@mrpatronz/nexusflow 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/agent/AcpCliAdapter.d.ts +75 -0
- package/dist/agent/AcpCliAdapter.d.ts.map +1 -0
- package/dist/agent/AcpCliAdapter.js +292 -0
- package/dist/agent/AcpCliAdapter.js.map +1 -0
- package/dist/agent/AcpCliAdapter.test.d.ts +2 -0
- package/dist/agent/AcpCliAdapter.test.d.ts.map +1 -0
- package/dist/agent/AcpCliAdapter.test.js +235 -0
- package/dist/agent/AcpCliAdapter.test.js.map +1 -0
- package/dist/agent/ClaudeCliAdapter.d.ts +40 -5
- package/dist/agent/ClaudeCliAdapter.d.ts.map +1 -1
- package/dist/agent/ClaudeCliAdapter.js +212 -15
- package/dist/agent/ClaudeCliAdapter.js.map +1 -1
- package/dist/agent/ClaudeCliAdapter.test.d.ts +2 -0
- package/dist/agent/ClaudeCliAdapter.test.d.ts.map +1 -0
- package/dist/agent/ClaudeCliAdapter.test.js +320 -0
- package/dist/agent/ClaudeCliAdapter.test.js.map +1 -0
- package/dist/agent/CliAdapterBase.d.ts +29 -12
- package/dist/agent/CliAdapterBase.d.ts.map +1 -1
- package/dist/agent/CliAdapterBase.js +76 -36
- package/dist/agent/CliAdapterBase.js.map +1 -1
- package/dist/agent/CodexCliAdapter.d.ts +51 -0
- package/dist/agent/CodexCliAdapter.d.ts.map +1 -0
- package/dist/agent/CodexCliAdapter.js +226 -0
- package/dist/agent/CodexCliAdapter.js.map +1 -0
- package/dist/agent/CodexCliAdapter.test.d.ts +2 -0
- package/dist/agent/CodexCliAdapter.test.d.ts.map +1 -0
- package/dist/agent/CodexCliAdapter.test.js +316 -0
- package/dist/agent/CodexCliAdapter.test.js.map +1 -0
- package/dist/agent/CopilotAcpAdapter.d.ts +7 -0
- package/dist/agent/CopilotAcpAdapter.d.ts.map +1 -0
- package/dist/agent/CopilotAcpAdapter.js +29 -0
- package/dist/agent/CopilotAcpAdapter.js.map +1 -0
- package/dist/agent/ProviderRegistry.d.ts +39 -3
- package/dist/agent/ProviderRegistry.d.ts.map +1 -1
- package/dist/agent/ProviderRegistry.js +43 -8
- package/dist/agent/ProviderRegistry.js.map +1 -1
- package/dist/agent/ProviderRegistry.test.js +52 -0
- package/dist/agent/ProviderRegistry.test.js.map +1 -1
- package/dist/agent/adapters.d.ts +7 -5
- package/dist/agent/adapters.d.ts.map +1 -1
- package/dist/agent/adapters.js +92 -17
- package/dist/agent/adapters.js.map +1 -1
- package/dist/agent/adapters.test.js +22 -0
- package/dist/agent/adapters.test.js.map +1 -1
- package/dist/agent/cliAvailability.d.ts +51 -13
- package/dist/agent/cliAvailability.d.ts.map +1 -1
- package/dist/agent/cliAvailability.js +163 -44
- package/dist/agent/cliAvailability.js.map +1 -1
- package/dist/agent/cliAvailability.test.js +140 -53
- package/dist/agent/cliAvailability.test.js.map +1 -1
- package/dist/agent/session.d.ts +2 -1
- package/dist/agent/session.d.ts.map +1 -1
- package/dist/agent/session.js +15 -4
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/session.test.js +29 -8
- package/dist/agent/session.test.js.map +1 -1
- package/dist/gui/assets/DashboardPage-BeAHHUtn.js +1 -0
- package/dist/gui/assets/GettingStartedPage-CFAyG0ar.js +1 -0
- package/dist/gui/assets/ProjectsPage-C0SmbBqW.js +1 -0
- package/dist/gui/assets/{ScaffoldRepoInline-D-2ZeuDK.js → ScaffoldRepoInline-lfFwOnQu.js} +1 -1
- package/dist/gui/assets/SettingsPage-DIBk9fu8.js +1 -0
- package/dist/gui/assets/StartWorkPage-CWC5OujI.js +1 -0
- package/dist/gui/assets/{StrategiesPage-Cizm0GWk.js → StrategiesPage-Dcq10WZS.js} +2 -2
- package/dist/gui/assets/WorkspacesPage-BqOx6Gbe.js +6 -0
- package/dist/gui/assets/index-B5IYXvr6.css +2 -0
- package/dist/gui/assets/{index-BqeoAIB1.js → index-BCfJkb0T.js} +3 -3
- package/dist/gui/index.html +2 -2
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +153 -21
- package/dist/server.js.map +1 -1
- package/dist/server.test.js +143 -1
- package/dist/server.test.js.map +1 -1
- package/dist/utils/session-finder.d.ts +3 -0
- package/dist/utils/session-finder.d.ts.map +1 -1
- package/dist/utils/session-finder.js +54 -10
- package/dist/utils/session-finder.js.map +1 -1
- package/dist/utils/session-finder.test.js +61 -2
- package/dist/utils/session-finder.test.js.map +1 -1
- package/package.json +4 -2
- package/dist/gui/assets/DashboardPage-HNC3-OP0.js +0 -1
- package/dist/gui/assets/GettingStartedPage-Dguoya_Z.js +0 -1
- package/dist/gui/assets/ProjectsPage-DVR4j4sw.js +0 -1
- package/dist/gui/assets/SettingsPage-Bauo77q3.js +0 -1
- package/dist/gui/assets/StartWorkPage-DvuFEa5Y.js +0 -1
- package/dist/gui/assets/WorkspacesPage-DYOVfZqy.js +0 -6
- package/dist/gui/assets/index-CsA2SueF.css +0 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import
|
|
1
|
+
import { afterEach, beforeEach, describe, it, expect } from 'vitest';
|
|
2
|
+
import * as fs from 'node:fs/promises';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
import { getClaudeProjectFolderName, isNoiseUserRecord, claudeRecordText, codexMessageText, codexSessionId, isCodexSessionId, isInjectedContextText, getSessionTranscript } from './session-finder.js';
|
|
3
6
|
describe('getClaudeProjectFolderName', () => {
|
|
4
7
|
it('matches Claude Code encoding for a Windows path (colon, backslash, dot, underscore)', () => {
|
|
5
8
|
expect(getClaudeProjectFolderName('C:\\Users\\anton.patron\\Git\\workspaces\\improve_las'))
|
|
@@ -52,6 +55,62 @@ describe('codexMessageText', () => {
|
|
|
52
55
|
expect(codexMessageText({ content: 'plain' })).toBe('plain');
|
|
53
56
|
});
|
|
54
57
|
});
|
|
58
|
+
describe('codexSessionId', () => {
|
|
59
|
+
it('uses session_meta.payload.id instead of the timestamped rollout filename', () => {
|
|
60
|
+
expect(codexSessionId({
|
|
61
|
+
type: 'session_meta',
|
|
62
|
+
payload: { id: '0199a213-81c0-7800-8aa1-bbab2a035a53', cwd: '/repo' },
|
|
63
|
+
})).toBe('0199a213-81c0-7800-8aa1-bbab2a035a53');
|
|
64
|
+
});
|
|
65
|
+
it('ignores unrelated or empty records', () => {
|
|
66
|
+
expect(codexSessionId({ type: 'turn_context', payload: { id: 'wrong' } })).toBeNull();
|
|
67
|
+
expect(codexSessionId({ type: 'session_meta', payload: { id: '' } })).toBeNull();
|
|
68
|
+
expect(codexSessionId({ type: 'session_meta', payload: { id: 'thread-name' } })).toBeNull();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('isCodexSessionId', () => {
|
|
72
|
+
it('accepts only complete UUIDs', () => {
|
|
73
|
+
expect(isCodexSessionId('0199a213-81c0-7800-8aa1-bbab2a035a53')).toBe(true);
|
|
74
|
+
expect(isCodexSessionId('53')).toBe(false);
|
|
75
|
+
expect(isCodexSessionId('0199a213-81c0-7800-8aa1-bbab2a035a53; whoami')).toBe(false);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('Codex transcript identity', () => {
|
|
79
|
+
const targetId = '0199a213-81c0-7800-8aa1-bbab2a035a53';
|
|
80
|
+
const otherId = '0199a213-81c0-7800-8aa1-bbab2a035a54';
|
|
81
|
+
let codexHome = '';
|
|
82
|
+
let previousCodexHome;
|
|
83
|
+
beforeEach(async () => {
|
|
84
|
+
previousCodexHome = process.env.CODEX_HOME;
|
|
85
|
+
codexHome = await fs.mkdtemp(path.join(os.tmpdir(), 'nexusflow-codex-sessions-'));
|
|
86
|
+
process.env.CODEX_HOME = codexHome;
|
|
87
|
+
await fs.mkdir(path.join(codexHome, 'sessions'), { recursive: true });
|
|
88
|
+
});
|
|
89
|
+
afterEach(async () => {
|
|
90
|
+
if (previousCodexHome === undefined)
|
|
91
|
+
delete process.env.CODEX_HOME;
|
|
92
|
+
else
|
|
93
|
+
process.env.CODEX_HOME = previousCodexHome;
|
|
94
|
+
await fs.rm(codexHome, { recursive: true, force: true });
|
|
95
|
+
});
|
|
96
|
+
it('verifies session_meta even when another rollout filename has the requested suffix', async () => {
|
|
97
|
+
const sessionsDir = path.join(codexHome, 'sessions');
|
|
98
|
+
await fs.writeFile(path.join(sessionsDir, `rollout-timestamp-${targetId}.jsonl`), [
|
|
99
|
+
JSON.stringify({ type: 'session_meta', payload: { id: otherId } }),
|
|
100
|
+
JSON.stringify({ type: 'response_item', payload: { type: 'message', role: 'assistant', content: 'wrong' } }),
|
|
101
|
+
].join('\n'));
|
|
102
|
+
await fs.writeFile(path.join(sessionsDir, 'renamed-rollout.jsonl'), [
|
|
103
|
+
JSON.stringify({ type: 'session_meta', payload: { id: targetId } }),
|
|
104
|
+
JSON.stringify({ type: 'response_item', payload: { type: 'message', role: 'assistant', content: 'correct' } }),
|
|
105
|
+
].join('\n'));
|
|
106
|
+
await expect(getSessionTranscript('codex', targetId)).resolves.toEqual([
|
|
107
|
+
{ role: 'assistant', content: 'correct', timestamp: undefined },
|
|
108
|
+
]);
|
|
109
|
+
});
|
|
110
|
+
it('rejects partial or attacker-controlled ids before scanning files', async () => {
|
|
111
|
+
await expect(getSessionTranscript('codex', '53')).rejects.toThrow(/Invalid Codex session id/);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
55
114
|
describe('isInjectedContextText', () => {
|
|
56
115
|
it('flags Codex and Copilot injected context', () => {
|
|
57
116
|
expect(isInjectedContextText('<environment_context>\n <cwd>...')).toBe(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-finder.test.js","sourceRoot":"","sources":["../../src/utils/session-finder.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"session-finder.test.js","sourceRoot":"","sources":["../../src/utils/session-finder.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEvM,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE;QAC7F,MAAM,CAAC,0BAA0B,CAAC,uDAAuD,CAAC,CAAC;aACxF,IAAI,CAAC,kDAAkD,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACrE,iFAAiF;QACjF,MAAM,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,0BAA0B,CAAC,uBAAuB,CAAC,CAAC;aACxD,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,QAAa,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAEvG,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,mCAAmC,CAAC,EAAE,mCAAmC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnH,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,oCAAoC,CAAC,EAAE,oCAAoC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrH,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,mDAAmD,CAAC,EAAE,mDAAmD,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,iCAAiC,CAAC,EAAE,iCAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7H,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aAClJ,IAAI,CAAC,aAAa,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,MAAM,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,CAAC,cAAc,CAAC;YACpB,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE,GAAG,EAAE,OAAO,EAAE;SACtE,CAAC,CAAC,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACtF,MAAM,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjF,MAAM,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,gBAAgB,CAAC,sCAAsC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5E,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,CAAC,gBAAgB,CAAC,8CAA8C,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,MAAM,QAAQ,GAAG,sCAAsC,CAAC;IACxD,MAAM,OAAO,GAAG,sCAAsC,CAAC;IACvD,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,iBAAqC,CAAC;IAE1C,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;QAC3C,SAAS,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,2BAA2B,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC;QACnC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAI,iBAAiB,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;;YAC9D,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,iBAAiB,CAAC;QAChD,MAAM,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mFAAmF,EAAE,KAAK,IAAI,EAAE;QACjG,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACrD,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,qBAAqB,QAAQ,QAAQ,CAAC,EAC7D;YACE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;YAClE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;SAC7G,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QACF,MAAM,EAAE,CAAC,SAAS,CAChB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAC/C;YACE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC;YACnE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC;SAC/G,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAEF,MAAM,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YACrE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE;SAChE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,KAAK,IAAI,EAAE;QAChF,MAAM,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,qBAAqB,CAAC,mCAAmC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9E,MAAM,CAAC,qBAAqB,CAAC,6CAA6C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxF,MAAM,CAAC,qBAAqB,CAAC,uCAAuC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,qBAAqB,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrpatronz/nexusflow",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Combine multiple repos into a workspace with rich AI assistant context",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"author": "",
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"dependencies": {
|
|
50
|
+
"@agentclientprotocol/sdk": "1.3.0",
|
|
50
51
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
51
52
|
"@google/genai": "^2.10.0",
|
|
52
53
|
"@hono/node-server": "^2.0.8",
|
|
@@ -61,7 +62,8 @@
|
|
|
61
62
|
"hono": "^4.12.27",
|
|
62
63
|
"openai": "^6.45.0",
|
|
63
64
|
"ora": "^9.4.1",
|
|
64
|
-
"pm2": "^7.0.3"
|
|
65
|
+
"pm2": "^7.0.3",
|
|
66
|
+
"zod": "^4.4.3"
|
|
65
67
|
},
|
|
66
68
|
"overrides": {
|
|
67
69
|
"@hono/node-ws": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./git-branch-Dw55pQWa.js";import{Z as r,ct as i,et as a,n as o,nt as s,r as c,rt as l,tt as u}from"./index-BqeoAIB1.js";import{n as d,t as f}from"./card-82INhRRE.js";import{a as p,i as m,n as h,r as g,t as _}from"./empty-DWyDwDYB.js";import{t as v}from"./skeleton-CCPbfn1L.js";var y=e();function b({icon:e,label:t,value:n,tone:r}){return(0,y.jsxs)(d,{className:`gap-3.5 p-4`,children:[(0,y.jsx)(`div`,{className:`grid h-9 w-9 shrink-0 place-items-center rounded-md ${r}`,children:e}),(0,y.jsxs)(`div`,{className:`min-w-0`,children:[(0,y.jsx)(`div`,{className:`text-xl font-bold leading-none text-foreground`,children:n}),(0,y.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:t})]})]})}function x({workspaces:e,workspaceStatuses:x,workspacesLoading:S,statusesLoading:C,onOpenWorkspace:w,onNewWorkspace:T}){let E=Object.values(x),D=E.filter(e=>e.changedFiles>0).length,O=E.reduce((e,t)=>e+t.runningServices,0),k=E.filter(e=>e.pendingValidation).length;return(0,y.jsxs)(`div`,{className:`mx-auto max-w-6xl animate-fade-in`,children:[(0,y.jsxs)(`header`,{className:`mb-6`,children:[(0,y.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Overview`}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Your multi-repo environment at a glance.`})]}),(0,y.jsxs)(`div`,{className:`mb-8 grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[(0,y.jsx)(b,{icon:(0,y.jsx)(l,{size:18,className:`text-primary`}),tone:`bg-primary/10`,label:`Workspaces`,value:e.length}),(0,y.jsx)(b,{icon:(0,y.jsx)(n,{size:18,className:`text-warning`}),tone:`bg-warning/10`,label:`With uncommitted changes`,value:D}),(0,y.jsx)(b,{icon:(0,y.jsx)(s,{size:18,className:`text-running`}),tone:`bg-running/10`,label:`Running services`,value:O}),(0,y.jsx)(b,{icon:(0,y.jsx)(r,{size:18,className:`text-warning`}),tone:`bg-warning/10`,label:`Need validation`,value:k})]}),(0,y.jsx)(`div`,{className:`mb-3 flex items-center justify-between`,children:(0,y.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-muted-foreground`,children:`Workspaces`})}),S?(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(v,{className:`h-20`}),(0,y.jsx)(v,{className:`h-20`}),(0,y.jsx)(v,{className:`h-20`})]}):e.length===0?(0,y.jsx)(f,{className:`border-dashed`,children:(0,y.jsxs)(_,{children:[(0,y.jsxs)(g,{children:[(0,y.jsx)(m,{variant:`icon`,children:(0,y.jsx)(l,{})}),(0,y.jsx)(p,{children:`No workspaces yet`}),(0,y.jsx)(h,{children:`Create a feature workspace to group repositories and give your AI assistants shared context.`})]}),(0,y.jsxs)(t,{onClick:T,children:[(0,y.jsx)(u,{size:16}),` New workspace`]})]})}):(0,y.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>{let t=x[e.branchName],n=t?o(t.syncStatus):null;return(0,y.jsxs)(d,{className:`group cursor-pointer gap-4 p-4 transition-colors hover:border-foreground/15 hover:bg-accent/50`,onClick:()=>w(e.branchName),children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-foreground`,children:e.branchName}),(0,y.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[e.repos.length,` repos`]})]}),e.description&&(0,y.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description})]}),(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[!t&&C?(0,y.jsx)(v,{className:`h-5 w-40`}):t?(0,y.jsxs)(y.Fragment,{children:[t.changedFiles>0?(0,y.jsxs)(c,{tone:`warning`,dot:!0,children:[t.changedFiles,` changed`]}):(0,y.jsx)(c,{tone:`idle`,dot:!0,children:`Clean`}),t.runningServices>0&&(0,y.jsxs)(c,{tone:`running`,dot:!0,children:[t.runningServices,` running`]}),n&&(0,y.jsxs)(c,{tone:n.tone,children:[(0,y.jsx)(a,{size:11}),` `,n.label]})]}):null,(0,y.jsx)(i,{size:16,className:`text-muted-foreground transition-transform group-hover:translate-x-0.5 group-hover:text-foreground`})]})]},e.id)})})]})}export{x as DashboardPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e,t}from"./button-cPldH5S4.js";import{t as n}from"./circle-plus-C0PNc7h4.js";import{$ as r}from"./index-BqeoAIB1.js";var i=e();function a({config:e,onCreateWorkspace:a,onModifySettings:o}){return(0,i.jsxs)(`div`,{className:`max-w-4xl mx-auto animate-fade-in`,children:[(0,i.jsxs)(`header`,{className:`mb-10`,children:[(0,i.jsx)(`div`,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/10 text-primary border border-primary/20 text-xs font-semibold uppercase tracking-wider mb-4`,children:`Getting Started Guide`}),(0,i.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground mb-2`,children:`Welcome to NexusFlow`}),(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`NexusFlow orchestrates multi-repository developer environments. It combines isolated Git worktrees, automatic code analyzer sweeps, and background process running into a single dashboard.`})]}),(0,i.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8 mb-10`,children:[(0,i.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm space-y-6`,children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`NexusFlow Workflows`}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`1`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Configure Folders`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Specify your Development folder (where repositories live) and Workspaces folder. These are currently set to:`,(0,i.jsx)(`code`,{className:`block mt-1 text-[10px] text-primary break-all`,children:e.devDir||`Not Configured`})]})]})]}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`2`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Build Workspaces`}),(0,i.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Choose repositories and feature branch. NexusFlow checks out dependencies under a unified workspace directory using Git Worktrees, keeping original projects clean.`})]})]}),(0,i.jsxs)(`div`,{className:`flex gap-4`,children:[(0,i.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`3`}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Align AI Context`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`NexusFlow writes files like `,(0,i.jsx)(`code`,{children:`CLAUDE.md`}),`, `,(0,i.jsx)(`code`,{children:`.cursorrules`}),`, `,(0,i.jsx)(`code`,{children:`AGENTS.md`}),` prompting the LLM to inspect project relations and list key assumptions and questions before coding.`]})]})]})]}),(0,i.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm flex flex-col justify-between`,children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`Current Configuration`}),(0,i.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Dev Folder:`}),(0,i.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.devDir})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Workspaces Folder:`}),(0,i.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.workspacesDir})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Preferred AI:`}),(0,i.jsx)(`span`,{className:`text-primary font-semibold uppercase`,children:e.defaultAssistant||`None`})]}),(0,i.jsxs)(`div`,{className:`flex justify-between py-1.5`,children:[(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:`Scan Depth:`}),(0,i.jsxs)(`span`,{className:`text-foreground font-semibold`,children:[e.scanDepth,` levels`]})]})]})]}),(0,i.jsxs)(`div`,{className:`pt-6 border-t border-border flex flex-col gap-2`,children:[(0,i.jsxs)(t,{className:`w-full gap-2`,onClick:a,children:[(0,i.jsx)(n,{size:14}),` Create a Workspace`]}),(0,i.jsxs)(t,{variant:`outline`,className:`w-full gap-2`,onClick:o,children:[(0,i.jsx)(r,{size:14,className:`text-muted-foreground`}),` Modify Settings`]})]})]})]})]})}export{a as GettingStartedPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{St as o,t as s}from"./spinner-DXt6mnJk.js";import{n as c,t as l}from"./ScaffoldRepoInline-D-2ZeuDK.js";import{t as u}from"./trash-2-Da8F2gKd.js";import{K as d,L as f,P as p,U as m,V as h,Y as g,_,a as v,b as y,c as b,h as x,i as S,l as C,m as w,nt as ee,o as te,p as T,rt as E,s as D,tt as O,u as k,v as A,x as j,y as M,z as N}from"./index-BqeoAIB1.js";import{a as P,i as F,n as I,r as L,t as R}from"./empty-DWyDwDYB.js";import{t as z}from"./badge-BnkhqVEF.js";var ne=r(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]);function B(e){return x(e,`alert-dialog`)}var V=t(e(),1),H=n(),U=B,W=_;function G({className:e,...t}){return(0,H.jsx)(j,{forceRender:!0,className:i(`fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0`,e),"data-slot":`alert-dialog-backdrop`,...t})}function K({className:e,...t}){return(0,H.jsx)(w,{className:i(`fixed inset-0 z-50 grid grid-rows-[1fr_auto_1fr] justify-items-center p-4`,e),"data-slot":`alert-dialog-viewport`,...t})}function q({className:e,bottomStickOnMobile:t=!0,...n}){return(0,H.jsxs)(W,{children:[(0,H.jsx)(G,{}),(0,H.jsx)(K,{className:i(t&&`max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12`),children:(0,H.jsx)(A,{className:i(`-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t&&`max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none`,e),"data-slot":`alert-dialog-popup`,...n})})]})}function J({className:e,...t}){return(0,H.jsx)(`div`,{className:i(`flex flex-col gap-2 p-6 text-center max-sm:pb-4 sm:text-left`,e),"data-slot":`alert-dialog-header`,...t})}function Y({className:e,variant:t=`default`,...n}){return(0,H.jsx)(`div`,{className:i(`flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]`,t==="default"&&`border-t bg-muted/72 py-4`,t===`bare`&&`pb-6`,e),"data-slot":`alert-dialog-footer`,...n})}function X({className:e,...t}){return(0,H.jsx)(T,{className:i(`font-heading font-semibold text-xl leading-none`,e),"data-slot":`alert-dialog-title`,...t})}function Z({className:e,...t}){return(0,H.jsx)(M,{className:i(`text-muted-foreground text-sm`,e),"data-slot":`alert-dialog-description`,...t})}function re(e){return(0,H.jsx)(y,{"data-slot":`alert-dialog-close`,...e})}var ie={editingId:null,name:``,description:``,repoPaths:[]};function Q(){let e=g(),t=N(),n=h(),r=d(),i=p(),_=m(),y=f(),[x,w]=(0,V.useState)(null),[T,A]=(0,V.useState)(null),[j,M]=(0,V.useState)(null),B=(0,V.useMemo)(()=>{let e={};for(let t of r.data??[])t.projectId&&(e[t.projectId]=(e[t.projectId]??0)+1);return e},[r.data]),W=()=>{A(null),w(ie)},G=e=>{A(null),w({editingId:e.id,name:e.name,description:e.description??``,repoPaths:e.repos.map(e=>e.path)})},K=e=>{w(t=>t&&{...t,repoPaths:t.repoPaths.includes(e.path)?t.repoPaths.filter(t=>t!==e.path):[...t.repoPaths,e.path]})},Q=async()=>{if(x){A(null);try{x.editingId?await _.mutateAsync({id:x.editingId,name:x.name,description:x.description||null,repos:x.repoPaths}):await i.mutateAsync({name:x.name,description:x.description||void 0,repos:x.repoPaths}),w(null)}catch(e){A(e instanceof Error?e.message:String(e))}}},ae=async()=>{if(j)try{await y.mutateAsync(j.id)}finally{M(null)}},oe=!!(x&&x.name.trim()&&x.repoPaths.length>0),$=i.isPending||_.isPending;return(0,H.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,H.jsxs)(`header`,{className:`mb-6 flex items-center justify-between gap-4`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Projects`}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Named groups of repositories you start work from. Registered once, reused for every feature.`})]}),(0,H.jsxs)(a,{onClick:W,children:[(0,H.jsx)(O,{}),` New project`]})]}),t.isLoading?(0,H.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,H.jsx)(s,{className:`size-6`})}):(t.data??[]).length===0?(0,H.jsxs)(R,{className:`border border-border border-dashed`,children:[(0,H.jsxs)(L,{children:[(0,H.jsx)(F,{variant:`icon`,children:(0,H.jsx)(E,{})}),(0,H.jsx)(P,{children:`No projects yet`}),(0,H.jsx)(I,{children:`Register your first project to start work without re-picking repositories every time.`})]}),(0,H.jsxs)(a,{onClick:W,children:[(0,H.jsx)(O,{}),` New project`]})]}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-3`,children:(t.data??[]).map(t=>(0,H.jsx)(`li`,{className:`rounded-xl border border-border bg-card p-4 transition-colors hover:border-foreground/15`,children:(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:t.name}),(B[t.id]??0)>0&&(0,H.jsxs)(z,{variant:`secondary`,children:[B[t.id],` workspace`,B[t.id]===1?``:`s`]})]}),t.description&&(0,H.jsx)(`p`,{className:`mt-0.5 truncate text-sm text-muted-foreground`,children:t.description}),(0,H.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:t.repos.map(e=>(0,H.jsxs)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[e.path,(0,H.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[`[`,e.defaultBranch,`]`]})]},e.path))})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,H.jsxs)(a,{size:`sm`,onClick:()=>e(`/new?project=${encodeURIComponent(t.id)}`),children:[(0,H.jsx)(ee,{}),` Start work`]}),(0,H.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${t.name}`,onClick:()=>G(t),children:(0,H.jsx)(ne,{})}),(0,H.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${t.name}`,onClick:()=>M(t),children:(0,H.jsx)(u,{})})]})]})},t.id))}),(0,H.jsx)(S,{open:x!==null,onOpenChange:e=>!e&&w(null),children:(0,H.jsxs)(C,{className:`max-w-lg`,children:[(0,H.jsxs)(D,{children:[(0,H.jsx)(k,{children:x?.editingId?`Edit project`:`New project`}),(0,H.jsx)(v,{children:`A project is a reusable group of source repositories. Removing one later never touches disk.`})]}),(0,H.jsxs)(b,{className:`space-y-4`,children:[(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Name`}),(0,H.jsx)(o,{value:x?.name??``,onChange:e=>w(t=>t&&{...t,name:e.target.value}),placeholder:`e.g. Hogia Billing`,autoFocus:!0})]}),(0,H.jsxs)(`label`,{className:`block`,children:[(0,H.jsxs)(`span`,{className:`mb-1 block text-sm font-medium`,children:[`Description `,(0,H.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,H.jsx)(o,{value:x?.description??``,onChange:e=>w(t=>t&&{...t,description:e.target.value}),placeholder:`What this group of repos is for`})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Repositories`}),(0,H.jsx)(c,{repos:n.data??[],selectedPaths:x?.repoPaths??[],onToggle:K,loading:n.isLoading,emptyHint:`No repositories found in your dev directory.`}),(0,H.jsx)(l,{onCreated:e=>w(t=>t&&{...t,repoPaths:[...t.repoPaths,e.path]})})]}),T&&(0,H.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:T})]}),(0,H.jsxs)(te,{children:[(0,H.jsx)(a,{variant:`outline`,onClick:()=>w(null),children:`Cancel`}),(0,H.jsxs)(a,{onClick:Q,disabled:!oe||$,children:[$?(0,H.jsx)(s,{}):null,x?.editingId?`Save changes`:`Create project`]})]})]})}),(0,H.jsx)(U,{open:j!==null,onOpenChange:e=>!e&&M(null),children:(0,H.jsxs)(q,{children:[(0,H.jsxs)(J,{children:[(0,H.jsxs)(X,{children:[`Remove “`,j?.name,`”?`]}),(0,H.jsx)(Z,{children:`This only removes the project from the registry — repositories and workspaces on disk are not touched.`})]}),(0,H.jsxs)(Y,{children:[(0,H.jsx)(re,{render:(0,H.jsx)(a,{variant:`outline`,children:`Cancel`})}),(0,H.jsxs)(a,{variant:`destructive`,onClick:ae,disabled:y.isPending,children:[y.isPending?(0,H.jsx)(s,{}):null,`Remove project`]})]})]})})]})}export{Q as ProjectsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,d as n,g as r,i,l as a,m as o,n as s,o as c,p as l,t as u}from"./button-cPldH5S4.js";import{$n as d,Ft as f,Ht as p,M as m,Mn as ee,S as te,St as h,Ut as ne,Vn as g,Xn as re,Zn as ie,bt as ae,er as oe,rr as se,t as _,tr as v,wt as y,xt as ce}from"./spinner-DXt6mnJk.js";import{t as le}from"./useAriaLabelledBy-CjNlctb9.js";import{t as b}from"./Separator-Chx6O62Y.js";import{C as x,D as S,E as C,T as w,Z as ue,et as T,ot as E,w as D}from"./index-BqeoAIB1.js";import{t as O}from"./card-82INhRRE.js";import{t as k}from"./badge-BnkhqVEF.js";import{t as A}from"./label-JFgMNsTn.js";var j=t(e(),1),M=r(),N=s(`relative rounded-xl border px-3.5 py-3 text-card-foreground text-sm`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&_svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 text-destructive-foreground [&_[data-slot=alert-description]]:text-destructive-foreground/80 [&_svg]:text-destructive`,info:`border-info/32 bg-info/4 [&_svg]:text-info`,success:`border-success/32 bg-success/4 [&_svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&_svg]:text-warning`}}});function P(e){let t=e.props[`data-slot`];if(t)return t;let n=e.type;switch(n.displayName??n.name){case`AlertAction`:return`alert-action`;case`AlertTitle`:return`alert-title`;case`AlertDescription`:return`alert-description`;default:return}}function F({className:e,variant:t,children:n,...r}){let i=[],a=[],s=[];return j.Children.forEach(n,e=>{if(!(0,j.isValidElement)(e)){a.push(e);return}let t=P(e);t===`alert-action`?s.push(e):t===`alert-title`||t===`alert-description`?a.push(e):i.push(e)}),(0,M.jsx)(`div`,{className:o(N({variant:t}),e),"data-slot":`alert`,role:`alert`,...r,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i.length>0&&(0,M.jsx)(`div`,{className:`flex size-4 shrink-0 items-center justify-center [&>svg]:size-full`,children:i}),a.length>0&&(0,M.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:a}),s.length>0&&(0,M.jsx)(`div`,{className:`flex shrink-0 items-center self-center`,children:s})]})})}function I({className:e,...t}){return(0,M.jsx)(`div`,{className:o(`font-medium`,e),"data-slot":`alert-title`,...t})}function L({className:e,...t}){return(0,M.jsx)(`div`,{className:o(`flex flex-col gap-2.5 text-muted-foreground`,e),"data-slot":`alert-description`,...t})}function R({className:e,...t}){return(0,M.jsx)(`div`,{className:o(`flex gap-1`,e),"data-slot":`alert-action`,...t})}I.displayName=`AlertTitle`,L.displayName=`AlertDescription`,R.displayName=`AlertAction`;function z({className:e,orientation:t=`horizontal`,...n}){return(0,M.jsx)(b,{className:o(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var B=j.createContext(void 0);function V(){let e=j.useContext(B);if(e===void 0)throw Error(n(63));return e}var H=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),U={...v,checked(e){return e?{[H.checked]:``}:{[H.unchecked]:``}}},W=j.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:o,"aria-labelledby":s,form:u,id:h,inputRef:_,name:v,nativeButton:b=!1,onCheckedChange:x,readOnly:S=!1,required:C=!1,disabled:w=!1,render:ue,uncheckedValue:T,value:E,style:D,...O}=e,{clearErrors:k}=d(),{state:A,setTouched:N,setDirty:P,validityData:F,setFilled:I,setFocused:L,validationMode:R,disabled:z,name:V,validation:H}=oe(),{labelId:W}=re(),G=z||w,K=V??v,q=j.useRef(null),de=a(q,_,H.inputRef),J=j.useRef(null),Y=ie(),X=ee({id:h,implicit:!1,controlRef:J}),Z=b?void 0:X,[Q,fe]=ne({controlled:n,default:!!o,name:`Switch`,state:`checked`});p(J,Y,Q,void 0,!G,v),se(()=>{q.current&&I(q.current.checked)},[q,I]),m(Q,()=>{k(K),P(Q!==F.initialValue),I(Q),H.change(Q)});let{getButtonProps:pe,buttonRef:me}=te({disabled:G,native:b}),he=le(s,W,q,!b,Z),ge={id:b?X:Y,role:`switch`,"aria-checked":Q,"aria-readonly":S||void 0,"aria-required":C||void 0,"aria-labelledby":he,onFocus(){G||L(!0)},onBlur(){let e=q.current;!e||G||(N(!0),L(!1),R===`onBlur`&&H.commit(e.checked))},onClick(e){if(S||G)return;e.preventDefault();let t=q.current;t&&t.dispatchEvent(new(g(t)).PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey}))}},_e=l({checked:Q,disabled:G,form:u,id:Z,name:K,required:C,style:K?ce:ae,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:de,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(S){e.preventDefault();return}let t=e.currentTarget.checked,n=y(f,e.nativeEvent);x?.(t,n),!n.isCanceled&&fe(t)},onFocus(){J.current?.focus()}},e=>H.getValidationProps(G,e),E===void 0?c:{value:E}),$=j.useMemo(()=>({...A,checked:Q,disabled:G,readOnly:S,required:C}),[A,Q,G,S,C]),ve=i(`span`,e,{state:$,ref:[t,J,me],props:[ge,O,pe,e=>H.getValidationProps(G,e)],stateAttributesMapping:U});return(0,M.jsxs)(B.Provider,{value:$,children:[ve,!Q&&K&&T!==void 0&&(0,M.jsx)(`input`,{type:`hidden`,form:u,name:K,value:T,disabled:G}),(0,M.jsx)(`input`,{..._e,suppressHydrationWarning:!0})]})}),G=j.forwardRef(function(e,t){let{render:n,className:r,style:a,...o}=e;return i(`span`,e,{state:V(),ref:t,stateAttributesMapping:U,props:o})});function K({className:e,...t}){return(0,M.jsx)(W,{className:o(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,M.jsx)(G,{className:o(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function q({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:d,handleUpdateTool:f}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,M.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,M.jsxs)(`header`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Global Settings`}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Configure your local directories, search parameters, and editor defaults.`})]}),n===`success`&&(0,M.jsxs)(F,{variant:`success`,className:`mb-6`,children:[(0,M.jsx)(E,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,M.jsxs)(F,{variant:`error`,className:`mb-6`,children:[(0,M.jsx)(ue,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,M.jsx)(O,{className:`mb-6 rounded-xl p-6 shadow-sm`,children:(0,M.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:`Development Directory`}),(0,M.jsx)(h,{type:`text`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:`Workspaces Directory`}),(0,M.jsx)(h,{type:`text`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:`Repo Search Depth`}),(0,M.jsx)(h,{type:`number`,min:1,max:5,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:`Default Assistant`}),(0,M.jsxs)(x,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,M.jsx)(C,{"aria-label":`Default Assistant`,children:(0,M.jsx)(S,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,M.jsxs)(w,{alignItemWithTrigger:!1,children:[(0,M.jsx)(D,{value:``,children:`None (Prompt me)`}),(0,M.jsx)(D,{value:`claude`,children:`Claude Code`}),(0,M.jsx)(D,{value:`antigravity`,children:`Antigravity`}),(0,M.jsx)(D,{value:`codex`,children:`Codex`}),(0,M.jsx)(D,{value:`copilot`,children:`GitHub Copilot`}),(0,M.jsx)(D,{value:`cursor`,children:`Cursor`})]})]}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:`Default Editor`}),(0,M.jsxs)(x,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,M.jsx)(C,{"aria-label":`Default Editor`,children:(0,M.jsx)(S,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`None (Skip opening)`})}),(0,M.jsxs)(w,{alignItemWithTrigger:!1,children:[(0,M.jsx)(D,{value:``,children:`None (Skip opening)`}),r.map(e=>(0,M.jsxs)(D,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred code editor for opening workspaces.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,M.jsx)(z,{className:`mt-1`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,M.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,M.jsx)(A,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,M.jsxs)(x,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,M.jsx)(C,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,M.jsx)(S,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,M.jsx)(w,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,M.jsx)(D,{value:e.name,children:e.displayName},e.name)):(0,M.jsx)(D,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,M.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,M.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,M.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,M.jsxs)(A,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,M.jsx)(K,{checked:!!i,onCheckedChange:e=>a(e)}),(0,M.jsxs)(`span`,{className:`flex flex-col`,children:[(0,M.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,M.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,M.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,M.jsx)(A,{className:`text-sm`,children:r.label}),(0,M.jsx)(h,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,M.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,M.jsxs)(O,{className:`mt-6 rounded-xl p-6 shadow-sm`,children:[(0,M.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,M.jsxs)(u,{variant:`outline`,size:`sm`,onClick:()=>d(!0),disabled:c,children:[c?(0,M.jsx)(_,{className:`size-3`}):(0,M.jsx)(T,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,M.jsx)(_,{className:`size-6`}),(0,M.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,M.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,M.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,M.jsxs)(`div`,{className:`min-w-0`,children:[(0,M.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,M.jsx)(k,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,M.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,M.jsxs)(`span`,{children:[`Installed version: `,(0,M.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,M.jsxs)(`span`,{children:[`Latest: `,(0,M.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,M.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,M.jsx)(u,{size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(k,{variant:`success`,className:`gap-1.5`,children:[(0,M.jsx)(E,{size:12}),` Up to Date`]}),(0,M.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,M.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>f(e.id),disabled:l!==null,children:l===e.id?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(_,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,M.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,M.jsxs)(u,{onClick:()=>a(e),disabled:!o,children:[(0,M.jsx)(E,{size:16}),` Save Configuration`]})})]})}export{q as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,b as t,g as n,h as r,m as i,t as a}from"./button-cPldH5S4.js";import{St as o,t as s}from"./spinner-DXt6mnJk.js";import{S as ee}from"./useCompositeListItem-DWGFLKqA.js";import{t as te}from"./external-link-BtYhMxno.js";import{n as ne,r as re,t as ie}from"./ScaffoldRepoInline-D-2ZeuDK.js";import{t as c}from"./git-branch-Dw55pQWa.js";import{B as l,C as u,D as d,E as f,I as ae,J as oe,M as se,N as ce,Q as le,T as p,V as ue,W as de,X as fe,Y as pe,at as m,lt as h,ot as g,q as _,rt as me,t as he,w as v,z as ge}from"./index-BqeoAIB1.js";import{t as y}from"./textarea-BLU5HXmZ.js";var b=r(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),x=t(e(),1),S={status:`idle`,steps:[]};function _e(){let[e,t]=(0,x.useState)(S),n=(0,x.useRef)(null),r=h(),i=(0,x.useCallback)(()=>{n.current?.close(),n.current=null},[]);return(0,x.useEffect)(()=>i,[i]),{progress:e,start:(0,x.useCallback)(e=>{i(),t({status:`running`,steps:[]});let a=new EventSource(`/api/workspace/create-stream/${encodeURIComponent(e)}`);n.current=a;let o=0;a.addEventListener(`progress`,n=>{o=0;try{let a=JSON.parse(n.data);t({status:a.status===`completed`||a.status===`failed`?a.status:`running`,steps:a.steps??[],error:a.error,workspacePath:a.workspacePath,workspaceId:a.feature?.id??e}),(a.status===`completed`||a.status===`failed`)&&(i(),r.invalidateQueries({queryKey:[`workspaces`]}),r.invalidateQueries({queryKey:[`workspaces-status`]}))}catch{}}),a.onerror=()=>{o+=1,!(a.readyState!==EventSource.CLOSED&&o<5)&&(t(e=>e.status===`running`?{...e,status:`failed`,error:e.error??`Lost connection to the creation stream.`}:e),i())}},[i,r]),reset:(0,x.useCallback)(()=>{i(),t(S)},[i])}}var C=n(),w=`__ad-hoc__`,T=new URLSearchParams(window.location.search).get(`env`)===`vscode`,ve=[{value:`in-place`,icon:b,title:`In-place`,body:`Work directly in the source repos. No branches or worktrees — fastest start.`},{value:`worktree`,icon:c,title:`Isolated worktrees`,body:`A feature branch and worktree per repo. Your source checkouts stay untouched.`}];function ye({repo:e,value:t,onChange:n,enabled:r}){let i=l(e.path,r),a=(0,x.useMemo)(()=>[...new Set([...i.data?.local??[],...i.data?.remote??[]])],[i.data]),s=`branches-${e.path.replace(/[^a-zA-Z0-9]/g,`-`)}`;return(0,C.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(`span`,{className:`w-40 shrink-0 truncate text-xs`,children:e.name}),(0,C.jsx)(o,{list:s,value:t,onChange:e=>n(e.target.value),placeholder:`existing branch (must exist)`,className:`h-7 font-mono text-xs`}),(0,C.jsx)(`datalist`,{id:s,children:a.map(e=>(0,C.jsx)(`option`,{value:e},e))})]})}function be({step:e}){return(0,C.jsxs)(`li`,{className:`flex items-center gap-3 py-2`,children:[(0,C.jsx)(`span`,{className:i(`grid size-5 shrink-0 place-items-center rounded-full border`,e.status===`completed`&&`border-success bg-success/15 text-success-foreground`,e.status===`running`&&`border-primary text-primary`,e.status===`failed`&&`border-destructive bg-destructive/15 text-destructive-foreground`,e.status===`pending`&&`border-border text-muted-foreground`),children:e.status===`completed`?(0,C.jsx)(g,{className:`size-3`}):e.status===`running`?(0,C.jsx)(s,{className:`size-3`}):e.status===`failed`?(0,C.jsx)(m,{className:`size-3`}):null}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,C.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.message})]})]})}function E(){let e=pe(),[t]=fe(),n=ge(),r=ue(),c=se(),l=de(),m=ce().data?.config,h=ae(),{progress:g,start:b}=_e(),[S,E]=(0,x.useState)(t.get(`project`)??w),[D,O]=(0,x.useState)(`in-place`),[k,xe]=(0,x.useState)(``),[A,Se]=(0,x.useState)(``),[j,Ce]=(0,x.useState)(``),[M,N]=(0,x.useState)([]),[P,we]=(0,x.useState)(!1),[F,I]=(0,x.useState)([]),[L,R]=(0,x.useState)(``),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(!1),[U,W]=(0,x.useState)(null),[G,Te]=(0,x.useState)({}),[Ee,De]=(0,x.useState)(!1),[K,q]=(0,x.useState)(null),[J,Y]=(0,x.useState)(!1),Oe=(0,x.useRef)(!1);(0,x.useEffect)(()=>{!Oe.current&&c.data&&(Oe.current=!0,I(c.data.filter(e=>e.detected).map(e=>e.name)))},[c.data]);let X=(0,x.useMemo)(()=>(n.data??[]).find(e=>e.id===S)??null,[n.data,S]),Z=(0,x.useMemo)(()=>X?X.repos.map(e=>({name:he(e.path),path:e.path,defaultBranch:e.defaultBranch})):(r.data??[]).filter(e=>M.includes(e.path)),[X,r.data,M]),Q=D===`in-place`,ke=(Q?A.trim().length>0:k.trim().length>0)&&Z.length>0&&j.trim().length>0,Ae=e=>{R(e),W(null);let t=(l.data??[]).find(t=>t.id===e);B(t?.content??``)},je=async()=>{if(!j.trim()){q(`Describe what you are building first — the suggestion is based on it.`);return}q(null),H(!0);try{let e=await _(`/api/workspace/suggest-workflow`,{method:`POST`,body:JSON.stringify({description:j,repos:Z})});R(e.suggestedWorkflowId),B(e.customInstructions),W(e.difficulty)}catch(e){q(e instanceof Error?e.message:String(e))}finally{H(!1)}},Me=async()=>{q(null);let e={mode:D,projectId:X?.id,...Q?{name:A.trim()}:{branchName:k.trim()},description:j.trim(),repos:Z.map(e=>({...e,existingBranch:!Q&&G[e.path]?.trim()?G[e.path].trim():void 0})),assistants:F,teamworkInstructions:z.trim()||void 0};try{let{jobId:t}=await h.mutateAsync(e);b(t)}catch(e){q(e instanceof Error?e.message:String(e))}},$=m?.defaultEditor&&m.defaultEditor!==`none`?m.defaultEditor:null,Ne=async()=>{if(g.workspacePath){if(T){window.parent.postMessage({type:`openWorkspaceFolder`,workspacePath:g.workspacePath},`*`);return}if($){Y(!0);try{await _(`/api/open-editor`,{method:`POST`,body:JSON.stringify({workspacePath:g.workspacePath,command:$})})}catch(e){q(e instanceof Error?e.message:String(e))}finally{Y(!1)}}}};if(g.status!==`idle`){let t=g.steps.find(e=>e.status===`failed`),n=T||!!$;return(0,C.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,C.jsx)(`h1`,{className:`text-xl font-semibold`,children:g.status===`running`?`Setting up your workspace…`:g.status===`completed`?`Workspace ready`:`Workspace creation failed`}),(0,C.jsx)(`ul`,{className:`mt-6 divide-y divide-border rounded-xl border border-border bg-card px-4`,children:g.steps.map(e=>(0,C.jsx)(be,{step:e},e.id))}),g.status===`failed`&&(0,C.jsx)(`p`,{className:`mt-4 text-sm text-destructive-foreground`,children:t?.message??g.error??`Something went wrong.`}),g.status===`completed`&&g.workspacePath&&(0,C.jsx)(`p`,{className:`mt-4 truncate font-mono text-xs text-muted-foreground`,children:g.workspacePath}),K&&(0,C.jsx)(`p`,{className:`mt-2 text-sm text-destructive-foreground`,children:K}),(0,C.jsxs)(`div`,{className:`mt-6 flex gap-2`,children:[g.status===`completed`&&g.workspaceId&&(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(a,{onClick:()=>e(`/workspaces/${encodeURIComponent(g.workspaceId)}`),children:`Open workspace`}),n&&(0,C.jsxs)(a,{variant:`outline`,onClick:Ne,disabled:J,children:[J?(0,C.jsx)(s,{}):(0,C.jsx)(te,{}),`Open in editor`]})]}),g.status===`failed`&&(0,C.jsx)(a,{variant:`outline`,onClick:()=>window.location.reload(),children:`Start over`}),g.status===`running`&&(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This can take a moment for large repositories.`})]})]})}return(0,C.jsxs)(`div`,{className:`mx-auto max-w-xl animate-fade-in`,children:[(0,C.jsxs)(`header`,{className:`mb-6`,children:[(0,C.jsx)(`h1`,{className:`text-xl font-semibold`,children:`Start work`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Pick where the work happens and how isolated it should be.`})]}),(0,C.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,C.jsxs)(`section`,{children:[(0,C.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`Project`}),(0,C.jsxs)(u,{value:S,onValueChange:e=>typeof e==`string`&&E(e),children:[(0,C.jsx)(f,{className:`w-full`,"aria-label":`Project`,children:(0,C.jsx)(d,{children:X?X.name:`Ad-hoc — pick repositories manually`})}),(0,C.jsxs)(p,{alignItemWithTrigger:!1,children:[(n.data??[]).map(e=>(0,C.jsx)(v,{value:e.id,children:e.name},e.id)),(0,C.jsx)(v,{value:w,children:`Ad-hoc — pick repositories manually`})]})]}),X?(0,C.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:X.repos.map(e=>(0,C.jsx)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.path},e.path))}):(0,C.jsxs)(`div`,{className:`mt-2`,children:[(0,C.jsx)(ne,{repos:r.data??[],selectedPaths:M,onToggle:e=>N(t=>t.includes(e.path)?t.filter(t=>t!==e.path):[...t,e.path]),loading:r.isLoading}),(0,C.jsx)(ie,{onCreated:e=>N(t=>[...t,e.path])})]}),(n.data??[]).length===0&&!n.isLoading&&(0,C.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Tip: `,(0,C.jsx)(oe,{to:`/projects`,className:`text-primary hover:underline`,children:`register a project`}),` to skip repo picking next time.`]})]}),(0,C.jsxs)(`section`,{children:[(0,C.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`How do you want to work?`}),(0,C.jsx)(`div`,{role:`radiogroup`,"aria-label":`Work mode`,className:`grid gap-3 sm:grid-cols-2`,onKeyDown:e=>{if([`ArrowRight`,`ArrowDown`,`ArrowLeft`,`ArrowUp`].includes(e.key)){e.preventDefault();let t=D===`in-place`?`worktree`:`in-place`;O(t),document.getElementById(`mode-${t}`)?.focus()}},children:ve.map(e=>(0,C.jsxs)(`button`,{id:`mode-${e.value}`,type:`button`,role:`radio`,"aria-checked":D===e.value,tabIndex:D===e.value?0:-1,onClick:()=>O(e.value),className:i(`cursor-pointer rounded-xl border p-4 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`,D===e.value?`border-primary bg-primary/5 ring-1 ring-primary`:`border-border bg-card hover:border-foreground/20`),children:[(0,C.jsx)(e.icon,{className:i(`size-4`,D===e.value?`text-primary`:`text-muted-foreground`)}),(0,C.jsx)(`p`,{className:`mt-2 text-sm font-semibold`,children:e.title}),(0,C.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:e.body})]},e.value))})]}),(0,C.jsx)(`section`,{children:Q?(0,C.jsxs)(`label`,{className:`block`,children:[(0,C.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Workspace name`}),(0,C.jsx)(o,{value:A,onChange:e=>Se(e.target.value),placeholder:`e.g. Fix invoice rounding`})]}):(0,C.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,C.jsxs)(`label`,{className:`block`,children:[(0,C.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Feature branch`}),(0,C.jsx)(o,{value:k,onChange:e=>xe(e.target.value),placeholder:`e.g. feature/invoice-rounding`,className:`font-mono`})]}),Z.length>0&&(0,C.jsxs)(`details`,{className:`rounded-lg border border-border px-3 py-2`,onToggle:e=>De(e.target.open),children:[(0,C.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground`,children:`Use an existing branch for specific repos (optional)`}),(0,C.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:Z.map(e=>(0,C.jsx)(ye,{repo:e,enabled:Ee,value:G[e.path]??``,onChange:t=>Te(n=>({...n,[e.path]:t}))},e.path))})]})]})}),(0,C.jsx)(`section`,{children:(0,C.jsxs)(`label`,{className:`block`,children:[(0,C.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`What are you building?`}),(0,C.jsx)(y,{value:j,onChange:e=>Ce(e.target.value),placeholder:`A short description — your AI assistant reads this to plan the work.`,rows:3})]})}),(0,C.jsxs)(`section`,{className:`rounded-xl border border-border`,children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex w-full items-center justify-between px-4 py-3 text-sm font-medium hover:bg-accent`,"aria-expanded":P,children:[`Advanced`,(0,C.jsx)(ee,{className:i(`size-4 text-muted-foreground transition-transform`,P&&`rotate-180`)})]}),P&&(0,C.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-border p-4`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`span`,{className:`mb-1.5 block text-sm font-medium`,children:`AI assistants`}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:(c.data??[]).map(e=>(0,C.jsxs)(`label`,{className:i(`flex cursor-pointer items-center gap-2 rounded-lg border border-border px-3 py-1.5 text-sm`,!e.detected&&`opacity-50`),children:[(0,C.jsx)(re,{checked:F.includes(e.name),onCheckedChange:()=>I(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])}),e.displayName]},e.name))})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`div`,{className:`mb-1.5 flex items-center justify-between`,children:[(0,C.jsx)(`span`,{className:`text-sm font-medium`,children:`Teamwork strategy`}),(0,C.jsxs)(a,{size:`xs`,variant:`outline`,onClick:je,disabled:V,children:[V?(0,C.jsx)(s,{}):(0,C.jsx)(le,{}),`Suggest with AI`]})]}),(0,C.jsxs)(u,{value:L,onValueChange:e=>typeof e==`string`&&Ae(e),children:[(0,C.jsx)(f,{className:`w-full`,"aria-label":`Teamwork strategy`,children:(0,C.jsx)(d,{children:(l.data??[]).find(e=>e.id===L)?.name??`None`})}),(0,C.jsxs)(p,{alignItemWithTrigger:!1,children:[(0,C.jsx)(v,{value:``,children:`None`}),(l.data??[]).map(e=>(0,C.jsx)(v,{value:e.id,children:e.name},e.id))]})]}),U&&(0,C.jsxs)(`p`,{className:`mt-1.5 text-xs text-muted-foreground`,children:[`AI classified this task as `,(0,C.jsx)(`span`,{className:`font-medium`,children:U}),` difficulty.`]}),(0,C.jsx)(y,{value:z,onChange:e=>B(e.target.value),placeholder:`Cooperation instructions for the agent team (editable — prefilled by the strategy pick or AI suggestion).`,rows:4,className:`mt-2 font-mono text-xs`})]})]})]}),K&&(0,C.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:K}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,C.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,C.jsx)(me,{className:`size-3.5`}),Z.length,` repositor`,Z.length===1?`y`:`ies`,` selected`]}),(0,C.jsxs)(a,{onClick:Me,disabled:!ke||h.isPending,children:[h.isPending?(0,C.jsx)(s,{}):null,Q?`Start working`:`Create workspace`]})]})]})]})}export{E as StartWorkPage};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,d as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,s as d,t as f,u as p,v as m}from"./button-cPldH5S4.js";import{$ as h,$t as g,An as _,At as v,B as y,Bn as b,C as x,D as S,Dt as C,E as w,F as T,Ft as E,G as D,Gn as O,Gt as k,H as A,I as j,J as M,Jt as N,Kt as P,L as F,Lt as I,Mt as L,N as R,Nn as z,O as B,On as V,P as H,Pt as ee,Q as te,Qn as ne,Qt as re,R as ie,Rt as ae,S as oe,Sn as U,St as se,Tt as ce,U as le,Un as W,Ut as ue,V as de,Vn as fe,W as pe,Wn as me,Wt as he,X as ge,Xt as _e,Y as ve,Yt as ye,Z as be,Zn as xe,Zt as Se,_t as G,a as Ce,an as we,at as Te,b as Ee,bn as De,c as Oe,cn as ke,ct as Ae,d as je,dt as Me,en as Ne,et as Pe,f as Fe,g as Ie,gn as Le,gt as Re,h as ze,hn as Be,ht as Ve,i as He,in as Ue,ir as We,it as Ge,jn as Ke,jt as qe,kt as Je,ln as Ye,lt as Xe,m as Ze,mt as Qe,n as $e,nn as et,nr as K,nt as tt,o as nt,p as rt,pn as it,q as at,qt as ot,r as st,rn as ct,rr as q,s as lt,sn as ut,st as dt,t as ft,tn as pt,tt as mt,u as ht,ut as gt,vn as _t,vt,w as yt,wt as J,x as bt,xn as Y,y as xt,yn as St,z as Ct,zt as wt}from"./spinner-DXt6mnJk.js";import{S as Tt,_ as Et,a as Dt,c as Ot,d as kt,f as At,i as jt,l as Mt,m as Nt,n as Pt,o as Ft,p as It,r as Lt,s as Rt,u as zt,v as Bt,x as Vt,y as Ht}from"./useCompositeListItem-DWGFLKqA.js";import{t as Ut}from"./cpu-CPUNnHRM.js";import{t as Wt}from"./external-link-BtYhMxno.js";import{t as Gt}from"./search-ChVovkOL.js";import{t as Kt}from"./trash-2-Da8F2gKd.js";import{t as qt}from"./Separator-Chx6O62Y.js";import{A as Jt,G as Yt,H as Xt,O as Zt,R as Qt,S as $t,Z as en,c as tn,et as nn,i as rn,it as an,j as on,k as sn,l as cn,n as ln,nt as un,ot as dn,r as X,rt as fn,s as pn,st as mn,t as hn,tt as gn,u as _n}from"./index-BqeoAIB1.js";import{t as vn}from"./card-82INhRRE.js";import{a as yn,i as bn,n as xn,r as Sn,t as Cn}from"./empty-DWyDwDYB.js";import{t as wn}from"./skeleton-CCPbfn1L.js";import{t as Tn}from"./textarea-BLU5HXmZ.js";var En=a(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Dn=a(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),On=a(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),kn=a(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),An=a(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),jn=a(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Mn=a(`message-square-code`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`m10 8-3 3 3 3`,key:`fp6dz7`}],[`path`,{d:`m14 14 3-3-3-3`,key:`1yrceu`}]]),Nn=a(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Pn=a(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Fn=a(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),In=a(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ln=a(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Rn=a(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),zn=a(`square-play`,[[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}]]),Bn=a(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Vn=a(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Z=n(e(),1);function Hn(){let[,e]=Z.useState({});return Z.useCallback(()=>{e({})},[])}function Un(e,t){return t!=null&&!Ye(t)?0:typeof e==`function`?e():e}function Wn(e,t,n){let r=Un(e,n);return typeof r==`number`?r:r?.[t]}function Gn(e){return typeof e==`function`?e():e}function Kn(e,t){return t||e===`click`||e===`mousedown`}function qn(e){return e?.includes(`mouse`)&&e!==`mousedown`}var Jn=_&&V;function Yn(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Z.useRef(!1),c=Z.useRef(null),l=Z.useRef(!0),u=Se();Z.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=fe(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&me(e)&&e===De(Ke(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return gt(Xe(t,`blur`,r),Jn&&Xe(t,`keydown`,a,!0),Jn&&Xe(t,`pointerdown`,o,!0))},[i,n]),Z.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);W(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Z.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=U(t.nativeEvent);if(W(a)){if(Jn&&!t.relatedTarget){if(!l.current&&!_t(a))return}else if(!St(a))return}let o=Le(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,J(ae,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,J(ae,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=W(n)&&n.hasAttribute(dt(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=De(Ke(e));!n&&t===e||Y(o.current.floatingContext?.refs.floating.current,t)||Y(e,t)||a||Le(n??t,i.context.triggerElements)||i.setOpen(!1,J(ae,r))})}}},[o,r,i,u]);return Z.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Xn=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new _e,this.restTimeout=new _e,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Zn=new WeakMap;function Qn(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Zn.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Zn.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $n(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Zn.get(n);a&&a!==e&&Qn(a),Qn(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Zn.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function er(e){let t=e.context.dataRef.current,n=p(()=>t.hoverInteractionState??Xn.create()).current;return t.hoverInteractionState||=n,re(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function tr(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=h(),d=te(),f=er(a),p=Se(),m=K(()=>Kn(l.current.openEvent?.type,f.interactedInside)),g=K(()=>qn(l.current.openEvent?.type)),_=K(()=>{Qn(f)});q(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,_())},[o,f,_]),Z.useEffect(()=>_,[_]),q(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&g()&&W(c)&&s){let e=c,t=s,n=Ke(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return $n(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{_()}}},[n,o,c,s,f,g,u,d,_]),Z.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&it(u.nodesRef.current,d).length>0)}function t(e){let t=Wn(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,J(wt,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=U(e);if(!Be(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),_()}function h(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(Le(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&W(o)&&it(u.nodesRef.current,r,!1).some(e=>Y(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}_(),g()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,J(wt,t)),u.events.emit(`floating.closed`,t)})}let y=s;return gt(y&&Xe(y,`mouseenter`,c),y&&Xe(y,`mouseleave`,h),y&&Xe(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,g,m,_,f,u,d,p])}var nr=n(We(),1),rr={current:null};function ir(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=rr,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=m.context,v=h(l),y=er(m),b=Z.useRef(!1),x=vt(i),S=vt(r),C=vt(o),w=vt(n),T=vt(p),E=vt(f),D=K(()=>Kn(g.current.openEvent?.type,y.interactedInside)),O=K(()=>T.current?.()!==!1),k=K((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!Y(e,t);if(!W(n))return!1;let i=n;return r.hasMatchingElement(e=>Y(e,i))&&(!e||!Y(e,i))}),A=K(()=>{y.handler&&=(Ke(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=K(()=>{Qn(y)});return u&&(y.handleCloseOptions=x.current?.__options),Z.useEffect(()=>A,[A]),Z.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===wt,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Z.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=Wn(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{m.setOpen(!1,J(wt,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),m.setOpen(!1,J(wt,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!W(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!Ye(y.pointerType))return;let t=Gn(C.current),n=Wn(S.current,`open`,y.pointerType),r=U(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(W(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(Y(e,r)){s=e;break}}W(i)&&W(o)&&!m.context.triggerElements.hasElement(i)&&Y(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=m.select(`open`),u=E.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&W(s)&&W(o)&&Y(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){O()&&m.setOpen(!0,J(wt,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&m.setOpen(!0,J(wt,e,s))}):g&&O()&&m.setOpen(!0,J(wt,e,s)))}function i(t){if(D()){j();return}A();let n=Ke(m.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!Le(t.relatedTarget,m.context.triggerElements)){if(x.current&&r){m.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!Y(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?gt(Xe(t,`mousemove`,r,{once:!0}),Xe(t,`mouseenter`,r),Xe(t,`mouseleave`,i)):gt(Xe(t,`mouseenter`,r),Xe(t,`mouseleave`,i))},[A,j,g,S,m,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O]),Z.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=k(r,n,e.target);if(a&&!Ye(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;$n(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=Gn(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=m.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&m.setOpen(!0,J(wt,t,n))}y.pointerType===`touch`?nr.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,m,C,O])}var ar=.1,or=ar*ar,Q=.5;function sr(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function cr(e,t,n,r,i,a,o,s,c,l){let u=!1;return sr(e,t,n,r,i,a)&&(u=!u),sr(e,t,i,a,o,s)&&(u=!u),sr(e,t,o,s,c,l)&&(u=!u),sr(e,t,c,l,n,r)&&(u=!u),u}function lr(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function ur(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function dr(e={}){let{blockPointerEvents:t=!1}=e,n=new _e,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*or;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=U(r),g=r.type===`mouseleave`,_=Y(u,h),v=Y(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&W(r.relatedTarget)&&Y(u,r.relatedTarget))return;function y(){return!!(s&&it(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=ur(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=ur(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=ur(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=ur(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!lr(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+Q+1,o=C||T?S.bottom-Q:S.top,s=C?T?S.bottom-Q:S.top:S.bottom-Q;M=cr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?Q/2:Q*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-Q,o=C||T?S.top+Q:S.bottom,s=C?T?S.top+Q:S.bottom:S.top+Q;M=cr(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+Q+1,o=w||E?S.right-Q:S.left,s=w?E?S.right-Q:S.left:S.right-Q;M=cr(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?Q/2:Q*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-Q,o=w||E?S.left+Q:S.right,s=w?E?S.left+Q:S.right:S.left+Q;M=cr(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var fr=Z.createContext(void 0);function pr(e){let t=Z.useContext(fr);if(t===void 0&&!e)throw Error(r(33));return t}var mr=Z.createContext(void 0);function hr(e){let t=Z.useContext(mr);if(t===void 0&&!e)throw Error(r(36));return t}var gr=Z.createContext(void 0);function _r(e=!0){let t=Z.useContext(gr);if(t===void 0&&!e)throw Error(r(25));return t}function vr(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=_r(!0),f=d!==void 0;return Z.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:L})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!_&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var yr={type:`regular-item`};function br(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:c,itemMetadata:l,nodeId:d}=e,f=a.useState(`disabled`),p=n||f,m=Z.useRef(null),{getButtonProps:h,buttonRef:g}=oe({disabled:p,focusableWhenDisabled:!0,native:c,composite:!0}),_=vr({closeOnClick:t,highlighted:r,id:i,nodeId:d,store:a,typingRef:o,itemRef:m,itemMetadata:l}),v=Z.useCallback(e=>u(_,{onMouseEnter(){l.type===`submenu-trigger`&&l.setActive()}},e,h),[_,h,l]),y=s(m,g);return Z.useMemo(()=>({getItemProps:v,itemRef:y}),[v,y])}var xr=Z.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:s=!1,disabled:c=!1,closeOnClick:l=!0,style:u,...d}=e,f=Pt({label:a}),p=pr(!0),m=xe(i),{store:h}=hr(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{getItemProps:v,itemRef:y}=br({closeOnClick:l,disabled:c,highlighted:g,id:m,store:h,nativeButton:s,nodeId:p?.context.nodeId,itemMetadata:yr});return o(`div`,e,{state:{disabled:c,highlighted:g},props:[_,d,v],ref:[y,t,f.ref]})}),$=i(),Sr={...w,...N},Cr=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...s}=e,{store:c}=hr(),{side:l,align:u}=pr(),d=Lt(!0)!=null,f=c.useState(`open`),p=c.useState(`transitionStatus`),m=c.useState(`popupProps`),h=c.useState(`mounted`),g=c.useState(`instantType`),_=c.useState(`activeTriggerElement`),v=c.useState(`parent`),y=c.useState(`lastOpenChangeReason`),b=c.useState(`rootId`),x=c.useState(`floatingRootContext`),S=c.useState(`floatingTreeRoot`),C=c.useState(`closeDelay`),w=c.useState(`activeTriggerElement`),T=c.useState(`hoverEnabled`),E=c.useState(`disabled`),D=c.useState(`openMethod`),O=v.type===`context-menu`;k({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}}),Z.useEffect(()=>{function e(e){c.setOpen(!1,J(e.reason,e.domEvent))}return S.events.on(`close`,e),()=>{S.events.off(`close`,e)}},[S.events,c]),tr(x,{enabled:T&&!E&&!O&&v.type!==`menubar`,closeDelay:C});let A=Z.useCallback(e=>{c.set(`popupElement`,e)},[c]),j=o(`div`,e,{state:{transitionStatus:p,side:l,align:u,open:f,nested:v.type===`menu`,instant:g},ref:[t,c.context.popupRef,A],stateAttributesMapping:Sr,props:[m,{onKeyDown(e){d&&Oe.has(e.key)&&e.stopPropagation()}},Ft(p),s,{"data-rootownerid":b}]}),N=v.type===void 0||O;return(_||v.type===`menubar`&&y!==`outside-press`)&&(N=!0),(0,$.jsx)(M,{context:x,openInteractionType:D,modal:O,disabled:!h,returnFocus:a===void 0?N:a,initialFocus:v.type!==`menu`,restoreFocus:!0,externalTree:v.type===`menubar`?void 0:S,previousFocusableElement:w,nextFocusableElement:v.type===void 0?c.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:v.type===void 0?c.context.beforeContentFocusGuardRef:void 0,children:j})}),wr=Z.createContext(void 0);function Tr(){let e=Z.useContext(wr);if(e===void 0)throw Error(r(32));return e}var Er=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=hr();return i.useState(`mounted`)||n?(0,$.jsx)(wr.Provider,{value:n,children:(0,$.jsx)(mt,{ref:t,...r})}):null}),Dr=Z.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Ge,style:g,..._}=e,{store:v}=hr(),y=Tr(),b=_r(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`hasViewport`),N=v.useState(`lastOpenChangeReason`),F=v.useState(`floatingNodeId`),L=v.useState(`floatingParentNodeId`),R=S.useState(`domReferenceElement`),z=Z.useRef(null),B=P(A,!1,!1),V=n,H=c,ee=l,te=s,ne=h;x.type===`context-menu`&&(V=n??x.context?.anchor,te??=`start`,!o&&te!==`center`&&(ee=e.alignOffset??2,H=e.sideOffset??-5));let re=o,ie=te;x.type===`menu`?(re??=`inline-end`,ie??=`start`,ne=e.collisionAvoidance??Te):x.type===`menubar`&&(re??=x.context.orientation===`vertical`?`inline-end`:`bottom`,ie??=`start`);let ae=x.type===`context-menu`,oe=Rt({anchor:V,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:re,sideOffset:H,align:ie,alignOffset:ee,arrowPadding:ae?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:F,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:ne,shiftCrossAxis:ae&&!(`side`in ne&&ne.side===`flip`),externalTree:C,adaptiveOrigin:M?Ot:void 0});Z.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&v.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,J(I)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,F]),Z.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,J(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let U=Se();Z.useEffect(()=>{T||U.clear()},[T,U]),Z.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?U.isStarted()||U.start(e,()=>{v.setOpen(!1,J(I))}):v.setOpen(!1,J(I))}else U.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,U]),Z.useEffect(()=>{let e={open:T,nodeId:F,parentNodeId:L,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,F,L]),q(()=>{let e=R,t=z.current;if(e&&(z.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return B(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[R,B,v]);let se={open:T,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,nested:x.type===`menu`,instant:j},ce=x.type===`menubar`&&x.context.modal;jt(T&&(ce||E&&N!==`trigger-hover`),D===`touch`,A,O);let le=Dt(e,se,{styles:oe.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),W=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ue=null;return x.type===`menubar`?ue=x.context.contentElement:x.type===void 0&&(ue=O),(0,$.jsxs)(fr.Provider,{value:oe,children:[W&&(0,$.jsx)(xt,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:bt(!T),cutout:ue}),(0,$.jsx)(ve,{id:F,children:(0,$.jsx)(Mt,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:le})})]})}),Or=Z.createContext(null);function kr(e){let t=Z.useContext(Or);if(t===null&&!e)throw Error(r(5));return t}var Ar={...Jt,disabled:G(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:G(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:G(e=>e.openMethod),allowMouseEnter:G(e=>e.allowMouseEnter),highlightItemOnHover:G(e=>e.highlightItemOnHover),stickIfOpen:G(e=>e.stickIfOpen),parent:G(e=>e.parent),rootId:G(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:G(e=>e.activeIndex),isActive:G((e,t)=>e.activeIndex===t),hoverEnabled:G(e=>e.hoverEnabled),instantType:G(e=>e.instantType),lastOpenChangeReason:G(e=>e.openChangeReason),floatingTreeRoot:G(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:G(e=>e.floatingNodeId),floatingParentNodeId:G(e=>e.floatingParentNodeId),itemProps:G(e=>e.itemProps),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport),keyboardEventRelay:G(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},jr=class e extends Me{constructor(e){super({...Mr(),...e},{positionerRef:Z.createRef(),popupRef:Z.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),onOpenChangeComplete:void 0,triggerElements:new R},Ar),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=p(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function Mr(){return{...Zt(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Pe,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:l,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var Nr=Z.createContext(void 0);function Pr(){return Z.useContext(Nr)}var Fr=Qe(function(e){let{children:n,open:r,onOpenChange:i,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:d=!0,orientation:f=`vertical`,actionsRef:p,closeParentOnEsc:m=!1,handle:h,triggerId:g,defaultTriggerId:_=null,highlightItemOnHover:b=!0}=e,x=_r(!0),S=hr(!0),C=kr(!0),w=Pr(),E=Z.useMemo(()=>w&&S?{type:`menu`,store:S.store}:C?{type:`menubar`,context:C}:x&&!S?{type:`context-menu`,context:x}:{type:void 0},[x,S,C,w]),O=jr.useStore(h?.store,{open:o,openProp:r,activeTriggerId:_,triggerIdProp:g,parent:E});Ct(O,r,o,_),O.useControlledProp(`openProp`,r),O.useControlledProp(`triggerIdProp`,g),O.useContextCallback(`onOpenChangeComplete`,a);let k=ne(),A=ne(),j=O.useState(`floatingTreeRoot`),M=be(j),N=te(),P=O.useState(`open`),I=O.useState(`activeTriggerElement`),L=O.useState(`positionerElement`),R=O.useState(`hoverEnabled`),z=O.useState(`disabled`),B=O.useState(`lastOpenChangeReason`),V=O.useState(`parent`),ee=O.useState(`activeIndex`),re=O.useState(`payload`),ae=O.useState(`floatingParentNodeId`),oe=Z.useRef(null),U=Z.useRef(V.type!==`context-menu`),se=Se(),ce=Z.useRef(!0),le=Se(),W=ae!=null,{openMethod:ue,triggerProps:fe}=kt(P);O.useSyncedValues({disabled:s,highlightItemOnHover:b,modal:V.type===void 0?c:void 0,openMethod:ue,rootId:k}),ie(O);let{forceUnmount:pe}=y(P,O,()=>{O.update({allowMouseEnter:!1,stickIfOpen:!0})});q(()=>{x&&!S?O.update({parent:{type:`context-menu`,context:x},floatingNodeId:M,floatingParentNodeId:N}):S&&O.update({floatingNodeId:M,floatingParentNodeId:N})},[x,S,M,N,O]),Z.useEffect(()=>{if(P||(oe.current=null),V.type===`context-menu`){if(!P){se.clear(),U.current=!1;return}se.start(500,()=>{U.current=!0})}},[se,P,V.type]),q(()=>{!P&&!R&&O.set(`hoverEnabled`,!0)},[P,R,O]);let me=K((e,t)=>{let n=t.reason;if(P===e&&t.trigger===I&&B===n)return;let r=T(t);if(!e&&t.trigger==null&&(t.trigger=I??void 0),i?.(e,t),t.isCanceled)return;O.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!ce.current)return;e&&n===`trigger-focus`?(ce.current=!1,le.start(300,()=>{ce.current=!0})):(ce.current=!0,le.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0&&a?.isTrusted,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};oe.current=t.event??null,F(c,e,t.trigger,r()),O.update(c),V.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?O.set(`instantType`,`group`):o||s?O.set(`instantType`,o?`click`:`dismiss`):O.set(`instantType`,void 0)}),he=D({popupStore:O,floatingId:A,nested:N!=null,onOpenChange:me}),_e=he.context.events;Z.useEffect(()=>{let e=({open:e,eventDetails:t})=>me(e,t);return _e.on(`setOpen`,e),()=>{_e?.off(`setOpen`,e)}},[_e,me]);let ve=Z.useCallback(()=>{O.setOpen(!1,J(v))},[O]);Z.useImperativeHandle(p,()=>({unmount:pe,close:ve}),[pe,ve]);let ye;V.type===`context-menu`&&(ye=V.context),Z.useImperativeHandle(ye?.positionerRef,()=>L,[L]),Z.useImperativeHandle(ye?.actionsRef,()=>({setOpen:me}),[me]);let xe=at(he,{enabled:!z,bubbles:{escapeKey:m&&V.type===`menu`},outsidePress(){return V.type!==`context-menu`||oe.current?.type===`contextmenu`||U.current},externalTree:W?j:void 0}),G=Ee(),Ce=Z.useCallback(e=>{O.select(`activeIndex`)!==e&&O.set(`activeIndex`,e)},[O]),we=Nt(he,{enabled:!z,listRef:O.context.itemDomElements,activeIndex:ee,nested:V.type!==void 0,loopFocus:d,orientation:f,parentOrientation:V.type===`menubar`?V.context.orientation:void 0,rtl:G===`rtl`,disabledIndices:t,onNavigate:Ce,openOnArrowKeyDown:V.type!==`context-menu`,externalTree:W?j:void 0,focusItemOnHover:b}),Te=Z.useCallback(e=>{O.context.typingRef.current=e},[O]),De=It(he,{enabled:!z,listRef:O.context.itemLabels,elementsRef:O.context.itemDomElements,activeIndex:ee,resetMs:500,onMatch:e=>{P&&e!==ee&&O.set(`activeIndex`,e)},onTyping:Te});de(O,{floatingRootContext:he,activeTriggerProps:Z.useMemo(()=>{let e=u(De.reference,we.reference,xe.reference,{onMouseMove(){O.set(`allowMouseEnter`,!0)}},fe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=P,e},[O,De.reference,we.reference,xe.reference,fe,P]),inactiveTriggerProps:Z.useMemo(()=>{let e=u(we.trigger,xe.trigger,fe);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[we.trigger,xe.trigger,fe]),popupProps:Z.useMemo(()=>u(H,{id:A,role:`menu`,"aria-labelledby":I?.id,onMouseMove(){O.set(`allowMouseEnter`,!0),V.type===`menu`&&O.set(`hoverEnabled`,!1)},onClick(){O.select(`hoverEnabled`)&&O.set(`hoverEnabled`,!1)},onKeyDown(e){let t=O.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},De.floating,we.floating,xe.floating),[I,A,V.type,O,De.floating,we.floating,xe.floating]),itemProps:we.item??l});let Oe=Z.useMemo(()=>({store:O,parent:E}),[O,E]),ke=(0,$.jsx)(mr.Provider,{value:Oe,children:typeof n==`function`?n({payload:re}):n});return V.type===void 0||V.type===`context-menu`?(0,$.jsx)(ge,{externalTree:j,children:ke}):ke});function Ir(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=yt(),{ref:i,index:a}=Pt(e),o=n===a,c=Z.useRef(null),l=s(i,c);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=c.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:l,index:a}}function Lr(e){let{render:n,className:r,style:i,state:a=l,props:s=t,refs:c=t,metadata:u,stateAttributesMapping:d,tag:f=`div`,...p}=e,{compositeProps:m,compositeRef:h}=Ir({metadata:u});return o(f,e,{state:a,ref:[...c,h],props:[m,...s,p],stateAttributesMapping:d})}function Rr(e){if(me(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!O(e))return Rr(b(e))}function zr(e,t){let n=Z.useRef(null);function r(t){nr.flushSync(()=>{e.setOpen(!1,J(Je,t.nativeEvent,t.currentTarget))}),pt(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&et(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{nr.flushSync(()=>{e.setOpen(!1,J(Je,n.nativeEvent,n.currentTarget))});let i=Ne(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&Y(r,i);){let e=i;if(i=g(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Br(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Z.useRef(!1);return Z.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Ke(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:l,[t,n,r])}var Vr=2,Hr=Ve(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,id:d,openOnHover:f,delay:p=100,closeDelay:m=0,handle:g,payload:_,...v}=e,y=hr(!0),b=g?.store??y?.store;if(!b)throw Error(r(85));let x=xe(d),C=b.useState(`isTriggerActive`,x),w=b.useState(`floatingRootContext`),T=b.useState(`isOpenedByTrigger`,x),E=b.useState(`triggerPopupId`,x),D=Z.useRef(null),O=Wr(),k=yt(!0),A=h(),j=Z.useMemo(()=>A??new Pe,[A]),{registerTrigger:M,isMountedByThisTrigger:N}=pe(x,D,b,{payload:_,closeDelay:m,parent:O,floatingTreeRoot:j,floatingNodeId:be(j),floatingParentNodeId:te(),keyboardEventRelay:k?.relayKeyboardEvent}),P=O.type===`menubar`,F=b.useState(`disabled`),I=s||F||P&&O.context.disabled,{getButtonProps:L,buttonRef:R}=oe({disabled:I,native:c});Z.useEffect(()=>{!T&&O.type===void 0&&(b.context.allowMouseUpTriggerRef.current=!1)},[b,T,O.type]);let z=Z.useRef(null),B=Se(),V=K(e=>{if(!z.current)return;B.clear(),b.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(Y(z.current,t)||Y(b.select(`positionerElement`),t)||t===z.current||t!=null&&Rr(t)===b.select(`rootId`))return;let n=zt(z.current);e.clientX>=n.left-Vr&&e.clientX<=n.right+Vr&&e.clientY>=n.top-Vr&&e.clientY<=n.bottom+Vr||j.events.emit(`close`,{domEvent:e,reason:ce})});Z.useEffect(()=>{T&&b.select(`lastOpenChangeReason`)===`trigger-hover`&&Ke(z.current).addEventListener(`mouseup`,V,{once:!0})},[T,V,b]);let H=P&&O.context.hasSubmenuOpen,ee=ir(w,{enabled:(f??H)&&!I&&O.type!==`context-menu`&&(!P||H&&!N),handleClose:dr({blockPointerEvents:!P}),mouseOnly:!0,move:!1,restMs:O.type===void 0?p:void 0,delay:{close:m},triggerElementRef:D,externalTree:j,isActiveTrigger:C,isClosing:()=>b.select(`transitionStatus`)===`ending`}),ne=Ur(T,b.select(`lastOpenChangeReason`)),re=Et(w,{enabled:!I&&O.type!==`context-menu`,event:T&&P?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0&&ne}),ie=Yn(w,{enabled:!I&&H}),ae=Br({open:T,enabled:P,mouseDownAction:`open`}),U=Z.useMemo(()=>u(ie.reference,re.reference),[ie.reference,re.reference]),se=b.useState(`triggerProps`,N),{preFocusGuardRef:le,handlePreFocusGuardFocus:W,handleFocusTargetFocus:ue}=zr(b,D),de={disabled:I,open:T},fe=[z,t,R,M,D],me=[U,ee??l,se,{"aria-haspopup":`menu`,"aria-controls":E,id:x,onMouseDown:e=>{b.select(`open`)||(B.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),Ke(e.currentTarget).addEventListener(`mouseup`,V,{once:!0}))}},P?{role:`menuitem`}:{},ae,v,L],he=o(`button`,e,{enabled:!P,stateAttributesMapping:S,state:de,ref:fe,props:me});return P?(0,$.jsx)(Lr,{tag:`button`,render:n,className:i,style:a,state:de,refs:fe,props:me,stateAttributesMapping:S}):T?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(Ae,{ref:le,onFocus:W},`${x}-pre-focus-guard`),(0,$.jsx)(Z.Fragment,{children:he},x),(0,$.jsx)(Ae,{ref:b.context.triggerFocusTargetRef,onFocus:ue},`${x}-post-focus-guard`)]}):(0,$.jsx)(Z.Fragment,{children:he},x)});function Ur(e,t){let n=Se(),[r,i]=Z.useState(!1);return q(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Wr(){let e=_r(!0),t=hr(!0),n=kr(!0);return Z.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function Gr(e){let t=z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=me(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(Vt(n)!==a||Vt(r)!==o)&&(n=a,r=o),{width:n,height:r}}function Kr(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,onMeasureLayout:a,onMeasureLayoutComplete:o,side:s,direction:c}=e,u=P(t,!0,!1),f=ye(),p=Z.useRef(null),m=Z.useRef(!0),h=Z.useRef(d),g=K(a),_=K(o),v=Z.useMemo(()=>{let e=s===`top`,t=s===`left`;return c===`rtl`?(e||=s===`inline-end`,t||=s===`inline-end`):(e||=s===`inline-start`,t||=s===`inline-start`),e?{position:`absolute`,[s===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:l},[s,c]);q(()=>{if(!i){h.current=d,m.current=!0,p.current=null;return}if(!t||!n)return;h.current=Jr(t,v),Yr(t,`auto`);let e=qr(t,`position`,`static`),r=qr(t,`transform`,`none`),a=qr(t,`scale`,`1`),o=Jr(n,{"--available-width":`max-content`,"--available-height":`max-content`});function s(){e(),r(),o()}function c(){s(),a()}if(g?.(),m.current||p.current===null){Xr(n,`max-content`);let e=Gr(t);return p.current=e,Xr(n,e),c(),_?.(null,e),m.current=!1,()=>{h.current(),h.current=d}}Xr(n,`max-content`);let l=p.current,y=Gr(t);p.current=y,Yr(t,l),c(),_?.(l,y),Xr(n,y);let b=new AbortController;return f.request(()=>{Yr(t,y),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},b.signal)}),()=>{b.abort(),f.cancel(),h.current(),h.current=d}},[r,t,n,u,f,i,g,_,v])}function qr(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function Jr(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(qr(e,r,i));return n.length?()=>{n.forEach(e=>e())}:d}function Yr(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function Xr(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function Zr(e){let{store:t,side:n,cssVars:r,children:i}=e,a=Ee(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=Ht(c?o:null),m=ti(s,l),h=Z.useRef(null),[g,_]=Z.useState(null),[v,y]=Z.useState(null),b=Z.useRef(null),x=Z.useRef(null),S=P(b,!0,!1),C=ye(),[w,T]=Z.useState(null),[E,D]=Z.useState(!1);q(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let O=K(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),k=K(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),A=Z.useRef(null);q(()=>{(!c||!u)&&(A.current=null)},[c,u]),q(()=>{if(o&&p&&o!==p&&A.current!==o&&h.current){_(h.current),D(!0);let e=ei(p,o);y(e),C.request(()=>{nr.flushSync(()=>{D(!1)}),S(()=>{_(null),T(null),h.current=null})}),A.current=o}},[o,p,g,S,C]),q(()=>{let e=b.current;if(!e)return;let t=Ke(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let j=g!=null,M;M=j?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(`div`,{"data-previous":!0,inert:bt(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,$.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,$.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),q(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),Kr({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:O,onMeasureLayoutComplete:k,side:n,direction:a});let N={activationDirection:Qr(v),transitioning:j};return{children:M,state:N}}function Qr(e){if(e)return`${$r(e.horizontal,5,`right`,`left`)} ${$r(e.vertical,5,`down`,`up`)}`}function $r(e,t,n,r){return e>t?n:e<-t?r:``}function ei(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function ti(e,t){let[n,r]=Z.useState(0),i=Z.useRef(e),a=Z.useRef(t),o=Z.useRef(!1);return q(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var ni=Fr;function ri({className:e,children:t,...n}){return(0,$.jsx)(Hr,{className:e,"data-slot":`menu-trigger`,...n,children:t})}function ii({children:e,className:t,sideOffset:n=4,align:r=`center`,alignOffset:i,side:a=`bottom`,anchor:o,...s}){return(0,$.jsx)(Er,{children:(0,$.jsx)(Dr,{align:r,alignOffset:i,anchor:o,className:`z-50`,"data-slot":`menu-positioner`,side:a,sideOffset:n,children:(0,$.jsx)(Cr,{className:c(`relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,t),"data-slot":`menu-popup`,...s,children:(0,$.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:e})})})})}function ai({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(xr,{className:c(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,e),"data-inset":t,"data-slot":`menu-item`,"data-variant":n,...r})}function oi({className:e,...t}){return(0,$.jsx)(qt,{className:c(`mx-2 my-1 h-px bg-border`,e),"data-slot":`menu-separator`,...t})}var si=Z.createContext(void 0);function ci(){let e=Z.useContext(si);if(e===void 0)throw Error(r(64));return e}var li=function(e){return e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e}({}),ui={tabActivationDirection:e=>({[li.activationDirection]:e})},di=Z.forwardRef(function(e,t){let{className:n,defaultValue:r=0,onValueChange:i,orientation:a=`horizontal`,render:s,value:c,style:l,...u}=e,d=e.defaultValue!==void 0,f=Z.useRef([]),[p,m]=Z.useState(()=>new Map),[h,g]=ue({controlled:c,default:r,name:`Tabs`,state:`value`}),_=c!==void 0,[v,y]=Z.useState(()=>new Map),b=Z.useRef(void 0),x=Z.useCallback(e=>{if(e===void 0)return null;for(let[t,n]of v.entries())if(n!=null&&e===(n.value??n.index))return t;return null},[v]),[S,w]=Z.useState(()=>({previousValue:h,tabActivationDirection:`none`})),{previousValue:T,tabActivationDirection:E}=S,D=E,O=!1;T!==h&&(D=fi(T,h,a,v),O=T!=null&&h!=null&&x(h)==null);let k=O?T:h,A=T!==k||E!==D;q(()=>{A&&w({previousValue:k,tabActivationDirection:D})},[k,A,D]);let j=K((e,t)=>{t.activationDirection=fi(h,e,a,v),i?.(e,t),!t.isCanceled&&g(e)}),M=K((e,t)=>{i?.(e,J(t,void 0,void 0,{activationDirection:`none`}))}),N=K((e,t)=>{m(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})}),P=K((e,t)=>{m(n=>{if(!n.has(e)||n.get(e)!==t)return n;let r=new Map(n);return r.delete(e),r})}),F=Z.useCallback(e=>p.get(e),[p]),I=Z.useCallback(e=>{for(let t of v.values())if(e===t?.value)return t?.id},[v]),L=Z.useMemo(()=>({getTabElementBySelectedValue:x,getTabIdByPanelValue:I,getTabPanelIdByValue:F,onValueChange:j,orientation:a,registerMountedTabPanel:N,setTabMap:y,unregisterMountedTabPanel:P,tabActivationDirection:D,value:h}),[x,I,F,j,a,N,y,P,D,h]),R=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&e.value===h)return e},[v,h]),z=Z.useMemo(()=>{for(let e of v.values())if(e!=null&&!e.disabled)return e.value},[v]),B=Z.useRef(!d),V=Z.useRef(r),H=Z.useRef(d),te=Z.useRef(!1);q(()=>{if(_)return;function e(e,t){g(e),w(t=>t.previousValue===e&&t.tabActivationDirection===`none`?t:{previousValue:e,tabActivationDirection:`none`}),M(e,t),B.current=!1}if(v.size===0){te.current&&h!==null&&!b.current?.isConnected&&e(null,ee);return}te.current=!0,b.current=v.keys().next().value;let t=R?.disabled,n=R==null&&h!==null;if(!t&&h===V.current&&(H.current=!1),H.current&&t&&h===V.current)return;let r=B.current;if(t||n){let n=z??null;if(h===n){B.current=!1;return}let i=ee;r?i=qe:t&&(i=C),e(n,i);return}r&&R!=null&&(M(h,qe),B.current=!1)},[z,_,M,R,g,v,h]);let ne=o(`div`,e,{state:{orientation:a,tabActivationDirection:D},ref:t,props:u,stateAttributesMapping:ui});return(0,$.jsx)(si.Provider,{value:L,children:(0,$.jsx)(Mt,{elementsRef:f,children:ne})})});function fi(e,t,n,r){if(e==null||t==null)return`none`;let i=null,a=null;for(let[n,o]of r.entries()){if(o==null)continue;let r=o.value??o.index;if(e===r&&(i=n),t===r&&(a=n),i!=null&&a!=null)break}if(i==null||a==null)return i!==a&&(typeof e==`number`||typeof e==`string`)&&typeof e==typeof t?n===`horizontal`?t>e?`right`:`left`:t>e?`down`:`up`:`none`;let o=i.getBoundingClientRect(),s=a.getBoundingClientRect();if(n===`horizontal`){if(s.left<o.left)return`left`;if(s.left>o.left)return`right`}else{if(s.top<o.top)return`up`;if(s.top>o.top)return`down`}return`none`}var pi=`data-composite-item-active`,mi=Z.createContext(void 0);function hi(){let e=Z.useContext(mi);if(e===void 0)throw Error(r(65));return e}var gi=Z.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:s,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,orientation:p,tabActivationDirection:m}=ci(),{activateOnFocus:h,highlightedTabIndex:g,onTabActivation:_,registerTabResizeObserverElement:v,setHighlightedTabIndex:y,tabsListElement:b}=hi(),x=xe(s),{compositeProps:S,compositeRef:C,index:w}=Ir({metadata:Z.useMemo(()=>({disabled:r,id:x,value:a}),[r,x,a])}),T=a===d,D=Z.useRef(!1),O=Z.useRef(null);q(()=>{let e=O.current;if(e)return v(e)},[v]),q(()=>{if(D.current){D.current=!1;return}if(!(T&&w>-1&&g!==w))return;let e=b;if(e!=null){let t=De(Ke(e));if(t&&Y(e,t))return}r||y(w)},[T,w,g,y,r,b]);let{getButtonProps:k,buttonRef:A}=oe({disabled:r,native:c,focusableWhenDisabled:!0}),j=f(a),M=Z.useRef(!1),N=Z.useRef(!1);function P(e){T||r||_(a,J(E,e.nativeEvent,void 0,{activationDirection:`none`}))}function F(e){T||(w>-1&&!r&&y(w),!r&&h&&(!M.current||M.current&&N.current)&&_(a,J(E,e.nativeEvent,void 0,{activationDirection:`none`})))}function I(e){if(T||r)return;M.current=!0;function t(){M.current=!1,N.current=!1}(!e.button||e.button===0)&&(N.current=!0,Ke(e.currentTarget).addEventListener(`pointerup`,t,{once:!0}))}return o(`button`,e,{state:{disabled:r,active:T,orientation:p,tabActivationDirection:m},ref:[t,A,C,O],props:[S,{role:`tab`,"aria-controls":j,"aria-selected":T,id:x,onClick:P,onFocus:F,onPointerDown:I,[pi]:T?``:void 0,onKeyDownCapture(){D.current=!0}},u,k],stateAttributesMapping:ui})}),_i=Re();function vi(){return d}function yi(){return!1}function bi(){return!0}function xi(){return(0,_i.useSyncExternalStore)(vi,yi,bi)}var Si=function(e){return e.activeTabLeft=`--active-tab-left`,e.activeTabRight=`--active-tab-right`,e.activeTabTop=`--active-tab-top`,e.activeTabBottom=`--active-tab-bottom`,e.activeTabWidth=`--active-tab-width`,e.activeTabHeight=`--active-tab-height`,e}({}),Ci={...ui,activeTabPosition:()=>null,activeTabSize:()=>null},wi=Z.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...s}=e,{nonce:c}=$e(),{getTabElementBySelectedValue:l,orientation:u,tabActivationDirection:d,value:f}=ci(),{tabsListElement:p,registerIndicatorUpdateListener:m}=hi(),h=xi(),g=Hn();Z.useEffect(()=>m(g),[m,g]);let _=0,v=0,y=0,b=0,x=0,S=0,C=!1;if(f!=null&&p!=null){let e=l(f);if(e!=null){C=!0;let{width:t,height:n}=Gr(e),{width:r,height:i}=Gr(p),a=e.getBoundingClientRect(),o=p.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1;if(Math.abs(s)>2**-52&&Math.abs(c)>2**-52){let e=a.left-o.left,t=a.top-o.top;_=e/s+p.scrollLeft-p.clientLeft,y=t/c+p.scrollTop-p.clientTop}else _=e.offsetLeft,y=e.offsetTop;x=t,S=n,v=p.scrollWidth-_-x,b=p.scrollHeight-y-S}}let w=C?{left:_,right:v,top:y,bottom:b}:null,T=C?{width:x,height:S}:null,E=C?{[Si.activeTabLeft]:`${_}px`,[Si.activeTabRight]:`${v}px`,[Si.activeTabTop]:`${y}px`,[Si.activeTabBottom]:`${b}px`,[Si.activeTabWidth]:`${x}px`,[Si.activeTabHeight]:`${S}px`}:void 0,D=o(`span`,e,{state:{orientation:u,activeTabPosition:w,activeTabSize:T,tabActivationDirection:d},ref:t,props:[{role:`presentation`,style:E,hidden:!(C&&x>0&&S>0)},s,{suppressHydrationWarning:!0}],stateAttributesMapping:Ci});return f==null?null:(0,$.jsxs)(Z.Fragment,{children:[D,h&&i&&(0,$.jsx)(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})}),Ti=function(e){return e.index=`data-index`,e.activationDirection=`data-activation-direction`,e.orientation=`data-orientation`,e.hidden=`data-hidden`,e[e.startingStyle=ot.startingStyle]=`startingStyle`,e[e.endingStyle=ot.endingStyle]=`endingStyle`,e}({}),Ei={...ui,...N},Di=Z.forwardRef(function(e,t){let{className:n,value:r,render:i,keepMounted:a=!1,style:s,...c}=e,{value:l,getTabIdByPanelValue:u,orientation:d,tabActivationDirection:f,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=ci(),h=xe(),{ref:g,index:_}=Pt({metadata:Z.useMemo(()=>({id:h,value:r}),[h,r])}),v=r===l,{mounted:y,transitionStatus:b,setMounted:x}=he(v),S=!y,C=u(r),w={hidden:S,orientation:d,tabActivationDirection:f,transitionStatus:b},T=Z.useRef(null),E=o(`div`,e,{state:w,ref:[t,g,T],props:[{"aria-labelledby":C,hidden:S,id:h,role:`tabpanel`,tabIndex:v?0:-1,inert:bt(!v),[Ti.index]:_},c],stateAttributesMapping:Ei});return k({open:v,ref:T,onComplete(){v||x(!1)}}),q(()=>{if(!(S&&!a)&&h!=null)return p(r,h),()=>{m(r,h)}},[S,a,r,h,p,m]),a||y?E:null}),Oi=[];function ki(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:c,rootRef:l,enableHomeAndEndKeys:u=!1,stopEventPropagation:d=!1,disabledIndices:f,modifierKeys:p=Oi}=e,[m,h]=Z.useState(0),g=r!=null,_=Z.useRef(null),v=s(_,l),y=Z.useRef([]),b=Z.useRef(!1),x=o??m,S=K((e,t=!1)=>{if((c??h)(e),t){let t=y.current[e];Ie(_.current,t,a,n)}}),C=K(e=>{if(e.size===0||b.current)return;b.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?t.indexOf(r):-1;if(i!==-1)S(i);else if(ke(t,x,f)){let e=ct(t,{disabledIndices:f});ut(t,e)||S(e)}Ie(_.current,r,a,n)});q(()=>{if(f==null||o!=null||!b.current)return;let e=y.current;if(ke(e,x,f)){let t=ct(e,{disabledIndices:f});ut(e,t)||S(t)}},[f,o,x,y,S]);let w=K((e,t,n)=>i?i(e,t,n,y):n),T=K(e=>{let o=u?Oe:He;if(!o.has(e.key)||Ai(e,p)||!_.current)return;let s=a===`rtl`,c=s?Ce:nt,l={horizontal:c,vertical:st,both:c}[n],m=s?nt:Ce,h={horizontal:m,vertical:lt,both:m}[n],v=U(e.nativeEvent);if(v!=null&&ze(v)&&!Bt(v)){let t=v.selectionStart,n=v.selectionEnd,r=v.value??``;if(t==null||e.shiftKey||t!==n||e.key!==h&&t<r.length||e.key!==l&&t>0)return}let b=x,C=we(y,f),T=Ue(y,f);r!=null&&(b=r({disabledIndices:f,elementsRef:y,event:e,highlightedIndex:x,loopFocus:t,maxIndex:T,minIndex:C,onLoop:w,orientation:n,rtl:s}));let E={horizontal:[c],vertical:[st],both:[c,st]}[n],D={horizontal:[m],vertical:[lt],both:[m,lt]}[n],O=g?o:{horizontal:u?je:ht,vertical:u?Ze:rt,both:o}[n];u&&(e.key===`Home`?b=C:e.key===`End`&&(b=T)),b===x&&(E.includes(e.key)||D.includes(e.key))&&(t&&b===T&&E.includes(e.key)?(b=C,i&&(b=i(e,x,b,y))):t&&b===C&&D.includes(e.key)?(b=T,i&&(b=i(e,x,b,y))):b=ct(y.current,{startingIndex:b,decrement:D.includes(e.key),disabledIndices:f})),b!==x&&!ut(y.current,b)&&(d&&e.stopPropagation(),O.has(e.key)&&e.preventDefault(),S(b,!0),queueMicrotask(()=>{y.current[b]?.focus()}))});return{props:{ref:v,onFocus(e){let t=_.current,n=U(e.nativeEvent);!t||n==null||!ze(n)||n.setSelectionRange(0,n.value.length??0)},onKeyDown:T},highlightedIndex:x,onHighlightedIndexChange:S,elementsRef:y,disabledIndices:f,onMapChange:C,relayKeyboardEvent:T}}function Ai(e,t){for(let n of Fe.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function ji(e){let{render:n,className:r,style:i,refs:a=t,props:s=t,state:c=l,stateAttributesMapping:u,highlightedIndex:d,onHighlightedIndexChange:f,orientation:p,grid:m,loopFocus:h,onLoop:g,enableHomeAndEndKeys:_,onMapChange:v,stopEventPropagation:y=!0,rootRef:b,disabledIndices:S,modifierKeys:C,highlightItemOnHover:w=!1,tag:T=`div`,...E}=e,{props:D,highlightedIndex:O,onHighlightedIndexChange:k,elementsRef:A,onMapChange:j,relayKeyboardEvent:M}=ki({grid:m,loopFocus:h,onLoop:g,orientation:p,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:b,stopEventPropagation:y,enableHomeAndEndKeys:_,direction:Ee(),disabledIndices:S,modifierKeys:C}),N=o(T,e,{state:c,ref:a,props:[D,...s,E],stateAttributesMapping:u}),P=Z.useMemo(()=>({highlightedIndex:O,onHighlightedIndexChange:k,highlightItemOnHover:w,relayKeyboardEvent:M}),[O,k,w,M]);return(0,$.jsx)(x.Provider,{value:P,children:(0,$.jsx)(Mt,{elementsRef:A,onMapChange:e=>{v?.(e),j(e)},children:N})})}var Mi=Z.forwardRef(function(e,n){let{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{onValueChange:l,orientation:u,value:d,setTabMap:f,tabActivationDirection:p}=ci(),[m,h]=Z.useState(0),[g,_]=Z.useState(null),v=Z.useRef(new Set),y=Z.useRef(new Set),b=Z.useRef(null);q(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{v.current.forEach(e=>{e()})});return b.current=e,g&&e.observe(g),y.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),b.current=null}},[g]);let x=K(e=>(v.current.add(e),()=>{v.current.delete(e)})),S=K(e=>(y.current.add(e),b.current?.observe(e),()=>{y.current.delete(e),b.current?.unobserve(e)})),C=K((e,t)=>{e!==d&&l(e,t)}),w={orientation:u,tabActivationDirection:p},T={"aria-orientation":u===`vertical`?`vertical`:void 0,role:`tablist`},E=Z.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:m,registerIndicatorUpdateListener:x,registerTabResizeObserverElement:S,onTabActivation:C,setHighlightedTabIndex:h,tabsListElement:g}),[r,m,x,S,C,h,g]);return(0,$.jsx)(mi.Provider,{value:E,children:(0,$.jsx)(ji,{render:o,className:i,style:s,state:w,refs:[n,_],props:[T,c],stateAttributesMapping:ui,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:a,orientation:u,onHighlightedIndexChange:h,onMapChange:f,disabledIndices:t})})});function Ni({className:e,...t}){return(0,$.jsx)(di,{className:c(`flex flex-col gap-4`,e),"data-slot":`tabs`,...t})}function Pi({className:e,...t}){return(0,$.jsxs)(Mi,{className:c(`relative z-0 flex w-fit items-center gap-1 rounded-lg bg-muted p-1`,e),"data-slot":`tabs-list`,...t,children:[t.children,(0,$.jsx)(wi,{className:`absolute top-1/2 left-0 z-[-1] h-[calc(100%-0.5rem)] w-(--active-tab-width) -translate-y-1/2 translate-x-(--active-tab-left) rounded-md bg-background shadow-xs transition-all duration-150`,"data-slot":`tabs-indicator`})]})}function Fi({className:e,...t}){return(0,$.jsx)(gi,{className:c(`flex h-7 cursor-pointer items-center justify-center whitespace-nowrap rounded-md border border-transparent px-2.5 font-medium text-muted-foreground text-sm outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-selected:text-foreground`,e),"data-slot":`tabs-tab`,...t})}function Ii({className:e,...t}){return(0,$.jsx)(Di,{className:c(`flex-1 outline-none`,e),"data-slot":`tabs-panel`,...t})}var Li=Z.createContext(void 0);function Ri(e){let t=Z.useContext(Li);if(t===void 0&&!e)throw Error(r(47));return t}function zi(){return{...Zt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var Bi={...Jt,disabled:G(e=>e.disabled),instantType:G(e=>e.instantType),openMethod:G(e=>e.openMethod),openChangeReason:G(e=>e.openChangeReason),modal:G(e=>e.modal),focusManagerModal:G(e=>e.focusManagerModal),stickIfOpen:G(e=>e.stickIfOpen),titleElementId:G(e=>e.titleElementId),descriptionElementId:G(e=>e.descriptionElementId),openOnHover:G(e=>e.openOnHover),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport)},Vi=class e extends Me{constructor(e,t,n=!1){let r={...zi(),...e},i=new R;r.open&&e?.mounted===void 0&&(r.mounted=!0),r.floatingRootContext=sn(i,t,n),super(r,{popupRef:Z.createRef(),backdropRef:Z.createRef(),internalBackdropRef:Z.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:Z.createRef(),beforeContentFocusGuardRef:Z.createRef(),stickIfOpenTimeout:new _e,triggerElements:i},Bi)}setOpen=(e,t)=>{let n=t.reason===wt,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null),a=T(t),o=this.select(`activeTriggerId`);if(!e&&t.reason===`close-press`&&t.trigger==null&&o!=null&&(t.trigger=this.context.triggerElements.getById(o)??this.select(`activeTriggerElement`)??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let s=()=>{let n={open:e,openChangeReason:t.reason};F(n,e,t.trigger,a()),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),nr.flushSync(s)):s(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let{store:r,internalStore:i}=le(t,(t,r)=>new e(n,t,r));return Z.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function Hi({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Vi.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});Ct(u,n,r,l),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`mounted`),p=u.useState(`payload`),m=te()!=null;u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a),A(u,d),ie(u);let{forceUnmount:h}=y(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});u.useSyncedValues({modal:o,nested:m}),Z.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=Z.useCallback(()=>{u.setOpen(!1,J(v))},[u]);Z.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=d||f,b=Z.useMemo(()=>({store:u}),[u]);return(0,$.jsxs)(Li.Provider,{value:b,children:[_&&(0,$.jsx)(Wi,{store:u,modal:o}),typeof t==`function`?t({payload:p}):t]})}function Ui(e){return Ri(!0)?(0,$.jsx)(Hi,{props:e}):(0,$.jsx)(ge,{children:(0,$.jsx)(Hi,{props:e})})}function Wi({store:e,modal:t}){let n=at(e.useState(`floatingRootContext`),{outsidePressEvent:{mouse:t===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}});return de(e,{activeTriggerProps:n.reference??l,inactiveTriggerProps:n.trigger??l,popupProps:Z.useMemo(()=>u(H,n.floating),[n.floating])}),null}var Gi=Z.forwardRef(function(e,t){let{render:n,className:i,style:a,disabled:s=!1,nativeButton:c=!0,handle:l,payload:u,openOnHover:d=!1,delay:f=300,closeDelay:p=0,id:m,...h}=e,g=Ri(!0),_=l?.store??g?.store;if(!_)throw Error(r(74));let v=xe(m),y=_.useState(`isTriggerActive`,v),b=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),C=_.useState(`triggerPopupId`,v),w=Z.useRef(null),{registerTrigger:T,isMountedByThisTrigger:E}=pe(v,w,_,{payload:u,disabled:s,openOnHover:d,closeDelay:p}),D=_.useState(`openChangeReason`),O=_.useState(`stickIfOpen`),k=_.useState(`openMethod`),A=_.useState(`focusManagerModal`),j=ir(b,{enabled:!s&&b!=null&&d&&(k!==`touch`||D!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:dr(),restMs:f,delay:{close:p},triggerElementRef:w,isActiveTrigger:y,isClosing:()=>_.select(`transitionStatus`)===`ending`}),M=Et(b,{enabled:b!=null,stickIfOpen:O}),N=At(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),P=_.useState(`triggerProps`,E),{getButtonProps:F,buttonRef:I}=oe({disabled:s,native:c}),L={open(e){return e&&D===`trigger-press`?S.open(e):B.open(e)}},{preFocusGuardRef:R,handlePreFocusGuardFocus:z,handleFocusTargetFocus:V}=zr(_,w),H=o(`button`,e,{state:{disabled:s,open:x},ref:[I,t,T,w],props:[M.reference,j,P,N,{[tt]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":C},h,F],stateAttributesMapping:L});return E&&!A?(0,$.jsxs)(Z.Fragment,{children:[(0,$.jsx)(Ae,{ref:R,onFocus:z}),(0,$.jsx)(Z.Fragment,{children:H},v),(0,$.jsx)(Ae,{ref:_.context.triggerFocusTargetRef,onFocus:V})]}):(0,$.jsx)(Z.Fragment,{children:H},v)}),Ki=Z.createContext(void 0);function qi(){let e=Z.useContext(Ki);if(e===void 0)throw Error(r(45));return e}var Ji=Z.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Ri();return i.useState(`mounted`)||n?(0,$.jsx)(Ki.Provider,{value:n,children:(0,$.jsx)(mt,{ref:t,...r})}):null}),Yi=Z.createContext(void 0);function Xi(){let e=Z.useContext(Yi);if(!e)throw Error(r(46));return e}var Zi=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,anchor:a,positionMethod:o=`absolute`,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:f=5,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:h=!1,collisionAvoidance:g=Te,..._}=e,{store:v}=Ri(),y=qi(),b=be(),x=v.useState(`floatingRootContext`),S=v.useState(`mounted`),C=v.useState(`open`),w=v.useState(`openChangeReason`),T=v.useState(`activeTriggerElement`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`positionerElement`),k=v.useState(`instantType`),A=v.useState(`transitionStatus`),j=v.useState(`hasViewport`),M=Z.useRef(null),N=P(O,!1,!1),F=Rt({anchor:a,floatingRootContext:x,positionMethod:o,mounted:S,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:p,collisionBoundary:d,collisionPadding:f,sticky:m,disableAnchorTracking:h,keepMounted:y,nodeId:b,collisionAvoidance:g,adaptiveOrigin:j?Ot:void 0}),I=x.useState(`domReferenceElement`);q(()=>{let e=I,t=M.current;if(e&&(M.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return N(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,N,v]),jt(C&&E===!0&&w!==`trigger-hover`,D===`touch`,O,T);let L=Z.useCallback(e=>{v.set(`positionerElement`,e)},[v]),R=Dt(e,{open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:k},{styles:F.positionerStyles,transitionStatus:A,props:_,refs:[t,L],hidden:!S,inert:!C});return(0,$.jsxs)(Yi.Provider,{value:F,children:[S&&E===!0&&w!==`trigger-hover`&&(0,$.jsx)(xt,{ref:v.context.internalBackdropRef,inert:bt(!C),cutout:T}),(0,$.jsx)(ve,{id:b,children:R})]})}),Qi=Z.createContext(void 0);function $i(){let[e,t]=Z.useState(0),n=K(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:Z.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function ea(e){let{value:t,children:n}=e;return(0,$.jsx)(Qi.Provider,{value:t,children:n})}var ta={...w,...N},na=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:s,...c}=e,{store:l}=Ri(),u=Xi(),d=Lt(!0)!=null,{context:f,hasClosePart:p}=$i(),m=l.useState(`open`),h=l.useState(`openMethod`),g=l.useState(`instantType`),_=l.useState(`transitionStatus`),v=l.useState(`popupProps`),y=l.useState(`titleElementId`),b=l.useState(`descriptionElementId`),x=l.useState(`modal`),S=l.useState(`mounted`),C=l.useState(`openChangeReason`),w=l.useState(`activeTriggerElement`),T=l.useState(`floatingRootContext`),E=T.useState(`floatingId`),D=l.useState(`disabled`),O=l.useState(`openOnHover`),A=l.useState(`closeDelay`),N=c.id??E;k({open:m,ref:l.context.popupRef,onComplete(){m&&l.context.onOpenChangeComplete?.(!0)}}),tr(T,{enabled:O&&!D,closeDelay:A});let P=a===void 0?j(l.context.popupRef):a,F=x!==!1&&p;l.useSyncedValue(`focusManagerModal`,F);let I=Z.useCallback(e=>{l.set(`popupElement`,e)},[l]),L=o(`div`,e,{state:{open:m,side:u.side,align:u.align,instant:g,transitionStatus:_},ref:[t,l.context.popupRef,I],props:[v,{id:N,role:`dialog`,...H,"aria-labelledby":y,"aria-describedby":b,onKeyDown(e){d&&Oe.has(e.key)&&e.stopPropagation()}},Ft(_),c],stateAttributesMapping:ta});return(0,$.jsx)(M,{context:T,openInteractionType:h,modal:F,disabled:!S||C===`trigger-hover`,initialFocus:P,returnFocus:s,restoreFocus:`popup`,previousFocusableElement:me(w)?w:void 0,nextFocusableElement:l.context.triggerFocusTargetRef,beforeContentFocusGuardRef:l.context.beforeContentFocusGuardRef,children:(0,$.jsx)(ea,{value:f,children:L})})}),ra=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),ia={activationDirection:e=>e?{"data-activation-direction":e}:null},aa=Z.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...s}=e,{store:c}=Ri(),{side:l}=Xi(),u=c.useState(`instantType`),{children:d,state:f}=Zr({store:c,side:l,cssVars:ra,children:a});return o(`div`,e,{state:{activationDirection:f.activationDirection,transitioning:f.transitioning,instant:u},ref:t,props:[s,{children:d}],stateAttributesMapping:ia})}),oa=Ui;function sa({className:e,children:t,...n}){return(0,$.jsx)(Gi,{className:e,"data-slot":`popover-trigger`,...n,children:t})}function ca({children:e,className:t,viewportClassName:n,side:r=`bottom`,align:i=`center`,sideOffset:a=4,alignOffset:o=0,tooltipStyle:s=!1,anchor:l,...u}){return(0,$.jsx)(Ji,{children:(0,$.jsx)(Zi,{align:i,alignOffset:o,anchor:l,className:`z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`popover-positioner`,side:r,sideOffset:a,children:(0,$.jsx)(na,{className:c(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 outline-none transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[slot=calendar]:rounded-xl has-data-[slot=calendar]:before:rounded-[calc(var(--radius-xl)-1px)] data-starting-style:scale-98 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,s&&`w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]`,t),"data-slot":`popover-popup`,...u,children:(0,$.jsx)(aa,{className:c(`relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,s?`py-1 [--viewport-inline-padding:--spacing(2)]`:`not-data-transitioning:overflow-y-auto`,n),"data-slot":`popover-viewport`,children:e})})})})}function la({repos:e,disabled:t,onAdd:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=(0,Z.useMemo)(()=>{let t=a.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,a]);return(0,$.jsxs)(oa,{open:r,onOpenChange:e=>{e&&o(``),i(e)},children:[(0,$.jsx)(sa,{render:(0,$.jsxs)(f,{variant:`outline`,size:`sm`,disabled:t,className:`h-8 text-xs text-muted-foreground`,children:[(0,$.jsx)(gn,{size:14}),` Add repository`]})}),(0,$.jsxs)(ca,{align:`end`,className:`w-[320px]`,viewportClassName:`p-0`,children:[(0,$.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Gt,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(se,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search repositories`,className:`pl-8`,"aria-label":`Search repositories`})]})}),(0,$.jsx)(`div`,{role:`listbox`,className:`max-h-64 overflow-y-auto py-1`,children:s.length===0?(0,$.jsx)(`div`,{className:`px-3 py-4 text-center text-sm text-muted-foreground`,children:`No repositories found.`}):s.map(e=>(0,$.jsxs)(`button`,{role:`option`,"aria-selected":!1,onClick:()=>{i(!1),n(e.path)},className:`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-accent`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,$.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]},e.path))})]})]})}var ua=e=>e===`antigravity`?`Antigravity`:e===`claude`?`Claude Code`:e===`codex`?`OpenAI Codex`:`GitHub Copilot`,da=e=>e===`claude`?`warning`:e===`codex`?`success`:e===`antigravity`?`accent`:`info`,fa=({ws:e,sessions:t,sessionsLoading:n,setActiveSession:r,setTranscript:i,fetchSessionTranscript:a,handleResumeSession:o})=>(0,$.jsx)(`div`,{children:n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(ft,{className:`size-5 text-primary`})}):t.length===0?(0,$.jsx)(Cn,{className:`rounded-xl border border-border bg-card`,children:(0,$.jsxs)(Sn,{children:[(0,$.jsx)(bn,{variant:`icon`,children:(0,$.jsx)(Mn,{})}),(0,$.jsx)(yn,{children:`No Past AI Sessions Found`}),(0,$.jsxs)(xn,{children:[`Start a conversation with your AI assistant (e.g. running `,(0,$.jsx)(`code`,{children:`claude`}),`, `,(0,$.jsx)(`code`,{children:`agy`}),`, `,(0,$.jsx)(`code`,{children:`codex`}),`, or `,(0,$.jsx)(`code`,{children:`copilot`}),` inside this directory) to track session history here.`]})]})}):(0,$.jsx)(`div`,{className:`space-y-3 mb-6`,children:t.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-col justify-between gap-4 rounded-xl border border-border bg-card p-4 transition-colors hover:border-foreground/15 md:flex-row md:items-center`,children:[(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-1.5`,children:[(0,$.jsx)(X,{tone:da(t.assistant),children:ua(t.assistant)}),(0,$.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`Updated: `,new Date(t.updatedAt).toLocaleString()]}),(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`•`}),(0,$.jsxs)(`span`,{className:`text-[10px] font-medium text-muted-foreground`,children:[t.messageCount,` messages`]})]}),(0,$.jsx)(`h4`,{className:`truncate pr-4 text-xs font-semibold text-foreground`,title:t.title,children:t.title})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>{r(t),i([]),a(t.assistant,t.id)},children:[(0,$.jsx)(Nn,{size:13}),` View Chat Log`]}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>o(e,t.id,t.assistant),children:[(0,$.jsx)(un,{size:11}),` Resume`]})]})]},t.id))})});function pa({ws:e}){let t=e.branchName,n=Yt(t),r=Xt(t),i=Qt(t),a=n.data,o=(0,Z.useMemo)(()=>a?.services??[],[a]),s=(0,Z.useMemo)(()=>a?.runningState??[],[a]),l=a?.orchestrationTools??[],u=(0,Z.useMemo)(()=>a?.runningOrchestrators??[],[a]),d=(0,Z.useMemo)(()=>u.filter(e=>e.mode===`pm2`&&e.logName),[u]),[p,m]=(0,Z.useState)(`classic`),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{let e=[...o.map(e=>e.name),...d.map(e=>e.logName)];e.length===0?_!==null&&v(null):(!_||!e.includes(_))&&v(e[0])},[o,d]);let{logs:y,connected:b,clear:x}=on(t,_,!0),S=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{S.current?.scrollIntoView({behavior:`smooth`})},[y]);let C=(0,Z.useMemo)(()=>new Set(s.filter(e=>e.pid>0).map(e=>e.name)),[s]),w=(0,Z.useMemo)(()=>new Set(u.map(e=>e.id)),[u]),T=C.size>0,E=p===`matrix`?`term-matrix`:p===`dracula`?`term-dracula`:`term-classic`,D=r.isPending||i.isPending;return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[n.isLoading&&(0,$.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-[10px] text-primary`,children:[(0,$.jsx)(ft,{className:`size-3`}),(0,$.jsx)(`span`,{className:`font-semibold tracking-wider uppercase`,children:`Scanning service configurations...`})]}),l.length>0&&(0,$.jsxs)(`div`,{className:`mb-5 rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(en,{size:12,className:`text-info`}),` Orchestration tools`]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:l.map(e=>{let t=w.has(e.id);return(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 rounded-full ${t?`bg-success`:`bg-muted-foreground/40`}`}),(0,$.jsx)(`span`,{className:`text-xs font-bold text-foreground`,children:e.tool}),(0,$.jsx)(X,{tone:`idle`,dot:!1,children:e.mode})]}),(0,$.jsx)(`code`,{className:`mt-1 block truncate font-mono text-[9px] text-muted-foreground`,children:e.configPath})]}),(0,$.jsx)(`div`,{className:`shrink-0`,children:t?(0,$.jsxs)(f,{size:`xs`,variant:`destructive`,"aria-label":`Stop ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`stop`,id:e.id}),children:[(0,$.jsx)(Bn,{size:12}),` Stop`]}):(0,$.jsxs)(f,{size:`xs`,"aria-label":`Start ${e.tool}`,disabled:D,onClick:()=>i.mutate({action:`start`,id:e.id}),children:[(0,$.jsx)(un,{size:12}),` Start`]})})]},e.id)})})]}),(0,$.jsxs)(`div`,{className:`mb-6 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between text-xs font-semibold text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:`Workspace Status`}),(0,$.jsx)(X,{tone:T?`running`:`idle`,children:T?`Active`:`Standby`})]}),(0,$.jsx)(`div`,{className:`mb-4 text-xs font-semibold text-foreground`,children:T?`${C.size} process${C.size===1?``:`es`} active`:`All processes offline`}),(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsxs)(f,{disabled:T||D,onClick:()=>r.mutate({action:`start`}),children:[(0,$.jsx)(un,{size:14}),` Start All Services`]}),(0,$.jsxs)(f,{variant:`destructive`,disabled:!T||D,onClick:()=>r.mutate({action:`stop`}),children:[(0,$.jsx)(Bn,{size:14}),` Stop All`]})]})]}),(o.length>0||d.length>0)&&(0,$.jsxs)(`div`,{className:`grid grid-cols-1 overflow-hidden rounded-xl border border-border bg-card shadow-sm lg:grid-cols-12`,children:[(0,$.jsxs)(`div`,{className:`border-b border-border bg-muted/30 p-5 lg:col-span-4 lg:border-b-0 lg:border-r`,children:[(0,$.jsxs)(`h4`,{className:`mb-4 flex items-center gap-1.5 border-b border-border pb-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground`,children:[(0,$.jsx)(Vn,{size:12,className:`text-primary`}),` Background Services`]}),(0,$.jsxs)(`div`,{className:`flex max-h-[400px] flex-col gap-2 overflow-y-auto pr-1`,children:[o.map(e=>{let t=_===e.name,n=C.has(e.name);return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer flex-col rounded-xl border p-3 transition-colors`,t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(e.name),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n?`bg-success`:`bg-destructive`}`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.name})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,onClick:e=>e.stopPropagation(),children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Restart ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`restart`,service:e.name}),children:(0,$.jsx)(Fn,{})}),(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Stop ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`stop`,service:e.name}),children:(0,$.jsx)(Bn,{})})]}):(0,$.jsx)(f,{size:`icon-xs`,variant:`ghost`,"aria-label":`Start ${e.name}`,disabled:D,onClick:()=>r.mutate({action:`start`,service:e.name}),children:(0,$.jsx)(un,{})})})]}),e.port?(0,$.jsxs)(`span`,{className:`mt-2 w-fit rounded border border-border bg-background px-2 py-0.5 font-mono text-[9px] text-muted-foreground`,children:[`Port: `,e.port]}):null,(0,$.jsxs)(`code`,{className:`mt-2 block truncate rounded border border-border bg-muted/40 p-1.5 font-mono text-[9px] text-muted-foreground`,children:[e.command,` `,e.args.join(` `)]})]},e.name)}),d.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-2 border-t border-border pt-3 text-[9px] font-bold uppercase tracking-wider text-muted-foreground`,children:`Orchestrators`}),d.map(e=>{let t=e.logName;return(0,$.jsxs)(`div`,{className:c(`flex cursor-pointer items-center gap-2 rounded-xl border p-3 transition-colors`,_===t?`border-primary/40 bg-primary/10 text-foreground`:`border-border bg-card text-muted-foreground hover:border-foreground/15 hover:bg-accent/50 hover:text-foreground`),onClick:()=>v(t),children:[(0,$.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-success`}),(0,$.jsx)(`span`,{className:`truncate text-xs font-bold`,children:e.tool}),(0,$.jsx)(X,{tone:`idle`,dot:!1,children:e.mode})]},e.id)})]})]})]}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col bg-background lg:col-span-8`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border bg-muted/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`font-mono text-xs font-bold text-primary`,children:_||`no-service`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`|`}),(0,$.jsx)(X,{tone:b?`running`:`idle`,children:b?`streaming`:`idle`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 self-end sm:self-auto`,children:[(0,$.jsx)(`div`,{className:`flex rounded-lg border border-border bg-card p-0.5 text-[9px] font-semibold text-muted-foreground`,children:[`classic`,`matrix`,`dracula`].map(e=>(0,$.jsx)(`button`,{className:c(`cursor-pointer rounded-md px-2 py-1 capitalize transition-colors`,p===e?`bg-primary/10 font-bold text-primary`:`hover:text-foreground`),onClick:()=>m(e),children:e},e))}),(0,$.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,$.jsx)(`button`,{onClick:x,className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Clear Console`,children:(0,$.jsx)(Kt,{size:13})}),(0,$.jsx)(`button`,{onClick:()=>g(!h),className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:h?`Minimize Console`:`Expand Console`,children:h?(0,$.jsx)(Pn,{size:13}):(0,$.jsx)(jn,{size:13})})]})]})]}),(0,$.jsxs)(`div`,{className:c(`relative overflow-y-auto whitespace-pre-wrap p-5 font-mono text-[10.5px] leading-relaxed selection:bg-primary/20`,E,h?`h-[520px]`:`h-80`),children:[y.trim()?y:(0,$.jsx)(`span`,{className:`font-mono italic text-muted-foreground`,children:`(no log content yet)`}),(0,$.jsx)(`div`,{ref:S})]})]})]})]})}var ma=({ws:e,gitChanges:t,gitChangesLoading:n,syncLoading:r,syncResults:i,commitMessage:a,showCommitModal:o,commitLoading:s,commitResults:c,setSyncResults:l,setCommitResults:u,setCommitMessage:d,setShowCommitModal:p,fetchGitChanges:m,handleSyncAll:h,handleCommitAll:g})=>{let[_,v]=(0,Z.useState)({}),[y,b]=(0,Z.useState)({}),[x,S]=(0,Z.useState)({}),[C,w]=(0,Z.useState)({}),[T,E]=(0,Z.useState)(``),D=async(t,n)=>{let r=`${t}/${n}`,i=!_[r];if(v(e=>({...e,[r]:i})),i&&!y[r]){S(e=>({...e,[r]:!0})),w(e=>({...e,[r]:``}));try{let i=encodeURIComponent(e.branchName),a=await fetch(`/api/workspace/${i}/changes/diff?repo=${encodeURIComponent(t)}&file=${encodeURIComponent(n)}`);if(!a.ok)throw Error(`Failed to load diff: ${a.statusText}`);let o=await a.json();b(e=>({...e,[r]:o.diff||``}))}catch(e){w(t=>({...t,[r]:e.message||`Unknown error`}))}finally{S(e=>({...e,[r]:!1}))}}},O=e=>!e||!e.trim()?(0,$.jsx)(`div`,{className:`p-3 font-mono text-[11px] italic text-muted-foreground`,children:`No diff details available.`}):(0,$.jsx)(`pre`,{className:`custom-scrollbar max-h-[450px] overflow-x-auto overflow-y-auto rounded-xl border border-border bg-muted/40 p-4 font-mono text-[11px] leading-relaxed text-muted-foreground select-text`,children:e.split(`
|
|
2
|
-
`).map((e,t)=>{let n;return n=e.startsWith(`+`)&&!e.startsWith(`+++`)?`block w-full rounded-sm bg-success/10 px-1 text-success-foreground`:e.startsWith(`-`)&&!e.startsWith(`---`)?`block w-full rounded-sm bg-destructive/10 px-1 text-destructive-foreground`:e.startsWith(`@@`)?`block w-full bg-info/10 px-1 font-semibold italic text-info-foreground`:e.startsWith(`diff`)||e.startsWith(`index`)||e.startsWith(`---`)||e.startsWith(`+++`)?`block w-full font-bold text-muted-foreground`:`block w-full px-1 text-foreground`,(0,$.jsx)(`code`,{className:n,children:e},t)})});return(0,$.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-6 flex-wrap gap-3`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(fn,{size:16,className:`text-primary`}),` Active Workspace Git Diffs`]}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>m(e.branchName),disabled:n,children:[(0,$.jsx)(nn,{size:11,className:n?`animate-spin text-primary`:``}),` Refresh Changes`]}),e.mode!==`in-place`&&(0,$.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>h(e.branchName),disabled:r,children:[r?(0,$.jsx)(ft,{className:`size-3`}):(0,$.jsx)(nn,{size:11}),` Sync All`]}),(0,$.jsx)(f,{size:`sm`,onClick:()=>p(!0),disabled:t.every(e=>e.files.length===0)||s,children:`Commit & Push All`})]})]}),i&&e.mode!==`in-place`&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-info/25 bg-info/10 p-5 text-info-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-info/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Rebase / Sync Action Logs`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-info-foreground hover:text-foreground`,onClick:()=>l(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:i.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Synced (${e.message})`:`✗ Conflict: ${e.message}`})]},e.repoName))})]}),c&&(0,$.jsxs)(`div`,{className:`relative mb-5 rounded-xl border border-success/25 bg-success/10 p-5 text-success-foreground shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between border-b border-success/20 pb-2`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-xs font-bold text-foreground`,children:`Commit & Push Results`}),(0,$.jsx)(`button`,{className:`cursor-pointer text-[10px] font-bold text-success-foreground hover:text-foreground`,onClick:()=>u(null),children:`Dismiss`})]}),(0,$.jsx)(`div`,{className:`space-y-2`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-card p-2 font-mono text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.repoName}),(0,$.jsx)(`span`,{className:e.success?`font-bold text-success-foreground`:`font-bold text-destructive-foreground`,children:e.success?`✓ Committed ${e.filesChanged} file(s) (${e.commitHash?e.commitHash.slice(0,7):`no hash`})`:`✗ Error: ${e.message}`})]},e.repoName))})]}),o&&(0,$.jsxs)(`div`,{className:`relative mb-6 rounded-xl border border-border bg-card p-6 shadow-sm animate-rise`,children:[(0,$.jsxs)(`h5`,{className:`mb-3 flex items-center gap-1.5 text-xs font-bold text-foreground`,children:[(0,$.jsx)(In,{size:13,className:`text-primary`}),` Enter Commit Message`]}),(0,$.jsx)(se,{type:`text`,className:`mb-4 font-mono text-xs`,placeholder:`feat: implement multi-repo logic...`,value:a,onChange:e=>d(e.target.value),onKeyDown:t=>{t.key===`Enter`&&a.trim()&&g(e.branchName)}}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2.5`,children:[(0,$.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{p(!1),d(``)},disabled:s,children:`Cancel`}),(0,$.jsxs)(f,{size:`sm`,onClick:()=>g(e.branchName),disabled:s||!a.trim(),children:[s?(0,$.jsx)(ft,{className:`size-3`}):null,s?`Committing...`:`Commit & Push All`]})]})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,$.jsx)(ft,{className:`size-6 text-primary`})}):(0,$.jsx)(`div`,{className:`space-y-6`,children:t.every(e=>e.files.length===0)?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center rounded-xl border border-border bg-card py-16 text-center`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-success/25 bg-success/10 text-success-foreground shadow-sm`,children:(0,$.jsx)(dn,{size:20})}),(0,$.jsx)(`h5`,{className:`text-sm font-bold text-foreground`,children:`No Uncommitted Changes`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Workspace repositories are completely in sync with Git feature branches.`})]}):t.map(e=>{if(e.files.length===0)return null;let t=e.files.length,n=e.files.reduce((e,t)=>e+(t.additions||0),0),r=e.files.reduce((e,t)=>e+(t.deletions||0),0);return(0,$.jsxs)(`div`,{className:`relative rounded-xl border border-border bg-card p-6 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex justify-between items-center mb-4 flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`h5`,{className:`font-mono text-sm font-bold text-foreground`,children:e.repoName}),(0,$.jsxs)(X,{tone:`warning`,dot:!1,children:[t,` file`,t===1?``:`s`,` changed`]}),(n>0||r>0)&&(0,$.jsxs)(`span`,{className:`rounded border border-border bg-muted/40 px-2 py-0.5 font-mono text-[10px] font-bold`,children:[(0,$.jsxs)(`span`,{className:`font-bold text-success-foreground`,children:[`+`,n]}),` `,(0,$.jsxs)(`span`,{className:`font-bold text-destructive-foreground`,children:[`-`,r]})]})]}),(0,$.jsx)(`span`,{className:`max-w-[280px] truncate font-mono text-[10px] text-muted-foreground`,title:e.repoPath,children:e.repoPath})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.files.map(t=>{let n=`${e.repoName}/${t.file}`,r=!!_[n],i=!!x[n],a=y[n]||``,o=C[n]||``;return(0,$.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-muted/20 transition-colors hover:border-foreground/15`,children:[(0,$.jsxs)(`div`,{className:`flex cursor-pointer select-none items-center justify-between px-4 py-3 transition-colors hover:bg-accent/50`,onClick:()=>D(e.repoName,t.file),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[r?(0,$.jsx)(Tt,{size:14,className:`shrink-0 text-primary`}):(0,$.jsx)(Dn,{size:14,className:`shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`max-w-[240px] truncate font-mono text-[11px] text-foreground sm:max-w-[480px]`,title:t.file,children:t.file}),(t.additions>0||t.deletions>0)&&(0,$.jsxs)(`span`,{className:`ml-1 shrink-0 font-mono text-[9px] font-bold text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`text-success-foreground`,children:[`+`,t.additions]}),` /`,` `,(0,$.jsxs)(`span`,{className:`text-destructive-foreground`,children:[`-`,t.deletions]})]})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2.5 shrink-0`,children:(0,$.jsx)(`span`,{className:`rounded border px-2 py-0.5 text-[8px] font-bold uppercase tracking-wider ${t.type===`added`?`border-success/25 bg-success/10 text-success-foreground`:t.type===`deleted`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-warning/25 bg-warning/10 text-warning-foreground`}`,children:t.type})})]}),r&&(0,$.jsx)(`div`,{className:`border-t border-border bg-background p-3`,children:i?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 p-2 font-mono text-[10px] text-primary`,children:[(0,$.jsx)(ft,{className:`size-3`}),` Loading diff...`]}):o?(0,$.jsxs)(`div`,{className:`p-2 font-mono text-[10px] text-destructive-foreground`,children:[`Error: `,o]}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{className:`absolute top-2 right-2 z-10`,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(a),E(n),setTimeout(()=>E(``),2e3)},className:`cursor-pointer rounded-lg border border-border bg-card p-1.5 text-muted-foreground shadow-sm transition-colors hover:bg-accent hover:text-foreground`,title:`Copy Diff`,children:T===n?(0,$.jsx)(dn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(an,{size:12})})}),O(a)]})})]},t.file)})})]},e.repoName)})})]})},ha=({ws:e,knowledgeContent:t,knowledgeLoading:n,isEditingKnowledge:r,editedKnowledge:i,saveKnowledgeLoading:a,setEditedKnowledge:o,setIsEditingKnowledge:s,handleSaveKnowledge:c})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsxs)(`header`,{className:`flex justify-between items-center mb-4`,children:[(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(mn,{size:16,className:`text-info`}),` Persistent Knowledge Memory (nexusflow-knowledge.md)`]}),(0,$.jsx)(`div`,{className:`flex gap-2`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`outline`,size:`xs`,onClick:()=>{o(t),s(!1)},disabled:a,children:`Cancel`}),(0,$.jsxs)(f,{size:`xs`,onClick:()=>c(e.branchName),disabled:a,children:[a?(0,$.jsx)(ft,{className:`size-3`}):(0,$.jsx)(In,{size:10}),` Save`]})]}):(0,$.jsxs)(f,{variant:`outline`,size:`xs`,onClick:()=>s(!0),disabled:n,children:[(0,$.jsx)(Rn,{size:10}),` Edit Knowledge`]})})]}),n?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(nn,{className:`animate-spin text-primary`,size:20})}):r?(0,$.jsx)(Tn,{className:`[&_[data-slot=textarea]]:h-96 [&_[data-slot=textarea]]:resize-y [&_[data-slot=textarea]]:font-mono [&_[data-slot=textarea]]:text-xs`,value:i,onChange:e=>o(e.target.value)}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:t||`No knowledge file generated yet.`})]}),ga=({planContent:e,planLoading:t})=>(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,$.jsx)(`header`,{className:`flex justify-between items-center mb-4`,children:(0,$.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-bold text-foreground`,children:[(0,$.jsx)(An,{size:16,className:`text-info`}),` Inter-Repo Implementation Plan (nexusflow-plan.md)`]})}),t?(0,$.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,$.jsx)(nn,{className:`animate-spin text-primary`,size:20})}):(0,$.jsx)(`div`,{className:`max-h-96 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/40 p-4 font-mono text-xs leading-relaxed text-muted-foreground`,children:e||`No implementation plan generated yet.`})]}),_a=e=>`nexusflow_chat_${e}`,va=()=>({v:2,sessionId:null,providerId:null,sessionStarted:!1,messages:[]});function ya(e){try{let t=localStorage.getItem(_a(e));if(!t)return va();let n=JSON.parse(t);return Array.isArray(n)?{...va(),messages:n.filter(e=>e&&typeof e.content==`string`&&(e.role===`user`||e.role===`assistant`)).map(e=>({role:e.role,content:e.content}))}:n&&n.v===2&&Array.isArray(n.messages)?n:va()}catch{return va()}}var ba=500;function xa(e,t){try{let n=t.messages.length>ba?{...t,messages:t.messages.slice(-500)}:t;localStorage.setItem(_a(e),JSON.stringify(n))}catch(e){console.error(`Failed to save chat to localStorage`,e)}}function Sa(e){try{localStorage.removeItem(_a(e))}catch{}}function Ca({open:e,onClose:t,ws:n,onPick:r,error:i}){let[a,o]=(0,Z.useState)([]),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null);return(0,Z.useEffect)(()=>{e&&(c(!0),u(null),fetch(`/api/workspace/${encodeURIComponent(n.branchName)}/sessions`).then(e=>e.json()).then(e=>{let t=(e.sessions||[]).filter(e=>e.assistant===`claude`);o(t)}).catch(()=>u(`Failed to load sessions.`)).finally(()=>c(!1)))},[e,n.branchName]),(0,$.jsx)(rn,{open:e,onOpenChange:e=>!e&&t(),children:(0,$.jsxs)(cn,{className:`max-w-lg`,children:[(0,$.jsx)(pn,{children:(0,$.jsx)(_n,{children:`Resume a past session`})}),(0,$.jsxs)(tn,{className:`flex max-h-[60vh] flex-col gap-2`,children:[(i||l)&&(0,$.jsx)(`div`,{className:`rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:i||l}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(wn,{className:`h-14`}),(0,$.jsx)(wn,{className:`h-14`}),(0,$.jsx)(wn,{className:`h-14`})]}):a.length===0?(0,$.jsx)(Cn,{children:(0,$.jsxs)(Sn,{children:[(0,$.jsx)(bn,{variant:`icon`,children:(0,$.jsx)(kn,{})}),(0,$.jsx)(yn,{children:`No Claude sessions found`}),(0,$.jsx)(xn,{children:`Past Claude Code conversations for this workspace will show up here.`})]})}):a.map(e=>(0,$.jsxs)(`button`,{onClick:()=>r(e),className:`cursor-pointer rounded-lg border border-border bg-card p-3 text-left transition-colors hover:border-foreground/15 hover:bg-accent/50`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,title:e.title,children:e.title}),(0,$.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:new Date(e.updatedAt).toLocaleString()}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(Nn,{size:11}),(0,$.jsxs)(`span`,{children:[e.messageCount,` messages`]})]})]},e.id))]})]})})}var wa=m(((e,t)=>{var n=[[{color:`0, 0, 0`,class:`ansi-black`},{color:`187, 0, 0`,class:`ansi-red`},{color:`0, 187, 0`,class:`ansi-green`},{color:`187, 187, 0`,class:`ansi-yellow`},{color:`0, 0, 187`,class:`ansi-blue`},{color:`187, 0, 187`,class:`ansi-magenta`},{color:`0, 187, 187`,class:`ansi-cyan`},{color:`255,255,255`,class:`ansi-white`}],[{color:`85, 85, 85`,class:`ansi-bright-black`},{color:`255, 85, 85`,class:`ansi-bright-red`},{color:`0, 255, 0`,class:`ansi-bright-green`},{color:`255, 255, 85`,class:`ansi-bright-yellow`},{color:`85, 85, 255`,class:`ansi-bright-blue`},{color:`255, 85, 255`,class:`ansi-bright-magenta`},{color:`85, 255, 255`,class:`ansi-bright-cyan`},{color:`255, 255, 255`,class:`ansi-bright-white`}]],r=/(https?:\/\/(?:[A-Za-z0-9#;/?:@=+$',_.!~*()[\]-]|&|%[A-Fa-f0-9]{2})+)/gm;t.exports=class e{static escapeForHtml(t){return new e().escapeForHtml(t)}static linkify(t){return new e().linkify(t)}static ansiToHtml(t,n){return new e().ansiToHtml(t,n)}static ansiToJson(t,n){return new e().ansiToJson(t,n)}static ansiToText(t){return new e().ansiToText(t)}constructor(){this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0,this.decorations=[]}setupPalette(){this.PALETTE_COLORS=[];for(let e=0;e<2;++e)for(let t=0;t<8;++t)this.PALETTE_COLORS.push(n[e][t].color);let e=[0,95,135,175,215,255],t=(t,n,r)=>e[t]+`, `+e[n]+`, `+e[r];for(let e=0;e<6;++e)for(let n=0;n<6;++n)for(let r=0;r<6;++r)this.PALETTE_COLORS.push(t(e,n,r));let r=8;for(let e=0;e<24;++e,r+=10)this.PALETTE_COLORS.push(r+`, `+r+`, `+r)}escapeForHtml(e){return e.replace(/[&<>\"]/gm,e=>e==`&`?`&`:e==`"`?`"`:e==`<`?`<`:e==`>`?`>`:``)}linkify(e){return e.replace(r,e=>`<a href="${e}">${e}</a>`)}ansiToHtml(e,t){return this.process(e,t,!0)}ansiToJson(e,t){return t||={},t.json=!0,t.clearLine=!1,this.process(e,t,!0)}ansiToText(e){return this.process(e,{},!1)}process(e,t,n){let r=this,i=e.split(/\033\[/),a=i.shift();t??={},t.clearLine=/\r/.test(e);let o=i.map(e=>this.processChunk(e,t,n));if(t&&t.json){let e=r.processChunkJson(``);return e.content=a,e.clearLine=t.clearLine,o.unshift(e),t.remove_empty&&(o=o.filter(e=>!e.isEmpty())),o}else o.unshift(a);return o.join(``)}processChunkJson(e,t,r){t=t===void 0?{}:t;let i=t.use_classes=t.use_classes!==void 0&&t.use_classes,a=t.key=i?`class`:`color`,o={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,isInverted:!1,clearLine:t.clearLine,decoration:null,decorations:[],was_processed:!1,isEmpty:()=>!o.content},s=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!s)return o;o.content=s[4];let c=s[2].split(`;`);if(s[1]!==``||s[3]!==`m`||!r)return o;let l=this;for(;c.length>0;){let e=c.shift(),t=parseInt(e);if(isNaN(t)||t===0)l.fg=l.bg=null,l.decorations=[];else if(t===1)l.decorations.push(`bold`);else if(t===2)l.decorations.push(`dim`);else if(t===3)l.decorations.push(`italic`);else if(t===4)l.decorations.push(`underline`);else if(t===5)l.decorations.push(`blink`);else if(t===7)l.decorations.push(`reverse`);else if(t===8)l.decorations.push(`hidden`);else if(t===9)l.decorations.push(`strikethrough`);else if(t===21)l.removeDecoration(`bold`);else if(t===22)l.removeDecoration(`bold`),l.removeDecoration(`dim`);else if(t===23)l.removeDecoration(`italic`);else if(t===24)l.removeDecoration(`underline`);else if(t===25)l.removeDecoration(`blink`);else if(t===27)l.removeDecoration(`reverse`);else if(t===28)l.removeDecoration(`hidden`);else if(t===29)l.removeDecoration(`strikethrough`);else if(t===39)l.fg=null;else if(t===49)l.bg=null;else if(t>=30&&t<38)l.fg=n[0][t%10][a];else if(t>=90&&t<98)l.fg=n[1][t%10][a];else if(t>=40&&t<48)l.bg=n[0][t%10][a];else if(t>=100&&t<108)l.bg=n[1][t%10][a];else if(t===38||t===48){let e=t===38;if(c.length>=1){let t=c.shift();if(t===`5`&&c.length>=1){let t=parseInt(c.shift());if(t>=0&&t<=255)if(!i)this.PALETTE_COLORS||l.setupPalette(),e?l.fg=this.PALETTE_COLORS[t]:l.bg=this.PALETTE_COLORS[t];else{let r=t>=16?`ansi-palette-`+t:n[+(t>7)][t%8].class;e?l.fg=r:l.bg=r}}else if(t===`2`&&c.length>=3){let t=parseInt(c.shift()),n=parseInt(c.shift()),r=parseInt(c.shift());if(t>=0&&t<=255&&n>=0&&n<=255&&r>=0&&r<=255){let a=t+`, `+n+`, `+r;i?e?(l.fg=`ansi-truecolor`,l.fg_truecolor=a):(l.bg=`ansi-truecolor`,l.bg_truecolor=a):e?l.fg=a:l.bg=a}}}}}return l.fg===null&&l.bg===null&&l.decorations.length===0?o:(o.fg=l.fg,o.bg=l.bg,o.fg_truecolor=l.fg_truecolor,o.bg_truecolor=l.bg_truecolor,o.decorations=l.decorations,o.decoration=l.decorations.slice(-1).pop()||null,o.was_processed=!0,o)}processChunk(e,t,r){t||={};let i=this.processChunkJson(e,t,r),a=t.use_classes;if(i.decorations=i.decorations.filter(e=>{if(e===`reverse`){i.fg||=n[0][7][a?`class`:`color`],i.bg||=n[0][0][a?`class`:`color`];let e=i.fg;i.fg=i.bg,i.bg=e;let t=i.fg_truecolor;return i.fg_truecolor=i.bg_truecolor,i.bg_truecolor=t,i.isInverted=!0,!1}return!0}),t.json)return i;if(i.isEmpty())return``;if(!i.was_processed)return i.content;let o=[],s=[],c=[],l={},u=e=>{let t=[],n;for(n in e)e.hasOwnProperty(n)&&t.push(`data-`+n+`="`+this.escapeForHtml(e[n])+`"`);return t.length>0?` `+t.join(` `):``};return i.isInverted&&(l[`ansi-is-inverted`]=`true`),i.fg&&(a?(o.push(i.fg+`-fg`),i.fg_truecolor!==null&&(l[`ansi-truecolor-fg`]=i.fg_truecolor,i.fg_truecolor=null)):o.push(`color:rgb(`+i.fg+`)`)),i.bg&&(a?(o.push(i.bg+`-bg`),i.bg_truecolor!==null&&(l[`ansi-truecolor-bg`]=i.bg_truecolor,i.bg_truecolor=null)):o.push(`background-color:rgb(`+i.bg+`)`)),i.decorations.forEach(e=>{if(a){s.push(`ansi-`+e);return}e===`bold`?s.push(`font-weight:bold`):e===`dim`?s.push(`opacity:0.5`):e===`italic`?s.push(`font-style:italic`):e===`hidden`?s.push(`visibility:hidden`):e===`strikethrough`?c.push(`line-through`):c.push(e)}),c.length&&s.push(`text-decoration:`+c.join(` `)),a?`<span class="`+o.concat(s).join(` `)+`"`+u(l)+`>`+i.content+`</span>`:`<span style="`+o.concat(s).join(`;`)+`"`+u(l)+`>`+i.content+`</span>`}removeDecoration(e){let t=this.decorations.indexOf(e);t>=0&&this.decorations.splice(t,1)}}})),Ta=m(((e,t)=>{function n(e){if(!e)return``;if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,`
|
|
3
|
-
`);/\r./.test(e);)e=e.replace(/^([^\r\n]*)\r+([^\r\n]+)/gm,function(e,t,n){return n+t.slice(n.length)});return e}function r(e){for(var t=0,n=0;n<e.length;n++)e[t].length<=e[n].length&&(t=n);return t}function i(e){if(!/\r/.test(e))return e;for(var t=e.split(`\r`),n=[];t.length>0;){var i=r(t);n.push(t[i]),t=t.slice(i+1)}return n.join(`\r`)}function a(e){if(!e)return``;if(!/\r/.test(e))return e;if(!/\n/.test(e))return i(e);e=e.replace(/\r+\n/gm,`
|
|
4
|
-
`);var t=e.lastIndexOf(`
|
|
5
|
-
`);return n(e.slice(0,t))+`
|
|
6
|
-
`+i(e.slice(t+1))}t.exports=n,t.exports.escapeCarriageReturn=n,t.exports.escapeCarriageReturnSafe=a})),Ea=m(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),Da=m(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),Oa=m(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),ka=m(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),Aa=m(((e,t)=>{t.exports=function(e){var t={};t.src_Any=Ea().source,t.src_Cc=Da().source,t.src_Z=Oa().source,t.src_P=ka().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),ja=m(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=Aa()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),Ma=n(m((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=t&&t.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var i={};if(t!=null)for(var a=e(t),o=0;o<a.length;o++)a[o]!=="default"&&n(i,t,a[o]);return r(i,t),i}})(),a=t&&t.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=g;var o=a(wa()),s=Ta(),c=a(ja()),l=i(e());function u(e,t=!1){return e=(0,s.escapeCarriageReturn)(_(e)),o.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function d(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function f(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function p(e,t,n,r){let i=t?null:f(n),a=t?d(n):null;return e?e===`fuzzy`?h(n,r,i,a):m(n,r,i,a):l.createElement(`span`,{style:i,key:r,className:a},n.content)}function m(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let c=n.startsWith(`www.`)?`http://${n}`:n;i.push(l.createElement(`a`,{key:o,href:c,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),l.createElement(`span`,{style:n,key:t,className:r},i)}function h(e,t,n,r){let i=(0,c.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return l.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return l.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(l.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),l.createElement(`span`,{style:n,key:t,className:r},o)}function g(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return l.createElement(`code`,{className:t},u(r??``,n??!1).map(p.bind(null,i??!1,n??!1)))}function _(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),Na=Ma.default.default||Ma.default,Pa=`claude-cli`,Fa=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):null,Ia=(0,Z.memo)(function({msg:e,idx:t,copied:n,onCopy:r}){if(e.role===`system`)return(0,$.jsx)(`div`,{className:`flex justify-center`,children:(0,$.jsx)(`span`,{className:c(`rounded-full border px-3 py-1 text-center text-[11px]`,e.kind===`error`?`border-destructive/25 bg-destructive/10 text-destructive-foreground`:`border-border bg-muted text-muted-foreground`),children:e.content})});let i=e.role===`user`,a=!i&&e.content.includes(`\x1B`);return(0,$.jsxs)(`div`,{className:`flex flex-col ${i?`items-end`:`items-start`}`,children:[(0,$.jsx)(`div`,{className:`group relative max-w-[85%] rounded-lg p-3 ${i?`bg-primary text-primary-foreground`:`border border-border bg-card text-foreground`}`,children:i?(0,$.jsx)(`div`,{className:`whitespace-pre-wrap text-sm`,children:e.content}):(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,$.jsx)(`div`,{className:`overflow-x-auto whitespace-pre-wrap rounded-md bg-muted/50 p-2 font-mono text-xs text-foreground`,children:(0,$.jsx)(Na,{children:e.content})}):(0,$.jsx)($t,{content:e.content}),(0,$.jsx)(`button`,{onClick:()=>r(t,e.content),className:`absolute -right-2.5 -top-2.5 hidden h-6 w-6 cursor-pointer place-items-center rounded-md border border-border bg-card text-muted-foreground shadow-sm hover:text-foreground group-hover:grid`,title:`Copy message`,children:n?(0,$.jsx)(dn,{size:12,className:`text-success-foreground`}):(0,$.jsx)(an,{size:12})})]})}),e.ts&&(0,$.jsx)(`span`,{className:`mt-1 text-[10px] text-muted-foreground`,children:Fa(e.ts)})]})});function La({ws:e}){let[t,n]=(0,Z.useState)([]),[r]=(0,Z.useState)(()=>ya(e.branchName)),[i,a]=(0,Z.useState)(r.messages),[o,s]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(!1),[d,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(``),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),w=(0,Z.useRef)(null),T=(0,Z.useRef)(null),E=(0,Z.useRef)(null),D=(0,Z.useRef)(!0),O=(0,Z.useRef)(r.sessionId),k=(0,Z.useRef)(r.sessionStarted),A=(0,Z.useRef)(!1),j=(0,Z.useRef)(!1),M=(0,Z.useRef)({messages:i,agentName:g}),N=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{M.current={messages:i,agentName:g}},[i,g]);let P=(0,Z.useCallback)(()=>{N.current=null,xa(e.branchName,{v:2,sessionId:O.current,providerId:M.current.agentName||r.providerId,sessionStarted:k.current,messages:M.current.messages})},[e.branchName,r.providerId]);(0,Z.useEffect)(()=>{let e=i[i.length-1];(D.current||e?.role===`user`)&&E.current?.scrollIntoView({behavior:e?.role===`user`?`smooth`:`auto`}),N.current&&clearTimeout(N.current),N.current=setTimeout(P,400)},[i,g,P]),(0,Z.useEffect)(()=>{let e=()=>P();return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),N.current&&clearTimeout(N.current),P()}},[P]),(0,Z.useEffect)(()=>{fetch(`/api/adapters/status`).then(e=>e.json()).then(e=>{n(e);let t=(r.providerId?e.find(e=>e.id===r.providerId):void 0)||e.find(e=>e.isConfigured)||e[0];t&&_(t.id)}).catch(e=>console.error(`Failed to fetch agent data`,e))},[]),(0,Z.useEffect)(()=>()=>{w.current&&w.current.close()},[]);let F=t.find(e=>e.id===g),I=!!g&&(!F||F.isConfigured),L=()=>{A.current=!1,h(!1)},R=(e,t)=>{a(n=>[...n,{role:`system`,content:e,kind:t,ts:Date.now()}])},z=(e,t)=>{e.send(JSON.stringify({type:`input`,input:t})),k.current=!0,a(e=>[...e,{role:`user`,content:t,ts:Date.now()}]),s(``),p(!0),L()},B=()=>{j.current||(j.current=!0,R(`Session ended`,`note`))},V=()=>{if(w.current||!I)return;let t=``;t=t.startsWith(`http`)?t.replace(`http`,`ws`):window.location.origin.replace(`http`,`ws`),t+=`/ws`,j.current=!1;let n=new WebSocket(t);n.onopen=()=>{if(w.current!==n)return;u(!0);let t={type:`start`,command:g,cwd:e.workspacePath};g===Pa&&(O.current||(O.current=crypto.randomUUID(),k.current=!1),t.sessionId=O.current,t.resume=k.current),n.send(JSON.stringify(t));let r=o.trim();r&&z(n,r)},n.onmessage=e=>{if(w.current===n)try{let t=JSON.parse(e.data);if(t.type===`stream`){let e=A.current;A.current=!0,h(!0),a(n=>{let r=n[n.length-1];if(e&&r?.role===`assistant`){let e=[...n];return e[e.length-1]={...r,content:r.content+t.text},e}return[...n,{role:`assistant`,content:t.text,ts:Date.now()}]})}else t.type===`status`?(p(t.state===`busy`),t.state!==`busy`&&L()):t.type===`system`?(R(t.message,`note`),L()):t.type===`error`?(R(t.message,`error`),p(!1),L()):t.type===`close`&&(u(!1),p(!1),L(),B(),n.close(),w.current=null)}catch(e){console.error(`Failed to parse WS message`,e)}},n.onclose=()=>{w.current===n&&(u(!1),p(!1),L(),B(),w.current=null)},w.current=n},H=()=>{if(w.current){w.current.send(JSON.stringify({type:`stop`}));let e=w.current;w.current=null,e.close(),u(!1),p(!1),L(),B()}},ee=()=>{let e=o.trim();!e||!w.current||d||z(w.current,e)},te=(0,Z.useCallback)((e,t)=>{navigator.clipboard.writeText(t).then(()=>{C(e),setTimeout(()=>C(t=>t===e?null:t),1500)}).catch(()=>{})},[]),ne=async e=>{x(null),w.current&&H();try{let t=await fetch(`/api/session/claude/${encodeURIComponent(e.id)}/transcript`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=((await t.json()).messages||[]).filter(e=>(e.role===`user`||e.role===`assistant`)&&typeof e.content==`string`&&e.content.trim()).map(e=>({role:e.role,content:e.content,ts:e.timestamp&&Date.parse(e.timestamp)||void 0}));O.current=e.id,k.current=!0,_(Pa),a([...n,{role:`system`,kind:`note`,content:`Loaded session — your next message resumes it.`,ts:Date.now()}]),y(!1)}catch{x(`Failed to load the session transcript.`)}},re=()=>{window.confirm(`Are you sure you want to clear this chat history? This also starts a new agent session.`)&&(w.current&&H(),O.current=null,k.current=!1,j.current=!1,a([]),Sa(e.branchName))},ie=d&&!m;return(0,$.jsxs)(`div`,{className:`flex h-full flex-col bg-card`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-border bg-card px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,$.jsx)(`h3`,{className:`font-semibold text-foreground`,children:`Chat`}),(0,$.jsx)(X,{tone:l?`running`:`idle`,dot:!0,children:l?F?.name||`Connected`:`Disconnected`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[i.length>0&&(0,$.jsx)(`button`,{onClick:re,className:`cursor-pointer text-xs text-muted-foreground transition-colors hover:text-destructive-foreground`,children:`Clear`}),(0,$.jsx)(`button`,{onClick:()=>{x(null),y(!0)},className:`grid h-7 w-7 cursor-pointer place-items-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,title:`Resume a past session`,children:(0,$.jsx)(kn,{size:14})}),l&&(0,$.jsxs)(f,{size:`sm`,variant:`outline`,onClick:H,children:[(0,$.jsx)(Bn,{size:14,className:`text-destructive-foreground`}),`Stop`]})]})]}),(0,$.jsx)(Ca,{open:v,onClose:()=>y(!1),ws:e,onPick:ne,error:b}),(0,$.jsxs)(`div`,{ref:T,onScroll:()=>{let e=T.current;e&&(D.current=e.scrollHeight-e.scrollTop-e.clientHeight<80)},className:`flex-1 space-y-4 overflow-y-auto p-4`,children:[i.length===0&&!ie&&(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`No messages yet. Start the agent and say hello.`}),i.map((e,t)=>(0,$.jsx)(Ia,{msg:e,idx:t,copied:S===t,onCopy:te},t)),ie&&(0,$.jsx)(`div`,{className:`flex justify-start`,children:(0,$.jsx)(`div`,{className:`rounded-lg border border-border bg-card px-4 py-3 text-muted-foreground`,children:(0,$.jsx)(nn,{size:14,className:`animate-spin`})})}),(0,$.jsx)(`div`,{ref:E})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border bg-card p-3`,children:[F&&!F.isConfigured&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-destructive/25 bg-destructive/10 px-3 py-2 text-xs text-destructive-foreground`,children:[(0,$.jsxs)(`span`,{className:`font-semibold`,children:[F.name,` provider status:`]}),(0,$.jsx)(`span`,{children:F.message})]}),(0,$.jsxs)(`div`,{className:`flex w-full flex-col rounded-xl border border-border bg-card shadow-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 p-2`,children:[(0,$.jsxs)(ni,{children:[(0,$.jsxs)(ri,{"aria-label":`Select Provider`,className:c(`flex cursor-pointer items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium transition-colors hover:bg-accent`,l?`pointer-events-none opacity-50`:`text-foreground`),children:[F?.icon===`Bot`?(0,$.jsx)(En,{size:14,className:`text-primary`}):(0,$.jsx)(Ut,{size:14,className:`text-primary`}),F?.name||`Select Agent`]}),(0,$.jsx)(ii,{align:`start`,side:`top`,children:t.map(e=>(0,$.jsxs)(ai,{onClick:()=>{l||_(e.id)},children:[e.icon===`Bot`?(0,$.jsx)(En,{size:14}):(0,$.jsx)(Ut,{size:14}),e.name]},e.id))})]}),(0,$.jsx)(`div`,{className:`h-4 w-px bg-border`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Full access`})]}),(0,$.jsxs)(`div`,{className:`flex items-end gap-2 p-2`,children:[(0,$.jsx)(Tn,{value:o,onChange:e=>{s(e.target.value);let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,200)}px`},onKeyDown:e=>{if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),d)return;l?ee():V();let t=e.currentTarget;t.style.height=`auto`}},placeholder:l?`Message the agent... (Shift+Enter for new line)`:`Start the agent or press Enter...`,unstyled:!0,className:`flex-1 [&_[data-slot=textarea]]:max-h-[200px] [&_[data-slot=textarea]]:min-h-11 [&_[data-slot=textarea]]:resize-none [&_[data-slot=textarea]]:text-sm`,rows:1}),l?(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:ee,disabled:!o.trim()||d,children:[d?(0,$.jsx)(nn,{size:14,className:`animate-spin`}):(0,$.jsx)(Ln,{size:14}),`Send`]}):(0,$.jsxs)(f,{className:`h-11 shrink-0 rounded-lg`,onClick:V,disabled:!I,children:[(0,$.jsx)(zn,{size:14}),`Start`]})]})]})]})]})}var Ra=[{value:`overview`,label:`Overview`},{value:`changes`,label:`Changes`},{value:`services`,label:`Services`},{value:`sessions`,label:`Sessions`},{value:`knowledge`,label:`Knowledge`},{value:`plan`,label:`Plan`}],za=[`all`,`changes`,`running`];function Ba(e){let{workspaces:t,workspaceStatuses:n,workspacesLoading:r,fetchWorkspaces:i,selectedId:a,subTab:o,onSelect:s,onSelectTab:l,resumingWs:u,handleResumeSession:d,handleCopyPrompt:p,handleOpenInEditor:m,handleDeleteWorkspace:h,deleteWsLoading:g,repos:_,addRepoLoading:v,handleAddRepo:y,sessionProps:b,changesProps:x,knowledgeProps:S,planProps:C}=e,[w,T]=(0,Z.useState)(``),[E,D]=(0,Z.useState)(`all`),O=t.find(e=>e.branchName===a)??null,k=O?.mode??`worktree`,A=Yt(O?.branchName??null).data?.services??[],j=(0,Z.useMemo)(()=>{let e=w.trim().toLowerCase();return t.filter(t=>{let r=n[t.branchName];return!(e&&!`${t.branchName} ${t.description}`.toLowerCase().includes(e)||E===`changes`&&!(r&&r.changedFiles>0)||E===`running`&&!(r&&r.runningServices>0))})},[t,n,w,E]),M=O?O.repos.map(e=>{let t=hn(e),n=x.gitChanges?.find(e=>e.repoName===t),r=n?n.files?.length??0:null,i=A.filter(e=>(e.cwd??``).split(/[\\/]/).includes(t));return{name:t,changedCount:r,ports:Array.from(new Set(i.map(e=>e.port).filter(e=>typeof e==`number`))),serviceCount:i.length}}):[],N=O?_.filter(e=>!O.repos.includes(e.path)):[];return(0,$.jsxs)(`div`,{className:`flex flex-col h-full animate-fade-in`,children:[(0,$.jsxs)(`header`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:`Workspaces`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Select a workspace to inspect its changes, services, sessions and context.`})]}),(0,$.jsxs)(f,{variant:`outline`,onClick:i,disabled:r,children:[(0,$.jsx)(nn,{size:14,className:r?`animate-spin text-primary`:``}),`Refresh`]})]}),(0,$.jsxs)(`div`,{className:`flex gap-4 h-[calc(100vh-120px)] overflow-x-auto overflow-y-hidden pb-4`,children:[(0,$.jsxs)(`div`,{className:`w-60 shrink-0 flex flex-col overflow-y-auto pr-1`,children:[(0,$.jsxs)(`div`,{className:`relative mb-3`,children:[(0,$.jsx)(Gt,{size:14,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(se,{value:w,onChange:e=>T(e.target.value),placeholder:`Search workspaces`,className:`[&_[data-slot=input]]:pl-8`})]}),(0,$.jsx)(`div`,{className:`mb-3 flex items-center gap-1 rounded-lg border border-border bg-muted p-1`,children:za.map(e=>(0,$.jsx)(`button`,{onClick:()=>D(e),className:c(`flex-1 rounded-md px-2.5 py-1 text-xs font-medium capitalize transition-colors cursor-pointer text-center`,E===e?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:e},e))}),r?(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:[0,1,2,3].map(e=>(0,$.jsx)(wn,{className:`h-14`},e))}):j.length===0?(0,$.jsx)(vn,{className:`p-6 text-center text-sm text-muted-foreground`,children:`No workspaces match.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:j.map(e=>{let t=n[e.branchName],r=e.branchName===a,i=e.mode===`in-place`?null:t?ln(t.syncStatus):null;return(0,$.jsxs)(`button`,{onClick:()=>s(e.branchName),className:c(`rounded-lg border p-3 text-left transition-colors cursor-pointer`,r?`border-primary/50 bg-primary/10`:`border-border bg-card hover:border-foreground/15 hover:bg-accent/50`),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate font-mono text-sm font-semibold text-foreground`,children:e.branchName}),(0,$.jsxs)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:[e.repos.length,` repos`]})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:c(`h-1.5 w-1.5 rounded-full`,t?.changedFiles?`bg-warning`:`bg-success`),title:t?.changedFiles?`${t.changedFiles} uncommitted`:`Clean`}),t?.runningServices?(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-running`,title:`Running services`}):null,i&&(0,$.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:i.label})]})]},e.id)})})]}),(0,$.jsx)(`div`,{className:`flex-1 min-w-[360px] flex flex-col overflow-y-auto pr-4 pl-1`,children:O?(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(vn,{className:`mb-4 p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-row justify-between items-start gap-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-xl font-bold text-foreground`,title:O.branchName,children:O.branchName}),(0,$.jsx)(X,{tone:k,children:k===`in-place`?`In-place`:`Worktree`})]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Created `,new Date(O.createdAt).toLocaleDateString()]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[O.repos.length,` repos`]})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(f,{disabled:u===O.branchName,onClick:()=>d(O),children:[(0,$.jsx)(un,{size:13,className:u===O.branchName?`animate-spin`:``}),u===O.branchName?`Resuming…`:`Resume in Editor`]}),(0,$.jsxs)(ni,{children:[(0,$.jsx)(ri,{"aria-label":`More actions`,className:`grid h-9 w-9 shrink-0 place-items-center rounded-md border border-border bg-card text-muted-foreground transition-colors hover:bg-accent hover:text-foreground`,children:(0,$.jsx)(On,{size:16})}),(0,$.jsxs)(ii,{align:`end`,children:[(0,$.jsxs)(ai,{onClick:()=>void m(O.workspacePath),children:[(0,$.jsx)(Wt,{size:14}),` Open Folder`]}),(0,$.jsxs)(ai,{onClick:()=>p(O),children:[(0,$.jsx)(an,{size:14}),` Copy AI Context`]}),(0,$.jsx)(oi,{}),(0,$.jsxs)(ai,{variant:`destructive`,disabled:g===O.branchName,onClick:()=>void h(O.branchName),children:[(0,$.jsx)(Kt,{size:14}),g===O.branchName?`Deleting…`:`Delete Workspace`]})]})]})]})]}),(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:(()=>{let e=n[O.branchName];if(!e)return null;let t=k===`in-place`?null:ln(e.syncStatus);return(0,$.jsxs)($.Fragment,{children:[e.changedFiles>0?(0,$.jsxs)(X,{tone:`warning`,dot:!0,children:[e.changedFiles,` uncommitted`]}):(0,$.jsx)(X,{tone:`idle`,dot:!0,children:`Clean`}),e.runningServices>0?(0,$.jsxs)(X,{tone:`running`,dot:!0,children:[e.runningServices,` running`]}):(0,$.jsx)(X,{tone:`idle`,dot:!0,children:`No services`}),t&&(0,$.jsxs)(X,{tone:t.tone,children:[(0,$.jsx)(nn,{size:11}),` `,t.label]}),e.pendingValidation&&(0,$.jsx)(X,{tone:`warning`,children:`Needs validation`})]})})()})]}),(0,$.jsxs)(Ni,{value:o,onValueChange:e=>typeof e==`string`&&l(O.branchName,e),className:`mb-4`,children:[(0,$.jsx)(Pi,{className:`max-w-full overflow-x-auto`,children:Ra.map(e=>(0,$.jsx)(Fi,{value:e.value,children:e.label},e.value))}),(0,$.jsxs)(Ii,{value:o,className:`animate-fade-in`,children:[o===`overview`&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,$.jsxs)(vn,{className:`p-5`,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-sm font-semibold text-foreground`,children:`Description`}),O.description?(0,$.jsx)(`p`,{className:`whitespace-pre-line text-sm leading-relaxed text-muted-foreground`,children:O.description}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No description provided.`})]}),(0,$.jsxs)(vn,{className:`p-5`,children:[(0,$.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-foreground`,children:[`Repositories `,(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,O.repos.length,`)`]})]}),N.length>0&&(0,$.jsx)(la,{repos:N,disabled:v,onAdd:e=>{window.confirm(`Add repository "${hn(e)}" to this workspace?\nThis creates a new git worktree and re-runs analysis.`)&&y(O.branchName,e)}})]}),(0,$.jsx)(`div`,{className:`divide-y divide-border`,children:M.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-3 py-2.5 first:pt-0 last:pb-0`,children:[(0,$.jsx)(`span`,{className:c(`h-2 w-2 shrink-0 rounded-full`,e.changedCount===null?`bg-muted-foreground`:e.changedCount>0?`bg-warning`:`bg-success`),title:e.changedCount===null?`Status unknown`:e.changedCount>0?`Uncommitted changes`:`Clean`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-sm text-foreground`,children:e.name}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.ports.map(e=>(0,$.jsxs)(`span`,{className:`rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[11px] text-running-foreground`,children:[`:`,e]},e)),(0,$.jsx)(`span`,{className:`w-24 text-right text-xs text-muted-foreground`,children:e.changedCount===null?`—`:e.changedCount>0?`${e.changedCount} changed`:`clean`})]})]},e.name))}),(0,$.jsx)(`p`,{className:`mt-3 text-[11px] text-muted-foreground`,children:`Per-repo git state and detected service ports.`})]})]}),o===`sessions`&&(0,$.jsx)(fa,{ws:O,...b}),o===`services`&&(0,$.jsx)(pa,{ws:O}),o===`changes`&&(0,$.jsx)(ma,{ws:O,...x}),o===`knowledge`&&(0,$.jsx)(ha,{ws:O,...S}),o===`plan`&&(0,$.jsx)(ga,{...C})]})]})]}):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-8`,children:(0,$.jsx)(`div`,{className:`max-w-md w-full`,children:(0,$.jsx)(vn,{className:`border-dashed p-0 shadow-sm`,children:(0,$.jsx)(Cn,{children:(0,$.jsxs)(Sn,{children:[(0,$.jsx)(bn,{variant:`icon`,children:(0,$.jsx)(fn,{})}),(0,$.jsx)(yn,{children:`No workspace selected`}),(0,$.jsx)(xn,{children:`Pick a workspace from the list to see its status, repositories, changes, services and sessions.`})]})})})})})}),(0,$.jsx)(`div`,{className:`w-[340px] 2xl:w-[400px] shrink-0 flex flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm`,children:O?(0,$.jsx)(La,{ws:O},O.branchName):(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-10 text-center text-sm text-muted-foreground`,children:`Select a workspace to start chatting.`})})]})]})}export{Ba as WorkspacesPage};
|