diff --git a/compiled/facebook-www/REVISION b/compiled/facebook-www/REVISION index 8bec10254f085..84bfc1ac369e3 100644 --- a/compiled/facebook-www/REVISION +++ b/compiled/facebook-www/REVISION @@ -1 +1 @@ -3ac551e855f9bec3161da2fc8787958aa62113db +2e3e6a9b1cc97ec91248be74565e7ccbf6946067 diff --git a/compiled/facebook-www/ReactART-dev.classic.js b/compiled/facebook-www/ReactART-dev.classic.js index 076eb97ad68b1..ec42b43f2e056 100644 --- a/compiled/facebook-www/ReactART-dev.classic.js +++ b/compiled/facebook-www/ReactART-dev.classic.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-classic-52a43e30'; +var ReactVersion = '19.0.0-www-classic-53ce7a77'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -625,2960 +625,3022 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; -} -function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - var a = fiber; - var b = alternate; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - while (true) { - var parentA = a.return; + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - if (parentA === null) { - // We're at the root. - break; - } - var parentB = parentA.alternate; + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - if (parentA.child === parentB.child) { - var child = parentA.child; - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } - throw new Error('Unable to find node on an unmounted component.'); + return [null, null]; } + }; // $FlowFixMe[prop-missing] - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - _child = _child.sibling; - } + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - _child = _child.sibling; - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (!didFindChild) { - throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; } } - } - - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } - - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } - var child = node.child; + return _frame; + } + } while (s >= 1 && c >= 0); + } - while (child !== null) { - var match = findCurrentHostFiberImpl(child); + break; + } + } + } + } finally { + reentry = false; - if (match !== null) { - return match; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); } - child = child.sibling; - } + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. - return null; -} -function isFiberSuspenseAndTimedOut(fiber) { - var memoizedState = fiber.memoizedState; - return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; -} -function doesFiberContain(parentFiber, childFiber) { - var node = childFiber; - var parentFiberAlternate = parentFiber.alternate; + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - while (node !== null) { - if (node === parentFiber || node === parentFiberAlternate) { - return true; + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); } - - node = node.return; } - return false; + return syntheticFrame; } -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - -var TYPES = { - CLIPPING_RECTANGLE: 'ClippingRectangle', - GROUP: 'Group', - SHAPE: 'Shape', - TEXT: 'Text' -}; -var EVENT_TYPES = { - onClick: 'click', - onMouseMove: 'mousemove', - onMouseOver: 'mouseover', - onMouseOut: 'mouseout', - onMouseUp: 'mouseup', - onMouseDown: 'mousedown' -}; -function childrenAsString(children) { - if (!children) { - return ''; - } else if (typeof children === 'string') { - return children; - } else if (children.length) { - return children.join(''); - } else { - return ''; - } -} - -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler.unstable_cancelCallback; -var shouldYield = Scheduler.unstable_shouldYield; -var requestPaint = Scheduler.unstable_requestPaint; -var now$1 = Scheduler.unstable_now; -var ImmediatePriority = Scheduler.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler.unstable_NormalPriority; -var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* -// on scheduler/unstable_mock, which we'll need for internal testing +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); -var log$2 = Scheduler.log; -var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); -function disabledLog() {} + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } + case ClassComponent: + return describeClassComponentFrame(fiber.type); - disabledDepth++; + default: + return ''; } } -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} + do { + info += describeFiber(node); -var rendererID = null; -var injectedHook = null; -var injectedProfilingHooks = null; -var hasLoggedError = false; -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. + node = node.return; + } while (node); - return true; + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; } +} - try { - if (enableSchedulingProfiler) { - // Conditionally inject these hooks only if Timeline profiler is supported by this build. - // This gives DevTools a way to feature detect that isn't tied to version number - // (since profiling and timeline are controlled by different feature flags). - internals = assign({}, internals, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }); +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; } - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + var owner = current._debugOwner; - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); + if (owner != null) { + return getComponentNameFromOwner(owner); } } - if (hook.checkDCE) { - // This is the real DevTools. - return true; - } else { - // This is likely a hook installed by Fast Refresh runtime. - return false; - } + return null; } -function onScheduleRoot(root, children) { + +function getCurrentFiberStackInDev() { { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if (!hasLoggedError) { - hasLoggedError = true; + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. - error('React instrumentation encountered an error: %s', err); - } - } - } + + return getStackByFiberInDevAndProd(current); } } -function onCommitRoot(root, eventPriority) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; - - if (enableProfilerTimer) { - var schedulerPriority; - - switch (eventPriority) { - case DiscreteEventPriority: - schedulerPriority = ImmediatePriority; - break; - - case ContinuousEventPriority: - schedulerPriority = UserBlockingPriority; - break; - case DefaultEventPriority: - schedulerPriority = NormalPriority$1; - break; - - case IdleEventPriority: - schedulerPriority = IdlePriority; - break; - - default: - schedulerPriority = NormalPriority$1; - break; - } - - injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } -} -function onPostCommitRoot(root) { - if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { - try { - injectedHook.onPostCommitFiberRoot(rendererID, root); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); } } -function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); } } -function setIsStrictModeForDevtools(newIsStrictMode) { +function resetCurrentFiber() { { - if (typeof log$2 === 'function') { - // We're in a test because Scheduler.log only exists - // in SchedulerMock. To reduce the noise in strict mode tests, - // suppress warnings and disable scheduler yielding during the double render - unstable_setDisableYieldValue(newIsStrictMode); - setSuppressWarning(newIsStrictMode); - } - - if (injectedHook && typeof injectedHook.setStrictMode === 'function') { - try { - injectedHook.setStrictMode(rendererID, newIsStrictMode); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } - } + ReactSharedInternals.getCurrentStack = null; + isRendering = false; } -} // Profiler API hooks -function injectProfilingHooks(profilingHooks) { - injectedProfilingHooks = profilingHooks; + current = null; } - -function getLaneLabelMap() { - if (enableSchedulingProfiler) { - var map = new Map(); - var lane = 1; - - for (var index = 0; index < TotalLanes; index++) { - var label = getLabelForLane(lane); - map.set(lane, label); - lane *= 2; - } - - return map; - } else { - return null; +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; } -} -function markCommitStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { - injectedProfilingHooks.markCommitStarted(lanes); - } - } + current = fiber; } -function markCommitStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { - injectedProfilingHooks.markCommitStopped(); - } +function getCurrentFiber() { + { + return current; } } -function markComponentRenderStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { - injectedProfilingHooks.markComponentRenderStarted(fiber); - } +function setIsRendering(rendering) { + { + isRendering = rendering; } } -function markComponentRenderStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { - injectedProfilingHooks.markComponentRenderStopped(); + +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; + + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; + + do { + node = nextNode; + + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; } } + + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; } -function markComponentPassiveEffectMountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { - injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); - } - } +function isFiberMounted(fiber) { + return getNearestMountedFiber(fiber) === fiber; } -function markComponentPassiveEffectMountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { - injectedProfilingHooks.markComponentPassiveEffectMountStopped(); +function isMounted(component) { + { + var owner = current; + + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); + } + + instance._warnedAboutRefsInRender = true; } } -} -function markComponentPassiveEffectUnmountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { - injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); - } + + var fiber = get(component); + + if (!fiber) { + return false; } + + return getNearestMountedFiber(fiber) === fiber; } -function markComponentPassiveEffectUnmountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { - injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); - } + +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); } } -function markComponentLayoutEffectMountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { - injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); + + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); } - } -} -function markComponentLayoutEffectMountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { - injectedProfilingHooks.markComponentLayoutEffectMountStopped(); + + if (nearestMounted !== fiber) { + return null; } - } -} -function markComponentLayoutEffectUnmountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { - injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + + + var a = fiber; + var b = alternate; + + while (true) { + var parentA = a.return; + + if (parentA === null) { + // We're at the root. + break; } - } -} -function markComponentLayoutEffectUnmountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { - injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); - } - } -} -function markComponentErrored(fiber, thrownValue, lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { - injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); - } - } -} -function markComponentSuspended(fiber, wakeable, lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { - injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); + + var parentB = parentA.alternate; + + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. + + + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + + + if (parentA.child === parentB.child) { + var child = parentA.child; + + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + + + throw new Error('Unable to find node on an unmounted component.'); } - } -} -function markLayoutEffectsStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { - injectedProfilingHooks.markLayoutEffectsStarted(lanes); + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + } + } } - } -} -function markLayoutEffectsStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { - injectedProfilingHooks.markLayoutEffectsStopped(); + + if (a.alternate !== b) { + throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + + + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); } + + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. + + + return alternate; } -function markPassiveEffectsStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { - injectedProfilingHooks.markPassiveEffectsStarted(lanes); - } - } +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; } -function markPassiveEffectsStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { - injectedProfilingHooks.markPassiveEffectsStopped(); - } + +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; } -} -function markRenderStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { - injectedProfilingHooks.markRenderStarted(lanes); + + var child = node.child; + + while (child !== null) { + var match = findCurrentHostFiberImpl(child); + + if (match !== null) { + return match; } + + child = child.sibling; } + + return null; } -function markRenderYielded() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { - injectedProfilingHooks.markRenderYielded(); - } - } + +function isFiberSuspenseAndTimedOut(fiber) { + var memoizedState = fiber.memoizedState; + return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; } -function markRenderStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { - injectedProfilingHooks.markRenderStopped(); +function doesFiberContain(parentFiber, childFiber) { + var node = childFiber; + var parentFiberAlternate = parentFiber.alternate; + + while (node !== null) { + if (node === parentFiber || node === parentFiberAlternate) { + return true; } + + node = node.return; } + + return false; } -function markRenderScheduled(lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { - injectedProfilingHooks.markRenderScheduled(lane); - } - } + +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + +function isArray(a) { + return isArrayImpl(a); } -function markForceUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { - injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); - } + +var TYPES = { + CLIPPING_RECTANGLE: 'ClippingRectangle', + GROUP: 'Group', + SHAPE: 'Shape', + TEXT: 'Text' +}; +var EVENT_TYPES = { + onClick: 'click', + onMouseMove: 'mousemove', + onMouseOver: 'mouseover', + onMouseOut: 'mouseout', + onMouseUp: 'mouseup', + onMouseDown: 'mousedown' +}; +function childrenAsString(children) { + if (!children) { + return ''; + } else if (typeof children === 'string') { + return children; + } else if (children.length) { + return children.join(''); + } else { + return ''; } } -function markStateUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { - injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); - } - } -} - -var NoMode = -/* */ -0; // TODO: Remove ConcurrentMode by reading from the root tag instead -var ConcurrentMode = -/* */ -1; -var ProfileMode = -/* */ -2; -var DebugTracingMode = -/* */ -4; -var StrictLegacyMode = -/* */ -8; -var StrictEffectsMode = -/* */ -16; -var ConcurrentUpdatesByDefaultMode = -/* */ -32; -var NoStrictPassiveEffectsMode = -/* */ -64; +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now$1 = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* +// on scheduler/unstable_mock, which we'll need for internal testing -// TODO: This is pretty well supported by browsers. Maybe we can drop it. -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 +var log$2 = Scheduler.log; +var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; -var log$1 = Math.log; -var LN2 = Math.LN2; +var rendererID = null; +var injectedHook = null; +var injectedProfilingHooks = null; +var hasLoggedError = false; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // No DevTools + return false; + } -function clz32Fallback(x) { - var asUint = x >>> 0; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; - if (asUint === 0) { - return 32; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; } - return 31 - (log$1(asUint) / LN2 | 0) | 0; -} - -// If those values are changed that package should be rebuilt and redeployed. + if (!hook.supportsFiber) { + { + error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); + } // DevTools exists, even though it doesn't support Fiber. -var TotalLanes = 31; -var NoLanes = -/* */ -0; -var NoLane = -/* */ -0; -var SyncHydrationLane = -/* */ -1; -var SyncLane = -/* */ -2; -var SyncLaneIndex = 1; -var InputContinuousHydrationLane = -/* */ -4; -var InputContinuousLane = -/* */ -8; -var DefaultHydrationLane = -/* */ -16; -var DefaultLane = -/* */ -32; -var SyncUpdateLanes = enableUnifiedSyncLane ? SyncLane | InputContinuousLane | DefaultLane : SyncLane; -var TransitionHydrationLane = -/* */ -64; -var TransitionLanes = -/* */ -4194176; -var TransitionLane1 = -/* */ -128; -var TransitionLane2 = -/* */ -256; -var TransitionLane3 = -/* */ -512; -var TransitionLane4 = -/* */ -1024; -var TransitionLane5 = -/* */ -2048; -var TransitionLane6 = -/* */ -4096; -var TransitionLane7 = -/* */ -8192; -var TransitionLane8 = -/* */ -16384; -var TransitionLane9 = -/* */ -32768; -var TransitionLane10 = -/* */ -65536; -var TransitionLane11 = -/* */ -131072; -var TransitionLane12 = -/* */ -262144; -var TransitionLane13 = -/* */ -524288; -var TransitionLane14 = -/* */ -1048576; -var TransitionLane15 = -/* */ -2097152; -var RetryLanes = -/* */ -62914560; -var RetryLane1 = -/* */ -4194304; -var RetryLane2 = -/* */ -8388608; -var RetryLane3 = -/* */ -16777216; -var RetryLane4 = -/* */ -33554432; -var SomeRetryLane = RetryLane1; -var SelectiveHydrationLane = -/* */ -67108864; -var NonIdleLanes = -/* */ -134217727; -var IdleHydrationLane = -/* */ -134217728; -var IdleLane = -/* */ -268435456; -var OffscreenLane = -/* */ -536870912; -var DeferredLane = -/* */ -1073741824; // Any lane that might schedule an update. This is used to detect infinite -// update loops, so it doesn't include hydration lanes or retries. -var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) -// It should be kept in sync with the Lanes values above. + return true; + } -function getLabelForLane(lane) { - if (enableSchedulingProfiler) { - if (lane & SyncHydrationLane) { - return 'SyncHydrationLane'; + try { + if (enableSchedulingProfiler) { + // Conditionally inject these hooks only if Timeline profiler is supported by this build. + // This gives DevTools a way to feature detect that isn't tied to version number + // (since profiling and timeline are controlled by different feature flags). + internals = assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }); } - if (lane & SyncLane) { - return 'Sync'; - } + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. - if (lane & InputContinuousHydrationLane) { - return 'InputContinuousHydration'; + injectedHook = hook; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + error('React instrumentation encountered an error: %s.', err); } + } - if (lane & InputContinuousLane) { - return 'InputContinuous'; - } + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; + } +} +function onScheduleRoot(root, children) { + { + if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { + try { + injectedHook.onScheduleFiberRoot(rendererID, root, children); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; - if (lane & DefaultHydrationLane) { - return 'DefaultHydration'; + error('React instrumentation encountered an error: %s', err); + } + } } + } +} +function onCommitRoot(root, eventPriority) { + if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { + try { + var didError = (root.current.flags & DidCapture) === DidCapture; - if (lane & DefaultLane) { - return 'Default'; - } + if (enableProfilerTimer) { + var schedulerPriority; - if (lane & TransitionHydrationLane) { - return 'TransitionHydration'; - } - - if (lane & TransitionLanes) { - return 'Transition'; - } + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; - if (lane & RetryLanes) { - return 'Retry'; - } + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; - if (lane & SelectiveHydrationLane) { - return 'SelectiveHydration'; - } + case DefaultEventPriority: + schedulerPriority = NormalPriority$1; + break; - if (lane & IdleHydrationLane) { - return 'IdleHydration'; - } + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; - if (lane & IdleLane) { - return 'Idle'; - } + default: + schedulerPriority = NormalPriority$1; + break; + } - if (lane & OffscreenLane) { - return 'Offscreen'; - } + injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); + } + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - if (lane & DeferredLane) { - return 'Deferred'; + error('React instrumentation encountered an error: %s', err); + } + } } } } -var NoTimestamp = -1; -var nextTransitionLane = TransitionLane1; -var nextRetryLane = RetryLane1; - -function getHighestPriorityLanes(lanes) { - if (enableUnifiedSyncLane) { - var pendingSyncLanes = lanes & SyncUpdateLanes; +function onPostCommitRoot(root) { + if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { + try { + injectedHook.onPostCommitFiberRoot(rendererID, root); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - if (pendingSyncLanes !== 0) { - return pendingSyncLanes; + error('React instrumentation encountered an error: %s', err); + } + } } } - - switch (getHighestPriorityLane(lanes)) { - case SyncHydrationLane: - return SyncHydrationLane; - - case SyncLane: - return SyncLane; - - case InputContinuousHydrationLane: - return InputContinuousHydrationLane; - - case InputContinuousLane: - return InputContinuousLane; - - case DefaultHydrationLane: - return DefaultHydrationLane; - - case DefaultLane: - return DefaultLane; - - case TransitionHydrationLane: - return TransitionHydrationLane; - - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return lanes & TransitionLanes; - - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - return lanes & RetryLanes; - - case SelectiveHydrationLane: - return SelectiveHydrationLane; - - case IdleHydrationLane: - return IdleHydrationLane; - - case IdleLane: - return IdleLane; - - case OffscreenLane: - return OffscreenLane; - - case DeferredLane: - // This shouldn't be reachable because deferred work is always entangled - // with something else. - return NoLanes; - - default: +} +function onCommitUnmount(fiber) { + if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { + try { + injectedHook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - + if (!hasLoggedError) { + hasLoggedError = true; - return lanes; + error('React instrumentation encountered an error: %s', err); + } + } + } } } +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (typeof log$2 === 'function') { + // We're in a test because Scheduler.log only exists + // in SchedulerMock. To reduce the noise in strict mode tests, + // suppress warnings and disable scheduler yielding during the double render + unstable_setDisableYieldValue(newIsStrictMode); + setSuppressWarning(newIsStrictMode); + } -function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; + if (injectedHook && typeof injectedHook.setStrictMode === 'function') { + try { + injectedHook.setStrictMode(rendererID, newIsStrictMode); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - if (pendingLanes === NoLanes) { - return NoLanes; + error('React instrumentation encountered an error: %s', err); + } + } + } + } } +} // Profiler API hooks - var nextLanes = NoLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; +function getLaneLabelMap() { + if (enableSchedulingProfiler) { + var map = new Map(); + var lane = 1; - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - } + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; } + + return map; } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; + return null; + } +} - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - } +function markCommitStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { + injectedProfilingHooks.markCommitStarted(lanes); } } - - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. - - - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - var nextLane = getHighestPriorityLane(nextLanes); - var wipLane = getHighestPriorityLane(wipLanes); - - if ( // Tests whether the next lane is equal or lower priority than the wip - // one. This works because the bits decrease in priority as you go left. - nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The - // only difference between default updates and transition updates is that - // default updates do not support refresh transitions. - nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { - // Keep working on the existing in-progress tree. Do not interrupt. - return wipLanes; +} +function markCommitStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { + injectedProfilingHooks.markCommitStopped(); } } - - return nextLanes; } -function getEntangledLanes(root, renderLanes) { - var entangledLanes = renderLanes; - - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { - // When updates are sync by default, we entangle continuous priority updates - // and default updates, so they render in the same batch. The only reason - // they use separate lanes is because continuous updates should interrupt - // transitions, but default updates should not. - entangledLanes |= entangledLanes & DefaultLane; - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // TODO: Reconsider this. The counter-argument is that the partial work - // represents an intermediate state, which we don't want to show to the user. - // And by spending extra time finishing it, we're increasing the amount of - // time it takes to show the final state, which is what they are actually - // waiting for. - // - // For those exceptions where entanglement is semantically important, - // we should ensure that there is no partial work at the - // time we apply the entanglement. - - - var allEntangledLanes = root.entangledLanes; - - if (allEntangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = entangledLanes & allEntangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entangledLanes |= entanglements[index]; - lanes &= ~lane; +function markComponentRenderStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { + injectedProfilingHooks.markComponentRenderStarted(fiber); } } - - return entangledLanes; } - -function computeExpirationTime(lane, currentTime) { - switch (lane) { - case SyncHydrationLane: - case SyncLane: - case InputContinuousHydrationLane: - case InputContinuousLane: - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. - // When we made it larger, a product metric in www regressed, suggesting - // there's a user interaction that's being starved by a series of - // synchronous updates. If that theory is correct, the proper solution is - // to fix the starvation. However, this scenario supports the idea that - // expiration times are an important safeguard when starvation - // does happen. - return currentTime + syncLaneExpirationMs; - - case DefaultHydrationLane: - case DefaultLane: - case TransitionHydrationLane: - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return currentTime + transitionLaneExpirationMs; - - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - // TODO: Retries should be allowed to expire if they are CPU bound for - // too long, but when I made this change it caused a spike in browser - // crashes. There must be some other underlying bug; not super urgent but - // ideally should figure out why and fix it. Unfortunately we don't have - // a repro for the crashes, only detected via production metrics. - return enableRetryLaneExpiration ? currentTime + retryLaneExpirationMs : NoTimestamp; - - case SelectiveHydrationLane: - case IdleHydrationLane: - case IdleLane: - case OffscreenLane: - case DeferredLane: - // Anything idle priority or lower should never expire. - return NoTimestamp; - - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } - - return NoTimestamp; +function markComponentRenderStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { + injectedProfilingHooks.markComponentRenderStopped(); + } } } - -function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - // TODO: We should be able to replace this with upgradePendingLanesToSync - // - // We exclude retry lanes because those must always be time sliced, in order - // to unwrap uncached promises. - // TODO: Write a test for this - - var lanes = enableRetryLaneExpiration ? pendingLanes : pendingLanes & ~RetryLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; - - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; +function markComponentPassiveEffectMountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { + injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); } - - lanes &= ~lane; - } -} // This returns the highest priority pending lanes regardless of whether they -function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { - if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { - // The error recovery mechanism is disabled until these lanes are cleared. - return NoLanes; } - - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; +} +function markComponentPassiveEffectMountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { + injectedProfilingHooks.markComponentPassiveEffectMountStopped(); + } } - - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; +} +function markComponentPassiveEffectUnmountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); + } } - - return NoLanes; } -function includesSyncLane(lanes) { - return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; +function markComponentPassiveEffectUnmountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); + } + } } -function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; +function markComponentLayoutEffectMountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { + injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); + } + } } -function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; +function markComponentLayoutEffectMountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); + } + } } -function includesOnlyNonUrgentLanes(lanes) { - // TODO: Should hydration lanes be included here? This function is only - // used in `updateDeferredValueImpl`. - var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; - return (lanes & UrgentLanes) === NoLanes; +function markComponentLayoutEffectUnmountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + } + } } -function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; +function markComponentLayoutEffectUnmountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); + } + } } -function includesBlockingLane(root, lanes) { - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { - // Concurrent updates by default always use time slicing. - return false; +function markComponentErrored(fiber, thrownValue, lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { + injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); + } } - - var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; - return (lanes & SyncDefaultLanes) !== NoLanes; } -function includesExpiredLane(root, lanes) { - // This is a separate check from includesBlockingLane because a lane can - // expire after a render has already started. - return (lanes & root.expiredLanes) !== NoLanes; +function markComponentSuspended(fiber, wakeable, lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { + injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); + } + } } -function isTransitionLane(lane) { - return (lane & TransitionLanes) !== NoLanes; +function markLayoutEffectsStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { + injectedProfilingHooks.markLayoutEffectsStarted(lanes); + } + } } -function claimNextTransitionLane() { - // Cycle through the lanes, assigning each new transition to the next lane. - // In most cases, this means every transition gets its own lane, until we - // run out of lanes and cycle back to the beginning. - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - - if ((nextTransitionLane & TransitionLanes) === NoLanes) { - nextTransitionLane = TransitionLane1; +function markLayoutEffectsStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { + injectedProfilingHooks.markLayoutEffectsStopped(); + } } - - return lane; } -function claimNextRetryLane() { - var lane = nextRetryLane; - nextRetryLane <<= 1; - - if ((nextRetryLane & RetryLanes) === NoLanes) { - nextRetryLane = RetryLane1; +function markPassiveEffectsStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + } } - - return lane; } -function getHighestPriorityLane(lanes) { - return lanes & -lanes; +function markPassiveEffectsStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { + injectedProfilingHooks.markPassiveEffectsStopped(); + } + } } -function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); +function markRenderStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { + injectedProfilingHooks.markRenderStarted(lanes); + } + } +} +function markRenderYielded() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { + injectedProfilingHooks.markRenderYielded(); + } + } +} +function markRenderStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { + injectedProfilingHooks.markRenderStopped(); + } + } +} +function markRenderScheduled(lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { + injectedProfilingHooks.markRenderScheduled(lane); + } + } +} +function markForceUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } +} +function markStateUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + } } -function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); +var NoMode = +/* */ +0; // TODO: Remove ConcurrentMode by reading from the root tag instead + +var ConcurrentMode = +/* */ +1; +var ProfileMode = +/* */ +2; +var DebugTracingMode = +/* */ +4; +var StrictLegacyMode = +/* */ +8; +var StrictEffectsMode = +/* */ +16; +var ConcurrentUpdatesByDefaultMode = +/* */ +32; +var NoStrictPassiveEffectsMode = +/* */ +64; + +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +var log$1 = Math.log; +var LN2 = Math.LN2; + +function clz32Fallback(x) { + var asUint = x >>> 0; + + if (asUint === 0) { + return 32; + } + + return 31 - (log$1(asUint) / LN2 | 0) | 0; } -function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); -} +// If those values are changed that package should be rebuilt and redeployed. + +var TotalLanes = 31; +var NoLanes = +/* */ +0; +var NoLane = +/* */ +0; +var SyncHydrationLane = +/* */ +1; +var SyncLane = +/* */ +2; +var SyncLaneIndex = 1; +var InputContinuousHydrationLane = +/* */ +4; +var InputContinuousLane = +/* */ +8; +var DefaultHydrationLane = +/* */ +16; +var DefaultLane = +/* */ +32; +var SyncUpdateLanes = enableUnifiedSyncLane ? SyncLane | InputContinuousLane | DefaultLane : SyncLane; +var TransitionHydrationLane = +/* */ +64; +var TransitionLanes = +/* */ +4194176; +var TransitionLane1 = +/* */ +128; +var TransitionLane2 = +/* */ +256; +var TransitionLane3 = +/* */ +512; +var TransitionLane4 = +/* */ +1024; +var TransitionLane5 = +/* */ +2048; +var TransitionLane6 = +/* */ +4096; +var TransitionLane7 = +/* */ +8192; +var TransitionLane8 = +/* */ +16384; +var TransitionLane9 = +/* */ +32768; +var TransitionLane10 = +/* */ +65536; +var TransitionLane11 = +/* */ +131072; +var TransitionLane12 = +/* */ +262144; +var TransitionLane13 = +/* */ +524288; +var TransitionLane14 = +/* */ +1048576; +var TransitionLane15 = +/* */ +2097152; +var RetryLanes = +/* */ +62914560; +var RetryLane1 = +/* */ +4194304; +var RetryLane2 = +/* */ +8388608; +var RetryLane3 = +/* */ +16777216; +var RetryLane4 = +/* */ +33554432; +var SomeRetryLane = RetryLane1; +var SelectiveHydrationLane = +/* */ +67108864; +var NonIdleLanes = +/* */ +134217727; +var IdleHydrationLane = +/* */ +134217728; +var IdleLane = +/* */ +268435456; +var OffscreenLane = +/* */ +536870912; +var DeferredLane = +/* */ +1073741824; // Any lane that might schedule an update. This is used to detect infinite +// update loops, so it doesn't include hydration lanes or retries. + +var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) +// It should be kept in sync with the Lanes values above. + +function getLabelForLane(lane) { + if (enableSchedulingProfiler) { + if (lane & SyncHydrationLane) { + return 'SyncHydrationLane'; + } + + if (lane & SyncLane) { + return 'Sync'; + } + + if (lane & InputContinuousHydrationLane) { + return 'InputContinuousHydration'; + } + + if (lane & InputContinuousLane) { + return 'InputContinuous'; + } + + if (lane & DefaultHydrationLane) { + return 'DefaultHydration'; + } + + if (lane & DefaultLane) { + return 'Default'; + } + + if (lane & TransitionHydrationLane) { + return 'TransitionHydration'; + } + + if (lane & TransitionLanes) { + return 'Transition'; + } + + if (lane & RetryLanes) { + return 'Retry'; + } -function includesSomeLane(a, b) { - return (a & b) !== NoLanes; -} -function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; -} -function mergeLanes(a, b) { - return a | b; -} -function removeLanes(set, subset) { - return set & ~subset; -} -function intersectLanes(a, b) { - return a & b; -} // Seems redundant, but it changes the type from a single lane (used for -// updates) to a group of lanes (used for flushing work). + if (lane & SelectiveHydrationLane) { + return 'SelectiveHydration'; + } -function laneToLanes(lane) { - return lane; -} -function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; + if (lane & IdleHydrationLane) { + return 'IdleHydration'; + } - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); - } + if (lane & IdleLane) { + return 'Idle'; + } - return laneMap; -} -function markRootUpdated$1(root, updateLane) { - root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update - // could unblock them. Clear the suspended lanes so that we can try rendering - // them again. - // - // TODO: We really only need to unsuspend only lanes that are in the - // `subtreeLanes` of the updated fiber, or the update lanes of the return - // path. This would exclude suspended updates in an unrelated sibling tree, - // since there's no way for this update to unblock it. - // - // We don't do this if the incoming update is idle, because we never process - // idle updates until after all the regular updates have finished; there's no - // way it could unblock a transition. + if (lane & OffscreenLane) { + return 'Offscreen'; + } - if (updateLane !== IdleLane) { - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; + if (lane & DeferredLane) { + return 'Deferred'; + } } } -function markRootSuspended$1(root, suspendedLanes, spawnedLane) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. +var NoTimestamp = -1; +var nextTransitionLane = TransitionLane1; +var nextRetryLane = RetryLane1; - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; +function getHighestPriorityLanes(lanes) { + if (enableUnifiedSyncLane) { + var pendingSyncLanes = lanes & SyncUpdateLanes; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; + if (pendingSyncLanes !== 0) { + return pendingSyncLanes; + } } - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); - } -} -function markRootPinged$1(root, pingedLanes) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; -} -function markRootFinished(root, remainingLanes, spawnedLane) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again + switch (getHighestPriorityLane(lanes)) { + case SyncHydrationLane: + return SyncHydrationLane; - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - root.expiredLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - root.errorRecoveryDisabledLanes &= remainingLanes; - root.shellSuspendCounter = 0; - var entanglements = root.entanglements; - var expirationTimes = root.expirationTimes; - var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work + case SyncLane: + return SyncLane; - var lanes = noLongerPendingLanes; + case InputContinuousHydrationLane: + return InputContinuousHydrationLane; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - expirationTimes[index] = NoTimestamp; - var hiddenUpdatesForLane = hiddenUpdates[index]; + case InputContinuousLane: + return InputContinuousLane; - if (hiddenUpdatesForLane !== null) { - hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They - // have special logic associated with them because they may be entangled - // with updates that occur outside that tree. But once the outer tree - // commits, they behave like regular updates. + case DefaultHydrationLane: + return DefaultHydrationLane; - for (var i = 0; i < hiddenUpdatesForLane.length; i++) { - var update = hiddenUpdatesForLane[i]; + case DefaultLane: + return DefaultLane; - if (update !== null) { - update.lane &= ~OffscreenLane; - } - } - } + case TransitionHydrationLane: + return TransitionHydrationLane; - lanes &= ~lane; - } + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return lanes & TransitionLanes; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need - // to entangle the spawned task with the parent task. - NoLanes); - } -} + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + return lanes & RetryLanes; -function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { - // This render spawned a deferred task. Mark it as pending. - root.pendingLanes |= spawnedLane; - root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it - // was the result of another render. This lets us avoid a useDeferredValue - // waterfall — only the first level will defer. + case SelectiveHydrationLane: + return SelectiveHydrationLane; - var spawnedLaneIndex = laneToIndex(spawnedLane); - root.entangledLanes |= spawnedLane; - root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes - // with the spawned task, so that the deferred task includes all the same - // updates that the parent task did. We can exclude any lane that is not - // used for updates (e.g. Offscreen). - entangledLanes & UpdateLanes; -} + case IdleHydrationLane: + return IdleHydrationLane; -function markRootEntangled(root, entangledLanes) { - // In addition to entangling each of the given lanes with each other, we also - // have to consider _transitive_ entanglements. For each lane that is already - // entangled with *any* of the given lanes, that lane is now transitively - // entangled with *all* the given lanes. - // - // Translated: If C is entangled with A, then entangling A with B also - // entangles C with B. - // - // If this is hard to grasp, it might help to intentionally break this - // function and look at the tests that fail in ReactTransition-test.js. Try - // commenting out one of the conditions below. - var rootEntangledLanes = root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = rootEntangledLanes; + case IdleLane: + return IdleLane; - while (lanes) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; + case OffscreenLane: + return OffscreenLane; - if ( // Is this one of the newly entangled lanes? - lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? - entanglements[index] & entangledLanes) { - entanglements[index] |= entangledLanes; - } + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; - lanes &= ~lane; - } -} -function upgradePendingLaneToSync(root, lane) { - // Since we're upgrading the priority of the given lane, there is now pending - // sync work. - root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane - // will not be allowed to finish without also finishing the given lane. + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - root.entangledLanes |= SyncLane; - root.entanglements[SyncLaneIndex] |= lane; -} -function markHiddenUpdate(root, update, lane) { - var index = laneToIndex(lane); - var hiddenUpdates = root.hiddenUpdates; - var hiddenUpdatesForLane = hiddenUpdates[index]; - if (hiddenUpdatesForLane === null) { - hiddenUpdates[index] = [update]; - } else { - hiddenUpdatesForLane.push(update); + return lanes; } +} - update.lane = lane | OffscreenLane; -} -function getBumpedLaneForHydration(root, renderLanes) { - var renderLane = getHighestPriorityLane(renderLanes); - var lane; - - if (enableUnifiedSyncLane && (renderLane & SyncUpdateLanes) !== NoLane) { - lane = SyncHydrationLane; - } else { - switch (renderLane) { - case SyncLane: - lane = SyncHydrationLane; - break; - - case InputContinuousLane: - lane = InputContinuousHydrationLane; - break; +function getNextLanes(root, wipLanes) { + // Early bailout if there's no pending work left. + var pendingLanes = root.pendingLanes; - case DefaultLane: - lane = DefaultHydrationLane; - break; + if (pendingLanes === NoLanes) { + return NoLanes; + } - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - lane = TransitionHydrationLane; - break; + var nextLanes = NoLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - case IdleLane: - lane = IdleHydrationLane; - break; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - default: - // Everything else is already either a hydration lane, or shouldn't - // be retried at a hydration lane. - lane = NoLane; - break; - } - } // Check if the lane we chose is suspended. If so, that indicates that we - // already attempted and failed to hydrate at that level. Also check if we're - // already rendering that lane, which is rare but could happen. + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { - // Give up trying to hydrate and fall back to client render. - return NoLane; + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); + } + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; + + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); + } + } } - return lane; -} -function addFiberToLanesMap(root, fiber, lanes) { + if (nextLanes === NoLanes) { + // This should only be reachable if we're suspended + // TODO: Consider warning in this path if a fallback timer is not scheduled. + return NoLanes; + } // If we're already in the middle of a render, switching lanes will interrupt + // it and we'll lose our progress. We should only do this if the new lanes are + // higher priority. - if (!isDevToolsPresent) { - return; - } - var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; + if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't + // bother waiting until the root is complete. + (wipLanes & suspendedLanes) === NoLanes) { + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var updaters = pendingUpdatersLaneMap[index]; - updaters.add(fiber); - lanes &= ~lane; + if ( // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The + // only difference between default updates and transition updates is that + // default updates do not support refresh transitions. + nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { + // Keep working on the existing in-progress tree. Do not interrupt. + return wipLanes; + } } + + return nextLanes; } -function movePendingFibersToMemoized(root, lanes) { +function getEntangledLanes(root, renderLanes) { + var entangledLanes = renderLanes; - if (!isDevToolsPresent) { - return; - } + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { + // When updates are sync by default, we entangle continuous priority updates + // and default updates, so they render in the same batch. The only reason + // they use separate lanes is because continuous updates should interrupt + // transitions, but default updates should not. + entangledLanes |= entangledLanes & DefaultLane; + } // Check for entangled lanes and add them to the batch. + // + // A lane is said to be entangled with another when it's not allowed to render + // in a batch that does not also include the other lane. Typically we do this + // when multiple updates have the same source, and we only want to respond to + // the most recent event from that source. + // + // Note that we apply entanglements *after* checking for partial work above. + // This means that if a lane is entangled during an interleaved event while + // it's already rendering, we won't interrupt it. This is intentional, since + // entanglement is usually "best effort": we'll try our best to render the + // lanes in the same batch, but it's not worth throwing out partially + // completed work in order to do it. + // TODO: Reconsider this. The counter-argument is that the partial work + // represents an intermediate state, which we don't want to show to the user. + // And by spending extra time finishing it, we're increasing the amount of + // time it takes to show the final state, which is what they are actually + // waiting for. + // + // For those exceptions where entanglement is semantically important, + // we should ensure that there is no partial work at the + // time we apply the entanglement. - var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; - var memoizedUpdaters = root.memoizedUpdaters; - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var updaters = pendingUpdatersLaneMap[index]; + var allEntangledLanes = root.entangledLanes; - if (updaters.size > 0) { - updaters.forEach(function (fiber) { - var alternate = fiber.alternate; + if (allEntangledLanes !== NoLanes) { + var entanglements = root.entanglements; + var lanes = entangledLanes & allEntangledLanes; - if (alternate === null || !memoizedUpdaters.has(alternate)) { - memoizedUpdaters.add(fiber); - } - }); - updaters.clear(); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entangledLanes |= entanglements[index]; + lanes &= ~lane; } - - lanes &= ~lane; } + + return entangledLanes; } -function addTransitionToLanesMap(root, transition, lane) { - if (enableTransitionTracing) { - var transitionLanesMap = root.transitionLanes; - var index = laneToIndex(lane); - var transitions = transitionLanesMap[index]; - if (transitions === null) { - transitions = new Set(); - } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case SyncHydrationLane: + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + syncLaneExpirationMs; - transitions.add(transition); - transitionLanesMap[index] = transitions; + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return currentTime + transitionLaneExpirationMs; + + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + // TODO: Retries should be allowed to expire if they are CPU bound for + // too long, but when I made this change it caused a spike in browser + // crashes. There must be some other underlying bug; not super urgent but + // ideally should figure out why and fix it. Unfortunately we don't have + // a repro for the crashes, only detected via production metrics. + return enableRetryLaneExpiration ? currentTime + retryLaneExpirationMs : NoTimestamp; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + case DeferredLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; + + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } + + return NoTimestamp; } } -function getTransitionsForLanes(root, lanes) { - if (!enableTransitionTracing) { - return null; - } - var transitionsForLanes = []; +function markStarvedLanesAsExpired(root, currentTime) { + // TODO: This gets called every time we yield. We can optimize by storing + // the earliest expiration time on the root. Then use that to quickly bail out + // of this function. + var pendingLanes = root.pendingLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; + var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their + // expiration time. If so, we'll assume the update is being starved and mark + // it as expired to force it to finish. + // TODO: We should be able to replace this with upgradePendingLanesToSync + // + // We exclude retry lanes because those must always be time sliced, in order + // to unwrap uncached promises. + // TODO: Write a test for this + + var lanes = enableRetryLaneExpiration ? pendingLanes : pendingLanes & ~RetryLanes; while (lanes > 0) { - var index = laneToIndex(lanes); + var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; - var transitions = root.transitionLanes[index]; + var expirationTime = expirationTimes[index]; - if (transitions !== null) { - transitions.forEach(function (transition) { - transitionsForLanes.push(transition); - }); + if (expirationTime === NoTimestamp) { + // Found a pending lane with no expiration time. If it's not suspended, or + // if it's pinged, assume it's CPU-bound. Compute a new expiration time + // using the current time. + if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { + // Assumes timestamps are monotonically increasing. + expirationTimes[index] = computeExpirationTime(lane, currentTime); + } + } else if (expirationTime <= currentTime) { + // This lane expired + root.expiredLanes |= lane; } lanes &= ~lane; } - - if (transitionsForLanes.length === 0) { - return null; - } - - return transitionsForLanes; -} -function clearTransitionsForLanes(root, lanes) { - if (!enableTransitionTracing) { - return; +} // This returns the highest priority pending lanes regardless of whether they +function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { + if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { + // The error recovery mechanism is disabled until these lanes are cleared. + return NoLanes; } - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var transitions = root.transitionLanes[index]; + var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - if (transitions !== null) { - root.transitionLanes[index] = null; - } + if (everythingButOffscreen !== NoLanes) { + return everythingButOffscreen; + } - lanes &= ~lane; + if (everythingButOffscreen & OffscreenLane) { + return OffscreenLane; } -} -var NoEventPriority = NoLane; -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; + return NoLanes; } -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; +function includesSyncLane(lanes) { + return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; } -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; +function includesNonIdleWork(lanes) { + return (lanes & NonIdleLanes) !== NoLanes; } -function eventPriorityToLane(updatePriority) { - return updatePriority; +function includesOnlyRetries(lanes) { + return (lanes & RetryLanes) === lanes; } -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); - - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } - - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; +function includesOnlyNonUrgentLanes(lanes) { + // TODO: Should hydration lanes be included here? This function is only + // used in `updateDeferredValueImpl`. + var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; + return (lanes & UrgentLanes) === NoLanes; +} +function includesOnlyTransitions(lanes) { + return (lanes & TransitionLanes) === lanes; +} +function includesBlockingLane(root, lanes) { + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { + // Concurrent updates by default always use time slicing. + return false; } - return IdleEventPriority; + var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; + return (lanes & SyncDefaultLanes) !== NoLanes; } +function includesExpiredLane(root, lanes) { + // This is a separate check from includesBlockingLane because a lane can + // expire after a render has already started. + return (lanes & root.expiredLanes) !== NoLanes; +} +function isTransitionLane(lane) { + return (lane & TransitionLanes) !== NoLanes; +} +function claimNextTransitionLane() { + // Cycle through the lanes, assigning each new transition to the next lane. + // In most cases, this means every transition gets its own lane, until we + // run out of lanes and cycle back to the beginning. + var lane = nextTransitionLane; + nextTransitionLane <<= 1; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim$2() { - throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Hydration (when unsupported) - - -var supportsHydration = false; -var isSuspenseInstancePending = shim$2; -var isSuspenseInstanceFallback = shim$2; -var getSuspenseInstanceFallbackErrorDetails = shim$2; -var registerSuspenseInstanceRetry = shim$2; -var clearSuspenseBoundary = shim$2; -var clearSuspenseBoundaryFromContainer = shim$2; - -// Renderers that don't support React Scopes -// can re-export everything from this module. -function shim$1() { - throw new Error('The current renderer does not support React Scopes. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // React Scopes (when unsupported) - - -var prepareScopeUpdate = shim$1; -var getInstanceFromScope = shim$1; - -// Renderers that don't support hydration -// can re-export everything from this module. -function shim() { - throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Resources (when unsupported) -var preloadResource = shim; -var suspendResource = shim; - -var pooledTransform = new Transform(); -var NO_CONTEXT = {}; + if ((nextTransitionLane & TransitionLanes) === NoLanes) { + nextTransitionLane = TransitionLane1; + } -{ - Object.freeze(NO_CONTEXT); + return lane; } -/** Helper Methods */ - +function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; -function addEventListeners(instance, type, listener) { - // We need to explicitly unregister before unmount. - // For this reason we need to track subscriptions. - if (!instance._listeners) { - instance._listeners = {}; - instance._subscriptions = {}; + if ((nextRetryLane & RetryLanes) === NoLanes) { + nextRetryLane = RetryLane1; } - instance._listeners[type] = listener; + return lane; +} +function getHighestPriorityLane(lanes) { + return lanes & -lanes; +} +function pickArbitraryLane(lanes) { + // This wrapper function gets inlined. Only exists so to communicate that it + // doesn't matter which bit is selected; you can pick any bit without + // affecting the algorithms where its used. Here I'm using + // getHighestPriorityLane because it requires the fewest operations. + return getHighestPriorityLane(lanes); +} - if (listener) { - if (!instance._subscriptions[type]) { - instance._subscriptions[type] = instance.subscribe(type, createEventHandler(instance), instance); - } - } else { - if (instance._subscriptions[type]) { - instance._subscriptions[type](); +function pickArbitraryLaneIndex(lanes) { + return 31 - clz32(lanes); +} - delete instance._subscriptions[type]; - } - } +function laneToIndex(lane) { + return pickArbitraryLaneIndex(lane); } -function createEventHandler(instance) { - return function handleEvent(event) { - var listener = instance._listeners[event.type]; +function includesSomeLane(a, b) { + return (a & b) !== NoLanes; +} +function isSubsetOfLanes(set, subset) { + return (set & subset) === subset; +} +function mergeLanes(a, b) { + return a | b; +} +function removeLanes(set, subset) { + return set & ~subset; +} +function intersectLanes(a, b) { + return a & b; +} // Seems redundant, but it changes the type from a single lane (used for +// updates) to a group of lanes (used for flushing work). - if (!listener) ; else if (typeof listener === 'function') { - listener.call(instance, event); - } else if (listener.handleEvent) { - listener.handleEvent(event); - } - }; +function laneToLanes(lane) { + return lane; } +function createLaneMap(initial) { + // Intentionally pushing one by one. + // https://v8.dev/blog/elements-kinds#avoid-creating-holes + var laneMap = []; -function destroyEventListeners(instance) { - if (instance._subscriptions) { - for (var type in instance._subscriptions) { - instance._subscriptions[type](); - } + for (var i = 0; i < TotalLanes; i++) { + laneMap.push(initial); } - instance._subscriptions = null; - instance._listeners = null; + return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update + // could unblock them. Clear the suspended lanes so that we can try rendering + // them again. + // + // TODO: We really only need to unsuspend only lanes that are in the + // `subtreeLanes` of the updated fiber, or the update lanes of the return + // path. This would exclude suspended updates in an unrelated sibling tree, + // since there's no way for this update to unblock it. + // + // We don't do this if the incoming update is idle, because we never process + // idle updates until after all the regular updates have finished; there's no + // way it could unblock a transition. -function getScaleX(props) { - if (props.scaleX != null) { - return props.scaleX; - } else if (props.scale != null) { - return props.scale; - } else { - return 1; + if (updateLane !== IdleLane) { + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; } } +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. -function getScaleY(props) { - if (props.scaleY != null) { - return props.scaleY; - } else if (props.scale != null) { - return props.scale; - } else { - return 1; + var expirationTimes = root.expirationTimes; + var lanes = suspendedLanes; + + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + expirationTimes[index] = NoTimestamp; + lanes &= ~lane; } -} -function isSameFont(oldFont, newFont) { - if (oldFont === newFont) { - return true; - } else if (typeof newFont === 'string' || typeof oldFont === 'string') { - return false; - } else { - return newFont.fontSize === oldFont.fontSize && newFont.fontStyle === oldFont.fontStyle && newFont.fontVariant === oldFont.fontVariant && newFont.fontWeight === oldFont.fontWeight && newFont.fontFamily === oldFont.fontFamily; + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } } -/** Render Methods */ +function markRootPinged$1(root, pingedLanes) { + root.pingedLanes |= root.suspendedLanes & pingedLanes; +} +function markRootFinished(root, remainingLanes, spawnedLane) { + var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; + root.pendingLanes = remainingLanes; // Let's try everything again + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements; + var expirationTimes = root.expirationTimes; + var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work -function applyClippingRectangleProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); - instance.width = props.width; - instance.height = props.height; -} + var lanes = noLongerPendingLanes; -function applyGroupProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); - instance.width = props.width; - instance.height = props.height; -} + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entanglements[index] = NoLanes; + expirationTimes[index] = NoTimestamp; + var hiddenUpdatesForLane = hiddenUpdates[index]; -function applyNodeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var scaleX = getScaleX(props); - var scaleY = getScaleY(props); - pooledTransform.transformTo(1, 0, 0, 1, 0, 0).move(props.x || 0, props.y || 0).rotate(props.rotation || 0, props.originX, props.originY).scale(scaleX, scaleY, props.originX, props.originY); + if (hiddenUpdatesForLane !== null) { + hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They + // have special logic associated with them because they may be entangled + // with updates that occur outside that tree. But once the outer tree + // commits, they behave like regular updates. - if (props.transform != null) { - pooledTransform.transform(props.transform); - } + for (var i = 0; i < hiddenUpdatesForLane.length; i++) { + var update = hiddenUpdatesForLane[i]; - if (instance.xx !== pooledTransform.xx || instance.yx !== pooledTransform.yx || instance.xy !== pooledTransform.xy || instance.yy !== pooledTransform.yy || instance.x !== pooledTransform.x || instance.y !== pooledTransform.y) { - instance.transformTo(pooledTransform); - } + if (update !== null) { + update.lane &= ~OffscreenLane; + } + } + } - if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) { - instance.indicate(props.cursor, props.title); + lanes &= ~lane; } - if (instance.blend && props.opacity !== prevProps.opacity) { - instance.blend(props.opacity == null ? 1 : props.opacity); + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes); } +} - if (props.visible !== prevProps.visible) { - if (props.visible == null || props.visible) { - instance.show(); - } else { - instance.hide(); - } - } +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. - for (var type in EVENT_TYPES) { - addEventListeners(instance, EVENT_TYPES[type], props[type]); - } + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task, so that the deferred task includes all the same + // updates that the parent task did. We can exclude any lane that is not + // used for updates (e.g. Offscreen). + entangledLanes & UpdateLanes; } -function applyRenderableNodeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); +function markRootEntangled(root, entangledLanes) { + // In addition to entangling each of the given lanes with each other, we also + // have to consider _transitive_ entanglements. For each lane that is already + // entangled with *any* of the given lanes, that lane is now transitively + // entangled with *all* the given lanes. + // + // Translated: If C is entangled with A, then entangling A with B also + // entangles C with B. + // + // If this is hard to grasp, it might help to intentionally break this + // function and look at the tests that fail in ReactTransition-test.js. Try + // commenting out one of the conditions below. + var rootEntangledLanes = root.entangledLanes |= entangledLanes; + var entanglements = root.entanglements; + var lanes = rootEntangledLanes; - if (prevProps.fill !== props.fill) { - if (props.fill && props.fill.applyFill) { - props.fill.applyFill(instance); - } else { - instance.fill(props.fill); + while (lanes) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + + if ( // Is this one of the newly entangled lanes? + lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? + entanglements[index] & entangledLanes) { + entanglements[index] |= entangledLanes; } - } - if (prevProps.stroke !== props.stroke || prevProps.strokeWidth !== props.strokeWidth || prevProps.strokeCap !== props.strokeCap || prevProps.strokeJoin !== props.strokeJoin || // TODO: Consider deep check of stokeDash; may benefit VML in IE. - prevProps.strokeDash !== props.strokeDash) { - instance.stroke(props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash); + lanes &= ~lane; } } +function upgradePendingLaneToSync(root, lane) { + // Since we're upgrading the priority of the given lane, there is now pending + // sync work. + root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane + // will not be allowed to finish without also finishing the given lane. -function applyShapeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyRenderableNodeProps(instance, props, prevProps); - var path = props.d || childrenAsString(props.children); - var prevDelta = instance._prevDelta; - var prevPath = instance._prevPath; + root.entangledLanes |= SyncLane; + root.entanglements[SyncLaneIndex] |= lane; +} +function markHiddenUpdate(root, update, lane) { + var index = laneToIndex(lane); + var hiddenUpdates = root.hiddenUpdates; + var hiddenUpdatesForLane = hiddenUpdates[index]; - if (path !== prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width) { - instance.draw(path, props.width, props.height); - instance._prevDelta = path.delta; - instance._prevPath = path; + if (hiddenUpdatesForLane === null) { + hiddenUpdates[index] = [update]; + } else { + hiddenUpdatesForLane.push(update); } + + update.lane = lane | OffscreenLane; } +function getBumpedLaneForHydration(root, renderLanes) { + var renderLane = getHighestPriorityLane(renderLanes); + var lane; -function applyTextProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyRenderableNodeProps(instance, props, prevProps); - var string = props.children; + if (enableUnifiedSyncLane && (renderLane & SyncUpdateLanes) !== NoLane) { + lane = SyncHydrationLane; + } else { + switch (renderLane) { + case SyncLane: + lane = SyncHydrationLane; + break; - if (instance._currentString !== string || !isSameFont(props.font, prevProps.font) || props.alignment !== prevProps.alignment || props.path !== prevProps.path) { - instance.draw(string, props.font, props.alignment, props.path); - instance._currentString = string; - } -} -function appendInitialChild(parentInstance, child) { - if (typeof child === 'string') { - // Noop for string children of Text (eg {'foo'}{'bar'}) - throw new Error('Text children should already be flattened.'); - } + case InputContinuousLane: + lane = InputContinuousHydrationLane; + break; - child.inject(parentInstance); -} -function createInstance(type, props, internalInstanceHandle) { - var instance; + case DefaultLane: + lane = DefaultHydrationLane; + break; - switch (type) { - case TYPES.CLIPPING_RECTANGLE: - instance = Mode$1.ClippingRectangle(); - instance._applyProps = applyClippingRectangleProps; - break; + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + lane = TransitionHydrationLane; + break; + + case IdleLane: + lane = IdleHydrationLane; + break; - case TYPES.GROUP: - instance = Mode$1.Group(); - instance._applyProps = applyGroupProps; - break; + default: + // Everything else is already either a hydration lane, or shouldn't + // be retried at a hydration lane. + lane = NoLane; + break; + } + } // Check if the lane we chose is suspended. If so, that indicates that we + // already attempted and failed to hydrate at that level. Also check if we're + // already rendering that lane, which is rare but could happen. - case TYPES.SHAPE: - instance = Mode$1.Shape(); - instance._applyProps = applyShapeProps; - break; - case TYPES.TEXT: - instance = Mode$1.Text(props.children, props.font, props.alignment, props.path); - instance._applyProps = applyTextProps; - break; + if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { + // Give up trying to hydrate and fall back to client render. + return NoLane; } - if (!instance) { - throw new Error("ReactART does not support the type \"" + type + "\""); + return lane; +} +function addFiberToLanesMap(root, fiber, lanes) { + + if (!isDevToolsPresent) { + return; } - instance._applyProps(instance, props); + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; - return instance; -} -function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { - return text; -} -function getPublicInstance(instance) { - return instance; -} -function prepareForCommit() { - // Noop - return null; -} -function resetTextContent(domElement) {// Noop -} -function getRootHostContext() { - return NO_CONTEXT; -} -function getChildHostContext() { - return NO_CONTEXT; -} -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; -function shouldSetTextContent(type, props) { - return typeof props.children === 'string' || typeof props.children === 'number'; -} -var currentUpdatePriority = NoEventPriority; -function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; -} -function getCurrentUpdatePriority() { - return currentUpdatePriority; -} -function resolveUpdatePriority() { - return currentUpdatePriority || DefaultEventPriority; + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var updaters = pendingUpdatersLaneMap[index]; + updaters.add(fiber); + lanes &= ~lane; + } } -function shouldAttemptEagerTransition() { - return false; -} // The ART renderer is secondary to the React DOM renderer. +function movePendingFibersToMemoized(root, lanes) { -var warnsIfNotActing = false; -function appendChild(parentInstance, child) { - if (child.parentNode === parentInstance) { - child.eject(); + if (!isDevToolsPresent) { + return; } - child.inject(parentInstance); -} -function appendChildToContainer(parentInstance, child) { - if (child.parentNode === parentInstance) { - child.eject(); - } + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; + var memoizedUpdaters = root.memoizedUpdaters; - child.inject(parentInstance); -} -function insertBefore(parentInstance, child, beforeChild) { - if (child === beforeChild) { - throw new Error('ReactART: Can not insert node before itself'); - } + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var updaters = pendingUpdatersLaneMap[index]; - child.injectBefore(beforeChild); -} -function insertInContainerBefore(parentInstance, child, beforeChild) { - if (child === beforeChild) { - throw new Error('ReactART: Can not insert node before itself'); - } + if (updaters.size > 0) { + updaters.forEach(function (fiber) { + var alternate = fiber.alternate; - child.injectBefore(beforeChild); -} -function removeChild(parentInstance, child) { - destroyEventListeners(child); - child.eject(); -} -function removeChildFromContainer(parentInstance, child) { - destroyEventListeners(child); - child.eject(); -} -function commitTextUpdate(textInstance, oldText, newText) {// Noop -} -function commitMount(instance, type, newProps) {// Noop -} -function commitUpdate(instance, type, oldProps, newProps) { - instance._applyProps(instance, newProps, oldProps); -} -function hideInstance(instance) { - instance.hide(); -} -function hideTextInstance(textInstance) {// Noop -} -function unhideInstance(instance, props) { - if (props.visible == null || props.visible) { - instance.show(); + if (alternate === null || !memoizedUpdaters.has(alternate)) { + memoizedUpdaters.add(fiber); + } + }); + updaters.clear(); + } + + lanes &= ~lane; } } -function unhideTextInstance(textInstance, text) {// Noop -} -function getInstanceFromNode(node) { - throw new Error('Not implemented.'); -} -function preloadInstance(type, props) { - // Return true to indicate it's already loaded - return true; -} -function waitForCommitToBeReady() { - return null; -} -var NotPendingTransition = null; +function addTransitionToLanesMap(root, transition, lane) { + if (enableTransitionTracing) { + var transitionLanesMap = root.transitionLanes; + var index = laneToIndex(lane); + var transitions = transitionLanesMap[index]; -var valueStack = []; -var fiberStack; + if (transitions === null) { + transitions = new Set(); + } -{ - fiberStack = []; + transitions.add(transition); + transitionLanesMap[index] = transitions; + } } +function getTransitionsForLanes(root, lanes) { + if (!enableTransitionTracing) { + return null; + } -var index = -1; + var transitionsForLanes = []; -function createCursor(defaultValue) { - return { - current: defaultValue - }; -} + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var transitions = root.transitionLanes[index]; -function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); + if (transitions !== null) { + transitions.forEach(function (transition) { + transitionsForLanes.push(transition); + }); } - return; + lanes &= ~lane; } - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); - } + if (transitionsForLanes.length === 0) { + return null; } - cursor.current = valueStack[index]; - valueStack[index] = null; + return transitionsForLanes; +} +function clearTransitionsForLanes(root, lanes) { + if (!enableTransitionTracing) { + return; + } - { - fiberStack[index] = null; + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var transitions = root.transitionLanes[index]; + + if (transitions !== null) { + root.transitionLanes[index] = null; + } + + lanes &= ~lane; } +} - index--; +var NoEventPriority = NoLane; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; } +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } - { - fiberStack[index] = fiber; + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; } - cursor.current = value; -} - -var warnedAboutMissingGetChildContext; + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; + } -{ - warnedAboutMissingGetChildContext = {}; + return IdleEventPriority; } -var emptyContextObject = {}; +// Renderers that don't support hydration +// can re-export everything from this module. +function shim$2() { + throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Hydration (when unsupported) -{ - Object.freeze(emptyContextObject); -} // A cursor to the current merged context object on the stack. +var supportsHydration = false; +var isSuspenseInstancePending = shim$2; +var isSuspenseInstanceFallback = shim$2; +var getSuspenseInstanceFallbackErrorDetails = shim$2; +var registerSuspenseInstanceRetry = shim$2; +var clearSuspenseBoundary = shim$2; +var clearSuspenseBoundaryFromContainer = shim$2; -var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. +// Renderers that don't support React Scopes +// can re-export everything from this module. +function shim$1() { + throw new Error('The current renderer does not support React Scopes. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // React Scopes (when unsupported) -var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. -// We use this to get access to the parent context after we have already -// pushed the next context provider, and now need to merge their contexts. -var previousContext = emptyContextObject; +var prepareScopeUpdate = shim$1; +var getInstanceFromScope = shim$1; -function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { - { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; - } +// Renderers that don't support hydration +// can re-export everything from this module. +function shim() { + throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Resources (when unsupported) +var preloadResource = shim; +var suspendResource = shim; - return contextStackCursor$1.current; - } -} +var pooledTransform = new Transform(); +var NO_CONTEXT = {}; -function cacheContext(workInProgress, unmaskedContext, maskedContext) { - { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } +{ + Object.freeze(NO_CONTEXT); } +/** Helper Methods */ -function getMaskedContext(workInProgress, unmaskedContext) { - { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - - if (!contextTypes) { - return emptyContextObject; - } // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. +function addEventListeners(instance, type, listener) { + // We need to explicitly unregister before unmount. + // For this reason we need to track subscriptions. + if (!instance._listeners) { + instance._listeners = {}; + instance._subscriptions = {}; + } - var instance = workInProgress.stateNode; + instance._listeners[type] = listener; - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; + if (listener) { + if (!instance._subscriptions[type]) { + instance._subscriptions[type] = instance.subscribe(type, createEventHandler(instance), instance); } + } else { + if (instance._subscriptions[type]) { + instance._subscriptions[type](); - var context = {}; - - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. - - - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); + delete instance._subscriptions[type]; } - - return context; } } -function hasContextChanged() { - { - return didPerformWorkStackCursor.current; - } +function createEventHandler(instance) { + return function handleEvent(event) { + var listener = instance._listeners[event.type]; + + if (!listener) ; else if (typeof listener === 'function') { + listener.call(instance, event); + } else if (listener.handleEvent) { + listener.handleEvent(event); + } + }; } -function isContextProvider(type) { - { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; +function destroyEventListeners(instance) { + if (instance._subscriptions) { + for (var type in instance._subscriptions) { + instance._subscriptions[type](); + } } + + instance._subscriptions = null; + instance._listeners = null; } -function popContext(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); +function getScaleX(props) { + if (props.scaleX != null) { + return props.scaleX; + } else if (props.scale != null) { + return props.scale; + } else { + return 1; } } -function popTopLevelContextObject(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); +function getScaleY(props) { + if (props.scaleY != null) { + return props.scaleY; + } else if (props.scale != null) { + return props.scale; + } else { + return 1; } } -function pushTopLevelContextObject(fiber, context, didChange) { - { - if (contextStackCursor$1.current !== emptyContextObject) { - throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } - - push(contextStackCursor$1, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); +function isSameFont(oldFont, newFont) { + if (oldFont === newFont) { + return true; + } else if (typeof newFont === 'string' || typeof oldFont === 'string') { + return false; + } else { + return newFont.fontSize === oldFont.fontSize && newFont.fontStyle === oldFont.fontStyle && newFont.fontVariant === oldFont.fontVariant && newFont.fontWeight === oldFont.fontWeight && newFont.fontFamily === oldFont.fontFamily; } } +/** Render Methods */ -function processChildContext(fiber, type, parentContext) { - { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; - - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; - - error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } - - return parentContext; - } - - var childContext = instance.getChildContext(); - - for (var contextKey in childContext) { - if (!(contextKey in childContextTypes)) { - throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); - } - } - return assign({}, parentContext, childContext); - } +function applyClippingRectangleProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); + instance.width = props.width; + instance.height = props.height; } -function pushContextProvider(workInProgress) { - { - var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. +function applyGroupProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); + instance.width = props.width; + instance.height = props.height; +} - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. +function applyNodeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var scaleX = getScaleX(props); + var scaleY = getScaleY(props); + pooledTransform.transformTo(1, 0, 0, 1, 0, 0).move(props.x || 0, props.y || 0).rotate(props.rotation || 0, props.originX, props.originY).scale(scaleX, scaleY, props.originX, props.originY); - previousContext = contextStackCursor$1.current; - push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); - return true; + if (props.transform != null) { + pooledTransform.transform(props.transform); } -} -function invalidateContextProvider(workInProgress, type, didChange) { - { - var instance = workInProgress.stateNode; - - if (!instance) { - throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } + if (instance.xx !== pooledTransform.xx || instance.yx !== pooledTransform.yx || instance.xy !== pooledTransform.xy || instance.yy !== pooledTransform.yy || instance.x !== pooledTransform.x || instance.y !== pooledTransform.y) { + instance.transformTo(pooledTransform); + } - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, type, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. + if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) { + instance.indicate(props.cursor, props.title); + } - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. + if (instance.blend && props.opacity !== prevProps.opacity) { + instance.blend(props.opacity == null ? 1 : props.opacity); + } - push(contextStackCursor$1, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); + if (props.visible !== prevProps.visible) { + if (props.visible == null || props.visible) { + instance.show(); } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); + instance.hide(); } } -} - -function findCurrentUnmaskedContext(fiber) { - { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { - throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } - var node = fiber; + for (var type in EVENT_TYPES) { + addEventListeners(instance, EVENT_TYPES[type], props[type]); + } +} - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; +function applyRenderableNodeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); - case ClassComponent: - { - var Component = node.type; + if (prevProps.fill !== props.fill) { + if (props.fill && props.fill.applyFill) { + props.fill.applyFill(instance); + } else { + instance.fill(props.fill); + } + } - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } + if (prevProps.stroke !== props.stroke || prevProps.strokeWidth !== props.strokeWidth || prevProps.strokeCap !== props.strokeCap || prevProps.strokeJoin !== props.strokeJoin || // TODO: Consider deep check of stokeDash; may benefit VML in IE. + prevProps.strokeDash !== props.strokeDash) { + instance.stroke(props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash); + } +} - break; - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null +function applyShapeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyRenderableNodeProps(instance, props, prevProps); + var path = props.d || childrenAsString(props.children); + var prevDelta = instance._prevDelta; + var prevPath = instance._prevPath; + if (path !== prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width) { + instance.draw(path, props.width, props.height); + instance._prevDelta = path.delta; + instance._prevPath = path; + } +} - node = node.return; - } while (node !== null); +function applyTextProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyRenderableNodeProps(instance, props, prevProps); + var string = props.children; - throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + if (instance._currentString !== string || !isSameFont(props.font, prevProps.font) || props.alignment !== prevProps.alignment || props.path !== prevProps.path) { + instance.draw(string, props.font, props.alignment, props.path); + instance._currentString = string; } } +function appendInitialChild(parentInstance, child) { + if (typeof child === 'string') { + // Noop for string children of Text (eg {'foo'}{'bar'}) + throw new Error('Text children should already be flattened.'); + } -// We use the existence of the state object as an indicator that the component -// is hidden. -var OffscreenVisible = -/* */ -1; -var OffscreenDetached = -/* */ -2; -var OffscreenPassiveEffectsConnected = -/* */ -4; -function isOffscreenManual(offscreenFiber) { - return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; + child.inject(parentInstance); } +function createInstance(type, props, internalInstanceHandle) { + var instance; -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; -} + switch (type) { + case TYPES.CLIPPING_RECTANGLE: + instance = Mode$1.ClippingRectangle(); + instance._applyProps = applyClippingRectangleProps; + break; -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; + case TYPES.GROUP: + instance = Mode$1.Group(); + instance._applyProps = applyGroupProps; + break; -var nativeConsole = console; -var nativeConsoleLog = null; -var pendingGroupArgs = []; -var printedGroupIndex = -1; + case TYPES.SHAPE: + instance = Mode$1.Shape(); + instance._applyProps = applyShapeProps; + break; -function formatLanes(laneOrLanes) { - return '0b' + laneOrLanes.toString(2).padStart(31, '0'); -} + case TYPES.TEXT: + instance = Mode$1.Text(props.children, props.font, props.alignment, props.path); + instance._applyProps = applyTextProps; + break; + } -function group() { - for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { - groupArgs[_key] = arguments[_key]; + if (!instance) { + throw new Error("ReactART does not support the type \"" + type + "\""); } - pendingGroupArgs.push(groupArgs); + instance._applyProps(instance, props); - if (nativeConsoleLog === null) { - nativeConsoleLog = nativeConsole.log; - nativeConsole.log = log; + return instance; +} +function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { + return text; +} +function getPublicInstance(instance) { + return instance; +} +function prepareForCommit() { + // Noop + return null; +} +function resetTextContent(domElement) {// Noop +} +function getRootHostContext() { + return NO_CONTEXT; +} +function getChildHostContext() { + return NO_CONTEXT; +} +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; +function shouldSetTextContent(type, props) { + return typeof props.children === 'string' || typeof props.children === 'number'; +} +var currentUpdatePriority = NoEventPriority; +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function resolveUpdatePriority() { + return currentUpdatePriority || DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; +} // The ART renderer is secondary to the React DOM renderer. + +var warnsIfNotActing = false; +function appendChild(parentInstance, child) { + if (child.parentNode === parentInstance) { + child.eject(); } + + child.inject(parentInstance); } +function appendChildToContainer(parentInstance, child) { + if (child.parentNode === parentInstance) { + child.eject(); + } -function groupEnd() { - pendingGroupArgs.pop(); + child.inject(parentInstance); +} +function insertBefore(parentInstance, child, beforeChild) { + if (child === beforeChild) { + throw new Error('ReactART: Can not insert node before itself'); + } - while (printedGroupIndex >= pendingGroupArgs.length) { - nativeConsole.groupEnd(); - printedGroupIndex--; + child.injectBefore(beforeChild); +} +function insertInContainerBefore(parentInstance, child, beforeChild) { + if (child === beforeChild) { + throw new Error('ReactART: Can not insert node before itself'); } - if (pendingGroupArgs.length === 0) { - nativeConsole.log = nativeConsoleLog; - nativeConsoleLog = null; + child.injectBefore(beforeChild); +} +function removeChild(parentInstance, child) { + destroyEventListeners(child); + child.eject(); +} +function removeChildFromContainer(parentInstance, child) { + destroyEventListeners(child); + child.eject(); +} +function commitTextUpdate(textInstance, oldText, newText) {// Noop +} +function commitMount(instance, type, newProps) {// Noop +} +function commitUpdate(instance, type, oldProps, newProps) { + instance._applyProps(instance, newProps, oldProps); +} +function hideInstance(instance) { + instance.hide(); +} +function hideTextInstance(textInstance) {// Noop +} +function unhideInstance(instance, props) { + if (props.visible == null || props.visible) { + instance.show(); } } +function unhideTextInstance(textInstance, text) {// Noop +} +function getInstanceFromNode(node) { + throw new Error('Not implemented.'); +} +function preloadInstance(type, props) { + // Return true to indicate it's already loaded + return true; +} +function waitForCommitToBeReady() { + return null; +} +var NotPendingTransition = null; -function log() { - if (printedGroupIndex < pendingGroupArgs.length - 1) { - for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { - var groupArgs = pendingGroupArgs[i]; - nativeConsole.group.apply(nativeConsole, groupArgs); - } +var valueStack = []; +var fiberStack; + +{ + fiberStack = []; +} - printedGroupIndex = pendingGroupArgs.length - 1; - } +var index = -1; - if (typeof nativeConsoleLog === 'function') { - nativeConsoleLog.apply(void 0, arguments); - } else { - nativeConsole.log.apply(nativeConsole, arguments); - } +function createCursor(defaultValue) { + return { + current: defaultValue + }; } -var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; -function logCommitStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); +function pop(cursor, fiber) { + if (index < 0) { + { + error('Unexpected pop.'); } + + return; } -} -function logCommitStopped() { + { - if (enableDebugTracing) { - groupEnd(); + if (fiber !== fiberStack[index]) { + error('Unexpected Fiber popped.'); } } -} -var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps -var wakeableIDs = new PossiblyWeakMap$2(); -var wakeableID = 0; + cursor.current = valueStack[index]; + valueStack[index] = null; -function getWakeableID(wakeable) { - if (!wakeableIDs.has(wakeable)) { - wakeableIDs.set(wakeable, wakeableID++); + { + fiberStack[index] = null; } - return wakeableIDs.get(wakeable); + index--; } -function logComponentSuspended(componentName, wakeable) { +function push(cursor, value, fiber) { + index++; + valueStack[index] = cursor.current; + { - if (enableDebugTracing) { - var id = getWakeableID(wakeable); - var display = wakeable.displayName || wakeable; - log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - wakeable.then(function () { - log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }, function () { - log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }); - } + fiberStack[index] = fiber; } + + cursor.current = value; } -function logLayoutEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } + +var warnedAboutMissingGetChildContext; + +{ + warnedAboutMissingGetChildContext = {}; } -function logLayoutEffectsStopped() { + +var emptyContextObject = {}; + +{ + Object.freeze(emptyContextObject); +} // A cursor to the current merged context object on the stack. + + +var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. + +var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. + +var previousContext = emptyContextObject; + +function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { { - if (enableDebugTracing) { - groupEnd(); + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; } + + return contextStackCursor$1.current; } } -function logPassiveEffectsStarted(lanes) { + +function cacheContext(workInProgress, unmaskedContext, maskedContext) { { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; } } -function logPassiveEffectsStopped() { + +function getMaskedContext(workInProgress, unmaskedContext) { { - if (enableDebugTracing) { - groupEnd(); + var type = workInProgress.type; + var contextTypes = type.contextTypes; + + if (!contextTypes) { + return emptyContextObject; + } // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + + + var instance = workInProgress.stateNode; + + if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { + return instance.__reactInternalMemoizedMaskedChildContext; } - } -} -function logRenderStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + + var context = {}; + + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. + + + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); } + + return context; } } -function logRenderStopped() { + +function hasContextChanged() { { - if (enableDebugTracing) { - groupEnd(); - } + return didPerformWorkStackCursor.current; } } -function logForceUpdateScheduled(componentName, lane) { + +function isContextProvider(type) { { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); - } + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; } } -function logStateUpdateScheduled(componentName, lane, payloadOrAction) { + +function popContext(fiber) { { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); - } + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); } } -var prefix; -function describeBuiltInComponentFrame(name) { +function popTopLevelContextObject(fiber) { { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); } } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } +function pushTopLevelContextObject(fiber, context, didChange) { { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; + if (contextStackCursor$1.current !== emptyContextObject) { + throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); + push(contextStackCursor$1, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ +} +function processChildContext(fiber, type, parentContext) { + { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; + if (typeof instance.getChildContext !== 'function') { + { + var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); + } + } - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); + return parentContext; + } - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } + var childContext = instance.getChildContext(); - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow + for (var contextKey in childContext) { + if (!(contextKey in childContextTypes)) { + throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); + } + } + return assign({}, parentContext, childContext); + } +} - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too +function pushContextProvider(workInProgress) { + { + var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? + previousContext = contextStackCursor$1.current; + push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); + push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); + return true; + } +} - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } +function invalidateContextProvider(workInProgress, type, didChange) { + { + var instance = workInProgress.stateNode; - return [null, null]; + if (!instance) { + throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } - }; // $FlowFixMe[prop-missing] - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext(workInProgress, type, previousContext); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. + + push(contextStackCursor$1, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } } +} - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; +function findCurrentUnmaskedContext(fiber) { + { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { + throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; + var node = fiber; - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... + case ClassComponent: + { + var Component = node.type; + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; + } - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; + break; + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. + node = node.return; + } while (node !== null); - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. + throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } +} +// We use the existence of the state object as an indicator that the component +// is hidden. +var OffscreenVisible = +/* */ +1; +var OffscreenDetached = +/* */ +2; +var OffscreenPassiveEffectsConnected = +/* */ +4; +function isOffscreenManual(offscreenFiber) { + return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; +} - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; +var nativeConsole = console; +var nativeConsoleLog = null; +var pendingGroupArgs = []; +var printedGroupIndex = -1; - return _frame; - } - } while (s >= 1 && c >= 0); - } +function formatLanes(laneOrLanes) { + return '0b' + laneOrLanes.toString(2).padStart(31, '0'); +} - break; - } - } - } - } finally { - reentry = false; +function group() { + for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { + groupArgs[_key] = arguments[_key]; + } - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } + pendingGroupArgs.push(groupArgs); + + if (nativeConsoleLog === null) { + nativeConsoleLog = nativeConsole.log; + nativeConsole.log = log; + } +} - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. +function groupEnd() { + pendingGroupArgs.pop(); + while (printedGroupIndex >= pendingGroupArgs.length) { + nativeConsole.groupEnd(); + printedGroupIndex--; + } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + if (pendingGroupArgs.length === 0) { + nativeConsole.log = nativeConsoleLog; + nativeConsoleLog = null; + } +} - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); +function log() { + if (printedGroupIndex < pendingGroupArgs.length - 1) { + for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { + var groupArgs = pendingGroupArgs[i]; + nativeConsole.group.apply(nativeConsole, groupArgs); } + + printedGroupIndex = pendingGroupArgs.length - 1; } - return syntheticFrame; + if (typeof nativeConsoleLog === 'function') { + nativeConsoleLog.apply(void 0, arguments); + } else { + nativeConsole.log.apply(nativeConsole, arguments); + } } -function describeClassComponentFrame(ctor) { +var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; +function logCommitStarted(lanes) { { - return describeNativeComponentFrame(ctor, true); + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } -function describeFunctionComponentFrame(fn) { +function logCommitStopped() { { - return describeNativeComponentFrame(fn, false); + if (enableDebugTracing) { + groupEnd(); + } } } +var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); +var wakeableIDs = new PossiblyWeakMap$1(); +var wakeableID = 0; - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); +function getWakeableID(wakeable) { + if (!wakeableIDs.has(wakeable)) { + wakeableIDs.set(wakeable, wakeableID++); + } - case ClassComponent: - return describeClassComponentFrame(fiber.type); + return wakeableIDs.get(wakeable); +} - default: - return ''; +function logComponentSuspended(componentName, wakeable) { + { + if (enableDebugTracing) { + var id = getWakeableID(wakeable); + var display = wakeable.displayName || wakeable; + log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + wakeable.then(function () { + log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }, function () { + log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }); + } } } - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; +function logLayoutEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logLayoutEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logPassiveEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logPassiveEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logRenderStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logRenderStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logForceUpdateScheduled(componentName, lane) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); + } + } +} +function logStateUpdateScheduled(componentName, lane, payloadOrAction) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); + } } } @@ -5648,61 +5710,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -5922,11 +5929,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -13206,7 +13213,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); setIsRendering(false); @@ -13759,7 +13765,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); setIsRendering(false); @@ -13911,7 +13916,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -15320,7 +15325,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -18407,7 +18411,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -18415,7 +18419,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -18444,7 +18448,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -18530,7 +18534,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -20056,9 +20060,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -20086,13 +20090,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -20498,8 +20502,10 @@ function commitReconciliationEffects(finishedWork) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -20511,14 +20517,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -20728,7 +20734,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -20887,9 +20893,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -20899,13 +20905,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -21101,7 +21107,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -21234,13 +21240,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -21286,9 +21292,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -21442,13 +21448,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -21519,12 +21525,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -21566,9 +21572,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -21834,7 +21840,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -22911,10 +22917,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -23569,7 +23574,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -23580,7 +23585,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -23589,10 +23597,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -23600,9 +23604,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -23680,7 +23683,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -23689,10 +23695,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -23779,7 +23781,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -23791,7 +23793,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -24029,18 +24031,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - commitBeforeMutationEffects(root, finishedWork); { @@ -24710,13 +24707,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -24729,7 +24726,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -24741,7 +24738,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -24765,7 +24762,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -24778,7 +24775,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -24841,14 +24838,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -24962,14 +24959,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } diff --git a/compiled/facebook-www/ReactART-dev.modern.js b/compiled/facebook-www/ReactART-dev.modern.js index 36a3657a7379d..aef7e485ae738 100644 --- a/compiled/facebook-www/ReactART-dev.modern.js +++ b/compiled/facebook-www/ReactART-dev.modern.js @@ -60,7 +60,7 @@ function _assertThisInitialized(self) { return self; } -var ReactVersion = '19.0.0-www-modern-c5403897'; +var ReactVersion = '19.0.0-www-modern-d3cf6c2c'; var LegacyRoot = 0; var ConcurrentRoot = 1; @@ -627,2759 +627,2821 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - var a = fiber; - var b = alternate; + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - while (true) { - var parentA = a.return; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - if (parentA === null) { - // We're at the root. - break; - } + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - var parentB = parentA.alternate; - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } - if (parentA.child === parentB.child) { - var child = parentA.child; + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } - throw new Error('Unable to find node on an unmounted component.'); + return [null, null]; } + }; // $FlowFixMe[prop-missing] - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - _child = _child.sibling; - } + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - _child = _child.sibling; - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (!didFindChild) { - throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; } } - } - - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. - - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } - var child = node.child; + return _frame; + } + } while (s >= 1 && c >= 0); + } - while (child !== null) { - var match = findCurrentHostFiberImpl(child); + break; + } + } + } + } finally { + reentry = false; - if (match !== null) { - return match; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); } - child = child.sibling; - } + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. - return null; -} -function isFiberSuspenseAndTimedOut(fiber) { - var memoizedState = fiber.memoizedState; - return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; -} -function doesFiberContain(parentFiber, childFiber) { - var node = childFiber; - var parentFiberAlternate = parentFiber.alternate; + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - while (node !== null) { - if (node === parentFiber || node === parentFiberAlternate) { - return true; + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); } - - node = node.return; } - return false; + return syntheticFrame; } -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - -var TYPES = { - CLIPPING_RECTANGLE: 'ClippingRectangle', - GROUP: 'Group', - SHAPE: 'Shape', - TEXT: 'Text' -}; -var EVENT_TYPES = { - onClick: 'click', - onMouseMove: 'mousemove', - onMouseOver: 'mouseover', - onMouseOut: 'mouseout', - onMouseUp: 'mouseup', - onMouseDown: 'mousedown' -}; -function childrenAsString(children) { - if (!children) { - return ''; - } else if (typeof children === 'string') { - return children; - } else if (children.length) { - return children.join(''); - } else { - return ''; - } -} - -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler.unstable_cancelCallback; -var shouldYield = Scheduler.unstable_shouldYield; -var requestPaint = Scheduler.unstable_requestPaint; -var now$1 = Scheduler.unstable_now; -var ImmediatePriority = Scheduler.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler.unstable_NormalPriority; -var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* -// on scheduler/unstable_mock, which we'll need for internal testing +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); -var log$2 = Scheduler.log; -var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); -function disabledLog() {} + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } + case ClassComponent: + return describeClassComponentFrame(fiber.type); - disabledDepth++; + default: + return ''; } } -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} + do { + info += describeFiber(node); -var rendererID = null; -var injectedHook = null; -var injectedProfilingHooks = null; -var hasLoggedError = false; -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; - } + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. + node = node.return; + } while (node); - return true; + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; } +} - try { - if (enableSchedulingProfiler) { - // Conditionally inject these hooks only if Timeline profiler is supported by this build. - // This gives DevTools a way to feature detect that isn't tied to version number - // (since profiling and timeline are controlled by different feature flags). - internals = assign({}, internals, { - getLaneLabelMap: getLaneLabelMap, - injectProfilingHooks: injectProfilingHooks - }); +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; } - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + var owner = current._debugOwner; - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); + if (owner != null) { + return getComponentNameFromOwner(owner); } } - if (hook.checkDCE) { - // This is the real DevTools. - return true; - } else { - // This is likely a hook installed by Fast Refresh runtime. - return false; - } + return null; } -function onScheduleRoot(root, children) { + +function getCurrentFiberStackInDev() { { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if (!hasLoggedError) { - hasLoggedError = true; + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. - error('React instrumentation encountered an error: %s', err); - } - } - } + + return getStackByFiberInDevAndProd(current); } } -function onCommitRoot(root, eventPriority) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; - if (enableProfilerTimer) { - var schedulerPriority; +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } - switch (eventPriority) { - case DiscreteEventPriority: - schedulerPriority = ImmediatePriority; - break; + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } - case ContinuousEventPriority: - schedulerPriority = UserBlockingPriority; - break; + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} - case DefaultEventPriority: - schedulerPriority = NormalPriority$1; - break; +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; - case IdleEventPriority: - schedulerPriority = IdlePriority; - break; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; - default: - schedulerPriority = NormalPriority$1; - break; - } + do { + node = nextNode; - injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null - error('React instrumentation encountered an error: %s', err); - } - } - } - } -} -function onPostCommitRoot(root) { - if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { - try { - injectedHook.onPostCommitFiberRoot(rendererID, root); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; } } -} -function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } - } - } + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; } -function setIsStrictModeForDevtools(newIsStrictMode) { +function isMounted(component) { { - if (typeof log$2 === 'function') { - // We're in a test because Scheduler.log only exists - // in SchedulerMock. To reduce the noise in strict mode tests, - // suppress warnings and disable scheduler yielding during the double render - unstable_setDisableYieldValue(newIsStrictMode); - setSuppressWarning(newIsStrictMode); - } + var owner = current; - if (injectedHook && typeof injectedHook.setStrictMode === 'function') { - try { - injectedHook.setStrictMode(rendererID, newIsStrictMode); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; - error('React instrumentation encountered an error: %s', err); - } - } + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); } + + instance._warnedAboutRefsInRender = true; } } -} // Profiler API hooks - -function injectProfilingHooks(profilingHooks) { - injectedProfilingHooks = profilingHooks; -} - -function getLaneLabelMap() { - if (enableSchedulingProfiler) { - var map = new Map(); - var lane = 1; - for (var index = 0; index < TotalLanes; index++) { - var label = getLabelForLane(lane); - map.set(lane, label); - lane *= 2; - } + var fiber = get(component); - return map; - } else { - return null; + if (!fiber) { + return false; } + + return getNearestMountedFiber(fiber) === fiber; } -function markCommitStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { - injectedProfilingHooks.markCommitStarted(lanes); - } +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); } } -function markCommitStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { - injectedProfilingHooks.markCommitStopped(); + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); + + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); } - } -} -function markComponentRenderStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { - injectedProfilingHooks.markComponentRenderStarted(fiber); + + if (nearestMounted !== fiber) { + return null; } - } -} -function markComponentRenderStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { - injectedProfilingHooks.markComponentRenderStopped(); + + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + + + var a = fiber; + var b = alternate; + + while (true) { + var parentA = a.return; + + if (parentA === null) { + // We're at the root. + break; } - } -} -function markComponentPassiveEffectMountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { - injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); + + var parentB = parentA.alternate; + + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. + + + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + + + if (parentA.child === parentB.child) { + var child = parentA.child; + + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + + + throw new Error('Unable to find node on an unmounted component.'); } - } -} -function markComponentPassiveEffectMountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { - injectedProfilingHooks.markComponentPassiveEffectMountStopped(); - } - } -} -function markComponentPassiveEffectUnmountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { - injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + } + } } - } -} -function markComponentPassiveEffectUnmountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { - injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); + + if (a.alternate !== b) { + throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + + + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); } + + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. + + + return alternate; } -function markComponentLayoutEffectMountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { - injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); - } - } +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; } -function markComponentLayoutEffectMountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { - injectedProfilingHooks.markComponentLayoutEffectMountStopped(); - } + +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; } -} -function markComponentLayoutEffectUnmountStarted(fiber) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { - injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + + var child = node.child; + + while (child !== null) { + var match = findCurrentHostFiberImpl(child); + + if (match !== null) { + return match; } + + child = child.sibling; } + + return null; } -function markComponentLayoutEffectUnmountStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { - injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); - } - } + +function isFiberSuspenseAndTimedOut(fiber) { + var memoizedState = fiber.memoizedState; + return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; } -function markComponentErrored(fiber, thrownValue, lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { - injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); +function doesFiberContain(parentFiber, childFiber) { + var node = childFiber; + var parentFiberAlternate = parentFiber.alternate; + + while (node !== null) { + if (node === parentFiber || node === parentFiberAlternate) { + return true; } + + node = node.return; } + + return false; } -function markComponentSuspended(fiber, wakeable, lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { - injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); - } - } + +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + +function isArray(a) { + return isArrayImpl(a); } -function markLayoutEffectsStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { - injectedProfilingHooks.markLayoutEffectsStarted(lanes); - } + +var TYPES = { + CLIPPING_RECTANGLE: 'ClippingRectangle', + GROUP: 'Group', + SHAPE: 'Shape', + TEXT: 'Text' +}; +var EVENT_TYPES = { + onClick: 'click', + onMouseMove: 'mousemove', + onMouseOver: 'mouseover', + onMouseOut: 'mouseout', + onMouseUp: 'mouseup', + onMouseDown: 'mousedown' +}; +function childrenAsString(children) { + if (!children) { + return ''; + } else if (typeof children === 'string') { + return children; + } else if (children.length) { + return children.join(''); + } else { + return ''; } } -function markLayoutEffectsStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { - injectedProfilingHooks.markLayoutEffectsStopped(); - } + +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now$1 = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* +// on scheduler/unstable_mock, which we'll need for internal testing + +var log$2 = Scheduler.log; +var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + +var rendererID = null; +var injectedHook = null; +var injectedProfilingHooks = null; +var hasLoggedError = false; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // No DevTools + return false; } -} -function markPassiveEffectsStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { - injectedProfilingHooks.markPassiveEffectsStarted(lanes); - } + + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; } -} -function markPassiveEffectsStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { - injectedProfilingHooks.markPassiveEffectsStopped(); - } + + if (!hook.supportsFiber) { + { + error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); + } // DevTools exists, even though it doesn't support Fiber. + + + return true; } -} -function markRenderStarted(lanes) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { - injectedProfilingHooks.markRenderStarted(lanes); + + try { + if (enableSchedulingProfiler) { + // Conditionally inject these hooks only if Timeline profiler is supported by this build. + // This gives DevTools a way to feature detect that isn't tied to version number + // (since profiling and timeline are controlled by different feature flags). + internals = assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }); } - } -} -function markRenderYielded() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { - injectedProfilingHooks.markRenderYielded(); + + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + + injectedHook = hook; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + error('React instrumentation encountered an error: %s.', err); } } + + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; + } } -function markRenderStopped() { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { - injectedProfilingHooks.markRenderStopped(); +function onScheduleRoot(root, children) { + { + if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { + try { + injectedHook.onScheduleFiberRoot(rendererID, root, children); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } } } } -function markRenderScheduled(lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { - injectedProfilingHooks.markRenderScheduled(lane); +function onCommitRoot(root, eventPriority) { + if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { + try { + var didError = (root.current.flags & DidCapture) === DidCapture; + + if (enableProfilerTimer) { + var schedulerPriority; + + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; + + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; + + case DefaultEventPriority: + schedulerPriority = NormalPriority$1; + break; + + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; + + default: + schedulerPriority = NormalPriority$1; + break; + } + + injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); + } + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } } } } -function markForceUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { - injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); +function onPostCommitRoot(root) { + if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { + try { + injectedHook.onPostCommitFiberRoot(rendererID, root); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } } } } -function markStateUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { - injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); +function onCommitUnmount(fiber) { + if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { + try { + injectedHook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } } } } +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (typeof log$2 === 'function') { + // We're in a test because Scheduler.log only exists + // in SchedulerMock. To reduce the noise in strict mode tests, + // suppress warnings and disable scheduler yielding during the double render + unstable_setDisableYieldValue(newIsStrictMode); + setSuppressWarning(newIsStrictMode); + } -var NoMode = -/* */ -0; // TODO: Remove ConcurrentMode by reading from the root tag instead + if (injectedHook && typeof injectedHook.setStrictMode === 'function') { + try { + injectedHook.setStrictMode(rendererID, newIsStrictMode); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; -var ConcurrentMode = -/* */ -1; -var ProfileMode = -/* */ -2; -var DebugTracingMode = -/* */ -4; -var StrictLegacyMode = -/* */ -8; -var StrictEffectsMode = -/* */ -16; -var ConcurrentUpdatesByDefaultMode = -/* */ -32; -var NoStrictPassiveEffectsMode = -/* */ -64; + error('React instrumentation encountered an error: %s', err); + } + } + } + } + } +} // Profiler API hooks -// TODO: This is pretty well supported by browsers. Maybe we can drop it. -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} -var log$1 = Math.log; -var LN2 = Math.LN2; +function getLaneLabelMap() { + if (enableSchedulingProfiler) { + var map = new Map(); + var lane = 1; -function clz32Fallback(x) { - var asUint = x >>> 0; + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } - if (asUint === 0) { - return 32; + return map; + } else { + return null; } - - return 31 - (log$1(asUint) / LN2 | 0) | 0; } -// If those values are changed that package should be rebuilt and redeployed. - -var TotalLanes = 31; -var NoLanes = -/* */ -0; -var NoLane = -/* */ -0; -var SyncHydrationLane = -/* */ -1; -var SyncLane = -/* */ -2; -var SyncLaneIndex = 1; -var InputContinuousHydrationLane = -/* */ -4; -var InputContinuousLane = -/* */ -8; -var DefaultHydrationLane = -/* */ -16; -var DefaultLane = -/* */ -32; -var SyncUpdateLanes = enableUnifiedSyncLane ? SyncLane | InputContinuousLane | DefaultLane : SyncLane; -var TransitionHydrationLane = -/* */ -64; -var TransitionLanes = -/* */ -4194176; -var TransitionLane1 = -/* */ -128; -var TransitionLane2 = -/* */ -256; -var TransitionLane3 = -/* */ -512; -var TransitionLane4 = -/* */ -1024; -var TransitionLane5 = -/* */ -2048; -var TransitionLane6 = -/* */ -4096; -var TransitionLane7 = -/* */ -8192; -var TransitionLane8 = -/* */ -16384; -var TransitionLane9 = -/* */ -32768; -var TransitionLane10 = -/* */ -65536; -var TransitionLane11 = -/* */ -131072; -var TransitionLane12 = -/* */ -262144; -var TransitionLane13 = -/* */ -524288; -var TransitionLane14 = -/* */ -1048576; -var TransitionLane15 = -/* */ -2097152; -var RetryLanes = -/* */ -62914560; -var RetryLane1 = -/* */ -4194304; -var RetryLane2 = -/* */ -8388608; -var RetryLane3 = -/* */ -16777216; -var RetryLane4 = -/* */ -33554432; -var SomeRetryLane = RetryLane1; -var SelectiveHydrationLane = -/* */ -67108864; -var NonIdleLanes = -/* */ -134217727; -var IdleHydrationLane = -/* */ -134217728; -var IdleLane = -/* */ -268435456; -var OffscreenLane = -/* */ -536870912; -var DeferredLane = -/* */ -1073741824; // Any lane that might schedule an update. This is used to detect infinite -// update loops, so it doesn't include hydration lanes or retries. - -var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) -// It should be kept in sync with the Lanes values above. - -function getLabelForLane(lane) { +function markCommitStarted(lanes) { if (enableSchedulingProfiler) { - if (lane & SyncHydrationLane) { - return 'SyncHydrationLane'; + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { + injectedProfilingHooks.markCommitStarted(lanes); } - - if (lane & SyncLane) { - return 'Sync'; + } +} +function markCommitStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { + injectedProfilingHooks.markCommitStopped(); } - - if (lane & InputContinuousHydrationLane) { - return 'InputContinuousHydration'; + } +} +function markComponentRenderStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { + injectedProfilingHooks.markComponentRenderStarted(fiber); } - - if (lane & InputContinuousLane) { - return 'InputContinuous'; + } +} +function markComponentRenderStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { + injectedProfilingHooks.markComponentRenderStopped(); } - - if (lane & DefaultHydrationLane) { - return 'DefaultHydration'; + } +} +function markComponentPassiveEffectMountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { + injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); } - - if (lane & DefaultLane) { - return 'Default'; + } +} +function markComponentPassiveEffectMountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { + injectedProfilingHooks.markComponentPassiveEffectMountStopped(); } - - if (lane & TransitionHydrationLane) { - return 'TransitionHydration'; + } +} +function markComponentPassiveEffectUnmountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); } - - if (lane & TransitionLanes) { - return 'Transition'; + } +} +function markComponentPassiveEffectUnmountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); } - - if (lane & RetryLanes) { - return 'Retry'; + } +} +function markComponentLayoutEffectMountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { + injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); } - - if (lane & SelectiveHydrationLane) { - return 'SelectiveHydration'; + } +} +function markComponentLayoutEffectMountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); } - - if (lane & IdleHydrationLane) { - return 'IdleHydration'; + } +} +function markComponentLayoutEffectUnmountStarted(fiber) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); } - - if (lane & IdleLane) { - return 'Idle'; + } +} +function markComponentLayoutEffectUnmountStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); } - - if (lane & OffscreenLane) { - return 'Offscreen'; + } +} +function markComponentErrored(fiber, thrownValue, lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { + injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); } - - if (lane & DeferredLane) { - return 'Deferred'; + } +} +function markComponentSuspended(fiber, wakeable, lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { + injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); } } } -var NoTimestamp = -1; -var nextTransitionLane = TransitionLane1; -var nextRetryLane = RetryLane1; - -function getHighestPriorityLanes(lanes) { - if (enableUnifiedSyncLane) { - var pendingSyncLanes = lanes & SyncUpdateLanes; - - if (pendingSyncLanes !== 0) { - return pendingSyncLanes; +function markLayoutEffectsStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { + injectedProfilingHooks.markLayoutEffectsStarted(lanes); } } - - switch (getHighestPriorityLane(lanes)) { - case SyncHydrationLane: - return SyncHydrationLane; - - case SyncLane: - return SyncLane; - - case InputContinuousHydrationLane: - return InputContinuousHydrationLane; - - case InputContinuousLane: - return InputContinuousLane; - - case DefaultHydrationLane: - return DefaultHydrationLane; - - case DefaultLane: - return DefaultLane; - - case TransitionHydrationLane: - return TransitionHydrationLane; - - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return lanes & TransitionLanes; - - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - return lanes & RetryLanes; - - case SelectiveHydrationLane: - return SelectiveHydrationLane; - - case IdleHydrationLane: - return IdleHydrationLane; - - case IdleLane: - return IdleLane; - - case OffscreenLane: - return OffscreenLane; - - case DeferredLane: - // This shouldn't be reachable because deferred work is always entangled - // with something else. - return NoLanes; - - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - - - return lanes; +} +function markLayoutEffectsStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { + injectedProfilingHooks.markLayoutEffectsStopped(); + } } } - -function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; - - if (pendingLanes === NoLanes) { - return NoLanes; +function markPassiveEffectsStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + } } - - var nextLanes = NoLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - } +} +function markPassiveEffectsStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { + injectedProfilingHooks.markPassiveEffectsStopped(); } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; - - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - } + } +} +function markRenderStarted(lanes) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { + injectedProfilingHooks.markRenderStarted(lanes); } } - - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. - - - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - var nextLane = getHighestPriorityLane(nextLanes); - var wipLane = getHighestPriorityLane(wipLanes); - - if ( // Tests whether the next lane is equal or lower priority than the wip - // one. This works because the bits decrease in priority as you go left. - nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The - // only difference between default updates and transition updates is that - // default updates do not support refresh transitions. - nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { - // Keep working on the existing in-progress tree. Do not interrupt. - return wipLanes; +} +function markRenderYielded() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { + injectedProfilingHooks.markRenderYielded(); } } - - return nextLanes; } -function getEntangledLanes(root, renderLanes) { - var entangledLanes = renderLanes; - - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { - // When updates are sync by default, we entangle continuous priority updates - // and default updates, so they render in the same batch. The only reason - // they use separate lanes is because continuous updates should interrupt - // transitions, but default updates should not. - entangledLanes |= entangledLanes & DefaultLane; - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // TODO: Reconsider this. The counter-argument is that the partial work - // represents an intermediate state, which we don't want to show to the user. - // And by spending extra time finishing it, we're increasing the amount of - // time it takes to show the final state, which is what they are actually - // waiting for. - // - // For those exceptions where entanglement is semantically important, - // we should ensure that there is no partial work at the - // time we apply the entanglement. - - - var allEntangledLanes = root.entangledLanes; - - if (allEntangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = entangledLanes & allEntangledLanes; - - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entangledLanes |= entanglements[index]; - lanes &= ~lane; +function markRenderStopped() { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { + injectedProfilingHooks.markRenderStopped(); + } + } +} +function markRenderScheduled(lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { + injectedProfilingHooks.markRenderScheduled(lane); + } + } +} +function markForceUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } +} +function markStateUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); } } - - return entangledLanes; } -function computeExpirationTime(lane, currentTime) { - switch (lane) { - case SyncHydrationLane: - case SyncLane: - case InputContinuousHydrationLane: - case InputContinuousLane: - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. - // When we made it larger, a product metric in www regressed, suggesting - // there's a user interaction that's being starved by a series of - // synchronous updates. If that theory is correct, the proper solution is - // to fix the starvation. However, this scenario supports the idea that - // expiration times are an important safeguard when starvation - // does happen. - return currentTime + syncLaneExpirationMs; +var NoMode = +/* */ +0; // TODO: Remove ConcurrentMode by reading from the root tag instead - case DefaultHydrationLane: - case DefaultLane: - case TransitionHydrationLane: - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return currentTime + transitionLaneExpirationMs; +var ConcurrentMode = +/* */ +1; +var ProfileMode = +/* */ +2; +var DebugTracingMode = +/* */ +4; +var StrictLegacyMode = +/* */ +8; +var StrictEffectsMode = +/* */ +16; +var ConcurrentUpdatesByDefaultMode = +/* */ +32; +var NoStrictPassiveEffectsMode = +/* */ +64; - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - // TODO: Retries should be allowed to expire if they are CPU bound for - // too long, but when I made this change it caused a spike in browser - // crashes. There must be some other underlying bug; not super urgent but - // ideally should figure out why and fix it. Unfortunately we don't have - // a repro for the crashes, only detected via production metrics. - return enableRetryLaneExpiration ? currentTime + retryLaneExpirationMs : NoTimestamp; +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 - case SelectiveHydrationLane: - case IdleHydrationLane: - case IdleLane: - case OffscreenLane: - case DeferredLane: - // Anything idle priority or lower should never expire. - return NoTimestamp; +var log$1 = Math.log; +var LN2 = Math.LN2; - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } +function clz32Fallback(x) { + var asUint = x >>> 0; - return NoTimestamp; + if (asUint === 0) { + return 32; } + + return 31 - (log$1(asUint) / LN2 | 0) | 0; } -function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - // TODO: We should be able to replace this with upgradePendingLanesToSync - // - // We exclude retry lanes because those must always be time sliced, in order - // to unwrap uncached promises. - // TODO: Write a test for this +// If those values are changed that package should be rebuilt and redeployed. - var lanes = enableRetryLaneExpiration ? pendingLanes : pendingLanes & ~RetryLanes; +var TotalLanes = 31; +var NoLanes = +/* */ +0; +var NoLane = +/* */ +0; +var SyncHydrationLane = +/* */ +1; +var SyncLane = +/* */ +2; +var SyncLaneIndex = 1; +var InputContinuousHydrationLane = +/* */ +4; +var InputContinuousLane = +/* */ +8; +var DefaultHydrationLane = +/* */ +16; +var DefaultLane = +/* */ +32; +var SyncUpdateLanes = enableUnifiedSyncLane ? SyncLane | InputContinuousLane | DefaultLane : SyncLane; +var TransitionHydrationLane = +/* */ +64; +var TransitionLanes = +/* */ +4194176; +var TransitionLane1 = +/* */ +128; +var TransitionLane2 = +/* */ +256; +var TransitionLane3 = +/* */ +512; +var TransitionLane4 = +/* */ +1024; +var TransitionLane5 = +/* */ +2048; +var TransitionLane6 = +/* */ +4096; +var TransitionLane7 = +/* */ +8192; +var TransitionLane8 = +/* */ +16384; +var TransitionLane9 = +/* */ +32768; +var TransitionLane10 = +/* */ +65536; +var TransitionLane11 = +/* */ +131072; +var TransitionLane12 = +/* */ +262144; +var TransitionLane13 = +/* */ +524288; +var TransitionLane14 = +/* */ +1048576; +var TransitionLane15 = +/* */ +2097152; +var RetryLanes = +/* */ +62914560; +var RetryLane1 = +/* */ +4194304; +var RetryLane2 = +/* */ +8388608; +var RetryLane3 = +/* */ +16777216; +var RetryLane4 = +/* */ +33554432; +var SomeRetryLane = RetryLane1; +var SelectiveHydrationLane = +/* */ +67108864; +var NonIdleLanes = +/* */ +134217727; +var IdleHydrationLane = +/* */ +134217728; +var IdleLane = +/* */ +268435456; +var OffscreenLane = +/* */ +536870912; +var DeferredLane = +/* */ +1073741824; // Any lane that might schedule an update. This is used to detect infinite +// update loops, so it doesn't include hydration lanes or retries. - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; +var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) +// It should be kept in sync with the Lanes values above. - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; +function getLabelForLane(lane) { + if (enableSchedulingProfiler) { + if (lane & SyncHydrationLane) { + return 'SyncHydrationLane'; } - lanes &= ~lane; - } -} // This returns the highest priority pending lanes regardless of whether they -function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { - if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { - // The error recovery mechanism is disabled until these lanes are cleared. - return NoLanes; - } - - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; - } - - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; - } - - return NoLanes; -} -function includesSyncLane(lanes) { - return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; -} -function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; -} -function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; -} -function includesOnlyNonUrgentLanes(lanes) { - // TODO: Should hydration lanes be included here? This function is only - // used in `updateDeferredValueImpl`. - var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; - return (lanes & UrgentLanes) === NoLanes; -} -function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; -} -function includesBlockingLane(root, lanes) { - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { - // Concurrent updates by default always use time slicing. - return false; - } - - var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; - return (lanes & SyncDefaultLanes) !== NoLanes; -} -function includesExpiredLane(root, lanes) { - // This is a separate check from includesBlockingLane because a lane can - // expire after a render has already started. - return (lanes & root.expiredLanes) !== NoLanes; -} -function isTransitionLane(lane) { - return (lane & TransitionLanes) !== NoLanes; -} -function claimNextTransitionLane() { - // Cycle through the lanes, assigning each new transition to the next lane. - // In most cases, this means every transition gets its own lane, until we - // run out of lanes and cycle back to the beginning. - var lane = nextTransitionLane; - nextTransitionLane <<= 1; + if (lane & SyncLane) { + return 'Sync'; + } - if ((nextTransitionLane & TransitionLanes) === NoLanes) { - nextTransitionLane = TransitionLane1; - } + if (lane & InputContinuousHydrationLane) { + return 'InputContinuousHydration'; + } - return lane; -} -function claimNextRetryLane() { - var lane = nextRetryLane; - nextRetryLane <<= 1; + if (lane & InputContinuousLane) { + return 'InputContinuous'; + } - if ((nextRetryLane & RetryLanes) === NoLanes) { - nextRetryLane = RetryLane1; - } + if (lane & DefaultHydrationLane) { + return 'DefaultHydration'; + } - return lane; -} -function getHighestPriorityLane(lanes) { - return lanes & -lanes; -} -function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); -} + if (lane & DefaultLane) { + return 'Default'; + } -function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); -} + if (lane & TransitionHydrationLane) { + return 'TransitionHydration'; + } -function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); -} + if (lane & TransitionLanes) { + return 'Transition'; + } -function includesSomeLane(a, b) { - return (a & b) !== NoLanes; -} -function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; -} -function mergeLanes(a, b) { - return a | b; -} -function removeLanes(set, subset) { - return set & ~subset; -} -function intersectLanes(a, b) { - return a & b; -} // Seems redundant, but it changes the type from a single lane (used for -// updates) to a group of lanes (used for flushing work). + if (lane & RetryLanes) { + return 'Retry'; + } -function laneToLanes(lane) { - return lane; -} -function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; + if (lane & SelectiveHydrationLane) { + return 'SelectiveHydration'; + } - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); - } + if (lane & IdleHydrationLane) { + return 'IdleHydration'; + } - return laneMap; -} -function markRootUpdated$1(root, updateLane) { - root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update - // could unblock them. Clear the suspended lanes so that we can try rendering - // them again. - // - // TODO: We really only need to unsuspend only lanes that are in the - // `subtreeLanes` of the updated fiber, or the update lanes of the return - // path. This would exclude suspended updates in an unrelated sibling tree, - // since there's no way for this update to unblock it. - // - // We don't do this if the incoming update is idle, because we never process - // idle updates until after all the regular updates have finished; there's no - // way it could unblock a transition. + if (lane & IdleLane) { + return 'Idle'; + } - if (updateLane !== IdleLane) { - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; + if (lane & OffscreenLane) { + return 'Offscreen'; + } + + if (lane & DeferredLane) { + return 'Deferred'; + } } } -function markRootSuspended$1(root, suspendedLanes, spawnedLane) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. +var NoTimestamp = -1; +var nextTransitionLane = TransitionLane1; +var nextRetryLane = RetryLane1; - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; +function getHighestPriorityLanes(lanes) { + if (enableUnifiedSyncLane) { + var pendingSyncLanes = lanes & SyncUpdateLanes; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; + if (pendingSyncLanes !== 0) { + return pendingSyncLanes; + } } - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); - } -} -function markRootPinged$1(root, pingedLanes) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; -} -function markRootFinished(root, remainingLanes, spawnedLane) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again + switch (getHighestPriorityLane(lanes)) { + case SyncHydrationLane: + return SyncHydrationLane; - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - root.expiredLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - root.errorRecoveryDisabledLanes &= remainingLanes; - root.shellSuspendCounter = 0; - var entanglements = root.entanglements; - var expirationTimes = root.expirationTimes; - var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work + case SyncLane: + return SyncLane; - var lanes = noLongerPendingLanes; + case InputContinuousHydrationLane: + return InputContinuousHydrationLane; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - expirationTimes[index] = NoTimestamp; - var hiddenUpdatesForLane = hiddenUpdates[index]; + case InputContinuousLane: + return InputContinuousLane; - if (hiddenUpdatesForLane !== null) { - hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They - // have special logic associated with them because they may be entangled - // with updates that occur outside that tree. But once the outer tree - // commits, they behave like regular updates. + case DefaultHydrationLane: + return DefaultHydrationLane; - for (var i = 0; i < hiddenUpdatesForLane.length; i++) { - var update = hiddenUpdatesForLane[i]; + case DefaultLane: + return DefaultLane; - if (update !== null) { - update.lane &= ~OffscreenLane; - } - } - } + case TransitionHydrationLane: + return TransitionHydrationLane; - lanes &= ~lane; - } + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return lanes & TransitionLanes; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need - // to entangle the spawned task with the parent task. - NoLanes); - } -} + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + return lanes & RetryLanes; -function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { - // This render spawned a deferred task. Mark it as pending. - root.pendingLanes |= spawnedLane; - root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it - // was the result of another render. This lets us avoid a useDeferredValue - // waterfall — only the first level will defer. + case SelectiveHydrationLane: + return SelectiveHydrationLane; - var spawnedLaneIndex = laneToIndex(spawnedLane); - root.entangledLanes |= spawnedLane; - root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes - // with the spawned task, so that the deferred task includes all the same - // updates that the parent task did. We can exclude any lane that is not - // used for updates (e.g. Offscreen). - entangledLanes & UpdateLanes; -} + case IdleHydrationLane: + return IdleHydrationLane; -function markRootEntangled(root, entangledLanes) { - // In addition to entangling each of the given lanes with each other, we also - // have to consider _transitive_ entanglements. For each lane that is already - // entangled with *any* of the given lanes, that lane is now transitively - // entangled with *all* the given lanes. - // - // Translated: If C is entangled with A, then entangling A with B also - // entangles C with B. - // - // If this is hard to grasp, it might help to intentionally break this - // function and look at the tests that fail in ReactTransition-test.js. Try - // commenting out one of the conditions below. - var rootEntangledLanes = root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = rootEntangledLanes; + case IdleLane: + return IdleLane; - while (lanes) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; + case OffscreenLane: + return OffscreenLane; - if ( // Is this one of the newly entangled lanes? - lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? - entanglements[index] & entangledLanes) { - entanglements[index] |= entangledLanes; - } + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; - lanes &= ~lane; - } -} -function upgradePendingLaneToSync(root, lane) { - // Since we're upgrading the priority of the given lane, there is now pending - // sync work. - root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane - // will not be allowed to finish without also finishing the given lane. + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - root.entangledLanes |= SyncLane; - root.entanglements[SyncLaneIndex] |= lane; -} -function markHiddenUpdate(root, update, lane) { - var index = laneToIndex(lane); - var hiddenUpdates = root.hiddenUpdates; - var hiddenUpdatesForLane = hiddenUpdates[index]; - if (hiddenUpdatesForLane === null) { - hiddenUpdates[index] = [update]; - } else { - hiddenUpdatesForLane.push(update); + return lanes; } - - update.lane = lane | OffscreenLane; } -function getBumpedLaneForHydration(root, renderLanes) { - var renderLane = getHighestPriorityLane(renderLanes); - var lane; - if (enableUnifiedSyncLane && (renderLane & SyncUpdateLanes) !== NoLane) { - lane = SyncHydrationLane; - } else { - switch (renderLane) { - case SyncLane: - lane = SyncHydrationLane; - break; +function getNextLanes(root, wipLanes) { + // Early bailout if there's no pending work left. + var pendingLanes = root.pendingLanes; - case InputContinuousLane: - lane = InputContinuousHydrationLane; - break; + if (pendingLanes === NoLanes) { + return NoLanes; + } - case DefaultLane: - lane = DefaultHydrationLane; - break; + var nextLanes = NoLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - lane = TransitionHydrationLane; - break; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - case IdleLane: - lane = IdleHydrationLane; - break; + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; - default: - // Everything else is already either a hydration lane, or shouldn't - // be retried at a hydration lane. - lane = NoLane; - break; - } - } // Check if the lane we chose is suspended. If so, that indicates that we - // already attempted and failed to hydrate at that level. Also check if we're - // already rendering that lane, which is rare but could happen. + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); + } + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; - if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { - // Give up trying to hydrate and fall back to client render. - return NoLane; + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); + } + } } - return lane; -} -function addFiberToLanesMap(root, fiber, lanes) { + if (nextLanes === NoLanes) { + // This should only be reachable if we're suspended + // TODO: Consider warning in this path if a fallback timer is not scheduled. + return NoLanes; + } // If we're already in the middle of a render, switching lanes will interrupt + // it and we'll lose our progress. We should only do this if the new lanes are + // higher priority. - if (!isDevToolsPresent) { - return; - } - var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; + if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't + // bother waiting until the root is complete. + (wipLanes & suspendedLanes) === NoLanes) { + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var updaters = pendingUpdatersLaneMap[index]; - updaters.add(fiber); - lanes &= ~lane; + if ( // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The + // only difference between default updates and transition updates is that + // default updates do not support refresh transitions. + nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { + // Keep working on the existing in-progress tree. Do not interrupt. + return wipLanes; + } } + + return nextLanes; } -function movePendingFibersToMemoized(root, lanes) { +function getEntangledLanes(root, renderLanes) { + var entangledLanes = renderLanes; - if (!isDevToolsPresent) { - return; - } + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { + // When updates are sync by default, we entangle continuous priority updates + // and default updates, so they render in the same batch. The only reason + // they use separate lanes is because continuous updates should interrupt + // transitions, but default updates should not. + entangledLanes |= entangledLanes & DefaultLane; + } // Check for entangled lanes and add them to the batch. + // + // A lane is said to be entangled with another when it's not allowed to render + // in a batch that does not also include the other lane. Typically we do this + // when multiple updates have the same source, and we only want to respond to + // the most recent event from that source. + // + // Note that we apply entanglements *after* checking for partial work above. + // This means that if a lane is entangled during an interleaved event while + // it's already rendering, we won't interrupt it. This is intentional, since + // entanglement is usually "best effort": we'll try our best to render the + // lanes in the same batch, but it's not worth throwing out partially + // completed work in order to do it. + // TODO: Reconsider this. The counter-argument is that the partial work + // represents an intermediate state, which we don't want to show to the user. + // And by spending extra time finishing it, we're increasing the amount of + // time it takes to show the final state, which is what they are actually + // waiting for. + // + // For those exceptions where entanglement is semantically important, + // we should ensure that there is no partial work at the + // time we apply the entanglement. - var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; - var memoizedUpdaters = root.memoizedUpdaters; - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var updaters = pendingUpdatersLaneMap[index]; + var allEntangledLanes = root.entangledLanes; - if (updaters.size > 0) { - updaters.forEach(function (fiber) { - var alternate = fiber.alternate; + if (allEntangledLanes !== NoLanes) { + var entanglements = root.entanglements; + var lanes = entangledLanes & allEntangledLanes; - if (alternate === null || !memoizedUpdaters.has(alternate)) { - memoizedUpdaters.add(fiber); - } - }); - updaters.clear(); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entangledLanes |= entanglements[index]; + lanes &= ~lane; } - - lanes &= ~lane; } + + return entangledLanes; } -function addTransitionToLanesMap(root, transition, lane) { - if (enableTransitionTracing) { - var transitionLanesMap = root.transitionLanes; - var index = laneToIndex(lane); - var transitions = transitionLanesMap[index]; - if (transitions === null) { - transitions = new Set(); - } +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case SyncHydrationLane: + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + syncLaneExpirationMs; + + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return currentTime + transitionLaneExpirationMs; + + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + // TODO: Retries should be allowed to expire if they are CPU bound for + // too long, but when I made this change it caused a spike in browser + // crashes. There must be some other underlying bug; not super urgent but + // ideally should figure out why and fix it. Unfortunately we don't have + // a repro for the crashes, only detected via production metrics. + return enableRetryLaneExpiration ? currentTime + retryLaneExpirationMs : NoTimestamp; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + case DeferredLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; + + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } - transitions.add(transition); - transitionLanesMap[index] = transitions; + return NoTimestamp; } } -function getTransitionsForLanes(root, lanes) { - if (!enableTransitionTracing) { - return null; - } - var transitionsForLanes = []; +function markStarvedLanesAsExpired(root, currentTime) { + // TODO: This gets called every time we yield. We can optimize by storing + // the earliest expiration time on the root. Then use that to quickly bail out + // of this function. + var pendingLanes = root.pendingLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; + var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their + // expiration time. If so, we'll assume the update is being starved and mark + // it as expired to force it to finish. + // TODO: We should be able to replace this with upgradePendingLanesToSync + // + // We exclude retry lanes because those must always be time sliced, in order + // to unwrap uncached promises. + // TODO: Write a test for this + + var lanes = enableRetryLaneExpiration ? pendingLanes : pendingLanes & ~RetryLanes; while (lanes > 0) { - var index = laneToIndex(lanes); + var index = pickArbitraryLaneIndex(lanes); var lane = 1 << index; - var transitions = root.transitionLanes[index]; + var expirationTime = expirationTimes[index]; - if (transitions !== null) { - transitions.forEach(function (transition) { - transitionsForLanes.push(transition); - }); + if (expirationTime === NoTimestamp) { + // Found a pending lane with no expiration time. If it's not suspended, or + // if it's pinged, assume it's CPU-bound. Compute a new expiration time + // using the current time. + if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { + // Assumes timestamps are monotonically increasing. + expirationTimes[index] = computeExpirationTime(lane, currentTime); + } + } else if (expirationTime <= currentTime) { + // This lane expired + root.expiredLanes |= lane; } lanes &= ~lane; } - - if (transitionsForLanes.length === 0) { - return null; - } - - return transitionsForLanes; -} -function clearTransitionsForLanes(root, lanes) { - if (!enableTransitionTracing) { - return; +} // This returns the highest priority pending lanes regardless of whether they +function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { + if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { + // The error recovery mechanism is disabled until these lanes are cleared. + return NoLanes; } - while (lanes > 0) { - var index = laneToIndex(lanes); - var lane = 1 << index; - var transitions = root.transitionLanes[index]; + var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - if (transitions !== null) { - root.transitionLanes[index] = null; - } + if (everythingButOffscreen !== NoLanes) { + return everythingButOffscreen; + } - lanes &= ~lane; + if (everythingButOffscreen & OffscreenLane) { + return OffscreenLane; } -} -var NoEventPriority = NoLane; -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; + return NoLanes; } -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; +function includesSyncLane(lanes) { + return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; } -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; +function includesNonIdleWork(lanes) { + return (lanes & NonIdleLanes) !== NoLanes; } -function eventPriorityToLane(updatePriority) { - return updatePriority; +function includesOnlyRetries(lanes) { + return (lanes & RetryLanes) === lanes; } -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); - - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } - - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; +function includesOnlyNonUrgentLanes(lanes) { + // TODO: Should hydration lanes be included here? This function is only + // used in `updateDeferredValueImpl`. + var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; + return (lanes & UrgentLanes) === NoLanes; +} +function includesOnlyTransitions(lanes) { + return (lanes & TransitionLanes) === lanes; +} +function includesBlockingLane(root, lanes) { + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { + // Concurrent updates by default always use time slicing. + return false; } - return IdleEventPriority; + var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; + return (lanes & SyncDefaultLanes) !== NoLanes; } +function includesExpiredLane(root, lanes) { + // This is a separate check from includesBlockingLane because a lane can + // expire after a render has already started. + return (lanes & root.expiredLanes) !== NoLanes; +} +function isTransitionLane(lane) { + return (lane & TransitionLanes) !== NoLanes; +} +function claimNextTransitionLane() { + // Cycle through the lanes, assigning each new transition to the next lane. + // In most cases, this means every transition gets its own lane, until we + // run out of lanes and cycle back to the beginning. + var lane = nextTransitionLane; + nextTransitionLane <<= 1; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim$2() { - throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Hydration (when unsupported) - - -var supportsHydration = false; -var isSuspenseInstancePending = shim$2; -var isSuspenseInstanceFallback = shim$2; -var getSuspenseInstanceFallbackErrorDetails = shim$2; -var registerSuspenseInstanceRetry = shim$2; -var clearSuspenseBoundary = shim$2; -var clearSuspenseBoundaryFromContainer = shim$2; - -// Renderers that don't support React Scopes -// can re-export everything from this module. -function shim$1() { - throw new Error('The current renderer does not support React Scopes. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // React Scopes (when unsupported) - - -var prepareScopeUpdate = shim$1; -var getInstanceFromScope = shim$1; - -// Renderers that don't support hydration -// can re-export everything from this module. -function shim() { - throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Resources (when unsupported) -var preloadResource = shim; -var suspendResource = shim; - -var pooledTransform = new Transform(); -var NO_CONTEXT = {}; + if ((nextTransitionLane & TransitionLanes) === NoLanes) { + nextTransitionLane = TransitionLane1; + } -{ - Object.freeze(NO_CONTEXT); + return lane; } -/** Helper Methods */ - +function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; -function addEventListeners(instance, type, listener) { - // We need to explicitly unregister before unmount. - // For this reason we need to track subscriptions. - if (!instance._listeners) { - instance._listeners = {}; - instance._subscriptions = {}; + if ((nextRetryLane & RetryLanes) === NoLanes) { + nextRetryLane = RetryLane1; } - instance._listeners[type] = listener; + return lane; +} +function getHighestPriorityLane(lanes) { + return lanes & -lanes; +} +function pickArbitraryLane(lanes) { + // This wrapper function gets inlined. Only exists so to communicate that it + // doesn't matter which bit is selected; you can pick any bit without + // affecting the algorithms where its used. Here I'm using + // getHighestPriorityLane because it requires the fewest operations. + return getHighestPriorityLane(lanes); +} - if (listener) { - if (!instance._subscriptions[type]) { - instance._subscriptions[type] = instance.subscribe(type, createEventHandler(instance), instance); - } - } else { - if (instance._subscriptions[type]) { - instance._subscriptions[type](); +function pickArbitraryLaneIndex(lanes) { + return 31 - clz32(lanes); +} - delete instance._subscriptions[type]; - } - } +function laneToIndex(lane) { + return pickArbitraryLaneIndex(lane); } -function createEventHandler(instance) { - return function handleEvent(event) { - var listener = instance._listeners[event.type]; +function includesSomeLane(a, b) { + return (a & b) !== NoLanes; +} +function isSubsetOfLanes(set, subset) { + return (set & subset) === subset; +} +function mergeLanes(a, b) { + return a | b; +} +function removeLanes(set, subset) { + return set & ~subset; +} +function intersectLanes(a, b) { + return a & b; +} // Seems redundant, but it changes the type from a single lane (used for +// updates) to a group of lanes (used for flushing work). - if (!listener) ; else if (typeof listener === 'function') { - listener.call(instance, event); - } else if (listener.handleEvent) { - listener.handleEvent(event); - } - }; +function laneToLanes(lane) { + return lane; } +function createLaneMap(initial) { + // Intentionally pushing one by one. + // https://v8.dev/blog/elements-kinds#avoid-creating-holes + var laneMap = []; -function destroyEventListeners(instance) { - if (instance._subscriptions) { - for (var type in instance._subscriptions) { - instance._subscriptions[type](); - } + for (var i = 0; i < TotalLanes; i++) { + laneMap.push(initial); } - instance._subscriptions = null; - instance._listeners = null; + return laneMap; } +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update + // could unblock them. Clear the suspended lanes so that we can try rendering + // them again. + // + // TODO: We really only need to unsuspend only lanes that are in the + // `subtreeLanes` of the updated fiber, or the update lanes of the return + // path. This would exclude suspended updates in an unrelated sibling tree, + // since there's no way for this update to unblock it. + // + // We don't do this if the incoming update is idle, because we never process + // idle updates until after all the regular updates have finished; there's no + // way it could unblock a transition. -function getScaleX(props) { - if (props.scaleX != null) { - return props.scaleX; - } else if (props.scale != null) { - return props.scale; - } else { - return 1; + if (updateLane !== IdleLane) { + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; } } +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. -function getScaleY(props) { - if (props.scaleY != null) { - return props.scaleY; - } else if (props.scale != null) { - return props.scale; - } else { - return 1; + var expirationTimes = root.expirationTimes; + var lanes = suspendedLanes; + + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + expirationTimes[index] = NoTimestamp; + lanes &= ~lane; } -} -function isSameFont(oldFont, newFont) { - if (oldFont === newFont) { - return true; - } else if (typeof newFont === 'string' || typeof oldFont === 'string') { - return false; - } else { - return newFont.fontSize === oldFont.fontSize && newFont.fontStyle === oldFont.fontStyle && newFont.fontVariant === oldFont.fontVariant && newFont.fontWeight === oldFont.fontWeight && newFont.fontFamily === oldFont.fontFamily; + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); } } -/** Render Methods */ +function markRootPinged$1(root, pingedLanes) { + root.pingedLanes |= root.suspendedLanes & pingedLanes; +} +function markRootFinished(root, remainingLanes, spawnedLane) { + var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; + root.pendingLanes = remainingLanes; // Let's try everything again + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements; + var expirationTimes = root.expirationTimes; + var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work -function applyClippingRectangleProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); - instance.width = props.width; - instance.height = props.height; -} + var lanes = noLongerPendingLanes; -function applyGroupProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); - instance.width = props.width; - instance.height = props.height; -} + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entanglements[index] = NoLanes; + expirationTimes[index] = NoTimestamp; + var hiddenUpdatesForLane = hiddenUpdates[index]; -function applyNodeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - var scaleX = getScaleX(props); - var scaleY = getScaleY(props); - pooledTransform.transformTo(1, 0, 0, 1, 0, 0).move(props.x || 0, props.y || 0).rotate(props.rotation || 0, props.originX, props.originY).scale(scaleX, scaleY, props.originX, props.originY); + if (hiddenUpdatesForLane !== null) { + hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They + // have special logic associated with them because they may be entangled + // with updates that occur outside that tree. But once the outer tree + // commits, they behave like regular updates. - if (props.transform != null) { - pooledTransform.transform(props.transform); - } + for (var i = 0; i < hiddenUpdatesForLane.length; i++) { + var update = hiddenUpdatesForLane[i]; - if (instance.xx !== pooledTransform.xx || instance.yx !== pooledTransform.yx || instance.xy !== pooledTransform.xy || instance.yy !== pooledTransform.yy || instance.x !== pooledTransform.x || instance.y !== pooledTransform.y) { - instance.transformTo(pooledTransform); - } + if (update !== null) { + update.lane &= ~OffscreenLane; + } + } + } - if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) { - instance.indicate(props.cursor, props.title); + lanes &= ~lane; } - if (instance.blend && props.opacity !== prevProps.opacity) { - instance.blend(props.opacity == null ? 1 : props.opacity); + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes); } +} - if (props.visible !== prevProps.visible) { - if (props.visible == null || props.visible) { - instance.show(); - } else { - instance.hide(); - } - } +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. - for (var type in EVENT_TYPES) { - addEventListeners(instance, EVENT_TYPES[type], props[type]); - } + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task, so that the deferred task includes all the same + // updates that the parent task did. We can exclude any lane that is not + // used for updates (e.g. Offscreen). + entangledLanes & UpdateLanes; } -function applyRenderableNodeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyNodeProps(instance, props, prevProps); +function markRootEntangled(root, entangledLanes) { + // In addition to entangling each of the given lanes with each other, we also + // have to consider _transitive_ entanglements. For each lane that is already + // entangled with *any* of the given lanes, that lane is now transitively + // entangled with *all* the given lanes. + // + // Translated: If C is entangled with A, then entangling A with B also + // entangles C with B. + // + // If this is hard to grasp, it might help to intentionally break this + // function and look at the tests that fail in ReactTransition-test.js. Try + // commenting out one of the conditions below. + var rootEntangledLanes = root.entangledLanes |= entangledLanes; + var entanglements = root.entanglements; + var lanes = rootEntangledLanes; - if (prevProps.fill !== props.fill) { - if (props.fill && props.fill.applyFill) { - props.fill.applyFill(instance); - } else { - instance.fill(props.fill); + while (lanes) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + + if ( // Is this one of the newly entangled lanes? + lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? + entanglements[index] & entangledLanes) { + entanglements[index] |= entangledLanes; } - } - if (prevProps.stroke !== props.stroke || prevProps.strokeWidth !== props.strokeWidth || prevProps.strokeCap !== props.strokeCap || prevProps.strokeJoin !== props.strokeJoin || // TODO: Consider deep check of stokeDash; may benefit VML in IE. - prevProps.strokeDash !== props.strokeDash) { - instance.stroke(props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash); + lanes &= ~lane; } } +function upgradePendingLaneToSync(root, lane) { + // Since we're upgrading the priority of the given lane, there is now pending + // sync work. + root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane + // will not be allowed to finish without also finishing the given lane. -function applyShapeProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyRenderableNodeProps(instance, props, prevProps); - var path = props.d || childrenAsString(props.children); - var prevDelta = instance._prevDelta; - var prevPath = instance._prevPath; - - if (path !== prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width) { - instance.draw(path, props.width, props.height); - instance._prevDelta = path.delta; - instance._prevPath = path; - } + root.entangledLanes |= SyncLane; + root.entanglements[SyncLaneIndex] |= lane; } +function markHiddenUpdate(root, update, lane) { + var index = laneToIndex(lane); + var hiddenUpdates = root.hiddenUpdates; + var hiddenUpdatesForLane = hiddenUpdates[index]; -function applyTextProps(instance, props) { - var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - applyRenderableNodeProps(instance, props, prevProps); - var string = props.children; - - if (instance._currentString !== string || !isSameFont(props.font, prevProps.font) || props.alignment !== prevProps.alignment || props.path !== prevProps.path) { - instance.draw(string, props.font, props.alignment, props.path); - instance._currentString = string; - } -} -function appendInitialChild(parentInstance, child) { - if (typeof child === 'string') { - // Noop for string children of Text (eg {'foo'}{'bar'}) - throw new Error('Text children should already be flattened.'); + if (hiddenUpdatesForLane === null) { + hiddenUpdates[index] = [update]; + } else { + hiddenUpdatesForLane.push(update); } - child.inject(parentInstance); + update.lane = lane | OffscreenLane; } -function createInstance(type, props, internalInstanceHandle) { - var instance; +function getBumpedLaneForHydration(root, renderLanes) { + var renderLane = getHighestPriorityLane(renderLanes); + var lane; - switch (type) { - case TYPES.CLIPPING_RECTANGLE: - instance = Mode$1.ClippingRectangle(); - instance._applyProps = applyClippingRectangleProps; - break; + if (enableUnifiedSyncLane && (renderLane & SyncUpdateLanes) !== NoLane) { + lane = SyncHydrationLane; + } else { + switch (renderLane) { + case SyncLane: + lane = SyncHydrationLane; + break; - case TYPES.GROUP: - instance = Mode$1.Group(); - instance._applyProps = applyGroupProps; - break; + case InputContinuousLane: + lane = InputContinuousHydrationLane; + break; - case TYPES.SHAPE: - instance = Mode$1.Shape(); - instance._applyProps = applyShapeProps; - break; + case DefaultLane: + lane = DefaultHydrationLane; + break; - case TYPES.TEXT: - instance = Mode$1.Text(props.children, props.font, props.alignment, props.path); - instance._applyProps = applyTextProps; - break; - } + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + lane = TransitionHydrationLane; + break; - if (!instance) { - throw new Error("ReactART does not support the type \"" + type + "\""); - } + case IdleLane: + lane = IdleHydrationLane; + break; - instance._applyProps(instance, props); + default: + // Everything else is already either a hydration lane, or shouldn't + // be retried at a hydration lane. + lane = NoLane; + break; + } + } // Check if the lane we chose is suspended. If so, that indicates that we + // already attempted and failed to hydrate at that level. Also check if we're + // already rendering that lane, which is rare but could happen. - return instance; -} -function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { - return text; -} -function getPublicInstance(instance) { - return instance; -} -function prepareForCommit() { - // Noop - return null; -} -function resetTextContent(domElement) {// Noop -} -function getRootHostContext() { - return NO_CONTEXT; -} -function getChildHostContext() { - return NO_CONTEXT; -} -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; -function shouldSetTextContent(type, props) { - return typeof props.children === 'string' || typeof props.children === 'number'; -} -var currentUpdatePriority = NoEventPriority; -function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; -} -function getCurrentUpdatePriority() { - return currentUpdatePriority; -} -function resolveUpdatePriority() { - return currentUpdatePriority || DefaultEventPriority; -} -function shouldAttemptEagerTransition() { - return false; -} // The ART renderer is secondary to the React DOM renderer. -function appendChild(parentInstance, child) { - if (child.parentNode === parentInstance) { - child.eject(); - } - child.inject(parentInstance); -} -function appendChildToContainer(parentInstance, child) { - if (child.parentNode === parentInstance) { - child.eject(); + if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { + // Give up trying to hydrate and fall back to client render. + return NoLane; } - child.inject(parentInstance); + return lane; } -function insertBefore(parentInstance, child, beforeChild) { - if (child === beforeChild) { - throw new Error('ReactART: Can not insert node before itself'); - } +function addFiberToLanesMap(root, fiber, lanes) { - child.injectBefore(beforeChild); -} -function insertInContainerBefore(parentInstance, child, beforeChild) { - if (child === beforeChild) { - throw new Error('ReactART: Can not insert node before itself'); + if (!isDevToolsPresent) { + return; } - child.injectBefore(beforeChild); -} -function removeChild(parentInstance, child) { - destroyEventListeners(child); - child.eject(); -} -function removeChildFromContainer(parentInstance, child) { - destroyEventListeners(child); - child.eject(); -} -function commitTextUpdate(textInstance, oldText, newText) {// Noop -} -function commitMount(instance, type, newProps) {// Noop -} -function commitUpdate(instance, type, oldProps, newProps) { - instance._applyProps(instance, newProps, oldProps); -} -function hideInstance(instance) { - instance.hide(); -} -function hideTextInstance(textInstance) {// Noop -} -function unhideInstance(instance, props) { - if (props.visible == null || props.visible) { - instance.show(); + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; + + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var updaters = pendingUpdatersLaneMap[index]; + updaters.add(fiber); + lanes &= ~lane; } } -function unhideTextInstance(textInstance, text) {// Noop -} -function getInstanceFromNode(node) { - throw new Error('Not implemented.'); -} -function preloadInstance(type, props) { - // Return true to indicate it's already loaded - return true; -} -function waitForCommitToBeReady() { - return null; -} -var NotPendingTransition = null; +function movePendingFibersToMemoized(root, lanes) { -var valueStack = []; -var fiberStack; + if (!isDevToolsPresent) { + return; + } -{ - fiberStack = []; -} + var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; + var memoizedUpdaters = root.memoizedUpdaters; -var index = -1; + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var updaters = pendingUpdatersLaneMap[index]; -function createCursor(defaultValue) { - return { - current: defaultValue - }; -} + if (updaters.size > 0) { + updaters.forEach(function (fiber) { + var alternate = fiber.alternate; -function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); + if (alternate === null || !memoizedUpdaters.has(alternate)) { + memoizedUpdaters.add(fiber); + } + }); + updaters.clear(); } - return; + lanes &= ~lane; } +} +function addTransitionToLanesMap(root, transition, lane) { + if (enableTransitionTracing) { + var transitionLanesMap = root.transitionLanes; + var index = laneToIndex(lane); + var transitions = transitionLanesMap[index]; - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); + if (transitions === null) { + transitions = new Set(); } + + transitions.add(transition); + transitionLanesMap[index] = transitions; + } +} +function getTransitionsForLanes(root, lanes) { + if (!enableTransitionTracing) { + return null; } - cursor.current = valueStack[index]; - valueStack[index] = null; + var transitionsForLanes = []; - { - fiberStack[index] = null; - } + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var transitions = root.transitionLanes[index]; - index--; -} + if (transitions !== null) { + transitions.forEach(function (transition) { + transitionsForLanes.push(transition); + }); + } -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; + lanes &= ~lane; + } - { - fiberStack[index] = fiber; + if (transitionsForLanes.length === 0) { + return null; } - cursor.current = value; + return transitionsForLanes; } +function clearTransitionsForLanes(root, lanes) { + if (!enableTransitionTracing) { + return; + } -var emptyContextObject = {}; + while (lanes > 0) { + var index = laneToIndex(lanes); + var lane = 1 << index; + var transitions = root.transitionLanes[index]; -{ - Object.freeze(emptyContextObject); -} // A cursor to the current merged context object on the stack. + if (transitions !== null) { + root.transitionLanes[index] = null; + } -function hasContextChanged() { - { - return false; + lanes &= ~lane; } } -function isContextProvider(type) { - { - return false; - } +var NoEventPriority = NoLane; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; } +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -function processChildContext(fiber, type, parentContext) { - { - return parentContext; + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; } -} -function findCurrentUnmaskedContext(fiber) { - { - return emptyContextObject; + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; } -} -// We use the existence of the state object as an indicator that the component -// is hidden. -var OffscreenVisible = -/* */ -1; -var OffscreenDetached = -/* */ -2; -var OffscreenPassiveEffectsConnected = -/* */ -4; -function isOffscreenManual(offscreenFiber) { - return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; -} + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; + } -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; + return IdleEventPriority; } -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; +// Renderers that don't support hydration +// can re-export everything from this module. +function shim$2() { + throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Hydration (when unsupported) -var nativeConsole = console; -var nativeConsoleLog = null; -var pendingGroupArgs = []; -var printedGroupIndex = -1; -function formatLanes(laneOrLanes) { - return '0b' + laneOrLanes.toString(2).padStart(31, '0'); -} +var supportsHydration = false; +var isSuspenseInstancePending = shim$2; +var isSuspenseInstanceFallback = shim$2; +var getSuspenseInstanceFallbackErrorDetails = shim$2; +var registerSuspenseInstanceRetry = shim$2; +var clearSuspenseBoundary = shim$2; +var clearSuspenseBoundaryFromContainer = shim$2; -function group() { - for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { - groupArgs[_key] = arguments[_key]; - } +// Renderers that don't support React Scopes +// can re-export everything from this module. +function shim$1() { + throw new Error('The current renderer does not support React Scopes. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // React Scopes (when unsupported) - pendingGroupArgs.push(groupArgs); - if (nativeConsoleLog === null) { - nativeConsoleLog = nativeConsole.log; - nativeConsole.log = log; - } +var prepareScopeUpdate = shim$1; +var getInstanceFromScope = shim$1; + +// Renderers that don't support hydration +// can re-export everything from this module. +function shim() { + throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Resources (when unsupported) +var preloadResource = shim; +var suspendResource = shim; + +var pooledTransform = new Transform(); +var NO_CONTEXT = {}; + +{ + Object.freeze(NO_CONTEXT); } +/** Helper Methods */ -function groupEnd() { - pendingGroupArgs.pop(); - while (printedGroupIndex >= pendingGroupArgs.length) { - nativeConsole.groupEnd(); - printedGroupIndex--; +function addEventListeners(instance, type, listener) { + // We need to explicitly unregister before unmount. + // For this reason we need to track subscriptions. + if (!instance._listeners) { + instance._listeners = {}; + instance._subscriptions = {}; } - if (pendingGroupArgs.length === 0) { - nativeConsole.log = nativeConsoleLog; - nativeConsoleLog = null; + instance._listeners[type] = listener; + + if (listener) { + if (!instance._subscriptions[type]) { + instance._subscriptions[type] = instance.subscribe(type, createEventHandler(instance), instance); + } + } else { + if (instance._subscriptions[type]) { + instance._subscriptions[type](); + + delete instance._subscriptions[type]; + } } } -function log() { - if (printedGroupIndex < pendingGroupArgs.length - 1) { - for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { - var groupArgs = pendingGroupArgs[i]; - nativeConsole.group.apply(nativeConsole, groupArgs); +function createEventHandler(instance) { + return function handleEvent(event) { + var listener = instance._listeners[event.type]; + + if (!listener) ; else if (typeof listener === 'function') { + listener.call(instance, event); + } else if (listener.handleEvent) { + listener.handleEvent(event); } + }; +} - printedGroupIndex = pendingGroupArgs.length - 1; +function destroyEventListeners(instance) { + if (instance._subscriptions) { + for (var type in instance._subscriptions) { + instance._subscriptions[type](); + } } - if (typeof nativeConsoleLog === 'function') { - nativeConsoleLog.apply(void 0, arguments); + instance._subscriptions = null; + instance._listeners = null; +} + +function getScaleX(props) { + if (props.scaleX != null) { + return props.scaleX; + } else if (props.scale != null) { + return props.scale; } else { - nativeConsole.log.apply(nativeConsole, arguments); + return 1; } } -var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; -function logCommitStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } +function getScaleY(props) { + if (props.scaleY != null) { + return props.scaleY; + } else if (props.scale != null) { + return props.scale; + } else { + return 1; } } -function logCommitStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } + +function isSameFont(oldFont, newFont) { + if (oldFont === newFont) { + return true; + } else if (typeof newFont === 'string' || typeof oldFont === 'string') { + return false; + } else { + return newFont.fontSize === oldFont.fontSize && newFont.fontStyle === oldFont.fontStyle && newFont.fontVariant === oldFont.fontVariant && newFont.fontWeight === oldFont.fontWeight && newFont.fontFamily === oldFont.fontFamily; } } -var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps +/** Render Methods */ -var wakeableIDs = new PossiblyWeakMap$2(); -var wakeableID = 0; -function getWakeableID(wakeable) { - if (!wakeableIDs.has(wakeable)) { - wakeableIDs.set(wakeable, wakeableID++); - } +function applyClippingRectangleProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); + instance.width = props.width; + instance.height = props.height; +} - return wakeableIDs.get(wakeable); +function applyGroupProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); + instance.width = props.width; + instance.height = props.height; } -function logComponentSuspended(componentName, wakeable) { - { - if (enableDebugTracing) { - var id = getWakeableID(wakeable); - var display = wakeable.displayName || wakeable; - log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - wakeable.then(function () { - log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }, function () { - log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }); - } +function applyNodeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var scaleX = getScaleX(props); + var scaleY = getScaleY(props); + pooledTransform.transformTo(1, 0, 0, 1, 0, 0).move(props.x || 0, props.y || 0).rotate(props.rotation || 0, props.originX, props.originY).scale(scaleX, scaleY, props.originX, props.originY); + + if (props.transform != null) { + pooledTransform.transform(props.transform); } -} -function logLayoutEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } + + if (instance.xx !== pooledTransform.xx || instance.yx !== pooledTransform.yx || instance.xy !== pooledTransform.xy || instance.yy !== pooledTransform.yy || instance.x !== pooledTransform.x || instance.y !== pooledTransform.y) { + instance.transformTo(pooledTransform); } -} -function logLayoutEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } + + if (props.cursor !== prevProps.cursor || props.title !== prevProps.title) { + instance.indicate(props.cursor, props.title); } -} -function logPassiveEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } + + if (instance.blend && props.opacity !== prevProps.opacity) { + instance.blend(props.opacity == null ? 1 : props.opacity); } -} -function logPassiveEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); + + if (props.visible !== prevProps.visible) { + if (props.visible == null || props.visible) { + instance.show(); + } else { + instance.hide(); } } -} -function logRenderStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } + + for (var type in EVENT_TYPES) { + addEventListeners(instance, EVENT_TYPES[type], props[type]); } } -function logRenderStopped() { - { - if (enableDebugTracing) { - groupEnd(); + +function applyRenderableNodeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyNodeProps(instance, props, prevProps); + + if (prevProps.fill !== props.fill) { + if (props.fill && props.fill.applyFill) { + props.fill.applyFill(instance); + } else { + instance.fill(props.fill); } } -} -function logForceUpdateScheduled(componentName, lane) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); - } + + if (prevProps.stroke !== props.stroke || prevProps.strokeWidth !== props.strokeWidth || prevProps.strokeCap !== props.strokeCap || prevProps.strokeJoin !== props.strokeJoin || // TODO: Consider deep check of stokeDash; may benefit VML in IE. + prevProps.strokeDash !== props.strokeDash) { + instance.stroke(props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash); } } -function logStateUpdateScheduled(componentName, lane, payloadOrAction) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); - } + +function applyShapeProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyRenderableNodeProps(instance, props, prevProps); + var path = props.d || childrenAsString(props.children); + var prevDelta = instance._prevDelta; + var prevPath = instance._prevPath; + + if (path !== prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width) { + instance.draw(path, props.width, props.height); + instance._prevDelta = path.delta; + instance._prevPath = path; } } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - +function applyTextProps(instance, props) { + var prevProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + applyRenderableNodeProps(instance, props, prevProps); + var string = props.children; - return '\n' + prefix + name; + if (instance._currentString !== string || !isSameFont(props.font, prevProps.font) || props.alignment !== prevProps.alignment || props.path !== prevProps.path) { + instance.draw(string, props.font, props.alignment, props.path); + instance._currentString = string; } } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; +function appendInitialChild(parentInstance, child) { + if (typeof child === 'string') { + // Noop for string children of Text (eg {'foo'}{'bar'}) + throw new Error('Text children should already be flattened.'); + } -{ - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); + child.inject(parentInstance); } -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ +function createInstance(type, props, internalInstanceHandle) { + var instance; + switch (type) { + case TYPES.CLIPPING_RECTANGLE: + instance = Mode$1.ClippingRectangle(); + instance._applyProps = applyClippingRectangleProps; + break; -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } + case TYPES.GROUP: + instance = Mode$1.Group(); + instance._applyProps = applyGroupProps; + break; - { - var frame = componentFrameCache.get(fn); + case TYPES.SHAPE: + instance = Mode$1.Shape(); + instance._applyProps = applyShapeProps; + break; - if (frame !== undefined) { - return frame; - } + case TYPES.TEXT: + instance = Mode$1.Text(props.children, props.font, props.alignment, props.path); + instance._applyProps = applyTextProps; + break; } - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + if (!instance) { + throw new Error("ReactART does not support the type \"" + type + "\""); + } - Error.prepareStackTrace = undefined; - var previousDispatcher = null; + instance._applyProps(instance, props); - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. + return instance; +} +function createTextInstance(text, rootContainerInstance, internalInstanceHandle) { + return text; +} +function getPublicInstance(instance) { + return instance; +} +function prepareForCommit() { + // Noop + return null; +} +function resetTextContent(domElement) {// Noop +} +function getRootHostContext() { + return NO_CONTEXT; +} +function getChildHostContext() { + return NO_CONTEXT; +} +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; +function shouldSetTextContent(type, props) { + return typeof props.children === 'string' || typeof props.children === 'number'; +} +var currentUpdatePriority = NoEventPriority; +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function resolveUpdatePriority() { + return currentUpdatePriority || DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; +} // The ART renderer is secondary to the React DOM renderer. +function appendChild(parentInstance, child) { + if (child.parentNode === parentInstance) { + child.eject(); + } - ReactSharedInternals.H = null; - disableLogs(); + child.inject(parentInstance); +} +function appendChildToContainer(parentInstance, child) { + if (child.parentNode === parentInstance) { + child.eject(); } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ + child.inject(parentInstance); +} +function insertBefore(parentInstance, child, beforeChild) { + if (child === beforeChild) { + throw new Error('ReactART: Can not insert node before itself'); + } - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; + child.injectBefore(beforeChild); +} +function insertInContainerBefore(parentInstance, child, beforeChild) { + if (child === beforeChild) { + throw new Error('ReactART: Can not insert node before itself'); + } - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] + child.injectBefore(beforeChild); +} +function removeChild(parentInstance, child) { + destroyEventListeners(child); + child.eject(); +} +function removeChildFromContainer(parentInstance, child) { + destroyEventListeners(child); + child.eject(); +} +function commitTextUpdate(textInstance, oldText, newText) {// Noop +} +function commitMount(instance, type, newProps) {// Noop +} +function commitUpdate(instance, type, oldProps, newProps) { + instance._applyProps(instance, newProps, oldProps); +} +function hideInstance(instance) { + instance.hide(); +} +function hideTextInstance(textInstance) {// Noop +} +function unhideInstance(instance, props) { + if (props.visible == null || props.visible) { + instance.show(); + } +} +function unhideTextInstance(textInstance, text) {// Noop +} +function getInstanceFromNode(node) { + throw new Error('Not implemented.'); +} +function preloadInstance(type, props) { + // Return true to indicate it's already loaded + return true; +} +function waitForCommitToBeReady() { + return null; +} +var NotPendingTransition = null; +var valueStack = []; +var fiberStack; - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); +{ + fiberStack = []; +} - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } +var index = -1; - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} +function pop(cursor, fiber) { + if (index < 0) { + { + error('Unexpected pop.'); + } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too + return; + } + { + if (fiber !== fiberStack[index]) { + error('Unexpected Fiber popped.'); + } + } - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? + cursor.current = valueStack[index]; + valueStack[index] = null; - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } + { + fiberStack[index] = null; + } - return [null, null]; - } - }; // $FlowFixMe[prop-missing] + index--; +} - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. +function push(cursor, value, fiber) { + index++; + valueStack[index] = cursor.current; - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); + { + fiberStack[index] = fiber; } - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; + cursor.current = value; +} - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } +var emptyContextObject = {}; - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... +{ + Object.freeze(emptyContextObject); +} // A cursor to the current merged context object on the stack. +function hasContextChanged() { + { + return false; + } +} - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; +function isContextProvider(type) { + { + return false; + } +} - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } +function processChildContext(fiber, type, parentContext) { + { + return parentContext; + } +} - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. +function findCurrentUnmaskedContext(fiber) { + { + return emptyContextObject; + } +} - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. +// We use the existence of the state object as an indicator that the component +// is hidden. +var OffscreenVisible = +/* */ +1; +var OffscreenDetached = +/* */ +2; +var OffscreenPassiveEffectsConnected = +/* */ +4; +function isOffscreenManual(offscreenFiber) { + return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; +} +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. +var nativeConsole = console; +var nativeConsoleLog = null; +var pendingGroupArgs = []; +var printedGroupIndex = -1; +function formatLanes(laneOrLanes) { + return '0b' + laneOrLanes.toString(2).padStart(31, '0'); +} - return _frame; - } - } while (s >= 1 && c >= 0); - } +function group() { + for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { + groupArgs[_key] = arguments[_key]; + } - break; - } - } - } - } finally { - reentry = false; + pendingGroupArgs.push(groupArgs); - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } + if (nativeConsoleLog === null) { + nativeConsoleLog = nativeConsole.log; + nativeConsole.log = log; + } +} - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. +function groupEnd() { + pendingGroupArgs.pop(); + while (printedGroupIndex >= pendingGroupArgs.length) { + nativeConsole.groupEnd(); + printedGroupIndex--; + } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + if (pendingGroupArgs.length === 0) { + nativeConsole.log = nativeConsoleLog; + nativeConsoleLog = null; + } +} - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); +function log() { + if (printedGroupIndex < pendingGroupArgs.length - 1) { + for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { + var groupArgs = pendingGroupArgs[i]; + nativeConsole.group.apply(nativeConsole, groupArgs); } + + printedGroupIndex = pendingGroupArgs.length - 1; } - return syntheticFrame; + if (typeof nativeConsoleLog === 'function') { + nativeConsoleLog.apply(void 0, arguments); + } else { + nativeConsole.log.apply(nativeConsole, arguments); + } } -function describeClassComponentFrame(ctor) { +var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; +function logCommitStarted(lanes) { { - return describeNativeComponentFrame(ctor, true); + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } -function describeFunctionComponentFrame(fn) { +function logCommitStopped() { { - return describeNativeComponentFrame(fn, false); + if (enableDebugTracing) { + groupEnd(); + } } } +var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); +var wakeableIDs = new PossiblyWeakMap$1(); +var wakeableID = 0; - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); +function getWakeableID(wakeable) { + if (!wakeableIDs.has(wakeable)) { + wakeableIDs.set(wakeable, wakeableID++); + } - case ClassComponent: - return describeClassComponentFrame(fiber.type); + return wakeableIDs.get(wakeable); +} - default: - return ''; +function logComponentSuspended(componentName, wakeable) { + { + if (enableDebugTracing) { + var id = getWakeableID(wakeable); + var display = wakeable.displayName || wakeable; + log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + wakeable.then(function () { + log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }, function () { + log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }); + } } } - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; +function logLayoutEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logLayoutEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logPassiveEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logPassiveEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logRenderStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logRenderStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logForceUpdateScheduled(componentName, lane) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); + } + } +} +function logStateUpdateScheduled(componentName, lane, payloadOrAction) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); + } } } @@ -5437,61 +5499,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -5711,11 +5718,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -12883,7 +12890,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); setIsRendering(false); @@ -13410,7 +13416,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); setIsRendering(false); @@ -13556,7 +13561,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -14873,7 +14878,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -17912,7 +17916,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -17920,7 +17924,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -17949,7 +17953,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -18035,7 +18039,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -19559,9 +19563,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -19589,13 +19593,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -19999,8 +20003,10 @@ function commitReconciliationEffects(finishedWork) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -20012,14 +20018,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -20229,7 +20235,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -20388,9 +20394,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -20400,13 +20406,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -20598,7 +20604,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -20727,13 +20733,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -20779,9 +20785,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -20935,13 +20941,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -21012,12 +21018,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -21059,9 +21065,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -21219,7 +21225,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -22270,10 +22276,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -22928,7 +22933,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -22939,7 +22944,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -22948,10 +22956,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -22959,9 +22963,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -23034,7 +23037,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -23043,10 +23049,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -23133,7 +23135,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -23145,7 +23147,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -23383,18 +23385,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - commitBeforeMutationEffects(root, finishedWork); { @@ -24064,13 +24061,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -24083,7 +24080,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -24095,7 +24092,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -24146,14 +24143,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -24249,14 +24246,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } diff --git a/compiled/facebook-www/ReactART-prod.classic.js b/compiled/facebook-www/ReactART-prod.classic.js index 222cf31d10c21..24bfc50f45494 100644 --- a/compiled/facebook-www/ReactART-prod.classic.js +++ b/compiled/facebook-www/ReactART-prod.classic.js @@ -237,7 +237,189 @@ function getComponentNameFromFiber(fiber) { } return null; } -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -285,36 +467,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$3 = parentA.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$3 = parentB.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -355,8 +537,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var isArrayImpl = Array.isArray, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, TYPES = { CLIPPING_RECTANGLE: "ClippingRectangle", GROUP: "Group", @@ -588,18 +768,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$7 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$7; + remainingLanes[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -619,21 +799,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$8 = 31 - clz32(lanes), - lane = 1 << index$8; - index$8 = root.transitionLanes[index$8]; - null !== index$8 && - index$8.forEach(function (transition) { + var index$10 = 31 - clz32(lanes), + lane = 1 << index$10; + index$10 = root.transitionLanes[index$10]; + null !== index$10 && + index$10.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -643,10 +823,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - null !== root.transitionLanes[index$9] && - (root.transitionLanes[index$9] = null); + var index$11 = 31 - clz32(lanes), + lane = 1 << index$11; + null !== root.transitionLanes[index$11] && + (root.transitionLanes[index$11] = null); lanes &= ~lane; } } @@ -925,187 +1105,7 @@ 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, - prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$10) { - control = x$10; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$11) { - control = x$11; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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(); + CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var stack = CapturedStacks.get(value); @@ -1304,12 +1304,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$5 = 31 - clz32(pendingLanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -1554,20 +1554,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$15 = workInProgress$jscomp$0.alternate; + null !== current$15 && + ((current$15 = current$15.updateQueue), + (pendingQueue = current$15.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$15.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$15.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$15 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -1580,8 +1580,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$15 && + (current$15 = current$15.next = { lane: 0, tag: pendingQueue.tag, @@ -1634,10 +1634,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$15 + ? ((firstPendingUpdate = current$15 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$15 = current$15.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -1650,10 +1650,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$15 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$15; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -2507,9 +2507,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$32 = fiber.alternate; + null !== current$32 && + null !== current$32.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -2740,16 +2740,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$34 = currentlyRenderingFiber$1.alternate; + null !== current$34 && + ((current$34 = current$34.updateQueue), + null !== current$34 && + ((current$34 = current$34.memoCache), + null != current$34 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$34.data + : current$34.data.map(function (array) { return array.slice(); }), index: 0 @@ -2763,11 +2763,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$34 = 0; + current$34 < size; + current$34++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$34] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -2800,7 +2801,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$31 = !1; + didReadFromEntangledAsyncAction$35 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2821,11 +2822,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$35 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$35 = !0); continue; } else (updateLane = { @@ -2871,7 +2872,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$31 && + didReadFromEntangledAsyncAction$35 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3947,9 +3948,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$36 in Component) - void 0 === newProps[propName$36] && - (newProps[propName$36] = Component[propName$36]); + for (var propName$40 in Component) + void 0 === newProps[propName$40] && + (newProps[propName$40] = Component[propName$40]); } return newProps; } @@ -4879,31 +4880,35 @@ function updateClassComponent( ); } function finishClassComponent( - current, + current$jscomp$0, workInProgress, Component, shouldUpdate, hasContext, renderLanes ) { - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); var didCaptureError = 0 !== (workInProgress.flags & 128); if (!shouldUpdate && !didCaptureError) return ( hasContext && invalidateContextProvider(workInProgress, Component, !1), - bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) + bailoutOnAlreadyFinishedWork( + current$jscomp$0, + workInProgress, + renderLanes + ) ); shouldUpdate = workInProgress.stateNode; - currentOwner = workInProgress; + current = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null : shouldUpdate.render(); workInProgress.flags |= 1; - null !== current && didCaptureError + null !== current$jscomp$0 && didCaptureError ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -4913,7 +4918,12 @@ function finishClassComponent( nextChildren, renderLanes ))) - : reconcileChildren(current, workInProgress, nextChildren, renderLanes); + : reconcileChildren( + current$jscomp$0, + workInProgress, + nextChildren, + renderLanes + ); workInProgress.memoizedState = shouldUpdate.state; hasContext && invalidateContextProvider(workInProgress, Component, !0); return workInProgress.child; @@ -6525,14 +6535,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$82 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$82 = lastTailNode), + for (var lastTailNode$87 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$87 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$82 + null === lastTailNode$87 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$82.sibling = null); + : (lastTailNode$87.sibling = null); } } function bubbleProperties(completedWork) { @@ -6542,19 +6552,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$83 = completedWork.child; null !== child$83; ) - (newChildLanes |= child$83.lanes | child$83.childLanes), - (subtreeFlags |= child$83.subtreeFlags & 31457280), - (subtreeFlags |= child$83.flags & 31457280), - (child$83.return = completedWork), - (child$83 = child$83.sibling); + for (var child$88 = completedWork.child; null !== child$88; ) + (newChildLanes |= child$88.lanes | child$88.childLanes), + (subtreeFlags |= child$88.subtreeFlags & 31457280), + (subtreeFlags |= child$88.flags & 31457280), + (child$88.return = completedWork), + (child$88 = child$88.sibling); else - for (child$83 = completedWork.child; null !== child$83; ) - (newChildLanes |= child$83.lanes | child$83.childLanes), - (subtreeFlags |= child$83.subtreeFlags), - (subtreeFlags |= child$83.flags), - (child$83.return = completedWork), - (child$83 = child$83.sibling); + for (child$88 = completedWork.child; null !== child$88; ) + (newChildLanes |= child$88.lanes | child$88.childLanes), + (subtreeFlags |= child$88.subtreeFlags), + (subtreeFlags |= child$88.flags), + (child$88.return = completedWork), + (child$88 = child$88.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6732,11 +6742,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (instance = newProps.alternate.memoizedState.cachePool.pool); - var cache$87 = null; + var cache$92 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$87 = newProps.memoizedState.cachePool.pool); - cache$87 !== instance && (newProps.flags |= 2048); + (cache$92 = newProps.memoizedState.cachePool.pool); + cache$92 !== instance && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -6770,8 +6780,8 @@ function completeWork(current, workInProgress, renderLanes) { instance = workInProgress.memoizedState; if (null === instance) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$87 = instance.rendering; - if (null === cache$87) + cache$92 = instance.rendering; + if (null === cache$92) if (newProps) cutOffTailIfNeeded(instance, !1); else { if ( @@ -6779,11 +6789,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$87 = findFirstSuspended(current); - if (null !== cache$87) { + cache$92 = findFirstSuspended(current); + if (null !== cache$92) { workInProgress.flags |= 128; cutOffTailIfNeeded(instance, !1); - current = cache$87.updateQueue; + current = cache$92.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -6808,7 +6818,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$87)), null !== current)) { + if (((current = findFirstSuspended(cache$92)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -6818,7 +6828,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(instance, !0), null === instance.tail && "hidden" === instance.tailMode && - !cache$87.alternate) + !cache$92.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -6830,13 +6840,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(instance, !1), (workInProgress.lanes = 4194304)); instance.isBackwards - ? ((cache$87.sibling = workInProgress.child), - (workInProgress.child = cache$87)) + ? ((cache$92.sibling = workInProgress.child), + (workInProgress.child = cache$92)) : ((current = instance.last), null !== current - ? (current.sibling = cache$87) - : (workInProgress.child = cache$87), - (instance.last = cache$87)); + ? (current.sibling = cache$92) + : (workInProgress.child = cache$92), + (instance.last = cache$92)); } if (null !== instance.tail) return ( @@ -7108,8 +7118,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$105) { - captureCommitPhaseError(current, nearestMountedAncestor, error$105); + } catch (error$110) { + captureCommitPhaseError(current, nearestMountedAncestor, error$110); } else ref.current = null; } @@ -7313,11 +7323,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$106) { + } catch (error$111) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$106 + error$111 ); } } @@ -7908,8 +7918,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$114) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$114); + } catch (error$119) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$119); } } break; @@ -7942,8 +7952,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = null !== current ? current.memoizedProps : newProps; try { flags._applyProps(flags, newProps, current); - } catch (error$117) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$117); + } catch (error$122) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$122); } } break; @@ -7979,8 +7989,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$119) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$119); + } catch (error$124) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$124); } flags = finishedWork.updateQueue; null !== flags && @@ -8120,12 +8130,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$109 = JSCompiler_inline_result.stateNode.containerInfo, - before$110 = getHostSibling(finishedWork); + var parent$114 = JSCompiler_inline_result.stateNode.containerInfo, + before$115 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$110, - parent$109 + before$115, + parent$114 ); break; default: @@ -8583,9 +8593,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$125 = finishedWork.stateNode; + var instance$134 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$125._visibility & 4 + ? instance$134._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8598,7 +8608,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$125._visibility |= 4), + : ((instance$134._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8606,7 +8616,7 @@ function recursivelyTraverseReconnectPassiveEffects( committedTransitions, includeWorkInProgressEffects )) - : ((instance$125._visibility |= 4), + : ((instance$134._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8619,7 +8629,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$125 + instance$134 ); break; case 24: @@ -8713,12 +8723,12 @@ function accumulateSuspenseyCommitOnFiber(fiber) { break; case 22: if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), + var current$139 = fiber.alternate; + null !== current$139 && null !== current$139.memoizedState + ? ((current$139 = suspenseyCommitFlag), (suspenseyCommitFlag = 16777216), recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) + (suspenseyCommitFlag = current$139)) : recursivelyAccumulateSuspenseyCommit(fiber); } break; @@ -8925,7 +8935,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, @@ -9062,11 +9072,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing) ) { var transitionLanesMap = root.transitionLanes, - index$7 = 31 - clz32(lane), - transitions = transitionLanesMap[index$7]; + index$9 = 31 - clz32(lane), + transitions = transitionLanesMap[index$9]; null === transitions && (transitions = new Set()); transitions.add(transition); - transitionLanesMap[index$7] = transitions; + transitionLanesMap[index$9] = transitions; } } root === workInProgressRoot && @@ -9317,9 +9327,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + expirationTimes[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -9423,9 +9433,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -9435,7 +9445,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -9525,8 +9535,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$133) { - handleThrow(root, thrownValue$133); + } catch (thrownValue$145) { + handleThrow(root, thrownValue$145); } while (1); lanes && root.shellSuspendCounter++; @@ -9635,8 +9645,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$135) { - handleThrow(root, thrownValue$135); + } catch (thrownValue$147) { + handleThrow(root, thrownValue$147); } while (1); resetContextDependencies(); @@ -9655,12 +9665,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -9675,8 +9685,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { ? previousContext : contextStackCursor$1.current; context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -9692,8 +9702,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -9704,16 +9714,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -9864,7 +9878,6 @@ function commitRootImpl( currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; commitBeforeMutationEffects(root, finishedWork); commitMutationEffectsOnFiber(finishedWork, root); root.current = finishedWork; @@ -10630,19 +10643,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1137 = { + devToolsConfig$jscomp$inline_1146 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-classic-231f67a4", + version: "19.0.0-www-classic-a5d5fa11", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1349 = { - bundleType: devToolsConfig$jscomp$inline_1137.bundleType, - version: devToolsConfig$jscomp$inline_1137.version, - rendererPackageName: devToolsConfig$jscomp$inline_1137.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1137.rendererConfig, +var internals$jscomp$inline_1358 = { + bundleType: devToolsConfig$jscomp$inline_1146.bundleType, + version: devToolsConfig$jscomp$inline_1146.version, + rendererPackageName: devToolsConfig$jscomp$inline_1146.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1146.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10659,26 +10672,26 @@ var internals$jscomp$inline_1349 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1137.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1146.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-231f67a4" + reconcilerVersion: "19.0.0-www-classic-a5d5fa11" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1350 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1359 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1350.isDisabled && - hook$jscomp$inline_1350.supportsFiber + !hook$jscomp$inline_1359.isDisabled && + hook$jscomp$inline_1359.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1350.inject( - internals$jscomp$inline_1349 + (rendererID = hook$jscomp$inline_1359.inject( + internals$jscomp$inline_1358 )), - (injectedHook = hook$jscomp$inline_1350); + (injectedHook = hook$jscomp$inline_1359); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactART-prod.modern.js b/compiled/facebook-www/ReactART-prod.modern.js index 2aabc06592d27..38d1b3066f8d3 100644 --- a/compiled/facebook-www/ReactART-prod.modern.js +++ b/compiled/facebook-www/ReactART-prod.modern.js @@ -113,7 +113,189 @@ function getIteratorFn(maybeIterable) { return "function" === typeof maybeIterable ? maybeIterable : null; } Symbol.for("react.client.reference"); -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -161,36 +343,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$3 = parentA.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$3 = parentB.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -231,8 +413,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var isArrayImpl = Array.isArray, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, TYPES = { CLIPPING_RECTANGLE: "ClippingRectangle", GROUP: "Group", @@ -464,18 +644,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$7 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$7; + remainingLanes[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -495,21 +675,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$8 = 31 - clz32(lanes), - lane = 1 << index$8; - index$8 = root.transitionLanes[index$8]; - null !== index$8 && - index$8.forEach(function (transition) { + var index$10 = 31 - clz32(lanes), + lane = 1 << index$10; + index$10 = root.transitionLanes[index$10]; + null !== index$10 && + index$10.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -519,10 +699,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - null !== root.transitionLanes[index$9] && - (root.transitionLanes[index$9] = null); + var index$11 = 31 - clz32(lanes), + lane = 1 << index$11; + null !== root.transitionLanes[index$11] && + (root.transitionLanes[index$11] = null); lanes &= ~lane; } } @@ -723,187 +903,7 @@ 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, - prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$10) { - control = x$10; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$11) { - control = x$11; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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(); + CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var stack = CapturedStacks.get(value); @@ -1102,12 +1102,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$5 = 31 - clz32(pendingLanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -1352,20 +1352,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$15 = workInProgress$jscomp$0.alternate; + null !== current$15 && + ((current$15 = current$15.updateQueue), + (pendingQueue = current$15.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$15.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$15.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$15 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -1378,8 +1378,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$15 && + (current$15 = current$15.next = { lane: 0, tag: pendingQueue.tag, @@ -1432,10 +1432,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$15 + ? ((firstPendingUpdate = current$15 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$15 = current$15.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -1448,10 +1448,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$15 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$15; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -2305,9 +2305,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$32 = fiber.alternate; + null !== current$32 && + null !== current$32.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -2538,16 +2538,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$34 = currentlyRenderingFiber$1.alternate; + null !== current$34 && + ((current$34 = current$34.updateQueue), + null !== current$34 && + ((current$34 = current$34.memoCache), + null != current$34 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$34.data + : current$34.data.map(function (array) { return array.slice(); }), index: 0 @@ -2561,11 +2561,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$34 = 0; + current$34 < size; + current$34++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$34] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -2598,7 +2599,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$31 = !1; + didReadFromEntangledAsyncAction$35 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2619,11 +2620,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$35 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$31 = !0); + (didReadFromEntangledAsyncAction$35 = !0); continue; } else (updateLane = { @@ -2669,7 +2670,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$31 && + didReadFromEntangledAsyncAction$35 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3683,9 +3684,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$36 in Component) - void 0 === newProps[propName$36] && - (newProps[propName$36] = Component[propName$36]); + for (var propName$40 in Component) + void 0 === newProps[propName$40] && + (newProps[propName$40] = Component[propName$40]); } return newProps; } @@ -4351,7 +4352,7 @@ function replayFunctionComponent( return workInProgress.child; } function updateClassComponent( - current, + current$jscomp$0, workInProgress, Component, nextProps, @@ -4407,7 +4408,7 @@ function updateClassComponent( "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); nextProps = !0; - } else if (null === current) { + } else if (null === current$jscomp$0) { context = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps( @@ -4485,7 +4486,7 @@ function updateClassComponent( (nextProps = !1)); } else { context = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); + cloneUpdateQueue(current$jscomp$0, workInProgress); contextType = workInProgress.memoizedProps; contextType$jscomp$0 = resolveClassComponentProps( Component, @@ -4523,9 +4524,9 @@ function updateClassComponent( oldState !== newState || hasForceUpdate || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies)) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies)) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps( workInProgress, @@ -4546,9 +4547,9 @@ function updateClassComponent( oldProps ) || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies))) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies))) ? (oldContext || ("function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate) || @@ -4565,12 +4566,12 @@ function updateClassComponent( "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), @@ -4579,30 +4580,30 @@ function updateClassComponent( (context.context = oldProps), (nextProps = contextType$jscomp$0)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (nextProps = !1)); } context = nextProps; - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); nextProps = 0 !== (workInProgress.flags & 128); context || nextProps ? ((context = workInProgress.stateNode), - (currentOwner = workInProgress), + (current = workInProgress), (Component = nextProps && "function" !== typeof Component.getDerivedStateFromError ? null : context.render()), (workInProgress.flags |= 1), - null !== current && nextProps + null !== current$jscomp$0 && nextProps ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -4612,15 +4613,20 @@ function updateClassComponent( Component, renderLanes ))) - : reconcileChildren(current, workInProgress, Component, renderLanes), + : reconcileChildren( + current$jscomp$0, + workInProgress, + Component, + renderLanes + ), (workInProgress.memoizedState = context.state), - (current = workInProgress.child)) - : (current = bailoutOnAlreadyFinishedWork( - current, + (current$jscomp$0 = workInProgress.child)) + : (current$jscomp$0 = bailoutOnAlreadyFinishedWork( + current$jscomp$0, workInProgress, renderLanes )); - return current; + return current$jscomp$0; } var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { @@ -6113,14 +6119,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$74 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$74 = lastTailNode), + for (var lastTailNode$79 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$79 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$74 + null === lastTailNode$79 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$74.sibling = null); + : (lastTailNode$79.sibling = null); } } function bubbleProperties(completedWork) { @@ -6130,19 +6136,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$75 = completedWork.child; null !== child$75; ) - (newChildLanes |= child$75.lanes | child$75.childLanes), - (subtreeFlags |= child$75.subtreeFlags & 31457280), - (subtreeFlags |= child$75.flags & 31457280), - (child$75.return = completedWork), - (child$75 = child$75.sibling); + for (var child$80 = completedWork.child; null !== child$80; ) + (newChildLanes |= child$80.lanes | child$80.childLanes), + (subtreeFlags |= child$80.subtreeFlags & 31457280), + (subtreeFlags |= child$80.flags & 31457280), + (child$80.return = completedWork), + (child$80 = child$80.sibling); else - for (child$75 = completedWork.child; null !== child$75; ) - (newChildLanes |= child$75.lanes | child$75.childLanes), - (subtreeFlags |= child$75.subtreeFlags), - (subtreeFlags |= child$75.flags), - (child$75.return = completedWork), - (child$75 = child$75.sibling); + for (child$80 = completedWork.child; null !== child$80; ) + (newChildLanes |= child$80.lanes | child$80.childLanes), + (subtreeFlags |= child$80.subtreeFlags), + (subtreeFlags |= child$80.flags), + (child$80.return = completedWork), + (child$80 = child$80.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -6313,11 +6319,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (instance = newProps.alternate.memoizedState.cachePool.pool); - var cache$79 = null; + var cache$84 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$79 = newProps.memoizedState.cachePool.pool); - cache$79 !== instance && (newProps.flags |= 2048); + (cache$84 = newProps.memoizedState.cachePool.pool); + cache$84 !== instance && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -6345,8 +6351,8 @@ function completeWork(current, workInProgress, renderLanes) { instance = workInProgress.memoizedState; if (null === instance) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$79 = instance.rendering; - if (null === cache$79) + cache$84 = instance.rendering; + if (null === cache$84) if (newProps) cutOffTailIfNeeded(instance, !1); else { if ( @@ -6354,11 +6360,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$79 = findFirstSuspended(current); - if (null !== cache$79) { + cache$84 = findFirstSuspended(current); + if (null !== cache$84) { workInProgress.flags |= 128; cutOffTailIfNeeded(instance, !1); - current = cache$79.updateQueue; + current = cache$84.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -6383,7 +6389,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$79)), null !== current)) { + if (((current = findFirstSuspended(cache$84)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -6393,7 +6399,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(instance, !0), null === instance.tail && "hidden" === instance.tailMode && - !cache$79.alternate) + !cache$84.alternate) ) return bubbleProperties(workInProgress), null; } else @@ -6405,13 +6411,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(instance, !1), (workInProgress.lanes = 4194304)); instance.isBackwards - ? ((cache$79.sibling = workInProgress.child), - (workInProgress.child = cache$79)) + ? ((cache$84.sibling = workInProgress.child), + (workInProgress.child = cache$84)) : ((current = instance.last), null !== current - ? (current.sibling = cache$79) - : (workInProgress.child = cache$79), - (instance.last = cache$79)); + ? (current.sibling = cache$84) + : (workInProgress.child = cache$84), + (instance.last = cache$84)); } if (null !== instance.tail) return ( @@ -6674,8 +6680,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$96) { - captureCommitPhaseError(current, nearestMountedAncestor, error$96); + } catch (error$101) { + captureCommitPhaseError(current, nearestMountedAncestor, error$101); } else ref.current = null; } @@ -6879,11 +6885,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$97) { + } catch (error$102) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$97 + error$102 ); } } @@ -7463,8 +7469,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$105) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$105); + } catch (error$110) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$110); } } break; @@ -7497,8 +7503,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = null !== current ? current.memoizedProps : newProps; try { flags._applyProps(flags, newProps, current); - } catch (error$108) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$108); + } catch (error$113) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$113); } } break; @@ -7534,8 +7540,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$110) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$110); + } catch (error$115) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$115); } flags = finishedWork.updateQueue; null !== flags && @@ -7672,12 +7678,12 @@ function commitReconciliationEffects(finishedWork) { break; case 3: case 4: - var parent$100 = JSCompiler_inline_result.stateNode.containerInfo, - before$101 = getHostSibling(finishedWork); + var parent$105 = JSCompiler_inline_result.stateNode.containerInfo, + before$106 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$101, - parent$100 + before$106, + parent$105 ); break; default: @@ -8127,9 +8133,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$116 = finishedWork.stateNode; + var instance$125 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$116._visibility & 4 + ? instance$125._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8141,7 +8147,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$116._visibility |= 4), + : ((instance$125._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8154,7 +8160,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$116 + instance$125 ); break; case 24: @@ -8248,12 +8254,12 @@ function accumulateSuspenseyCommitOnFiber(fiber) { break; case 22: if (null === fiber.memoizedState) { - var current = fiber.alternate; - null !== current && null !== current.memoizedState - ? ((current = suspenseyCommitFlag), + var current$130 = fiber.alternate; + null !== current$130 && null !== current$130.memoizedState + ? ((current$130 = suspenseyCommitFlag), (suspenseyCommitFlag = 16777216), recursivelyAccumulateSuspenseyCommit(fiber), - (suspenseyCommitFlag = current)) + (suspenseyCommitFlag = current$130)) : recursivelyAccumulateSuspenseyCommit(fiber); } break; @@ -8460,7 +8466,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, PossiblyWeakMap = "function" === typeof WeakMap ? WeakMap : Map, @@ -8596,11 +8602,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing)) ) { var transitionLanesMap = root.transitionLanes, - index$7 = 31 - clz32(lane), - transitions = transitionLanesMap[index$7]; + index$9 = 31 - clz32(lane), + transitions = transitionLanesMap[index$9]; null === transitions && (transitions = new Set()); transitions.add(fiber); - transitionLanesMap[index$7] = transitions; + transitionLanesMap[index$9] = transitions; } root === workInProgressRoot && (0 === (executionContext & 2) && @@ -8845,9 +8851,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + expirationTimes[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -8951,9 +8957,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -8963,7 +8969,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; if (thrownValue === SuspenseException) { thrownValue = getSuspendedThenable(); var handler = suspenseHandlerStackCursor.current; @@ -9053,8 +9059,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$124) { - handleThrow(root, thrownValue$124); + } catch (thrownValue$136) { + handleThrow(root, thrownValue$136); } while (1); lanes && root.shellSuspendCounter++; @@ -9163,8 +9169,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$126) { - handleThrow(root, thrownValue$126); + } catch (thrownValue$138) { + handleThrow(root, thrownValue$138); } while (1); resetContextDependencies(); @@ -9183,12 +9189,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -9199,8 +9205,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -9216,8 +9222,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -9228,16 +9234,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -9388,7 +9398,6 @@ function commitRootImpl( currentUpdatePriority = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; commitBeforeMutationEffects(root, finishedWork); commitMutationEffectsOnFiber(finishedWork, root); root.current = finishedWork; @@ -10109,19 +10118,19 @@ var slice = Array.prototype.slice, }; return Text; })(React.Component), - devToolsConfig$jscomp$inline_1102 = { + devToolsConfig$jscomp$inline_1111 = { findFiberByHostInstance: function () { return null; }, bundleType: 0, - version: "19.0.0-www-modern-2946f075", + version: "19.0.0-www-modern-fd88c001", rendererPackageName: "react-art" }; -var internals$jscomp$inline_1336 = { - bundleType: devToolsConfig$jscomp$inline_1102.bundleType, - version: devToolsConfig$jscomp$inline_1102.version, - rendererPackageName: devToolsConfig$jscomp$inline_1102.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1102.rendererConfig, +var internals$jscomp$inline_1345 = { + bundleType: devToolsConfig$jscomp$inline_1111.bundleType, + version: devToolsConfig$jscomp$inline_1111.version, + rendererPackageName: devToolsConfig$jscomp$inline_1111.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1111.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -10138,26 +10147,26 @@ var internals$jscomp$inline_1336 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1102.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1111.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-2946f075" + reconcilerVersion: "19.0.0-www-modern-fd88c001" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1337 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1346 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1337.isDisabled && - hook$jscomp$inline_1337.supportsFiber + !hook$jscomp$inline_1346.isDisabled && + hook$jscomp$inline_1346.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1337.inject( - internals$jscomp$inline_1336 + (rendererID = hook$jscomp$inline_1346.inject( + internals$jscomp$inline_1345 )), - (injectedHook = hook$jscomp$inline_1337); + (injectedHook = hook$jscomp$inline_1346); } catch (err) {} } var Path = Mode$1.Path; diff --git a/compiled/facebook-www/ReactDOM-dev.classic.js b/compiled/facebook-www/ReactDOM-dev.classic.js index b87883d0f591f..929f2a27b946d 100644 --- a/compiled/facebook-www/ReactDOM-dev.classic.js +++ b/compiled/facebook-www/ReactDOM-dev.classic.js @@ -592,9 +592,511 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); +} +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ + + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher = null; + + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ + + + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow + + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too + + + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } + + return [null, null]; + } + }; // $FlowFixMe[prop-missing] + + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } + + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } + + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... + + + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} + +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); + + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); + + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } } function getNearestMountedFiber(fiber) { @@ -662,9 +1164,9 @@ function isFiberMounted(fiber) { } function isMounted(component) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.tag === ClassComponent) { + if (owner !== null && isRendering && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; @@ -951,8 +1453,6 @@ function isReplayingEvent(event) { return event === currentReplayingEvent; } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This module only exists as an ESM wrapper around the external CommonJS var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; var cancelCallback$1 = Scheduler.unstable_cancelCallback; @@ -970,100 +1470,6 @@ var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exi var log$2 = Scheduler.log; var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -3198,405 +3604,6 @@ function setValueForPropertyOnCustomComponent(node, name, value) { setValueForAttribute(node, name, value); } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$2(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); - } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too - - - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? - - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } - - return [null, null]; - } - }; // $FlowFixMe[prop-missing] - - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); - } - - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. @@ -9519,11 +9526,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -17106,7 +17113,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -17665,7 +17671,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -17827,7 +17832,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -19398,7 +19403,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -22677,7 +22681,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -22685,7 +22689,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -22715,7 +22719,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -22807,7 +22811,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -24460,9 +24464,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -24490,13 +24494,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -25038,8 +25042,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -25051,14 +25057,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -25273,7 +25279,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -25432,9 +25438,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -25444,13 +25450,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25646,7 +25652,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -25779,13 +25785,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25831,9 +25837,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -25992,13 +25998,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -26069,12 +26075,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -26116,9 +26122,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -26384,7 +26390,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -27602,10 +27608,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -28260,7 +28265,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -28271,7 +28276,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28280,10 +28288,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -28291,9 +28295,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -28371,7 +28374,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28380,10 +28386,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -28470,7 +28472,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -28482,7 +28484,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -28720,18 +28722,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -29441,13 +29438,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -29460,7 +29457,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -29472,7 +29469,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -29496,7 +29493,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -29509,7 +29506,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -29572,14 +29569,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -29693,14 +29690,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -30855,7 +30852,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-48001749'; +var ReactVersion = '19.0.0-www-classic-d3c0ad7c'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { @@ -30952,7 +30949,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -30963,9 +30960,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -41836,9 +41833,9 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container, function findDOMNode(componentOrElement) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; if (!warnedAboutRefsInRender) { diff --git a/compiled/facebook-www/ReactDOM-dev.modern.js b/compiled/facebook-www/ReactDOM-dev.modern.js index 86a008513c6ab..70f279c28d26a 100644 --- a/compiled/facebook-www/ReactDOM-dev.modern.js +++ b/compiled/facebook-www/ReactDOM-dev.modern.js @@ -591,9 +591,511 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); +} +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ + + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher = null; + + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ + + + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow + + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too + + + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } + + return [null, null]; + } + }; // $FlowFixMe[prop-missing] + + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } + + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } + + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... + + + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} + +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); + + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); + + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } } function getNearestMountedFiber(fiber) { @@ -658,9 +1160,9 @@ function getContainerFromFiber(fiber) { } function isMounted(component) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.tag === ClassComponent) { + if (owner !== null && isRendering && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; @@ -917,8 +1419,6 @@ function isReplayingEvent(event) { return event === currentReplayingEvent; } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This module only exists as an ESM wrapper around the external CommonJS var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; var cancelCallback$1 = Scheduler.unstable_cancelCallback; @@ -936,100 +1436,6 @@ var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exi var log$2 = Scheduler.log; var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -3164,405 +3570,6 @@ function setValueForPropertyOnCustomComponent(node, name, value) { setValueForAttribute(node, name, value); } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$2(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); - } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too - - - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? - - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } - - return [null, null]; - } - }; // $FlowFixMe[prop-missing] - - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); - } - - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. @@ -9260,11 +9267,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -16735,7 +16742,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -17268,7 +17274,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -17424,7 +17429,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -18903,7 +18908,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -22134,7 +22138,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -22142,7 +22146,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -22172,7 +22176,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -22264,7 +22268,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -23915,9 +23919,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -23945,13 +23949,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -24491,8 +24495,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -24504,14 +24510,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -24726,7 +24732,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -24885,9 +24891,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -24897,13 +24903,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25095,7 +25101,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -25224,13 +25230,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25276,9 +25282,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -25437,13 +25443,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -25514,12 +25520,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -25561,9 +25567,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -25721,7 +25727,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -26858,10 +26864,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -27516,7 +27521,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -27527,7 +27532,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -27536,10 +27544,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -27547,9 +27551,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -27622,7 +27625,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -27631,10 +27637,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -27721,7 +27723,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -27733,7 +27735,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -27971,18 +27973,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -28692,13 +28689,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -28711,7 +28708,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -28723,7 +28720,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -28774,14 +28771,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -28877,14 +28874,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -30030,7 +30027,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-899aca39'; +var ReactVersion = '19.0.0-www-modern-533bc87e'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { @@ -30127,7 +30124,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -30138,9 +30135,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -40883,9 +40880,9 @@ function hydrateRoot(container, initialChildren, options) { function findDOMNode(componentOrElement) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; if (!warnedAboutRefsInRender) { diff --git a/compiled/facebook-www/ReactDOM-prod.classic.js b/compiled/facebook-www/ReactDOM-prod.classic.js index fb16b251aa1b1..0a17750c49cb5 100644 --- a/compiled/facebook-www/ReactDOM-prod.classic.js +++ b/compiled/facebook-www/ReactDOM-prod.classic.js @@ -214,7 +214,189 @@ function getComponentNameFromFiber(fiber) { } return null; } -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -272,36 +454,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -346,8 +528,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -558,18 +738,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + expirationTimes[index$8] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$8]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$8] = null, index$8 = 0; + index$8 < hiddenUpdatesForLane.length; + index$8++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$8]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -589,21 +769,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + index$12 = root.transitionLanes[index$12]; + null !== index$12 && + index$12.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -613,10 +793,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$13 = 31 - clz32(lanes), + lane = 1 << index$13; + null !== root.transitionLanes[index$13] && + (root.transitionLanes[index$13] = null); lanes &= ~lane; } } @@ -798,8 +978,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$14 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$14 && "aria-" !== prefix$14) { node.removeAttribute(name); return; } @@ -842,186 +1022,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$12) { - control = x$12; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$13) { - control = x$13; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1318,15 +1318,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$19 in styles) - (styleName = styles[styleName$19]), - styles.hasOwnProperty(styleName$19) && - prevStyles[styleName$19] !== styleName && - setValueForStyle(node, styleName$19, styleName); - } else for (var styleName$20 in styles) - styles.hasOwnProperty(styleName$20) && - setValueForStyle(node, styleName$20, styles[styleName$20]); + (styleName = styles[styleName$20]), + styles.hasOwnProperty(styleName$20) && + prevStyles[styleName$20] !== styleName && + setValueForStyle(node, styleName$20, styleName); + } else + for (var styleName$21 in styles) + styles.hasOwnProperty(styleName$21) && + setValueForStyle(node, styleName$21, styles[styleName$21]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1932,20 +1932,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$25 = firstScheduledRoot; null !== root$25; ) { - if (!onlyLegacy || 0 === root$25.tag) { - var workInProgressRootRenderLanes$27 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$27 = getNextLanes( - root$25, - root$25 === workInProgressRoot - ? workInProgressRootRenderLanes$27 + for (var root$26 = firstScheduledRoot; null !== root$26; ) { + if (!onlyLegacy || 0 === root$26.tag) { + var workInProgressRootRenderLanes$28 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$28 = getNextLanes( + root$26, + root$26 === workInProgressRoot + ? workInProgressRootRenderLanes$28 : 0 ); - 0 !== (workInProgressRootRenderLanes$27 & 3) && + 0 !== (workInProgressRootRenderLanes$28 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$25, workInProgressRootRenderLanes$27)); + performSyncWorkOnRoot(root$26, workInProgressRootRenderLanes$28)); } - root$25 = root$25.next; + root$26 = root$26.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -1990,12 +1990,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$6 = 31 - clz32(pendingLanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2247,20 +2247,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$30 = workInProgress$jscomp$0.alternate; + null !== current$30 && + ((current$30 = current$30.updateQueue), + (pendingQueue = current$30.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$30.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$30.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$30 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2273,8 +2273,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$30 && + (current$30 = current$30.next = { lane: 0, tag: pendingQueue.tag, @@ -2327,10 +2327,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$30 + ? ((firstPendingUpdate = current$30 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$30 = current$30.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2343,10 +2343,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$30 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$30; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -3207,9 +3207,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$53 = fiber.alternate; + null !== current$53 && + null !== current$53.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3450,16 +3450,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$55 = currentlyRenderingFiber$1.alternate; + null !== current$55 && + ((current$55 = current$55.updateQueue), + null !== current$55 && + ((current$55 = current$55.memoCache), + null != current$55 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$55.data + : current$55.data.map(function (array) { return array.slice(); }), index: 0 @@ -3473,11 +3473,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$55 = 0; + current$55 < size; + current$55++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$55] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3510,7 +3511,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$51 = !1; + didReadFromEntangledAsyncAction$56 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3531,11 +3532,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); continue; } else (updateLane = { @@ -3581,7 +3582,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$51 && + didReadFromEntangledAsyncAction$56 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4201,14 +4202,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(provider); fiber = createUpdate(lane); - var root$59 = enqueueUpdate(provider, fiber, lane); - null !== root$59 && - (scheduleUpdateOnFiber(root$59, provider, lane), - entangleTransitions(root$59, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$59 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4444,15 +4445,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$54 = workInProgressRoot; - if (null === root$54) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$54, workInProgressRootRenderLanes) || + var root$59 = workInProgressRoot; + if (null === root$59) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$59, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$54 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$54; - mountEffect(subscribeToStore.bind(null, fiber, root$54, subscribe), [ + root$59 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$59; + mountEffect(subscribeToStore.bind(null, fiber, root$59, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4461,7 +4462,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$54, + root$59, getServerSnapshot, getSnapshot ), @@ -4802,9 +4803,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$63 in Component) - void 0 === newProps[propName$63] && - (newProps[propName$63] = Component[propName$63]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -5249,10 +5250,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$75 = workInProgress.stateNode; + root$81 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$75.incompleteTransitions.has(transition)) { + if (!root$81.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -5260,11 +5261,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$75.incompleteTransitions.set(transition, markerInstance); + root$81.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$75.incompleteTransitions.forEach(function (markerInstance) { + root$81.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -5811,31 +5812,35 @@ function updateClassComponent( ); } function finishClassComponent( - current, + current$jscomp$0, workInProgress, Component, shouldUpdate, hasContext, renderLanes ) { - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); var didCaptureError = 0 !== (workInProgress.flags & 128); if (!shouldUpdate && !didCaptureError) return ( hasContext && invalidateContextProvider(workInProgress, Component, !1), - bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) + bailoutOnAlreadyFinishedWork( + current$jscomp$0, + workInProgress, + renderLanes + ) ); shouldUpdate = workInProgress.stateNode; - currentOwner = workInProgress; + current = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null : shouldUpdate.render(); workInProgress.flags |= 1; - null !== current && didCaptureError + null !== current$jscomp$0 && didCaptureError ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -5845,7 +5850,12 @@ function finishClassComponent( nextChildren, renderLanes ))) - : reconcileChildren(current, workInProgress, nextChildren, renderLanes); + : reconcileChildren( + current$jscomp$0, + workInProgress, + nextChildren, + renderLanes + ); workInProgress.memoizedState = shouldUpdate.state; hasContext && invalidateContextProvider(workInProgress, Component, !0); return workInProgress.child; @@ -7713,14 +7723,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$118 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$118 = lastTailNode), + for (var lastTailNode$124 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$124 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$118 + null === lastTailNode$124 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$118.sibling = null); + : (lastTailNode$124.sibling = null); } } function bubbleProperties(completedWork) { @@ -7730,19 +7740,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$119 = completedWork.child; null !== child$119; ) - (newChildLanes |= child$119.lanes | child$119.childLanes), - (subtreeFlags |= child$119.subtreeFlags & 31457280), - (subtreeFlags |= child$119.flags & 31457280), - (child$119.return = completedWork), - (child$119 = child$119.sibling); + for (var child$125 = completedWork.child; null !== child$125; ) + (newChildLanes |= child$125.lanes | child$125.childLanes), + (subtreeFlags |= child$125.subtreeFlags & 31457280), + (subtreeFlags |= child$125.flags & 31457280), + (child$125.return = completedWork), + (child$125 = child$125.sibling); else - for (child$119 = completedWork.child; null !== child$119; ) - (newChildLanes |= child$119.lanes | child$119.childLanes), - (subtreeFlags |= child$119.subtreeFlags), - (subtreeFlags |= child$119.flags), - (child$119.return = completedWork), - (child$119 = child$119.sibling); + for (child$125 = completedWork.child; null !== child$125; ) + (newChildLanes |= child$125.lanes | child$125.childLanes), + (subtreeFlags |= child$125.subtreeFlags), + (subtreeFlags |= child$125.flags), + (child$125.return = completedWork), + (child$125 = child$125.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -8058,11 +8068,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$131 = null; + var cache$137 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$131 = newProps.memoizedState.cachePool.pool); - cache$131 !== currentResource && (newProps.flags |= 2048); + (cache$137 = newProps.memoizedState.cachePool.pool); + cache$137 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -8103,8 +8113,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$131 = currentResource.rendering; - if (null === cache$131) + cache$137 = currentResource.rendering; + if (null === cache$137) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -8112,11 +8122,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$131 = findFirstSuspended(current); - if (null !== cache$131) { + cache$137 = findFirstSuspended(current); + if (null !== cache$137) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$131.updateQueue; + current = cache$137.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -8141,7 +8151,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$131)), null !== current)) { + if (((current = findFirstSuspended(cache$137)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -8151,7 +8161,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$131.alternate && + !cache$137.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -8164,13 +8174,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$131.sibling = workInProgress.child), - (workInProgress.child = cache$131)) + ? ((cache$137.sibling = workInProgress.child), + (workInProgress.child = cache$137)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$131) - : (workInProgress.child = cache$131), - (currentResource.last = cache$131)); + ? (current.sibling = cache$137) + : (workInProgress.child = cache$137), + (currentResource.last = cache$137)); } if (null !== currentResource.tail) return ( @@ -8445,8 +8455,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$149) { - captureCommitPhaseError(current, nearestMountedAncestor, error$149); + } catch (error$155) { + captureCommitPhaseError(current, nearestMountedAncestor, error$155); } else ref.current = null; } @@ -8483,7 +8493,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$199) { + } catch (e$215) { JSCompiler_temp = null; break a; } @@ -8751,11 +8761,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$151) { + } catch (error$157) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$151 + error$157 ); } } @@ -9304,18 +9314,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$169 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$169 && + ((current$169 = current$169.memoizedState), + null !== current$169 && + ((current$169 = current$169.dehydrated), null !== current$169)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$169); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$169); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -9433,8 +9444,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$164) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$164); + } catch (error$171) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$171); } } break; @@ -9607,11 +9618,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$165) { + } catch (error$172) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$165 + error$172 ); } break; @@ -9648,8 +9659,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$166) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$166); + } catch (error$173) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$173); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -9659,8 +9670,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$168) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$168); + } catch (error$175) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$175); } } flags & 1024 && (needsFormReset = !0); @@ -9675,8 +9686,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$169) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$169); + } catch (error$176) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$176); } } break; @@ -9690,8 +9701,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$170) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$170); + } catch (error$177) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$177); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -9723,8 +9734,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$172) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$172); + } catch (error$179) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$179); } flags = finishedWork.updateQueue; null !== flags && @@ -9802,11 +9813,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$154) { + } catch (error$160) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$154 + error$160 ); } } else if ( @@ -9881,21 +9892,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$155 = JSCompiler_inline_result.stateNode; + var parent$161 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$155, ""), + (setTextContent(parent$161, ""), (JSCompiler_inline_result.flags &= -33)); - var before$156 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$156, parent$155); + var before$162 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$162, parent$161); break; case 3: case 4: - var parent$157 = JSCompiler_inline_result.stateNode.containerInfo, - before$158 = getHostSibling(finishedWork); + var parent$163 = JSCompiler_inline_result.stateNode.containerInfo, + before$164 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$158, - parent$157 + before$164, + parent$163 ); break; default: @@ -9974,7 +9985,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$183 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -10002,16 +10013,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$183 = finishedWork.updateQueue; + if (null !== current$183) { + var hiddenCallbacks = current$183.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$183.shared.hiddenCallbacks = null, current$183 = 0; + current$183 < hiddenCallbacks.length; + current$183++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$183], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -10027,7 +10038,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$183 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -10371,9 +10382,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$179 = finishedWork.stateNode; + var instance$190 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$179._visibility & 4 + ? instance$190._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10386,7 +10397,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$179._visibility |= 4), + : ((instance$190._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10394,7 +10405,7 @@ function recursivelyTraverseReconnectPassiveEffects( committedTransitions, includeWorkInProgressEffects )) - : ((instance$179._visibility |= 4), + : ((instance$190._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10407,7 +10418,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$179 + instance$190 ); break; case 24: @@ -10721,7 +10732,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, postPaintCallbackScheduled = !1, @@ -10870,11 +10881,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$11 = 31 - clz32(lane), + transitions = transitionLanesMap[index$11]; null === transitions && (transitions = new Set()); transitions.add(transition); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$11] = transitions; } } root === workInProgressRoot && @@ -11144,9 +11155,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7; + expirationTimes[index$7] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11262,9 +11273,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$5 = 31 - clz32(allEntangledLanes), + lane = 1 << index$5; + lanes |= root[index$5]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11274,7 +11285,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -11370,8 +11381,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$187) { - handleThrow(root, thrownValue$187); + } catch (thrownValue$201) { + handleThrow(root, thrownValue$201); } while (1); lanes && root.shellSuspendCounter++; @@ -11480,8 +11491,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$189) { - handleThrow(root, thrownValue$189); + } catch (thrownValue$203) { + handleThrow(root, thrownValue$203); } while (1); resetContextDependencies(); @@ -11500,12 +11511,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -11520,8 +11531,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { ? previousContext : contextStackCursor.current; context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11537,8 +11548,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11549,16 +11560,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11709,13 +11724,12 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$193 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$209 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$193 && + shouldFireAfterActiveInstanceBlur$209 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11787,7 +11801,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$194 = rootWithPendingPassiveEffects, + var root$210 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11802,7 +11816,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$194, remainingLanes); + releaseRootPooledCache(root$210, remainingLanes); } } return !1; @@ -13088,19 +13102,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$354; + var JSCompiler_inline_result$jscomp$370; if (canUseDOM) { - var isSupported$jscomp$inline_1516 = "oninput" in document; - if (!isSupported$jscomp$inline_1516) { - var element$jscomp$inline_1517 = document.createElement("div"); - element$jscomp$inline_1517.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1516 = - "function" === typeof element$jscomp$inline_1517.oninput; + var isSupported$jscomp$inline_1527 = "oninput" in document; + if (!isSupported$jscomp$inline_1527) { + var element$jscomp$inline_1528 = document.createElement("div"); + element$jscomp$inline_1528.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1527 = + "function" === typeof element$jscomp$inline_1528.oninput; } - JSCompiler_inline_result$jscomp$354 = isSupported$jscomp$inline_1516; - } else JSCompiler_inline_result$jscomp$354 = !1; + JSCompiler_inline_result$jscomp$370 = isSupported$jscomp$inline_1527; + } else JSCompiler_inline_result$jscomp$370 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$354 && + JSCompiler_inline_result$jscomp$370 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13509,20 +13523,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1557 = 0; - i$jscomp$inline_1557 < simpleEventPluginEvents.length; - i$jscomp$inline_1557++ + var i$jscomp$inline_1568 = 0; + i$jscomp$inline_1568 < simpleEventPluginEvents.length; + i$jscomp$inline_1568++ ) { - var eventName$jscomp$inline_1558 = - simpleEventPluginEvents[i$jscomp$inline_1557], - domEventName$jscomp$inline_1559 = - eventName$jscomp$inline_1558.toLowerCase(), - capitalizedEvent$jscomp$inline_1560 = - eventName$jscomp$inline_1558[0].toUpperCase() + - eventName$jscomp$inline_1558.slice(1); + var eventName$jscomp$inline_1569 = + simpleEventPluginEvents[i$jscomp$inline_1568], + domEventName$jscomp$inline_1570 = + eventName$jscomp$inline_1569.toLowerCase(), + capitalizedEvent$jscomp$inline_1571 = + eventName$jscomp$inline_1569[0].toUpperCase() + + eventName$jscomp$inline_1569.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1559, - "on" + capitalizedEvent$jscomp$inline_1560 + domEventName$jscomp$inline_1570, + "on" + capitalizedEvent$jscomp$inline_1571 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15000,14 +15014,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$228 in nextProps) { - var propKey = nextProps[propKey$228]; - lastProp = lastProps[propKey$228]; + for (var propKey$244 in nextProps) { + var propKey = nextProps[propKey$244]; + lastProp = lastProps[propKey$244]; if ( - nextProps.hasOwnProperty(propKey$228) && + nextProps.hasOwnProperty(propKey$244) && (null != propKey || null != lastProp) ) - switch (propKey$228) { + switch (propKey$244) { case "type": type = propKey; break; @@ -15036,7 +15050,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$228, + propKey$244, propKey, nextProps, lastProp @@ -15055,7 +15069,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$228 = null; + propKey = value = defaultValue = propKey$244 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -15086,7 +15100,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$228 = type; + propKey$244 = type; break; case "defaultValue": defaultValue = type; @@ -15107,15 +15121,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$228 - ? updateOptions(domElement, !!lastProps, propKey$228, !1) + null != propKey$244 + ? updateOptions(domElement, !!lastProps, propKey$244, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$228 = null; + propKey = propKey$244 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -15139,7 +15153,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$228 = name; + propKey$244 = name; break; case "defaultValue": propKey = name; @@ -15153,17 +15167,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$228, propKey); + updateTextarea(domElement, propKey$244, propKey); return; case "option": - for (var propKey$244 in lastProps) + for (var propKey$260 in lastProps) if ( - ((propKey$228 = lastProps[propKey$244]), - lastProps.hasOwnProperty(propKey$244) && - null != propKey$228 && - !nextProps.hasOwnProperty(propKey$244)) + ((propKey$244 = lastProps[propKey$260]), + lastProps.hasOwnProperty(propKey$260) && + null != propKey$244 && + !nextProps.hasOwnProperty(propKey$260)) ) - switch (propKey$244) { + switch (propKey$260) { case "selected": domElement.selected = !1; break; @@ -15171,33 +15185,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$244, + propKey$260, null, nextProps, - propKey$228 + propKey$244 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$228 = nextProps[lastDefaultValue]), + ((propKey$244 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$228 !== propKey && - (null != propKey$228 || null != propKey)) + propKey$244 !== propKey && + (null != propKey$244 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$228 && - "function" !== typeof propKey$228 && - "symbol" !== typeof propKey$228; + propKey$244 && + "function" !== typeof propKey$244 && + "symbol" !== typeof propKey$244; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$228, + propKey$244, nextProps, propKey ); @@ -15218,24 +15232,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$249 in lastProps) - (propKey$228 = lastProps[propKey$249]), - lastProps.hasOwnProperty(propKey$249) && - null != propKey$228 && - !nextProps.hasOwnProperty(propKey$249) && - setProp(domElement, tag, propKey$249, null, nextProps, propKey$228); + for (var propKey$265 in lastProps) + (propKey$244 = lastProps[propKey$265]), + lastProps.hasOwnProperty(propKey$265) && + null != propKey$244 && + !nextProps.hasOwnProperty(propKey$265) && + setProp(domElement, tag, propKey$265, null, nextProps, propKey$244); for (checked in nextProps) if ( - ((propKey$228 = nextProps[checked]), + ((propKey$244 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$228 !== propKey && - (null != propKey$228 || null != propKey)) + propKey$244 !== propKey && + (null != propKey$244 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$228) + if (null != propKey$244) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -15243,7 +15257,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$228, + propKey$244, nextProps, propKey ); @@ -15251,49 +15265,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$254 in lastProps) - (propKey$228 = lastProps[propKey$254]), - lastProps.hasOwnProperty(propKey$254) && - void 0 !== propKey$228 && - !nextProps.hasOwnProperty(propKey$254) && + for (var propKey$270 in lastProps) + (propKey$244 = lastProps[propKey$270]), + lastProps.hasOwnProperty(propKey$270) && + void 0 !== propKey$244 && + !nextProps.hasOwnProperty(propKey$270) && setPropOnCustomElement( domElement, tag, - propKey$254, + propKey$270, void 0, nextProps, - propKey$228 + propKey$244 ); for (defaultChecked in nextProps) - (propKey$228 = nextProps[defaultChecked]), + (propKey$244 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$228 === propKey || - (void 0 === propKey$228 && void 0 === propKey) || + propKey$244 === propKey || + (void 0 === propKey$244 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$228, + propKey$244, nextProps, propKey ); return; } } - for (var propKey$259 in lastProps) - (propKey$228 = lastProps[propKey$259]), - lastProps.hasOwnProperty(propKey$259) && - null != propKey$228 && - !nextProps.hasOwnProperty(propKey$259) && - setProp(domElement, tag, propKey$259, null, nextProps, propKey$228); + for (var propKey$275 in lastProps) + (propKey$244 = lastProps[propKey$275]), + lastProps.hasOwnProperty(propKey$275) && + null != propKey$244 && + !nextProps.hasOwnProperty(propKey$275) && + setProp(domElement, tag, propKey$275, null, nextProps, propKey$244); for (lastProp in nextProps) - (propKey$228 = nextProps[lastProp]), + (propKey$244 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$228 === propKey || - (null == propKey$228 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$228, nextProps, propKey); + propKey$244 === propKey || + (null == propKey$244 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$244, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -15872,17 +15886,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$267 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$268 = styles$267.get(type); - resource$268 || + var styles$283 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$284 = styles$283.get(type); + resource$284 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$268 = { + (resource$284 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$267.set(type, resource$268), + styles$283.set(type, resource$284), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -15897,9 +15911,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$268.state + resource$284.state )); - return resource$268; + return resource$284; } return null; case "script": @@ -15995,37 +16009,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$272 = hoistableRoot.querySelector( + var instance$288 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$272) + if (instance$288) return ( (resource.state.loading |= 4), - (resource.instance = instance$272), - markNodeAsHoistable(instance$272), - instance$272 + (resource.instance = instance$288), + markNodeAsHoistable(instance$288), + instance$288 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$272 = ( + instance$288 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$272); - var linkInstance = instance$272; + markNodeAsHoistable(instance$288); + var linkInstance = instance$288; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$272, "link", instance); + setInitialProperties(instance$288, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$272, props.precedence, hoistableRoot); - return (resource.instance = instance$272); + insertStylesheet(instance$288, props.precedence, hoistableRoot); + return (resource.instance = instance$288); case "script": - instance$272 = getScriptKey(props.src); + instance$288 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$272) + getScriptSelectorFromKey(instance$288) )) ) return ( @@ -16034,7 +16048,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$272))) + if ((styleProps = preloadPropsMap.get(instance$288))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -17052,17 +17066,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1735 = { +var devToolsConfig$jscomp$inline_1746 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-92c89d2a", + version: "19.0.0-www-classic-ad74bc60", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2179 = { - bundleType: devToolsConfig$jscomp$inline_1735.bundleType, - version: devToolsConfig$jscomp$inline_1735.version, - rendererPackageName: devToolsConfig$jscomp$inline_1735.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1735.rendererConfig, +var internals$jscomp$inline_2190 = { + bundleType: devToolsConfig$jscomp$inline_1746.bundleType, + version: devToolsConfig$jscomp$inline_1746.version, + rendererPackageName: devToolsConfig$jscomp$inline_1746.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1746.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17078,26 +17092,26 @@ var internals$jscomp$inline_2179 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1735.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1746.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-92c89d2a" + reconcilerVersion: "19.0.0-www-classic-ad74bc60" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2180 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2191 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2180.isDisabled && - hook$jscomp$inline_2180.supportsFiber + !hook$jscomp$inline_2191.isDisabled && + hook$jscomp$inline_2191.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2180.inject( - internals$jscomp$inline_2179 + (rendererID = hook$jscomp$inline_2191.inject( + internals$jscomp$inline_2190 )), - (injectedHook = hook$jscomp$inline_2180); + (injectedHook = hook$jscomp$inline_2191); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17171,11 +17185,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$293); + var instance = getPublicRootInstance(root$309); originalCallback.call(instance); }; } - var root$293 = createHydrationContainer( + var root$309 = createHydrationContainer( initialChildren, callback, container, @@ -17190,23 +17204,23 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$293; - container[internalContainerInstanceKey] = root$293.current; + container._reactRootContainer = root$309; + container[internalContainerInstanceKey] = root$309.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSyncWork(); - return root$293; + return root$309; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$294 = callback; + var originalCallback$310 = callback; callback = function () { - var instance = getPublicRootInstance(root$295); - originalCallback$294.call(instance); + var instance = getPublicRootInstance(root$311); + originalCallback$310.call(instance); }; } - var root$295 = createFiberRoot( + var root$311 = createFiberRoot( container, 0, !1, @@ -17221,14 +17235,14 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$295; - container[internalContainerInstanceKey] = root$295.current; + container._reactRootContainer = root$311; + container[internalContainerInstanceKey] = root$311.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); - updateContainerSync(initialChildren, root$295, parentComponent, callback); + updateContainerSync(initialChildren, root$311, parentComponent, callback); flushSyncWork(); - return root$295; + return root$311; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -17589,4 +17603,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-92c89d2a"; +exports.version = "19.0.0-www-classic-ad74bc60"; diff --git a/compiled/facebook-www/ReactDOM-prod.modern.js b/compiled/facebook-www/ReactDOM-prod.modern.js index 81dbdf4ed28ea..90529eb173779 100644 --- a/compiled/facebook-www/ReactDOM-prod.modern.js +++ b/compiled/facebook-www/ReactDOM-prod.modern.js @@ -90,7 +90,189 @@ function getIteratorFn(maybeIterable) { return "function" === typeof maybeIterable ? maybeIterable : null; } Symbol.for("react.client.reference"); -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -148,36 +330,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -222,8 +404,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -434,18 +614,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + expirationTimes[index$8] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$8]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$8] = null, index$8 = 0; + index$8 < hiddenUpdatesForLane.length; + index$8++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$8]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -465,21 +645,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + index$12 = root.transitionLanes[index$12]; + null !== index$12 && + index$12.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -489,10 +669,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$13 = 31 - clz32(lanes), + lane = 1 << index$13; + null !== root.transitionLanes[index$13] && + (root.transitionLanes[index$13] = null); lanes &= ~lane; } } @@ -674,8 +854,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$14 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$14 && "aria-" !== prefix$14) { node.removeAttribute(name); return; } @@ -718,186 +898,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$12) { - control = x$12; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$13) { - control = x$13; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1184,15 +1184,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$19 in styles) - (styleName = styles[styleName$19]), - styles.hasOwnProperty(styleName$19) && - prevStyles[styleName$19] !== styleName && - setValueForStyle(node, styleName$19, styleName); - } else for (var styleName$20 in styles) - styles.hasOwnProperty(styleName$20) && - setValueForStyle(node, styleName$20, styles[styleName$20]); + (styleName = styles[styleName$20]), + styles.hasOwnProperty(styleName$20) && + prevStyles[styleName$20] !== styleName && + setValueForStyle(node, styleName$20, styleName); + } else + for (var styleName$21 in styles) + styles.hasOwnProperty(styleName$21) && + setValueForStyle(node, styleName$21, styles[styleName$21]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1720,20 +1720,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$25 = firstScheduledRoot; null !== root$25; ) { + for (var root$26 = firstScheduledRoot; null !== root$26; ) { if (!onlyLegacy) { - var workInProgressRootRenderLanes$27 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$27 = getNextLanes( - root$25, - root$25 === workInProgressRoot - ? workInProgressRootRenderLanes$27 + var workInProgressRootRenderLanes$28 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$28 = getNextLanes( + root$26, + root$26 === workInProgressRoot + ? workInProgressRootRenderLanes$28 : 0 ); - 0 !== (workInProgressRootRenderLanes$27 & 3) && + 0 !== (workInProgressRootRenderLanes$28 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$25, workInProgressRootRenderLanes$27)); + performSyncWorkOnRoot(root$26, workInProgressRootRenderLanes$28)); } - root$25 = root$25.next; + root$26 = root$26.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -1778,12 +1778,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$6 = 31 - clz32(pendingLanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2035,20 +2035,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$30 = workInProgress$jscomp$0.alternate; + null !== current$30 && + ((current$30 = current$30.updateQueue), + (pendingQueue = current$30.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$30.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$30.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$30 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2061,8 +2061,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$30 && + (current$30 = current$30.next = { lane: 0, tag: pendingQueue.tag, @@ -2115,10 +2115,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$30 + ? ((firstPendingUpdate = current$30 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$30 = current$30.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2131,10 +2131,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$30 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$30; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -2995,9 +2995,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$53 = fiber.alternate; + null !== current$53 && + null !== current$53.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3238,16 +3238,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$55 = currentlyRenderingFiber$1.alternate; + null !== current$55 && + ((current$55 = current$55.updateQueue), + null !== current$55 && + ((current$55 = current$55.memoCache), + null != current$55 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$55.data + : current$55.data.map(function (array) { return array.slice(); }), index: 0 @@ -3261,11 +3261,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$55 = 0; + current$55 < size; + current$55++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$55] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3298,7 +3299,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$51 = !1; + didReadFromEntangledAsyncAction$56 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3319,11 +3320,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); continue; } else (updateLane = { @@ -3369,7 +3370,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$51 && + didReadFromEntangledAsyncAction$56 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3989,14 +3990,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$59 = enqueueUpdate(provider, fiber, lane); - null !== root$59 && - (scheduleUpdateOnFiber(root$59, provider, lane), - entangleTransitions(root$59, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$59 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4232,15 +4233,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$54 = workInProgressRoot; - if (null === root$54) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$54, workInProgressRootRenderLanes) || + var root$59 = workInProgressRoot; + if (null === root$59) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$59, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$54 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$54; - mountEffect(subscribeToStore.bind(null, fiber, root$54, subscribe), [ + root$59 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$59; + mountEffect(subscribeToStore.bind(null, fiber, root$59, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4249,7 +4250,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$54, + root$59, getServerSnapshot, getSnapshot ), @@ -4528,9 +4529,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$63 in Component) - void 0 === newProps[propName$63] && - (newProps[propName$63] = Component[propName$63]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -4907,10 +4908,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$74 = workInProgress.stateNode; + root$80 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$74.incompleteTransitions.has(transition)) { + if (!root$80.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -4918,11 +4919,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$74.incompleteTransitions.set(transition, markerInstance); + root$80.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$74.incompleteTransitions.forEach(function (markerInstance) { + root$80.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -5245,7 +5246,7 @@ function replayFunctionComponent( return workInProgress.child; } function updateClassComponent( - current, + current$jscomp$0, workInProgress, Component, nextProps, @@ -5301,7 +5302,7 @@ function updateClassComponent( "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); nextProps = !0; - } else if (null === current) { + } else if (null === current$jscomp$0) { context = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps( @@ -5379,7 +5380,7 @@ function updateClassComponent( (nextProps = !1)); } else { context = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); + cloneUpdateQueue(current$jscomp$0, workInProgress); contextType = workInProgress.memoizedProps; contextType$jscomp$0 = resolveClassComponentProps( Component, @@ -5417,9 +5418,9 @@ function updateClassComponent( oldState !== newState || hasForceUpdate || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies)) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies)) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps( workInProgress, @@ -5440,9 +5441,9 @@ function updateClassComponent( oldProps ) || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies))) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies))) ? (oldContext || ("function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate) || @@ -5459,12 +5460,12 @@ function updateClassComponent( "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), @@ -5473,30 +5474,30 @@ function updateClassComponent( (context.context = oldProps), (nextProps = contextType$jscomp$0)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (nextProps = !1)); } context = nextProps; - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); nextProps = 0 !== (workInProgress.flags & 128); context || nextProps ? ((context = workInProgress.stateNode), - (currentOwner = workInProgress), + (current = workInProgress), (Component = nextProps && "function" !== typeof Component.getDerivedStateFromError ? null : context.render()), (workInProgress.flags |= 1), - null !== current && nextProps + null !== current$jscomp$0 && nextProps ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -5506,15 +5507,20 @@ function updateClassComponent( Component, renderLanes ))) - : reconcileChildren(current, workInProgress, Component, renderLanes), + : reconcileChildren( + current$jscomp$0, + workInProgress, + Component, + renderLanes + ), (workInProgress.memoizedState = context.state), - (current = workInProgress.child)) - : (current = bailoutOnAlreadyFinishedWork( - current, + (current$jscomp$0 = workInProgress.child)) + : (current$jscomp$0 = bailoutOnAlreadyFinishedWork( + current$jscomp$0, workInProgress, renderLanes )); - return current; + return current$jscomp$0; } function mountHostRootWithoutHydrating( current, @@ -7259,14 +7265,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$110 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$110 = lastTailNode), + for (var lastTailNode$116 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$116 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$110 + null === lastTailNode$116 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$110.sibling = null); + : (lastTailNode$116.sibling = null); } } function bubbleProperties(completedWork) { @@ -7276,19 +7282,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$111 = completedWork.child; null !== child$111; ) - (newChildLanes |= child$111.lanes | child$111.childLanes), - (subtreeFlags |= child$111.subtreeFlags & 31457280), - (subtreeFlags |= child$111.flags & 31457280), - (child$111.return = completedWork), - (child$111 = child$111.sibling); + for (var child$117 = completedWork.child; null !== child$117; ) + (newChildLanes |= child$117.lanes | child$117.childLanes), + (subtreeFlags |= child$117.subtreeFlags & 31457280), + (subtreeFlags |= child$117.flags & 31457280), + (child$117.return = completedWork), + (child$117 = child$117.sibling); else - for (child$111 = completedWork.child; null !== child$111; ) - (newChildLanes |= child$111.lanes | child$111.childLanes), - (subtreeFlags |= child$111.subtreeFlags), - (subtreeFlags |= child$111.flags), - (child$111.return = completedWork), - (child$111 = child$111.sibling); + for (child$117 = completedWork.child; null !== child$117; ) + (newChildLanes |= child$117.lanes | child$117.childLanes), + (subtreeFlags |= child$117.subtreeFlags), + (subtreeFlags |= child$117.flags), + (child$117.return = completedWork), + (child$117 = child$117.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7597,11 +7603,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$123 = null; + var cache$129 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$123 = newProps.memoizedState.cachePool.pool); - cache$123 !== currentResource && (newProps.flags |= 2048); + (cache$129 = newProps.memoizedState.cachePool.pool); + cache$129 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -7636,8 +7642,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$123 = currentResource.rendering; - if (null === cache$123) + cache$129 = currentResource.rendering; + if (null === cache$129) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -7645,11 +7651,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$123 = findFirstSuspended(current); - if (null !== cache$123) { + cache$129 = findFirstSuspended(current); + if (null !== cache$129) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$123.updateQueue; + current = cache$129.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -7674,7 +7680,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$123)), null !== current)) { + if (((current = findFirstSuspended(cache$129)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -7684,7 +7690,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$123.alternate && + !cache$129.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -7697,13 +7703,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$123.sibling = workInProgress.child), - (workInProgress.child = cache$123)) + ? ((cache$129.sibling = workInProgress.child), + (workInProgress.child = cache$129)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$123) - : (workInProgress.child = cache$123), - (currentResource.last = cache$123)); + ? (current.sibling = cache$129) + : (workInProgress.child = cache$129), + (currentResource.last = cache$129)); } if (null !== currentResource.tail) return ( @@ -7969,8 +7975,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$140) { - captureCommitPhaseError(current, nearestMountedAncestor, error$140); + } catch (error$146) { + captureCommitPhaseError(current, nearestMountedAncestor, error$146); } else ref.current = null; } @@ -8007,7 +8013,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$190) { + } catch (e$206) { JSCompiler_temp = null; break a; } @@ -8288,11 +8294,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$142) { + } catch (error$148) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$142 + error$148 ); } } @@ -8830,18 +8836,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$160 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$160 && + ((current$160 = current$160.memoizedState), + null !== current$160 && + ((current$160 = current$160.dehydrated), null !== current$160)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$160); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$160); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -8959,8 +8966,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$155) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$155); + } catch (error$162) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$162); } } break; @@ -9133,11 +9140,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$156) { + } catch (error$163) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$156 + error$163 ); } break; @@ -9174,8 +9181,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$157) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$157); + } catch (error$164) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$164); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -9185,8 +9192,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$159) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$159); + } catch (error$166) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$166); } } flags & 1024 && (needsFormReset = !0); @@ -9201,8 +9208,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$160) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$160); + } catch (error$167) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$167); } } break; @@ -9216,8 +9223,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$161) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$161); + } catch (error$168) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$168); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -9249,8 +9256,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$163) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$163); + } catch (error$170) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$170); } flags = finishedWork.updateQueue; null !== flags && @@ -9325,11 +9332,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$145) { + } catch (error$151) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$145 + error$151 ); } } else if ( @@ -9404,21 +9411,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$146 = JSCompiler_inline_result.stateNode; + var parent$152 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$146, ""), + (setTextContent(parent$152, ""), (JSCompiler_inline_result.flags &= -33)); - var before$147 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$147, parent$146); + var before$153 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$153, parent$152); break; case 3: case 4: - var parent$148 = JSCompiler_inline_result.stateNode.containerInfo, - before$149 = getHostSibling(finishedWork); + var parent$154 = JSCompiler_inline_result.stateNode.containerInfo, + before$155 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$149, - parent$148 + before$155, + parent$154 ); break; default: @@ -9497,7 +9504,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$174 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -9525,16 +9532,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$174 = finishedWork.updateQueue; + if (null !== current$174) { + var hiddenCallbacks = current$174.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$174.shared.hiddenCallbacks = null, current$174 = 0; + current$174 < hiddenCallbacks.length; + current$174++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$174], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -9550,7 +9557,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$174 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -9886,9 +9893,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$170 = finishedWork.stateNode; + var instance$181 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$170._visibility & 4 + ? instance$181._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -9900,7 +9907,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$170._visibility |= 4), + : ((instance$181._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -9913,7 +9920,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$170 + instance$181 ); break; case 24: @@ -10227,7 +10234,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, postPaintCallbackScheduled = !1, @@ -10375,11 +10382,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing)) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$11 = 31 - clz32(lane), + transitions = transitionLanesMap[index$11]; null === transitions && (transitions = new Set()); transitions.add(fiber); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$11] = transitions; } root === workInProgressRoot && (0 === (executionContext & 2) && @@ -10643,9 +10650,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7; + expirationTimes[index$7] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -10749,9 +10756,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$5 = 31 - clz32(allEntangledLanes), + lane = 1 << index$5; + lanes |= root[index$5]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -10761,7 +10768,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -10857,8 +10864,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$178) { - handleThrow(root, thrownValue$178); + } catch (thrownValue$192) { + handleThrow(root, thrownValue$192); } while (1); lanes && root.shellSuspendCounter++; @@ -10967,8 +10974,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$180) { - handleThrow(root, thrownValue$180); + } catch (thrownValue$194) { + handleThrow(root, thrownValue$194); } while (1); resetContextDependencies(); @@ -10987,12 +10994,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -11003,8 +11010,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11020,8 +11027,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11032,16 +11039,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11192,13 +11203,12 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$184 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$200 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$184 && + shouldFireAfterActiveInstanceBlur$200 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11268,7 +11278,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$185 = rootWithPendingPassiveEffects, + var root$201 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11283,7 +11293,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$185, remainingLanes); + releaseRootPooledCache(root$201, remainingLanes); } } return !1; @@ -12475,19 +12485,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$341; + var JSCompiler_inline_result$jscomp$357; if (canUseDOM) { - var isSupported$jscomp$inline_1488 = "oninput" in document; - if (!isSupported$jscomp$inline_1488) { - var element$jscomp$inline_1489 = document.createElement("div"); - element$jscomp$inline_1489.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1488 = - "function" === typeof element$jscomp$inline_1489.oninput; + var isSupported$jscomp$inline_1499 = "oninput" in document; + if (!isSupported$jscomp$inline_1499) { + var element$jscomp$inline_1500 = document.createElement("div"); + element$jscomp$inline_1500.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1499 = + "function" === typeof element$jscomp$inline_1500.oninput; } - JSCompiler_inline_result$jscomp$341 = isSupported$jscomp$inline_1488; - } else JSCompiler_inline_result$jscomp$341 = !1; + JSCompiler_inline_result$jscomp$357 = isSupported$jscomp$inline_1499; + } else JSCompiler_inline_result$jscomp$357 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$341 && + JSCompiler_inline_result$jscomp$357 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -12896,20 +12906,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1529 = 0; - i$jscomp$inline_1529 < simpleEventPluginEvents.length; - i$jscomp$inline_1529++ + var i$jscomp$inline_1540 = 0; + i$jscomp$inline_1540 < simpleEventPluginEvents.length; + i$jscomp$inline_1540++ ) { - var eventName$jscomp$inline_1530 = - simpleEventPluginEvents[i$jscomp$inline_1529], - domEventName$jscomp$inline_1531 = - eventName$jscomp$inline_1530.toLowerCase(), - capitalizedEvent$jscomp$inline_1532 = - eventName$jscomp$inline_1530[0].toUpperCase() + - eventName$jscomp$inline_1530.slice(1); + var eventName$jscomp$inline_1541 = + simpleEventPluginEvents[i$jscomp$inline_1540], + domEventName$jscomp$inline_1542 = + eventName$jscomp$inline_1541.toLowerCase(), + capitalizedEvent$jscomp$inline_1543 = + eventName$jscomp$inline_1541[0].toUpperCase() + + eventName$jscomp$inline_1541.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1531, - "on" + capitalizedEvent$jscomp$inline_1532 + domEventName$jscomp$inline_1542, + "on" + capitalizedEvent$jscomp$inline_1543 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -14386,14 +14396,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$219 in nextProps) { - var propKey = nextProps[propKey$219]; - lastProp = lastProps[propKey$219]; + for (var propKey$235 in nextProps) { + var propKey = nextProps[propKey$235]; + lastProp = lastProps[propKey$235]; if ( - nextProps.hasOwnProperty(propKey$219) && + nextProps.hasOwnProperty(propKey$235) && (null != propKey || null != lastProp) ) - switch (propKey$219) { + switch (propKey$235) { case "type": type = propKey; break; @@ -14422,7 +14432,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$219, + propKey$235, propKey, nextProps, lastProp @@ -14441,7 +14451,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$219 = null; + propKey = value = defaultValue = propKey$235 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -14472,7 +14482,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$219 = type; + propKey$235 = type; break; case "defaultValue": defaultValue = type; @@ -14493,15 +14503,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$219 - ? updateOptions(domElement, !!lastProps, propKey$219, !1) + null != propKey$235 + ? updateOptions(domElement, !!lastProps, propKey$235, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$219 = null; + propKey = propKey$235 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -14525,7 +14535,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$219 = name; + propKey$235 = name; break; case "defaultValue": propKey = name; @@ -14539,17 +14549,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$219, propKey); + updateTextarea(domElement, propKey$235, propKey); return; case "option": - for (var propKey$235 in lastProps) + for (var propKey$251 in lastProps) if ( - ((propKey$219 = lastProps[propKey$235]), - lastProps.hasOwnProperty(propKey$235) && - null != propKey$219 && - !nextProps.hasOwnProperty(propKey$235)) + ((propKey$235 = lastProps[propKey$251]), + lastProps.hasOwnProperty(propKey$251) && + null != propKey$235 && + !nextProps.hasOwnProperty(propKey$251)) ) - switch (propKey$235) { + switch (propKey$251) { case "selected": domElement.selected = !1; break; @@ -14557,33 +14567,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$235, + propKey$251, null, nextProps, - propKey$219 + propKey$235 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$219 = nextProps[lastDefaultValue]), + ((propKey$235 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$219 !== propKey && - (null != propKey$219 || null != propKey)) + propKey$235 !== propKey && + (null != propKey$235 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$219 && - "function" !== typeof propKey$219 && - "symbol" !== typeof propKey$219; + propKey$235 && + "function" !== typeof propKey$235 && + "symbol" !== typeof propKey$235; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$219, + propKey$235, nextProps, propKey ); @@ -14604,24 +14614,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$240 in lastProps) - (propKey$219 = lastProps[propKey$240]), - lastProps.hasOwnProperty(propKey$240) && - null != propKey$219 && - !nextProps.hasOwnProperty(propKey$240) && - setProp(domElement, tag, propKey$240, null, nextProps, propKey$219); + for (var propKey$256 in lastProps) + (propKey$235 = lastProps[propKey$256]), + lastProps.hasOwnProperty(propKey$256) && + null != propKey$235 && + !nextProps.hasOwnProperty(propKey$256) && + setProp(domElement, tag, propKey$256, null, nextProps, propKey$235); for (checked in nextProps) if ( - ((propKey$219 = nextProps[checked]), + ((propKey$235 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$219 !== propKey && - (null != propKey$219 || null != propKey)) + propKey$235 !== propKey && + (null != propKey$235 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$219) + if (null != propKey$235) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -14629,7 +14639,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$219, + propKey$235, nextProps, propKey ); @@ -14637,49 +14647,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$245 in lastProps) - (propKey$219 = lastProps[propKey$245]), - lastProps.hasOwnProperty(propKey$245) && - void 0 !== propKey$219 && - !nextProps.hasOwnProperty(propKey$245) && + for (var propKey$261 in lastProps) + (propKey$235 = lastProps[propKey$261]), + lastProps.hasOwnProperty(propKey$261) && + void 0 !== propKey$235 && + !nextProps.hasOwnProperty(propKey$261) && setPropOnCustomElement( domElement, tag, - propKey$245, + propKey$261, void 0, nextProps, - propKey$219 + propKey$235 ); for (defaultChecked in nextProps) - (propKey$219 = nextProps[defaultChecked]), + (propKey$235 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$219 === propKey || - (void 0 === propKey$219 && void 0 === propKey) || + propKey$235 === propKey || + (void 0 === propKey$235 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$219, + propKey$235, nextProps, propKey ); return; } } - for (var propKey$250 in lastProps) - (propKey$219 = lastProps[propKey$250]), - lastProps.hasOwnProperty(propKey$250) && - null != propKey$219 && - !nextProps.hasOwnProperty(propKey$250) && - setProp(domElement, tag, propKey$250, null, nextProps, propKey$219); + for (var propKey$266 in lastProps) + (propKey$235 = lastProps[propKey$266]), + lastProps.hasOwnProperty(propKey$266) && + null != propKey$235 && + !nextProps.hasOwnProperty(propKey$266) && + setProp(domElement, tag, propKey$266, null, nextProps, propKey$235); for (lastProp in nextProps) - (propKey$219 = nextProps[lastProp]), + (propKey$235 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$219 === propKey || - (null == propKey$219 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$219, nextProps, propKey); + propKey$235 === propKey || + (null == propKey$235 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$235, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -15249,17 +15259,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$258 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$259 = styles$258.get(type); - resource$259 || + var styles$274 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$275 = styles$274.get(type); + resource$275 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$259 = { + (resource$275 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$258.set(type, resource$259), + styles$274.set(type, resource$275), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -15274,9 +15284,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$259.state + resource$275.state )); - return resource$259; + return resource$275; } return null; case "script": @@ -15372,37 +15382,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$263 = hoistableRoot.querySelector( + var instance$279 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$263) + if (instance$279) return ( (resource.state.loading |= 4), - (resource.instance = instance$263), - markNodeAsHoistable(instance$263), - instance$263 + (resource.instance = instance$279), + markNodeAsHoistable(instance$279), + instance$279 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$263 = ( + instance$279 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$263); - var linkInstance = instance$263; + markNodeAsHoistable(instance$279); + var linkInstance = instance$279; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$263, "link", instance); + setInitialProperties(instance$279, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$263, props.precedence, hoistableRoot); - return (resource.instance = instance$263); + insertStylesheet(instance$279, props.precedence, hoistableRoot); + return (resource.instance = instance$279); case "script": - instance$263 = getScriptKey(props.src); + instance$279 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$263) + getScriptSelectorFromKey(instance$279) )) ) return ( @@ -15411,7 +15421,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$263))) + if ((styleProps = preloadPropsMap.get(instance$279))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -16419,17 +16429,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1702 = { +var devToolsConfig$jscomp$inline_1713 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-e7aa74f6", + version: "19.0.0-www-modern-72670d98", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2171 = { - bundleType: devToolsConfig$jscomp$inline_1702.bundleType, - version: devToolsConfig$jscomp$inline_1702.version, - rendererPackageName: devToolsConfig$jscomp$inline_1702.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1702.rendererConfig, +var internals$jscomp$inline_2182 = { + bundleType: devToolsConfig$jscomp$inline_1713.bundleType, + version: devToolsConfig$jscomp$inline_1713.version, + rendererPackageName: devToolsConfig$jscomp$inline_1713.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1713.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16445,26 +16455,26 @@ var internals$jscomp$inline_2171 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1702.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1713.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-e7aa74f6" + reconcilerVersion: "19.0.0-www-modern-72670d98" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2172 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2183 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2172.isDisabled && - hook$jscomp$inline_2172.supportsFiber + !hook$jscomp$inline_2183.isDisabled && + hook$jscomp$inline_2183.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2172.inject( - internals$jscomp$inline_2171 + (rendererID = hook$jscomp$inline_2183.inject( + internals$jscomp$inline_2182 )), - (injectedHook = hook$jscomp$inline_2172); + (injectedHook = hook$jscomp$inline_2183); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -16826,4 +16836,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-e7aa74f6"; +exports.version = "19.0.0-www-modern-72670d98"; diff --git a/compiled/facebook-www/ReactDOM-profiling.classic.js b/compiled/facebook-www/ReactDOM-profiling.classic.js index 2fc96d46365b9..32d5596929d38 100644 --- a/compiled/facebook-www/ReactDOM-profiling.classic.js +++ b/compiled/facebook-www/ReactDOM-profiling.classic.js @@ -219,7 +219,189 @@ function getComponentNameFromFiber(fiber) { } return null; } -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -277,36 +459,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -351,8 +533,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -410,7 +590,7 @@ function injectProfilingHooks(profilingHooks) { } function getLaneLabelMap() { if (enableSchedulingProfiler) { - for (var map = new Map(), lane = 1, index$2 = 0; 31 > index$2; index$2++) { + for (var map = new Map(), lane = 1, index$5 = 0; 31 > index$5; index$5++) { var label = getLabelForLane(lane); map.set(lane, label); lane *= 2; @@ -664,18 +844,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$6 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$6; - remainingLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$9 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$9; + remainingLanes[index$9] = 0; + expirationTimes[index$9] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$9]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$9] = null, index$9 = 0; + index$9 < hiddenUpdatesForLane.length; + index$9++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$9]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -695,19 +875,19 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$10 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$10; + (lane & entangledLanes) | (root[index$10] & entangledLanes) && + (root[index$10] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - root[index$9].add(fiber); + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + root[index$12].add(fiber); lanes &= ~lane; } } @@ -719,27 +899,27 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$10 = 31 - clz32(lanes); - root = 1 << index$10; - index$10 = pendingUpdatersLaneMap[index$10]; - 0 < index$10.size && - (index$10.forEach(function (fiber) { + var index$13 = 31 - clz32(lanes); + root = 1 << index$13; + index$13 = pendingUpdatersLaneMap[index$13]; + 0 < index$13.size && + (index$13.forEach(function (fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$10.clear()); + index$13.clear()); lanes &= ~root; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$12 = 31 - clz32(lanes), - lane = 1 << index$12; - index$12 = root.transitionLanes[index$12]; - null !== index$12 && - index$12.forEach(function (transition) { + var index$15 = 31 - clz32(lanes), + lane = 1 << index$15; + index$15 = root.transitionLanes[index$15]; + null !== index$15 && + index$15.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -749,10 +929,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$13 = 31 - clz32(lanes), - lane = 1 << index$13; - null !== root.transitionLanes[index$13] && - (root.transitionLanes[index$13] = null); + var index$16 = 31 - clz32(lanes), + lane = 1 << index$16; + null !== root.transitionLanes[index$16] && + (root.transitionLanes[index$16] = null); lanes &= ~lane; } } @@ -934,8 +1114,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$14 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$14 && "aria-" !== prefix$14) { + var prefix$17 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$17 && "aria-" !== prefix$17) { node.removeAttribute(name); return; } @@ -978,186 +1158,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$15) { - control = x$15; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$16) { - control = x$16; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1454,15 +1454,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$22 in styles) - (styleName = styles[styleName$22]), - styles.hasOwnProperty(styleName$22) && - prevStyles[styleName$22] !== styleName && - setValueForStyle(node, styleName$22, styleName); - } else for (var styleName$23 in styles) - styles.hasOwnProperty(styleName$23) && - setValueForStyle(node, styleName$23, styles[styleName$23]); + (styleName = styles[styleName$23]), + styles.hasOwnProperty(styleName$23) && + prevStyles[styleName$23] !== styleName && + setValueForStyle(node, styleName$23, styleName); + } else + for (var styleName$24 in styles) + styles.hasOwnProperty(styleName$24) && + setValueForStyle(node, styleName$24, styles[styleName$24]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -2068,20 +2068,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$28 = firstScheduledRoot; null !== root$28; ) { - if (!onlyLegacy || 0 === root$28.tag) { - var workInProgressRootRenderLanes$30 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$30 = getNextLanes( - root$28, - root$28 === workInProgressRoot - ? workInProgressRootRenderLanes$30 + for (var root$29 = firstScheduledRoot; null !== root$29; ) { + if (!onlyLegacy || 0 === root$29.tag) { + var workInProgressRootRenderLanes$31 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$31 = getNextLanes( + root$29, + root$29 === workInProgressRoot + ? workInProgressRootRenderLanes$31 : 0 ); - 0 !== (workInProgressRootRenderLanes$30 & 3) && + 0 !== (workInProgressRootRenderLanes$31 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$28, workInProgressRootRenderLanes$30)); + performSyncWorkOnRoot(root$29, workInProgressRootRenderLanes$31)); } - root$28 = root$28.next; + root$29 = root$29.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -2126,12 +2126,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$4 = 31 - clz32(pendingLanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$7 = 31 - clz32(pendingLanes), + lane = 1 << index$7, + expirationTime = expirationTimes[index$7]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$7] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2383,20 +2383,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$33 = workInProgress$jscomp$0.alternate; + null !== current$33 && + ((current$33 = current$33.updateQueue), + (pendingQueue = current$33.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$33.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$33.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$33 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2409,8 +2409,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$33 && + (current$33 = current$33.next = { lane: 0, tag: pendingQueue.tag, @@ -2463,10 +2463,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$33 + ? ((firstPendingUpdate = current$33 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$33 = current$33.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2479,10 +2479,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$33 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$33; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -3343,9 +3343,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$56 = fiber.alternate; + null !== current$56 && + null !== current$56.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3586,16 +3586,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$58 = currentlyRenderingFiber$1.alternate; + null !== current$58 && + ((current$58 = current$58.updateQueue), + null !== current$58 && + ((current$58 = current$58.memoCache), + null != current$58 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$58.data + : current$58.data.map(function (array) { return array.slice(); }), index: 0 @@ -3609,11 +3609,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$58 = 0; + current$58 < size; + current$58++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$58] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3646,7 +3647,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$54 = !1; + didReadFromEntangledAsyncAction$59 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3667,11 +3668,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$59 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$59 = !0); continue; } else (updateLane = { @@ -3717,7 +3718,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$54 && + didReadFromEntangledAsyncAction$59 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4337,14 +4338,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(provider); fiber = createUpdate(lane); - var root$62 = enqueueUpdate(provider, fiber, lane); - null !== root$62 && - (scheduleUpdateOnFiber(root$62, provider, lane), - entangleTransitions(root$62, provider, lane)); + var root$67 = enqueueUpdate(provider, fiber, lane); + null !== root$67 && + (scheduleUpdateOnFiber(root$67, provider, lane), + entangleTransitions(root$67, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$62 && + null !== root$67 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4583,15 +4584,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$57 = workInProgressRoot; - if (null === root$57) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$57, workInProgressRootRenderLanes) || + var root$62 = workInProgressRoot; + if (null === root$62) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$62, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$57 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$57; - mountEffect(subscribeToStore.bind(null, fiber, root$57, subscribe), [ + root$62 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$62; + mountEffect(subscribeToStore.bind(null, fiber, root$62, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4600,7 +4601,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$57, + root$62, getServerSnapshot, getSnapshot ), @@ -5010,9 +5011,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$68 in Component) - void 0 === newProps[propName$68] && - (newProps[propName$68] = Component[propName$68]); + for (var propName$73 in Component) + void 0 === newProps[propName$73] && + (newProps[propName$73] = Component[propName$73]); } return newProps; } @@ -5458,10 +5459,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$80 = workInProgress.stateNode; + root$86 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$80.incompleteTransitions.has(transition)) { + if (!root$86.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -5469,11 +5470,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$80.incompleteTransitions.set(transition, markerInstance); + root$86.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$80.incompleteTransitions.forEach(function (markerInstance) { + root$86.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -6026,22 +6027,26 @@ function updateClassComponent( ); } function finishClassComponent( - current, + current$jscomp$0, workInProgress, Component, shouldUpdate, hasContext, renderLanes ) { - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); var didCaptureError = 0 !== (workInProgress.flags & 128); if (!shouldUpdate && !didCaptureError) return ( hasContext && invalidateContextProvider(workInProgress, Component, !1), - bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) + bailoutOnAlreadyFinishedWork( + current$jscomp$0, + workInProgress, + renderLanes + ) ); shouldUpdate = workInProgress.stateNode; - currentOwner = workInProgress; + current = workInProgress; if ( didCaptureError && "function" !== typeof Component.getDerivedStateFromError @@ -6053,11 +6058,11 @@ function finishClassComponent( (nextChildren = shouldUpdate.render()), enableSchedulingProfiler && markComponentRenderStopped(); workInProgress.flags |= 1; - null !== current && didCaptureError + null !== current$jscomp$0 && didCaptureError ? ((didCaptureError = nextChildren), (workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -6067,7 +6072,12 @@ function finishClassComponent( didCaptureError, renderLanes ))) - : reconcileChildren(current, workInProgress, nextChildren, renderLanes); + : reconcileChildren( + current$jscomp$0, + workInProgress, + nextChildren, + renderLanes + ); workInProgress.memoizedState = shouldUpdate.state; hasContext && invalidateContextProvider(workInProgress, Component, !0); return workInProgress.child; @@ -7961,14 +7971,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$124 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$124 = lastTailNode), + for (var lastTailNode$130 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$130 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$124 + null === lastTailNode$130 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$124.sibling = null); + : (lastTailNode$130.sibling = null); } } function bubbleProperties(completedWork) { @@ -7980,53 +7990,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$126 = completedWork.selfBaseDuration, - child$127 = completedWork.child; - null !== child$127; + var treeBaseDuration$132 = completedWork.selfBaseDuration, + child$133 = completedWork.child; + null !== child$133; ) - (newChildLanes |= child$127.lanes | child$127.childLanes), - (subtreeFlags |= child$127.subtreeFlags & 31457280), - (subtreeFlags |= child$127.flags & 31457280), - (treeBaseDuration$126 += child$127.treeBaseDuration), - (child$127 = child$127.sibling); - completedWork.treeBaseDuration = treeBaseDuration$126; + (newChildLanes |= child$133.lanes | child$133.childLanes), + (subtreeFlags |= child$133.subtreeFlags & 31457280), + (subtreeFlags |= child$133.flags & 31457280), + (treeBaseDuration$132 += child$133.treeBaseDuration), + (child$133 = child$133.sibling); + completedWork.treeBaseDuration = treeBaseDuration$132; } else for ( - treeBaseDuration$126 = completedWork.child; - null !== treeBaseDuration$126; + treeBaseDuration$132 = completedWork.child; + null !== treeBaseDuration$132; ) (newChildLanes |= - treeBaseDuration$126.lanes | treeBaseDuration$126.childLanes), - (subtreeFlags |= treeBaseDuration$126.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$126.flags & 31457280), - (treeBaseDuration$126.return = completedWork), - (treeBaseDuration$126 = treeBaseDuration$126.sibling); + treeBaseDuration$132.lanes | treeBaseDuration$132.childLanes), + (subtreeFlags |= treeBaseDuration$132.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$132.flags & 31457280), + (treeBaseDuration$132.return = completedWork), + (treeBaseDuration$132 = treeBaseDuration$132.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$126 = completedWork.actualDuration; - child$127 = completedWork.selfBaseDuration; + treeBaseDuration$132 = completedWork.actualDuration; + child$133 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$126 += child.actualDuration), - (child$127 += child.treeBaseDuration), + (treeBaseDuration$132 += child.actualDuration), + (child$133 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$126; - completedWork.treeBaseDuration = child$127; + completedWork.actualDuration = treeBaseDuration$132; + completedWork.treeBaseDuration = child$133; } else for ( - treeBaseDuration$126 = completedWork.child; - null !== treeBaseDuration$126; + treeBaseDuration$132 = completedWork.child; + null !== treeBaseDuration$132; ) (newChildLanes |= - treeBaseDuration$126.lanes | treeBaseDuration$126.childLanes), - (subtreeFlags |= treeBaseDuration$126.subtreeFlags), - (subtreeFlags |= treeBaseDuration$126.flags), - (treeBaseDuration$126.return = completedWork), - (treeBaseDuration$126 = treeBaseDuration$126.sibling); + treeBaseDuration$132.lanes | treeBaseDuration$132.childLanes), + (subtreeFlags |= treeBaseDuration$132.subtreeFlags), + (subtreeFlags |= treeBaseDuration$132.flags), + (treeBaseDuration$132.return = completedWork), + (treeBaseDuration$132 = treeBaseDuration$132.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -8360,11 +8370,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$142 = null; + var cache$148 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$142 = newProps.memoizedState.cachePool.pool); - cache$142 !== currentResource && (newProps.flags |= 2048); + (cache$148 = newProps.memoizedState.cachePool.pool); + cache$148 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -8410,8 +8420,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$142 = currentResource.rendering; - if (null === cache$142) + cache$148 = currentResource.rendering; + if (null === cache$148) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -8419,11 +8429,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$142 = findFirstSuspended(current); - if (null !== cache$142) { + cache$148 = findFirstSuspended(current); + if (null !== cache$148) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$142.updateQueue; + current = cache$148.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -8448,7 +8458,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$142)), null !== current)) { + if (((current = findFirstSuspended(cache$148)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -8458,7 +8468,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$142.alternate && + !cache$148.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -8471,13 +8481,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$142.sibling = workInProgress.child), - (workInProgress.child = cache$142)) + ? ((cache$148.sibling = workInProgress.child), + (workInProgress.child = cache$148)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$142) - : (workInProgress.child = cache$142), - (currentResource.last = cache$142)); + ? (current.sibling = cache$148) + : (workInProgress.child = cache$148), + (currentResource.last = cache$148)); } if (null !== currentResource.tail) return ( @@ -8790,8 +8800,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$160) { - captureCommitPhaseError(current, nearestMountedAncestor, error$160); + } catch (error$166) { + captureCommitPhaseError(current, nearestMountedAncestor, error$166); } else ref.current = null; } @@ -8828,7 +8838,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$220) { + } catch (e$236) { JSCompiler_temp = null; break a; } @@ -9086,11 +9096,11 @@ function commitPassiveEffectDurations(finishedRoot, finishedWork) { var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id; _finishedWork$memoize = _finishedWork$memoize.onPostCommit; - var commitTime$162 = commitTime, + var commitTime$168 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof _finishedWork$memoize && - _finishedWork$memoize(id, phase, finishedRoot, commitTime$162); + _finishedWork$memoize(id, phase, finishedRoot, commitTime$168); finishedWork = finishedWork.return; a: for (; null !== finishedWork; ) { switch (finishedWork.tag) { @@ -9117,8 +9127,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$164) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$164); + } catch (error$170) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$170); } } function commitClassCallbacks(finishedWork) { @@ -9217,11 +9227,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$165) { + } catch (error$171) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$165 + error$171 ); } else { @@ -9239,11 +9249,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$166) { + } catch (error$172) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$166 + error$172 ); } recordLayoutEffectDuration(finishedWork); @@ -9254,11 +9264,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$167) { + } catch (error$173) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$167 + error$173 ); } } @@ -9821,18 +9831,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$187 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$187 && + ((current$187 = current$187.memoizedState), + null !== current$187 && + ((current$187 = current$187.dehydrated), null !== current$187)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$187); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$187); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -9964,22 +9975,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$182) { + } catch (error$189) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$182 + error$189 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$183) { + } catch (error$190) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$183 + error$190 ); } } @@ -10153,11 +10164,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$184) { + } catch (error$191) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$184 + error$191 ); } break; @@ -10194,8 +10205,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$185) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$185); + } catch (error$192) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$192); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -10205,8 +10216,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$187) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$187); + } catch (error$194) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$194); } } flags & 1024 && (needsFormReset = !0); @@ -10221,8 +10232,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$188) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$188); + } catch (error$195) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$195); } } break; @@ -10236,8 +10247,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$189) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$189); + } catch (error$196) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$196); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -10269,8 +10280,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$191) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$191); + } catch (error$198) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$198); } flags = finishedWork.updateQueue; null !== flags && @@ -10348,11 +10359,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$172) { + } catch (error$178) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$172 + error$178 ); } } else if ( @@ -10427,21 +10438,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$173 = JSCompiler_inline_result.stateNode; + var parent$179 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$173, ""), + (setTextContent(parent$179, ""), (JSCompiler_inline_result.flags &= -33)); - var before$174 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$174, parent$173); + var before$180 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$180, parent$179); break; case 3: case 4: - var parent$175 = JSCompiler_inline_result.stateNode.containerInfo, - before$176 = getHostSibling(finishedWork); + var parent$181 = JSCompiler_inline_result.stateNode.containerInfo, + before$182 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$176, - parent$175 + before$182, + parent$181 ); break; default: @@ -10533,7 +10544,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$202 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -10561,16 +10572,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$202 = finishedWork.updateQueue; + if (null !== current$202) { + var hiddenCallbacks = current$202.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$202.shared.hiddenCallbacks = null, current$202 = 0; + current$202 < hiddenCallbacks.length; + current$202++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$202], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -10586,7 +10597,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$202 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -10599,7 +10610,7 @@ function recursivelyTraverseReappearLayoutEffects( ); includeWorkInProgressEffects && flags & 4 && - commitProfilerUpdate(finishedWork, current); + commitProfilerUpdate(finishedWork, current$202); break; case 13: recursivelyTraverseReappearLayoutEffects( @@ -10642,8 +10653,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$194) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$194); + } catch (error$203) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$203); } } function commitOffscreenPassiveMountEffects(current, finishedWork, instance) { @@ -10942,9 +10953,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$199 = finishedWork.stateNode; + var instance$210 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$199._visibility & 4 + ? instance$210._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10957,7 +10968,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$199._visibility |= 4), + : ((instance$210._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10965,7 +10976,7 @@ function recursivelyTraverseReconnectPassiveEffects( committedTransitions, includeWorkInProgressEffects )) - : ((instance$199._visibility |= 4), + : ((instance$210._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10978,7 +10989,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$199 + instance$210 ); break; case 24: @@ -11311,7 +11322,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, postPaintCallbackScheduled = !1, @@ -11462,11 +11473,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing) ) { var transitionLanesMap = root.transitionLanes, - index$11 = 31 - clz32(lane), - transitions = transitionLanesMap[index$11]; + index$14 = 31 - clz32(lane), + transitions = transitionLanesMap[index$14]; null === transitions && (transitions = new Set()); transitions.add(transition); - transitionLanesMap[index$11] = transitions; + transitionLanesMap[index$14] = transitions; } } root === workInProgressRoot && @@ -11737,9 +11748,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + var index$8 = 31 - clz32(lanes), + lane = 1 << index$8; + expirationTimes[index$8] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11857,9 +11868,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$6 = 31 - clz32(allEntangledLanes), + lane = 1 << index$6; + lanes |= root[index$6]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11869,7 +11880,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -12004,8 +12015,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$207) { - handleThrow(root, thrownValue$207); + } catch (thrownValue$221) { + handleThrow(root, thrownValue$221); } while (1); lanes && root.shellSuspendCounter++; @@ -12125,8 +12136,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$209) { - handleThrow(root, thrownValue$209); + } catch (thrownValue$223) { + handleThrow(root, thrownValue$223); } while (1); resetContextDependencies(); @@ -12153,20 +12164,28 @@ function workLoopConcurrent() { performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; 0 !== (unitOfWork.mode & 2) ? (startProfilerTimer(unitOfWork), - (current = beginWork(current, unitOfWork, entangledRenderLanes)), + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )), stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) - : (current = beginWork(current, unitOfWork, entangledRenderLanes)); + : (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, + var current$jscomp$0 = unitOfWork.alternate, isProfilingMode = 0 !== (unitOfWork.mode & 2); isProfilingMode && startProfilerTimer(unitOfWork); switch (unitOfWork.tag) { @@ -12183,8 +12202,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { ? previousContext : contextStackCursor.current; context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -12200,8 +12219,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -12212,17 +12231,21 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -12291,15 +12314,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + var current$227 = completedWork.alternate; unitOfWork = completedWork.return; 0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, entangledRenderLanes)) + ? (current$227 = completeWork( + current$227, + completedWork, + entangledRenderLanes + )) : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, entangledRenderLanes)), + (current$227 = completeWork( + current$227, + completedWork, + entangledRenderLanes + )), stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); - if (null !== current) { - workInProgress = current; + if (null !== current$227) { + workInProgress = current$227; return; } completedWork = completedWork.sibling; @@ -12388,14 +12419,13 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$213 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$229 = commitBeforeMutationEffects( root, finishedWork ); commitTime = now(); commitMutationEffects(root, finishedWork, lanes); - shouldFireAfterActiveInstanceBlur$213 && + shouldFireAfterActiveInstanceBlur$229 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -12480,7 +12510,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$214 = rootWithPendingPassiveEffects, + var root$230 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -12495,7 +12525,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$214, remainingLanes); + releaseRootPooledCache(root$230, remainingLanes); } } return !1; @@ -13836,19 +13866,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$375; + var JSCompiler_inline_result$jscomp$391; if (canUseDOM) { - var isSupported$jscomp$inline_1602 = "oninput" in document; - if (!isSupported$jscomp$inline_1602) { - var element$jscomp$inline_1603 = document.createElement("div"); - element$jscomp$inline_1603.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1602 = - "function" === typeof element$jscomp$inline_1603.oninput; + 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; } - JSCompiler_inline_result$jscomp$375 = isSupported$jscomp$inline_1602; - } else JSCompiler_inline_result$jscomp$375 = !1; + JSCompiler_inline_result$jscomp$391 = isSupported$jscomp$inline_1613; + } else JSCompiler_inline_result$jscomp$391 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$375 && + JSCompiler_inline_result$jscomp$391 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -14257,20 +14287,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1643 = 0; - i$jscomp$inline_1643 < simpleEventPluginEvents.length; - i$jscomp$inline_1643++ + var i$jscomp$inline_1654 = 0; + i$jscomp$inline_1654 < simpleEventPluginEvents.length; + i$jscomp$inline_1654++ ) { - 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); + var eventName$jscomp$inline_1655 = + simpleEventPluginEvents[i$jscomp$inline_1654], + domEventName$jscomp$inline_1656 = + eventName$jscomp$inline_1655.toLowerCase(), + capitalizedEvent$jscomp$inline_1657 = + eventName$jscomp$inline_1655[0].toUpperCase() + + eventName$jscomp$inline_1655.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1645, - "on" + capitalizedEvent$jscomp$inline_1646 + domEventName$jscomp$inline_1656, + "on" + capitalizedEvent$jscomp$inline_1657 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15748,14 +15778,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$249 in nextProps) { - var propKey = nextProps[propKey$249]; - lastProp = lastProps[propKey$249]; + for (var propKey$265 in nextProps) { + var propKey = nextProps[propKey$265]; + lastProp = lastProps[propKey$265]; if ( - nextProps.hasOwnProperty(propKey$249) && + nextProps.hasOwnProperty(propKey$265) && (null != propKey || null != lastProp) ) - switch (propKey$249) { + switch (propKey$265) { case "type": type = propKey; break; @@ -15784,7 +15814,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$249, + propKey$265, propKey, nextProps, lastProp @@ -15803,7 +15833,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$249 = null; + propKey = value = defaultValue = propKey$265 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -15834,7 +15864,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$249 = type; + propKey$265 = type; break; case "defaultValue": defaultValue = type; @@ -15855,15 +15885,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$249 - ? updateOptions(domElement, !!lastProps, propKey$249, !1) + null != propKey$265 + ? updateOptions(domElement, !!lastProps, propKey$265, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$249 = null; + propKey = propKey$265 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -15887,7 +15917,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$249 = name; + propKey$265 = name; break; case "defaultValue": propKey = name; @@ -15901,17 +15931,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$249, propKey); + updateTextarea(domElement, propKey$265, propKey); return; case "option": - for (var propKey$265 in lastProps) + for (var propKey$281 in lastProps) if ( - ((propKey$249 = lastProps[propKey$265]), - lastProps.hasOwnProperty(propKey$265) && - null != propKey$249 && - !nextProps.hasOwnProperty(propKey$265)) + ((propKey$265 = lastProps[propKey$281]), + lastProps.hasOwnProperty(propKey$281) && + null != propKey$265 && + !nextProps.hasOwnProperty(propKey$281)) ) - switch (propKey$265) { + switch (propKey$281) { case "selected": domElement.selected = !1; break; @@ -15919,33 +15949,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$265, + propKey$281, null, nextProps, - propKey$249 + propKey$265 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$249 = nextProps[lastDefaultValue]), + ((propKey$265 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$249 !== propKey && - (null != propKey$249 || null != propKey)) + propKey$265 !== propKey && + (null != propKey$265 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$249 && - "function" !== typeof propKey$249 && - "symbol" !== typeof propKey$249; + propKey$265 && + "function" !== typeof propKey$265 && + "symbol" !== typeof propKey$265; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$249, + propKey$265, nextProps, propKey ); @@ -15966,24 +15996,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$270 in lastProps) - (propKey$249 = lastProps[propKey$270]), - lastProps.hasOwnProperty(propKey$270) && - null != propKey$249 && - !nextProps.hasOwnProperty(propKey$270) && - setProp(domElement, tag, propKey$270, null, nextProps, propKey$249); + for (var propKey$286 in lastProps) + (propKey$265 = lastProps[propKey$286]), + lastProps.hasOwnProperty(propKey$286) && + null != propKey$265 && + !nextProps.hasOwnProperty(propKey$286) && + setProp(domElement, tag, propKey$286, null, nextProps, propKey$265); for (checked in nextProps) if ( - ((propKey$249 = nextProps[checked]), + ((propKey$265 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$249 !== propKey && - (null != propKey$249 || null != propKey)) + propKey$265 !== propKey && + (null != propKey$265 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$249) + if (null != propKey$265) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -15991,7 +16021,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$249, + propKey$265, nextProps, propKey ); @@ -15999,49 +16029,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$275 in lastProps) - (propKey$249 = lastProps[propKey$275]), - lastProps.hasOwnProperty(propKey$275) && - void 0 !== propKey$249 && - !nextProps.hasOwnProperty(propKey$275) && + for (var propKey$291 in lastProps) + (propKey$265 = lastProps[propKey$291]), + lastProps.hasOwnProperty(propKey$291) && + void 0 !== propKey$265 && + !nextProps.hasOwnProperty(propKey$291) && setPropOnCustomElement( domElement, tag, - propKey$275, + propKey$291, void 0, nextProps, - propKey$249 + propKey$265 ); for (defaultChecked in nextProps) - (propKey$249 = nextProps[defaultChecked]), + (propKey$265 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$249 === propKey || - (void 0 === propKey$249 && void 0 === propKey) || + propKey$265 === propKey || + (void 0 === propKey$265 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$249, + propKey$265, nextProps, propKey ); return; } } - for (var propKey$280 in lastProps) - (propKey$249 = lastProps[propKey$280]), - lastProps.hasOwnProperty(propKey$280) && - null != propKey$249 && - !nextProps.hasOwnProperty(propKey$280) && - setProp(domElement, tag, propKey$280, null, nextProps, propKey$249); + for (var propKey$296 in lastProps) + (propKey$265 = lastProps[propKey$296]), + lastProps.hasOwnProperty(propKey$296) && + null != propKey$265 && + !nextProps.hasOwnProperty(propKey$296) && + setProp(domElement, tag, propKey$296, null, nextProps, propKey$265); for (lastProp in nextProps) - (propKey$249 = nextProps[lastProp]), + (propKey$265 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$249 === propKey || - (null == propKey$249 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$249, nextProps, propKey); + propKey$265 === propKey || + (null == propKey$265 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$265, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -16620,17 +16650,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$288 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$289 = styles$288.get(type); - resource$289 || + var styles$304 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$305 = styles$304.get(type); + resource$305 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$289 = { + (resource$305 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$288.set(type, resource$289), + styles$304.set(type, resource$305), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -16645,9 +16675,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$289.state + resource$305.state )); - return resource$289; + return resource$305; } return null; case "script": @@ -16743,37 +16773,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$293 = hoistableRoot.querySelector( + var instance$309 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$293) + if (instance$309) return ( (resource.state.loading |= 4), - (resource.instance = instance$293), - markNodeAsHoistable(instance$293), - instance$293 + (resource.instance = instance$309), + markNodeAsHoistable(instance$309), + instance$309 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$293 = ( + instance$309 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$293); - var linkInstance = instance$293; + markNodeAsHoistable(instance$309); + var linkInstance = instance$309; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$293, "link", instance); + setInitialProperties(instance$309, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$293, props.precedence, hoistableRoot); - return (resource.instance = instance$293); + insertStylesheet(instance$309, props.precedence, hoistableRoot); + return (resource.instance = instance$309); case "script": - instance$293 = getScriptKey(props.src); + instance$309 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$293) + getScriptSelectorFromKey(instance$309) )) ) return ( @@ -16782,7 +16812,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$293))) + if ((styleProps = preloadPropsMap.get(instance$309))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -17800,10 +17830,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1821 = { +var devToolsConfig$jscomp$inline_1832 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-2e18da43", + version: "19.0.0-www-classic-97671a1d", rendererPackageName: "react-dom" }; (function (internals) { @@ -17821,10 +17851,10 @@ var devToolsConfig$jscomp$inline_1821 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1821.bundleType, - version: devToolsConfig$jscomp$inline_1821.version, - rendererPackageName: devToolsConfig$jscomp$inline_1821.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1821.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1832.bundleType, + version: devToolsConfig$jscomp$inline_1832.version, + rendererPackageName: devToolsConfig$jscomp$inline_1832.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1832.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17840,14 +17870,14 @@ var devToolsConfig$jscomp$inline_1821 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1821.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1832.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-2e18da43" + reconcilerVersion: "19.0.0-www-classic-97671a1d" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -17920,11 +17950,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$314); + var instance = getPublicRootInstance(root$330); originalCallback.call(instance); }; } - var root$314 = createHydrationContainer( + var root$330 = createHydrationContainer( initialChildren, callback, container, @@ -17939,23 +17969,23 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$314; - container[internalContainerInstanceKey] = root$314.current; + container._reactRootContainer = root$330; + container[internalContainerInstanceKey] = root$330.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSyncWork(); - return root$314; + return root$330; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$315 = callback; + var originalCallback$331 = callback; callback = function () { - var instance = getPublicRootInstance(root$316); - originalCallback$315.call(instance); + var instance = getPublicRootInstance(root$332); + originalCallback$331.call(instance); }; } - var root$316 = createFiberRoot( + var root$332 = createFiberRoot( container, 0, !1, @@ -17970,14 +18000,14 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$316; - container[internalContainerInstanceKey] = root$316.current; + container._reactRootContainer = root$332; + container[internalContainerInstanceKey] = root$332.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); - updateContainerSync(initialChildren, root$316, parentComponent, callback); + updateContainerSync(initialChildren, root$332, parentComponent, callback); flushSyncWork(); - return root$316; + return root$332; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -18338,7 +18368,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-2e18da43"; +exports.version = "19.0.0-www-classic-97671a1d"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOM-profiling.modern.js b/compiled/facebook-www/ReactDOM-profiling.modern.js index bef9c35929e51..137cdf2c54faf 100644 --- a/compiled/facebook-www/ReactDOM-profiling.modern.js +++ b/compiled/facebook-www/ReactDOM-profiling.modern.js @@ -95,7 +95,189 @@ function getIteratorFn(maybeIterable) { return "function" === typeof maybeIterable ? maybeIterable : null; } Symbol.for("react.client.reference"); -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -153,36 +335,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -227,8 +409,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -286,7 +466,7 @@ function injectProfilingHooks(profilingHooks) { } function getLaneLabelMap() { if (enableSchedulingProfiler) { - for (var map = new Map(), lane = 1, index$2 = 0; 31 > index$2; index$2++) { + for (var map = new Map(), lane = 1, index$5 = 0; 31 > index$5; index$5++) { var label = getLabelForLane(lane); map.set(lane, label); lane *= 2; @@ -540,18 +720,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$6 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$6; - remainingLanes[index$6] = 0; - expirationTimes[index$6] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$6]; + var index$9 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$9; + remainingLanes[index$9] = 0; + expirationTimes[index$9] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$9]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$6] = null, index$6 = 0; - index$6 < hiddenUpdatesForLane.length; - index$6++ + hiddenUpdates[index$9] = null, index$9 = 0; + index$9 < hiddenUpdatesForLane.length; + index$9++ ) { - var update = hiddenUpdatesForLane[index$6]; + var update = hiddenUpdatesForLane[index$9]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -571,19 +751,19 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$7 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$7; - (lane & entangledLanes) | (root[index$7] & entangledLanes) && - (root[index$7] |= entangledLanes); + var index$10 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$10; + (lane & entangledLanes) | (root[index$10] & entangledLanes) && + (root[index$10] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - root[index$9].add(fiber); + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + root[index$12].add(fiber); lanes &= ~lane; } } @@ -595,27 +775,27 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$10 = 31 - clz32(lanes); - root = 1 << index$10; - index$10 = pendingUpdatersLaneMap[index$10]; - 0 < index$10.size && - (index$10.forEach(function (fiber) { + var index$13 = 31 - clz32(lanes); + root = 1 << index$13; + index$13 = pendingUpdatersLaneMap[index$13]; + 0 < index$13.size && + (index$13.forEach(function (fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$10.clear()); + index$13.clear()); lanes &= ~root; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$12 = 31 - clz32(lanes), - lane = 1 << index$12; - index$12 = root.transitionLanes[index$12]; - null !== index$12 && - index$12.forEach(function (transition) { + var index$15 = 31 - clz32(lanes), + lane = 1 << index$15; + index$15 = root.transitionLanes[index$15]; + null !== index$15 && + index$15.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -625,10 +805,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$13 = 31 - clz32(lanes), - lane = 1 << index$13; - null !== root.transitionLanes[index$13] && - (root.transitionLanes[index$13] = null); + var index$16 = 31 - clz32(lanes), + lane = 1 << index$16; + null !== root.transitionLanes[index$16] && + (root.transitionLanes[index$16] = null); lanes &= ~lane; } } @@ -810,8 +990,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$14 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$14 && "aria-" !== prefix$14) { + var prefix$17 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$17 && "aria-" !== prefix$17) { node.removeAttribute(name); return; } @@ -854,186 +1034,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$15) { - control = x$15; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$16) { - control = x$16; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1320,15 +1320,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$22 in styles) - (styleName = styles[styleName$22]), - styles.hasOwnProperty(styleName$22) && - prevStyles[styleName$22] !== styleName && - setValueForStyle(node, styleName$22, styleName); - } else for (var styleName$23 in styles) - styles.hasOwnProperty(styleName$23) && - setValueForStyle(node, styleName$23, styles[styleName$23]); + (styleName = styles[styleName$23]), + styles.hasOwnProperty(styleName$23) && + prevStyles[styleName$23] !== styleName && + setValueForStyle(node, styleName$23, styleName); + } else + for (var styleName$24 in styles) + styles.hasOwnProperty(styleName$24) && + setValueForStyle(node, styleName$24, styles[styleName$24]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1856,20 +1856,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$28 = firstScheduledRoot; null !== root$28; ) { + for (var root$29 = firstScheduledRoot; null !== root$29; ) { if (!onlyLegacy) { - var workInProgressRootRenderLanes$30 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$30 = getNextLanes( - root$28, - root$28 === workInProgressRoot - ? workInProgressRootRenderLanes$30 + var workInProgressRootRenderLanes$31 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$31 = getNextLanes( + root$29, + root$29 === workInProgressRoot + ? workInProgressRootRenderLanes$31 : 0 ); - 0 !== (workInProgressRootRenderLanes$30 & 3) && + 0 !== (workInProgressRootRenderLanes$31 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$28, workInProgressRootRenderLanes$30)); + performSyncWorkOnRoot(root$29, workInProgressRootRenderLanes$31)); } - root$28 = root$28.next; + root$29 = root$29.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -1914,12 +1914,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$4 = 31 - clz32(pendingLanes), - lane = 1 << index$4, - expirationTime = expirationTimes[index$4]; + var index$7 = 31 - clz32(pendingLanes), + lane = 1 << index$7, + expirationTime = expirationTimes[index$7]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$4] = computeExpirationTime(lane, currentTime); + expirationTimes[index$7] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2171,20 +2171,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$33 = workInProgress$jscomp$0.alternate; + null !== current$33 && + ((current$33 = current$33.updateQueue), + (pendingQueue = current$33.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$33.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$33.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$33 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2197,8 +2197,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$33 && + (current$33 = current$33.next = { lane: 0, tag: pendingQueue.tag, @@ -2251,10 +2251,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$33 + ? ((firstPendingUpdate = current$33 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$33 = current$33.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2267,10 +2267,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$33 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$33; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -3131,9 +3131,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$56 = fiber.alternate; + null !== current$56 && + null !== current$56.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3374,16 +3374,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$58 = currentlyRenderingFiber$1.alternate; + null !== current$58 && + ((current$58 = current$58.updateQueue), + null !== current$58 && + ((current$58 = current$58.memoCache), + null != current$58 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$58.data + : current$58.data.map(function (array) { return array.slice(); }), index: 0 @@ -3397,11 +3397,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$58 = 0; + current$58 < size; + current$58++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$58] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3434,7 +3435,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$54 = !1; + didReadFromEntangledAsyncAction$59 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3455,11 +3456,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$59 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$54 = !0); + (didReadFromEntangledAsyncAction$59 = !0); continue; } else (updateLane = { @@ -3505,7 +3506,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$54 && + didReadFromEntangledAsyncAction$59 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4125,14 +4126,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$62 = enqueueUpdate(provider, fiber, lane); - null !== root$62 && - (scheduleUpdateOnFiber(root$62, provider, lane), - entangleTransitions(root$62, provider, lane)); + var root$67 = enqueueUpdate(provider, fiber, lane); + null !== root$67 && + (scheduleUpdateOnFiber(root$67, provider, lane), + entangleTransitions(root$67, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$62 && + null !== root$67 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4371,15 +4372,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$57 = workInProgressRoot; - if (null === root$57) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$57, workInProgressRootRenderLanes) || + var root$62 = workInProgressRoot; + if (null === root$62) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$62, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$57 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$57; - mountEffect(subscribeToStore.bind(null, fiber, root$57, subscribe), [ + root$62 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$62; + mountEffect(subscribeToStore.bind(null, fiber, root$62, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4388,7 +4389,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$57, + root$62, getServerSnapshot, getSnapshot ), @@ -4736,9 +4737,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$68 in Component) - void 0 === newProps[propName$68] && - (newProps[propName$68] = Component[propName$68]); + for (var propName$73 in Component) + void 0 === newProps[propName$73] && + (newProps[propName$73] = Component[propName$73]); } return newProps; } @@ -5116,10 +5117,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$79 = workInProgress.stateNode; + root$85 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$79.incompleteTransitions.has(transition)) { + if (!root$85.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -5127,11 +5128,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$79.incompleteTransitions.set(transition, markerInstance); + root$85.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$79.incompleteTransitions.forEach(function (markerInstance) { + root$85.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -5460,7 +5461,7 @@ function replayFunctionComponent( return workInProgress.child; } function updateClassComponent( - current, + current$jscomp$0, workInProgress, Component, nextProps, @@ -5516,7 +5517,7 @@ function updateClassComponent( "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); nextProps = !0; - } else if (null === current) { + } else if (null === current$jscomp$0) { context = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps( @@ -5594,7 +5595,7 @@ function updateClassComponent( (nextProps = !1)); } else { context = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); + cloneUpdateQueue(current$jscomp$0, workInProgress); contextType = workInProgress.memoizedProps; contextType$jscomp$0 = resolveClassComponentProps( Component, @@ -5632,9 +5633,9 @@ function updateClassComponent( oldState !== newState || hasForceUpdate || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies)) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies)) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps( workInProgress, @@ -5655,9 +5656,9 @@ function updateClassComponent( oldProps ) || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies))) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies))) ? (oldContext || ("function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate) || @@ -5674,12 +5675,12 @@ function updateClassComponent( "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), @@ -5688,21 +5689,21 @@ function updateClassComponent( (context.context = oldProps), (nextProps = contextType$jscomp$0)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (nextProps = !1)); } context = nextProps; - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); nextProps = 0 !== (workInProgress.flags & 128); context || nextProps ? ((context = workInProgress.stateNode), - (currentOwner = workInProgress), + (current = workInProgress), nextProps && "function" !== typeof Component.getDerivedStateFromError ? ((Component = null), (profilerStartTime = -1)) : (enableSchedulingProfiler && @@ -5710,10 +5711,10 @@ function updateClassComponent( (Component = context.render()), enableSchedulingProfiler && markComponentRenderStopped()), (workInProgress.flags |= 1), - null !== current && nextProps + null !== current$jscomp$0 && nextProps ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -5723,15 +5724,20 @@ function updateClassComponent( Component, renderLanes ))) - : reconcileChildren(current, workInProgress, Component, renderLanes), + : reconcileChildren( + current$jscomp$0, + workInProgress, + Component, + renderLanes + ), (workInProgress.memoizedState = context.state), - (current = workInProgress.child)) - : (current = bailoutOnAlreadyFinishedWork( - current, + (current$jscomp$0 = workInProgress.child)) + : (current$jscomp$0 = bailoutOnAlreadyFinishedWork( + current$jscomp$0, workInProgress, renderLanes )); - return current; + return current$jscomp$0; } function mountHostRootWithoutHydrating( current, @@ -7490,14 +7496,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$116 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$116 = lastTailNode), + for (var lastTailNode$122 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$122 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$116 + null === lastTailNode$122 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$116.sibling = null); + : (lastTailNode$122.sibling = null); } } function bubbleProperties(completedWork) { @@ -7509,53 +7515,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$118 = completedWork.selfBaseDuration, - child$119 = completedWork.child; - null !== child$119; + var treeBaseDuration$124 = completedWork.selfBaseDuration, + child$125 = completedWork.child; + null !== child$125; ) - (newChildLanes |= child$119.lanes | child$119.childLanes), - (subtreeFlags |= child$119.subtreeFlags & 31457280), - (subtreeFlags |= child$119.flags & 31457280), - (treeBaseDuration$118 += child$119.treeBaseDuration), - (child$119 = child$119.sibling); - completedWork.treeBaseDuration = treeBaseDuration$118; + (newChildLanes |= child$125.lanes | child$125.childLanes), + (subtreeFlags |= child$125.subtreeFlags & 31457280), + (subtreeFlags |= child$125.flags & 31457280), + (treeBaseDuration$124 += child$125.treeBaseDuration), + (child$125 = child$125.sibling); + completedWork.treeBaseDuration = treeBaseDuration$124; } else for ( - treeBaseDuration$118 = completedWork.child; - null !== treeBaseDuration$118; + treeBaseDuration$124 = completedWork.child; + null !== treeBaseDuration$124; ) (newChildLanes |= - treeBaseDuration$118.lanes | treeBaseDuration$118.childLanes), - (subtreeFlags |= treeBaseDuration$118.subtreeFlags & 31457280), - (subtreeFlags |= treeBaseDuration$118.flags & 31457280), - (treeBaseDuration$118.return = completedWork), - (treeBaseDuration$118 = treeBaseDuration$118.sibling); + treeBaseDuration$124.lanes | treeBaseDuration$124.childLanes), + (subtreeFlags |= treeBaseDuration$124.subtreeFlags & 31457280), + (subtreeFlags |= treeBaseDuration$124.flags & 31457280), + (treeBaseDuration$124.return = completedWork), + (treeBaseDuration$124 = treeBaseDuration$124.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$118 = completedWork.actualDuration; - child$119 = completedWork.selfBaseDuration; + treeBaseDuration$124 = completedWork.actualDuration; + child$125 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$118 += child.actualDuration), - (child$119 += child.treeBaseDuration), + (treeBaseDuration$124 += child.actualDuration), + (child$125 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$118; - completedWork.treeBaseDuration = child$119; + completedWork.actualDuration = treeBaseDuration$124; + completedWork.treeBaseDuration = child$125; } else for ( - treeBaseDuration$118 = completedWork.child; - null !== treeBaseDuration$118; + treeBaseDuration$124 = completedWork.child; + null !== treeBaseDuration$124; ) (newChildLanes |= - treeBaseDuration$118.lanes | treeBaseDuration$118.childLanes), - (subtreeFlags |= treeBaseDuration$118.subtreeFlags), - (subtreeFlags |= treeBaseDuration$118.flags), - (treeBaseDuration$118.return = completedWork), - (treeBaseDuration$118 = treeBaseDuration$118.sibling); + treeBaseDuration$124.lanes | treeBaseDuration$124.childLanes), + (subtreeFlags |= treeBaseDuration$124.subtreeFlags), + (subtreeFlags |= treeBaseDuration$124.flags), + (treeBaseDuration$124.return = completedWork), + (treeBaseDuration$124 = treeBaseDuration$124.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7882,11 +7888,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$134 = null; + var cache$140 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$134 = newProps.memoizedState.cachePool.pool); - cache$134 !== currentResource && (newProps.flags |= 2048); + (cache$140 = newProps.memoizedState.cachePool.pool); + cache$140 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -7926,8 +7932,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$134 = currentResource.rendering; - if (null === cache$134) + cache$140 = currentResource.rendering; + if (null === cache$140) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -7935,11 +7941,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$134 = findFirstSuspended(current); - if (null !== cache$134) { + cache$140 = findFirstSuspended(current); + if (null !== cache$140) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$134.updateQueue; + current = cache$140.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -7964,7 +7970,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$134)), null !== current)) { + if (((current = findFirstSuspended(cache$140)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -7974,7 +7980,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$134.alternate && + !cache$140.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -7987,13 +7993,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$134.sibling = workInProgress.child), - (workInProgress.child = cache$134)) + ? ((cache$140.sibling = workInProgress.child), + (workInProgress.child = cache$140)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$134) - : (workInProgress.child = cache$134), - (currentResource.last = cache$134)); + ? (current.sibling = cache$140) + : (workInProgress.child = cache$140), + (currentResource.last = cache$140)); } if (null !== currentResource.tail) return ( @@ -8297,8 +8303,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { recordLayoutEffectDuration(current); } else ref(null); - } catch (error$151) { - captureCommitPhaseError(current, nearestMountedAncestor, error$151); + } catch (error$157) { + captureCommitPhaseError(current, nearestMountedAncestor, error$157); } else ref.current = null; } @@ -8335,7 +8341,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$211) { + } catch (e$227) { JSCompiler_temp = null; break a; } @@ -8606,11 +8612,11 @@ function commitPassiveEffectDurations(finishedRoot, finishedWork) { var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id; _finishedWork$memoize = _finishedWork$memoize.onPostCommit; - var commitTime$153 = commitTime, + var commitTime$159 = commitTime, phase = null === finishedWork.alternate ? "mount" : "update"; currentUpdateIsNested && (phase = "nested-update"); "function" === typeof _finishedWork$memoize && - _finishedWork$memoize(id, phase, finishedRoot, commitTime$153); + _finishedWork$memoize(id, phase, finishedRoot, commitTime$159); finishedWork = finishedWork.return; a: for (; null !== finishedWork; ) { switch (finishedWork.tag) { @@ -8637,8 +8643,8 @@ function commitHookLayoutEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$155) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$155); + } catch (error$161) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$161); } } function commitClassCallbacks(finishedWork) { @@ -8737,11 +8743,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { } else try { finishedRoot.componentDidMount(); - } catch (error$156) { + } catch (error$162) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$156 + error$162 ); } else { @@ -8759,11 +8765,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$157) { + } catch (error$163) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$157 + error$163 ); } recordLayoutEffectDuration(finishedWork); @@ -8774,11 +8780,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$158) { + } catch (error$164) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$158 + error$164 ); } } @@ -9330,18 +9336,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$178 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$178 && + ((current$178 = current$178.memoizedState), + null !== current$178 && + ((current$178 = current$178.dehydrated), null !== current$178)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$178); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$178); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -9473,22 +9480,22 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { startLayoutEffectTimer(), commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$173) { + } catch (error$180) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$173 + error$180 ); } recordLayoutEffectDuration(finishedWork); } else try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$174) { + } catch (error$181) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$174 + error$181 ); } } @@ -9662,11 +9669,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$175) { + } catch (error$182) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$175 + error$182 ); } break; @@ -9703,8 +9710,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$176) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$176); + } catch (error$183) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$183); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -9714,8 +9721,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$178) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$178); + } catch (error$185) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$185); } } flags & 1024 && (needsFormReset = !0); @@ -9730,8 +9737,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$179) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$179); + } catch (error$186) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$186); } } break; @@ -9745,8 +9752,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$180) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$180); + } catch (error$187) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$187); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -9778,8 +9785,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$182) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$182); + } catch (error$189) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$189); } flags = finishedWork.updateQueue; null !== flags && @@ -9854,11 +9861,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$163) { + } catch (error$169) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$163 + error$169 ); } } else if ( @@ -9933,21 +9940,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$164 = JSCompiler_inline_result.stateNode; + var parent$170 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$164, ""), + (setTextContent(parent$170, ""), (JSCompiler_inline_result.flags &= -33)); - var before$165 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$165, parent$164); + var before$171 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$171, parent$170); break; case 3: case 4: - var parent$166 = JSCompiler_inline_result.stateNode.containerInfo, - before$167 = getHostSibling(finishedWork); + var parent$172 = JSCompiler_inline_result.stateNode.containerInfo, + before$173 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$167, - parent$166 + before$173, + parent$172 ); break; default: @@ -10039,7 +10046,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$193 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -10067,16 +10074,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$193 = finishedWork.updateQueue; + if (null !== current$193) { + var hiddenCallbacks = current$193.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$193.shared.hiddenCallbacks = null, current$193 = 0; + current$193 < hiddenCallbacks.length; + current$193++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$193], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -10092,7 +10099,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$193 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -10105,7 +10112,7 @@ function recursivelyTraverseReappearLayoutEffects( ); includeWorkInProgressEffects && flags & 4 && - commitProfilerUpdate(finishedWork, current); + commitProfilerUpdate(finishedWork, current$193); break; case 13: recursivelyTraverseReappearLayoutEffects( @@ -10148,8 +10155,8 @@ function commitHookPassiveMountEffects(finishedWork, hookFlags) { } else try { commitHookEffectListMount(hookFlags, finishedWork); - } catch (error$185) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$185); + } catch (error$194) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$194); } } function commitOffscreenPassiveMountEffects(current, finishedWork, instance) { @@ -10440,9 +10447,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$190 = finishedWork.stateNode; + var instance$201 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$190._visibility & 4 + ? instance$201._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10454,7 +10461,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$190._visibility |= 4), + : ((instance$201._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10467,7 +10474,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$190 + instance$201 ); break; case 24: @@ -10800,7 +10807,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, postPaintCallbackScheduled = !1, @@ -10950,11 +10957,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing)) ) { var transitionLanesMap = root.transitionLanes, - index$11 = 31 - clz32(lane), - transitions = transitionLanesMap[index$11]; + index$14 = 31 - clz32(lane), + transitions = transitionLanesMap[index$14]; null === transitions && (transitions = new Set()); transitions.add(fiber); - transitionLanesMap[index$11] = transitions; + transitionLanesMap[index$14] = transitions; } root === workInProgressRoot && (0 === (executionContext & 2) && @@ -11219,9 +11226,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5; - expirationTimes[index$5] = -1; + var index$8 = 31 - clz32(lanes), + lane = 1 << index$8; + expirationTimes[index$8] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11327,9 +11334,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$3 = 31 - clz32(allEntangledLanes), - lane = 1 << index$3; - lanes |= root[index$3]; + var index$6 = 31 - clz32(allEntangledLanes), + lane = 1 << index$6; + lanes |= root[index$6]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11339,7 +11346,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -11474,8 +11481,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$198) { - handleThrow(root, thrownValue$198); + } catch (thrownValue$212) { + handleThrow(root, thrownValue$212); } while (1); lanes && root.shellSuspendCounter++; @@ -11595,8 +11602,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$200) { - handleThrow(root, thrownValue$200); + } catch (thrownValue$214) { + handleThrow(root, thrownValue$214); } while (1); resetContextDependencies(); @@ -11623,20 +11630,28 @@ function workLoopConcurrent() { performUnitOfWork(workInProgress); } function performUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; 0 !== (unitOfWork.mode & 2) ? (startProfilerTimer(unitOfWork), - (current = beginWork(current, unitOfWork, entangledRenderLanes)), + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )), stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0)) - : (current = beginWork(current, unitOfWork, entangledRenderLanes)); + : (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate, + var current$jscomp$0 = unitOfWork.alternate, isProfilingMode = 0 !== (unitOfWork.mode & 2); isProfilingMode && startProfilerTimer(unitOfWork); switch (unitOfWork.tag) { @@ -11649,8 +11664,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11666,8 +11681,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11678,17 +11693,21 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } isProfilingMode && stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, !0); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11757,15 +11776,23 @@ function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { function completeUnitOfWork(unitOfWork) { var completedWork = unitOfWork; do { - var current = completedWork.alternate; + var current$218 = completedWork.alternate; unitOfWork = completedWork.return; 0 === (completedWork.mode & 2) - ? (current = completeWork(current, completedWork, entangledRenderLanes)) + ? (current$218 = completeWork( + current$218, + completedWork, + entangledRenderLanes + )) : (startProfilerTimer(completedWork), - (current = completeWork(current, completedWork, entangledRenderLanes)), + (current$218 = completeWork( + current$218, + completedWork, + entangledRenderLanes + )), stopProfilerTimerIfRunningAndRecordDelta(completedWork, !1)); - if (null !== current) { - workInProgress = current; + if (null !== current$218) { + workInProgress = current$218; return; } completedWork = completedWork.sibling; @@ -11854,14 +11881,13 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$204 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$220 = commitBeforeMutationEffects( root, finishedWork ); commitTime = now(); commitMutationEffects(root, finishedWork, lanes); - shouldFireAfterActiveInstanceBlur$204 && + shouldFireAfterActiveInstanceBlur$220 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11944,7 +11970,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$205 = rootWithPendingPassiveEffects, + var root$221 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11959,7 +11985,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$205, remainingLanes); + releaseRootPooledCache(root$221, remainingLanes); } } return !1; @@ -13206,19 +13232,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$362; + var JSCompiler_inline_result$jscomp$378; if (canUseDOM) { - var isSupported$jscomp$inline_1574 = "oninput" in document; - if (!isSupported$jscomp$inline_1574) { - var element$jscomp$inline_1575 = document.createElement("div"); - element$jscomp$inline_1575.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1574 = - "function" === typeof element$jscomp$inline_1575.oninput; + var isSupported$jscomp$inline_1585 = "oninput" in document; + if (!isSupported$jscomp$inline_1585) { + var element$jscomp$inline_1586 = document.createElement("div"); + element$jscomp$inline_1586.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1585 = + "function" === typeof element$jscomp$inline_1586.oninput; } - JSCompiler_inline_result$jscomp$362 = isSupported$jscomp$inline_1574; - } else JSCompiler_inline_result$jscomp$362 = !1; + JSCompiler_inline_result$jscomp$378 = isSupported$jscomp$inline_1585; + } else JSCompiler_inline_result$jscomp$378 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$362 && + JSCompiler_inline_result$jscomp$378 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13627,20 +13653,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1615 = 0; - i$jscomp$inline_1615 < simpleEventPluginEvents.length; - i$jscomp$inline_1615++ + var i$jscomp$inline_1626 = 0; + i$jscomp$inline_1626 < simpleEventPluginEvents.length; + i$jscomp$inline_1626++ ) { - var eventName$jscomp$inline_1616 = - simpleEventPluginEvents[i$jscomp$inline_1615], - domEventName$jscomp$inline_1617 = - eventName$jscomp$inline_1616.toLowerCase(), - capitalizedEvent$jscomp$inline_1618 = - eventName$jscomp$inline_1616[0].toUpperCase() + - eventName$jscomp$inline_1616.slice(1); + 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); registerSimpleEvent( - domEventName$jscomp$inline_1617, - "on" + capitalizedEvent$jscomp$inline_1618 + domEventName$jscomp$inline_1628, + "on" + capitalizedEvent$jscomp$inline_1629 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15117,14 +15143,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$240 in nextProps) { - var propKey = nextProps[propKey$240]; - lastProp = lastProps[propKey$240]; + for (var propKey$256 in nextProps) { + var propKey = nextProps[propKey$256]; + lastProp = lastProps[propKey$256]; if ( - nextProps.hasOwnProperty(propKey$240) && + nextProps.hasOwnProperty(propKey$256) && (null != propKey || null != lastProp) ) - switch (propKey$240) { + switch (propKey$256) { case "type": type = propKey; break; @@ -15153,7 +15179,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$240, + propKey$256, propKey, nextProps, lastProp @@ -15172,7 +15198,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$240 = null; + propKey = value = defaultValue = propKey$256 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -15203,7 +15229,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$240 = type; + propKey$256 = type; break; case "defaultValue": defaultValue = type; @@ -15224,15 +15250,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$240 - ? updateOptions(domElement, !!lastProps, propKey$240, !1) + null != propKey$256 + ? updateOptions(domElement, !!lastProps, propKey$256, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$240 = null; + propKey = propKey$256 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -15256,7 +15282,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$240 = name; + propKey$256 = name; break; case "defaultValue": propKey = name; @@ -15270,17 +15296,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$240, propKey); + updateTextarea(domElement, propKey$256, propKey); return; case "option": - for (var propKey$256 in lastProps) + for (var propKey$272 in lastProps) if ( - ((propKey$240 = lastProps[propKey$256]), - lastProps.hasOwnProperty(propKey$256) && - null != propKey$240 && - !nextProps.hasOwnProperty(propKey$256)) + ((propKey$256 = lastProps[propKey$272]), + lastProps.hasOwnProperty(propKey$272) && + null != propKey$256 && + !nextProps.hasOwnProperty(propKey$272)) ) - switch (propKey$256) { + switch (propKey$272) { case "selected": domElement.selected = !1; break; @@ -15288,33 +15314,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$256, + propKey$272, null, nextProps, - propKey$240 + propKey$256 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$240 = nextProps[lastDefaultValue]), + ((propKey$256 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$240 !== propKey && - (null != propKey$240 || null != propKey)) + propKey$256 !== propKey && + (null != propKey$256 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$240 && - "function" !== typeof propKey$240 && - "symbol" !== typeof propKey$240; + propKey$256 && + "function" !== typeof propKey$256 && + "symbol" !== typeof propKey$256; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$240, + propKey$256, nextProps, propKey ); @@ -15335,24 +15361,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$261 in lastProps) - (propKey$240 = lastProps[propKey$261]), - lastProps.hasOwnProperty(propKey$261) && - null != propKey$240 && - !nextProps.hasOwnProperty(propKey$261) && - setProp(domElement, tag, propKey$261, null, nextProps, propKey$240); + for (var propKey$277 in lastProps) + (propKey$256 = lastProps[propKey$277]), + lastProps.hasOwnProperty(propKey$277) && + null != propKey$256 && + !nextProps.hasOwnProperty(propKey$277) && + setProp(domElement, tag, propKey$277, null, nextProps, propKey$256); for (checked in nextProps) if ( - ((propKey$240 = nextProps[checked]), + ((propKey$256 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$240 !== propKey && - (null != propKey$240 || null != propKey)) + propKey$256 !== propKey && + (null != propKey$256 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$240) + if (null != propKey$256) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -15360,7 +15386,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$240, + propKey$256, nextProps, propKey ); @@ -15368,49 +15394,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$266 in lastProps) - (propKey$240 = lastProps[propKey$266]), - lastProps.hasOwnProperty(propKey$266) && - void 0 !== propKey$240 && - !nextProps.hasOwnProperty(propKey$266) && + for (var propKey$282 in lastProps) + (propKey$256 = lastProps[propKey$282]), + lastProps.hasOwnProperty(propKey$282) && + void 0 !== propKey$256 && + !nextProps.hasOwnProperty(propKey$282) && setPropOnCustomElement( domElement, tag, - propKey$266, + propKey$282, void 0, nextProps, - propKey$240 + propKey$256 ); for (defaultChecked in nextProps) - (propKey$240 = nextProps[defaultChecked]), + (propKey$256 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$240 === propKey || - (void 0 === propKey$240 && void 0 === propKey) || + propKey$256 === propKey || + (void 0 === propKey$256 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$240, + propKey$256, nextProps, propKey ); return; } } - for (var propKey$271 in lastProps) - (propKey$240 = lastProps[propKey$271]), - lastProps.hasOwnProperty(propKey$271) && - null != propKey$240 && - !nextProps.hasOwnProperty(propKey$271) && - setProp(domElement, tag, propKey$271, null, nextProps, propKey$240); + for (var propKey$287 in lastProps) + (propKey$256 = lastProps[propKey$287]), + lastProps.hasOwnProperty(propKey$287) && + null != propKey$256 && + !nextProps.hasOwnProperty(propKey$287) && + setProp(domElement, tag, propKey$287, null, nextProps, propKey$256); for (lastProp in nextProps) - (propKey$240 = nextProps[lastProp]), + (propKey$256 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$240 === propKey || - (null == propKey$240 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$240, nextProps, propKey); + propKey$256 === propKey || + (null == propKey$256 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$256, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -15980,17 +16006,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$279 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$280 = styles$279.get(type); - resource$280 || + var styles$295 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$296 = styles$295.get(type); + resource$296 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$280 = { + (resource$296 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$279.set(type, resource$280), + styles$295.set(type, resource$296), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -16005,9 +16031,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$280.state + resource$296.state )); - return resource$280; + return resource$296; } return null; case "script": @@ -16103,37 +16129,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$284 = hoistableRoot.querySelector( + var instance$300 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$284) + if (instance$300) return ( (resource.state.loading |= 4), - (resource.instance = instance$284), - markNodeAsHoistable(instance$284), - instance$284 + (resource.instance = instance$300), + markNodeAsHoistable(instance$300), + instance$300 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$284 = ( + instance$300 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$284); - var linkInstance = instance$284; + markNodeAsHoistable(instance$300); + var linkInstance = instance$300; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$284, "link", instance); + setInitialProperties(instance$300, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$284, props.precedence, hoistableRoot); - return (resource.instance = instance$284); + insertStylesheet(instance$300, props.precedence, hoistableRoot); + return (resource.instance = instance$300); case "script": - instance$284 = getScriptKey(props.src); + instance$300 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$284) + getScriptSelectorFromKey(instance$300) )) ) return ( @@ -16142,7 +16168,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$284))) + if ((styleProps = preloadPropsMap.get(instance$300))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -17150,10 +17176,10 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1788 = { +var devToolsConfig$jscomp$inline_1799 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-cbbce0de", + version: "19.0.0-www-modern-7cb427ce", rendererPackageName: "react-dom" }; (function (internals) { @@ -17171,10 +17197,10 @@ var devToolsConfig$jscomp$inline_1788 = { } catch (err) {} return hook.checkDCE ? !0 : !1; })({ - bundleType: devToolsConfig$jscomp$inline_1788.bundleType, - version: devToolsConfig$jscomp$inline_1788.version, - rendererPackageName: devToolsConfig$jscomp$inline_1788.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1788.rendererConfig, + bundleType: devToolsConfig$jscomp$inline_1799.bundleType, + version: devToolsConfig$jscomp$inline_1799.version, + rendererPackageName: devToolsConfig$jscomp$inline_1799.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1799.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17190,14 +17216,14 @@ var devToolsConfig$jscomp$inline_1788 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1788.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1799.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-cbbce0de" + reconcilerVersion: "19.0.0-www-modern-7cb427ce" }); function ReactDOMRoot(internalRoot) { this._internalRoot = internalRoot; @@ -17558,7 +17584,7 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-cbbce0de"; +exports.version = "19.0.0-www-modern-7cb427ce"; "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && diff --git a/compiled/facebook-www/ReactDOMTesting-dev.classic.js b/compiled/facebook-www/ReactDOMTesting-dev.classic.js index 751304641009d..e6dc32ca16e7b 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.classic.js @@ -586,9 +586,511 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); +} +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ + + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher = null; + + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ + + + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow + + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too + + + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } + + return [null, null]; + } + }; // $FlowFixMe[prop-missing] + + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } + + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } + + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... + + + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} + +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); + + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); + + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } } function getNearestMountedFiber(fiber) { @@ -656,9 +1158,9 @@ function isFiberMounted(fiber) { } function isMounted(component) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.tag === ClassComponent) { + if (owner !== null && isRendering && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; @@ -945,8 +1447,6 @@ function isReplayingEvent(event) { return event === currentReplayingEvent; } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This module only exists as an ESM wrapper around the external CommonJS var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; var cancelCallback$1 = Scheduler.unstable_cancelCallback; @@ -964,100 +1464,6 @@ var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exi var log$2 = Scheduler.log; var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -3339,405 +3745,6 @@ function setValueForPropertyOnCustomComponent(node, name, value) { setValueForAttribute(node, name, value); } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$2(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); - } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too - - - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? - - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } - - return [null, null]; - } - }; // $FlowFixMe[prop-missing] - - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); - } - - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. @@ -9660,11 +9667,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -17247,7 +17254,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -17806,7 +17812,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -17968,7 +17973,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -19539,7 +19544,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -22818,7 +22822,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -22826,7 +22830,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -22856,7 +22860,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -22948,7 +22952,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -24601,9 +24605,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -24631,13 +24635,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -25179,8 +25183,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -25192,14 +25198,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -25414,7 +25420,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -25573,9 +25579,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -25585,13 +25591,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25787,7 +25793,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -25920,13 +25926,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25972,9 +25978,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -26133,13 +26139,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -26210,12 +26216,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -26257,9 +26263,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -26525,7 +26531,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -28168,10 +28174,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -28826,7 +28831,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -28837,7 +28842,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28846,10 +28854,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -28857,9 +28861,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -28937,7 +28940,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28946,10 +28952,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -29036,7 +29038,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -29048,7 +29050,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -29286,18 +29288,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -30007,13 +30004,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -30026,7 +30023,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -30038,7 +30035,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -30062,7 +30059,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -30075,7 +30072,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -30138,14 +30135,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -30259,14 +30256,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -31421,7 +31418,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-5c88d62e'; +var ReactVersion = '19.0.0-www-classic-1d6fd8ed'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { @@ -31518,7 +31515,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -31529,9 +31526,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -42534,9 +42531,9 @@ function legacyRenderSubtreeIntoContainer(parentComponent, children, container, function findDOMNode(componentOrElement) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; if (!warnedAboutRefsInRender) { diff --git a/compiled/facebook-www/ReactDOMTesting-dev.modern.js b/compiled/facebook-www/ReactDOMTesting-dev.modern.js index da5c32b2426c6..7396dd464454a 100644 --- a/compiled/facebook-www/ReactDOMTesting-dev.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-dev.modern.js @@ -585,9 +585,511 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; + +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ + } + + disabledDepth++; + } +} +function reenableLogs() { + { + disabledDepth--; + + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } + + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } + } +} + +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. + + + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +} +var reentry = false; +var componentFrameCache; + +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); +} +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ + + +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } + + { + var frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; + } + } + + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + + Error.prepareStackTrace = undefined; + var previousDispatcher = null; + + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. + + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ + + + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow + + + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too + + + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } + + return [null, null]; + } + }; // $FlowFixMe[prop-missing] + + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } + + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; + + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } + + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... + + + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; + + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. + + + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. + + + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } + } + } finally { + reentry = false; + + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} + +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } +} +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } +} + +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); + + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); + + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } } function getNearestMountedFiber(fiber) { @@ -652,9 +1154,9 @@ function getContainerFromFiber(fiber) { } function isMounted(component) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.tag === ClassComponent) { + if (owner !== null && isRendering && owner.tag === ClassComponent) { var ownerFiber = owner; var instance = ownerFiber.stateNode; @@ -911,8 +1413,6 @@ function isReplayingEvent(event) { return event === currentReplayingEvent; } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This module only exists as an ESM wrapper around the external CommonJS var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; var cancelCallback$1 = Scheduler.unstable_cancelCallback; @@ -930,100 +1430,6 @@ var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exi var log$2 = Scheduler.log; var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } - - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} - var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -3305,405 +3711,6 @@ function setValueForPropertyOnCustomComponent(node, name, value) { setValueForAttribute(node, name, value); } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; - } -} -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); -} -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$2(); -} -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ - - -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; - } - } - - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); - } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too - - - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? - - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } - - return [null, null]; - } - }; // $FlowFixMe[prop-missing] - - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); - } - - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } - - break; - } - } - } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); - } - - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } - } - - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); - } -} - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; - } -} - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; - } -} - -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - // around this limitation, we use an opaque type that can only be obtained by // passing the value through getToStringValue first. @@ -9401,11 +9408,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -16876,7 +16883,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -17409,7 +17415,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -17565,7 +17570,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -19044,7 +19049,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -22275,7 +22279,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -22283,7 +22287,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -22313,7 +22317,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -22405,7 +22409,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -24056,9 +24060,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -24086,13 +24090,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -24632,8 +24636,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -24645,14 +24651,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -24867,7 +24873,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -25026,9 +25032,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -25038,13 +25044,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25236,7 +25242,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -25365,13 +25371,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -25417,9 +25423,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -25578,13 +25584,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -25655,12 +25661,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -25702,9 +25708,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -25862,7 +25868,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -27424,10 +27430,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -28082,7 +28087,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -28093,7 +28098,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28102,10 +28110,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -28113,9 +28117,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -28188,7 +28191,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -28197,10 +28203,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -28287,7 +28289,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -28299,7 +28301,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -28537,18 +28539,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -29258,13 +29255,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -29277,7 +29274,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -29289,7 +29286,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -29340,14 +29337,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -29443,14 +29440,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -30596,7 +30593,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-8a4086e1'; +var ReactVersion = '19.0.0-www-modern-1e692f4e'; function createPortal$1(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. implementation) { @@ -30693,7 +30690,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -30704,9 +30701,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -41581,9 +41578,9 @@ function hydrateRoot(container, initialChildren, options) { function findDOMNode(componentOrElement) { { - var owner = currentOwner; + var owner = current; - if (owner !== null && owner.stateNode !== null) { + if (owner !== null && isRendering && owner.stateNode !== null) { var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; if (!warnedAboutRefsInRender) { diff --git a/compiled/facebook-www/ReactDOMTesting-prod.classic.js b/compiled/facebook-www/ReactDOMTesting-prod.classic.js index 617b531a8ce18..4f0804309237c 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.classic.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.classic.js @@ -214,7 +214,189 @@ function getComponentNameFromFiber(fiber) { } return null; } -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -272,36 +454,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -346,8 +528,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -558,18 +738,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + expirationTimes[index$8] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$8]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$8] = null, index$8 = 0; + index$8 < hiddenUpdatesForLane.length; + index$8++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$8]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -589,21 +769,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + index$12 = root.transitionLanes[index$12]; + null !== index$12 && + index$12.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -613,10 +793,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$13 = 31 - clz32(lanes), + lane = 1 << index$13; + null !== root.transitionLanes[index$13] && + (root.transitionLanes[index$13] = null); lanes &= ~lane; } } @@ -884,8 +1064,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$14 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$14 && "aria-" !== prefix$14) { node.removeAttribute(name); return; } @@ -928,186 +1108,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$12) { - control = x$12; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$13) { - control = x$13; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1404,15 +1404,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$19 in styles) - (styleName = styles[styleName$19]), - styles.hasOwnProperty(styleName$19) && - prevStyles[styleName$19] !== styleName && - setValueForStyle(node, styleName$19, styleName); - } else for (var styleName$20 in styles) - styles.hasOwnProperty(styleName$20) && - setValueForStyle(node, styleName$20, styles[styleName$20]); + (styleName = styles[styleName$20]), + styles.hasOwnProperty(styleName$20) && + prevStyles[styleName$20] !== styleName && + setValueForStyle(node, styleName$20, styleName); + } else + for (var styleName$21 in styles) + styles.hasOwnProperty(styleName$21) && + setValueForStyle(node, styleName$21, styles[styleName$21]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -2018,20 +2018,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$25 = firstScheduledRoot; null !== root$25; ) { - if (!onlyLegacy || 0 === root$25.tag) { - var workInProgressRootRenderLanes$27 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$27 = getNextLanes( - root$25, - root$25 === workInProgressRoot - ? workInProgressRootRenderLanes$27 + for (var root$26 = firstScheduledRoot; null !== root$26; ) { + if (!onlyLegacy || 0 === root$26.tag) { + var workInProgressRootRenderLanes$28 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$28 = getNextLanes( + root$26, + root$26 === workInProgressRoot + ? workInProgressRootRenderLanes$28 : 0 ); - 0 !== (workInProgressRootRenderLanes$27 & 3) && + 0 !== (workInProgressRootRenderLanes$28 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$25, workInProgressRootRenderLanes$27)); + performSyncWorkOnRoot(root$26, workInProgressRootRenderLanes$28)); } - root$25 = root$25.next; + root$26 = root$26.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -2076,12 +2076,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$6 = 31 - clz32(pendingLanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2333,20 +2333,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$30 = workInProgress$jscomp$0.alternate; + null !== current$30 && + ((current$30 = current$30.updateQueue), + (pendingQueue = current$30.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$30.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$30.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$30 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2359,8 +2359,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$30 && + (current$30 = current$30.next = { lane: 0, tag: pendingQueue.tag, @@ -2413,10 +2413,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$30 + ? ((firstPendingUpdate = current$30 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$30 = current$30.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2429,10 +2429,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$30 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$30; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -3293,9 +3293,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$53 = fiber.alternate; + null !== current$53 && + null !== current$53.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3536,16 +3536,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$55 = currentlyRenderingFiber$1.alternate; + null !== current$55 && + ((current$55 = current$55.updateQueue), + null !== current$55 && + ((current$55 = current$55.memoCache), + null != current$55 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$55.data + : current$55.data.map(function (array) { return array.slice(); }), index: 0 @@ -3559,11 +3559,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$55 = 0; + current$55 < size; + current$55++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$55] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3596,7 +3597,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$51 = !1; + didReadFromEntangledAsyncAction$56 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3617,11 +3618,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); continue; } else (updateLane = { @@ -3667,7 +3668,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$51 && + didReadFromEntangledAsyncAction$56 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4287,14 +4288,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(provider); fiber = createUpdate(lane); - var root$59 = enqueueUpdate(provider, fiber, lane); - null !== root$59 && - (scheduleUpdateOnFiber(root$59, provider, lane), - entangleTransitions(root$59, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$59 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4530,15 +4531,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$54 = workInProgressRoot; - if (null === root$54) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$54, workInProgressRootRenderLanes) || + var root$59 = workInProgressRoot; + if (null === root$59) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$59, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$54 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$54; - mountEffect(subscribeToStore.bind(null, fiber, root$54, subscribe), [ + root$59 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$59; + mountEffect(subscribeToStore.bind(null, fiber, root$59, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4547,7 +4548,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$54, + root$59, getServerSnapshot, getSnapshot ), @@ -4888,9 +4889,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$63 in Component) - void 0 === newProps[propName$63] && - (newProps[propName$63] = Component[propName$63]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -5335,10 +5336,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$75 = workInProgress.stateNode; + root$81 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$75.incompleteTransitions.has(transition)) { + if (!root$81.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -5346,11 +5347,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$75.incompleteTransitions.set(transition, markerInstance); + root$81.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$75.incompleteTransitions.forEach(function (markerInstance) { + root$81.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -5897,31 +5898,35 @@ function updateClassComponent( ); } function finishClassComponent( - current, + current$jscomp$0, workInProgress, Component, shouldUpdate, hasContext, renderLanes ) { - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); var didCaptureError = 0 !== (workInProgress.flags & 128); if (!shouldUpdate && !didCaptureError) return ( hasContext && invalidateContextProvider(workInProgress, Component, !1), - bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) + bailoutOnAlreadyFinishedWork( + current$jscomp$0, + workInProgress, + renderLanes + ) ); shouldUpdate = workInProgress.stateNode; - currentOwner = workInProgress; + current = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null : shouldUpdate.render(); workInProgress.flags |= 1; - null !== current && didCaptureError + null !== current$jscomp$0 && didCaptureError ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -5931,7 +5936,12 @@ function finishClassComponent( nextChildren, renderLanes ))) - : reconcileChildren(current, workInProgress, nextChildren, renderLanes); + : reconcileChildren( + current$jscomp$0, + workInProgress, + nextChildren, + renderLanes + ); workInProgress.memoizedState = shouldUpdate.state; hasContext && invalidateContextProvider(workInProgress, Component, !0); return workInProgress.child; @@ -7799,14 +7809,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$118 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$118 = lastTailNode), + for (var lastTailNode$124 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$124 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$118 + null === lastTailNode$124 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$118.sibling = null); + : (lastTailNode$124.sibling = null); } } function bubbleProperties(completedWork) { @@ -7816,19 +7826,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$119 = completedWork.child; null !== child$119; ) - (newChildLanes |= child$119.lanes | child$119.childLanes), - (subtreeFlags |= child$119.subtreeFlags & 31457280), - (subtreeFlags |= child$119.flags & 31457280), - (child$119.return = completedWork), - (child$119 = child$119.sibling); + for (var child$125 = completedWork.child; null !== child$125; ) + (newChildLanes |= child$125.lanes | child$125.childLanes), + (subtreeFlags |= child$125.subtreeFlags & 31457280), + (subtreeFlags |= child$125.flags & 31457280), + (child$125.return = completedWork), + (child$125 = child$125.sibling); else - for (child$119 = completedWork.child; null !== child$119; ) - (newChildLanes |= child$119.lanes | child$119.childLanes), - (subtreeFlags |= child$119.subtreeFlags), - (subtreeFlags |= child$119.flags), - (child$119.return = completedWork), - (child$119 = child$119.sibling); + for (child$125 = completedWork.child; null !== child$125; ) + (newChildLanes |= child$125.lanes | child$125.childLanes), + (subtreeFlags |= child$125.subtreeFlags), + (subtreeFlags |= child$125.flags), + (child$125.return = completedWork), + (child$125 = child$125.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -8144,11 +8154,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$131 = null; + var cache$137 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$131 = newProps.memoizedState.cachePool.pool); - cache$131 !== currentResource && (newProps.flags |= 2048); + (cache$137 = newProps.memoizedState.cachePool.pool); + cache$137 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -8189,8 +8199,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$131 = currentResource.rendering; - if (null === cache$131) + cache$137 = currentResource.rendering; + if (null === cache$137) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -8198,11 +8208,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$131 = findFirstSuspended(current); - if (null !== cache$131) { + cache$137 = findFirstSuspended(current); + if (null !== cache$137) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$131.updateQueue; + current = cache$137.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -8227,7 +8237,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$131)), null !== current)) { + if (((current = findFirstSuspended(cache$137)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -8237,7 +8247,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$131.alternate && + !cache$137.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -8250,13 +8260,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$131.sibling = workInProgress.child), - (workInProgress.child = cache$131)) + ? ((cache$137.sibling = workInProgress.child), + (workInProgress.child = cache$137)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$131) - : (workInProgress.child = cache$131), - (currentResource.last = cache$131)); + ? (current.sibling = cache$137) + : (workInProgress.child = cache$137), + (currentResource.last = cache$137)); } if (null !== currentResource.tail) return ( @@ -8531,8 +8541,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$149) { - captureCommitPhaseError(current, nearestMountedAncestor, error$149); + } catch (error$155) { + captureCommitPhaseError(current, nearestMountedAncestor, error$155); } else ref.current = null; } @@ -8569,7 +8579,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$200) { + } catch (e$216) { JSCompiler_temp = null; break a; } @@ -8837,11 +8847,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$151) { + } catch (error$157) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$151 + error$157 ); } } @@ -9390,18 +9400,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$169 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$169 && + ((current$169 = current$169.memoizedState), + null !== current$169 && + ((current$169 = current$169.dehydrated), null !== current$169)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$169); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$169); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -9519,8 +9530,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$164) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$164); + } catch (error$171) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$171); } } break; @@ -9693,11 +9704,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$165) { + } catch (error$172) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$165 + error$172 ); } break; @@ -9734,8 +9745,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$166) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$166); + } catch (error$173) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$173); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -9745,8 +9756,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$168) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$168); + } catch (error$175) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$175); } } flags & 1024 && (needsFormReset = !0); @@ -9761,8 +9772,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$169) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$169); + } catch (error$176) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$176); } } break; @@ -9776,8 +9787,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$170) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$170); + } catch (error$177) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$177); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -9809,8 +9820,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$172) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$172); + } catch (error$179) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$179); } flags = finishedWork.updateQueue; null !== flags && @@ -9888,11 +9899,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$154) { + } catch (error$160) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$154 + error$160 ); } } else if ( @@ -9967,21 +9978,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$155 = JSCompiler_inline_result.stateNode; + var parent$161 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$155, ""), + (setTextContent(parent$161, ""), (JSCompiler_inline_result.flags &= -33)); - var before$156 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$156, parent$155); + var before$162 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$162, parent$161); break; case 3: case 4: - var parent$157 = JSCompiler_inline_result.stateNode.containerInfo, - before$158 = getHostSibling(finishedWork); + var parent$163 = JSCompiler_inline_result.stateNode.containerInfo, + before$164 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$158, - parent$157 + before$164, + parent$163 ); break; default: @@ -10060,7 +10071,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$183 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -10088,16 +10099,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$183 = finishedWork.updateQueue; + if (null !== current$183) { + var hiddenCallbacks = current$183.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$183.shared.hiddenCallbacks = null, current$183 = 0; + current$183 < hiddenCallbacks.length; + current$183++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$183], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -10113,7 +10124,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$183 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -10457,9 +10468,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$179 = finishedWork.stateNode; + var instance$190 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$179._visibility & 4 + ? instance$190._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10472,7 +10483,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$179._visibility |= 4), + : ((instance$190._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10480,7 +10491,7 @@ function recursivelyTraverseReconnectPassiveEffects( committedTransitions, includeWorkInProgressEffects )) - : ((instance$179._visibility |= 4), + : ((instance$190._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10493,7 +10504,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$179 + instance$190 ); break; case 24: @@ -10807,7 +10818,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, COMPONENT_TYPE = 0, @@ -10833,12 +10844,12 @@ function findFiberRootForHostRoot(hostRoot) { a: { hostRoot = [hostRoot]; for (maybeFiber = 0; maybeFiber < hostRoot.length; ) { - var current = hostRoot[maybeFiber++]; - if (current[internalContainerInstanceKey]) { - hostRoot = getInstanceFromNode(current); + var current$283 = hostRoot[maybeFiber++]; + if (current$283[internalContainerInstanceKey]) { + hostRoot = getInstanceFromNode(current$283); break a; } - hostRoot.push.apply(hostRoot, current.children); + hostRoot.push.apply(hostRoot, current$283.children); } hostRoot = null; } @@ -11142,11 +11153,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$11 = 31 - clz32(lane), + transitions = transitionLanesMap[index$11]; null === transitions && (transitions = new Set()); transitions.add(transition); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$11] = transitions; } } root === workInProgressRoot && @@ -11416,9 +11427,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7; + expirationTimes[index$7] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11534,9 +11545,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$5 = 31 - clz32(allEntangledLanes), + lane = 1 << index$5; + lanes |= root[index$5]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11546,7 +11557,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -11642,8 +11653,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$188) { - handleThrow(root, thrownValue$188); + } catch (thrownValue$202) { + handleThrow(root, thrownValue$202); } while (1); lanes && root.shellSuspendCounter++; @@ -11752,8 +11763,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$190) { - handleThrow(root, thrownValue$190); + } catch (thrownValue$204) { + handleThrow(root, thrownValue$204); } while (1); resetContextDependencies(); @@ -11772,12 +11783,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -11792,8 +11803,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { ? previousContext : contextStackCursor.current; context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11809,8 +11820,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11821,16 +11832,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11981,13 +11996,12 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$194 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$210 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$194 && + shouldFireAfterActiveInstanceBlur$210 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -12059,7 +12073,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$195 = rootWithPendingPassiveEffects, + var root$211 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -12074,7 +12088,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$195, remainingLanes); + releaseRootPooledCache(root$211, remainingLanes); } } return !1; @@ -13360,19 +13374,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$356; + var JSCompiler_inline_result$jscomp$373; if (canUseDOM) { - var isSupported$jscomp$inline_1545 = "oninput" in document; - if (!isSupported$jscomp$inline_1545) { - var element$jscomp$inline_1546 = document.createElement("div"); - element$jscomp$inline_1546.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1545 = - "function" === typeof element$jscomp$inline_1546.oninput; + var isSupported$jscomp$inline_1557 = "oninput" in document; + if (!isSupported$jscomp$inline_1557) { + var element$jscomp$inline_1558 = document.createElement("div"); + element$jscomp$inline_1558.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1557 = + "function" === typeof element$jscomp$inline_1558.oninput; } - JSCompiler_inline_result$jscomp$356 = isSupported$jscomp$inline_1545; - } else JSCompiler_inline_result$jscomp$356 = !1; + JSCompiler_inline_result$jscomp$373 = isSupported$jscomp$inline_1557; + } else JSCompiler_inline_result$jscomp$373 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$356 && + JSCompiler_inline_result$jscomp$373 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13781,20 +13795,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1586 = 0; - i$jscomp$inline_1586 < simpleEventPluginEvents.length; - i$jscomp$inline_1586++ + var i$jscomp$inline_1598 = 0; + i$jscomp$inline_1598 < simpleEventPluginEvents.length; + i$jscomp$inline_1598++ ) { - var eventName$jscomp$inline_1587 = - simpleEventPluginEvents[i$jscomp$inline_1586], - domEventName$jscomp$inline_1588 = - eventName$jscomp$inline_1587.toLowerCase(), - capitalizedEvent$jscomp$inline_1589 = - eventName$jscomp$inline_1587[0].toUpperCase() + - eventName$jscomp$inline_1587.slice(1); + var eventName$jscomp$inline_1599 = + simpleEventPluginEvents[i$jscomp$inline_1598], + domEventName$jscomp$inline_1600 = + eventName$jscomp$inline_1599.toLowerCase(), + capitalizedEvent$jscomp$inline_1601 = + eventName$jscomp$inline_1599[0].toUpperCase() + + eventName$jscomp$inline_1599.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1588, - "on" + capitalizedEvent$jscomp$inline_1589 + domEventName$jscomp$inline_1600, + "on" + capitalizedEvent$jscomp$inline_1601 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -15272,14 +15286,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$229 in nextProps) { - var propKey = nextProps[propKey$229]; - lastProp = lastProps[propKey$229]; + for (var propKey$245 in nextProps) { + var propKey = nextProps[propKey$245]; + lastProp = lastProps[propKey$245]; if ( - nextProps.hasOwnProperty(propKey$229) && + nextProps.hasOwnProperty(propKey$245) && (null != propKey || null != lastProp) ) - switch (propKey$229) { + switch (propKey$245) { case "type": type = propKey; break; @@ -15308,7 +15322,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$229, + propKey$245, propKey, nextProps, lastProp @@ -15327,7 +15341,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$229 = null; + propKey = value = defaultValue = propKey$245 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -15358,7 +15372,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$229 = type; + propKey$245 = type; break; case "defaultValue": defaultValue = type; @@ -15379,15 +15393,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$229 - ? updateOptions(domElement, !!lastProps, propKey$229, !1) + null != propKey$245 + ? updateOptions(domElement, !!lastProps, propKey$245, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$229 = null; + propKey = propKey$245 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -15411,7 +15425,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$229 = name; + propKey$245 = name; break; case "defaultValue": propKey = name; @@ -15425,17 +15439,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$229, propKey); + updateTextarea(domElement, propKey$245, propKey); return; case "option": - for (var propKey$245 in lastProps) + for (var propKey$261 in lastProps) if ( - ((propKey$229 = lastProps[propKey$245]), - lastProps.hasOwnProperty(propKey$245) && - null != propKey$229 && - !nextProps.hasOwnProperty(propKey$245)) + ((propKey$245 = lastProps[propKey$261]), + lastProps.hasOwnProperty(propKey$261) && + null != propKey$245 && + !nextProps.hasOwnProperty(propKey$261)) ) - switch (propKey$245) { + switch (propKey$261) { case "selected": domElement.selected = !1; break; @@ -15443,33 +15457,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$245, + propKey$261, null, nextProps, - propKey$229 + propKey$245 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$229 = nextProps[lastDefaultValue]), + ((propKey$245 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$229 !== propKey && - (null != propKey$229 || null != propKey)) + propKey$245 !== propKey && + (null != propKey$245 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$229 && - "function" !== typeof propKey$229 && - "symbol" !== typeof propKey$229; + propKey$245 && + "function" !== typeof propKey$245 && + "symbol" !== typeof propKey$245; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$229, + propKey$245, nextProps, propKey ); @@ -15490,24 +15504,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$250 in lastProps) - (propKey$229 = lastProps[propKey$250]), - lastProps.hasOwnProperty(propKey$250) && - null != propKey$229 && - !nextProps.hasOwnProperty(propKey$250) && - setProp(domElement, tag, propKey$250, null, nextProps, propKey$229); + for (var propKey$266 in lastProps) + (propKey$245 = lastProps[propKey$266]), + lastProps.hasOwnProperty(propKey$266) && + null != propKey$245 && + !nextProps.hasOwnProperty(propKey$266) && + setProp(domElement, tag, propKey$266, null, nextProps, propKey$245); for (checked in nextProps) if ( - ((propKey$229 = nextProps[checked]), + ((propKey$245 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$229 !== propKey && - (null != propKey$229 || null != propKey)) + propKey$245 !== propKey && + (null != propKey$245 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$229) + if (null != propKey$245) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -15515,7 +15529,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$229, + propKey$245, nextProps, propKey ); @@ -15523,49 +15537,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$255 in lastProps) - (propKey$229 = lastProps[propKey$255]), - lastProps.hasOwnProperty(propKey$255) && - void 0 !== propKey$229 && - !nextProps.hasOwnProperty(propKey$255) && + for (var propKey$271 in lastProps) + (propKey$245 = lastProps[propKey$271]), + lastProps.hasOwnProperty(propKey$271) && + void 0 !== propKey$245 && + !nextProps.hasOwnProperty(propKey$271) && setPropOnCustomElement( domElement, tag, - propKey$255, + propKey$271, void 0, nextProps, - propKey$229 + propKey$245 ); for (defaultChecked in nextProps) - (propKey$229 = nextProps[defaultChecked]), + (propKey$245 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$229 === propKey || - (void 0 === propKey$229 && void 0 === propKey) || + propKey$245 === propKey || + (void 0 === propKey$245 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$229, + propKey$245, nextProps, propKey ); return; } } - for (var propKey$260 in lastProps) - (propKey$229 = lastProps[propKey$260]), - lastProps.hasOwnProperty(propKey$260) && - null != propKey$229 && - !nextProps.hasOwnProperty(propKey$260) && - setProp(domElement, tag, propKey$260, null, nextProps, propKey$229); + for (var propKey$276 in lastProps) + (propKey$245 = lastProps[propKey$276]), + lastProps.hasOwnProperty(propKey$276) && + null != propKey$245 && + !nextProps.hasOwnProperty(propKey$276) && + setProp(domElement, tag, propKey$276, null, nextProps, propKey$245); for (lastProp in nextProps) - (propKey$229 = nextProps[lastProp]), + (propKey$245 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$229 === propKey || - (null == propKey$229 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$229, nextProps, propKey); + propKey$245 === propKey || + (null == propKey$245 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$245, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -16201,17 +16215,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$268 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$269 = styles$268.get(type); - resource$269 || + var styles$285 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$286 = styles$285.get(type); + resource$286 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$269 = { + (resource$286 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$268.set(type, resource$269), + styles$285.set(type, resource$286), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -16226,9 +16240,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$269.state + resource$286.state )); - return resource$269; + return resource$286; } return null; case "script": @@ -16324,37 +16338,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$273 = hoistableRoot.querySelector( + var instance$290 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$273) + if (instance$290) return ( (resource.state.loading |= 4), - (resource.instance = instance$273), - markNodeAsHoistable(instance$273), - instance$273 + (resource.instance = instance$290), + markNodeAsHoistable(instance$290), + instance$290 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$273 = ( + instance$290 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$273); - var linkInstance = instance$273; + markNodeAsHoistable(instance$290); + var linkInstance = instance$290; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$273, "link", instance); + setInitialProperties(instance$290, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$273, props.precedence, hoistableRoot); - return (resource.instance = instance$273); + insertStylesheet(instance$290, props.precedence, hoistableRoot); + return (resource.instance = instance$290); case "script": - instance$273 = getScriptKey(props.src); + instance$290 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$273) + getScriptSelectorFromKey(instance$290) )) ) return ( @@ -16363,7 +16377,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$273))) + if ((styleProps = preloadPropsMap.get(instance$290))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -17381,17 +17395,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1764 = { +var devToolsConfig$jscomp$inline_1776 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-classic-53e83227", + version: "19.0.0-www-classic-7ee5c2f5", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2213 = { - bundleType: devToolsConfig$jscomp$inline_1764.bundleType, - version: devToolsConfig$jscomp$inline_1764.version, - rendererPackageName: devToolsConfig$jscomp$inline_1764.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1764.rendererConfig, +var internals$jscomp$inline_2225 = { + bundleType: devToolsConfig$jscomp$inline_1776.bundleType, + version: devToolsConfig$jscomp$inline_1776.version, + rendererPackageName: devToolsConfig$jscomp$inline_1776.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1776.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -17407,26 +17421,26 @@ var internals$jscomp$inline_2213 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1764.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1776.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-53e83227" + reconcilerVersion: "19.0.0-www-classic-7ee5c2f5" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2214 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2226 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2214.isDisabled && - hook$jscomp$inline_2214.supportsFiber + !hook$jscomp$inline_2226.isDisabled && + hook$jscomp$inline_2226.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2214.inject( - internals$jscomp$inline_2213 + (rendererID = hook$jscomp$inline_2226.inject( + internals$jscomp$inline_2225 )), - (injectedHook = hook$jscomp$inline_2214); + (injectedHook = hook$jscomp$inline_2226); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17500,11 +17514,11 @@ function legacyCreateRootFromDOMContainer( if ("function" === typeof callback) { var originalCallback = callback; callback = function () { - var instance = getPublicRootInstance(root$294); + var instance = getPublicRootInstance(root$311); originalCallback.call(instance); }; } - var root$294 = createHydrationContainer( + var root$311 = createHydrationContainer( initialChildren, callback, container, @@ -17519,23 +17533,23 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$294; - container[internalContainerInstanceKey] = root$294.current; + container._reactRootContainer = root$311; + container[internalContainerInstanceKey] = root$311.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); flushSyncWork(); - return root$294; + return root$311; } clearContainer(container); if ("function" === typeof callback) { - var originalCallback$295 = callback; + var originalCallback$312 = callback; callback = function () { - var instance = getPublicRootInstance(root$296); - originalCallback$295.call(instance); + var instance = getPublicRootInstance(root$313); + originalCallback$312.call(instance); }; } - var root$296 = createFiberRoot( + var root$313 = createFiberRoot( container, 0, !1, @@ -17550,14 +17564,14 @@ function legacyCreateRootFromDOMContainer( null, null ); - container._reactRootContainer = root$296; - container[internalContainerInstanceKey] = root$296.current; + container._reactRootContainer = root$313; + container[internalContainerInstanceKey] = root$313.current; listenToAllSupportedEvents( 8 === container.nodeType ? container.parentNode : container ); - updateContainerSync(initialChildren, root$296, parentComponent, callback); + updateContainerSync(initialChildren, root$313, parentComponent, callback); flushSyncWork(); - return root$296; + return root$313; } function legacyRenderSubtreeIntoContainer( parentComponent, @@ -18069,4 +18083,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-classic-53e83227"; +exports.version = "19.0.0-www-classic-7ee5c2f5"; diff --git a/compiled/facebook-www/ReactDOMTesting-prod.modern.js b/compiled/facebook-www/ReactDOMTesting-prod.modern.js index f186d0fe68156..a32bd78d3614b 100644 --- a/compiled/facebook-www/ReactDOMTesting-prod.modern.js +++ b/compiled/facebook-www/ReactDOMTesting-prod.modern.js @@ -149,7 +149,189 @@ function getComponentNameFromType(type) { } return null; } -var currentOwner = null; +var ReactSharedInternals = + React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix; +function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; +} +var reentry = !1; +function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" + }); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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 current = null; function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -207,36 +389,36 @@ function findCurrentFiberUsingSlowPath(fiber) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$4 = parentA.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$4 = parentB.child; child$4; ) { + if (child$4 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$4 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$4 = child$4.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -281,8 +463,6 @@ function doesFiberContain(parentFiber, childFiber) { return !1; } var currentReplayingEvent = null, - ReactSharedInternals = - React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, @@ -493,18 +673,18 @@ function markRootFinished(root, remainingLanes, spawnedLane) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + expirationTimes[index$8] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$8]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$8] = null, index$8 = 0; + index$8 < hiddenUpdatesForLane.length; + index$8++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$8]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -524,21 +704,21 @@ function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { 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); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + index$12 = root.transitionLanes[index$12]; + null !== index$12 && + index$12.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -548,10 +728,10 @@ function getTransitionsForLanes(root, lanes) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$13 = 31 - clz32(lanes), + lane = 1 << index$13; + null !== root.transitionLanes[index$13] && + (root.transitionLanes[index$13] = null); lanes &= ~lane; } } @@ -819,8 +999,8 @@ function setValueForAttribute(node, name, value) { node.removeAttribute(name); return; case "boolean": - var prefix$11 = name.toLowerCase().slice(0, 5); - if ("data-" !== prefix$11 && "aria-" !== prefix$11) { + var prefix$14 = name.toLowerCase().slice(0, 5); + if ("data-" !== prefix$14 && "aria-" !== prefix$14) { node.removeAttribute(name); return; } @@ -863,186 +1043,6 @@ function setValueForNamespacedAttribute(node, namespace, name, value) { ); } } -var prefix; -function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; -} -var reentry = !1; -function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$12) { - control = x$12; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$13) { - control = x$13; - } - (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" - }); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } -} function getToStringValue(value) { switch (typeof value) { case "bigint": @@ -1329,15 +1329,15 @@ function setValueForStyles(node, styles, prevStyles) { : "float" === styleName ? (node.cssFloat = "") : (node[styleName] = "")); - for (var styleName$19 in styles) - (styleName = styles[styleName$19]), - styles.hasOwnProperty(styleName$19) && - prevStyles[styleName$19] !== styleName && - setValueForStyle(node, styleName$19, styleName); - } else for (var styleName$20 in styles) - styles.hasOwnProperty(styleName$20) && - setValueForStyle(node, styleName$20, styles[styleName$20]); + (styleName = styles[styleName$20]), + styles.hasOwnProperty(styleName$20) && + prevStyles[styleName$20] !== styleName && + setValueForStyle(node, styleName$20, styleName); + } else + for (var styleName$21 in styles) + styles.hasOwnProperty(styleName$21) && + setValueForStyle(node, styleName$21, styles[styleName$21]); } function isCustomElement(tagName) { if (-1 === tagName.indexOf("-")) return !1; @@ -1865,20 +1865,20 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) { isFlushingWork = !0; do { var didPerformSomeWork = !1; - for (var root$25 = firstScheduledRoot; null !== root$25; ) { + for (var root$26 = firstScheduledRoot; null !== root$26; ) { if (!onlyLegacy) { - var workInProgressRootRenderLanes$27 = workInProgressRootRenderLanes; - workInProgressRootRenderLanes$27 = getNextLanes( - root$25, - root$25 === workInProgressRoot - ? workInProgressRootRenderLanes$27 + var workInProgressRootRenderLanes$28 = workInProgressRootRenderLanes; + workInProgressRootRenderLanes$28 = getNextLanes( + root$26, + root$26 === workInProgressRoot + ? workInProgressRootRenderLanes$28 : 0 ); - 0 !== (workInProgressRootRenderLanes$27 & 3) && + 0 !== (workInProgressRootRenderLanes$28 & 3) && ((didPerformSomeWork = !0), - performSyncWorkOnRoot(root$25, workInProgressRootRenderLanes$27)); + performSyncWorkOnRoot(root$26, workInProgressRootRenderLanes$28)); } - root$25 = root$25.next; + root$26 = root$26.next; } } while (didPerformSomeWork); isFlushingWork = !1; @@ -1923,12 +1923,12 @@ function scheduleTaskForRootDuringMicrotask(root, currentTime) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$6 = 31 - clz32(pendingLanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -2180,20 +2180,20 @@ function processUpdateQueue( ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$30 = workInProgress$jscomp$0.alternate; + null !== current$30 && + ((current$30 = current$30.updateQueue), + (pendingQueue = current$30.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$30.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$30.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$30 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -2206,8 +2206,8 @@ function processUpdateQueue( 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$30 && + (current$30 = current$30.next = { lane: 0, tag: pendingQueue.tag, @@ -2260,10 +2260,10 @@ function processUpdateQueue( callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$30 + ? ((firstPendingUpdate = current$30 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$30 = current$30.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -2276,10 +2276,10 @@ function processUpdateQueue( (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$30 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$30; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -3140,9 +3140,9 @@ function pushOffscreenSuspenseHandler(fiber) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$53 = fiber.alternate; + null !== current$53 && + null !== current$53.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -3383,16 +3383,16 @@ function useMemoCache(size) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$55 = currentlyRenderingFiber$1.alternate; + null !== current$55 && + ((current$55 = current$55.updateQueue), + null !== current$55 && + ((current$55 = current$55.memoCache), + null != current$55 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$55.data + : current$55.data.map(function (array) { return array.slice(); }), index: 0 @@ -3406,11 +3406,12 @@ function useMemoCache(size) { updateQueue = memoCache.data[memoCache.index]; if (void 0 === updateQueue) for ( - updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0; - current < size; - current++ + updateQueue = memoCache.data[memoCache.index] = Array(size), + current$55 = 0; + current$55 < size; + current$55++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$55] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -3443,7 +3444,7 @@ function updateReducerImpl(hook, current, reducer) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$51 = !1; + didReadFromEntangledAsyncAction$56 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -3464,11 +3465,11 @@ function updateReducerImpl(hook, current, reducer) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$51 = !0); + (didReadFromEntangledAsyncAction$56 = !0); continue; } else (updateLane = { @@ -3514,7 +3515,7 @@ function updateReducerImpl(hook, current, reducer) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$51 && + didReadFromEntangledAsyncAction$56 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -4134,14 +4135,14 @@ function refreshCache(fiber, seedKey, seedValue) { case 3: var lane = requestUpdateLane(); fiber = createUpdate(lane); - var root$59 = enqueueUpdate(provider, fiber, lane); - null !== root$59 && - (scheduleUpdateOnFiber(root$59, provider, lane), - entangleTransitions(root$59, provider, lane)); + var root$64 = enqueueUpdate(provider, fiber, lane); + null !== root$64 && + (scheduleUpdateOnFiber(root$64, provider, lane), + entangleTransitions(root$64, provider, lane)); provider = createCache(); null !== seedKey && void 0 !== seedKey && - null !== root$59 && + null !== root$64 && provider.data.set(seedKey, seedValue); fiber.payload = { cache: provider }; return; @@ -4377,15 +4378,15 @@ var HooksDispatcherOnMount = { getServerSnapshot = getServerSnapshot(); } else { getServerSnapshot = getSnapshot(); - var root$54 = workInProgressRoot; - if (null === root$54) throw Error(formatProdErrorMessage(349)); - includesBlockingLane(root$54, workInProgressRootRenderLanes) || + var root$59 = workInProgressRoot; + if (null === root$59) throw Error(formatProdErrorMessage(349)); + includesBlockingLane(root$59, workInProgressRootRenderLanes) || pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot); } hook.memoizedState = getServerSnapshot; - root$54 = { value: getServerSnapshot, getSnapshot: getSnapshot }; - hook.queue = root$54; - mountEffect(subscribeToStore.bind(null, fiber, root$54, subscribe), [ + root$59 = { value: getServerSnapshot, getSnapshot: getSnapshot }; + hook.queue = root$59; + mountEffect(subscribeToStore.bind(null, fiber, root$59, subscribe), [ subscribe ]); fiber.flags |= 2048; @@ -4394,7 +4395,7 @@ var HooksDispatcherOnMount = { updateStoreInstance.bind( null, fiber, - root$54, + root$59, getServerSnapshot, getSnapshot ), @@ -4673,9 +4674,9 @@ function resolveClassComponentProps( (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$63 in Component) - void 0 === newProps[propName$63] && - (newProps[propName$63] = Component[propName$63]); + for (var propName$68 in Component) + void 0 === newProps[propName$68] && + (newProps[propName$68] = Component[propName$68]); } return newProps; } @@ -5052,10 +5053,10 @@ var markerInstanceStack = createCursor(null); function pushRootMarkerInstance(workInProgress) { if (enableTransitionTracing) { var transitions = workInProgressTransitions, - root$74 = workInProgress.stateNode; + root$80 = workInProgress.stateNode; null !== transitions && transitions.forEach(function (transition) { - if (!root$74.incompleteTransitions.has(transition)) { + if (!root$80.incompleteTransitions.has(transition)) { var markerInstance = { tag: 0, transitions: new Set([transition]), @@ -5063,11 +5064,11 @@ function pushRootMarkerInstance(workInProgress) { aborts: null, name: null }; - root$74.incompleteTransitions.set(transition, markerInstance); + root$80.incompleteTransitions.set(transition, markerInstance); } }); var markerInstances = []; - root$74.incompleteTransitions.forEach(function (markerInstance) { + root$80.incompleteTransitions.forEach(function (markerInstance) { markerInstances.push(markerInstance); }); push(markerInstanceStack, markerInstances); @@ -5390,7 +5391,7 @@ function replayFunctionComponent( return workInProgress.child; } function updateClassComponent( - current, + current$jscomp$0, workInProgress, Component, nextProps, @@ -5446,7 +5447,7 @@ function updateClassComponent( "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); nextProps = !0; - } else if (null === current) { + } else if (null === current$jscomp$0) { context = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps( @@ -5524,7 +5525,7 @@ function updateClassComponent( (nextProps = !1)); } else { context = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); + cloneUpdateQueue(current$jscomp$0, workInProgress); contextType = workInProgress.memoizedProps; contextType$jscomp$0 = resolveClassComponentProps( Component, @@ -5562,9 +5563,9 @@ function updateClassComponent( oldState !== newState || hasForceUpdate || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies)) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies)) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps( workInProgress, @@ -5585,9 +5586,9 @@ function updateClassComponent( oldProps ) || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies))) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies))) ? (oldContext || ("function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate) || @@ -5604,12 +5605,12 @@ function updateClassComponent( "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), @@ -5618,30 +5619,30 @@ function updateClassComponent( (context.context = oldProps), (nextProps = contextType$jscomp$0)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (nextProps = !1)); } context = nextProps; - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); nextProps = 0 !== (workInProgress.flags & 128); context || nextProps ? ((context = workInProgress.stateNode), - (currentOwner = workInProgress), + (current = workInProgress), (Component = nextProps && "function" !== typeof Component.getDerivedStateFromError ? null : context.render()), (workInProgress.flags |= 1), - null !== current && nextProps + null !== current$jscomp$0 && nextProps ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -5651,15 +5652,20 @@ function updateClassComponent( Component, renderLanes ))) - : reconcileChildren(current, workInProgress, Component, renderLanes), + : reconcileChildren( + current$jscomp$0, + workInProgress, + Component, + renderLanes + ), (workInProgress.memoizedState = context.state), - (current = workInProgress.child)) - : (current = bailoutOnAlreadyFinishedWork( - current, + (current$jscomp$0 = workInProgress.child)) + : (current$jscomp$0 = bailoutOnAlreadyFinishedWork( + current$jscomp$0, workInProgress, renderLanes )); - return current; + return current$jscomp$0; } function mountHostRootWithoutHydrating( current, @@ -7404,14 +7410,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$110 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$110 = lastTailNode), + for (var lastTailNode$116 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$116 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$110 + null === lastTailNode$116 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$110.sibling = null); + : (lastTailNode$116.sibling = null); } } function bubbleProperties(completedWork) { @@ -7421,19 +7427,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$111 = completedWork.child; null !== child$111; ) - (newChildLanes |= child$111.lanes | child$111.childLanes), - (subtreeFlags |= child$111.subtreeFlags & 31457280), - (subtreeFlags |= child$111.flags & 31457280), - (child$111.return = completedWork), - (child$111 = child$111.sibling); + for (var child$117 = completedWork.child; null !== child$117; ) + (newChildLanes |= child$117.lanes | child$117.childLanes), + (subtreeFlags |= child$117.subtreeFlags & 31457280), + (subtreeFlags |= child$117.flags & 31457280), + (child$117.return = completedWork), + (child$117 = child$117.sibling); else - for (child$111 = completedWork.child; null !== child$111; ) - (newChildLanes |= child$111.lanes | child$111.childLanes), - (subtreeFlags |= child$111.subtreeFlags), - (subtreeFlags |= child$111.flags), - (child$111.return = completedWork), - (child$111 = child$111.sibling); + for (child$117 = completedWork.child; null !== child$117; ) + (newChildLanes |= child$117.lanes | child$117.childLanes), + (subtreeFlags |= child$117.subtreeFlags), + (subtreeFlags |= child$117.flags), + (child$117.return = completedWork), + (child$117 = child$117.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7742,11 +7748,11 @@ function completeWork(current, workInProgress, renderLanes) { null !== newProps.alternate.memoizedState && null !== newProps.alternate.memoizedState.cachePool && (currentResource = newProps.alternate.memoizedState.cachePool.pool); - var cache$123 = null; + var cache$129 = null; null !== newProps.memoizedState && null !== newProps.memoizedState.cachePool && - (cache$123 = newProps.memoizedState.cachePool.pool); - cache$123 !== currentResource && (newProps.flags |= 2048); + (cache$129 = newProps.memoizedState.cachePool.pool); + cache$129 !== currentResource && (newProps.flags |= 2048); } renderLanes !== current && (enableTransitionTracing && (workInProgress.child.flags |= 2048), @@ -7781,8 +7787,8 @@ function completeWork(current, workInProgress, renderLanes) { if (null === currentResource) return bubbleProperties(workInProgress), null; newProps = 0 !== (workInProgress.flags & 128); - cache$123 = currentResource.rendering; - if (null === cache$123) + cache$129 = currentResource.rendering; + if (null === cache$129) if (newProps) cutOffTailIfNeeded(currentResource, !1); else { if ( @@ -7790,11 +7796,11 @@ function completeWork(current, workInProgress, renderLanes) { (null !== current && 0 !== (current.flags & 128)) ) for (current = workInProgress.child; null !== current; ) { - cache$123 = findFirstSuspended(current); - if (null !== cache$123) { + cache$129 = findFirstSuspended(current); + if (null !== cache$129) { workInProgress.flags |= 128; cutOffTailIfNeeded(currentResource, !1); - current = cache$123.updateQueue; + current = cache$129.updateQueue; workInProgress.updateQueue = current; scheduleRetryEffect(workInProgress, current); workInProgress.subtreeFlags = 0; @@ -7819,7 +7825,7 @@ function completeWork(current, workInProgress, renderLanes) { } else { if (!newProps) - if (((current = findFirstSuspended(cache$123)), null !== current)) { + if (((current = findFirstSuspended(cache$129)), null !== current)) { if ( ((workInProgress.flags |= 128), (newProps = !0), @@ -7829,7 +7835,7 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !0), null === currentResource.tail && "hidden" === currentResource.tailMode && - !cache$123.alternate && + !cache$129.alternate && !isHydrating) ) return bubbleProperties(workInProgress), null; @@ -7842,13 +7848,13 @@ function completeWork(current, workInProgress, renderLanes) { cutOffTailIfNeeded(currentResource, !1), (workInProgress.lanes = 4194304)); currentResource.isBackwards - ? ((cache$123.sibling = workInProgress.child), - (workInProgress.child = cache$123)) + ? ((cache$129.sibling = workInProgress.child), + (workInProgress.child = cache$129)) : ((current = currentResource.last), null !== current - ? (current.sibling = cache$123) - : (workInProgress.child = cache$123), - (currentResource.last = cache$123)); + ? (current.sibling = cache$129) + : (workInProgress.child = cache$129), + (currentResource.last = cache$129)); } if (null !== currentResource.tail) return ( @@ -8114,8 +8120,8 @@ function safelyDetachRef(current, nearestMountedAncestor) { else if ("function" === typeof ref) try { ref(null); - } catch (error$140) { - captureCommitPhaseError(current, nearestMountedAncestor, error$140); + } catch (error$146) { + captureCommitPhaseError(current, nearestMountedAncestor, error$146); } else ref.current = null; } @@ -8152,7 +8158,7 @@ function commitBeforeMutationEffects(root, firstChild) { selection = selection.focusOffset; try { JSCompiler_temp.nodeType, focusNode.nodeType; - } catch (e$191) { + } catch (e$207) { JSCompiler_temp = null; break a; } @@ -8433,11 +8439,11 @@ function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$142) { + } catch (error$148) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$142 + error$148 ); } } @@ -8975,18 +8981,19 @@ function commitDeletionEffectsOnFiber( } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$160 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$160 && + ((current$160 = current$160.memoizedState), + null !== current$160 && + ((current$160 = current$160.dehydrated), null !== current$160)) ) try { - retryIfBlockedOn(current); + retryIfBlockedOn(current$160); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$160); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -9104,8 +9111,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$155) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$155); + } catch (error$162) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$162); } } break; @@ -9278,11 +9285,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { newProps ); domElement[internalPropsKey] = newProps; - } catch (error$156) { + } catch (error$163) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$156 + error$163 ); } break; @@ -9319,8 +9326,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { root = finishedWork.stateNode; try { setTextContent(root, ""); - } catch (error$157) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$157); + } catch (error$164) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$164); } } if (flags & 4 && ((root = finishedWork.stateNode), null != root)) { @@ -9330,8 +9337,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { try { updateProperties(root, maybeNodes, current, hoistableRoot), (root[internalPropsKey] = hoistableRoot); - } catch (error$159) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$159); + } catch (error$166) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$166); } } flags & 1024 && (needsFormReset = !0); @@ -9346,8 +9353,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { current = finishedWork.memoizedProps; try { flags.nodeValue = current; - } catch (error$160) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$160); + } catch (error$167) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$167); } } break; @@ -9361,8 +9368,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (flags & 4 && null !== current && current.memoizedState.isDehydrated) try { retryIfBlockedOn(root.containerInfo); - } catch (error$161) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$161); + } catch (error$168) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$168); } needsFormReset && ((needsFormReset = !1), recursivelyResetForms(finishedWork)); @@ -9394,8 +9401,8 @@ function commitMutationEffectsOnFiber(finishedWork, root) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$163) { - captureCommitPhaseError(finishedWork, finishedWork.return, error$163); + } catch (error$170) { + captureCommitPhaseError(finishedWork, finishedWork.return, error$170); } flags = finishedWork.updateQueue; null !== flags && @@ -9470,11 +9477,11 @@ function commitMutationEffectsOnFiber(finishedWork, root) { if (null === current) try { root.stateNode.nodeValue = domElement ? "" : root.memoizedProps; - } catch (error$145) { + } catch (error$151) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$145 + error$151 ); } } else if ( @@ -9549,21 +9556,21 @@ function commitReconciliationEffects(finishedWork) { insertOrAppendPlacementNode(finishedWork, before, parent$jscomp$0); break; case 5: - var parent$146 = JSCompiler_inline_result.stateNode; + var parent$152 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (setTextContent(parent$146, ""), + (setTextContent(parent$152, ""), (JSCompiler_inline_result.flags &= -33)); - var before$147 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$147, parent$146); + var before$153 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$153, parent$152); break; case 3: case 4: - var parent$148 = JSCompiler_inline_result.stateNode.containerInfo, - before$149 = getHostSibling(finishedWork); + var parent$154 = JSCompiler_inline_result.stateNode.containerInfo, + before$155 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$149, - parent$148 + before$155, + parent$154 ); break; default: @@ -9642,7 +9649,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$174 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -9670,16 +9677,16 @@ function recursivelyTraverseReappearLayoutEffects( } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$174 = finishedWork.updateQueue; + if (null !== current$174) { + var hiddenCallbacks = current$174.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$174.shared.hiddenCallbacks = null, current$174 = 0; + current$174 < hiddenCallbacks.length; + current$174++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$174], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -9695,7 +9702,7 @@ function recursivelyTraverseReappearLayoutEffects( includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$174 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -10031,9 +10038,9 @@ function recursivelyTraverseReconnectPassiveEffects( ); break; case 22: - var instance$170 = finishedWork.stateNode; + var instance$181 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$170._visibility & 4 + ? instance$181._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10045,7 +10052,7 @@ function recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork ) - : ((instance$170._visibility |= 4), + : ((instance$181._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -10058,7 +10065,7 @@ function recursivelyTraverseReconnectPassiveEffects( commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$170 + instance$181 ); break; case 24: @@ -10372,7 +10379,7 @@ var DefaultAsyncDispatcher = { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, COMPONENT_TYPE = 0, @@ -10398,12 +10405,12 @@ function findFiberRootForHostRoot(hostRoot) { a: { hostRoot = [hostRoot]; for (maybeFiber = 0; maybeFiber < hostRoot.length; ) { - var current = hostRoot[maybeFiber++]; - if (current[internalContainerInstanceKey]) { - hostRoot = getInstanceFromNode(current); + var current$274 = hostRoot[maybeFiber++]; + if (current$274[internalContainerInstanceKey]) { + hostRoot = getInstanceFromNode(current$274); break a; } - hostRoot.push.apply(hostRoot, current.children); + hostRoot.push.apply(hostRoot, current$274.children); } hostRoot = null; } @@ -10706,11 +10713,11 @@ function scheduleUpdateOnFiber(root, fiber, lane) { enableTransitionTracing)) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$11 = 31 - clz32(lane), + transitions = transitionLanesMap[index$11]; null === transitions && (transitions = new Set()); transitions.add(fiber); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$11] = transitions; } root === workInProgressRoot && (0 === (executionContext & 2) && @@ -10974,9 +10981,9 @@ function markRootSuspended(root, suspendedLanes, spawnedLane) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7; + expirationTimes[index$7] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -11080,9 +11087,9 @@ function prepareFreshStack(root, lanes) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$5 = 31 - clz32(allEntangledLanes), + lane = 1 << index$5; + lanes |= root[index$5]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -11092,7 +11099,7 @@ function prepareFreshStack(root, lanes) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -11188,8 +11195,8 @@ function renderRootSync(root, lanes) { } workLoopSync(); break; - } catch (thrownValue$179) { - handleThrow(root, thrownValue$179); + } catch (thrownValue$193) { + handleThrow(root, thrownValue$193); } while (1); lanes && root.shellSuspendCounter++; @@ -11298,8 +11305,8 @@ function renderRootConcurrent(root, lanes) { } workLoopConcurrent(); break; - } catch (thrownValue$181) { - handleThrow(root, thrownValue$181); + } catch (thrownValue$195) { + handleThrow(root, thrownValue$195); } while (1); resetContextDependencies(); @@ -11318,12 +11325,12 @@ function workLoopConcurrent() { } function performUnitOfWork(unitOfWork) { var next = beginWork(unitOfWork.alternate, unitOfWork, entangledRenderLanes); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -11334,8 +11341,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11351,8 +11358,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { unitOfWork.elementType === Component ? unresolvedProps : resolveDefaultPropsOnNonClassComponent(Component, unresolvedProps); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -11363,16 +11370,20 @@ function replaySuspendedUnitOfWork(unitOfWork) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -11523,13 +11534,12 @@ function commitRootImpl( Internals.p = 2; var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$185 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$201 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$185 && + shouldFireAfterActiveInstanceBlur$201 && ((_enabled = !0), dispatchAfterDetachedBlur(selectionInformation.focusedElem), (_enabled = !1)); @@ -11599,7 +11609,7 @@ function releaseRootPooledCache(root, remainingLanes) { } function flushPassiveEffects() { if (null !== rootWithPendingPassiveEffects) { - var root$186 = rootWithPendingPassiveEffects, + var root$202 = rootWithPendingPassiveEffects, remainingLanes = pendingPassiveEffectsRemainingLanes; pendingPassiveEffectsRemainingLanes = 0; var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes), @@ -11614,7 +11624,7 @@ function flushPassiveEffects() { } finally { (Internals.p = previousPriority), (ReactSharedInternals.T = prevTransition), - releaseRootPooledCache(root$186, remainingLanes); + releaseRootPooledCache(root$202, remainingLanes); } } return !1; @@ -12806,19 +12816,19 @@ function getTargetInstForChangeEvent(domEventName, targetInst) { } var isInputEventSupported = !1; if (canUseDOM) { - var JSCompiler_inline_result$jscomp$343; + var JSCompiler_inline_result$jscomp$360; if (canUseDOM) { - var isSupported$jscomp$inline_1517 = "oninput" in document; - if (!isSupported$jscomp$inline_1517) { - var element$jscomp$inline_1518 = document.createElement("div"); - element$jscomp$inline_1518.setAttribute("oninput", "return;"); - isSupported$jscomp$inline_1517 = - "function" === typeof element$jscomp$inline_1518.oninput; + var isSupported$jscomp$inline_1529 = "oninput" in document; + if (!isSupported$jscomp$inline_1529) { + var element$jscomp$inline_1530 = document.createElement("div"); + element$jscomp$inline_1530.setAttribute("oninput", "return;"); + isSupported$jscomp$inline_1529 = + "function" === typeof element$jscomp$inline_1530.oninput; } - JSCompiler_inline_result$jscomp$343 = isSupported$jscomp$inline_1517; - } else JSCompiler_inline_result$jscomp$343 = !1; + JSCompiler_inline_result$jscomp$360 = isSupported$jscomp$inline_1529; + } else JSCompiler_inline_result$jscomp$360 = !1; isInputEventSupported = - JSCompiler_inline_result$jscomp$343 && + JSCompiler_inline_result$jscomp$360 && (!document.documentMode || 9 < document.documentMode); } function stopWatchingForValueChange() { @@ -13227,20 +13237,20 @@ function extractEvents$1( } } for ( - var i$jscomp$inline_1558 = 0; - i$jscomp$inline_1558 < simpleEventPluginEvents.length; - i$jscomp$inline_1558++ + var i$jscomp$inline_1570 = 0; + i$jscomp$inline_1570 < simpleEventPluginEvents.length; + i$jscomp$inline_1570++ ) { - var eventName$jscomp$inline_1559 = - simpleEventPluginEvents[i$jscomp$inline_1558], - domEventName$jscomp$inline_1560 = - eventName$jscomp$inline_1559.toLowerCase(), - capitalizedEvent$jscomp$inline_1561 = - eventName$jscomp$inline_1559[0].toUpperCase() + - eventName$jscomp$inline_1559.slice(1); + var eventName$jscomp$inline_1571 = + simpleEventPluginEvents[i$jscomp$inline_1570], + domEventName$jscomp$inline_1572 = + eventName$jscomp$inline_1571.toLowerCase(), + capitalizedEvent$jscomp$inline_1573 = + eventName$jscomp$inline_1571[0].toUpperCase() + + eventName$jscomp$inline_1571.slice(1); registerSimpleEvent( - domEventName$jscomp$inline_1560, - "on" + capitalizedEvent$jscomp$inline_1561 + domEventName$jscomp$inline_1572, + "on" + capitalizedEvent$jscomp$inline_1573 ); } registerSimpleEvent(ANIMATION_END, "onAnimationEnd"); @@ -14717,14 +14727,14 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp(domElement, tag, propKey, null, nextProps, lastProp); } } - for (var propKey$220 in nextProps) { - var propKey = nextProps[propKey$220]; - lastProp = lastProps[propKey$220]; + for (var propKey$236 in nextProps) { + var propKey = nextProps[propKey$236]; + lastProp = lastProps[propKey$236]; if ( - nextProps.hasOwnProperty(propKey$220) && + nextProps.hasOwnProperty(propKey$236) && (null != propKey || null != lastProp) ) - switch (propKey$220) { + switch (propKey$236) { case "type": type = propKey; break; @@ -14753,7 +14763,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$220, + propKey$236, propKey, nextProps, lastProp @@ -14772,7 +14782,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ); return; case "select": - propKey = value = defaultValue = propKey$220 = null; + propKey = value = defaultValue = propKey$236 = null; for (type in lastProps) if ( ((lastDefaultValue = lastProps[type]), @@ -14803,7 +14813,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (name) { case "value": - propKey$220 = type; + propKey$236 = type; break; case "defaultValue": defaultValue = type; @@ -14824,15 +14834,15 @@ function updateProperties(domElement, tag, lastProps, nextProps) { tag = defaultValue; lastProps = value; nextProps = propKey; - null != propKey$220 - ? updateOptions(domElement, !!lastProps, propKey$220, !1) + null != propKey$236 + ? updateOptions(domElement, !!lastProps, propKey$236, !1) : !!nextProps !== !!lastProps && (null != tag ? updateOptions(domElement, !!lastProps, tag, !0) : updateOptions(domElement, !!lastProps, lastProps ? [] : "", !1)); return; case "textarea": - propKey = propKey$220 = null; + propKey = propKey$236 = null; for (defaultValue in lastProps) if ( ((name = lastProps[defaultValue]), @@ -14856,7 +14866,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { ) switch (value) { case "value": - propKey$220 = name; + propKey$236 = name; break; case "defaultValue": propKey = name; @@ -14870,17 +14880,17 @@ function updateProperties(domElement, tag, lastProps, nextProps) { name !== type && setProp(domElement, tag, value, name, nextProps, type); } - updateTextarea(domElement, propKey$220, propKey); + updateTextarea(domElement, propKey$236, propKey); return; case "option": - for (var propKey$236 in lastProps) + for (var propKey$252 in lastProps) if ( - ((propKey$220 = lastProps[propKey$236]), - lastProps.hasOwnProperty(propKey$236) && - null != propKey$220 && - !nextProps.hasOwnProperty(propKey$236)) + ((propKey$236 = lastProps[propKey$252]), + lastProps.hasOwnProperty(propKey$252) && + null != propKey$236 && + !nextProps.hasOwnProperty(propKey$252)) ) - switch (propKey$236) { + switch (propKey$252) { case "selected": domElement.selected = !1; break; @@ -14888,33 +14898,33 @@ function updateProperties(domElement, tag, lastProps, nextProps) { setProp( domElement, tag, - propKey$236, + propKey$252, null, nextProps, - propKey$220 + propKey$236 ); } for (lastDefaultValue in nextProps) if ( - ((propKey$220 = nextProps[lastDefaultValue]), + ((propKey$236 = nextProps[lastDefaultValue]), (propKey = lastProps[lastDefaultValue]), nextProps.hasOwnProperty(lastDefaultValue) && - propKey$220 !== propKey && - (null != propKey$220 || null != propKey)) + propKey$236 !== propKey && + (null != propKey$236 || null != propKey)) ) switch (lastDefaultValue) { case "selected": domElement.selected = - propKey$220 && - "function" !== typeof propKey$220 && - "symbol" !== typeof propKey$220; + propKey$236 && + "function" !== typeof propKey$236 && + "symbol" !== typeof propKey$236; break; default: setProp( domElement, tag, lastDefaultValue, - propKey$220, + propKey$236, nextProps, propKey ); @@ -14935,24 +14945,24 @@ function updateProperties(domElement, tag, lastProps, nextProps) { case "track": case "wbr": case "menuitem": - for (var propKey$241 in lastProps) - (propKey$220 = lastProps[propKey$241]), - lastProps.hasOwnProperty(propKey$241) && - null != propKey$220 && - !nextProps.hasOwnProperty(propKey$241) && - setProp(domElement, tag, propKey$241, null, nextProps, propKey$220); + for (var propKey$257 in lastProps) + (propKey$236 = lastProps[propKey$257]), + lastProps.hasOwnProperty(propKey$257) && + null != propKey$236 && + !nextProps.hasOwnProperty(propKey$257) && + setProp(domElement, tag, propKey$257, null, nextProps, propKey$236); for (checked in nextProps) if ( - ((propKey$220 = nextProps[checked]), + ((propKey$236 = nextProps[checked]), (propKey = lastProps[checked]), nextProps.hasOwnProperty(checked) && - propKey$220 !== propKey && - (null != propKey$220 || null != propKey)) + propKey$236 !== propKey && + (null != propKey$236 || null != propKey)) ) switch (checked) { case "children": case "dangerouslySetInnerHTML": - if (null != propKey$220) + if (null != propKey$236) throw Error(formatProdErrorMessage(137, tag)); break; default: @@ -14960,7 +14970,7 @@ function updateProperties(domElement, tag, lastProps, nextProps) { domElement, tag, checked, - propKey$220, + propKey$236, nextProps, propKey ); @@ -14968,49 +14978,49 @@ function updateProperties(domElement, tag, lastProps, nextProps) { return; default: if (isCustomElement(tag)) { - for (var propKey$246 in lastProps) - (propKey$220 = lastProps[propKey$246]), - lastProps.hasOwnProperty(propKey$246) && - void 0 !== propKey$220 && - !nextProps.hasOwnProperty(propKey$246) && + for (var propKey$262 in lastProps) + (propKey$236 = lastProps[propKey$262]), + lastProps.hasOwnProperty(propKey$262) && + void 0 !== propKey$236 && + !nextProps.hasOwnProperty(propKey$262) && setPropOnCustomElement( domElement, tag, - propKey$246, + propKey$262, void 0, nextProps, - propKey$220 + propKey$236 ); for (defaultChecked in nextProps) - (propKey$220 = nextProps[defaultChecked]), + (propKey$236 = nextProps[defaultChecked]), (propKey = lastProps[defaultChecked]), !nextProps.hasOwnProperty(defaultChecked) || - propKey$220 === propKey || - (void 0 === propKey$220 && void 0 === propKey) || + propKey$236 === propKey || + (void 0 === propKey$236 && void 0 === propKey) || setPropOnCustomElement( domElement, tag, defaultChecked, - propKey$220, + propKey$236, nextProps, propKey ); return; } } - for (var propKey$251 in lastProps) - (propKey$220 = lastProps[propKey$251]), - lastProps.hasOwnProperty(propKey$251) && - null != propKey$220 && - !nextProps.hasOwnProperty(propKey$251) && - setProp(domElement, tag, propKey$251, null, nextProps, propKey$220); + for (var propKey$267 in lastProps) + (propKey$236 = lastProps[propKey$267]), + lastProps.hasOwnProperty(propKey$267) && + null != propKey$236 && + !nextProps.hasOwnProperty(propKey$267) && + setProp(domElement, tag, propKey$267, null, nextProps, propKey$236); for (lastProp in nextProps) - (propKey$220 = nextProps[lastProp]), + (propKey$236 = nextProps[lastProp]), (propKey = lastProps[lastProp]), !nextProps.hasOwnProperty(lastProp) || - propKey$220 === propKey || - (null == propKey$220 && null == propKey) || - setProp(domElement, tag, lastProp, propKey$220, nextProps, propKey); + propKey$236 === propKey || + (null == propKey$236 && null == propKey) || + setProp(domElement, tag, lastProp, propKey$236, nextProps, propKey); } var eventsEnabled = null, selectionInformation = null; @@ -15637,17 +15647,17 @@ function getResource(type, currentProps, pendingProps) { "string" === typeof pendingProps.precedence ) { type = getStyleKey(pendingProps.href); - var styles$259 = getResourcesFromRoot(currentProps).hoistableStyles, - resource$260 = styles$259.get(type); - resource$260 || + var styles$276 = getResourcesFromRoot(currentProps).hoistableStyles, + resource$277 = styles$276.get(type); + resource$277 || ((currentProps = currentProps.ownerDocument || currentProps), - (resource$260 = { + (resource$277 = { type: "stylesheet", instance: null, count: 0, state: { loading: 0, preload: null } }), - styles$259.set(type, resource$260), + styles$276.set(type, resource$277), preloadPropsMap.has(type) || preloadStylesheet( currentProps, @@ -15662,9 +15672,9 @@ function getResource(type, currentProps, pendingProps) { hrefLang: pendingProps.hrefLang, referrerPolicy: pendingProps.referrerPolicy }, - resource$260.state + resource$277.state )); - return resource$260; + return resource$277; } return null; case "script": @@ -15760,37 +15770,37 @@ function acquireResource(hoistableRoot, resource, props) { return (resource.instance = instance); case "stylesheet": styleProps = getStyleKey(props.href); - var instance$264 = hoistableRoot.querySelector( + var instance$281 = hoistableRoot.querySelector( getStylesheetSelectorFromKey(styleProps) ); - if (instance$264) + if (instance$281) return ( (resource.state.loading |= 4), - (resource.instance = instance$264), - markNodeAsHoistable(instance$264), - instance$264 + (resource.instance = instance$281), + markNodeAsHoistable(instance$281), + instance$281 ); instance = stylesheetPropsFromRawProps(props); (styleProps = preloadPropsMap.get(styleProps)) && adoptPreloadPropsForStylesheet(instance, styleProps); - instance$264 = ( + instance$281 = ( hoistableRoot.ownerDocument || hoistableRoot ).createElement("link"); - markNodeAsHoistable(instance$264); - var linkInstance = instance$264; + markNodeAsHoistable(instance$281); + var linkInstance = instance$281; linkInstance._p = new Promise(function (resolve, reject) { linkInstance.onload = resolve; linkInstance.onerror = reject; }); - setInitialProperties(instance$264, "link", instance); + setInitialProperties(instance$281, "link", instance); resource.state.loading |= 4; - insertStylesheet(instance$264, props.precedence, hoistableRoot); - return (resource.instance = instance$264); + insertStylesheet(instance$281, props.precedence, hoistableRoot); + return (resource.instance = instance$281); case "script": - instance$264 = getScriptKey(props.src); + instance$281 = getScriptKey(props.src); if ( (styleProps = hoistableRoot.querySelector( - getScriptSelectorFromKey(instance$264) + getScriptSelectorFromKey(instance$281) )) ) return ( @@ -15799,7 +15809,7 @@ function acquireResource(hoistableRoot, resource, props) { styleProps ); instance = props; - if ((styleProps = preloadPropsMap.get(instance$264))) + if ((styleProps = preloadPropsMap.get(instance$281))) (instance = assign({}, props)), adoptPreloadPropsForScript(instance, styleProps); hoistableRoot = hoistableRoot.ownerDocument || hoistableRoot; @@ -16807,17 +16817,17 @@ Internals.Events = [ return fn(a); } ]; -var devToolsConfig$jscomp$inline_1731 = { +var devToolsConfig$jscomp$inline_1743 = { findFiberByHostInstance: getClosestInstanceFromNode, bundleType: 0, - version: "19.0.0-www-modern-b93e382d", + version: "19.0.0-www-modern-275952a2", rendererPackageName: "react-dom" }; -var internals$jscomp$inline_2205 = { - bundleType: devToolsConfig$jscomp$inline_1731.bundleType, - version: devToolsConfig$jscomp$inline_1731.version, - rendererPackageName: devToolsConfig$jscomp$inline_1731.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1731.rendererConfig, +var internals$jscomp$inline_2217 = { + bundleType: devToolsConfig$jscomp$inline_1743.bundleType, + version: devToolsConfig$jscomp$inline_1743.version, + rendererPackageName: devToolsConfig$jscomp$inline_1743.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1743.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -16833,26 +16843,26 @@ var internals$jscomp$inline_2205 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1731.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1743.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-b93e382d" + reconcilerVersion: "19.0.0-www-modern-275952a2" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_2206 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_2218 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_2206.isDisabled && - hook$jscomp$inline_2206.supportsFiber + !hook$jscomp$inline_2218.isDisabled && + hook$jscomp$inline_2218.supportsFiber ) try { - (rendererID = hook$jscomp$inline_2206.inject( - internals$jscomp$inline_2205 + (rendererID = hook$jscomp$inline_2218.inject( + internals$jscomp$inline_2217 )), - (injectedHook = hook$jscomp$inline_2206); + (injectedHook = hook$jscomp$inline_2218); } catch (err) {} } function ReactDOMRoot(internalRoot) { @@ -17365,4 +17375,4 @@ exports.useFormState = function (action, initialState, permalink) { exports.useFormStatus = function () { return ReactSharedInternals.H.useHostTransitionStatus(); }; -exports.version = "19.0.0-www-modern-b93e382d"; +exports.version = "19.0.0-www-modern-275952a2"; diff --git a/compiled/facebook-www/ReactReconciler-dev.classic.js b/compiled/facebook-www/ReactReconciler-dev.classic.js index d310dbeb999dd..2ddc40d3a2f1a 100644 --- a/compiled/facebook-www/ReactReconciler-dev.classic.js +++ b/compiled/facebook-www/ReactReconciler-dev.classic.js @@ -586,289 +586,791 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; -} -function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - var a = fiber; - var b = alternate; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - while (true) { - var parentA = a.return; + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - if (parentA === null) { - // We're at the root. - break; - } - var parentB = parentA.alternate; + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - if (parentA.child === parentB.child) { - var child = parentA.child; - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } - throw new Error('Unable to find node on an unmounted component.'); + return [null, null]; } + }; // $FlowFixMe[prop-missing] - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - _child = _child.sibling; - } + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - _child = _child.sibling; - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (!didFindChild) { - throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; } } - } - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; + return _frame; + } + } while (s >= 1 && c >= 0); + } - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } + break; + } + } + } + } finally { + reentry = false; - var child = node.child; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } - while (child !== null) { - var match = findCurrentHostFiberImpl(child); + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. - if (match !== null) { - return match; - } - child = child.sibling; + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } } - return null; + return syntheticFrame; } -function findCurrentHostFiberWithNoPortals(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } } - -function findCurrentHostFiberWithNoPortalsImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; - - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); } +} - var child = node.child; +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); - while (child !== null) { - if (child.tag !== HostPortal) { - var match = findCurrentHostFiberWithNoPortalsImpl(child); + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); - if (match !== null) { + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} + +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; + + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; + + do { + node = nextNode; + + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; + } + } + + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; +} +function isFiberMounted(fiber) { + return getNearestMountedFiber(fiber) === fiber; +} +function isMounted(component) { + { + var owner = current; + + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); + } + + instance._warnedAboutRefsInRender = true; + } + } + + var fiber = get(component); + + if (!fiber) { + return false; + } + + return getNearestMountedFiber(fiber) === fiber; +} + +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); + } +} + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); + + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); + } + + if (nearestMounted !== fiber) { + return null; + } + + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + + + var a = fiber; + var b = alternate; + + while (true) { + var parentA = a.return; + + if (parentA === null) { + // We're at the root. + break; + } + + var parentB = parentA.alternate; + + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. + + + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + + + if (parentA.child === parentB.child) { + var child = parentA.child; + + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + + + throw new Error('Unable to find node on an unmounted component.'); + } + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + throw new 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 new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); + } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + + + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); + } + + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. + + + return alternate; +} +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; +} + +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + + var child = node.child; + + while (child !== null) { + var match = findCurrentHostFiberImpl(child); + + if (match !== null) { + return match; + } + + child = child.sibling; + } + + return null; +} + +function findCurrentHostFiberWithNoPortals(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; +} + +function findCurrentHostFiberWithNoPortalsImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + + var child = node.child; + + while (child !== null) { + if (child.tag !== HostPortal) { + var match = findCurrentHostFiberWithNoPortalsImpl(child); + + if (match !== null) { return match; } } @@ -904,8 +1406,6 @@ function isArray(a) { return isArrayImpl(a); } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This is a host config that's used for the `react-reconciler` package on npm. // It is only used by third-party renderers. // @@ -2375,149 +2875,55 @@ function clearTransitionsForLanes(root, lanes) { } } -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; -} -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; -} -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; -} -function eventPriorityToLane(updatePriority) { - return updatePriority; -} -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); - - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } - - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; - } - - return IdleEventPriority; -} - -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler.unstable_cancelCallback; -var shouldYield = Scheduler.unstable_shouldYield; -var requestPaint = Scheduler.unstable_requestPaint; -var now$1 = Scheduler.unstable_now; -var ImmediatePriority = Scheduler.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler.unstable_NormalPriority; -var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* -// on scheduler/unstable_mock, which we'll need for internal testing - -var log$1 = Scheduler.log; -var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } + + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } + + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; } + + return IdleEventPriority; } +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now$1 = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* +// on scheduler/unstable_mock, which we'll need for internal testing + +var log$1 = Scheduler.log; +var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -2857,545 +3263,201 @@ function markRenderStopped() { injectedProfilingHooks.markRenderStopped(); } } -} -function markRenderScheduled(lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { - injectedProfilingHooks.markRenderScheduled(lane); - } - } -} -function markForceUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { - injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); - } - } -} -function markStateUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { - injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); - } - } -} - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; -} - -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; - -var nativeConsole = console; -var nativeConsoleLog = null; -var pendingGroupArgs = []; -var printedGroupIndex = -1; - -function formatLanes(laneOrLanes) { - return '0b' + laneOrLanes.toString(2).padStart(31, '0'); -} - -function group() { - for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { - groupArgs[_key] = arguments[_key]; - } - - pendingGroupArgs.push(groupArgs); - - if (nativeConsoleLog === null) { - nativeConsoleLog = nativeConsole.log; - nativeConsole.log = log; - } -} - -function groupEnd() { - pendingGroupArgs.pop(); - - while (printedGroupIndex >= pendingGroupArgs.length) { - nativeConsole.groupEnd(); - printedGroupIndex--; - } - - if (pendingGroupArgs.length === 0) { - nativeConsole.log = nativeConsoleLog; - nativeConsoleLog = null; - } -} - -function log() { - if (printedGroupIndex < pendingGroupArgs.length - 1) { - for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { - var groupArgs = pendingGroupArgs[i]; - nativeConsole.group.apply(nativeConsole, groupArgs); - } - - printedGroupIndex = pendingGroupArgs.length - 1; - } - - if (typeof nativeConsoleLog === 'function') { - nativeConsoleLog.apply(void 0, arguments); - } else { - nativeConsole.log.apply(nativeConsole, arguments); - } -} - -var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; -function logCommitStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logCommitStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps - -var wakeableIDs = new PossiblyWeakMap$2(); -var wakeableID = 0; - -function getWakeableID(wakeable) { - if (!wakeableIDs.has(wakeable)) { - wakeableIDs.set(wakeable, wakeableID++); - } - - return wakeableIDs.get(wakeable); -} - -function logComponentSuspended(componentName, wakeable) { - { - if (enableDebugTracing) { - var id = getWakeableID(wakeable); - var display = wakeable.displayName || wakeable; - log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - wakeable.then(function () { - log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }, function () { - log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }); - } - } -} -function logLayoutEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logLayoutEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logPassiveEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logPassiveEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logRenderStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logRenderStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logForceUpdateScheduled(componentName, lane) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); - } - } -} -function logStateUpdateScheduled(componentName, lane, payloadOrAction) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); - } - } -} - -// This is imported by the event replaying implementation in React DOM. It's -// in a separate file to break a circular dependency between the renderer and -// the reconciler. -function isRootDehydrated(root) { - var currentState = root.current.memoizedState; - return currentState.isDehydrated; -} - -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; +} +function markRenderScheduled(lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { + injectedProfilingHooks.markRenderScheduled(lane); + } } } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +function markForceUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } } -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); +function markStateUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + } } + /** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } +var nativeConsole = console; +var nativeConsoleLog = null; +var pendingGroupArgs = []; +var printedGroupIndex = -1; - { - var frame = componentFrameCache.get(fn); +function formatLanes(laneOrLanes) { + return '0b' + laneOrLanes.toString(2).padStart(31, '0'); +} - if (frame !== undefined) { - return frame; - } +function group() { + for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { + groupArgs[_key] = arguments[_key]; } - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. + pendingGroupArgs.push(groupArgs); - ReactSharedInternals.H = null; - disableLogs(); + if (nativeConsoleLog === null) { + nativeConsoleLog = nativeConsole.log; + nativeConsole.log = log; } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too +} +function groupEnd() { + pendingGroupArgs.pop(); - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? + while (printedGroupIndex >= pendingGroupArgs.length) { + nativeConsole.groupEnd(); + printedGroupIndex--; + } - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } + if (pendingGroupArgs.length === 0) { + nativeConsole.log = nativeConsoleLog; + nativeConsoleLog = null; + } +} - return [null, null]; +function log() { + if (printedGroupIndex < pendingGroupArgs.length - 1) { + for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { + var groupArgs = pendingGroupArgs[i]; + nativeConsole.group.apply(nativeConsole, groupArgs); } - }; // $FlowFixMe[prop-missing] - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); + printedGroupIndex = pendingGroupArgs.length - 1; } - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } + if (typeof nativeConsoleLog === 'function') { + nativeConsoleLog.apply(void 0, arguments); + } else { + nativeConsole.log.apply(nativeConsole, arguments); + } +} - break; - } - } +var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; +function logCommitStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); + } +} +function logCommitStopped() { + { + if (enableDebugTracing) { + groupEnd(); } + } +} +var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. +var wakeableIDs = new PossiblyWeakMap$1(); +var wakeableID = 0; +function getWakeableID(wakeable) { + if (!wakeableIDs.has(wakeable)) { + wakeableIDs.set(wakeable, wakeableID++); + } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + return wakeableIDs.get(wakeable); +} +function logComponentSuspended(componentName, wakeable) { { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); + if (enableDebugTracing) { + var id = getWakeableID(wakeable); + var display = wakeable.displayName || wakeable; + log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + wakeable.then(function () { + log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }, function () { + log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }); } } - - return syntheticFrame; } - -function describeClassComponentFrame(ctor) { +function logLayoutEffectsStarted(lanes) { { - return describeNativeComponentFrame(ctor, true); + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } -function describeFunctionComponentFrame(fn) { +function logLayoutEffectsStopped() { { - return describeNativeComponentFrame(fn, false); + if (enableDebugTracing) { + groupEnd(); + } } } - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; +function logPassiveEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; +function logPassiveEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logRenderStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logRenderStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logForceUpdateScheduled(componentName, lane) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); + } + } +} +function logStateUpdateScheduled(componentName, lane, payloadOrAction) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); + } } } +// This is imported by the event replaying implementation in React DOM. It's +// in a separate file to break a circular dependency between the renderer and +// the reconciler. +function isRootDehydrated(root) { + var currentState = root.current.memoizedState; + return currentState.isDehydrated; +} + var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown @@ -6176,61 +6238,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -6450,11 +6457,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -14037,7 +14044,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -14596,7 +14602,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -14758,7 +14763,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -16331,7 +16336,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -19929,7 +19933,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -19937,7 +19941,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -19967,7 +19971,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -20059,7 +20063,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -21737,9 +21741,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -21767,13 +21771,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -22346,8 +22350,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -22359,14 +22365,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -22581,7 +22587,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -22740,9 +22746,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -22752,13 +22758,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -22954,7 +22960,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -23087,13 +23093,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -23139,9 +23145,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -23312,13 +23318,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -23389,12 +23395,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -23436,9 +23442,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -23704,7 +23710,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -25392,10 +25398,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -26050,7 +26055,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -26061,7 +26066,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -26070,10 +26078,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -26081,9 +26085,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -26161,7 +26164,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -26170,10 +26176,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -26260,7 +26262,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -26272,7 +26274,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -26510,18 +26512,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -27231,13 +27228,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -27250,7 +27247,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -27262,7 +27259,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -27286,7 +27283,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -27299,7 +27296,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -27362,14 +27359,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -27483,14 +27480,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -28653,7 +28650,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-e2e5cb48'; +var ReactVersion = '19.0.0-www-classic-06080d9f'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -28818,7 +28815,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -28829,9 +28826,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } diff --git a/compiled/facebook-www/ReactReconciler-dev.modern.js b/compiled/facebook-www/ReactReconciler-dev.modern.js index 611d39b4661b8..daefdc2d1c30c 100644 --- a/compiled/facebook-www/ReactReconciler-dev.modern.js +++ b/compiled/facebook-www/ReactReconciler-dev.modern.js @@ -588,287 +588,789 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$2(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - var a = fiber; - var b = alternate; + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - while (true) { - var parentA = a.return; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - if (parentA === null) { - // We're at the root. - break; - } + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - var parentB = parentA.alternate; - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } - if (parentA.child === parentB.child) { - var child = parentA.child; + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? + + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; + } + } - throw new Error('Unable to find node on an unmounted component.'); + return [null, null]; } + }; // $FlowFixMe[prop-missing] - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - _child = _child.sibling; - } + if (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; + } - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } - _child = _child.sibling; - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (!didFindChild) { - throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; } } - } - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; + return _frame; + } + } while (s >= 1 && c >= 0); + } - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } + break; + } + } + } + } finally { + reentry = false; - var child = node.child; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } - while (child !== null) { - var match = findCurrentHostFiberImpl(child); + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. - if (match !== null) { - return match; - } - child = child.sibling; + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } } - return null; + return syntheticFrame; } -function findCurrentHostFiberWithNoPortals(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } } - -function findCurrentHostFiberWithNoPortalsImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; - - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); } +} - var child = node.child; +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); - while (child !== null) { - if (child.tag !== HostPortal) { - var match = findCurrentHostFiberWithNoPortalsImpl(child); + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); - if (match !== null) { - return match; + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); + + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); + + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); + + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); + + case ClassComponent: + return describeClassComponentFrame(fiber.type); + + default: + return ''; + } +} + +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; + + do { + info += describeFiber(node); + + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; + + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; + + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; + } +} + +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + + var owner = current._debugOwner; + + if (owner != null) { + return getComponentNameFromOwner(owner); + } + } + + return null; +} + +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. + + + return getStackByFiberInDevAndProd(current); + } +} + +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); + } +} +function setCurrentDebugFiberInDEV(fiber) { + { + setCurrentFiber(fiber); + } +} +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } + + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } + + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} + +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; + + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; + + do { + node = nextNode; + + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null + + + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; + } + } + + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; +} +function isMounted(component) { + { + var owner = current; + + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); + } + + instance._warnedAboutRefsInRender = true; + } + } + + var fiber = get(component); + + if (!fiber) { + return false; + } + + return getNearestMountedFiber(fiber) === fiber; +} + +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); + } +} + +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; + + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); + + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); + } + + if (nearestMounted !== fiber) { + return null; + } + + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. + + + var a = fiber; + var b = alternate; + + while (true) { + var parentA = a.return; + + if (parentA === null) { + // We're at the root. + break; + } + + var parentB = parentA.alternate; + + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; + + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. + + + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. + + + if (parentA.child === parentB.child) { + var child = parentA.child; + + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } + + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } + + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. + + + throw new Error('Unable to find node on an unmounted component.'); + } + + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; + + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } + + _child = _child.sibling; + } + + if (!didFindChild) { + throw new 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 new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); + } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. + + + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); + } + + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. + + + return alternate; +} +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; +} + +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + + var child = node.child; + + while (child !== null) { + var match = findCurrentHostFiberImpl(child); + + if (match !== null) { + return match; + } + + child = child.sibling; + } + + return null; +} + +function findCurrentHostFiberWithNoPortals(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; +} + +function findCurrentHostFiberWithNoPortalsImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; + + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + + var child = node.child; + + while (child !== null) { + if (child.tag !== HostPortal) { + var match = findCurrentHostFiberWithNoPortalsImpl(child); + + if (match !== null) { + return match; } } @@ -903,8 +1405,6 @@ function isArray(a) { return isArrayImpl(a); } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - // This is a host config that's used for the `react-reconciler` package on npm. // It is only used by third-party renderers. // @@ -2178,149 +2678,55 @@ function clearTransitionsForLanes(root, lanes) { } } -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; -} -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; -} -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; -} -function eventPriorityToLane(updatePriority) { - return updatePriority; -} -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); - - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } - - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; - } - - return IdleEventPriority; -} - -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler.unstable_cancelCallback; -var shouldYield = Scheduler.unstable_shouldYield; -var requestPaint = Scheduler.unstable_requestPaint; -var now$1 = Scheduler.unstable_now; -var ImmediatePriority = Scheduler.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler.unstable_NormalPriority; -var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* -// on scheduler/unstable_mock, which we'll need for internal testing - -var log$1 = Scheduler.log; -var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; - -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; - -function disabledLog() {} - -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 - - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } - - disabledDepth++; - } -} -function reenableLogs() { - { - disabledDepth--; - - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; +} +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; +} +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } + + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } + + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; } + + return IdleEventPriority; } +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler.unstable_cancelCallback; +var shouldYield = Scheduler.unstable_shouldYield; +var requestPaint = Scheduler.unstable_requestPaint; +var now$1 = Scheduler.unstable_now; +var ImmediatePriority = Scheduler.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler.unstable_NormalPriority; +var IdlePriority = Scheduler.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* +// on scheduler/unstable_mock, which we'll need for internal testing + +var log$1 = Scheduler.log; +var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; + var rendererID = null; var injectedHook = null; var injectedProfilingHooks = null; @@ -2660,545 +3066,201 @@ function markRenderStopped() { injectedProfilingHooks.markRenderStopped(); } } -} -function markRenderScheduled(lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { - injectedProfilingHooks.markRenderScheduled(lane); - } - } -} -function markForceUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { - injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); - } - } -} -function markStateUpdateScheduled(fiber, lane) { - if (enableSchedulingProfiler) { - if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { - injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); - } - } -} - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; -} - -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; - -var nativeConsole = console; -var nativeConsoleLog = null; -var pendingGroupArgs = []; -var printedGroupIndex = -1; - -function formatLanes(laneOrLanes) { - return '0b' + laneOrLanes.toString(2).padStart(31, '0'); -} - -function group() { - for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { - groupArgs[_key] = arguments[_key]; - } - - pendingGroupArgs.push(groupArgs); - - if (nativeConsoleLog === null) { - nativeConsoleLog = nativeConsole.log; - nativeConsole.log = log; - } -} - -function groupEnd() { - pendingGroupArgs.pop(); - - while (printedGroupIndex >= pendingGroupArgs.length) { - nativeConsole.groupEnd(); - printedGroupIndex--; - } - - if (pendingGroupArgs.length === 0) { - nativeConsole.log = nativeConsoleLog; - nativeConsoleLog = null; - } -} - -function log() { - if (printedGroupIndex < pendingGroupArgs.length - 1) { - for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { - var groupArgs = pendingGroupArgs[i]; - nativeConsole.group.apply(nativeConsole, groupArgs); - } - - printedGroupIndex = pendingGroupArgs.length - 1; - } - - if (typeof nativeConsoleLog === 'function') { - nativeConsoleLog.apply(void 0, arguments); - } else { - nativeConsole.log.apply(nativeConsole, arguments); - } -} - -var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; -function logCommitStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logCommitStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -var PossiblyWeakMap$2 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps - -var wakeableIDs = new PossiblyWeakMap$2(); -var wakeableID = 0; - -function getWakeableID(wakeable) { - if (!wakeableIDs.has(wakeable)) { - wakeableIDs.set(wakeable, wakeableID++); - } - - return wakeableIDs.get(wakeable); -} - -function logComponentSuspended(componentName, wakeable) { - { - if (enableDebugTracing) { - var id = getWakeableID(wakeable); - var display = wakeable.displayName || wakeable; - log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - wakeable.then(function () { - log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }, function () { - log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); - }); - } - } -} -function logLayoutEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logLayoutEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logPassiveEffectsStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logPassiveEffectsStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logRenderStarted(lanes) { - { - if (enableDebugTracing) { - group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); - } - } -} -function logRenderStopped() { - { - if (enableDebugTracing) { - groupEnd(); - } - } -} -function logForceUpdateScheduled(componentName, lane) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); - } - } -} -function logStateUpdateScheduled(componentName, lane, payloadOrAction) { - { - if (enableDebugTracing) { - log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); - } - } -} - -// This is imported by the event replaying implementation in React DOM. It's -// in a separate file to break a circular dependency between the renderer and -// the reconciler. -function isRootDehydrated(root) { - var currentState = root.current.memoizedState; - return currentState.isDehydrated; -} - -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. - - - return '\n' + prefix + name; +} +function markRenderScheduled(lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { + injectedProfilingHooks.markRenderScheduled(lane); + } } } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +function markForceUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } } -var reentry = false; -var componentFrameCache; - -{ - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); +function markStateUpdateScheduled(fiber, lane) { + if (enableSchedulingProfiler) { + if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + } } + /** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } +var nativeConsole = console; +var nativeConsoleLog = null; +var pendingGroupArgs = []; +var printedGroupIndex = -1; - { - var frame = componentFrameCache.get(fn); +function formatLanes(laneOrLanes) { + return '0b' + laneOrLanes.toString(2).padStart(31, '0'); +} - if (frame !== undefined) { - return frame; - } +function group() { + for (var _len = arguments.length, groupArgs = new Array(_len), _key = 0; _key < _len; _key++) { + groupArgs[_key] = arguments[_key]; } - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; - - { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. + pendingGroupArgs.push(groupArgs); - ReactSharedInternals.H = null; - disableLogs(); + if (nativeConsoleLog === null) { + nativeConsoleLog = nativeConsole.log; + nativeConsole.log = log; } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ - - - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; - - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] - - - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); - - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } - - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow - - - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too +} +function groupEnd() { + pendingGroupArgs.pop(); - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? + while (printedGroupIndex >= pendingGroupArgs.length) { + nativeConsole.groupEnd(); + printedGroupIndex--; + } - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } + if (pendingGroupArgs.length === 0) { + nativeConsole.log = nativeConsoleLog; + nativeConsoleLog = null; + } +} - return [null, null]; +function log() { + if (printedGroupIndex < pendingGroupArgs.length - 1) { + for (var i = printedGroupIndex + 1; i < pendingGroupArgs.length; i++) { + var groupArgs = pendingGroupArgs[i]; + nativeConsole.group.apply(nativeConsole, groupArgs); } - }; // $FlowFixMe[prop-missing] - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); + printedGroupIndex = pendingGroupArgs.length - 1; } - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; - - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; - - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... - - - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; - - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } - - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. - - - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } - - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. - - - return _frame; - } - } while (s >= 1 && c >= 0); - } + if (typeof nativeConsoleLog === 'function') { + nativeConsoleLog.apply(void 0, arguments); + } else { + nativeConsole.log.apply(nativeConsole, arguments); + } +} - break; - } - } +var REACT_LOGO_STYLE = 'background-color: #20232a; color: #61dafb; padding: 0 2px;'; +function logCommitStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c commit%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); } - } finally { - reentry = false; - - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); + } +} +function logCommitStopped() { + { + if (enableDebugTracing) { + groupEnd(); } + } +} +var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe[incompatible-type]: Flow cannot handle polymorphic WeakMaps - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. +var wakeableIDs = new PossiblyWeakMap$1(); +var wakeableID = 0; +function getWakeableID(wakeable) { + if (!wakeableIDs.has(wakeable)) { + wakeableIDs.set(wakeable, wakeableID++); + } - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + return wakeableIDs.get(wakeable); +} +function logComponentSuspended(componentName, wakeable) { { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); + if (enableDebugTracing) { + var id = getWakeableID(wakeable); + var display = wakeable.displayName || wakeable; + log("%c\u269B\uFE0F%c " + componentName + " suspended", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + wakeable.then(function () { + log("%c\u269B\uFE0F%c " + componentName + " resolved", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }, function () { + log("%c\u269B\uFE0F%c " + componentName + " rejected", REACT_LOGO_STYLE, 'color: #80366d; font-weight: bold;', id, display); + }); } } - - return syntheticFrame; } - -function describeClassComponentFrame(ctor) { +function logLayoutEffectsStarted(lanes) { { - return describeNativeComponentFrame(ctor, true); + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c layout effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } -function describeFunctionComponentFrame(fn) { +function logLayoutEffectsStopped() { { - return describeNativeComponentFrame(fn, false); + if (enableDebugTracing) { + groupEnd(); + } } } - -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); - - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); - - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); - - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); - - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); - - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); - - case ClassComponent: - return describeClassComponentFrame(fiber.type); - - default: - return ''; +function logPassiveEffectsStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c passive effects%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } } } - -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; - - do { - info += describeFiber(node); - - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; - - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; - - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); - } - } - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null - - - node = node.return; - } while (node); - - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; +function logPassiveEffectsStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logRenderStarted(lanes) { + { + if (enableDebugTracing) { + group("%c\u269B\uFE0F%c render%c (" + formatLanes(lanes) + ")", REACT_LOGO_STYLE, '', 'font-weight: normal;'); + } + } +} +function logRenderStopped() { + { + if (enableDebugTracing) { + groupEnd(); + } + } +} +function logForceUpdateScheduled(componentName, lane) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " forced update %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #db2e1f; font-weight: bold;', ''); + } + } +} +function logStateUpdateScheduled(componentName, lane, payloadOrAction) { + { + if (enableDebugTracing) { + log("%c\u269B\uFE0F%c " + componentName + " updated state %c(" + formatLanes(lane) + ")", REACT_LOGO_STYLE, 'color: #01a252; font-weight: bold;', '', payloadOrAction); + } } } +// This is imported by the event replaying implementation in React DOM. It's +// in a separate file to break a circular dependency between the renderer and +// the reconciler. +function isRootDehydrated(root) { + var currentState = root.current.memoizedState; + return currentState.isDehydrated; +} + var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown @@ -5967,61 +6029,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -6241,11 +6248,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -13716,7 +13723,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); hasId = checkDidRenderIdHook(); @@ -14249,7 +14255,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, } { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); hasId = checkDidRenderIdHook(); @@ -14405,7 +14410,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -15886,7 +15891,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -19436,7 +19440,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -19444,7 +19448,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -19474,7 +19478,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -19566,7 +19570,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -21242,9 +21246,9 @@ function isSuspenseBoundaryBeingHidden(current, finishedWork) { function commitMutationEffects(root, finishedWork, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -21272,13 +21276,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } var currentHoistableRoot = null; @@ -21849,8 +21853,10 @@ function resetFormOnFiber(fiber) { function commitLayoutEffects(finishedWork, root, committedLanes) { inProgressLanes = committedLanes; inProgressRoot = root; + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); inProgressLanes = null; inProgressRoot = null; } @@ -21862,14 +21868,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -22084,7 +22090,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -22243,9 +22249,9 @@ function commitTracingMarkerPassiveMountEffect(finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -22255,13 +22261,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -22453,7 +22459,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -22582,13 +22588,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -22634,9 +22640,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -22807,13 +22813,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -22884,12 +22890,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -22931,9 +22937,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -23091,7 +23097,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -24739,10 +24745,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -25397,7 +25402,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -25408,7 +25413,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -25417,10 +25425,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -25428,9 +25432,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -25503,7 +25506,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -25512,10 +25518,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -25602,7 +25604,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -25614,7 +25616,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -25852,18 +25854,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); { @@ -26573,13 +26570,13 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.tag !== OffscreenComponent) { if (fiber.flags & PlacementDEV) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode) { doubleInvokeEffectsOnFiber(root, fiber, (fiber.mode & NoStrictPassiveEffectsMode) === NoMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } else { recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } @@ -26592,7 +26589,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) if (fiber.memoizedState === null) { // Only consider Offscreen that is visible. // TODO (Offscreen) Handle manual mode. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); if (isInStrictMode && fiber.flags & Visibility) { // Double invoke effects on Offscreen's subtree only @@ -26604,7 +26601,7 @@ function doubleInvokeEffectsInDEVIfNecessary(root, fiber, parentIsInStrictMode) recursivelyTraverseAndDoubleInvokeEffectsInDEV(root, fiber, isInStrictMode); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -26655,14 +26652,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -26758,14 +26755,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -27919,7 +27916,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-a0174ad9'; +var ReactVersion = '19.0.0-www-modern-51ae228d'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol @@ -28084,7 +28081,7 @@ function findHostInstanceWithWarning(component, methodName) { var previousFiber = current; try { - setCurrentFiber(hostFiber); + setCurrentDebugFiberInDEV(hostFiber); if (fiber.mode & StrictLegacyMode) { error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://react.dev/link/strict-mode-find-node', methodName, methodName, componentName); @@ -28095,9 +28092,9 @@ function findHostInstanceWithWarning(component, methodName) { // Ideally this should reset to previous but this shouldn't be called in // render and there's another warning for that anyway. if (previousFiber) { - setCurrentFiber(previousFiber); + setCurrentDebugFiberInDEV(previousFiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } diff --git a/compiled/facebook-www/ReactReconciler-prod.classic.js b/compiled/facebook-www/ReactReconciler-prod.classic.js index 687cb8763fe98..866e6805c93ee 100644 --- a/compiled/facebook-www/ReactReconciler-prod.classic.js +++ b/compiled/facebook-www/ReactReconciler-prod.classic.js @@ -160,6 +160,188 @@ module.exports = function ($$$config) { } return null; } + function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; + } + function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" } + ); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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; + } + } function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -207,36 +389,36 @@ module.exports = function ($$$config) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$3 = parentA.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$3 = parentB.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -553,18 +735,18 @@ module.exports = function ($$$config) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$7 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$7; + remainingLanes[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -584,21 +766,21 @@ module.exports = function ($$$config) { 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); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$11 = 31 - clz32(lanes), + lane = 1 << index$11; + index$11 = root.transitionLanes[index$11]; + null !== index$11 && + index$11.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -608,10 +790,10 @@ module.exports = function ($$$config) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + null !== root.transitionLanes[index$12] && + (root.transitionLanes[index$12] = null); lanes &= ~lane; } } @@ -646,188 +828,6 @@ module.exports = function ($$$config) { function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } - function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; - } - function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$11) { - control = x$11; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$12) { - control = x$12; - } - (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" } - ); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } - } function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var stack = CapturedStacks.get(value); @@ -1144,12 +1144,12 @@ module.exports = function ($$$config) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$5 = 31 - clz32(pendingLanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -1397,20 +1397,20 @@ module.exports = function ($$$config) { ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$18 = workInProgress$jscomp$0.alternate; + null !== current$18 && + ((current$18 = current$18.updateQueue), + (pendingQueue = current$18.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$18.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$18.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$18 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -1423,8 +1423,8 @@ module.exports = function ($$$config) { 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$18 && + (current$18 = current$18.next = { lane: 0, tag: pendingQueue.tag, @@ -1481,10 +1481,10 @@ module.exports = function ($$$config) { callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$18 + ? ((firstPendingUpdate = current$18 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$18 = current$18.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -1497,10 +1497,10 @@ module.exports = function ($$$config) { (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$18 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$18; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -2361,9 +2361,9 @@ module.exports = function ($$$config) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$40 = fiber.alternate; + null !== current$40 && + null !== current$40.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -2591,16 +2591,16 @@ module.exports = function ($$$config) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$42 = currentlyRenderingFiber$1.alternate; + null !== current$42 && + ((current$42 = current$42.updateQueue), + null !== current$42 && + ((current$42 = current$42.memoCache), + null != current$42 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$42.data + : current$42.data.map(function (array) { return array.slice(); }), index: 0 @@ -2615,11 +2615,11 @@ module.exports = function ($$$config) { if (void 0 === updateQueue) for ( updateQueue = memoCache.data[memoCache.index] = Array(size), - current = 0; - current < size; - current++ + current$42 = 0; + current$42 < size; + current$42++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$42] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -2652,7 +2652,7 @@ module.exports = function ($$$config) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$39 = !1; + didReadFromEntangledAsyncAction$43 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2673,11 +2673,11 @@ module.exports = function ($$$config) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$39 = !0); + (didReadFromEntangledAsyncAction$43 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$39 = !0); + (didReadFromEntangledAsyncAction$43 = !0); continue; } else (updateLane = { @@ -2723,7 +2723,7 @@ module.exports = function ($$$config) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$39 && + didReadFromEntangledAsyncAction$43 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3567,9 +3567,9 @@ module.exports = function ($$$config) { (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$44 in Component) - void 0 === newProps[propName$44] && - (newProps[propName$44] = Component[propName$44]); + for (var propName$48 in Component) + void 0 === newProps[propName$48] && + (newProps[propName$48] = Component[propName$48]); } return newProps; } @@ -4554,32 +4554,36 @@ module.exports = function ($$$config) { ); } function finishClassComponent( - current, + current$jscomp$0, workInProgress, Component, shouldUpdate, hasContext, renderLanes ) { - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); var didCaptureError = 0 !== (workInProgress.flags & 128); if (!shouldUpdate && !didCaptureError) return ( hasContext && invalidateContextProvider(workInProgress, Component, !1), - bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) + bailoutOnAlreadyFinishedWork( + current$jscomp$0, + workInProgress, + renderLanes + ) ); shouldUpdate = workInProgress.stateNode; - currentOwner = workInProgress; + current = workInProgress; var nextChildren = didCaptureError && "function" !== typeof Component.getDerivedStateFromError ? null : shouldUpdate.render(); workInProgress.flags |= 1; - null !== current && didCaptureError + null !== current$jscomp$0 && didCaptureError ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -4589,7 +4593,12 @@ module.exports = function ($$$config) { nextChildren, renderLanes ))) - : reconcileChildren(current, workInProgress, nextChildren, renderLanes); + : reconcileChildren( + current$jscomp$0, + workInProgress, + nextChildren, + renderLanes + ); workInProgress.memoizedState = shouldUpdate.state; hasContext && invalidateContextProvider(workInProgress, Component, !0); return workInProgress.child; @@ -6500,44 +6509,44 @@ module.exports = function ($$$config) { needsVisibilityToggle = needsVisibilityToggle.sibling; } else if (supportsPersistence) - for (var node$96 = workInProgress.child; null !== node$96; ) { - if (5 === node$96.tag) { - var instance = node$96.stateNode; + for (var node$101 = workInProgress.child; null !== node$101; ) { + if (5 === node$101.tag) { + var instance = node$101.stateNode; needsVisibilityToggle && isHidden && (instance = cloneHiddenInstance( instance, - node$96.type, - node$96.memoizedProps + node$101.type, + node$101.memoizedProps )); appendInitialChild(parent, instance); - } else if (6 === node$96.tag) - (instance = node$96.stateNode), + } else if (6 === node$101.tag) + (instance = node$101.stateNode), needsVisibilityToggle && isHidden && (instance = cloneHiddenTextInstance( instance, - node$96.memoizedProps + node$101.memoizedProps )), appendInitialChild(parent, instance); - else if (4 !== node$96.tag) - if (22 === node$96.tag && null !== node$96.memoizedState) - (instance = node$96.child), - null !== instance && (instance.return = node$96), - appendAllChildren(parent, node$96, !0, !0); - else if (null !== node$96.child) { - node$96.child.return = node$96; - node$96 = node$96.child; + else if (4 !== node$101.tag) + if (22 === node$101.tag && null !== node$101.memoizedState) + (instance = node$101.child), + null !== instance && (instance.return = node$101), + appendAllChildren(parent, node$101, !0, !0); + else if (null !== node$101.child) { + node$101.child.return = node$101; + node$101 = node$101.child; continue; } - if (node$96 === workInProgress) break; - for (; null === node$96.sibling; ) { - if (null === node$96.return || node$96.return === workInProgress) + if (node$101 === workInProgress) break; + for (; null === node$101.sibling; ) { + if (null === node$101.return || node$101.return === workInProgress) return; - node$96 = node$96.return; + node$101 = node$101.return; } - node$96.sibling.return = node$96.return; - node$96 = node$96.sibling; + node$101.sibling.return = node$101.return; + node$101 = node$101.sibling; } } function appendAllChildrenToContainer( @@ -6610,31 +6619,31 @@ module.exports = function ($$$config) { current.memoizedProps !== newProps && markUpdate(workInProgress); else if (supportsPersistence) { var currentInstance = current.stateNode, - oldProps$99 = current.memoizedProps; + oldProps$104 = current.memoizedProps; if ( (current = doesRequireClone(current, workInProgress)) || - oldProps$99 !== newProps + oldProps$104 !== newProps ) { var currentHostContext = contextStackCursor.current; - oldProps$99 = cloneInstance( + oldProps$104 = cloneInstance( currentInstance, type, - oldProps$99, + oldProps$104, newProps, !current, null ); - oldProps$99 === currentInstance + oldProps$104 === currentInstance ? (workInProgress.stateNode = currentInstance) : (finalizeInitialChildren( - oldProps$99, + oldProps$104, type, newProps, currentHostContext ) && markUpdate(workInProgress), - (workInProgress.stateNode = oldProps$99), + (workInProgress.stateNode = oldProps$104), current - ? appendAllChildren(oldProps$99, workInProgress, !1, !1) + ? appendAllChildren(oldProps$104, workInProgress, !1, !1) : markUpdate(workInProgress)); } else workInProgress.stateNode = currentInstance; } @@ -6684,15 +6693,15 @@ module.exports = function ($$$config) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$101 = null; null !== lastTailNode; ) + for (var lastTailNode$106 = null; null !== lastTailNode; ) null !== lastTailNode.alternate && - (lastTailNode$101 = lastTailNode), + (lastTailNode$106 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$101 + null === lastTailNode$106 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$101.sibling = null); + : (lastTailNode$106.sibling = null); } } function bubbleProperties(completedWork) { @@ -6702,19 +6711,19 @@ module.exports = function ($$$config) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$102 = completedWork.child; null !== child$102; ) - (newChildLanes |= child$102.lanes | child$102.childLanes), - (subtreeFlags |= child$102.subtreeFlags & 31457280), - (subtreeFlags |= child$102.flags & 31457280), - (child$102.return = completedWork), - (child$102 = child$102.sibling); + for (var child$107 = completedWork.child; null !== child$107; ) + (newChildLanes |= child$107.lanes | child$107.childLanes), + (subtreeFlags |= child$107.subtreeFlags & 31457280), + (subtreeFlags |= child$107.flags & 31457280), + (child$107.return = completedWork), + (child$107 = child$107.sibling); else - for (child$102 = completedWork.child; null !== child$102; ) - (newChildLanes |= child$102.lanes | child$102.childLanes), - (subtreeFlags |= child$102.subtreeFlags), - (subtreeFlags |= child$102.flags), - (child$102.return = completedWork), - (child$102 = child$102.sibling); + for (child$107 = completedWork.child; null !== child$107; ) + (newChildLanes |= child$107.lanes | child$107.childLanes), + (subtreeFlags |= child$107.subtreeFlags), + (subtreeFlags |= child$107.flags), + (child$107.return = completedWork), + (child$107 = child$107.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7391,8 +7400,8 @@ module.exports = function ($$$config) { else if ("function" === typeof ref) try { ref(null); - } catch (error$133) { - captureCommitPhaseError(current, nearestMountedAncestor, error$133); + } catch (error$138) { + captureCommitPhaseError(current, nearestMountedAncestor, error$138); } else ref.current = null; } @@ -7615,11 +7624,11 @@ module.exports = function ($$$config) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$134) { + } catch (error$139) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$134 + error$139 ); } } @@ -8192,18 +8201,19 @@ module.exports = function ($$$config) { } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (supportsHydration && null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$150 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$150 && + ((current$150 = current$150.memoizedState), + null !== current$150 && + ((current$150 = current$150.dehydrated), null !== current$150)) ) try { - commitHydratedSuspenseInstance(current); + commitHydratedSuspenseInstance(current$150); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$150); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -8322,11 +8332,11 @@ module.exports = function ($$$config) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$146) { + } catch (error$152) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$146 + error$152 ); } } @@ -8404,11 +8414,11 @@ module.exports = function ($$$config) { finishedWork.memoizedProps, finishedWork ); - } catch (error$147) { + } catch (error$153) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$147 + error$153 ); } break; @@ -8440,11 +8450,11 @@ module.exports = function ($$$config) { root = finishedWork.stateNode; try { resetTextContent(root); - } catch (error$148) { + } catch (error$154) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$148 + error$154 ); } } @@ -8454,11 +8464,11 @@ module.exports = function ($$$config) { props = finishedWork.type; try { commitUpdate(root, props, current, hoistableRoot, finishedWork); - } catch (error$150) { + } catch (error$156) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$150 + error$156 ); } } @@ -8476,11 +8486,11 @@ module.exports = function ($$$config) { current = null !== current ? current.memoizedProps : root; try { commitTextUpdate(flags, current, root); - } catch (error$151) { + } catch (error$157) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$151 + error$157 ); } } @@ -8503,11 +8513,11 @@ module.exports = function ($$$config) { ) try { commitHydratedContainer(root.containerInfo); - } catch (error$152) { + } catch (error$158) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$152 + error$158 ); } if (supportsPersistence) { @@ -8515,11 +8525,11 @@ module.exports = function ($$$config) { current = root.pendingChildren; try { replaceContainerChildren(flags, current); - } catch (error$153) { + } catch (error$159) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$153 + error$159 ); } } @@ -8544,11 +8554,11 @@ module.exports = function ($$$config) { current = current.pendingChildren; try { replaceContainerChildren(flags, current); - } catch (error$157) { + } catch (error$163) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$157 + error$163 ); } } @@ -8572,11 +8582,11 @@ module.exports = function ($$$config) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$158) { + } catch (error$164) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$158 + error$164 ); } flags = finishedWork.updateQueue; @@ -8652,11 +8662,11 @@ module.exports = function ($$$config) { suspenseCallback ? hideTextInstance(props) : unhideTextInstance(props, root.memoizedProps); - } catch (error$136) { + } catch (error$141) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$136 + error$141 ); } } else if ( @@ -8742,21 +8752,21 @@ module.exports = function ($$$config) { break; } case 5: - var parent$137 = JSCompiler_inline_result.stateNode; + var parent$142 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (resetTextContent(parent$137), + (resetTextContent(parent$142), (JSCompiler_inline_result.flags &= -33)); - var before$138 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$138, parent$137); + var before$143 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$143, parent$142); break; case 3: case 4: - var parent$139 = JSCompiler_inline_result.stateNode.containerInfo, - before$140 = getHostSibling(finishedWork); + var parent$144 = JSCompiler_inline_result.stateNode.containerInfo, + before$145 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$140, - parent$139 + before$145, + parent$144 ); break; default: @@ -8837,7 +8847,7 @@ module.exports = function ($$$config) { includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$168 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -8865,16 +8875,16 @@ module.exports = function ($$$config) { } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$168 = finishedWork.updateQueue; + if (null !== current$168) { + var hiddenCallbacks = current$168.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$168.shared.hiddenCallbacks = null, current$168 = 0; + current$168 < hiddenCallbacks.length; + current$168++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$168], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -8890,7 +8900,7 @@ module.exports = function ($$$config) { includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$168 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -9241,9 +9251,9 @@ module.exports = function ($$$config) { ); break; case 22: - var instance$164 = finishedWork.stateNode; + var instance$174 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$164._visibility & 4 + ? instance$174._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -9256,7 +9266,7 @@ module.exports = function ($$$config) { finishedRoot, finishedWork ) - : ((instance$164._visibility |= 4), + : ((instance$174._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -9264,7 +9274,7 @@ module.exports = function ($$$config) { committedTransitions, includeWorkInProgressEffects )) - : ((instance$164._visibility |= 4), + : ((instance$174._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -9277,7 +9287,7 @@ module.exports = function ($$$config) { commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$164 + instance$174 ); break; case 24: @@ -9848,11 +9858,11 @@ module.exports = function ($$$config) { enableTransitionTracing) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$10 = 31 - clz32(lane), + transitions = transitionLanesMap[index$10]; null === transitions && (transitions = new Set()); transitions.add(transition); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$10] = transitions; } } root === workInProgressRoot && @@ -10124,9 +10134,9 @@ module.exports = function ($$$config) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + expirationTimes[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -10232,9 +10242,9 @@ module.exports = function ($$$config) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -10244,7 +10254,7 @@ module.exports = function ($$$config) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -10340,8 +10350,8 @@ module.exports = function ($$$config) { } workLoopSync(); break; - } catch (thrownValue$175) { - handleThrow(root, thrownValue$175); + } catch (thrownValue$188) { + handleThrow(root, thrownValue$188); } while (1); lanes && root.shellSuspendCounter++; @@ -10456,8 +10466,8 @@ module.exports = function ($$$config) { } workLoopConcurrent(); break; - } catch (thrownValue$177) { - handleThrow(root, thrownValue$177); + } catch (thrownValue$190) { + handleThrow(root, thrownValue$190); } while (1); resetContextDependencies(); @@ -10480,12 +10490,12 @@ module.exports = function ($$$config) { unitOfWork, entangledRenderLanes ); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -10503,8 +10513,8 @@ module.exports = function ($$$config) { ? previousContext : contextStackCursor$1.current; context = getMaskedContext(unitOfWork, context); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -10523,8 +10533,8 @@ module.exports = function ($$$config) { Component, unresolvedProps ); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -10535,16 +10545,20 @@ module.exports = function ($$$config) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10695,13 +10709,12 @@ module.exports = function ($$$config) { setCurrentUpdatePriority(2); var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$181 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$196 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$181 && afterActiveInstanceBlur(); + shouldFireAfterActiveInstanceBlur$196 && afterActiveInstanceBlur(); resetAfterCommit(root.containerInfo); root.current = finishedWork; commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); @@ -11517,10 +11530,12 @@ module.exports = function ($$$config) { REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), - currentOwner = null, - isArrayImpl = Array.isArray, ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix, + reentry = !1, + current = null, + isArrayImpl = Array.isArray, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, @@ -11669,8 +11684,6 @@ module.exports = function ($$$config) { rendererID = null, injectedHook = null, objectIs = "function" === typeof Object.is ? Object.is : is, - prefix, - reentry = !1, CapturedStacks = new WeakMap(), forkStack = [], forkStackIndex = 0, @@ -12204,7 +12217,7 @@ module.exports = function ($$$config) { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, COMPONENT_TYPE = 0, @@ -12628,7 +12641,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-classic-d23e956a" + reconcilerVersion: "19.0.0-www-classic-be35b40e" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactReconciler-prod.modern.js b/compiled/facebook-www/ReactReconciler-prod.modern.js index 75bb1055aedaa..66eed58f8d072 100644 --- a/compiled/facebook-www/ReactReconciler-prod.modern.js +++ b/compiled/facebook-www/ReactReconciler-prod.modern.js @@ -95,6 +95,188 @@ module.exports = function ($$$config) { } return null; } + function describeBuiltInComponentFrame(name) { + if (void 0 === prefix) + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = (match && match[1]) || ""; + } + return "\n" + prefix + name; + } + function describeNativeComponentFrame(fn, construct) { + if (!fn || reentry) return ""; + reentry = !0; + var previousPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = void 0; + 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$1) { + control = x$1; + } + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x$2) { + control = x$2; + } + (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" } + ); + try { + 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("") && + (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; + case 11: + return ( + (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber + ); + case 1: + return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; + 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; + } + } function getNearestMountedFiber(fiber) { var node = fiber, nearestMounted = fiber; @@ -142,36 +324,36 @@ module.exports = function ($$$config) { } if (a.return !== b.return) (a = parentA), (b = parentB); else { - for (var didFindChild = !1, child$1 = parentA.child; child$1; ) { - if (child$1 === a) { + for (var didFindChild = !1, child$3 = parentA.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentA; b = parentB; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentA; a = parentB; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) { - for (child$1 = parentB.child; child$1; ) { - if (child$1 === a) { + for (child$3 = parentB.child; child$3; ) { + if (child$3 === a) { didFindChild = !0; a = parentB; b = parentA; break; } - if (child$1 === b) { + if (child$3 === b) { didFindChild = !0; b = parentB; a = parentA; break; } - child$1 = child$1.sibling; + child$3 = child$3.sibling; } if (!didFindChild) throw Error(formatProdErrorMessage(189)); } @@ -413,18 +595,18 @@ module.exports = function ($$$config) { 0 < noLongerPendingLanes; ) { - var index$5 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$5; - remainingLanes[index$5] = 0; - expirationTimes[index$5] = -1; - var hiddenUpdatesForLane = hiddenUpdates[index$5]; + var index$7 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$7; + remainingLanes[index$7] = 0; + expirationTimes[index$7] = -1; + var hiddenUpdatesForLane = hiddenUpdates[index$7]; if (null !== hiddenUpdatesForLane) for ( - hiddenUpdates[index$5] = null, index$5 = 0; - index$5 < hiddenUpdatesForLane.length; - index$5++ + hiddenUpdates[index$7] = null, index$7 = 0; + index$7 < hiddenUpdatesForLane.length; + index$7++ ) { - var update = hiddenUpdatesForLane[index$5]; + var update = hiddenUpdatesForLane[index$7]; null !== update && (update.lane &= -536870913); } noLongerPendingLanes &= ~lane; @@ -444,21 +626,21 @@ module.exports = function ($$$config) { 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); + var index$8 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$8; + (lane & entangledLanes) | (root[index$8] & entangledLanes) && + (root[index$8] |= entangledLanes); rootEntangledLanes &= ~lane; } } function getTransitionsForLanes(root, lanes) { if (!enableTransitionTracing) return null; for (var transitionsForLanes = []; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - index$9 = root.transitionLanes[index$9]; - null !== index$9 && - index$9.forEach(function (transition) { + var index$11 = 31 - clz32(lanes), + lane = 1 << index$11; + index$11 = root.transitionLanes[index$11]; + null !== index$11 && + index$11.forEach(function (transition) { transitionsForLanes.push(transition); }); lanes &= ~lane; @@ -468,10 +650,10 @@ module.exports = function ($$$config) { function clearTransitionsForLanes(root, lanes) { if (enableTransitionTracing) for (; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - null !== root.transitionLanes[index$10] && - (root.transitionLanes[index$10] = null); + var index$12 = 31 - clz32(lanes), + lane = 1 << index$12; + null !== root.transitionLanes[index$12] && + (root.transitionLanes[index$12] = null); lanes &= ~lane; } } @@ -506,188 +688,6 @@ module.exports = function ($$$config) { function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } - function describeBuiltInComponentFrame(name) { - if (void 0 === prefix) - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = (match && match[1]) || ""; - } - return "\n" + prefix + name; - } - function describeNativeComponentFrame(fn, construct) { - if (!fn || reentry) return ""; - reentry = !0; - var previousPrepareStackTrace = Error.prepareStackTrace; - Error.prepareStackTrace = void 0; - 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$11) { - control = x$11; - } - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x$12) { - control = x$12; - } - (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" } - ); - try { - 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("") && - (frame = frame.replace("", 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 (fiber = describeNativeComponentFrame(fiber.type, !1)), fiber; - case 11: - return ( - (fiber = describeNativeComponentFrame(fiber.type.render, !1)), fiber - ); - case 1: - return (fiber = describeNativeComponentFrame(fiber.type, !0)), fiber; - 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; - } - } function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var stack = CapturedStacks.get(value); @@ -1004,12 +1004,12 @@ module.exports = function ($$$config) { 0 < pendingLanes; ) { - var index$3 = 31 - clz32(pendingLanes), - lane = 1 << index$3, - expirationTime = expirationTimes[index$3]; + var index$5 = 31 - clz32(pendingLanes), + lane = 1 << index$5, + expirationTime = expirationTimes[index$5]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$3] = computeExpirationTime(lane, currentTime); + expirationTimes[index$5] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); pendingLanes &= ~lane; } @@ -1257,20 +1257,20 @@ module.exports = function ($$$config) { ? (firstBaseUpdate = firstPendingUpdate) : (lastBaseUpdate.next = firstPendingUpdate); lastBaseUpdate = lastPendingUpdate; - var current = workInProgress$jscomp$0.alternate; - null !== current && - ((current = current.updateQueue), - (pendingQueue = current.lastBaseUpdate), + var current$18 = workInProgress$jscomp$0.alternate; + null !== current$18 && + ((current$18 = current$18.updateQueue), + (pendingQueue = current$18.lastBaseUpdate), pendingQueue !== lastBaseUpdate && (null === pendingQueue - ? (current.firstBaseUpdate = firstPendingUpdate) + ? (current$18.firstBaseUpdate = firstPendingUpdate) : (pendingQueue.next = firstPendingUpdate), - (current.lastBaseUpdate = lastPendingUpdate))); + (current$18.lastBaseUpdate = lastPendingUpdate))); } if (null !== firstBaseUpdate) { var newState = queue.baseState; lastBaseUpdate = 0; - current = firstPendingUpdate = lastPendingUpdate = null; + current$18 = firstPendingUpdate = lastPendingUpdate = null; pendingQueue = firstBaseUpdate; do { var updateLane = pendingQueue.lane & -536870913, @@ -1283,8 +1283,8 @@ module.exports = function ($$$config) { 0 !== updateLane && updateLane === currentEntangledLane && (didReadFromEntangledAsyncAction = !0); - null !== current && - (current = current.next = + null !== current$18 && + (current$18 = current$18.next = { lane: 0, tag: pendingQueue.tag, @@ -1341,10 +1341,10 @@ module.exports = function ($$$config) { callback: pendingQueue.callback, next: null }), - null === current - ? ((firstPendingUpdate = current = isHiddenUpdate), + null === current$18 + ? ((firstPendingUpdate = current$18 = isHiddenUpdate), (lastPendingUpdate = newState)) - : (current = current.next = isHiddenUpdate), + : (current$18 = current$18.next = isHiddenUpdate), (lastBaseUpdate |= updateLane); pendingQueue = pendingQueue.next; if (null === pendingQueue) @@ -1357,10 +1357,10 @@ module.exports = function ($$$config) { (queue.lastBaseUpdate = isHiddenUpdate), (queue.shared.pending = null); } while (1); - null === current && (lastPendingUpdate = newState); + null === current$18 && (lastPendingUpdate = newState); queue.baseState = lastPendingUpdate; queue.firstBaseUpdate = firstPendingUpdate; - queue.lastBaseUpdate = current; + queue.lastBaseUpdate = current$18; null === firstBaseUpdate && (queue.shared.lanes = 0); workInProgressRootSkippedLanes |= lastBaseUpdate; workInProgress$jscomp$0.lanes = lastBaseUpdate; @@ -2221,9 +2221,9 @@ module.exports = function ($$$config) { push(suspenseHandlerStackCursor, fiber), null === shellBoundary) ) { - var current = fiber.alternate; - null !== current && - null !== current.memoizedState && + var current$40 = fiber.alternate; + null !== current$40 && + null !== current$40.memoizedState && (shellBoundary = fiber); } } else reuseSuspenseHandlerOnStack(fiber); @@ -2451,16 +2451,16 @@ module.exports = function ($$$config) { updateQueue = currentlyRenderingFiber$1.updateQueue; null !== updateQueue && (memoCache = updateQueue.memoCache); if (null == memoCache) { - var current = currentlyRenderingFiber$1.alternate; - null !== current && - ((current = current.updateQueue), - null !== current && - ((current = current.memoCache), - null != current && + var current$42 = currentlyRenderingFiber$1.alternate; + null !== current$42 && + ((current$42 = current$42.updateQueue), + null !== current$42 && + ((current$42 = current$42.memoCache), + null != current$42 && (memoCache = { data: enableNoCloningMemoCache - ? current.data - : current.data.map(function (array) { + ? current$42.data + : current$42.data.map(function (array) { return array.slice(); }), index: 0 @@ -2475,11 +2475,11 @@ module.exports = function ($$$config) { if (void 0 === updateQueue) for ( updateQueue = memoCache.data[memoCache.index] = Array(size), - current = 0; - current < size; - current++ + current$42 = 0; + current$42 < size; + current$42++ ) - updateQueue[current] = REACT_MEMO_CACHE_SENTINEL; + updateQueue[current$42] = REACT_MEMO_CACHE_SENTINEL; memoCache.index++; return updateQueue; } @@ -2512,7 +2512,7 @@ module.exports = function ($$$config) { var newBaseQueueFirst = (baseFirst = null), newBaseQueueLast = null, update = current, - didReadFromEntangledAsyncAction$39 = !1; + didReadFromEntangledAsyncAction$43 = !1; do { var updateLane = update.lane & -536870913; if ( @@ -2533,11 +2533,11 @@ module.exports = function ($$$config) { next: null }), updateLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$39 = !0); + (didReadFromEntangledAsyncAction$43 = !0); else if ((renderLanes & revertLane) === revertLane) { update = update.next; revertLane === currentEntangledLane && - (didReadFromEntangledAsyncAction$39 = !0); + (didReadFromEntangledAsyncAction$43 = !0); continue; } else (updateLane = { @@ -2583,7 +2583,7 @@ module.exports = function ($$$config) { if ( !objectIs(pendingQueue, hook.memoizedState) && ((didReceiveUpdate = !0), - didReadFromEntangledAsyncAction$39 && + didReadFromEntangledAsyncAction$43 && ((reducer = currentEntangledActionThenable), null !== reducer)) ) throw reducer; @@ -3360,9 +3360,9 @@ module.exports = function ($$$config) { (disableDefaultPropsExceptForClasses || !alreadyResolvedDefaultProps) ) { newProps === baseProps && (newProps = assign({}, newProps)); - for (var propName$44 in Component) - void 0 === newProps[propName$44] && - (newProps[propName$44] = Component[propName$44]); + for (var propName$48 in Component) + void 0 === newProps[propName$48] && + (newProps[propName$48] = Component[propName$48]); } return newProps; } @@ -4057,7 +4057,7 @@ module.exports = function ($$$config) { return workInProgress.child; } function updateClassComponent( - current, + current$jscomp$0, workInProgress, Component, nextProps, @@ -4119,7 +4119,7 @@ module.exports = function ($$$config) { "function" === typeof context.componentDidMount && (workInProgress.flags |= 4194308); nextProps = !0; - } else if (null === current) { + } else if (null === current$jscomp$0) { context = workInProgress.stateNode; var unresolvedOldProps = workInProgress.memoizedProps, oldProps = resolveClassComponentProps( @@ -4197,7 +4197,7 @@ module.exports = function ($$$config) { (nextProps = !1)); } else { context = workInProgress.stateNode; - cloneUpdateQueue(current, workInProgress); + cloneUpdateQueue(current$jscomp$0, workInProgress); contextType = workInProgress.memoizedProps; contextType$jscomp$0 = resolveClassComponentProps( Component, @@ -4235,9 +4235,9 @@ module.exports = function ($$$config) { oldState !== newState || hasForceUpdate || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies)) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies)) ? ("function" === typeof unresolvedOldProps && (applyDerivedStateFromProps( workInProgress, @@ -4258,9 +4258,9 @@ module.exports = function ($$$config) { oldProps ) || (enableLazyContextPropagation && - null !== current && - null !== current.dependencies && - checkIfContextChanged(current.dependencies))) + null !== current$jscomp$0 && + null !== current$jscomp$0.dependencies && + checkIfContextChanged(current$jscomp$0.dependencies))) ? (oldContext || ("function" !== typeof context.UNSAFE_componentWillUpdate && "function" !== typeof context.componentWillUpdate) || @@ -4277,12 +4277,12 @@ module.exports = function ($$$config) { "function" === typeof context.getSnapshotBeforeUpdate && (workInProgress.flags |= 1024)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (workInProgress.memoizedProps = nextProps), (workInProgress.memoizedState = newState)), @@ -4291,30 +4291,30 @@ module.exports = function ($$$config) { (context.context = oldProps), (nextProps = contextType$jscomp$0)) : ("function" !== typeof context.componentDidUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 4), "function" !== typeof context.getSnapshotBeforeUpdate || - (contextType === current.memoizedProps && - oldState === current.memoizedState) || + (contextType === current$jscomp$0.memoizedProps && + oldState === current$jscomp$0.memoizedState) || (workInProgress.flags |= 1024), (nextProps = !1)); } context = nextProps; - markRef(current, workInProgress); + markRef(current$jscomp$0, workInProgress); nextProps = 0 !== (workInProgress.flags & 128); context || nextProps ? ((context = workInProgress.stateNode), - (currentOwner = workInProgress), + (current = workInProgress), (Component = nextProps && "function" !== typeof Component.getDerivedStateFromError ? null : context.render()), (workInProgress.flags |= 1), - null !== current && nextProps + null !== current$jscomp$0 && nextProps ? ((workInProgress.child = reconcileChildFibers( workInProgress, - current.child, + current$jscomp$0.child, null, renderLanes )), @@ -4324,15 +4324,20 @@ module.exports = function ($$$config) { Component, renderLanes ))) - : reconcileChildren(current, workInProgress, Component, renderLanes), + : reconcileChildren( + current$jscomp$0, + workInProgress, + Component, + renderLanes + ), (workInProgress.memoizedState = context.state), - (current = workInProgress.child)) - : (current = bailoutOnAlreadyFinishedWork( - current, + (current$jscomp$0 = workInProgress.child)) + : (current$jscomp$0 = bailoutOnAlreadyFinishedWork( + current$jscomp$0, workInProgress, renderLanes )); - return current; + return current$jscomp$0; } function mountHostRootWithoutHydrating( current, @@ -6138,44 +6143,44 @@ module.exports = function ($$$config) { needsVisibilityToggle = needsVisibilityToggle.sibling; } else if (supportsPersistence) - for (var node$88 = workInProgress.child; null !== node$88; ) { - if (5 === node$88.tag) { - var instance = node$88.stateNode; + for (var node$93 = workInProgress.child; null !== node$93; ) { + if (5 === node$93.tag) { + var instance = node$93.stateNode; needsVisibilityToggle && isHidden && (instance = cloneHiddenInstance( instance, - node$88.type, - node$88.memoizedProps + node$93.type, + node$93.memoizedProps )); appendInitialChild(parent, instance); - } else if (6 === node$88.tag) - (instance = node$88.stateNode), + } else if (6 === node$93.tag) + (instance = node$93.stateNode), needsVisibilityToggle && isHidden && (instance = cloneHiddenTextInstance( instance, - node$88.memoizedProps + node$93.memoizedProps )), appendInitialChild(parent, instance); - else if (4 !== node$88.tag) - if (22 === node$88.tag && null !== node$88.memoizedState) - (instance = node$88.child), - null !== instance && (instance.return = node$88), - appendAllChildren(parent, node$88, !0, !0); - else if (null !== node$88.child) { - node$88.child.return = node$88; - node$88 = node$88.child; + else if (4 !== node$93.tag) + if (22 === node$93.tag && null !== node$93.memoizedState) + (instance = node$93.child), + null !== instance && (instance.return = node$93), + appendAllChildren(parent, node$93, !0, !0); + else if (null !== node$93.child) { + node$93.child.return = node$93; + node$93 = node$93.child; continue; } - if (node$88 === workInProgress) break; - for (; null === node$88.sibling; ) { - if (null === node$88.return || node$88.return === workInProgress) + if (node$93 === workInProgress) break; + for (; null === node$93.sibling; ) { + if (null === node$93.return || node$93.return === workInProgress) return; - node$88 = node$88.return; + node$93 = node$93.return; } - node$88.sibling.return = node$88.return; - node$88 = node$88.sibling; + node$93.sibling.return = node$93.return; + node$93 = node$93.sibling; } } function appendAllChildrenToContainer( @@ -6248,31 +6253,31 @@ module.exports = function ($$$config) { current.memoizedProps !== newProps && markUpdate(workInProgress); else if (supportsPersistence) { var currentInstance = current.stateNode, - oldProps$91 = current.memoizedProps; + oldProps$96 = current.memoizedProps; if ( (current = doesRequireClone(current, workInProgress)) || - oldProps$91 !== newProps + oldProps$96 !== newProps ) { var currentHostContext = contextStackCursor.current; - oldProps$91 = cloneInstance( + oldProps$96 = cloneInstance( currentInstance, type, - oldProps$91, + oldProps$96, newProps, !current, null ); - oldProps$91 === currentInstance + oldProps$96 === currentInstance ? (workInProgress.stateNode = currentInstance) : (finalizeInitialChildren( - oldProps$91, + oldProps$96, type, newProps, currentHostContext ) && markUpdate(workInProgress), - (workInProgress.stateNode = oldProps$91), + (workInProgress.stateNode = oldProps$96), current - ? appendAllChildren(oldProps$91, workInProgress, !1, !1) + ? appendAllChildren(oldProps$96, workInProgress, !1, !1) : markUpdate(workInProgress)); } else workInProgress.stateNode = currentInstance; } @@ -6322,14 +6327,14 @@ module.exports = function ($$$config) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$93 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$93 = lastTailNode), + for (var lastTailNode$98 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$98 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$93 + null === lastTailNode$98 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$93.sibling = null); + : (lastTailNode$98.sibling = null); } } function bubbleProperties(completedWork) { @@ -6339,19 +6344,19 @@ module.exports = function ($$$config) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$94 = completedWork.child; null !== child$94; ) - (newChildLanes |= child$94.lanes | child$94.childLanes), - (subtreeFlags |= child$94.subtreeFlags & 31457280), - (subtreeFlags |= child$94.flags & 31457280), - (child$94.return = completedWork), - (child$94 = child$94.sibling); + for (var child$99 = completedWork.child; null !== child$99; ) + (newChildLanes |= child$99.lanes | child$99.childLanes), + (subtreeFlags |= child$99.subtreeFlags & 31457280), + (subtreeFlags |= child$99.flags & 31457280), + (child$99.return = completedWork), + (child$99 = child$99.sibling); else - for (child$94 = completedWork.child; null !== child$94; ) - (newChildLanes |= child$94.lanes | child$94.childLanes), - (subtreeFlags |= child$94.subtreeFlags), - (subtreeFlags |= child$94.flags), - (child$94.return = completedWork), - (child$94 = child$94.sibling); + for (child$99 = completedWork.child; null !== child$99; ) + (newChildLanes |= child$99.lanes | child$99.childLanes), + (subtreeFlags |= child$99.subtreeFlags), + (subtreeFlags |= child$99.flags), + (child$99.return = completedWork), + (child$99 = child$99.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -7006,8 +7011,8 @@ module.exports = function ($$$config) { else if ("function" === typeof ref) try { ref(null); - } catch (error$124) { - captureCommitPhaseError(current, nearestMountedAncestor, error$124); + } catch (error$129) { + captureCommitPhaseError(current, nearestMountedAncestor, error$129); } else ref.current = null; } @@ -7230,11 +7235,11 @@ module.exports = function ($$$config) { current, finishedRoot.__reactInternalSnapshotBeforeUpdate ); - } catch (error$125) { + } catch (error$130) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$125 + error$130 ); } } @@ -7797,18 +7802,19 @@ module.exports = function ($$$config) { } function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { if (supportsHydration && null === finishedWork.memoizedState) { - var current = finishedWork.alternate; + var current$141 = finishedWork.alternate; if ( - null !== current && - ((current = current.memoizedState), - null !== current && ((current = current.dehydrated), null !== current)) + null !== current$141 && + ((current$141 = current$141.memoizedState), + null !== current$141 && + ((current$141 = current$141.dehydrated), null !== current$141)) ) try { - commitHydratedSuspenseInstance(current); + commitHydratedSuspenseInstance(current$141); var hydrationCallbacks = finishedRoot.hydrationCallbacks; if (null !== hydrationCallbacks) { var onHydrated = hydrationCallbacks.onHydrated; - onHydrated && onHydrated(current); + onHydrated && onHydrated(current$141); } } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); @@ -7927,11 +7933,11 @@ module.exports = function ($$$config) { } try { commitHookEffectListUnmount(5, finishedWork, finishedWork.return); - } catch (error$137) { + } catch (error$143) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$137 + error$143 ); } } @@ -8009,11 +8015,11 @@ module.exports = function ($$$config) { finishedWork.memoizedProps, finishedWork ); - } catch (error$138) { + } catch (error$144) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$138 + error$144 ); } break; @@ -8045,11 +8051,11 @@ module.exports = function ($$$config) { root = finishedWork.stateNode; try { resetTextContent(root); - } catch (error$139) { + } catch (error$145) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$139 + error$145 ); } } @@ -8059,11 +8065,11 @@ module.exports = function ($$$config) { props = finishedWork.type; try { commitUpdate(root, props, current, hoistableRoot, finishedWork); - } catch (error$141) { + } catch (error$147) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$141 + error$147 ); } } @@ -8081,11 +8087,11 @@ module.exports = function ($$$config) { current = null !== current ? current.memoizedProps : root; try { commitTextUpdate(flags, current, root); - } catch (error$142) { + } catch (error$148) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$142 + error$148 ); } } @@ -8108,11 +8114,11 @@ module.exports = function ($$$config) { ) try { commitHydratedContainer(root.containerInfo); - } catch (error$143) { + } catch (error$149) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$143 + error$149 ); } if (supportsPersistence) { @@ -8120,11 +8126,11 @@ module.exports = function ($$$config) { current = root.pendingChildren; try { replaceContainerChildren(flags, current); - } catch (error$144) { + } catch (error$150) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$144 + error$150 ); } } @@ -8149,11 +8155,11 @@ module.exports = function ($$$config) { current = current.pendingChildren; try { replaceContainerChildren(flags, current); - } catch (error$148) { + } catch (error$154) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$148 + error$154 ); } } @@ -8177,11 +8183,11 @@ module.exports = function ($$$config) { null !== retryQueue && suspenseCallback(new Set(retryQueue)); } } - } catch (error$149) { + } catch (error$155) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$149 + error$155 ); } flags = finishedWork.updateQueue; @@ -8253,11 +8259,11 @@ module.exports = function ($$$config) { suspenseCallback ? hideTextInstance(props) : unhideTextInstance(props, root.memoizedProps); - } catch (error$127) { + } catch (error$132) { captureCommitPhaseError( finishedWork, finishedWork.return, - error$127 + error$132 ); } } else if ( @@ -8343,21 +8349,21 @@ module.exports = function ($$$config) { break; } case 5: - var parent$128 = JSCompiler_inline_result.stateNode; + var parent$133 = JSCompiler_inline_result.stateNode; JSCompiler_inline_result.flags & 32 && - (resetTextContent(parent$128), + (resetTextContent(parent$133), (JSCompiler_inline_result.flags &= -33)); - var before$129 = getHostSibling(finishedWork); - insertOrAppendPlacementNode(finishedWork, before$129, parent$128); + var before$134 = getHostSibling(finishedWork); + insertOrAppendPlacementNode(finishedWork, before$134, parent$133); break; case 3: case 4: - var parent$130 = JSCompiler_inline_result.stateNode.containerInfo, - before$131 = getHostSibling(finishedWork); + var parent$135 = JSCompiler_inline_result.stateNode.containerInfo, + before$136 = getHostSibling(finishedWork); insertOrAppendPlacementNodeIntoContainer( finishedWork, - before$131, - parent$130 + before$136, + parent$135 ); break; default: @@ -8438,7 +8444,7 @@ module.exports = function ($$$config) { includeWorkInProgressEffects = includeWorkInProgressEffects && 0 !== (parentFiber.subtreeFlags & 8772); for (parentFiber = parentFiber.child; null !== parentFiber; ) { - var current = parentFiber.alternate, + var current$159 = parentFiber.alternate, finishedRoot = finishedRoot$jscomp$0, finishedWork = parentFiber, flags = finishedWork.flags; @@ -8466,16 +8472,16 @@ module.exports = function ($$$config) { } catch (error) { captureCommitPhaseError(finishedWork, finishedWork.return, error); } - current = finishedWork.updateQueue; - if (null !== current) { - var hiddenCallbacks = current.shared.hiddenCallbacks; + current$159 = finishedWork.updateQueue; + if (null !== current$159) { + var hiddenCallbacks = current$159.shared.hiddenCallbacks; if (null !== hiddenCallbacks) for ( - current.shared.hiddenCallbacks = null, current = 0; - current < hiddenCallbacks.length; - current++ + current$159.shared.hiddenCallbacks = null, current$159 = 0; + current$159 < hiddenCallbacks.length; + current$159++ ) - callCallback(hiddenCallbacks[current], finishedRoot); + callCallback(hiddenCallbacks[current$159], finishedRoot); } includeWorkInProgressEffects && flags & 64 && @@ -8491,7 +8497,7 @@ module.exports = function ($$$config) { includeWorkInProgressEffects ); includeWorkInProgressEffects && - null === current && + null === current$159 && flags & 4 && commitHostComponentMount(finishedWork); safelyAttachRef(finishedWork, finishedWork.return); @@ -8834,9 +8840,9 @@ module.exports = function ($$$config) { ); break; case 22: - var instance$155 = finishedWork.stateNode; + var instance$165 = finishedWork.stateNode; null !== finishedWork.memoizedState - ? instance$155._visibility & 4 + ? instance$165._visibility & 4 ? recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8848,7 +8854,7 @@ module.exports = function ($$$config) { finishedRoot, finishedWork ) - : ((instance$155._visibility |= 4), + : ((instance$165._visibility |= 4), recursivelyTraverseReconnectPassiveEffects( finishedRoot, finishedWork, @@ -8861,7 +8867,7 @@ module.exports = function ($$$config) { commitOffscreenPassiveMountEffects( finishedWork.alternate, finishedWork, - instance$155 + instance$165 ); break; case 24: @@ -9428,11 +9434,11 @@ module.exports = function ($$$config) { enableTransitionTracing)) ) { var transitionLanesMap = root.transitionLanes, - index$8 = 31 - clz32(lane), - transitions = transitionLanesMap[index$8]; + index$10 = 31 - clz32(lane), + transitions = transitionLanesMap[index$10]; null === transitions && (transitions = new Set()); transitions.add(fiber); - transitionLanesMap[index$8] = transitions; + transitionLanesMap[index$10] = transitions; } root === workInProgressRoot && (0 === (executionContext & 2) && @@ -9699,9 +9705,9 @@ module.exports = function ($$$config) { 0 < lanes; ) { - var index$4 = 31 - clz32(lanes), - lane = 1 << index$4; - expirationTimes[index$4] = -1; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6; + expirationTimes[index$6] = -1; lanes &= ~lane; } 0 !== spawnedLane && @@ -9807,9 +9813,9 @@ module.exports = function ($$$config) { 0 < allEntangledLanes; ) { - var index$2 = 31 - clz32(allEntangledLanes), - lane = 1 << index$2; - lanes |= root[index$2]; + var index$4 = 31 - clz32(allEntangledLanes), + lane = 1 << index$4; + lanes |= root[index$4]; allEntangledLanes &= ~lane; } entangledRenderLanes = lanes; @@ -9819,7 +9825,7 @@ module.exports = function ($$$config) { function handleThrow(root, thrownValue) { currentlyRenderingFiber$1 = null; ReactSharedInternals.H = ContextOnlyDispatcher; - currentOwner = null; + current = null; thrownValue === SuspenseException ? ((thrownValue = getSuspendedThenable()), (workInProgressSuspendedReason = @@ -9915,8 +9921,8 @@ module.exports = function ($$$config) { } workLoopSync(); break; - } catch (thrownValue$166) { - handleThrow(root, thrownValue$166); + } catch (thrownValue$179) { + handleThrow(root, thrownValue$179); } while (1); lanes && root.shellSuspendCounter++; @@ -10031,8 +10037,8 @@ module.exports = function ($$$config) { } workLoopConcurrent(); break; - } catch (thrownValue$168) { - handleThrow(root, thrownValue$168); + } catch (thrownValue$181) { + handleThrow(root, thrownValue$181); } while (1); resetContextDependencies(); @@ -10055,12 +10061,12 @@ module.exports = function ($$$config) { unitOfWork, entangledRenderLanes ); + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; null === next ? completeUnitOfWork(unitOfWork) : (workInProgress = next); - currentOwner = null; } function replaySuspendedUnitOfWork(unitOfWork) { - var current = unitOfWork.alternate; + var current$jscomp$0 = unitOfWork.alternate; switch (unitOfWork.tag) { case 15: case 0: @@ -10074,8 +10080,8 @@ module.exports = function ($$$config) { Component, unresolvedProps ); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -10094,8 +10100,8 @@ module.exports = function ($$$config) { Component, unresolvedProps ); - current = replayFunctionComponent( - current, + current$jscomp$0 = replayFunctionComponent( + current$jscomp$0, unitOfWork, unresolvedProps, Component, @@ -10106,16 +10112,20 @@ module.exports = function ($$$config) { case 5: resetHooksOnUnwind(unitOfWork); default: - unwindInterruptedWork(current, unitOfWork), + unwindInterruptedWork(current$jscomp$0, unitOfWork), (unitOfWork = workInProgress = resetWorkInProgress(unitOfWork, entangledRenderLanes)), - (current = beginWork(current, unitOfWork, entangledRenderLanes)); + (current$jscomp$0 = beginWork( + current$jscomp$0, + unitOfWork, + entangledRenderLanes + )); } + current = null; unitOfWork.memoizedProps = unitOfWork.pendingProps; - null === current + null === current$jscomp$0 ? completeUnitOfWork(unitOfWork) - : (workInProgress = current); - currentOwner = null; + : (workInProgress = current$jscomp$0); } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { resetContextDependencies(); @@ -10266,13 +10276,12 @@ module.exports = function ($$$config) { setCurrentUpdatePriority(2); var prevExecutionContext = executionContext; executionContext |= 4; - currentOwner = null; - var shouldFireAfterActiveInstanceBlur$172 = commitBeforeMutationEffects( + var shouldFireAfterActiveInstanceBlur$187 = commitBeforeMutationEffects( root, finishedWork ); commitMutationEffectsOnFiber(finishedWork, root); - shouldFireAfterActiveInstanceBlur$172 && afterActiveInstanceBlur(); + shouldFireAfterActiveInstanceBlur$187 && afterActiveInstanceBlur(); resetAfterCommit(root.containerInfo); root.current = finishedWork; commitLayoutEffectOnFiber(root, finishedWork.alternate, finishedWork); @@ -11047,10 +11056,12 @@ module.exports = function ($$$config) { REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), - currentOwner = null, - isArrayImpl = Array.isArray, ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, + prefix, + reentry = !1, + current = null, + isArrayImpl = Array.isArray, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, @@ -11196,8 +11207,6 @@ module.exports = function ($$$config) { rendererID = null, injectedHook = null, objectIs = "function" === typeof Object.is ? Object.is : is, - prefix, - reentry = !1, CapturedStacks = new WeakMap(), forkStack = [], forkStackIndex = 0, @@ -11731,7 +11740,7 @@ module.exports = function ($$$config) { return cacheForType; }, getOwner: function () { - return currentOwner; + return current; } }, COMPONENT_TYPE = 0, @@ -12145,7 +12154,7 @@ module.exports = function ($$$config) { scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "19.0.0-www-modern-8adc81b7" + reconcilerVersion: "19.0.0-www-modern-24c867c9" }; if ("undefined" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) devToolsConfig = !1; diff --git a/compiled/facebook-www/ReactTestRenderer-dev.classic.js b/compiled/facebook-www/ReactTestRenderer-dev.classic.js index 7b78ea45648a6..bdcd21afa8e76 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.classic.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.classic.js @@ -556,2229 +556,2291 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; -} -function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$1(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - - - var a = fiber; - var b = alternate; - - while (true) { - var parentA = a.return; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - if (parentA === null) { - // We're at the root. - break; - } + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - var parentB = parentA.alternate; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - if (parentA.child === parentB.child) { - var child = parentA.child; + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - throw new Error('Unable to find node on an unmounted component.'); - } - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } } - - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; } - - _child = _child.sibling; } - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + return [null, null]; + } + }; // $FlowFixMe[prop-missing] - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - _child = _child.sibling; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - if (!didFindChild) { - throw new 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 (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; } - } - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } - var child = node.child; + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - while (child !== null) { - var match = findCurrentHostFiberImpl(child); - if (match !== null) { - return match; + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } } + } finally { + reentry = false; - child = child.sibling; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } } - return null; + return syntheticFrame; } -function isFiberSuspenseAndTimedOut(fiber) { - var memoizedState = fiber.memoizedState; - return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } } - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler$1.unstable_cancelCallback; -var shouldYield = Scheduler$1.unstable_shouldYield; -var requestPaint = Scheduler$1.unstable_requestPaint; -var now$1 = Scheduler$1.unstable_now; -var ImmediatePriority = Scheduler$1.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler$1.unstable_NormalPriority; -var IdlePriority = Scheduler$1.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); -function disabledLog() {} + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } + case ClassComponent: + return describeClassComponentFrame(fiber.type); - disabledDepth++; + default: + return ''; } } -function reenableLogs() { - { - disabledDepth--; - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } + do { + info += describeFiber(node); - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; -var rendererID = null; -var injectedHook = null; -var hasLoggedError = false; -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; } +} - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + var owner = current._debugOwner; - return true; + if (owner != null) { + return getComponentNameFromOwner(owner); + } } - try { - if (enableSchedulingProfiler) ; + return null; +} - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); - } + + return getStackByFiberInDevAndProd(current); } +} - if (hook.checkDCE) { - // This is the real DevTools. - return true; - } else { - // This is likely a hook installed by Fast Refresh runtime. - return false; +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); } } -function onScheduleRoot(root, children) { +function setCurrentDebugFiberInDEV(fiber) { { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } + setCurrentFiber(fiber); } } -function onCommitRoot(root, eventPriority) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } - if (enableProfilerTimer) { - var schedulerPriority; + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } - switch (eventPriority) { - case DiscreteEventPriority: - schedulerPriority = ImmediatePriority; - break; + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} - case ContinuousEventPriority: - schedulerPriority = UserBlockingPriority; - break; +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; - case DefaultEventPriority: - schedulerPriority = NormalPriority$1; - break; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; - case IdleEventPriority: - schedulerPriority = IdlePriority; - break; + do { + node = nextNode; - default: - schedulerPriority = NormalPriority$1; - break; - } + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null - injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; } } -} -function onPostCommitRoot(root) { - if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { - try { - injectedHook.onPostCommitFiberRoot(rendererID, root); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } - } - } + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; } -function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; +function isFiberMounted(fiber) { + return getNearestMountedFiber(fiber) === fiber; +} +function isMounted(component) { + { + var owner = current; - error('React instrumentation encountered an error: %s', err); - } + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); } + + instance._warnedAboutRefsInRender = true; } } -} -function setIsStrictModeForDevtools(newIsStrictMode) { - { - if (newIsStrictMode) { - disableLogs(); - } else { - reenableLogs(); - } + + var fiber = get(component); + + if (!fiber) { + return false; } -} // Profiler API hooks -function injectProfilingHooks(profilingHooks) { + return getNearestMountedFiber(fiber) === fiber; } -function getLaneLabelMap() { - { - return null; +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); } } -var NoMode = -/* */ -0; // TODO: Remove ConcurrentMode by reading from the root tag instead +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; -var ConcurrentMode = -/* */ -1; -var ProfileMode = -/* */ -2; -var StrictLegacyMode = -/* */ -8; -var StrictEffectsMode = -/* */ -16; -var ConcurrentUpdatesByDefaultMode = -/* */ -32; -var NoStrictPassiveEffectsMode = -/* */ -64; + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); -// TODO: This is pretty well supported by browsers. Maybe we can drop it. -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); + } -var log = Math.log; -var LN2 = Math.LN2; + if (nearestMounted !== fiber) { + return null; + } -function clz32Fallback(x) { - var asUint = x >>> 0; + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. - if (asUint === 0) { - return 32; - } - return 31 - (log(asUint) / LN2 | 0) | 0; -} + var a = fiber; + var b = alternate; -// If those values are changed that package should be rebuilt and redeployed. + while (true) { + var parentA = a.return; -var TotalLanes = 31; -var NoLanes = -/* */ -0; -var NoLane = -/* */ -0; -var SyncHydrationLane = -/* */ -1; -var SyncLane = -/* */ -2; -var SyncLaneIndex = 1; -var InputContinuousHydrationLane = -/* */ -4; -var InputContinuousLane = -/* */ -8; -var DefaultHydrationLane = -/* */ -16; -var DefaultLane = -/* */ -32; -var SyncUpdateLanes = SyncLane | InputContinuousLane | DefaultLane ; -var TransitionHydrationLane = -/* */ -64; -var TransitionLanes = -/* */ -4194176; -var TransitionLane1 = -/* */ -128; -var TransitionLane2 = -/* */ -256; -var TransitionLane3 = -/* */ -512; -var TransitionLane4 = -/* */ -1024; -var TransitionLane5 = -/* */ -2048; -var TransitionLane6 = -/* */ -4096; -var TransitionLane7 = -/* */ -8192; -var TransitionLane8 = -/* */ -16384; -var TransitionLane9 = -/* */ -32768; -var TransitionLane10 = -/* */ -65536; -var TransitionLane11 = -/* */ -131072; -var TransitionLane12 = -/* */ -262144; -var TransitionLane13 = -/* */ -524288; -var TransitionLane14 = -/* */ -1048576; -var TransitionLane15 = -/* */ -2097152; -var RetryLanes = -/* */ -62914560; -var RetryLane1 = -/* */ -4194304; -var RetryLane2 = -/* */ -8388608; -var RetryLane3 = -/* */ -16777216; -var RetryLane4 = -/* */ -33554432; -var SomeRetryLane = RetryLane1; -var SelectiveHydrationLane = -/* */ -67108864; -var NonIdleLanes = -/* */ -134217727; -var IdleHydrationLane = -/* */ -134217728; -var IdleLane = -/* */ -268435456; -var OffscreenLane = -/* */ -536870912; -var DeferredLane = -/* */ -1073741824; // Any lane that might schedule an update. This is used to detect infinite -// update loops, so it doesn't include hydration lanes or retries. + if (parentA === null) { + // We're at the root. + break; + } -var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) -var NoTimestamp = -1; -var nextTransitionLane = TransitionLane1; -var nextRetryLane = RetryLane1; + var parentB = parentA.alternate; -function getHighestPriorityLanes(lanes) { - { - var pendingSyncLanes = lanes & SyncUpdateLanes; + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; - if (pendingSyncLanes !== 0) { - return pendingSyncLanes; - } - } + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. - switch (getHighestPriorityLane(lanes)) { - case SyncHydrationLane: - return SyncHydrationLane; - case SyncLane: - return SyncLane; + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. - case InputContinuousHydrationLane: - return InputContinuousHydrationLane; - case InputContinuousLane: - return InputContinuousLane; + if (parentA.child === parentB.child) { + var child = parentA.child; - case DefaultHydrationLane: - return DefaultHydrationLane; + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } - case DefaultLane: - return DefaultLane; + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } - case TransitionHydrationLane: - return TransitionHydrationLane; + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return lanes & TransitionLanes; - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - return lanes & RetryLanes; + throw new Error('Unable to find node on an unmounted component.'); + } - case SelectiveHydrationLane: - return SelectiveHydrationLane; + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; - case IdleHydrationLane: - return IdleHydrationLane; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } - case IdleLane: - return IdleLane; + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } - case OffscreenLane: - return OffscreenLane; + _child = _child.sibling; + } - case DeferredLane: - // This shouldn't be reachable because deferred work is always entangled - // with something else. - return NoLanes; + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } - return lanes; - } -} + _child = _child.sibling; + } -function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; + if (!didFindChild) { + throw new 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 (pendingLanes === NoLanes) { - return NoLanes; - } + if (a.alternate !== b) { + throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); + } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. - var nextLanes = NoLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); + } - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - } - } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; + return alternate; +} +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; +} - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - } - } - } +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + var child = node.child; - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - var nextLane = getHighestPriorityLane(nextLanes); - var wipLane = getHighestPriorityLane(wipLanes); + while (child !== null) { + var match = findCurrentHostFiberImpl(child); - if ( // Tests whether the next lane is equal or lower priority than the wip - // one. This works because the bits decrease in priority as you go left. - nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The - // only difference between default updates and transition updates is that - // default updates do not support refresh transitions. - nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { - // Keep working on the existing in-progress tree. Do not interrupt. - return wipLanes; + if (match !== null) { + return match; } + + child = child.sibling; } - return nextLanes; + return null; } -function getEntangledLanes(root, renderLanes) { - var entangledLanes = renderLanes; - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { - // When updates are sync by default, we entangle continuous priority updates - // and default updates, so they render in the same batch. The only reason - // they use separate lanes is because continuous updates should interrupt - // transitions, but default updates should not. - entangledLanes |= entangledLanes & DefaultLane; - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // TODO: Reconsider this. The counter-argument is that the partial work - // represents an intermediate state, which we don't want to show to the user. - // And by spending extra time finishing it, we're increasing the amount of - // time it takes to show the final state, which is what they are actually - // waiting for. - // - // For those exceptions where entanglement is semantically important, - // we should ensure that there is no partial work at the - // time we apply the entanglement. +function isFiberSuspenseAndTimedOut(fiber) { + var memoizedState = fiber.memoizedState; + return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; +} +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - var allEntangledLanes = root.entangledLanes; +function isArray(a) { + return isArrayImpl(a); +} - if (allEntangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = entangledLanes & allEntangledLanes; +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler$1.unstable_cancelCallback; +var shouldYield = Scheduler$1.unstable_shouldYield; +var requestPaint = Scheduler$1.unstable_requestPaint; +var now$1 = Scheduler$1.unstable_now; +var ImmediatePriority = Scheduler$1.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler$1.unstable_NormalPriority; +var IdlePriority = Scheduler$1.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entangledLanes |= entanglements[index]; - lanes &= ~lane; - } +var rendererID = null; +var injectedHook = null; +var hasLoggedError = false; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // No DevTools + return false; } - return entangledLanes; -} + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; -function computeExpirationTime(lane, currentTime) { - switch (lane) { - case SyncHydrationLane: - case SyncLane: - case InputContinuousHydrationLane: - case InputContinuousLane: - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. - // When we made it larger, a product metric in www regressed, suggesting - // there's a user interaction that's being starved by a series of - // synchronous updates. If that theory is correct, the proper solution is - // to fix the starvation. However, this scenario supports the idea that - // expiration times are an important safeguard when starvation - // does happen. - return currentTime + syncLaneExpirationMs; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } - case DefaultHydrationLane: - case DefaultLane: - case TransitionHydrationLane: - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return currentTime + transitionLaneExpirationMs; + if (!hook.supportsFiber) { + { + error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); + } // DevTools exists, even though it doesn't support Fiber. - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - // TODO: Retries should be allowed to expire if they are CPU bound for - // too long, but when I made this change it caused a spike in browser - // crashes. There must be some other underlying bug; not super urgent but - // ideally should figure out why and fix it. Unfortunately we don't have - // a repro for the crashes, only detected via production metrics. - return NoTimestamp; - case SelectiveHydrationLane: - case IdleHydrationLane: - case IdleLane: - case OffscreenLane: - case DeferredLane: - // Anything idle priority or lower should never expire. - return NoTimestamp; + return true; + } - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } + try { + if (enableSchedulingProfiler) ; - return NoTimestamp; + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + + injectedHook = hook; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + error('React instrumentation encountered an error: %s.', err); + } + } + + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; } } +function onScheduleRoot(root, children) { + { + if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { + try { + injectedHook.onScheduleFiberRoot(rendererID, root, children); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; -function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - // TODO: We should be able to replace this with upgradePendingLanesToSync - // - // We exclude retry lanes because those must always be time sliced, in order - // to unwrap uncached promises. - // TODO: Write a test for this + error('React instrumentation encountered an error: %s', err); + } + } + } + } +} +function onCommitRoot(root, eventPriority) { + if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { + try { + var didError = (root.current.flags & DidCapture) === DidCapture; - var lanes = pendingLanes & ~RetryLanes; + if (enableProfilerTimer) { + var schedulerPriority; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; - } + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; - lanes &= ~lane; - } -} // This returns the highest priority pending lanes regardless of whether they -function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { - if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { - // The error recovery mechanism is disabled until these lanes are cleared. - return NoLanes; - } + case DefaultEventPriority: + schedulerPriority = NormalPriority$1; + break; - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; - } + default: + schedulerPriority = NormalPriority$1; + break; + } - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; - } + injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); + } + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - return NoLanes; + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function includesSyncLane(lanes) { - return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; +function onPostCommitRoot(root) { + if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { + try { + injectedHook.onPostCommitFiberRoot(rendererID, root); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; -} -function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; -} -function includesOnlyNonUrgentLanes(lanes) { - // TODO: Should hydration lanes be included here? This function is only - // used in `updateDeferredValueImpl`. - var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; - return (lanes & UrgentLanes) === NoLanes; -} -function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; -} -function includesBlockingLane(root, lanes) { - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { - // Concurrent updates by default always use time slicing. - return false; - } +function onCommitUnmount(fiber) { + if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { + try { + injectedHook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; - return (lanes & SyncDefaultLanes) !== NoLanes; -} -function includesExpiredLane(root, lanes) { - // This is a separate check from includesBlockingLane because a lane can - // expire after a render has already started. - return (lanes & root.expiredLanes) !== NoLanes; -} -function isTransitionLane(lane) { - return (lane & TransitionLanes) !== NoLanes; + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function claimNextTransitionLane() { - // Cycle through the lanes, assigning each new transition to the next lane. - // In most cases, this means every transition gets its own lane, until we - // run out of lanes and cycle back to the beginning. - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - - if ((nextTransitionLane & TransitionLanes) === NoLanes) { - nextTransitionLane = TransitionLane1; +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (newIsStrictMode) { + disableLogs(); + } else { + reenableLogs(); + } } +} // Profiler API hooks - return lane; +function injectProfilingHooks(profilingHooks) { } -function claimNextRetryLane() { - var lane = nextRetryLane; - nextRetryLane <<= 1; - if ((nextRetryLane & RetryLanes) === NoLanes) { - nextRetryLane = RetryLane1; +function getLaneLabelMap() { + { + return null; } - - return lane; -} -function getHighestPriorityLane(lanes) { - return lanes & -lanes; -} -function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); } -function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); -} +var NoMode = +/* */ +0; // TODO: Remove ConcurrentMode by reading from the root tag instead -function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); -} +var ConcurrentMode = +/* */ +1; +var ProfileMode = +/* */ +2; +var StrictLegacyMode = +/* */ +8; +var StrictEffectsMode = +/* */ +16; +var ConcurrentUpdatesByDefaultMode = +/* */ +32; +var NoStrictPassiveEffectsMode = +/* */ +64; -function includesSomeLane(a, b) { - return (a & b) !== NoLanes; -} -function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; -} -function mergeLanes(a, b) { - return a | b; -} -function removeLanes(set, subset) { - return set & ~subset; -} -function intersectLanes(a, b) { - return a & b; -} // Seems redundant, but it changes the type from a single lane (used for -// updates) to a group of lanes (used for flushing work). +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 -function laneToLanes(lane) { - return lane; -} -function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; +var log = Math.log; +var LN2 = Math.LN2; - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); +function clz32Fallback(x) { + var asUint = x >>> 0; + + if (asUint === 0) { + return 32; } - return laneMap; + return 31 - (log(asUint) / LN2 | 0) | 0; } -function markRootUpdated$1(root, updateLane) { - root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update - // could unblock them. Clear the suspended lanes so that we can try rendering - // them again. - // - // TODO: We really only need to unsuspend only lanes that are in the - // `subtreeLanes` of the updated fiber, or the update lanes of the return - // path. This would exclude suspended updates in an unrelated sibling tree, - // since there's no way for this update to unblock it. - // - // We don't do this if the incoming update is idle, because we never process - // idle updates until after all the regular updates have finished; there's no - // way it could unblock a transition. - if (updateLane !== IdleLane) { - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - } -} -function markRootSuspended$1(root, suspendedLanes, spawnedLane) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. +// If those values are changed that package should be rebuilt and redeployed. - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; +var TotalLanes = 31; +var NoLanes = +/* */ +0; +var NoLane = +/* */ +0; +var SyncHydrationLane = +/* */ +1; +var SyncLane = +/* */ +2; +var SyncLaneIndex = 1; +var InputContinuousHydrationLane = +/* */ +4; +var InputContinuousLane = +/* */ +8; +var DefaultHydrationLane = +/* */ +16; +var DefaultLane = +/* */ +32; +var SyncUpdateLanes = SyncLane | InputContinuousLane | DefaultLane ; +var TransitionHydrationLane = +/* */ +64; +var TransitionLanes = +/* */ +4194176; +var TransitionLane1 = +/* */ +128; +var TransitionLane2 = +/* */ +256; +var TransitionLane3 = +/* */ +512; +var TransitionLane4 = +/* */ +1024; +var TransitionLane5 = +/* */ +2048; +var TransitionLane6 = +/* */ +4096; +var TransitionLane7 = +/* */ +8192; +var TransitionLane8 = +/* */ +16384; +var TransitionLane9 = +/* */ +32768; +var TransitionLane10 = +/* */ +65536; +var TransitionLane11 = +/* */ +131072; +var TransitionLane12 = +/* */ +262144; +var TransitionLane13 = +/* */ +524288; +var TransitionLane14 = +/* */ +1048576; +var TransitionLane15 = +/* */ +2097152; +var RetryLanes = +/* */ +62914560; +var RetryLane1 = +/* */ +4194304; +var RetryLane2 = +/* */ +8388608; +var RetryLane3 = +/* */ +16777216; +var RetryLane4 = +/* */ +33554432; +var SomeRetryLane = RetryLane1; +var SelectiveHydrationLane = +/* */ +67108864; +var NonIdleLanes = +/* */ +134217727; +var IdleHydrationLane = +/* */ +134217728; +var IdleLane = +/* */ +268435456; +var OffscreenLane = +/* */ +536870912; +var DeferredLane = +/* */ +1073741824; // Any lane that might schedule an update. This is used to detect infinite +// update loops, so it doesn't include hydration lanes or retries. - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } +var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) +var NoTimestamp = -1; +var nextTransitionLane = TransitionLane1; +var nextRetryLane = RetryLane1; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +function getHighestPriorityLanes(lanes) { + { + var pendingSyncLanes = lanes & SyncUpdateLanes; + + if (pendingSyncLanes !== 0) { + return pendingSyncLanes; + } } -} -function markRootPinged$1(root, pingedLanes) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; -} -function markRootFinished(root, remainingLanes, spawnedLane) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - root.expiredLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - root.errorRecoveryDisabledLanes &= remainingLanes; - root.shellSuspendCounter = 0; - var entanglements = root.entanglements; - var expirationTimes = root.expirationTimes; - var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work + switch (getHighestPriorityLane(lanes)) { + case SyncHydrationLane: + return SyncHydrationLane; - var lanes = noLongerPendingLanes; + case SyncLane: + return SyncLane; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - expirationTimes[index] = NoTimestamp; - var hiddenUpdatesForLane = hiddenUpdates[index]; + case InputContinuousHydrationLane: + return InputContinuousHydrationLane; + + case InputContinuousLane: + return InputContinuousLane; - if (hiddenUpdatesForLane !== null) { - hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They - // have special logic associated with them because they may be entangled - // with updates that occur outside that tree. But once the outer tree - // commits, they behave like regular updates. + case DefaultHydrationLane: + return DefaultHydrationLane; - for (var i = 0; i < hiddenUpdatesForLane.length; i++) { - var update = hiddenUpdatesForLane[i]; + case DefaultLane: + return DefaultLane; - if (update !== null) { - update.lane &= ~OffscreenLane; - } - } - } + case TransitionHydrationLane: + return TransitionHydrationLane; - lanes &= ~lane; - } + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return lanes & TransitionLanes; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need - // to entangle the spawned task with the parent task. - NoLanes); - } -} + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + return lanes & RetryLanes; -function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { - // This render spawned a deferred task. Mark it as pending. - root.pendingLanes |= spawnedLane; - root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it - // was the result of another render. This lets us avoid a useDeferredValue - // waterfall — only the first level will defer. + case SelectiveHydrationLane: + return SelectiveHydrationLane; - var spawnedLaneIndex = laneToIndex(spawnedLane); - root.entangledLanes |= spawnedLane; - root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes - // with the spawned task, so that the deferred task includes all the same - // updates that the parent task did. We can exclude any lane that is not - // used for updates (e.g. Offscreen). - entangledLanes & UpdateLanes; -} + case IdleHydrationLane: + return IdleHydrationLane; -function markRootEntangled(root, entangledLanes) { - // In addition to entangling each of the given lanes with each other, we also - // have to consider _transitive_ entanglements. For each lane that is already - // entangled with *any* of the given lanes, that lane is now transitively - // entangled with *all* the given lanes. - // - // Translated: If C is entangled with A, then entangling A with B also - // entangles C with B. - // - // If this is hard to grasp, it might help to intentionally break this - // function and look at the tests that fail in ReactTransition-test.js. Try - // commenting out one of the conditions below. - var rootEntangledLanes = root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = rootEntangledLanes; + case IdleLane: + return IdleLane; - while (lanes) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; + case OffscreenLane: + return OffscreenLane; - if ( // Is this one of the newly entangled lanes? - lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? - entanglements[index] & entangledLanes) { - entanglements[index] |= entangledLanes; - } + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; - lanes &= ~lane; - } -} -function upgradePendingLaneToSync(root, lane) { - // Since we're upgrading the priority of the given lane, there is now pending - // sync work. - root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane - // will not be allowed to finish without also finishing the given lane. + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - root.entangledLanes |= SyncLane; - root.entanglements[SyncLaneIndex] |= lane; -} -function markHiddenUpdate(root, update, lane) { - var index = laneToIndex(lane); - var hiddenUpdates = root.hiddenUpdates; - var hiddenUpdatesForLane = hiddenUpdates[index]; - if (hiddenUpdatesForLane === null) { - hiddenUpdates[index] = [update]; - } else { - hiddenUpdatesForLane.push(update); + return lanes; } - - update.lane = lane | OffscreenLane; } -function getBumpedLaneForHydration(root, renderLanes) { - var renderLane = getHighestPriorityLane(renderLanes); - var lane; - - if ((renderLane & SyncUpdateLanes) !== NoLane) { - lane = SyncHydrationLane; - } else { - switch (renderLane) { - case SyncLane: - lane = SyncHydrationLane; - break; - case InputContinuousLane: - lane = InputContinuousHydrationLane; - break; +function getNextLanes(root, wipLanes) { + // Early bailout if there's no pending work left. + var pendingLanes = root.pendingLanes; - case DefaultLane: - lane = DefaultHydrationLane; - break; + if (pendingLanes === NoLanes) { + return NoLanes; + } - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - lane = TransitionHydrationLane; - break; + var nextLanes = NoLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - case IdleLane: - lane = IdleHydrationLane; - break; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - default: - // Everything else is already either a hydration lane, or shouldn't - // be retried at a hydration lane. - lane = NoLane; - break; - } - } // Check if the lane we chose is suspended. If so, that indicates that we - // already attempted and failed to hydrate at that level. Also check if we're - // already rendering that lane, which is rare but could happen. + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { - // Give up trying to hydrate and fall back to client render. - return NoLane; - } + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); + } + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; - return lane; -} -function getTransitionsForLanes(root, lanes) { - { - return null; + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); + } + } } -} -var NoEventPriority = NoLane; -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; -} -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; -} -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; -} -function eventPriorityToLane(updatePriority) { - return updatePriority; -} -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); + if (nextLanes === NoLanes) { + // This should only be reachable if we're suspended + // TODO: Consider warning in this path if a fallback timer is not scheduled. + return NoLanes; + } // If we're already in the middle of a render, switching lanes will interrupt + // it and we'll lose our progress. We should only do this if the new lanes are + // higher priority. - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } + if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't + // bother waiting until the root is complete. + (wipLanes & suspendedLanes) === NoLanes) { + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; + if ( // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The + // only difference between default updates and transition updates is that + // default updates do not support refresh transitions. + nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { + // Keep working on the existing in-progress tree. Do not interrupt. + return wipLanes; + } } - return IdleEventPriority; + return nextLanes; } +function getEntangledLanes(root, renderLanes) { + var entangledLanes = renderLanes; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim$1() { - throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Hydration (when unsupported) + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { + // When updates are sync by default, we entangle continuous priority updates + // and default updates, so they render in the same batch. The only reason + // they use separate lanes is because continuous updates should interrupt + // transitions, but default updates should not. + entangledLanes |= entangledLanes & DefaultLane; + } // Check for entangled lanes and add them to the batch. + // + // A lane is said to be entangled with another when it's not allowed to render + // in a batch that does not also include the other lane. Typically we do this + // when multiple updates have the same source, and we only want to respond to + // the most recent event from that source. + // + // Note that we apply entanglements *after* checking for partial work above. + // This means that if a lane is entangled during an interleaved event while + // it's already rendering, we won't interrupt it. This is intentional, since + // entanglement is usually "best effort": we'll try our best to render the + // lanes in the same batch, but it's not worth throwing out partially + // completed work in order to do it. + // TODO: Reconsider this. The counter-argument is that the partial work + // represents an intermediate state, which we don't want to show to the user. + // And by spending extra time finishing it, we're increasing the amount of + // time it takes to show the final state, which is what they are actually + // waiting for. + // + // For those exceptions where entanglement is semantically important, + // we should ensure that there is no partial work at the + // time we apply the entanglement. -var supportsHydration = false; -var isSuspenseInstancePending = shim$1; -var isSuspenseInstanceFallback = shim$1; -var getSuspenseInstanceFallbackErrorDetails = shim$1; -var registerSuspenseInstanceRetry = shim$1; -var clearSuspenseBoundary = shim$1; -var clearSuspenseBoundaryFromContainer = shim$1; + var allEntangledLanes = root.entangledLanes; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim() { - throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Resources (when unsupported) -var preloadResource = shim; -var suspendResource = shim; + if (allEntangledLanes !== NoLanes) { + var entanglements = root.entanglements; + var lanes = entangledLanes & allEntangledLanes; -var NO_CONTEXT = {}; -var nodeToInstanceMap = new WeakMap(); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entangledLanes |= entanglements[index]; + lanes &= ~lane; + } + } -{ - Object.freeze(NO_CONTEXT); + return entangledLanes; } -function getPublicInstance(inst) { - switch (inst.tag) { - case 'INSTANCE': - var createNodeMock = inst.rootContainerInstance.createNodeMock; - var mockNode = createNodeMock({ - type: inst.type, - props: inst.props - }); +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case SyncHydrationLane: + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + syncLaneExpirationMs; - if (typeof mockNode === 'object' && mockNode !== null) { - nodeToInstanceMap.set(mockNode, inst); - } + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return currentTime + transitionLaneExpirationMs; - return mockNode; + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + // TODO: Retries should be allowed to expire if they are CPU bound for + // too long, but when I made this change it caused a spike in browser + // crashes. There must be some other underlying bug; not super urgent but + // ideally should figure out why and fix it. Unfortunately we don't have + // a repro for the crashes, only detected via production metrics. + return NoTimestamp; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + case DeferredLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; default: - return inst; + { + error('Should have found matching lanes. This is a bug in React.'); + } + + return NoTimestamp; } } -function appendChild(parentInstance, child) { - { - if (!isArray(parentInstance.children)) { - error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); - } - } - var index = parentInstance.children.indexOf(child); +function markStarvedLanesAsExpired(root, currentTime) { + // TODO: This gets called every time we yield. We can optimize by storing + // the earliest expiration time on the root. Then use that to quickly bail out + // of this function. + var pendingLanes = root.pendingLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; + var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their + // expiration time. If so, we'll assume the update is being starved and mark + // it as expired to force it to finish. + // TODO: We should be able to replace this with upgradePendingLanesToSync + // + // We exclude retry lanes because those must always be time sliced, in order + // to unwrap uncached promises. + // TODO: Write a test for this - if (index !== -1) { - parentInstance.children.splice(index, 1); - } + var lanes = pendingLanes & ~RetryLanes; - parentInstance.children.push(child); -} -function insertBefore(parentInstance, child, beforeChild) { - var index = parentInstance.children.indexOf(child); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + var expirationTime = expirationTimes[index]; - if (index !== -1) { - parentInstance.children.splice(index, 1); + if (expirationTime === NoTimestamp) { + // Found a pending lane with no expiration time. If it's not suspended, or + // if it's pinged, assume it's CPU-bound. Compute a new expiration time + // using the current time. + if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { + // Assumes timestamps are monotonically increasing. + expirationTimes[index] = computeExpirationTime(lane, currentTime); + } + } else if (expirationTime <= currentTime) { + // This lane expired + root.expiredLanes |= lane; + } + + lanes &= ~lane; + } +} // This returns the highest priority pending lanes regardless of whether they +function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { + if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { + // The error recovery mechanism is disabled until these lanes are cleared. + return NoLanes; } - var beforeIndex = parentInstance.children.indexOf(beforeChild); - parentInstance.children.splice(beforeIndex, 0, child); -} -function removeChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - parentInstance.children.splice(index, 1); -} -function clearContainer(container) { - container.children.splice(0); -} -function getRootHostContext(rootContainerInstance) { - return NO_CONTEXT; -} -function getChildHostContext(parentHostContext, type) { - return NO_CONTEXT; -} -function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - type: type, - props: props, - isHidden: false, - children: [], - internalInstanceHandle: internalInstanceHandle, - rootContainerInstance: rootContainerInstance, - tag: 'INSTANCE' - }; -} -function appendInitialChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); + var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - if (index !== -1) { - parentInstance.children.splice(index, 1); + if (everythingButOffscreen !== NoLanes) { + return everythingButOffscreen; } - - parentInstance.children.push(child); -} -function shouldSetTextContent(type, props) { - return false; -} -function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - text: text, - isHidden: false, - tag: 'TEXT' - }; -} -var currentUpdatePriority = NoEventPriority; -function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; -} -function getCurrentUpdatePriority() { - return currentUpdatePriority; -} -function resolveUpdatePriority() { - if (currentUpdatePriority !== NoEventPriority) { - return currentUpdatePriority; + + if (everythingButOffscreen & OffscreenLane) { + return OffscreenLane; } - return DefaultEventPriority; -} -function shouldAttemptEagerTransition() { - return false; + return NoLanes; } -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; // ------------------- -function commitUpdate(instance, type, oldProps, newProps, internalInstanceHandle) { - instance.type = type; - instance.props = newProps; +function includesSyncLane(lanes) { + return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; } -function commitMount(instance, type, newProps, internalInstanceHandle) {// noop +function includesNonIdleWork(lanes) { + return (lanes & NonIdleLanes) !== NoLanes; } -function commitTextUpdate(textInstance, oldText, newText) { - textInstance.text = newText; +function includesOnlyRetries(lanes) { + return (lanes & RetryLanes) === lanes; } -function resetTextContent(testElement) {// noop +function includesOnlyNonUrgentLanes(lanes) { + // TODO: Should hydration lanes be included here? This function is only + // used in `updateDeferredValueImpl`. + var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; + return (lanes & UrgentLanes) === NoLanes; } -var appendChildToContainer = appendChild; -var insertInContainerBefore = insertBefore; -var removeChildFromContainer = removeChild; -function hideInstance(instance) { - instance.isHidden = true; +function includesOnlyTransitions(lanes) { + return (lanes & TransitionLanes) === lanes; } -function hideTextInstance(textInstance) { - textInstance.isHidden = true; +function includesBlockingLane(root, lanes) { + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { + // Concurrent updates by default always use time slicing. + return false; + } + + var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; + return (lanes & SyncDefaultLanes) !== NoLanes; } -function unhideInstance(instance, props) { - instance.isHidden = false; +function includesExpiredLane(root, lanes) { + // This is a separate check from includesBlockingLane because a lane can + // expire after a render has already started. + return (lanes & root.expiredLanes) !== NoLanes; } -function unhideTextInstance(textInstance, text) { - textInstance.isHidden = false; +function isTransitionLane(lane) { + return (lane & TransitionLanes) !== NoLanes; } -function getInstanceFromNode(mockNode) { - var instance = nodeToInstanceMap.get(mockNode); +function claimNextTransitionLane() { + // Cycle through the lanes, assigning each new transition to the next lane. + // In most cases, this means every transition gets its own lane, until we + // run out of lanes and cycle back to the beginning. + var lane = nextTransitionLane; + nextTransitionLane <<= 1; - if (instance !== undefined) { - return instance.internalInstanceHandle; + if ((nextTransitionLane & TransitionLanes) === NoLanes) { + nextTransitionLane = TransitionLane1; } - return null; -} -function prepareScopeUpdate(scopeInstance, inst) { - nodeToInstanceMap.set(scopeInstance, inst); + return lane; } -function getInstanceFromScope(scopeInstance) { - return nodeToInstanceMap.get(scopeInstance) || null; +function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; + + if ((nextRetryLane & RetryLanes) === NoLanes) { + nextRetryLane = RetryLane1; + } + + return lane; } -function preloadInstance(type, props) { - // Return true to indicate it's already loaded - return true; +function getHighestPriorityLane(lanes) { + return lanes & -lanes; } -function waitForCommitToBeReady() { - return null; +function pickArbitraryLane(lanes) { + // This wrapper function gets inlined. Only exists so to communicate that it + // doesn't matter which bit is selected; you can pick any bit without + // affecting the algorithms where its used. Here I'm using + // getHighestPriorityLane because it requires the fewest operations. + return getHighestPriorityLane(lanes); } -var NotPendingTransition = null; - -var valueStack = []; -var fiberStack; -{ - fiberStack = []; +function pickArbitraryLaneIndex(lanes) { + return 31 - clz32(lanes); } -var index = -1; +function laneToIndex(lane) { + return pickArbitraryLaneIndex(lane); +} -function createCursor(defaultValue) { - return { - current: defaultValue - }; +function includesSomeLane(a, b) { + return (a & b) !== NoLanes; +} +function isSubsetOfLanes(set, subset) { + return (set & subset) === subset; +} +function mergeLanes(a, b) { + return a | b; +} +function removeLanes(set, subset) { + return set & ~subset; } +function intersectLanes(a, b) { + return a & b; +} // Seems redundant, but it changes the type from a single lane (used for +// updates) to a group of lanes (used for flushing work). -function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); - } +function laneToLanes(lane) { + return lane; +} +function createLaneMap(initial) { + // Intentionally pushing one by one. + // https://v8.dev/blog/elements-kinds#avoid-creating-holes + var laneMap = []; - return; + for (var i = 0; i < TotalLanes; i++) { + laneMap.push(initial); } - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); - } + return laneMap; +} +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update + // could unblock them. Clear the suspended lanes so that we can try rendering + // them again. + // + // TODO: We really only need to unsuspend only lanes that are in the + // `subtreeLanes` of the updated fiber, or the update lanes of the return + // path. This would exclude suspended updates in an unrelated sibling tree, + // since there's no way for this update to unblock it. + // + // We don't do this if the incoming update is idle, because we never process + // idle updates until after all the regular updates have finished; there's no + // way it could unblock a transition. + + if (updateLane !== IdleLane) { + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; } +} +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. - cursor.current = valueStack[index]; - valueStack[index] = null; + var expirationTimes = root.expirationTimes; + var lanes = suspendedLanes; - { - fiberStack[index] = null; + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + expirationTimes[index] = NoTimestamp; + lanes &= ~lane; } - index--; + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } +} +function markRootPinged$1(root, pingedLanes) { + root.pingedLanes |= root.suspendedLanes & pingedLanes; } +function markRootFinished(root, remainingLanes, spawnedLane) { + var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; + root.pendingLanes = remainingLanes; // Let's try everything again -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements; + var expirationTimes = root.expirationTimes; + var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work - { - fiberStack[index] = fiber; - } + var lanes = noLongerPendingLanes; - cursor.current = value; -} + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entanglements[index] = NoLanes; + expirationTimes[index] = NoTimestamp; + var hiddenUpdatesForLane = hiddenUpdates[index]; -var warnedAboutMissingGetChildContext; + if (hiddenUpdatesForLane !== null) { + hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They + // have special logic associated with them because they may be entangled + // with updates that occur outside that tree. But once the outer tree + // commits, they behave like regular updates. -{ - warnedAboutMissingGetChildContext = {}; -} + for (var i = 0; i < hiddenUpdatesForLane.length; i++) { + var update = hiddenUpdatesForLane[i]; -var emptyContextObject = {}; + if (update !== null) { + update.lane &= ~OffscreenLane; + } + } + } -{ - Object.freeze(emptyContextObject); -} // A cursor to the current merged context object on the stack. + lanes &= ~lane; + } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes); + } +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. -var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task, so that the deferred task includes all the same + // updates that the parent task did. We can exclude any lane that is not + // used for updates (e.g. Offscreen). + entangledLanes & UpdateLanes; +} -var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. -// We use this to get access to the parent context after we have already -// pushed the next context provider, and now need to merge their contexts. +function markRootEntangled(root, entangledLanes) { + // In addition to entangling each of the given lanes with each other, we also + // have to consider _transitive_ entanglements. For each lane that is already + // entangled with *any* of the given lanes, that lane is now transitively + // entangled with *all* the given lanes. + // + // Translated: If C is entangled with A, then entangling A with B also + // entangles C with B. + // + // If this is hard to grasp, it might help to intentionally break this + // function and look at the tests that fail in ReactTransition-test.js. Try + // commenting out one of the conditions below. + var rootEntangledLanes = root.entangledLanes |= entangledLanes; + var entanglements = root.entanglements; + var lanes = rootEntangledLanes; -var previousContext = emptyContextObject; + while (lanes) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; -function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { - { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; + if ( // Is this one of the newly entangled lanes? + lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? + entanglements[index] & entangledLanes) { + entanglements[index] |= entangledLanes; } - return contextStackCursor$1.current; + lanes &= ~lane; } } +function upgradePendingLaneToSync(root, lane) { + // Since we're upgrading the priority of the given lane, there is now pending + // sync work. + root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane + // will not be allowed to finish without also finishing the given lane. -function cacheContext(workInProgress, unmaskedContext, maskedContext) { - { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } + root.entangledLanes |= SyncLane; + root.entanglements[SyncLaneIndex] |= lane; } +function markHiddenUpdate(root, update, lane) { + var index = laneToIndex(lane); + var hiddenUpdates = root.hiddenUpdates; + var hiddenUpdatesForLane = hiddenUpdates[index]; -function getMaskedContext(workInProgress, unmaskedContext) { - { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - - if (!contextTypes) { - return emptyContextObject; - } // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. + if (hiddenUpdatesForLane === null) { + hiddenUpdates[index] = [update]; + } else { + hiddenUpdatesForLane.push(update); + } + update.lane = lane | OffscreenLane; +} +function getBumpedLaneForHydration(root, renderLanes) { + var renderLane = getHighestPriorityLane(renderLanes); + var lane; - var instance = workInProgress.stateNode; + if ((renderLane & SyncUpdateLanes) !== NoLane) { + lane = SyncHydrationLane; + } else { + switch (renderLane) { + case SyncLane: + lane = SyncHydrationLane; + break; - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; - } + case InputContinuousLane: + lane = InputContinuousHydrationLane; + break; - var context = {}; + case DefaultLane: + lane = DefaultHydrationLane; + break; - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + lane = TransitionHydrationLane; + break; + case IdleLane: + lane = IdleHydrationLane; + break; - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); + default: + // Everything else is already either a hydration lane, or shouldn't + // be retried at a hydration lane. + lane = NoLane; + break; } + } // Check if the lane we chose is suspended. If so, that indicates that we + // already attempted and failed to hydrate at that level. Also check if we're + // already rendering that lane, which is rare but could happen. - return context; - } -} -function hasContextChanged() { - { - return didPerformWorkStackCursor.current; + if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { + // Give up trying to hydrate and fall back to client render. + return NoLane; } -} -function isContextProvider(type) { - { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; - } + return lane; } - -function popContext(fiber) { +function getTransitionsForLanes(root, lanes) { { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); + return null; } } -function popTopLevelContextObject(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); - } +var NoEventPriority = NoLane; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; } - -function pushTopLevelContextObject(fiber, context, didChange) { - { - if (contextStackCursor$1.current !== emptyContextObject) { - throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } - - push(contextStackCursor$1, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); - } +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; } +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -function processChildContext(fiber, type, parentContext) { - { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } - error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; + } - return parentContext; - } + return IdleEventPriority; +} - var childContext = instance.getChildContext(); +// Renderers that don't support hydration +// can re-export everything from this module. +function shim$1() { + throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Hydration (when unsupported) - for (var contextKey in childContext) { - if (!(contextKey in childContextTypes)) { - throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); - } - } - return assign({}, parentContext, childContext); - } -} +var supportsHydration = false; +var isSuspenseInstancePending = shim$1; +var isSuspenseInstanceFallback = shim$1; +var getSuspenseInstanceFallbackErrorDetails = shim$1; +var registerSuspenseInstanceRetry = shim$1; +var clearSuspenseBoundary = shim$1; +var clearSuspenseBoundaryFromContainer = shim$1; -function pushContextProvider(workInProgress) { - { - var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. +// Renderers that don't support hydration +// can re-export everything from this module. +function shim() { + throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Resources (when unsupported) +var preloadResource = shim; +var suspendResource = shim; - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. +var NO_CONTEXT = {}; +var nodeToInstanceMap = new WeakMap(); - previousContext = contextStackCursor$1.current; - push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); - return true; - } +{ + Object.freeze(NO_CONTEXT); } -function invalidateContextProvider(workInProgress, type, didChange) { - { - var instance = workInProgress.stateNode; - - if (!instance) { - throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } +function getPublicInstance(inst) { + switch (inst.tag) { + case 'INSTANCE': + var createNodeMock = inst.rootContainerInstance.createNodeMock; + var mockNode = createNodeMock({ + type: inst.type, + props: inst.props + }); - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, type, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. + if (typeof mockNode === 'object' && mockNode !== null) { + nodeToInstanceMap.set(mockNode, inst); + } - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. + return mockNode; - push(contextStackCursor$1, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } + default: + return inst; } } - -function findCurrentUnmaskedContext(fiber) { +function appendChild(parentInstance, child) { { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { - throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + if (!isArray(parentInstance.children)) { + error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); } + } - var node = fiber; - - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - - case ClassComponent: - { - var Component = node.type; - - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - - break; - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null + var index = parentInstance.children.indexOf(child); + if (index !== -1) { + parentInstance.children.splice(index, 1); + } - node = node.return; - } while (node !== null); + parentInstance.children.push(child); +} +function insertBefore(parentInstance, child, beforeChild) { + var index = parentInstance.children.indexOf(child); - throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + if (index !== -1) { + parentInstance.children.splice(index, 1); } -} -// We use the existence of the state object as an indicator that the component -// is hidden. -var OffscreenVisible = -/* */ -1; -var OffscreenDetached = -/* */ -2; -var OffscreenPassiveEffectsConnected = -/* */ -4; -function isOffscreenManual(offscreenFiber) { - return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; + var beforeIndex = parentInstance.children.indexOf(beforeChild); + parentInstance.children.splice(beforeIndex, 0, child); } - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; +function removeChild(parentInstance, child) { + var index = parentInstance.children.indexOf(child); + parentInstance.children.splice(index, 1); +} +function clearContainer(container) { + container.children.splice(0); +} +function getRootHostContext(rootContainerInstance) { + return NO_CONTEXT; +} +function getChildHostContext(parentHostContext, type) { + return NO_CONTEXT; +} +function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { + return { + type: type, + props: props, + isHidden: false, + children: [], + internalInstanceHandle: internalInstanceHandle, + rootContainerInstance: rootContainerInstance, + tag: 'INSTANCE' + }; } +function appendInitialChild(parentInstance, child) { + var index = parentInstance.children.indexOf(child); -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; + if (index !== -1) { + parentInstance.children.splice(index, 1); + } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. + parentInstance.children.push(child); +} +function shouldSetTextContent(type, props) { + return false; +} +function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { + return { + text: text, + isHidden: false, + tag: 'TEXT' + }; +} +var currentUpdatePriority = NoEventPriority; +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function resolveUpdatePriority() { + if (currentUpdatePriority !== NoEventPriority) { + return currentUpdatePriority; + } + return DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; +} +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; // ------------------- +function commitUpdate(instance, type, oldProps, newProps, internalInstanceHandle) { + instance.type = type; + instance.props = newProps; +} +function commitMount(instance, type, newProps, internalInstanceHandle) {// noop +} +function commitTextUpdate(textInstance, oldText, newText) { + textInstance.text = newText; +} +function resetTextContent(testElement) {// noop +} +var appendChildToContainer = appendChild; +var insertInContainerBefore = insertBefore; +var removeChildFromContainer = removeChild; +function hideInstance(instance) { + instance.isHidden = true; +} +function hideTextInstance(textInstance) { + textInstance.isHidden = true; +} +function unhideInstance(instance, props) { + instance.isHidden = false; +} +function unhideTextInstance(textInstance, text) { + textInstance.isHidden = false; +} +function getInstanceFromNode(mockNode) { + var instance = nodeToInstanceMap.get(mockNode); - return '\n' + prefix + name; + if (instance !== undefined) { + return instance.internalInstanceHandle; } + + return null; } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +function prepareScopeUpdate(scopeInstance, inst) { + nodeToInstanceMap.set(scopeInstance, inst); } -var reentry = false; -var componentFrameCache; +function getInstanceFromScope(scopeInstance) { + return nodeToInstanceMap.get(scopeInstance) || null; +} +function preloadInstance(type, props) { + // Return true to indicate it's already loaded + return true; +} +function waitForCommitToBeReady() { + return null; +} +var NotPendingTransition = null; + +var valueStack = []; +var fiberStack; { - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); + fiberStack = []; } -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ +var index = -1; -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} + +function pop(cursor, fiber) { + if (index < 0) { + { + error('Unexpected pop.'); + } + + return; } { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; + if (fiber !== fiberStack[index]) { + error('Unexpected Fiber popped.'); } } - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; + cursor.current = valueStack[index]; + valueStack[index] = null; { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); + fiberStack[index] = null; } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ + index--; +} - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; +function push(cursor, value, fiber) { + index++; + valueStack[index] = cursor.current; - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] + { + fiberStack[index] = fiber; + } + cursor.current = value; +} - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); +var warnedAboutMissingGetChildContext; - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } +{ + warnedAboutMissingGetChildContext = {}; +} - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow +var emptyContextObject = {}; +{ + Object.freeze(emptyContextObject); +} // A cursor to the current merged context object on the stack. - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too +var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? +var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } +var previousContext = emptyContextObject; - return [null, null]; +function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { + { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; } - }; // $FlowFixMe[prop-missing] - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + return contextStackCursor$1.current; + } +} - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); +function cacheContext(workInProgress, unmaskedContext, maskedContext) { + { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; } +} - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; +function getMaskedContext(workInProgress, unmaskedContext) { + { + var type = workInProgress.type; + var contextTypes = type.contextTypes; - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; + if (!contextTypes) { + return emptyContextObject; + } // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... + var instance = workInProgress.stateNode; + if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { + return instance.__reactInternalMemoizedMaskedChildContext; + } - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; + var context = {}; - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } + return context; + } +} - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } +function hasContextChanged() { + { + return didPerformWorkStackCursor.current; + } +} + +function isContextProvider(type) { + { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } +} + +function popContext(fiber) { + { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); + } +} + +function popTopLevelContextObject(fiber) { + { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); + } +} + +function pushTopLevelContextObject(fiber, context, didChange) { + { + if (contextStackCursor$1.current !== emptyContextObject) { + throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } + + push(contextStackCursor$1, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); + } +} - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. +function processChildContext(fiber, type, parentContext) { + { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== 'function') { + { + var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; - return _frame; - } - } while (s >= 1 && c >= 0); - } + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; - break; + error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); } } - } - } finally { - reentry = false; - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); + return parentContext; } - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + var childContext = instance.getChildContext(); - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); + for (var contextKey in childContext) { + if (!(contextKey in childContextTypes)) { + throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); + } } - } - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); + return assign({}, parentContext, childContext); } } -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); +function pushContextProvider(workInProgress) { + { + var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); + var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); + previousContext = contextStackCursor$1.current; + push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); + push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); + return true; + } +} - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); +function invalidateContextProvider(workInProgress, type, didChange) { + { + var instance = workInProgress.stateNode; - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); + if (!instance) { + throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext(workInProgress, type, previousContext); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. - case ClassComponent: - return describeClassComponentFrame(fiber.type); + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. - default: - return ''; + push(contextStackCursor$1, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } } } -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; +function findCurrentUnmaskedContext(fiber) { + { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { + throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } - do { - info += describeFiber(node); + var node = fiber; - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; + case ClassComponent: + { + var Component = node.type; - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; } + + break; } - } } // $FlowFixMe[incompatible-type] we bail out when we get a null node = node.return; - } while (node); + } while (node !== null); - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; + throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } } +// We use the existence of the state object as an indicator that the component +// is hidden. +var OffscreenVisible = +/* */ +1; +var OffscreenDetached = +/* */ +2; +var OffscreenPassiveEffectsConnected = +/* */ +4; +function isOffscreenManual(offscreenFiber) { + return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; +} + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} + +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; + var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown @@ -4815,61 +4877,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -5089,11 +5096,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -11915,7 +11922,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL prepareToReadContext(workInProgress, renderLanes); { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); setIsRendering(false); @@ -12390,7 +12396,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, prepareToReadContext(workInProgress, renderLanes); { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); setIsRendering(false); @@ -12530,7 +12535,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -13815,7 +13820,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -16421,7 +16425,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -16429,7 +16433,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -16447,7 +16451,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { var flags = finishedWork.flags; if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -16534,7 +16538,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -17786,9 +17790,9 @@ function attachSuspenseRetryListeners(finishedWork, wakeables) { }); } // This function detects when a Suspense boundary goes from visible to hidden. function commitMutationEffects(root, finishedWork, committedLanes) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); } function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { @@ -17814,13 +17818,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -18219,8 +18223,10 @@ function commitReconciliationEffects(finishedWork) { } function commitLayoutEffects(finishedWork, root, committedLanes) { + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); } function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { @@ -18230,14 +18236,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -18447,7 +18453,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -18525,9 +18531,9 @@ function commitCachePassiveMountEffect(current, finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -18537,13 +18543,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -18691,7 +18697,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -18802,13 +18808,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -18853,9 +18859,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -19009,13 +19015,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -19086,12 +19092,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -19133,9 +19139,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -19357,7 +19363,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -20310,10 +20316,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -20870,7 +20875,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -20881,7 +20886,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -20890,10 +20898,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -20901,9 +20905,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -20981,7 +20984,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -20990,10 +20996,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -21080,7 +21082,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -21092,7 +21094,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -21309,18 +21311,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - commitBeforeMutationEffects(root, finishedWork); { @@ -21874,7 +21871,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -21887,7 +21884,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -21950,14 +21947,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -22058,14 +22055,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -23133,7 +23130,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-classic-5f76d447'; +var ReactVersion = '19.0.0-www-classic-a084ecf7'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestRenderer-dev.modern.js b/compiled/facebook-www/ReactTestRenderer-dev.modern.js index 358e3afdc0aa7..1ec1a6833ddd7 100644 --- a/compiled/facebook-www/ReactTestRenderer-dev.modern.js +++ b/compiled/facebook-www/ReactTestRenderer-dev.modern.js @@ -556,2229 +556,2291 @@ var PassiveMask = Passive$1 | Visibility | ChildDeletion; // Union of tags that var StaticMask = LayoutStatic | PassiveStatic | RefStatic | MaySuspendCommit; -var currentOwner = null; -function setCurrentOwner(fiber) { - currentOwner = fiber; -} - -function getNearestMountedFiber(fiber) { - var node = fiber; - var nearestMounted = fiber; +var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; - if (!fiber.alternate) { - // If there is no alternate, this might be a new tree that isn't inserted - // yet. If it is, then it will have a pending insertion effect on it. - var nextNode = node; +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +var disabledDepth = 0; +var prevLog; +var prevInfo; +var prevWarn; +var prevError; +var prevGroup; +var prevGroupCollapsed; +var prevGroupEnd; - do { - node = nextNode; +function disabledLog() {} - if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { - // This is an insertion or in-progress hydration. The nearest possible - // mounted fiber is the parent but we need to continue to figure out - // if that one is still mounted. - nearestMounted = node.return; - } // $FlowFixMe[incompatible-type] we bail out when we get a null +disabledLog.__reactDisabledLog = true; +function disableLogs() { + { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + var props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - nextNode = node.return; - } while (nextNode); - } else { - while (node.return) { - node = node.return; + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - } - - if (node.tag === HostRoot) { - // TODO: Check if this was a nested HostRoot when used with - // renderContainerIntoSubtree. - return nearestMounted; - } // If we didn't hit the root, that means that we're in an disconnected tree - // that has been unmounted. - - return null; -} -function isFiberMounted(fiber) { - return getNearestMountedFiber(fiber) === fiber; + disabledDepth++; + } } -function isMounted(component) { +function reenableLogs() { { - var owner = currentOwner; + disabledDepth--; - if (owner !== null && owner.tag === ClassComponent) { - var ownerFiber = owner; - var instance = ownerFiber.stateNode; + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + var props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. - if (!instance._warnedAboutRefsInRender) { - error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); - } + Object.defineProperties(console, { + log: assign({}, props, { + value: prevLog + }), + info: assign({}, props, { + value: prevInfo + }), + warn: assign({}, props, { + value: prevWarn + }), + error: assign({}, props, { + value: prevError + }), + group: assign({}, props, { + value: prevGroup + }), + groupCollapsed: assign({}, props, { + value: prevGroupCollapsed + }), + groupEnd: assign({}, props, { + value: prevGroupEnd + }) + }); + /* eslint-enable react-internal/no-production-logging */ + } - instance._warnedAboutRefsInRender = true; + if (disabledDepth < 0) { + error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); } } +} - var fiber = get(component); +var prefix; +function describeBuiltInComponentFrame(name) { + { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + var match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - if (!fiber) { - return false; - } - return getNearestMountedFiber(fiber) === fiber; + return '\n' + prefix + name; + } +} +function describeDebugInfoFrame(name, env) { + return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); } +var reentry = false; +var componentFrameCache; -function assertIsMounted(fiber) { - if (getNearestMountedFiber(fiber) !== fiber) { - throw new Error('Unable to find node on an unmounted component.'); - } +{ + var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap$1(); } +/** + * Leverages native browser/VM stack frames to get proper details (e.g. + * filename, line + col number) for a single component in a component stack. We + * do this by: + * (1) throwing and catching an error in the function - this will be our + * control error. + * (2) calling the component which will eventually throw an error that we'll + * catch - this will be our sample error. + * (3) diffing the control and sample error stacks to find the stack frame + * which represents our component. + */ -function findCurrentFiberUsingSlowPath(fiber) { - var alternate = fiber.alternate; - if (!alternate) { - // If there is no alternate, then we only need to check if it is mounted. - var nearestMounted = getNearestMountedFiber(fiber); +function describeNativeComponentFrame(fn, construct) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - if (nearestMounted === null) { - throw new Error('Unable to find node on an unmounted component.'); - } + { + var frame = componentFrameCache.get(fn); - if (nearestMounted !== fiber) { - return null; + if (frame !== undefined) { + return frame; } + } - return fiber; - } // If we have two possible branches, we'll walk backwards up to the root - // to see what path the root points to. On the way we may hit one of the - // special cases and we'll deal with them. - - - var a = fiber; - var b = alternate; - - while (true) { - var parentA = a.return; + reentry = true; + var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - if (parentA === null) { - // We're at the root. - break; - } + Error.prepareStackTrace = undefined; + var previousDispatcher = null; - var parentB = parentA.alternate; + { + previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function + // for warnings. - if (parentB === null) { - // There is no alternate. This is an unusual case. Currently, it only - // happens when a Suspense component is hidden. An extra fragment fiber - // is inserted in between the Suspense fiber and its children. Skip - // over this extra fragment fiber and proceed to the next parent. - var nextParent = parentA.return; + ReactSharedInternals.H = null; + disableLogs(); + } + /** + * Finding a common stack frame between sample and control errors can be + * tricky given the different types and levels of stack trace truncation from + * different JS VMs. So instead we'll attempt to control what that common + * frame should be through this object method: + * Having both the sample and control errors be in the function under the + * `DescribeNativeComponentFrameRoot` property, + setting the `name` and + * `displayName` properties of the function ensures that a stack + * frame exists that has the method name `DescribeNativeComponentFrameRoot` in + * it for both control and sample stacks. + */ - if (nextParent !== null) { - a = b = nextParent; - continue; - } // If there's no parent, we're at the root. + var RunInRootFrame = { + DetermineComponentFrameRoot: function () { + var control; - break; - } // If both copies of the parent fiber point to the same child, we can - // assume that the child is current. This happens when we bailout on low - // priority: the bailed out fiber's child reuses the current child. + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + var Fake = function () { + throw Error(); + }; // $FlowFixMe[prop-missing] - if (parentA.child === parentB.child) { - var child = parentA.child; + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); - while (child) { - if (child === a) { - // We've determined that A is the current branch. - assertIsMounted(parentA); - return fiber; - } + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } - if (child === b) { - // We've determined that B is the current branch. - assertIsMounted(parentA); - return alternate; - } + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } // $FlowFixMe[prop-missing] found when upgrading Flow - child = child.sibling; - } // We should never have an alternate for any mounting node. So the only - // way this could possibly happen is if this was unmounted, if at all. + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } // TODO(luna): This will currently only throw if the function component + // tries to access React/ReactDOM/props. We should probably make this throw + // in simple components too - throw new Error('Unable to find node on an unmounted component.'); - } - if (a.return !== b.return) { - // The return pointer of A and the return pointer of B point to different - // fibers. We assume that return pointers never criss-cross, so A must - // belong to the child set of A.return, and B must belong to the child - // set of B.return. - a = parentA; - b = parentB; - } else { - // The return pointers point to the same fiber. We'll have to use the - // default, slow path: scan the child sets of each parent alternate to see - // which child belongs to which set. - // - // Search parent A's child set - var didFindChild = false; - var _child = parentA.child; + var maybePromise = fn(); // If the function component returns a promise, it's likely an async + // component, which we don't yet support. Attach a noop catch handler to + // silence the error. + // TODO: Implement component stacks for async client components? - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentA; - b = parentB; - break; + if (maybePromise && typeof maybePromise.catch === 'function') { + maybePromise.catch(function () {}); + } } - - if (_child === b) { - didFindChild = true; - b = parentA; - a = parentB; - break; + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + return [sample.stack, control.stack]; } - - _child = _child.sibling; } - if (!didFindChild) { - // Search parent B's child set - _child = parentB.child; + return [null, null]; + } + }; // $FlowFixMe[prop-missing] - while (_child) { - if (_child === a) { - didFindChild = true; - a = parentB; - b = parentA; - break; - } + RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; + var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. - if (_child === b) { - didFindChild = true; - b = parentB; - a = parentA; - break; - } + if (namePropDescriptor && namePropDescriptor.configurable) { + // V8 utilizes a function's `name` property when generating a stack trace. + Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor + // is set to `false`. + // $FlowFixMe[cannot-write] + 'name', { + value: 'DetermineComponentFrameRoot' + }); + } - _child = _child.sibling; - } + try { + var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), + sampleStack = _RunInRootFrame$Deter[0], + controlStack = _RunInRootFrame$Deter[1]; - if (!didFindChild) { - throw new 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 (sampleStack && controlStack) { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + var sampleLines = sampleStack.split('\n'); + var controlLines = controlStack.split('\n'); + var s = 0; + var c = 0; + + while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { + s++; } - } - if (a.alternate !== b) { - throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); - } - } // If the root is not a host container, we're in a disconnected tree. I.e. - // unmounted. + while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { + c++; + } // We couldn't find our intentionally injected common root frame, attempt + // to find another common root frame by search from the bottom of the + // control stack... - if (a.tag !== HostRoot) { - throw new Error('Unable to find node on an unmounted component.'); - } + if (s === sampleLines.length || c === controlLines.length) { + s = sampleLines.length - 1; + c = controlLines.length - 1; - if (a.stateNode.current === a) { - // We've determined that A is the current branch. - return fiber; - } // Otherwise B has to be current branch. + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } + } + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. - return alternate; -} -function findCurrentHostFiber(parent) { - var currentParent = findCurrentFiberUsingSlowPath(parent); - return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; -} + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" + // but we have a user-provided "displayName" + // splice it in to make the stack more readable. -function findCurrentHostFiberImpl(node) { - // Next we'll drill down this component to find the first HostComponent/Text. - var tag = node.tag; - if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { - return node; - } + if (fn.displayName && _frame.includes('')) { + _frame = _frame.replace('', fn.displayName); + } - var child = node.child; + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, _frame); + } + } // Return the line we found. - while (child !== null) { - var match = findCurrentHostFiberImpl(child); - if (match !== null) { - return match; + return _frame; + } + } while (s >= 1 && c >= 0); + } + + break; + } + } } + } finally { + reentry = false; - child = child.sibling; + { + ReactSharedInternals.H = previousDispatcher; + reenableLogs(); + } + + Error.prepareStackTrace = previousPrepareStackTrace; + } // Fallback to just using the name if we couldn't make it throw. + + + var name = fn ? fn.displayName || fn.name : ''; + var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + + { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } } - return null; + return syntheticFrame; } -function isFiberSuspenseAndTimedOut(fiber) { - var memoizedState = fiber.memoizedState; - return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; +function describeClassComponentFrame(ctor) { + { + return describeNativeComponentFrame(ctor, true); + } } - -var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - -function isArray(a) { - return isArrayImpl(a); +function describeFunctionComponentFrame(fn) { + { + return describeNativeComponentFrame(fn, false); + } } -var ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE; +function describeFiber(fiber) { + switch (fiber.tag) { + case HostHoistable: + case HostSingleton: + case HostComponent: + return describeBuiltInComponentFrame(fiber.type); -// This module only exists as an ESM wrapper around the external CommonJS -var scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback; -var cancelCallback$1 = Scheduler$1.unstable_cancelCallback; -var shouldYield = Scheduler$1.unstable_shouldYield; -var requestPaint = Scheduler$1.unstable_requestPaint; -var now$1 = Scheduler$1.unstable_now; -var ImmediatePriority = Scheduler$1.unstable_ImmediatePriority; -var UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority; -var NormalPriority$1 = Scheduler$1.unstable_NormalPriority; -var IdlePriority = Scheduler$1.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* + case LazyComponent: + return describeBuiltInComponentFrame('Lazy'); -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -var disabledDepth = 0; -var prevLog; -var prevInfo; -var prevWarn; -var prevError; -var prevGroup; -var prevGroupCollapsed; -var prevGroupEnd; + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense'); -function disabledLog() {} + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList'); -disabledLog.__reactDisabledLog = true; -function disableLogs() { - { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + case FunctionComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(fiber.type); - var props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. + case ForwardRef: + return describeFunctionComponentFrame(fiber.type.render); - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props - }); - /* eslint-enable react-internal/no-production-logging */ - } + case ClassComponent: + return describeClassComponentFrame(fiber.type); - disabledDepth++; + default: + return ''; } } -function reenableLogs() { - { - disabledDepth--; - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - var props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe[cannot-write] Flow thinks console is immutable. +function getStackByFiberInDevAndProd(workInProgress) { + try { + var info = ''; + var node = workInProgress; - Object.defineProperties(console, { - log: assign({}, props, { - value: prevLog - }), - info: assign({}, props, { - value: prevInfo - }), - warn: assign({}, props, { - value: prevWarn - }), - error: assign({}, props, { - value: prevError - }), - group: assign({}, props, { - value: prevGroup - }), - groupCollapsed: assign({}, props, { - value: prevGroupCollapsed - }), - groupEnd: assign({}, props, { - value: prevGroupEnd - }) - }); - /* eslint-enable react-internal/no-production-logging */ - } + do { + info += describeFiber(node); - if (disabledDepth < 0) { - error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); - } - } -} + if (true) { + // Add any Server Component stack frames in reverse order. + var debugInfo = node._debugInfo; -var rendererID = null; -var injectedHook = null; -var hasLoggedError = false; -var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; -function injectInternals(internals) { - if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { - // No DevTools - return false; - } + if (debugInfo) { + for (var i = debugInfo.length - 1; i >= 0; i--) { + var entry = debugInfo[i]; - var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (typeof entry.name === 'string') { + info += describeDebugInfoFrame(entry.name, entry.env); + } + } + } + } // $FlowFixMe[incompatible-type] we bail out when we get a null - if (hook.isDisabled) { - // This isn't a real property on the hook, but it can be set to opt out - // of DevTools integration and associated warnings and logs. - // https://github.com/facebook/react/issues/3877 - return true; + + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; } +} - if (!hook.supportsFiber) { - { - error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); - } // DevTools exists, even though it doesn't support Fiber. +var current = null; +var isRendering = false; +function getCurrentFiberOwnerNameInDevOrNull() { + { + if (current === null) { + return null; + } + var owner = current._debugOwner; - return true; + if (owner != null) { + return getComponentNameFromOwner(owner); + } } - try { - if (enableSchedulingProfiler) ; + return null; +} - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. +function getCurrentFiberStackInDev() { + { + if (current === null) { + return ''; + } // Safe because if current fiber exists, we are reconciling, + // and it is guaranteed to be the work-in-progress version. - injectedHook = hook; - } catch (err) { - // Catch all errors because it is unsafe to throw during initialization. - { - error('React instrumentation encountered an error: %s.', err); - } + + return getStackByFiberInDevAndProd(current); } +} - if (hook.checkDCE) { - // This is the real DevTools. - return true; - } else { - // This is likely a hook installed by Fast Refresh runtime. - return false; +function resetCurrentDebugFiberInDEV() { + { + resetCurrentFiber(); } } -function onScheduleRoot(root, children) { +function setCurrentDebugFiberInDEV(fiber) { { - if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { - try { - injectedHook.onScheduleFiberRoot(rendererID, root, children); - } catch (err) { - if (!hasLoggedError) { - hasLoggedError = true; - - error('React instrumentation encountered an error: %s', err); - } - } - } + setCurrentFiber(fiber); } } -function onCommitRoot(root, eventPriority) { - if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { - try { - var didError = (root.current.flags & DidCapture) === DidCapture; +function resetCurrentFiber() { + { + ReactSharedInternals.getCurrentStack = null; + isRendering = false; + } - if (enableProfilerTimer) { - var schedulerPriority; + current = null; +} +function setCurrentFiber(fiber) { + { + ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; + isRendering = false; + } - switch (eventPriority) { - case DiscreteEventPriority: - schedulerPriority = ImmediatePriority; - break; + current = fiber; +} +function getCurrentFiber() { + { + return current; + } +} +function setIsRendering(rendering) { + { + isRendering = rendering; + } +} - case ContinuousEventPriority: - schedulerPriority = UserBlockingPriority; - break; +function getNearestMountedFiber(fiber) { + var node = fiber; + var nearestMounted = fiber; - case DefaultEventPriority: - schedulerPriority = NormalPriority$1; - break; + if (!fiber.alternate) { + // If there is no alternate, this might be a new tree that isn't inserted + // yet. If it is, then it will have a pending insertion effect on it. + var nextNode = node; - case IdleEventPriority: - schedulerPriority = IdlePriority; - break; + do { + node = nextNode; - default: - schedulerPriority = NormalPriority$1; - break; - } + if ((node.flags & (Placement | Hydrating)) !== NoFlags$1) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; + } // $FlowFixMe[incompatible-type] we bail out when we get a null - injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); - } - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } + nextNode = node.return; + } while (nextNode); + } else { + while (node.return) { + node = node.return; } } -} -function onPostCommitRoot(root) { - if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { - try { - injectedHook.onPostCommitFiberRoot(rendererID, root); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; - error('React instrumentation encountered an error: %s', err); - } - } - } - } + if (node.tag === HostRoot) { + // TODO: Check if this was a nested HostRoot when used with + // renderContainerIntoSubtree. + return nearestMounted; + } // If we didn't hit the root, that means that we're in an disconnected tree + // that has been unmounted. + + + return null; } -function onCommitUnmount(fiber) { - if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { - try { - injectedHook.onCommitFiberUnmount(rendererID, fiber); - } catch (err) { - { - if (!hasLoggedError) { - hasLoggedError = true; +function isFiberMounted(fiber) { + return getNearestMountedFiber(fiber) === fiber; +} +function isMounted(component) { + { + var owner = current; - error('React instrumentation encountered an error: %s', err); - } + if (owner !== null && isRendering && owner.tag === ClassComponent) { + var ownerFiber = owner; + var instance = ownerFiber.stateNode; + + if (!instance._warnedAboutRefsInRender) { + error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); } + + instance._warnedAboutRefsInRender = true; } } -} -function setIsStrictModeForDevtools(newIsStrictMode) { - { - if (newIsStrictMode) { - disableLogs(); - } else { - reenableLogs(); - } + + var fiber = get(component); + + if (!fiber) { + return false; } -} // Profiler API hooks -function injectProfilingHooks(profilingHooks) { + return getNearestMountedFiber(fiber) === fiber; } -function getLaneLabelMap() { - { - return null; +function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); } } -var NoMode = -/* */ -0; // TODO: Remove ConcurrentMode by reading from the root tag instead +function findCurrentFiberUsingSlowPath(fiber) { + var alternate = fiber.alternate; -var ConcurrentMode = -/* */ -1; -var ProfileMode = -/* */ -2; -var StrictLegacyMode = -/* */ -8; -var StrictEffectsMode = -/* */ -16; -var ConcurrentUpdatesByDefaultMode = -/* */ -32; -var NoStrictPassiveEffectsMode = -/* */ -64; + if (!alternate) { + // If there is no alternate, then we only need to check if it is mounted. + var nearestMounted = getNearestMountedFiber(fiber); -// TODO: This is pretty well supported by browsers. Maybe we can drop it. -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); + } -var log = Math.log; -var LN2 = Math.LN2; + if (nearestMounted !== fiber) { + return null; + } -function clz32Fallback(x) { - var asUint = x >>> 0; + return fiber; + } // If we have two possible branches, we'll walk backwards up to the root + // to see what path the root points to. On the way we may hit one of the + // special cases and we'll deal with them. - if (asUint === 0) { - return 32; - } - return 31 - (log(asUint) / LN2 | 0) | 0; -} + var a = fiber; + var b = alternate; -// If those values are changed that package should be rebuilt and redeployed. + while (true) { + var parentA = a.return; -var TotalLanes = 31; -var NoLanes = -/* */ -0; -var NoLane = -/* */ -0; -var SyncHydrationLane = -/* */ -1; -var SyncLane = -/* */ -2; -var SyncLaneIndex = 1; -var InputContinuousHydrationLane = -/* */ -4; -var InputContinuousLane = -/* */ -8; -var DefaultHydrationLane = -/* */ -16; -var DefaultLane = -/* */ -32; -var SyncUpdateLanes = SyncLane | InputContinuousLane | DefaultLane ; -var TransitionHydrationLane = -/* */ -64; -var TransitionLanes = -/* */ -4194176; -var TransitionLane1 = -/* */ -128; -var TransitionLane2 = -/* */ -256; -var TransitionLane3 = -/* */ -512; -var TransitionLane4 = -/* */ -1024; -var TransitionLane5 = -/* */ -2048; -var TransitionLane6 = -/* */ -4096; -var TransitionLane7 = -/* */ -8192; -var TransitionLane8 = -/* */ -16384; -var TransitionLane9 = -/* */ -32768; -var TransitionLane10 = -/* */ -65536; -var TransitionLane11 = -/* */ -131072; -var TransitionLane12 = -/* */ -262144; -var TransitionLane13 = -/* */ -524288; -var TransitionLane14 = -/* */ -1048576; -var TransitionLane15 = -/* */ -2097152; -var RetryLanes = -/* */ -62914560; -var RetryLane1 = -/* */ -4194304; -var RetryLane2 = -/* */ -8388608; -var RetryLane3 = -/* */ -16777216; -var RetryLane4 = -/* */ -33554432; -var SomeRetryLane = RetryLane1; -var SelectiveHydrationLane = -/* */ -67108864; -var NonIdleLanes = -/* */ -134217727; -var IdleHydrationLane = -/* */ -134217728; -var IdleLane = -/* */ -268435456; -var OffscreenLane = -/* */ -536870912; -var DeferredLane = -/* */ -1073741824; // Any lane that might schedule an update. This is used to detect infinite -// update loops, so it doesn't include hydration lanes or retries. + if (parentA === null) { + // We're at the root. + break; + } -var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) -var NoTimestamp = -1; -var nextTransitionLane = TransitionLane1; -var nextRetryLane = RetryLane1; + var parentB = parentA.alternate; -function getHighestPriorityLanes(lanes) { - { - var pendingSyncLanes = lanes & SyncUpdateLanes; + if (parentB === null) { + // There is no alternate. This is an unusual case. Currently, it only + // happens when a Suspense component is hidden. An extra fragment fiber + // is inserted in between the Suspense fiber and its children. Skip + // over this extra fragment fiber and proceed to the next parent. + var nextParent = parentA.return; - if (pendingSyncLanes !== 0) { - return pendingSyncLanes; - } - } + if (nextParent !== null) { + a = b = nextParent; + continue; + } // If there's no parent, we're at the root. - switch (getHighestPriorityLane(lanes)) { - case SyncHydrationLane: - return SyncHydrationLane; - case SyncLane: - return SyncLane; + break; + } // If both copies of the parent fiber point to the same child, we can + // assume that the child is current. This happens when we bailout on low + // priority: the bailed out fiber's child reuses the current child. - case InputContinuousHydrationLane: - return InputContinuousHydrationLane; - case InputContinuousLane: - return InputContinuousLane; + if (parentA.child === parentB.child) { + var child = parentA.child; - case DefaultHydrationLane: - return DefaultHydrationLane; + while (child) { + if (child === a) { + // We've determined that A is the current branch. + assertIsMounted(parentA); + return fiber; + } - case DefaultLane: - return DefaultLane; + if (child === b) { + // We've determined that B is the current branch. + assertIsMounted(parentA); + return alternate; + } - case TransitionHydrationLane: - return TransitionHydrationLane; + child = child.sibling; + } // We should never have an alternate for any mounting node. So the only + // way this could possibly happen is if this was unmounted, if at all. - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return lanes & TransitionLanes; - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - return lanes & RetryLanes; + throw new Error('Unable to find node on an unmounted component.'); + } - case SelectiveHydrationLane: - return SelectiveHydrationLane; + if (a.return !== b.return) { + // The return pointer of A and the return pointer of B point to different + // fibers. We assume that return pointers never criss-cross, so A must + // belong to the child set of A.return, and B must belong to the child + // set of B.return. + a = parentA; + b = parentB; + } else { + // The return pointers point to the same fiber. We'll have to use the + // default, slow path: scan the child sets of each parent alternate to see + // which child belongs to which set. + // + // Search parent A's child set + var didFindChild = false; + var _child = parentA.child; - case IdleHydrationLane: - return IdleHydrationLane; + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentA; + b = parentB; + break; + } - case IdleLane: - return IdleLane; + if (_child === b) { + didFindChild = true; + b = parentA; + a = parentB; + break; + } - case OffscreenLane: - return OffscreenLane; + _child = _child.sibling; + } - case DeferredLane: - // This shouldn't be reachable because deferred work is always entangled - // with something else. - return NoLanes; + if (!didFindChild) { + // Search parent B's child set + _child = parentB.child; - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } // This shouldn't be reachable, but as a fallback, return the entire bitmask. + while (_child) { + if (_child === a) { + didFindChild = true; + a = parentB; + b = parentA; + break; + } + if (_child === b) { + didFindChild = true; + b = parentB; + a = parentA; + break; + } - return lanes; - } -} + _child = _child.sibling; + } -function getNextLanes(root, wipLanes) { - // Early bailout if there's no pending work left. - var pendingLanes = root.pendingLanes; + if (!didFindChild) { + throw new 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 (pendingLanes === NoLanes) { - return NoLanes; - } + if (a.alternate !== b) { + throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); + } + } // If the root is not a host container, we're in a disconnected tree. I.e. + // unmounted. - var nextLanes = NoLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, - // even if the work is suspended. - var nonIdlePendingLanes = pendingLanes & NonIdleLanes; + if (a.tag !== HostRoot) { + throw new Error('Unable to find node on an unmounted component.'); + } - if (nonIdlePendingLanes !== NoLanes) { - var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (a.stateNode.current === a) { + // We've determined that A is the current branch. + return fiber; + } // Otherwise B has to be current branch. - if (nonIdleUnblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); - } else { - var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if (nonIdlePingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); - } - } - } else { - // The only remaining work is Idle. - var unblockedLanes = pendingLanes & ~suspendedLanes; + return alternate; +} +function findCurrentHostFiber(parent) { + var currentParent = findCurrentFiberUsingSlowPath(parent); + return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; +} - if (unblockedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(unblockedLanes); - } else { - if (pingedLanes !== NoLanes) { - nextLanes = getHighestPriorityLanes(pingedLanes); - } - } - } +function findCurrentHostFiberImpl(node) { + // Next we'll drill down this component to find the first HostComponent/Text. + var tag = node.tag; - if (nextLanes === NoLanes) { - // This should only be reachable if we're suspended - // TODO: Consider warning in this path if a fallback timer is not scheduled. - return NoLanes; - } // If we're already in the middle of a render, switching lanes will interrupt - // it and we'll lose our progress. We should only do this if the new lanes are - // higher priority. + if (tag === HostComponent || tag === HostHoistable || tag === HostSingleton || tag === HostText) { + return node; + } + var child = node.child; - if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't - // bother waiting until the root is complete. - (wipLanes & suspendedLanes) === NoLanes) { - var nextLane = getHighestPriorityLane(nextLanes); - var wipLane = getHighestPriorityLane(wipLanes); + while (child !== null) { + var match = findCurrentHostFiberImpl(child); - if ( // Tests whether the next lane is equal or lower priority than the wip - // one. This works because the bits decrease in priority as you go left. - nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The - // only difference between default updates and transition updates is that - // default updates do not support refresh transitions. - nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { - // Keep working on the existing in-progress tree. Do not interrupt. - return wipLanes; + if (match !== null) { + return match; } + + child = child.sibling; } - return nextLanes; + return null; } -function getEntangledLanes(root, renderLanes) { - var entangledLanes = renderLanes; - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { - // When updates are sync by default, we entangle continuous priority updates - // and default updates, so they render in the same batch. The only reason - // they use separate lanes is because continuous updates should interrupt - // transitions, but default updates should not. - entangledLanes |= entangledLanes & DefaultLane; - } // Check for entangled lanes and add them to the batch. - // - // A lane is said to be entangled with another when it's not allowed to render - // in a batch that does not also include the other lane. Typically we do this - // when multiple updates have the same source, and we only want to respond to - // the most recent event from that source. - // - // Note that we apply entanglements *after* checking for partial work above. - // This means that if a lane is entangled during an interleaved event while - // it's already rendering, we won't interrupt it. This is intentional, since - // entanglement is usually "best effort": we'll try our best to render the - // lanes in the same batch, but it's not worth throwing out partially - // completed work in order to do it. - // TODO: Reconsider this. The counter-argument is that the partial work - // represents an intermediate state, which we don't want to show to the user. - // And by spending extra time finishing it, we're increasing the amount of - // time it takes to show the final state, which is what they are actually - // waiting for. - // - // For those exceptions where entanglement is semantically important, - // we should ensure that there is no partial work at the - // time we apply the entanglement. +function isFiberSuspenseAndTimedOut(fiber) { + var memoizedState = fiber.memoizedState; + return fiber.tag === SuspenseComponent && memoizedState !== null && memoizedState.dehydrated === null; +} +var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare - var allEntangledLanes = root.entangledLanes; +function isArray(a) { + return isArrayImpl(a); +} - if (allEntangledLanes !== NoLanes) { - var entanglements = root.entanglements; - var lanes = entangledLanes & allEntangledLanes; +// This module only exists as an ESM wrapper around the external CommonJS +var scheduleCallback$3 = Scheduler$1.unstable_scheduleCallback; +var cancelCallback$1 = Scheduler$1.unstable_cancelCallback; +var shouldYield = Scheduler$1.unstable_shouldYield; +var requestPaint = Scheduler$1.unstable_requestPaint; +var now$1 = Scheduler$1.unstable_now; +var ImmediatePriority = Scheduler$1.unstable_ImmediatePriority; +var UserBlockingPriority = Scheduler$1.unstable_UserBlockingPriority; +var NormalPriority$1 = Scheduler$1.unstable_NormalPriority; +var IdlePriority = Scheduler$1.unstable_IdlePriority; // this doesn't actually exist on the scheduler, but it *does* - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entangledLanes |= entanglements[index]; - lanes &= ~lane; - } +var rendererID = null; +var injectedHook = null; +var hasLoggedError = false; +var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; +function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // No DevTools + return false; } - return entangledLanes; -} + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; -function computeExpirationTime(lane, currentTime) { - switch (lane) { - case SyncHydrationLane: - case SyncLane: - case InputContinuousHydrationLane: - case InputContinuousLane: - // User interactions should expire slightly more quickly. - // - // NOTE: This is set to the corresponding constant as in Scheduler.js. - // When we made it larger, a product metric in www regressed, suggesting - // there's a user interaction that's being starved by a series of - // synchronous updates. If that theory is correct, the proper solution is - // to fix the starvation. However, this scenario supports the idea that - // expiration times are an important safeguard when starvation - // does happen. - return currentTime + syncLaneExpirationMs; + if (hook.isDisabled) { + // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + } - case DefaultHydrationLane: - case DefaultLane: - case TransitionHydrationLane: - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - return currentTime + transitionLaneExpirationMs; + if (!hook.supportsFiber) { + { + error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://react.dev/link/react-devtools'); + } // DevTools exists, even though it doesn't support Fiber. - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - // TODO: Retries should be allowed to expire if they are CPU bound for - // too long, but when I made this change it caused a spike in browser - // crashes. There must be some other underlying bug; not super urgent but - // ideally should figure out why and fix it. Unfortunately we don't have - // a repro for the crashes, only detected via production metrics. - return NoTimestamp; - case SelectiveHydrationLane: - case IdleHydrationLane: - case IdleLane: - case OffscreenLane: - case DeferredLane: - // Anything idle priority or lower should never expire. - return NoTimestamp; + return true; + } - default: - { - error('Should have found matching lanes. This is a bug in React.'); - } + try { + if (enableSchedulingProfiler) ; - return NoTimestamp; + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + + injectedHook = hook; + } catch (err) { + // Catch all errors because it is unsafe to throw during initialization. + { + error('React instrumentation encountered an error: %s.', err); + } + } + + if (hook.checkDCE) { + // This is the real DevTools. + return true; + } else { + // This is likely a hook installed by Fast Refresh runtime. + return false; } } +function onScheduleRoot(root, children) { + { + if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { + try { + injectedHook.onScheduleFiberRoot(rendererID, root, children); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; -function markStarvedLanesAsExpired(root, currentTime) { - // TODO: This gets called every time we yield. We can optimize by storing - // the earliest expiration time on the root. Then use that to quickly bail out - // of this function. - var pendingLanes = root.pendingLanes; - var suspendedLanes = root.suspendedLanes; - var pingedLanes = root.pingedLanes; - var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their - // expiration time. If so, we'll assume the update is being starved and mark - // it as expired to force it to finish. - // TODO: We should be able to replace this with upgradePendingLanesToSync - // - // We exclude retry lanes because those must always be time sliced, in order - // to unwrap uncached promises. - // TODO: Write a test for this + error('React instrumentation encountered an error: %s', err); + } + } + } + } +} +function onCommitRoot(root, eventPriority) { + if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { + try { + var didError = (root.current.flags & DidCapture) === DidCapture; - var lanes = pendingLanes & ~RetryLanes; + if (enableProfilerTimer) { + var schedulerPriority; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - var expirationTime = expirationTimes[index]; + switch (eventPriority) { + case DiscreteEventPriority: + schedulerPriority = ImmediatePriority; + break; - if (expirationTime === NoTimestamp) { - // Found a pending lane with no expiration time. If it's not suspended, or - // if it's pinged, assume it's CPU-bound. Compute a new expiration time - // using the current time. - if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { - // Assumes timestamps are monotonically increasing. - expirationTimes[index] = computeExpirationTime(lane, currentTime); - } - } else if (expirationTime <= currentTime) { - // This lane expired - root.expiredLanes |= lane; - } + case ContinuousEventPriority: + schedulerPriority = UserBlockingPriority; + break; - lanes &= ~lane; - } -} // This returns the highest priority pending lanes regardless of whether they -function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { - if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { - // The error recovery mechanism is disabled until these lanes are cleared. - return NoLanes; - } + case DefaultEventPriority: + schedulerPriority = NormalPriority$1; + break; - var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; + case IdleEventPriority: + schedulerPriority = IdlePriority; + break; - if (everythingButOffscreen !== NoLanes) { - return everythingButOffscreen; - } + default: + schedulerPriority = NormalPriority$1; + break; + } - if (everythingButOffscreen & OffscreenLane) { - return OffscreenLane; - } + injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); + } + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - return NoLanes; + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function includesSyncLane(lanes) { - return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; +function onPostCommitRoot(root) { + if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { + try { + injectedHook.onPostCommitFiberRoot(rendererID, root); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; + + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function includesNonIdleWork(lanes) { - return (lanes & NonIdleLanes) !== NoLanes; -} -function includesOnlyRetries(lanes) { - return (lanes & RetryLanes) === lanes; -} -function includesOnlyNonUrgentLanes(lanes) { - // TODO: Should hydration lanes be included here? This function is only - // used in `updateDeferredValueImpl`. - var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; - return (lanes & UrgentLanes) === NoLanes; -} -function includesOnlyTransitions(lanes) { - return (lanes & TransitionLanes) === lanes; -} -function includesBlockingLane(root, lanes) { - if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { - // Concurrent updates by default always use time slicing. - return false; - } +function onCommitUnmount(fiber) { + if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { + try { + injectedHook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + { + if (!hasLoggedError) { + hasLoggedError = true; - var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; - return (lanes & SyncDefaultLanes) !== NoLanes; -} -function includesExpiredLane(root, lanes) { - // This is a separate check from includesBlockingLane because a lane can - // expire after a render has already started. - return (lanes & root.expiredLanes) !== NoLanes; -} -function isTransitionLane(lane) { - return (lane & TransitionLanes) !== NoLanes; + error('React instrumentation encountered an error: %s', err); + } + } + } + } } -function claimNextTransitionLane() { - // Cycle through the lanes, assigning each new transition to the next lane. - // In most cases, this means every transition gets its own lane, until we - // run out of lanes and cycle back to the beginning. - var lane = nextTransitionLane; - nextTransitionLane <<= 1; - - if ((nextTransitionLane & TransitionLanes) === NoLanes) { - nextTransitionLane = TransitionLane1; +function setIsStrictModeForDevtools(newIsStrictMode) { + { + if (newIsStrictMode) { + disableLogs(); + } else { + reenableLogs(); + } } +} // Profiler API hooks - return lane; +function injectProfilingHooks(profilingHooks) { } -function claimNextRetryLane() { - var lane = nextRetryLane; - nextRetryLane <<= 1; - if ((nextRetryLane & RetryLanes) === NoLanes) { - nextRetryLane = RetryLane1; +function getLaneLabelMap() { + { + return null; } - - return lane; -} -function getHighestPriorityLane(lanes) { - return lanes & -lanes; -} -function pickArbitraryLane(lanes) { - // This wrapper function gets inlined. Only exists so to communicate that it - // doesn't matter which bit is selected; you can pick any bit without - // affecting the algorithms where its used. Here I'm using - // getHighestPriorityLane because it requires the fewest operations. - return getHighestPriorityLane(lanes); } -function pickArbitraryLaneIndex(lanes) { - return 31 - clz32(lanes); -} +var NoMode = +/* */ +0; // TODO: Remove ConcurrentMode by reading from the root tag instead -function laneToIndex(lane) { - return pickArbitraryLaneIndex(lane); -} +var ConcurrentMode = +/* */ +1; +var ProfileMode = +/* */ +2; +var StrictLegacyMode = +/* */ +8; +var StrictEffectsMode = +/* */ +16; +var ConcurrentUpdatesByDefaultMode = +/* */ +32; +var NoStrictPassiveEffectsMode = +/* */ +64; -function includesSomeLane(a, b) { - return (a & b) !== NoLanes; -} -function isSubsetOfLanes(set, subset) { - return (set & subset) === subset; -} -function mergeLanes(a, b) { - return a | b; -} -function removeLanes(set, subset) { - return set & ~subset; -} -function intersectLanes(a, b) { - return a & b; -} // Seems redundant, but it changes the type from a single lane (used for -// updates) to a group of lanes (used for flushing work). +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 -function laneToLanes(lane) { - return lane; -} -function createLaneMap(initial) { - // Intentionally pushing one by one. - // https://v8.dev/blog/elements-kinds#avoid-creating-holes - var laneMap = []; +var log = Math.log; +var LN2 = Math.LN2; - for (var i = 0; i < TotalLanes; i++) { - laneMap.push(initial); +function clz32Fallback(x) { + var asUint = x >>> 0; + + if (asUint === 0) { + return 32; } - return laneMap; + return 31 - (log(asUint) / LN2 | 0) | 0; } -function markRootUpdated$1(root, updateLane) { - root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update - // could unblock them. Clear the suspended lanes so that we can try rendering - // them again. - // - // TODO: We really only need to unsuspend only lanes that are in the - // `subtreeLanes` of the updated fiber, or the update lanes of the return - // path. This would exclude suspended updates in an unrelated sibling tree, - // since there's no way for this update to unblock it. - // - // We don't do this if the incoming update is idle, because we never process - // idle updates until after all the regular updates have finished; there's no - // way it could unblock a transition. - if (updateLane !== IdleLane) { - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - } -} -function markRootSuspended$1(root, suspendedLanes, spawnedLane) { - root.suspendedLanes |= suspendedLanes; - root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. +// If those values are changed that package should be rebuilt and redeployed. - var expirationTimes = root.expirationTimes; - var lanes = suspendedLanes; +var TotalLanes = 31; +var NoLanes = +/* */ +0; +var NoLane = +/* */ +0; +var SyncHydrationLane = +/* */ +1; +var SyncLane = +/* */ +2; +var SyncLaneIndex = 1; +var InputContinuousHydrationLane = +/* */ +4; +var InputContinuousLane = +/* */ +8; +var DefaultHydrationLane = +/* */ +16; +var DefaultLane = +/* */ +32; +var SyncUpdateLanes = SyncLane | InputContinuousLane | DefaultLane ; +var TransitionHydrationLane = +/* */ +64; +var TransitionLanes = +/* */ +4194176; +var TransitionLane1 = +/* */ +128; +var TransitionLane2 = +/* */ +256; +var TransitionLane3 = +/* */ +512; +var TransitionLane4 = +/* */ +1024; +var TransitionLane5 = +/* */ +2048; +var TransitionLane6 = +/* */ +4096; +var TransitionLane7 = +/* */ +8192; +var TransitionLane8 = +/* */ +16384; +var TransitionLane9 = +/* */ +32768; +var TransitionLane10 = +/* */ +65536; +var TransitionLane11 = +/* */ +131072; +var TransitionLane12 = +/* */ +262144; +var TransitionLane13 = +/* */ +524288; +var TransitionLane14 = +/* */ +1048576; +var TransitionLane15 = +/* */ +2097152; +var RetryLanes = +/* */ +62914560; +var RetryLane1 = +/* */ +4194304; +var RetryLane2 = +/* */ +8388608; +var RetryLane3 = +/* */ +16777216; +var RetryLane4 = +/* */ +33554432; +var SomeRetryLane = RetryLane1; +var SelectiveHydrationLane = +/* */ +67108864; +var NonIdleLanes = +/* */ +134217727; +var IdleHydrationLane = +/* */ +134217728; +var IdleLane = +/* */ +268435456; +var OffscreenLane = +/* */ +536870912; +var DeferredLane = +/* */ +1073741824; // Any lane that might schedule an update. This is used to detect infinite +// update loops, so it doesn't include hydration lanes or retries. - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - expirationTimes[index] = NoTimestamp; - lanes &= ~lane; - } +var UpdateLanes = SyncLane | InputContinuousLane | DefaultLane | TransitionLanes; // This function is used for the experimental timeline (react-devtools-timeline) +var NoTimestamp = -1; +var nextTransitionLane = TransitionLane1; +var nextRetryLane = RetryLane1; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); +function getHighestPriorityLanes(lanes) { + { + var pendingSyncLanes = lanes & SyncUpdateLanes; + + if (pendingSyncLanes !== 0) { + return pendingSyncLanes; + } } -} -function markRootPinged$1(root, pingedLanes) { - root.pingedLanes |= root.suspendedLanes & pingedLanes; -} -function markRootFinished(root, remainingLanes, spawnedLane) { - var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; - root.pendingLanes = remainingLanes; // Let's try everything again - root.suspendedLanes = NoLanes; - root.pingedLanes = NoLanes; - root.expiredLanes &= remainingLanes; - root.entangledLanes &= remainingLanes; - root.errorRecoveryDisabledLanes &= remainingLanes; - root.shellSuspendCounter = 0; - var entanglements = root.entanglements; - var expirationTimes = root.expirationTimes; - var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work + switch (getHighestPriorityLane(lanes)) { + case SyncHydrationLane: + return SyncHydrationLane; - var lanes = noLongerPendingLanes; + case SyncLane: + return SyncLane; - while (lanes > 0) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; - entanglements[index] = NoLanes; - expirationTimes[index] = NoTimestamp; - var hiddenUpdatesForLane = hiddenUpdates[index]; + case InputContinuousHydrationLane: + return InputContinuousHydrationLane; + + case InputContinuousLane: + return InputContinuousLane; - if (hiddenUpdatesForLane !== null) { - hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They - // have special logic associated with them because they may be entangled - // with updates that occur outside that tree. But once the outer tree - // commits, they behave like regular updates. + case DefaultHydrationLane: + return DefaultHydrationLane; - for (var i = 0; i < hiddenUpdatesForLane.length; i++) { - var update = hiddenUpdatesForLane[i]; + case DefaultLane: + return DefaultLane; - if (update !== null) { - update.lane &= ~OffscreenLane; - } - } - } + case TransitionHydrationLane: + return TransitionHydrationLane; - lanes &= ~lane; - } + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return lanes & TransitionLanes; - if (spawnedLane !== NoLane) { - markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need - // to entangle the spawned task with the parent task. - NoLanes); - } -} + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + return lanes & RetryLanes; -function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { - // This render spawned a deferred task. Mark it as pending. - root.pendingLanes |= spawnedLane; - root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it - // was the result of another render. This lets us avoid a useDeferredValue - // waterfall — only the first level will defer. + case SelectiveHydrationLane: + return SelectiveHydrationLane; - var spawnedLaneIndex = laneToIndex(spawnedLane); - root.entangledLanes |= spawnedLane; - root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes - // with the spawned task, so that the deferred task includes all the same - // updates that the parent task did. We can exclude any lane that is not - // used for updates (e.g. Offscreen). - entangledLanes & UpdateLanes; -} + case IdleHydrationLane: + return IdleHydrationLane; -function markRootEntangled(root, entangledLanes) { - // In addition to entangling each of the given lanes with each other, we also - // have to consider _transitive_ entanglements. For each lane that is already - // entangled with *any* of the given lanes, that lane is now transitively - // entangled with *all* the given lanes. - // - // Translated: If C is entangled with A, then entangling A with B also - // entangles C with B. - // - // If this is hard to grasp, it might help to intentionally break this - // function and look at the tests that fail in ReactTransition-test.js. Try - // commenting out one of the conditions below. - var rootEntangledLanes = root.entangledLanes |= entangledLanes; - var entanglements = root.entanglements; - var lanes = rootEntangledLanes; + case IdleLane: + return IdleLane; - while (lanes) { - var index = pickArbitraryLaneIndex(lanes); - var lane = 1 << index; + case OffscreenLane: + return OffscreenLane; - if ( // Is this one of the newly entangled lanes? - lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? - entanglements[index] & entangledLanes) { - entanglements[index] |= entangledLanes; - } + case DeferredLane: + // This shouldn't be reachable because deferred work is always entangled + // with something else. + return NoLanes; - lanes &= ~lane; - } -} -function upgradePendingLaneToSync(root, lane) { - // Since we're upgrading the priority of the given lane, there is now pending - // sync work. - root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane - // will not be allowed to finish without also finishing the given lane. + default: + { + error('Should have found matching lanes. This is a bug in React.'); + } // This shouldn't be reachable, but as a fallback, return the entire bitmask. - root.entangledLanes |= SyncLane; - root.entanglements[SyncLaneIndex] |= lane; -} -function markHiddenUpdate(root, update, lane) { - var index = laneToIndex(lane); - var hiddenUpdates = root.hiddenUpdates; - var hiddenUpdatesForLane = hiddenUpdates[index]; - if (hiddenUpdatesForLane === null) { - hiddenUpdates[index] = [update]; - } else { - hiddenUpdatesForLane.push(update); + return lanes; } - - update.lane = lane | OffscreenLane; } -function getBumpedLaneForHydration(root, renderLanes) { - var renderLane = getHighestPriorityLane(renderLanes); - var lane; - - if ((renderLane & SyncUpdateLanes) !== NoLane) { - lane = SyncHydrationLane; - } else { - switch (renderLane) { - case SyncLane: - lane = SyncHydrationLane; - break; - case InputContinuousLane: - lane = InputContinuousHydrationLane; - break; +function getNextLanes(root, wipLanes) { + // Early bailout if there's no pending work left. + var pendingLanes = root.pendingLanes; - case DefaultLane: - lane = DefaultHydrationLane; - break; + if (pendingLanes === NoLanes) { + return NoLanes; + } - case TransitionLane1: - case TransitionLane2: - case TransitionLane3: - case TransitionLane4: - case TransitionLane5: - case TransitionLane6: - case TransitionLane7: - case TransitionLane8: - case TransitionLane9: - case TransitionLane10: - case TransitionLane11: - case TransitionLane12: - case TransitionLane13: - case TransitionLane14: - case TransitionLane15: - case RetryLane1: - case RetryLane2: - case RetryLane3: - case RetryLane4: - lane = TransitionHydrationLane; - break; + var nextLanes = NoLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, + // even if the work is suspended. - case IdleLane: - lane = IdleHydrationLane; - break; + var nonIdlePendingLanes = pendingLanes & NonIdleLanes; - default: - // Everything else is already either a hydration lane, or shouldn't - // be retried at a hydration lane. - lane = NoLane; - break; - } - } // Check if the lane we chose is suspended. If so, that indicates that we - // already attempted and failed to hydrate at that level. Also check if we're - // already rendering that lane, which is rare but could happen. + if (nonIdlePendingLanes !== NoLanes) { + var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; + if (nonIdleUnblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); + } else { + var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; - if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { - // Give up trying to hydrate and fall back to client render. - return NoLane; - } + if (nonIdlePingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); + } + } + } else { + // The only remaining work is Idle. + var unblockedLanes = pendingLanes & ~suspendedLanes; - return lane; -} -function getTransitionsForLanes(root, lanes) { - { - return null; + if (unblockedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(unblockedLanes); + } else { + if (pingedLanes !== NoLanes) { + nextLanes = getHighestPriorityLanes(pingedLanes); + } + } } -} -var NoEventPriority = NoLane; -var DiscreteEventPriority = SyncLane; -var ContinuousEventPriority = InputContinuousLane; -var DefaultEventPriority = DefaultLane; -var IdleEventPriority = IdleLane; -function higherEventPriority(a, b) { - return a !== 0 && a < b ? a : b; -} -function lowerEventPriority(a, b) { - return a === 0 || a > b ? a : b; -} -function isHigherEventPriority(a, b) { - return a !== 0 && a < b; -} -function eventPriorityToLane(updatePriority) { - return updatePriority; -} -function lanesToEventPriority(lanes) { - var lane = getHighestPriorityLane(lanes); + if (nextLanes === NoLanes) { + // This should only be reachable if we're suspended + // TODO: Consider warning in this path if a fallback timer is not scheduled. + return NoLanes; + } // If we're already in the middle of a render, switching lanes will interrupt + // it and we'll lose our progress. We should only do this if the new lanes are + // higher priority. - if (!isHigherEventPriority(DiscreteEventPriority, lane)) { - return DiscreteEventPriority; - } - if (!isHigherEventPriority(ContinuousEventPriority, lane)) { - return ContinuousEventPriority; - } + if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't + // bother waiting until the root is complete. + (wipLanes & suspendedLanes) === NoLanes) { + var nextLane = getHighestPriorityLane(nextLanes); + var wipLane = getHighestPriorityLane(wipLanes); - if (includesNonIdleWork(lane)) { - return DefaultEventPriority; + if ( // Tests whether the next lane is equal or lower priority than the wip + // one. This works because the bits decrease in priority as you go left. + nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The + // only difference between default updates and transition updates is that + // default updates do not support refresh transitions. + nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { + // Keep working on the existing in-progress tree. Do not interrupt. + return wipLanes; + } } - return IdleEventPriority; + return nextLanes; } +function getEntangledLanes(root, renderLanes) { + var entangledLanes = renderLanes; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim$1() { - throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Hydration (when unsupported) + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) ; else if ((entangledLanes & InputContinuousLane) !== NoLanes) { + // When updates are sync by default, we entangle continuous priority updates + // and default updates, so they render in the same batch. The only reason + // they use separate lanes is because continuous updates should interrupt + // transitions, but default updates should not. + entangledLanes |= entangledLanes & DefaultLane; + } // Check for entangled lanes and add them to the batch. + // + // A lane is said to be entangled with another when it's not allowed to render + // in a batch that does not also include the other lane. Typically we do this + // when multiple updates have the same source, and we only want to respond to + // the most recent event from that source. + // + // Note that we apply entanglements *after* checking for partial work above. + // This means that if a lane is entangled during an interleaved event while + // it's already rendering, we won't interrupt it. This is intentional, since + // entanglement is usually "best effort": we'll try our best to render the + // lanes in the same batch, but it's not worth throwing out partially + // completed work in order to do it. + // TODO: Reconsider this. The counter-argument is that the partial work + // represents an intermediate state, which we don't want to show to the user. + // And by spending extra time finishing it, we're increasing the amount of + // time it takes to show the final state, which is what they are actually + // waiting for. + // + // For those exceptions where entanglement is semantically important, + // we should ensure that there is no partial work at the + // time we apply the entanglement. -var supportsHydration = false; -var isSuspenseInstancePending = shim$1; -var isSuspenseInstanceFallback = shim$1; -var getSuspenseInstanceFallbackErrorDetails = shim$1; -var registerSuspenseInstanceRetry = shim$1; -var clearSuspenseBoundary = shim$1; -var clearSuspenseBoundaryFromContainer = shim$1; + var allEntangledLanes = root.entangledLanes; -// Renderers that don't support hydration -// can re-export everything from this module. -function shim() { - throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); -} // Resources (when unsupported) -var preloadResource = shim; -var suspendResource = shim; + if (allEntangledLanes !== NoLanes) { + var entanglements = root.entanglements; + var lanes = entangledLanes & allEntangledLanes; -var NO_CONTEXT = {}; -var nodeToInstanceMap = new WeakMap(); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entangledLanes |= entanglements[index]; + lanes &= ~lane; + } + } -{ - Object.freeze(NO_CONTEXT); + return entangledLanes; } -function getPublicInstance(inst) { - switch (inst.tag) { - case 'INSTANCE': - var createNodeMock = inst.rootContainerInstance.createNodeMock; - var mockNode = createNodeMock({ - type: inst.type, - props: inst.props - }); +function computeExpirationTime(lane, currentTime) { + switch (lane) { + case SyncHydrationLane: + case SyncLane: + case InputContinuousHydrationLane: + case InputContinuousLane: + // User interactions should expire slightly more quickly. + // + // NOTE: This is set to the corresponding constant as in Scheduler.js. + // When we made it larger, a product metric in www regressed, suggesting + // there's a user interaction that's being starved by a series of + // synchronous updates. If that theory is correct, the proper solution is + // to fix the starvation. However, this scenario supports the idea that + // expiration times are an important safeguard when starvation + // does happen. + return currentTime + syncLaneExpirationMs; - if (typeof mockNode === 'object' && mockNode !== null) { - nodeToInstanceMap.set(mockNode, inst); - } + case DefaultHydrationLane: + case DefaultLane: + case TransitionHydrationLane: + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + return currentTime + transitionLaneExpirationMs; - return mockNode; + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + // TODO: Retries should be allowed to expire if they are CPU bound for + // too long, but when I made this change it caused a spike in browser + // crashes. There must be some other underlying bug; not super urgent but + // ideally should figure out why and fix it. Unfortunately we don't have + // a repro for the crashes, only detected via production metrics. + return NoTimestamp; + + case SelectiveHydrationLane: + case IdleHydrationLane: + case IdleLane: + case OffscreenLane: + case DeferredLane: + // Anything idle priority or lower should never expire. + return NoTimestamp; default: - return inst; + { + error('Should have found matching lanes. This is a bug in React.'); + } + + return NoTimestamp; } } -function appendChild(parentInstance, child) { - { - if (!isArray(parentInstance.children)) { - error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); - } - } - var index = parentInstance.children.indexOf(child); +function markStarvedLanesAsExpired(root, currentTime) { + // TODO: This gets called every time we yield. We can optimize by storing + // the earliest expiration time on the root. Then use that to quickly bail out + // of this function. + var pendingLanes = root.pendingLanes; + var suspendedLanes = root.suspendedLanes; + var pingedLanes = root.pingedLanes; + var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their + // expiration time. If so, we'll assume the update is being starved and mark + // it as expired to force it to finish. + // TODO: We should be able to replace this with upgradePendingLanesToSync + // + // We exclude retry lanes because those must always be time sliced, in order + // to unwrap uncached promises. + // TODO: Write a test for this - if (index !== -1) { - parentInstance.children.splice(index, 1); - } + var lanes = pendingLanes & ~RetryLanes; - parentInstance.children.push(child); -} -function insertBefore(parentInstance, child, beforeChild) { - var index = parentInstance.children.indexOf(child); + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + var expirationTime = expirationTimes[index]; - if (index !== -1) { - parentInstance.children.splice(index, 1); + if (expirationTime === NoTimestamp) { + // Found a pending lane with no expiration time. If it's not suspended, or + // if it's pinged, assume it's CPU-bound. Compute a new expiration time + // using the current time. + if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { + // Assumes timestamps are monotonically increasing. + expirationTimes[index] = computeExpirationTime(lane, currentTime); + } + } else if (expirationTime <= currentTime) { + // This lane expired + root.expiredLanes |= lane; + } + + lanes &= ~lane; + } +} // This returns the highest priority pending lanes regardless of whether they +function getLanesToRetrySynchronouslyOnError(root, originallyAttemptedLanes) { + if (root.errorRecoveryDisabledLanes & originallyAttemptedLanes) { + // The error recovery mechanism is disabled until these lanes are cleared. + return NoLanes; } - var beforeIndex = parentInstance.children.indexOf(beforeChild); - parentInstance.children.splice(beforeIndex, 0, child); -} -function removeChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); - parentInstance.children.splice(index, 1); -} -function clearContainer(container) { - container.children.splice(0); -} -function getRootHostContext(rootContainerInstance) { - return NO_CONTEXT; -} -function getChildHostContext(parentHostContext, type) { - return NO_CONTEXT; -} -function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - type: type, - props: props, - isHidden: false, - children: [], - internalInstanceHandle: internalInstanceHandle, - rootContainerInstance: rootContainerInstance, - tag: 'INSTANCE' - }; -} -function appendInitialChild(parentInstance, child) { - var index = parentInstance.children.indexOf(child); + var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; - if (index !== -1) { - parentInstance.children.splice(index, 1); + if (everythingButOffscreen !== NoLanes) { + return everythingButOffscreen; } - - parentInstance.children.push(child); -} -function shouldSetTextContent(type, props) { - return false; -} -function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { - return { - text: text, - isHidden: false, - tag: 'TEXT' - }; -} -var currentUpdatePriority = NoEventPriority; -function setCurrentUpdatePriority(newPriority) { - currentUpdatePriority = newPriority; -} -function getCurrentUpdatePriority() { - return currentUpdatePriority; -} -function resolveUpdatePriority() { - if (currentUpdatePriority !== NoEventPriority) { - return currentUpdatePriority; + + if (everythingButOffscreen & OffscreenLane) { + return OffscreenLane; } - return DefaultEventPriority; -} -function shouldAttemptEagerTransition() { - return false; + return NoLanes; } -var scheduleTimeout = setTimeout; -var cancelTimeout = clearTimeout; -var noTimeout = -1; // ------------------- -function commitUpdate(instance, type, oldProps, newProps, internalInstanceHandle) { - instance.type = type; - instance.props = newProps; +function includesSyncLane(lanes) { + return (lanes & (SyncLane | SyncHydrationLane)) !== NoLanes; } -function commitMount(instance, type, newProps, internalInstanceHandle) {// noop +function includesNonIdleWork(lanes) { + return (lanes & NonIdleLanes) !== NoLanes; } -function commitTextUpdate(textInstance, oldText, newText) { - textInstance.text = newText; +function includesOnlyRetries(lanes) { + return (lanes & RetryLanes) === lanes; } -function resetTextContent(testElement) {// noop +function includesOnlyNonUrgentLanes(lanes) { + // TODO: Should hydration lanes be included here? This function is only + // used in `updateDeferredValueImpl`. + var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; + return (lanes & UrgentLanes) === NoLanes; } -var appendChildToContainer = appendChild; -var insertInContainerBefore = insertBefore; -var removeChildFromContainer = removeChild; -function hideInstance(instance) { - instance.isHidden = true; +function includesOnlyTransitions(lanes) { + return (lanes & TransitionLanes) === lanes; } -function hideTextInstance(textInstance) { - textInstance.isHidden = true; +function includesBlockingLane(root, lanes) { + if ((root.current.mode & ConcurrentUpdatesByDefaultMode) !== NoMode) { + // Concurrent updates by default always use time slicing. + return false; + } + + var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; + return (lanes & SyncDefaultLanes) !== NoLanes; } -function unhideInstance(instance, props) { - instance.isHidden = false; +function includesExpiredLane(root, lanes) { + // This is a separate check from includesBlockingLane because a lane can + // expire after a render has already started. + return (lanes & root.expiredLanes) !== NoLanes; } -function unhideTextInstance(textInstance, text) { - textInstance.isHidden = false; +function isTransitionLane(lane) { + return (lane & TransitionLanes) !== NoLanes; } -function getInstanceFromNode(mockNode) { - var instance = nodeToInstanceMap.get(mockNode); +function claimNextTransitionLane() { + // Cycle through the lanes, assigning each new transition to the next lane. + // In most cases, this means every transition gets its own lane, until we + // run out of lanes and cycle back to the beginning. + var lane = nextTransitionLane; + nextTransitionLane <<= 1; - if (instance !== undefined) { - return instance.internalInstanceHandle; + if ((nextTransitionLane & TransitionLanes) === NoLanes) { + nextTransitionLane = TransitionLane1; } - return null; -} -function prepareScopeUpdate(scopeInstance, inst) { - nodeToInstanceMap.set(scopeInstance, inst); + return lane; } -function getInstanceFromScope(scopeInstance) { - return nodeToInstanceMap.get(scopeInstance) || null; +function claimNextRetryLane() { + var lane = nextRetryLane; + nextRetryLane <<= 1; + + if ((nextRetryLane & RetryLanes) === NoLanes) { + nextRetryLane = RetryLane1; + } + + return lane; } -function preloadInstance(type, props) { - // Return true to indicate it's already loaded - return true; +function getHighestPriorityLane(lanes) { + return lanes & -lanes; } -function waitForCommitToBeReady() { - return null; +function pickArbitraryLane(lanes) { + // This wrapper function gets inlined. Only exists so to communicate that it + // doesn't matter which bit is selected; you can pick any bit without + // affecting the algorithms where its used. Here I'm using + // getHighestPriorityLane because it requires the fewest operations. + return getHighestPriorityLane(lanes); } -var NotPendingTransition = null; - -var valueStack = []; -var fiberStack; -{ - fiberStack = []; +function pickArbitraryLaneIndex(lanes) { + return 31 - clz32(lanes); } -var index = -1; +function laneToIndex(lane) { + return pickArbitraryLaneIndex(lane); +} -function createCursor(defaultValue) { - return { - current: defaultValue - }; +function includesSomeLane(a, b) { + return (a & b) !== NoLanes; +} +function isSubsetOfLanes(set, subset) { + return (set & subset) === subset; +} +function mergeLanes(a, b) { + return a | b; +} +function removeLanes(set, subset) { + return set & ~subset; } +function intersectLanes(a, b) { + return a & b; +} // Seems redundant, but it changes the type from a single lane (used for +// updates) to a group of lanes (used for flushing work). -function pop(cursor, fiber) { - if (index < 0) { - { - error('Unexpected pop.'); - } +function laneToLanes(lane) { + return lane; +} +function createLaneMap(initial) { + // Intentionally pushing one by one. + // https://v8.dev/blog/elements-kinds#avoid-creating-holes + var laneMap = []; - return; + for (var i = 0; i < TotalLanes; i++) { + laneMap.push(initial); } - { - if (fiber !== fiberStack[index]) { - error('Unexpected Fiber popped.'); - } + return laneMap; +} +function markRootUpdated$1(root, updateLane) { + root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update + // could unblock them. Clear the suspended lanes so that we can try rendering + // them again. + // + // TODO: We really only need to unsuspend only lanes that are in the + // `subtreeLanes` of the updated fiber, or the update lanes of the return + // path. This would exclude suspended updates in an unrelated sibling tree, + // since there's no way for this update to unblock it. + // + // We don't do this if the incoming update is idle, because we never process + // idle updates until after all the regular updates have finished; there's no + // way it could unblock a transition. + + if (updateLane !== IdleLane) { + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; } +} +function markRootSuspended$1(root, suspendedLanes, spawnedLane) { + root.suspendedLanes |= suspendedLanes; + root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. - cursor.current = valueStack[index]; - valueStack[index] = null; + var expirationTimes = root.expirationTimes; + var lanes = suspendedLanes; - { - fiberStack[index] = null; + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + expirationTimes[index] = NoTimestamp; + lanes &= ~lane; } - index--; + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, suspendedLanes); + } +} +function markRootPinged$1(root, pingedLanes) { + root.pingedLanes |= root.suspendedLanes & pingedLanes; } +function markRootFinished(root, remainingLanes, spawnedLane) { + var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; + root.pendingLanes = remainingLanes; // Let's try everything again -function push(cursor, value, fiber) { - index++; - valueStack[index] = cursor.current; + root.suspendedLanes = NoLanes; + root.pingedLanes = NoLanes; + root.expiredLanes &= remainingLanes; + root.entangledLanes &= remainingLanes; + root.errorRecoveryDisabledLanes &= remainingLanes; + root.shellSuspendCounter = 0; + var entanglements = root.entanglements; + var expirationTimes = root.expirationTimes; + var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work - { - fiberStack[index] = fiber; - } + var lanes = noLongerPendingLanes; - cursor.current = value; -} + while (lanes > 0) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; + entanglements[index] = NoLanes; + expirationTimes[index] = NoTimestamp; + var hiddenUpdatesForLane = hiddenUpdates[index]; -var warnedAboutMissingGetChildContext; + if (hiddenUpdatesForLane !== null) { + hiddenUpdates[index] = null; // "Hidden" updates are updates that were made to a hidden component. They + // have special logic associated with them because they may be entangled + // with updates that occur outside that tree. But once the outer tree + // commits, they behave like regular updates. -{ - warnedAboutMissingGetChildContext = {}; -} + for (var i = 0; i < hiddenUpdatesForLane.length; i++) { + var update = hiddenUpdatesForLane[i]; -var emptyContextObject = {}; + if (update !== null) { + update.lane &= ~OffscreenLane; + } + } + } -{ - Object.freeze(emptyContextObject); -} // A cursor to the current merged context object on the stack. + lanes &= ~lane; + } + + if (spawnedLane !== NoLane) { + markSpawnedDeferredLane(root, spawnedLane, // This render finished successfully without suspending, so we don't need + // to entangle the spawned task with the parent task. + NoLanes); + } +} +function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { + // This render spawned a deferred task. Mark it as pending. + root.pendingLanes |= spawnedLane; + root.suspendedLanes &= ~spawnedLane; // Entangle the spawned lane with the DeferredLane bit so that we know it + // was the result of another render. This lets us avoid a useDeferredValue + // waterfall — only the first level will defer. -var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. + var spawnedLaneIndex = laneToIndex(spawnedLane); + root.entangledLanes |= spawnedLane; + root.entanglements[spawnedLaneIndex] |= DeferredLane | // If the parent render task suspended, we must also entangle those lanes + // with the spawned task, so that the deferred task includes all the same + // updates that the parent task did. We can exclude any lane that is not + // used for updates (e.g. Offscreen). + entangledLanes & UpdateLanes; +} -var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. -// We use this to get access to the parent context after we have already -// pushed the next context provider, and now need to merge their contexts. +function markRootEntangled(root, entangledLanes) { + // In addition to entangling each of the given lanes with each other, we also + // have to consider _transitive_ entanglements. For each lane that is already + // entangled with *any* of the given lanes, that lane is now transitively + // entangled with *all* the given lanes. + // + // Translated: If C is entangled with A, then entangling A with B also + // entangles C with B. + // + // If this is hard to grasp, it might help to intentionally break this + // function and look at the tests that fail in ReactTransition-test.js. Try + // commenting out one of the conditions below. + var rootEntangledLanes = root.entangledLanes |= entangledLanes; + var entanglements = root.entanglements; + var lanes = rootEntangledLanes; -var previousContext = emptyContextObject; + while (lanes) { + var index = pickArbitraryLaneIndex(lanes); + var lane = 1 << index; -function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { - { - if (didPushOwnContextIfProvider && isContextProvider(Component)) { - // If the fiber is a context provider itself, when we read its context - // we may have already pushed its own child context on the stack. A context - // provider should not "see" its own child context. Therefore we read the - // previous (parent) context instead for a context provider. - return previousContext; + if ( // Is this one of the newly entangled lanes? + lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? + entanglements[index] & entangledLanes) { + entanglements[index] |= entangledLanes; } - return contextStackCursor$1.current; + lanes &= ~lane; } } +function upgradePendingLaneToSync(root, lane) { + // Since we're upgrading the priority of the given lane, there is now pending + // sync work. + root.pendingLanes |= SyncLane; // Entangle the sync lane with the lane we're upgrading. This means SyncLane + // will not be allowed to finish without also finishing the given lane. -function cacheContext(workInProgress, unmaskedContext, maskedContext) { - { - var instance = workInProgress.stateNode; - instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; - instance.__reactInternalMemoizedMaskedChildContext = maskedContext; - } + root.entangledLanes |= SyncLane; + root.entanglements[SyncLaneIndex] |= lane; } +function markHiddenUpdate(root, update, lane) { + var index = laneToIndex(lane); + var hiddenUpdates = root.hiddenUpdates; + var hiddenUpdatesForLane = hiddenUpdates[index]; -function getMaskedContext(workInProgress, unmaskedContext) { - { - var type = workInProgress.type; - var contextTypes = type.contextTypes; - - if (!contextTypes) { - return emptyContextObject; - } // Avoid recreating masked context unless unmasked context has changed. - // Failing to do this will result in unnecessary calls to componentWillReceiveProps. - // This may trigger infinite loops if componentWillReceiveProps calls setState. + if (hiddenUpdatesForLane === null) { + hiddenUpdates[index] = [update]; + } else { + hiddenUpdatesForLane.push(update); + } + update.lane = lane | OffscreenLane; +} +function getBumpedLaneForHydration(root, renderLanes) { + var renderLane = getHighestPriorityLane(renderLanes); + var lane; - var instance = workInProgress.stateNode; + if ((renderLane & SyncUpdateLanes) !== NoLane) { + lane = SyncHydrationLane; + } else { + switch (renderLane) { + case SyncLane: + lane = SyncHydrationLane; + break; - if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { - return instance.__reactInternalMemoizedMaskedChildContext; - } + case InputContinuousLane: + lane = InputContinuousHydrationLane; + break; - var context = {}; + case DefaultLane: + lane = DefaultHydrationLane; + break; - for (var key in contextTypes) { - context[key] = unmaskedContext[key]; - } // Cache unmasked context so we can avoid recreating masked context unless necessary. - // Context is created before the class component is instantiated so check for instance. + case TransitionLane1: + case TransitionLane2: + case TransitionLane3: + case TransitionLane4: + case TransitionLane5: + case TransitionLane6: + case TransitionLane7: + case TransitionLane8: + case TransitionLane9: + case TransitionLane10: + case TransitionLane11: + case TransitionLane12: + case TransitionLane13: + case TransitionLane14: + case TransitionLane15: + case RetryLane1: + case RetryLane2: + case RetryLane3: + case RetryLane4: + lane = TransitionHydrationLane; + break; + case IdleLane: + lane = IdleHydrationLane; + break; - if (instance) { - cacheContext(workInProgress, unmaskedContext, context); + default: + // Everything else is already either a hydration lane, or shouldn't + // be retried at a hydration lane. + lane = NoLane; + break; } + } // Check if the lane we chose is suspended. If so, that indicates that we + // already attempted and failed to hydrate at that level. Also check if we're + // already rendering that lane, which is rare but could happen. - return context; - } -} -function hasContextChanged() { - { - return didPerformWorkStackCursor.current; + if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { + // Give up trying to hydrate and fall back to client render. + return NoLane; } -} -function isContextProvider(type) { - { - var childContextTypes = type.childContextTypes; - return childContextTypes !== null && childContextTypes !== undefined; - } + return lane; } - -function popContext(fiber) { +function getTransitionsForLanes(root, lanes) { { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); + return null; } } -function popTopLevelContextObject(fiber) { - { - pop(didPerformWorkStackCursor, fiber); - pop(contextStackCursor$1, fiber); - } +var NoEventPriority = NoLane; +var DiscreteEventPriority = SyncLane; +var ContinuousEventPriority = InputContinuousLane; +var DefaultEventPriority = DefaultLane; +var IdleEventPriority = IdleLane; +function higherEventPriority(a, b) { + return a !== 0 && a < b ? a : b; } - -function pushTopLevelContextObject(fiber, context, didChange) { - { - if (contextStackCursor$1.current !== emptyContextObject) { - throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } - - push(contextStackCursor$1, context, fiber); - push(didPerformWorkStackCursor, didChange, fiber); - } +function lowerEventPriority(a, b) { + return a === 0 || a > b ? a : b; } +function isHigherEventPriority(a, b) { + return a !== 0 && a < b; +} +function eventPriorityToLane(updatePriority) { + return updatePriority; +} +function lanesToEventPriority(lanes) { + var lane = getHighestPriorityLane(lanes); -function processChildContext(fiber, type, parentContext) { - { - var instance = fiber.stateNode; - var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. - // It has only been added in Fiber to match the (unintentional) behavior in Stack. - - if (typeof instance.getChildContext !== 'function') { - { - var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; + if (!isHigherEventPriority(DiscreteEventPriority, lane)) { + return DiscreteEventPriority; + } - if (!warnedAboutMissingGetChildContext[componentName]) { - warnedAboutMissingGetChildContext[componentName] = true; + if (!isHigherEventPriority(ContinuousEventPriority, lane)) { + return ContinuousEventPriority; + } - error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); - } - } + if (includesNonIdleWork(lane)) { + return DefaultEventPriority; + } - return parentContext; - } + return IdleEventPriority; +} - var childContext = instance.getChildContext(); +// Renderers that don't support hydration +// can re-export everything from this module. +function shim$1() { + throw new Error('The current renderer does not support hydration. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Hydration (when unsupported) - for (var contextKey in childContext) { - if (!(contextKey in childContextTypes)) { - throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); - } - } - return assign({}, parentContext, childContext); - } -} +var supportsHydration = false; +var isSuspenseInstancePending = shim$1; +var isSuspenseInstanceFallback = shim$1; +var getSuspenseInstanceFallbackErrorDetails = shim$1; +var registerSuspenseInstanceRetry = shim$1; +var clearSuspenseBoundary = shim$1; +var clearSuspenseBoundaryFromContainer = shim$1; -function pushContextProvider(workInProgress) { - { - var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. - // If the instance does not exist yet, we will push null at first, - // and replace it on the stack later when invalidating the context. +// Renderers that don't support hydration +// can re-export everything from this module. +function shim() { + throw new Error('The current renderer does not support Resources. ' + 'This error is likely caused by a bug in React. ' + 'Please file an issue.'); +} // Resources (when unsupported) +var preloadResource = shim; +var suspendResource = shim; - var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. - // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. +var NO_CONTEXT = {}; +var nodeToInstanceMap = new WeakMap(); - previousContext = contextStackCursor$1.current; - push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); - push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); - return true; - } +{ + Object.freeze(NO_CONTEXT); } -function invalidateContextProvider(workInProgress, type, didChange) { - { - var instance = workInProgress.stateNode; - - if (!instance) { - throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); - } +function getPublicInstance(inst) { + switch (inst.tag) { + case 'INSTANCE': + var createNodeMock = inst.rootContainerInstance.createNodeMock; + var mockNode = createNodeMock({ + type: inst.type, + props: inst.props + }); - if (didChange) { - // Merge parent and own context. - // Skip this if we're not updating due to sCU. - // This avoids unnecessarily recomputing memoized values. - var mergedContext = processChildContext(workInProgress, type, previousContext); - instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. - // It is important to unwind the context in the reverse order. + if (typeof mockNode === 'object' && mockNode !== null) { + nodeToInstanceMap.set(mockNode, inst); + } - pop(didPerformWorkStackCursor, workInProgress); - pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. + return mockNode; - push(contextStackCursor$1, mergedContext, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } else { - pop(didPerformWorkStackCursor, workInProgress); - push(didPerformWorkStackCursor, didChange, workInProgress); - } + default: + return inst; } } - -function findCurrentUnmaskedContext(fiber) { +function appendChild(parentInstance, child) { { - // Currently this is only used with renderSubtreeIntoContainer; not sure if it - // makes sense elsewhere - if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { - throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + if (!isArray(parentInstance.children)) { + error('An invalid container has been provided. ' + 'This may indicate that another renderer is being used in addition to the test renderer. ' + '(For example, ReactDOM.createPortal inside of a ReactTestRenderer tree.) ' + 'This is not supported.'); } + } - var node = fiber; - - do { - switch (node.tag) { - case HostRoot: - return node.stateNode.context; - - case ClassComponent: - { - var Component = node.type; - - if (isContextProvider(Component)) { - return node.stateNode.__reactInternalMemoizedMergedChildContext; - } - - break; - } - } // $FlowFixMe[incompatible-type] we bail out when we get a null + var index = parentInstance.children.indexOf(child); + if (index !== -1) { + parentInstance.children.splice(index, 1); + } - node = node.return; - } while (node !== null); + parentInstance.children.push(child); +} +function insertBefore(parentInstance, child, beforeChild) { + var index = parentInstance.children.indexOf(child); - throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + if (index !== -1) { + parentInstance.children.splice(index, 1); } -} -// We use the existence of the state object as an indicator that the component -// is hidden. -var OffscreenVisible = -/* */ -1; -var OffscreenDetached = -/* */ -2; -var OffscreenPassiveEffectsConnected = -/* */ -4; -function isOffscreenManual(offscreenFiber) { - return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; + var beforeIndex = parentInstance.children.indexOf(beforeChild); + parentInstance.children.splice(beforeIndex, 0, child); } - -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; +function removeChild(parentInstance, child) { + var index = parentInstance.children.indexOf(child); + parentInstance.children.splice(index, 1); +} +function clearContainer(container) { + container.children.splice(0); +} +function getRootHostContext(rootContainerInstance) { + return NO_CONTEXT; +} +function getChildHostContext(parentHostContext, type) { + return NO_CONTEXT; +} +function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { + return { + type: type, + props: props, + isHidden: false, + children: [], + internalInstanceHandle: internalInstanceHandle, + rootContainerInstance: rootContainerInstance, + tag: 'INSTANCE' + }; } +function appendInitialChild(parentInstance, child) { + var index = parentInstance.children.indexOf(child); -var objectIs = // $FlowFixMe[method-unbinding] -typeof Object.is === 'function' ? Object.is : is; + if (index !== -1) { + parentInstance.children.splice(index, 1); + } -var prefix; -function describeBuiltInComponentFrame(name) { - { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - var match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. + parentInstance.children.push(child); +} +function shouldSetTextContent(type, props) { + return false; +} +function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { + return { + text: text, + isHidden: false, + tag: 'TEXT' + }; +} +var currentUpdatePriority = NoEventPriority; +function setCurrentUpdatePriority(newPriority) { + currentUpdatePriority = newPriority; +} +function getCurrentUpdatePriority() { + return currentUpdatePriority; +} +function resolveUpdatePriority() { + if (currentUpdatePriority !== NoEventPriority) { + return currentUpdatePriority; + } + return DefaultEventPriority; +} +function shouldAttemptEagerTransition() { + return false; +} +var scheduleTimeout = setTimeout; +var cancelTimeout = clearTimeout; +var noTimeout = -1; // ------------------- +function commitUpdate(instance, type, oldProps, newProps, internalInstanceHandle) { + instance.type = type; + instance.props = newProps; +} +function commitMount(instance, type, newProps, internalInstanceHandle) {// noop +} +function commitTextUpdate(textInstance, oldText, newText) { + textInstance.text = newText; +} +function resetTextContent(testElement) {// noop +} +var appendChildToContainer = appendChild; +var insertInContainerBefore = insertBefore; +var removeChildFromContainer = removeChild; +function hideInstance(instance) { + instance.isHidden = true; +} +function hideTextInstance(textInstance) { + textInstance.isHidden = true; +} +function unhideInstance(instance, props) { + instance.isHidden = false; +} +function unhideTextInstance(textInstance, text) { + textInstance.isHidden = false; +} +function getInstanceFromNode(mockNode) { + var instance = nodeToInstanceMap.get(mockNode); - return '\n' + prefix + name; + if (instance !== undefined) { + return instance.internalInstanceHandle; } + + return null; } -function describeDebugInfoFrame(name, env) { - return describeBuiltInComponentFrame(name + (env ? ' (' + env + ')' : '')); +function prepareScopeUpdate(scopeInstance, inst) { + nodeToInstanceMap.set(scopeInstance, inst); } -var reentry = false; -var componentFrameCache; +function getInstanceFromScope(scopeInstance) { + return nodeToInstanceMap.get(scopeInstance) || null; +} +function preloadInstance(type, props) { + // Return true to indicate it's already loaded + return true; +} +function waitForCommitToBeReady() { + return null; +} +var NotPendingTransition = null; + +var valueStack = []; +var fiberStack; { - var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap$1(); + fiberStack = []; } -/** - * Leverages native browser/VM stack frames to get proper details (e.g. - * filename, line + col number) for a single component in a component stack. We - * do this by: - * (1) throwing and catching an error in the function - this will be our - * control error. - * (2) calling the component which will eventually throw an error that we'll - * catch - this will be our sample error. - * (3) diffing the control and sample error stacks to find the stack frame - * which represents our component. - */ +var index = -1; -function describeNativeComponentFrame(fn, construct) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; +function createCursor(defaultValue) { + return { + current: defaultValue + }; +} + +function pop(cursor, fiber) { + if (index < 0) { + { + error('Unexpected pop.'); + } + + return; } { - var frame = componentFrameCache.get(fn); - - if (frame !== undefined) { - return frame; + if (fiber !== fiberStack[index]) { + error('Unexpected Fiber popped.'); } } - reentry = true; - var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe[incompatible-type] It does accept undefined. - - Error.prepareStackTrace = undefined; - var previousDispatcher = null; + cursor.current = valueStack[index]; + valueStack[index] = null; { - previousDispatcher = ReactSharedInternals.H; // Set the dispatcher in DEV because this might be call in the render function - // for warnings. - - ReactSharedInternals.H = null; - disableLogs(); + fiberStack[index] = null; } - /** - * Finding a common stack frame between sample and control errors can be - * tricky given the different types and levels of stack trace truncation from - * different JS VMs. So instead we'll attempt to control what that common - * frame should be through this object method: - * Having both the sample and control errors be in the function under the - * `DescribeNativeComponentFrameRoot` property, + setting the `name` and - * `displayName` properties of the function ensures that a stack - * frame exists that has the method name `DescribeNativeComponentFrameRoot` in - * it for both control and sample stacks. - */ + index--; +} - var RunInRootFrame = { - DetermineComponentFrameRoot: function () { - var control; +function push(cursor, value, fiber) { + index++; + valueStack[index] = cursor.current; - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - var Fake = function () { - throw Error(); - }; // $FlowFixMe[prop-missing] + { + fiberStack[index] = fiber; + } + cursor.current = value; +} - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); +var warnedAboutMissingGetChildContext; - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; - } +{ + warnedAboutMissingGetChildContext = {}; +} - Reflect.construct(fn, [], Fake); - } else { - try { - Fake.call(); - } catch (x) { - control = x; - } // $FlowFixMe[prop-missing] found when upgrading Flow +var emptyContextObject = {}; +{ + Object.freeze(emptyContextObject); +} // A cursor to the current merged context object on the stack. - fn.call(Fake.prototype); - } - } else { - try { - throw Error(); - } catch (x) { - control = x; - } // TODO(luna): This will currently only throw if the function component - // tries to access React/ReactDOM/props. We should probably make this throw - // in simple components too +var contextStackCursor$1 = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. - var maybePromise = fn(); // If the function component returns a promise, it's likely an async - // component, which we don't yet support. Attach a noop catch handler to - // silence the error. - // TODO: Implement component stacks for async client components? +var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. +// We use this to get access to the parent context after we have already +// pushed the next context provider, and now need to merge their contexts. - if (maybePromise && typeof maybePromise.catch === 'function') { - maybePromise.catch(function () {}); - } - } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - return [sample.stack, control.stack]; - } - } +var previousContext = emptyContextObject; - return [null, null]; +function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { + { + if (didPushOwnContextIfProvider && isContextProvider(Component)) { + // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; } - }; // $FlowFixMe[prop-missing] - RunInRootFrame.DetermineComponentFrameRoot.displayName = 'DetermineComponentFrameRoot'; - var namePropDescriptor = Object.getOwnPropertyDescriptor(RunInRootFrame.DetermineComponentFrameRoot, 'name'); // Before ES6, the `name` property was not configurable. + return contextStackCursor$1.current; + } +} - if (namePropDescriptor && namePropDescriptor.configurable) { - // V8 utilizes a function's `name` property when generating a stack trace. - Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, // Configurable properties can be updated even if its writable descriptor - // is set to `false`. - // $FlowFixMe[cannot-write] - 'name', { - value: 'DetermineComponentFrameRoot' - }); +function cacheContext(workInProgress, unmaskedContext, maskedContext) { + { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; } +} - try { - var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), - sampleStack = _RunInRootFrame$Deter[0], - controlStack = _RunInRootFrame$Deter[1]; +function getMaskedContext(workInProgress, unmaskedContext) { + { + var type = workInProgress.type; + var contextTypes = type.contextTypes; - if (sampleStack && controlStack) { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - var sampleLines = sampleStack.split('\n'); - var controlLines = controlStack.split('\n'); - var s = 0; - var c = 0; + if (!contextTypes) { + return emptyContextObject; + } // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. - while (s < sampleLines.length && !sampleLines[s].includes('DetermineComponentFrameRoot')) { - s++; - } - while (c < controlLines.length && !controlLines[c].includes('DetermineComponentFrameRoot')) { - c++; - } // We couldn't find our intentionally injected common root frame, attempt - // to find another common root frame by search from the bottom of the - // control stack... + var instance = workInProgress.stateNode; + if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { + return instance.__reactInternalMemoizedMaskedChildContext; + } - if (s === sampleLines.length || c === controlLines.length) { - s = sampleLines.length - 1; - c = controlLines.length - 1; + var context = {}; - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } - } + for (var key in contextTypes) { + context[key] = unmaskedContext[key]; + } // Cache unmasked context so we can avoid recreating masked context unless necessary. + // Context is created before the class component is instantiated so check for instance. - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "" - // but we have a user-provided "displayName" - // splice it in to make the stack more readable. + if (instance) { + cacheContext(workInProgress, unmaskedContext, context); + } + return context; + } +} - if (fn.displayName && _frame.includes('')) { - _frame = _frame.replace('', fn.displayName); - } +function hasContextChanged() { + { + return didPerformWorkStackCursor.current; + } +} + +function isContextProvider(type) { + { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } +} + +function popContext(fiber) { + { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); + } +} + +function popTopLevelContextObject(fiber) { + { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor$1, fiber); + } +} + +function pushTopLevelContextObject(fiber, context, didChange) { + { + if (contextStackCursor$1.current !== emptyContextObject) { + throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } + + push(contextStackCursor$1, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); + } +} - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, _frame); - } - } // Return the line we found. +function processChildContext(fiber, type, parentContext) { + { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== 'function') { + { + var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; - return _frame; - } - } while (s >= 1 && c >= 0); - } + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; - break; + error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); } } - } - } finally { - reentry = false; - { - ReactSharedInternals.H = previousDispatcher; - reenableLogs(); + return parentContext; } - Error.prepareStackTrace = previousPrepareStackTrace; - } // Fallback to just using the name if we couldn't make it throw. - - - var name = fn ? fn.displayName || fn.name : ''; - var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; + var childContext = instance.getChildContext(); - { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); + for (var contextKey in childContext) { + if (!(contextKey in childContextTypes)) { + throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); + } } - } - return syntheticFrame; -} - -function describeClassComponentFrame(ctor) { - { - return describeNativeComponentFrame(ctor, true); - } -} -function describeFunctionComponentFrame(fn) { - { - return describeNativeComponentFrame(fn, false); + return assign({}, parentContext, childContext); } } -function describeFiber(fiber) { - switch (fiber.tag) { - case HostHoistable: - case HostSingleton: - case HostComponent: - return describeBuiltInComponentFrame(fiber.type); +function pushContextProvider(workInProgress) { + { + var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. - case LazyComponent: - return describeBuiltInComponentFrame('Lazy'); + var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense'); + previousContext = contextStackCursor$1.current; + push(contextStackCursor$1, memoizedMergedChildContext, workInProgress); + push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); + return true; + } +} - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList'); +function invalidateContextProvider(workInProgress, type, didChange) { + { + var instance = workInProgress.stateNode; - case FunctionComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(fiber.type); + if (!instance) { + throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } - case ForwardRef: - return describeFunctionComponentFrame(fiber.type.render); + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext(workInProgress, type, previousContext); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. - case ClassComponent: - return describeClassComponentFrame(fiber.type); + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor$1, workInProgress); // Now push the new context and mark that it has changed. - default: - return ''; + push(contextStackCursor$1, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } } } -function getStackByFiberInDevAndProd(workInProgress) { - try { - var info = ''; - var node = workInProgress; +function findCurrentUnmaskedContext(fiber) { + { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { + throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); + } - do { - info += describeFiber(node); + var node = fiber; - if (true) { - // Add any Server Component stack frames in reverse order. - var debugInfo = node._debugInfo; + do { + switch (node.tag) { + case HostRoot: + return node.stateNode.context; - if (debugInfo) { - for (var i = debugInfo.length - 1; i >= 0; i--) { - var entry = debugInfo[i]; + case ClassComponent: + { + var Component = node.type; - if (typeof entry.name === 'string') { - info += describeDebugInfoFrame(entry.name, entry.env); + if (isContextProvider(Component)) { + return node.stateNode.__reactInternalMemoizedMergedChildContext; } + + break; } - } } // $FlowFixMe[incompatible-type] we bail out when we get a null node = node.return; - } while (node); + } while (node !== null); - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; + throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); } } +// We use the existence of the state object as an indicator that the component +// is hidden. +var OffscreenVisible = +/* */ +1; +var OffscreenDetached = +/* */ +2; +var OffscreenPassiveEffectsConnected = +/* */ +4; +function isOffscreenManual(offscreenFiber) { + return offscreenFiber.memoizedProps !== null && offscreenFiber.memoizedProps.mode === 'manual'; +} + +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} + +var objectIs = // $FlowFixMe[method-unbinding] +typeof Object.is === 'function' ? Object.is : is; + var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { // If the value is an error, call this function immediately after it is thrown @@ -4815,61 +4877,6 @@ function shallowEqual(objA, objB) { return true; } -var current = null; -var isRendering = false; -function getCurrentFiberOwnerNameInDevOrNull() { - { - if (current === null) { - return null; - } - - var owner = current._debugOwner; - - if (owner != null) { - return getComponentNameFromOwner(owner); - } - } - - return null; -} - -function getCurrentFiberStackInDev() { - { - if (current === null) { - return ''; - } // Safe because if current fiber exists, we are reconciling, - // and it is guaranteed to be the work-in-progress version. - - - return getStackByFiberInDevAndProd(current); - } -} - -function resetCurrentFiber() { - { - ReactSharedInternals.getCurrentStack = null; - current = null; - isRendering = false; - } -} -function setCurrentFiber(fiber) { - { - ReactSharedInternals.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; - current = fiber; - isRendering = false; - } -} -function getCurrentFiber() { - { - return current; - } -} -function setIsRendering(rendering) { - { - isRendering = rendering; - } -} - var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function (fiber, instance) {}, flushPendingUnsafeLifecycleWarnings: function () {}, @@ -5089,11 +5096,11 @@ var ReactStrictModeWarnings = { var sortedNames = setToSortedString(uniqueNames); try { - setCurrentFiber(firstFiber); + setCurrentDebugFiberInDEV(firstFiber); error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://react.dev/link/legacy-context', sortedNames); } finally { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } }); }; @@ -11915,7 +11922,6 @@ function updateForwardRef(current, workInProgress, Component, nextProps, renderL prepareToReadContext(workInProgress, renderLanes); { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, render, propsWithoutRef, ref, renderLanes); setIsRendering(false); @@ -12390,7 +12396,6 @@ function updateFunctionComponent(current, workInProgress, Component, nextProps, prepareToReadContext(workInProgress, renderLanes); { - setCurrentOwner(workInProgress); setIsRendering(true); nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); setIsRendering(false); @@ -12530,7 +12535,7 @@ function finishClassComponent(current, workInProgress, Component, shouldUpdate, var instance = workInProgress.stateNode; // Rerender { - setCurrentOwner(workInProgress); + setCurrentFiber(workInProgress); } var nextChildren; @@ -13815,7 +13820,6 @@ function updateContextConsumer(current, workInProgress, renderLanes) { var newChildren; { - setCurrentOwner(workInProgress); setIsRendering(true); newChildren = render(newValue); setIsRendering(false); @@ -16421,7 +16425,7 @@ function commitBeforeMutationEffects_begin() { function commitBeforeMutationEffects_complete() { while (nextEffect !== null) { var fiber = nextEffect; - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); try { commitBeforeMutationEffectsOnFiber(fiber); @@ -16429,7 +16433,7 @@ function commitBeforeMutationEffects_complete() { captureCommitPhaseError(fiber, fiber.return, error); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var sibling = fiber.sibling; if (sibling !== null) { @@ -16447,7 +16451,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { var flags = finishedWork.flags; if ((flags & Snapshot) !== NoFlags$1) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); } switch (finishedWork.tag) { @@ -16534,7 +16538,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork) { } if ((flags & Snapshot) !== NoFlags$1) { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } @@ -17786,9 +17790,9 @@ function attachSuspenseRetryListeners(finishedWork, wakeables) { }); } // This function detects when a Suspense boundary goes from visible to hidden. function commitMutationEffects(root, finishedWork, committedLanes) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitMutationEffectsOnFiber(finishedWork, root); - setCurrentFiber(finishedWork); + resetCurrentDebugFiberInDEV(); } function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { @@ -17814,13 +17818,13 @@ function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitMutationEffectsOnFiber(child, root); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitMutationEffectsOnFiber(finishedWork, root, lanes) { @@ -18219,8 +18223,10 @@ function commitReconciliationEffects(finishedWork) { } function commitLayoutEffects(finishedWork, root, committedLanes) { + setCurrentDebugFiberInDEV(finishedWork); var current = finishedWork.alternate; commitLayoutEffectOnFiber(root, current, finishedWork); + resetCurrentDebugFiberInDEV(); } function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { @@ -18230,14 +18236,14 @@ function recursivelyTraverseLayoutEffects(root, parentFiber, lanes) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); var current = child.alternate; commitLayoutEffectOnFiber(root, current, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disappearLayoutEffects(finishedWork) { @@ -18447,7 +18453,7 @@ function recursivelyTraverseReappearLayoutEffects(finishedRoot, parentFiber, inc child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitHookPassiveMountEffects(finishedWork, hookFlags) { @@ -18525,9 +18531,9 @@ function commitCachePassiveMountEffect(current, finishedWork) { } function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveMountOnFiber(root, finishedWork, committedLanes, committedTransitions); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLanes, committedTransitions) { @@ -18537,13 +18543,13 @@ function recursivelyTraversePassiveMountEffects(root, parentFiber, committedLane var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveMountOnFiber(root, child, committedLanes, committedTransitions); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -18691,7 +18697,7 @@ function recursivelyTraverseReconnectPassiveEffects(finishedRoot, parentFiber, c child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function reconnectPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions, // This function visits both newly finished work and nodes that were re-used @@ -18802,13 +18808,13 @@ function recursivelyTraverseAtomicPassiveEffects(finishedRoot, parentFiber, comm var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitAtomicPassiveEffects(finishedRoot, child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, committedTransitions) { @@ -18853,9 +18859,9 @@ function commitAtomicPassiveEffects(finishedRoot, finishedWork, committedLanes, } function commitPassiveUnmountEffects(finishedWork) { - setCurrentFiber(finishedWork); + setCurrentDebugFiberInDEV(finishedWork); commitPassiveUnmountOnFiber(finishedWork); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } // If we're inside a brand new tree, or a tree that was already visible, then we // should only suspend host components that have a ShouldSuspendCommit flag. // Components without it haven't changed since the last commit, so we can skip @@ -19009,13 +19015,13 @@ function recursivelyTraversePassiveUnmountEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); commitPassiveUnmountOnFiber(child); child = child.sibling; } } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function commitPassiveUnmountOnFiber(finishedWork) { @@ -19086,12 +19092,12 @@ function recursivelyTraverseDisconnectPassiveEffects(parentFiber) { var child = parentFiber.child; while (child !== null) { - setCurrentFiber(child); + setCurrentDebugFiberInDEV(child); disconnectPassiveEffect(child); child = child.sibling; } - setCurrentFiber(prevDebugFiber); + setCurrentDebugFiberInDEV(prevDebugFiber); } function disconnectPassiveEffect(finishedWork) { @@ -19133,9 +19139,9 @@ function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot var fiber = nextEffect; // Deletion effects fire in parent -> child order // TODO: Check if fiber has a PassiveStatic flag - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. if (child !== null) { @@ -19357,7 +19363,7 @@ var DefaultAsyncDispatcher = { { DefaultAsyncDispatcher.getOwner = function () { - return currentOwner; + return current; }; } @@ -20310,10 +20316,9 @@ function handleThrow(root, thrownValue) { // These should be reset immediately because they're only supposed to be set // when React is executing user code. resetHooksAfterThrow(); - resetCurrentFiber(); { - setCurrentOwner(null); + resetCurrentFiber(); } if (thrownValue === SuspenseException) { @@ -20870,7 +20875,7 @@ function performUnitOfWork(unitOfWork) { // nothing should rely on this, but relying on it here means that we don't // need an additional field on the work in progress. var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; if ((unitOfWork.mode & ProfileMode) !== NoMode) { @@ -20881,7 +20886,10 @@ function performUnitOfWork(unitOfWork) { next = beginWork(current, unitOfWork, entangledRenderLanes); } - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -20890,10 +20898,6 @@ function performUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function replaySuspendedUnitOfWork(unitOfWork) { @@ -20901,9 +20905,8 @@ function replaySuspendedUnitOfWork(unitOfWork) { // just suspended. // var current = unitOfWork.alternate; - setCurrentFiber(unitOfWork); + setCurrentDebugFiberInDEV(unitOfWork); var next; - setCurrentFiber(unitOfWork); var isProfilingMode = (unitOfWork.mode & ProfileMode) !== NoMode; if (isProfilingMode) { @@ -20981,7 +20984,10 @@ function replaySuspendedUnitOfWork(unitOfWork) { // normal work loop. - resetCurrentFiber(); + { + resetCurrentFiber(); + } + unitOfWork.memoizedProps = unitOfWork.pendingProps; if (next === null) { @@ -20990,10 +20996,6 @@ function replaySuspendedUnitOfWork(unitOfWork) { } else { workInProgress = next; } - - { - setCurrentOwner(null); - } } function throwAndUnwindWorkLoop(root, unitOfWork, thrownValue) { @@ -21080,7 +21082,7 @@ function completeUnitOfWork(unitOfWork) { var current = completedWork.alternate; var returnFiber = completedWork.return; - setCurrentFiber(completedWork); + setCurrentDebugFiberInDEV(completedWork); var next = void 0; if ((completedWork.mode & ProfileMode) === NoMode) { @@ -21092,7 +21094,7 @@ function completeUnitOfWork(unitOfWork) { stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); if (next !== null) { // Completing this fiber spawned new work. Work on that next. @@ -21309,18 +21311,13 @@ function commitRootImpl(root, recoverableErrors, transitions, didIncludeRenderPh var previousPriority = getCurrentUpdatePriority(); setCurrentUpdatePriority(DiscreteEventPriority); var prevExecutionContext = executionContext; - executionContext |= CommitContext; // Reset this to null before calling lifecycles - - { - setCurrentOwner(null); - } // The commit phase is broken into several sub-phases. We do a separate pass + executionContext |= CommitContext; // The commit phase is broken into several sub-phases. We do a separate pass // of the effect list for each phase: all mutation effects come before all // layout effects, and so on. // The first phase a "before mutation" phase. We use this phase to read the // state of the host tree right before we mutate it. This is where // getSnapshotBeforeUpdate is called. - commitBeforeMutationEffects(root, finishedWork); { @@ -21874,7 +21871,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. // Maybe not a big deal since this is DEV only behavior. - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); if (hasPassiveEffects) { @@ -21887,7 +21884,7 @@ function legacyCommitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); } - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { @@ -21950,14 +21947,14 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -22058,14 +22055,14 @@ function warnIfUpdatesNotWrappedWithActDEV(fiber) { var previousFiber = current; try { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://react.dev/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); } finally { if (previousFiber) { - setCurrentFiber(fiber); + setCurrentDebugFiberInDEV(fiber); } else { - resetCurrentFiber(); + resetCurrentDebugFiberInDEV(); } } } @@ -23133,7 +23130,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition return root; } -var ReactVersion = '19.0.0-www-modern-5f76d447'; +var ReactVersion = '19.0.0-www-modern-a084ecf7'; /* * The `'' + value` pattern (used in perf-sensitive code) throws for Symbol diff --git a/compiled/facebook-www/ReactTestUtils-dev.classic.js b/compiled/facebook-www/ReactTestUtils-dev.classic.js index 32a27c2713d91..3f7abf435bf7a 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.classic.js +++ b/compiled/facebook-www/ReactTestUtils-dev.classic.js @@ -101,6 +101,13 @@ var Hydrating = /* */ 4096; // You can change the rest (and add more). +var assign = Object.assign; + +{ + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + new PossiblyWeakMap(); +} + function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; @@ -305,8 +312,6 @@ function findCurrentFiberUsingSlowPath(fiber) { return alternate; } -var assign = Object.assign; - /** * `charCode` represents the actual "character code" and is safe to use with * `String.fromCharCode`. As such, only keys that correspond to printable diff --git a/compiled/facebook-www/ReactTestUtils-dev.modern.js b/compiled/facebook-www/ReactTestUtils-dev.modern.js index 32a27c2713d91..3f7abf435bf7a 100644 --- a/compiled/facebook-www/ReactTestUtils-dev.modern.js +++ b/compiled/facebook-www/ReactTestUtils-dev.modern.js @@ -101,6 +101,13 @@ var Hydrating = /* */ 4096; // You can change the rest (and add more). +var assign = Object.assign; + +{ + var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + new PossiblyWeakMap(); +} + function getNearestMountedFiber(fiber) { var node = fiber; var nearestMounted = fiber; @@ -305,8 +312,6 @@ function findCurrentFiberUsingSlowPath(fiber) { return alternate; } -var assign = Object.assign; - /** * `charCode` represents the actual "character code" and is safe to use with * `String.fromCharCode`. As such, only keys that correspond to printable