laplus 0.1.8 → 0.1.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DiffPanel-CCJQFhJl.js","names":["__iconNode","__iconNode","CodeView","useEffect","useLayoutEffect","useStableCallback","Fragment","ScopedThreadRef","useRightPanelStore","resolvePathLinkTarget","OpenDiffFilePrimaryActionInput","threadRef","filePath","activeCwd","openInEditor","targetPath","openDiffFilePrimaryAction","getState","openFile","CheckpointDiffState","CheckpointDiffTarget","useCheckpointDiff","useCheckpointDiffQuery","target","options","$","_c","state","t0","data","error","isPending","areAllDiffFilesCollapsed","fileKeys","ReadonlyArray","collapsedFileKeys","ReadonlySet","length","every","fileKey","has","toggleAllDiffFiles","Set","ReactNode","cn","Skeleton","DiffPanelMode","getDiffPanelHeaderRowClassName","DiffPanelShell","props","$","_c","t0","mode","t1","t2","Symbol","for","t3","header","t4","children","DiffPanelHeaderSkeleton","DiffPanelLoadingState","label","AnnotationSide","CodeViewDiffItem","CodeViewItem","DiffLineAnnotation","FileDiffMetadata","SelectedLineRange","CodeView","CodeViewHandle","CodeViewProps","ScopedThreadRef","useCallback","useMemo","useState","ReactNode","Ref","DraftId","useComposerDraftStore","fnv1a32","buildDiffReviewComment","restoreDiffReviewCommentRange","ReviewCommentContext","LocalCommentAnnotation","nextFileCommentId","DiffCommentAnnotationEntry","id","kind","range","rangeLabel","text","DiffCommentAnnotationGroup","entries","DiffCommentLineAnnotation","AnnotatableCodeViewHandle","EMPTY_REVIEW_COMMENTS","ReadonlyArray","annotationSide","endSide","side","appendAnnotationEntry","annotations","entry","annotationIndex","findIndex","annotation","lineNumber","end","metadata","map","index","AnnotatableCodeViewProps","files","fileDiff","filePath","fileKey","collapsed","sectionId","sectionTitle","composerDraftTarget","options","NonNullable","viewerRef","className","renderHeaderPrefix","DiffSelectionContext","item","AnnotatableCodeView","t0","$","_c","addReviewComment","_temp","removeReviewComment","_temp2","t1","store_1","store","getComposerDraft","reviewComments","selectedLines","setSelectedLines","draft","setDraft","t2","Map","_temp3","filesByKey","t3","t4","t5","persisted","filter","comment","fenceLanguage","reduce","comment_0","annotations_0","type","version","flatMap","_temp5","join","items","entryId","some","entry_0","removeEntry","entryId_0","entry_1","find","candidate","file_0","get","undefined","file","comment_1","submitEntry","t6","range_0","context","file_1","comment_2","beginComment","hasOpenComment","t7","ref","t8","t9","t10","t11","enableGutterUtility","enableLineSelection","onLineSelectionEnd","t12","item_0","t13","annotation_0","entry_2","text_0","t14","_temp4","store_0","ToggleGroup","ToggleGroupContext","c","_c","Toggle","TogglePrimitive","ToggleGroup","ToggleGroupPrimitive","VariantProps","React","cn","Separator","ToggleComponent","toggleVariants","ToggleGroupContext","createContext","size","variant","t0","$","children","className","props","t1","t2","t3","orientation","undefined","t4","value","t5","t6","t7","t8","t9","context","use","resolvedVariant","resolvedSize","ToggleGroupSeparator","ToggleGroupItem","WS_METHODS","Atom","createEnvironmentRpcQueryAtomFamily","EnvironmentRegistry","createReviewEnvironmentAtoms","runtime","AtomRuntime","R","E","diffPreview","label","tag","reviewGetDiffPreview","staleTimeMs","VcsRef","BaseRefChoice","id","label","local","remote","remoteBranchName","ref","remoteName","name","startsWith","slice","length","buildBaseRefChoices","localRefs","ReadonlyArray","remoteRefs","unusedRemoteRefs","Set","pairedChoices","map","matches","filter","has","find","candidate","delete","remoteOnlyChoices","filterBaseRefChoices","choices","query","normalizedQuery","trim","toLocaleLowerCase","choice","includes","useAtomValue","useParams","isAtomCommandInterrupted","squashAtomCommandFailure","safeErrorLogAttributes","ScopedThreadRef","TurnId","ArrowRightIcon","CheckIcon","ChevronDownIcon","ChevronRightIcon","ChevronsDownUpIcon","ChevronsUpDownIcon","Columns2Icon","PilcrowIcon","Rows3Icon","SearchIcon","TextWrapIcon","useCallback","useEffect","useMemo","useRef","useState","useOpenInPreferredEditor","DraftId","openDiffFilePrimaryAction","useCheckpointDiff","cn","selectThreadDiffPanelSelection","useDiffPanelStore","useTheme","buildFileDiffRenderKey","getDiffCollapseIconClassName","getRenderablePatch","resolveDiffThemeName","resolveFileDiffPath","areAllDiffFilesCollapsed","toggleAllDiffFiles","useTurnDiffSummaries","useProject","useThread","resolveThreadRouteRef","useClientSettings","formatShortTimestamp","DiffPanelLoadingState","DiffPanelShell","DiffPanelMode","AnnotatableCodeView","AnnotatableCodeViewHandle","Button","ToggleGroup","Toggle","Switch","Combobox","ComboboxEmpty","ComboboxInput","ComboboxItem","ComboboxList","ComboboxPopup","ComboboxTrigger","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuSub","DropdownMenuSubContent","DropdownMenuSubTrigger","DropdownMenuTrigger","Tooltip","TooltipPopup","TooltipTrigger","useEnvironmentQuery","serverEnvironment","reviewEnvironment","vcsEnvironment","buildBaseRefChoices","filterBaseRefChoices","DiffRenderMode","DiffThemeType","AUTOMATIC_BASE_REF","CollapsedDiffFilesState","scopeKey","fileKeys","ReadonlySet","EMPTY_COLLAPSED_DIFF_FILE_KEYS","Set","DIFF_PANEL_UNSAFE_CSS","DiffPanelProps","mode","composerDraftTarget","initialGitScope","DiffWorkerPoolProvider","DiffPanel","initialGitScopeProp","resolvedTheme","settings","diffRenderMode","setDiffRenderMode","wordWrap","setWordWrap","diffIgnoreWhitespace","setDiffIgnoreWhitespace","baseRefQuery","setBaseRefQuery","collapsedDiffFiles","setCollapsedDiffFiles","codeViewRef","routeThreadRef","strict","select","params","activeThreadId","threadId","activeThread","activeProjectId","projectId","activeProject","environmentId","activeCwd","worktreePath","workspaceRoot","serverConfig","configValueAtom","openInPreferredEditor","availableEditors","gitStatusQuery","undefined","status","input","cwd","diffSelection","state","byThreadKey","isGitRepo","data","isRepo","turnDiffSummaries","inferredCheckpointTurnCountByTurnId","orderedTurnDiffSummaries","toSorted","left","right","leftTurnCount","checkpointTurnCount","turnId","rightTurnCount","completedAt","localeCompare","kind","getState","reconcileTurnSelection","map","summary","selectedTurnId","selectedGitScope","selectedBaseRef","baseRef","selectedFilePath","filePath","selectedFileRevealRequestId","revealRequestId","selectedTurn","find","selectedCheckpointTurnCount","latestTurn","selectedScopeLabel","reviewSectionId","collapseScopeKey","collapsedDiffFileKeys","reviewSectionTitle","selectedCheckpointRange","fromTurnCount","Math","max","toTurnCount","activeCheckpointDiff","ignoreWhitespace","cacheScope","enabled","primaryBranchDiffPreview","diffPreview","shouldRetryBranchDiffAtEnvironmentCwd","error","includes","fallbackBranchDiffPreview","branchDiffPreview","selectedGitSource","sources","source","localBranchRefs","listRefs","includeMatchingRemoteRefs","refKind","trim","length","query","limit","remoteBranchRefs","baseRefChoices","refs","filter","ref","name","headRef","matchingBaseRefChoices","valueForBaseRefChoice","choice","remote","local","id","baseRefItems","filteredBaseRefItems","gitDiff","diff","selectedPatch","isSelectedPatchTruncated","truncated","isLoadingSelectedPatch","isPending","selectedPatchError","hasResolvedPatch","hasNoNetChanges","renderablePatch","compactPartialHunkOffsets","renderableFiles","files","numeric","sensitivity","codeViewFiles","fileDiff","fileKey","collapsed","has","diffFileKeys","file","allDiffFilesCollapsed","candidate","current","scrollTo","type","align","openDiffFile","threadRef","openInEditor","targetPath","result","_tag","console","warn","operation","toggleDiffFileCollapsed","next","delete","add","toggleDiffFileCollapse","currentKeys","selectTurn","selectGitScope","scope","selectBranchBaseRef","headerRow","turnCount","timestampFormat","open","value","event","target","item","hasBoth","useRemote","label","stopPropagation","checked","nextRef","pressed","Boolean","composedPath","nativeEvent","title","node","HTMLElement","hasAttribute","textContent","diffStyle","lineDiffType","overflow","theme","themeType","unsafeCSS","stickyHeaders","layout","paddingTop","paddingBottom","gap","reason","text"],"sources":["../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/columns-2.js","../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/pilcrow.js","../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/rows-3.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/prefersReducedMotion.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/roundToDevicePixel.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/components/CodeView.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/areManagedSnapshotsEqual.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/react/CodeView.js","../../src/diffFileActions.ts","../../src/lib/checkpointDiffState.ts","../../src/lib/diffCollapse.ts","../../src/components/DiffPanelShell.tsx","../../src/components/diffs/AnnotatableCodeView.tsx","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@19.2.16_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@base-ui/react/esm/toggle-group/ToggleGroupDataAttributes.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@19.2.16_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@base-ui/react/esm/toggle-group/ToggleGroup.js","../../src/components/ui/toggle-group.tsx","../../../../packages/client-runtime/src/state/review.ts","../../src/state/review.ts","../../src/lib/baseRefChoices.ts","../../src/components/DiffPanel.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M12 3v18\", key: \"108xh3\" }]\n];\nconst Columns2 = createLucideIcon(\"columns-2\", __iconNode);\n\nexport { __iconNode, Columns2 as default };\n//# sourceMappingURL=columns-2.js.map\n","/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M13 4v16\", key: \"8vvj80\" }],\n [\"path\", { d: \"M17 4v16\", key: \"7dpous\" }],\n [\"path\", { d: \"M19 4H9.5a4.5 4.5 0 0 0 0 9H13\", key: \"sh4n9v\" }]\n];\nconst Pilcrow = createLucideIcon(\"pilcrow\", __iconNode);\n\nexport { __iconNode, Pilcrow as default };\n//# sourceMappingURL=pilcrow.js.map\n","/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M21 9H3\", key: \"1338ky\" }],\n [\"path\", { d: \"M21 15H3\", key: \"9uk58r\" }]\n];\nconst Rows3 = createLucideIcon(\"rows-3\", __iconNode);\n\nexport { __iconNode, Rows3 as default };\n//# sourceMappingURL=rows-3.js.map\n","//#region src/utils/prefersReducedMotion.ts\nfunction prefersReducedMotion() {\n\tif (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return false;\n\treturn window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n//#endregion\nexport { prefersReducedMotion };\n//# sourceMappingURL=prefersReducedMotion.js.map","//#region src/utils/roundToDevicePixel.ts\n/**\n* Snap a CSS-pixel value to the nearest device-pixel boundary. Browsers store\n* scrollTop on the device-pixel grid on fractional-DPR displays (1.25x, 1.5x,\n* etc.), so rounding computed scroll targets against that grid keeps delta\n* math settling cleanly instead of hovering around fractional residuals.\n*\n* Reads window.devicePixelRatio fresh on each call so monitor-switching and\n* zoom changes are picked up without needing to flush any cached value.\n*/\nfunction roundToDevicePixel(value) {\n\tconst dpr = window.devicePixelRatio ?? 1;\n\treturn Math.round(value * dpr) / dpr;\n}\n\n//#endregion\nexport { roundToDevicePixel };\n//# sourceMappingURL=roundToDevicePixel.js.map","import { CORE_CSS_ATTRIBUTE, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DIFFS_DEVELOPMENT_BUILD, DIFFS_TAG_NAME, THEME_CSS_ATTRIBUTE, UNSAFE_CSS_ATTRIBUTE } from \"../constants.js\";\nimport { dequeueRender, queueRender } from \"../managers/UniversalRenderingManager.js\";\nimport { areObjectsEqual } from \"../utils/areObjectsEqual.js\";\nimport { areThemesEqual } from \"../utils/areThemesEqual.js\";\nimport { areOptionsEqual } from \"../utils/areOptionsEqual.js\";\nimport { areSelectionsEqual } from \"../utils/areSelectionsEqual.js\";\nimport { createWindowFromScrollPosition } from \"../utils/createWindowFromScrollPosition.js\";\nimport { isStyleNode } from \"../utils/isStyleNode.js\";\nimport { prefersReducedMotion } from \"../utils/prefersReducedMotion.js\";\nimport { roundToDevicePixel } from \"../utils/roundToDevicePixel.js\";\nimport { VirtualizedFile } from \"./VirtualizedFile.js\";\nimport { VirtualizedFileDiff } from \"./VirtualizedFileDiff.js\";\n\n//#region src/components/CodeView.ts\nconst CODE_VIEW_DIFF_OPTION_KEYS = [\n\t\"theme\",\n\t\"disableLineNumbers\",\n\t\"overflow\",\n\t\"themeType\",\n\t\"disableFileHeader\",\n\t\"disableVirtualizationBuffers\",\n\t\"preferredHighlighter\",\n\t\"useCSSClasses\",\n\t\"useTokenTransformer\",\n\t\"tokenizeMaxLineLength\",\n\t\"tokenizeMaxLength\",\n\t\"unsafeCSS\",\n\t\"diffStyle\",\n\t\"diffIndicators\",\n\t\"disableBackground\",\n\t\"expandUnchanged\",\n\t\"collapsedContextThreshold\",\n\t\"lineDiffType\",\n\t\"maxLineDiffLength\",\n\t\"expansionLineCount\",\n\t\"lineHoverHighlight\",\n\t\"enableTokenInteractionsOnWhitespace\",\n\t\"enableGutterUtility\",\n\t\"__debugPointerEvents\",\n\t\"enableLineSelection\",\n\t\"controlledSelection\",\n\t\"disableErrorHandling\"\n];\nconst CODE_VIEW_FILE_OPTION_KEYS = [\n\t\"theme\",\n\t\"disableLineNumbers\",\n\t\"overflow\",\n\t\"themeType\",\n\t\"disableFileHeader\",\n\t\"disableVirtualizationBuffers\",\n\t\"preferredHighlighter\",\n\t\"useCSSClasses\",\n\t\"useTokenTransformer\",\n\t\"tokenizeMaxLineLength\",\n\t\"tokenizeMaxLength\",\n\t\"unsafeCSS\",\n\t\"lineHoverHighlight\",\n\t\"enableTokenInteractionsOnWhitespace\",\n\t\"enableGutterUtility\",\n\t\"__debugPointerEvents\",\n\t\"enableLineSelection\",\n\t\"controlledSelection\",\n\t\"disableErrorHandling\"\n];\nconst CODE_VIEW_SHARED_CALLBACK_KEYS = [\n\t\"renderCustomHeader\",\n\t\"renderHeaderPrefix\",\n\t\"renderHeaderMetadata\",\n\t\"renderAnnotation\",\n\t\"renderGutterUtility\",\n\t\"onPostRender\",\n\t\"onGutterUtilityClick\",\n\t\"onLineClick\",\n\t\"onLineNumberClick\",\n\t\"onLineEnter\",\n\t\"onLineLeave\",\n\t\"onTokenClick\",\n\t\"onTokenEnter\",\n\t\"onTokenLeave\"\n];\nconst CODE_VIEW_SELECTION_CALLBACK_KEYS = [\n\t\"onLineSelected\",\n\t\"onLineSelectionStart\",\n\t\"onLineSelectionChange\",\n\t\"onLineSelectionEnd\"\n];\nconst CODE_VIEW_ITEM_OPTIONS_STATE = Symbol(\"CodeView.itemOptionsState\");\nfunction defineOptionsState(options, state) {\n\tObject.defineProperty(options, CODE_VIEW_ITEM_OPTIONS_STATE, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: state\n\t});\n}\nfunction getItemOptionsState(options) {\n\treturn options[CODE_VIEW_ITEM_OPTIONS_STATE];\n}\nfunction defineItemOption(target, key, get) {\n\tObject.defineProperty(target, key, {\n\t\tconfigurable: false,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn get(this);\n\t\t}\n\t});\n}\nconst DEFAULT_SCROLL_INTERACTION_RESTORE_DELAY_MS = 120;\nconst SCROLLING_CODE_OVERFLOW_FIX_VARIABLE = \"--diffs-overflow-override\";\nconst SCROLL_REBASE_CONTAINER_HEIGHT = 12e6;\nconst SCROLL_REBASE_TRIGGER_TOP = 1e6;\nconst SCROLL_REBASE_TARGET_TOP = 2e6;\nconst SCROLL_REBASE_TARGET_BOTTOM = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TARGET_TOP;\nconst SCROLL_REBASE_THRESHOLD = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TRIGGER_TOP;\nconst MOBILE_SAFARI = (() => {\n\tconst { navigator } = globalThis;\n\tconst userAgent = navigator.userAgent;\n\tconst isIOS = /iP(?:hone|ad|od)/.test(userAgent);\n\tconst isIPadOS = navigator.platform === \"MacIntel\" && navigator.maxTouchPoints > 1;\n\treturn (isIOS || isIPadOS) && /AppleWebKit/.test(userAgent) && /Safari/.test(userAgent) && !/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(userAgent);\n})();\nvar CodeView = class CodeView {\n\tstatic __STOP = false;\n\tstatic __lastScrollPosition = 0;\n\ttype = \"advanced\";\n\tconfig = {\n\t\toverscrollSize: 200,\n\t\tintersectionObserverMargin: 0,\n\t\tresizeDebugging: false\n\t};\n\titems = [];\n\tidToItem = /* @__PURE__ */ new Map();\n\tselectedLines = null;\n\tinstanceToItem = /* @__PURE__ */ new Map();\n\tlayoutDirtyIndex;\n\tpendingLayoutReset;\n\trenderOptionsRevision = 0;\n\tslotCoordinator;\n\tslotSnapshot;\n\tscrollListeners = /* @__PURE__ */ new Set();\n\tscrollHeight = 0;\n\tcontainerHeight = -1;\n\tscrollTop = 0;\n\tscrollPageOffset = 0;\n\tscrollDirty = true;\n\tscrollInteractionFixTimer;\n\tpointerEventsDisabled = false;\n\tcodeOverflowFix = false;\n\theight = 0;\n\theightDirty = true;\n\twindowSpecs = {\n\t\ttop: 0,\n\t\tbottom: 0\n\t};\n\trenderState = {\n\t\tscrollTop: -1,\n\t\tfirstIndex: -1,\n\t\tlastIndex: -1,\n\t\tstickyHeight: 0,\n\t\tstickyTop: -1,\n\t\tstickyBottom: -1\n\t};\n\titemMetricsCache = DEFAULT_CODE_VIEW_FILE_METRICS;\n\tfileOptionsPrototype;\n\tdiffOptionsPrototype;\n\tpendingScrollTarget;\n\tpendingLayoutAnchor;\n\tshouldFixContainerFocus = false;\n\tscrollAnimation;\n\troot;\n\tresizeObserver;\n\tcontainer = document.createElement(\"div\");\n\tstickyContainer = document.createElement(\"div\");\n\tstickyOffset = document.createElement(\"div\");\n\telementPool = [];\n\telementPoolVersion = 0;\n\telementPoolTracker = /* @__PURE__ */ new WeakMap();\n\tpendingElementPool = [];\n\toptions;\n\tworkerManager;\n\tisContainerManaged;\n\tconstructor(options = { theme: DEFAULT_THEMES }, workerManager, isContainerManaged = false) {\n\t\tthis.options = options;\n\t\tthis.computeMetricsCache(options.itemMetrics);\n\t\tthis.fileOptionsPrototype = this.createFileOptionsPrototype();\n\t\tthis.diffOptionsPrototype = this.createDiffOptionsPrototype();\n\t\tthis.workerManager = workerManager;\n\t\tthis.isContainerManaged = isContainerManaged;\n\t\tthis.stickyOffset.style.contain = \"layout size\";\n\t\tthis.stickyContainer.style.position = \"sticky\";\n\t\tthis.stickyContainer.style.width = \"100%\";\n\t\tthis.stickyContainer.style.contain = \"layout style inline-size\";\n\t\tthis.stickyContainer.style.isolation = \"isolate\";\n\t\tthis.stickyContainer.style.display = \"flex\";\n\t\tthis.stickyContainer.style.flexDirection = \"column\";\n\t}\n\tgetLayout() {\n\t\treturn this.options.layout ?? DEFAULT_CODE_VIEW_LAYOUT;\n\t}\n\tcomputeMetricsCache(itemMetrics) {\n\t\tthis.itemMetricsCache = {\n\t\t\thunkLineCount: itemMetrics?.hunkLineCount ?? DEFAULT_CODE_VIEW_FILE_METRICS.hunkLineCount,\n\t\t\tlineHeight: itemMetrics?.lineHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.lineHeight,\n\t\t\tdiffHeaderHeight: itemMetrics?.diffHeaderHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.diffHeaderHeight,\n\t\t\thunkSeparatorHeight: itemMetrics?.hunkSeparatorHeight,\n\t\t\tspacing: itemMetrics?.spacing ?? DEFAULT_CODE_VIEW_FILE_METRICS.spacing,\n\t\t\tpaddingTop: itemMetrics?.paddingTop,\n\t\t\tpaddingBottom: itemMetrics?.paddingBottom\n\t\t};\n\t\treturn this.itemMetricsCache;\n\t}\n\tgetSmoothScrollSettings() {\n\t\treturn this.options.smoothScrollSettings ?? DEFAULT_SMOOTH_SCROLL_SETTINGS;\n\t}\n\tshouldDisablePointerEvents() {\n\t\treturn this.options.pointerEventsOnScroll !== true;\n\t}\n\tshouldValidateItemHeights() {\n\t\treturn DIFFS_DEVELOPMENT_BUILD && this.options.__devOnlyValidateItemHeights === true;\n\t}\n\tvalidateRenderedItemHeight(item) {\n\t\tif (!this.shouldValidateItemHeights() || item.element == null) return;\n\t\tconst stickySpecs = item.instance.getAdvancedStickySpecs();\n\t\tif (stickySpecs == null) return;\n\t\tconst expectedHeight = stickySpecs.height;\n\t\tconst actualHeight = item.element.getBoundingClientRect().height;\n\t\tif (expectedHeight === actualHeight) return;\n\t\tconsole.error(\"CodeView: reconciled item height does not match DOM height\", {\n\t\t\tid: item.item.id,\n\t\t\ttype: item.type,\n\t\t\tindex: item.index,\n\t\t\tversion: item.version,\n\t\t\texpectedHeight,\n\t\t\tactualHeight,\n\t\t\tdelta: actualHeight - expectedHeight,\n\t\t\tstickyTopOffset: stickySpecs.topOffset,\n\t\t\tvirtualizedHeight: item.instance.getVirtualizedHeight(),\n\t\t\ttop: item.top,\n\t\t\tscrollTop: this.getScrollTop(),\n\t\t\twindowSpecs: { ...this.windowSpecs },\n\t\t\telement: item.element,\n\t\t\tinstance: item.instance\n\t\t});\n\t}\n\tvalidateStickyContainerHeight() {\n\t\tif (!this.shouldValidateItemHeights()) return;\n\t\tconst { firstIndex, lastIndex, stickyHeight, stickyTop, stickyBottom } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1) return;\n\t\tconst actualHeight = this.stickyContainer.getBoundingClientRect().height;\n\t\tif (Math.abs(actualHeight - stickyHeight) < 1) return;\n\t\tconsole.error(\"CodeView: sticky container height does not match computed layout\", {\n\t\t\tcomputedStickyHeight: stickyHeight,\n\t\t\tactualStickyHeight: actualHeight,\n\t\t\tdelta: actualHeight - stickyHeight,\n\t\t\tstickyTop,\n\t\t\tstickyBottom,\n\t\t\tfirstIndex,\n\t\t\tlastIndex,\n\t\t\tfirstStickySpecs: this.items[firstIndex]?.instance.getAdvancedStickySpecs(),\n\t\t\tlastStickySpecs: this.items[lastIndex]?.instance.getAdvancedStickySpecs(),\n\t\t\tscrollTop: this.getScrollTop(),\n\t\t\tscrollPageOffset: this.scrollPageOffset,\n\t\t\twindowSpecs: { ...this.windowSpecs },\n\t\t\tstickyContainer: this.stickyContainer\n\t\t});\n\t}\n\tclearScrollInteractionTimer() {\n\t\tif (this.scrollInteractionFixTimer != null) {\n\t\t\tclearTimeout(this.scrollInteractionFixTimer);\n\t\t\tthis.scrollInteractionFixTimer = void 0;\n\t\t}\n\t}\n\tsuspendScrollInteractions() {\n\t\tthis.clearScrollInteractionTimer();\n\t\tif (this.shouldDisablePointerEvents() && !this.pointerEventsDisabled) {\n\t\t\tthis.stickyContainer.style.pointerEvents = \"none\";\n\t\t\tthis.pointerEventsDisabled = true;\n\t\t}\n\t\tif (MOBILE_SAFARI && !this.codeOverflowFix) {\n\t\t\tthis.stickyContainer.style.setProperty(SCROLLING_CODE_OVERFLOW_FIX_VARIABLE, \"hidden\");\n\t\t\tthis.codeOverflowFix = true;\n\t\t}\n\t\tthis.scrollInteractionFixTimer = setTimeout(this.restoreScrollInteractions, DEFAULT_SCROLL_INTERACTION_RESTORE_DELAY_MS);\n\t}\n\trestoreScrollInteractions = () => {\n\t\tthis.clearScrollInteractionTimer();\n\t\tif (this.pointerEventsDisabled) {\n\t\t\tthis.stickyContainer.style.removeProperty(\"pointer-events\");\n\t\t\tthis.pointerEventsDisabled = false;\n\t\t}\n\t\tif (this.codeOverflowFix) {\n\t\t\tthis.stickyContainer.style.setProperty(SCROLLING_CODE_OVERFLOW_FIX_VARIABLE, \"auto\");\n\t\t\tthis.codeOverflowFix = false;\n\t\t}\n\t};\n\tsyncLayout() {\n\t\tconst { gap, paddingBottom, paddingTop } = this.getLayout();\n\t\tthis.stickyContainer.style.gap = `${gap}px`;\n\t\tthis.container?.style.setProperty(\"margin-top\", `${paddingTop}px`);\n\t\tthis.container?.style.setProperty(\"margin-bottom\", `${paddingBottom}px`);\n\t}\n\tsetup(root) {\n\t\tif (this.root != null) throw new Error(\"CodeView.setup: already setup\");\n\t\tthis.workerManager?.subscribeToThemeChanges(this);\n\t\tthis.root = root;\n\t\tthis.root.style.overflowAnchor = \"none\";\n\t\tif (!this.root.hasAttribute(\"tabindex\")) this.root.tabIndex = -1;\n\t\tthis.container ??= document.createElement(\"div\");\n\t\tthis.container.style.contain = \"layout style\";\n\t\tthis.syncLayout();\n\t\tthis.container.appendChild(this.stickyOffset);\n\t\tthis.container.appendChild(this.stickyContainer);\n\t\tthis.root.appendChild(this.container);\n\t\tthis.scrollDirty = true;\n\t\tthis.heightDirty = true;\n\t\tthis.resizeObserver = new ResizeObserver(this.handleResize);\n\t\tthis.resizeObserver.observe(this.stickyContainer);\n\t\tthis.root.addEventListener(\"scroll\", this.handleScroll, { passive: true });\n\t\tthis.root.addEventListener(\"wheel\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"touchstart\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"pointerdown\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"keydown\", this.clearPendingScroll, { passive: true });\n\t\tthis.resizeObserver.observe(this.root);\n\t\tthis.render(true);\n\t\twindow.__INSTANCE = this;\n\t\twindow.__TOGGLE = () => {\n\t\t\tif (CodeView.__STOP) {\n\t\t\t\tCodeView.__STOP = false;\n\t\t\t\tthis.scrollTo({\n\t\t\t\t\ttype: \"position\",\n\t\t\t\t\tposition: CodeView.__lastScrollPosition,\n\t\t\t\t\tbehavior: \"instant\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tCodeView.__lastScrollPosition = this.getScrollTop();\n\t\t\t\tCodeView.__STOP = true;\n\t\t\t}\n\t\t};\n\t}\n\treset() {\n\t\tthis.restoreScrollInteractions();\n\t\tthis.cleanAllRenderedItems();\n\t\tthis.selectedLines = null;\n\t\tthis.items.length = 0;\n\t\tthis.idToItem.clear();\n\t\tthis.instanceToItem.clear();\n\t\tthis.layoutDirtyIndex = void 0;\n\t\tthis.pendingLayoutReset = void 0;\n\t\tthis.stickyContainer.textContent = \"\";\n\t\tthis.stickyOffset.style.height = \"\";\n\t\tthis.container?.style.removeProperty(\"height\");\n\t\tthis.containerHeight = -1;\n\t\tthis.windowSpecs = {\n\t\t\ttop: 0,\n\t\t\tbottom: 0\n\t\t};\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.shouldFixContainerFocus = false;\n\t\tthis.height = 0;\n\t\tthis.scrollTop = 0;\n\t\tthis.scrollPageOffset = 0;\n\t\tthis.scrollHeight = 0;\n\t\tthis.scrollDirty = true;\n\t\tthis.heightDirty = true;\n\t\tthis.resetRenderState();\n\t\tif (!this.isContainerManaged) this.flushSlotCoordinator();\n\t}\n\tcleanUp() {\n\t\tthis.reset();\n\t\tthis.clearElementPool();\n\t\tthis.restoreScrollInteractions();\n\t\tthis.workerManager?.unsubscribeToThemeChanges(this);\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = void 0;\n\t\tthis.root?.removeEventListener(\"scroll\", this.handleScroll);\n\t\tthis.root?.removeEventListener(\"wheel\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"touchstart\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"pointerdown\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"keydown\", this.clearPendingScroll);\n\t\tthis.root?.style.removeProperty(\"overflow-anchor\");\n\t\tthis.container?.remove();\n\t\tthis.stickyOffset.remove();\n\t\tthis.stickyContainer.remove();\n\t\tthis.stickyContainer.textContent = \"\";\n\t\tthis.root = void 0;\n\t\tthis.container = void 0;\n\t}\n\tcleanAllRenderedItems() {\n\t\tif (this.renderState.firstIndex === -1) return;\n\t\tfor (let index = this.renderState.firstIndex; index <= this.renderState.lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${index}`);\n\t\t\tthis.releaseRenderedItem(item);\n\t\t}\n\t}\n\tprimeScrollTarget(target) {\n\t\tif (target.type === \"position\") return;\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) return;\n\t\titem.instance.primeHighlightCache();\n\t}\n\tgetElementPoolLimit() {\n\t\tconst viewportSize = this.getHeight() + this.config.overscrollSize * 2;\n\t\tconst { diffHeaderHeight } = this.itemMetricsCache;\n\t\treturn Math.max(8, Math.ceil(viewportSize / Math.max(diffHeaderHeight, 10)) + 1) * (this.isContainerManaged ? 2 : 1);\n\t}\n\tacquireElement() {\n\t\tthis.promotePendingPooledElements();\n\t\tlet element = this.elementPool.pop();\n\t\twhile (element != null && !this.isElementPoolGenerationCurrent(element)) element = this.elementPool.pop();\n\t\telement ??= document.createElement(DIFFS_TAG_NAME);\n\t\tthis.markElementPoolGenerationCurrent(element);\n\t\treturn element;\n\t}\n\treleaseRenderedItem(item) {\n\t\tconst { element } = item;\n\t\tif (element != null && this.renderedItemOwnsFocus(element)) this.shouldFixContainerFocus = true;\n\t\titem.instance.cleanUp(true);\n\t\titem.element = void 0;\n\t\tif (element == null) return;\n\t\telement.remove();\n\t\tthis.cleanElement(element);\n\t\tthis.queueElementForPool(element);\n\t}\n\trenderedItemOwnsFocus(element) {\n\t\tconst { activeElement } = document;\n\t\treturn activeElement === element || element.contains(activeElement) || element.shadowRoot?.activeElement != null;\n\t}\n\tfixContainerFocus() {\n\t\tif (this.shouldFixContainerFocus) {\n\t\t\tthis.shouldFixContainerFocus = false;\n\t\t\tthis.root?.focus({ preventScroll: true });\n\t\t}\n\t}\n\tcleanElement(element) {\n\t\tconst { shadowRoot } = element;\n\t\tif (shadowRoot != null) {\n\t\t\tfor (const child of Array.from(shadowRoot.children)) if (!isPooledShadowChild(child)) child.remove();\n\t\t}\n\t\tif (!this.isContainerManaged) element.replaceChildren();\n\t}\n\tqueueElementForPool(element) {\n\t\tconst poolLimit = this.getElementPoolLimit();\n\t\tif (!this.isElementPoolGenerationCurrent(element) || this.getElementPoolSize() >= poolLimit) return;\n\t\tif (this.isElementClean(element)) this.elementPool.push(element);\n\t\telse this.pendingElementPool.push(element);\n\t}\n\tpromotePendingPooledElements() {\n\t\tif (this.pendingElementPool.length === 0) return;\n\t\tconst { pendingElementPool: pendingElements } = this;\n\t\tthis.pendingElementPool = [];\n\t\tconst poolLimit = this.getElementPoolLimit();\n\t\tfor (const element of pendingElements) if (this.isElementPoolGenerationCurrent(element) && this.isElementClean(element) && this.elementPool.length < poolLimit) this.elementPool.push(element);\n\t\telse if (this.isElementPoolGenerationCurrent(element) && this.getElementPoolSize() < poolLimit) this.pendingElementPool.push(element);\n\t}\n\tisElementClean(element) {\n\t\treturn element.childNodes.length === 0;\n\t}\n\tgetElementPoolSize() {\n\t\treturn this.elementPool.length + this.pendingElementPool.length;\n\t}\n\tclearElementPool() {\n\t\tthis.elementPool.length = 0;\n\t\tthis.pendingElementPool.length = 0;\n\t}\n\tinvalidateElementPool() {\n\t\tthis.elementPoolVersion++;\n\t\tthis.clearElementPool();\n\t}\n\tmarkElementPoolGenerationCurrent(element) {\n\t\tthis.elementPoolTracker.set(element, this.elementPoolVersion);\n\t}\n\tisElementPoolGenerationCurrent(element) {\n\t\treturn this.elementPoolTracker.get(element) === this.elementPoolVersion;\n\t}\n\tresolveEffectiveScrollBehavior(target, destination) {\n\t\tif (prefersReducedMotion()) return \"instant\";\n\t\tif (target.behavior !== \"smooth-auto\") return target.behavior ?? \"instant\";\n\t\treturn Math.abs(destination - this.getScrollTop()) <= this.getHeight() * 10 ? \"smooth\" : \"instant\";\n\t}\n\tscrollTo(target) {\n\t\tif (this.root == null) return;\n\t\tconst pendingTarget = this.normalizeScrollTarget(target);\n\t\tif (pendingTarget == null) return;\n\t\tconst destination = this.resolveScrollTargetTop(pendingTarget);\n\t\tif (destination == null) return;\n\t\tthis.primeScrollTarget(pendingTarget);\n\t\tif (this.resolveEffectiveScrollBehavior(pendingTarget, destination) === \"smooth\") this.scrollAnimation ??= {\n\t\t\tposition: this.getScrollTop(),\n\t\t\tvelocity: 0,\n\t\t\tlastTimestamp: performance.now()\n\t\t};\n\t\telse this.scrollAnimation = void 0;\n\t\tthis.suspendScrollInteractions();\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.pendingScrollTarget = pendingTarget;\n\t\tthis.render();\n\t}\n\tsetSelectedLines(selection, options) {\n\t\tthis.applySelectedLines(selection, options);\n\t}\n\tgetSelectedLines() {\n\t\treturn this.selectedLines;\n\t}\n\tclearSelectedLines(options) {\n\t\tthis.applySelectedLines(null, options);\n\t}\n\tgetItem(itemId) {\n\t\treturn this.idToItem.get(itemId)?.item;\n\t}\n\tupdateItem(input) {\n\t\tconst item = this.idToItem.get(input.id);\n\t\tif (item == null) {\n\t\t\tconsole.error(`CodeView.updateItem: unknown item id \"${input.id}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.syncItemRecord(item, input)) return false;\n\t\tthis.markItemLayoutDirty(item);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t\tthis.syncSelection();\n\t\treturn true;\n\t}\n\tupdateItemId(oldId, newId) {\n\t\tif (oldId === newId) return true;\n\t\tconst item = this.idToItem.get(oldId);\n\t\tif (item == null) {\n\t\t\tconsole.error(`CodeView.updateItemId: unknown item id \"${oldId}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tif (this.idToItem.has(newId)) {\n\t\t\tconsole.error(`CodeView.updateItemId: duplicate item id \"${newId}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tthis.idToItem.delete(oldId);\n\t\titem.item.id = newId;\n\t\tthis.idToItem.set(newId, item);\n\t\tthis.updateItemOptionsId(item.instance.options, newId);\n\t\tif (this.selectedLines?.id === oldId) {\n\t\t\tthis.selectedLines = {\n\t\t\t\t...this.selectedLines,\n\t\t\t\tid: newId\n\t\t\t};\n\t\t\tthis.options.onSelectedLinesChange?.(this.selectedLines);\n\t\t}\n\t\tthis.renamePendingScrollTarget(oldId, newId);\n\t\tthis.renamePendingLayoutAnchor(oldId, newId);\n\t\tthis.render();\n\t\treturn true;\n\t}\n\taddItem(input) {\n\t\tthis.addItems([input]);\n\t\tthis.syncSelection();\n\t}\n\taddItems(inputs) {\n\t\tthis.appendItemsInternal(inputs);\n\t\tthis.syncSelection();\n\t}\n\tsetItems(items) {\n\t\tif (items.length === 0) this.reset();\n\t\telse if (this.items.length === 0) this.appendItemsInternal(items);\n\t\telse if (!this.tryAppendItems(items)) this.reconcileItems(items);\n\t\tthis.syncSelection();\n\t}\n\t/**\n\t* Append new records to the viewer while preserving existing layout state.\n\t* This is the shared path for imperative adds and the append-only reconcile\n\t* fast path, so it measures new items immediately and only triggers render\n\t* once at the end.\n\t*/\n\tappendItemsInternal(inputs, render = true) {\n\t\tif (inputs.length === 0) return;\n\t\tconst layout = this.getLayout();\n\t\tlet nextTop = this.items.length === 0 ? 0 : this.scrollHeight + layout.gap;\n\t\tconst appendedTop = nextTop;\n\t\tfor (let index = 0; index < inputs.length; index++) {\n\t\t\tconst input = inputs[index];\n\t\t\tif (input == null) throw new Error(\"CodeView.appendItemsInternal: missing input item\");\n\t\t\tif (this.idToItem.has(input.id)) throw new Error(`CodeView.addItem: duplicate id \"${input.id}\"`);\n\t\t\tconst item = this.createItem(input, this.items.length, nextTop);\n\t\t\tthis.items.push(item);\n\t\t\tthis.idToItem.set(item.item.id, item);\n\t\t\tthis.instanceToItem.set(item.instance, item);\n\t\t\titem.height = prepareItemInstance(item);\n\t\t\tnextTop += item.height + layout.gap;\n\t\t}\n\t\tthis.scrollHeight = nextTop - layout.gap;\n\t\tthis.scrollDirty = true;\n\t\tif (render) if (this.canSkipRenderForAppend(appendedTop)) this.syncContainerHeight();\n\t\telse this.render();\n\t}\n\tcanSkipRenderForAppend(appendedTop) {\n\t\treturn this.container != null && this.renderState.firstIndex !== -1 && this.pendingScrollTarget == null && this.scrollAnimation == null && this.layoutDirtyIndex == null && appendedTop > this.windowSpecs.bottom;\n\t}\n\tonThemeChange() {\n\t\tthis.invalidateElementPool();\n\t}\n\tsetOptions(options) {\n\t\tif (options == null) return;\n\t\tthis.capturePendingLayoutAnchor();\n\t\tconst { options: prevOptions } = this;\n\t\tconst previousLayout = this.getLayout();\n\t\tconst { itemMetricsCache: previousItemMetrics } = this;\n\t\tif (shouldClearPool(prevOptions, options)) this.invalidateElementPool();\n\t\tthis.options = options;\n\t\tconst nextItemMetrics = this.computeMetricsCache(options.itemMetrics);\n\t\tconst itemMetricsChanged = !areObjectsEqual(previousItemMetrics, nextItemMetrics);\n\t\tconst layoutChanged = !areObjectsEqual(previousLayout, this.getLayout());\n\t\tif (layoutChanged) this.syncLayout();\n\t\tconst itemLayoutChanged = itemMetricsChanged || hasItemLayoutOptionChanged(prevOptions, options);\n\t\tif (itemLayoutChanged) {\n\t\t\tconst previousReset = this.pendingLayoutReset;\n\t\t\tthis.pendingLayoutReset = {\n\t\t\t\tmetrics: itemMetricsChanged ? nextItemMetrics : previousReset?.metrics,\n\t\t\t\tresetFileLayoutCache: true,\n\t\t\t\tresetDiffLayoutCache: true,\n\t\t\t\tincludeEstimatedDiffHeights: previousReset?.includeEstimatedDiffHeights === true || itemMetricsChanged || hasCodeViewDiffEstimateOptionChanged(prevOptions, options)\n\t\t\t};\n\t\t}\n\t\tif (layoutChanged || itemLayoutChanged) {\n\t\t\tthis.markLayoutDirtyFromIndex(0);\n\t\t\tthis.scrollDirty = true;\n\t\t}\n\t\tif (!areOptionsEqual(prevOptions, options)) this.renderOptionsRevision++;\n\t\tif (!this.isContainerManaged && this.items.length > 0) this.render();\n\t}\n\tcapturePendingLayoutAnchor() {\n\t\tif (this.root == null || this.items.length === 0 || this.pendingScrollTarget != null) return;\n\t\tthis.pendingLayoutAnchor = this.getScrollAnchor(this.getScrollTop());\n\t}\n\trender(immediate = false) {\n\t\tif (CodeView.__STOP) return;\n\t\tif (immediate) {\n\t\t\tdequeueRender(this.computeRenderRangeAndEmit);\n\t\t\tthis.computeRenderRangeAndEmit();\n\t\t} else queueRender(this.computeRenderRangeAndEmit);\n\t}\n\tinstanceChanged(instance, layoutDirty) {\n\t\tconst item = this.instanceToItem.get(instance);\n\t\tif (item == null) throw new Error(\"CodeView.instanceChanged: An instance has changed that is not registered\");\n\t\tif (layoutDirty) this.markItemLayoutDirty(item);\n\t\tthis.render();\n\t}\n\tgetWindowSpecs() {\n\t\treturn this.windowSpecs;\n\t}\n\tgetContainerElement() {\n\t\treturn this.root;\n\t}\n\tgetRenderedItems() {\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1 || lastIndex < firstIndex) return [];\n\t\tconst renderedItems = [];\n\t\tfor (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item?.element == null) continue;\n\t\t\tif (item.type === \"diff\") renderedItems.push({\n\t\t\t\tid: item.item.id,\n\t\t\t\ttype: \"diff\",\n\t\t\t\titem: item.item,\n\t\t\t\tversion: item.version,\n\t\t\t\telement: item.element,\n\t\t\t\tinstance: item.instance\n\t\t\t});\n\t\t\telse renderedItems.push({\n\t\t\t\tid: item.item.id,\n\t\t\t\ttype: \"file\",\n\t\t\t\titem: item.item,\n\t\t\t\tversion: item.version,\n\t\t\t\telement: item.element,\n\t\t\t\tinstance: item.instance\n\t\t\t});\n\t\t}\n\t\treturn renderedItems;\n\t}\n\tsetSlotCoordinator(coordinator) {\n\t\tif (coordinator === this.slotCoordinator) return false;\n\t\tthis.slotCoordinator = coordinator;\n\t\tthis.slotSnapshot = void 0;\n\t\treturn true;\n\t}\n\tgetSlotSnapshot(coordinator) {\n\t\treturn getSlotSnapshot(this.getRenderedItems(), coordinator);\n\t}\n\tsubscribeToScroll(listener) {\n\t\tthis.scrollListeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.scrollListeners.delete(listener);\n\t\t};\n\t}\n\tgetLocalTopForInstance(instance) {\n\t\tconst item = this.instanceToItem.get(instance);\n\t\tif (item == null) throw new Error(\"CodeView.getLocalTopForInstance: unknown virtualized instance\");\n\t\treturn item.top;\n\t}\n\tgetTopForItem(id) {\n\t\tconst item = this.idToItem.get(id);\n\t\tif (item == null) return;\n\t\treturn item.top + this.getLayout().paddingTop;\n\t}\n\tcreateItem(input, index, top) {\n\t\tconst { itemMetricsCache: itemMetrics } = this;\n\t\tif (input.type === \"diff\") {\n\t\t\tconst instance$1 = new VirtualizedFileDiff(this.createDiffOptions(input.id), this, itemMetrics, this.workerManager, this.isContainerManaged);\n\t\t\treturn {\n\t\t\t\ttype: \"diff\",\n\t\t\t\titem: input,\n\t\t\t\tversion: input.version,\n\t\t\t\tindex,\n\t\t\t\ttop,\n\t\t\t\theight: 0,\n\t\t\t\telement: void 0,\n\t\t\t\trenderedOptionsRevision: this.renderOptionsRevision,\n\t\t\t\tinstance: instance$1\n\t\t\t};\n\t\t}\n\t\tconst instance = new VirtualizedFile(this.createFileOptions(input.id), this, itemMetrics, this.workerManager, this.isContainerManaged);\n\t\treturn {\n\t\t\ttype: \"file\",\n\t\t\titem: input,\n\t\t\tversion: input.version,\n\t\t\tindex,\n\t\t\ttop,\n\t\t\theight: 0,\n\t\t\telement: void 0,\n\t\t\trenderedOptionsRevision: this.renderOptionsRevision,\n\t\t\tinstance\n\t\t};\n\t}\n\tapplySelectedLines(selection, options) {\n\t\tconst { selectedLines: prevSelection } = this;\n\t\tif (selection == null && prevSelection == null || selection != null && prevSelection?.id === selection.id && areSelectionsEqual(prevSelection.range, selection.range)) return;\n\t\tif (prevSelection != null && prevSelection.id !== selection?.id) this.idToItem.get(prevSelection.id)?.instance.setSelectedLines(null, { notify: false });\n\t\tthis.selectedLines = selection;\n\t\tthis.idToItem.get(selection?.id ?? \"\")?.instance.setSelectedLines(selection?.range ?? null, options);\n\t}\n\tsyncSelection() {\n\t\tif (this.selectedLines == null) return;\n\t\tconst item = this.idToItem.get(this.selectedLines.id);\n\t\tif (item == null) {\n\t\t\tthis.selectedLines = null;\n\t\t\treturn;\n\t\t}\n\t\titem.instance.setSelectedLines(this.selectedLines.range, { notify: false });\n\t}\n\trenamePendingScrollTarget(oldId, newId) {\n\t\tconst { pendingScrollTarget } = this;\n\t\tif (pendingScrollTarget == null || pendingScrollTarget.type === \"position\" || pendingScrollTarget.id !== oldId) return;\n\t\tthis.pendingScrollTarget = {\n\t\t\t...pendingScrollTarget,\n\t\t\tid: newId\n\t\t};\n\t}\n\trenamePendingLayoutAnchor(oldId, newId) {\n\t\tif (this.pendingLayoutAnchor?.id === oldId) this.pendingLayoutAnchor.id = newId;\n\t}\n\tcreateFileOptionsPrototype() {\n\t\tconst prototype = {};\n\t\tfor (const key of CODE_VIEW_FILE_OPTION_KEYS) defineItemOption(prototype, key, () => this.options[key]);\n\t\tdefineItemOption(prototype, \"stickyHeader\", () => this.options.stickyHeaders);\n\t\tdefineItemOption(prototype, \"collapsed\", (receiver) => this.getItemOptions(getItemOptionsState(receiver), \"file\")?.item.collapsed === true);\n\t\tfor (const key of CODE_VIEW_SHARED_CALLBACK_KEYS) this.defineItemSharedCallback(prototype, \"file\", key);\n\t\tfor (const key of CODE_VIEW_SELECTION_CALLBACK_KEYS) this.defineItemSelectionCallback(prototype, \"file\", key);\n\t\treturn prototype;\n\t}\n\tcreateDiffOptionsPrototype() {\n\t\tconst prototype = {};\n\t\tfor (const key of CODE_VIEW_DIFF_OPTION_KEYS) defineItemOption(prototype, key, () => this.options[key]);\n\t\tdefineItemOption(prototype, \"stickyHeader\", () => this.options.stickyHeaders);\n\t\tdefineItemOption(prototype, \"hunkSeparators\", () => this.options.hunkSeparators);\n\t\tdefineItemOption(prototype, \"collapsed\", (receiver) => this.getItemOptions(getItemOptionsState(receiver), \"diff\")?.item.collapsed === true);\n\t\tfor (const key of CODE_VIEW_SHARED_CALLBACK_KEYS) this.defineItemSharedCallback(prototype, \"diff\", key);\n\t\tfor (const key of CODE_VIEW_SELECTION_CALLBACK_KEYS) this.defineItemSelectionCallback(prototype, \"diff\", key);\n\t\treturn prototype;\n\t}\n\tcreateFileOptions(id) {\n\t\tconst options = Object.create(this.fileOptionsPrototype);\n\t\tdefineOptionsState(options, { id });\n\t\treturn options;\n\t}\n\tcreateDiffOptions(id) {\n\t\tconst options = Object.create(this.diffOptionsPrototype);\n\t\tdefineOptionsState(options, { id });\n\t\treturn options;\n\t}\n\tupdateItemOptionsId(options, id) {\n\t\tgetItemOptionsState(options).id = id;\n\t}\n\tgetItemOptions(state, mode) {\n\t\tconst item = this.idToItem.get(state.id);\n\t\tif (item == null || item.type !== mode) return;\n\t\treturn item;\n\t}\n\tdefineItemSharedCallback(options, mode, key) {\n\t\tdefineItemOption(options, key, (receiver) => {\n\t\t\tif (this.options[key] == null) return;\n\t\t\tconst state = getItemOptionsState(receiver);\n\t\t\tconst callbackCache = state.callbackCache ??= {};\n\t\t\tlet wrapped = callbackCache[key];\n\t\t\tif (wrapped == null) {\n\t\t\t\twrapped = ((...args) => {\n\t\t\t\t\tconst latest = this.getItemOptions(state, mode);\n\t\t\t\t\tif (latest == null) return;\n\t\t\t\t\tconst callback = this.options[key];\n\t\t\t\t\treturn callback?.(...args, latest);\n\t\t\t\t});\n\t\t\t\tcallbackCache[key] = wrapped;\n\t\t\t}\n\t\t\treturn wrapped;\n\t\t});\n\t}\n\tdefineItemSelectionCallback(options, mode, key) {\n\t\tdefineItemOption(options, key, (receiver) => {\n\t\t\tif (this.options.enableLineSelection !== true) return;\n\t\t\tconst state = getItemOptionsState(receiver);\n\t\t\tconst callbackCache = state.callbackCache ??= {};\n\t\t\tlet wrapped = callbackCache[key];\n\t\t\tif (wrapped == null) {\n\t\t\t\twrapped = ((range) => {\n\t\t\t\t\tconst latest = this.getItemOptions(state, mode);\n\t\t\t\t\tif (latest == null) return;\n\t\t\t\t\tconst selection = range == null ? null : {\n\t\t\t\t\t\tid: latest.item.id,\n\t\t\t\t\t\trange\n\t\t\t\t\t};\n\t\t\t\t\tif (this.options.controlledSelection !== true) {\n\t\t\t\t\t\tif (range != null || this.selectedLines?.id === latest.item.id) this.applySelectedLines(selection, { notify: false });\n\t\t\t\t\t}\n\t\t\t\t\tthis.options.onSelectedLinesChange?.(selection);\n\t\t\t\t\tconst callback = this.options[key];\n\t\t\t\t\treturn callback?.(range, latest);\n\t\t\t\t});\n\t\t\t\tcallbackCache[key] = wrapped;\n\t\t\t}\n\t\t\treturn wrapped;\n\t\t});\n\t}\n\t/**\n\t* Track the earliest index whose measured layout may now be stale. Later\n\t* render passes relayout from this point forward so we do not have to rebuild\n\t* positions for the whole list after every change.\n\t*/\n\tmarkLayoutDirtyFromIndex(index) {\n\t\tthis.layoutDirtyIndex = Math.min(this.layoutDirtyIndex ?? index, index);\n\t}\n\t/**\n\t* Mark the earliest affected item as layout-dirty after an imperative change.\n\t* Each record carries its current array index so this stays O(1) even when\n\t* the viewer holds a very large number of items.\n\t*/\n\tmarkItemLayoutDirty(item) {\n\t\tif (this.items[item.index] !== item) throw new Error(`CodeView.markItemLayoutDirty: unknown item id \"${item.item.id}\"`);\n\t\tthis.markLayoutDirtyFromIndex(item.index);\n\t}\n\t/**\n\t* Detect the common controlled-update case where the new list simply extends\n\t* the existing ordered prefix. When that happens we can reuse every current\n\t* record in place, sync any versioned payload changes, and append only the new\n\t* tail instead of rebuilding the whole list.\n\t*/\n\ttryAppendItems(items) {\n\t\tif (items.length <= this.items.length) return false;\n\t\tfor (let index = 0; index < this.items.length; index++) {\n\t\t\tconst existingItem = this.items[index];\n\t\t\tif (existingItem == null) throw new Error(\"CodeView.tryAppendItems: missing existing item\");\n\t\t\tconst nextItem = items[index];\n\t\t\tif (nextItem == null || existingItem.item.id !== nextItem.id || existingItem.type !== nextItem.type) return false;\n\t\t}\n\t\tfor (let index = 0; index < this.items.length; index++) {\n\t\t\tconst existingItem = this.items[index];\n\t\t\tif (existingItem == null) throw new Error(\"CodeView.tryAppendItems: missing existing item\");\n\t\t\tconst nextItem = items[index];\n\t\t\tif (nextItem == null) throw new Error(\"CodeView.tryAppendItems: append candidate missing prefix item\");\n\t\t\tif (this.syncItemRecord(existingItem, nextItem)) this.markLayoutDirtyFromIndex(index);\n\t\t}\n\t\tthis.appendItemsInternal(items.slice(this.items.length), false);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t\treturn true;\n\t}\n\t/**\n\t* Reconcile a new controlled item list against the existing records by id.\n\t* This reuses records and instances when type matches, cleans up removed\n\t* records, rebuilds the lookup maps, and marks layout dirty whenever order,\n\t* membership, or versioned item data changes.\n\t*/\n\treconcileItems(items) {\n\t\tconst { items: previousItems, idToItem: previousById } = this;\n\t\tconst removedItems = new Set(previousItems);\n\t\tconst nextItems = [];\n\t\tconst nextIdToItem = /* @__PURE__ */ new Map();\n\t\tconst nextInstanceToItem = /* @__PURE__ */ new Map();\n\t\tlet firstDirtyIndex;\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst input = items[index];\n\t\t\tif (input == null) throw new Error(\"CodeView.reconcileItems: missing input item\");\n\t\t\tif (nextIdToItem.has(input.id)) throw new Error(`CodeView.setItems: duplicate id \"${input.id}\"`);\n\t\t\tconst previousItem = previousById.get(input.id);\n\t\t\tconst item = previousItem != null && previousItem.type === input.type ? previousItem : this.createItem(input, index, 0);\n\t\t\titem.index = index;\n\t\t\tif (previousItem != null && previousItem.type === input.type) {\n\t\t\t\tremovedItems.delete(previousItem);\n\t\t\t\tif (this.syncItemRecord(item, input)) firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\t} else firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\tif (previousItems[index] !== item) firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\tnextItems.push(item);\n\t\t\tnextIdToItem.set(input.id, item);\n\t\t\tnextInstanceToItem.set(item.instance, item);\n\t\t}\n\t\tfor (let index = 0; index < previousItems.length; index++) {\n\t\t\tconst removedItem = previousItems[index];\n\t\t\tif (removedItem == null || !removedItems.has(removedItem)) continue;\n\t\t\tthis.releaseRenderedItem(removedItem);\n\t\t\tconst dirtyIndex = Math.max(nextItems.length - 1, 0);\n\t\t\tfirstDirtyIndex = Math.min(firstDirtyIndex ?? dirtyIndex, dirtyIndex);\n\t\t}\n\t\tif (firstDirtyIndex == null) return;\n\t\tthis.items = nextItems;\n\t\tthis.idToItem = nextIdToItem;\n\t\tthis.instanceToItem = nextInstanceToItem;\n\t\tif (this.renderState.firstIndex >= nextItems.length) this.resetRenderState();\n\t\telse if (this.renderState.lastIndex >= nextItems.length) this.renderState.lastIndex = nextItems.length - 1;\n\t\tthis.markLayoutDirtyFromIndex(firstDirtyIndex);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t}\n\t/**\n\t* Update a reused record from the latest controlled item only when its item\n\t* version changes. Matching versions mean CodeView keeps the current record\n\t* snapshot, which lets imperative updates remain in place until the caller\n\t* intentionally publishes a newer version.\n\t*/\n\tsyncItemRecord(item, nextItem) {\n\t\tif (item.type !== nextItem.type) throw new Error(`CodeView.syncItemRecord: type mismatch for id \"${nextItem.id}\"`);\n\t\tif (item.version === nextItem.version) return false;\n\t\titem.item = nextItem;\n\t\titem.version = nextItem.version;\n\t\titem.renderedOptionsRevision = -1;\n\t\treturn true;\n\t}\n\tgetMaxScrollTopForHeight(scrollHeight) {\n\t\tconst { paddingBottom, paddingTop } = this.getLayout();\n\t\treturn Math.max(paddingTop + scrollHeight + paddingBottom - this.getHeight(), 0);\n\t}\n\tgetMaxScrollTop() {\n\t\treturn this.getMaxScrollTopForHeight(this.getScrollHeight());\n\t}\n\tshouldRebaseScroll() {\n\t\treturn this.getMaxScrollTop() > SCROLL_REBASE_THRESHOLD;\n\t}\n\tgetPagedScrollHeight() {\n\t\treturn this.shouldRebaseScroll() ? Math.min(this.getScrollHeight(), SCROLL_REBASE_CONTAINER_HEIGHT) : this.getScrollHeight();\n\t}\n\tgetMaxPagedScrollTop() {\n\t\treturn this.getMaxScrollTopForHeight(this.getPagedScrollHeight());\n\t}\n\tclampPagedScrollTop(value) {\n\t\tconst maxScroll = this.getMaxPagedScrollTop();\n\t\treturn Math.max(0, Math.min(value, maxScroll));\n\t}\n\t/**\n\t* Clamps a logical scroll position to the min/max allowable scroll range\n\t* based on the full computed content height.\n\t*/\n\tclampScrollTop(value) {\n\t\tconst maxScroll = this.getMaxScrollTop();\n\t\treturn Math.max(0, Math.min(value, maxScroll));\n\t}\n\tgetMaxScrollPageOffset() {\n\t\treturn Math.max(this.getMaxScrollTop() - this.getMaxPagedScrollTop(), 0);\n\t}\n\tclampScrollPageOffset(value) {\n\t\tconst maxOffset = this.getMaxScrollPageOffset();\n\t\treturn Math.max(0, Math.min(value, maxOffset));\n\t}\n\tresolveScrollPageWindow(scrollTop, preferredPagedScrollTop) {\n\t\tlet pagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(preferredPagedScrollTop));\n\t\tlet scrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);\n\t\tpagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(scrollTop - scrollPageOffset));\n\t\tscrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);\n\t\treturn {\n\t\t\tpagedScrollTop,\n\t\t\tscrollPageOffset\n\t\t};\n\t}\n\t/**\n\t* Resolve how a logical scrollTop maps onto the reusable paged scroll window\n\t* without mutating the current page offset.\n\t*/\n\tresolvePagedScrollPosition(logicalScrollTop) {\n\t\tif (!this.shouldRebaseScroll()) return {\n\t\t\tpagedScrollTop: this.clampPagedScrollTop(logicalScrollTop),\n\t\t\tscrollPageOffset: 0\n\t\t};\n\t\tconst currentPageOffset = this.clampScrollPageOffset(this.scrollPageOffset);\n\t\tconst pagedScrollTop = logicalScrollTop - currentPageOffset;\n\t\tconst pagedMaxScrollTop = this.getMaxPagedScrollTop();\n\t\tconst maxRebaseOffset = this.getMaxScrollPageOffset();\n\t\tconst shouldMoveDown = pagedScrollTop > SCROLL_REBASE_THRESHOLD && currentPageOffset < maxRebaseOffset;\n\t\tconst shouldMoveUp = pagedScrollTop < SCROLL_REBASE_TRIGGER_TOP && currentPageOffset > 0;\n\t\tif (pagedScrollTop < 0 || pagedScrollTop > pagedMaxScrollTop || shouldMoveDown || shouldMoveUp) return this.resolveScrollPageWindow(logicalScrollTop, shouldMoveUp ? Math.min(SCROLL_REBASE_TARGET_BOTTOM, pagedMaxScrollTop) : SCROLL_REBASE_TARGET_TOP);\n\t\treturn {\n\t\t\tpagedScrollTop: roundToDevicePixel(this.clampPagedScrollTop(pagedScrollTop)),\n\t\t\tscrollPageOffset: currentPageOffset\n\t\t};\n\t}\n\tneedsScrollPageUpdate(logicalScrollTop) {\n\t\tconst roundedScrollTop = roundToDevicePixel(this.clampScrollTop(logicalScrollTop));\n\t\tconst { scrollPageOffset } = this.resolvePagedScrollPosition(roundedScrollTop);\n\t\treturn scrollPageOffset !== this.scrollPageOffset;\n\t}\n\tgetPagedLayoutTop(logicalTop) {\n\t\tif (!this.shouldRebaseScroll()) return logicalTop;\n\t\treturn Math.max(logicalTop - this.scrollPageOffset, 0);\n\t}\n\tgetStickyHeaderOffset() {\n\t\treturn this.options.stickyHeaders === true && this.options.disableFileHeader !== true ? this.itemMetricsCache.diffHeaderHeight : 0;\n\t}\n\tgetScrollTargetRect(target) {\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unknown item id \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\tif (target.type === \"item\") return {\n\t\t\ttop: item.top,\n\t\t\theight: item.height\n\t\t};\n\t\tif (target.type === \"range\") {\n\t\t\tconst rangePosition = this.getRangeScrollPosition(item, target);\n\t\t\tif (rangePosition == null) {\n\t\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item \"${target.id}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttop: item.top + rangePosition.top,\n\t\t\t\theight: rangePosition.height\n\t\t\t};\n\t\t}\n\t\tconst linePosition = this.getLineScrollPosition(item, target);\n\t\tif (linePosition == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\treturn {\n\t\t\ttop: item.top + linePosition.top,\n\t\t\theight: linePosition.height\n\t\t};\n\t}\n\tnormalizeScrollTarget(target) {\n\t\tif (target.type === \"position\" || target.align !== \"nearest\") return target;\n\t\tconst rect = this.getScrollTargetRect(target);\n\t\tif (rect == null) return;\n\t\tconst offset = target.offset ?? 0;\n\t\tconst targetTop = this.getLayout().paddingTop + rect.top;\n\t\tconst targetBottom = targetTop + rect.height;\n\t\tconst currentTop = this.getScrollTop();\n\t\tconst visibleTop = currentTop + (target.type === \"line\" || target.type === \"range\" ? this.getStickyHeaderOffset() : 0);\n\t\tconst visibleBottom = currentTop + this.getHeight();\n\t\tif (targetTop - offset <= visibleTop && targetBottom + offset >= visibleBottom) return;\n\t\tif (targetTop - offset < visibleTop) return {\n\t\t\t...target,\n\t\t\talign: \"start\"\n\t\t};\n\t\tif (targetBottom + offset > visibleBottom) return {\n\t\t\t...target,\n\t\t\talign: \"end\"\n\t\t};\n\t}\n\t/**\n\t* Resolve a target's scroll position\n\t\n\t* Returns `undefined` when we can't resolve a target for whatever reason\n\t*/\n\tresolveScrollTargetTop(target) {\n\t\tif (target.type === \"position\") {\n\t\t\tconst clampedPosition = this.clampScrollTop(target.position);\n\t\t\treturn clampedPosition !== target.position ? clampedPosition : this.clampScrollTop(target.position - this.getStickyHeaderOffset());\n\t\t}\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unknown item id \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\tif (target.type === \"item\") return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top, item.height, target.align, target.offset));\n\t\tif (target.type === \"range\") {\n\t\t\tconst rangePosition = this.getRangeScrollPosition(item, target);\n\t\t\tif (rangePosition == null) {\n\t\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item \"${target.id}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + rangePosition.top, rangePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));\n\t\t}\n\t\tconst linePosition = this.getLineScrollPosition(item, target);\n\t\tif (linePosition == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\treturn this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + linePosition.top, linePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));\n\t}\n\t/**\n\t* Given an existing scroll target (scroll top and height), figure out the\n\t* correct scroll position to target based on the desired alignment, offset\n\t* and stickyOffset if necessary\n\t*/\n\tresolveAlignedScrollPosition(targetTop, targetHeight, align, offset = 0, stickyOffset = 0) {\n\t\ttargetTop += this.getLayout().paddingTop;\n\t\tconst viewportHeight = this.getHeight();\n\t\tif (align === \"center\" && targetHeight + offset < viewportHeight) return targetTop - (viewportHeight - targetHeight) / 2 + offset;\n\t\tif (align === \"end\") return targetTop - (viewportHeight - targetHeight) + offset;\n\t\treturn targetTop - stickyOffset - offset;\n\t}\n\tgetLineScrollPosition(item, target) {\n\t\tif (item.type === \"diff\") return item.instance.getLinePosition(target.lineNumber, target.side);\n\t\treturn item.instance.getLinePosition(target.lineNumber);\n\t}\n\tgetRangeScrollPosition(item, target) {\n\t\tconst { range } = target;\n\t\tconst startPosition = this.getLineScrollPosition(item, {\n\t\t\ttype: \"line\",\n\t\t\tid: target.id,\n\t\t\tlineNumber: range.start,\n\t\t\tside: range.side\n\t\t});\n\t\tconst endPosition = this.getLineScrollPosition(item, {\n\t\t\ttype: \"line\",\n\t\t\tid: target.id,\n\t\t\tlineNumber: range.end,\n\t\t\tside: range.endSide ?? range.side\n\t\t});\n\t\tif (startPosition == null || endPosition == null) return;\n\t\tconst startTop = startPosition.top;\n\t\tconst startBottom = startTop + startPosition.height;\n\t\tconst endTop = endPosition.top;\n\t\tconst endBottom = endTop + endPosition.height;\n\t\tconst top = Math.min(startTop, endTop);\n\t\treturn {\n\t\t\ttop,\n\t\t\theight: Math.max(startBottom, endBottom) - top\n\t\t};\n\t}\n\t/**\n\t* Determine target scroll position for current frame.\n\t*\n\t* If there's no pendingScrollTarget then we just return the current scroll\n\t* position\n\t*\n\t* If there's a pendingScrollTarget then we depend on whether there's a\n\t* smooth scroll animation or not. If not just return the destination, or\n\t* compute next position given the smooth scroll spring physics\n\t*/\n\tcomputeTargetScrollTopForFrame(scrollTop, frameTimestamp) {\n\t\tif (this.pendingScrollTarget == null) return scrollTop;\n\t\tconst destination = this.resolveScrollTargetTop(this.pendingScrollTarget);\n\t\tif (destination == null) return scrollTop;\n\t\tconst { scrollAnimation } = this;\n\t\tif (scrollAnimation == null) return destination;\n\t\treturn this.computeSpringStep(scrollAnimation, destination, frameTimestamp).position;\n\t}\n\t/**\n\t* Closed-form critical-damped ODE step.\n\t*\n\t* Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n\t* big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n\t* fire outside the normal RAF cadence.\n\t*/\n\tcomputeSpringStep(animation, destination, frameTimestamp) {\n\t\tconst dt = Math.max(0, frameTimestamp - animation.lastTimestamp);\n\t\tconst { omega } = this.getSmoothScrollSettings();\n\t\tconst decay = Math.exp(-omega * dt);\n\t\tconst displacement = animation.position - destination;\n\t\tconst springCoeff = animation.velocity + omega * displacement;\n\t\treturn {\n\t\t\tposition: destination + (displacement + springCoeff * dt) * decay,\n\t\t\tvelocity: (springCoeff * (1 - omega * dt) - omega * displacement) * decay\n\t\t};\n\t}\n\t/**\n\t* For any given pendingScrollTarget, updates any in flight smooth scroll\n\t* animations and returns the target scrollTop to move towards\n\t*\n\t* Resolves the animation based on frame time and adopts any necessary scroll\n\t* anchoring corrections if necessary\n\t*/\n\tadvanceScrollAnimation(frameTimestamp, anchorDelta) {\n\t\tif (this.pendingScrollTarget == null) return;\n\t\tconst destination = this.resolveScrollTargetTop(this.pendingScrollTarget);\n\t\tif (destination == null) {\n\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t\treturn;\n\t\t}\n\t\tconst animation = this.scrollAnimation;\n\t\tif (animation == null) return destination;\n\t\tanimation.position += anchorDelta;\n\t\tconst { position, velocity } = this.computeSpringStep(animation, destination, frameTimestamp);\n\t\tanimation.lastTimestamp = frameTimestamp;\n\t\tanimation.position = position;\n\t\tanimation.velocity = velocity;\n\t\tconst { positionEpsilon, velocityEpsilon } = this.getSmoothScrollSettings();\n\t\tif (Math.abs(destination - position) <= positionEpsilon && Math.abs(velocity) <= velocityEpsilon) {\n\t\t\tanimation.position = destination;\n\t\t\tanimation.velocity = 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t\treturn destination;\n\t\t}\n\t\treturn animation.position;\n\t}\n\tcomputeRenderRangeAndEmit = (timestamp = performance.now()) => {\n\t\tif (CodeView.__STOP || this.container == null) return;\n\t\tconst viewportHeight = this.getHeight();\n\t\tconst initialScrollTop = this.getScrollTop();\n\t\tlet scrollTopAfterLayout = initialScrollTop;\n\t\tlet computeScrollCorrection = this.pendingLayoutAnchor != null;\n\t\tlet scrollAnchor = this.getScrollAnchor(scrollTopAfterLayout);\n\t\tif (this.layoutDirtyIndex != null) {\n\t\t\tthis.recomputeLayout(this.layoutDirtyIndex, this.pendingLayoutReset);\n\t\t\tthis.layoutDirtyIndex = void 0;\n\t\t\tthis.pendingLayoutReset = void 0;\n\t\t\tcomputeScrollCorrection = true;\n\t\t}\n\t\tif (computeScrollCorrection && scrollAnchor != null) {\n\t\t\tconst anchoredScrollTopAfterLayout = this.resolveAnchoredScrollTop(scrollAnchor);\n\t\t\tif (anchoredScrollTopAfterLayout != null) {\n\t\t\t\tconst layoutAnchorDelta = anchoredScrollTopAfterLayout - scrollTopAfterLayout;\n\t\t\t\tscrollTopAfterLayout = anchoredScrollTopAfterLayout;\n\t\t\t\tif (this.scrollAnimation != null) this.scrollAnimation.position += layoutAnchorDelta;\n\t\t\t}\n\t\t}\n\t\tif (computeScrollCorrection) {\n\t\t\tscrollTopAfterLayout = this.clampScrollTop(scrollTopAfterLayout);\n\t\t\tthis.syncContainerHeight();\n\t\t}\n\t\tconst targetScrollTop = this.computeTargetScrollTopForFrame(scrollTopAfterLayout, timestamp);\n\t\tconst fitPerfectly = !computeScrollCorrection && (this.renderState.scrollTop === -1 || Math.abs(targetScrollTop - this.renderState.scrollTop) > viewportHeight + this.config.overscrollSize * 2);\n\t\tif (fitPerfectly) scrollAnchor = void 0;\n\t\tthis.windowSpecs = createWindowFromScrollPosition({\n\t\t\tscrollTop: targetScrollTop,\n\t\t\theight: viewportHeight,\n\t\t\tscrollHeight: this.getScrollHeight(),\n\t\t\tfitPerfectly,\n\t\t\tfitPerfectlyOverscroll: this.getFitPerfectlyOverscroll(),\n\t\t\toverscrollSize: this.config.overscrollSize\n\t\t});\n\t\tlet syncedScrollTop = initialScrollTop;\n\t\tif (this.pendingScrollTarget != null && targetScrollTop !== syncedScrollTop || this.needsScrollPageUpdate(targetScrollTop)) {\n\t\t\tthis.applyScrollFix(targetScrollTop, syncedScrollTop, this.windowSpecs);\n\t\t\tsyncedScrollTop = targetScrollTop;\n\t\t}\n\t\tconst { top, bottom } = this.windowSpecs;\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex >= 0) for (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${index}`);\n\t\t\tif (!(item.top > top - item.height && item.top <= bottom)) this.releaseRenderedItem(item);\n\t\t}\n\t\tlet prevElement;\n\t\tconst updatedItems = /* @__PURE__ */ new Set();\n\t\tconst startingIndex = this.findFirstVisibleIndex(top);\n\t\tconst lastRenderedIndex = this.findLastVisibleIndex(bottom);\n\t\tfor (let itemIndex = startingIndex; itemIndex <= lastRenderedIndex; itemIndex++) {\n\t\t\tconst item = this.items[itemIndex];\n\t\t\tif (item == null) throw new Error(`CodeView.computeRenderRangeAndEmit: missing item`);\n\t\t\tconst { instance } = item;\n\t\t\tif (item.element == null) {\n\t\t\t\titem.element = this.acquireElement();\n\t\t\t\tsyncRenderedItemOrder(this.stickyContainer, item.element, prevElement);\n\t\t\t\tinstance.virtualizedSetup();\n\t\t\t\tif (renderItem(item, item.element)) {\n\t\t\t\t\titem.renderedOptionsRevision = this.renderOptionsRevision;\n\t\t\t\t\tupdatedItems.add(item);\n\t\t\t\t}\n\t\t\t\tprevElement = item.element;\n\t\t\t} else {\n\t\t\t\tsyncRenderedItemOrder(this.stickyContainer, item.element, prevElement);\n\t\t\t\tif (renderItem(item, void 0, item.renderedOptionsRevision !== this.renderOptionsRevision)) {\n\t\t\t\t\titem.renderedOptionsRevision = this.renderOptionsRevision;\n\t\t\t\t\tupdatedItems.add(item);\n\t\t\t\t}\n\t\t\t\tprevElement = item.element;\n\t\t\t}\n\t\t}\n\t\tthis.renderState.firstIndex = startingIndex <= lastRenderedIndex ? startingIndex : -1;\n\t\tthis.renderState.lastIndex = lastRenderedIndex;\n\t\tthis.flushSlotCoordinator();\n\t\tthis.reconcileRenderedItems(updatedItems);\n\t\tthis.syncContainerHeight();\n\t\tthis.updateStickyPositioning();\n\t\tconst anchoredScrollTopAfterRender = scrollAnchor != null ? this.resolveAnchoredScrollTop(scrollAnchor) : void 0;\n\t\tif (scrollAnchor === this.pendingLayoutAnchor) this.pendingLayoutAnchor = void 0;\n\t\tconst postRenderAnchorDelta = anchoredScrollTopAfterRender != null ? anchoredScrollTopAfterRender - scrollTopAfterLayout : 0;\n\t\tlet postRenderScrollTop = targetScrollTop;\n\t\tlet shouldCheckPendingTargetSettled = false;\n\t\tif (this.pendingScrollTarget != null) {\n\t\t\tconst pendingTargetScrollTop = this.advanceScrollAnimation(timestamp, postRenderAnchorDelta);\n\t\t\tif (pendingTargetScrollTop != null) {\n\t\t\t\tpostRenderScrollTop = pendingTargetScrollTop;\n\t\t\t\tshouldCheckPendingTargetSettled = true;\n\t\t\t} else postRenderScrollTop = scrollTopAfterLayout;\n\t\t} else postRenderScrollTop = anchoredScrollTopAfterRender ?? targetScrollTop;\n\t\tif (postRenderScrollTop !== syncedScrollTop) {\n\t\t\tthis.applyScrollFix(postRenderScrollTop, syncedScrollTop, this.windowSpecs);\n\t\t\tsyncedScrollTop = postRenderScrollTop;\n\t\t}\n\t\tif (shouldCheckPendingTargetSettled && this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {\n\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t}\n\t\tthis.renderState.scrollTop = roundToDevicePixel(syncedScrollTop);\n\t\tthis.flushManagers(updatedItems);\n\t\tthis.validateStickyContainerHeight();\n\t\tthis.fixContainerFocus();\n\t\tif (fitPerfectly || this.scrollAnimation != null) this.render();\n\t};\n\tflushManagers(updatedItems) {\n\t\tfor (const item of updatedItems) item.instance.flushManagers();\n\t}\n\tsyncContainerHeight() {\n\t\tconst pagedScrollHeight = this.getPagedScrollHeight();\n\t\tif (this.container == null || this.containerHeight === pagedScrollHeight) return;\n\t\tthis.container.style.height = `${pagedScrollHeight}px`;\n\t\tthis.containerHeight = pagedScrollHeight;\n\t}\n\tgetStickyBounds(windowSpecs) {\n\t\tconst { firstIndex, lastIndex } = windowSpecs != null ? {\n\t\t\tfirstIndex: this.findFirstVisibleIndex(windowSpecs.top),\n\t\t\tlastIndex: this.findLastVisibleIndex(windowSpecs.bottom)\n\t\t} : this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1 || firstIndex > lastIndex) return;\n\t\tconst firstStickySpecs = this.items[firstIndex]?.instance.getAdvancedStickySpecs(windowSpecs);\n\t\tconst lastStickySpecs = this.items[lastIndex]?.instance.getAdvancedStickySpecs(windowSpecs);\n\t\tif (firstStickySpecs == null || lastStickySpecs == null) return;\n\t\treturn {\n\t\t\tstickyTop: this.getPagedLayoutTop(Math.max(firstStickySpecs.topOffset, 0)),\n\t\t\tstickyBottom: this.getPagedLayoutTop(lastStickySpecs.topOffset + lastStickySpecs.height)\n\t\t};\n\t}\n\tapplyStickyPositioning({ stickyTop, stickyBottom }) {\n\t\tconst height = this.getHeight();\n\t\tconst { itemMetricsCache: itemMetrics } = this;\n\t\tconst stickyContainerHeight = stickyBottom - stickyTop;\n\t\tthis.renderState.stickyHeight = stickyContainerHeight;\n\t\tthis.renderState.stickyTop = stickyTop;\n\t\tthis.renderState.stickyBottom = stickyBottom;\n\t\tthis.stickyOffset.style.height = `${stickyTop}px`;\n\t\tconst randomOffset = (Math.random() * itemMetrics.lineHeight >> 0) * -1;\n\t\tconst stickyJitter = -Math.max(stickyContainerHeight + randomOffset, 0) + height;\n\t\tthis.stickyContainer.style.top = `${stickyJitter}px`;\n\t\tthis.stickyContainer.style.bottom = `${stickyJitter + itemMetrics.diffHeaderHeight}px`;\n\t}\n\tsyncPagedScrollScaffolding(windowSpecs) {\n\t\tthis.syncContainerHeight();\n\t\tconst stickyBounds = this.getStickyBounds(windowSpecs);\n\t\tif (stickyBounds == null) return;\n\t\tthis.applyStickyPositioning(stickyBounds);\n\t}\n\treconcileRenderedItems(updatedItems) {\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex === -1) return;\n\t\tlet currentTop = -1;\n\t\tlet heightChanged = false;\n\t\tfor (let index = firstIndex; index < this.items.length; index++) {\n\t\t\tif (!heightChanged && index > lastIndex) break;\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(\"CodeView.reconcileRenderedItems: Invalid item\");\n\t\t\tif (currentTop === -1) currentTop = item.top;\n\t\t\telse if (item.top !== currentTop) {\n\t\t\t\titem.top = currentTop;\n\t\t\t\titem.instance.syncVirtualizedTop();\n\t\t\t\theightChanged = true;\n\t\t\t}\n\t\t\tif (updatedItems == null ? index <= lastIndex : updatedItems.has(item)) {\n\t\t\t\tif (item.instance.reconcileHeights()) {\n\t\t\t\t\theightChanged = true;\n\t\t\t\t\titem.height = item.instance.getVirtualizedHeight();\n\t\t\t\t}\n\t\t\t\tthis.validateRenderedItemHeight(item);\n\t\t\t}\n\t\t\tcurrentTop += item.instance.getVirtualizedHeight();\n\t\t\tif (index < this.items.length - 1) currentTop += this.getLayout().gap;\n\t\t}\n\t\tif (heightChanged && currentTop != null) {\n\t\t\tthis.scrollDirty = true;\n\t\t\tthis.scrollHeight = currentTop;\n\t\t}\n\t}\n\tupdateStickyPositioning() {\n\t\tconst stickyBounds = this.getStickyBounds();\n\t\tif (stickyBounds == null) return;\n\t\tconst { stickyTop, stickyBottom } = stickyBounds;\n\t\tif (stickyBottom - stickyTop === this.renderState.stickyHeight && stickyTop === this.renderState.stickyTop && stickyBottom === this.renderState.stickyBottom) return;\n\t\tthis.applyStickyPositioning(stickyBounds);\n\t}\n\thandleScroll = () => {\n\t\tif (CodeView.__STOP) return;\n\t\tthis.suspendScrollInteractions();\n\t\tthis.scrollDirty = true;\n\t\tthis.notifyScroll();\n\t\tthis.render();\n\t};\n\tclearPendingScroll = () => {\n\t\tthis.pendingScrollTarget = void 0;\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.scrollAnimation = void 0;\n\t};\n\thandleResize = (entries) => {\n\t\tfor (const entry of entries) if (entry.target === this.stickyContainer) {\n\t\t\tif (entry.borderBoxSize[0].blockSize !== this.renderState.stickyHeight) {\n\t\t\t\tconst currentScrollTop = this.getScrollTop();\n\t\t\t\tconst anchor = this.getScrollAnchor(currentScrollTop);\n\t\t\t\tthis.reconcileRenderedItems();\n\t\t\t\tthis.updateStickyPositioning();\n\t\t\t\tconst anchoredScrollTop = anchor != null ? this.resolveAnchoredScrollTop(anchor) : void 0;\n\t\t\t\tif (anchoredScrollTop != null) {\n\t\t\t\t\tconst resizeAnchorDelta = anchoredScrollTop - currentScrollTop;\n\t\t\t\t\tthis.applyScrollFix(anchoredScrollTop, currentScrollTop, this.windowSpecs);\n\t\t\t\t\tif (this.scrollAnimation != null) this.scrollAnimation.position += resizeAnchorDelta;\n\t\t\t\t}\n\t\t\t\tif (this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {\n\t\t\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\t\t\tthis.scrollAnimation = void 0;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.scrollDirty = true;\n\t\t\tthis.heightDirty = true;\n\t\t\tthis.render();\n\t\t}\n\t};\n\t/**\n\t* Figure out scrollTop accounting for sticky header if enabled and\n\t* necessary\n\t*/\n\tgetScrollAnchorViewportTop(absoluteItemTop, scrollTop) {\n\t\treturn absoluteItemTop < scrollTop ? scrollTop + this.getStickyHeaderOffset() : scrollTop;\n\t}\n\t/**\n\t* Attempt to find a scroll anchor based on build in metrics of the existing\n\t* rendered files/diff.\n\t*\n\t* A scroll anchor represents the first fully visible element (in other\n\t* words, the first file or first line who's top is fully in the viewport).\n\t*/\n\tgetScrollAnchor(scrollTop) {\n\t\tif (this.pendingLayoutAnchor != null) return this.pendingLayoutAnchor;\n\t\tconst { firstIndex, lastIndex, stickyTop, stickyBottom } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1) return;\n\t\tconst viewportHeight = this.getHeight();\n\t\tif (stickyTop === -1 || stickyBottom === -1) return;\n\t\tfor (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) continue;\n\t\t\tconst absoluteItemTop = this.getLayout().paddingTop + item.top;\n\t\t\tif (absoluteItemTop + item.height <= scrollTop) continue;\n\t\t\tif (absoluteItemTop >= scrollTop + viewportHeight) break;\n\t\t\tif (absoluteItemTop >= scrollTop) return {\n\t\t\t\ttype: \"item\",\n\t\t\t\tid: item.item.id,\n\t\t\t\tviewportOffset: absoluteItemTop - scrollTop\n\t\t\t};\n\t\t\tconst localViewportTop = this.getScrollAnchorViewportTop(absoluteItemTop, scrollTop) - absoluteItemTop;\n\t\t\tconst lineAnchor = item.instance.getNumericScrollAnchor(localViewportTop);\n\t\t\tif (lineAnchor != null) {\n\t\t\t\tconst absoluteLineTop = absoluteItemTop + lineAnchor.top;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"line\",\n\t\t\t\t\tid: item.item.id,\n\t\t\t\t\tlineNumber: lineAnchor.lineNumber,\n\t\t\t\t\tside: lineAnchor.side,\n\t\t\t\t\tviewportOffset: absoluteLineTop - scrollTop\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n\t* scroll position to keep the anchored element in place.\n\t*\n\t* If we can't resolve a position for whatever reason, we'll return\n\t* undefined.\n\t*/\n\tresolveAnchoredScrollTop(anchor) {\n\t\tconst item = this.idToItem.get(anchor.id);\n\t\tif (item == null) return;\n\t\tconst { paddingTop } = this.getLayout();\n\t\tif (anchor.type === \"item\") {\n\t\t\tconst absoluteItemTop = paddingTop + item.top;\n\t\t\treturn this.clampScrollTop(absoluteItemTop - anchor.viewportOffset);\n\t\t}\n\t\tconst linePosition = item.type === \"diff\" ? item.instance.getLinePosition(anchor.lineNumber, anchor.side) : item.instance.getLinePosition(anchor.lineNumber);\n\t\tif (linePosition == null) return;\n\t\tconst absoluteLineTop = paddingTop + item.top + linePosition.top;\n\t\treturn this.clampScrollTop(absoluteLineTop - anchor.viewportOffset);\n\t}\n\t/**\n\t* Apply a device-pixel-rounded scroll position if it differs from the last\n\t* logical scrollTop synchronized into the paged scroll scaffold.\n\t*/\n\tapplyScrollFix(targetScrollTop, syncedScrollTop, windowSpecs) {\n\t\tif (this.root == null) return;\n\t\tconst roundedTargetScrollTop = roundToDevicePixel(this.clampScrollTop(targetScrollTop));\n\t\tconst roundedSyncedScrollTop = roundToDevicePixel(syncedScrollTop);\n\t\tconst { scrollPageOffset: previousPageOffset } = this;\n\t\tconst syncedPagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(roundedSyncedScrollTop - previousPageOffset));\n\t\tconst { pagedScrollTop, scrollPageOffset } = this.resolvePagedScrollPosition(roundedTargetScrollTop);\n\t\tconst targetPagedScrollTop = pagedScrollTop;\n\t\tconst rebaseChanged = previousPageOffset !== scrollPageOffset;\n\t\tif (roundedTargetScrollTop === this.renderState.scrollTop && roundedTargetScrollTop === roundedSyncedScrollTop && targetPagedScrollTop === syncedPagedScrollTop && !rebaseChanged) return;\n\t\tthis.suspendScrollInteractions();\n\t\tif (targetPagedScrollTop !== syncedPagedScrollTop || rebaseChanged) {\n\t\t\tthis.scrollPageOffset = scrollPageOffset;\n\t\t\tthis.syncPagedScrollScaffolding(windowSpecs);\n\t\t}\n\t\tif (targetPagedScrollTop !== syncedPagedScrollTop) this.root.scrollTo({\n\t\t\ttop: targetPagedScrollTop,\n\t\t\tbehavior: \"instant\"\n\t\t});\n\t\tthis.renderState.scrollTop = roundedTargetScrollTop;\n\t\tthis.scrollTop = roundedTargetScrollTop;\n\t\tthis.scrollDirty = false;\n\t}\n\t/**\n\t* Decide whether a pending programmatic scroll has reached its\n\t* destination and should be cleared.\n\t*/\n\tisPendingTargetSettled(target) {\n\t\tconst top = this.resolveScrollTargetTop(target);\n\t\tif (top == null) return true;\n\t\treturn roundToDevicePixel(this.getScrollTop()) === roundToDevicePixel(top);\n\t}\n\tgetScrollTop() {\n\t\tif (!this.scrollDirty) return this.scrollTop;\n\t\tthis.scrollDirty = false;\n\t\tconst rootScrollTop = this.root?.scrollTop ?? 0;\n\t\tthis.scrollTop = this.clampScrollTop(rootScrollTop + this.scrollPageOffset);\n\t\treturn this.scrollTop;\n\t}\n\tgetHeight() {\n\t\tif (!this.heightDirty) return this.height;\n\t\tthis.heightDirty = false;\n\t\tthis.height = this.root?.getBoundingClientRect().height ?? 0;\n\t\treturn this.height;\n\t}\n\tgetScrollHeight() {\n\t\treturn this.scrollHeight;\n\t}\n\tflushSlotCoordinator() {\n\t\tif (this.slotCoordinator == null) return;\n\t\tconst { onSnapshotChange } = this.slotCoordinator;\n\t\tconst slotSnapshot = getSlotSnapshot(this.getRenderedItems(), this.slotCoordinator);\n\t\tif (areSlotSnapshotsEqual(this.slotSnapshot, slotSnapshot)) return;\n\t\tthis.slotSnapshot = slotSnapshot;\n\t\tonSnapshotChange(slotSnapshot);\n\t}\n\tnotifyScroll() {\n\t\tif (this.scrollListeners.size === 0) return;\n\t\tconst scrollTop = this.getScrollTop();\n\t\tfor (const listener of this.scrollListeners) listener(scrollTop, this);\n\t}\n\t/**\n\t* Find the first item whose bottom edge crosses into the viewport window.\n\t* This lets scroll-time rendering jump directly near the visible range instead\n\t* of linearly scanning from the start of very large item lists.\n\t*/\n\tfindFirstVisibleIndex(top) {\n\t\tlet low = 0;\n\t\tlet high = this.items.length - 1;\n\t\tlet result = this.items.length;\n\t\twhile (low <= high) {\n\t\t\tconst mid = low + high >> 1;\n\t\t\tconst item = this.items[mid];\n\t\t\tif (item == null) throw new Error(\"CodeView.findFirstVisibleIndex: invalid item index\");\n\t\t\tif (item.top + item.height > top) {\n\t\t\t\tresult = mid;\n\t\t\t\thigh = mid - 1;\n\t\t\t} else low = mid + 1;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Find the last item whose top edge is still within the viewport window.\n\t* Paired with findFirstVisibleIndex, this bounds the render loop to only the\n\t* slice of items that can actually intersect the current scroll range.\n\t*/\n\tfindLastVisibleIndex(bottom) {\n\t\tlet low = 0;\n\t\tlet high = this.items.length - 1;\n\t\tlet result = -1;\n\t\twhile (low <= high) {\n\t\t\tconst mid = low + high >> 1;\n\t\t\tconst item = this.items[mid];\n\t\t\tif (item == null) throw new Error(\"CodeView.findLastVisibleIndex: invalid item index\");\n\t\t\tif (item.top <= bottom) {\n\t\t\t\tresult = mid;\n\t\t\t\tlow = mid + 1;\n\t\t\t} else high = mid - 1;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Recompute measured tops and heights starting from the earliest dirty item.\n\t* Earlier items keep their existing layout, while everything from startIndex\n\t* onward is remeasured so downstream positions and total scroll height stay\n\t* consistent after inserts, removals, or versioned item updates.\n\t*/\n\trecomputeLayout(startIndex = 0, reset) {\n\t\tif (this.items.length === 0) {\n\t\t\tthis.scrollHeight = 0;\n\t\t\treturn;\n\t\t}\n\t\tconst layout = this.getLayout();\n\t\tlet runningTop = 0;\n\t\tif (startIndex > 0) {\n\t\t\tconst previousItem = this.items[startIndex - 1];\n\t\t\tif (previousItem == null) throw new Error(\"CodeView.recomputeLayout: invalid dirty index\");\n\t\t\trunningTop = previousItem.top + previousItem.height + layout.gap;\n\t\t}\n\t\tfor (let index = startIndex; index < this.items.length; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(\"CodeView.recomputeLayout: invalid item index\");\n\t\t\titem.top = runningTop;\n\t\t\tif (item.type === \"diff\") item.height = item.instance.prepareCodeViewItem(item.item.fileDiff, runningTop, reset, item.item.annotations ?? []);\n\t\t\telse item.height = item.instance.prepareCodeViewItem(item.item.file, runningTop, reset, item.item.annotations ?? []);\n\t\t\trunningTop += item.height;\n\t\t\tif (index < this.items.length - 1) runningTop += layout.gap;\n\t\t}\n\t\tif (runningTop !== this.scrollHeight) this.scrollDirty = true;\n\t\tthis.scrollHeight = runningTop;\n\t}\n\tresetRenderState() {\n\t\tthis.renderState.scrollTop = -1;\n\t\tthis.renderState.firstIndex = -1;\n\t\tthis.renderState.lastIndex = -1;\n\t\tthis.renderState.stickyHeight = 0;\n\t\tthis.renderState.stickyTop = -1;\n\t\tthis.renderState.stickyBottom = -1;\n\t}\n\tgetFitPerfectlyOverscroll() {\n\t\treturn this.getLayout().gap + this.itemMetricsCache.diffHeaderHeight;\n\t}\n};\nfunction prepareItemInstance(item) {\n\titem.instance.cleanUp(true);\n\tif (item.type === \"diff\") return item.instance.prepareCodeViewItem(item.item.fileDiff, item.top, void 0, item.item.annotations ?? []);\n\telse return item.instance.prepareCodeViewItem(item.item.file, item.top, void 0, item.item.annotations ?? []);\n}\nfunction shouldClearPool(previousOptions, nextOptions) {\n\treturn !areThemesEqual(previousOptions.theme ?? DEFAULT_THEMES, nextOptions.theme ?? DEFAULT_THEMES) || (previousOptions.themeType ?? \"system\") !== (nextOptions.themeType ?? \"system\") || previousOptions.unsafeCSS !== nextOptions.unsafeCSS;\n}\nfunction hasItemLayoutOptionChanged(previousOptions, nextOptions) {\n\treturn (previousOptions.overflow ?? \"scroll\") !== (nextOptions.overflow ?? \"scroll\") || (previousOptions.disableLineNumbers ?? false) !== (nextOptions.disableLineNumbers ?? false) || (previousOptions.disableFileHeader ?? false) !== (nextOptions.disableFileHeader ?? false) || previousOptions.unsafeCSS !== nextOptions.unsafeCSS || (previousOptions.diffStyle ?? \"split\") !== (nextOptions.diffStyle ?? \"split\") || (previousOptions.diffIndicators ?? \"bars\") !== (nextOptions.diffIndicators ?? \"bars\") || (previousOptions.hunkSeparators ?? \"line-info\") !== (nextOptions.hunkSeparators ?? \"line-info\") || (previousOptions.expandUnchanged ?? false) !== (nextOptions.expandUnchanged ?? false) || (previousOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD) !== (nextOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD);\n}\nfunction hasCodeViewDiffEstimateOptionChanged(previousOptions, nextOptions) {\n\treturn (previousOptions.disableFileHeader ?? false) !== (nextOptions.disableFileHeader ?? false) || (previousOptions.hunkSeparators ?? \"line-info\") !== (nextOptions.hunkSeparators ?? \"line-info\") || (previousOptions.expandUnchanged ?? false) !== (nextOptions.expandUnchanged ?? false) || (previousOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD) !== (nextOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD);\n}\nfunction isPooledShadowChild(child) {\n\tif (child instanceof SVGElement) return true;\n\treturn isStyleNode(child) && (child.hasAttribute(CORE_CSS_ATTRIBUTE) || child.hasAttribute(THEME_CSS_ATTRIBUTE) || child.hasAttribute(UNSAFE_CSS_ATTRIBUTE));\n}\nfunction formatSelectedLineRange(range) {\n\tconst start = formatSelectedLinePoint(range.start, range.side);\n\tconst end = formatSelectedLinePoint(range.end, range.endSide ?? range.side);\n\treturn start === end ? start : `${start}-${end}`;\n}\nfunction formatSelectedLinePoint(lineNumber, side) {\n\tif (side == null) return `${lineNumber}`;\n\treturn `${side === \"deletions\" ? \"D\" : \"A\"}${lineNumber}`;\n}\nfunction renderItem(item, fileContainer, forceRender = false) {\n\tif (item.type === \"diff\") return item.instance.render({\n\t\tdeferManagers: true,\n\t\tfileContainer,\n\t\tfileDiff: item.item.fileDiff,\n\t\tforceRender,\n\t\tlineAnnotations: item.item.annotations ?? []\n\t});\n\telse return item.instance.render({\n\t\tdeferManagers: true,\n\t\tfileContainer,\n\t\tfile: item.item.file,\n\t\tforceRender,\n\t\tlineAnnotations: item.item.annotations ?? []\n\t});\n}\n/**\n* Keep the rendered DOM order aligned with the current record order even when\n* we reuse existing elements. Reused items may already be mounted elsewhere in\n* the sticky container, so this moves them into the correct sibling position\n* before rendering updates.\n*/\nfunction syncRenderedItemOrder(container, element, prevElement) {\n\tif (prevElement == null) {\n\t\tif (container.firstChild !== element) container.prepend(element);\n\t\treturn;\n\t}\n\tif (prevElement.nextSibling !== element) prevElement.after(element);\n}\nfunction hasAnnotations(item) {\n\treturn (item.annotations?.length ?? 0) > 0;\n}\nfunction getSlotSnapshot(renderedItems, { hasHeaderRenderers, hasAnnotationRenderer, hasGutterRenderer }) {\n\tif (renderedItems.length === 0) return;\n\tif (hasHeaderRenderers || hasGutterRenderer) return renderedItems;\n\tif (!hasAnnotationRenderer) return;\n\tconst slotSnapshot = [];\n\tfor (const renderedItem of renderedItems) if (hasAnnotations(renderedItem.item)) slotSnapshot.push(renderedItem);\n\treturn slotSnapshot.length > 0 ? slotSnapshot : void 0;\n}\nfunction areSlotSnapshotsEqual(previous, next) {\n\tif (previous == null || next == null) return previous === next;\n\tif (previous.length !== next.length) return false;\n\tfor (let index = 0; index < previous.length; index++) {\n\t\tconst previousItem = previous[index];\n\t\tconst nextItem = next[index];\n\t\tif (previousItem == null || nextItem == null || previousItem.id !== nextItem.id || previousItem.type !== nextItem.type || previousItem.element !== nextItem.element || previousItem.version !== nextItem.version) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\nexport { CodeView };\n//# sourceMappingURL=CodeView.js.map","//#region src/utils/areManagedSnapshotsEqual.ts\nfunction areManagedSnapshotsEqual(previous, next) {\n\tif (previous == null || next == null) return previous === next;\n\tif (previous.length !== next.length) return false;\n\tfor (let index = 0; index < previous.length; index++) {\n\t\tconst previousItem = previous[index];\n\t\tconst nextItem = next[index];\n\t\tif (previousItem == null || nextItem == null || previousItem.id !== nextItem.id || previousItem.type !== nextItem.type || previousItem.element !== nextItem.element || previousItem.version !== nextItem.version) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\nexport { areManagedSnapshotsEqual };\n//# sourceMappingURL=areManagedSnapshotsEqual.js.map","'use client';\n\n\nimport { areOptionsEqual } from \"../utils/areOptionsEqual.js\";\nimport { CodeView as CodeView$1 } from \"../components/CodeView.js\";\nimport { areManagedSnapshotsEqual } from \"../utils/areManagedSnapshotsEqual.js\";\nimport { renderDiffChildren } from \"./utils/renderDiffChildren.js\";\nimport { renderFileChildren } from \"./utils/renderFileChildren.js\";\nimport { useStableCallback } from \"./utils/useStableCallback.js\";\nimport { WorkerPoolContext } from \"./WorkerPoolContext.js\";\nimport { forwardRef, memo, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from \"react\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { createPortal, flushSync } from \"react-dom\";\n\n//#region src/react/CodeView.tsx\nconst useIsometricEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect;\nfunction createDefaultCache(controlled) {\n\treturn {\n\t\tinstance: void 0,\n\t\titems: void 0,\n\t\tcontrolled,\n\t\tmanagedOptions: void 0,\n\t\tdisableFlushSync: false,\n\t\tslotCoordinator: void 0\n\t};\n}\nfunction CodeViewInner(props, ref) {\n\tconst { className, containerRef, disableWorkerPool = false, initialItems, items: controlledItems, onScroll, onSelectedLinesChange, options, renderAnnotation, renderCustomHeader, renderGutterUtility, renderHeaderMetadata, renderHeaderPrefix, selectedLines, style } = props;\n\tconst controlled = controlledItems !== void 0;\n\tconst poolManager = useContext(WorkerPoolContext);\n\tconst cachedDataRef = useRef(createDefaultCache(controlled));\n\tconst hasCustomHeader = renderCustomHeader != null;\n\tconst hasAnnotationRenderer = renderAnnotation != null;\n\tconst hasGutterRenderer = renderGutterUtility != null;\n\tconst hasHeaderRenderers = hasCustomHeader || renderHeaderPrefix != null || renderHeaderMetadata != null;\n\tconst hasRenderers = hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n\tconst emitSelectedLinesChange = useStableCallback((selection) => {\n\t\tonSelectedLinesChange?.(selection);\n\t});\n\tconst controlledSelection = selectedLines !== void 0;\n\tconst managedOptions = useMemo(() => createManagedCodeViewOptions({\n\t\toptions,\n\t\thasCustomHeader,\n\t\thasGutterRenderer,\n\t\tonSelectedLinesChange: onSelectedLinesChange != null ? emitSelectedLinesChange : void 0,\n\t\tcontrolledSelection\n\t}), [\n\t\toptions,\n\t\thasCustomHeader,\n\t\thasGutterRenderer,\n\t\tonSelectedLinesChange,\n\t\temitSelectedLinesChange,\n\t\tcontrolledSelection\n\t]);\n\tconst [slotContentStore] = useState(() => createSlotContentStore());\n\tconst [, forceUpdate] = useState({});\n\tconst nodeRef = useStableCallback((node) => {\n\t\tif (cachedDataRef.current.instance != null && (node == null || node !== cachedDataRef.current.instance.getContainerElement())) {\n\t\t\tcachedDataRef.current.instance.cleanUp();\n\t\t\tslotContentStore.publish(void 0);\n\t\t\tcachedDataRef.current = createDefaultCache(controlled);\n\t\t}\n\t\tif (node != null && node !== cachedDataRef.current.instance?.getContainerElement()) {\n\t\t\tcachedDataRef.current.instance = new CodeView$1(managedOptions, !disableWorkerPool ? poolManager : void 0, true);\n\t\t\tcachedDataRef.current.instance.setup(node);\n\t\t}\n\t\tif (typeof containerRef === \"function\") containerRef(node);\n\t\telse if (containerRef != null) containerRef.current = node;\n\t});\n\tconst onSnapshotChange = useStableCallback((snapshot) => {\n\t\tif (cachedDataRef.current.disableFlushSync) slotContentStore.publish(snapshot);\n\t\telse flushSync(() => {\n\t\t\tslotContentStore.publish(snapshot);\n\t\t});\n\t});\n\tconst slotCoordinator = useMemo(() => {\n\t\tif (!hasHeaderRenderers && !hasAnnotationRenderer && !hasGutterRenderer) return;\n\t\telse return {\n\t\t\thasHeaderRenderers,\n\t\t\thasAnnotationRenderer,\n\t\t\thasGutterRenderer,\n\t\t\tonSnapshotChange\n\t\t};\n\t}, [\n\t\tonSnapshotChange,\n\t\thasAnnotationRenderer,\n\t\thasGutterRenderer,\n\t\thasHeaderRenderers\n\t]);\n\tuseIsometricEffect(() => {\n\t\treturn onScroll != null ? cachedDataRef.current.instance?.subscribeToScroll(onScroll) : void 0;\n\t});\n\tuseIsometricEffect(() => {\n\t\tconst { instance, controlled: prevControlled, items: prevItems, managedOptions: prevManagedOptions, slotCoordinator: prevSlotCoordinator } = cachedDataRef.current;\n\t\tif (instance == null) return;\n\t\ttry {\n\t\t\tcachedDataRef.current.disableFlushSync = true;\n\t\t\tlet shouldRender = false;\n\t\t\tif (!areOptionsEqual(managedOptions, prevManagedOptions)) {\n\t\t\t\tcachedDataRef.current.managedOptions = managedOptions;\n\t\t\t\tinstance.setOptions(managedOptions);\n\t\t\t\tshouldRender = true;\n\t\t\t}\n\t\t\tif (prevControlled !== controlled) {\n\t\t\t\tconsole.error(\"CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controlled) {\n\t\t\t\tif (controlledItems !== prevItems) if (areItemListsEqual(prevItems, controlledItems)) cachedDataRef.current.items = controlledItems;\n\t\t\t\telse if (isAppendOnlyItemUpdate(prevItems, controlledItems)) {\n\t\t\t\t\tcachedDataRef.current.items = controlledItems;\n\t\t\t\t\tinstance.addItems(controlledItems.slice(prevItems.length));\n\t\t\t\t} else {\n\t\t\t\t\tcachedDataRef.current.items = controlledItems;\n\t\t\t\t\tinstance.setItems(controlledItems);\n\t\t\t\t\tshouldRender = true;\n\t\t\t\t}\n\t\t\t} else if (prevItems == null) {\n\t\t\t\tconst seedItems = initialItems ?? [];\n\t\t\t\tcachedDataRef.current.items = seedItems;\n\t\t\t\tif (seedItems.length > 0) {\n\t\t\t\t\tinstance.setItems(seedItems);\n\t\t\t\t\tshouldRender = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (selectedLines !== void 0) instance.setSelectedLines(selectedLines, { notify: false });\n\t\t\tconst slotPublish = instance.setSlotCoordinator(slotCoordinator);\n\t\t\tlet forceInlinePublish = false;\n\t\t\tif (slotCoordinator !== prevSlotCoordinator) {\n\t\t\t\tif (slotCoordinator == null || prevSlotCoordinator == null) forceInlinePublish = true;\n\t\t\t\tcachedDataRef.current.slotCoordinator = slotCoordinator;\n\t\t\t}\n\t\t\tif (shouldRender || slotPublish) instance.render(true);\n\t\t\tif (slotPublish && slotCoordinator == null) slotContentStore.publish(void 0);\n\t\t\tif (forceInlinePublish) forceUpdate({});\n\t\t} finally {\n\t\t\tcachedDataRef.current.disableFlushSync = false;\n\t\t}\n\t});\n\tuseImperativeHandle(ref, () => ({\n\t\taddItems(items) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"addItems\");\n\t\t\tif (instance == null) console.error(\"CodeView.addItems: no valid instance to append items with\", items);\n\t\t\telse instance.addItems(items);\n\t\t},\n\t\tgetItem(id) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.getItem: no valid instance exists\", id);\n\t\t\t\treturn;\n\t\t\t} else return instance.getItem(id);\n\t\t},\n\t\tupdateItem(item) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"updateItem\");\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.updateItem: no valid instance to update item with\", item);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn instance.updateItem(item);\n\t\t},\n\t\tupdateItemId(oldId, newId) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"updateItemId\");\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.updateItemId: no valid instance to update item id with\", oldId, newId);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn instance.updateItemId(oldId, newId);\n\t\t},\n\t\tscrollTo(target) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.scrollTo: no valid instance to scroll with\", target);\n\t\t\telse instance.scrollTo(target);\n\t\t},\n\t\tsetSelectedLines(selection) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.setSelectedLines: no valid instance to update selection with\", selection);\n\t\t\telse {\n\t\t\t\tinstance.setSelectedLines(selection, { notify: false });\n\t\t\t\temitSelectedLinesChange(selection);\n\t\t\t}\n\t\t},\n\t\tgetSelectedLines() {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.getSelectedLines: no valid instance exists\");\n\t\t\t\treturn null;\n\t\t\t} else return instance.getSelectedLines();\n\t\t},\n\t\tclearSelectedLines() {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.clearSelectedLines: no valid instance to update selection with\");\n\t\t\telse {\n\t\t\t\tinstance.clearSelectedLines({ notify: false });\n\t\t\t\temitSelectedLinesChange(null);\n\t\t\t}\n\t\t},\n\t\tgetInstance() {\n\t\t\treturn cachedDataRef.current.instance;\n\t\t}\n\t}), [emitSelectedLinesChange]);\n\treturn /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\tref: nodeRef,\n\t\tclassName,\n\t\tstyle\n\t}), hasRenderers && /* @__PURE__ */ jsx(SlotPortals, {\n\t\tmanagedContentStore: slotContentStore,\n\t\trenderCustomHeader,\n\t\trenderHeaderPrefix,\n\t\trenderHeaderMetadata,\n\t\trenderAnnotation,\n\t\trenderGutterUtility\n\t})] });\n}\nconst CodeView = forwardRef(CodeViewInner);\nfunction isAppendOnlyItemUpdate(previousItems, nextItems) {\n\tif (previousItems == null || nextItems.length <= previousItems.length) return false;\n\tif (previousItems.length === 0) return true;\n\tfor (let index = 0; index < previousItems.length; index++) if (nextItems[index] !== previousItems[index]) return false;\n\treturn true;\n}\nfunction areItemListsEqual(previousItems, nextItems) {\n\tif (previousItems == null || previousItems.length !== nextItems.length) return false;\n\tfor (let index = 0; index < previousItems.length; index++) if (previousItems[index] !== nextItems[index]) return false;\n\treturn true;\n}\nfunction assertUncontrolledCodeViewAction(controlled, action) {\n\tif (!controlled) return;\n\tthrow new Error(`CodeView.${action} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`);\n}\nfunction createSlotContentStore() {\n\tlet snapshot;\n\tconst listeners = /* @__PURE__ */ new Set();\n\treturn {\n\t\tgetSnapshot() {\n\t\t\treturn snapshot;\n\t\t},\n\t\tpublish(nextSnapshot) {\n\t\t\tif (areManagedSnapshotsEqual(snapshot, nextSnapshot)) return;\n\t\t\tsnapshot = nextSnapshot;\n\t\t\tfor (const listener of listeners) listener();\n\t\t},\n\t\tsubscribe(listener) {\n\t\t\tlisteners.add(listener);\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createManagedCodeViewOptions({ options, hasCustomHeader, hasGutterRenderer, onSelectedLinesChange, controlledSelection }) {\n\tif (!hasCustomHeader && !hasGutterRenderer && onSelectedLinesChange == null && !controlledSelection) return options;\n\toptions = {\n\t\t...options,\n\t\tcontrolledSelection,\n\t\tonSelectedLinesChange\n\t};\n\tif (hasCustomHeader) options.renderCustomHeader = noopRender;\n\tif (hasGutterRenderer) options.renderGutterUtility = noopRender;\n\treturn options;\n}\nconst SlotPortals = memo(function SlotPortals$1({ managedContentStore, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {\n\tconst subscribe = useStableCallback((listener) => managedContentStore.subscribe(listener));\n\tconst getSnapshot = useStableCallback(() => managedContentStore.getSnapshot());\n\treturn useSyncExternalStore(subscribe, getSnapshot, getSnapshot)?.map((renderedItem) => {\n\t\treturn createPortal(renderCodeViewItemChildren({\n\t\t\trenderedItem,\n\t\t\trenderCustomHeader,\n\t\t\trenderHeaderPrefix,\n\t\t\trenderHeaderMetadata,\n\t\t\trenderAnnotation,\n\t\t\trenderGutterUtility\n\t\t}), renderedItem.element, renderedItem.id);\n\t});\n});\nfunction renderCodeViewItemChildren({ renderedItem, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {\n\tif (renderedItem.type === \"diff\") {\n\t\tconst { item, instance } = renderedItem;\n\t\treturn renderDiffChildren({\n\t\t\tfileDiff: item.fileDiff,\n\t\t\trenderCustomHeader: renderCustomHeader != null ? () => renderCustomHeader(item) : void 0,\n\t\t\trenderHeaderPrefix: renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : void 0,\n\t\t\trenderHeaderMetadata: renderHeaderMetadata != null ? () => renderHeaderMetadata(item) : void 0,\n\t\t\trenderAnnotation: renderAnnotation != null ? (annotation) => renderAnnotation(annotation, item) : void 0,\n\t\t\tlineAnnotations: item.annotations,\n\t\t\trenderGutterUtility: renderGutterUtility != null ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item) : void 0,\n\t\t\tgetHoveredLine: instance.getHoveredLine\n\t\t});\n\t} else {\n\t\tconst { item, instance } = renderedItem;\n\t\treturn renderFileChildren({\n\t\t\tfile: item.file,\n\t\t\trenderCustomHeader: renderCustomHeader != null ? () => renderCustomHeader(item) : void 0,\n\t\t\trenderHeaderPrefix: renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : void 0,\n\t\t\trenderHeaderMetadata: renderHeaderMetadata != null ? () => renderHeaderMetadata(item) : void 0,\n\t\t\trenderAnnotation: renderAnnotation != null ? (annotation) => renderAnnotation(annotation, item) : void 0,\n\t\t\tlineAnnotations: item.annotations,\n\t\t\trenderGutterUtility: renderGutterUtility != null ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item) : void 0,\n\t\t\tgetHoveredLine: instance.getHoveredLine\n\t\t});\n\t}\n}\nfunction noopRender() {}\n\n//#endregion\nexport { CodeView };\n//# sourceMappingURL=CodeView.js.map","import type { ScopedThreadRef } from \"@t3tools/contracts\";\n\nimport { useRightPanelStore } from \"./rightPanelStore\";\nimport { resolvePathLinkTarget } from \"./terminal-links\";\n\ninterface OpenDiffFilePrimaryActionInput {\n readonly threadRef: ScopedThreadRef | null;\n readonly filePath: string;\n readonly activeCwd: string | undefined;\n readonly openInEditor: (targetPath: string) => void;\n}\n\nexport function openDiffFilePrimaryAction({\n threadRef,\n filePath,\n activeCwd,\n openInEditor,\n}: OpenDiffFilePrimaryActionInput): void {\n if (threadRef) {\n useRightPanelStore.getState().openFile(threadRef, filePath);\n return;\n }\n\n openInEditor(activeCwd ? resolvePathLinkTarget(filePath, activeCwd) : filePath);\n}\n","import {\n type CheckpointDiffState,\n type CheckpointDiffTarget,\n} from \"@t3tools/client-runtime/state/threads\";\n\nimport { useCheckpointDiff as useCheckpointDiffQuery } from \"../state/queries\";\n\nexport function useCheckpointDiff(\n target: CheckpointDiffTarget,\n options?: { readonly enabled?: boolean },\n): CheckpointDiffState {\n const state = useCheckpointDiffQuery(target, options);\n return {\n data: state.data,\n error: state.error,\n isPending: state.isPending,\n };\n}\n","export function areAllDiffFilesCollapsed(\n fileKeys: ReadonlyArray<string>,\n collapsedFileKeys: ReadonlySet<string>,\n): boolean {\n return fileKeys.length > 0 && fileKeys.every((fileKey) => collapsedFileKeys.has(fileKey));\n}\n\nexport function toggleAllDiffFiles(\n fileKeys: ReadonlyArray<string>,\n collapsedFileKeys: ReadonlySet<string>,\n): ReadonlySet<string> {\n return areAllDiffFilesCollapsed(fileKeys, collapsedFileKeys) ? new Set() : new Set(fileKeys);\n}\n","import type { ReactNode } from \"react\";\n\nimport { cn } from \"~/lib/utils\";\n\nimport { Skeleton } from \"./ui/skeleton\";\n\nexport type DiffPanelMode = \"inline\" | \"sheet\" | \"sidebar\" | \"embedded\";\n\nfunction getDiffPanelHeaderRowClassName() {\n return cn(\"flex items-center justify-between gap-2 px-4\", \"surface-subheader\");\n}\n\nexport function DiffPanelShell(props: {\n mode: DiffPanelMode;\n header: ReactNode;\n children: ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"flex h-full min-w-0 flex-col bg-background\",\n props.mode === \"inline\"\n ? \"w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border\"\n : \"w-full\",\n )}\n >\n <div className={getDiffPanelHeaderRowClassName()} data-surface-subheader>\n {props.header}\n </div>\n {props.children}\n </div>\n );\n}\n\nexport function DiffPanelHeaderSkeleton() {\n return (\n <>\n <div className=\"min-w-0 flex-1\">\n <Skeleton className=\"h-8 w-32 rounded-lg\" />\n </div>\n <div className=\"flex shrink-0 gap-1\">\n <Skeleton className=\"size-7 rounded-md\" />\n <Skeleton className=\"size-7 rounded-md\" />\n </div>\n </>\n );\n}\n\nexport function DiffPanelLoadingState(props: { label: string }) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col p-2\">\n <div\n className=\"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border/60 bg-card/25\"\n role=\"status\"\n aria-live=\"polite\"\n aria-label={props.label}\n >\n <div className=\"flex items-center gap-2 border-b border-border/50 px-3 py-2\">\n <Skeleton className=\"h-4 w-32 rounded-full\" />\n <Skeleton className=\"ml-auto h-4 w-20 rounded-full\" />\n </div>\n <div className=\"flex min-h-0 flex-1 flex-col gap-4 px-3 py-4\">\n <div className=\"space-y-2\">\n <Skeleton className=\"h-3 w-full rounded-full\" />\n <Skeleton className=\"h-3 w-full rounded-full\" />\n <Skeleton className=\"h-3 w-10/12 rounded-full\" />\n <Skeleton className=\"h-3 w-11/12 rounded-full\" />\n <Skeleton className=\"h-3 w-9/12 rounded-full\" />\n </div>\n <span className=\"sr-only\">{props.label}</span>\n </div>\n </div>\n </div>\n );\n}\n","import type {\n AnnotationSide,\n CodeViewDiffItem,\n CodeViewItem,\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n} from \"@pierre/diffs\";\nimport { CodeView, type CodeViewHandle, type CodeViewProps } from \"@pierre/diffs/react\";\nimport type { ScopedThreadRef } from \"@t3tools/contracts\";\nimport { useCallback, useMemo, useState, type ReactNode, type Ref } from \"react\";\n\nimport { type DraftId, useComposerDraftStore } from \"~/composerDraftStore\";\nimport { fnv1a32 } from \"~/lib/diffRendering\";\nimport {\n buildDiffReviewComment,\n restoreDiffReviewCommentRange,\n type ReviewCommentContext,\n} from \"~/reviewCommentContext\";\n\nimport { LocalCommentAnnotation } from \"../files/LocalCommentAnnotation\";\nimport { nextFileCommentId } from \"../files/fileCommentAnnotations\";\n\ninterface DiffCommentAnnotationEntry {\n id: string;\n kind: \"draft\" | \"comment\";\n range: SelectedLineRange;\n rangeLabel: string;\n text: string;\n}\n\ninterface DiffCommentAnnotationGroup {\n entries: DiffCommentAnnotationEntry[];\n}\n\ntype DiffCommentLineAnnotation = DiffLineAnnotation<DiffCommentAnnotationGroup>;\nexport type AnnotatableCodeViewHandle = CodeViewHandle<DiffCommentAnnotationGroup>;\nconst EMPTY_REVIEW_COMMENTS: ReadonlyArray<ReviewCommentContext> = [];\n\nfunction annotationSide(range: SelectedLineRange): AnnotationSide {\n return (range.endSide ?? range.side) === \"deletions\" ? \"deletions\" : \"additions\";\n}\n\nfunction appendAnnotationEntry(\n annotations: ReadonlyArray<DiffCommentLineAnnotation>,\n range: SelectedLineRange,\n entry: DiffCommentAnnotationEntry,\n): DiffCommentLineAnnotation[] {\n const side = annotationSide(range);\n const annotationIndex = annotations.findIndex(\n (annotation) => annotation.side === side && annotation.lineNumber === range.end,\n );\n if (annotationIndex < 0) {\n return [\n ...annotations,\n {\n side,\n lineNumber: range.end,\n metadata: { entries: [entry] },\n },\n ];\n }\n return annotations.map((annotation, index) =>\n index === annotationIndex\n ? {\n ...annotation,\n metadata: { entries: [...annotation.metadata.entries, entry] },\n }\n : annotation,\n );\n}\n\ninterface AnnotatableCodeViewProps {\n files: ReadonlyArray<{\n fileDiff: FileDiffMetadata;\n filePath: string;\n fileKey: string;\n collapsed: boolean;\n }>;\n sectionId: string;\n sectionTitle: string;\n composerDraftTarget: ScopedThreadRef | DraftId;\n options: NonNullable<CodeViewProps<DiffCommentAnnotationGroup>[\"options\"]>;\n viewerRef?: Ref<AnnotatableCodeViewHandle>;\n className?: string;\n renderHeaderPrefix: (\n fileDiff: FileDiffMetadata,\n fileKey: string,\n collapsed: boolean,\n ) => ReactNode;\n}\n\ninterface DiffSelectionContext {\n item: CodeViewItem<DiffCommentAnnotationGroup>;\n}\n\nexport function AnnotatableCodeView({\n files,\n sectionId,\n sectionTitle,\n composerDraftTarget,\n options,\n viewerRef,\n className,\n renderHeaderPrefix,\n}: AnnotatableCodeViewProps) {\n const addReviewComment = useComposerDraftStore((store) => store.addReviewComment);\n const removeReviewComment = useComposerDraftStore((store) => store.removeReviewComment);\n const reviewComments = useComposerDraftStore(\n (store) => store.getComposerDraft(composerDraftTarget)?.reviewComments ?? EMPTY_REVIEW_COMMENTS,\n );\n const [selectedLines, setSelectedLines] = useState<{\n id: string;\n range: SelectedLineRange;\n } | null>(null);\n const [draft, setDraft] = useState<{\n fileKey: string;\n annotation: DiffCommentLineAnnotation;\n } | null>(null);\n\n const filesByKey = useMemo(() => new Map(files.map((file) => [file.fileKey, file])), [files]);\n const items = useMemo<CodeViewDiffItem<DiffCommentAnnotationGroup>[]>(\n () =>\n files.map(({ fileDiff, filePath, fileKey, collapsed }) => {\n const persisted = reviewComments\n .filter(\n (comment) =>\n comment.sectionId === sectionId &&\n comment.filePath === filePath &&\n (comment.fenceLanguage ?? \"diff\") === \"diff\",\n )\n .reduce<DiffCommentLineAnnotation[]>((annotations, comment) => {\n const range = restoreDiffReviewCommentRange(fileDiff, comment);\n if (!range) return annotations;\n return appendAnnotationEntry(annotations, range, {\n id: comment.id,\n kind: \"comment\",\n range,\n rangeLabel: comment.rangeLabel,\n text: comment.text,\n });\n }, []);\n const annotations =\n draft?.fileKey === fileKey ? [...persisted, draft.annotation] : persisted;\n return {\n id: fileKey,\n type: \"diff\",\n fileDiff,\n annotations,\n collapsed,\n version: fnv1a32(\n `${collapsed ? \"1\" : \"0\"}:${annotations\n .flatMap((annotation) =>\n annotation.metadata.entries.map(\n (entry) => `${entry.id}:${entry.rangeLabel}:${entry.text}`,\n ),\n )\n .join(\":\")}`,\n ),\n };\n }),\n [draft, files, reviewComments, sectionId],\n );\n\n const removeEntry = useCallback(\n (entryId: string) => {\n setSelectedLines(null);\n if (draft?.annotation.metadata.entries.some((entry) => entry.id === entryId)) {\n setDraft(null);\n } else {\n removeReviewComment(composerDraftTarget, entryId);\n }\n },\n [composerDraftTarget, draft, removeReviewComment],\n );\n\n const submitEntry = useCallback(\n (entryId: string, text: string) => {\n const entry = draft?.annotation.metadata.entries.find(\n (candidate) => candidate.id === entryId,\n );\n const file = draft ? filesByKey.get(draft.fileKey) : undefined;\n if (!entry || !file) return;\n const comment = buildDiffReviewComment({\n id: entry.id,\n sectionId,\n sectionTitle,\n filePath: file.filePath,\n fileDiff: file.fileDiff,\n range: entry.range,\n text,\n });\n if (comment) addReviewComment(composerDraftTarget, comment);\n setSelectedLines(null);\n setDraft(null);\n },\n [addReviewComment, composerDraftTarget, draft, filesByKey, sectionId, sectionTitle],\n );\n\n const beginComment = useCallback(\n (range: SelectedLineRange | null, context: DiffSelectionContext) => {\n if (!range) return;\n const item = context.item;\n if (item.type !== \"diff\") return;\n const file = filesByKey.get(item.id);\n if (!file) return;\n const id = nextFileCommentId();\n const comment = buildDiffReviewComment({\n id,\n sectionId,\n sectionTitle,\n filePath: file.filePath,\n fileDiff: file.fileDiff,\n range,\n text: \"\",\n });\n if (!comment) return;\n setDraft({\n fileKey: item.id,\n annotation: {\n side: annotationSide(range),\n lineNumber: range.end,\n metadata: {\n entries: [{ id, kind: \"draft\", range, rangeLabel: comment.rangeLabel, text: \"\" }],\n },\n },\n });\n },\n [filesByKey, sectionId, sectionTitle],\n );\n\n const hasOpenComment = draft !== null;\n return (\n <CodeView<DiffCommentAnnotationGroup>\n {...(viewerRef ? { ref: viewerRef } : {})}\n {...(className ? { className } : {})}\n items={items}\n selectedLines={selectedLines}\n onSelectedLinesChange={setSelectedLines}\n options={{\n ...options,\n enableGutterUtility: !hasOpenComment,\n enableLineSelection: !hasOpenComment,\n onLineSelectionEnd: beginComment,\n }}\n renderHeaderPrefix={(item) =>\n item.type === \"diff\"\n ? renderHeaderPrefix(item.fileDiff, item.id, item.collapsed === true)\n : null\n }\n renderAnnotation={(annotation) => (\n <div className=\"py-1\">\n {annotation.metadata.entries.map((entry) => (\n <LocalCommentAnnotation\n key={entry.id}\n kind={entry.kind}\n rangeLabel={entry.rangeLabel}\n text={entry.text}\n onCancel={() => removeEntry(entry.id)}\n onComment={(text) => submitEntry(entry.id, text)}\n onDelete={() => removeEntry(entry.id)}\n />\n ))}\n </div>\n )}\n />\n );\n}\n","export let ToggleGroupDataAttributes = /*#__PURE__*/function (ToggleGroupDataAttributes) {\n /**\n * Present when the toggle group is disabled.\n */\n ToggleGroupDataAttributes[\"disabled\"] = \"data-disabled\";\n /**\n * Indicates the orientation of the toggle group.\n * @type {'horizontal' | 'vertical'}\n */\n ToggleGroupDataAttributes[\"orientation\"] = \"data-orientation\";\n /**\n * Present when the toggle group allows multiple buttons to be in the pressed state at the same time.\n */\n ToggleGroupDataAttributes[\"multiple\"] = \"data-multiple\";\n return ToggleGroupDataAttributes;\n}({});","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../internals/useRenderElement.js\";\nimport { CompositeRoot } from \"../internals/composite/root/CompositeRoot.js\";\nimport { useToolbarRootContext } from \"../toolbar/root/ToolbarRootContext.js\";\nimport { ToggleGroupContext } from \"./ToggleGroupContext.js\";\nimport { ToggleGroupDataAttributes } from \"./ToggleGroupDataAttributes.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n multiple(value) {\n if (value) {\n return {\n [ToggleGroupDataAttributes.multiple]: ''\n };\n }\n return null;\n }\n};\n\n/**\n * Provides a shared state to a series of toggle buttons.\n *\n * Documentation: [Base UI Toggle Group](https://base-ui.com/react/components/toggle-group)\n */\nexport const ToggleGroup = /*#__PURE__*/React.forwardRef(function ToggleGroup(componentProps, forwardedRef) {\n const {\n defaultValue: defaultValueProp,\n disabled: disabledProp = false,\n loopFocus = true,\n onValueChange,\n orientation = 'horizontal',\n multiple = false,\n value: valueProp,\n className,\n render,\n style,\n ...elementProps\n } = componentProps;\n const toolbarContext = useToolbarRootContext(true);\n const isValueInitialized = React.useMemo(() => valueProp !== undefined || defaultValueProp !== undefined, [valueProp, defaultValueProp]);\n const disabled = (toolbarContext?.disabled ?? false) || disabledProp;\n const [groupValue, setValueState] = useControlled({\n controlled: valueProp,\n default: valueProp === undefined ? defaultValueProp ?? EMPTY_ARRAY : undefined,\n name: 'ToggleGroup',\n state: 'value'\n });\n const setGroupValue = useStableCallback((newValue, nextPressed, eventDetails) => {\n let newGroupValue;\n if (multiple) {\n newGroupValue = groupValue.slice();\n if (nextPressed) {\n newGroupValue.push(newValue);\n } else {\n newGroupValue.splice(groupValue.indexOf(newValue), 1);\n }\n } else {\n newGroupValue = nextPressed ? [newValue] : [];\n }\n onValueChange?.(newGroupValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValueState(newGroupValue);\n });\n const state = {\n disabled,\n multiple,\n orientation\n };\n const contextValue = React.useMemo(() => ({\n disabled,\n orientation,\n setGroupValue,\n value: groupValue,\n isValueInitialized\n }), [disabled, orientation, setGroupValue, groupValue, isValueInitialized]);\n const defaultProps = {\n role: 'group'\n };\n const element = useRenderElement('div', componentProps, {\n enabled: Boolean(toolbarContext),\n state,\n ref: forwardedRef,\n props: [defaultProps, elementProps],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsx(ToggleGroupContext.Provider, {\n value: contextValue,\n children: toolbarContext ? element : /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: [defaultProps, elementProps],\n stateAttributesMapping: stateAttributesMapping,\n loopFocus: loopFocus,\n enableHomeAndEndKeys: true,\n orientation: orientation\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ToggleGroup.displayName = \"ToggleGroup\";","\"use client\";\n\nimport type { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\";\nimport { ToggleGroup as ToggleGroupPrimitive } from \"@base-ui/react/toggle-group\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"~/lib/utils\";\nimport { Separator } from \"~/components/ui/separator\";\nimport { Toggle as ToggleComponent, type toggleVariants } from \"~/components/ui/toggle\";\n\nconst ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({\n size: \"default\",\n variant: \"default\",\n});\n\nfunction ToggleGroup({\n className,\n variant = \"default\",\n size = \"default\",\n orientation = \"horizontal\",\n children,\n ...props\n}: ToggleGroupPrimitive.Props & VariantProps<typeof toggleVariants>) {\n const value = React.useMemo(() => ({ size, variant }), [size, variant]);\n return (\n <ToggleGroupPrimitive\n className={cn(\n \"flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input\",\n orientation === \"horizontal\"\n ? \"*:pointer-coarse:after:min-w-auto\"\n : \"*:pointer-coarse:after:min-h-auto\",\n variant === \"default\"\n ? \"gap-0.5\"\n : orientation === \"horizontal\"\n ? \"*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none\"\n : \"*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block\",\n className,\n )}\n data-size={size}\n data-slot=\"toggle-group\"\n data-variant={variant}\n orientation={orientation}\n {...props}\n >\n <ToggleGroupContext value={value}>{children}</ToggleGroupContext>\n </ToggleGroupPrimitive>\n );\n}\n\nfunction Toggle({\n className,\n children,\n variant,\n size,\n ...props\n}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {\n const context = React.use(ToggleGroupContext);\n\n const resolvedVariant = variant ?? context.variant;\n const resolvedSize = size ?? context.size;\n\n return (\n <ToggleComponent\n className={className}\n data-size={resolvedSize}\n data-variant={resolvedVariant}\n size={resolvedSize}\n variant={resolvedVariant}\n {...props}\n >\n {children}\n </ToggleComponent>\n );\n}\n\nfunction ToggleGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: {\n className?: string;\n} & React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n className={cn(\n \"pointer-events-none relative bg-input before:absolute before:inset-0 dark:before:bg-input/32\",\n className,\n )}\n orientation={orientation}\n {...props}\n />\n );\n}\n\nexport { ToggleGroup, Toggle, Toggle as ToggleGroupItem, ToggleGroupSeparator };\n","import { WS_METHODS } from \"@t3tools/contracts\";\nimport { Atom } from \"effect/unstable/reactivity\";\n\nimport { createEnvironmentRpcQueryAtomFamily } from \"./runtime.ts\";\nimport type { EnvironmentRegistry } from \"../connection/registry.ts\";\n\nexport function createReviewEnvironmentAtoms<R, E>(\n runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,\n) {\n return {\n diffPreview: createEnvironmentRpcQueryAtomFamily(runtime, {\n label: \"environment-data:review:diff-preview\",\n tag: WS_METHODS.reviewGetDiffPreview,\n staleTimeMs: 5_000,\n }),\n };\n}\n","import { createReviewEnvironmentAtoms } from \"@t3tools/client-runtime/state/review\";\n\nimport { connectionAtomRuntime } from \"../connection/runtime\";\n\nexport const reviewEnvironment = createReviewEnvironmentAtoms(connectionAtomRuntime);\n","import type { VcsRef } from \"@t3tools/contracts\";\n\nexport interface BaseRefChoice {\n readonly id: string;\n readonly label: string;\n readonly local: VcsRef | null;\n readonly remote: VcsRef | null;\n}\n\nfunction remoteBranchName(ref: VcsRef): string {\n if (ref.remoteName && ref.name.startsWith(`${ref.remoteName}/`)) {\n return ref.name.slice(ref.remoteName.length + 1);\n }\n return ref.name;\n}\n\nexport function buildBaseRefChoices(\n localRefs: ReadonlyArray<VcsRef>,\n remoteRefs: ReadonlyArray<VcsRef>,\n): ReadonlyArray<BaseRefChoice> {\n const unusedRemoteRefs = new Set(remoteRefs);\n const pairedChoices = localRefs.map((local) => {\n const matches = remoteRefs.filter(\n (remote) => unusedRemoteRefs.has(remote) && remoteBranchName(remote) === local.name,\n );\n const remote =\n matches.find((candidate) => candidate.remoteName === \"origin\") ?? matches[0] ?? null;\n if (remote) unusedRemoteRefs.delete(remote);\n return {\n id: `local:${local.name}`,\n label: local.name,\n local,\n remote,\n };\n });\n\n const remoteOnlyChoices = remoteRefs\n .filter((remote) => unusedRemoteRefs.has(remote))\n .map((remote) => ({\n id: `remote:${remote.name}`,\n label: remote.name,\n local: null,\n remote,\n }));\n\n return [...pairedChoices, ...remoteOnlyChoices];\n}\n\nexport function filterBaseRefChoices(\n choices: ReadonlyArray<BaseRefChoice>,\n query: string,\n): ReadonlyArray<BaseRefChoice> {\n const normalizedQuery = query.trim().toLocaleLowerCase();\n if (normalizedQuery.length === 0) return choices;\n return choices.filter(\n (choice) =>\n choice.label.toLocaleLowerCase().includes(normalizedQuery) ||\n choice.local?.name.toLocaleLowerCase().includes(normalizedQuery) === true ||\n choice.remote?.name.toLocaleLowerCase().includes(normalizedQuery) === true,\n );\n}\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { useParams } from \"@tanstack/react-router\";\nimport {\n isAtomCommandInterrupted,\n squashAtomCommandFailure,\n} from \"@t3tools/client-runtime/state/runtime\";\nimport { safeErrorLogAttributes } from \"@t3tools/client-runtime/errors\";\nimport type { ScopedThreadRef, TurnId } from \"@t3tools/contracts\";\nimport {\n ArrowRightIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n ChevronsDownUpIcon,\n ChevronsUpDownIcon,\n Columns2Icon,\n PilcrowIcon,\n Rows3Icon,\n SearchIcon,\n TextWrapIcon,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useOpenInPreferredEditor } from \"../editorPreferences\";\nimport { type DraftId } from \"../composerDraftStore\";\nimport { openDiffFilePrimaryAction } from \"../diffFileActions\";\nimport { useCheckpointDiff } from \"~/lib/checkpointDiffState\";\nimport { cn } from \"~/lib/utils\";\nimport { selectThreadDiffPanelSelection, useDiffPanelStore } from \"../diffPanelStore\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport {\n buildFileDiffRenderKey,\n getDiffCollapseIconClassName,\n getRenderablePatch,\n resolveDiffThemeName,\n resolveFileDiffPath,\n} from \"../lib/diffRendering\";\nimport { areAllDiffFilesCollapsed, toggleAllDiffFiles } from \"../lib/diffCollapse\";\nimport { useTurnDiffSummaries } from \"../hooks/useTurnDiffSummaries\";\nimport { useProject, useThread } from \"../state/entities\";\nimport { resolveThreadRouteRef } from \"../threadRoutes\";\nimport { useClientSettings } from \"../hooks/useSettings\";\nimport { formatShortTimestamp } from \"../timestampFormat\";\nimport { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from \"./DiffPanelShell\";\nimport { AnnotatableCodeView, type AnnotatableCodeViewHandle } from \"./diffs/AnnotatableCodeView\";\nimport { Button } from \"./ui/button\";\nimport { ToggleGroup, Toggle } from \"./ui/toggle-group\";\nimport { Switch } from \"./ui/switch\";\nimport {\n Combobox,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxTrigger,\n} from \"./ui/combobox\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"./ui/menu\";\nimport { Tooltip, TooltipPopup, TooltipTrigger } from \"./ui/tooltip\";\nimport { useEnvironmentQuery } from \"../state/query\";\nimport { serverEnvironment } from \"../state/server\";\nimport { reviewEnvironment } from \"../state/review\";\nimport { vcsEnvironment } from \"../state/vcs\";\nimport { buildBaseRefChoices, filterBaseRefChoices } from \"../lib/baseRefChoices\";\n\ntype DiffRenderMode = \"stacked\" | \"split\";\ntype DiffThemeType = \"light\" | \"dark\";\nconst AUTOMATIC_BASE_REF = \"__automatic_base_ref__\";\n\ninterface CollapsedDiffFilesState {\n readonly scopeKey: string | null;\n readonly fileKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_COLLAPSED_DIFF_FILE_KEYS: ReadonlySet<string> = new Set();\n\nconst DIFF_PANEL_UNSAFE_CSS = `\n[data-diffs-header],\n[data-diff],\n[data-file],\n[data-error-wrapper],\n[data-virtualizer-buffer] {\n --diffs-header-font-family: var(--font-sans) !important;\n --diffs-font-family: var(--font-mono) !important;\n --diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-token-light-bg: transparent;\n --diffs-token-dark-bg: transparent;\n\n --diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));\n --diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));\n --diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));\n --diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));\n\n --diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));\n --diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));\n --diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));\n --diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));\n\n --diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));\n --diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));\n --diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));\n --diffs-bg-deletion-emphasis-override: color-mix(\n in srgb,\n var(--background) 80%,\n var(--destructive)\n );\n\n background-color: var(--diffs-bg) !important;\n}\n\n[data-file-info] {\n background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;\n border-block-color: var(--border) !important;\n color: var(--foreground) !important;\n}\n\n[data-diffs-header] {\n position: sticky !important;\n top: 0;\n z-index: 4;\n background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;\n border-bottom: 1px solid var(--border) !important;\n align-items: center !important;\n font-family: var(--font-sans) !important;\n font-size: 12px !important;\n line-height: 1 !important;\n min-height: 32px !important;\n padding-block: 6px !important;\n}\n\n[data-diffs-header] [data-header-content] {\n align-items: center !important;\n line-height: 1 !important;\n}\n\n[data-diffs-header] [data-metadata] {\n align-items: center !important;\n line-height: 1 !important;\n font-variant-numeric: tabular-nums;\n}\n\n[data-diffs-header] [data-additions-count],\n[data-diffs-header] [data-deletions-count] {\n font-family: var(--font-mono) !important;\n font-size: 11px !important;\n font-variant-numeric: tabular-nums;\n line-height: 1 !important;\n}\n\n[data-diffs-header] [data-change-icon],\n[data-diffs-header] [data-rename-icon] {\n display: block;\n flex-shrink: 0;\n}\n\n[data-title] {\n cursor: pointer;\n transition:\n color 120ms ease,\n text-decoration-color 120ms ease;\n text-decoration: underline;\n text-decoration-color: transparent;\n text-underline-offset: 2px;\n font-family: var(--font-sans) !important;\n}\n\n[data-title]:hover {\n color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;\n text-decoration-color: currentColor;\n}\n`;\n\ninterface DiffPanelProps {\n mode?: DiffPanelMode;\n composerDraftTarget: ScopedThreadRef | DraftId;\n initialGitScope: \"branch\" | \"unstaged\";\n}\n\nexport { DiffWorkerPoolProvider } from \"./DiffWorkerPoolProvider\";\n\nexport default function DiffPanel({\n mode = \"inline\",\n composerDraftTarget,\n initialGitScope: initialGitScopeProp,\n}: DiffPanelProps) {\n const { resolvedTheme } = useTheme();\n const settings = useClientSettings();\n const [initialGitScope] = useState(initialGitScopeProp);\n const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>(\"stacked\");\n const [wordWrap, setWordWrap] = useState(settings.wordWrap);\n const [diffIgnoreWhitespace, setDiffIgnoreWhitespace] = useState(settings.diffIgnoreWhitespace);\n const [baseRefQuery, setBaseRefQuery] = useState(\"\");\n const [collapsedDiffFiles, setCollapsedDiffFiles] = useState<CollapsedDiffFilesState>(() => ({\n scopeKey: null,\n fileKeys: EMPTY_COLLAPSED_DIFF_FILE_KEYS,\n }));\n const codeViewRef = useRef<AnnotatableCodeViewHandle>(null);\n\n const routeThreadRef = useParams({\n strict: false,\n select: (params) => resolveThreadRouteRef(params),\n });\n const activeThreadId = routeThreadRef?.threadId ?? null;\n const activeThread = useThread(routeThreadRef);\n const activeProjectId = activeThread?.projectId ?? null;\n const activeProject = useProject(\n activeThread && activeProjectId\n ? {\n environmentId: activeThread.environmentId,\n projectId: activeProjectId,\n }\n : null,\n );\n const activeCwd = activeThread?.worktreePath ?? activeProject?.workspaceRoot;\n const serverConfig = useAtomValue(\n serverEnvironment.configValueAtom(activeThread?.environmentId ?? null),\n );\n const openInPreferredEditor = useOpenInPreferredEditor(\n activeThread?.environmentId ?? null,\n serverConfig?.availableEditors ?? [],\n );\n const gitStatusQuery = useEnvironmentQuery(\n activeThread !== null && activeThread !== undefined && activeCwd != null\n ? vcsEnvironment.status({\n environmentId: activeThread.environmentId,\n input: { cwd: activeCwd },\n })\n : null,\n );\n const diffSelection = useDiffPanelStore((state) =>\n selectThreadDiffPanelSelection(\n state.byThreadKey,\n routeThreadRef,\n initialGitScope === \"unstaged\",\n ),\n );\n const isGitRepo = gitStatusQuery.data?.isRepo ?? true;\n const { turnDiffSummaries, inferredCheckpointTurnCountByTurnId } =\n useTurnDiffSummaries(activeThread);\n const orderedTurnDiffSummaries = useMemo(\n () =>\n [...turnDiffSummaries].toSorted((left, right) => {\n const leftTurnCount =\n left.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[left.turnId] ?? 0;\n const rightTurnCount =\n right.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[right.turnId] ?? 0;\n if (leftTurnCount !== rightTurnCount) {\n return rightTurnCount - leftTurnCount;\n }\n return right.completedAt.localeCompare(left.completedAt);\n }),\n [inferredCheckpointTurnCountByTurnId, turnDiffSummaries],\n );\n\n useEffect(() => {\n if (!routeThreadRef || diffSelection.kind !== \"turn\") return;\n useDiffPanelStore.getState().reconcileTurnSelection(\n routeThreadRef,\n orderedTurnDiffSummaries.map((summary) => summary.turnId),\n );\n }, [diffSelection, orderedTurnDiffSummaries, routeThreadRef]);\n\n const selectedTurnId = diffSelection.kind === \"turn\" ? diffSelection.turnId : null;\n const selectedGitScope = diffSelection.kind === \"unstaged\" ? \"unstaged\" : \"branch\";\n const selectedBaseRef = diffSelection.kind === \"branch\" ? diffSelection.baseRef : null;\n const selectedFilePath = diffSelection.kind === \"turn\" ? diffSelection.filePath : null;\n const selectedFileRevealRequestId =\n diffSelection.kind === \"turn\" ? diffSelection.revealRequestId : 0;\n const selectedTurn =\n selectedTurnId === null\n ? undefined\n : (orderedTurnDiffSummaries.find((summary) => summary.turnId === selectedTurnId) ??\n orderedTurnDiffSummaries[0]);\n const selectedCheckpointTurnCount =\n selectedTurn &&\n (selectedTurn.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[selectedTurn.turnId]);\n const latestTurn = orderedTurnDiffSummaries[0];\n const selectedScopeLabel =\n selectedTurnId === null\n ? selectedGitScope === \"unstaged\"\n ? \"Working tree\"\n : \"Branch changes\"\n : selectedTurn?.turnId === latestTurn?.turnId\n ? \"Latest turn\"\n : `Turn ${selectedCheckpointTurnCount ?? \"?\"}`;\n const reviewSectionId = selectedTurn ? `turn:${selectedTurn.turnId}` : selectedGitScope;\n const collapseScopeKey = routeThreadRef\n ? `${routeThreadRef.environmentId}:${routeThreadRef.threadId}:${reviewSectionId}`\n : null;\n const collapsedDiffFileKeys =\n collapsedDiffFiles.scopeKey === collapseScopeKey\n ? collapsedDiffFiles.fileKeys\n : EMPTY_COLLAPSED_DIFF_FILE_KEYS;\n const reviewSectionTitle = selectedTurn\n ? `Turn ${selectedCheckpointTurnCount ?? \"?\"}`\n : selectedGitScope === \"unstaged\"\n ? \"Working tree\"\n : \"Branch changes\";\n const selectedCheckpointRange = useMemo(\n () =>\n typeof selectedCheckpointTurnCount === \"number\"\n ? {\n fromTurnCount: Math.max(0, selectedCheckpointTurnCount - 1),\n toTurnCount: selectedCheckpointTurnCount,\n }\n : null,\n [selectedCheckpointTurnCount],\n );\n const activeCheckpointDiff = useCheckpointDiff(\n {\n environmentId: activeThread?.environmentId ?? null,\n threadId: activeThreadId,\n fromTurnCount: selectedCheckpointRange?.fromTurnCount ?? null,\n toTurnCount: selectedCheckpointRange?.toTurnCount ?? null,\n ignoreWhitespace: diffIgnoreWhitespace,\n cacheScope: selectedTurn ? `turn:${selectedTurn.turnId}` : null,\n },\n { enabled: isGitRepo && selectedTurn !== undefined },\n );\n const primaryBranchDiffPreview = useEnvironmentQuery(\n selectedTurnId === null && activeThread && activeCwd\n ? reviewEnvironment.diffPreview({\n environmentId: activeThread.environmentId,\n input: {\n cwd: activeCwd,\n ...(selectedBaseRef ? { baseRef: selectedBaseRef } : {}),\n ignoreWhitespace: diffIgnoreWhitespace,\n },\n })\n : null,\n );\n const shouldRetryBranchDiffAtEnvironmentCwd =\n selectedTurnId === null &&\n primaryBranchDiffPreview.error?.includes(\"configured workspace root\") === true &&\n serverConfig?.cwd !== undefined &&\n serverConfig.cwd !== activeCwd;\n const fallbackBranchDiffPreview = useEnvironmentQuery(\n shouldRetryBranchDiffAtEnvironmentCwd && activeThread && serverConfig\n ? reviewEnvironment.diffPreview({\n environmentId: activeThread.environmentId,\n input: {\n cwd: serverConfig.cwd,\n ...(selectedBaseRef ? { baseRef: selectedBaseRef } : {}),\n ignoreWhitespace: diffIgnoreWhitespace,\n },\n })\n : null,\n );\n const branchDiffPreview = shouldRetryBranchDiffAtEnvironmentCwd\n ? fallbackBranchDiffPreview\n : primaryBranchDiffPreview;\n const selectedGitSource = branchDiffPreview.data?.sources.find(\n (source) => source.kind === (selectedGitScope === \"unstaged\" ? \"working-tree\" : \"branch-range\"),\n );\n const localBranchRefs = useEnvironmentQuery(\n selectedTurnId === null &&\n selectedGitScope === \"branch\" &&\n activeThread &&\n branchDiffPreview.data?.cwd\n ? vcsEnvironment.listRefs({\n environmentId: activeThread.environmentId,\n input: {\n cwd: branchDiffPreview.data.cwd,\n includeMatchingRemoteRefs: true,\n refKind: \"local\",\n ...(baseRefQuery.trim().length > 0 ? { query: baseRefQuery.trim() } : {}),\n limit: 100,\n },\n })\n : null,\n );\n const remoteBranchRefs = useEnvironmentQuery(\n selectedTurnId === null &&\n selectedGitScope === \"branch\" &&\n activeThread &&\n branchDiffPreview.data?.cwd\n ? vcsEnvironment.listRefs({\n environmentId: activeThread.environmentId,\n input: {\n cwd: branchDiffPreview.data.cwd,\n includeMatchingRemoteRefs: true,\n refKind: \"remote\",\n ...(baseRefQuery.trim().length > 0 ? { query: baseRefQuery.trim() } : {}),\n limit: 100,\n },\n })\n : null,\n );\n const baseRefChoices = buildBaseRefChoices(\n localBranchRefs.data?.refs.filter((ref) => ref.name !== selectedGitSource?.headRef) ?? [],\n remoteBranchRefs.data?.refs ?? [],\n );\n const matchingBaseRefChoices = filterBaseRefChoices(baseRefChoices, baseRefQuery);\n const valueForBaseRefChoice = (choice: (typeof baseRefChoices)[number]) =>\n selectedBaseRef && selectedBaseRef === choice.remote?.name\n ? selectedBaseRef\n : (choice.local?.name ?? choice.remote?.name ?? choice.id);\n const baseRefItems = [AUTOMATIC_BASE_REF, ...baseRefChoices.map(valueForBaseRefChoice)];\n const filteredBaseRefItems = [\n ...(baseRefQuery.trim().length === 0 ? [AUTOMATIC_BASE_REF] : []),\n ...matchingBaseRefChoices.map(valueForBaseRefChoice),\n ];\n const gitDiff = selectedGitSource?.diff;\n\n const selectedPatch = selectedTurn ? activeCheckpointDiff.data?.diff : gitDiff;\n const isSelectedPatchTruncated = !selectedTurn && selectedGitSource?.truncated === true;\n const isLoadingSelectedPatch = selectedTurn\n ? activeCheckpointDiff.isPending\n : branchDiffPreview.isPending;\n const selectedPatchError = selectedTurn ? activeCheckpointDiff.error : branchDiffPreview.error;\n const hasResolvedPatch = typeof selectedPatch === \"string\";\n const hasNoNetChanges = hasResolvedPatch && selectedPatch.trim().length === 0;\n const renderablePatch = useMemo(\n () =>\n getRenderablePatch(selectedPatch, `diff-panel:${resolvedTheme}`, {\n compactPartialHunkOffsets: selectedTurnId === null,\n }),\n [resolvedTheme, selectedPatch, selectedTurnId],\n );\n const renderableFiles = useMemo(() => {\n if (!renderablePatch || renderablePatch.kind !== \"files\") {\n return [];\n }\n return renderablePatch.files.toSorted((left, right) =>\n resolveFileDiffPath(left).localeCompare(resolveFileDiffPath(right), undefined, {\n numeric: true,\n sensitivity: \"base\",\n }),\n );\n }, [renderablePatch]);\n const codeViewFiles = useMemo(\n () =>\n renderableFiles.map((fileDiff) => {\n const fileKey = buildFileDiffRenderKey(fileDiff);\n return {\n fileDiff,\n filePath: resolveFileDiffPath(fileDiff),\n fileKey,\n collapsed: collapsedDiffFileKeys.has(fileKey),\n };\n }),\n [collapsedDiffFileKeys, renderableFiles],\n );\n const diffFileKeys = useMemo(() => codeViewFiles.map((file) => file.fileKey), [codeViewFiles]);\n const allDiffFilesCollapsed = areAllDiffFilesCollapsed(diffFileKeys, collapsedDiffFileKeys);\n\n useEffect(() => {\n if (!selectedFilePath) return;\n const file = codeViewFiles.find((candidate) => candidate.filePath === selectedFilePath);\n if (!file) return;\n codeViewRef.current?.scrollTo({ type: \"item\", id: file.fileKey, align: \"start\" });\n }, [codeViewFiles, selectedFilePath, selectedFileRevealRequestId]);\n\n const openDiffFile = useCallback(\n (filePath: string) => {\n openDiffFilePrimaryAction({\n threadRef: routeThreadRef,\n filePath,\n activeCwd,\n openInEditor: (targetPath) => {\n void (async () => {\n const result = await openInPreferredEditor(targetPath);\n if (result._tag === \"Failure\" && !isAtomCommandInterrupted(result)) {\n console.warn(\"Failed to open diff file in editor.\", {\n operation: \"open-diff-file\",\n ...(routeThreadRef\n ? {\n environmentId: routeThreadRef.environmentId,\n threadId: routeThreadRef.threadId,\n }\n : {}),\n ...safeErrorLogAttributes(squashAtomCommandFailure(result)),\n });\n }\n })();\n },\n });\n },\n [activeCwd, openInPreferredEditor, routeThreadRef],\n );\n const toggleDiffFileCollapsed = useCallback(\n (fileKey: string) => {\n setCollapsedDiffFiles((current) => {\n const next = new Set(current.scopeKey === collapseScopeKey ? current.fileKeys : []);\n if (next.has(fileKey)) {\n next.delete(fileKey);\n } else {\n next.add(fileKey);\n }\n return { scopeKey: collapseScopeKey, fileKeys: next };\n });\n },\n [collapseScopeKey],\n );\n\n const toggleDiffFileCollapse = useCallback(() => {\n setCollapsedDiffFiles((current) => {\n const currentKeys =\n current.scopeKey === collapseScopeKey ? current.fileKeys : EMPTY_COLLAPSED_DIFF_FILE_KEYS;\n\n return {\n scopeKey: collapseScopeKey,\n fileKeys: toggleAllDiffFiles(diffFileKeys, currentKeys),\n };\n });\n }, [collapseScopeKey, diffFileKeys]);\n\n const selectTurn = (turnId: TurnId) => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectTurn(routeThreadRef, turnId);\n };\n const selectGitScope = (scope: \"branch\" | \"unstaged\") => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectGitScope(routeThreadRef, scope);\n };\n const selectBranchBaseRef = (baseRef: string | null) => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectBranchBaseRef(routeThreadRef, baseRef);\n };\n\n const headerRow = (\n <>\n <div className=\"flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]\">\n <DropdownMenu>\n <DropdownMenuTrigger\n className=\"inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Diff scope: ${selectedScopeLabel}`}\n >\n <span className=\"truncate\">{selectedScopeLabel}</span>\n <ChevronDownIcon className=\"size-3.5 shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" className=\"w-60\">\n <DropdownMenuItem\n className={\n selectedTurnId === null && selectedGitScope === \"unstaged\"\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => selectGitScope(\"unstaged\")}\n >\n <span>Working tree</span>\n </DropdownMenuItem>\n <DropdownMenuItem\n className={\n selectedTurnId === null && selectedGitScope === \"branch\"\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => selectGitScope(\"branch\")}\n >\n <span>Branch changes</span>\n </DropdownMenuItem>\n <DropdownMenuItem\n className={\n selectedTurnId !== null && selectedTurn?.turnId === latestTurn?.turnId\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => {\n if (latestTurn) selectTurn(latestTurn.turnId);\n }}\n >\n <span>Latest turn</span>\n </DropdownMenuItem>\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>Turn</DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-64\">\n {orderedTurnDiffSummaries.map((summary) => {\n const turnCount =\n summary.checkpointTurnCount ??\n inferredCheckpointTurnCountByTurnId[summary.turnId] ??\n \"?\";\n return (\n <DropdownMenuItem\n key={summary.turnId}\n className={\n summary.turnId === selectedTurn?.turnId ? \"bg-foreground/[0.08]\" : undefined\n }\n onClick={() => selectTurn(summary.turnId)}\n >\n <span>Turn {turnCount}</span>\n <span className=\"ml-auto text-xs tabular-nums text-muted-foreground\">\n {formatShortTimestamp(summary.completedAt, settings.timestampFormat)}\n </span>\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n </DropdownMenuContent>\n </DropdownMenu>\n {selectedTurnId === null && selectedGitScope === \"branch\" && selectedGitSource?.baseRef && (\n <div\n className=\"flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground\"\n title={`${selectedGitSource.headRef ?? \"HEAD\"} → ${selectedGitSource.baseRef}`}\n aria-label={`Comparing ${selectedGitSource.headRef ?? \"HEAD\"} against ${selectedGitSource.baseRef}`}\n >\n <span className=\"min-w-0 max-w-48 truncate\">{selectedGitSource.headRef ?? \"HEAD\"}</span>\n <ArrowRightIcon className=\"size-3.5 shrink-0 opacity-70\" />\n <Combobox\n items={baseRefItems}\n filteredItems={filteredBaseRefItems}\n value={selectedBaseRef ?? AUTOMATIC_BASE_REF}\n onOpenChange={(open) => {\n if (!open) setBaseRefQuery(\"\");\n }}\n onValueChange={(value) => {\n if (!value) return;\n selectBranchBaseRef(value === AUTOMATIC_BASE_REF ? null : value);\n }}\n >\n <ComboboxTrigger\n className=\"inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Change comparison target. Currently ${selectedGitSource.baseRef}`}\n >\n <span className=\"min-w-0 truncate\">{selectedGitSource.baseRef}</span>\n <ChevronDownIcon className=\"size-3.5 shrink-0 opacity-70\" />\n </ComboboxTrigger>\n <ComboboxPopup\n align=\"start\"\n className=\"w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden\"\n >\n <div className=\"min-w-0 shrink-0 px-3 pt-2.5\">\n <div className=\"relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring\">\n <SearchIcon\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55\"\n />\n <ComboboxInput\n className=\"[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5\"\n inputClassName=\"rounded-none bg-transparent text-sm\"\n placeholder=\"Search refs...\"\n showTrigger={false}\n size=\"sm\"\n unstyled\n value={baseRefQuery}\n onChange={(event) => setBaseRefQuery(event.target.value)}\n />\n </div>\n </div>\n <div className=\"grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide\">\n <span aria-hidden=\"true\" />\n <div className=\"grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center\">\n <span>Branch</span>\n <span className=\"text-right\">Remote</span>\n </div>\n </div>\n <ComboboxEmpty>No matching refs.</ComboboxEmpty>\n <ComboboxList className=\"max-h-64 min-w-0 overflow-x-hidden\">\n <ComboboxItem\n className=\"h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0\"\n contentClassName=\"w-full min-w-0 overflow-hidden\"\n value={AUTOMATIC_BASE_REF}\n >\n <span className=\"block min-w-0 truncate\">Automatic</span>\n </ComboboxItem>\n {baseRefChoices.map((choice) => {\n const item = valueForBaseRefChoice(choice);\n const hasBoth = choice.local !== null && choice.remote !== null;\n const useRemote = choice.remote?.name === item;\n return (\n <ComboboxItem\n key={choice.id}\n className=\"h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0\"\n contentClassName=\"w-full min-w-0 overflow-hidden\"\n value={item}\n >\n <div className=\"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden\">\n <span className=\"block min-w-0 truncate pe-2\">{choice.label}</span>\n {hasBoth ? (\n <div\n className=\"flex justify-end\"\n onClick={(event) => event.stopPropagation()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n <Switch\n aria-label={`Use remote version of ${choice.label}`}\n checked={useRemote}\n className=\"[--thumb-size:--spacing(3)]\"\n onCheckedChange={(checked) => {\n const nextRef = checked\n ? choice.remote?.name\n : choice.local?.name;\n if (nextRef) selectBranchBaseRef(nextRef);\n }}\n />\n </div>\n ) : choice.remote ? (\n <span\n className=\"flex justify-end text-muted-foreground\"\n title=\"Remote only\"\n >\n <CheckIcon aria-hidden=\"true\" className=\"size-3\" />\n </span>\n ) : null}\n </div>\n </ComboboxItem>\n );\n })}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n </div>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]\">\n {codeViewFiles.length > 0 && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"icon-xs\"\n variant=\"outline\"\n aria-label={allDiffFilesCollapsed ? \"Expand all files\" : \"Collapse all files\"}\n onClick={toggleDiffFileCollapse}\n />\n }\n >\n {allDiffFilesCollapsed ? (\n <ChevronsUpDownIcon className=\"size-3\" />\n ) : (\n <ChevronsDownUpIcon className=\"size-3\" />\n )}\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {allDiffFilesCollapsed ? \"Expand all files\" : \"Collapse all files\"}\n </TooltipPopup>\n </Tooltip>\n )}\n <ToggleGroup\n className=\"shrink-0\"\n variant=\"outline\"\n size=\"xs\"\n value={[diffRenderMode]}\n onValueChange={(value) => {\n const next = value[0];\n if (next === \"stacked\" || next === \"split\") {\n setDiffRenderMode(next);\n }\n }}\n >\n <Toggle aria-label=\"Stacked diff view\" value=\"stacked\">\n <Rows3Icon className=\"size-3\" />\n </Toggle>\n <Toggle aria-label=\"Split diff view\" value=\"split\">\n <Columns2Icon className=\"size-3\" />\n </Toggle>\n </ToggleGroup>\n <Tooltip>\n <TooltipTrigger\n render={\n <Toggle\n aria-label={wordWrap ? \"Disable diff line wrapping\" : \"Enable diff line wrapping\"}\n variant=\"outline\"\n size=\"xs\"\n pressed={wordWrap}\n onPressedChange={(pressed) => {\n setWordWrap(Boolean(pressed));\n }}\n />\n }\n >\n <TextWrapIcon className=\"size-3\" />\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {wordWrap ? \"Disable line wrapping\" : \"Enable line wrapping\"}\n </TooltipPopup>\n </Tooltip>\n <Tooltip>\n <TooltipTrigger\n render={\n <Toggle\n aria-label={\n diffIgnoreWhitespace ? \"Show whitespace changes\" : \"Hide whitespace changes\"\n }\n variant=\"outline\"\n size=\"xs\"\n pressed={diffIgnoreWhitespace}\n onPressedChange={(pressed) => {\n setDiffIgnoreWhitespace(Boolean(pressed));\n }}\n />\n }\n >\n <PilcrowIcon className=\"size-3\" />\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {diffIgnoreWhitespace ? \"Show whitespace changes\" : \"Hide whitespace changes\"}\n </TooltipPopup>\n </Tooltip>\n </div>\n </>\n );\n\n return (\n <DiffPanelShell mode={mode} header={headerRow}>\n {!activeThread ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n Select a thread to inspect turn diffs.\n </div>\n ) : !isGitRepo ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n Turn diffs are unavailable because this project is not a git repository.\n </div>\n ) : selectedTurnId !== null && orderedTurnDiffSummaries.length === 0 ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n No completed turns yet.\n </div>\n ) : (\n <>\n <div className=\"diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden\">\n {isSelectedPatchTruncated && (\n <p className=\"shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground\">\n This diff was truncated because it exceeded the preview limit. The changes shown are\n incomplete.\n </p>\n )}\n {selectedPatchError && !renderablePatch && (\n <div className=\"px-3\">\n <p className=\"mb-2 text-[11px] text-red-500/80\">{selectedPatchError}</p>\n </div>\n )}\n {!renderablePatch ? (\n isLoadingSelectedPatch ? (\n <DiffPanelLoadingState\n label={\n selectedTurn\n ? \"Loading checkpoint diff...\"\n : selectedGitScope === \"unstaged\"\n ? \"Loading working tree diff...\"\n : \"Loading branch diff...\"\n }\n />\n ) : (\n <div className=\"flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70\">\n <p>\n {hasNoNetChanges\n ? \"No net changes in this selection.\"\n : \"No patch available for this selection.\"}\n </p>\n </div>\n )\n ) : renderablePatch.kind === \"files\" ? (\n <div\n className=\"min-h-0 flex-1\"\n onClickCapture={(event) => {\n const composedPath = event.nativeEvent.composedPath?.() ?? [];\n const title = composedPath.find(\n (node): node is HTMLElement =>\n node instanceof HTMLElement && node.hasAttribute(\"data-title\"),\n );\n const filePath = title?.textContent?.trim();\n if (filePath) openDiffFile(filePath);\n }}\n >\n <AnnotatableCodeView\n viewerRef={codeViewRef}\n key={collapseScopeKey ?? reviewSectionId}\n className=\"diff-render-surface h-full min-h-0 overflow-auto [&>div>div:last-child]:top-0! [&>div>div:last-child]:bottom-auto!\"\n files={codeViewFiles}\n sectionId={reviewSectionId}\n sectionTitle={reviewSectionTitle}\n composerDraftTarget={composerDraftTarget}\n renderHeaderPrefix={(fileDiff, fileKey, collapsed) => {\n const filePath = resolveFileDiffPath(fileDiff);\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <button\n type=\"button\"\n className={cn(\n \"inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden\",\n getDiffCollapseIconClassName(fileDiff),\n )}\n aria-label={collapsed ? `Expand ${filePath}` : `Collapse ${filePath}`}\n aria-expanded={!collapsed}\n onClick={(event) => {\n event.stopPropagation();\n toggleDiffFileCollapsed(fileKey);\n }}\n />\n }\n >\n {collapsed ? (\n <ChevronRightIcon className=\"size-4\" />\n ) : (\n <ChevronDownIcon className=\"size-4\" />\n )}\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {collapsed ? \"Expand diff\" : \"Collapse diff\"}\n </TooltipPopup>\n </Tooltip>\n );\n }}\n options={{\n diffStyle: diffRenderMode === \"split\" ? \"split\" : \"unified\",\n lineDiffType: \"none\",\n overflow: wordWrap ? \"wrap\" : \"scroll\",\n theme: resolveDiffThemeName(resolvedTheme),\n themeType: resolvedTheme as DiffThemeType,\n unsafeCSS: DIFF_PANEL_UNSAFE_CSS,\n stickyHeaders: true,\n layout: { paddingTop: 8, paddingBottom: 8, gap: 8 },\n }}\n />\n </div>\n ) : (\n <div className=\"min-h-0 flex-1 overflow-auto p-2\">\n <div className=\"space-y-2\">\n <p className=\"text-[11px] text-muted-foreground/75\">{renderablePatch.reason}</p>\n <pre\n className={cn(\n \"max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90\",\n wordWrap\n ? \"overflow-auto whitespace-pre-wrap wrap-break-word\"\n : \"overflow-auto\",\n )}\n >\n {renderablePatch.text}\n </pre>\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </DiffPanelShell>\n );\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,13,14],"mappings":"m9BAaA,IAAM,GAAW,EAAiB,YAAaA,CAH7C,CAAC,OAAQ,CAAE,MAAO,KAAM,OAAQ,KAAM,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EAC9E,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,CAEIA,CAAU,ECCnD,GAAU,EAAiB,UAAWC,CAJ1C,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG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+FACb,EAAA,EAAA,IAAA,CAAC,IAAD,CAAA,SACGmE,GACG,oCACA,wCACH,CAAA,CACA,CAAA,CAqFN,GACP,CAAA,GA7HA,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qGAA2F,0EAErG,CAAA,GANL,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qGAA2F,wCAErG,CAAA,CAiIO,CAAA,CAEpB"}
1
+ {"version":3,"file":"DiffPanel-B4yuHpll.js","names":["__iconNode","__iconNode","CodeView","useEffect","useLayoutEffect","useStableCallback","Fragment","ScopedThreadRef","useRightPanelStore","resolvePathLinkTarget","OpenDiffFilePrimaryActionInput","threadRef","filePath","activeCwd","openInEditor","targetPath","openDiffFilePrimaryAction","getState","openFile","CheckpointDiffState","CheckpointDiffTarget","useCheckpointDiff","useCheckpointDiffQuery","target","options","$","_c","state","t0","data","error","isPending","areAllDiffFilesCollapsed","fileKeys","ReadonlyArray","collapsedFileKeys","ReadonlySet","length","every","fileKey","has","toggleAllDiffFiles","Set","ReactNode","cn","Skeleton","DiffPanelMode","getDiffPanelHeaderRowClassName","DiffPanelShell","props","$","_c","t0","mode","t1","t2","Symbol","for","t3","header","t4","children","DiffPanelHeaderSkeleton","DiffPanelLoadingState","label","AnnotationSide","CodeViewDiffItem","CodeViewItem","DiffLineAnnotation","FileDiffMetadata","SelectedLineRange","CodeView","CodeViewHandle","CodeViewProps","ScopedThreadRef","useCallback","useMemo","useState","ReactNode","Ref","DraftId","useComposerDraftStore","fnv1a32","buildDiffReviewComment","restoreDiffReviewCommentRange","ReviewCommentContext","LocalCommentAnnotation","nextFileCommentId","DiffCommentAnnotationEntry","id","kind","range","rangeLabel","text","DiffCommentAnnotationGroup","entries","DiffCommentLineAnnotation","AnnotatableCodeViewHandle","EMPTY_REVIEW_COMMENTS","ReadonlyArray","annotationSide","endSide","side","appendAnnotationEntry","annotations","entry","annotationIndex","findIndex","annotation","lineNumber","end","metadata","map","index","AnnotatableCodeViewProps","files","fileDiff","filePath","fileKey","collapsed","sectionId","sectionTitle","composerDraftTarget","options","NonNullable","viewerRef","className","renderHeaderPrefix","DiffSelectionContext","item","AnnotatableCodeView","t0","$","_c","addReviewComment","_temp","removeReviewComment","_temp2","t1","store_1","store","getComposerDraft","reviewComments","selectedLines","setSelectedLines","draft","setDraft","t2","Map","_temp3","filesByKey","t3","t4","t5","persisted","filter","comment","fenceLanguage","reduce","comment_0","annotations_0","type","version","flatMap","_temp5","join","items","entryId","some","entry_0","removeEntry","entryId_0","entry_1","find","candidate","file_0","get","undefined","file","comment_1","submitEntry","t6","range_0","context","file_1","comment_2","beginComment","hasOpenComment","t7","ref","t8","t9","t10","t11","enableGutterUtility","enableLineSelection","onLineSelectionEnd","t12","item_0","t13","annotation_0","entry_2","text_0","t14","_temp4","store_0","ToggleGroup","ToggleGroupContext","c","_c","Toggle","TogglePrimitive","ToggleGroup","ToggleGroupPrimitive","VariantProps","React","cn","Separator","ToggleComponent","toggleVariants","ToggleGroupContext","createContext","size","variant","t0","$","children","className","props","t1","t2","t3","orientation","undefined","t4","value","t5","t6","t7","t8","t9","context","use","resolvedVariant","resolvedSize","ToggleGroupSeparator","ToggleGroupItem","WS_METHODS","Atom","createEnvironmentRpcQueryAtomFamily","EnvironmentRegistry","createReviewEnvironmentAtoms","runtime","AtomRuntime","R","E","diffPreview","label","tag","reviewGetDiffPreview","staleTimeMs","VcsRef","BaseRefChoice","id","label","local","remote","remoteBranchName","ref","remoteName","name","startsWith","slice","length","buildBaseRefChoices","localRefs","ReadonlyArray","remoteRefs","unusedRemoteRefs","Set","pairedChoices","map","matches","filter","has","find","candidate","delete","remoteOnlyChoices","filterBaseRefChoices","choices","query","normalizedQuery","trim","toLocaleLowerCase","choice","includes","useAtomValue","useParams","isAtomCommandInterrupted","squashAtomCommandFailure","safeErrorLogAttributes","ScopedThreadRef","TurnId","ArrowRightIcon","CheckIcon","ChevronDownIcon","ChevronRightIcon","ChevronsDownUpIcon","ChevronsUpDownIcon","Columns2Icon","PilcrowIcon","Rows3Icon","SearchIcon","TextWrapIcon","useCallback","useEffect","useMemo","useRef","useState","useOpenInPreferredEditor","DraftId","openDiffFilePrimaryAction","useCheckpointDiff","cn","selectThreadDiffPanelSelection","useDiffPanelStore","useTheme","buildFileDiffRenderKey","getDiffCollapseIconClassName","getRenderablePatch","resolveDiffThemeName","resolveFileDiffPath","areAllDiffFilesCollapsed","toggleAllDiffFiles","useTurnDiffSummaries","useProject","useThread","resolveThreadRouteRef","useClientSettings","formatShortTimestamp","DiffPanelLoadingState","DiffPanelShell","DiffPanelMode","AnnotatableCodeView","AnnotatableCodeViewHandle","Button","ToggleGroup","Toggle","Switch","Combobox","ComboboxEmpty","ComboboxInput","ComboboxItem","ComboboxList","ComboboxPopup","ComboboxTrigger","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuSub","DropdownMenuSubContent","DropdownMenuSubTrigger","DropdownMenuTrigger","Tooltip","TooltipPopup","TooltipTrigger","useEnvironmentQuery","serverEnvironment","reviewEnvironment","vcsEnvironment","buildBaseRefChoices","filterBaseRefChoices","DiffRenderMode","DiffThemeType","AUTOMATIC_BASE_REF","CollapsedDiffFilesState","scopeKey","fileKeys","ReadonlySet","EMPTY_COLLAPSED_DIFF_FILE_KEYS","Set","DIFF_PANEL_UNSAFE_CSS","DiffPanelProps","mode","composerDraftTarget","initialGitScope","DiffWorkerPoolProvider","DiffPanel","initialGitScopeProp","resolvedTheme","settings","diffRenderMode","setDiffRenderMode","wordWrap","setWordWrap","diffIgnoreWhitespace","setDiffIgnoreWhitespace","baseRefQuery","setBaseRefQuery","collapsedDiffFiles","setCollapsedDiffFiles","codeViewRef","routeThreadRef","strict","select","params","activeThreadId","threadId","activeThread","activeProjectId","projectId","activeProject","environmentId","activeCwd","worktreePath","workspaceRoot","serverConfig","configValueAtom","openInPreferredEditor","availableEditors","gitStatusQuery","undefined","status","input","cwd","diffSelection","state","byThreadKey","isGitRepo","data","isRepo","turnDiffSummaries","inferredCheckpointTurnCountByTurnId","orderedTurnDiffSummaries","toSorted","left","right","leftTurnCount","checkpointTurnCount","turnId","rightTurnCount","completedAt","localeCompare","kind","getState","reconcileTurnSelection","map","summary","selectedTurnId","selectedGitScope","selectedBaseRef","baseRef","selectedFilePath","filePath","selectedFileRevealRequestId","revealRequestId","selectedTurn","find","selectedCheckpointTurnCount","latestTurn","selectedScopeLabel","reviewSectionId","collapseScopeKey","collapsedDiffFileKeys","reviewSectionTitle","selectedCheckpointRange","fromTurnCount","Math","max","toTurnCount","activeCheckpointDiff","ignoreWhitespace","cacheScope","enabled","primaryBranchDiffPreview","diffPreview","shouldRetryBranchDiffAtEnvironmentCwd","error","includes","fallbackBranchDiffPreview","branchDiffPreview","selectedGitSource","sources","source","localBranchRefs","listRefs","includeMatchingRemoteRefs","refKind","trim","length","query","limit","remoteBranchRefs","baseRefChoices","refs","filter","ref","name","headRef","matchingBaseRefChoices","valueForBaseRefChoice","choice","remote","local","id","baseRefItems","filteredBaseRefItems","gitDiff","diff","selectedPatch","isSelectedPatchTruncated","truncated","isLoadingSelectedPatch","isPending","selectedPatchError","hasResolvedPatch","hasNoNetChanges","renderablePatch","compactPartialHunkOffsets","renderableFiles","files","numeric","sensitivity","codeViewFiles","fileDiff","fileKey","collapsed","has","diffFileKeys","file","allDiffFilesCollapsed","candidate","current","scrollTo","type","align","openDiffFile","threadRef","openInEditor","targetPath","result","_tag","console","warn","operation","toggleDiffFileCollapsed","next","delete","add","toggleDiffFileCollapse","currentKeys","selectTurn","selectGitScope","scope","selectBranchBaseRef","headerRow","turnCount","timestampFormat","open","value","event","target","item","hasBoth","useRemote","label","stopPropagation","checked","nextRef","pressed","Boolean","composedPath","nativeEvent","title","node","HTMLElement","hasAttribute","textContent","diffStyle","lineDiffType","overflow","theme","themeType","unsafeCSS","stickyHeaders","layout","paddingTop","paddingBottom","gap","reason","text"],"sources":["../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/columns-2.js","../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/pilcrow.js","../../../../node_modules/.pnpm/lucide-react@0.564.0_react@19.2.6/node_modules/lucide-react/dist/esm/icons/rows-3.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/prefersReducedMotion.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/roundToDevicePixel.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/components/CodeView.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/utils/areManagedSnapshotsEqual.js","../../../../node_modules/.pnpm/@pierre+diffs@1.3.0-beta.5_patch_hash=7cb6da88544119adda056b2f46f43956f99326227732da0b3_3b51331382fbad9d080c5033ee1e2a6a/node_modules/@pierre/diffs/dist/react/CodeView.js","../../src/diffFileActions.ts","../../src/lib/checkpointDiffState.ts","../../src/lib/diffCollapse.ts","../../src/components/DiffPanelShell.tsx","../../src/components/diffs/AnnotatableCodeView.tsx","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@19.2.16_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@base-ui/react/esm/toggle-group/ToggleGroupDataAttributes.js","../../../../node_modules/.pnpm/@base-ui+react@1.5.0_@types+react@19.2.16_react-dom@19.2.6_react@19.2.6__react@19.2.6/node_modules/@base-ui/react/esm/toggle-group/ToggleGroup.js","../../src/components/ui/toggle-group.tsx","../../../../packages/client-runtime/src/state/review.ts","../../src/state/review.ts","../../src/lib/baseRefChoices.ts","../../src/components/DiffPanel.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M12 3v18\", key: \"108xh3\" }]\n];\nconst Columns2 = createLucideIcon(\"columns-2\", __iconNode);\n\nexport { __iconNode, Columns2 as default };\n//# sourceMappingURL=columns-2.js.map\n","/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"path\", { d: \"M13 4v16\", key: \"8vvj80\" }],\n [\"path\", { d: \"M17 4v16\", key: \"7dpous\" }],\n [\"path\", { d: \"M19 4H9.5a4.5 4.5 0 0 0 0 9H13\", key: \"sh4n9v\" }]\n];\nconst Pilcrow = createLucideIcon(\"pilcrow\", __iconNode);\n\nexport { __iconNode, Pilcrow as default };\n//# sourceMappingURL=pilcrow.js.map\n","/**\n * @license lucide-react v0.564.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n [\"rect\", { width: \"18\", height: \"18\", x: \"3\", y: \"3\", rx: \"2\", key: \"afitv7\" }],\n [\"path\", { d: \"M21 9H3\", key: \"1338ky\" }],\n [\"path\", { d: \"M21 15H3\", key: \"9uk58r\" }]\n];\nconst Rows3 = createLucideIcon(\"rows-3\", __iconNode);\n\nexport { __iconNode, Rows3 as default };\n//# sourceMappingURL=rows-3.js.map\n","//#region src/utils/prefersReducedMotion.ts\nfunction prefersReducedMotion() {\n\tif (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") return false;\n\treturn window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n}\n\n//#endregion\nexport { prefersReducedMotion };\n//# sourceMappingURL=prefersReducedMotion.js.map","//#region src/utils/roundToDevicePixel.ts\n/**\n* Snap a CSS-pixel value to the nearest device-pixel boundary. Browsers store\n* scrollTop on the device-pixel grid on fractional-DPR displays (1.25x, 1.5x,\n* etc.), so rounding computed scroll targets against that grid keeps delta\n* math settling cleanly instead of hovering around fractional residuals.\n*\n* Reads window.devicePixelRatio fresh on each call so monitor-switching and\n* zoom changes are picked up without needing to flush any cached value.\n*/\nfunction roundToDevicePixel(value) {\n\tconst dpr = window.devicePixelRatio ?? 1;\n\treturn Math.round(value * dpr) / dpr;\n}\n\n//#endregion\nexport { roundToDevicePixel };\n//# sourceMappingURL=roundToDevicePixel.js.map","import { CORE_CSS_ATTRIBUTE, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DIFFS_DEVELOPMENT_BUILD, DIFFS_TAG_NAME, THEME_CSS_ATTRIBUTE, UNSAFE_CSS_ATTRIBUTE } from \"../constants.js\";\nimport { dequeueRender, queueRender } from \"../managers/UniversalRenderingManager.js\";\nimport { areObjectsEqual } from \"../utils/areObjectsEqual.js\";\nimport { areThemesEqual } from \"../utils/areThemesEqual.js\";\nimport { areOptionsEqual } from \"../utils/areOptionsEqual.js\";\nimport { areSelectionsEqual } from \"../utils/areSelectionsEqual.js\";\nimport { createWindowFromScrollPosition } from \"../utils/createWindowFromScrollPosition.js\";\nimport { isStyleNode } from \"../utils/isStyleNode.js\";\nimport { prefersReducedMotion } from \"../utils/prefersReducedMotion.js\";\nimport { roundToDevicePixel } from \"../utils/roundToDevicePixel.js\";\nimport { VirtualizedFile } from \"./VirtualizedFile.js\";\nimport { VirtualizedFileDiff } from \"./VirtualizedFileDiff.js\";\n\n//#region src/components/CodeView.ts\nconst CODE_VIEW_DIFF_OPTION_KEYS = [\n\t\"theme\",\n\t\"disableLineNumbers\",\n\t\"overflow\",\n\t\"themeType\",\n\t\"disableFileHeader\",\n\t\"disableVirtualizationBuffers\",\n\t\"preferredHighlighter\",\n\t\"useCSSClasses\",\n\t\"useTokenTransformer\",\n\t\"tokenizeMaxLineLength\",\n\t\"tokenizeMaxLength\",\n\t\"unsafeCSS\",\n\t\"diffStyle\",\n\t\"diffIndicators\",\n\t\"disableBackground\",\n\t\"expandUnchanged\",\n\t\"collapsedContextThreshold\",\n\t\"lineDiffType\",\n\t\"maxLineDiffLength\",\n\t\"expansionLineCount\",\n\t\"lineHoverHighlight\",\n\t\"enableTokenInteractionsOnWhitespace\",\n\t\"enableGutterUtility\",\n\t\"__debugPointerEvents\",\n\t\"enableLineSelection\",\n\t\"controlledSelection\",\n\t\"disableErrorHandling\"\n];\nconst CODE_VIEW_FILE_OPTION_KEYS = [\n\t\"theme\",\n\t\"disableLineNumbers\",\n\t\"overflow\",\n\t\"themeType\",\n\t\"disableFileHeader\",\n\t\"disableVirtualizationBuffers\",\n\t\"preferredHighlighter\",\n\t\"useCSSClasses\",\n\t\"useTokenTransformer\",\n\t\"tokenizeMaxLineLength\",\n\t\"tokenizeMaxLength\",\n\t\"unsafeCSS\",\n\t\"lineHoverHighlight\",\n\t\"enableTokenInteractionsOnWhitespace\",\n\t\"enableGutterUtility\",\n\t\"__debugPointerEvents\",\n\t\"enableLineSelection\",\n\t\"controlledSelection\",\n\t\"disableErrorHandling\"\n];\nconst CODE_VIEW_SHARED_CALLBACK_KEYS = [\n\t\"renderCustomHeader\",\n\t\"renderHeaderPrefix\",\n\t\"renderHeaderMetadata\",\n\t\"renderAnnotation\",\n\t\"renderGutterUtility\",\n\t\"onPostRender\",\n\t\"onGutterUtilityClick\",\n\t\"onLineClick\",\n\t\"onLineNumberClick\",\n\t\"onLineEnter\",\n\t\"onLineLeave\",\n\t\"onTokenClick\",\n\t\"onTokenEnter\",\n\t\"onTokenLeave\"\n];\nconst CODE_VIEW_SELECTION_CALLBACK_KEYS = [\n\t\"onLineSelected\",\n\t\"onLineSelectionStart\",\n\t\"onLineSelectionChange\",\n\t\"onLineSelectionEnd\"\n];\nconst CODE_VIEW_ITEM_OPTIONS_STATE = Symbol(\"CodeView.itemOptionsState\");\nfunction defineOptionsState(options, state) {\n\tObject.defineProperty(options, CODE_VIEW_ITEM_OPTIONS_STATE, {\n\t\tconfigurable: false,\n\t\tenumerable: false,\n\t\tvalue: state\n\t});\n}\nfunction getItemOptionsState(options) {\n\treturn options[CODE_VIEW_ITEM_OPTIONS_STATE];\n}\nfunction defineItemOption(target, key, get) {\n\tObject.defineProperty(target, key, {\n\t\tconfigurable: false,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn get(this);\n\t\t}\n\t});\n}\nconst DEFAULT_SCROLL_INTERACTION_RESTORE_DELAY_MS = 120;\nconst SCROLLING_CODE_OVERFLOW_FIX_VARIABLE = \"--diffs-overflow-override\";\nconst SCROLL_REBASE_CONTAINER_HEIGHT = 12e6;\nconst SCROLL_REBASE_TRIGGER_TOP = 1e6;\nconst SCROLL_REBASE_TARGET_TOP = 2e6;\nconst SCROLL_REBASE_TARGET_BOTTOM = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TARGET_TOP;\nconst SCROLL_REBASE_THRESHOLD = SCROLL_REBASE_CONTAINER_HEIGHT - SCROLL_REBASE_TRIGGER_TOP;\nconst MOBILE_SAFARI = (() => {\n\tconst { navigator } = globalThis;\n\tconst userAgent = navigator.userAgent;\n\tconst isIOS = /iP(?:hone|ad|od)/.test(userAgent);\n\tconst isIPadOS = navigator.platform === \"MacIntel\" && navigator.maxTouchPoints > 1;\n\treturn (isIOS || isIPadOS) && /AppleWebKit/.test(userAgent) && /Safari/.test(userAgent) && !/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(userAgent);\n})();\nvar CodeView = class CodeView {\n\tstatic __STOP = false;\n\tstatic __lastScrollPosition = 0;\n\ttype = \"advanced\";\n\tconfig = {\n\t\toverscrollSize: 200,\n\t\tintersectionObserverMargin: 0,\n\t\tresizeDebugging: false\n\t};\n\titems = [];\n\tidToItem = /* @__PURE__ */ new Map();\n\tselectedLines = null;\n\tinstanceToItem = /* @__PURE__ */ new Map();\n\tlayoutDirtyIndex;\n\tpendingLayoutReset;\n\trenderOptionsRevision = 0;\n\tslotCoordinator;\n\tslotSnapshot;\n\tscrollListeners = /* @__PURE__ */ new Set();\n\tscrollHeight = 0;\n\tcontainerHeight = -1;\n\tscrollTop = 0;\n\tscrollPageOffset = 0;\n\tscrollDirty = true;\n\tscrollInteractionFixTimer;\n\tpointerEventsDisabled = false;\n\tcodeOverflowFix = false;\n\theight = 0;\n\theightDirty = true;\n\twindowSpecs = {\n\t\ttop: 0,\n\t\tbottom: 0\n\t};\n\trenderState = {\n\t\tscrollTop: -1,\n\t\tfirstIndex: -1,\n\t\tlastIndex: -1,\n\t\tstickyHeight: 0,\n\t\tstickyTop: -1,\n\t\tstickyBottom: -1\n\t};\n\titemMetricsCache = DEFAULT_CODE_VIEW_FILE_METRICS;\n\tfileOptionsPrototype;\n\tdiffOptionsPrototype;\n\tpendingScrollTarget;\n\tpendingLayoutAnchor;\n\tshouldFixContainerFocus = false;\n\tscrollAnimation;\n\troot;\n\tresizeObserver;\n\tcontainer = document.createElement(\"div\");\n\tstickyContainer = document.createElement(\"div\");\n\tstickyOffset = document.createElement(\"div\");\n\telementPool = [];\n\telementPoolVersion = 0;\n\telementPoolTracker = /* @__PURE__ */ new WeakMap();\n\tpendingElementPool = [];\n\toptions;\n\tworkerManager;\n\tisContainerManaged;\n\tconstructor(options = { theme: DEFAULT_THEMES }, workerManager, isContainerManaged = false) {\n\t\tthis.options = options;\n\t\tthis.computeMetricsCache(options.itemMetrics);\n\t\tthis.fileOptionsPrototype = this.createFileOptionsPrototype();\n\t\tthis.diffOptionsPrototype = this.createDiffOptionsPrototype();\n\t\tthis.workerManager = workerManager;\n\t\tthis.isContainerManaged = isContainerManaged;\n\t\tthis.stickyOffset.style.contain = \"layout size\";\n\t\tthis.stickyContainer.style.position = \"sticky\";\n\t\tthis.stickyContainer.style.width = \"100%\";\n\t\tthis.stickyContainer.style.contain = \"layout style inline-size\";\n\t\tthis.stickyContainer.style.isolation = \"isolate\";\n\t\tthis.stickyContainer.style.display = \"flex\";\n\t\tthis.stickyContainer.style.flexDirection = \"column\";\n\t}\n\tgetLayout() {\n\t\treturn this.options.layout ?? DEFAULT_CODE_VIEW_LAYOUT;\n\t}\n\tcomputeMetricsCache(itemMetrics) {\n\t\tthis.itemMetricsCache = {\n\t\t\thunkLineCount: itemMetrics?.hunkLineCount ?? DEFAULT_CODE_VIEW_FILE_METRICS.hunkLineCount,\n\t\t\tlineHeight: itemMetrics?.lineHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.lineHeight,\n\t\t\tdiffHeaderHeight: itemMetrics?.diffHeaderHeight ?? DEFAULT_CODE_VIEW_FILE_METRICS.diffHeaderHeight,\n\t\t\thunkSeparatorHeight: itemMetrics?.hunkSeparatorHeight,\n\t\t\tspacing: itemMetrics?.spacing ?? DEFAULT_CODE_VIEW_FILE_METRICS.spacing,\n\t\t\tpaddingTop: itemMetrics?.paddingTop,\n\t\t\tpaddingBottom: itemMetrics?.paddingBottom\n\t\t};\n\t\treturn this.itemMetricsCache;\n\t}\n\tgetSmoothScrollSettings() {\n\t\treturn this.options.smoothScrollSettings ?? DEFAULT_SMOOTH_SCROLL_SETTINGS;\n\t}\n\tshouldDisablePointerEvents() {\n\t\treturn this.options.pointerEventsOnScroll !== true;\n\t}\n\tshouldValidateItemHeights() {\n\t\treturn DIFFS_DEVELOPMENT_BUILD && this.options.__devOnlyValidateItemHeights === true;\n\t}\n\tvalidateRenderedItemHeight(item) {\n\t\tif (!this.shouldValidateItemHeights() || item.element == null) return;\n\t\tconst stickySpecs = item.instance.getAdvancedStickySpecs();\n\t\tif (stickySpecs == null) return;\n\t\tconst expectedHeight = stickySpecs.height;\n\t\tconst actualHeight = item.element.getBoundingClientRect().height;\n\t\tif (expectedHeight === actualHeight) return;\n\t\tconsole.error(\"CodeView: reconciled item height does not match DOM height\", {\n\t\t\tid: item.item.id,\n\t\t\ttype: item.type,\n\t\t\tindex: item.index,\n\t\t\tversion: item.version,\n\t\t\texpectedHeight,\n\t\t\tactualHeight,\n\t\t\tdelta: actualHeight - expectedHeight,\n\t\t\tstickyTopOffset: stickySpecs.topOffset,\n\t\t\tvirtualizedHeight: item.instance.getVirtualizedHeight(),\n\t\t\ttop: item.top,\n\t\t\tscrollTop: this.getScrollTop(),\n\t\t\twindowSpecs: { ...this.windowSpecs },\n\t\t\telement: item.element,\n\t\t\tinstance: item.instance\n\t\t});\n\t}\n\tvalidateStickyContainerHeight() {\n\t\tif (!this.shouldValidateItemHeights()) return;\n\t\tconst { firstIndex, lastIndex, stickyHeight, stickyTop, stickyBottom } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1) return;\n\t\tconst actualHeight = this.stickyContainer.getBoundingClientRect().height;\n\t\tif (Math.abs(actualHeight - stickyHeight) < 1) return;\n\t\tconsole.error(\"CodeView: sticky container height does not match computed layout\", {\n\t\t\tcomputedStickyHeight: stickyHeight,\n\t\t\tactualStickyHeight: actualHeight,\n\t\t\tdelta: actualHeight - stickyHeight,\n\t\t\tstickyTop,\n\t\t\tstickyBottom,\n\t\t\tfirstIndex,\n\t\t\tlastIndex,\n\t\t\tfirstStickySpecs: this.items[firstIndex]?.instance.getAdvancedStickySpecs(),\n\t\t\tlastStickySpecs: this.items[lastIndex]?.instance.getAdvancedStickySpecs(),\n\t\t\tscrollTop: this.getScrollTop(),\n\t\t\tscrollPageOffset: this.scrollPageOffset,\n\t\t\twindowSpecs: { ...this.windowSpecs },\n\t\t\tstickyContainer: this.stickyContainer\n\t\t});\n\t}\n\tclearScrollInteractionTimer() {\n\t\tif (this.scrollInteractionFixTimer != null) {\n\t\t\tclearTimeout(this.scrollInteractionFixTimer);\n\t\t\tthis.scrollInteractionFixTimer = void 0;\n\t\t}\n\t}\n\tsuspendScrollInteractions() {\n\t\tthis.clearScrollInteractionTimer();\n\t\tif (this.shouldDisablePointerEvents() && !this.pointerEventsDisabled) {\n\t\t\tthis.stickyContainer.style.pointerEvents = \"none\";\n\t\t\tthis.pointerEventsDisabled = true;\n\t\t}\n\t\tif (MOBILE_SAFARI && !this.codeOverflowFix) {\n\t\t\tthis.stickyContainer.style.setProperty(SCROLLING_CODE_OVERFLOW_FIX_VARIABLE, \"hidden\");\n\t\t\tthis.codeOverflowFix = true;\n\t\t}\n\t\tthis.scrollInteractionFixTimer = setTimeout(this.restoreScrollInteractions, DEFAULT_SCROLL_INTERACTION_RESTORE_DELAY_MS);\n\t}\n\trestoreScrollInteractions = () => {\n\t\tthis.clearScrollInteractionTimer();\n\t\tif (this.pointerEventsDisabled) {\n\t\t\tthis.stickyContainer.style.removeProperty(\"pointer-events\");\n\t\t\tthis.pointerEventsDisabled = false;\n\t\t}\n\t\tif (this.codeOverflowFix) {\n\t\t\tthis.stickyContainer.style.setProperty(SCROLLING_CODE_OVERFLOW_FIX_VARIABLE, \"auto\");\n\t\t\tthis.codeOverflowFix = false;\n\t\t}\n\t};\n\tsyncLayout() {\n\t\tconst { gap, paddingBottom, paddingTop } = this.getLayout();\n\t\tthis.stickyContainer.style.gap = `${gap}px`;\n\t\tthis.container?.style.setProperty(\"margin-top\", `${paddingTop}px`);\n\t\tthis.container?.style.setProperty(\"margin-bottom\", `${paddingBottom}px`);\n\t}\n\tsetup(root) {\n\t\tif (this.root != null) throw new Error(\"CodeView.setup: already setup\");\n\t\tthis.workerManager?.subscribeToThemeChanges(this);\n\t\tthis.root = root;\n\t\tthis.root.style.overflowAnchor = \"none\";\n\t\tif (!this.root.hasAttribute(\"tabindex\")) this.root.tabIndex = -1;\n\t\tthis.container ??= document.createElement(\"div\");\n\t\tthis.container.style.contain = \"layout style\";\n\t\tthis.syncLayout();\n\t\tthis.container.appendChild(this.stickyOffset);\n\t\tthis.container.appendChild(this.stickyContainer);\n\t\tthis.root.appendChild(this.container);\n\t\tthis.scrollDirty = true;\n\t\tthis.heightDirty = true;\n\t\tthis.resizeObserver = new ResizeObserver(this.handleResize);\n\t\tthis.resizeObserver.observe(this.stickyContainer);\n\t\tthis.root.addEventListener(\"scroll\", this.handleScroll, { passive: true });\n\t\tthis.root.addEventListener(\"wheel\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"touchstart\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"pointerdown\", this.clearPendingScroll, { passive: true });\n\t\tthis.root.addEventListener(\"keydown\", this.clearPendingScroll, { passive: true });\n\t\tthis.resizeObserver.observe(this.root);\n\t\tthis.render(true);\n\t\twindow.__INSTANCE = this;\n\t\twindow.__TOGGLE = () => {\n\t\t\tif (CodeView.__STOP) {\n\t\t\t\tCodeView.__STOP = false;\n\t\t\t\tthis.scrollTo({\n\t\t\t\t\ttype: \"position\",\n\t\t\t\t\tposition: CodeView.__lastScrollPosition,\n\t\t\t\t\tbehavior: \"instant\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tCodeView.__lastScrollPosition = this.getScrollTop();\n\t\t\t\tCodeView.__STOP = true;\n\t\t\t}\n\t\t};\n\t}\n\treset() {\n\t\tthis.restoreScrollInteractions();\n\t\tthis.cleanAllRenderedItems();\n\t\tthis.selectedLines = null;\n\t\tthis.items.length = 0;\n\t\tthis.idToItem.clear();\n\t\tthis.instanceToItem.clear();\n\t\tthis.layoutDirtyIndex = void 0;\n\t\tthis.pendingLayoutReset = void 0;\n\t\tthis.stickyContainer.textContent = \"\";\n\t\tthis.stickyOffset.style.height = \"\";\n\t\tthis.container?.style.removeProperty(\"height\");\n\t\tthis.containerHeight = -1;\n\t\tthis.windowSpecs = {\n\t\t\ttop: 0,\n\t\t\tbottom: 0\n\t\t};\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.shouldFixContainerFocus = false;\n\t\tthis.height = 0;\n\t\tthis.scrollTop = 0;\n\t\tthis.scrollPageOffset = 0;\n\t\tthis.scrollHeight = 0;\n\t\tthis.scrollDirty = true;\n\t\tthis.heightDirty = true;\n\t\tthis.resetRenderState();\n\t\tif (!this.isContainerManaged) this.flushSlotCoordinator();\n\t}\n\tcleanUp() {\n\t\tthis.reset();\n\t\tthis.clearElementPool();\n\t\tthis.restoreScrollInteractions();\n\t\tthis.workerManager?.unsubscribeToThemeChanges(this);\n\t\tthis.resizeObserver?.disconnect();\n\t\tthis.resizeObserver = void 0;\n\t\tthis.root?.removeEventListener(\"scroll\", this.handleScroll);\n\t\tthis.root?.removeEventListener(\"wheel\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"touchstart\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"pointerdown\", this.clearPendingScroll);\n\t\tthis.root?.removeEventListener(\"keydown\", this.clearPendingScroll);\n\t\tthis.root?.style.removeProperty(\"overflow-anchor\");\n\t\tthis.container?.remove();\n\t\tthis.stickyOffset.remove();\n\t\tthis.stickyContainer.remove();\n\t\tthis.stickyContainer.textContent = \"\";\n\t\tthis.root = void 0;\n\t\tthis.container = void 0;\n\t}\n\tcleanAllRenderedItems() {\n\t\tif (this.renderState.firstIndex === -1) return;\n\t\tfor (let index = this.renderState.firstIndex; index <= this.renderState.lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${index}`);\n\t\t\tthis.releaseRenderedItem(item);\n\t\t}\n\t}\n\tprimeScrollTarget(target) {\n\t\tif (target.type === \"position\") return;\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) return;\n\t\titem.instance.primeHighlightCache();\n\t}\n\tgetElementPoolLimit() {\n\t\tconst viewportSize = this.getHeight() + this.config.overscrollSize * 2;\n\t\tconst { diffHeaderHeight } = this.itemMetricsCache;\n\t\treturn Math.max(8, Math.ceil(viewportSize / Math.max(diffHeaderHeight, 10)) + 1) * (this.isContainerManaged ? 2 : 1);\n\t}\n\tacquireElement() {\n\t\tthis.promotePendingPooledElements();\n\t\tlet element = this.elementPool.pop();\n\t\twhile (element != null && !this.isElementPoolGenerationCurrent(element)) element = this.elementPool.pop();\n\t\telement ??= document.createElement(DIFFS_TAG_NAME);\n\t\tthis.markElementPoolGenerationCurrent(element);\n\t\treturn element;\n\t}\n\treleaseRenderedItem(item) {\n\t\tconst { element } = item;\n\t\tif (element != null && this.renderedItemOwnsFocus(element)) this.shouldFixContainerFocus = true;\n\t\titem.instance.cleanUp(true);\n\t\titem.element = void 0;\n\t\tif (element == null) return;\n\t\telement.remove();\n\t\tthis.cleanElement(element);\n\t\tthis.queueElementForPool(element);\n\t}\n\trenderedItemOwnsFocus(element) {\n\t\tconst { activeElement } = document;\n\t\treturn activeElement === element || element.contains(activeElement) || element.shadowRoot?.activeElement != null;\n\t}\n\tfixContainerFocus() {\n\t\tif (this.shouldFixContainerFocus) {\n\t\t\tthis.shouldFixContainerFocus = false;\n\t\t\tthis.root?.focus({ preventScroll: true });\n\t\t}\n\t}\n\tcleanElement(element) {\n\t\tconst { shadowRoot } = element;\n\t\tif (shadowRoot != null) {\n\t\t\tfor (const child of Array.from(shadowRoot.children)) if (!isPooledShadowChild(child)) child.remove();\n\t\t}\n\t\tif (!this.isContainerManaged) element.replaceChildren();\n\t}\n\tqueueElementForPool(element) {\n\t\tconst poolLimit = this.getElementPoolLimit();\n\t\tif (!this.isElementPoolGenerationCurrent(element) || this.getElementPoolSize() >= poolLimit) return;\n\t\tif (this.isElementClean(element)) this.elementPool.push(element);\n\t\telse this.pendingElementPool.push(element);\n\t}\n\tpromotePendingPooledElements() {\n\t\tif (this.pendingElementPool.length === 0) return;\n\t\tconst { pendingElementPool: pendingElements } = this;\n\t\tthis.pendingElementPool = [];\n\t\tconst poolLimit = this.getElementPoolLimit();\n\t\tfor (const element of pendingElements) if (this.isElementPoolGenerationCurrent(element) && this.isElementClean(element) && this.elementPool.length < poolLimit) this.elementPool.push(element);\n\t\telse if (this.isElementPoolGenerationCurrent(element) && this.getElementPoolSize() < poolLimit) this.pendingElementPool.push(element);\n\t}\n\tisElementClean(element) {\n\t\treturn element.childNodes.length === 0;\n\t}\n\tgetElementPoolSize() {\n\t\treturn this.elementPool.length + this.pendingElementPool.length;\n\t}\n\tclearElementPool() {\n\t\tthis.elementPool.length = 0;\n\t\tthis.pendingElementPool.length = 0;\n\t}\n\tinvalidateElementPool() {\n\t\tthis.elementPoolVersion++;\n\t\tthis.clearElementPool();\n\t}\n\tmarkElementPoolGenerationCurrent(element) {\n\t\tthis.elementPoolTracker.set(element, this.elementPoolVersion);\n\t}\n\tisElementPoolGenerationCurrent(element) {\n\t\treturn this.elementPoolTracker.get(element) === this.elementPoolVersion;\n\t}\n\tresolveEffectiveScrollBehavior(target, destination) {\n\t\tif (prefersReducedMotion()) return \"instant\";\n\t\tif (target.behavior !== \"smooth-auto\") return target.behavior ?? \"instant\";\n\t\treturn Math.abs(destination - this.getScrollTop()) <= this.getHeight() * 10 ? \"smooth\" : \"instant\";\n\t}\n\tscrollTo(target) {\n\t\tif (this.root == null) return;\n\t\tconst pendingTarget = this.normalizeScrollTarget(target);\n\t\tif (pendingTarget == null) return;\n\t\tconst destination = this.resolveScrollTargetTop(pendingTarget);\n\t\tif (destination == null) return;\n\t\tthis.primeScrollTarget(pendingTarget);\n\t\tif (this.resolveEffectiveScrollBehavior(pendingTarget, destination) === \"smooth\") this.scrollAnimation ??= {\n\t\t\tposition: this.getScrollTop(),\n\t\t\tvelocity: 0,\n\t\t\tlastTimestamp: performance.now()\n\t\t};\n\t\telse this.scrollAnimation = void 0;\n\t\tthis.suspendScrollInteractions();\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.pendingScrollTarget = pendingTarget;\n\t\tthis.render();\n\t}\n\tsetSelectedLines(selection, options) {\n\t\tthis.applySelectedLines(selection, options);\n\t}\n\tgetSelectedLines() {\n\t\treturn this.selectedLines;\n\t}\n\tclearSelectedLines(options) {\n\t\tthis.applySelectedLines(null, options);\n\t}\n\tgetItem(itemId) {\n\t\treturn this.idToItem.get(itemId)?.item;\n\t}\n\tupdateItem(input) {\n\t\tconst item = this.idToItem.get(input.id);\n\t\tif (item == null) {\n\t\t\tconsole.error(`CodeView.updateItem: unknown item id \"${input.id}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.syncItemRecord(item, input)) return false;\n\t\tthis.markItemLayoutDirty(item);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t\tthis.syncSelection();\n\t\treturn true;\n\t}\n\tupdateItemId(oldId, newId) {\n\t\tif (oldId === newId) return true;\n\t\tconst item = this.idToItem.get(oldId);\n\t\tif (item == null) {\n\t\t\tconsole.error(`CodeView.updateItemId: unknown item id \"${oldId}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tif (this.idToItem.has(newId)) {\n\t\t\tconsole.error(`CodeView.updateItemId: duplicate item id \"${newId}\"`);\n\t\t\treturn false;\n\t\t}\n\t\tthis.idToItem.delete(oldId);\n\t\titem.item.id = newId;\n\t\tthis.idToItem.set(newId, item);\n\t\tthis.updateItemOptionsId(item.instance.options, newId);\n\t\tif (this.selectedLines?.id === oldId) {\n\t\t\tthis.selectedLines = {\n\t\t\t\t...this.selectedLines,\n\t\t\t\tid: newId\n\t\t\t};\n\t\t\tthis.options.onSelectedLinesChange?.(this.selectedLines);\n\t\t}\n\t\tthis.renamePendingScrollTarget(oldId, newId);\n\t\tthis.renamePendingLayoutAnchor(oldId, newId);\n\t\tthis.render();\n\t\treturn true;\n\t}\n\taddItem(input) {\n\t\tthis.addItems([input]);\n\t\tthis.syncSelection();\n\t}\n\taddItems(inputs) {\n\t\tthis.appendItemsInternal(inputs);\n\t\tthis.syncSelection();\n\t}\n\tsetItems(items) {\n\t\tif (items.length === 0) this.reset();\n\t\telse if (this.items.length === 0) this.appendItemsInternal(items);\n\t\telse if (!this.tryAppendItems(items)) this.reconcileItems(items);\n\t\tthis.syncSelection();\n\t}\n\t/**\n\t* Append new records to the viewer while preserving existing layout state.\n\t* This is the shared path for imperative adds and the append-only reconcile\n\t* fast path, so it measures new items immediately and only triggers render\n\t* once at the end.\n\t*/\n\tappendItemsInternal(inputs, render = true) {\n\t\tif (inputs.length === 0) return;\n\t\tconst layout = this.getLayout();\n\t\tlet nextTop = this.items.length === 0 ? 0 : this.scrollHeight + layout.gap;\n\t\tconst appendedTop = nextTop;\n\t\tfor (let index = 0; index < inputs.length; index++) {\n\t\t\tconst input = inputs[index];\n\t\t\tif (input == null) throw new Error(\"CodeView.appendItemsInternal: missing input item\");\n\t\t\tif (this.idToItem.has(input.id)) throw new Error(`CodeView.addItem: duplicate id \"${input.id}\"`);\n\t\t\tconst item = this.createItem(input, this.items.length, nextTop);\n\t\t\tthis.items.push(item);\n\t\t\tthis.idToItem.set(item.item.id, item);\n\t\t\tthis.instanceToItem.set(item.instance, item);\n\t\t\titem.height = prepareItemInstance(item);\n\t\t\tnextTop += item.height + layout.gap;\n\t\t}\n\t\tthis.scrollHeight = nextTop - layout.gap;\n\t\tthis.scrollDirty = true;\n\t\tif (render) if (this.canSkipRenderForAppend(appendedTop)) this.syncContainerHeight();\n\t\telse this.render();\n\t}\n\tcanSkipRenderForAppend(appendedTop) {\n\t\treturn this.container != null && this.renderState.firstIndex !== -1 && this.pendingScrollTarget == null && this.scrollAnimation == null && this.layoutDirtyIndex == null && appendedTop > this.windowSpecs.bottom;\n\t}\n\tonThemeChange() {\n\t\tthis.invalidateElementPool();\n\t}\n\tsetOptions(options) {\n\t\tif (options == null) return;\n\t\tthis.capturePendingLayoutAnchor();\n\t\tconst { options: prevOptions } = this;\n\t\tconst previousLayout = this.getLayout();\n\t\tconst { itemMetricsCache: previousItemMetrics } = this;\n\t\tif (shouldClearPool(prevOptions, options)) this.invalidateElementPool();\n\t\tthis.options = options;\n\t\tconst nextItemMetrics = this.computeMetricsCache(options.itemMetrics);\n\t\tconst itemMetricsChanged = !areObjectsEqual(previousItemMetrics, nextItemMetrics);\n\t\tconst layoutChanged = !areObjectsEqual(previousLayout, this.getLayout());\n\t\tif (layoutChanged) this.syncLayout();\n\t\tconst itemLayoutChanged = itemMetricsChanged || hasItemLayoutOptionChanged(prevOptions, options);\n\t\tif (itemLayoutChanged) {\n\t\t\tconst previousReset = this.pendingLayoutReset;\n\t\t\tthis.pendingLayoutReset = {\n\t\t\t\tmetrics: itemMetricsChanged ? nextItemMetrics : previousReset?.metrics,\n\t\t\t\tresetFileLayoutCache: true,\n\t\t\t\tresetDiffLayoutCache: true,\n\t\t\t\tincludeEstimatedDiffHeights: previousReset?.includeEstimatedDiffHeights === true || itemMetricsChanged || hasCodeViewDiffEstimateOptionChanged(prevOptions, options)\n\t\t\t};\n\t\t}\n\t\tif (layoutChanged || itemLayoutChanged) {\n\t\t\tthis.markLayoutDirtyFromIndex(0);\n\t\t\tthis.scrollDirty = true;\n\t\t}\n\t\tif (!areOptionsEqual(prevOptions, options)) this.renderOptionsRevision++;\n\t\tif (!this.isContainerManaged && this.items.length > 0) this.render();\n\t}\n\tcapturePendingLayoutAnchor() {\n\t\tif (this.root == null || this.items.length === 0 || this.pendingScrollTarget != null) return;\n\t\tthis.pendingLayoutAnchor = this.getScrollAnchor(this.getScrollTop());\n\t}\n\trender(immediate = false) {\n\t\tif (CodeView.__STOP) return;\n\t\tif (immediate) {\n\t\t\tdequeueRender(this.computeRenderRangeAndEmit);\n\t\t\tthis.computeRenderRangeAndEmit();\n\t\t} else queueRender(this.computeRenderRangeAndEmit);\n\t}\n\tinstanceChanged(instance, layoutDirty) {\n\t\tconst item = this.instanceToItem.get(instance);\n\t\tif (item == null) throw new Error(\"CodeView.instanceChanged: An instance has changed that is not registered\");\n\t\tif (layoutDirty) this.markItemLayoutDirty(item);\n\t\tthis.render();\n\t}\n\tgetWindowSpecs() {\n\t\treturn this.windowSpecs;\n\t}\n\tgetContainerElement() {\n\t\treturn this.root;\n\t}\n\tgetRenderedItems() {\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1 || lastIndex < firstIndex) return [];\n\t\tconst renderedItems = [];\n\t\tfor (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item?.element == null) continue;\n\t\t\tif (item.type === \"diff\") renderedItems.push({\n\t\t\t\tid: item.item.id,\n\t\t\t\ttype: \"diff\",\n\t\t\t\titem: item.item,\n\t\t\t\tversion: item.version,\n\t\t\t\telement: item.element,\n\t\t\t\tinstance: item.instance\n\t\t\t});\n\t\t\telse renderedItems.push({\n\t\t\t\tid: item.item.id,\n\t\t\t\ttype: \"file\",\n\t\t\t\titem: item.item,\n\t\t\t\tversion: item.version,\n\t\t\t\telement: item.element,\n\t\t\t\tinstance: item.instance\n\t\t\t});\n\t\t}\n\t\treturn renderedItems;\n\t}\n\tsetSlotCoordinator(coordinator) {\n\t\tif (coordinator === this.slotCoordinator) return false;\n\t\tthis.slotCoordinator = coordinator;\n\t\tthis.slotSnapshot = void 0;\n\t\treturn true;\n\t}\n\tgetSlotSnapshot(coordinator) {\n\t\treturn getSlotSnapshot(this.getRenderedItems(), coordinator);\n\t}\n\tsubscribeToScroll(listener) {\n\t\tthis.scrollListeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.scrollListeners.delete(listener);\n\t\t};\n\t}\n\tgetLocalTopForInstance(instance) {\n\t\tconst item = this.instanceToItem.get(instance);\n\t\tif (item == null) throw new Error(\"CodeView.getLocalTopForInstance: unknown virtualized instance\");\n\t\treturn item.top;\n\t}\n\tgetTopForItem(id) {\n\t\tconst item = this.idToItem.get(id);\n\t\tif (item == null) return;\n\t\treturn item.top + this.getLayout().paddingTop;\n\t}\n\tcreateItem(input, index, top) {\n\t\tconst { itemMetricsCache: itemMetrics } = this;\n\t\tif (input.type === \"diff\") {\n\t\t\tconst instance$1 = new VirtualizedFileDiff(this.createDiffOptions(input.id), this, itemMetrics, this.workerManager, this.isContainerManaged);\n\t\t\treturn {\n\t\t\t\ttype: \"diff\",\n\t\t\t\titem: input,\n\t\t\t\tversion: input.version,\n\t\t\t\tindex,\n\t\t\t\ttop,\n\t\t\t\theight: 0,\n\t\t\t\telement: void 0,\n\t\t\t\trenderedOptionsRevision: this.renderOptionsRevision,\n\t\t\t\tinstance: instance$1\n\t\t\t};\n\t\t}\n\t\tconst instance = new VirtualizedFile(this.createFileOptions(input.id), this, itemMetrics, this.workerManager, this.isContainerManaged);\n\t\treturn {\n\t\t\ttype: \"file\",\n\t\t\titem: input,\n\t\t\tversion: input.version,\n\t\t\tindex,\n\t\t\ttop,\n\t\t\theight: 0,\n\t\t\telement: void 0,\n\t\t\trenderedOptionsRevision: this.renderOptionsRevision,\n\t\t\tinstance\n\t\t};\n\t}\n\tapplySelectedLines(selection, options) {\n\t\tconst { selectedLines: prevSelection } = this;\n\t\tif (selection == null && prevSelection == null || selection != null && prevSelection?.id === selection.id && areSelectionsEqual(prevSelection.range, selection.range)) return;\n\t\tif (prevSelection != null && prevSelection.id !== selection?.id) this.idToItem.get(prevSelection.id)?.instance.setSelectedLines(null, { notify: false });\n\t\tthis.selectedLines = selection;\n\t\tthis.idToItem.get(selection?.id ?? \"\")?.instance.setSelectedLines(selection?.range ?? null, options);\n\t}\n\tsyncSelection() {\n\t\tif (this.selectedLines == null) return;\n\t\tconst item = this.idToItem.get(this.selectedLines.id);\n\t\tif (item == null) {\n\t\t\tthis.selectedLines = null;\n\t\t\treturn;\n\t\t}\n\t\titem.instance.setSelectedLines(this.selectedLines.range, { notify: false });\n\t}\n\trenamePendingScrollTarget(oldId, newId) {\n\t\tconst { pendingScrollTarget } = this;\n\t\tif (pendingScrollTarget == null || pendingScrollTarget.type === \"position\" || pendingScrollTarget.id !== oldId) return;\n\t\tthis.pendingScrollTarget = {\n\t\t\t...pendingScrollTarget,\n\t\t\tid: newId\n\t\t};\n\t}\n\trenamePendingLayoutAnchor(oldId, newId) {\n\t\tif (this.pendingLayoutAnchor?.id === oldId) this.pendingLayoutAnchor.id = newId;\n\t}\n\tcreateFileOptionsPrototype() {\n\t\tconst prototype = {};\n\t\tfor (const key of CODE_VIEW_FILE_OPTION_KEYS) defineItemOption(prototype, key, () => this.options[key]);\n\t\tdefineItemOption(prototype, \"stickyHeader\", () => this.options.stickyHeaders);\n\t\tdefineItemOption(prototype, \"collapsed\", (receiver) => this.getItemOptions(getItemOptionsState(receiver), \"file\")?.item.collapsed === true);\n\t\tfor (const key of CODE_VIEW_SHARED_CALLBACK_KEYS) this.defineItemSharedCallback(prototype, \"file\", key);\n\t\tfor (const key of CODE_VIEW_SELECTION_CALLBACK_KEYS) this.defineItemSelectionCallback(prototype, \"file\", key);\n\t\treturn prototype;\n\t}\n\tcreateDiffOptionsPrototype() {\n\t\tconst prototype = {};\n\t\tfor (const key of CODE_VIEW_DIFF_OPTION_KEYS) defineItemOption(prototype, key, () => this.options[key]);\n\t\tdefineItemOption(prototype, \"stickyHeader\", () => this.options.stickyHeaders);\n\t\tdefineItemOption(prototype, \"hunkSeparators\", () => this.options.hunkSeparators);\n\t\tdefineItemOption(prototype, \"collapsed\", (receiver) => this.getItemOptions(getItemOptionsState(receiver), \"diff\")?.item.collapsed === true);\n\t\tfor (const key of CODE_VIEW_SHARED_CALLBACK_KEYS) this.defineItemSharedCallback(prototype, \"diff\", key);\n\t\tfor (const key of CODE_VIEW_SELECTION_CALLBACK_KEYS) this.defineItemSelectionCallback(prototype, \"diff\", key);\n\t\treturn prototype;\n\t}\n\tcreateFileOptions(id) {\n\t\tconst options = Object.create(this.fileOptionsPrototype);\n\t\tdefineOptionsState(options, { id });\n\t\treturn options;\n\t}\n\tcreateDiffOptions(id) {\n\t\tconst options = Object.create(this.diffOptionsPrototype);\n\t\tdefineOptionsState(options, { id });\n\t\treturn options;\n\t}\n\tupdateItemOptionsId(options, id) {\n\t\tgetItemOptionsState(options).id = id;\n\t}\n\tgetItemOptions(state, mode) {\n\t\tconst item = this.idToItem.get(state.id);\n\t\tif (item == null || item.type !== mode) return;\n\t\treturn item;\n\t}\n\tdefineItemSharedCallback(options, mode, key) {\n\t\tdefineItemOption(options, key, (receiver) => {\n\t\t\tif (this.options[key] == null) return;\n\t\t\tconst state = getItemOptionsState(receiver);\n\t\t\tconst callbackCache = state.callbackCache ??= {};\n\t\t\tlet wrapped = callbackCache[key];\n\t\t\tif (wrapped == null) {\n\t\t\t\twrapped = ((...args) => {\n\t\t\t\t\tconst latest = this.getItemOptions(state, mode);\n\t\t\t\t\tif (latest == null) return;\n\t\t\t\t\tconst callback = this.options[key];\n\t\t\t\t\treturn callback?.(...args, latest);\n\t\t\t\t});\n\t\t\t\tcallbackCache[key] = wrapped;\n\t\t\t}\n\t\t\treturn wrapped;\n\t\t});\n\t}\n\tdefineItemSelectionCallback(options, mode, key) {\n\t\tdefineItemOption(options, key, (receiver) => {\n\t\t\tif (this.options.enableLineSelection !== true) return;\n\t\t\tconst state = getItemOptionsState(receiver);\n\t\t\tconst callbackCache = state.callbackCache ??= {};\n\t\t\tlet wrapped = callbackCache[key];\n\t\t\tif (wrapped == null) {\n\t\t\t\twrapped = ((range) => {\n\t\t\t\t\tconst latest = this.getItemOptions(state, mode);\n\t\t\t\t\tif (latest == null) return;\n\t\t\t\t\tconst selection = range == null ? null : {\n\t\t\t\t\t\tid: latest.item.id,\n\t\t\t\t\t\trange\n\t\t\t\t\t};\n\t\t\t\t\tif (this.options.controlledSelection !== true) {\n\t\t\t\t\t\tif (range != null || this.selectedLines?.id === latest.item.id) this.applySelectedLines(selection, { notify: false });\n\t\t\t\t\t}\n\t\t\t\t\tthis.options.onSelectedLinesChange?.(selection);\n\t\t\t\t\tconst callback = this.options[key];\n\t\t\t\t\treturn callback?.(range, latest);\n\t\t\t\t});\n\t\t\t\tcallbackCache[key] = wrapped;\n\t\t\t}\n\t\t\treturn wrapped;\n\t\t});\n\t}\n\t/**\n\t* Track the earliest index whose measured layout may now be stale. Later\n\t* render passes relayout from this point forward so we do not have to rebuild\n\t* positions for the whole list after every change.\n\t*/\n\tmarkLayoutDirtyFromIndex(index) {\n\t\tthis.layoutDirtyIndex = Math.min(this.layoutDirtyIndex ?? index, index);\n\t}\n\t/**\n\t* Mark the earliest affected item as layout-dirty after an imperative change.\n\t* Each record carries its current array index so this stays O(1) even when\n\t* the viewer holds a very large number of items.\n\t*/\n\tmarkItemLayoutDirty(item) {\n\t\tif (this.items[item.index] !== item) throw new Error(`CodeView.markItemLayoutDirty: unknown item id \"${item.item.id}\"`);\n\t\tthis.markLayoutDirtyFromIndex(item.index);\n\t}\n\t/**\n\t* Detect the common controlled-update case where the new list simply extends\n\t* the existing ordered prefix. When that happens we can reuse every current\n\t* record in place, sync any versioned payload changes, and append only the new\n\t* tail instead of rebuilding the whole list.\n\t*/\n\ttryAppendItems(items) {\n\t\tif (items.length <= this.items.length) return false;\n\t\tfor (let index = 0; index < this.items.length; index++) {\n\t\t\tconst existingItem = this.items[index];\n\t\t\tif (existingItem == null) throw new Error(\"CodeView.tryAppendItems: missing existing item\");\n\t\t\tconst nextItem = items[index];\n\t\t\tif (nextItem == null || existingItem.item.id !== nextItem.id || existingItem.type !== nextItem.type) return false;\n\t\t}\n\t\tfor (let index = 0; index < this.items.length; index++) {\n\t\t\tconst existingItem = this.items[index];\n\t\t\tif (existingItem == null) throw new Error(\"CodeView.tryAppendItems: missing existing item\");\n\t\t\tconst nextItem = items[index];\n\t\t\tif (nextItem == null) throw new Error(\"CodeView.tryAppendItems: append candidate missing prefix item\");\n\t\t\tif (this.syncItemRecord(existingItem, nextItem)) this.markLayoutDirtyFromIndex(index);\n\t\t}\n\t\tthis.appendItemsInternal(items.slice(this.items.length), false);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t\treturn true;\n\t}\n\t/**\n\t* Reconcile a new controlled item list against the existing records by id.\n\t* This reuses records and instances when type matches, cleans up removed\n\t* records, rebuilds the lookup maps, and marks layout dirty whenever order,\n\t* membership, or versioned item data changes.\n\t*/\n\treconcileItems(items) {\n\t\tconst { items: previousItems, idToItem: previousById } = this;\n\t\tconst removedItems = new Set(previousItems);\n\t\tconst nextItems = [];\n\t\tconst nextIdToItem = /* @__PURE__ */ new Map();\n\t\tconst nextInstanceToItem = /* @__PURE__ */ new Map();\n\t\tlet firstDirtyIndex;\n\t\tfor (let index = 0; index < items.length; index++) {\n\t\t\tconst input = items[index];\n\t\t\tif (input == null) throw new Error(\"CodeView.reconcileItems: missing input item\");\n\t\t\tif (nextIdToItem.has(input.id)) throw new Error(`CodeView.setItems: duplicate id \"${input.id}\"`);\n\t\t\tconst previousItem = previousById.get(input.id);\n\t\t\tconst item = previousItem != null && previousItem.type === input.type ? previousItem : this.createItem(input, index, 0);\n\t\t\titem.index = index;\n\t\t\tif (previousItem != null && previousItem.type === input.type) {\n\t\t\t\tremovedItems.delete(previousItem);\n\t\t\t\tif (this.syncItemRecord(item, input)) firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\t} else firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\tif (previousItems[index] !== item) firstDirtyIndex = Math.min(firstDirtyIndex ?? index, index);\n\t\t\tnextItems.push(item);\n\t\t\tnextIdToItem.set(input.id, item);\n\t\t\tnextInstanceToItem.set(item.instance, item);\n\t\t}\n\t\tfor (let index = 0; index < previousItems.length; index++) {\n\t\t\tconst removedItem = previousItems[index];\n\t\t\tif (removedItem == null || !removedItems.has(removedItem)) continue;\n\t\t\tthis.releaseRenderedItem(removedItem);\n\t\t\tconst dirtyIndex = Math.max(nextItems.length - 1, 0);\n\t\t\tfirstDirtyIndex = Math.min(firstDirtyIndex ?? dirtyIndex, dirtyIndex);\n\t\t}\n\t\tif (firstDirtyIndex == null) return;\n\t\tthis.items = nextItems;\n\t\tthis.idToItem = nextIdToItem;\n\t\tthis.instanceToItem = nextInstanceToItem;\n\t\tif (this.renderState.firstIndex >= nextItems.length) this.resetRenderState();\n\t\telse if (this.renderState.lastIndex >= nextItems.length) this.renderState.lastIndex = nextItems.length - 1;\n\t\tthis.markLayoutDirtyFromIndex(firstDirtyIndex);\n\t\tthis.scrollDirty = true;\n\t\tthis.render();\n\t}\n\t/**\n\t* Update a reused record from the latest controlled item only when its item\n\t* version changes. Matching versions mean CodeView keeps the current record\n\t* snapshot, which lets imperative updates remain in place until the caller\n\t* intentionally publishes a newer version.\n\t*/\n\tsyncItemRecord(item, nextItem) {\n\t\tif (item.type !== nextItem.type) throw new Error(`CodeView.syncItemRecord: type mismatch for id \"${nextItem.id}\"`);\n\t\tif (item.version === nextItem.version) return false;\n\t\titem.item = nextItem;\n\t\titem.version = nextItem.version;\n\t\titem.renderedOptionsRevision = -1;\n\t\treturn true;\n\t}\n\tgetMaxScrollTopForHeight(scrollHeight) {\n\t\tconst { paddingBottom, paddingTop } = this.getLayout();\n\t\treturn Math.max(paddingTop + scrollHeight + paddingBottom - this.getHeight(), 0);\n\t}\n\tgetMaxScrollTop() {\n\t\treturn this.getMaxScrollTopForHeight(this.getScrollHeight());\n\t}\n\tshouldRebaseScroll() {\n\t\treturn this.getMaxScrollTop() > SCROLL_REBASE_THRESHOLD;\n\t}\n\tgetPagedScrollHeight() {\n\t\treturn this.shouldRebaseScroll() ? Math.min(this.getScrollHeight(), SCROLL_REBASE_CONTAINER_HEIGHT) : this.getScrollHeight();\n\t}\n\tgetMaxPagedScrollTop() {\n\t\treturn this.getMaxScrollTopForHeight(this.getPagedScrollHeight());\n\t}\n\tclampPagedScrollTop(value) {\n\t\tconst maxScroll = this.getMaxPagedScrollTop();\n\t\treturn Math.max(0, Math.min(value, maxScroll));\n\t}\n\t/**\n\t* Clamps a logical scroll position to the min/max allowable scroll range\n\t* based on the full computed content height.\n\t*/\n\tclampScrollTop(value) {\n\t\tconst maxScroll = this.getMaxScrollTop();\n\t\treturn Math.max(0, Math.min(value, maxScroll));\n\t}\n\tgetMaxScrollPageOffset() {\n\t\treturn Math.max(this.getMaxScrollTop() - this.getMaxPagedScrollTop(), 0);\n\t}\n\tclampScrollPageOffset(value) {\n\t\tconst maxOffset = this.getMaxScrollPageOffset();\n\t\treturn Math.max(0, Math.min(value, maxOffset));\n\t}\n\tresolveScrollPageWindow(scrollTop, preferredPagedScrollTop) {\n\t\tlet pagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(preferredPagedScrollTop));\n\t\tlet scrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);\n\t\tpagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(scrollTop - scrollPageOffset));\n\t\tscrollPageOffset = this.clampScrollPageOffset(scrollTop - pagedScrollTop);\n\t\treturn {\n\t\t\tpagedScrollTop,\n\t\t\tscrollPageOffset\n\t\t};\n\t}\n\t/**\n\t* Resolve how a logical scrollTop maps onto the reusable paged scroll window\n\t* without mutating the current page offset.\n\t*/\n\tresolvePagedScrollPosition(logicalScrollTop) {\n\t\tif (!this.shouldRebaseScroll()) return {\n\t\t\tpagedScrollTop: this.clampPagedScrollTop(logicalScrollTop),\n\t\t\tscrollPageOffset: 0\n\t\t};\n\t\tconst currentPageOffset = this.clampScrollPageOffset(this.scrollPageOffset);\n\t\tconst pagedScrollTop = logicalScrollTop - currentPageOffset;\n\t\tconst pagedMaxScrollTop = this.getMaxPagedScrollTop();\n\t\tconst maxRebaseOffset = this.getMaxScrollPageOffset();\n\t\tconst shouldMoveDown = pagedScrollTop > SCROLL_REBASE_THRESHOLD && currentPageOffset < maxRebaseOffset;\n\t\tconst shouldMoveUp = pagedScrollTop < SCROLL_REBASE_TRIGGER_TOP && currentPageOffset > 0;\n\t\tif (pagedScrollTop < 0 || pagedScrollTop > pagedMaxScrollTop || shouldMoveDown || shouldMoveUp) return this.resolveScrollPageWindow(logicalScrollTop, shouldMoveUp ? Math.min(SCROLL_REBASE_TARGET_BOTTOM, pagedMaxScrollTop) : SCROLL_REBASE_TARGET_TOP);\n\t\treturn {\n\t\t\tpagedScrollTop: roundToDevicePixel(this.clampPagedScrollTop(pagedScrollTop)),\n\t\t\tscrollPageOffset: currentPageOffset\n\t\t};\n\t}\n\tneedsScrollPageUpdate(logicalScrollTop) {\n\t\tconst roundedScrollTop = roundToDevicePixel(this.clampScrollTop(logicalScrollTop));\n\t\tconst { scrollPageOffset } = this.resolvePagedScrollPosition(roundedScrollTop);\n\t\treturn scrollPageOffset !== this.scrollPageOffset;\n\t}\n\tgetPagedLayoutTop(logicalTop) {\n\t\tif (!this.shouldRebaseScroll()) return logicalTop;\n\t\treturn Math.max(logicalTop - this.scrollPageOffset, 0);\n\t}\n\tgetStickyHeaderOffset() {\n\t\treturn this.options.stickyHeaders === true && this.options.disableFileHeader !== true ? this.itemMetricsCache.diffHeaderHeight : 0;\n\t}\n\tgetScrollTargetRect(target) {\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unknown item id \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\tif (target.type === \"item\") return {\n\t\t\ttop: item.top,\n\t\t\theight: item.height\n\t\t};\n\t\tif (target.type === \"range\") {\n\t\t\tconst rangePosition = this.getRangeScrollPosition(item, target);\n\t\t\tif (rangePosition == null) {\n\t\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item \"${target.id}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttop: item.top + rangePosition.top,\n\t\t\t\theight: rangePosition.height\n\t\t\t};\n\t\t}\n\t\tconst linePosition = this.getLineScrollPosition(item, target);\n\t\tif (linePosition == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\treturn {\n\t\t\ttop: item.top + linePosition.top,\n\t\t\theight: linePosition.height\n\t\t};\n\t}\n\tnormalizeScrollTarget(target) {\n\t\tif (target.type === \"position\" || target.align !== \"nearest\") return target;\n\t\tconst rect = this.getScrollTargetRect(target);\n\t\tif (rect == null) return;\n\t\tconst offset = target.offset ?? 0;\n\t\tconst targetTop = this.getLayout().paddingTop + rect.top;\n\t\tconst targetBottom = targetTop + rect.height;\n\t\tconst currentTop = this.getScrollTop();\n\t\tconst visibleTop = currentTop + (target.type === \"line\" || target.type === \"range\" ? this.getStickyHeaderOffset() : 0);\n\t\tconst visibleBottom = currentTop + this.getHeight();\n\t\tif (targetTop - offset <= visibleTop && targetBottom + offset >= visibleBottom) return;\n\t\tif (targetTop - offset < visibleTop) return {\n\t\t\t...target,\n\t\t\talign: \"start\"\n\t\t};\n\t\tif (targetBottom + offset > visibleBottom) return {\n\t\t\t...target,\n\t\t\talign: \"end\"\n\t\t};\n\t}\n\t/**\n\t* Resolve a target's scroll position\n\t\n\t* Returns `undefined` when we can't resolve a target for whatever reason\n\t*/\n\tresolveScrollTargetTop(target) {\n\t\tif (target.type === \"position\") {\n\t\t\tconst clampedPosition = this.clampScrollTop(target.position);\n\t\t\treturn clampedPosition !== target.position ? clampedPosition : this.clampScrollTop(target.position - this.getStickyHeaderOffset());\n\t\t}\n\t\tconst item = this.idToItem.get(target.id);\n\t\tif (item == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unknown item id \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\tif (target.type === \"item\") return this.clampScrollTop(this.resolveAlignedScrollPosition(item.top, item.height, target.align, target.offset));\n\t\tif (target.type === \"range\") {\n\t\t\tconst rangePosition = this.getRangeScrollPosition(item, target);\n\t\t\tif (rangePosition == null) {\n\t\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve range ${formatSelectedLineRange(target.range)} for item \"${target.id}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + rangePosition.top, rangePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));\n\t\t}\n\t\tconst linePosition = this.getLineScrollPosition(item, target);\n\t\tif (linePosition == null) {\n\t\t\tconsole.warn(`CodeView.scrollTo: unable to resolve line ${target.lineNumber} for item \"${target.id}\"`);\n\t\t\treturn;\n\t\t}\n\t\treturn this.clampScrollTop(this.resolveAlignedScrollPosition(item.top + linePosition.top, linePosition.height, target.align, target.offset, this.getStickyHeaderOffset()));\n\t}\n\t/**\n\t* Given an existing scroll target (scroll top and height), figure out the\n\t* correct scroll position to target based on the desired alignment, offset\n\t* and stickyOffset if necessary\n\t*/\n\tresolveAlignedScrollPosition(targetTop, targetHeight, align, offset = 0, stickyOffset = 0) {\n\t\ttargetTop += this.getLayout().paddingTop;\n\t\tconst viewportHeight = this.getHeight();\n\t\tif (align === \"center\" && targetHeight + offset < viewportHeight) return targetTop - (viewportHeight - targetHeight) / 2 + offset;\n\t\tif (align === \"end\") return targetTop - (viewportHeight - targetHeight) + offset;\n\t\treturn targetTop - stickyOffset - offset;\n\t}\n\tgetLineScrollPosition(item, target) {\n\t\tif (item.type === \"diff\") return item.instance.getLinePosition(target.lineNumber, target.side);\n\t\treturn item.instance.getLinePosition(target.lineNumber);\n\t}\n\tgetRangeScrollPosition(item, target) {\n\t\tconst { range } = target;\n\t\tconst startPosition = this.getLineScrollPosition(item, {\n\t\t\ttype: \"line\",\n\t\t\tid: target.id,\n\t\t\tlineNumber: range.start,\n\t\t\tside: range.side\n\t\t});\n\t\tconst endPosition = this.getLineScrollPosition(item, {\n\t\t\ttype: \"line\",\n\t\t\tid: target.id,\n\t\t\tlineNumber: range.end,\n\t\t\tside: range.endSide ?? range.side\n\t\t});\n\t\tif (startPosition == null || endPosition == null) return;\n\t\tconst startTop = startPosition.top;\n\t\tconst startBottom = startTop + startPosition.height;\n\t\tconst endTop = endPosition.top;\n\t\tconst endBottom = endTop + endPosition.height;\n\t\tconst top = Math.min(startTop, endTop);\n\t\treturn {\n\t\t\ttop,\n\t\t\theight: Math.max(startBottom, endBottom) - top\n\t\t};\n\t}\n\t/**\n\t* Determine target scroll position for current frame.\n\t*\n\t* If there's no pendingScrollTarget then we just return the current scroll\n\t* position\n\t*\n\t* If there's a pendingScrollTarget then we depend on whether there's a\n\t* smooth scroll animation or not. If not just return the destination, or\n\t* compute next position given the smooth scroll spring physics\n\t*/\n\tcomputeTargetScrollTopForFrame(scrollTop, frameTimestamp) {\n\t\tif (this.pendingScrollTarget == null) return scrollTop;\n\t\tconst destination = this.resolveScrollTargetTop(this.pendingScrollTarget);\n\t\tif (destination == null) return scrollTop;\n\t\tconst { scrollAnimation } = this;\n\t\tif (scrollAnimation == null) return destination;\n\t\treturn this.computeSpringStep(scrollAnimation, destination, frameTimestamp).position;\n\t}\n\t/**\n\t* Closed-form critical-damped ODE step.\n\t*\n\t* Stable at any dt (Euler would blow up once ω·dt ≳ 1), so this survives\n\t* big RAF gaps (tab-wake, offscreen frames) and resize-driven ticks that\n\t* fire outside the normal RAF cadence.\n\t*/\n\tcomputeSpringStep(animation, destination, frameTimestamp) {\n\t\tconst dt = Math.max(0, frameTimestamp - animation.lastTimestamp);\n\t\tconst { omega } = this.getSmoothScrollSettings();\n\t\tconst decay = Math.exp(-omega * dt);\n\t\tconst displacement = animation.position - destination;\n\t\tconst springCoeff = animation.velocity + omega * displacement;\n\t\treturn {\n\t\t\tposition: destination + (displacement + springCoeff * dt) * decay,\n\t\t\tvelocity: (springCoeff * (1 - omega * dt) - omega * displacement) * decay\n\t\t};\n\t}\n\t/**\n\t* For any given pendingScrollTarget, updates any in flight smooth scroll\n\t* animations and returns the target scrollTop to move towards\n\t*\n\t* Resolves the animation based on frame time and adopts any necessary scroll\n\t* anchoring corrections if necessary\n\t*/\n\tadvanceScrollAnimation(frameTimestamp, anchorDelta) {\n\t\tif (this.pendingScrollTarget == null) return;\n\t\tconst destination = this.resolveScrollTargetTop(this.pendingScrollTarget);\n\t\tif (destination == null) {\n\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t\treturn;\n\t\t}\n\t\tconst animation = this.scrollAnimation;\n\t\tif (animation == null) return destination;\n\t\tanimation.position += anchorDelta;\n\t\tconst { position, velocity } = this.computeSpringStep(animation, destination, frameTimestamp);\n\t\tanimation.lastTimestamp = frameTimestamp;\n\t\tanimation.position = position;\n\t\tanimation.velocity = velocity;\n\t\tconst { positionEpsilon, velocityEpsilon } = this.getSmoothScrollSettings();\n\t\tif (Math.abs(destination - position) <= positionEpsilon && Math.abs(velocity) <= velocityEpsilon) {\n\t\t\tanimation.position = destination;\n\t\t\tanimation.velocity = 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t\treturn destination;\n\t\t}\n\t\treturn animation.position;\n\t}\n\tcomputeRenderRangeAndEmit = (timestamp = performance.now()) => {\n\t\tif (CodeView.__STOP || this.container == null) return;\n\t\tconst viewportHeight = this.getHeight();\n\t\tconst initialScrollTop = this.getScrollTop();\n\t\tlet scrollTopAfterLayout = initialScrollTop;\n\t\tlet computeScrollCorrection = this.pendingLayoutAnchor != null;\n\t\tlet scrollAnchor = this.getScrollAnchor(scrollTopAfterLayout);\n\t\tif (this.layoutDirtyIndex != null) {\n\t\t\tthis.recomputeLayout(this.layoutDirtyIndex, this.pendingLayoutReset);\n\t\t\tthis.layoutDirtyIndex = void 0;\n\t\t\tthis.pendingLayoutReset = void 0;\n\t\t\tcomputeScrollCorrection = true;\n\t\t}\n\t\tif (computeScrollCorrection && scrollAnchor != null) {\n\t\t\tconst anchoredScrollTopAfterLayout = this.resolveAnchoredScrollTop(scrollAnchor);\n\t\t\tif (anchoredScrollTopAfterLayout != null) {\n\t\t\t\tconst layoutAnchorDelta = anchoredScrollTopAfterLayout - scrollTopAfterLayout;\n\t\t\t\tscrollTopAfterLayout = anchoredScrollTopAfterLayout;\n\t\t\t\tif (this.scrollAnimation != null) this.scrollAnimation.position += layoutAnchorDelta;\n\t\t\t}\n\t\t}\n\t\tif (computeScrollCorrection) {\n\t\t\tscrollTopAfterLayout = this.clampScrollTop(scrollTopAfterLayout);\n\t\t\tthis.syncContainerHeight();\n\t\t}\n\t\tconst targetScrollTop = this.computeTargetScrollTopForFrame(scrollTopAfterLayout, timestamp);\n\t\tconst fitPerfectly = !computeScrollCorrection && (this.renderState.scrollTop === -1 || Math.abs(targetScrollTop - this.renderState.scrollTop) > viewportHeight + this.config.overscrollSize * 2);\n\t\tif (fitPerfectly) scrollAnchor = void 0;\n\t\tthis.windowSpecs = createWindowFromScrollPosition({\n\t\t\tscrollTop: targetScrollTop,\n\t\t\theight: viewportHeight,\n\t\t\tscrollHeight: this.getScrollHeight(),\n\t\t\tfitPerfectly,\n\t\t\tfitPerfectlyOverscroll: this.getFitPerfectlyOverscroll(),\n\t\t\toverscrollSize: this.config.overscrollSize\n\t\t});\n\t\tlet syncedScrollTop = initialScrollTop;\n\t\tif (this.pendingScrollTarget != null && targetScrollTop !== syncedScrollTop || this.needsScrollPageUpdate(targetScrollTop)) {\n\t\t\tthis.applyScrollFix(targetScrollTop, syncedScrollTop, this.windowSpecs);\n\t\t\tsyncedScrollTop = targetScrollTop;\n\t\t}\n\t\tconst { top, bottom } = this.windowSpecs;\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex >= 0) for (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${index}`);\n\t\t\tif (!(item.top > top - item.height && item.top <= bottom)) this.releaseRenderedItem(item);\n\t\t}\n\t\tlet prevElement;\n\t\tconst updatedItems = /* @__PURE__ */ new Set();\n\t\tconst startingIndex = this.findFirstVisibleIndex(top);\n\t\tconst lastRenderedIndex = this.findLastVisibleIndex(bottom);\n\t\tfor (let itemIndex = startingIndex; itemIndex <= lastRenderedIndex; itemIndex++) {\n\t\t\tconst item = this.items[itemIndex];\n\t\t\tif (item == null) throw new Error(`CodeView.computeRenderRangeAndEmit: missing item`);\n\t\t\tconst { instance } = item;\n\t\t\tif (item.element == null) {\n\t\t\t\titem.element = this.acquireElement();\n\t\t\t\tsyncRenderedItemOrder(this.stickyContainer, item.element, prevElement);\n\t\t\t\tinstance.virtualizedSetup();\n\t\t\t\tif (renderItem(item, item.element)) {\n\t\t\t\t\titem.renderedOptionsRevision = this.renderOptionsRevision;\n\t\t\t\t\tupdatedItems.add(item);\n\t\t\t\t}\n\t\t\t\tprevElement = item.element;\n\t\t\t} else {\n\t\t\t\tsyncRenderedItemOrder(this.stickyContainer, item.element, prevElement);\n\t\t\t\tif (renderItem(item, void 0, item.renderedOptionsRevision !== this.renderOptionsRevision)) {\n\t\t\t\t\titem.renderedOptionsRevision = this.renderOptionsRevision;\n\t\t\t\t\tupdatedItems.add(item);\n\t\t\t\t}\n\t\t\t\tprevElement = item.element;\n\t\t\t}\n\t\t}\n\t\tthis.renderState.firstIndex = startingIndex <= lastRenderedIndex ? startingIndex : -1;\n\t\tthis.renderState.lastIndex = lastRenderedIndex;\n\t\tthis.flushSlotCoordinator();\n\t\tthis.reconcileRenderedItems(updatedItems);\n\t\tthis.syncContainerHeight();\n\t\tthis.updateStickyPositioning();\n\t\tconst anchoredScrollTopAfterRender = scrollAnchor != null ? this.resolveAnchoredScrollTop(scrollAnchor) : void 0;\n\t\tif (scrollAnchor === this.pendingLayoutAnchor) this.pendingLayoutAnchor = void 0;\n\t\tconst postRenderAnchorDelta = anchoredScrollTopAfterRender != null ? anchoredScrollTopAfterRender - scrollTopAfterLayout : 0;\n\t\tlet postRenderScrollTop = targetScrollTop;\n\t\tlet shouldCheckPendingTargetSettled = false;\n\t\tif (this.pendingScrollTarget != null) {\n\t\t\tconst pendingTargetScrollTop = this.advanceScrollAnimation(timestamp, postRenderAnchorDelta);\n\t\t\tif (pendingTargetScrollTop != null) {\n\t\t\t\tpostRenderScrollTop = pendingTargetScrollTop;\n\t\t\t\tshouldCheckPendingTargetSettled = true;\n\t\t\t} else postRenderScrollTop = scrollTopAfterLayout;\n\t\t} else postRenderScrollTop = anchoredScrollTopAfterRender ?? targetScrollTop;\n\t\tif (postRenderScrollTop !== syncedScrollTop) {\n\t\t\tthis.applyScrollFix(postRenderScrollTop, syncedScrollTop, this.windowSpecs);\n\t\t\tsyncedScrollTop = postRenderScrollTop;\n\t\t}\n\t\tif (shouldCheckPendingTargetSettled && this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {\n\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\tthis.scrollAnimation = void 0;\n\t\t}\n\t\tthis.renderState.scrollTop = roundToDevicePixel(syncedScrollTop);\n\t\tthis.flushManagers(updatedItems);\n\t\tthis.validateStickyContainerHeight();\n\t\tthis.fixContainerFocus();\n\t\tif (fitPerfectly || this.scrollAnimation != null) this.render();\n\t};\n\tflushManagers(updatedItems) {\n\t\tfor (const item of updatedItems) item.instance.flushManagers();\n\t}\n\tsyncContainerHeight() {\n\t\tconst pagedScrollHeight = this.getPagedScrollHeight();\n\t\tif (this.container == null || this.containerHeight === pagedScrollHeight) return;\n\t\tthis.container.style.height = `${pagedScrollHeight}px`;\n\t\tthis.containerHeight = pagedScrollHeight;\n\t}\n\tgetStickyBounds(windowSpecs) {\n\t\tconst { firstIndex, lastIndex } = windowSpecs != null ? {\n\t\t\tfirstIndex: this.findFirstVisibleIndex(windowSpecs.top),\n\t\t\tlastIndex: this.findLastVisibleIndex(windowSpecs.bottom)\n\t\t} : this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1 || firstIndex > lastIndex) return;\n\t\tconst firstStickySpecs = this.items[firstIndex]?.instance.getAdvancedStickySpecs(windowSpecs);\n\t\tconst lastStickySpecs = this.items[lastIndex]?.instance.getAdvancedStickySpecs(windowSpecs);\n\t\tif (firstStickySpecs == null || lastStickySpecs == null) return;\n\t\treturn {\n\t\t\tstickyTop: this.getPagedLayoutTop(Math.max(firstStickySpecs.topOffset, 0)),\n\t\t\tstickyBottom: this.getPagedLayoutTop(lastStickySpecs.topOffset + lastStickySpecs.height)\n\t\t};\n\t}\n\tapplyStickyPositioning({ stickyTop, stickyBottom }) {\n\t\tconst height = this.getHeight();\n\t\tconst { itemMetricsCache: itemMetrics } = this;\n\t\tconst stickyContainerHeight = stickyBottom - stickyTop;\n\t\tthis.renderState.stickyHeight = stickyContainerHeight;\n\t\tthis.renderState.stickyTop = stickyTop;\n\t\tthis.renderState.stickyBottom = stickyBottom;\n\t\tthis.stickyOffset.style.height = `${stickyTop}px`;\n\t\tconst randomOffset = (Math.random() * itemMetrics.lineHeight >> 0) * -1;\n\t\tconst stickyJitter = -Math.max(stickyContainerHeight + randomOffset, 0) + height;\n\t\tthis.stickyContainer.style.top = `${stickyJitter}px`;\n\t\tthis.stickyContainer.style.bottom = `${stickyJitter + itemMetrics.diffHeaderHeight}px`;\n\t}\n\tsyncPagedScrollScaffolding(windowSpecs) {\n\t\tthis.syncContainerHeight();\n\t\tconst stickyBounds = this.getStickyBounds(windowSpecs);\n\t\tif (stickyBounds == null) return;\n\t\tthis.applyStickyPositioning(stickyBounds);\n\t}\n\treconcileRenderedItems(updatedItems) {\n\t\tconst { firstIndex, lastIndex } = this.renderState;\n\t\tif (firstIndex === -1) return;\n\t\tlet currentTop = -1;\n\t\tlet heightChanged = false;\n\t\tfor (let index = firstIndex; index < this.items.length; index++) {\n\t\t\tif (!heightChanged && index > lastIndex) break;\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(\"CodeView.reconcileRenderedItems: Invalid item\");\n\t\t\tif (currentTop === -1) currentTop = item.top;\n\t\t\telse if (item.top !== currentTop) {\n\t\t\t\titem.top = currentTop;\n\t\t\t\titem.instance.syncVirtualizedTop();\n\t\t\t\theightChanged = true;\n\t\t\t}\n\t\t\tif (updatedItems == null ? index <= lastIndex : updatedItems.has(item)) {\n\t\t\t\tif (item.instance.reconcileHeights()) {\n\t\t\t\t\theightChanged = true;\n\t\t\t\t\titem.height = item.instance.getVirtualizedHeight();\n\t\t\t\t}\n\t\t\t\tthis.validateRenderedItemHeight(item);\n\t\t\t}\n\t\t\tcurrentTop += item.instance.getVirtualizedHeight();\n\t\t\tif (index < this.items.length - 1) currentTop += this.getLayout().gap;\n\t\t}\n\t\tif (heightChanged && currentTop != null) {\n\t\t\tthis.scrollDirty = true;\n\t\t\tthis.scrollHeight = currentTop;\n\t\t}\n\t}\n\tupdateStickyPositioning() {\n\t\tconst stickyBounds = this.getStickyBounds();\n\t\tif (stickyBounds == null) return;\n\t\tconst { stickyTop, stickyBottom } = stickyBounds;\n\t\tif (stickyBottom - stickyTop === this.renderState.stickyHeight && stickyTop === this.renderState.stickyTop && stickyBottom === this.renderState.stickyBottom) return;\n\t\tthis.applyStickyPositioning(stickyBounds);\n\t}\n\thandleScroll = () => {\n\t\tif (CodeView.__STOP) return;\n\t\tthis.suspendScrollInteractions();\n\t\tthis.scrollDirty = true;\n\t\tthis.notifyScroll();\n\t\tthis.render();\n\t};\n\tclearPendingScroll = () => {\n\t\tthis.pendingScrollTarget = void 0;\n\t\tthis.pendingLayoutAnchor = void 0;\n\t\tthis.scrollAnimation = void 0;\n\t};\n\thandleResize = (entries) => {\n\t\tfor (const entry of entries) if (entry.target === this.stickyContainer) {\n\t\t\tif (entry.borderBoxSize[0].blockSize !== this.renderState.stickyHeight) {\n\t\t\t\tconst currentScrollTop = this.getScrollTop();\n\t\t\t\tconst anchor = this.getScrollAnchor(currentScrollTop);\n\t\t\t\tthis.reconcileRenderedItems();\n\t\t\t\tthis.updateStickyPositioning();\n\t\t\t\tconst anchoredScrollTop = anchor != null ? this.resolveAnchoredScrollTop(anchor) : void 0;\n\t\t\t\tif (anchoredScrollTop != null) {\n\t\t\t\t\tconst resizeAnchorDelta = anchoredScrollTop - currentScrollTop;\n\t\t\t\t\tthis.applyScrollFix(anchoredScrollTop, currentScrollTop, this.windowSpecs);\n\t\t\t\t\tif (this.scrollAnimation != null) this.scrollAnimation.position += resizeAnchorDelta;\n\t\t\t\t}\n\t\t\t\tif (this.pendingScrollTarget != null && this.isPendingTargetSettled(this.pendingScrollTarget)) {\n\t\t\t\t\tthis.pendingScrollTarget = void 0;\n\t\t\t\t\tthis.scrollAnimation = void 0;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis.scrollDirty = true;\n\t\t\tthis.heightDirty = true;\n\t\t\tthis.render();\n\t\t}\n\t};\n\t/**\n\t* Figure out scrollTop accounting for sticky header if enabled and\n\t* necessary\n\t*/\n\tgetScrollAnchorViewportTop(absoluteItemTop, scrollTop) {\n\t\treturn absoluteItemTop < scrollTop ? scrollTop + this.getStickyHeaderOffset() : scrollTop;\n\t}\n\t/**\n\t* Attempt to find a scroll anchor based on build in metrics of the existing\n\t* rendered files/diff.\n\t*\n\t* A scroll anchor represents the first fully visible element (in other\n\t* words, the first file or first line who's top is fully in the viewport).\n\t*/\n\tgetScrollAnchor(scrollTop) {\n\t\tif (this.pendingLayoutAnchor != null) return this.pendingLayoutAnchor;\n\t\tconst { firstIndex, lastIndex, stickyTop, stickyBottom } = this.renderState;\n\t\tif (firstIndex === -1 || lastIndex === -1) return;\n\t\tconst viewportHeight = this.getHeight();\n\t\tif (stickyTop === -1 || stickyBottom === -1) return;\n\t\tfor (let index = firstIndex; index <= lastIndex; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) continue;\n\t\t\tconst absoluteItemTop = this.getLayout().paddingTop + item.top;\n\t\t\tif (absoluteItemTop + item.height <= scrollTop) continue;\n\t\t\tif (absoluteItemTop >= scrollTop + viewportHeight) break;\n\t\t\tif (absoluteItemTop >= scrollTop) return {\n\t\t\t\ttype: \"item\",\n\t\t\t\tid: item.item.id,\n\t\t\t\tviewportOffset: absoluteItemTop - scrollTop\n\t\t\t};\n\t\t\tconst localViewportTop = this.getScrollAnchorViewportTop(absoluteItemTop, scrollTop) - absoluteItemTop;\n\t\t\tconst lineAnchor = item.instance.getNumericScrollAnchor(localViewportTop);\n\t\t\tif (lineAnchor != null) {\n\t\t\t\tconst absoluteLineTop = absoluteItemTop + lineAnchor.top;\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"line\",\n\t\t\t\t\tid: item.item.id,\n\t\t\t\t\tlineNumber: lineAnchor.lineNumber,\n\t\t\t\t\tside: lineAnchor.side,\n\t\t\t\t\tviewportOffset: absoluteLineTop - scrollTop\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Given a scroll anchor, attempt to resolve a newly updated (and clamped)\n\t* scroll position to keep the anchored element in place.\n\t*\n\t* If we can't resolve a position for whatever reason, we'll return\n\t* undefined.\n\t*/\n\tresolveAnchoredScrollTop(anchor) {\n\t\tconst item = this.idToItem.get(anchor.id);\n\t\tif (item == null) return;\n\t\tconst { paddingTop } = this.getLayout();\n\t\tif (anchor.type === \"item\") {\n\t\t\tconst absoluteItemTop = paddingTop + item.top;\n\t\t\treturn this.clampScrollTop(absoluteItemTop - anchor.viewportOffset);\n\t\t}\n\t\tconst linePosition = item.type === \"diff\" ? item.instance.getLinePosition(anchor.lineNumber, anchor.side) : item.instance.getLinePosition(anchor.lineNumber);\n\t\tif (linePosition == null) return;\n\t\tconst absoluteLineTop = paddingTop + item.top + linePosition.top;\n\t\treturn this.clampScrollTop(absoluteLineTop - anchor.viewportOffset);\n\t}\n\t/**\n\t* Apply a device-pixel-rounded scroll position if it differs from the last\n\t* logical scrollTop synchronized into the paged scroll scaffold.\n\t*/\n\tapplyScrollFix(targetScrollTop, syncedScrollTop, windowSpecs) {\n\t\tif (this.root == null) return;\n\t\tconst roundedTargetScrollTop = roundToDevicePixel(this.clampScrollTop(targetScrollTop));\n\t\tconst roundedSyncedScrollTop = roundToDevicePixel(syncedScrollTop);\n\t\tconst { scrollPageOffset: previousPageOffset } = this;\n\t\tconst syncedPagedScrollTop = roundToDevicePixel(this.clampPagedScrollTop(roundedSyncedScrollTop - previousPageOffset));\n\t\tconst { pagedScrollTop, scrollPageOffset } = this.resolvePagedScrollPosition(roundedTargetScrollTop);\n\t\tconst targetPagedScrollTop = pagedScrollTop;\n\t\tconst rebaseChanged = previousPageOffset !== scrollPageOffset;\n\t\tif (roundedTargetScrollTop === this.renderState.scrollTop && roundedTargetScrollTop === roundedSyncedScrollTop && targetPagedScrollTop === syncedPagedScrollTop && !rebaseChanged) return;\n\t\tthis.suspendScrollInteractions();\n\t\tif (targetPagedScrollTop !== syncedPagedScrollTop || rebaseChanged) {\n\t\t\tthis.scrollPageOffset = scrollPageOffset;\n\t\t\tthis.syncPagedScrollScaffolding(windowSpecs);\n\t\t}\n\t\tif (targetPagedScrollTop !== syncedPagedScrollTop) this.root.scrollTo({\n\t\t\ttop: targetPagedScrollTop,\n\t\t\tbehavior: \"instant\"\n\t\t});\n\t\tthis.renderState.scrollTop = roundedTargetScrollTop;\n\t\tthis.scrollTop = roundedTargetScrollTop;\n\t\tthis.scrollDirty = false;\n\t}\n\t/**\n\t* Decide whether a pending programmatic scroll has reached its\n\t* destination and should be cleared.\n\t*/\n\tisPendingTargetSettled(target) {\n\t\tconst top = this.resolveScrollTargetTop(target);\n\t\tif (top == null) return true;\n\t\treturn roundToDevicePixel(this.getScrollTop()) === roundToDevicePixel(top);\n\t}\n\tgetScrollTop() {\n\t\tif (!this.scrollDirty) return this.scrollTop;\n\t\tthis.scrollDirty = false;\n\t\tconst rootScrollTop = this.root?.scrollTop ?? 0;\n\t\tthis.scrollTop = this.clampScrollTop(rootScrollTop + this.scrollPageOffset);\n\t\treturn this.scrollTop;\n\t}\n\tgetHeight() {\n\t\tif (!this.heightDirty) return this.height;\n\t\tthis.heightDirty = false;\n\t\tthis.height = this.root?.getBoundingClientRect().height ?? 0;\n\t\treturn this.height;\n\t}\n\tgetScrollHeight() {\n\t\treturn this.scrollHeight;\n\t}\n\tflushSlotCoordinator() {\n\t\tif (this.slotCoordinator == null) return;\n\t\tconst { onSnapshotChange } = this.slotCoordinator;\n\t\tconst slotSnapshot = getSlotSnapshot(this.getRenderedItems(), this.slotCoordinator);\n\t\tif (areSlotSnapshotsEqual(this.slotSnapshot, slotSnapshot)) return;\n\t\tthis.slotSnapshot = slotSnapshot;\n\t\tonSnapshotChange(slotSnapshot);\n\t}\n\tnotifyScroll() {\n\t\tif (this.scrollListeners.size === 0) return;\n\t\tconst scrollTop = this.getScrollTop();\n\t\tfor (const listener of this.scrollListeners) listener(scrollTop, this);\n\t}\n\t/**\n\t* Find the first item whose bottom edge crosses into the viewport window.\n\t* This lets scroll-time rendering jump directly near the visible range instead\n\t* of linearly scanning from the start of very large item lists.\n\t*/\n\tfindFirstVisibleIndex(top) {\n\t\tlet low = 0;\n\t\tlet high = this.items.length - 1;\n\t\tlet result = this.items.length;\n\t\twhile (low <= high) {\n\t\t\tconst mid = low + high >> 1;\n\t\t\tconst item = this.items[mid];\n\t\t\tif (item == null) throw new Error(\"CodeView.findFirstVisibleIndex: invalid item index\");\n\t\t\tif (item.top + item.height > top) {\n\t\t\t\tresult = mid;\n\t\t\t\thigh = mid - 1;\n\t\t\t} else low = mid + 1;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Find the last item whose top edge is still within the viewport window.\n\t* Paired with findFirstVisibleIndex, this bounds the render loop to only the\n\t* slice of items that can actually intersect the current scroll range.\n\t*/\n\tfindLastVisibleIndex(bottom) {\n\t\tlet low = 0;\n\t\tlet high = this.items.length - 1;\n\t\tlet result = -1;\n\t\twhile (low <= high) {\n\t\t\tconst mid = low + high >> 1;\n\t\t\tconst item = this.items[mid];\n\t\t\tif (item == null) throw new Error(\"CodeView.findLastVisibleIndex: invalid item index\");\n\t\t\tif (item.top <= bottom) {\n\t\t\t\tresult = mid;\n\t\t\t\tlow = mid + 1;\n\t\t\t} else high = mid - 1;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Recompute measured tops and heights starting from the earliest dirty item.\n\t* Earlier items keep their existing layout, while everything from startIndex\n\t* onward is remeasured so downstream positions and total scroll height stay\n\t* consistent after inserts, removals, or versioned item updates.\n\t*/\n\trecomputeLayout(startIndex = 0, reset) {\n\t\tif (this.items.length === 0) {\n\t\t\tthis.scrollHeight = 0;\n\t\t\treturn;\n\t\t}\n\t\tconst layout = this.getLayout();\n\t\tlet runningTop = 0;\n\t\tif (startIndex > 0) {\n\t\t\tconst previousItem = this.items[startIndex - 1];\n\t\t\tif (previousItem == null) throw new Error(\"CodeView.recomputeLayout: invalid dirty index\");\n\t\t\trunningTop = previousItem.top + previousItem.height + layout.gap;\n\t\t}\n\t\tfor (let index = startIndex; index < this.items.length; index++) {\n\t\t\tconst item = this.items[index];\n\t\t\tif (item == null) throw new Error(\"CodeView.recomputeLayout: invalid item index\");\n\t\t\titem.top = runningTop;\n\t\t\tif (item.type === \"diff\") item.height = item.instance.prepareCodeViewItem(item.item.fileDiff, runningTop, reset, item.item.annotations ?? []);\n\t\t\telse item.height = item.instance.prepareCodeViewItem(item.item.file, runningTop, reset, item.item.annotations ?? []);\n\t\t\trunningTop += item.height;\n\t\t\tif (index < this.items.length - 1) runningTop += layout.gap;\n\t\t}\n\t\tif (runningTop !== this.scrollHeight) this.scrollDirty = true;\n\t\tthis.scrollHeight = runningTop;\n\t}\n\tresetRenderState() {\n\t\tthis.renderState.scrollTop = -1;\n\t\tthis.renderState.firstIndex = -1;\n\t\tthis.renderState.lastIndex = -1;\n\t\tthis.renderState.stickyHeight = 0;\n\t\tthis.renderState.stickyTop = -1;\n\t\tthis.renderState.stickyBottom = -1;\n\t}\n\tgetFitPerfectlyOverscroll() {\n\t\treturn this.getLayout().gap + this.itemMetricsCache.diffHeaderHeight;\n\t}\n};\nfunction prepareItemInstance(item) {\n\titem.instance.cleanUp(true);\n\tif (item.type === \"diff\") return item.instance.prepareCodeViewItem(item.item.fileDiff, item.top, void 0, item.item.annotations ?? []);\n\telse return item.instance.prepareCodeViewItem(item.item.file, item.top, void 0, item.item.annotations ?? []);\n}\nfunction shouldClearPool(previousOptions, nextOptions) {\n\treturn !areThemesEqual(previousOptions.theme ?? DEFAULT_THEMES, nextOptions.theme ?? DEFAULT_THEMES) || (previousOptions.themeType ?? \"system\") !== (nextOptions.themeType ?? \"system\") || previousOptions.unsafeCSS !== nextOptions.unsafeCSS;\n}\nfunction hasItemLayoutOptionChanged(previousOptions, nextOptions) {\n\treturn (previousOptions.overflow ?? \"scroll\") !== (nextOptions.overflow ?? \"scroll\") || (previousOptions.disableLineNumbers ?? false) !== (nextOptions.disableLineNumbers ?? false) || (previousOptions.disableFileHeader ?? false) !== (nextOptions.disableFileHeader ?? false) || previousOptions.unsafeCSS !== nextOptions.unsafeCSS || (previousOptions.diffStyle ?? \"split\") !== (nextOptions.diffStyle ?? \"split\") || (previousOptions.diffIndicators ?? \"bars\") !== (nextOptions.diffIndicators ?? \"bars\") || (previousOptions.hunkSeparators ?? \"line-info\") !== (nextOptions.hunkSeparators ?? \"line-info\") || (previousOptions.expandUnchanged ?? false) !== (nextOptions.expandUnchanged ?? false) || (previousOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD) !== (nextOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD);\n}\nfunction hasCodeViewDiffEstimateOptionChanged(previousOptions, nextOptions) {\n\treturn (previousOptions.disableFileHeader ?? false) !== (nextOptions.disableFileHeader ?? false) || (previousOptions.hunkSeparators ?? \"line-info\") !== (nextOptions.hunkSeparators ?? \"line-info\") || (previousOptions.expandUnchanged ?? false) !== (nextOptions.expandUnchanged ?? false) || (previousOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD) !== (nextOptions.collapsedContextThreshold ?? DEFAULT_COLLAPSED_CONTEXT_THRESHOLD);\n}\nfunction isPooledShadowChild(child) {\n\tif (child instanceof SVGElement) return true;\n\treturn isStyleNode(child) && (child.hasAttribute(CORE_CSS_ATTRIBUTE) || child.hasAttribute(THEME_CSS_ATTRIBUTE) || child.hasAttribute(UNSAFE_CSS_ATTRIBUTE));\n}\nfunction formatSelectedLineRange(range) {\n\tconst start = formatSelectedLinePoint(range.start, range.side);\n\tconst end = formatSelectedLinePoint(range.end, range.endSide ?? range.side);\n\treturn start === end ? start : `${start}-${end}`;\n}\nfunction formatSelectedLinePoint(lineNumber, side) {\n\tif (side == null) return `${lineNumber}`;\n\treturn `${side === \"deletions\" ? \"D\" : \"A\"}${lineNumber}`;\n}\nfunction renderItem(item, fileContainer, forceRender = false) {\n\tif (item.type === \"diff\") return item.instance.render({\n\t\tdeferManagers: true,\n\t\tfileContainer,\n\t\tfileDiff: item.item.fileDiff,\n\t\tforceRender,\n\t\tlineAnnotations: item.item.annotations ?? []\n\t});\n\telse return item.instance.render({\n\t\tdeferManagers: true,\n\t\tfileContainer,\n\t\tfile: item.item.file,\n\t\tforceRender,\n\t\tlineAnnotations: item.item.annotations ?? []\n\t});\n}\n/**\n* Keep the rendered DOM order aligned with the current record order even when\n* we reuse existing elements. Reused items may already be mounted elsewhere in\n* the sticky container, so this moves them into the correct sibling position\n* before rendering updates.\n*/\nfunction syncRenderedItemOrder(container, element, prevElement) {\n\tif (prevElement == null) {\n\t\tif (container.firstChild !== element) container.prepend(element);\n\t\treturn;\n\t}\n\tif (prevElement.nextSibling !== element) prevElement.after(element);\n}\nfunction hasAnnotations(item) {\n\treturn (item.annotations?.length ?? 0) > 0;\n}\nfunction getSlotSnapshot(renderedItems, { hasHeaderRenderers, hasAnnotationRenderer, hasGutterRenderer }) {\n\tif (renderedItems.length === 0) return;\n\tif (hasHeaderRenderers || hasGutterRenderer) return renderedItems;\n\tif (!hasAnnotationRenderer) return;\n\tconst slotSnapshot = [];\n\tfor (const renderedItem of renderedItems) if (hasAnnotations(renderedItem.item)) slotSnapshot.push(renderedItem);\n\treturn slotSnapshot.length > 0 ? slotSnapshot : void 0;\n}\nfunction areSlotSnapshotsEqual(previous, next) {\n\tif (previous == null || next == null) return previous === next;\n\tif (previous.length !== next.length) return false;\n\tfor (let index = 0; index < previous.length; index++) {\n\t\tconst previousItem = previous[index];\n\t\tconst nextItem = next[index];\n\t\tif (previousItem == null || nextItem == null || previousItem.id !== nextItem.id || previousItem.type !== nextItem.type || previousItem.element !== nextItem.element || previousItem.version !== nextItem.version) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\nexport { CodeView };\n//# sourceMappingURL=CodeView.js.map","//#region src/utils/areManagedSnapshotsEqual.ts\nfunction areManagedSnapshotsEqual(previous, next) {\n\tif (previous == null || next == null) return previous === next;\n\tif (previous.length !== next.length) return false;\n\tfor (let index = 0; index < previous.length; index++) {\n\t\tconst previousItem = previous[index];\n\t\tconst nextItem = next[index];\n\t\tif (previousItem == null || nextItem == null || previousItem.id !== nextItem.id || previousItem.type !== nextItem.type || previousItem.element !== nextItem.element || previousItem.version !== nextItem.version) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\nexport { areManagedSnapshotsEqual };\n//# sourceMappingURL=areManagedSnapshotsEqual.js.map","'use client';\n\n\nimport { areOptionsEqual } from \"../utils/areOptionsEqual.js\";\nimport { CodeView as CodeView$1 } from \"../components/CodeView.js\";\nimport { areManagedSnapshotsEqual } from \"../utils/areManagedSnapshotsEqual.js\";\nimport { renderDiffChildren } from \"./utils/renderDiffChildren.js\";\nimport { renderFileChildren } from \"./utils/renderFileChildren.js\";\nimport { useStableCallback } from \"./utils/useStableCallback.js\";\nimport { WorkerPoolContext } from \"./WorkerPoolContext.js\";\nimport { forwardRef, memo, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from \"react\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { createPortal, flushSync } from \"react-dom\";\n\n//#region src/react/CodeView.tsx\nconst useIsometricEffect = typeof window === \"undefined\" ? useEffect : useLayoutEffect;\nfunction createDefaultCache(controlled) {\n\treturn {\n\t\tinstance: void 0,\n\t\titems: void 0,\n\t\tcontrolled,\n\t\tmanagedOptions: void 0,\n\t\tdisableFlushSync: false,\n\t\tslotCoordinator: void 0\n\t};\n}\nfunction CodeViewInner(props, ref) {\n\tconst { className, containerRef, disableWorkerPool = false, initialItems, items: controlledItems, onScroll, onSelectedLinesChange, options, renderAnnotation, renderCustomHeader, renderGutterUtility, renderHeaderMetadata, renderHeaderPrefix, selectedLines, style } = props;\n\tconst controlled = controlledItems !== void 0;\n\tconst poolManager = useContext(WorkerPoolContext);\n\tconst cachedDataRef = useRef(createDefaultCache(controlled));\n\tconst hasCustomHeader = renderCustomHeader != null;\n\tconst hasAnnotationRenderer = renderAnnotation != null;\n\tconst hasGutterRenderer = renderGutterUtility != null;\n\tconst hasHeaderRenderers = hasCustomHeader || renderHeaderPrefix != null || renderHeaderMetadata != null;\n\tconst hasRenderers = hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n\tconst emitSelectedLinesChange = useStableCallback((selection) => {\n\t\tonSelectedLinesChange?.(selection);\n\t});\n\tconst controlledSelection = selectedLines !== void 0;\n\tconst managedOptions = useMemo(() => createManagedCodeViewOptions({\n\t\toptions,\n\t\thasCustomHeader,\n\t\thasGutterRenderer,\n\t\tonSelectedLinesChange: onSelectedLinesChange != null ? emitSelectedLinesChange : void 0,\n\t\tcontrolledSelection\n\t}), [\n\t\toptions,\n\t\thasCustomHeader,\n\t\thasGutterRenderer,\n\t\tonSelectedLinesChange,\n\t\temitSelectedLinesChange,\n\t\tcontrolledSelection\n\t]);\n\tconst [slotContentStore] = useState(() => createSlotContentStore());\n\tconst [, forceUpdate] = useState({});\n\tconst nodeRef = useStableCallback((node) => {\n\t\tif (cachedDataRef.current.instance != null && (node == null || node !== cachedDataRef.current.instance.getContainerElement())) {\n\t\t\tcachedDataRef.current.instance.cleanUp();\n\t\t\tslotContentStore.publish(void 0);\n\t\t\tcachedDataRef.current = createDefaultCache(controlled);\n\t\t}\n\t\tif (node != null && node !== cachedDataRef.current.instance?.getContainerElement()) {\n\t\t\tcachedDataRef.current.instance = new CodeView$1(managedOptions, !disableWorkerPool ? poolManager : void 0, true);\n\t\t\tcachedDataRef.current.instance.setup(node);\n\t\t}\n\t\tif (typeof containerRef === \"function\") containerRef(node);\n\t\telse if (containerRef != null) containerRef.current = node;\n\t});\n\tconst onSnapshotChange = useStableCallback((snapshot) => {\n\t\tif (cachedDataRef.current.disableFlushSync) slotContentStore.publish(snapshot);\n\t\telse flushSync(() => {\n\t\t\tslotContentStore.publish(snapshot);\n\t\t});\n\t});\n\tconst slotCoordinator = useMemo(() => {\n\t\tif (!hasHeaderRenderers && !hasAnnotationRenderer && !hasGutterRenderer) return;\n\t\telse return {\n\t\t\thasHeaderRenderers,\n\t\t\thasAnnotationRenderer,\n\t\t\thasGutterRenderer,\n\t\t\tonSnapshotChange\n\t\t};\n\t}, [\n\t\tonSnapshotChange,\n\t\thasAnnotationRenderer,\n\t\thasGutterRenderer,\n\t\thasHeaderRenderers\n\t]);\n\tuseIsometricEffect(() => {\n\t\treturn onScroll != null ? cachedDataRef.current.instance?.subscribeToScroll(onScroll) : void 0;\n\t});\n\tuseIsometricEffect(() => {\n\t\tconst { instance, controlled: prevControlled, items: prevItems, managedOptions: prevManagedOptions, slotCoordinator: prevSlotCoordinator } = cachedDataRef.current;\n\t\tif (instance == null) return;\n\t\ttry {\n\t\t\tcachedDataRef.current.disableFlushSync = true;\n\t\t\tlet shouldRender = false;\n\t\t\tif (!areOptionsEqual(managedOptions, prevManagedOptions)) {\n\t\t\t\tcachedDataRef.current.managedOptions = managedOptions;\n\t\t\t\tinstance.setOptions(managedOptions);\n\t\t\t\tshouldRender = true;\n\t\t\t}\n\t\t\tif (prevControlled !== controlled) {\n\t\t\t\tconsole.error(\"CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (controlled) {\n\t\t\t\tif (controlledItems !== prevItems) if (areItemListsEqual(prevItems, controlledItems)) cachedDataRef.current.items = controlledItems;\n\t\t\t\telse if (isAppendOnlyItemUpdate(prevItems, controlledItems)) {\n\t\t\t\t\tcachedDataRef.current.items = controlledItems;\n\t\t\t\t\tinstance.addItems(controlledItems.slice(prevItems.length));\n\t\t\t\t} else {\n\t\t\t\t\tcachedDataRef.current.items = controlledItems;\n\t\t\t\t\tinstance.setItems(controlledItems);\n\t\t\t\t\tshouldRender = true;\n\t\t\t\t}\n\t\t\t} else if (prevItems == null) {\n\t\t\t\tconst seedItems = initialItems ?? [];\n\t\t\t\tcachedDataRef.current.items = seedItems;\n\t\t\t\tif (seedItems.length > 0) {\n\t\t\t\t\tinstance.setItems(seedItems);\n\t\t\t\t\tshouldRender = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (selectedLines !== void 0) instance.setSelectedLines(selectedLines, { notify: false });\n\t\t\tconst slotPublish = instance.setSlotCoordinator(slotCoordinator);\n\t\t\tlet forceInlinePublish = false;\n\t\t\tif (slotCoordinator !== prevSlotCoordinator) {\n\t\t\t\tif (slotCoordinator == null || prevSlotCoordinator == null) forceInlinePublish = true;\n\t\t\t\tcachedDataRef.current.slotCoordinator = slotCoordinator;\n\t\t\t}\n\t\t\tif (shouldRender || slotPublish) instance.render(true);\n\t\t\tif (slotPublish && slotCoordinator == null) slotContentStore.publish(void 0);\n\t\t\tif (forceInlinePublish) forceUpdate({});\n\t\t} finally {\n\t\t\tcachedDataRef.current.disableFlushSync = false;\n\t\t}\n\t});\n\tuseImperativeHandle(ref, () => ({\n\t\taddItems(items) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"addItems\");\n\t\t\tif (instance == null) console.error(\"CodeView.addItems: no valid instance to append items with\", items);\n\t\t\telse instance.addItems(items);\n\t\t},\n\t\tgetItem(id) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.getItem: no valid instance exists\", id);\n\t\t\t\treturn;\n\t\t\t} else return instance.getItem(id);\n\t\t},\n\t\tupdateItem(item) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"updateItem\");\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.updateItem: no valid instance to update item with\", item);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn instance.updateItem(item);\n\t\t},\n\t\tupdateItemId(oldId, newId) {\n\t\t\tconst { controlled: controlled$1, instance } = cachedDataRef.current;\n\t\t\tassertUncontrolledCodeViewAction(controlled$1, \"updateItemId\");\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.updateItemId: no valid instance to update item id with\", oldId, newId);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn instance.updateItemId(oldId, newId);\n\t\t},\n\t\tscrollTo(target) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.scrollTo: no valid instance to scroll with\", target);\n\t\t\telse instance.scrollTo(target);\n\t\t},\n\t\tsetSelectedLines(selection) {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.setSelectedLines: no valid instance to update selection with\", selection);\n\t\t\telse {\n\t\t\t\tinstance.setSelectedLines(selection, { notify: false });\n\t\t\t\temitSelectedLinesChange(selection);\n\t\t\t}\n\t\t},\n\t\tgetSelectedLines() {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) {\n\t\t\t\tconsole.error(\"CodeView.getSelectedLines: no valid instance exists\");\n\t\t\t\treturn null;\n\t\t\t} else return instance.getSelectedLines();\n\t\t},\n\t\tclearSelectedLines() {\n\t\t\tconst { instance } = cachedDataRef.current;\n\t\t\tif (instance == null) console.error(\"CodeView.clearSelectedLines: no valid instance to update selection with\");\n\t\t\telse {\n\t\t\t\tinstance.clearSelectedLines({ notify: false });\n\t\t\t\temitSelectedLinesChange(null);\n\t\t\t}\n\t\t},\n\t\tgetInstance() {\n\t\t\treturn cachedDataRef.current.instance;\n\t\t}\n\t}), [emitSelectedLinesChange]);\n\treturn /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(\"div\", {\n\t\tref: nodeRef,\n\t\tclassName,\n\t\tstyle\n\t}), hasRenderers && /* @__PURE__ */ jsx(SlotPortals, {\n\t\tmanagedContentStore: slotContentStore,\n\t\trenderCustomHeader,\n\t\trenderHeaderPrefix,\n\t\trenderHeaderMetadata,\n\t\trenderAnnotation,\n\t\trenderGutterUtility\n\t})] });\n}\nconst CodeView = forwardRef(CodeViewInner);\nfunction isAppendOnlyItemUpdate(previousItems, nextItems) {\n\tif (previousItems == null || nextItems.length <= previousItems.length) return false;\n\tif (previousItems.length === 0) return true;\n\tfor (let index = 0; index < previousItems.length; index++) if (nextItems[index] !== previousItems[index]) return false;\n\treturn true;\n}\nfunction areItemListsEqual(previousItems, nextItems) {\n\tif (previousItems == null || previousItems.length !== nextItems.length) return false;\n\tfor (let index = 0; index < previousItems.length; index++) if (previousItems[index] !== nextItems[index]) return false;\n\treturn true;\n}\nfunction assertUncontrolledCodeViewAction(controlled, action) {\n\tif (!controlled) return;\n\tthrow new Error(`CodeView.${action} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`);\n}\nfunction createSlotContentStore() {\n\tlet snapshot;\n\tconst listeners = /* @__PURE__ */ new Set();\n\treturn {\n\t\tgetSnapshot() {\n\t\t\treturn snapshot;\n\t\t},\n\t\tpublish(nextSnapshot) {\n\t\t\tif (areManagedSnapshotsEqual(snapshot, nextSnapshot)) return;\n\t\t\tsnapshot = nextSnapshot;\n\t\t\tfor (const listener of listeners) listener();\n\t\t},\n\t\tsubscribe(listener) {\n\t\t\tlisteners.add(listener);\n\t\t\treturn () => {\n\t\t\t\tlisteners.delete(listener);\n\t\t\t};\n\t\t}\n\t};\n}\nfunction createManagedCodeViewOptions({ options, hasCustomHeader, hasGutterRenderer, onSelectedLinesChange, controlledSelection }) {\n\tif (!hasCustomHeader && !hasGutterRenderer && onSelectedLinesChange == null && !controlledSelection) return options;\n\toptions = {\n\t\t...options,\n\t\tcontrolledSelection,\n\t\tonSelectedLinesChange\n\t};\n\tif (hasCustomHeader) options.renderCustomHeader = noopRender;\n\tif (hasGutterRenderer) options.renderGutterUtility = noopRender;\n\treturn options;\n}\nconst SlotPortals = memo(function SlotPortals$1({ managedContentStore, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {\n\tconst subscribe = useStableCallback((listener) => managedContentStore.subscribe(listener));\n\tconst getSnapshot = useStableCallback(() => managedContentStore.getSnapshot());\n\treturn useSyncExternalStore(subscribe, getSnapshot, getSnapshot)?.map((renderedItem) => {\n\t\treturn createPortal(renderCodeViewItemChildren({\n\t\t\trenderedItem,\n\t\t\trenderCustomHeader,\n\t\t\trenderHeaderPrefix,\n\t\t\trenderHeaderMetadata,\n\t\t\trenderAnnotation,\n\t\t\trenderGutterUtility\n\t\t}), renderedItem.element, renderedItem.id);\n\t});\n});\nfunction renderCodeViewItemChildren({ renderedItem, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {\n\tif (renderedItem.type === \"diff\") {\n\t\tconst { item, instance } = renderedItem;\n\t\treturn renderDiffChildren({\n\t\t\tfileDiff: item.fileDiff,\n\t\t\trenderCustomHeader: renderCustomHeader != null ? () => renderCustomHeader(item) : void 0,\n\t\t\trenderHeaderPrefix: renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : void 0,\n\t\t\trenderHeaderMetadata: renderHeaderMetadata != null ? () => renderHeaderMetadata(item) : void 0,\n\t\t\trenderAnnotation: renderAnnotation != null ? (annotation) => renderAnnotation(annotation, item) : void 0,\n\t\t\tlineAnnotations: item.annotations,\n\t\t\trenderGutterUtility: renderGutterUtility != null ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item) : void 0,\n\t\t\tgetHoveredLine: instance.getHoveredLine\n\t\t});\n\t} else {\n\t\tconst { item, instance } = renderedItem;\n\t\treturn renderFileChildren({\n\t\t\tfile: item.file,\n\t\t\trenderCustomHeader: renderCustomHeader != null ? () => renderCustomHeader(item) : void 0,\n\t\t\trenderHeaderPrefix: renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : void 0,\n\t\t\trenderHeaderMetadata: renderHeaderMetadata != null ? () => renderHeaderMetadata(item) : void 0,\n\t\t\trenderAnnotation: renderAnnotation != null ? (annotation) => renderAnnotation(annotation, item) : void 0,\n\t\t\tlineAnnotations: item.annotations,\n\t\t\trenderGutterUtility: renderGutterUtility != null ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item) : void 0,\n\t\t\tgetHoveredLine: instance.getHoveredLine\n\t\t});\n\t}\n}\nfunction noopRender() {}\n\n//#endregion\nexport { CodeView };\n//# sourceMappingURL=CodeView.js.map","import type { ScopedThreadRef } from \"@t3tools/contracts\";\n\nimport { useRightPanelStore } from \"./rightPanelStore\";\nimport { resolvePathLinkTarget } from \"./terminal-links\";\n\ninterface OpenDiffFilePrimaryActionInput {\n readonly threadRef: ScopedThreadRef | null;\n readonly filePath: string;\n readonly activeCwd: string | undefined;\n readonly openInEditor: (targetPath: string) => void;\n}\n\nexport function openDiffFilePrimaryAction({\n threadRef,\n filePath,\n activeCwd,\n openInEditor,\n}: OpenDiffFilePrimaryActionInput): void {\n if (threadRef) {\n useRightPanelStore.getState().openFile(threadRef, filePath);\n return;\n }\n\n openInEditor(activeCwd ? resolvePathLinkTarget(filePath, activeCwd) : filePath);\n}\n","import {\n type CheckpointDiffState,\n type CheckpointDiffTarget,\n} from \"@t3tools/client-runtime/state/threads\";\n\nimport { useCheckpointDiff as useCheckpointDiffQuery } from \"../state/queries\";\n\nexport function useCheckpointDiff(\n target: CheckpointDiffTarget,\n options?: { readonly enabled?: boolean },\n): CheckpointDiffState {\n const state = useCheckpointDiffQuery(target, options);\n return {\n data: state.data,\n error: state.error,\n isPending: state.isPending,\n };\n}\n","export function areAllDiffFilesCollapsed(\n fileKeys: ReadonlyArray<string>,\n collapsedFileKeys: ReadonlySet<string>,\n): boolean {\n return fileKeys.length > 0 && fileKeys.every((fileKey) => collapsedFileKeys.has(fileKey));\n}\n\nexport function toggleAllDiffFiles(\n fileKeys: ReadonlyArray<string>,\n collapsedFileKeys: ReadonlySet<string>,\n): ReadonlySet<string> {\n return areAllDiffFilesCollapsed(fileKeys, collapsedFileKeys) ? new Set() : new Set(fileKeys);\n}\n","import type { ReactNode } from \"react\";\n\nimport { cn } from \"~/lib/utils\";\n\nimport { Skeleton } from \"./ui/skeleton\";\n\nexport type DiffPanelMode = \"inline\" | \"sheet\" | \"sidebar\" | \"embedded\";\n\nfunction getDiffPanelHeaderRowClassName() {\n return cn(\"flex items-center justify-between gap-2 px-4\", \"surface-subheader\");\n}\n\nexport function DiffPanelShell(props: {\n mode: DiffPanelMode;\n header: ReactNode;\n children: ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"flex h-full min-w-0 flex-col bg-background\",\n props.mode === \"inline\"\n ? \"w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border\"\n : \"w-full\",\n )}\n >\n <div className={getDiffPanelHeaderRowClassName()} data-surface-subheader>\n {props.header}\n </div>\n {props.children}\n </div>\n );\n}\n\nexport function DiffPanelHeaderSkeleton() {\n return (\n <>\n <div className=\"min-w-0 flex-1\">\n <Skeleton className=\"h-8 w-32 rounded-lg\" />\n </div>\n <div className=\"flex shrink-0 gap-1\">\n <Skeleton className=\"size-7 rounded-md\" />\n <Skeleton className=\"size-7 rounded-md\" />\n </div>\n </>\n );\n}\n\nexport function DiffPanelLoadingState(props: { label: string }) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col p-2\">\n <div\n className=\"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border/60 bg-card/25\"\n role=\"status\"\n aria-live=\"polite\"\n aria-label={props.label}\n >\n <div className=\"flex items-center gap-2 border-b border-border/50 px-3 py-2\">\n <Skeleton className=\"h-4 w-32 rounded-full\" />\n <Skeleton className=\"ml-auto h-4 w-20 rounded-full\" />\n </div>\n <div className=\"flex min-h-0 flex-1 flex-col gap-4 px-3 py-4\">\n <div className=\"space-y-2\">\n <Skeleton className=\"h-3 w-full rounded-full\" />\n <Skeleton className=\"h-3 w-full rounded-full\" />\n <Skeleton className=\"h-3 w-10/12 rounded-full\" />\n <Skeleton className=\"h-3 w-11/12 rounded-full\" />\n <Skeleton className=\"h-3 w-9/12 rounded-full\" />\n </div>\n <span className=\"sr-only\">{props.label}</span>\n </div>\n </div>\n </div>\n );\n}\n","import type {\n AnnotationSide,\n CodeViewDiffItem,\n CodeViewItem,\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n} from \"@pierre/diffs\";\nimport { CodeView, type CodeViewHandle, type CodeViewProps } from \"@pierre/diffs/react\";\nimport type { ScopedThreadRef } from \"@t3tools/contracts\";\nimport { useCallback, useMemo, useState, type ReactNode, type Ref } from \"react\";\n\nimport { type DraftId, useComposerDraftStore } from \"~/composerDraftStore\";\nimport { fnv1a32 } from \"~/lib/diffRendering\";\nimport {\n buildDiffReviewComment,\n restoreDiffReviewCommentRange,\n type ReviewCommentContext,\n} from \"~/reviewCommentContext\";\n\nimport { LocalCommentAnnotation } from \"../files/LocalCommentAnnotation\";\nimport { nextFileCommentId } from \"../files/fileCommentAnnotations\";\n\ninterface DiffCommentAnnotationEntry {\n id: string;\n kind: \"draft\" | \"comment\";\n range: SelectedLineRange;\n rangeLabel: string;\n text: string;\n}\n\ninterface DiffCommentAnnotationGroup {\n entries: DiffCommentAnnotationEntry[];\n}\n\ntype DiffCommentLineAnnotation = DiffLineAnnotation<DiffCommentAnnotationGroup>;\nexport type AnnotatableCodeViewHandle = CodeViewHandle<DiffCommentAnnotationGroup>;\nconst EMPTY_REVIEW_COMMENTS: ReadonlyArray<ReviewCommentContext> = [];\n\nfunction annotationSide(range: SelectedLineRange): AnnotationSide {\n return (range.endSide ?? range.side) === \"deletions\" ? \"deletions\" : \"additions\";\n}\n\nfunction appendAnnotationEntry(\n annotations: ReadonlyArray<DiffCommentLineAnnotation>,\n range: SelectedLineRange,\n entry: DiffCommentAnnotationEntry,\n): DiffCommentLineAnnotation[] {\n const side = annotationSide(range);\n const annotationIndex = annotations.findIndex(\n (annotation) => annotation.side === side && annotation.lineNumber === range.end,\n );\n if (annotationIndex < 0) {\n return [\n ...annotations,\n {\n side,\n lineNumber: range.end,\n metadata: { entries: [entry] },\n },\n ];\n }\n return annotations.map((annotation, index) =>\n index === annotationIndex\n ? {\n ...annotation,\n metadata: { entries: [...annotation.metadata.entries, entry] },\n }\n : annotation,\n );\n}\n\ninterface AnnotatableCodeViewProps {\n files: ReadonlyArray<{\n fileDiff: FileDiffMetadata;\n filePath: string;\n fileKey: string;\n collapsed: boolean;\n }>;\n sectionId: string;\n sectionTitle: string;\n composerDraftTarget: ScopedThreadRef | DraftId;\n options: NonNullable<CodeViewProps<DiffCommentAnnotationGroup>[\"options\"]>;\n viewerRef?: Ref<AnnotatableCodeViewHandle>;\n className?: string;\n renderHeaderPrefix: (\n fileDiff: FileDiffMetadata,\n fileKey: string,\n collapsed: boolean,\n ) => ReactNode;\n}\n\ninterface DiffSelectionContext {\n item: CodeViewItem<DiffCommentAnnotationGroup>;\n}\n\nexport function AnnotatableCodeView({\n files,\n sectionId,\n sectionTitle,\n composerDraftTarget,\n options,\n viewerRef,\n className,\n renderHeaderPrefix,\n}: AnnotatableCodeViewProps) {\n const addReviewComment = useComposerDraftStore((store) => store.addReviewComment);\n const removeReviewComment = useComposerDraftStore((store) => store.removeReviewComment);\n const reviewComments = useComposerDraftStore(\n (store) => store.getComposerDraft(composerDraftTarget)?.reviewComments ?? EMPTY_REVIEW_COMMENTS,\n );\n const [selectedLines, setSelectedLines] = useState<{\n id: string;\n range: SelectedLineRange;\n } | null>(null);\n const [draft, setDraft] = useState<{\n fileKey: string;\n annotation: DiffCommentLineAnnotation;\n } | null>(null);\n\n const filesByKey = useMemo(() => new Map(files.map((file) => [file.fileKey, file])), [files]);\n const items = useMemo<CodeViewDiffItem<DiffCommentAnnotationGroup>[]>(\n () =>\n files.map(({ fileDiff, filePath, fileKey, collapsed }) => {\n const persisted = reviewComments\n .filter(\n (comment) =>\n comment.sectionId === sectionId &&\n comment.filePath === filePath &&\n (comment.fenceLanguage ?? \"diff\") === \"diff\",\n )\n .reduce<DiffCommentLineAnnotation[]>((annotations, comment) => {\n const range = restoreDiffReviewCommentRange(fileDiff, comment);\n if (!range) return annotations;\n return appendAnnotationEntry(annotations, range, {\n id: comment.id,\n kind: \"comment\",\n range,\n rangeLabel: comment.rangeLabel,\n text: comment.text,\n });\n }, []);\n const annotations =\n draft?.fileKey === fileKey ? [...persisted, draft.annotation] : persisted;\n return {\n id: fileKey,\n type: \"diff\",\n fileDiff,\n annotations,\n collapsed,\n version: fnv1a32(\n `${collapsed ? \"1\" : \"0\"}:${annotations\n .flatMap((annotation) =>\n annotation.metadata.entries.map(\n (entry) => `${entry.id}:${entry.rangeLabel}:${entry.text}`,\n ),\n )\n .join(\":\")}`,\n ),\n };\n }),\n [draft, files, reviewComments, sectionId],\n );\n\n const removeEntry = useCallback(\n (entryId: string) => {\n setSelectedLines(null);\n if (draft?.annotation.metadata.entries.some((entry) => entry.id === entryId)) {\n setDraft(null);\n } else {\n removeReviewComment(composerDraftTarget, entryId);\n }\n },\n [composerDraftTarget, draft, removeReviewComment],\n );\n\n const submitEntry = useCallback(\n (entryId: string, text: string) => {\n const entry = draft?.annotation.metadata.entries.find(\n (candidate) => candidate.id === entryId,\n );\n const file = draft ? filesByKey.get(draft.fileKey) : undefined;\n if (!entry || !file) return;\n const comment = buildDiffReviewComment({\n id: entry.id,\n sectionId,\n sectionTitle,\n filePath: file.filePath,\n fileDiff: file.fileDiff,\n range: entry.range,\n text,\n });\n if (comment) addReviewComment(composerDraftTarget, comment);\n setSelectedLines(null);\n setDraft(null);\n },\n [addReviewComment, composerDraftTarget, draft, filesByKey, sectionId, sectionTitle],\n );\n\n const beginComment = useCallback(\n (range: SelectedLineRange | null, context: DiffSelectionContext) => {\n if (!range) return;\n const item = context.item;\n if (item.type !== \"diff\") return;\n const file = filesByKey.get(item.id);\n if (!file) return;\n const id = nextFileCommentId();\n const comment = buildDiffReviewComment({\n id,\n sectionId,\n sectionTitle,\n filePath: file.filePath,\n fileDiff: file.fileDiff,\n range,\n text: \"\",\n });\n if (!comment) return;\n setDraft({\n fileKey: item.id,\n annotation: {\n side: annotationSide(range),\n lineNumber: range.end,\n metadata: {\n entries: [{ id, kind: \"draft\", range, rangeLabel: comment.rangeLabel, text: \"\" }],\n },\n },\n });\n },\n [filesByKey, sectionId, sectionTitle],\n );\n\n const hasOpenComment = draft !== null;\n return (\n <CodeView<DiffCommentAnnotationGroup>\n {...(viewerRef ? { ref: viewerRef } : {})}\n {...(className ? { className } : {})}\n items={items}\n selectedLines={selectedLines}\n onSelectedLinesChange={setSelectedLines}\n options={{\n ...options,\n enableGutterUtility: !hasOpenComment,\n enableLineSelection: !hasOpenComment,\n onLineSelectionEnd: beginComment,\n }}\n renderHeaderPrefix={(item) =>\n item.type === \"diff\"\n ? renderHeaderPrefix(item.fileDiff, item.id, item.collapsed === true)\n : null\n }\n renderAnnotation={(annotation) => (\n <div className=\"py-1\">\n {annotation.metadata.entries.map((entry) => (\n <LocalCommentAnnotation\n key={entry.id}\n kind={entry.kind}\n rangeLabel={entry.rangeLabel}\n text={entry.text}\n onCancel={() => removeEntry(entry.id)}\n onComment={(text) => submitEntry(entry.id, text)}\n onDelete={() => removeEntry(entry.id)}\n />\n ))}\n </div>\n )}\n />\n );\n}\n","export let ToggleGroupDataAttributes = /*#__PURE__*/function (ToggleGroupDataAttributes) {\n /**\n * Present when the toggle group is disabled.\n */\n ToggleGroupDataAttributes[\"disabled\"] = \"data-disabled\";\n /**\n * Indicates the orientation of the toggle group.\n * @type {'horizontal' | 'vertical'}\n */\n ToggleGroupDataAttributes[\"orientation\"] = \"data-orientation\";\n /**\n * Present when the toggle group allows multiple buttons to be in the pressed state at the same time.\n */\n ToggleGroupDataAttributes[\"multiple\"] = \"data-multiple\";\n return ToggleGroupDataAttributes;\n}({});","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../internals/useRenderElement.js\";\nimport { CompositeRoot } from \"../internals/composite/root/CompositeRoot.js\";\nimport { useToolbarRootContext } from \"../toolbar/root/ToolbarRootContext.js\";\nimport { ToggleGroupContext } from \"./ToggleGroupContext.js\";\nimport { ToggleGroupDataAttributes } from \"./ToggleGroupDataAttributes.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n multiple(value) {\n if (value) {\n return {\n [ToggleGroupDataAttributes.multiple]: ''\n };\n }\n return null;\n }\n};\n\n/**\n * Provides a shared state to a series of toggle buttons.\n *\n * Documentation: [Base UI Toggle Group](https://base-ui.com/react/components/toggle-group)\n */\nexport const ToggleGroup = /*#__PURE__*/React.forwardRef(function ToggleGroup(componentProps, forwardedRef) {\n const {\n defaultValue: defaultValueProp,\n disabled: disabledProp = false,\n loopFocus = true,\n onValueChange,\n orientation = 'horizontal',\n multiple = false,\n value: valueProp,\n className,\n render,\n style,\n ...elementProps\n } = componentProps;\n const toolbarContext = useToolbarRootContext(true);\n const isValueInitialized = React.useMemo(() => valueProp !== undefined || defaultValueProp !== undefined, [valueProp, defaultValueProp]);\n const disabled = (toolbarContext?.disabled ?? false) || disabledProp;\n const [groupValue, setValueState] = useControlled({\n controlled: valueProp,\n default: valueProp === undefined ? defaultValueProp ?? EMPTY_ARRAY : undefined,\n name: 'ToggleGroup',\n state: 'value'\n });\n const setGroupValue = useStableCallback((newValue, nextPressed, eventDetails) => {\n let newGroupValue;\n if (multiple) {\n newGroupValue = groupValue.slice();\n if (nextPressed) {\n newGroupValue.push(newValue);\n } else {\n newGroupValue.splice(groupValue.indexOf(newValue), 1);\n }\n } else {\n newGroupValue = nextPressed ? [newValue] : [];\n }\n onValueChange?.(newGroupValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValueState(newGroupValue);\n });\n const state = {\n disabled,\n multiple,\n orientation\n };\n const contextValue = React.useMemo(() => ({\n disabled,\n orientation,\n setGroupValue,\n value: groupValue,\n isValueInitialized\n }), [disabled, orientation, setGroupValue, groupValue, isValueInitialized]);\n const defaultProps = {\n role: 'group'\n };\n const element = useRenderElement('div', componentProps, {\n enabled: Boolean(toolbarContext),\n state,\n ref: forwardedRef,\n props: [defaultProps, elementProps],\n stateAttributesMapping\n });\n return /*#__PURE__*/_jsx(ToggleGroupContext.Provider, {\n value: contextValue,\n children: toolbarContext ? element : /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: [defaultProps, elementProps],\n stateAttributesMapping: stateAttributesMapping,\n loopFocus: loopFocus,\n enableHomeAndEndKeys: true,\n orientation: orientation\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") ToggleGroup.displayName = \"ToggleGroup\";","\"use client\";\n\nimport type { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\";\nimport { ToggleGroup as ToggleGroupPrimitive } from \"@base-ui/react/toggle-group\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport { cn } from \"~/lib/utils\";\nimport { Separator } from \"~/components/ui/separator\";\nimport { Toggle as ToggleComponent, type toggleVariants } from \"~/components/ui/toggle\";\n\nconst ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({\n size: \"default\",\n variant: \"default\",\n});\n\nfunction ToggleGroup({\n className,\n variant = \"default\",\n size = \"default\",\n orientation = \"horizontal\",\n children,\n ...props\n}: ToggleGroupPrimitive.Props & VariantProps<typeof toggleVariants>) {\n const value = React.useMemo(() => ({ size, variant }), [size, variant]);\n return (\n <ToggleGroupPrimitive\n className={cn(\n \"flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input\",\n orientation === \"horizontal\"\n ? \"*:pointer-coarse:after:min-w-auto\"\n : \"*:pointer-coarse:after:min-h-auto\",\n variant === \"default\"\n ? \"gap-0.5\"\n : orientation === \"horizontal\"\n ? \"*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none\"\n : \"*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block\",\n className,\n )}\n data-size={size}\n data-slot=\"toggle-group\"\n data-variant={variant}\n orientation={orientation}\n {...props}\n >\n <ToggleGroupContext value={value}>{children}</ToggleGroupContext>\n </ToggleGroupPrimitive>\n );\n}\n\nfunction Toggle({\n className,\n children,\n variant,\n size,\n ...props\n}: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {\n const context = React.use(ToggleGroupContext);\n\n const resolvedVariant = variant ?? context.variant;\n const resolvedSize = size ?? context.size;\n\n return (\n <ToggleComponent\n className={className}\n data-size={resolvedSize}\n data-variant={resolvedVariant}\n size={resolvedSize}\n variant={resolvedVariant}\n {...props}\n >\n {children}\n </ToggleComponent>\n );\n}\n\nfunction ToggleGroupSeparator({\n className,\n orientation = \"vertical\",\n ...props\n}: {\n className?: string;\n} & React.ComponentProps<typeof Separator>) {\n return (\n <Separator\n className={cn(\n \"pointer-events-none relative bg-input before:absolute before:inset-0 dark:before:bg-input/32\",\n className,\n )}\n orientation={orientation}\n {...props}\n />\n );\n}\n\nexport { ToggleGroup, Toggle, Toggle as ToggleGroupItem, ToggleGroupSeparator };\n","import { WS_METHODS } from \"@t3tools/contracts\";\nimport { Atom } from \"effect/unstable/reactivity\";\n\nimport { createEnvironmentRpcQueryAtomFamily } from \"./runtime.ts\";\nimport type { EnvironmentRegistry } from \"../connection/registry.ts\";\n\nexport function createReviewEnvironmentAtoms<R, E>(\n runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,\n) {\n return {\n diffPreview: createEnvironmentRpcQueryAtomFamily(runtime, {\n label: \"environment-data:review:diff-preview\",\n tag: WS_METHODS.reviewGetDiffPreview,\n staleTimeMs: 5_000,\n }),\n };\n}\n","import { createReviewEnvironmentAtoms } from \"@t3tools/client-runtime/state/review\";\n\nimport { connectionAtomRuntime } from \"../connection/runtime\";\n\nexport const reviewEnvironment = createReviewEnvironmentAtoms(connectionAtomRuntime);\n","import type { VcsRef } from \"@t3tools/contracts\";\n\nexport interface BaseRefChoice {\n readonly id: string;\n readonly label: string;\n readonly local: VcsRef | null;\n readonly remote: VcsRef | null;\n}\n\nfunction remoteBranchName(ref: VcsRef): string {\n if (ref.remoteName && ref.name.startsWith(`${ref.remoteName}/`)) {\n return ref.name.slice(ref.remoteName.length + 1);\n }\n return ref.name;\n}\n\nexport function buildBaseRefChoices(\n localRefs: ReadonlyArray<VcsRef>,\n remoteRefs: ReadonlyArray<VcsRef>,\n): ReadonlyArray<BaseRefChoice> {\n const unusedRemoteRefs = new Set(remoteRefs);\n const pairedChoices = localRefs.map((local) => {\n const matches = remoteRefs.filter(\n (remote) => unusedRemoteRefs.has(remote) && remoteBranchName(remote) === local.name,\n );\n const remote =\n matches.find((candidate) => candidate.remoteName === \"origin\") ?? matches[0] ?? null;\n if (remote) unusedRemoteRefs.delete(remote);\n return {\n id: `local:${local.name}`,\n label: local.name,\n local,\n remote,\n };\n });\n\n const remoteOnlyChoices = remoteRefs\n .filter((remote) => unusedRemoteRefs.has(remote))\n .map((remote) => ({\n id: `remote:${remote.name}`,\n label: remote.name,\n local: null,\n remote,\n }));\n\n return [...pairedChoices, ...remoteOnlyChoices];\n}\n\nexport function filterBaseRefChoices(\n choices: ReadonlyArray<BaseRefChoice>,\n query: string,\n): ReadonlyArray<BaseRefChoice> {\n const normalizedQuery = query.trim().toLocaleLowerCase();\n if (normalizedQuery.length === 0) return choices;\n return choices.filter(\n (choice) =>\n choice.label.toLocaleLowerCase().includes(normalizedQuery) ||\n choice.local?.name.toLocaleLowerCase().includes(normalizedQuery) === true ||\n choice.remote?.name.toLocaleLowerCase().includes(normalizedQuery) === true,\n );\n}\n","import { useAtomValue } from \"@effect/atom-react\";\nimport { useParams } from \"@tanstack/react-router\";\nimport {\n isAtomCommandInterrupted,\n squashAtomCommandFailure,\n} from \"@t3tools/client-runtime/state/runtime\";\nimport { safeErrorLogAttributes } from \"@t3tools/client-runtime/errors\";\nimport type { ScopedThreadRef, TurnId } from \"@t3tools/contracts\";\nimport {\n ArrowRightIcon,\n CheckIcon,\n ChevronDownIcon,\n ChevronRightIcon,\n ChevronsDownUpIcon,\n ChevronsUpDownIcon,\n Columns2Icon,\n PilcrowIcon,\n Rows3Icon,\n SearchIcon,\n TextWrapIcon,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useOpenInPreferredEditor } from \"../editorPreferences\";\nimport { type DraftId } from \"../composerDraftStore\";\nimport { openDiffFilePrimaryAction } from \"../diffFileActions\";\nimport { useCheckpointDiff } from \"~/lib/checkpointDiffState\";\nimport { cn } from \"~/lib/utils\";\nimport { selectThreadDiffPanelSelection, useDiffPanelStore } from \"../diffPanelStore\";\nimport { useTheme } from \"../hooks/useTheme\";\nimport {\n buildFileDiffRenderKey,\n getDiffCollapseIconClassName,\n getRenderablePatch,\n resolveDiffThemeName,\n resolveFileDiffPath,\n} from \"../lib/diffRendering\";\nimport { areAllDiffFilesCollapsed, toggleAllDiffFiles } from \"../lib/diffCollapse\";\nimport { useTurnDiffSummaries } from \"../hooks/useTurnDiffSummaries\";\nimport { useProject, useThread } from \"../state/entities\";\nimport { resolveThreadRouteRef } from \"../threadRoutes\";\nimport { useClientSettings } from \"../hooks/useSettings\";\nimport { formatShortTimestamp } from \"../timestampFormat\";\nimport { DiffPanelLoadingState, DiffPanelShell, type DiffPanelMode } from \"./DiffPanelShell\";\nimport { AnnotatableCodeView, type AnnotatableCodeViewHandle } from \"./diffs/AnnotatableCodeView\";\nimport { Button } from \"./ui/button\";\nimport { ToggleGroup, Toggle } from \"./ui/toggle-group\";\nimport { Switch } from \"./ui/switch\";\nimport {\n Combobox,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n ComboboxPopup,\n ComboboxTrigger,\n} from \"./ui/combobox\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"./ui/menu\";\nimport { Tooltip, TooltipPopup, TooltipTrigger } from \"./ui/tooltip\";\nimport { useEnvironmentQuery } from \"../state/query\";\nimport { serverEnvironment } from \"../state/server\";\nimport { reviewEnvironment } from \"../state/review\";\nimport { vcsEnvironment } from \"../state/vcs\";\nimport { buildBaseRefChoices, filterBaseRefChoices } from \"../lib/baseRefChoices\";\n\ntype DiffRenderMode = \"stacked\" | \"split\";\ntype DiffThemeType = \"light\" | \"dark\";\nconst AUTOMATIC_BASE_REF = \"__automatic_base_ref__\";\n\ninterface CollapsedDiffFilesState {\n readonly scopeKey: string | null;\n readonly fileKeys: ReadonlySet<string>;\n}\n\nconst EMPTY_COLLAPSED_DIFF_FILE_KEYS: ReadonlySet<string> = new Set();\n\nconst DIFF_PANEL_UNSAFE_CSS = `\n[data-diffs-header],\n[data-diff],\n[data-file],\n[data-error-wrapper],\n[data-virtualizer-buffer] {\n --diffs-header-font-family: var(--font-sans) !important;\n --diffs-font-family: var(--font-mono) !important;\n --diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;\n --diffs-token-light-bg: transparent;\n --diffs-token-dark-bg: transparent;\n\n --diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));\n --diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));\n --diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));\n --diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));\n\n --diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));\n --diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));\n --diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));\n --diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));\n\n --diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));\n --diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));\n --diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));\n --diffs-bg-deletion-emphasis-override: color-mix(\n in srgb,\n var(--background) 80%,\n var(--destructive)\n );\n\n background-color: var(--diffs-bg) !important;\n}\n\n[data-file-info] {\n background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;\n border-block-color: var(--border) !important;\n color: var(--foreground) !important;\n}\n\n[data-diffs-header] {\n position: sticky !important;\n top: 0;\n z-index: 4;\n background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;\n border-bottom: 1px solid var(--border) !important;\n align-items: center !important;\n font-family: var(--font-sans) !important;\n font-size: 12px !important;\n line-height: 1 !important;\n min-height: 32px !important;\n padding-block: 6px !important;\n}\n\n[data-diffs-header] [data-header-content] {\n align-items: center !important;\n line-height: 1 !important;\n}\n\n[data-diffs-header] [data-metadata] {\n align-items: center !important;\n line-height: 1 !important;\n font-variant-numeric: tabular-nums;\n}\n\n[data-diffs-header] [data-additions-count],\n[data-diffs-header] [data-deletions-count] {\n font-family: var(--font-mono) !important;\n font-size: 11px !important;\n font-variant-numeric: tabular-nums;\n line-height: 1 !important;\n}\n\n[data-diffs-header] [data-change-icon],\n[data-diffs-header] [data-rename-icon] {\n display: block;\n flex-shrink: 0;\n}\n\n[data-title] {\n cursor: pointer;\n transition:\n color 120ms ease,\n text-decoration-color 120ms ease;\n text-decoration: underline;\n text-decoration-color: transparent;\n text-underline-offset: 2px;\n font-family: var(--font-sans) !important;\n}\n\n[data-title]:hover {\n color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;\n text-decoration-color: currentColor;\n}\n`;\n\ninterface DiffPanelProps {\n mode?: DiffPanelMode;\n composerDraftTarget: ScopedThreadRef | DraftId;\n initialGitScope: \"branch\" | \"unstaged\";\n}\n\nexport { DiffWorkerPoolProvider } from \"./DiffWorkerPoolProvider\";\n\nexport default function DiffPanel({\n mode = \"inline\",\n composerDraftTarget,\n initialGitScope: initialGitScopeProp,\n}: DiffPanelProps) {\n const { resolvedTheme } = useTheme();\n const settings = useClientSettings();\n const [initialGitScope] = useState(initialGitScopeProp);\n const [diffRenderMode, setDiffRenderMode] = useState<DiffRenderMode>(\"stacked\");\n const [wordWrap, setWordWrap] = useState(settings.wordWrap);\n const [diffIgnoreWhitespace, setDiffIgnoreWhitespace] = useState(settings.diffIgnoreWhitespace);\n const [baseRefQuery, setBaseRefQuery] = useState(\"\");\n const [collapsedDiffFiles, setCollapsedDiffFiles] = useState<CollapsedDiffFilesState>(() => ({\n scopeKey: null,\n fileKeys: EMPTY_COLLAPSED_DIFF_FILE_KEYS,\n }));\n const codeViewRef = useRef<AnnotatableCodeViewHandle>(null);\n\n const routeThreadRef = useParams({\n strict: false,\n select: (params) => resolveThreadRouteRef(params),\n });\n const activeThreadId = routeThreadRef?.threadId ?? null;\n const activeThread = useThread(routeThreadRef);\n const activeProjectId = activeThread?.projectId ?? null;\n const activeProject = useProject(\n activeThread && activeProjectId\n ? {\n environmentId: activeThread.environmentId,\n projectId: activeProjectId,\n }\n : null,\n );\n const activeCwd = activeThread?.worktreePath ?? activeProject?.workspaceRoot;\n const serverConfig = useAtomValue(\n serverEnvironment.configValueAtom(activeThread?.environmentId ?? null),\n );\n const openInPreferredEditor = useOpenInPreferredEditor(\n activeThread?.environmentId ?? null,\n serverConfig?.availableEditors ?? [],\n );\n const gitStatusQuery = useEnvironmentQuery(\n activeThread !== null && activeThread !== undefined && activeCwd != null\n ? vcsEnvironment.status({\n environmentId: activeThread.environmentId,\n input: { cwd: activeCwd },\n })\n : null,\n );\n const diffSelection = useDiffPanelStore((state) =>\n selectThreadDiffPanelSelection(\n state.byThreadKey,\n routeThreadRef,\n initialGitScope === \"unstaged\",\n ),\n );\n const isGitRepo = gitStatusQuery.data?.isRepo ?? true;\n const { turnDiffSummaries, inferredCheckpointTurnCountByTurnId } =\n useTurnDiffSummaries(activeThread);\n const orderedTurnDiffSummaries = useMemo(\n () =>\n [...turnDiffSummaries].toSorted((left, right) => {\n const leftTurnCount =\n left.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[left.turnId] ?? 0;\n const rightTurnCount =\n right.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[right.turnId] ?? 0;\n if (leftTurnCount !== rightTurnCount) {\n return rightTurnCount - leftTurnCount;\n }\n return right.completedAt.localeCompare(left.completedAt);\n }),\n [inferredCheckpointTurnCountByTurnId, turnDiffSummaries],\n );\n\n useEffect(() => {\n if (!routeThreadRef || diffSelection.kind !== \"turn\") return;\n useDiffPanelStore.getState().reconcileTurnSelection(\n routeThreadRef,\n orderedTurnDiffSummaries.map((summary) => summary.turnId),\n );\n }, [diffSelection, orderedTurnDiffSummaries, routeThreadRef]);\n\n const selectedTurnId = diffSelection.kind === \"turn\" ? diffSelection.turnId : null;\n const selectedGitScope = diffSelection.kind === \"unstaged\" ? \"unstaged\" : \"branch\";\n const selectedBaseRef = diffSelection.kind === \"branch\" ? diffSelection.baseRef : null;\n const selectedFilePath = diffSelection.kind === \"turn\" ? diffSelection.filePath : null;\n const selectedFileRevealRequestId =\n diffSelection.kind === \"turn\" ? diffSelection.revealRequestId : 0;\n const selectedTurn =\n selectedTurnId === null\n ? undefined\n : (orderedTurnDiffSummaries.find((summary) => summary.turnId === selectedTurnId) ??\n orderedTurnDiffSummaries[0]);\n const selectedCheckpointTurnCount =\n selectedTurn &&\n (selectedTurn.checkpointTurnCount ?? inferredCheckpointTurnCountByTurnId[selectedTurn.turnId]);\n const latestTurn = orderedTurnDiffSummaries[0];\n const selectedScopeLabel =\n selectedTurnId === null\n ? selectedGitScope === \"unstaged\"\n ? \"Working tree\"\n : \"Branch changes\"\n : selectedTurn?.turnId === latestTurn?.turnId\n ? \"Latest turn\"\n : `Turn ${selectedCheckpointTurnCount ?? \"?\"}`;\n const reviewSectionId = selectedTurn ? `turn:${selectedTurn.turnId}` : selectedGitScope;\n const collapseScopeKey = routeThreadRef\n ? `${routeThreadRef.environmentId}:${routeThreadRef.threadId}:${reviewSectionId}`\n : null;\n const collapsedDiffFileKeys =\n collapsedDiffFiles.scopeKey === collapseScopeKey\n ? collapsedDiffFiles.fileKeys\n : EMPTY_COLLAPSED_DIFF_FILE_KEYS;\n const reviewSectionTitle = selectedTurn\n ? `Turn ${selectedCheckpointTurnCount ?? \"?\"}`\n : selectedGitScope === \"unstaged\"\n ? \"Working tree\"\n : \"Branch changes\";\n const selectedCheckpointRange = useMemo(\n () =>\n typeof selectedCheckpointTurnCount === \"number\"\n ? {\n fromTurnCount: Math.max(0, selectedCheckpointTurnCount - 1),\n toTurnCount: selectedCheckpointTurnCount,\n }\n : null,\n [selectedCheckpointTurnCount],\n );\n const activeCheckpointDiff = useCheckpointDiff(\n {\n environmentId: activeThread?.environmentId ?? null,\n threadId: activeThreadId,\n fromTurnCount: selectedCheckpointRange?.fromTurnCount ?? null,\n toTurnCount: selectedCheckpointRange?.toTurnCount ?? null,\n ignoreWhitespace: diffIgnoreWhitespace,\n cacheScope: selectedTurn ? `turn:${selectedTurn.turnId}` : null,\n },\n { enabled: isGitRepo && selectedTurn !== undefined },\n );\n const primaryBranchDiffPreview = useEnvironmentQuery(\n selectedTurnId === null && activeThread && activeCwd\n ? reviewEnvironment.diffPreview({\n environmentId: activeThread.environmentId,\n input: {\n cwd: activeCwd,\n ...(selectedBaseRef ? { baseRef: selectedBaseRef } : {}),\n ignoreWhitespace: diffIgnoreWhitespace,\n },\n })\n : null,\n );\n const shouldRetryBranchDiffAtEnvironmentCwd =\n selectedTurnId === null &&\n primaryBranchDiffPreview.error?.includes(\"configured workspace root\") === true &&\n serverConfig?.cwd !== undefined &&\n serverConfig.cwd !== activeCwd;\n const fallbackBranchDiffPreview = useEnvironmentQuery(\n shouldRetryBranchDiffAtEnvironmentCwd && activeThread && serverConfig\n ? reviewEnvironment.diffPreview({\n environmentId: activeThread.environmentId,\n input: {\n cwd: serverConfig.cwd,\n ...(selectedBaseRef ? { baseRef: selectedBaseRef } : {}),\n ignoreWhitespace: diffIgnoreWhitespace,\n },\n })\n : null,\n );\n const branchDiffPreview = shouldRetryBranchDiffAtEnvironmentCwd\n ? fallbackBranchDiffPreview\n : primaryBranchDiffPreview;\n const selectedGitSource = branchDiffPreview.data?.sources.find(\n (source) => source.kind === (selectedGitScope === \"unstaged\" ? \"working-tree\" : \"branch-range\"),\n );\n const localBranchRefs = useEnvironmentQuery(\n selectedTurnId === null &&\n selectedGitScope === \"branch\" &&\n activeThread &&\n branchDiffPreview.data?.cwd\n ? vcsEnvironment.listRefs({\n environmentId: activeThread.environmentId,\n input: {\n cwd: branchDiffPreview.data.cwd,\n includeMatchingRemoteRefs: true,\n refKind: \"local\",\n ...(baseRefQuery.trim().length > 0 ? { query: baseRefQuery.trim() } : {}),\n limit: 100,\n },\n })\n : null,\n );\n const remoteBranchRefs = useEnvironmentQuery(\n selectedTurnId === null &&\n selectedGitScope === \"branch\" &&\n activeThread &&\n branchDiffPreview.data?.cwd\n ? vcsEnvironment.listRefs({\n environmentId: activeThread.environmentId,\n input: {\n cwd: branchDiffPreview.data.cwd,\n includeMatchingRemoteRefs: true,\n refKind: \"remote\",\n ...(baseRefQuery.trim().length > 0 ? { query: baseRefQuery.trim() } : {}),\n limit: 100,\n },\n })\n : null,\n );\n const baseRefChoices = buildBaseRefChoices(\n localBranchRefs.data?.refs.filter((ref) => ref.name !== selectedGitSource?.headRef) ?? [],\n remoteBranchRefs.data?.refs ?? [],\n );\n const matchingBaseRefChoices = filterBaseRefChoices(baseRefChoices, baseRefQuery);\n const valueForBaseRefChoice = (choice: (typeof baseRefChoices)[number]) =>\n selectedBaseRef && selectedBaseRef === choice.remote?.name\n ? selectedBaseRef\n : (choice.local?.name ?? choice.remote?.name ?? choice.id);\n const baseRefItems = [AUTOMATIC_BASE_REF, ...baseRefChoices.map(valueForBaseRefChoice)];\n const filteredBaseRefItems = [\n ...(baseRefQuery.trim().length === 0 ? [AUTOMATIC_BASE_REF] : []),\n ...matchingBaseRefChoices.map(valueForBaseRefChoice),\n ];\n const gitDiff = selectedGitSource?.diff;\n\n const selectedPatch = selectedTurn ? activeCheckpointDiff.data?.diff : gitDiff;\n const isSelectedPatchTruncated = !selectedTurn && selectedGitSource?.truncated === true;\n const isLoadingSelectedPatch = selectedTurn\n ? activeCheckpointDiff.isPending\n : branchDiffPreview.isPending;\n const selectedPatchError = selectedTurn ? activeCheckpointDiff.error : branchDiffPreview.error;\n const hasResolvedPatch = typeof selectedPatch === \"string\";\n const hasNoNetChanges = hasResolvedPatch && selectedPatch.trim().length === 0;\n const renderablePatch = useMemo(\n () =>\n getRenderablePatch(selectedPatch, `diff-panel:${resolvedTheme}`, {\n compactPartialHunkOffsets: selectedTurnId === null,\n }),\n [resolvedTheme, selectedPatch, selectedTurnId],\n );\n const renderableFiles = useMemo(() => {\n if (!renderablePatch || renderablePatch.kind !== \"files\") {\n return [];\n }\n return renderablePatch.files.toSorted((left, right) =>\n resolveFileDiffPath(left).localeCompare(resolveFileDiffPath(right), undefined, {\n numeric: true,\n sensitivity: \"base\",\n }),\n );\n }, [renderablePatch]);\n const codeViewFiles = useMemo(\n () =>\n renderableFiles.map((fileDiff) => {\n const fileKey = buildFileDiffRenderKey(fileDiff);\n return {\n fileDiff,\n filePath: resolveFileDiffPath(fileDiff),\n fileKey,\n collapsed: collapsedDiffFileKeys.has(fileKey),\n };\n }),\n [collapsedDiffFileKeys, renderableFiles],\n );\n const diffFileKeys = useMemo(() => codeViewFiles.map((file) => file.fileKey), [codeViewFiles]);\n const allDiffFilesCollapsed = areAllDiffFilesCollapsed(diffFileKeys, collapsedDiffFileKeys);\n\n useEffect(() => {\n if (!selectedFilePath) return;\n const file = codeViewFiles.find((candidate) => candidate.filePath === selectedFilePath);\n if (!file) return;\n codeViewRef.current?.scrollTo({ type: \"item\", id: file.fileKey, align: \"start\" });\n }, [codeViewFiles, selectedFilePath, selectedFileRevealRequestId]);\n\n const openDiffFile = useCallback(\n (filePath: string) => {\n openDiffFilePrimaryAction({\n threadRef: routeThreadRef,\n filePath,\n activeCwd,\n openInEditor: (targetPath) => {\n void (async () => {\n const result = await openInPreferredEditor(targetPath);\n if (result._tag === \"Failure\" && !isAtomCommandInterrupted(result)) {\n console.warn(\"Failed to open diff file in editor.\", {\n operation: \"open-diff-file\",\n ...(routeThreadRef\n ? {\n environmentId: routeThreadRef.environmentId,\n threadId: routeThreadRef.threadId,\n }\n : {}),\n ...safeErrorLogAttributes(squashAtomCommandFailure(result)),\n });\n }\n })();\n },\n });\n },\n [activeCwd, openInPreferredEditor, routeThreadRef],\n );\n const toggleDiffFileCollapsed = useCallback(\n (fileKey: string) => {\n setCollapsedDiffFiles((current) => {\n const next = new Set(current.scopeKey === collapseScopeKey ? current.fileKeys : []);\n if (next.has(fileKey)) {\n next.delete(fileKey);\n } else {\n next.add(fileKey);\n }\n return { scopeKey: collapseScopeKey, fileKeys: next };\n });\n },\n [collapseScopeKey],\n );\n\n const toggleDiffFileCollapse = useCallback(() => {\n setCollapsedDiffFiles((current) => {\n const currentKeys =\n current.scopeKey === collapseScopeKey ? current.fileKeys : EMPTY_COLLAPSED_DIFF_FILE_KEYS;\n\n return {\n scopeKey: collapseScopeKey,\n fileKeys: toggleAllDiffFiles(diffFileKeys, currentKeys),\n };\n });\n }, [collapseScopeKey, diffFileKeys]);\n\n const selectTurn = (turnId: TurnId) => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectTurn(routeThreadRef, turnId);\n };\n const selectGitScope = (scope: \"branch\" | \"unstaged\") => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectGitScope(routeThreadRef, scope);\n };\n const selectBranchBaseRef = (baseRef: string | null) => {\n if (!routeThreadRef) return;\n useDiffPanelStore.getState().selectBranchBaseRef(routeThreadRef, baseRef);\n };\n\n const headerRow = (\n <>\n <div className=\"flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]\">\n <DropdownMenu>\n <DropdownMenuTrigger\n className=\"inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Diff scope: ${selectedScopeLabel}`}\n >\n <span className=\"truncate\">{selectedScopeLabel}</span>\n <ChevronDownIcon className=\"size-3.5 shrink-0 text-muted-foreground\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" className=\"w-60\">\n <DropdownMenuItem\n className={\n selectedTurnId === null && selectedGitScope === \"unstaged\"\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => selectGitScope(\"unstaged\")}\n >\n <span>Working tree</span>\n </DropdownMenuItem>\n <DropdownMenuItem\n className={\n selectedTurnId === null && selectedGitScope === \"branch\"\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => selectGitScope(\"branch\")}\n >\n <span>Branch changes</span>\n </DropdownMenuItem>\n <DropdownMenuItem\n className={\n selectedTurnId !== null && selectedTurn?.turnId === latestTurn?.turnId\n ? \"bg-foreground/[0.08]\"\n : undefined\n }\n onClick={() => {\n if (latestTurn) selectTurn(latestTurn.turnId);\n }}\n >\n <span>Latest turn</span>\n </DropdownMenuItem>\n <DropdownMenuSub>\n <DropdownMenuSubTrigger>Turn</DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-64\">\n {orderedTurnDiffSummaries.map((summary) => {\n const turnCount =\n summary.checkpointTurnCount ??\n inferredCheckpointTurnCountByTurnId[summary.turnId] ??\n \"?\";\n return (\n <DropdownMenuItem\n key={summary.turnId}\n className={\n summary.turnId === selectedTurn?.turnId ? \"bg-foreground/[0.08]\" : undefined\n }\n onClick={() => selectTurn(summary.turnId)}\n >\n <span>Turn {turnCount}</span>\n <span className=\"ml-auto text-xs tabular-nums text-muted-foreground\">\n {formatShortTimestamp(summary.completedAt, settings.timestampFormat)}\n </span>\n </DropdownMenuItem>\n );\n })}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n </DropdownMenuContent>\n </DropdownMenu>\n {selectedTurnId === null && selectedGitScope === \"branch\" && selectedGitSource?.baseRef && (\n <div\n className=\"flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground\"\n title={`${selectedGitSource.headRef ?? \"HEAD\"} → ${selectedGitSource.baseRef}`}\n aria-label={`Comparing ${selectedGitSource.headRef ?? \"HEAD\"} against ${selectedGitSource.baseRef}`}\n >\n <span className=\"min-w-0 max-w-48 truncate\">{selectedGitSource.headRef ?? \"HEAD\"}</span>\n <ArrowRightIcon className=\"size-3.5 shrink-0 opacity-70\" />\n <Combobox\n items={baseRefItems}\n filteredItems={filteredBaseRefItems}\n value={selectedBaseRef ?? AUTOMATIC_BASE_REF}\n onOpenChange={(open) => {\n if (!open) setBaseRefQuery(\"\");\n }}\n onValueChange={(value) => {\n if (!value) return;\n selectBranchBaseRef(value === AUTOMATIC_BASE_REF ? null : value);\n }}\n >\n <ComboboxTrigger\n className=\"inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n aria-label={`Change comparison target. Currently ${selectedGitSource.baseRef}`}\n >\n <span className=\"min-w-0 truncate\">{selectedGitSource.baseRef}</span>\n <ChevronDownIcon className=\"size-3.5 shrink-0 opacity-70\" />\n </ComboboxTrigger>\n <ComboboxPopup\n align=\"start\"\n className=\"w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden\"\n >\n <div className=\"min-w-0 shrink-0 px-3 pt-2.5\">\n <div className=\"relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring\">\n <SearchIcon\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55\"\n />\n <ComboboxInput\n className=\"[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5\"\n inputClassName=\"rounded-none bg-transparent text-sm\"\n placeholder=\"Search refs...\"\n showTrigger={false}\n size=\"sm\"\n unstyled\n value={baseRefQuery}\n onChange={(event) => setBaseRefQuery(event.target.value)}\n />\n </div>\n </div>\n <div className=\"grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide\">\n <span aria-hidden=\"true\" />\n <div className=\"grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center\">\n <span>Branch</span>\n <span className=\"text-right\">Remote</span>\n </div>\n </div>\n <ComboboxEmpty>No matching refs.</ComboboxEmpty>\n <ComboboxList className=\"max-h-64 min-w-0 overflow-x-hidden\">\n <ComboboxItem\n className=\"h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0\"\n contentClassName=\"w-full min-w-0 overflow-hidden\"\n value={AUTOMATIC_BASE_REF}\n >\n <span className=\"block min-w-0 truncate\">Automatic</span>\n </ComboboxItem>\n {baseRefChoices.map((choice) => {\n const item = valueForBaseRefChoice(choice);\n const hasBoth = choice.local !== null && choice.remote !== null;\n const useRemote = choice.remote?.name === item;\n return (\n <ComboboxItem\n key={choice.id}\n className=\"h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0\"\n contentClassName=\"w-full min-w-0 overflow-hidden\"\n value={item}\n >\n <div className=\"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden\">\n <span className=\"block min-w-0 truncate pe-2\">{choice.label}</span>\n {hasBoth ? (\n <div\n className=\"flex justify-end\"\n onClick={(event) => event.stopPropagation()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n <Switch\n aria-label={`Use remote version of ${choice.label}`}\n checked={useRemote}\n className=\"[--thumb-size:--spacing(3)]\"\n onCheckedChange={(checked) => {\n const nextRef = checked\n ? choice.remote?.name\n : choice.local?.name;\n if (nextRef) selectBranchBaseRef(nextRef);\n }}\n />\n </div>\n ) : choice.remote ? (\n <span\n className=\"flex justify-end text-muted-foreground\"\n title=\"Remote only\"\n >\n <CheckIcon aria-hidden=\"true\" className=\"size-3\" />\n </span>\n ) : null}\n </div>\n </ComboboxItem>\n );\n })}\n </ComboboxList>\n </ComboboxPopup>\n </Combobox>\n </div>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]\">\n {codeViewFiles.length > 0 && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"icon-xs\"\n variant=\"outline\"\n aria-label={allDiffFilesCollapsed ? \"Expand all files\" : \"Collapse all files\"}\n onClick={toggleDiffFileCollapse}\n />\n }\n >\n {allDiffFilesCollapsed ? (\n <ChevronsUpDownIcon className=\"size-3\" />\n ) : (\n <ChevronsDownUpIcon className=\"size-3\" />\n )}\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {allDiffFilesCollapsed ? \"Expand all files\" : \"Collapse all files\"}\n </TooltipPopup>\n </Tooltip>\n )}\n <ToggleGroup\n className=\"shrink-0\"\n variant=\"outline\"\n size=\"xs\"\n value={[diffRenderMode]}\n onValueChange={(value) => {\n const next = value[0];\n if (next === \"stacked\" || next === \"split\") {\n setDiffRenderMode(next);\n }\n }}\n >\n <Toggle aria-label=\"Stacked diff view\" value=\"stacked\">\n <Rows3Icon className=\"size-3\" />\n </Toggle>\n <Toggle aria-label=\"Split diff view\" value=\"split\">\n <Columns2Icon className=\"size-3\" />\n </Toggle>\n </ToggleGroup>\n <Tooltip>\n <TooltipTrigger\n render={\n <Toggle\n aria-label={wordWrap ? \"Disable diff line wrapping\" : \"Enable diff line wrapping\"}\n variant=\"outline\"\n size=\"xs\"\n pressed={wordWrap}\n onPressedChange={(pressed) => {\n setWordWrap(Boolean(pressed));\n }}\n />\n }\n >\n <TextWrapIcon className=\"size-3\" />\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {wordWrap ? \"Disable line wrapping\" : \"Enable line wrapping\"}\n </TooltipPopup>\n </Tooltip>\n <Tooltip>\n <TooltipTrigger\n render={\n <Toggle\n aria-label={\n diffIgnoreWhitespace ? \"Show whitespace changes\" : \"Hide whitespace changes\"\n }\n variant=\"outline\"\n size=\"xs\"\n pressed={diffIgnoreWhitespace}\n onPressedChange={(pressed) => {\n setDiffIgnoreWhitespace(Boolean(pressed));\n }}\n />\n }\n >\n <PilcrowIcon className=\"size-3\" />\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {diffIgnoreWhitespace ? \"Show whitespace changes\" : \"Hide whitespace changes\"}\n </TooltipPopup>\n </Tooltip>\n </div>\n </>\n );\n\n return (\n <DiffPanelShell mode={mode} header={headerRow}>\n {!activeThread ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n Select a thread to inspect turn diffs.\n </div>\n ) : !isGitRepo ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n Turn diffs are unavailable because this project is not a git repository.\n </div>\n ) : selectedTurnId !== null && orderedTurnDiffSummaries.length === 0 ? (\n <div className=\"flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70\">\n No completed turns yet.\n </div>\n ) : (\n <>\n <div className=\"diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden\">\n {isSelectedPatchTruncated && (\n <p className=\"shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground\">\n This diff was truncated because it exceeded the preview limit. The changes shown are\n incomplete.\n </p>\n )}\n {selectedPatchError && !renderablePatch && (\n <div className=\"px-3\">\n <p className=\"mb-2 text-[11px] text-red-500/80\">{selectedPatchError}</p>\n </div>\n )}\n {!renderablePatch ? (\n isLoadingSelectedPatch ? (\n <DiffPanelLoadingState\n label={\n selectedTurn\n ? \"Loading checkpoint diff...\"\n : selectedGitScope === \"unstaged\"\n ? \"Loading working tree diff...\"\n : \"Loading branch diff...\"\n }\n />\n ) : (\n <div className=\"flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70\">\n <p>\n {hasNoNetChanges\n ? \"No net changes in this selection.\"\n : \"No patch available for this selection.\"}\n </p>\n </div>\n )\n ) : renderablePatch.kind === \"files\" ? (\n <div\n className=\"min-h-0 flex-1\"\n onClickCapture={(event) => {\n const composedPath = event.nativeEvent.composedPath?.() ?? [];\n const title = composedPath.find(\n (node): node is HTMLElement =>\n node instanceof HTMLElement && node.hasAttribute(\"data-title\"),\n );\n const filePath = title?.textContent?.trim();\n if (filePath) openDiffFile(filePath);\n }}\n >\n <AnnotatableCodeView\n viewerRef={codeViewRef}\n key={collapseScopeKey ?? reviewSectionId}\n className=\"diff-render-surface h-full min-h-0 overflow-auto [&>div>div:last-child]:top-0! [&>div>div:last-child]:bottom-auto!\"\n files={codeViewFiles}\n sectionId={reviewSectionId}\n sectionTitle={reviewSectionTitle}\n composerDraftTarget={composerDraftTarget}\n renderHeaderPrefix={(fileDiff, fileKey, collapsed) => {\n const filePath = resolveFileDiffPath(fileDiff);\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <button\n type=\"button\"\n className={cn(\n \"inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden\",\n getDiffCollapseIconClassName(fileDiff),\n )}\n aria-label={collapsed ? `Expand ${filePath}` : `Collapse ${filePath}`}\n aria-expanded={!collapsed}\n onClick={(event) => {\n event.stopPropagation();\n toggleDiffFileCollapsed(fileKey);\n }}\n />\n }\n >\n {collapsed ? (\n <ChevronRightIcon className=\"size-4\" />\n ) : (\n <ChevronDownIcon className=\"size-4\" />\n )}\n </TooltipTrigger>\n <TooltipPopup side=\"top\">\n {collapsed ? \"Expand diff\" : \"Collapse diff\"}\n </TooltipPopup>\n </Tooltip>\n );\n }}\n options={{\n diffStyle: diffRenderMode === \"split\" ? \"split\" : \"unified\",\n lineDiffType: \"none\",\n overflow: wordWrap ? \"wrap\" : \"scroll\",\n theme: resolveDiffThemeName(resolvedTheme),\n themeType: resolvedTheme as DiffThemeType,\n unsafeCSS: DIFF_PANEL_UNSAFE_CSS,\n stickyHeaders: true,\n layout: { paddingTop: 8, paddingBottom: 8, gap: 8 },\n }}\n />\n </div>\n ) : (\n <div className=\"min-h-0 flex-1 overflow-auto p-2\">\n <div className=\"space-y-2\">\n <p className=\"text-[11px] text-muted-foreground/75\">{renderablePatch.reason}</p>\n <pre\n className={cn(\n \"max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90\",\n wordWrap\n ? \"overflow-auto whitespace-pre-wrap wrap-break-word\"\n : \"overflow-auto\",\n )}\n >\n {renderablePatch.text}\n </pre>\n </div>\n </div>\n )}\n </div>\n </>\n )}\n </DiffPanelShell>\n );\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,13,14],"mappings":"m9BAaA,IAAM,GAAW,EAAiB,YAAaA,CAH7C,CAAC,OAAQ,CAAE,MAAO,KAAM,OAAQ,KAAM,EAAG,IAAK,EAAG,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,EAC9E,CAAC,OAAQ,CAAE,EAAG,WAAY,IA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