@bgub/fig-reconciler 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/fiber-work.ts","../src/commit-index.ts","../src/fiber-tags.ts","../src/hook-kinds.ts","../src/scheduler.ts","../src/lanes.ts","../src/fiber-traversal.ts","../src/hook-queue.ts","../src/host-content.ts","../src/root-data-store.ts","../src/index.ts"],"sourcesContent":["export const NoFlags = 0;\n\n// Render emits transient work on individual fibers. Completion folds the\n// subset in SubtreeVisibleFlags into subtreeFlags, and commit interprets the\n// resulting tree summary in host order.\nexport const PlacementFlag = 1 << 0;\nexport const UpdateFlag = 1 << 1;\nexport const HydrationFlag = 1 << 2;\nexport const TextContentFlag = 1 << 3;\nexport const VisibilityFlag = 1 << 5;\nexport const DeletionFlag = 1 << 7;\nexport const EffectFlag = 1 << 9;\nexport const StoreConsistencyFlag = 1 << 11;\n\n// The fiber reused its committed children without cloning; render skips the\n// subtree and commit walks must not consume already-committed state below it.\nexport const AdoptedFlag = 1 << 4;\n// A host fiber assembled its children at complete-time, so placement inserts\n// the whole subtree once instead of placing each child independently.\nexport const AssembledFlag = 1 << 6;\n// Membership in the root's sparse commit index. Recording is idempotent, and\n// rollback clears this bit from every discarded index entry.\nexport const CommitIndexedFlag = 1 << 8;\n// This render already propagated changed providers through the subtree.\nexport const ContextPropagationFlag = 1 << 10;\n// Cached negative result for the overwhelmingly common non-hoisted fiber.\nexport const NotHoistedFlag = 1 << 13;\n\n// Static capabilities survive commits and bailouts. A subtree capability is\n// a durable fact about tree shape, unlike transient work owed by this commit.\nexport const ViewTransitionStaticFlag = 1 << 12;\n\nexport type Flag = number;\n\nexport const MutationMask =\n PlacementFlag | UpdateFlag | HydrationFlag | TextContentFlag | VisibilityFlag;\nexport const HostUpdateMask = UpdateFlag | TextContentFlag;\n\n// These marks never enter subtreeFlags. Host updates are found through the\n// sparse commit index; membership and cache marks are not descendant work.\nconst SubtreeMaskedFlags = CommitIndexedFlag | HostUpdateMask | NotHoistedFlag;\n// Static facts survive commits and bailouts so adopted and deleted subtrees\n// remain searchable without rebuilding their summaries.\nexport const StaticFlagsMask = ViewTransitionStaticFlag;\n\nexport function childSubtreeFlags(node: {\n flags: Flag;\n subtreeFlags: Flag;\n}): Flag {\n return (node.flags & ~SubtreeMaskedFlags) | node.subtreeFlags;\n}\n\nexport function clearTransientFlags(node: {\n flags: Flag;\n subtreeFlags: Flag;\n}): void {\n node.flags &= StaticFlagsMask;\n node.subtreeFlags &= StaticFlagsMask;\n}\n","import { CommitIndexedFlag, type Flag, NoFlags } from \"./fiber-work.ts\";\n\ninterface CommitIndexNode {\n flags: Flag;\n}\n\ndeclare const CommitIndexCheckpointBrand: unique symbol;\n\nexport type CommitIndexCheckpoint = number & {\n readonly [CommitIndexCheckpointBrand]: true;\n};\n\nexport type CommitIndex<Node extends CommitIndexNode> = Node[];\n\nexport function createCommitIndex<\n Node extends CommitIndexNode,\n>(): CommitIndex<Node> {\n return [];\n}\n\nexport function commitIndexCheckpoint<Node extends CommitIndexNode>(\n index: CommitIndex<Node>,\n): CommitIndexCheckpoint {\n return index.length as CommitIndexCheckpoint;\n}\n\nexport function recordCommitWork<Node extends CommitIndexNode>(\n index: CommitIndex<Node>,\n node: Node,\n flags: Flag = NoFlags,\n): void {\n node.flags |= flags;\n if ((node.flags & CommitIndexedFlag) !== 0) return;\n node.flags |= CommitIndexedFlag;\n index.push(node);\n}\n\nexport function rollbackCommitIndex<Node extends CommitIndexNode>(\n index: CommitIndex<Node>,\n checkpoint: CommitIndexCheckpoint | undefined,\n): void {\n if (checkpoint === undefined || checkpoint >= index.length) return;\n const start: number = checkpoint;\n for (let offset = start; offset < index.length; offset += 1) {\n index[offset].flags &= ~CommitIndexedFlag;\n }\n index.length = checkpoint;\n}\n\nexport function clearCommitIndex<Node extends CommitIndexNode>(\n index: CommitIndex<Node>,\n): void {\n for (const node of index) node.flags &= ~CommitIndexedFlag;\n index.length = 0;\n}\n","import { type FigElement, Fragment } from \"@bgub/fig\";\nimport {\n isActivity,\n isAssets,\n isContext,\n isErrorBoundary,\n isSuspense,\n isViewTransition,\n} from \"@bgub/fig/internal\";\n\nexport const RootTag = 0;\nexport const HostTag = 1;\nexport const TextTag = 2;\nexport const FunctionTag = 3;\nexport const FragmentTag = 4;\nexport const ContextProviderTag = 5;\nexport const SuspenseTag = 6;\nexport const ErrorBoundaryTag = 7;\nexport const PortalTag = 8;\nexport const AssetsTag = 9;\nexport const ActivityTag = 10;\nexport const ViewTransitionTag = 11;\n\nexport type Tag =\n | typeof RootTag\n | typeof HostTag\n | typeof TextTag\n | typeof FunctionTag\n | typeof FragmentTag\n | typeof ContextProviderTag\n | typeof SuspenseTag\n | typeof ErrorBoundaryTag\n | typeof PortalTag\n | typeof AssetsTag\n | typeof ActivityTag\n | typeof ViewTransitionTag;\n\nexport function tagFor(element: FigElement): Tag {\n if (typeof element.type === \"string\") return HostTag;\n if (element.type === Fragment) return FragmentTag;\n if (isAssets(element.type)) return AssetsTag;\n if (isContext(element.type)) return ContextProviderTag;\n if (isSuspense(element.type)) return SuspenseTag;\n if (isActivity(element.type)) return ActivityTag;\n if (isErrorBoundary(element.type)) return ErrorBoundaryTag;\n if (isViewTransition(element.type)) return ViewTransitionTag;\n return FunctionTag;\n}\n","// Effect hooks reuse their phase as their hook kind. Keeping the shared\n// numeric vocabulary here lets rendering and DevTools interpret hooks without\n// making either module depend on the other's implementation.\nexport const ReactiveEffect = 0;\nexport const BeforePaintEffect = 1;\nexport const BeforeLayoutEffect = 2;\n\nexport type EffectPhase =\n | typeof ReactiveEffect\n | typeof BeforePaintEffect\n | typeof BeforeLayoutEffect;\n\nexport const StateHook = 3;\nexport const ActionStateHook = 4;\nexport const IdHook = 5;\nexport const DeferredValueHook = 6;\nexport const ExternalStoreHook = 7;\nexport const MemoHook = 8;\nexport const TransitionHook = 9;\nexport const StableEventHook = 10;\n\nexport type HookKind = number;\n\nexport const hookKindNames = [\n \"reactive\",\n \"before-paint\",\n \"before-layout\",\n \"state\",\n \"action-state\",\n \"id\",\n \"deferred-value\",\n \"external-store\",\n \"memo\",\n \"transition\",\n \"stable-event\",\n] as const;\n\nexport function isEffectHook(kind: HookKind): boolean {\n return kind <= BeforeLayoutEffect;\n}\n","// Fig's cooperative task scheduler: a macrotask-hopping work loop with five\n// priority tiers (mapped from lanes in lanes.ts) and starvation timeouts.\n// Internal to fig-reconciler — the reconciler is its only consumer, so it is\n// deliberately not a published package.\n\nexport type PriorityLevel = 1 | 2 | 3 | 4 | 5;\nexport type SchedulerCallback = () => SchedulerCallback | undefined;\n\nexport interface ScheduledTask {\n cancel(): void;\n}\n\nexport const ImmediatePriority = 1;\nexport const UserBlockingPriority = 2;\nexport const NormalPriority = 3;\nexport const LowPriority = 4;\nexport const IdlePriority = 5;\n\n// Starvation timeouts: once a task has waited this long it runs even past\n// frame-budget yields (see flushWork's expiration check).\nconst priorityTimeouts: Record<PriorityLevel, number> = {\n [ImmediatePriority]: -1,\n [UserBlockingPriority]: 250,\n [NormalPriority]: 5_000,\n [LowPriority]: 10_000,\n [IdlePriority]: 1_073_741_823,\n};\n\nconst frameInterval = 5;\n\ninterface Task {\n id: number;\n callback: SchedulerCallback | null;\n expirationTime: number;\n}\n\nfunction compare(a: Task, b: Task): number {\n return a.expirationTime - b.expirationTime || a.id - b.id;\n}\n\nclass MinHeap {\n readonly items: Task[] = [];\n\n push(value: Task): void {\n this.items.push(value);\n this.siftUp(this.items.length - 1);\n }\n\n peek(): Task | null {\n return this.items[0] ?? null;\n }\n\n pop(): Task | null {\n const first = this.items[0];\n const last = this.items.pop();\n\n if (first === undefined || last === undefined) return null;\n\n if (first !== last) {\n this.items[0] = last;\n this.siftDown(0);\n }\n\n return first;\n }\n\n private siftUp(index: number): void {\n const value = this.items[index];\n\n while (index > 0) {\n const parentIndex = (index - 1) >>> 1;\n const parent = this.items[parentIndex];\n if (compare(parent, value) <= 0) return;\n\n this.items[parentIndex] = value;\n this.items[index] = parent;\n index = parentIndex;\n }\n }\n\n private siftDown(index: number): void {\n const length = this.items.length;\n const value = this.items[index];\n\n while (index < length) {\n const leftIndex = index * 2 + 1;\n const rightIndex = leftIndex + 1;\n let smallest = index;\n\n if (\n leftIndex < length &&\n compare(this.items[leftIndex], this.items[smallest]) < 0\n ) {\n smallest = leftIndex;\n }\n\n if (\n rightIndex < length &&\n compare(this.items[rightIndex], this.items[smallest]) < 0\n ) {\n smallest = rightIndex;\n }\n\n if (smallest === index) return;\n\n this.items[index] = this.items[smallest];\n this.items[smallest] = value;\n index = smallest;\n }\n }\n}\n\nconst taskQueue = new MinHeap();\nlet taskId = 1;\nlet messageLoopRunning = false;\nlet needsPaint = false;\nlet startTime = -1;\nlet actQueue: Task[] | null = null;\nlet actScopeDepth = 0;\nlet flushingActQueue = false;\n\nconst actFlushLimit = 1_000;\n\nexport function now(): number {\n return globalThis.performance?.now?.() ?? Date.now();\n}\n\nexport function shouldYieldToHost(): boolean {\n return needsPaint || now() - startTime >= frameInterval;\n}\n\n// Renderers call this after committing host mutations: the next\n// shouldYieldToHost() returns true, so the work loop hands the thread back\n// and the host can paint before further scheduled work runs.\nexport function requestPaint(): void {\n needsPaint = true;\n}\n\nexport function scheduleCallback(\n priority: PriorityLevel,\n callback: SchedulerCallback,\n): ScheduledTask {\n const task: Task = {\n id: taskId++,\n callback,\n expirationTime: now() + priorityTimeouts[priority],\n };\n\n if (actQueue !== null) {\n actQueue.push(task);\n return {\n cancel() {\n task.callback = null;\n },\n };\n }\n\n taskQueue.push(task);\n requestHostCallback();\n\n return {\n cancel() {\n task.callback = null;\n },\n };\n}\n\nexport async function act<T>(\n callback: () => T | PromiseLike<T>,\n): Promise<Awaited<T>> {\n const previousActQueue = actQueue;\n const previousActScopeDepth = actScopeDepth;\n const queue = previousActQueue ?? [];\n\n actQueue = queue;\n actScopeDepth = previousActScopeDepth + 1;\n\n try {\n const result = await callback();\n\n actScopeDepth = previousActScopeDepth;\n if (previousActScopeDepth === 0) {\n try {\n await flushActQueueUntilSettled(queue);\n } finally {\n actQueue = previousActQueue;\n }\n } else {\n actQueue = previousActQueue;\n }\n\n return result;\n } catch (error) {\n actScopeDepth = previousActScopeDepth;\n actQueue = previousActQueue;\n throw error;\n }\n}\n\nasync function flushActQueueUntilSettled(queue: Task[]): Promise<void> {\n for (let flushes = 0; flushes < actFlushLimit; flushes += 1) {\n flushActQueue(queue);\n await Promise.resolve();\n\n if (hasActWork(queue)) continue;\n\n await waitForActMacrotask();\n if (!hasActWork(queue)) {\n queue.length = 0;\n return;\n }\n }\n\n throw new Error(\"act() exceeded the scheduled work flush limit.\");\n}\n\nfunction flushActQueue(queue: Task[]): void {\n if (flushingActQueue) return;\n\n flushingActQueue = true;\n try {\n let task = takeNextActTask(queue);\n while (task !== null) {\n const callback = task.callback;\n\n if (callback !== null) {\n task.callback = null;\n needsPaint = false;\n startTime = now();\n const continuation = callback();\n if (typeof continuation === \"function\") {\n task.callback = continuation;\n queue.push(task);\n }\n }\n\n task = takeNextActTask(queue);\n }\n } finally {\n flushingActQueue = false;\n }\n}\n\nfunction hasActWork(queue: Task[]): boolean {\n return queue.some((task) => task.callback !== null);\n}\n\nfunction takeNextActTask(queue: Task[]): Task | null {\n let nextIndex = -1;\n for (let index = 0; index < queue.length; index += 1) {\n const task = queue[index];\n if (task.callback === null) continue;\n\n if (nextIndex === -1 || compare(task, queue[nextIndex]) < 0) {\n nextIndex = index;\n }\n }\n\n if (nextIndex === -1) {\n queue.length = 0;\n return null;\n }\n\n const [task] = queue.splice(nextIndex, 1);\n return task;\n}\n\nfunction waitForActMacrotask(): Promise<void> {\n return new Promise((resolve) => {\n if (typeof setImmediate === \"function\") {\n void setImmediate(resolve);\n } else {\n setTimeout(resolve, 0);\n }\n });\n}\n\nfunction requestHostCallback(): void {\n if (messageLoopRunning) return;\n messageLoopRunning = true;\n scheduleHostCallback();\n}\n\nfunction performWorkUntilDeadline(): void {\n needsPaint = false;\n startTime = now();\n\n let hasMoreWork = false;\n try {\n hasMoreWork = flushWork(startTime);\n } finally {\n if (hasMoreWork) scheduleHostCallback();\n else messageLoopRunning = false;\n }\n}\n\ndeclare const setImmediate: ((callback: () => void) => unknown) | undefined;\n\nlet channel: MessageChannel | null = null;\n\n// Host-callback preference, matching React's scheduler (facebook/react#20756):\n// - setImmediate first (Node, old IE): unlike a MessagePort with a message\n// handler it never refs an idle event loop — importing the scheduler cannot\n// keep a Node process alive — and it fires earlier in the loop's turn.\n// Caveat shared with React: a page-level setImmediate polyfill would win\n// this check in a browser; real browsers never reach it natively.\n// - MessageChannel in browsers, where setImmediate does not exist: preferred\n// over setTimeout because nested setTimeout(0) is clamped to 4ms+, wasting\n// most of a frame per work-loop hop. Created on the first post so module\n// evaluation allocates nothing.\n// - setTimeout as the last resort for hosts with neither.\nconst scheduleHostCallback: () => void =\n typeof setImmediate === \"function\"\n ? () => void setImmediate(performWorkUntilDeadline)\n : typeof MessageChannel === \"function\"\n ? () => {\n if (channel === null) {\n channel = new MessageChannel();\n channel.port1.onmessage = () => performWorkUntilDeadline();\n }\n channel.port2.postMessage(null);\n }\n : () => void setTimeout(performWorkUntilDeadline, 0);\n\nfunction flushWork(currentTime: number): boolean {\n let task = taskQueue.peek();\n while (task !== null) {\n if (task.expirationTime > currentTime && shouldYieldToHost()) break;\n\n const callback = task.callback;\n if (callback === null) {\n taskQueue.pop();\n } else {\n task.callback = null;\n const continuation = callback();\n\n if (typeof continuation === \"function\") {\n task.callback = continuation;\n } else if (task === taskQueue.peek()) {\n // The callback may have scheduled work that sorts ahead of this task,\n // so only pop when this task is still at the top of the heap; a stale\n // entry is skipped via its null callback when it surfaces later.\n taskQueue.pop();\n }\n }\n\n task = taskQueue.peek();\n }\n\n return task !== null;\n}\n","import { isThenable } from \"@bgub/fig/internal\";\nimport {\n IdlePriority,\n ImmediatePriority,\n LowPriority,\n NormalPriority,\n type PriorityLevel,\n UserBlockingPriority,\n} from \"./scheduler.ts\";\n\nexport type Lane = number;\nexport type Lanes = number;\nexport type LaneMap<T extends number> = T[];\n\nexport const TotalLanes = 31;\nexport const NoTimestamp = -1;\nexport const NoLane = 0;\nexport const NoLanes = 0;\n\nexport const SyncHydrationLane = 1 << 0;\nexport const SyncLane = 1 << 1;\nexport const InputContinuousHydrationLane = 1 << 2;\nexport const InputContinuousLane = 1 << 3;\nexport const DefaultHydrationLane = 1 << 4;\nexport const DefaultLane = 1 << 5;\nexport const GestureLane = 1 << 6;\nexport const TransitionHydrationLane = 1 << 7;\nexport const TransitionLane1 = 1 << 8;\nexport const TransitionLane2 = 1 << 9;\nexport const TransitionLane3 = 1 << 10;\nexport const TransitionLane4 = 1 << 11;\nexport const TransitionLane5 = 1 << 12;\nexport const TransitionLane6 = 1 << 13;\nexport const TransitionLane7 = 1 << 14;\nexport const TransitionLane8 = 1 << 15;\nexport const TransitionLane9 = 1 << 16;\nexport const TransitionLane10 = 1 << 17;\nexport const TransitionLane11 = 1 << 18;\nexport const TransitionLane12 = 1 << 19;\nexport const TransitionLane13 = 1 << 20;\nexport const TransitionLane14 = 1 << 21;\nexport const RetryLane1 = 1 << 22;\nexport const RetryLane2 = 1 << 23;\nexport const RetryLane3 = 1 << 24;\nexport const RetryLane4 = 1 << 25;\nexport const SelectiveHydrationLane = 1 << 26;\nexport const IdleHydrationLane = 1 << 27;\nexport const IdleLane = 1 << 28;\nexport const OffscreenLane = 1 << 29;\nexport const DeferredLane = 1 << 30;\n\nexport const TransitionLane = TransitionLane1;\n\nexport const TransitionLanes =\n TransitionLane1 |\n TransitionLane2 |\n TransitionLane3 |\n TransitionLane4 |\n TransitionLane5 |\n TransitionLane6 |\n TransitionLane7 |\n TransitionLane8 |\n TransitionLane9 |\n TransitionLane10;\nexport const TransitionDeferredLanes =\n TransitionLane11 | TransitionLane12 | TransitionLane13 | TransitionLane14;\nexport const AllTransitionLanes = TransitionLanes | TransitionDeferredLanes;\nexport const RetryLanes = RetryLane1 | RetryLane2 | RetryLane3 | RetryLane4;\nexport const IdleLanes = IdleHydrationLane | IdleLane | OffscreenLane;\nexport const NonIdleLanes = (1 << 27) - 1;\nexport const HydrationLanes =\n SyncHydrationLane |\n InputContinuousHydrationLane |\n DefaultHydrationLane |\n TransitionHydrationLane |\n SelectiveHydrationLane |\n IdleHydrationLane;\n\nexport type LanePriority =\n | \"sync\"\n | \"input\"\n | \"default\"\n | \"gesture\"\n | \"transition\"\n | \"retry\"\n | \"idle\"\n | \"offscreen\"\n | \"deferred\";\n\nexport interface LaneRoot {\n pendingLanes: Lanes;\n suspendedLanes: Lanes;\n pingedLanes: Lanes;\n expiredLanes: Lanes;\n entangledLanes: Lanes;\n entanglements: LaneMap<Lanes>;\n expirationTimes: LaneMap<number>;\n}\n\nconst syncLaneExpirationMs = 250;\nconst transitionLaneExpirationMs = 5_000;\n\nlet currentUpdateLane: Lane = DefaultLane;\nlet nextTransitionLane: Lane = TransitionLane1;\nlet nextRetryLane: Lane = RetryLane1;\n// JavaScript does not expose per-continuation async context in browsers yet, so\n// async transitions keep their lane ambient while the returned thenable is\n// pending. Explicit event/sync priorities still override this fallback.\nlet asyncTransitionLanes: Lanes = NoLanes;\nconst asyncTransitionLaneCounts = createLaneMap<number>(0);\n\nexport function createLaneMap<T extends number>(initial: T): LaneMap<T> {\n return Array.from({ length: TotalLanes }, () => initial);\n}\n\nexport function mergeLanes(a: Lanes, b: Lanes): Lanes {\n return a | b;\n}\n\nexport function includesSomeLane(set: Lanes, subset: Lanes): boolean {\n return (set & subset) !== NoLanes;\n}\n\nexport function getHighestPriorityLane(lanes: Lanes): Lane {\n return lanes & -lanes;\n}\n\nexport function getHighestPriorityLanes(lanes: Lanes): Lanes {\n const lane = getHighestPriorityLane(lanes);\n\n if (includesSomeLane(AllTransitionLanes, lane)) {\n return lanes & AllTransitionLanes;\n }\n\n if (includesSomeLane(RetryLanes, lane)) {\n return lanes & RetryLanes;\n }\n\n return lane;\n}\n\nexport function getNextLanes(root: LaneRoot, wipLanes: Lanes = NoLanes): Lanes {\n const pending = root.pendingLanes;\n if (pending === NoLanes) return NoLanes;\n\n const unblocked = pending & ~root.suspendedLanes;\n const pinged = pending & root.pingedLanes;\n let next = root.expiredLanes & unblocked;\n if (next === NoLanes) {\n next = getHighestPriorityLanes(unblocked);\n\n if (next === NoLanes) {\n // Expired pinged work wins over fresh pinged work; NoLanes is 0, so the\n // fallback only runs when no expired pinged lane exists.\n const expiredPinged = root.expiredLanes & pinged;\n next =\n expiredPinged !== NoLanes\n ? expiredPinged\n : getHighestPriorityLanes(pinged);\n }\n }\n\n if (next === NoLanes) return NoLanes;\n\n if (\n wipLanes !== NoLanes &&\n wipLanes !== next &&\n !includesSomeLane(root.expiredLanes, wipLanes) &&\n getHighestPriorityLane(next) >= getHighestPriorityLane(wipLanes)\n ) {\n return wipLanes;\n }\n\n return getEntangledLanes(root, next);\n}\n\nexport function getEntangledLanes(root: LaneRoot, lanes: Lanes): Lanes {\n let entangled = lanes;\n let visited = NoLanes;\n let laneSet = entangled & root.entangledLanes;\n\n while (laneSet !== NoLanes) {\n const index = laneToIndex(laneSet);\n const lane = 1 << index;\n entangled |= root.entanglements[index];\n visited |= lane;\n laneSet = entangled & root.entangledLanes & ~visited;\n }\n\n return entangled;\n}\n\nexport function markRootUpdated(root: LaneRoot, lane: Lane): void {\n root.pendingLanes |= lane;\n\n if (lane !== IdleLane) {\n root.suspendedLanes = NoLanes;\n root.pingedLanes = NoLanes;\n }\n}\n\nexport function markRootFinished(root: LaneRoot, remainingLanes: Lanes): void {\n const noLongerPending = root.pendingLanes & ~remainingLanes;\n root.pendingLanes = remainingLanes;\n root.suspendedLanes = NoLanes;\n root.pingedLanes = NoLanes;\n root.expiredLanes &= remainingLanes;\n root.entangledLanes &= remainingLanes;\n\n let lanes = noLongerPending;\n while (lanes !== NoLanes) {\n const index = laneToIndex(lanes);\n const lane = 1 << index;\n root.entanglements[index] = NoLanes;\n root.expirationTimes[index] = NoTimestamp;\n lanes &= ~lane;\n }\n}\n\nexport function markRootSuspended(root: LaneRoot, lanes: Lanes): void {\n root.suspendedLanes |= lanes;\n root.pingedLanes &= ~lanes;\n\n let laneSet = lanes;\n while (laneSet !== NoLanes) {\n const index = laneToIndex(laneSet);\n const lane = 1 << index;\n root.expirationTimes[index] = NoTimestamp;\n laneSet &= ~lane;\n }\n}\n\nexport function markRootPinged(root: LaneRoot, lanes: Lanes): void {\n root.pingedLanes |= root.suspendedLanes & lanes;\n}\n\nexport function markRootEntangled(root: LaneRoot, lanes: Lanes): void {\n root.entangledLanes |= lanes;\n\n let laneSet = lanes;\n while (laneSet !== NoLanes) {\n const index = laneToIndex(laneSet);\n const lane = 1 << index;\n root.entanglements[index] |= lanes;\n laneSet &= ~lane;\n }\n}\n\nexport function markStarvedLanesAsExpired(\n root: LaneRoot,\n currentTime: number,\n): void {\n let lanes = root.pendingLanes & ~RetryLanes;\n\n while (lanes !== NoLanes) {\n const index = laneToIndex(lanes);\n const lane = 1 << index;\n const expiration = root.expirationTimes[index];\n\n if (expiration === NoTimestamp) {\n if (\n !includesSomeLane(root.suspendedLanes, lane) ||\n includesSomeLane(root.pingedLanes, lane)\n ) {\n root.expirationTimes[index] = computeExpirationTime(lane, currentTime);\n }\n } else if (expiration <= currentTime) {\n root.expiredLanes |= lane;\n }\n\n lanes &= ~lane;\n }\n}\n\nexport function claimNextTransitionLane(): Lane {\n const lane = nextTransitionLane;\n nextTransitionLane <<= 1;\n\n if (!includesSomeLane(TransitionLanes, nextTransitionLane)) {\n nextTransitionLane = TransitionLane1;\n }\n\n return lane;\n}\n\nexport function claimNextRetryLane(): Lane {\n const lane = nextRetryLane;\n nextRetryLane <<= 1;\n\n if (!includesSomeLane(RetryLanes, nextRetryLane)) {\n nextRetryLane = RetryLane1;\n }\n\n return lane;\n}\n\nexport function isSyncLane(lane: Lane): boolean {\n return includesSomeLane(SyncHydrationLane | SyncLane, lane);\n}\n\nexport function includesOnlyTransitions(lanes: Lanes): boolean {\n return (lanes & AllTransitionLanes) === lanes;\n}\n\nexport function getLanePriority(lane: Lane): LanePriority {\n if (includesSomeLane(SyncHydrationLane | SyncLane, lane)) return \"sync\";\n if (\n includesSomeLane(InputContinuousHydrationLane | InputContinuousLane, lane)\n ) {\n return \"input\";\n }\n if (\n includesSomeLane(\n DefaultHydrationLane | DefaultLane | SelectiveHydrationLane,\n lane,\n )\n ) {\n return \"default\";\n }\n if (includesSomeLane(GestureLane, lane)) return \"gesture\";\n if (includesSomeLane(AllTransitionLanes | TransitionHydrationLane, lane)) {\n return \"transition\";\n }\n if (includesSomeLane(RetryLanes, lane)) return \"retry\";\n if (includesSomeLane(DeferredLane, lane)) return \"deferred\";\n if (includesSomeLane(OffscreenLane, lane)) return \"offscreen\";\n return \"idle\";\n}\n\n// Mask checks directly instead of via getLanePriority's string names, so the\n// name table stays out of production bundles (getLanePriority survives for\n// tests and diagnostics only). `lane` is a single bit (highest-priority\n// lane), so merging the groups is exact.\nexport function getLaneSchedulerPriority(lane: Lane): PriorityLevel {\n if (includesSomeLane(SyncHydrationLane | SyncLane, lane)) {\n return ImmediatePriority;\n }\n if (\n includesSomeLane(\n InputContinuousHydrationLane | InputContinuousLane | GestureLane,\n lane,\n )\n ) {\n return UserBlockingPriority;\n }\n // SelectiveHydrationLane is non-idle work (event-triggered hydration of a\n // dehydrated boundary): schedule it at Normal like React, or it starves\n // behind every transition and never gets a scheduler timeout.\n if (\n includesSomeLane(\n DefaultHydrationLane |\n DefaultLane |\n AllTransitionLanes |\n TransitionHydrationLane |\n SelectiveHydrationLane,\n lane,\n )\n ) {\n return NormalPriority;\n }\n if (includesSomeLane(RetryLanes, lane)) return LowPriority;\n return IdlePriority;\n}\n\nexport function requestUpdateLane(): Lane {\n if (currentUpdateLane === DefaultLane && asyncTransitionLanes !== NoLanes) {\n return getHighestPriorityLane(asyncTransitionLanes);\n }\n\n return currentUpdateLane;\n}\n\nexport function runWithPriority<T>(lane: Lane, callback: () => T): T {\n const previousLane = currentUpdateLane;\n currentUpdateLane = lane;\n\n try {\n return callback();\n } finally {\n currentUpdateLane = previousLane;\n }\n}\n\nexport function runWithTransition<T>(callback: () => T): T {\n const lane = includesSomeLane(AllTransitionLanes, currentUpdateLane)\n ? currentUpdateLane\n : claimNextTransitionLane();\n\n return runWithTransitionLane(lane, callback);\n}\n\nexport function runWithTransitionLane<T>(lane: Lane, callback: () => T): T {\n const result = runWithPriority(lane, callback);\n if (isThenable(result)) {\n const release = trackAsyncTransitionLane(lane);\n result.then(release, release);\n }\n\n return result;\n}\n\nfunction trackAsyncTransitionLane(lane: Lane): () => void {\n const index = laneToIndex(lane);\n asyncTransitionLaneCounts[index] += 1;\n asyncTransitionLanes |= lane;\n\n return () => releaseAsyncTransitionLane(lane, index);\n}\n\nfunction releaseAsyncTransitionLane(lane: Lane, index: number): void {\n asyncTransitionLaneCounts[index] = Math.max(\n 0,\n asyncTransitionLaneCounts[index] - 1,\n );\n\n if (asyncTransitionLaneCounts[index] === 0) {\n asyncTransitionLanes &= ~lane;\n }\n}\n\nfunction computeExpirationTime(lane: Lane, currentTime: number): number {\n if (\n includesSomeLane(\n SyncHydrationLane |\n SyncLane |\n InputContinuousHydrationLane |\n InputContinuousLane |\n GestureLane,\n lane,\n )\n ) {\n return currentTime + syncLaneExpirationMs;\n }\n\n if (\n includesSomeLane(\n DefaultHydrationLane |\n DefaultLane |\n TransitionHydrationLane |\n AllTransitionLanes,\n lane,\n )\n ) {\n return currentTime + transitionLaneExpirationMs;\n }\n\n return NoTimestamp;\n}\n\nfunction laneToIndex(lanes: Lanes): number {\n return 31 - Math.clz32(lanes);\n}\n","interface TreeNode<Node> {\n child: Node | null;\n sibling: Node | null;\n}\n\nexport function walkFiberForest<Node extends TreeNode<Node>>(\n node: Node | null,\n visitor: (node: Node) => boolean | void,\n): void {\n walkFiberTree(node, true, visitor);\n}\n\nexport function walkFiberSubtree<Node extends TreeNode<Node>>(\n node: Node,\n visitor: (node: Node) => boolean | void,\n): void {\n walkFiberTree(node, false, visitor);\n}\n\n// The explicit sibling stack bounds a subtree walk even when a detached\n// deletion still points at kept siblings through its old fiber links.\nfunction walkFiberTree<Node extends TreeNode<Node>>(\n node: Node | null,\n includeRootSiblings: boolean,\n visitor: (node: Node) => boolean | void,\n): void {\n const stack: Node[] = [];\n let cursor = node;\n\n while (cursor !== null) {\n const shouldDescend = visitor(cursor) !== false && cursor.child !== null;\n\n if ((includeRootSiblings || cursor !== node) && cursor.sibling !== null) {\n stack.push(cursor.sibling);\n }\n\n cursor = shouldDescend ? cursor.child : (stack.pop() ?? null);\n }\n}\n","import type { StateSetter } from \"@bgub/fig\";\nimport { type Lane, NoLane } from \"./lanes.ts\";\n\nexport type StateUpdate<S> = S | ((previous: S) => S);\n\nexport interface HookUpdate<S> {\n action: StateUpdate<S>;\n lane: Lane;\n next: HookUpdate<S>;\n}\n\nexport interface HookQueue<S> {\n pending: HookUpdate<S> | null;\n dispatch: StateSetter<S> | null;\n}\n\n// Hook queues are circular lists whose tail points at the first update. These\n// operations keep the pointer manipulation in one place so render retries and\n// rebasing share exactly the same ordering rules.\nexport function mergeQueues<S>(\n baseQueue: HookUpdate<S> | null,\n pendingQueue: HookUpdate<S>,\n): HookUpdate<S> {\n if (baseQueue === null) return pendingQueue;\n\n const baseFirst = baseQueue.next;\n const pendingFirst = pendingQueue.next;\n baseQueue.next = pendingFirst;\n pendingQueue.next = baseFirst;\n return pendingQueue;\n}\n\nexport function cloneUpdateNode<S>(update: HookUpdate<S>): HookUpdate<S> {\n const clone: HookUpdate<S> = {\n action: update.action,\n lane: update.lane,\n next: null as never,\n };\n clone.next = clone;\n return clone;\n}\n\nexport function cloneQueue<S>(\n queue: HookUpdate<S> | null,\n): HookUpdate<S> | null {\n return queue === null ? null : cloneQueueNodes(queue);\n}\n\nexport function cloneQueueNodes<S>(queue: HookUpdate<S>): HookUpdate<S> {\n let clone: HookUpdate<S> | null = null;\n let update = queue.next;\n\n do {\n clone = mergeQueues(clone, cloneUpdateNode(update));\n update = update.next;\n } while (update !== queue.next);\n\n return clone as HookUpdate<S>;\n}\n\nexport function clearQueueLanes(queue: HookUpdate<unknown>): void {\n let update = queue.next;\n do {\n update.lane = NoLane;\n update = update.next;\n } while (update !== queue.next);\n}\n","import type { FigNode, Props } from \"@bgub/fig\";\nimport {\n invalidChildError,\n isPortal,\n isValidElement,\n} from \"@bgub/fig/internal\";\n\nconst EmptyHostTextContent = Symbol(\"fig.empty-host-text-content\");\nconst NonTextHostContent = Symbol(\"fig.non-text-host-content\");\n\ntype HostTextContent =\n | string\n | typeof EmptyHostTextContent\n | typeof NonTextHostContent;\n\nexport function hostTextContent(children: unknown): string | null {\n const text = hostTextContentPart(children as FigNode);\n return typeof text === \"string\" ? text : null;\n}\n\nexport function hostChildren(props: Props): FigNode {\n if (!hasUnsafeHTML(props)) return props.children as FigNode;\n if (hasRenderableChild(props.children as FigNode)) {\n throw new Error(\"Host elements cannot have both unsafeHTML and children.\");\n }\n return null;\n}\n\nexport function hasUnsafeHTML(props: Props): boolean {\n return !emptyValue(props.unsafeHTML);\n}\n\nfunction hasRenderableChild(node: FigNode): boolean {\n if (Array.isArray(node)) return node.some(hasRenderableChild);\n return !emptyChild(node);\n}\n\nfunction emptyValue(value: unknown): boolean {\n return value === null || value === undefined || value === false;\n}\n\nfunction emptyChild(value: unknown): boolean {\n return value === null || value === undefined || typeof value === \"boolean\";\n}\n\nfunction hostTextContentPart(node: FigNode): HostTextContent {\n if (Array.isArray(node)) {\n let hasText = false;\n let text = \"\";\n\n for (const child of node) {\n const childText = hostTextContentPart(child);\n if (childText === NonTextHostContent) return NonTextHostContent;\n if (childText === EmptyHostTextContent) continue;\n\n hasText = true;\n text += childText;\n }\n\n return hasText ? text : EmptyHostTextContent;\n }\n\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return EmptyHostTextContent;\n }\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n return String(node);\n }\n\n if (isValidElement(node) || isPortal(node)) return NonTextHostContent;\n\n throw invalidChildError(node);\n}\n","import type {\n DataRefreshResult,\n DataResource,\n DataResourceKey,\n FigDataHydrationEntry,\n} from \"@bgub/fig\";\nimport {\n type FigDataStore,\n type FigDataStoreFactory,\n type FigDataStoreHost,\n setCurrentDataStore,\n} from \"@bgub/fig/internal\";\n\n// Renderer bundles do not import @bgub/fig. Resources created by that package\n// carry the store factory on this symbol, so a root can buffer hydration data\n// until the first real data-resource operation installs the implementation.\nconst DataStoreFactorySymbol = Symbol.for(\"fig.data-store-factory\");\n\nexport function createRootDataStore(host: FigDataStoreHost): FigDataStore {\n let inner: FigDataStore | null = null;\n let buffered: FigDataHydrationEntry[] | null = null;\n let disposed = false;\n\n function installStore<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ): FigDataStore {\n if (inner !== null) return inner;\n if (disposed) {\n throw new Error(\"Data resource APIs require a live Fig root.\");\n }\n\n const factory = (\n resource as DataResource & Record<symbol, FigDataStoreFactory>\n )[DataStoreFactorySymbol];\n if (factory === undefined) {\n throw new Error(\"Data resource APIs require @bgub/fig.\");\n }\n\n inner = factory(host);\n if (buffered !== null) inner.hydrate(buffered);\n buffered = null;\n return inner;\n }\n\n const store: FigDataStore = {\n hydrate(entries: readonly FigDataHydrationEntry[]): void {\n if (inner !== null) {\n inner.hydrate(entries);\n return;\n }\n (buffered ??= []).push(...entries);\n },\n run<T>(callback: () => T): T {\n if (inner !== null) return inner.run(callback);\n\n const previousStore = setCurrentDataStore(store);\n try {\n return callback();\n } finally {\n setCurrentDataStore(previousStore);\n }\n },\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n owner: object,\n ): TValue {\n return installStore(resource).readData(resource, args, owner);\n },\n preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void {\n installStore(resource).preloadData(resource, ...args);\n },\n invalidateData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): void {\n installStore(resource).invalidateData(resource, ...args);\n },\n invalidateDataError(error: unknown): boolean {\n return inner?.invalidateDataError(error) ?? false;\n },\n invalidateDataKey(key: DataResourceKey): void {\n inner?.invalidateDataKey(key);\n },\n invalidateDataPrefix(prefix: DataResourceKey): void {\n inner?.invalidateDataPrefix(prefix);\n },\n refreshData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n ...args: TArgs\n ): Promise<DataRefreshResult<TValue>> {\n return installStore(resource).refreshData(resource, ...args);\n },\n commitDataDependencies(owner: object, previousOwner: object | null): void {\n inner?.commitDataDependencies(owner, previousOwner);\n },\n deleteDataOwner(owner: object): void {\n inner?.deleteDataOwner(owner);\n },\n releaseDataOwner(owner: object): void {\n inner?.releaseDataOwner(owner);\n },\n resetDataDependencies(owner: object): void {\n inner?.resetDataDependencies(owner);\n },\n dispose(): void {\n disposed = true;\n inner?.dispose();\n inner = null;\n buffered = null;\n },\n inspectDataEntries() {\n return inner?.inspectDataEntries() ?? [];\n },\n snapshot() {\n return inner?.snapshot() ?? buffered?.slice() ?? [];\n },\n };\n\n return store;\n}\n","import {\n type ActionStateAction,\n type ActionStateRunner,\n type DataResource,\n type DataResourceKeyInput,\n type DependencyList,\n type EffectCallback,\n type ElementType,\n type ErrorInfo,\n type ExternalStoreSubscribe,\n type FigContext,\n type FigDataHydrationEntry,\n type FigDataStoreHandle,\n type FigNode,\n type FigPortal,\n type Props,\n type StableEventArgs,\n type StartTransition,\n type StateSetter,\n type ViewTransitionClass,\n type ViewTransitionProps,\n} from \"@bgub/fig\";\nimport {\n collectChildren,\n dataResourceKeysForError,\n type FigDataStore,\n invalidChildError,\n isPortal,\n isThenable,\n isValidElement,\n type NormalizedChild,\n type RenderDispatcher,\n readThenable,\n setCurrentDataStore,\n setCurrentDispatcher,\n setTransitionHandler,\n type Thenable,\n} from \"@bgub/fig/internal\";\nimport {\n clearCommitIndex,\n commitIndexCheckpoint,\n type CommitIndex,\n type CommitIndexCheckpoint,\n createCommitIndex,\n recordCommitWork,\n rollbackCommitIndex,\n} from \"./commit-index.ts\";\nimport { emitDevtoolsCommit } from \"./devtools-snapshot.ts\";\nimport { devtoolsTypeName } from \"./devtools.ts\";\nimport {\n ActivityTag,\n AssetsTag,\n ContextProviderTag,\n ErrorBoundaryTag,\n FragmentTag,\n FunctionTag,\n HostTag,\n PortalTag,\n RootTag,\n SuspenseTag,\n tagFor,\n type Tag,\n TextTag,\n ViewTransitionTag,\n} from \"./fiber-tags.ts\";\nimport { walkFiberForest, walkFiberSubtree } from \"./fiber-traversal.ts\";\nimport {\n AdoptedFlag,\n AssembledFlag,\n childSubtreeFlags,\n clearTransientFlags,\n ContextPropagationFlag,\n DeletionFlag,\n EffectFlag,\n type Flag,\n HostUpdateMask,\n HydrationFlag,\n MutationMask,\n NoFlags,\n NotHoistedFlag,\n PlacementFlag,\n StaticFlagsMask,\n StoreConsistencyFlag,\n TextContentFlag,\n UpdateFlag,\n ViewTransitionStaticFlag,\n VisibilityFlag,\n} from \"./fiber-work.ts\";\nimport {\n ActionStateHook,\n BeforeLayoutEffect,\n BeforePaintEffect,\n DeferredValueHook,\n type EffectPhase,\n ExternalStoreHook,\n hookKindNames,\n type HookKind,\n IdHook,\n isEffectHook,\n MemoHook,\n ReactiveEffect,\n StableEventHook,\n StateHook,\n TransitionHook,\n} from \"./hook-kinds.ts\";\nimport {\n clearQueueLanes,\n cloneQueue,\n cloneQueueNodes,\n cloneUpdateNode,\n type HookQueue,\n type HookUpdate,\n mergeQueues,\n type StateUpdate,\n} from \"./hook-queue.ts\";\nimport {\n hasUnsafeHTML,\n hostChildren,\n hostTextContent,\n} from \"./host-content.ts\";\nimport {\n AllTransitionLanes,\n claimNextRetryLane,\n claimNextTransitionLane,\n createLaneMap,\n DefaultHydrationLane,\n DefaultLane,\n DeferredLane,\n getHighestPriorityLane,\n getLaneSchedulerPriority,\n getNextLanes,\n IdleLane,\n InputContinuousLane,\n includesOnlyTransitions,\n includesSomeLane,\n isSyncLane,\n type Lane,\n type LaneRoot,\n type Lanes,\n markRootEntangled,\n markRootFinished,\n markRootPinged,\n markRootSuspended,\n markRootUpdated,\n markStarvedLanesAsExpired,\n mergeLanes,\n NoLane,\n NoLanes,\n NoTimestamp,\n OffscreenLane,\n RetryLanes,\n requestUpdateLane,\n runWithPriority,\n runWithTransition,\n runWithTransitionLane,\n SelectiveHydrationLane,\n SyncLane,\n} from \"./lanes.ts\";\nimport {\n hasRefreshHandler,\n matchesComponentFamily,\n refreshFamilyFor,\n resolveLatestType,\n runWithStaleRefreshFamilies,\n} from \"./refresh-internal.ts\";\nimport type { RefreshUpdate } from \"./refresh.ts\";\nexport type { RefreshUpdate } from \"./refresh.ts\";\nimport { createRootDataStore } from \"./root-data-store.ts\";\nimport {\n NormalPriority,\n now,\n requestPaint,\n type ScheduledTask,\n scheduleCallback,\n shouldYieldToHost,\n} from \"./scheduler.ts\";\nexport { act } from \"./scheduler.ts\";\n\nexport type EventPriority = \"default\" | \"continuous\" | \"discrete\";\n\nexport function runWithEventPriority<T>(\n priority: EventPriority,\n callback: () => T,\n): T {\n return runWithPriority(eventPriorityLane(priority), callback);\n}\n\nfunction eventPriorityLane(priority: EventPriority): Lane {\n switch (priority) {\n case \"discrete\":\n return SyncLane;\n case \"continuous\":\n return InputContinuousLane;\n case \"default\":\n return DefaultLane;\n }\n}\n\nfunction hydrationLaneForPriority(priority: EventPriority): Lane {\n return priority === \"discrete\" ? SyncLane : SelectiveHydrationLane;\n}\n\ndeclare const __FIG_DEV__: boolean | undefined;\n\nconst __DEV__ = typeof __FIG_DEV__ === \"boolean\" ? __FIG_DEV__ : false;\n\nsetTransitionHandler(runWithTransition);\n\ntype Component = (props: Props & { children?: FigNode }) => FigNode;\ntype HostNode<Instance, TextInstance> = Instance | TextInstance;\ntype Parent<Container, Instance> = Container | Instance;\n\nexport interface DehydratedSuspenseError {\n digest?: string;\n message?: string;\n}\n\nexport interface DehydratedSuspenseBoundary<\n Instance = unknown,\n TextInstance = unknown,\n> {\n error?: DehydratedSuspenseError | null;\n id: string | null;\n start: HostNode<Instance, TextInstance>;\n end: HostNode<Instance, TextInstance>;\n status: \"completed\" | \"pending\" | \"client-rendered\";\n forceClientRender: boolean;\n}\n\nexport type ViewTransitionCommitResult = false | \"committed\" | \"deferred\";\n\nexport interface ViewTransitionSurfaceMeasurement {\n // Width/height changes of statically positioned surfaces relayout their\n // parent (React's AffectedParentLayout); absolutely positioned ones don't.\n absolutelyPositioned: boolean;\n height: number;\n inViewport: boolean;\n width: number;\n x: number;\n y: number;\n}\n\n// Computed inside the host's update callback, after mutations and new-side\n// measurement: which already-captured groups turned out not to move (hide\n// them at ready) and whether the whole-page snapshot can be dropped.\nexport interface ViewTransitionMutationResult {\n canceledNames: string[];\n cancelRootSnapshot: boolean;\n}\n\nexport interface ViewTransitionHostConfig<Container, Instance> {\n commit(\n this: void,\n container: Container,\n prepareSnapshot: () => void,\n mutate: () => ViewTransitionMutationResult,\n cleanup: () => void,\n ): ViewTransitionCommitResult;\n apply(\n this: void,\n instance: Instance,\n name: string,\n className: string | null,\n ): void;\n restore(this: void, instance: Instance, props: Props): void;\n measure?(\n this: void,\n instance: Instance,\n ): ViewTransitionSurfaceMeasurement | null;\n // True when a view transition is currently running on the container's\n // document; `onFinished` fires once it settles (and never fires when this\n // returns false). Lets the reconciler park eligible commits behind a\n // running animation instead of committing under it.\n suspend?(this: void, container: Container, onFinished: () => void): boolean;\n}\n\nexport interface HostConfig<Container, Instance, TextInstance> {\n createInstance(\n type: string,\n props: Props,\n parent: Parent<Container, Instance>,\n ): Instance;\n createTextInstance(text: string): TextInstance;\n validateInstanceNesting?(\n type: string,\n props: Props,\n ancestors: readonly string[],\n ): void;\n validateTextNesting?(text: string, ancestors: readonly string[]): void;\n containerType?(container: Parent<Container, Instance>): string | null;\n appendInitialChild?(\n parent: Instance,\n child: HostNode<Instance, TextInstance>,\n ): void;\n finalizeInitialInstance?(instance: Instance, props: Props): void;\n setTextContent?(instance: Instance, text: string): void;\n getFirstHydratableChild?(\n parent: Parent<Container, Instance>,\n props?: Props,\n ): HostNode<Instance, TextInstance> | null;\n getNextHydratableSibling?(\n node: HostNode<Instance, TextInstance>,\n ): HostNode<Instance, TextInstance> | null;\n canHydrateInstance?(\n node: HostNode<Instance, TextInstance>,\n type: string,\n props: Props,\n ): boolean;\n canHydrateTextInstance?(\n node: HostNode<Instance, TextInstance>,\n text: string,\n suppressHydrationWarning?: boolean,\n ): boolean;\n // Hoisted instances (asset resources) live out-of-band, not at their\n // fiber's DOM position: the server emits nothing inline for them, so they\n // must not consume a node from the hydration cursor and their subtrees\n // render fresh; commit acquires them via commitHoistedInstance when the\n // fiber first commits and releases them via removeHoistedInstance when it\n // is deleted, instead of insertBefore/removeChild.\n isHoistedInstance?(type: string, props: Props): boolean;\n // May return a different instance when the fiber's identity already\n // resolves to a live shared instance (e.g. one inserted while this render\n // was suspended); the fiber adopts the returned instance.\n commitHoistedInstance?(instance: Instance): Instance | void;\n removeHoistedInstance?(instance: Instance): void;\n // Hoisted instances are shared by identity (key), so an update that\n // changes the identity must not mutate the shared instance in place; the\n // host releases the old identity and returns the instance to use, which\n // may differ from the current one.\n updateHoistedInstance?(\n instance: Instance,\n previousProps: Props,\n nextProps: Props,\n ): Instance;\n shouldCommitUpdate?(\n type: string,\n previousProps: Props,\n nextProps: Props,\n ): boolean;\n clearContainer?(container: Container): void;\n insertBefore(\n parent: Parent<Container, Instance>,\n child: HostNode<Instance, TextInstance>,\n before: HostNode<Instance, TextInstance> | null,\n ): void;\n removeChild(\n parent: Parent<Container, Instance>,\n child: HostNode<Instance, TextInstance>,\n ): void;\n commitUpdate(\n instance: Instance,\n previousProps: Props,\n nextProps: Props,\n ): void;\n commitHydratedInstance?(instance: Instance, nextProps: Props): void;\n getActivityBoundary?(node: HostNode<Instance, TextInstance>): Instance | null;\n getFirstActivityHydratable?(\n boundary: Instance,\n ): HostNode<Instance, TextInstance> | null;\n commitHydratedActivityBoundary?(boundary: Instance): void;\n hideInstance?(instance: Instance): void;\n unhideInstance?(instance: Instance, props: Props): void;\n hideTextInstance?(instance: TextInstance): void;\n unhideTextInstance?(instance: TextInstance, text: string): void;\n getSuspenseBoundary?(\n node: HostNode<Instance, TextInstance>,\n ): DehydratedSuspenseBoundary<Instance, TextInstance> | null;\n getEnclosingSuspenseBoundaryStart?(\n target: unknown,\n ): HostNode<Instance, TextInstance> | null;\n isTargetWithinSuspenseBoundary?(\n target: unknown,\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): boolean;\n registerSuspenseBoundaryRetry?(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n retry: () => void,\n ): void;\n commitHydratedSuspenseBoundary?(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void;\n completeRootHydration?(container: Container): void;\n removeDehydratedSuspenseBoundary?(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void;\n preparePortalContainer?(\n container: Parent<Container, Instance>,\n root: Container,\n logicalParent: Parent<Container, Instance>,\n ): void;\n removePortalContainer?(container: Parent<Container, Instance>): void;\n viewTransition?: ViewTransitionHostConfig<Container, Instance>;\n commitTextUpdate(text: TextInstance, value: string): void;\n}\n\nexport type HostRenderConfig<Container, Instance, TextInstance> = Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"createInstance\"\n | \"createTextInstance\"\n | \"appendInitialChild\"\n | \"finalizeInitialInstance\"\n | \"setTextContent\"\n | \"insertBefore\"\n | \"removeChild\"\n | \"commitUpdate\"\n | \"commitTextUpdate\"\n | \"shouldCommitUpdate\"\n | \"clearContainer\"\n>;\n\nexport type HostValidationConfig<Container, Instance, TextInstance> = Pick<\n HostConfig<Container, Instance, TextInstance>,\n \"validateInstanceNesting\" | \"validateTextNesting\" | \"containerType\"\n>;\n\nexport type HostHydrationConfig<Container, Instance, TextInstance> = Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"getFirstHydratableChild\"\n | \"getNextHydratableSibling\"\n | \"canHydrateInstance\"\n | \"canHydrateTextInstance\"\n | \"clearContainer\"\n >\n> &\n Pick<HostConfig<Container, Instance, TextInstance>, \"commitHydratedInstance\">;\n\nexport type HostActivityConfig<Container, Instance, TextInstance> = Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"getActivityBoundary\"\n | \"getFirstActivityHydratable\"\n | \"commitHydratedActivityBoundary\"\n | \"hideInstance\"\n | \"unhideInstance\"\n | \"hideTextInstance\"\n | \"unhideTextInstance\"\n >\n>;\n\nexport type HostSuspenseHydrationConfig<Container, Instance, TextInstance> =\n Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"getSuspenseBoundary\"\n | \"getEnclosingSuspenseBoundaryStart\"\n | \"isTargetWithinSuspenseBoundary\"\n | \"registerSuspenseBoundaryRetry\"\n | \"commitHydratedSuspenseBoundary\"\n | \"completeRootHydration\"\n | \"removeDehydratedSuspenseBoundary\"\n >\n >;\n\nexport type HostPortalConfig<Container, Instance, TextInstance> = Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n \"preparePortalContainer\" | \"removePortalContainer\"\n >\n>;\n\nexport type HostHoistedAssetConfig<Container, Instance, TextInstance> =\n Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"isHoistedInstance\"\n | \"commitHoistedInstance\"\n | \"removeHoistedInstance\"\n | \"updateHoistedInstance\"\n >\n >;\n\nexport interface FigRoot {\n data: FigDataStoreHandle;\n render(children: FigNode): void;\n unmount(): void;\n}\n\nexport interface FigRootOptions {\n dataPartition?: DataResourceKeyInput;\n initialData?: readonly FigDataHydrationEntry[];\n identifierPrefix?: string;\n devtools?: boolean;\n onRecoverableError?: (error: unknown, info: RecoverableErrorInfo) => void;\n onUncaughtError?: (error: unknown, info: ErrorInfo) => void;\n}\n\nexport interface RecoverableErrorInfo extends ErrorInfo {\n actual?: string;\n boundaryId?: string;\n componentStack: string;\n digest?: string;\n expected?: string;\n recovery: \"root\" | \"suspense\";\n source: \"hydration\" | \"server\";\n}\n\nexport type HydrationTargetResult = \"none\" | \"hydrated\" | \"blocked\";\n\nexport interface FigRenderer<Container> {\n batchedUpdates<T>(this: void, callback: () => T): T;\n createRoot(\n this: void,\n container: Container,\n options?: FigRootOptions,\n ): FigRoot;\n hydrateRoot(\n this: void,\n container: Container,\n children: FigNode,\n options?: FigRootOptions,\n ): FigRoot;\n hydrateTarget(\n this: void,\n container: Container,\n target: unknown,\n priority?: EventPriority,\n ): HydrationTargetResult;\n flushSync<T>(this: void, callback: () => T): T;\n scheduleRefresh(this: void, update: RefreshUpdate): void;\n}\n\ntype RequiredHydrationHostConfig<Container, Instance, TextInstance> =\n HostHydrationConfig<Container, Instance, TextInstance>;\n// A commit may animate only when every rendered lane is transition-shaped:\n// transitions, retries (client Suspense reveals), deferred follow-ups, idle.\n// Hydration lanes are excluded on purpose — hydration changes no pixels, so\n// animating an \"enter\" for freshly hydrated boundaries is a visible glitch —\n// and only-eligible (not some-lane) semantics keep urgent updates that were\n// batched into the commit (expiration, entanglement) from being captured\n// mid-animation. Mirrors React's includesOnlyViewTransitionEligibleLanes.\nconst ViewTransitionEligibleLanes =\n AllTransitionLanes | RetryLanes | DeferredLane | IdleLane;\n\ninterface Hook<S = any> {\n kind: HookKind;\n memoizedState: S;\n baseState: S;\n baseQueue: HookUpdate<S> | null;\n queue: HookQueue<S>;\n next: Hook<any> | null;\n}\n\ninterface Effect {\n phase: EffectPhase;\n create: EffectCallback;\n controller: AbortController | null;\n deps: DependencyList | null;\n owner: Fiber<unknown, unknown, unknown>;\n // Carried across renders like controller; gates the dev-only strict\n // re-run to once per hook lifetime so renders nested inside an effect\n // (e.g. flushSync) cannot re-trigger the cycle.\n strictRan: boolean;\n}\n\ntype StableEventHandler = (...args: unknown[]) => unknown;\n\ninterface StableEventInstance {\n controller: AbortController | null;\n handler: StableEventHandler | null;\n live: boolean;\n stable: StableEventHandler;\n}\n\ninterface StableEventState {\n instance: StableEventInstance;\n // Lives on the per-render hook state, not the persistent instance: commits\n // republish bailed-out fibers' hooks, so an abandoned render's handler must\n // never be reachable from the instance.\n next: StableEventHandler;\n}\n\ninterface MemoState<T> {\n value: T;\n deps: DependencyList;\n}\n\n// One cancellable run per hook: supersede/unmount/hide abort the controller\n// and bump the generation, which retires the run — retired settlements are\n// fully inert (no pending decrement, rejections swallowed).\ninterface RunInstance {\n controller: AbortController | null;\n generation: number;\n}\n\ninterface TransitionState {\n instance: RunInstance;\n pendingCount: number;\n start: StartTransition | null;\n}\n\nconst NoActionStateError = Symbol();\n\ninterface ActionStateInstance<S, Args extends unknown[]> extends RunInstance {\n action: ActionStateAction<S, Args>;\n value: S;\n}\n\ninterface ActionState<S, Args extends unknown[]> {\n error: unknown;\n instance: ActionStateInstance<S, Args>;\n pending: number;\n action: ActionStateAction<S, Args>;\n value: S;\n}\n\ntype QueuedHookKind =\n | typeof StateHook\n | typeof TransitionHook\n | typeof ActionStateHook;\n\ninterface ExternalStoreInstance<T, Owner> {\n committedSubscribe: ExternalStoreSubscribe | null;\n getSnapshot: () => T;\n owner: Owner | null;\n unsubscribe: (() => void) | null;\n value: T;\n}\n\ninterface ExternalStoreState<T, Owner> {\n getSnapshot: () => T;\n instance: ExternalStoreInstance<T, Owner>;\n subscribe: ExternalStoreSubscribe;\n value: T;\n}\n\ninterface SuspenseFallbackState<Container, Instance, TextInstance> {\n kind: \"fallback\";\n primaryChild: Fiber<Container, Instance, TextInstance> | null;\n}\n\ninterface DehydratedSuspenseState<Instance, TextInstance> {\n kind: \"dehydrated\";\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>;\n wasPending: boolean;\n}\n\ntype SuspenseState<Container, Instance, TextInstance> =\n | SuspenseFallbackState<Container, Instance, TextInstance>\n | DehydratedSuspenseState<Instance, TextInstance>;\n\ninterface HiddenState<Container, Instance, TextInstance> {\n currentFirstChild: Fiber<Container, Instance, TextInstance> | null;\n}\n\ninterface ErrorBoundaryState {\n error: unknown;\n info: ErrorInfo;\n didReport: boolean;\n}\n\ninterface ActivityState<Instance> {\n hidden: boolean;\n // The host boundary (an inert template holding server content) while the\n // boundary is dehydrated, or null; cleared when the content unpacks at\n // commit.\n dehydrated: Instance | null;\n}\n\ntype BoundaryState<Container, Instance, TextInstance> =\n | SuspenseState<Container, Instance, TextInstance>\n | ErrorBoundaryState\n | ActivityState<Instance>;\n\ninterface ContextDependency {\n context: FigContext<unknown>;\n memoizedValue: unknown;\n}\n\n// A suspension recorded during render, retried through the boundary fiber\n// once a commit blesses that fiber's identity. Entries from discarded renders\n// die with the render; their thenables are covered by the root ping attached\n// at capture time.\ninterface PendingSuspenseRetry<Container, Instance, TextInstance> {\n boundary: Fiber<Container, Instance, TextInstance>;\n thenable: Thenable;\n lanes: Lanes;\n}\n\ninterface Fiber<Container, Instance, TextInstance> {\n tag: Tag;\n type: ElementType | null;\n key: string | number | null;\n props: Props;\n memoizedProps: Props | null;\n committedProps: Props | null;\n memoizedState: Hook<any> | null;\n stateNode:\n | HostNode<Instance, TextInstance>\n | FiberRoot<Container, Instance, TextInstance>\n | ViewTransitionState\n | null;\n return: Fiber<Container, Instance, TextInstance> | null;\n child: Fiber<Container, Instance, TextInstance> | null;\n sibling: Fiber<Container, Instance, TextInstance> | null;\n index: number;\n alternate: Fiber<Container, Instance, TextInstance> | null;\n flags: Flag;\n subtreeFlags: Flag;\n deletions: Fiber<Container, Instance, TextInstance>[] | null;\n lanes: Lanes;\n childLanes: Lanes;\n effects: Effect[] | null;\n contextDependencies: ContextDependency[] | null;\n contextSubtreeDependencies: FigContext<unknown>[] | null;\n dataDependenciesDirty: boolean;\n // The fiber tag discriminates this union. Keep this cold slot after the\n // topology and work fields: changing their object offsets slows hot paths.\n // Activity state is shared by both generations so stale return chains see\n // the committed visibility state.\n boundaryState: BoundaryState<Container, Instance, TextInstance> | null;\n suspenseQueueStart?: number;\n // Suspense/ErrorBoundary only: root commit-index length when this boundary\n // began, so a capture can truncate entries queued by its discarded subtree.\n commitIndexCheckpoint?: CommitIndexCheckpoint;\n hiddenState: HiddenState<Container, Instance, TextInstance> | null;\n}\n\ninterface ViewTransitionState {\n autoName: string | null;\n}\n\ntype ViewTransitionPhase = \"enter\" | \"exit\" | \"share\" | \"update\";\n\ninterface ViewTransitionSurface<Instance> {\n boundary: object;\n className: string | null;\n instance: Instance;\n // Old-side geometry, captured while applying names before the old\n // snapshot; the post-mutation pass compares against fresh measurements.\n measurement: ViewTransitionSurfaceMeasurement | null;\n // Content-driven updates and share pairs animate regardless of geometry;\n // layout-driven updates and moves let measurement decide.\n mustAnimate: boolean;\n name: string;\n phase: ViewTransitionPhase;\n props: Props;\n // Gated out (viewport, unchanged geometry): no name applied on this side.\n skipped: boolean;\n}\n\ninterface ViewTransitionPlan<Instance> {\n newSurfaces: ViewTransitionSurface<Instance>[];\n oldSurfaces: ViewTransitionSurface<Instance>[];\n // True when the commit also mutates layout outside annotated boundaries\n // (insertions, deletions, moves, or plain mutations not contained in a\n // collected boundary). When false the host may cancel the browser's\n // whole-page snapshot so untouched regions stay interactive.\n rootAffected: boolean;\n}\n\ninterface FiberRoot<Container, Instance, TextInstance> extends LaneRoot {\n container: Container;\n current: Fiber<Container, Instance, TextInstance>;\n element: FigNode;\n identifierPrefix: string;\n devtools: boolean;\n callback: ScheduledTask | null;\n callbackPriority: Lane;\n wip: Fiber<Container, Instance, TextInstance> | null;\n finishedWork: Fiber<Container, Instance, TextInstance> | null;\n renderLanes: Lanes;\n pendingViewTransitionCommit: boolean;\n // finishedWork is rendered but its commit waits for a running view\n // transition to finish. Unlike pendingViewTransitionCommit (the sub-frame\n // capture window, which freezes the root), a parked root keeps rendering:\n // newer work supersedes the parked tree so the latest state commits when\n // the animation ends.\n parkedViewTransitionCommit: boolean;\n dataStore: FigDataStore;\n contextValues: Map<FigContext<unknown>, unknown>;\n contextStack: ContextStackEntry<Container, Instance, TextInstance>[];\n externalStores: Set<\n ExternalStoreInstance<unknown, Fiber<Container, Instance, TextInstance>>\n >;\n pendingReactiveEffects: Effect[];\n reactiveCallback: ScheduledTask | null;\n suspendedThenables: WeakMap<object, Lanes>;\n pendingSuspenseRetries: PendingSuspenseRetry<\n Container,\n Instance,\n TextInstance\n >[];\n attachedSuspenseRetries: WeakMap<\n object,\n WeakSet<Fiber<Container, Instance, TextInstance>>\n >;\n consumedPendingQueues: ConsumedPendingQueue[];\n onRecoverableError: (error: unknown, info: RecoverableErrorInfo) => void;\n onUncaughtError: ((error: unknown, info: ErrorInfo) => void) | null;\n recoverableErrors: RecoverableErrorRecord[];\n uncaughtErrorInfo: ErrorInfo | null;\n commitEffectPhases: number;\n needsCommitDeletions: boolean;\n // Commit work discovered during render: every fiber that rendered hooks,\n // recorded deletions, or caught an error, in begin order (pre-order over\n // the rendered region). Commit passes iterate this instead of walking the\n // tree; each pass re-checks its own per-fiber predicate, so duplicate and\n // stale entries are inert. Truncated to a boundary checkpoint when a\n // capture discards its subtree; cleared on restart and after commit.\n commitIndex: CommitIndex<Fiber<Container, Instance, TextInstance>>;\n // Boundaries that caught during the commit phase (effects, reactive\n // flushes). Kept outside the commit index: these must survive render restarts\n // until a later commit reports them.\n committedCaughtErrors: Fiber<Container, Instance, TextInstance>[];\n isHydrating: boolean;\n isHydrationRoot: boolean;\n hydrationParent: Fiber<Container, Instance, TextInstance> | null;\n hydratingSuspenseBoundary: Fiber<Container, Instance, TextInstance> | null;\n hydratingActivityBoundary: Fiber<Container, Instance, TextInstance> | null;\n dehydratedSuspenseCount: number;\n // Live dehydrated boundaries keyed by their start marker node, rebuilt in\n // the same post-commit walk that maintains dehydratedSuspenseCount, so\n // event-target lookups resolve to a fiber without searching the tree.\n dehydratedBoundaries: Map<\n HostNode<Instance, TextInstance>,\n Fiber<Container, Instance, TextInstance>\n >;\n needsRootHydrationCompletion: boolean;\n nextHydratableInstance: HostNode<Instance, TextInstance> | null;\n clearContainerBeforeCommit: boolean;\n hydrationInitialElement: FigNode | typeof NoHydrationInitialElement;\n}\n\ninterface ContextStackEntry<Container, Instance, TextInstance> {\n context: FigContext<unknown>;\n hadPrevious: boolean;\n previous: unknown;\n provider: Fiber<Container, Instance, TextInstance>;\n}\n\ninterface ConsumedPendingQueue {\n queue: HookQueue<unknown>;\n pending: HookUpdate<unknown>;\n}\n\ninterface RecoverableErrorRecord {\n error: unknown;\n info: RecoverableErrorInfo;\n}\n\ntype RecoverableDetails = Omit<RecoverableErrorInfo, \"componentStack\">;\n\nconst PreservedSuspense = Symbol(\"fig.preserved-suspense\");\nconst NoHydrationInitialElement = Symbol(\"fig.no-hydration-initial-element\");\n\nclass HydrationMismatchError extends Error {}\n\nexport function createRenderer<Container, Instance, TextInstance>(\n host: HostConfig<Container, Instance, TextInstance>,\n): FigRenderer<Container> {\n type F = Fiber<Container, Instance, TextInstance>;\n type R = FiberRoot<Container, Instance, TextInstance>;\n // Shared read-only stand-in for the common no-retries commit; never pushed\n // to (commits swap in a fresh array before recording anything).\n const noSuspenseRetries: PendingSuspenseRetry<\n Container,\n Instance,\n TextInstance\n >[] = [];\n type ActivityHydrationHostConfig = HostConfig<\n Container,\n Instance,\n TextInstance\n > &\n Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"getActivityBoundary\"\n | \"getFirstActivityHydratable\"\n | \"commitHydratedActivityBoundary\"\n >\n >;\n type RequiredHoistedAssetHostConfig = HostConfig<\n Container,\n Instance,\n TextInstance\n > &\n HostHoistedAssetConfig<Container, Instance, TextInstance>;\n const roots = new WeakMap<object, R>();\n // Iterable view of live roots, only populated when a refresh handler is set,\n // so a hot-reload pass can walk every mounted tree (dev-only; empty in prod).\n const mountedRoots = new Set<R>();\n const pendingRoots = new Set<R>();\n const batchedRoots = new Set<R>();\n const abandonedHydrationBoundaries = new WeakSet<object>();\n let batchDepth = 0;\n let flushingSyncWork = false;\n let commitDepth = 0;\n let needsPostCommitSyncFlush = false;\n let flushingPostCommitSyncWork = false;\n let nestedPostCommitSyncFlushes = 0;\n const nestedPostCommitSyncFlushLimit = 50;\n let currentCommitEffectPhase: EffectPhase | null = null;\n // `hasHiddenBoundaries` gates the parent-walk in `hiddenSubtreeLane`: while it\n // is false no update can need the offscreen downgrade, so the walk is skipped.\n // It is set eagerly true whenever a hidden boundary is begun (covering the\n // in-flight render before its commit) and recomputed from `hiddenStates` at\n // the end of every commit, so it resets to false once the last hidden boundary\n // is revealed or unmounted. `hiddenStates` tracks the live committed\n // `ActivityState`s that are currently hidden; keying on the state object (which\n // both fiber generations share) makes membership generation-agnostic.\n let hasHiddenBoundaries = false;\n const hiddenStates = new Set<ActivityState<Instance>>();\n let activityHostConfig: ReturnType<typeof requireActivityHostConfig> | null =\n null;\n let activityHydrationHostConfig: ActivityHydrationHostConfig | null = null;\n let hoistedAssetHostConfig: RequiredHoistedAssetHostConfig | null = null;\n const viewTransitionHost = host.viewTransition ?? null;\n let renderingFiber: F | null = null;\n let currentHook: Hook | null = null;\n let workInProgressHook: Hook | null = null;\n let localIdCounter = 0;\n let viewTransitionAutoNameCounter = 0;\n\n // Argument-identical delegations are direct references (the function\n // declarations below are hoisted); only the effect hooks, which bind their\n // phase constant, need wrappers.\n const dispatcher: RenderDispatcher = {\n useState: updateStateHook,\n useActionState: updateActionStateHook,\n useId: updateIdHook,\n useDeferredValue: updateDeferredValueHook,\n useMemo: updateMemoHook,\n useTransition: updateTransitionHook,\n useReactive(effect: EffectCallback, deps?: DependencyList): void {\n updateEffectHook(ReactiveEffect, effect, deps);\n },\n useBeforePaint(effect: EffectCallback, deps?: DependencyList): void {\n updateEffectHook(BeforePaintEffect, effect, deps);\n },\n useBeforeLayout(effect: EffectCallback, deps?: DependencyList): void {\n updateEffectHook(BeforeLayoutEffect, effect, deps);\n },\n useSyncExternalStore: updateExternalStoreHook,\n useStableEvent: updateStableEventHook,\n readContext: readContextValue,\n readData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): TValue {\n const fiber = requireRenderingFiber();\n return rootOf(fiber).dataStore.readData(resource, args, fiber);\n },\n preloadData<TArgs extends unknown[], TValue>(\n resource: DataResource<TArgs, TValue>,\n args: TArgs,\n ): void {\n const fiber = requireRenderingFiber();\n rootOf(fiber).dataStore.preloadData(resource, ...args);\n },\n readPromise<T>(promise: PromiseLike<T>): T {\n return readThenable(promise);\n },\n };\n\n function createRoot(\n container: Container,\n options: FigRootOptions = {},\n ): FigRoot {\n return rootHandle(rootForContainer(container, { kind: \"client\", options }));\n }\n\n function hydrateRoot(\n container: Container,\n children: FigNode,\n options: FigRootOptions = {},\n ): FigRoot {\n const root = rootForContainer(container, { kind: \"hydration\", options });\n root.hydrationInitialElement = children;\n updateRoot(root, children);\n return rootHandle(root);\n }\n\n function rootForContainer(\n container: Container,\n request: {\n kind: \"client\" | \"hydration\";\n options?: FigRootOptions;\n },\n ): R {\n if (roots.has(container as object)) {\n throw duplicateRootError(request.kind);\n }\n\n if (request.kind === \"hydration\") requireHydrationHostConfig();\n\n const root = createFiberRoot(container, request.options ?? {});\n roots.set(container as object, root);\n if (__DEV__) {\n if (hasRefreshHandler()) mountedRoots.add(root);\n }\n\n if (request.kind === \"hydration\") {\n root.isHydrating = true;\n root.isHydrationRoot = true;\n root.needsRootHydrationCompletion = true;\n }\n\n return root;\n }\n\n function createFiberRoot(container: Container, options: FigRootOptions): R {\n const current = fiber(RootTag, null, null, { children: null }, null);\n const dataStore = createRootDataStore({\n getLane: requestUpdateLane,\n partition: options.dataPartition,\n schedule(owner: object, lane: unknown): void {\n scheduleFiber(owner as F, hiddenSubtreeLane(owner as F, lane as Lane));\n },\n });\n const root: R = {\n container,\n current,\n element: null,\n identifierPrefix: options.identifierPrefix ?? \"\",\n devtools: options.devtools ?? true,\n pendingLanes: NoLanes,\n suspendedLanes: NoLanes,\n pingedLanes: NoLanes,\n expiredLanes: NoLanes,\n entangledLanes: NoLanes,\n entanglements: createLaneMap(NoLanes),\n expirationTimes: createLaneMap(NoTimestamp),\n callback: null,\n callbackPriority: NoLane,\n wip: null,\n finishedWork: null,\n renderLanes: NoLanes,\n pendingViewTransitionCommit: false,\n parkedViewTransitionCommit: false,\n dataStore,\n contextValues: new Map(),\n contextStack: [],\n externalStores: new Set(),\n pendingReactiveEffects: [],\n reactiveCallback: null,\n suspendedThenables: new WeakMap(),\n pendingSuspenseRetries: [],\n attachedSuspenseRetries: new WeakMap(),\n consumedPendingQueues: [],\n onRecoverableError: options.onRecoverableError ?? noop,\n onUncaughtError: options.onUncaughtError ?? null,\n recoverableErrors: [],\n uncaughtErrorInfo: null,\n commitEffectPhases: 0,\n needsCommitDeletions: false,\n commitIndex: createCommitIndex(),\n committedCaughtErrors: [],\n isHydrating: false,\n isHydrationRoot: false,\n hydrationParent: null,\n hydratingSuspenseBoundary: null,\n hydratingActivityBoundary: null,\n dehydratedSuspenseCount: 0,\n dehydratedBoundaries: new Map(),\n needsRootHydrationCompletion: false,\n nextHydratableInstance: null,\n clearContainerBeforeCommit: false,\n hydrationInitialElement: NoHydrationInitialElement,\n };\n if (options.initialData !== undefined)\n dataStore.hydrate(options.initialData);\n current.stateNode = root;\n return root;\n }\n\n function duplicateRootError(kind: \"client\" | \"hydration\"): Error {\n const method = kind === \"hydration\" ? \"hydrateRoot\" : \"createRoot\";\n return new Error(\n `Cannot call ${method} on a container that already has a Fig root. Use the existing root.render(...) to update it instead.`,\n );\n }\n\n function noop(): void {}\n\n function rootHandle(root: R): FigRoot {\n let unmounted = false;\n return {\n data: root.dataStore,\n render: (children) => {\n if (unmounted) {\n throw new Error(\"Cannot update an unmounted root.\");\n }\n updateRoot(root, children);\n },\n unmount: () => {\n if (unmounted) return;\n unmounted = true;\n // Tear the tree down synchronously so per-fiber data cleanup runs while\n // the store is still live; dispose is then the final teardown step.\n flushSync(() => updateRoot(root, null));\n root.dataStore.dispose();\n // Free the container so a later createRoot/render starts a fresh root\n // instead of reusing this one's now-disposed store.\n if (roots.get(root.container as object) === root) {\n roots.delete(root.container as object);\n }\n mountedRoots.delete(root);\n },\n };\n }\n\n function hydrateTarget(\n container: Container,\n target: unknown,\n priority: EventPriority = \"default\",\n ): HydrationTargetResult {\n const lane = hydrationLaneForPriority(priority);\n const root = roots.get(container as object);\n if (root === undefined) return \"none\";\n // Before the shell's first hydration commit nothing has handlers, so\n // every target is blocked — reporting \"none\" here would let a replayed\n // event dispatch into a slot-less tree and be consumed silently. A\n // discrete interaction pulls the whole initial hydration forward\n // synchronously, exactly like it does for a dehydrated boundary.\n if (rootShellPendingHydration(root)) {\n if (isSyncLane(lane)) performRoot(root, true);\n if (rootShellPendingHydration(root)) return \"blocked\";\n }\n if (root.dehydratedSuspenseCount === 0) return \"none\";\n\n const boundary = dehydratedBoundaryForTarget(root, target);\n if (boundary === null) return \"none\";\n\n scheduleFiber(boundary, lane);\n if (isSyncLane(lane)) performRoot(root, true);\n return dehydratedBoundaryForTarget(root, target) === null\n ? \"hydrated\"\n : \"blocked\";\n }\n\n // needsRootHydrationCompletion clears when every boundary hydrated, and\n // current.child fills at the first commit — together they mean \"the shell\n // has not committed yet\" (a root rendering null clears the flag at its\n // first commit, so the conjunction still breaks).\n function rootShellPendingHydration(root: R): boolean {\n return root.needsRootHydrationCompletion && root.current.child === null;\n }\n\n function dehydratedBoundaryForTarget(root: R, target: unknown): F | null {\n if (host.getEnclosingSuspenseBoundaryStart === undefined) {\n // Fallback for hosts without target-instance lookup: search the fiber\n // tree for a dehydrated boundary whose host range contains the target.\n return findDehydratedSuspenseBoundaryForTarget(\n root.current.child,\n target,\n );\n }\n\n // A start marker with no live dehydrated fiber belongs to a boundary\n // nested inside an outer dehydrated one (its content has no fibers yet),\n // so resume the marker walk outward from that marker.\n let start = host.getEnclosingSuspenseBoundaryStart(target);\n while (start !== null) {\n const fiber = root.dehydratedBoundaries.get(start) ?? null;\n if (fiberSuspenseState(fiber)?.kind === \"dehydrated\") return fiber;\n start = host.getEnclosingSuspenseBoundaryStart(start);\n }\n\n return null;\n }\n\n function flushSync<T>(callback: () => T): T {\n if (renderingFiber !== null) {\n throw new Error(\n \"flushSync cannot be called while rendering a component.\",\n );\n }\n\n try {\n return runWithPriority(SyncLane, callback);\n } finally {\n flushSyncWork();\n }\n }\n\n function flushSyncWork(): void {\n if (commitDepth > 0) {\n needsPostCommitSyncFlush = true;\n return;\n }\n\n // Save/restore rather than force false: a nested flushSync (e.g. unmount()\n // from a commit-phase effect) must not clear the flag while an outer flush is\n // still running, or the outer flush's uncaught errors get misrouted.\n const previousFlushingSyncWork = flushingSyncWork;\n flushingSyncWork = true;\n try {\n for (const root of pendingRoots) {\n if (root.pendingLanes !== NoLanes) {\n root.callback?.cancel();\n root.callback = null;\n root.callbackPriority = NoLane;\n performRoot(root, true);\n } else {\n pendingRoots.delete(root);\n }\n }\n } finally {\n flushingSyncWork = previousFlushingSyncWork;\n }\n }\n\n function flushPostCommitSyncWork(): void {\n if (\n commitDepth > 0 ||\n !needsPostCommitSyncFlush ||\n flushingPostCommitSyncWork\n ) {\n return;\n }\n\n flushingPostCommitSyncWork = true;\n try {\n do {\n nestedPostCommitSyncFlushes += 1;\n if (nestedPostCommitSyncFlushes > nestedPostCommitSyncFlushLimit) {\n throw new Error(\"Maximum update depth exceeded.\");\n }\n needsPostCommitSyncFlush = false;\n flushSyncWork();\n } while (needsPostCommitSyncFlush);\n } finally {\n nestedPostCommitSyncFlushes = 0;\n flushingPostCommitSyncWork = false;\n }\n }\n\n function batchedUpdates<T>(callback: () => T): T {\n batchDepth += 1;\n\n try {\n return callback();\n } finally {\n batchDepth -= 1;\n if (batchDepth === 0) {\n for (const root of batchedRoots) scheduleRoot(root);\n batchedRoots.clear();\n }\n }\n }\n\n function updateRoot(root: R, children: FigNode): void {\n if (shouldClientRenderEarlyHydrationUpdate(root, children)) {\n forceClientRender(root);\n }\n\n const lane = requestUpdateLane();\n root.element = children;\n markRootPending(root, lane);\n scheduleOrBatchRoot(root);\n }\n\n function markRootPending(root: R, lane: Lane): void {\n markRootUpdated(root, lane);\n pendingRoots.add(root);\n if (currentCommitEffectPhase === BeforePaintEffect && isSyncLane(lane)) {\n needsPostCommitSyncFlush = true;\n }\n }\n\n function markCommitEffectPhase(root: R, phase: EffectPhase): void {\n root.commitEffectPhases |= 1 << phase;\n }\n\n function scheduleOrBatchRoot(root: R): void {\n if (batchDepth > 0) batchedRoots.add(root);\n else scheduleRoot(root);\n }\n\n function scheduleRoot(root: R): void {\n if (root.pendingViewTransitionCommit) return;\n\n markStarvedLanesAsExpired(root, now());\n\n const nextLanes = getNextLanes(root, root.renderLanes);\n if (nextLanes === NoLanes) {\n if (root.pendingLanes === NoLanes) pendingRoots.delete(root);\n return;\n }\n\n const priorityLane = getHighestPriorityLane(nextLanes);\n if (root.callback !== null && root.callbackPriority === priorityLane)\n return;\n\n root.callback?.cancel();\n root.callbackPriority = priorityLane;\n root.callback = scheduleCallback(\n getLaneSchedulerPriority(priorityLane),\n () => {\n performRoot(root, isSyncLane(priorityLane));\n },\n );\n }\n\n function performRoot(root: R, forceSync: boolean): void {\n try {\n performRootWork(root, forceSync);\n } catch (error) {\n if (error === PreservedSuspense) {\n restartRootWork(root);\n scheduleRoot(root);\n return;\n }\n\n if (error instanceof HydrationMismatchError) {\n recoverFromHydrationMismatch(root);\n return;\n }\n\n if (isThenable(error)) {\n const suspendedLanes = root.renderLanes;\n restartRootWork(root);\n markRootSuspended(root, suspendedLanes);\n attachPing(root, error, suspendedLanes);\n scheduleRoot(root);\n return;\n }\n\n const info = root.uncaughtErrorInfo ?? errorInfoFor(root.current, error);\n restartRootWork(root);\n clearRootAfterUncaughtError(root);\n reportUncaughtError(root, error, info);\n\n // flushSync callers observe the error directly. Outside flushSync the\n // error must not escape into the scheduler tick (that would stall other\n // queued tasks), so without an onUncaughtError handler it is rethrown\n // from a detached task to surface as a global error.\n if (flushingSyncWork) throw error;\n if (root.onUncaughtError === null) {\n setTimeout(() => {\n throw error;\n });\n }\n }\n }\n\n function recoverFromHydrationMismatch(root: R): void {\n if (root.hydratingSuspenseBoundary !== null) {\n recoverFromSuspenseHydrationMismatch(\n root,\n root.hydratingSuspenseBoundary,\n );\n return;\n }\n\n markHydrationRecovery(root, \"root\");\n restartRootWork(root);\n forceClientRender(root);\n performRoot(root, true);\n }\n\n function recoverFromSuspenseHydrationMismatch(root: R, boundary: F): void {\n const current = boundary.alternate ?? boundary;\n const state = fiberSuspenseState(current);\n\n restartRootWork(root);\n\n if (state?.kind !== \"dehydrated\") {\n markHydrationRecovery(root, \"root\");\n forceClientRender(root);\n performRoot(root, true);\n return;\n }\n\n markHydrationRecovery(root, \"suspense\");\n state.boundary.forceClientRender = true;\n deactivateHydration(root);\n scheduleFiber(current, SelectiveHydrationLane);\n performRoot(root, true);\n }\n\n function markHydrationRecovery(\n root: R,\n recovery: RecoverableErrorInfo[\"recovery\"],\n ): void {\n for (const record of root.recoverableErrors) {\n if (record.info.source === \"hydration\") record.info.recovery = recovery;\n }\n }\n\n function shouldClientRenderEarlyHydrationUpdate(\n root: R,\n children: FigNode,\n ): boolean {\n return (\n root.isHydrating &&\n root.current.child === null &&\n root.hydrationInitialElement !== NoHydrationInitialElement &&\n root.hydrationInitialElement !== children\n );\n }\n\n function forceClientRender(root: R): void {\n deactivateHydration(root);\n root.clearContainerBeforeCommit = true;\n root.hydrationInitialElement = NoHydrationInitialElement;\n }\n\n function performRootWork(root: R, forceSync: boolean): void {\n if (root.pendingViewTransitionCommit) return;\n\n if (root.pendingLanes === NoLanes && root.wip === null) {\n pendingRoots.delete(root);\n return;\n }\n\n flushPendingReactiveEffects(root);\n\n if (root.parkedViewTransitionCommit) {\n root.parkedViewTransitionCommit = false;\n // The parked tree's lanes were never marked finished, so they are\n // still inside pendingLanes; anything beyond them is newer work.\n const supersededByNewerWork =\n (root.pendingLanes & ~root.renderLanes) !== NoLanes;\n if (\n !supersededByNewerWork &&\n root.wip === null &&\n root.finishedWork !== null\n ) {\n // Nothing changed while the animation ran: commit the parked tree\n // as-is (commitRoot re-parks it if yet another transition started\n // in between, e.g. a streaming reveal).\n if (commitRoot(root, root.finishedWork)) return;\n finishRootWork(root);\n flushPostCommitSyncWork();\n return;\n }\n // Newer work supersedes the parked commit — React cancels its\n // suspended commit the same way. restartRootWork restores the update\n // queues the parked render consumed, and the fresh render below\n // absorbs the parked lanes, so the latest state commits instead.\n restartRootWork(root);\n }\n\n const nextLanes = getNextLanes(root, root.renderLanes);\n if (nextLanes === NoLanes && root.wip === null) {\n root.callback = null;\n root.callbackPriority = NoLane;\n return;\n }\n\n if (\n root.wip !== null &&\n nextLanes !== NoLanes &&\n nextLanes !== root.renderLanes\n ) {\n restartRootWork(root);\n }\n\n if (root.wip === null) {\n root.renderLanes = nextLanes;\n root.consumedPendingQueues = [];\n resetContextStack(root);\n root.finishedWork = createWorkInProgress(root.current, {\n children: root.element,\n });\n root.wip = root.finishedWork;\n prepareToHydrateRoot(root);\n }\n\n while (\n root.wip !== null &&\n (forceSync ||\n isSyncLane(getHighestPriorityLane(root.renderLanes)) ||\n !shouldYieldToHost())\n ) {\n root.wip = performUnit(root.wip);\n }\n\n if (root.wip !== null) {\n root.callback = null;\n root.callbackPriority = NoLane;\n scheduleRoot(root);\n return;\n }\n\n if (root.finishedWork !== null && commitRoot(root, root.finishedWork)) {\n return;\n }\n finishRootWork(root);\n flushPostCommitSyncWork();\n }\n\n function finishRootWork(root: R): void {\n resetRootWork(root);\n\n if (root.pendingLanes !== NoLanes) scheduleRoot(root);\n else pendingRoots.delete(root);\n }\n\n function restartRootWork(root: R): void {\n restoreConsumedPendingQueues(root);\n resetRootWork(root);\n }\n\n function resetRootWork(root: R): void {\n const wasHydratingCompletedBoundary =\n root.hydrationInitialElement === NoHydrationInitialElement &&\n (root.hydratingSuspenseBoundary !== null ||\n root.hydratingActivityBoundary !== null);\n root.wip = null;\n root.finishedWork = null;\n root.renderLanes = NoLanes;\n root.callback = null;\n root.callbackPriority = NoLane;\n // Retries recorded by the discarded render die with it; their thenables\n // stay covered by the root pings attached at capture time.\n if (root.pendingSuspenseRetries.length > 0) {\n root.pendingSuspenseRetries = [];\n }\n clearCommitIndex(root.commitIndex);\n resetHydrationPointers(root);\n resetContextStack(root);\n if (wasHydratingCompletedBoundary) root.isHydrating = false;\n root.uncaughtErrorInfo = null;\n }\n\n function resetHydrationPointers(root: R): void {\n root.hydrationParent = null;\n root.hydratingSuspenseBoundary = null;\n root.hydratingActivityBoundary = null;\n root.nextHydratableInstance = null;\n }\n\n function deactivateHydration(root: R): void {\n root.isHydrating = false;\n resetHydrationPointers(root);\n }\n\n function performUnit(node: F): F | null {\n try {\n begin(node);\n } catch (error) {\n return handleThrownValue(node, error);\n }\n\n if ((node.flags & AdoptedFlag) === 0 && node.child !== null) {\n return node.child;\n }\n\n return completeUnit(node);\n }\n\n function handleThrownValue(node: F, error: unknown): F | null {\n const root = rootOf(node);\n if (root.hydratingActivityBoundary !== null) {\n abandonActivityHydration(root, error instanceof HydrationMismatchError);\n }\n\n if (isThenable(error)) {\n const boundary = findSuspenseBoundary(node);\n if (boundary !== null) {\n unwindContextTo(root, boundary);\n return captureSuspenseBoundary(boundary, error);\n }\n\n unwindContextTo(root, null);\n throw error;\n }\n\n if (error instanceof HydrationMismatchError) {\n unwindContextTo(root, null);\n throw error;\n }\n\n const boundary = findErrorBoundary(node);\n if (boundary !== null) {\n unwindContextTo(root, boundary);\n return captureErrorBoundary(boundary, error, node);\n }\n\n unwindContextTo(root, null);\n rootOf(node).uncaughtErrorInfo = errorInfoFor(node, error);\n throw error;\n }\n\n function completeUnit(node: F): F | null {\n let next: F | null = node;\n while (next !== null) {\n complete(next);\n if (next.sibling !== null) return next.sibling;\n next = next.return;\n }\n return null;\n }\n\n function begin(node: F): void {\n const root = rootOf(node);\n\n // Recorded before any path that can render descendants (including the\n // clone-and-descend bailout), so a capture always has a fresh watermark.\n if (node.tag === SuspenseTag || node.tag === ErrorBoundaryTag) {\n node.commitIndexCheckpoint = commitIndexCheckpoint(root.commitIndex);\n }\n\n if (canBailout(node, root)) {\n let hasChildWork = includesSomeLane(node.childLanes, root.renderLanes);\n if (!hasChildWork) {\n hasChildWork = lazilyPropagateParentContextChanges(node, root);\n }\n\n if (!hasChildWork) {\n // The whole subtree is clean: adopt the committed children without\n // cloning and skip them entirely.\n node.flags |= AdoptedFlag;\n node.child = node.alternate?.child ?? null;\n return;\n }\n\n // Descendants have work but this fiber does not: clone children and\n // descend without re-rendering, preserving child props identity.\n // Suspense always runs begin so hidden-primary retries are handled.\n if (node.tag !== SuspenseTag) {\n if (node.tag === ContextProviderTag) pushContextProvider(node, root);\n cloneChildFibers(node);\n return;\n }\n }\n\n if (node.tag === ContextProviderTag) pushContextProvider(node, root);\n\n const hasOwnWork = includesSomeLane(node.lanes, root.renderLanes);\n node.lanes &= ~root.renderLanes;\n\n if (node.tag === FunctionTag) {\n renderFunction(node, root);\n return;\n }\n\n if (node.tag === TextTag) {\n if (\n __DEV__ &&\n (node.alternate === null ||\n node.alternate.props.nodeValue !== node.props.nodeValue)\n ) {\n host.validateTextNesting?.(\n String(node.props.nodeValue),\n hostAncestorTypes(node),\n );\n }\n if (tryHydrateText(node, root)) return;\n node.stateNode ??= host.createTextInstance(String(node.props.nodeValue));\n return;\n }\n\n if (node.tag === HostTag) {\n const type = String(node.type);\n const children = hostChildren(node.props);\n\n if (__DEV__) {\n let ancestors: string[] | null = null;\n\n if (node.alternate === null && host.validateInstanceNesting) {\n ancestors = hostAncestorTypes(node);\n host.validateInstanceNesting(type, node.props, ancestors);\n }\n\n // Text that becomes Text fibers is validated by the TextTag branch.\n if (host.validateTextNesting && shouldUseHostTextContent(node, root)) {\n const textContent = hostTextContent(children);\n if (textContent !== null) {\n ancestors ??= hostAncestorTypes(node);\n ancestors.unshift(type);\n host.validateTextNesting(textContent, ancestors);\n }\n }\n }\n\n if (tryHydrateInstance(node, root)) {\n reconcileCurrentChildren(node, children, root);\n return;\n }\n\n node.stateNode ??= host.createInstance(\n type,\n node.props,\n hostParent(node),\n );\n\n reconcileCurrentChildren(\n node,\n children === null || shouldUseHostTextContent(node, root)\n ? null\n : children,\n root,\n );\n return;\n }\n\n if (node.tag === SuspenseTag) {\n beginSuspense(node, hasOwnWork);\n return;\n }\n\n if (node.tag === ErrorBoundaryTag) {\n beginErrorBoundary(node);\n return;\n }\n\n if (node.tag === ActivityTag && node.type === null) {\n beginHiddenBoundary(root, node);\n return;\n }\n\n if (node.tag === ActivityTag) {\n beginActivity(root, node);\n return;\n }\n\n if (node.tag === ViewTransitionTag) {\n beginViewTransition(node);\n return;\n }\n\n if (node.tag === PortalTag) {\n beginPortal(node);\n return;\n }\n\n reconcileCurrentChildren(node, node.props.children, root);\n }\n\n function beginViewTransition(node: F): void {\n if (__DEV__) {\n const name = (node.props as ViewTransitionProps).name;\n if (name === \"none\" || name === \"\") {\n throw new Error(\n `<ViewTransition> received the reserved name \"${name}\". ` +\n '\"none\" disables the browser feature and \"\" is not a valid ' +\n 'view-transition-name; use \"auto\" or omit the prop for a ' +\n \"generated name.\",\n );\n }\n }\n node.stateNode ??= { autoName: null };\n reconcileCurrentChildren(node, node.props.children);\n }\n\n function beginActivity(root: R, node: F): void {\n const hidden = activityHidden(node.props);\n if (hidden) hasHiddenBoundaries = true;\n\n const state = ensureFiberActivityState(node);\n\n if (\n state.dehydrated === null &&\n tryDehydrateActivityBoundary(root, node, state)\n ) {\n // Server-hidden content stays dehydrated; if the client wants it\n // visible, a follow-up render hydrates through.\n if (!hidden) scheduleFiber(node, DefaultLane);\n return;\n }\n\n if (state.dehydrated !== null) {\n if (hidden) return;\n hydrateDehydratedActivityBoundary(root, node);\n return;\n }\n\n beginHiddenBoundary(root, node);\n }\n\n function beginHiddenBoundary(root: R, node: F): void {\n const hidden = activityHidden(node.props);\n if (hidden) hasHiddenBoundaries = true;\n const hiddenState = node.hiddenState;\n const previousHidden =\n node.alternate === null\n ? false\n : activityHidden(node.alternate.memoizedProps ?? {});\n\n ensureFiberActivityState(node);\n\n if (hidden !== previousHidden) {\n node.flags |= VisibilityFlag;\n }\n if (!hidden && hiddenState?.currentFirstChild != null) {\n node.flags |= VisibilityFlag;\n }\n\n // A reveal with pending offscreen work expands the render lanes so the\n // revealed subtree commits already up to date. Offscreen work skipped by\n // earlier bailouts is re-marked pending after commit.\n if (!hidden && previousHidden) {\n // Deferred effects can live below otherwise unchanged wrapper components.\n // Mark the committed hidden subtree so reveal traversal does not adopt\n // those wrappers and skip the newly armed effects underneath them.\n markSubtreeLanes(node.alternate?.child ?? null, root.renderLanes);\n if (\n includesSomeLane(node.childLanes, OffscreenLane) &&\n !includesSomeLane(root.renderLanes, OffscreenLane)\n ) {\n root.renderLanes = mergeLanes(root.renderLanes, OffscreenLane);\n }\n }\n\n reconcile(\n node,\n node.props.children,\n hiddenState?.currentFirstChild ?? node.alternate?.child ?? null,\n hiddenState?.currentFirstChild != null && node.alternate === null,\n );\n node.hiddenState = null;\n }\n\n function prepareToHydrateRoot(root: R): void {\n if (!root.isHydrating) return;\n\n const hydrationHost = requireHydrationHostConfig();\n root.hydrationParent = root.finishedWork;\n root.nextHydratableInstance = hydrationHost.getFirstHydratableChild(\n root.container,\n );\n }\n\n function tryHydrateInstance(node: F, root: R): boolean {\n if (!shouldHydrateFiber(root, node)) return false;\n\n const hydrationHost = requireHydrationHostConfig();\n const hydratable = root.nextHydratableInstance;\n const type = String(node.type);\n\n // Falling through creates the instance out-of-band, leaving the cursor\n // for the fiber's siblings; the placement flag routes the fiber through\n // commitHoistedInstance so commit still acquires it.\n if (isHoistedFiber(node)) {\n node.flags |= PlacementFlag;\n return false;\n }\n\n if (\n hydratable === null ||\n !hydrationHost.canHydrateInstance(hydratable, type, node.props)\n ) {\n throwHydrationMismatch(root, node, `<${type}>`);\n }\n\n node.stateNode = hydratable as Instance;\n recordCommitWork(root.commitIndex, node, UpdateFlag | HydrationFlag);\n root.hydrationParent = node;\n root.nextHydratableInstance = hydrationHost.getFirstHydratableChild(\n hydratable as Instance,\n node.props,\n );\n\n return true;\n }\n\n function tryHydrateText(node: F, root: R): boolean {\n if (!shouldHydrateFiber(root, node)) return false;\n\n const hydrationHost = requireHydrationHostConfig();\n const hydratable = root.nextHydratableInstance;\n const text = String(node.props.nodeValue);\n const suppressHydrationWarning =\n (node.return?.tag === HostTag &&\n node.return.props.suppressHydrationWarning === true) ||\n canHydratePendingSuspenseTextMismatch(root);\n\n if (\n hydratable === null ||\n !hydrationHost.canHydrateTextInstance(\n hydratable,\n text,\n suppressHydrationWarning,\n )\n ) {\n throwHydrationMismatch(root, node, \"text\");\n }\n\n node.stateNode = hydratable as TextInstance;\n recordCommitWork(root.commitIndex, node, UpdateFlag);\n root.nextHydratableInstance =\n hydrationHost.getNextHydratableSibling(hydratable);\n\n return true;\n }\n\n function shouldHydrateFiber(root: R, node: F): boolean {\n return (\n root.isHydrating &&\n node.alternate === null &&\n node.stateNode === null &&\n !insideHydrationExemptHost(node)\n );\n }\n\n // A fresh host that rendered during hydration without claiming a DOM node\n // (its instance was created out-of-band) renders its subtree fresh, so\n // descendants must not consume the outer hydration cursor. The walk stops\n // at the nearest host ancestor, or at any cloned fiber: hydration only\n // occurs in fully fresh subtrees.\n function insideHydrationExemptHost(node: F): boolean {\n for (\n let parent = node.return;\n parent !== null && parent.alternate === null;\n parent = parent.return\n ) {\n if (parent.tag !== HostTag) continue;\n return hydrationBypassedHost(parent);\n }\n\n return false;\n }\n\n function completeHydration(node: F): void {\n const root = rootOf(node);\n\n if (\n node.tag === SuspenseTag &&\n (node.flags & HydrationFlag) !== 0 &&\n root.hydratingSuspenseBoundary === node\n ) {\n completeDehydratedSuspenseHydration(root, node);\n return;\n }\n\n if (\n node.tag === ActivityTag &&\n (node.flags & HydrationFlag) !== 0 &&\n root.hydratingActivityBoundary === node\n ) {\n if (root.nextHydratableInstance !== null) {\n throwHydrationMismatch(root, node, undefined, \" in Activity\");\n }\n leaveActivityHydration(root, node);\n return;\n }\n\n if (!root.isHydrating || root.hydrationParent !== node) return;\n\n if (root.nextHydratableInstance !== null) {\n throwHydrationMismatch(root, node);\n }\n\n const hydrationHost = requireHydrationHostConfig();\n root.hydrationParent = nextHydrationParent(node.return);\n root.nextHydratableInstance =\n node.tag === HostTag\n ? hydrationHost.getNextHydratableSibling(node.stateNode as Instance)\n : null;\n }\n\n function completeDehydratedSuspenseHydration(root: R, node: F): void {\n const boundary = dehydratedSuspenseBoundary(node.alternate);\n\n if (boundary === null) return;\n\n if (\n boundary.status === \"completed\" &&\n !boundary.forceClientRender &&\n root.nextHydratableInstance !== boundary.end\n ) {\n throwHydrationMismatch(\n root,\n node,\n undefined,\n \" in Suspense\",\n boundary.id ?? undefined,\n );\n }\n\n leaveSuspenseHydration(root, node, boundary);\n }\n\n function nextHydrationParent(node: F | null): F | null {\n for (let parent = node; parent !== null; parent = parent.return) {\n if (\n parent.tag === RootTag ||\n parent.tag === HostTag ||\n (parent.tag === SuspenseTag &&\n (parent.flags & HydrationFlag) !== 0 &&\n dehydratedSuspenseBoundary(parent.alternate) !== null) ||\n (parent.tag === ActivityTag &&\n (parent.flags & HydrationFlag) !== 0 &&\n fiberActivityState(parent)?.dehydrated != null)\n ) {\n return parent;\n }\n }\n\n return null;\n }\n\n function firstWithinSuspenseBoundary(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): HostNode<Instance, TextInstance> | null {\n const first = requireHydrationHostConfig().getNextHydratableSibling(\n boundary.start,\n );\n return first === boundary.end ? null : first;\n }\n\n function nextAfterSuspenseBoundary(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): HostNode<Instance, TextInstance> | null {\n return requireHydrationHostConfig().getNextHydratableSibling(boundary.end);\n }\n\n function requireHydrationHostConfig(): RequiredHydrationHostConfig<\n Container,\n Instance,\n TextInstance\n > {\n if (\n host.getFirstHydratableChild === undefined ||\n host.getNextHydratableSibling === undefined ||\n host.canHydrateInstance === undefined ||\n host.canHydrateTextInstance === undefined ||\n host.clearContainer === undefined\n ) {\n throw new Error(\"Hydration is not supported by this renderer.\");\n }\n\n return host as RequiredHydrationHostConfig<\n Container,\n Instance,\n TextInstance\n >;\n }\n\n // The message and the recoverable-error fields derive from two facts: what\n // was expected (`<div>`/\"text\"; undefined means an unexpected extra node)\n // and whether the hydration cursor was empty — the expected-node throw\n // sites all test root.nextHydratableInstance directly.\n function throwHydrationMismatch(\n root: R,\n node: F,\n expected?: string,\n where = \"\",\n boundaryId?: string,\n ): never {\n const nothing = root.nextHydratableInstance === null;\n const message =\n expected === undefined\n ? `found an extra DOM node${where}`\n : nothing\n ? `expected ${expected}, but found no DOM node`\n : `expected ${expected}`;\n const error = new Error(`Hydration mismatch: ${message}.`);\n queueRecoverableError(root, node, error, {\n actual:\n expected === undefined\n ? \"extra DOM node\"\n : nothing\n ? \"nothing\"\n : \"different DOM node\",\n boundaryId,\n expected,\n recovery: \"root\",\n source: \"hydration\",\n });\n throw new HydrationMismatchError(error.message);\n }\n\n function canBailout(node: F, root: R): boolean {\n return (\n node.alternate !== null &&\n (node.flags & PlacementFlag) === 0 &&\n node.props === node.alternate.memoizedProps &&\n !includesSomeLane(node.lanes, root.renderLanes) &&\n !contextDependenciesChanged(node, root)\n );\n }\n\n function contextDependenciesChanged(node: F, root: R): boolean {\n const dependencies = node.contextDependencies;\n if (dependencies === null) return false;\n\n for (const dependency of dependencies) {\n if (\n !Object.is(\n currentContextValue(root, dependency.context),\n dependency.memoizedValue,\n )\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n function currentContextValue(root: R, context: FigContext<unknown>): unknown {\n return root.contextValues.has(context)\n ? root.contextValues.get(context)\n : context.defaultValue;\n }\n\n function shouldUseHostTextContent(node: F, root = rootOf(node)): boolean {\n return (\n host.setTextContent !== undefined &&\n // A host created out-of-band during hydration (hoisted instance)\n // renders fresh: its text must replace any server content wholesale\n // rather than match against it.\n (!root.isHydrating || hydrationBypassedHost(node)) &&\n // Hydration adopted the text as a child fiber (it had to match the\n // server's text node); keep that shape on re-renders. Collapsing to\n // textContent would delete the adopted fiber and rewrite identical\n // text — flag noise that reads as a real mutation (and made view\n // transitions animate the first post-hydration commit).\n !adoptedSingleTextChild(node) &&\n hostTextContent(node.props.children) !== null\n );\n }\n\n function adoptedSingleTextChild(node: F): boolean {\n const child = node.alternate?.child ?? node.child;\n return child !== null && child.tag === TextTag && child.sibling === null;\n }\n\n function hydrationBypassedHost(node: F): boolean {\n return (\n node.alternate === null &&\n node.stateNode !== null &&\n (node.flags & HydrationFlag) === 0\n );\n }\n\n function isHoistedFiber(node: F): boolean {\n if (node.tag !== HostTag || host.isHoistedInstance === undefined) {\n return false;\n }\n if ((node.flags & NotHoistedFlag) !== 0) return false;\n if (!host.isHoistedInstance(String(node.type), node.props)) {\n node.flags |= NotHoistedFlag;\n return false;\n }\n requireHoistedAssetHostConfig();\n return true;\n }\n\n function requireHoistedAssetHostConfig(): RequiredHoistedAssetHostConfig {\n if (hoistedAssetHostConfig !== null) return hoistedAssetHostConfig;\n\n if (\n host.isHoistedInstance === undefined ||\n host.commitHoistedInstance === undefined ||\n host.removeHoistedInstance === undefined ||\n host.updateHoistedInstance === undefined\n ) {\n throw new Error(\"Hoisted assets are not supported by this renderer.\");\n }\n\n hoistedAssetHostConfig = host as RequiredHoistedAssetHostConfig;\n return hoistedAssetHostConfig;\n }\n\n function renderFunction(node: F, root: R): void {\n // Hot reload: run the latest version of this component's family. In\n // production the whole block strips out.\n if (__DEV__) {\n if (hasRefreshHandler()) {\n node.type = resolveLatestType(node.type) as F[\"type\"];\n }\n }\n prepareHookRender(node, root);\n\n const previousDispatcher = setCurrentDispatcher(dispatcher);\n const previousDataStore = setCurrentDataStore(root.dataStore);\n try {\n if (__DEV__) {\n // Strict shadow pass: invoke the component once and discard every\n // trace so impure renders surface in development. Skipping\n // reconciliation keeps the pass free of child and deletion effects.\n const consumedBefore = root.consumedPendingQueues.length;\n (node.type as Component)(node.props);\n if (currentHook !== null) throw hookOrderError(\"fewer\");\n restoreConsumedPendingQueues(root, consumedBefore);\n prepareHookRender(node, root);\n node.effects = null;\n }\n reconcileCurrentChildren(\n node,\n (node.type as Component)(node.props),\n root,\n );\n if (currentHook !== null) throw hookOrderError(\"fewer\");\n } finally {\n setCurrentDataStore(previousDataStore);\n setCurrentDispatcher(previousDispatcher);\n renderingFiber = null;\n currentHook = null;\n workInProgressHook = null;\n localIdCounter = 0;\n }\n }\n\n function prepareHookRender(node: F, root: R): void {\n renderingFiber = node;\n currentHook = node.alternate?.memoizedState ?? null;\n workInProgressHook = null;\n localIdCounter = 0;\n node.memoizedState = null;\n node.contextDependencies = null;\n root.dataStore.resetDataDependencies(node);\n node.dataDependenciesDirty = true;\n recordCommitWork(root.commitIndex, node);\n }\n\n function beginSuspense(node: F, hasOwnWork: boolean): void {\n const root = rootOf(node);\n const previousSuspenseState = fiberSuspenseState(node.alternate);\n\n node.boundaryState = null;\n\n if (previousSuspenseState?.kind === \"dehydrated\") {\n if (!hasOwnWork) {\n node.boundaryState = previousSuspenseState;\n return;\n }\n hydrateDehydratedSuspenseBoundary(node, previousSuspenseState.boundary);\n return;\n }\n\n if (tryDehydrateSuspenseBoundary(node)) return;\n\n node.suspenseQueueStart = root.consumedPendingQueues.length;\n\n if (previousSuspenseState === null) {\n beginSuspensePrimary(node, suspensePrimaryFiber(node.alternate));\n return;\n }\n\n const currentPrimary = suspensePrimaryFiber(node.alternate);\n if (currentPrimary !== null) {\n // Reveal of a re-suspended boundary: the committed primary was kept hidden\n // and its lanes were cleared (so blocked offscreen work could not busy-loop\n // the scheduler while suspended). Updates dispatched during the fallback\n // were parked in their hook queues. Mark the kept-hidden subtree with the\n // current render lanes so it re-renders instead of bailing out and adopting\n // the frozen clone — that re-render is what applies the parked updates.\n markSubtreeLanes(currentPrimary.child, root.renderLanes);\n }\n beginSuspensePrimary(\n node,\n currentPrimary,\n previousSuspenseState.primaryChild,\n );\n appendDeletions(node, suspenseFallbackFiber(node.alternate));\n }\n\n function markSubtreeLanes(node: F | null, lanes: Lanes): void {\n for (let child = node; child !== null; child = child.sibling) {\n child.lanes = mergeLanes(child.lanes, lanes);\n child.childLanes = mergeLanes(child.childLanes, lanes);\n markSubtreeLanes(child.child, lanes);\n }\n }\n\n function beginSuspensePrimary(\n boundary: F,\n currentPrimary: F | null,\n capturedPrimary: F | null = null,\n ): void {\n if (capturedPrimary !== null) hasHiddenBoundaries = true;\n const primary = suspensePrimaryWorkInProgress(\n boundary,\n currentPrimary,\n \"visible\",\n capturedPrimary,\n );\n boundary.child = primary;\n }\n\n function suspensePrimaryWorkInProgress(\n boundary: F,\n currentPrimary: F | null,\n mode: \"visible\" | \"hidden\",\n capturedPrimary: F | null = null,\n ): F {\n const props: Props = { mode, children: boundary.props.children };\n\n const primary =\n currentPrimary === null\n ? fiber(ActivityTag, null, null, props, null)\n : createWorkInProgress(currentPrimary, props);\n\n primary.hiddenState = {\n currentFirstChild: capturedPrimary,\n };\n primary.index = 0;\n primary.return = boundary;\n primary.sibling = null;\n return primary;\n }\n\n function suspenseFallbackWorkInProgress(\n boundary: F,\n currentFallback: F | null,\n index: number,\n ): F {\n const props: Props = { children: boundary.props.fallback };\n const fallback =\n currentFallback?.tag === FragmentTag\n ? createWorkInProgress(currentFallback, props)\n : fiber(FragmentTag, null, null, props, null);\n\n fallback.index = index;\n fallback.return = boundary;\n fallback.sibling = null;\n if (currentFallback === null) fallback.flags |= PlacementFlag;\n return fallback;\n }\n\n function suspensePrimaryFiber(node: F | null | undefined): F | null {\n const child = node?.child ?? null;\n return child?.tag === ActivityTag && child.type === null ? child : null;\n }\n\n function suspenseFallbackFiber(node: F | null | undefined): F | null {\n const primary = suspensePrimaryFiber(node);\n return primary === null ? (node?.child ?? null) : primary.sibling;\n }\n\n function cloneSuspendedPrimary(node: F | null, parent: F): F | null {\n let first: F | null = null;\n let previous: F | null = null;\n\n for (let current = node; current !== null; current = current.sibling) {\n const clone = createWorkInProgress(current, current.props);\n clone.return = parent;\n clone.child = cloneSuspendedPrimary(current.child, clone);\n clone.sibling = null;\n // The cloned primary is committed hidden while the boundary stays\n // suspended; it has no schedulable work. Any pending update inside it is\n // parked in its hook queue (restored as NoLane) and applied when the\n // suspense ping retries the reveal — clearing the lanes here keeps a\n // downgraded (OffscreenLane) update from busy-looping the scheduler via\n // the post-commit \"let idle retries proceed\" re-mark.\n clone.lanes = NoLanes;\n clone.childLanes = NoLanes;\n if (previous === null) first = clone;\n else previous.sibling = clone;\n previous = clone;\n }\n\n return first;\n }\n\n function tryDehydrateSuspenseBoundary(node: F): boolean {\n const root = rootOf(node);\n if (!shouldHydrateFiber(root, node)) return false;\n if (host.getSuspenseBoundary === undefined) return false;\n\n const hydratable = root.nextHydratableInstance;\n if (hydratable === null) return false;\n\n const boundary = host.getSuspenseBoundary(hydratable);\n if (boundary === null) return false;\n\n node.boundaryState = {\n boundary,\n kind: \"dehydrated\",\n wasPending: boundary.status === \"pending\",\n };\n host.registerSuspenseBoundaryRetry?.(boundary, () =>\n scheduleFiber(node, DefaultLane),\n );\n root.nextHydratableInstance = nextAfterSuspenseBoundary(boundary);\n return true;\n }\n\n function hydrateDehydratedSuspenseBoundary(\n node: F,\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void {\n abandonedHydrationBoundaries.delete(node);\n if (node.alternate !== null) {\n abandonedHydrationBoundaries.delete(node.alternate);\n }\n\n if (!boundary.forceClientRender) {\n if (boundary.status === \"completed\") {\n enterSuspenseHydration(node, boundary);\n node.boundaryState = null;\n node.flags |= HydrationFlag;\n beginSuspensePrimary(node, suspensePrimaryFiber(node.alternate));\n return;\n }\n\n if (boundary.status === \"pending\") {\n node.boundaryState = {\n boundary,\n kind: \"dehydrated\",\n wasPending: true,\n };\n return;\n }\n }\n\n if (boundary.status === \"client-rendered\") {\n queueClientRenderedSuspenseError(rootOf(node), node, boundary);\n }\n\n node.boundaryState = null;\n node.flags |= HydrationFlag;\n beginSuspensePrimary(node, suspensePrimaryFiber(node.alternate));\n }\n\n function queueClientRenderedSuspenseError(\n root: R,\n node: F,\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void {\n const boundaryError = boundary.error;\n const error = new Error(\n boundaryError?.message ??\n \"The server could not finish this Suspense boundary. Switched to client rendering.\",\n );\n if (boundaryError?.digest !== undefined) {\n (error as Error & { digest?: string }).digest = boundaryError.digest;\n }\n queueRecoverableError(root, node, error, {\n boundaryId: boundary.id ?? undefined,\n digest: boundaryError?.digest,\n recovery: \"suspense\",\n source: \"server\",\n });\n }\n\n function canHydratePendingSuspenseTextMismatch(root: R): boolean {\n const boundary = root.hydratingSuspenseBoundary;\n const state = fiberSuspenseState(boundary?.alternate);\n return state?.kind === \"dehydrated\" && state.wasPending;\n }\n\n function requireActivityHydrationHostConfig(): ActivityHydrationHostConfig {\n if (activityHydrationHostConfig !== null)\n return activityHydrationHostConfig;\n\n if (\n host.getActivityBoundary === undefined ||\n host.getFirstActivityHydratable === undefined ||\n host.commitHydratedActivityBoundary === undefined\n ) {\n throw new Error(\n \"Activity hydration requires getActivityBoundary, getFirstActivityHydratable, and commitHydratedActivityBoundary.\",\n );\n }\n\n activityHydrationHostConfig = host as ActivityHydrationHostConfig;\n return activityHydrationHostConfig;\n }\n\n function tryDehydrateActivityBoundary(\n root: R,\n node: F,\n state: ActivityState<Instance>,\n ): boolean {\n if (!shouldHydrateFiber(root, node)) return false;\n if (host.getActivityBoundary === undefined) return false;\n\n const hydratable = root.nextHydratableInstance;\n if (hydratable === null) return false;\n\n const boundary = host.getActivityBoundary(hydratable);\n if (boundary === null) return false;\n\n // A detected boundary commits the host to the full lifecycle; partial\n // configs fail loudly here instead of silently never revealing content.\n requireActivityHydrationHostConfig();\n\n hasHiddenBoundaries = true;\n state.dehydrated = boundary;\n root.nextHydratableInstance =\n requireHydrationHostConfig().getNextHydratableSibling(boundary);\n return true;\n }\n\n function hydrateDehydratedActivityBoundary(root: R, node: F): void {\n enterActivityHydration(root, node);\n node.flags |= HydrationFlag | VisibilityFlag;\n reconcile(node, node.props.children, null, false);\n }\n\n function enterActivityHydration(root: R, node: F): void {\n const boundary = dehydratedActivityBoundary(node);\n if (boundary === null) {\n throw new Error(\"Expected a dehydrated Activity boundary.\");\n }\n\n root.isHydrating = true;\n root.hydrationParent = node;\n root.hydratingActivityBoundary = node;\n root.nextHydratableInstance =\n requireActivityHydrationHostConfig().getFirstActivityHydratable(boundary);\n }\n\n function leaveActivityHydration(root: R, node: F): void {\n root.hydrationParent = nextHydrationParent(node.return);\n root.nextHydratableInstance = null;\n root.hydratingActivityBoundary = null;\n root.isHydrating = false;\n }\n\n // Any throw while hydrating a dehydrated Activity abandons the attempt. For\n // mismatches, clear the dehydrated template before root recovery so the\n // forced client render cannot recurse into the same failed hydration.\n function abandonActivityHydration(root: R, forceClientRender = false): void {\n if (forceClientRender) {\n const state = fiberActivityState(root.hydratingActivityBoundary);\n if (state !== null) state.dehydrated = null;\n }\n deactivateHydration(root);\n }\n\n function enterSuspenseHydration(\n node: F,\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void {\n const root = rootOf(node);\n root.isHydrating = true;\n root.hydrationParent = node;\n root.hydratingSuspenseBoundary = node;\n root.nextHydratableInstance = firstWithinSuspenseBoundary(boundary);\n }\n\n function leaveSuspenseHydration(\n root: R,\n node: F,\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): void {\n root.hydrationParent = nextHydrationParent(node.return);\n root.nextHydratableInstance = nextAfterSuspenseBoundary(boundary);\n root.hydratingSuspenseBoundary = null;\n root.isHydrating = false;\n }\n\n function beginErrorBoundary(node: F): void {\n const previousErrorState = fiberErrorBoundaryState(node.alternate);\n\n node.boundaryState = previousErrorState;\n\n reconcileCurrentChildren(\n node,\n previousErrorState === null\n ? node.props.children\n : errorBoundaryFallback(node, previousErrorState),\n );\n }\n\n // A bare function is never a valid FigNode, so a function fallback is\n // unambiguously the render-with-error shape.\n function errorBoundaryFallback(node: F, state: ErrorBoundaryState): FigNode {\n const fallback = node.props.fallback as\n | FigNode\n | ((error: unknown, info: ErrorInfo) => FigNode)\n | undefined;\n return typeof fallback === \"function\"\n ? fallback(state.error, state.info)\n : fallback;\n }\n\n function beginPortal(node: F): void {\n reconcileCurrentChildren(node, node.props.children as FigNode);\n }\n\n function updateStateHook<S>(\n initialState: S | (() => S),\n ): [S, StateSetter<S>] {\n const hook = updateQueuedHook(StateHook, initialState);\n const queue = hook.queue;\n const fiber = requireRenderingFiber();\n\n // The queue object persists across renders, so the dispatch created on\n // mount is always present afterwards.\n queue.dispatch ??= (action: StateUpdate<S>) => {\n if (renderingFiber !== null) {\n throw new Error(\n \"State updates are not allowed while rendering a component.\",\n );\n }\n\n scheduleHookUpdate(fiber, queue, action, requestUpdateLane());\n };\n\n return [hook.memoizedState, queue.dispatch];\n }\n\n function updateActionStateHook<S, Args extends unknown[]>(\n action: ActionStateAction<S, Args>,\n initialState: S,\n ): [S, ActionStateRunner<Args>, boolean] {\n const hook: Hook<ActionState<S, Args>> = updateQueuedHook(\n ActionStateHook,\n () => createActionState(action, initialState),\n );\n const queue = hook.queue;\n const fiber = requireRenderingFiber();\n const instance = hook.memoizedState.instance;\n const nextState = { ...hook.memoizedState, action };\n hook.memoizedState = nextState;\n if (hook.baseQueue === null) {\n hook.baseState = nextState;\n } else {\n hook.baseState = { ...hook.baseState, action };\n }\n\n if (queue.dispatch === null) {\n const updatePending = (delta: 1 | -1, lane: Lane) => {\n scheduleHookUpdate(\n fiber,\n queue,\n (state) => ({\n ...state,\n pending: Math.max(0, state.pending + delta),\n }),\n lane,\n );\n };\n const finish = (lane: Lane, error: unknown, ...value: [] | [S]) => {\n scheduleHookUpdate(\n fiber,\n queue,\n (state) => ({\n ...state,\n error,\n pending: Math.max(0, state.pending - 1),\n value: value.length === 0 ? state.value : value[0],\n }),\n lane,\n );\n };\n\n queue.dispatch = ((...args: Args) => {\n if (renderingFiber !== null) {\n throw new Error(\n \"Action state updates are not allowed during render.\",\n );\n }\n\n // Last-run-wins: a new run aborts and retires the previous one,\n // releasing its pending slot now (on DefaultLane — the retired run's\n // held transition lane may never render). A retired run's settlement\n // — value or rejection — never touches state, error, or pending.\n runLatest(\n instance,\n fiber,\n (signal) => instance.action(instance.value, ...args, signal),\n updatePending,\n (lane, value, failed) => {\n if (failed) finish(lane, value);\n else finish(lane, NoActionStateError, value as S);\n },\n );\n }) as unknown as StateSetter<ActionState<S, Args>>;\n }\n\n if (hook.memoizedState.error !== NoActionStateError) {\n throw hook.memoizedState.error;\n }\n\n return [\n hook.memoizedState.value,\n queue.dispatch as unknown as ActionStateRunner<Args>,\n hook.memoizedState.pending > 0,\n ];\n }\n\n function updateIdHook(): string {\n const fiber = requireRenderingFiber();\n const oldHook = updateHook(IdHook) as Hook<string> | null;\n const id =\n oldHook === null\n ? createFiberId(rootOf(fiber), fiber, localIdCounter)\n : oldHook.memoizedState;\n localIdCounter += 1;\n\n appendHook(createHook(IdHook, id));\n return id;\n }\n\n function updateMemoHook<T>(calculate: () => T, deps: DependencyList): T {\n requireRenderingFiber();\n const previous = (updateHook(MemoHook) as Hook<MemoState<T>> | null)\n ?.memoizedState;\n const state =\n previous !== undefined && areHookInputsEqual(deps, previous.deps)\n ? previous\n : { deps, value: calculate() };\n\n appendHook(createHook(MemoHook, state));\n return state.value;\n }\n\n function updateDeferredValueHook<T>(\n value: T,\n initialValue: T | undefined,\n hasInitialValue: boolean,\n ): T {\n const fiber = requireRenderingFiber();\n const oldHook = updateHook(DeferredValueHook) as Hook<T> | null;\n let next =\n oldHook === null\n ? initialDeferredValue(value, initialValue, hasInitialValue)\n : oldHook.memoizedState;\n\n if (!Object.is(next, value)) {\n if (isTransitionOrDeferredRender(rootOf(fiber))) {\n next = value;\n } else {\n scheduleFiber(fiber, DeferredLane);\n }\n }\n\n appendHook(createHook(DeferredValueHook, next));\n return next;\n }\n\n function initialDeferredValue<T>(\n value: T,\n initialValue: T | undefined,\n hasInitialValue: boolean,\n ): T {\n return hasInitialValue ? (initialValue as T) : value;\n }\n\n function isTransitionOrDeferredRender(root: R): boolean {\n return (\n includesOnlyTransitions(root.renderLanes) ||\n includesSomeLane(root.renderLanes, DeferredLane)\n );\n }\n\n function updateTransitionHook(): [boolean, StartTransition] {\n const initialState: TransitionState = {\n instance: { controller: null, generation: 0 },\n pendingCount: 0,\n start: null,\n };\n const hook: Hook<TransitionState> = updateQueuedHook(\n TransitionHook,\n initialState,\n );\n const queue = hook.queue;\n\n if (hook.memoizedState.start === null) {\n const fiber = requireRenderingFiber();\n const updatePending = (delta: 1 | -1, lane: Lane) => {\n scheduleHookUpdate(\n fiber,\n queue,\n (state) => ({\n ...state,\n pendingCount: Math.max(0, state.pendingCount + delta),\n }),\n lane,\n );\n };\n\n const instance = hook.memoizedState.instance;\n hook.memoizedState.start = (\n callback: (signal: AbortSignal) => void | PromiseLike<void>,\n ) => {\n if (renderingFiber !== null) {\n throw new Error(\n \"Transitions cannot be started while rendering a component.\",\n );\n }\n\n // One cancellation domain per hook: a new start aborts and retires\n // the previous pending run, releasing its pending slot now so an\n // ignored signal or hung promise can never pin isPending. The\n // decrement goes to DefaultLane — the retired run's own transition\n // lane is held until its callback settles (possibly never), and a\n // cancelled run has nothing to commit atomically with.\n runLatest(\n instance,\n fiber,\n callback,\n updatePending,\n (lane, value, failed, asynchronous) => {\n updatePending(-1, lane);\n if (failed) {\n if (!asynchronous) throw value;\n queueMicrotask(() => {\n throw value;\n });\n }\n },\n );\n };\n }\n\n // Assigned above when null; queued updates spread the previous state, so\n // the starter is always carried forward.\n return [\n hook.memoizedState.pendingCount > 0,\n hook.memoizedState.start as StartTransition,\n ];\n }\n\n // A transition and an action are the same cancellable effect up to how\n // their result is folded into state. This owns the shared protocol: one\n // scope, one generation token, and settlements from only the latest run.\n function runLatest<T>(\n instance: RunInstance,\n fiber: F,\n run: (signal: AbortSignal) => T | PromiseLike<T>,\n updatePending: (delta: 1 | -1, lane: Lane) => void,\n settled: (\n lane: Lane,\n value: unknown,\n failed: boolean,\n asynchronous: boolean,\n ) => void,\n ): void {\n if (retireRun(instance)) updatePending(-1, DefaultLane);\n const lane = claimNextTransitionLane();\n const controller = new AbortController();\n const generation = (instance.generation += 1);\n instance.controller = controller;\n updatePending(1, SyncLane);\n\n const settle = (\n value: unknown,\n failed: boolean,\n asynchronous: boolean,\n ): void => {\n if (generation !== instance.generation) return;\n instance.controller = null;\n settled(lane, value, failed, asynchronous);\n };\n\n // A run started after the owner unmounted (deletion severs the fiber's\n // root path) still executes for its side effects, just without an\n // ambient data store; its settlements schedule into the void.\n const store = rootOfOrNull(fiber)?.dataStore;\n let result: T | PromiseLike<T>;\n try {\n const invoke = () =>\n runWithTransitionLane(lane, () => run(controller.signal));\n result = store === undefined ? invoke() : store.run(invoke);\n } catch (error) {\n settle(error, true, false);\n return;\n }\n\n if (!isThenable(result)) {\n settle(result, false, false);\n return;\n }\n\n result.then(\n (value) => settle(value, false, true),\n (error: unknown) => settle(error, true, true),\n );\n }\n\n function requireRenderingFiber(): F {\n if (renderingFiber === null) {\n throw new Error(\"Hooks can only be called while rendering a component.\");\n }\n\n return renderingFiber;\n }\n\n function updateQueuedHook<S>(\n kind: QueuedHookKind,\n initialState: S | (() => S),\n ): Hook<S> {\n const fiber = requireRenderingFiber();\n const oldHook = updateHook(kind) as Hook<S> | null;\n const hook: Hook<S> =\n oldHook === null\n ? createHook(kind, resolveInitialState(initialState))\n : { ...oldHook, next: null };\n\n appendHook(hook);\n\n const root = rootOf(fiber);\n const pending = hook.queue.pending;\n if (pending !== null) {\n hook.baseQueue = consumePendingHookQueue(root, hook, pending);\n }\n\n if (hook.baseQueue !== null) {\n processHookQueue(hook, root.renderLanes);\n }\n\n return hook;\n }\n\n function updateExternalStoreHook<T>(\n subscribe: ExternalStoreSubscribe,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n const fiber = requireRenderingFiber();\n const oldHook = updateHook(ExternalStoreHook) as Hook<\n ExternalStoreState<T, F>\n > | null;\n const root = rootOf(fiber);\n const value = readExternalStoreSnapshot(\n root,\n getSnapshot,\n getServerSnapshot,\n );\n const instance = oldHook?.memoizedState.instance ?? {\n committedSubscribe: null,\n getSnapshot,\n owner: null,\n unsubscribe: null,\n value,\n };\n const state: ExternalStoreState<T, F> = {\n getSnapshot,\n instance,\n subscribe,\n value,\n };\n\n recordCommitWork(root.commitIndex, fiber, StoreConsistencyFlag);\n appendHook(createHook(ExternalStoreHook, state));\n return value;\n }\n\n function updateStableEventHook<Args extends unknown[], Result>(\n handler: (...args: Args) => Result,\n ): (...args: StableEventArgs<Args>) => Result {\n requireRenderingFiber();\n const oldHook = updateHook(\n StableEventHook,\n ) as Hook<StableEventState> | null;\n const instance =\n oldHook?.memoizedState.instance ?? createStableEventInstance();\n\n appendHook(\n createHook(StableEventHook, {\n instance,\n next: handler as StableEventHandler,\n }),\n );\n return instance.stable as (...args: StableEventArgs<Args>) => Result;\n }\n\n function createStableEventInstance(): StableEventInstance {\n const instance: StableEventInstance = {\n controller: null,\n handler: null,\n live: false,\n stable: (...args) => {\n if (renderingFiber !== null) {\n throw new Error(\n \"Stable events cannot be called while rendering a component.\",\n );\n }\n\n const handler = instance.handler;\n if (handler === null) {\n throw new Error(\n \"Stable events cannot be called before their first commit.\",\n );\n }\n\n instance.controller?.abort();\n instance.controller = new AbortController();\n if (!instance.live) instance.controller.abort();\n return handler(...args, instance.controller.signal);\n },\n };\n\n return instance;\n }\n\n function readExternalStoreSnapshot<T>(\n root: R,\n getSnapshot: () => T,\n getServerSnapshot?: () => T,\n ): T {\n if (!root.isHydrating) return getSnapshot();\n\n if (getServerSnapshot === undefined) {\n throw new Error(\n \"useSyncExternalStore requires getServerSnapshot during hydration.\",\n );\n }\n\n return getServerSnapshot();\n }\n\n function processHookQueue<S>(hook: Hook<S>, renderLanes: Lanes): void {\n const baseQueue = hook.baseQueue;\n if (baseQueue === null) return;\n\n let state = hook.baseState;\n let newBaseState = state;\n let newBaseQueue: HookUpdate<S> | null = null;\n let update = baseQueue.next;\n\n do {\n if (\n update.lane !== NoLane &&\n !includesSomeLane(renderLanes, update.lane)\n ) {\n const cloneUpdate = cloneUpdateNode(update);\n // Pin the rebase point at the FIRST skipped update (mergeQueues\n // returns the appended tail, so comparing against cloneUpdate would\n // re-snapshot on every skip and lose earlier skipped reductions).\n if (newBaseQueue === null) newBaseState = state;\n newBaseQueue = mergeQueues(newBaseQueue, cloneUpdate);\n } else {\n state =\n typeof update.action === \"function\"\n ? (update.action as (previousState: S) => S)(state)\n : update.action;\n\n if (newBaseQueue !== null) {\n const cloneUpdate = cloneUpdateNode(update);\n cloneUpdate.lane = NoLane;\n newBaseQueue = mergeQueues(newBaseQueue, cloneUpdate);\n }\n }\n update = update.next;\n } while (update !== baseQueue.next);\n\n hook.memoizedState = state;\n hook.baseState = newBaseQueue === null ? state : newBaseState;\n hook.baseQueue = newBaseQueue;\n }\n\n function scheduleHookUpdate<S>(\n fiber: F,\n queue: HookQueue<S>,\n action: StateUpdate<S>,\n lane: Lane,\n ): void {\n if (__DEV__ && currentCommitEffectPhase === BeforeLayoutEffect) {\n throw new Error(\n \"State updates are not allowed from useBeforeLayout effects.\",\n );\n }\n\n lane = hiddenSubtreeLane(fiber, lane);\n const update: HookUpdate<S> = { action, lane, next: null as never };\n update.next = update;\n queue.pending = mergeQueues(queue.pending, update);\n scheduleFiber(fiber, lane);\n }\n\n // Updates inside hidden boundaries are downgraded to the\n // offscreen lane at schedule time, so normal renders never descend for\n // hidden work and idle renders prerender it. A boundary mid-transition\n // (generations disagree) is treated as visible so updates are never\n // wrongly deferred.\n function hiddenSubtreeLane(node: F, lane: Lane): Lane {\n if (!hasHiddenBoundaries || lane === OffscreenLane) return lane;\n\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (\n isHiddenBoundaryTag(parent) &&\n fiberActivityState(parent)?.hidden === true\n ) {\n return OffscreenLane;\n }\n }\n\n return lane;\n }\n\n function createFiberId(root: R, fiber: F, localId: number): string {\n return `${root.identifierPrefix}fig-${fiberPath(fiber)}-${localId.toString(32)}`;\n }\n\n function fiberPath(fiber: F): string {\n const parts: string[] = [];\n\n for (\n let node: F | null = fiber;\n node !== null && node.tag !== RootTag;\n node = node.return\n ) {\n parts.push(node.index.toString(32));\n }\n\n return parts.reverse().join(\"-\");\n }\n\n function consumePendingHookQueue<S>(\n root: R,\n hook: Hook<S>,\n pending: HookUpdate<S>,\n ): HookUpdate<S> | null {\n const queue = hook.queue;\n queue.pending = null;\n root.consumedPendingQueues.push({\n queue: queue as HookQueue<unknown>,\n pending: pending as HookUpdate<unknown>,\n });\n return mergeQueues(cloneQueue(hook.baseQueue), cloneQueueNodes(pending));\n }\n\n function appendHook(hook: Hook): void {\n if (renderingFiber === null) return;\n\n if (workInProgressHook === null) {\n renderingFiber.memoizedState = hook;\n } else {\n workInProgressHook.next = hook;\n }\n\n workInProgressHook = hook;\n }\n\n function updateEffectHook(\n phase: EffectPhase,\n create: EffectCallback,\n deps?: DependencyList,\n ): void {\n const fiber = requireRenderingFiber();\n const oldHook = updateHook(phase) as Hook<Effect> | null;\n const nextDeps = deps ?? null;\n const previousEffect = oldHook?.memoizedState ?? null;\n const hasChanged =\n previousEffect === null ||\n previousEffect.controller === null ||\n previousEffect.controller.signal.aborted ||\n !areHookInputsEqual(nextDeps, previousEffect.deps);\n const effect: Effect = {\n phase,\n create,\n controller: previousEffect?.controller ?? null,\n deps: nextDeps,\n owner: fiber as Fiber<unknown, unknown, unknown>,\n strictRan: __DEV__ && previousEffect?.strictRan === true,\n };\n const hook = createHook(phase, effect);\n\n appendHook(hook);\n\n if (hasChanged) {\n fiber.effects ??= [];\n fiber.effects.push(effect);\n const root = rootOf(fiber);\n recordCommitWork(root.commitIndex, fiber, EffectFlag);\n markCommitEffectPhase(root, phase);\n }\n }\n\n function readContextValue<T>(context: FigContext<T>): T {\n if (renderingFiber === null) {\n throw new Error(\n \"readContext can only be called while rendering a component.\",\n );\n }\n\n const root = rootOf(renderingFiber);\n const contextKey = context as FigContext<unknown>;\n const value = currentContextValue(root, contextKey);\n\n addContextDependency(renderingFiber, contextKey, value);\n return value as T;\n }\n\n function pushContextProvider(node: F, root = rootOf(node)): void {\n const context = node.type as unknown as FigContext<unknown>;\n const values = root.contextValues;\n const hadPrevious = values.has(context);\n const previous = values.get(context);\n values.set(context, node.props.value);\n root.contextStack.push({ context, hadPrevious, previous, provider: node });\n }\n\n function popContextProvider(node: F): void {\n const root = rootOf(node);\n const entry = root.contextStack.pop();\n if (entry === undefined || entry.provider !== node) {\n resetContextStack(root);\n return;\n }\n restoreContextEntry(root, entry);\n }\n\n function unwindContextTo(root: R, node: F | null): void {\n while (root.contextStack.length > 0) {\n const entry = root.contextStack[root.contextStack.length - 1];\n if (node !== null && isAncestorOf(entry.provider, node)) return;\n restoreContextEntry(\n root,\n root.contextStack.pop() as ContextStackEntry<\n Container,\n Instance,\n TextInstance\n >,\n );\n }\n }\n\n function restoreContextEntry(\n root: R,\n entry: ContextStackEntry<Container, Instance, TextInstance>,\n ): void {\n if (entry.hadPrevious) {\n root.contextValues.set(entry.context, entry.previous);\n } else {\n root.contextValues.delete(entry.context);\n }\n }\n\n function resetContextStack(root: R): void {\n root.contextValues = new Map();\n root.contextStack = [];\n }\n\n function isAncestorOf(ancestor: F, node: F): boolean {\n for (let parent: F | null = node; parent !== null; parent = parent.return) {\n if (parent === ancestor) return true;\n }\n return false;\n }\n\n function addContextDependency(\n node: F,\n context: FigContext<unknown>,\n memoizedValue: unknown,\n ): void {\n node.contextDependencies ??= [];\n const dependency = contextDependency(node, context);\n\n if (dependency === null) {\n node.contextDependencies.push({ context, memoizedValue });\n } else {\n dependency.memoizedValue = memoizedValue;\n }\n }\n\n function contextDependency(\n node: F,\n context: FigContext<unknown>,\n ): ContextDependency | null {\n return (\n node.contextDependencies?.find(\n (dependency) => dependency.context === context,\n ) ?? null\n );\n }\n\n function appendContextDependencies(\n list: FigContext<unknown>[] | null,\n dependencies: ContextDependency[] | null,\n ): FigContext<unknown>[] | null {\n if (dependencies === null) return list;\n\n let next = list;\n for (const dependency of dependencies) {\n next = appendContext(next, dependency.context);\n }\n return next;\n }\n\n function appendContextList(\n list: FigContext<unknown>[] | null,\n contexts: FigContext<unknown>[] | null,\n ): FigContext<unknown>[] | null {\n if (contexts === null) return list;\n\n let next = list;\n for (const context of contexts) next = appendContext(next, context);\n return next;\n }\n\n function appendContext(\n list: FigContext<unknown>[] | null,\n context: FigContext<unknown>,\n ): FigContext<unknown>[] {\n if (list === null) return [context];\n if (!list.includes(context)) list.push(context);\n return list;\n }\n\n function contextListIncludes(\n list: FigContext<unknown>[] | null,\n context: FigContext<unknown>,\n ): boolean {\n return list?.includes(context) === true;\n }\n\n function updateHook(kind: HookKind): Hook | null {\n const hook = currentHook;\n\n if (hook === null) {\n if (didRenderBefore(renderingFiber)) throw hookOrderError(\"more\");\n return null;\n }\n\n if (hook.kind !== kind) {\n throw new Error(\n `Hook order changed: expected ${hookKindName(hook.kind)}, ` +\n `received ${hookKindName(kind)}.`,\n );\n }\n\n currentHook = hook.next;\n return hook;\n }\n\n function didRenderBefore(node: F | null): boolean {\n const previous = node?.alternate ?? null;\n return previous !== null && previous.memoizedProps !== null;\n }\n\n function hookOrderError(direction: \"fewer\" | \"more\"): Error {\n return new Error(\n `Rendered ${direction} hooks than during the previous render.`,\n );\n }\n\n function complete(node: F): void {\n completeHydration(node);\n\n let child = node.child;\n let childLanes = NoLanes;\n let subtreeFlags = NoFlags;\n let contextSubtreeDependencies: FigContext<unknown>[] | null = null;\n\n while (child !== null) {\n childLanes = mergeLanes(childLanes, child.lanes);\n childLanes = mergeLanes(childLanes, child.childLanes);\n subtreeFlags |= childSubtreeFlags(child);\n contextSubtreeDependencies = appendContextDependencies(\n contextSubtreeDependencies,\n child.contextDependencies,\n );\n contextSubtreeDependencies = appendContextList(\n contextSubtreeDependencies,\n child.contextSubtreeDependencies,\n );\n child = child.sibling;\n }\n\n if (isNewHostInstance(node)) {\n host.finalizeInitialInstance?.(node.stateNode as Instance, node.props);\n if (!setInitialHostTextContent(node)) {\n // A reused instance (re-assembled on Suspense reveal) may still hold\n // stale children from before the fallback; clear before re-appending.\n // Gated on a reused node (alternate) with child fibers, so fresh mounts\n // and content set via props (innerHTML/textarea) are left untouched.\n if (node.alternate !== null && node.child !== null) {\n host.setTextContent?.(node.stateNode as Instance, \"\");\n }\n appendAllHostChildren(node.stateNode as Instance, node.child);\n }\n if (host.appendInitialChild !== undefined) node.flags |= AssembledFlag;\n }\n\n if (node.tag === ViewTransitionTag) node.flags |= ViewTransitionStaticFlag;\n\n node.childLanes = childLanes;\n node.subtreeFlags = subtreeFlags;\n node.contextSubtreeDependencies = contextSubtreeDependencies;\n node.memoizedProps = node.props;\n if (node.tag === ContextProviderTag && (node.flags & AdoptedFlag) === 0) {\n popContextProvider(node);\n }\n }\n\n function isNewHostInstance(node: F): boolean {\n // A host instance needs initial assembly until it has actually committed —\n // tracked by committedProps, not by alternate. A reused fiber from a\n // never-committed render (e.g. a Suspense primary subtree captured when a\n // child suspended, then revealed) has an alternate but null committedProps:\n // its host children were never appended into it, so it must assemble like a\n // fresh instance or its non-suspending descendants are dropped on reveal.\n return (\n node.tag === HostTag &&\n node.committedProps === null &&\n (node.flags & HydrationFlag) === 0\n );\n }\n\n function setInitialHostTextContent(node: F): boolean {\n const text = hostTextContent(node.props.children);\n if (text === null || host.setTextContent === undefined) return false;\n\n host.setTextContent(node.stateNode as Instance, text);\n return true;\n }\n\n function appendAllHostChildren(parent: Instance, child: F | null): void {\n if (host.appendInitialChild === undefined) return;\n\n for (let node = child; node !== null; node = node.sibling) {\n if (node.tag === PortalTag) continue;\n // Hoisted instances live out-of-band; commit acquires them instead.\n if (isHoistedFiber(node)) continue;\n\n if (node.tag === HostTag || node.tag === TextTag) {\n host.appendInitialChild(parent, hostNode(node));\n } else {\n appendAllHostChildren(parent, node.child);\n }\n }\n }\n\n function reconcileCurrentChildren(\n parent: F,\n children: FigNode,\n root = rootOf(parent),\n ): void {\n reconcile(parent, children, parent.alternate?.child ?? null, false, root);\n }\n\n function reconcile(\n parent: F,\n children: FigNode,\n currentFirstChild: F | null,\n forcePlacement: boolean,\n root = rootOf(parent),\n ): void {\n const nextChildren = collectChildren(children);\n const seenKeys = __DEV__ ? new Set<string>() : null;\n\n parent.child = null;\n parent.deletions = null;\n\n let previous: F | null = null;\n let old: F | null = currentFirstChild;\n let index = 0;\n let lastPlacedIndex = 0;\n const isHydratingNewTree =\n parent.tag !== PortalTag &&\n root.isHydrating &&\n currentFirstChild === null;\n\n for (; old !== null && index < nextChildren.length; index += 1) {\n const child = nextChildren[index];\n if (!sameChildKey(old, child, index) || !sameType(old, child)) {\n break;\n }\n validateChildKey(child, seenKeys);\n\n const next = createWorkInProgress(old, propsFor(child));\n next.index = index;\n next.return = parent;\n\n const updateFlags = hostUpdateFlags(old, next.props);\n if (updateFlags !== NoFlags) {\n recordCommitWork(root.commitIndex, next, updateFlags);\n }\n if (forcePlacement) {\n next.flags |= PlacementFlag;\n } else {\n lastPlacedIndex = old.index;\n }\n\n previous = appendChild(parent, previous, next);\n old = old.sibling;\n }\n\n if (index === nextChildren.length) {\n appendDeletions(parent, old);\n return;\n }\n\n if (old === null) {\n for (; index < nextChildren.length; index += 1) {\n validateChildKey(nextChildren[index], seenKeys);\n const next = fiberFrom(nextChildren[index]);\n if (next === null) continue;\n\n next.index = index;\n next.return = parent;\n if (!isHydratingNewTree) next.flags |= PlacementFlag;\n previous = appendChild(parent, previous, next);\n }\n return;\n }\n\n let existingByKey: Map<string, F> | null = null;\n let existingByIndex: Map<number, F> | null = null;\n for (; old !== null; old = old.sibling) {\n if (old.key === null) {\n (existingByIndex ??= new Map()).set(old.index, old);\n } else {\n (existingByKey ??= new Map()).set(String(old.key), old);\n }\n }\n\n for (; index < nextChildren.length; index += 1) {\n const child = nextChildren[index];\n validateChildKey(child, seenKeys);\n const key = childExplicitKey(child);\n const matched =\n key === null ? existingByIndex?.get(index) : existingByKey?.get(key);\n const canReuse = matched !== undefined && sameType(matched, child);\n const next = canReuse\n ? createWorkInProgress(matched, propsFor(child))\n : fiberFrom(child);\n\n if (next === null) continue;\n\n next.index = index;\n next.return = parent;\n\n if (canReuse) {\n if (key === null) {\n existingByIndex?.delete(index);\n } else {\n existingByKey?.delete(key);\n }\n const updateFlags = hostUpdateFlags(matched, next.props);\n if (updateFlags !== NoFlags) {\n recordCommitWork(root.commitIndex, next, updateFlags);\n }\n if (forcePlacement || matched.index < lastPlacedIndex) {\n next.flags |= PlacementFlag;\n } else {\n lastPlacedIndex = matched.index;\n }\n } else {\n if (!isHydratingNewTree) next.flags |= PlacementFlag;\n }\n\n previous = appendChild(parent, previous, next);\n }\n\n if (existingByKey !== null) {\n for (const child of existingByKey.values()) appendDeletion(parent, child);\n }\n if (existingByIndex !== null) {\n for (const child of existingByIndex.values()) {\n appendDeletion(parent, child);\n }\n }\n }\n\n function appendDeletions(parent: F, firstChild: F | null): void {\n for (let child = firstChild; child !== null; child = child.sibling) {\n appendDeletion(parent, child);\n }\n }\n\n function appendDeletion(parent: F, child: F): void {\n const root = rootOf(parent);\n parent.deletions ??= [];\n parent.deletions.push(child);\n root.needsCommitDeletions = true;\n recordCommitWork(root.commitIndex, parent, DeletionFlag);\n }\n\n function hostUpdateFlags(current: F, nextProps: Props): Flag {\n if (current.tag === TextTag) {\n return current.committedProps?.nodeValue !== nextProps.nodeValue\n ? UpdateFlag\n : NoFlags;\n }\n\n if (current.tag !== HostTag) return NoFlags;\n\n const previousProps = current.committedProps ?? {};\n let flags = NoFlags;\n\n if (hostPropsChanged(previousProps, nextProps)) {\n flags |= UpdateFlag;\n }\n if (\n host.shouldCommitUpdate?.(String(current.type), previousProps, nextProps)\n ) {\n flags |= UpdateFlag;\n }\n if (hostTextContentChanged(current, previousProps, nextProps)) {\n flags |= TextContentFlag;\n }\n\n return flags;\n }\n\n function hostTextContentChanged(\n current: F,\n previous: Props,\n next: Props,\n ): boolean {\n if (host.setTextContent === undefined) return false;\n if (hasUnsafeHTML(next)) return false;\n // Hydration-adopted single-text children keep their fiber shape: the\n // text fiber owns updates (commitTextUpdate). Setting textContent here\n // would replace the very node that fiber points at.\n if (adoptedSingleTextChild(current)) return false;\n\n const previousText = hostTextContent(previous.children);\n const nextText = hostTextContent(next.children);\n\n return (\n previousText !== nextText || (nextText !== null && current.child !== null)\n );\n }\n\n function hostPropsChanged(previous: Props, next: Props): boolean {\n let previousCount = 0;\n\n for (const key in previous) {\n if (!Object.hasOwn(previous, key)) continue;\n if (!committedHostProp(key)) continue;\n previousCount += 1;\n if (!(key in next) || previous[key] !== next[key]) return true;\n }\n\n let nextCount = 0;\n\n for (const key in next) {\n if (!Object.hasOwn(next, key)) continue;\n if (committedHostProp(key)) nextCount += 1;\n }\n\n return previousCount !== nextCount;\n }\n\n function committedHostProp(name: string): boolean {\n return name !== \"children\";\n }\n\n // Shared by the commit-parking gate and the plan builder. Parking uses\n // this WITHOUT checking for boundaries on purpose: even a commit with no\n // annotated surfaces must not land under a running animation — mutations\n // to captured regions stay invisible until the animation settles and then\n // pop in. React parks all eligible commits the same way.\n function isViewTransitionEligibleCommit(root: R): boolean {\n return (\n !root.clearContainerBeforeCommit &&\n root.renderLanes !== NoLanes &&\n (root.renderLanes & ~ViewTransitionEligibleLanes) === NoLanes &&\n viewTransitionHost !== null\n );\n }\n\n function prepareViewTransitionPlan(\n root: R,\n finishedWork: F,\n ): ViewTransitionPlan<Instance> | null {\n if (!isViewTransitionEligibleCommit(root)) return null;\n if (\n (finishedWork.subtreeFlags & ViewTransitionStaticFlag) === 0 &&\n !root.needsCommitDeletions\n ) {\n return null;\n }\n\n const plan: ViewTransitionPlan<Instance> = {\n newSurfaces: [],\n oldSurfaces: [],\n rootAffected: false,\n };\n const exitsByName = new Map<string, F>();\n\n if (root.needsCommitDeletions) {\n collectDeletedViewTransitions(root, finishedWork, plan, exitsByName);\n }\n const changedBoundaries = attributeQueuedHostUpdates(root, plan);\n collectFinishedViewTransitions(\n finishedWork.child,\n false,\n false,\n false,\n changedBoundaries,\n plan,\n exitsByName,\n );\n\n if (__DEV__ && !plan.rootAffected && devFlagRootAffected(finishedWork)) {\n throw new Error(\n \"Fig internal parity error: commit-queue attribution missed a \" +\n \"mutation outside view-transition boundaries (rootAffected).\",\n );\n }\n\n if (plan.oldSurfaces.length === 0 && plan.newSurfaces.length === 0) {\n return null;\n }\n\n if (__DEV__) warnOnDuplicateViewTransitionNames(plan);\n return plan;\n }\n\n // Two live boundaries sharing one view-transition-name make the browser\n // silently skip the whole transition, which reads as \"animations randomly\n // stopped working\" — surface it. Old and new sides are checked separately:\n // the same name on both sides is exactly how pairs morph.\n function warnOnDuplicateViewTransitionNames(\n plan: ViewTransitionPlan<Instance>,\n ): void {\n for (const surfaces of [plan.oldSurfaces, plan.newSurfaces]) {\n const owners = new Map<string, object>();\n for (const surface of surfaces) {\n const owner = owners.get(surface.name);\n if (owner !== undefined && owner !== surface.boundary) {\n console.error(\n `Multiple <ViewTransition> boundaries resolved to the name ` +\n `\"${surface.name}\" in one commit. The browser skips the ` +\n \"entire transition when a view-transition-name is duplicated; \" +\n \"give each simultaneously mounted boundary a distinct name.\",\n );\n }\n owners.set(surface.name, surface.boundary);\n }\n }\n }\n\n function collectDeletedViewTransitions(\n root: R,\n node: F,\n plan: ViewTransitionPlan<Instance>,\n exitsByName: Map<string, F>,\n ): void {\n let collected = 0;\n for (const cursor of root.commitIndex) {\n if (cursor.deletions === null) continue;\n if (__DEV__) collected += 1;\n for (const deletion of cursor.deletions) {\n collectDeletedViewTransitionFiber(deletion, plan, exitsByName, true);\n }\n }\n\n if (__DEV__) {\n let expected = 0;\n walkFiberSubtree(node, (cursor) => {\n if (cursor.deletions !== null) expected += 1;\n return (cursor.subtreeFlags & DeletionFlag) !== 0;\n });\n if (collected !== expected) {\n throw new Error(\n \"Fig internal parity error: the commit index collected deleted \" +\n `view transitions from ${collected} fiber(s) where the tree ` +\n `walk found ${expected}.`,\n );\n }\n }\n }\n\n // A deletions entry is a single detached subtree; its sibling pointers\n // still reference kept fibers in the old child list, so only the entry\n // itself is walked, never its siblings.\n function collectDeletedViewTransitionFiber(\n cursor: F,\n plan: ViewTransitionPlan<Instance>,\n exitsByName: Map<string, F>,\n collectExit: boolean,\n ): void {\n if (cursor.tag === PortalTag || isHiddenBoundary(cursor)) return;\n\n if (cursor.tag === ViewTransitionTag) {\n if (explicitViewTransitionName(cursor) !== null) {\n exitsByName.set(viewTransitionName(cursor), cursor);\n }\n if (collectExit) {\n collectViewTransitionSurfaces(\n cursor,\n \"exit\",\n plan.oldSurfaces,\n \"committed\",\n );\n }\n // The outermost deleted boundary owns the exit; deeper named\n // boundaries never exit on their own but stay eligible to pair with\n // an appearing counterpart (share).\n for (let child = cursor.child; child !== null; child = child.sibling) {\n collectDeletedViewTransitionFiber(child, plan, exitsByName, false);\n }\n return;\n }\n\n // Deleted fibers committed before, so their persisted static flag is\n // authoritative: no bit means no boundary anywhere below — skip the\n // subtree instead of walking every deleted fiber.\n if ((cursor.subtreeFlags & ViewTransitionStaticFlag) === 0) return;\n for (let child = cursor.child; child !== null; child = child.sibling) {\n collectDeletedViewTransitionFiber(child, plan, exitsByName, collectExit);\n }\n }\n\n // Host-update bits never reach subtreeFlags, so the collect walk cannot\n // see updates below a fiber. This pass recovers that signal from the\n // commit index: each pending host update is attributed to its innermost\n // enclosing ViewTransition boundary (matching \"the innermost boundary owns\n // an update\"), to nothing when a portal intervenes (the collect walks skip\n // portal content), or to the root snapshot when no boundary encloses it.\n function attributeQueuedHostUpdates(\n root: R,\n plan: ViewTransitionPlan<Instance>,\n ): Set<F> | null {\n let changed: Set<F> | null = null;\n\n for (const entry of root.commitIndex) {\n if ((entry.flags & HostUpdateMask) === 0) continue;\n let sawPortal = false;\n let boundary: F | null = null;\n for (let parent = entry.return; parent !== null; parent = parent.return) {\n if (parent.tag === ViewTransitionTag) {\n boundary = parent;\n break;\n }\n if (parent.tag === PortalTag) sawPortal = true;\n }\n if (boundary === null) {\n // Portal content still repaints the page, and the pre-queue walk\n // counted it through raw subtree bits when no boundary enclosed it.\n plan.rootAffected = true;\n } else if (!sawPortal) {\n (changed ??= new Set()).add(boundary);\n }\n }\n\n return changed;\n }\n\n // Dev-only pre-masking truth: does any own-fiber mutation/deletion flag\n // exist outside every ViewTransition boundary? Mirrors the old\n // subtree-bit rootAffected discovery (portal content counts only outside\n // boundaries; stably hidden VT-containing subtrees are skipped).\n function devFlagRootAffected(node: F): boolean {\n let affected = false;\n walkFiberSubtree(node, (cursor) => {\n if (cursor === node) return true;\n const containsViewTransition =\n cursor.tag === ViewTransitionTag ||\n (cursor.subtreeFlags & ViewTransitionStaticFlag) !== 0;\n if (!containsViewTransition) {\n if (devSubtreeHasMutations(cursor)) affected = true;\n return false;\n }\n if (isStablyHiddenBoundary(cursor)) return false;\n if (cursor.tag === ViewTransitionTag) return false;\n if (cursor.tag === PortalTag) return false;\n if ((cursor.flags & (MutationMask | DeletionFlag)) !== 0) affected = true;\n return true;\n });\n return affected;\n }\n\n function devSubtreeHasMutations(node: F): boolean {\n let found = false;\n walkFiberSubtree(node, (cursor) => {\n if ((cursor.flags & (MutationMask | DeletionFlag)) !== 0) found = true;\n return !found;\n });\n return found;\n }\n\n function collectFinishedViewTransitions(\n node: F | null,\n placed: boolean,\n insideBoundary: boolean,\n // A fiber whose own props or child list changed re-lays-out its\n // descendants, so boundaries below it may move without any mutation of\n // their own (a container's gap/class change is the classic case). React\n // measures such \"nested\" boundaries and cancels the still ones; without\n // measurement Fig collects them as updates and lets identical-geometry\n // morphs be visual no-ops. Sibling-insertion shifts are still missed:\n // placement flags live on the inserted fiber, not its parent.\n ancestorLayoutChanged: boolean,\n changedBoundaries: Set<F> | null,\n plan: ViewTransitionPlan<Instance>,\n exitsByName: Map<string, F>,\n ): void {\n // A keyed reorder moves existing content: every sibling at the level may\n // shift without its own flags, so treat the level as layout-changed and\n // let measurement cancel the boundaries that did not actually move. A\n // placed fiber that was committed before (it has an alternate, or was\n // adopted in place by a bailout) is a move; fresh insertions keep the\n // documented behavior of not animating the siblings they shift. The scan\n // only runs when it can still change the answer.\n let layoutChanged = ancestorLayoutChanged;\n for (\n let cursor = node;\n !layoutChanged && cursor !== null;\n cursor = cursor.sibling\n ) {\n if (\n (cursor.flags & PlacementFlag) !== 0 &&\n (cursor.alternate !== null || (cursor.flags & AdoptedFlag) !== 0)\n ) {\n layoutChanged = true;\n }\n }\n\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n const cursorPlaced = placed || (cursor.flags & PlacementFlag) !== 0;\n const containsViewTransition =\n cursor.tag === ViewTransitionTag ||\n (cursor.subtreeFlags & ViewTransitionStaticFlag) !== 0;\n\n if (!containsViewTransition) {\n // Changes out here are not contained by any boundary: the root\n // snapshot must stay so the browser cross-fades them.\n if (\n !insideBoundary &&\n ((cursor.flags | cursor.subtreeFlags) &\n (MutationMask | DeletionFlag)) !==\n 0\n ) {\n plan.rootAffected = true;\n }\n continue;\n }\n // Stably hidden content is never captured by the browser, so its\n // boundaries must not create surfaces (or a plan). A boundary hiding\n // this commit still walks: its old side was visible and animates away.\n if (isStablyHiddenBoundary(cursor)) continue;\n\n if (cursor.tag === ViewTransitionTag) {\n // Hydration mounts fresh fibers over already-visible server pixels:\n // nothing enters or changes visually, so a hydrating boundary must\n // not animate (retry-lane commits that finish a dehydrated Suspense\n // boundary land here). React reaches the same outcome by keying\n // enter off Placement flags, which hydration never sets.\n if (\n !cursorPlaced &&\n ((cursor.flags | cursor.subtreeFlags) & HydrationFlag) !== 0\n ) {\n continue;\n }\n // Enter is keyed off Placement flags only (like React). A missing\n // alternate must NOT read as \"mounted this commit\": in-place bailout\n // reuse means a fiber that mounted once and always bailed out since\n // keeps alternate === null forever, and treating it as entering\n // replays its enter animation on every eligible commit.\n if (cursorPlaced) {\n const pairedExit = exitsByName.get(viewTransitionName(cursor));\n if (pairedExit !== undefined) {\n // A pair vacates one slot and fills another: both relayout.\n if (!insideBoundary) plan.rootAffected = true;\n collectViewTransitionPair(plan, pairedExit, cursor);\n exitsByName.delete(viewTransitionName(cursor));\n } else if (cursor.alternate !== null) {\n // A moved boundary keeps its identity: naming both the committed\n // and finished instances lets the browser morph position instead\n // of treating the move as an enter-only cross-fade. Measurement\n // decides whether it actually moved, and reorder companions are\n // collected through the sibling-move level rule, so the root\n // snapshot is not forced here.\n collectViewTransitionSurfaces(\n cursor.alternate,\n \"update\",\n plan.oldSurfaces,\n \"committed\",\n false,\n );\n collectViewTransitionSurfaces(\n cursor,\n \"update\",\n plan.newSurfaces,\n \"finished\",\n false,\n );\n } else {\n // An insertion changes the sibling count at its slot: the\n // surrounding layout shifts, so the root cross-fade must stay.\n if (!insideBoundary) plan.rootAffected = true;\n collectViewTransitionSurfaces(\n cursor,\n \"enter\",\n plan.newSurfaces,\n \"finished\",\n );\n }\n // Named boundaries deeper in a new or moved subtree never enter on\n // their own, but they can still pair with a deleted counterpart.\n collectAppearingPairViewTransitions(cursor.child, plan, exitsByName);\n continue;\n }\n\n // The innermost boundary owns an update: this boundary only animates\n // when something changed outside its nested boundaries (or an\n // ancestor's layout change moved it), and the walk always descends\n // so nested boundaries classify their own changes (an outer\n // update=\"none\" must not disable them). A bailed-out boundary is its\n // own committed instance (in-place reuse never created an\n // alternate): eligible commits cannot be first mounts, so a fiber\n // with neither placement nor alternate was committed before.\n const current = cursor.alternate ?? cursor;\n const contentChanged = viewTransitionChangedOutsideNested(\n cursor,\n changedBoundaries,\n );\n if (__DEV__) {\n const expected = devViewTransitionChangedOutsideNested(cursor);\n if (contentChanged !== expected) {\n throw new Error(\n \"Fig internal parity error: commit-queue attribution \" +\n `classified a view-transition boundary as ${contentChanged ? \"changed\" : \"unchanged\"} ` +\n \"where own-fiber flags disagree.\",\n );\n }\n }\n if (contentChanged || layoutChanged) {\n collectViewTransitionSurfaces(\n current,\n \"update\",\n plan.oldSurfaces,\n \"committed\",\n contentChanged,\n );\n collectViewTransitionSurfaces(\n cursor,\n \"update\",\n plan.newSurfaces,\n \"finished\",\n contentChanged,\n );\n }\n collectFinishedViewTransitions(\n cursor.child,\n cursorPlaced,\n true,\n contentChanged || layoutChanged,\n changedBoundaries,\n plan,\n exitsByName,\n );\n continue;\n }\n\n if (cursor.tag !== PortalTag) {\n // The fiber's own mutations and deletions sit outside any boundary\n // deeper in its subtree.\n if (\n !insideBoundary &&\n (cursor.flags & (MutationMask | DeletionFlag)) !== 0\n ) {\n plan.rootAffected = true;\n }\n collectFinishedViewTransitions(\n cursor.child,\n cursorPlaced,\n insideBoundary,\n layoutChanged || (cursor.flags & (MutationMask | DeletionFlag)) !== 0,\n changedBoundaries,\n plan,\n exitsByName,\n );\n }\n }\n }\n\n function collectAppearingPairViewTransitions(\n node: F | null,\n plan: ViewTransitionPlan<Instance>,\n exitsByName: Map<string, F>,\n ): void {\n if (exitsByName.size === 0) return;\n\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if (cursor.tag === PortalTag || isStablyHiddenBoundary(cursor)) continue;\n\n if (cursor.tag === ViewTransitionTag) {\n const pairedExit =\n explicitViewTransitionName(cursor) !== null\n ? exitsByName.get(viewTransitionName(cursor))\n : undefined;\n if (pairedExit !== undefined) {\n collectViewTransitionPair(plan, pairedExit, cursor);\n exitsByName.delete(viewTransitionName(cursor));\n }\n }\n\n collectAppearingPairViewTransitions(cursor.child, plan, exitsByName);\n }\n }\n\n function collectViewTransitionPair(\n plan: ViewTransitionPlan<Instance>,\n oldBoundary: F,\n newBoundary: F,\n ): void {\n removeViewTransitionSurfaces(plan.oldSurfaces, oldBoundary);\n collectViewTransitionSurfaces(\n oldBoundary,\n \"share\",\n plan.oldSurfaces,\n \"committed\",\n );\n collectViewTransitionSurfaces(\n newBoundary,\n \"share\",\n plan.newSurfaces,\n \"finished\",\n );\n }\n\n function isStablyHiddenBoundary(node: F): boolean {\n if (!isHiddenBoundary(node)) return false;\n const current = node.alternate;\n return (\n current === null || activityHidden(current.memoizedProps ?? current.props)\n );\n }\n\n function viewTransitionChangedOutsideNested(\n boundary: F,\n changedBoundaries: Set<F> | null,\n ): boolean {\n if ((boundary.flags & (MutationMask | DeletionFlag)) !== 0) return true;\n // Host updates below this boundary (outside nested boundaries) were\n // attributed from the commit index; subtree bits no longer carry them.\n if (changedBoundaries !== null && changedBoundaries.has(boundary)) {\n return true;\n }\n return subtreeChangedOutsideNested(boundary.child);\n }\n\n // Dev-only pre-masking truth via own-fiber flags, no subtree pruning.\n function devViewTransitionChangedOutsideNested(boundary: F): boolean {\n if ((boundary.flags & (MutationMask | DeletionFlag)) !== 0) return true;\n let changed = false;\n walkFiberForest(boundary.child, (cursor) => {\n if (changed || cursor.tag === PortalTag) return false;\n if (cursor.tag === ViewTransitionTag) return false;\n if ((cursor.flags & (MutationMask | DeletionFlag)) !== 0) changed = true;\n return !changed;\n });\n return changed;\n }\n\n function subtreeChangedOutsideNested(node: F | null): boolean {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if (cursor.tag === PortalTag) continue;\n // A nested boundary owns everything below it, including its own flags.\n if (cursor.tag === ViewTransitionTag) continue;\n if ((cursor.flags & (MutationMask | DeletionFlag)) !== 0) return true;\n if ((cursor.subtreeFlags & (MutationMask | DeletionFlag)) === 0) continue;\n if (subtreeChangedOutsideNested(cursor.child)) return true;\n }\n\n return false;\n }\n\n function removeViewTransitionSurfaces(\n surfaces: ViewTransitionSurface<Instance>[],\n boundary: F,\n ): void {\n for (let index = surfaces.length - 1; index >= 0; index -= 1) {\n const surface = surfaces[index];\n if (surface.boundary === boundary) surfaces.splice(index, 1);\n }\n }\n\n function collectViewTransitionSurfaces(\n boundary: F,\n phase: ViewTransitionPhase,\n surfaces: ViewTransitionSurface<Instance>[],\n propsSource: \"committed\" | \"finished\",\n mustAnimate = true,\n ): void {\n const className = viewTransitionClass(boundary.props, phase);\n if (className === \"none\") return;\n\n const name = viewTransitionName(boundary);\n let index = 0;\n\n const collect = (node: F | null): void => {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if (cursor.tag === PortalTag) continue;\n if (cursor.tag === ViewTransitionTag) continue;\n if (cursor.tag === HostTag) {\n if (!isHoistedFiber(cursor)) {\n surfaces.push({\n boundary,\n className,\n instance: cursor.stateNode as Instance,\n measurement: null,\n mustAnimate,\n name: index === 0 ? name : `${name}_${index}`,\n phase,\n props: viewTransitionSurfaceProps(cursor, propsSource),\n skipped: false,\n });\n index += 1;\n }\n continue;\n }\n collect(cursor.child);\n }\n };\n\n collect(boundary.child);\n }\n\n function viewTransitionSurfaceProps(\n node: F,\n source: \"committed\" | \"finished\",\n ): Props {\n if (source === \"committed\") {\n return node.committedProps ?? node.memoizedProps ?? node.props;\n }\n return node.memoizedProps ?? node.props;\n }\n\n function viewTransitionName(node: F): string {\n const props = node.props as ViewTransitionProps;\n if (props.name !== undefined && props.name !== \"auto\") return props.name;\n\n const state = node.stateNode as ViewTransitionState;\n state.autoName ??= `fig-vt-${viewTransitionAutoNameCounter++}`;\n return state.autoName;\n }\n\n function explicitViewTransitionName(node: F): string | null {\n const name = (node.props as ViewTransitionProps).name;\n return name === undefined || name === \"auto\" ? null : name;\n }\n\n function viewTransitionClass(\n props: Props,\n phase: \"enter\" | \"exit\" | \"share\" | \"update\",\n ): ViewTransitionClass | null {\n const viewTransitionProps = props as ViewTransitionProps;\n const phaseClass = viewTransitionProps[phase];\n const className =\n phaseClass === undefined ? viewTransitionProps.default : phaseClass;\n\n if (className === undefined || className === \"auto\") return null;\n if (className === \"none\") return \"none\";\n return className;\n }\n\n // The prepare pass, before the browser captures the old state: measure and\n // name the old-side surfaces. Exits gate on the old viewport alone — the\n // element is leaving, so offscreen exits never participate (React reverts\n // these the same way before its old capture).\n function applyOldViewTransitionSurfaces(\n plan: ViewTransitionPlan<Instance>,\n ): void {\n if (viewTransitionHost === null) return;\n const measure = viewTransitionHost.measure;\n\n for (const surface of plan.oldSurfaces) {\n surface.measurement = measure?.(surface.instance) ?? null;\n if (\n surface.phase === \"exit\" &&\n surface.measurement !== null &&\n !surface.measurement.inViewport\n ) {\n surface.skipped = true;\n continue;\n }\n viewTransitionHost.apply(\n surface.instance,\n surface.name,\n surface.className,\n );\n }\n }\n\n // The resolve pass, inside the update callback after mutations landed and\n // before the browser captures the new state. Fresh measurements decide who\n // really animates, mirroring React's after-mutation pass:\n // - enters gate on the new viewport;\n // - layout-driven updates whose geometry did not change are canceled (the\n // new name is withheld and the already-captured old group is hidden at\n // ready), while content-driven updates and share pairs always animate;\n // - a resize of a statically positioned surface relayouts its parent, and\n // a shrunken surface list relayouts its slot, so either keeps the root\n // snapshot alive.\n function resolveViewTransitionPlan(\n plan: ViewTransitionPlan<Instance> | null,\n ): ViewTransitionMutationResult {\n const result: ViewTransitionMutationResult = {\n canceledNames: [],\n cancelRootSnapshot: false,\n };\n if (viewTransitionHost === null || plan === null) return result;\n const measure = viewTransitionHost.measure;\n\n const oldByName = new Map<string, ViewTransitionSurface<Instance>>();\n for (const surface of plan.oldSurfaces) {\n if (!surface.skipped) oldByName.set(surface.name, surface);\n }\n\n let rootAffected = plan.rootAffected;\n const newNames = new Set<string>();\n\n for (const surface of plan.newSurfaces) {\n newNames.add(surface.name);\n const measurement = measure?.(surface.instance) ?? null;\n\n if (surface.phase === \"enter\") {\n if (measurement !== null && !measurement.inViewport) {\n surface.skipped = true;\n continue;\n }\n applyViewTransitionSurface(viewTransitionHost, surface);\n continue;\n }\n\n if (surface.phase === \"update\") {\n const before = oldByName.get(surface.name)?.measurement ?? null;\n if (before !== null && measurement !== null) {\n const moved =\n before.x !== measurement.x ||\n before.y !== measurement.y ||\n before.width !== measurement.width ||\n before.height !== measurement.height;\n const offscreen = !before.inViewport && !measurement.inViewport;\n\n if (offscreen || (!surface.mustAnimate && !moved)) {\n // The prepare pass already named this instance (update surfaces\n // share it between sides); take the name back off so the new\n // capture skips it, and hide the old capture at ready.\n surface.skipped = true;\n viewTransitionHost.restore(surface.instance, surface.props);\n if (oldByName.has(surface.name)) {\n result.canceledNames.push(surface.name);\n }\n continue;\n }\n if (\n (before.width !== measurement.width ||\n before.height !== measurement.height) &&\n !measurement.absolutelyPositioned\n ) {\n rootAffected = true;\n }\n }\n }\n\n applyViewTransitionSurface(viewTransitionHost, surface);\n }\n\n // Update names with no new counterpart mean the surface list shrank:\n // that slot relayouts, and the dangling old capture exits.\n for (const [name, surface] of oldByName) {\n if (surface.phase === \"update\" && !newNames.has(name)) {\n rootAffected = true;\n }\n }\n\n result.cancelRootSnapshot = !rootAffected;\n return result;\n }\n\n function applyViewTransitionSurface(\n viewTransitionHost: ViewTransitionHostConfig<Container, Instance>,\n surface: ViewTransitionSurface<Instance>,\n ): void {\n viewTransitionHost.apply(surface.instance, surface.name, surface.className);\n }\n\n function restoreViewTransitionSurfaces(\n plan: ViewTransitionPlan<Instance>,\n ): void {\n if (viewTransitionHost === null) return;\n\n const propsByInstance = new Map<Instance, Props>();\n for (const surface of plan.oldSurfaces) {\n propsByInstance.set(surface.instance, surface.props);\n }\n for (const surface of plan.newSurfaces) {\n propsByInstance.set(surface.instance, surface.props);\n }\n\n for (const [instance, props] of propsByInstance) {\n viewTransitionHost.restore(instance, props);\n }\n }\n\n function commitRoot(root: R, finishedWork: F): boolean {\n // While a previous view transition is animating, park eligible commits\n // instead of committing under it: mutations to captured surfaces would\n // stay invisible until the animation ends (a visual pop at settle), and\n // the browser cannot hand an interrupted transition off to a new one —\n // skipTransition() hard-stops and restarts, which is the jank this\n // avoids. Rendering stays live while parked, and any newer render\n // supersedes the parked tree (its lanes are still pending, so the fresh\n // render absorbs them): the LATEST state commits the moment the\n // animation finishes. This is React's suspend-commits model\n // (facebook/react#32002) — waiting is cheap because only the commit\n // waits, never the rendering. The park sits before every commit phase\n // so a superseded parked commit never runs its effects.\n if (\n !root.pendingViewTransitionCommit &&\n isViewTransitionEligibleCommit(root) &&\n viewTransitionHost?.suspend?.(root.container, () =>\n scheduleRoot(root),\n ) === true\n ) {\n root.parkedViewTransitionCommit = true;\n // The scheduler callback that carried this attempt is spent; clear it\n // so the finished-callback's (or a newer update's) scheduleRoot isn't\n // deduped against it.\n root.callback = null;\n root.callbackPriority = NoLane;\n return true;\n }\n\n commitDepth += 1;\n try {\n // Taken before any commit step runs: the closures below may defer\n // completion across ticks (view transitions), and a later render must\n // not see or clear this commit's retries. Most commits carry none —\n // the shared empty list avoids a per-commit allocation, and holding\n // root's own (empty) array instead would let a later render's pushes\n // leak into this commit's deferred attach.\n let suspenseRetries = noSuspenseRetries;\n if (root.pendingSuspenseRetries.length > 0) {\n suspenseRetries = root.pendingSuspenseRetries;\n root.pendingSuspenseRetries = [];\n }\n commitLiveHookInstances(root);\n if (__DEV__) assertLiveHookInstanceParity(finishedWork.child);\n if (hasHiddenBoundaries) armRevealedHiddenBoundaries(finishedWork.child);\n commitEffects(root, finishedWork.child, BeforeLayoutEffect);\n const viewTransitionPlan = prepareViewTransitionPlan(root, finishedWork);\n const commitHostChanges = () => {\n if (root.clearContainerBeforeCommit) {\n requireHydrationHostConfig().clearContainer(root.container);\n root.clearContainerBeforeCommit = false;\n }\n if (root.needsCommitDeletions) {\n commitDeletions(root);\n root.needsCommitDeletions = false;\n }\n if (__DEV__) assertDeletionCommitParity(finishedWork);\n commitDataDependencies(root);\n if (__DEV__) assertDataDependencyCommitParity(finishedWork.child);\n commitHostUpdates(root);\n if (__DEV__) assertHostUpdateCommitParity(finishedWork.child);\n commitMutationEffects(finishedWork.child);\n if (hasHiddenBoundaries)\n commitHiddenBoundaryVisibility(finishedWork.child);\n };\n const completeCommit = () => {\n // Recompute from committed reality: the eager render-time set is sticky, so\n // once the last hidden boundary reveals or unmounts this clears the flag and\n // the per-update parent-walk is skipped again.\n hasHiddenBoundaries = hiddenStates.size > 0;\n root.current = finishedWork;\n deactivateHydration(root);\n root.hydrationInitialElement = NoHydrationInitialElement;\n root.consumedPendingQueues = [];\n // Remaining work is read from the committed tree, not just from\n // pendingLanes minus renderLanes: an update dispatched after its fiber\n // rendered but before this line (setState in a commit-phase effect, or a\n // same-lane update while a time-sliced render of that lane was yielded)\n // lands on a lane inside renderLanes, and stripping it here would park it\n // in its hook queue forever. markLanes/markChildLanes recorded such\n // updates on the finishedWork fibers (begin cleared the lanes that\n // actually rendered), so merging finishedWork.lanes | childLanes revives\n // exactly the work still owed without resurrecting completed lanes.\n markRootFinished(\n root,\n (root.pendingLanes & ~root.renderLanes) |\n finishedWork.lanes |\n finishedWork.childLanes,\n );\n if (includesSomeLane(finishedWork.childLanes, OffscreenLane)) {\n markRootPending(root, OffscreenLane);\n // A suspension after reveal lane expansion may have marked offscreen\n // work suspended alongside the visible lanes; let idle retries proceed.\n root.suspendedLanes &= ~OffscreenLane;\n }\n try {\n commitExternalStores(root);\n if (__DEV__) assertExternalStoreCommitParity(finishedWork.child);\n attachCommittedSuspenseRetries(root, suspenseRetries);\n scheduleDehydratedSuspenseRetries(root);\n commitEffects(root, finishedWork.child, BeforePaintEffect);\n flushCaughtBoundaryErrors(root);\n if (__DEV__) assertCaughtBoundaryErrorParity(finishedWork.child);\n } finally {\n // Once the tree is current its flags must be cleared even when a\n // commit step throws, or a later render would adopt stale flags.\n collectReactiveEffects(root, finishedWork.child);\n clearTransientFlags(finishedWork);\n scheduleReactiveEffects(root);\n clearCommitIndex(root.commitIndex);\n }\n if (__DEV__ && root.devtools) {\n emitDevtoolsCommit(host, root);\n }\n flushRecoverableErrors(root);\n // Host mutations just landed: make the work loop yield at its next check\n // so the host paints before further scheduled work (React does the same\n // from commitRoot).\n requestPaint();\n };\n const commitWithoutViewTransition = () => {\n commitHostChanges();\n completeCommit();\n };\n const commitWithViewTransition = (): ViewTransitionMutationResult => {\n const isDeferredCommit = root.pendingViewTransitionCommit;\n if (isDeferredCommit) commitDepth += 1;\n try {\n commitHostChanges();\n const resolution = resolveViewTransitionPlan(viewTransitionPlan);\n completeCommit();\n return resolution;\n } catch (error) {\n // A deferred commit runs inside the browser's startViewTransition\n // update callback, outside any performRoot frame. Rethrowing there\n // would strand the error in the transition's promise and leave the\n // root half-committed, so route it through the same uncaught-error\n // path performRoot uses.\n if (!isDeferredCommit) throw error;\n const info =\n root.uncaughtErrorInfo ?? errorInfoFor(root.current, error);\n restartRootWork(root);\n clearRootAfterUncaughtError(root);\n reportUncaughtError(root, error, info);\n if (root.onUncaughtError === null) {\n setTimeout(() => {\n throw error;\n });\n }\n return { canceledNames: [], cancelRootSnapshot: false };\n } finally {\n if (isDeferredCommit) {\n root.pendingViewTransitionCommit = false;\n commitDepth -= 1;\n finishRootWork(root);\n flushPostCommitSyncWork();\n }\n }\n };\n if (viewTransitionPlan !== null && viewTransitionHost !== null) {\n const viewTransitionResult = viewTransitionHost.commit(\n root.container,\n () => applyOldViewTransitionSurfaces(viewTransitionPlan),\n commitWithViewTransition,\n () => restoreViewTransitionSurfaces(viewTransitionPlan),\n );\n\n if (viewTransitionResult === \"deferred\") {\n root.pendingViewTransitionCommit = true;\n root.callback = null;\n root.callbackPriority = NoLane;\n return true;\n }\n\n if (viewTransitionResult === \"committed\") return false;\n }\n\n commitWithoutViewTransition();\n return false;\n } finally {\n commitDepth -= 1;\n }\n }\n\n function scheduleDehydratedSuspenseRetries(root: R): void {\n if (\n !root.isHydrationRoot &&\n root.dehydratedSuspenseCount === 0 &&\n !root.needsRootHydrationCompletion\n ) {\n root.dehydratedBoundaries = new Map();\n return;\n }\n\n const boundaries: F[] = [];\n root.dehydratedBoundaries = new Map();\n const dehydratedSuspenseCount = collectDehydratedSuspense(\n root.current.child,\n boundaries,\n root.dehydratedBoundaries,\n );\n updateDehydratedSuspenseCount(root, dehydratedSuspenseCount);\n if (boundaries.length === 0) return;\n\n queueMicrotask(() => {\n for (const boundary of boundaries) {\n const state = fiberSuspenseState(boundary);\n if (state?.kind !== \"dehydrated\") continue;\n\n const lane = dehydratedSuspenseRetryLane(state.boundary);\n if (lane !== NoLane) scheduleFiber(boundary, lane);\n }\n });\n }\n\n function collectDehydratedSuspense(\n node: F | null,\n boundaries: F[],\n byStartMarker: Map<HostNode<Instance, TextInstance>, F>,\n ): number {\n let count = 0;\n walkFiberForest(node, (cursor) => {\n const state = fiberSuspenseState(cursor);\n if (state?.kind === \"dehydrated\") {\n count += 1;\n byStartMarker.set(state.boundary.start, cursor);\n // A dehydrated boundary has no live children to descend into, but its\n // siblings may be retriable too (e.g. several boundaries inside one\n // revealed Activity), so keep walking the sibling chain.\n if (\n !abandonedHydrationBoundaries.has(cursor) &&\n dehydratedSuspenseRetryLane(state.boundary) !== NoLane\n ) {\n boundaries.push(cursor);\n }\n return false;\n }\n return true;\n });\n return count;\n }\n\n function updateDehydratedSuspenseCount(root: R, count: number): void {\n const previous = root.dehydratedSuspenseCount;\n root.dehydratedSuspenseCount = count;\n if ((previous > 0 || root.needsRootHydrationCompletion) && count === 0) {\n root.needsRootHydrationCompletion = false;\n host.completeRootHydration?.(root.container);\n }\n }\n\n function dehydratedSuspenseRetryLane(\n boundary: DehydratedSuspenseBoundary<Instance, TextInstance>,\n ): Lane {\n if (boundary.forceClientRender) return DefaultLane;\n if (boundary.status === \"completed\") return DefaultHydrationLane;\n if (boundary.status === \"client-rendered\") return DefaultLane;\n return NoLane;\n }\n\n function flushRecoverableErrors(root: R): void {\n const errors = root.recoverableErrors;\n if (errors.length === 0) return;\n\n root.recoverableErrors = [];\n\n for (const { error, info } of errors) {\n try {\n root.onRecoverableError(error, info);\n } catch {\n // Recoverable error reporting should not break a successful commit.\n }\n }\n }\n\n function flushCaughtBoundaryErrors(root: R): void {\n if (root.committedCaughtErrors.length > 0) {\n const boundaries = root.committedCaughtErrors;\n root.committedCaughtErrors = [];\n for (const boundary of boundaries) {\n flushCaughtBoundaryError(root, boundary);\n }\n }\n\n for (const boundary of root.commitIndex) {\n flushCaughtBoundaryError(root, boundary);\n }\n }\n\n function assertCaughtBoundaryErrorParity(node: F | null): void {\n walkFiberForest(node, (cursor) => {\n const state = fiberErrorBoundaryState(cursor);\n if (state !== null && !state.didReport) {\n throw new Error(\n \"Fig internal parity error: a caught boundary error was missing \" +\n \"from the commit index.\",\n );\n }\n });\n }\n\n function flushCaughtBoundaryError(root: R, node: F): void {\n const state = fiberErrorBoundaryState(node);\n if (state === null || state.didReport) return;\n\n state.didReport = true;\n if (node.alternate !== null) node.alternate.boundaryState = state;\n\n const onError = node.props.onError;\n if (typeof onError !== \"function\") return;\n\n try {\n (onError as (error: unknown, info: ErrorInfo) => void)(\n state.error,\n state.info,\n );\n } catch (error) {\n reportUncaughtError(root, error, errorInfoFor(node, error));\n }\n }\n\n function reportUncaughtError(root: R, error: unknown, info: ErrorInfo): void {\n try {\n root.onUncaughtError?.(error, info);\n } catch {\n // Error reporting should not corrupt already-failed recovery work.\n }\n }\n\n function clearRootAfterUncaughtError(root: R): void {\n root.reactiveCallback?.cancel();\n root.reactiveCallback = null;\n root.pendingReactiveEffects = [];\n root.element = null;\n\n if (root.current.child !== null) {\n deleteFiberDataTree(root.current.child);\n abortFiberEffects(root.current);\n }\n\n if (host.clearContainer !== undefined) {\n removePortalDescendants(root.current.child);\n host.clearContainer(root.container);\n } else if (root.current.child !== null) {\n let child: F | null = root.current.child;\n while (child !== null) {\n const next: F | null = child.sibling;\n remove(child, root.container);\n child = next;\n }\n }\n\n const current = fiber(RootTag, null, null, { children: null }, root);\n current.memoizedProps = current.props;\n current.committedProps = current.props;\n root.current = current;\n resetRootWork(root);\n root.clearContainerBeforeCommit = false;\n root.hydrationInitialElement = NoHydrationInitialElement;\n root.consumedPendingQueues = [];\n root.commitEffectPhases = 0;\n root.needsCommitDeletions = false;\n root.committedCaughtErrors.length = 0;\n markRootFinished(root, NoLanes);\n pendingRoots.delete(root);\n }\n\n function commitMutationEffects(node: F | null, hidden = false): void {\n let cursor = node;\n\n while (cursor !== null) {\n const subtreeMutation = (cursor.subtreeFlags & MutationMask) !== 0;\n\n if ((cursor.flags & MutationMask) === 0 && !subtreeMutation) {\n cursor = cursor.sibling;\n continue;\n }\n\n if ((cursor.flags & PlacementFlag) !== 0) {\n cursor = commitPlacementRun(cursor, hidden);\n continue;\n }\n\n if (cursor.tag === PortalTag) {\n commitPortal(cursor);\n }\n\n if (cursor.tag === ActivityTag && (cursor.flags & HydrationFlag) !== 0) {\n commitHydratedActivityBoundary(cursor);\n }\n\n // Hydration commits are position-sensitive (Activity templates unpack\n // above, Suspense boundaries commit below), so they stay in the walk\n // rather than the host-update queue pass.\n if (\n (cursor.flags & HydrationFlag) !== 0 &&\n (cursor.flags & HostUpdateMask) !== 0 &&\n isHost(cursor)\n ) {\n const hostFiber = cursor;\n commitHostMutation(hostFiber, () => commitUpdate(hostFiber));\n if (hidden) hideHostFiber(hostFiber);\n }\n\n if ((cursor.flags & AdoptedFlag) === 0 && subtreeMutation) {\n commitMutationEffects(cursor.child, hidden || isHiddenBoundary(cursor));\n }\n\n if (cursor.tag === SuspenseTag && (cursor.flags & HydrationFlag) !== 0) {\n commitHydratedSuspenseBoundary(cursor);\n }\n\n cursor = cursor.sibling;\n }\n }\n\n function commitPlacementRun(firstPlaced: F, hidden: boolean): F | null {\n const lastPlaced = placementRunTail(firstPlaced);\n const afterPlaced = lastPlaced.sibling;\n const before = hostSibling(lastPlaced);\n\n for (let placed: F | null = firstPlaced; placed !== afterPlaced;) {\n if (placed === null) break;\n\n const current: F = placed;\n const next: F | null = current.sibling;\n const placedHidden = hidden || isHiddenBoundary(current);\n // Hide (suspending binds) BEFORE inserting so attach paths in the\n // host's insertBefore never run binds on hidden content; hide again\n // after, since a placement update may rewrite the inline style.\n // Preassembled subtrees also pre-hide nested hidden boundaries'\n // content, which never gets a placement of its own.\n if (placedHidden) hidePlacedNode(current);\n if (hasHiddenBoundaries && isPreassembledHostSubtree(current)) {\n hideNestedBoundaryContent(current.child);\n }\n commitHostMutation(current, () => commitPlacement(current, before));\n if (placedHidden) hidePlacedNode(current);\n if (!isPreassembledHostSubtree(current)) {\n commitMutationEffects(current.child, placedHidden);\n } else {\n commitPortalsInPreassembledSubtree(current.child, placedHidden);\n }\n placed = next;\n }\n\n return afterPlaced;\n }\n\n // setNodeVisibility keeps a hidden boundary's own subtree untouched, but a\n // FRESH hidden boundary's content was never hidden; hide its children.\n function hidePlacedNode(node: F): void {\n if (isHiddenBoundary(node)) setSubtreeVisibility(node.child, true);\n else setNodeVisibility(node, true);\n }\n\n function hideNestedBoundaryContent(node: F | null): void {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if (isHiddenBoundary(cursor)) setSubtreeVisibility(cursor.child, true);\n hideNestedBoundaryContent(cursor.child);\n }\n }\n\n function commitPortalsInPreassembledSubtree(\n node: F | null,\n hidden: boolean,\n ): void {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n const cursorHidden = hidden || isHiddenBoundary(cursor);\n if (cursor.tag === PortalTag) {\n if (cursorHidden) setSubtreeVisibility(cursor.child, true);\n if (hasHiddenBoundaries) hideNestedBoundaryContent(cursor.child);\n commitHostMutation(cursor, () => commitPlacement(cursor));\n if (cursorHidden) setNodeVisibility(cursor, true);\n commitMutationEffects(cursor.child, cursorHidden);\n } else {\n commitPortalsInPreassembledSubtree(cursor.child, cursorHidden);\n }\n }\n }\n\n function commitHostMutation(source: F, mutation: () => void): void {\n try {\n mutation();\n } catch (error) {\n rootOf(source).uncaughtErrorInfo = errorInfoFor(source, error);\n throw error;\n }\n }\n\n function isPreassembledHostSubtree(node: F): boolean {\n return (node.flags & AssembledFlag) !== 0;\n }\n\n function placementRunTail(node: F): F {\n let tail = node;\n while (\n tail.sibling !== null &&\n (tail.sibling.flags & PlacementFlag) !== 0\n ) {\n tail = tail.sibling;\n }\n return tail;\n }\n\n function commitPlacement(\n node: F,\n before: HostNode<Instance, TextInstance> | null = hostSibling(node),\n ): void {\n if (isHost(node)) {\n if (node.tag === HostTag && isHoistedFiber(node)) {\n // First commit only: a move keeps the out-of-band instance in place.\n if (node.committedProps === null) acquireHoistedInstance(node);\n markHostCommitted(node);\n markHostSubtreeCommitted(node.child);\n return;\n }\n if (shouldCommitPlacementUpdate(node)) commitUpdate(node);\n host.insertBefore(hostParent(node), hostNode(node), before);\n markHostCommitted(node);\n if (isPreassembledHostSubtree(node)) markHostSubtreeCommitted(node.child);\n } else if (node.tag === PortalTag) {\n commitPortal(node);\n if (node.alternate !== null) insertPortalChildren(node);\n } else if (node.alternate !== null) {\n insertHostSubtree(node, hostParent(node), before);\n }\n }\n\n function commitPortal(node: F): void {\n host.preparePortalContainer?.(\n portalTarget(node),\n rootOf(node).container,\n hostParent(node),\n );\n }\n\n function shouldCommitPlacementUpdate(node: F): boolean {\n if ((node.flags & (UpdateFlag | TextContentFlag)) !== 0) return true;\n if (node.alternate !== null || node.tag === TextTag) return false;\n return host.finalizeInitialInstance === undefined;\n }\n\n function insertHostSubtree(\n node: F,\n parent: Parent<Container, Instance>,\n before: HostNode<Instance, TextInstance> | null,\n ): void {\n visitHostNodes(node, (child) => host.insertBefore(parent, child, before));\n }\n\n function insertPortalChildren(node: F): void {\n const parent = portalTarget(node);\n for (let child = node.child; child !== null; child = child.sibling) {\n visitHostNodes(child, (hostChild) =>\n host.insertBefore(parent, hostChild, null),\n );\n }\n }\n\n function commitUpdate(node: F): void {\n if (node.tag === TextTag) {\n host.commitTextUpdate(\n node.stateNode as TextInstance,\n String(node.props.nodeValue),\n );\n } else if (node.tag === HostTag && isHoistedFiber(node)) {\n commitHoistedUpdate(node);\n } else if (\n (node.flags & HydrationFlag) !== 0 &&\n host.commitHydratedInstance !== undefined\n ) {\n host.commitHydratedInstance(node.stateNode as Instance, node.props);\n } else {\n const previousProps = previousCommittedProps(node);\n\n if ((node.flags & UpdateFlag) !== 0) {\n host.commitUpdate(\n node.stateNode as Instance,\n previousProps,\n node.props,\n );\n }\n\n if ((node.flags & TextContentFlag) !== 0) {\n commitHostTextContent(node, previousProps);\n }\n }\n\n markHostCommitted(node);\n }\n\n function commitHoistedUpdate(node: F): void {\n const hoistedHost = requireHoistedAssetHostConfig();\n const previousProps = previousCommittedProps(node);\n const instance = node.stateNode as Instance;\n const next =\n hoistedHost.updateHoistedInstance(instance, previousProps, node.props) ??\n instance;\n\n if (next !== instance) {\n adoptSwappedHoistedInstance(node, next);\n return;\n }\n\n if ((node.flags & TextContentFlag) !== 0) {\n commitHostTextContent(node, previousProps);\n }\n }\n\n // The swapped-in instance starts fresh; adopt it on both alternates and\n // re-apply the fiber's text so updates target the live node.\n function adoptSwappedHoistedInstance(node: F, next: Instance): void {\n node.stateNode = next;\n if (node.alternate !== null) node.alternate.stateNode = next;\n\n const text = hostTextContent(node.props.children);\n if (text !== null) host.setTextContent?.(next, text);\n }\n\n function commitHydratedSuspenseBoundary(node: F): void {\n const boundary = dehydratedSuspenseBoundary(node.alternate);\n\n if (boundary === null) return;\n host.commitHydratedSuspenseBoundary?.(boundary);\n }\n\n function commitHydratedActivityBoundary(node: F): void {\n const state = fiberActivityState(node);\n if (state?.dehydrated == null) return;\n\n requireActivityHydrationHostConfig().commitHydratedActivityBoundary(\n state.dehydrated,\n );\n state.dehydrated = null;\n }\n\n function commitHostTextContent(node: F, previousProps: Props): void {\n if (host.setTextContent === undefined || node.tag !== HostTag) return;\n\n const nextText = hostTextContent(node.props.children);\n if (nextText !== null) {\n host.setTextContent(node.stateNode as Instance, nextText);\n } else if (hostTextContent(previousProps.children) !== null) {\n host.setTextContent(node.stateNode as Instance, \"\");\n }\n }\n\n function previousCommittedProps(node: F): Props {\n return (\n node.committedProps ??\n node.alternate?.committedProps ??\n node.alternate?.memoizedProps ??\n {}\n );\n }\n\n function markHostCommitted(node: F): void {\n if (!isHost(node)) return;\n node.committedProps = node.props;\n if (node.alternate !== null) node.alternate.committedProps = node.props;\n }\n\n function markHostSubtreeCommitted(node: F | null): void {\n walkFiberForest(node, (child) => {\n // Hoisted descendants were left out of complete-time assembly; acquire\n // them on the subtree's first commit (moves find committedProps set).\n if (child.committedProps === null && isHoistedFiber(child)) {\n acquireHoistedInstance(child);\n }\n markHostCommitted(child);\n });\n }\n\n function acquireHoistedInstance(node: F): void {\n const hoistedHost = requireHoistedAssetHostConfig();\n const instance = node.stateNode as Instance;\n const resolved = hoistedHost.commitHoistedInstance(instance) ?? instance;\n if (resolved === instance) return;\n\n // The identity resolved to a shared live instance (e.g. inserted while\n // this render was suspended); drop the stale duplicate.\n adoptSwappedHoistedInstance(node, resolved);\n }\n\n // Runs before the mutation walk, and owns only steady-state updates:\n // hydration commits stay in the walk (an Activity template must unpack\n // before its hydrated children bind, and Suspense boundary commits follow\n // their instances), and first commits stay with the placement/assembly\n // paths (committing an update first would set committedProps and defeat\n // hoisted acquisition and shouldCommitPlacementUpdate). Updates inside\n // subtrees the walk will place apply while those nodes are still at their\n // old position (or detached); the insertion carries them over.\n function commitHostUpdates(root: R): void {\n for (const cursor of root.commitIndex) {\n if ((cursor.flags & HostUpdateMask) === 0 || !isHost(cursor)) continue;\n if ((cursor.flags & (HydrationFlag | PlacementFlag)) !== 0) continue;\n // First commits belong to placement/assembly — except text, whose\n // first \"update\" is how hydration applies a differing value.\n if (cursor.committedProps === null && cursor.tag !== TextTag) continue;\n commitHostMutation(cursor, () => commitUpdate(cursor));\n // Prerendered mutations inside hidden trees must stay hidden.\n if (hasHiddenBoundaries && isInsideHiddenBoundary(cursor)) {\n hideHostFiber(cursor);\n }\n // Own-fiber update bits never reach subtreeFlags, so the flag-clearing\n // walk cannot be relied on to reach them; the pass owns their cleanup.\n cursor.flags &= ~HostUpdateMask;\n }\n }\n\n function assertHostUpdateCommitParity(node: F | null): void {\n walkFiberForest(node, (cursor) => {\n if (\n (cursor.flags & HostUpdateMask) !== 0 &&\n (cursor.flags & (HydrationFlag | PlacementFlag)) === 0 &&\n (cursor.committedProps !== null || cursor.tag === TextTag) &&\n isHost(cursor)\n ) {\n throw new Error(\n \"Fig internal parity error: a host fiber with pending updates \" +\n \"was missing from the commit index.\",\n );\n }\n\n return (cursor.flags & AdoptedFlag) === 0;\n });\n }\n\n function commitDeletions(root: R): void {\n const store = root.dataStore;\n for (const cursor of root.commitIndex) {\n if (cursor.deletions === null) continue;\n const parent = isHostParent(cursor)\n ? hostParentFor(cursor)\n : hostParent(cursor);\n for (const child of cursor.deletions) {\n // One walk, bounded to the deleted subtree: a deletion entry's old\n // sibling pointers still reference kept fibers whose hook state is\n // shared with the live generation, so a forest walk here would tear\n // down hooks that are still mounted.\n walkFiberSubtree(child, (deleted) => {\n deleteFiberDataOwner(deleted, store);\n abortFiberHooks(deleted, false);\n });\n // Deletion is the one event that invalidates a committed fiber\n // identity; record it at the source by severing the subtree root's\n // upward links (both generations die together). Every return chain\n // out of the deleted subtree passes through one of the root's two\n // generations, so anything that later schedules through a deleted\n // fiber — a late suspense retry, a setState from a stale closure —\n // fails root lookup and no-ops instead of marking phantom lanes.\n // Severing waits until here because the teardown above still\n // resolves roots through these chains.\n child.return = null;\n if (child.alternate !== null) child.alternate.return = null;\n remove(child, parent);\n }\n cursor.deletions = null;\n }\n }\n\n function assertDeletionCommitParity(node: F): void {\n walkFiberSubtree(node, (cursor) => {\n if (cursor.deletions !== null) {\n throw new Error(\n \"Fig internal parity error: a fiber with pending deletions was \" +\n \"missing from the commit index.\",\n );\n }\n\n return (\n (cursor.flags & AdoptedFlag) === 0 &&\n (cursor.subtreeFlags & DeletionFlag) !== 0\n );\n });\n }\n\n function commitDataDependencies(root: R): void {\n for (const cursor of root.commitIndex) {\n if (!cursor.dataDependenciesDirty) continue;\n root.dataStore.commitDataDependencies(cursor, cursor.alternate);\n cursor.dataDependenciesDirty = false;\n if (cursor.alternate !== null)\n cursor.alternate.dataDependenciesDirty = false;\n }\n }\n\n function assertDataDependencyCommitParity(node: F | null): void {\n walkFiberForest(node, (cursor) => {\n if (cursor.dataDependenciesDirty) {\n throw new Error(\n \"Fig internal parity error: a fiber with dirty data dependencies \" +\n \"was missing from the commit index.\",\n );\n }\n\n return (cursor.flags & AdoptedFlag) === 0;\n });\n }\n\n function deleteFiberDataTree(node: F): void {\n const store = rootOf(node).dataStore;\n walkFiberForest(node, (cursor) => {\n deleteFiberDataOwner(cursor, store);\n });\n }\n\n function deleteFiberDataOwner(node: F, store: R[\"dataStore\"]): void {\n store.releaseDataOwner(node);\n if (node.alternate !== null) store.releaseDataOwner(node.alternate);\n // A hidden boundary removed from the tree stops counting toward\n // `hasHiddenBoundaries`; both generations share the one state object.\n const state = fiberActivityState(node);\n if (state !== null) hiddenStates.delete(state);\n }\n\n function dehydratedActivityBoundary(node: F): Instance | null {\n return node.tag === ActivityTag\n ? (fiberActivityState(node)?.dehydrated ?? null)\n : null;\n }\n\n function remove(node: F, parent: Parent<Container, Instance>): void {\n const dehydratedActivity = dehydratedActivityBoundary(node);\n if (dehydratedActivity !== null) {\n host.removeChild(parent, dehydratedActivity);\n return;\n }\n\n const boundary = dehydratedSuspenseBoundary(node);\n if (\n boundary !== null &&\n host.removeDehydratedSuspenseBoundary !== undefined\n ) {\n host.removeDehydratedSuspenseBoundary(boundary);\n return;\n }\n\n if (node.tag === PortalTag) {\n removePortalChildren(node);\n host.removePortalContainer?.(portalTarget(node));\n return;\n }\n\n if (node.tag === HostTag && isHoistedFiber(node)) {\n if (node.committedProps !== null) {\n requireHoistedAssetHostConfig().removeHoistedInstance(\n node.stateNode as Instance,\n );\n }\n return;\n }\n\n if (isHost(node)) {\n removePortalDescendants(node.child);\n removeHoistedDescendants(node.child);\n host.removeChild(parent, hostNode(node));\n return;\n }\n\n for (let child = node.child; child !== null; child = child.sibling) {\n remove(child, parent);\n }\n }\n\n // Hoisted instances are not DOM descendants of the removed host, so the\n // top-node removal above never reaches them; release them explicitly.\n function removeHoistedDescendants(node: F | null): void {\n if (host.isHoistedInstance === undefined) return;\n\n for (let child = node; child !== null; child = child.sibling) {\n if (child.tag === PortalTag) continue;\n\n if (child.tag === HostTag && isHoistedFiber(child)) {\n if (child.committedProps !== null && child.stateNode !== null) {\n requireHoistedAssetHostConfig().removeHoistedInstance(\n child.stateNode as Instance,\n );\n }\n continue;\n }\n\n removeHoistedDescendants(child.child);\n }\n }\n\n function removePortalChildren(node: F): void {\n const parent = portalTarget(node);\n for (let child = node.child; child !== null; child = child.sibling) {\n remove(child, parent);\n }\n }\n\n function removePortalDescendants(node: F | null): void {\n for (let child = node; child !== null; child = child.sibling) {\n if (child.tag === PortalTag) {\n removePortalChildren(child);\n host.removePortalContainer?.(portalTarget(child));\n } else {\n removePortalDescendants(child.child);\n }\n }\n }\n\n function visitHostNodes(\n node: F,\n visitor: (node: HostNode<Instance, TextInstance>) => void,\n ): void {\n if (isHost(node)) {\n // Both callers insert host nodes into a position; hoisted instances\n // live out-of-band and must never be moved to a fiber position.\n if (node.tag === HostTag && isHoistedFiber(node)) return;\n visitor(hostNode(node));\n return;\n }\n\n if (node.tag === PortalTag) return;\n\n for (let child = node.child; child !== null; child = child.sibling) {\n visitHostNodes(child, visitor);\n }\n }\n\n function hostParent(node: F): Parent<Container, Instance> {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (isHostParent(parent)) return hostParentFor(parent);\n }\n\n throw new Error(\"Could not find a host parent for fiber.\");\n }\n\n function hostAncestorTypes(node: F): string[] {\n const ancestors: string[] = [];\n\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (parent.tag === HostTag) {\n ancestors.push(String(parent.type));\n continue;\n }\n\n // Fiber ancestry ends at portals and roots; seed the container's own\n // tag so nesting against the render target is still validated.\n if (parent.tag === PortalTag || parent.tag === RootTag) {\n const container = host.containerType?.(hostParentFor(parent));\n if (container != null) ancestors.push(container);\n break;\n }\n }\n\n return ancestors;\n }\n\n function hostSibling(node: F): HostNode<Instance, TextInstance> | null {\n const dehydratedBoundary = dehydratedSuspenseParent(node);\n if (dehydratedBoundary !== null) return dehydratedBoundary.start;\n\n let cursor: F = node;\n\n search: while (true) {\n while (cursor.sibling === null) {\n if (cursor.return === null || isHostParent(cursor.return)) {\n return null;\n }\n cursor = cursor.return;\n }\n\n cursor = cursor.sibling;\n\n while (!isHost(cursor)) {\n const dehydratedActivity = dehydratedActivityBoundary(cursor);\n if (dehydratedActivity !== null) return dehydratedActivity;\n\n if (\n cursor.tag === PortalTag ||\n (cursor.flags & PlacementFlag) !== 0 ||\n cursor.child === null\n ) {\n continue search;\n }\n cursor = cursor.child;\n }\n\n if ((cursor.flags & PlacementFlag) === 0 && !isHoistedFiber(cursor)) {\n return hostNode(cursor);\n }\n }\n }\n\n function dehydratedSuspenseParent(\n node: F,\n ): DehydratedSuspenseBoundary<Instance, TextInstance> | null {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if ((parent.flags & HydrationFlag) !== 0) {\n const boundary = dehydratedSuspenseBoundary(parent.alternate);\n if (\n boundary !== null &&\n (boundary.status !== \"completed\" || boundary.forceClientRender)\n ) {\n return boundary;\n }\n }\n\n if (isHostParent(parent)) return null;\n }\n\n return null;\n }\n\n function isHostParent(node: F): boolean {\n return (\n node.tag === RootTag || node.tag === HostTag || node.tag === PortalTag\n );\n }\n\n function hostParentFor(node: F): Parent<Container, Instance> {\n if (node.tag === RootTag) return (node.stateNode as R).container;\n if (node.tag === HostTag) return node.stateNode as Instance;\n return portalTarget(node);\n }\n\n function dehydratedSuspenseBoundary(\n node: F | null | undefined,\n ): DehydratedSuspenseBoundary<Instance, TextInstance> | null {\n const state = fiberSuspenseState(node);\n return state?.kind === \"dehydrated\" ? state.boundary : null;\n }\n\n function fiberSuspenseState(\n node: F | null | undefined,\n ): SuspenseState<Container, Instance, TextInstance> | null {\n return node?.tag === SuspenseTag\n ? (node.boundaryState as SuspenseState<\n Container,\n Instance,\n TextInstance\n > | null)\n : null;\n }\n\n function fiberErrorBoundaryState(\n node: F | null | undefined,\n ): ErrorBoundaryState | null {\n return node?.tag === ErrorBoundaryTag\n ? (node.boundaryState as ErrorBoundaryState | null)\n : null;\n }\n\n function fiberActivityState(\n node: F | null | undefined,\n ): ActivityState<Instance> | null {\n return node?.tag === ActivityTag\n ? (node.boundaryState as ActivityState<Instance> | null)\n : null;\n }\n\n function ensureFiberActivityState(node: F): ActivityState<Instance> {\n const current = fiberActivityState(node);\n if (current !== null) return current;\n\n const state = { hidden: false, dehydrated: null };\n node.boundaryState = state;\n return state;\n }\n\n function scheduleFiber(node: F, lane: Lane): void {\n markLanes(node, lane);\n const root = scheduleParentPath(node.return, lane);\n const alternateRoot = scheduleParentPath(\n node.alternate?.return ?? null,\n lane,\n );\n const scheduledRoot = root ?? alternateRoot;\n if (scheduledRoot === null) return;\n\n markRootPending(scheduledRoot, lane);\n scheduleOrBatchRoot(scheduledRoot);\n }\n\n function scheduleParentPath(parent: F | null, lane: Lane): R | null {\n for (; parent !== null; parent = parent.return) {\n markChildLanes(parent, lane);\n\n if (parent.tag === RootTag) {\n return parent.stateNode as R;\n }\n }\n\n return null;\n }\n\n function attachPing(root: R, thenable: Thenable, lanes: Lanes): void {\n if (lanes === NoLanes) return;\n\n const previousLanes = root.suspendedThenables.get(thenable) ?? NoLanes;\n root.suspendedThenables.set(thenable, mergeLanes(previousLanes, lanes));\n\n if (previousLanes !== NoLanes) return;\n thenable.then(\n () => ping(root, thenable),\n () => ping(root, thenable),\n );\n }\n\n function ping(root: R, thenable: object): void {\n const lanes = root.suspendedThenables.get(thenable) ?? NoLanes;\n if (lanes === NoLanes) return;\n\n root.suspendedThenables.delete(thenable);\n markRootPinged(root, lanes);\n pendingRoots.add(root);\n scheduleRoot(root);\n }\n\n function findSuspenseBoundary(node: F): F | null {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (parent.tag === SuspenseTag && fiberSuspenseState(parent) === null) {\n return parent;\n }\n }\n\n return null;\n }\n\n function findErrorBoundary(node: F): F | null {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (\n parent.tag === ErrorBoundaryTag &&\n fiberErrorBoundaryState(parent) === null\n ) {\n return parent;\n }\n }\n\n return null;\n }\n\n function captureSuspenseBoundary(boundary: F, thenable: Thenable): F | null {\n const root = rootOf(boundary);\n const lanes = root.renderLanes;\n // Two pings per suspension. The root ping is identity-free: if this\n // render never commits (preserved suspension, restart, interruption),\n // the resolved thenable revives the suspended lanes at the root, and it\n // no-ops once the lanes committed (markRootPinged masks by\n // suspendedLanes). The boundary retry is recorded here but attached only\n // at commit, to the fiber identity the commit blessed.\n attachPing(root, thenable, lanes);\n root.pendingSuspenseRetries.push({ boundary, thenable, lanes });\n rollbackCommitIndex(root.commitIndex, boundary.commitIndexCheckpoint);\n // The boundary's own deletions (e.g. the committed fallback recorded by\n // the reveal path) belong to the boundary, not its discarded subtree;\n // requeue them. Paths that discard them null boundary.deletions, which\n // leaves this entry inert.\n if (boundary.deletions !== null)\n recordCommitWork(root.commitIndex, boundary);\n\n const dehydrated = fiberSuspenseState(boundary.alternate);\n if (\n root.hydratingSuspenseBoundary === boundary &&\n dehydrated?.kind === \"dehydrated\"\n ) {\n // Hydrating this boundary suspended. Abandon the attempt and stay\n // dehydrated so the server-rendered content survives; the retry\n // recorded above re-attempts hydration once the thenable settles, so\n // commit-time dehydrated retry scheduling must skip the boundary until\n // then.\n leaveSuspenseHydration(root, boundary, dehydrated.boundary);\n boundary.boundaryState = dehydrated;\n boundary.flags &= ~HydrationFlag;\n boundary.child = null;\n abandonedHydrationBoundaries.add(boundary);\n if (boundary.alternate !== null) {\n abandonedHydrationBoundaries.add(boundary.alternate);\n }\n return completeUnit(boundary);\n }\n\n if (shouldPreserveSuspenseBoundary(root, boundary)) {\n markRootSuspended(root, lanes);\n throw PreservedSuspense;\n }\n\n const currentPrimary = suspensePrimaryFiber(boundary.alternate);\n if (currentPrimary !== null) {\n boundary.boundaryState = { kind: \"fallback\", primaryChild: null };\n boundary.deletions = null;\n restoreConsumedPendingQueuesForRetry(\n root,\n boundary.suspenseQueueStart ?? root.consumedPendingQueues.length,\n );\n hasHiddenBoundaries = true;\n const primary = suspensePrimaryWorkInProgress(\n boundary,\n currentPrimary,\n \"hidden\",\n );\n primary.child = cloneSuspendedPrimary(currentPrimary.child, primary);\n primary.flags |= VisibilityFlag;\n primary.memoizedProps = primary.props;\n // The hidden primary is committed but not begun/completed this pass, so\n // its lanes are not recomputed — clear them (and the boundary will not see\n // OffscreenLane work blocked behind the still-suspended boundary).\n primary.lanes = NoLanes;\n primary.childLanes = NoLanes;\n boundary.child = primary;\n\n const fallback = suspenseFallbackWorkInProgress(\n boundary,\n currentPrimary.sibling,\n 1,\n );\n primary.sibling = fallback;\n return fallback;\n }\n\n // There is no committed primary on an initial suspension. Keep the partial\n // render only as retry input; committing it hidden would publish an\n // incomplete host tree.\n boundary.boundaryState = {\n kind: \"fallback\",\n primaryChild:\n boundary.child?.tag === ActivityTag && boundary.child.type === null\n ? boundary.child.child\n : boundary.child,\n };\n const fallback = suspenseFallbackWorkInProgress(boundary, null, 0);\n boundary.child = fallback;\n return fallback;\n }\n\n function captureErrorBoundary(\n boundary: F,\n error: unknown,\n source: F,\n ): F | null {\n const root = rootOf(boundary);\n rollbackCommitIndex(root.commitIndex, boundary.commitIndexCheckpoint);\n recordCommitWork(root.commitIndex, boundary);\n const state = createErrorBoundaryState(error, source);\n boundary.boundaryState = state;\n reconcileCurrentChildren(boundary, errorBoundaryFallback(boundary, state));\n return boundary.child ?? completeUnit(boundary);\n }\n\n function captureCommittedErrorBoundary(\n boundary: F,\n error: unknown,\n source: F,\n ): void {\n rootOf(boundary).committedCaughtErrors.push(boundary);\n const state = createErrorBoundaryState(error, source);\n boundary.boundaryState = state;\n if (boundary.alternate !== null) boundary.alternate.boundaryState = state;\n }\n\n function createErrorBoundaryState(\n error: unknown,\n source: F,\n ): ErrorBoundaryState {\n return {\n error,\n info: errorInfoFor(source, error),\n didReport: false,\n };\n }\n\n function shouldPreserveSuspenseBoundary(root: R, boundary: F): boolean {\n return (\n boundary.alternate !== null &&\n fiberSuspenseState(boundary.alternate) === null &&\n isTransitionOrDeferredRender(root)\n );\n }\n\n // Boundary retries attach here, after the tree flipped: the recorded fiber\n // is in the committed tree by construction, so no tree-membership question\n // ever arises. A retry that fires after the boundary is deleted no-ops in\n // scheduleFiber, because deletion teardown severs the deleted subtree's\n // upward links and root lookup finds nothing.\n function attachCommittedSuspenseRetries(\n root: R,\n retries: PendingSuspenseRetry<Container, Instance, TextInstance>[],\n ): void {\n for (const { boundary, thenable, lanes } of retries) {\n // A boundary that re-suspends on a still-pending thenable in a later\n // commit would otherwise stack duplicate listeners; one per conceptual\n // boundary (either generation) is enough.\n let attached = root.attachedSuspenseRetries.get(thenable);\n if (attached === undefined) {\n attached = new WeakSet();\n root.attachedSuspenseRetries.set(thenable, attached);\n }\n if (\n attached.has(boundary) ||\n (boundary.alternate !== null && attached.has(boundary.alternate))\n ) {\n continue;\n }\n attached.add(boundary);\n\n const retry = () => scheduleFiber(boundary, suspenseRetryLane(lanes));\n thenable.then(retry, retry);\n }\n }\n\n // Context propagation is lazy: providers push new values without walking\n // their subtree, so a subtree about to be skipped is the only place a stale\n // consumer could get stranded. Every skip point (clean-childLanes bailout)\n // checks the providers above it and marks the consumers it is about to skip.\n // Consumers that are begun anyway are covered by canBailout's memoized\n // dependency check, so no eager walk is needed. Returns whether the node's\n // childLanes now intersect the render lanes; the early-false paths rely on\n // the caller only asking when childLanes were already clean.\n function lazilyPropagateParentContextChanges(node: F, root: R): boolean {\n if ((node.flags & ContextPropagationFlag) !== 0) return false;\n\n const contexts = changedParentContexts(node);\n node.flags |= ContextPropagationFlag;\n if (contexts === null) return false;\n\n const current = node.alternate;\n if (current === null) return false;\n\n for (const context of contexts) {\n if (!contextListIncludes(current.contextSubtreeDependencies, context)) {\n continue;\n }\n\n for (let child = current.child; child !== null; child = child.sibling) {\n markContextConsumers(child, current, context, root.renderLanes);\n }\n }\n\n return includesSomeLane(node.childLanes, root.renderLanes);\n }\n\n function changedParentContexts(node: F): FigContext<unknown>[] | null {\n let seen =\n node.tag === ContextProviderTag\n ? [node.type as unknown as FigContext<unknown>]\n : null;\n let changed: FigContext<unknown>[] | null = null;\n\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if ((parent.flags & ContextPropagationFlag) !== 0) break;\n if (parent.tag !== ContextProviderTag) continue;\n\n const context = parent.type as unknown as FigContext<unknown>;\n if (contextListIncludes(seen, context)) continue;\n seen = appendContext(seen, context);\n if (changedContextProvider(parent)) {\n changed = appendContext(changed, context);\n }\n }\n\n return changed;\n }\n\n function markContextConsumers(\n node: F,\n propagationRoot: F,\n context: FigContext<unknown>,\n lanes: Lanes,\n ): void {\n if (\n node.tag === ContextProviderTag &&\n node.type === (context as unknown as ElementType | null)\n ) {\n return;\n }\n\n if (contextDependency(node, context) !== null) {\n markLanes(node, lanes);\n markParentPath(node, propagationRoot, lanes);\n }\n\n if (!contextListIncludes(node.contextSubtreeDependencies, context)) return;\n\n for (let child = node.child; child !== null; child = child.sibling) {\n markContextConsumers(child, propagationRoot, context, lanes);\n }\n }\n\n // Marks childLanes up to and including stopAt: stopAt is the skip point\n // whose childLanes gate whether its subtree is adopted or descended into.\n function markParentPath(node: F, stopAt: F, lanes: Lanes): void {\n for (\n let parent = node.return;\n parent !== null && parent !== stopAt;\n parent = parent.return\n ) {\n markChildLanes(parent, lanes);\n }\n\n markChildLanes(stopAt, lanes);\n }\n\n function markLanes(node: F, lane: Lane): void {\n node.lanes = mergeLanes(node.lanes, lane);\n if (node.alternate !== null) {\n node.alternate.lanes = mergeLanes(node.alternate.lanes, lane);\n }\n }\n\n function markChildLanes(node: F, lane: Lane): void {\n node.childLanes = mergeLanes(node.childLanes, lane);\n if (node.alternate !== null) {\n node.alternate.childLanes = mergeLanes(node.alternate.childLanes, lane);\n }\n }\n\n function markSubtreeFlag(node: F, flag: Flag): void {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n parent.subtreeFlags |= flag;\n }\n }\n\n function createWorkInProgress(current: F, props: Props): F {\n const next =\n current.alternate ??\n fiber(current.tag, current.type, current.key, props, current.stateNode);\n\n next.props = props;\n next.memoizedProps = current.memoizedProps;\n next.committedProps = current.committedProps;\n next.memoizedState = current.memoizedState;\n next.stateNode = current.stateNode;\n next.return = current.return;\n next.child = null;\n next.sibling = null;\n next.index = current.index;\n next.flags = NoFlags;\n next.subtreeFlags = NoFlags;\n next.deletions = null;\n next.lanes = current.lanes;\n next.childLanes = current.childLanes;\n next.effects = null;\n next.contextDependencies = current.contextDependencies;\n next.contextSubtreeDependencies = current.contextSubtreeDependencies;\n next.dataDependenciesDirty = false;\n next.boundaryState = current.boundaryState;\n next.hiddenState = null;\n next.alternate = current;\n current.alternate = next;\n\n return next;\n }\n\n function cloneChildFibers(parent: F): void {\n let current = parent.alternate?.child ?? null;\n let previous: F | null = null;\n parent.child = null;\n parent.deletions = null;\n\n while (current !== null) {\n const next = createWorkInProgress(current, current.props);\n next.return = parent;\n\n previous = appendChild(parent, previous, next);\n current = current.sibling;\n }\n }\n\n function appendChild(parent: F, previous: F | null, child: F): F {\n if (previous === null) parent.child = child;\n else previous.sibling = child;\n return child;\n }\n\n function fiberFrom(child: NormalizedChild): F | null {\n if (typeof child === \"string\") {\n return fiber(TextTag, null, null, { nodeValue: child }, null);\n }\n\n if (isPortal(child)) {\n return fiber(PortalTag, null, child.key, portalProps(child), null);\n }\n\n if (!isValidElement(child)) return null;\n\n return fiber(tagFor(child), child.type, child.key, child.props, null);\n }\n\n function portalTarget(node: F): Parent<Container, Instance> {\n return node.props.target as Parent<Container, Instance>;\n }\n\n function fiber(\n tag: Tag,\n type: ElementType | null,\n key: string | number | null,\n props: Props,\n stateNode: F[\"stateNode\"],\n ): F {\n return {\n tag,\n type,\n key,\n props,\n memoizedProps: null,\n committedProps: null,\n memoizedState: null,\n stateNode,\n return: null,\n child: null,\n sibling: null,\n index: 0,\n alternate: null,\n flags: NoFlags,\n subtreeFlags: NoFlags,\n deletions: null,\n lanes: NoLanes,\n childLanes: NoLanes,\n effects: null,\n contextDependencies: null,\n contextSubtreeDependencies: null,\n dataDependenciesDirty: false,\n boundaryState: null,\n hiddenState: null,\n };\n }\n\n function rootOf(node: F): R {\n const root = rootOfOrNull(node);\n if (root === null) throw new Error(\"Could not find a root for fiber.\");\n return root;\n }\n\n // Deletion teardown severs return pointers, so fibers held past unmount\n // (transition starters, stale closures) legitimately have no root. Paths\n // reachable from user code after unmount take this form; render- and\n // commit-time paths keep the throwing rootOf invariant.\n function rootOfOrNull(node: F): R | null {\n for (let parent: F | null = node; parent !== null; parent = parent.return) {\n if (parent.tag === RootTag) return parent.stateNode as R;\n }\n\n return null;\n }\n\n function errorInfoFor(node: F, error?: unknown): ErrorInfo {\n const dataResourceKeys =\n error === undefined ? undefined : dataResourceKeysForError(error);\n\n return dataResourceKeys === undefined\n ? { componentStack: componentStackFor(node) }\n : { componentStack: componentStackFor(node), dataResourceKeys };\n }\n\n function queueRecoverableError(\n root: R,\n node: F,\n error: unknown,\n details: RecoverableDetails,\n ): void {\n root.recoverableErrors.push({\n error,\n info: { ...details, componentStack: componentStackFor(node) },\n });\n }\n\n function componentStackFor(node: F): string {\n const frames: string[] = [];\n\n for (let fiber: F | null = node; fiber !== null; fiber = fiber.return) {\n const name = componentStackName(fiber);\n if (name !== null) frames.push(` at ${name}`);\n }\n\n return frames.length === 0 ? \"\" : `\\n${frames.join(\"\\n\")}`;\n }\n\n function componentStackName(node: F): string | null {\n switch (node.tag) {\n case FunctionTag:\n return devtoolsTypeName(node.type, \"Anonymous\");\n case ContextProviderTag:\n return `${devtoolsTypeName(node.type, \"Context\")}.Provider`;\n case SuspenseTag:\n return \"Suspense\";\n case ErrorBoundaryTag:\n return \"ErrorBoundary\";\n case ViewTransitionTag:\n return \"ViewTransition\";\n case PortalTag:\n return \"Portal\";\n case AssetsTag:\n return \"Assets\";\n default:\n return null;\n }\n }\n\n return {\n batchedUpdates,\n createRoot,\n hydrateRoot,\n hydrateTarget,\n flushSync,\n scheduleRefresh,\n };\n\n // Re-render every mounted instance of a changed component family. Updated\n // families re-render in place (hook state preserved); stale families (hook\n // signature changed) remount via their parent. The refresh runtime swaps each\n // family's `current` before calling this.\n // Each refresh function wraps its whole body in a block-form dev gate\n // (not an early return: esbuild only drops the bodies — and with them the\n // machinery — via parse-time branch elimination) so production builds ship\n // empty stubs.\n function scheduleRefresh(update: RefreshUpdate): void {\n if (__DEV__) {\n if (!hasRefreshHandler() || mountedRoots.size === 0) return;\n\n runWithStaleRefreshFamilies(update.staleFamilies, () => {\n flushSync(() => {\n for (const root of mountedRoots) {\n scheduleFamilyRefresh(root.current.child, update);\n }\n });\n });\n }\n }\n\n function scheduleFamilyRefresh(node: F | null, update: RefreshUpdate): void {\n if (__DEV__) {\n if (node === null) return;\n\n if (node.tag === FunctionTag && hasRefreshHandler()) {\n const family = refreshFamilyFor(node.type);\n if (family !== undefined) {\n if (update.staleFamilies.has(family)) {\n remountForRefresh(node);\n } else if (update.updatedFamilies.has(family)) {\n // Mark the instance dirty so render bailouts don't skip it.\n scheduleFiber(node, SyncLane);\n }\n }\n }\n\n scheduleFamilyRefresh(node.child, update);\n scheduleFamilyRefresh(node.sibling, update);\n }\n }\n\n // A stale component must drop its hook state. Re-render its parent so the\n // child reconciles as an incompatible type and remounts; for a top-level\n // component re-render the whole root.\n function remountForRefresh(node: F): void {\n if (__DEV__) {\n const parent = node.return;\n if (parent === null || parent.tag === RootTag) {\n const root = rootOf(node);\n updateRoot(root, root.element);\n } else {\n scheduleFiber(parent, SyncLane);\n }\n }\n }\n\n function findDehydratedSuspenseBoundaryForTarget(\n node: F | null,\n target: unknown,\n ): F | null {\n if (node === null || host.isTargetWithinSuspenseBoundary === undefined) {\n return null;\n }\n\n const state = fiberSuspenseState(node);\n if (\n state?.kind === \"dehydrated\" &&\n host.isTargetWithinSuspenseBoundary(target, state.boundary)\n ) {\n return node;\n }\n\n return (\n findDehydratedSuspenseBoundaryForTarget(node.child, target) ??\n findDehydratedSuspenseBoundaryForTarget(node.sibling, target)\n );\n }\n\n function isHiddenBoundary(node: F): boolean {\n return isHiddenBoundaryTag(node) && activityHidden(node.props);\n }\n\n function isHiddenBoundaryTag(node: F): boolean {\n return node.tag === ActivityTag;\n }\n\n function requireActivityHostConfig(): HostConfig<\n Container,\n Instance,\n TextInstance\n > &\n Required<\n Pick<\n HostConfig<Container, Instance, TextInstance>,\n | \"hideInstance\"\n | \"unhideInstance\"\n | \"hideTextInstance\"\n | \"unhideTextInstance\"\n >\n > {\n if (activityHostConfig !== null) return activityHostConfig;\n\n if (\n host.hideInstance === undefined ||\n host.unhideInstance === undefined ||\n host.hideTextInstance === undefined ||\n host.unhideTextInstance === undefined\n ) {\n throw new Error(\"Activity is not supported by this renderer.\");\n }\n\n activityHostConfig = host as ReturnType<typeof requireActivityHostConfig>;\n return activityHostConfig;\n }\n\n function commitHiddenBoundaryVisibility(\n node: F | null,\n hidden = false,\n ): void {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if ((cursor.flags & AdoptedFlag) !== 0) continue;\n const subtreeVisibility = (cursor.subtreeFlags & VisibilityFlag) !== 0;\n\n if ((cursor.flags & VisibilityFlag) === 0 && !subtreeVisibility) {\n continue;\n }\n\n const boundary = isHiddenBoundaryTag(cursor);\n const boundaryHidden = boundary && activityHidden(cursor.props);\n\n if (boundary && (cursor.flags & VisibilityFlag) !== 0) {\n const effectiveHidden = hidden || boundaryHidden;\n const state = fiberActivityState(cursor);\n if (state !== null) {\n state.hidden = effectiveHidden;\n if (effectiveHidden) hiddenStates.add(state);\n else hiddenStates.delete(state);\n }\n setSubtreeVisibility(cursor.child, effectiveHidden);\n if (effectiveHidden && cursor.child !== null)\n abortFiberEffects(cursor.child, true);\n if (\n !effectiveHidden &&\n includesSomeLane(cursor.childLanes, OffscreenLane)\n ) {\n // Pending hidden work upgrades to prompt processing on reveal.\n const root = rootOf(cursor);\n markRootPending(root, DefaultLane);\n markRootEntangled(root, DefaultLane | OffscreenLane);\n scheduleOrBatchRoot(root);\n }\n }\n\n if (subtreeVisibility) {\n commitHiddenBoundaryVisibility(cursor.child, hidden || boundaryHidden);\n }\n }\n }\n\n function setSubtreeVisibility(node: F | null, hidden: boolean): void {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n setNodeVisibility(cursor, hidden);\n }\n }\n\n function setNodeVisibility(cursor: F, hidden: boolean): void {\n // Subtrees hidden by their own boundary keep their visibility.\n if (isHiddenBoundary(cursor)) return;\n\n if (cursor.tag === HostTag) {\n const activityHost = requireActivityHostConfig();\n if (hidden) activityHost.hideInstance(cursor.stateNode as Instance);\n else {\n activityHost.unhideInstance(cursor.stateNode as Instance, cursor.props);\n }\n } else if (cursor.tag === TextTag) {\n const activityHost = requireActivityHostConfig();\n if (hidden) {\n activityHost.hideTextInstance(cursor.stateNode as TextInstance);\n } else {\n activityHost.unhideTextInstance(\n cursor.stateNode as TextInstance,\n String(cursor.props.nodeValue),\n );\n }\n }\n\n setSubtreeVisibility(cursor.child, hidden);\n }\n\n function hideHostFiber(node: F): void {\n const activityHost = requireActivityHostConfig();\n if (node.tag === HostTag) {\n activityHost.hideInstance(node.stateNode as Instance);\n } else {\n activityHost.hideTextInstance(node.stateNode as TextInstance);\n }\n }\n\n function armRevealedHiddenBoundaries(node: F | null): void {\n for (let cursor = node; cursor !== null; cursor = cursor.sibling) {\n if ((cursor.flags & AdoptedFlag) !== 0) continue;\n const subtreeVisibility = (cursor.subtreeFlags & VisibilityFlag) !== 0;\n\n if ((cursor.flags & VisibilityFlag) === 0 && !subtreeVisibility) {\n continue;\n }\n\n if (\n isHiddenBoundaryTag(cursor) &&\n (cursor.flags & VisibilityFlag) !== 0 &&\n !activityHidden(cursor.props) &&\n cursor.child !== null\n ) {\n armDeferredEffects(cursor.child);\n }\n\n if (subtreeVisibility) armRevealedHiddenBoundaries(cursor.child);\n }\n }\n\n // Re-arms effects that were deferred or aborted while hidden so the\n // regular commit phases run them in order during the reveal commit.\n function armDeferredEffects(node: F): void {\n visitFiberHooks(node, (owner, hook) => {\n if (hook.kind === StableEventHook) {\n const state = hook.memoizedState as StableEventState;\n const instance = state.instance;\n instance.handler = state.next;\n instance.live = true;\n return;\n }\n\n if (!isEffectHook(hook.kind)) return;\n\n const effect = hook.memoizedState as Effect;\n if (effect.controller !== null) return;\n\n const effects = (owner.effects ??= []);\n if (!effects.includes(effect)) effects.push(effect);\n const root = rootOf(owner);\n recordCommitWork(root.commitIndex, owner, EffectFlag);\n markSubtreeFlag(owner, EffectFlag);\n markCommitEffectPhase(root, effect.phase);\n // Re-armed owners that did not re-render are not in the commit index\n // yet; the arming pass runs before every effect pass consumes it.\n });\n }\n\n function commitLiveHookInstances(root: R): void {\n for (const owner of root.commitIndex) {\n for (let hook = owner.memoizedState; hook !== null; hook = hook.next) {\n commitLiveHookInstance(owner, hook);\n }\n }\n }\n\n function commitLiveHookInstance(owner: F, hook: Hook): void {\n if (isStableEventHook(hook)) {\n const instance = hook.memoizedState.instance;\n instance.handler = hook.memoizedState.next;\n instance.live = !hasHiddenBoundaries || !isInsideHiddenBoundary(owner);\n }\n\n if (hook.kind === ActionStateHook) {\n const state = hook.memoizedState as ActionState<unknown, unknown[]>;\n state.instance.action = state.action;\n state.instance.value = state.value;\n }\n }\n\n // Bailed-out (cloned) fibers share their hook state objects with the last\n // rendered generation, so their instances already hold the published\n // values; the queue therefore only carries rendered fibers. This walk\n // proves that assumption on every dev commit.\n function assertLiveHookInstanceParity(node: F | null): void {\n visitRenderedFiberHooks(node, (owner, hook) => {\n if (isStableEventHook(hook)) {\n const instance = hook.memoizedState.instance;\n if (\n instance.handler !== hook.memoizedState.next ||\n instance.live !==\n (!hasHiddenBoundaries || !isInsideHiddenBoundary(owner))\n ) {\n throw new Error(\n \"Fig internal parity error: a stable-event hook was not \" +\n \"published by the commit index.\",\n );\n }\n }\n\n if (hook.kind === ActionStateHook) {\n const state = hook.memoizedState as ActionState<unknown, unknown[]>;\n if (\n state.instance.action !== state.action ||\n state.instance.value !== state.value\n ) {\n throw new Error(\n \"Fig internal parity error: an action-state hook was not \" +\n \"published by the commit index.\",\n );\n }\n }\n });\n }\n\n function isInsideHiddenBoundary(node: F): boolean {\n for (let parent = node.return; parent !== null; parent = parent.return) {\n if (isHiddenBoundary(parent)) return true;\n }\n\n return false;\n }\n\n function isStableEventHook(hook: Hook): hook is Hook<StableEventState> {\n return hook.kind === StableEventHook;\n }\n\n function commitExternalStores(root: R): void {\n for (const cursor of root.commitIndex) {\n if ((cursor.flags & StoreConsistencyFlag) === 0) continue;\n // Subscriptions under hidden boundaries are deferred until reveal.\n if (hasHiddenBoundaries && isInsideHiddenBoundary(cursor)) continue;\n for (let hook = cursor.memoizedState; hook !== null; hook = hook.next) {\n if (isExternalStoreHook(hook))\n commitExternalStore(root, cursor, hook.memoizedState);\n }\n }\n }\n\n function assertExternalStoreCommitParity(node: F | null): void {\n walkFiberForest(node, (cursor) => {\n if ((cursor.flags & AdoptedFlag) !== 0) return false;\n\n if ((cursor.flags & StoreConsistencyFlag) !== 0) {\n for (let hook = cursor.memoizedState; hook !== null; hook = hook.next) {\n if (!isExternalStoreHook(hook)) continue;\n const state = hook.memoizedState;\n const instance = state.instance;\n if (\n instance.committedSubscribe !== state.subscribe ||\n instance.getSnapshot !== state.getSnapshot ||\n instance.owner !== cursor ||\n !Object.is(instance.value, state.value)\n ) {\n throw new Error(\n \"Fig internal parity error: an external-store hook was not \" +\n \"committed by the commit index.\",\n );\n }\n }\n }\n\n return (\n !isHiddenBoundary(cursor) &&\n (cursor.subtreeFlags & StoreConsistencyFlag) !== 0\n );\n });\n }\n\n function commitExternalStore(\n root: R,\n owner: F,\n state: ExternalStoreState<unknown, F>,\n ): void {\n const instance = state.instance;\n\n if (instance.committedSubscribe !== state.subscribe) {\n instance.unsubscribe?.();\n instance.unsubscribe = null;\n instance.committedSubscribe = state.subscribe;\n }\n\n instance.getSnapshot = state.getSnapshot;\n instance.owner = owner;\n instance.value = state.value;\n root.externalStores.add(instance);\n instance.unsubscribe ??= state.subscribe(() => {\n scheduleExternalStoreIfChanged(\n instance.owner,\n instance,\n requestExternalStoreUpdateLane(),\n );\n });\n scheduleExternalStoreIfChanged(instance.owner, instance, SyncLane);\n }\n\n function scheduleExternalStoreIfChanged(\n owner: F | null,\n instance: ExternalStoreInstance<unknown, F>,\n lane: Lane,\n ): void {\n if (owner === null) return;\n\n const latestValue = instance.getSnapshot();\n if (!Object.is(latestValue, instance.value)) scheduleFiber(owner, lane);\n }\n\n function requestExternalStoreUpdateLane(): Lane {\n const lane = requestUpdateLane();\n return lane === DefaultLane ? SyncLane : lane;\n }\n\n function commitEffects(root: R, node: F | null, phase: EffectPhase): void {\n const mask = 1 << phase;\n if ((root.commitEffectPhases & mask) === 0) return;\n\n let executed = 0;\n const runEffects = () => {\n for (const owner of root.commitIndex) {\n const effects = owner.effects;\n if (effects === null) continue;\n // Effects under hidden boundaries stay deferred until reveal.\n if (hasHiddenBoundaries && isInsideHiddenBoundary(owner)) continue;\n for (const effect of effects) {\n if (effect.phase !== phase) continue;\n if (__DEV__) executed += 1;\n runCommitEffect(effect, phase);\n }\n }\n };\n\n if (phase === BeforePaintEffect) {\n runWithPriority(SyncLane, runEffects);\n } else {\n runEffects();\n }\n root.commitEffectPhases &= ~mask;\n\n if (__DEV__) {\n let expected = 0;\n visitEffects(node, (effect) => {\n if (effect.phase === phase) expected += 1;\n });\n if (executed !== expected) {\n throw new Error(\n \"Fig internal parity error: the commit index executed \" +\n `${executed} ${hookKindNames[phase]} effect(s) where the tree ` +\n `walk found ${expected}.`,\n );\n }\n }\n }\n\n function runCommitEffect(effect: Effect, phase: EffectPhase): void {\n const previousPhase = currentCommitEffectPhase;\n currentCommitEffectPhase = phase;\n try {\n runEffect(effect);\n } finally {\n currentCommitEffectPhase = previousPhase;\n }\n }\n\n function collectReactiveEffects(root: R, node: F | null): void {\n walkFiberForest(node, (cursor) => {\n for (const effect of cursor.effects ?? []) {\n if (effect.phase === ReactiveEffect)\n root.pendingReactiveEffects.push(effect);\n }\n\n cursor.effects = null;\n const adopted = (cursor.flags & AdoptedFlag) !== 0;\n const subtreeFlags = cursor.subtreeFlags;\n // The last flag consumer in the commit clears them (static facts\n // excepted), so committed trees stay flag-clean and adopted subtrees\n // never expose stale commit state.\n clearTransientFlags(cursor);\n if (adopted) return false;\n if (isHiddenBoundary(cursor)) {\n if (subtreeFlags !== NoFlags) clearHiddenSubtreeFlags(cursor.child);\n return false;\n }\n return (subtreeFlags & ~StaticFlagsMask) !== NoFlags;\n });\n }\n\n // Hidden subtrees keep their deferred fiber.effects for reveal, but their\n // flags must still be cleared to keep committed trees flag-clean. Reveal\n // arming depends on those effect arrays surviving every commit while\n // hidden; no walk may null them below a hidden boundary.\n function clearHiddenSubtreeFlags(node: F | null): void {\n walkFiberForest(node, (cursor) => {\n const adopted = (cursor.flags & AdoptedFlag) !== 0;\n const subtreeFlags = cursor.subtreeFlags;\n clearTransientFlags(cursor);\n return !adopted && (subtreeFlags & ~StaticFlagsMask) !== NoFlags;\n });\n }\n\n function scheduleReactiveEffects(root: R): void {\n if (\n root.pendingReactiveEffects.length === 0 ||\n root.reactiveCallback !== null\n ) {\n return;\n }\n\n root.reactiveCallback = scheduleCallback(NormalPriority, () => {\n performReactiveEffects(root);\n });\n }\n\n // The standalone reactive flush has no performRoot frame around its\n // scheduler tick, so uncaught effect errors (handleEffectError rethrows\n // when no ancestor boundary exists) are routed here exactly like\n // performRoot's catch: clear the committed UI, report to onUncaughtError,\n // and keep the error out of the scheduler tick — a throw there would\n // strand queued tasks until the next scheduleCallback. Boundary-captured\n // errors never reach the catch; they schedule the boundary instead.\n function performReactiveEffects(root: R): void {\n try {\n flushReactiveEffects(root);\n } catch (error) {\n const info = root.uncaughtErrorInfo ?? errorInfoFor(root.current, error);\n clearRootAfterUncaughtError(root);\n reportUncaughtError(root, error, info);\n\n if (root.onUncaughtError === null) {\n setTimeout(() => {\n throw error;\n });\n }\n }\n }\n\n function flushPendingReactiveEffects(root: R): void {\n root.reactiveCallback?.cancel();\n flushReactiveEffects(root);\n }\n\n function flushReactiveEffects(root: R): void {\n root.reactiveCallback = null;\n\n const effects = root.pendingReactiveEffects;\n root.pendingReactiveEffects = [];\n\n for (const effect of effects) runEffect(effect);\n }\n\n function visitEffects(\n node: F | null,\n visitor: (effect: Effect) => void,\n ): void {\n walkFiberForest(node, (cursor) => {\n for (const effect of cursor.effects ?? []) visitor(effect);\n\n return (\n (cursor.flags & AdoptedFlag) === 0 &&\n !isHiddenBoundary(cursor) &&\n (cursor.subtreeFlags & EffectFlag) !== 0\n );\n });\n }\n\n // Deliberately traverses adopted subtrees: unmount aborts and commit-time\n // external store checks must reach hooks that did not re-render.\n function visitFiberHooks(\n node: F | null,\n visitor: (owner: F, hook: Hook) => void,\n ): void {\n walkFiberForest(node, (cursor) => {\n for (let hook = cursor.memoizedState; hook !== null; hook = hook.next) {\n visitor(cursor, hook);\n }\n });\n }\n\n function visitRenderedFiberHooks(\n node: F | null,\n visitor: (owner: F, hook: Hook) => void,\n ): void {\n walkFiberForest(node, (cursor) => {\n for (let hook = cursor.memoizedState; hook !== null; hook = hook.next) {\n visitor(cursor, hook);\n }\n\n return (cursor.flags & AdoptedFlag) === 0;\n });\n }\n\n function isExternalStoreHook(\n hook: Hook,\n ): hook is Hook<ExternalStoreState<unknown, F>> {\n return hook.kind === ExternalStoreHook;\n }\n\n function runEffect(effect: Effect): void {\n let runStrict = false;\n if (__DEV__) {\n // Marked before create so renders nested inside the effect carry it\n // forward and never re-enter the strict cycle.\n runStrict = !effect.strictRan;\n effect.strictRan = true;\n }\n abortEffect(effect);\n let controller = new AbortController();\n effect.controller = controller;\n // Effects run with the ambient data store set, like render and event\n // dispatch, so preloadData/invalidateData work synchronously inside them.\n const dataStore = rootOf(effect.owner as F).dataStore;\n try {\n dataStore.run(() => effect.create(controller.signal));\n if (__DEV__ && runStrict) {\n // Strict re-run: abort and re-invoke first-time effects so work that\n // ignores its AbortSignal surfaces in development.\n abortEffect(effect);\n controller = new AbortController();\n effect.controller = controller;\n dataStore.run(() => effect.create(controller.signal));\n }\n } catch (error) {\n abortEffect(effect);\n handleEffectError(effect, error);\n }\n }\n\n function handleEffectError(effect: Effect, error: unknown): void {\n const owner = effect.owner as F;\n\n const boundary = findErrorBoundary(owner);\n if (boundary !== null) {\n captureCommittedErrorBoundary(boundary, error, owner);\n scheduleFiber(boundary, DefaultLane);\n return;\n }\n\n rootOf(owner).uncaughtErrorInfo = errorInfoFor(owner, error);\n throw error;\n }\n\n // retirePending: hide keeps the tree alive, so retired transition/action\n // runs must also release their pending slots (the decrement schedules at\n // the run's lane and downgrades to the offscreen lane like any hidden\n // update); deletions and root unmount skip the scheduling — the fiber is\n // going away, so only the abort matters.\n // Walks the node AND its siblings (a hiding boundary tears down all of\n // its content children). Deletion teardown must NOT use this: deletion\n // entries' sibling pointers reference kept fibers — it walks each deleted\n // subtree itself and calls abortFiberHooks per fiber.\n function abortFiberEffects(node: F, retirePending = false): void {\n walkFiberForest(node, (cursor) => {\n abortFiberHooks(cursor, retirePending);\n });\n }\n\n function abortFiberHooks(owner: F, retirePending: boolean): void {\n for (let hook = owner.memoizedState; hook !== null; hook = hook.next) {\n if (isEffectHook(hook.kind)) abortEffect(hook.memoizedState as Effect);\n if (isExternalStoreHook(hook))\n unsubscribeExternalStore(hook.memoizedState);\n if (isStableEventHook(hook)) {\n const instance = hook.memoizedState.instance;\n instance.controller?.abort();\n instance.controller = null;\n // Calls after unmount (or while hidden) still run the last committed\n // handler, but with a signal that is already aborted.\n instance.live = false;\n }\n if (hook.kind === TransitionHook) {\n const state = hook.memoizedState as TransitionState;\n if (retireRun(state.instance) && retirePending) {\n scheduleHookUpdate(\n owner,\n hook.queue as HookQueue<TransitionState>,\n (previous) => ({\n ...previous,\n pendingCount: Math.max(0, previous.pendingCount - 1),\n }),\n DefaultLane,\n );\n }\n }\n if (hook.kind === ActionStateHook) {\n const state = hook.memoizedState as ActionState<unknown, unknown[]>;\n if (retireRun(state.instance) && retirePending) {\n scheduleHookUpdate(\n owner,\n hook.queue as HookQueue<ActionState<unknown, unknown[]>>,\n (previous) => ({\n ...previous,\n pending: Math.max(0, previous.pending - 1),\n }),\n DefaultLane,\n );\n }\n }\n }\n }\n\n function abortEffect(effect: Effect): void {\n effect.controller?.abort();\n effect.controller = null;\n }\n\n function unsubscribeExternalStore(\n state: ExternalStoreState<unknown, F>,\n ): void {\n if (state.instance.owner !== null) {\n rootOf(state.instance.owner).externalStores.delete(state.instance);\n }\n state.instance.unsubscribe?.();\n state.instance.unsubscribe = null;\n state.instance.committedSubscribe = null;\n state.instance.owner = null;\n }\n\n function restoreConsumedPendingQueues(root: R, from = 0): void {\n for (const consumed of root.consumedPendingQueues.splice(from)) {\n restoreConsumedPendingQueue(consumed);\n }\n }\n\n function restoreConsumedPendingQueuesForRetry(root: R, from: number): void {\n for (const consumed of root.consumedPendingQueues.splice(from)) {\n clearQueueLanes(consumed.pending);\n restoreConsumedPendingQueue(consumed);\n }\n }\n\n function restoreConsumedPendingQueue({\n queue,\n pending,\n }: ConsumedPendingQueue): void {\n queue.pending =\n queue.pending === null ? pending : mergeQueues(pending, queue.pending);\n }\n}\n\nfunction activityHidden(props: Props): boolean {\n return props.mode === \"hidden\";\n}\n\n// Dev-only (inline-gated at call sites): maps a numeric kind back to its\n// public FigDevtoolsHookKind name for readable errors.\nfunction hookKindName(kind: HookKind): string | number {\n return __DEV__ ? hookKindNames[kind] : kind;\n}\n\nfunction createHook<S>(kind: HookKind, state: S): Hook<S> {\n return {\n kind,\n memoizedState: state,\n baseState: state,\n baseQueue: null,\n queue: { pending: null, dispatch: null },\n next: null,\n };\n}\n\n// Aborts and retires the instance's live run (if any): its generation is\n// invalidated so any later settlement is inert. Returns whether a run was\n// retired, so callers release its pending slot exactly once.\nfunction retireRun(instance: RunInstance): boolean {\n const controller = instance.controller;\n if (controller === null) return false;\n instance.controller = null;\n instance.generation += 1;\n controller.abort();\n return true;\n}\n\nfunction createActionState<S, Args extends unknown[]>(\n action: ActionStateAction<S, Args>,\n value: S,\n): ActionState<S, Args> {\n return {\n action,\n error: NoActionStateError,\n instance: { action, controller: null, generation: 0, value },\n pending: 0,\n value,\n };\n}\n\nfunction resolveInitialState<S>(initialState: S | (() => S)): S {\n return typeof initialState === \"function\"\n ? (initialState as () => S)()\n : initialState;\n}\n\nfunction sameType<Container, Instance, TextInstance>(\n fiber: Fiber<Container, Instance, TextInstance>,\n child: NormalizedChild,\n): boolean {\n if (typeof child === \"string\") {\n return fiber.tag === TextTag;\n }\n\n if (isPortal(child)) {\n return fiber.tag === PortalTag && fiber.props.target === child.target;\n }\n\n if (!isValidElement(child)) return false;\n\n if (__DEV__) {\n return matchesComponentFamily(fiber.type, child.type);\n }\n\n return fiber.type === child.type;\n}\n\nfunction propsFor(child: NormalizedChild): Props {\n if (typeof child === \"string\") {\n return { nodeValue: child };\n }\n\n if (isPortal(child)) return portalProps(child);\n if (isValidElement(child)) return child.props;\n\n throw invalidChildError(child);\n}\n\nfunction portalProps(child: FigPortal): Props {\n return { children: child.children, target: child.target };\n}\n\nfunction validateChildKey(\n child: NormalizedChild,\n seenKeys: Set<string> | null,\n): void {\n if (seenKeys === null) return;\n\n const key = childExplicitKey(child);\n if (key === null) return;\n\n if (seenKeys.has(key)) throw duplicateKeyError(key);\n seenKeys.add(key);\n}\n\nfunction sameChildKey<Container, Instance, TextInstance>(\n fiber: Fiber<Container, Instance, TextInstance>,\n child: NormalizedChild,\n index: number,\n): boolean {\n const key = childExplicitKey(child);\n return key === null\n ? fiber.key === null && fiber.index === index\n : fiber.key !== null && String(fiber.key) === key;\n}\n\nfunction childExplicitKey(child: NormalizedChild): string | null {\n return (isValidElement(child) || isPortal(child)) && child.key !== null\n ? String(child.key)\n : null;\n}\n\nfunction duplicateKeyError(key: string | number): Error {\n return new Error(`Duplicate key \"${String(key)}\" found among siblings.`);\n}\n\nfunction isHost<Container, Instance, TextInstance>(\n fiber: Fiber<Container, Instance, TextInstance>,\n): boolean {\n return fiber.tag === HostTag || fiber.tag === TextTag;\n}\n\nfunction hostNode<Container, Instance, TextInstance>(\n fiber: Fiber<Container, Instance, TextInstance>,\n): HostNode<Instance, TextInstance> {\n return fiber.stateNode as HostNode<Instance, TextInstance>;\n}\n\nfunction areHookInputsEqual(\n nextDeps: DependencyList | null,\n previousDeps: DependencyList | null,\n): boolean {\n if (nextDeps === null || previousDeps === null) return false;\n if (nextDeps.length !== previousDeps.length) return false;\n\n for (let index = 0; index < nextDeps.length; index += 1) {\n if (!Object.is(nextDeps[index], previousDeps[index])) return false;\n }\n\n return true;\n}\n\nfunction changedContextProvider<Container, Instance, TextInstance>(\n fiber: Fiber<Container, Instance, TextInstance>,\n): boolean {\n return (\n fiber.tag === ContextProviderTag &&\n fiber.alternate !== null &&\n !Object.is(fiber.props.value, fiber.alternate.memoizedProps?.value)\n );\n}\n\n// Retries of a committed fallback render at retry-lane priority rather than\n// the lane of the update that originally suspended. A boundary that suspends\n// again while retrying keeps its existing retry lane so successive retries of\n// one boundary stay grouped instead of claiming a new lane per ping.\nfunction suspenseRetryLane(lanes: Lanes): Lane {\n const retryLanes = lanes & RetryLanes;\n return retryLanes === NoLanes\n ? claimNextRetryLane()\n : getHighest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