@cerbur/clutch-dsh-worktree 0.1.10 → 0.1.13
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.
- package/README.md +278 -498
- package/README.zh.md +231 -432
- package/assets/screenshots/screenshots-dashboard.png +0 -0
- package/assets/screenshots/screenshots-en.png +0 -0
- package/assets/screenshots/screenshots-git-reviewer.png +0 -0
- package/assets/screenshots/screenshots-import.png +0 -0
- package/assets/screenshots/screenshots-zh.png +0 -0
- package/lib/client/WorktreeSurface.d.ts +1 -1
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +268 -10
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/context/WorktreeHeroContext.d.ts +4 -3
- package/lib/client/context/WorktreeHeroContext.d.ts.map +1 -1
- package/lib/client/context/WorktreeHeroContext.js +29 -11
- package/lib/client/context/WorktreeHeroContext.js.map +1 -1
- package/lib/client/dashboard/DashboardHeaderAction.d.ts +20 -0
- package/lib/client/dashboard/DashboardHeaderAction.d.ts.map +1 -0
- package/lib/client/dashboard/DashboardHeaderAction.js +19 -0
- package/lib/client/dashboard/DashboardHeaderAction.js.map +1 -0
- package/lib/client/dashboard/OpenInAppButton.d.ts +9 -0
- package/lib/client/dashboard/OpenInAppButton.d.ts.map +1 -0
- package/lib/client/dashboard/OpenInAppButton.js +123 -0
- package/lib/client/dashboard/OpenInAppButton.js.map +1 -0
- package/lib/client/dashboard/WorktreeDashboard.d.ts +28 -0
- package/lib/client/dashboard/WorktreeDashboard.d.ts.map +1 -0
- package/lib/client/dashboard/WorktreeDashboard.js +362 -0
- package/lib/client/dashboard/WorktreeDashboard.js.map +1 -0
- package/lib/client/dashboard/WorktreeInstructions.d.ts +8 -0
- package/lib/client/dashboard/WorktreeInstructions.d.ts.map +1 -0
- package/lib/client/dashboard/WorktreeInstructions.js +53 -0
- package/lib/client/dashboard/WorktreeInstructions.js.map +1 -0
- package/lib/client/dashboard/dashboard-icon.d.ts +7 -0
- package/lib/client/dashboard/dashboard-icon.d.ts.map +1 -0
- package/lib/client/dashboard/dashboard-icon.js +6 -0
- package/lib/client/dashboard/dashboard-icon.js.map +1 -0
- package/lib/client/dashboard/dashboard-navigation.d.ts +35 -0
- package/lib/client/dashboard/dashboard-navigation.d.ts.map +1 -0
- package/lib/client/dashboard/dashboard-navigation.js +48 -0
- package/lib/client/dashboard/dashboard-navigation.js.map +1 -0
- package/lib/client/dashboard/dashboard-overlay.d.ts +16 -0
- package/lib/client/dashboard/dashboard-overlay.d.ts.map +1 -0
- package/lib/client/dashboard/dashboard-overlay.js +185 -0
- package/lib/client/dashboard/dashboard-overlay.js.map +1 -0
- package/lib/client/dashboard/dashboard-selection.d.ts +33 -0
- package/lib/client/dashboard/dashboard-selection.d.ts.map +1 -0
- package/lib/client/dashboard/dashboard-selection.js +31 -0
- package/lib/client/dashboard/dashboard-selection.js.map +1 -0
- package/lib/client/dashboard/dashboard-sessions.d.ts +6 -0
- package/lib/client/dashboard/dashboard-sessions.d.ts.map +1 -0
- package/lib/client/dashboard/dashboard-sessions.js +21 -0
- package/lib/client/dashboard/dashboard-sessions.js.map +1 -0
- package/lib/client/dashboard/git/GitChangedFiles.d.ts +11 -0
- package/lib/client/dashboard/git/GitChangedFiles.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitChangedFiles.js +101 -0
- package/lib/client/dashboard/git/GitChangedFiles.js.map +1 -0
- package/lib/client/dashboard/git/GitCommitList.d.ts +15 -0
- package/lib/client/dashboard/git/GitCommitList.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitCommitList.js +55 -0
- package/lib/client/dashboard/git/GitCommitList.js.map +1 -0
- package/lib/client/dashboard/git/GitDiffView.d.ts +10 -0
- package/lib/client/dashboard/git/GitDiffView.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitDiffView.js +65 -0
- package/lib/client/dashboard/git/GitDiffView.js.map +1 -0
- package/lib/client/dashboard/git/GitFileTypeIcon.d.ts +8 -0
- package/lib/client/dashboard/git/GitFileTypeIcon.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitFileTypeIcon.js +24 -0
- package/lib/client/dashboard/git/GitFileTypeIcon.js.map +1 -0
- package/lib/client/dashboard/git/GitLineStats.d.ts +10 -0
- package/lib/client/dashboard/git/GitLineStats.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitLineStats.js +9 -0
- package/lib/client/dashboard/git/GitLineStats.js.map +1 -0
- package/lib/client/dashboard/git/WorktreeGitOverview.d.ts +31 -0
- package/lib/client/dashboard/git/WorktreeGitOverview.d.ts.map +1 -0
- package/lib/client/dashboard/git/WorktreeGitOverview.js +89 -0
- package/lib/client/dashboard/git/WorktreeGitOverview.js.map +1 -0
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts +16 -0
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts.map +1 -0
- package/lib/client/dashboard/git/WorktreeGitPanel.js +126 -0
- package/lib/client/dashboard/git/WorktreeGitPanel.js.map +1 -0
- package/lib/client/dashboard/git/file-address.d.ts +2 -0
- package/lib/client/dashboard/git/file-address.d.ts.map +1 -0
- package/lib/client/dashboard/git/file-address.js +16 -0
- package/lib/client/dashboard/git/file-address.js.map +1 -0
- package/lib/client/dashboard/git/git-column-split.d.ts +34 -0
- package/lib/client/dashboard/git/git-column-split.d.ts.map +1 -0
- package/lib/client/dashboard/git/git-column-split.js +41 -0
- package/lib/client/dashboard/git/git-column-split.js.map +1 -0
- package/lib/client/dashboard/git/git-diff-parser.d.ts +24 -0
- package/lib/client/dashboard/git/git-diff-parser.d.ts.map +1 -0
- package/lib/client/dashboard/git/git-diff-parser.js +56 -0
- package/lib/client/dashboard/git/git-diff-parser.js.map +1 -0
- package/lib/client/dashboard/git/git-facts.d.ts +18 -0
- package/lib/client/dashboard/git/git-facts.d.ts.map +1 -0
- package/lib/client/dashboard/git/git-facts.js +31 -0
- package/lib/client/dashboard/git/git-facts.js.map +1 -0
- package/lib/client/dashboard/git/git-file-tree.d.ts +16 -0
- package/lib/client/dashboard/git/git-file-tree.d.ts.map +1 -0
- package/lib/client/dashboard/git/git-file-tree.js +52 -0
- package/lib/client/dashboard/git/git-file-tree.js.map +1 -0
- package/lib/client/dashboard/git/git-state-cache.d.ts +49 -0
- package/lib/client/dashboard/git/git-state-cache.d.ts.map +1 -0
- package/lib/client/dashboard/git/git-state-cache.js +80 -0
- package/lib/client/dashboard/git/git-state-cache.js.map +1 -0
- package/lib/client/dashboard/git/useGitPaneSplit.d.ts +33 -0
- package/lib/client/dashboard/git/useGitPaneSplit.d.ts.map +1 -0
- package/lib/client/dashboard/git/useGitPaneSplit.js +119 -0
- package/lib/client/dashboard/git/useGitPaneSplit.js.map +1 -0
- package/lib/client/dashboard/git/useWorktreeGitState.d.ts +60 -0
- package/lib/client/dashboard/git/useWorktreeGitState.d.ts.map +1 -0
- package/lib/client/dashboard/git/useWorktreeGitState.js +654 -0
- package/lib/client/dashboard/git/useWorktreeGitState.js.map +1 -0
- package/lib/client/dashboard/open-in-app-controller.d.ts +30 -0
- package/lib/client/dashboard/open-in-app-controller.d.ts.map +1 -0
- package/lib/client/dashboard/open-in-app-controller.js +94 -0
- package/lib/client/dashboard/open-in-app-controller.js.map +1 -0
- package/lib/client/dashboard/vscode-url.d.ts +3 -0
- package/lib/client/dashboard/vscode-url.d.ts.map +1 -0
- package/lib/client/dashboard/vscode-url.js +9 -0
- package/lib/client/dashboard/vscode-url.js.map +1 -0
- package/lib/client/dashboard/worktree-acquisition-facts.d.ts +16 -0
- package/lib/client/dashboard/worktree-acquisition-facts.d.ts.map +1 -0
- package/lib/client/dashboard/worktree-acquisition-facts.js +14 -0
- package/lib/client/dashboard/worktree-acquisition-facts.js.map +1 -0
- package/lib/client/dsh-slot-contract.d.ts +5 -0
- package/lib/client/dsh-slot-contract.d.ts.map +1 -1
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +93 -0
- package/lib/client/entry.js.map +1 -1
- package/lib/client/locales.d.ts +296 -0
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +296 -0
- package/lib/client/locales.js.map +1 -1
- package/lib/client/session/session-labels.d.ts +9 -0
- package/lib/client/session/session-labels.d.ts.map +1 -0
- package/lib/client/session/session-labels.js +44 -0
- package/lib/client/session/session-labels.js.map +1 -0
- package/lib/client/session/session-view.d.ts +10 -0
- package/lib/client/session/session-view.d.ts.map +1 -1
- package/lib/client/session/session-view.js +57 -0
- package/lib/client/session/session-view.js.map +1 -1
- package/lib/client/session/worktree-session-order.d.ts +2 -5
- package/lib/client/session/worktree-session-order.d.ts.map +1 -1
- package/lib/client/session/worktree-session-order.js +35 -10
- package/lib/client/session/worktree-session-order.js.map +1 -1
- package/lib/client/session/worktree-session-position.d.ts +2 -1
- package/lib/client/session/worktree-session-position.d.ts.map +1 -1
- package/lib/client/session/worktree-session-position.js +10 -3
- package/lib/client/session/worktree-session-position.js.map +1 -1
- package/lib/client/surface/actions/useDragActions.d.ts +33 -2
- package/lib/client/surface/actions/useDragActions.d.ts.map +1 -1
- package/lib/client/surface/actions/useDragActions.js +66 -18
- package/lib/client/surface/actions/useDragActions.js.map +1 -1
- package/lib/client/surface/components/ActiveWorktree.d.ts +1 -1
- package/lib/client/surface/components/ActiveWorktree.d.ts.map +1 -1
- package/lib/client/surface/components/ActiveWorktree.js +4 -3
- package/lib/client/surface/components/ActiveWorktree.js.map +1 -1
- package/lib/client/surface/components/ArchivedWorktree.d.ts +1 -1
- package/lib/client/surface/components/ArchivedWorktree.d.ts.map +1 -1
- package/lib/client/surface/components/ArchivedWorktree.js +4 -3
- package/lib/client/surface/components/ArchivedWorktree.js.map +1 -1
- package/lib/client/surface/components/ArchivedWorktrees.d.ts +1 -1
- package/lib/client/surface/components/ArchivedWorktrees.d.ts.map +1 -1
- package/lib/client/surface/components/ArchivedWorktrees.js +2 -2
- package/lib/client/surface/components/ArchivedWorktrees.js.map +1 -1
- package/lib/client/surface/components/SurfaceContent.d.ts +2 -2
- package/lib/client/surface/components/SurfaceContent.d.ts.map +1 -1
- package/lib/client/surface/components/SurfaceContent.js +1 -1
- package/lib/client/surface/components/SurfaceContent.js.map +1 -1
- package/lib/client/surface/components/SurfaceHeader.d.ts +1 -1
- package/lib/client/surface/components/SurfaceHeader.d.ts.map +1 -1
- package/lib/client/surface/components/SurfaceHeader.js +12 -3
- package/lib/client/surface/components/SurfaceHeader.js.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.d.ts +1 -1
- package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.js +9 -5
- package/lib/client/surface/components/WorkspaceTree.js.map +1 -1
- package/lib/client/surface/components/rows.d.ts +2 -2
- package/lib/client/surface/components/rows.d.ts.map +1 -1
- package/lib/client/surface/components/rows.js +111 -8
- package/lib/client/surface/components/rows.js.map +1 -1
- package/lib/client/surface/selectors.d.ts +10 -0
- package/lib/client/surface/selectors.d.ts.map +1 -1
- package/lib/client/surface/selectors.js +14 -0
- package/lib/client/surface/selectors.js.map +1 -1
- package/lib/client/surface/state/useSessionExpansion.d.ts +2 -1
- package/lib/client/surface/state/useSessionExpansion.d.ts.map +1 -1
- package/lib/client/surface/state/useSessionExpansion.js +26 -13
- package/lib/client/surface/state/useSessionExpansion.js.map +1 -1
- package/lib/client/surface/state/useSessionOrdering.d.ts +1 -1
- package/lib/client/surface/state/useSessionOrdering.d.ts.map +1 -1
- package/lib/client/surface/state/useSessionOrdering.js +23 -8
- package/lib/client/surface/state/useSessionOrdering.js.map +1 -1
- package/lib/client/surface/types.d.ts +23 -3
- package/lib/client/surface/types.d.ts.map +1 -1
- package/lib/client/view/WorktreeModeAction.d.ts.map +1 -1
- package/lib/client/view/WorktreeModeAction.js +8 -0
- package/lib/client/view/WorktreeModeAction.js.map +1 -1
- package/lib/client/view/view-mode-dispatch.d.ts +7 -0
- package/lib/client/view/view-mode-dispatch.d.ts.map +1 -0
- package/lib/client/view/view-mode-dispatch.js +11 -0
- package/lib/client/view/view-mode-dispatch.js.map +1 -0
- package/lib/client/view/worktree-expand-state.d.ts +1 -1
- package/lib/client/view/worktree-expand-state.d.ts.map +1 -1
- package/lib/client/view/worktree-expand-state.js +8 -1
- package/lib/client/view/worktree-expand-state.js.map +1 -1
- package/lib/client/worktree-connection.d.ts +5 -0
- package/lib/client/worktree-connection.d.ts.map +1 -1
- package/lib/client/worktree-connection.js +14 -0
- package/lib/client/worktree-connection.js.map +1 -1
- package/lib/client.js +4865 -158
- package/lib/client.js.map +1 -1
- package/lib/contract/index.contract.js +10 -0
- package/lib/contract/index.contract.js.map +1 -1
- package/lib/contract/index.d.ts +163 -1
- package/lib/contract/index.d.ts.map +1 -1
- package/lib/contract/index.js +19 -0
- package/lib/contract/index.js.map +1 -1
- package/lib/host/dsh-read-adapter.d.ts +3 -1
- package/lib/host/dsh-read-adapter.d.ts.map +1 -1
- package/lib/host/dsh-read-adapter.js +5 -2
- package/lib/host/dsh-read-adapter.js.map +1 -1
- package/lib/host/remote.d.ts.map +1 -1
- package/lib/host/remote.js +5 -0
- package/lib/host/remote.js.map +1 -1
- package/lib/host/service.d.ts +20 -1
- package/lib/host/service.d.ts.map +1 -1
- package/lib/host/service.js +32 -0
- package/lib/host/service.js.map +1 -1
- package/lib/host/worktree-instructions.d.ts +41 -0
- package/lib/host/worktree-instructions.d.ts.map +1 -0
- package/lib/host/worktree-instructions.js +65 -0
- package/lib/host/worktree-instructions.js.map +1 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/manage/manager-git-history.d.ts +17 -0
- package/lib/manage/manager-git-history.d.ts.map +1 -0
- package/lib/manage/manager-git-history.js +717 -0
- package/lib/manage/manager-git-history.js.map +1 -0
- package/lib/manage/manager-worktrees.d.ts.map +1 -1
- package/lib/manage/manager-worktrees.js +27 -0
- package/lib/manage/manager-worktrees.js.map +1 -1
- package/lib/manage/manager.d.ts +21 -1
- package/lib/manage/manager.d.ts.map +1 -1
- package/lib/manage/manager.js +60 -0
- package/lib/manage/manager.js.map +1 -1
- package/lib/manage/types.d.ts +1 -0
- package/lib/manage/types.d.ts.map +1 -1
- package/lib/provider/git/adapter.d.ts +54 -1
- package/lib/provider/git/adapter.d.ts.map +1 -1
- package/lib/provider/git/adapter.js +820 -1
- package/lib/provider/git/adapter.js.map +1 -1
- package/lib/provider/index.d.ts +2 -2
- package/lib/provider/index.d.ts.map +1 -1
- package/lib/provider/index.js +1 -1
- package/lib/provider/index.js.map +1 -1
- package/lib/provider/mutation-token.d.ts +1 -1
- package/lib/provider/mutation-token.d.ts.map +1 -1
- package/lib/provider/mutation-token.js +1 -0
- package/lib/provider/mutation-token.js.map +1 -1
- package/lib/provider/sidecar/repository.d.ts +1 -1
- package/lib/provider/sidecar/repository.d.ts.map +1 -1
- package/lib/provider/sidecar/repository.js +7 -2
- package/lib/provider/sidecar/repository.js.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.d.ts +16 -3
- package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.js +117 -28
- package/lib/provider/sidecar/sidecar-schema.js.map +1 -1
- package/lib/provider/transaction/operations/create.d.ts.map +1 -1
- package/lib/provider/transaction/operations/create.js +21 -6
- package/lib/provider/transaction/operations/create.js.map +1 -1
- package/lib/provider/transaction/operations/import.d.ts.map +1 -1
- package/lib/provider/transaction/operations/import.js +1 -0
- package/lib/provider/transaction/operations/import.js.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.js +11 -4
- package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -1
- package/lib/provider/transaction/recovery/recover.js +11 -11
- package/lib/provider/transaction/recovery/recover.js.map +1 -1
- package/lib/provider/transaction/support/inspection.d.ts +0 -2
- package/lib/provider/transaction/support/inspection.d.ts.map +1 -1
- package/lib/provider/transaction/support/inspection.js +0 -4
- package/lib/provider/transaction/support/inspection.js.map +1 -1
- package/lib/provider/transaction/support/journal.d.ts.map +1 -1
- package/lib/provider/transaction/support/journal.js +4 -0
- package/lib/provider/transaction/support/journal.js.map +1 -1
- package/lib/provider/transaction/types.d.ts +1 -0
- package/lib/provider/transaction/types.d.ts.map +1 -1
- package/lib/provider/types.d.ts +53 -5
- package/lib/provider/types.d.ts.map +1 -1
- package/lib/provider/types.js +1 -1
- package/lib/provider/types.js.map +1 -1
- package/lib/typert.host.js +349 -33
- package/lib/typert.remote-client.d.ts +11 -1
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +349 -33
- package/package.json +23 -20
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { WORKTREE_GIT_WORKING_TREE, isWorktreeGitCommit, } from '../../../contract/index.js';
|
|
2
|
+
export const MAX_FILE_CACHE = 8;
|
|
3
|
+
export const MAX_DIFF_CACHE = 24;
|
|
4
|
+
/** The summary selection for one working-tree inclusion mode. */
|
|
5
|
+
export function summarySelection(includeWorkingTree) {
|
|
6
|
+
return includeWorkingTree ? { kind: 'summary', includeWorkingTree: true } : { kind: 'summary' };
|
|
7
|
+
}
|
|
8
|
+
function targetKey(target) {
|
|
9
|
+
if (target.kind === 'commit')
|
|
10
|
+
return 'commit\u0000' + target.commit;
|
|
11
|
+
if (target.selection.kind === 'summary') {
|
|
12
|
+
return target.selection.includeWorkingTree === true ? 'summary\u0000working-tree' : 'summary';
|
|
13
|
+
}
|
|
14
|
+
return 'commits\u0000' + target.selection.commits.join('\u0000');
|
|
15
|
+
}
|
|
16
|
+
function historyProjectionKey(history) {
|
|
17
|
+
if (history.status !== 'ready')
|
|
18
|
+
return 'unknown';
|
|
19
|
+
return (history.value.baseline?.commit ?? 'unknown') + '\u0000' + (history.value.headCommit ?? 'unknown');
|
|
20
|
+
}
|
|
21
|
+
/** True when the target reads the live working tree and must not be cached. */
|
|
22
|
+
export function isLiveTarget(target) {
|
|
23
|
+
return target.kind === 'commit'
|
|
24
|
+
? target.commit === WORKTREE_GIT_WORKING_TREE
|
|
25
|
+
: target.selection.kind === 'summary' && target.selection.includeWorkingTree === true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Live-result markers complete a cache key. Matching on the marker rather than
|
|
29
|
+
* on a hand-written substring keeps key construction and invalidation aligned.
|
|
30
|
+
*/
|
|
31
|
+
const LIVE_KEY_MARKERS = [
|
|
32
|
+
'\u0000' + targetKey({ kind: 'commit', commit: WORKTREE_GIT_WORKING_TREE }),
|
|
33
|
+
'\u0000' + targetKey({ kind: 'selection', selection: summarySelection(true) }),
|
|
34
|
+
];
|
|
35
|
+
/** True when a file or diff cache key belongs to a live working-tree read. */
|
|
36
|
+
export function isLiveCacheKey(key) {
|
|
37
|
+
return LIVE_KEY_MARKERS.some((marker) => key.includes(marker));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Key token for a read that names no baseline branch and therefore asks the
|
|
41
|
+
* Manager to resolve the Worktree's captured acquisition commit. The leading NUL
|
|
42
|
+
* cannot appear in a local branch name, so the token can never collide with one.
|
|
43
|
+
*/
|
|
44
|
+
const CAPTURED_BASELINE_KEY = '\u0000captured';
|
|
45
|
+
function baselineKey(baseBranch) {
|
|
46
|
+
return baseBranch ?? CAPTURED_BASELINE_KEY;
|
|
47
|
+
}
|
|
48
|
+
export function gitCacheKey(baseBranch, history, target) {
|
|
49
|
+
return baselineKey(baseBranch) + '\u0000' + historyProjectionKey(history) + '\u0000' + targetKey(target);
|
|
50
|
+
}
|
|
51
|
+
export function diffCacheKey(baseBranch, history, target, filePath) {
|
|
52
|
+
return gitCacheKey(baseBranch, history, target) + '\u0000' + filePath;
|
|
53
|
+
}
|
|
54
|
+
/** Compare two targets by projection identity rather than object identity. */
|
|
55
|
+
export function sameTarget(left, right) {
|
|
56
|
+
return targetKey(left) === targetKey(right);
|
|
57
|
+
}
|
|
58
|
+
/** Drop the oldest entries until the cache respects its bound. */
|
|
59
|
+
export function trimCache(cache, maxSize) {
|
|
60
|
+
while (cache.size > maxSize) {
|
|
61
|
+
const oldest = cache.keys().next().value;
|
|
62
|
+
if (oldest === undefined)
|
|
63
|
+
return;
|
|
64
|
+
cache.delete(oldest);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Find the changed-file row for a new or previous path. */
|
|
68
|
+
export function fileForPath(files, selectedPath) {
|
|
69
|
+
return files.files.find((file) => file.path === selectedPath || file.oldPath === selectedPath);
|
|
70
|
+
}
|
|
71
|
+
/** Keep only SHAs that are still part of the current history projection. */
|
|
72
|
+
export function canonicalizeCommits(history, commits) {
|
|
73
|
+
if (history === undefined)
|
|
74
|
+
return [];
|
|
75
|
+
const requested = new Set(commits.filter((commit) => isWorktreeGitCommit(commit)));
|
|
76
|
+
return history.commits
|
|
77
|
+
.filter((commit) => commit.sha !== WORKTREE_GIT_WORKING_TREE && requested.has(commit.sha))
|
|
78
|
+
.map((commit) => commit.sha);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=git-state-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-state-cache.js","sourceRoot":"","sources":["../../../../src/client/dashboard/git/git-state-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,mBAAmB,GAKpB,MAAM,4BAA4B,CAAC;AAwBpC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAC9B,kBAA2B;IAE3B,OAAO,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAClG,CAAC;AAED,SAAS,SAAS,CAAC,MAAiB;IAClC,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,cAAc,GAA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AC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,OAAO,KAAK,YAAY,CAAC,CAAC;AACjG,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CACjC,OAAuC,EACvC,OAA0B;IAE1B,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACnF,OAAO,OAAO,CAAC,OAAO;SACnB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,yBAAyB,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACzF,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { KeyboardEvent as ReactKeyboardEvent, MutableRefObject, PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
export type GitSplitOrientation = 'horizontal' | 'vertical';
|
|
3
|
+
export interface GitPaneSplitOptions {
|
|
4
|
+
/** The grid that holds both panes and the divider. */
|
|
5
|
+
readonly containerRef: MutableRefObject<HTMLDivElement | null>;
|
|
6
|
+
/** `horizontal` splits rows by height, `vertical` splits columns by width. */
|
|
7
|
+
readonly orientation: GitSplitOrientation;
|
|
8
|
+
/** CSS custom property on the container that carries the leading-pane share. */
|
|
9
|
+
readonly property: string;
|
|
10
|
+
/** Smallest pane size along the axis, in CSS pixels. */
|
|
11
|
+
readonly minimum: number;
|
|
12
|
+
/** Default share used before the first drag. */
|
|
13
|
+
readonly fallback: number;
|
|
14
|
+
}
|
|
15
|
+
export interface GitPaneSplit {
|
|
16
|
+
/** Attach to the draggable divider between both panes. */
|
|
17
|
+
readonly splitterRef: MutableRefObject<HTMLDivElement | null>;
|
|
18
|
+
/** Leading-pane share along this axis, in percent. */
|
|
19
|
+
readonly percent: number;
|
|
20
|
+
readonly dragging: boolean;
|
|
21
|
+
readonly startDrag: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
22
|
+
readonly drag: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
23
|
+
readonly endDrag: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
24
|
+
readonly onKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => void;
|
|
25
|
+
readonly reset: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resize one grid axis with a pointer or the keyboard. The dragging frame writes
|
|
29
|
+
* straight to the DOM custom property, so heavy commit and file lists never
|
|
30
|
+
* re-render per pointer move; React state commits once per gesture.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useGitPaneSplit(options: GitPaneSplitOptions): GitPaneSplit;
|
|
33
|
+
//# sourceMappingURL=useGitPaneSplit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGitPaneSplit.d.ts","sourceRoot":"","sources":["../../../../src/client/dashboard/git/useGitPaneSplit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,IAAI,kBAAkB,EACnC,gBAAgB,EAChB,YAAY,IAAI,iBAAiB,EAClC,MAAM,OAAO,CAAC;AAUf,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,UAAU,CAAC;AAQ5D,MAAM,WAAW,mBAAmB;IAClC,sDAAsD;IACtD,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/D,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9D,sDAAsD;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACvE,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAyH1E"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { GIT_SPLIT_KEY_STEP, clampGitSplitPercent, gitSplitPercentFromPointer } from './git-column-split.js';
|
|
3
|
+
/**
|
|
4
|
+
* Remembers every divider position for the rest of the browser session, so
|
|
5
|
+
* closing and reopening the Git tab keeps the split the user dragged to.
|
|
6
|
+
*/
|
|
7
|
+
const rememberedPercents = new Map();
|
|
8
|
+
/** Arrow keys that move a leading pane forward or backward along one axis. */
|
|
9
|
+
const KEY_DIRECTIONS = {
|
|
10
|
+
horizontal: { ArrowUp: -1, ArrowDown: 1 },
|
|
11
|
+
vertical: { ArrowLeft: -1, ArrowRight: 1 },
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Resize one grid axis with a pointer or the keyboard. The dragging frame writes
|
|
15
|
+
* straight to the DOM custom property, so heavy commit and file lists never
|
|
16
|
+
* re-render per pointer move; React state commits once per gesture.
|
|
17
|
+
*/
|
|
18
|
+
export function useGitPaneSplit(options) {
|
|
19
|
+
const { containerRef, orientation, property, minimum, fallback } = options;
|
|
20
|
+
const splitterRef = useRef(null);
|
|
21
|
+
const [percent, setPercent] = useState(() => rememberedPercents.get(property) ?? fallback);
|
|
22
|
+
const [dragging, setDragging] = useState(false);
|
|
23
|
+
const percentRef = useRef(percent);
|
|
24
|
+
const geometryRef = useRef(undefined);
|
|
25
|
+
const draggingRef = useRef(false);
|
|
26
|
+
const applyPercent = useCallback((next) => {
|
|
27
|
+
percentRef.current = next;
|
|
28
|
+
containerRef.current?.style.setProperty(property, next + '%');
|
|
29
|
+
splitterRef.current?.setAttribute('aria-valuenow', String(Math.round(next)));
|
|
30
|
+
}, [containerRef, property]);
|
|
31
|
+
const commitPercent = useCallback((next) => {
|
|
32
|
+
applyPercent(next);
|
|
33
|
+
rememberedPercents.set(property, next);
|
|
34
|
+
setPercent(next);
|
|
35
|
+
}, [applyPercent, property]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
applyPercent(percent);
|
|
38
|
+
rememberedPercents.set(property, percent);
|
|
39
|
+
}, [applyPercent, percent, property]);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!dragging)
|
|
42
|
+
return undefined;
|
|
43
|
+
// Keep the resize cursor and suppress selection while the pointer is captured.
|
|
44
|
+
const previousCursor = document.body.style.cursor;
|
|
45
|
+
const previousUserSelect = document.body.style.userSelect;
|
|
46
|
+
document.body.style.cursor = orientation === 'horizontal' ? 'row-resize' : 'col-resize';
|
|
47
|
+
document.body.style.userSelect = 'none';
|
|
48
|
+
return () => {
|
|
49
|
+
document.body.style.cursor = previousCursor;
|
|
50
|
+
document.body.style.userSelect = previousUserSelect;
|
|
51
|
+
};
|
|
52
|
+
}, [dragging, orientation]);
|
|
53
|
+
const measure = useCallback(() => {
|
|
54
|
+
const container = containerRef.current;
|
|
55
|
+
const splitter = splitterRef.current;
|
|
56
|
+
if (container === null || splitter === null)
|
|
57
|
+
return undefined;
|
|
58
|
+
const containerRect = container.getBoundingClientRect();
|
|
59
|
+
const splitterRect = splitter.getBoundingClientRect();
|
|
60
|
+
return orientation === 'horizontal'
|
|
61
|
+
? { start: containerRect.top, size: containerRect.height, divider: splitterRect.height, minimum }
|
|
62
|
+
: { start: containerRect.left, size: containerRect.width, divider: splitterRect.width, minimum };
|
|
63
|
+
}, [containerRef, minimum, orientation]);
|
|
64
|
+
const startDrag = useCallback((event) => {
|
|
65
|
+
if (event.button !== 0)
|
|
66
|
+
return;
|
|
67
|
+
const geometry = measure();
|
|
68
|
+
if (geometry === undefined)
|
|
69
|
+
return;
|
|
70
|
+
geometryRef.current = geometry;
|
|
71
|
+
draggingRef.current = true;
|
|
72
|
+
setDragging(true);
|
|
73
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
// preventDefault suppresses the default focus; keep the divider keyboard-reachable.
|
|
76
|
+
event.currentTarget.focus({ preventScroll: true });
|
|
77
|
+
}, [measure]);
|
|
78
|
+
const drag = useCallback((event) => {
|
|
79
|
+
const geometry = geometryRef.current;
|
|
80
|
+
if (!draggingRef.current || geometry === undefined)
|
|
81
|
+
return;
|
|
82
|
+
const pointer = orientation === 'horizontal' ? event.clientY : event.clientX;
|
|
83
|
+
const next = gitSplitPercentFromPointer(pointer, geometry);
|
|
84
|
+
if (next !== undefined)
|
|
85
|
+
applyPercent(next);
|
|
86
|
+
}, [applyPercent, orientation]);
|
|
87
|
+
const endDrag = useCallback((event) => {
|
|
88
|
+
if (!draggingRef.current)
|
|
89
|
+
return;
|
|
90
|
+
draggingRef.current = false;
|
|
91
|
+
geometryRef.current = undefined;
|
|
92
|
+
setDragging(false);
|
|
93
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
94
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
95
|
+
}
|
|
96
|
+
const geometry = measure();
|
|
97
|
+
commitPercent(geometry === undefined
|
|
98
|
+
? percentRef.current
|
|
99
|
+
: clampGitSplitPercent(percentRef.current, geometry) ?? percentRef.current);
|
|
100
|
+
}, [commitPercent, measure]);
|
|
101
|
+
const onKeyDown = useCallback((event) => {
|
|
102
|
+
const direction = KEY_DIRECTIONS[orientation][event.key];
|
|
103
|
+
if (direction === undefined)
|
|
104
|
+
return;
|
|
105
|
+
const geometry = measure();
|
|
106
|
+
if (geometry === undefined)
|
|
107
|
+
return;
|
|
108
|
+
event.preventDefault();
|
|
109
|
+
const step = GIT_SPLIT_KEY_STEP * (event.shiftKey ? 4 : 1);
|
|
110
|
+
const next = clampGitSplitPercent(percentRef.current + direction * step, geometry);
|
|
111
|
+
if (next !== undefined)
|
|
112
|
+
commitPercent(next);
|
|
113
|
+
}, [commitPercent, measure, orientation]);
|
|
114
|
+
const reset = useCallback(() => {
|
|
115
|
+
commitPercent(fallback);
|
|
116
|
+
}, [commitPercent, fallback]);
|
|
117
|
+
return { splitterRef, percent, dragging, startDrag, drag, endDrag, onKeyDown, reset };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=useGitPaneSplit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGitPaneSplit.js","sourceRoot":"","sources":["../../../../src/client/dashboard/git/useGitPaneSplit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMjE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAG7G;;;GAGG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAIrD,8EAA8E;AA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AG,cAAc,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO;QACpC,MAAM,QAAQ,GAAG,OAAO,EAAE,CAAC;QAC3B,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO;QACnC,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,kBAAkB,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,IAAI,GAAG,oBAAoB,CAAC,UAAU,CAAC,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnF,IAAI,IAAI,KAAK,SAAS;YAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC,EACD,CAAC,aAAa,EAAE,OAAO,EAAE,WAAW,CAAC,CACtC,CAAC;IAEF,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;QAC7B,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE9B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BranchRecord, WorktreeGitCommitFiles, WorktreeGitFileDiff, WorktreeGitHistory, WorktreeManager } from '../../../contract/index.js';
|
|
2
|
+
import type { GitLoadable } from './git-state-cache.js';
|
|
3
|
+
export type { GitLoadable } from './git-state-cache.js';
|
|
4
|
+
export type WorktreeGitView = 'commits' | 'summary';
|
|
5
|
+
export interface WorktreeGitState {
|
|
6
|
+
readonly branches: GitLoadable<readonly BranchRecord[]>;
|
|
7
|
+
/** The currently selected local branch; undefined keeps the Git tab unselected. */
|
|
8
|
+
readonly baselineBranch?: string;
|
|
9
|
+
readonly history: GitLoadable<WorktreeGitHistory>;
|
|
10
|
+
readonly view: WorktreeGitView;
|
|
11
|
+
/** Whether the summary target includes the live working tree. */
|
|
12
|
+
readonly includeWorkingTree: boolean;
|
|
13
|
+
/** The focused/primary commit; aggregate selections are in selectedCommits. */
|
|
14
|
+
readonly selectedCommit?: string;
|
|
15
|
+
/** Selected committed SHAs; the live working tree is intentionally excluded. */
|
|
16
|
+
readonly selectedCommits: readonly string[];
|
|
17
|
+
/** Whether picking a commit adds to the selection instead of replacing it. */
|
|
18
|
+
readonly commitMultiSelect: boolean;
|
|
19
|
+
readonly files: GitLoadable<WorktreeGitCommitFiles>;
|
|
20
|
+
readonly selectedPath?: string;
|
|
21
|
+
readonly diff: GitLoadable<WorktreeGitFileDiff>;
|
|
22
|
+
}
|
|
23
|
+
export interface WorktreeGitStateController {
|
|
24
|
+
readonly getSnapshot: () => WorktreeGitState;
|
|
25
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
26
|
+
readonly loadBranches: () => Promise<void>;
|
|
27
|
+
readonly loadHistory: () => Promise<void>;
|
|
28
|
+
readonly refresh: () => Promise<void>;
|
|
29
|
+
readonly selectBaselineBranch: (branch: string | undefined) => void;
|
|
30
|
+
readonly selectView: (view: WorktreeGitView) => void;
|
|
31
|
+
readonly selectSummary: () => void;
|
|
32
|
+
readonly setIncludeWorkingTree: (include: boolean) => void;
|
|
33
|
+
readonly selectCommit: (commit: string) => void;
|
|
34
|
+
readonly toggleCommit: (commit: string) => void;
|
|
35
|
+
readonly setCommitMultiSelect: (enabled: boolean) => void;
|
|
36
|
+
readonly clearCommitSelection: () => void;
|
|
37
|
+
readonly selectPath: (path: string) => void;
|
|
38
|
+
readonly dispose: () => void;
|
|
39
|
+
}
|
|
40
|
+
interface ControllerInput {
|
|
41
|
+
readonly manager?: Pick<WorktreeManager, 'listBranches' | 'listWorktreeCommits' | 'listWorktreeCommitFiles' | 'getWorktreeCommitFileDiff'>;
|
|
42
|
+
readonly workspaceId: string;
|
|
43
|
+
readonly worktreeId: string;
|
|
44
|
+
readonly defaultBaselineBranch?: string;
|
|
45
|
+
/**
|
|
46
|
+
* True when the Worktree record carries a captured acquisition commit the
|
|
47
|
+
* Manager resolves as the implicit baseline. It lets the Git tab read the
|
|
48
|
+
* captured baseline instead of staying blank until a branch is picked.
|
|
49
|
+
*/
|
|
50
|
+
readonly capturedBaseline?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create the browser-safe Git Dashboard state machine. Construction is inert;
|
|
54
|
+
* the caller explicitly starts history loading on first Git-tab activation.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createWorktreeGitStateController(input: ControllerInput): WorktreeGitStateController;
|
|
57
|
+
export type UseWorktreeGitStateInput = ControllerInput;
|
|
58
|
+
/** React adapter; the first Git history request starts in the mount effect. */
|
|
59
|
+
export declare function useWorktreeGitState(input: UseWorktreeGitStateInput): WorktreeGitState & Omit<WorktreeGitStateController, 'getSnapshot' | 'subscribe'>;
|
|
60
|
+
//# sourceMappingURL=useWorktreeGitState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWorktreeGitState.d.ts","sourceRoot":"","sources":["../../../../src/client/dashboard/git/useWorktreeGitState.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAepC,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,sBAAsB,CAAC;AAEnE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,SAAS,YAAY,EAAE,CAAC,CAAC;IACxD,mFAAmF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