@hienlh/ppm 0.2.20 → 0.3.0
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/CHANGELOG.md +49 -0
- package/CLAUDE.md +18 -1
- package/bun.lock +57 -59
- package/dist/ppm +0 -0
- package/dist/web/assets/chat-tab-BHrizSRk.js +6 -0
- package/dist/web/assets/code-editor-B9B6BZbl.js +1 -0
- package/dist/web/assets/diff-viewer-DI3baLow.js +4 -0
- package/dist/web/assets/git-graph-7qqwcWri.js +1 -0
- package/dist/web/assets/index-DnbqOQf5.css +2 -0
- package/dist/web/assets/index-wdrrHLzl.js +21 -0
- package/dist/web/assets/input-CTnwfHVN.js +41 -0
- package/dist/web/assets/settings-tab-WE-GP2Ig.js +1 -0
- package/dist/web/assets/{terminal-tab-sGlqTp7k.js → terminal-tab-BEFAYT4S.js} +1 -1
- package/dist/web/assets/use-monaco-theme-DGDiih0R.js +11 -0
- package/dist/web/index.html +35 -8
- package/dist/web/sw.js +1 -1
- package/docs/codebase-summary.md +13 -8
- package/docs/project-roadmap.md +22 -4
- package/docs/system-architecture.md +59 -0
- package/package.json +6 -14
- package/src/providers/claude-agent-sdk.ts +2 -2
- package/src/providers/registry.ts +12 -11
- package/src/server/routes/projects.ts +43 -0
- package/src/server/routes/settings.ts +42 -8
- package/src/server/ws/chat.ts +2 -2
- package/src/services/config.service.ts +5 -1
- package/src/services/project.service.ts +1 -0
- package/src/types/config.ts +37 -0
- package/src/types/project.ts +1 -0
- package/src/web/Users/hienlh/Projects/ppm/dist/web/monacoeditorwork/css.worker.bundle.js +54268 -0
- package/src/web/Users/hienlh/Projects/ppm/dist/web/monacoeditorwork/editor.worker.bundle.js +14316 -0
- package/src/web/Users/hienlh/Projects/ppm/dist/web/monacoeditorwork/html.worker.bundle.js +30452 -0
- package/src/web/Users/hienlh/Projects/ppm/dist/web/monacoeditorwork/json.worker.bundle.js +22095 -0
- package/src/web/Users/hienlh/Projects/ppm/dist/web/monacoeditorwork/ts.worker.bundle.js +225957 -0
- package/src/web/app.tsx +52 -6
- package/src/web/components/chat/chat-history-panel.tsx +106 -0
- package/src/web/components/chat/chat-tab.tsx +28 -20
- package/src/web/components/editor/code-editor.tsx +78 -197
- package/src/web/components/editor/diff-viewer.tsx +59 -176
- package/src/web/components/layout/add-project-form.tsx +151 -0
- package/src/web/components/layout/command-palette.tsx +3 -1
- package/src/web/components/layout/editor-panel.tsx +50 -8
- package/src/web/components/layout/mobile-drawer.tsx +48 -180
- package/src/web/components/layout/mobile-nav.tsx +89 -6
- package/src/web/components/layout/panel-layout.tsx +16 -10
- package/src/web/components/layout/project-bar.tsx +329 -0
- package/src/web/components/layout/project-bottom-sheet.tsx +345 -0
- package/src/web/components/layout/sidebar.tsx +56 -142
- package/src/web/components/layout/tab-bar.tsx +1 -6
- package/src/web/components/layout/tab-content.tsx +0 -10
- package/src/web/components/settings/settings-tab.tsx +3 -1
- package/src/web/components/ui/dialog.tsx +1 -1
- package/src/web/components/ui/scroll-area.tsx +2 -2
- package/src/web/lib/project-avatar.ts +45 -0
- package/src/web/lib/project-palette.ts +18 -0
- package/src/web/lib/use-monaco-theme.ts +29 -0
- package/src/web/stores/panel-store.ts +94 -14
- package/src/web/stores/project-store.ts +87 -3
- package/src/web/stores/settings-store.ts +31 -4
- package/src/web/stores/tab-store.ts +0 -2
- package/src/web/styles/globals.css +10 -4
- package/vite.config.ts +6 -2
- package/dist/web/assets/arrow-up-from-line-DjfWTP75.js +0 -1
- package/dist/web/assets/button-CQ5h5gxS.js +0 -41
- package/dist/web/assets/chat-tab-Cfw__7vJ.js +0 -6
- package/dist/web/assets/code-editor-D8Pz69sx.js +0 -2
- package/dist/web/assets/dialog-BL9i7XEo.js +0 -5
- package/dist/web/assets/diff-viewer-CWS5n7ur.js +0 -4
- package/dist/web/assets/dist-0XHv8Vwc.js +0 -1
- package/dist/web/assets/dist-Ca3N8Xbh.js +0 -46
- package/dist/web/assets/git-graph-DwA62J8-.js +0 -1
- package/dist/web/assets/git-status-panel-DaB-zzSF.js +0 -1
- package/dist/web/assets/index-BYIXPY6U.css +0 -2
- package/dist/web/assets/index-DbTCLiox.js +0 -17
- package/dist/web/assets/project-list-Z4lhtp6P.js +0 -1
- package/dist/web/assets/refresh-cw-S6I91MHO.js +0 -1
- package/dist/web/assets/settings-tab-BW6MGcir.js +0 -1
- package/dist/web/assets/trash-2-CGlFXde_.js +0 -1
- package/dist/web/assets/x-C0Rw5Giw.js +0 -1
- /package/dist/web/assets/{api-client-DzH9zCD7.js → api-client-BCjah751.js} +0 -0
- /package/dist/web/assets/{columns-2-DsiY76NQ.js → columns-2-DFQ3yid7.js} +0 -0
- /package/dist/web/assets/{copy-D_Q54D-v.js → copy-B-kLwqzg.js} +0 -0
- /package/dist/web/assets/{external-link-C6Y-D528.js → external-link-Dim3NH6h.js} +0 -0
- /package/dist/web/assets/{marked.esm-Cv8mjgnt.js → marked.esm-DhBtkBa8.js} +0 -0
- /package/dist/web/assets/{utils-D6me7KDg.js → utils-B-_GCz7E.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.0] - 2026-03-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Project Switcher Bar: 52px non-collapsible sidebar with project avatars and quick-access buttons
|
|
7
|
+
- Project color customization with 12-color palette + custom hex input
|
|
8
|
+
- Project drag-to-reorder (PATCH /api/projects/reorder endpoint)
|
|
9
|
+
- Mobile ProjectBottomSheet for project switching on touch devices
|
|
10
|
+
- Sidebar tab system: Explorer, Git, History (replaces dropdown)
|
|
11
|
+
- Chat history panel in sidebar
|
|
12
|
+
- Smart project initials with collision detection
|
|
13
|
+
- EmptyPanel quick-open buttons for new workspaces
|
|
14
|
+
- Device name badge on mobile
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- Migrated code editor from CodeMirror 6 to Monaco Editor (@monaco-editor/react)
|
|
18
|
+
- Migrated diff viewer to Monaco DiffEditor
|
|
19
|
+
- Thin scrollbar styling (5px webkit, scrollbar-width:thin Firefox)
|
|
20
|
+
- Removed obsolete tab types: projects, git-status (consolidated into sidebar)
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Keep-alive workspace switching: per-project grid snapshots preserve DOM and tab state
|
|
24
|
+
- Chat tab reads projectName from own metadata instead of global activeProject
|
|
25
|
+
- Chat provider ID default corrected: "claude-sdk" → "claude"
|
|
26
|
+
|
|
27
|
+
## [0.2.4] - 2026-03-17
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Project Switcher Bar: narrow 52px left sidebar with project avatars and quick-access buttons
|
|
31
|
+
- Project color customization with 12-color palette + custom hex input
|
|
32
|
+
- Project drag-to-reorder functionality (PATCH /api/projects/reorder endpoint)
|
|
33
|
+
- Mobile ProjectBottomSheet for project switching on touch devices
|
|
34
|
+
- Keep-alive workspace switching: hides/shows instead of unmounting, preserves xterm DOM across projects
|
|
35
|
+
- Sidebar tab system with Explorer, Git, and History tabs (replaces dropdown tabs)
|
|
36
|
+
- Chat history panel component for browsing past chat sessions from sidebar
|
|
37
|
+
- Smart project initials with collision detection (1-char, 2-char, or index fallback)
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- Migrated code editor from CodeMirror 6 to Monaco Editor (@monaco-editor/react)
|
|
41
|
+
- Upgraded diff viewer to Monaco diff viewer for better syntax highlighting
|
|
42
|
+
- Removed obsolete tab types: projects, git-status (consolidated into sidebar)
|
|
43
|
+
- Alt+Z keyboard shortcut for word wrap toggle in editor and diff viewer
|
|
44
|
+
- Improved editor performance on large files with Monaco's efficient rendering
|
|
45
|
+
|
|
46
|
+
### Technical
|
|
47
|
+
- New endpoints: PATCH /api/projects/reorder, PATCH /api/projects/:name/color
|
|
48
|
+
- Updated Project interface with optional color field
|
|
49
|
+
- New utility modules: project-avatar.ts (initials), project-palette.ts (color palette)
|
|
50
|
+
- UI components: ProjectBar, ProjectBottomSheet, ChatHistoryPanel
|
|
51
|
+
|
|
3
52
|
## [0.2.3] - 2026-03-16
|
|
4
53
|
|
|
5
54
|
### Changed
|
package/CLAUDE.md
CHANGED
|
@@ -15,12 +15,29 @@ PPM (Project & Process Manager) — a web-based IDE/project manager with AI chat
|
|
|
15
15
|
## Commands
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
bun dev:server # Start backend (port
|
|
18
|
+
bun dev:server # Start backend dev (port 8081, uses ~/.ppm/config.dev.yaml)
|
|
19
19
|
bun dev:web # Start Vite frontend (port 5173)
|
|
20
20
|
bun test # Run all tests
|
|
21
21
|
bun test tests/integration/ # Integration tests only
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Dev Config
|
|
25
|
+
|
|
26
|
+
Local dev uses a **separate config file** from production:
|
|
27
|
+
|
|
28
|
+
- **Dev**: `~/.ppm/config.dev.yaml` — port **8081**
|
|
29
|
+
- **Production**: `~/.ppm/config.yaml` — port **8080**
|
|
30
|
+
|
|
31
|
+
`bun dev:server` automatically passes `-c ~/.ppm/config.dev.yaml`. Create this file on a new machine by copying `ppm.example.yaml` to `~/.ppm/config.dev.yaml` and setting `port: 8081`.
|
|
32
|
+
|
|
33
|
+
## Release Process
|
|
34
|
+
|
|
35
|
+
1. Commit feature/fix changes
|
|
36
|
+
2. Update `CHANGELOG.md` with all changes
|
|
37
|
+
3. Bump version in `package.json` — patch for small changes, minor/major for large ones
|
|
38
|
+
4. Commit: `chore: bump version to x.x.x`
|
|
39
|
+
5. Publish: `npm publish --access public`
|
|
40
|
+
|
|
24
41
|
## Quick SDK Tool Test
|
|
25
42
|
|
|
26
43
|
Use `test-tool.mjs` to verify SDK tool execution against any project cwd:
|
package/bun.lock
CHANGED
|
@@ -6,23 +6,13 @@
|
|
|
6
6
|
"name": "ppm",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@anthropic-ai/claude-agent-sdk": "^0.2.76",
|
|
9
|
-
"@codemirror/autocomplete": "^6.20.1",
|
|
10
|
-
"@codemirror/lang-css": "^6.3.1",
|
|
11
|
-
"@codemirror/lang-html": "^6.4.11",
|
|
12
|
-
"@codemirror/lang-javascript": "^6.2.5",
|
|
13
|
-
"@codemirror/lang-json": "^6.0.2",
|
|
14
|
-
"@codemirror/lang-markdown": "^6.5.0",
|
|
15
|
-
"@codemirror/lang-python": "^6.2.1",
|
|
16
|
-
"@codemirror/merge": "^6.12.1",
|
|
17
|
-
"@codemirror/theme-one-dark": "^6.1.3",
|
|
18
9
|
"@inquirer/prompts": "^8.3.0",
|
|
19
|
-
"@
|
|
10
|
+
"@monaco-editor/react": "^4.7.0",
|
|
20
11
|
"@xterm/addon-fit": "^0.11.0",
|
|
21
12
|
"@xterm/addon-web-links": "^0.12.0",
|
|
22
13
|
"@xterm/xterm": "^6.0.0",
|
|
23
14
|
"class-variance-authority": "^0.7.1",
|
|
24
15
|
"clsx": "^2.1.1",
|
|
25
|
-
"codemirror": "^6.0.2",
|
|
26
16
|
"commander": "^14.0.3",
|
|
27
17
|
"diff2html": "^3.4.56",
|
|
28
18
|
"hono": "^4.12.8",
|
|
@@ -38,6 +28,7 @@
|
|
|
38
28
|
"simple-git": "^3.33.0",
|
|
39
29
|
"sonner": "^2.0.7",
|
|
40
30
|
"tailwind-merge": "^3.5.0",
|
|
31
|
+
"vite-plugin-monaco-editor": "^1.1.0",
|
|
41
32
|
"web-push": "^3.6.7",
|
|
42
33
|
"zustand": "^5.0.11",
|
|
43
34
|
},
|
|
@@ -50,6 +41,7 @@
|
|
|
50
41
|
"@types/react-dom": "^19.2.3",
|
|
51
42
|
"@types/web-push": "^3.6.4",
|
|
52
43
|
"@vitejs/plugin-react": "^6.0.1",
|
|
44
|
+
"esbuild": "^0.27.4",
|
|
53
45
|
"tailwindcss": "^4.2.1",
|
|
54
46
|
"vite": "^8.0.0",
|
|
55
47
|
"vite-plugin-pwa": "^1.2.0",
|
|
@@ -244,41 +236,63 @@
|
|
|
244
236
|
|
|
245
237
|
"@babel/types": ["@babel/types@7.29.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A=="],
|
|
246
238
|
|
|
247
|
-
"@
|
|
239
|
+
"@emnapi/core": ["@emnapi/core@1.9.0", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.0", "tslib": "^2.4.0" } }, "sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w=="],
|
|
248
240
|
|
|
249
|
-
"@
|
|
241
|
+
"@emnapi/runtime": ["@emnapi/runtime@1.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw=="],
|
|
250
242
|
|
|
251
|
-
"@
|
|
243
|
+
"@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg=="],
|
|
252
244
|
|
|
253
|
-
"@
|
|
245
|
+
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.4", "", { "os": "aix", "cpu": "ppc64" }, "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q=="],
|
|
254
246
|
|
|
255
|
-
"@
|
|
247
|
+
"@esbuild/android-arm": ["@esbuild/android-arm@0.27.4", "", { "os": "android", "cpu": "arm" }, "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ=="],
|
|
256
248
|
|
|
257
|
-
"@
|
|
249
|
+
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.4", "", { "os": "android", "cpu": "arm64" }, "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw=="],
|
|
258
250
|
|
|
259
|
-
"@
|
|
251
|
+
"@esbuild/android-x64": ["@esbuild/android-x64@0.27.4", "", { "os": "android", "cpu": "x64" }, "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw=="],
|
|
260
252
|
|
|
261
|
-
"@
|
|
253
|
+
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ=="],
|
|
262
254
|
|
|
263
|
-
"@
|
|
255
|
+
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw=="],
|
|
264
256
|
|
|
265
|
-
"@
|
|
257
|
+
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.4", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw=="],
|
|
266
258
|
|
|
267
|
-
"@
|
|
259
|
+
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.4", "", { "os": "freebsd", "cpu": "x64" }, "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ=="],
|
|
268
260
|
|
|
269
|
-
"@
|
|
261
|
+
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.4", "", { "os": "linux", "cpu": "arm" }, "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg=="],
|
|
270
262
|
|
|
271
|
-
"@
|
|
263
|
+
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA=="],
|
|
272
264
|
|
|
273
|
-
"@
|
|
265
|
+
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.4", "", { "os": "linux", "cpu": "ia32" }, "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA=="],
|
|
274
266
|
|
|
275
|
-
"@
|
|
267
|
+
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA=="],
|
|
276
268
|
|
|
277
|
-
"@
|
|
269
|
+
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw=="],
|
|
278
270
|
|
|
279
|
-
"@
|
|
271
|
+
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.4", "", { "os": "linux", "cpu": "ppc64" }, "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA=="],
|
|
280
272
|
|
|
281
|
-
"@
|
|
273
|
+
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.4", "", { "os": "linux", "cpu": "none" }, "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw=="],
|
|
274
|
+
|
|
275
|
+
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.4", "", { "os": "linux", "cpu": "s390x" }, "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA=="],
|
|
276
|
+
|
|
277
|
+
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.4", "", { "os": "linux", "cpu": "x64" }, "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA=="],
|
|
278
|
+
|
|
279
|
+
"@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q=="],
|
|
280
|
+
|
|
281
|
+
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.4", "", { "os": "none", "cpu": "x64" }, "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg=="],
|
|
282
|
+
|
|
283
|
+
"@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.4", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow=="],
|
|
284
|
+
|
|
285
|
+
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.4", "", { "os": "openbsd", "cpu": "x64" }, "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ=="],
|
|
286
|
+
|
|
287
|
+
"@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.4", "", { "os": "none", "cpu": "arm64" }, "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg=="],
|
|
288
|
+
|
|
289
|
+
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.4", "", { "os": "sunos", "cpu": "x64" }, "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g=="],
|
|
290
|
+
|
|
291
|
+
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg=="],
|
|
292
|
+
|
|
293
|
+
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.4", "", { "os": "win32", "cpu": "ia32" }, "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw=="],
|
|
294
|
+
|
|
295
|
+
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.4", "", { "os": "win32", "cpu": "x64" }, "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg=="],
|
|
282
296
|
|
|
283
297
|
"@floating-ui/core": ["@floating-ui/core@1.7.5", "", { "dependencies": { "@floating-ui/utils": "^0.2.11" } }, "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ=="],
|
|
284
298
|
|
|
@@ -370,25 +384,9 @@
|
|
|
370
384
|
|
|
371
385
|
"@kwsites/promise-deferred": ["@kwsites/promise-deferred@1.1.1", "", {}, "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="],
|
|
372
386
|
|
|
373
|
-
"@
|
|
374
|
-
|
|
375
|
-
"@lezer/css": ["@lezer/css@1.3.1", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.3.0" } }, "sha512-PYAKeUVBo3HFThruRyp/iK91SwiZJnzXh8QzkQlwijB5y+N5iB28+iLk78o2zmKqqV0uolNhCwFqB8LA7b0Svg=="],
|
|
376
|
-
|
|
377
|
-
"@lezer/highlight": ["@lezer/highlight@1.2.3", "", { "dependencies": { "@lezer/common": "^1.3.0" } }, "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g=="],
|
|
387
|
+
"@monaco-editor/loader": ["@monaco-editor/loader@1.7.0", "", { "dependencies": { "state-local": "^1.0.6" } }, "sha512-gIwR1HrJrrx+vfyOhYmCZ0/JcWqG5kbfG7+d3f/C1LXk2EvzAbHSg3MQ5lO2sMlo9izoAZ04shohfKLVT6crVA=="],
|
|
378
388
|
|
|
379
|
-
"@
|
|
380
|
-
|
|
381
|
-
"@lezer/javascript": ["@lezer/javascript@1.5.4", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.1.3", "@lezer/lr": "^1.3.0" } }, "sha512-vvYx3MhWqeZtGPwDStM2dwgljd5smolYD2lR2UyFcHfxbBQebqx8yjmFmxtJ/E6nN6u1D9srOiVWm3Rb4tmcUA=="],
|
|
382
|
-
|
|
383
|
-
"@lezer/json": ["@lezer/json@1.0.3", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ=="],
|
|
384
|
-
|
|
385
|
-
"@lezer/lr": ["@lezer/lr@1.4.8", "", { "dependencies": { "@lezer/common": "^1.0.0" } }, "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA=="],
|
|
386
|
-
|
|
387
|
-
"@lezer/markdown": ["@lezer/markdown@1.6.3", "", { "dependencies": { "@lezer/common": "^1.5.0", "@lezer/highlight": "^1.0.0" } }, "sha512-jpGm5Ps+XErS+xA4urw7ogEGkeZOahVQF21Z6oECF0sj+2liwZopd2+I8uH5I/vZsRuuze3OxBREIANLf6KKUw=="],
|
|
388
|
-
|
|
389
|
-
"@lezer/python": ["@lezer/python@1.1.18", "", { "dependencies": { "@lezer/common": "^1.2.0", "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" } }, "sha512-31FiUrU7z9+d/ElGQLJFXl+dKOdx0jALlP3KEOsGTex8mvj+SoE1FgItcHWK/axkxCHGUSpqIHt6JAWfWu9Rhg=="],
|
|
390
|
-
|
|
391
|
-
"@marijn/find-cluster-break": ["@marijn/find-cluster-break@1.0.2", "", {}, "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g=="],
|
|
389
|
+
"@monaco-editor/react": ["@monaco-editor/react@4.7.0", "", { "dependencies": { "@monaco-editor/loader": "^1.5.0" }, "peerDependencies": { "monaco-editor": ">= 0.25.0 < 1", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA=="],
|
|
392
390
|
|
|
393
391
|
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.1", "", { "dependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1", "@tybys/wasm-util": "^0.10.1" } }, "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A=="],
|
|
394
392
|
|
|
@@ -612,10 +610,6 @@
|
|
|
612
610
|
|
|
613
611
|
"@types/web-push": ["@types/web-push@3.6.4", "", { "dependencies": { "@types/node": "*" } }, "sha512-GnJmSr40H3RAnj0s34FNTcJi1hmWFV5KXugE0mYWnYhgTAHLJ/dJKAwDmvPJYMke0RplY2XE9LnM4hqSqKIjhQ=="],
|
|
614
612
|
|
|
615
|
-
"@uiw/codemirror-extensions-basic-setup": ["@uiw/codemirror-extensions-basic-setup@4.25.8", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-9Rr+liiBmK4xzZHszL+twNRJApthqmITBwDP3emNTtTrkBFN4gHlqfp+nodKmoVt1+bUH1qQCtyqt+7dbDTHiw=="],
|
|
616
|
-
|
|
617
|
-
"@uiw/react-codemirror": ["@uiw/react-codemirror@4.25.8", "", { "dependencies": { "@babel/runtime": "^7.18.6", "@codemirror/commands": "^6.1.0", "@codemirror/state": "^6.1.1", "@codemirror/theme-one-dark": "^6.0.0", "@uiw/codemirror-extensions-basic-setup": "4.25.8", "codemirror": "^6.0.0" }, "peerDependencies": { "@codemirror/view": ">=6.0.0", "react": ">=17.0.0", "react-dom": ">=17.0.0" } }, "sha512-A0aLOuJZm2yJ+U9GlMFwxwFciztjd5LhcAG4SMqFxdD58wH+sCQXuY4UU5J2hqgS390qAlShtUgREvJPUonbuQ=="],
|
|
618
|
-
|
|
619
613
|
"@vitejs/plugin-react": ["@vitejs/plugin-react@6.0.1", "", { "dependencies": { "@rolldown/pluginutils": "1.0.0-rc.7" }, "peerDependencies": { "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", "babel-plugin-react-compiler": "^1.0.0", "vite": "^8.0.0" }, "optionalPeers": ["@rolldown/plugin-babel", "babel-plugin-react-compiler"] }, "sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ=="],
|
|
620
614
|
|
|
621
615
|
"@xterm/addon-fit": ["@xterm/addon-fit@0.11.0", "", {}, "sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g=="],
|
|
@@ -688,8 +682,6 @@
|
|
|
688
682
|
|
|
689
683
|
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
|
|
690
684
|
|
|
691
|
-
"codemirror": ["codemirror@6.0.2", "", { "dependencies": { "@codemirror/autocomplete": "^6.0.0", "@codemirror/commands": "^6.0.0", "@codemirror/language": "^6.0.0", "@codemirror/lint": "^6.0.0", "@codemirror/search": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0" } }, "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw=="],
|
|
692
|
-
|
|
693
685
|
"commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
|
|
694
686
|
|
|
695
687
|
"common-tags": ["common-tags@1.8.2", "", {}, "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA=="],
|
|
@@ -698,8 +690,6 @@
|
|
|
698
690
|
|
|
699
691
|
"core-js-compat": ["core-js-compat@3.48.0", "", { "dependencies": { "browserslist": "^4.28.1" } }, "sha512-OM4cAF3D6VtH/WkLtWvyNC56EZVXsZdU3iqaMG2B4WvYrlqU831pc4UtG5yp0sE9z8Y02wVN7PjW5Zf9Gt0f1Q=="],
|
|
700
692
|
|
|
701
|
-
"crelt": ["crelt@1.0.6", "", {}, "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g=="],
|
|
702
|
-
|
|
703
693
|
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
|
|
704
694
|
|
|
705
695
|
"crypto-random-string": ["crypto-random-string@2.0.0", "", {}, "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="],
|
|
@@ -728,6 +718,8 @@
|
|
|
728
718
|
|
|
729
719
|
"diff2html": ["diff2html@3.4.56", "", { "dependencies": { "@profoundlogic/hogan": "^3.0.4", "diff": "^8.0.3" }, "optionalDependencies": { "highlight.js": "11.11.1" } }, "sha512-u9gfn+BlbHcyO7vItCIC4z49LJDUt31tODzOfAuJ5R1E7IdlRL6KjugcB9zOpejD+XiR+dDZbsnHSQ3g6A/u8A=="],
|
|
730
720
|
|
|
721
|
+
"dompurify": ["dompurify@3.2.7", "", { "optionalDependencies": { "@types/trusted-types": "^2.0.7" } }, "sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw=="],
|
|
722
|
+
|
|
731
723
|
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
|
732
724
|
|
|
733
725
|
"ecdsa-sig-formatter": ["ecdsa-sig-formatter@1.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="],
|
|
@@ -750,6 +742,8 @@
|
|
|
750
742
|
|
|
751
743
|
"es-to-primitive": ["es-to-primitive@1.3.0", "", { "dependencies": { "is-callable": "^1.2.7", "is-date-object": "^1.0.5", "is-symbol": "^1.0.4" } }, "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g=="],
|
|
752
744
|
|
|
745
|
+
"esbuild": ["esbuild@0.27.4", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.4", "@esbuild/android-arm": "0.27.4", "@esbuild/android-arm64": "0.27.4", "@esbuild/android-x64": "0.27.4", "@esbuild/darwin-arm64": "0.27.4", "@esbuild/darwin-x64": "0.27.4", "@esbuild/freebsd-arm64": "0.27.4", "@esbuild/freebsd-x64": "0.27.4", "@esbuild/linux-arm": "0.27.4", "@esbuild/linux-arm64": "0.27.4", "@esbuild/linux-ia32": "0.27.4", "@esbuild/linux-loong64": "0.27.4", "@esbuild/linux-mips64el": "0.27.4", "@esbuild/linux-ppc64": "0.27.4", "@esbuild/linux-riscv64": "0.27.4", "@esbuild/linux-s390x": "0.27.4", "@esbuild/linux-x64": "0.27.4", "@esbuild/netbsd-arm64": "0.27.4", "@esbuild/netbsd-x64": "0.27.4", "@esbuild/openbsd-arm64": "0.27.4", "@esbuild/openbsd-x64": "0.27.4", "@esbuild/openharmony-arm64": "0.27.4", "@esbuild/sunos-x64": "0.27.4", "@esbuild/win32-arm64": "0.27.4", "@esbuild/win32-ia32": "0.27.4", "@esbuild/win32-x64": "0.27.4" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ=="],
|
|
746
|
+
|
|
753
747
|
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
|
|
754
748
|
|
|
755
749
|
"estree-walker": ["estree-walker@1.0.1", "", {}, "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg=="],
|
|
@@ -968,6 +962,8 @@
|
|
|
968
962
|
|
|
969
963
|
"minipass": ["minipass@7.1.3", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
|
|
970
964
|
|
|
965
|
+
"monaco-editor": ["monaco-editor@0.55.1", "", { "dependencies": { "dompurify": "3.2.7", "marked": "14.0.0" } }, "sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A=="],
|
|
966
|
+
|
|
971
967
|
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
|
972
968
|
|
|
973
969
|
"mute-stream": ["mute-stream@3.0.0", "", {}, "sha512-dkEJPVvun4FryqBmZ5KhDo0K9iDXAwn08tMLDinNdRBNPcYEDiWYysLcc6k3mjTMlbP9KyylvRpd4wFtwrT9rw=="],
|
|
@@ -1098,6 +1094,8 @@
|
|
|
1098
1094
|
|
|
1099
1095
|
"sourcemap-codec": ["sourcemap-codec@1.4.8", "", {}, "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="],
|
|
1100
1096
|
|
|
1097
|
+
"state-local": ["state-local@1.0.7", "", {}, "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w=="],
|
|
1098
|
+
|
|
1101
1099
|
"stop-iteration-iterator": ["stop-iteration-iterator@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "internal-slot": "^1.1.0" } }, "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ=="],
|
|
1102
1100
|
|
|
1103
1101
|
"string.prototype.matchall": ["string.prototype.matchall@4.0.12", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-abstract": "^1.23.6", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.6", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "internal-slot": "^1.1.0", "regexp.prototype.flags": "^1.5.3", "set-function-name": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA=="],
|
|
@@ -1112,8 +1110,6 @@
|
|
|
1112
1110
|
|
|
1113
1111
|
"strip-comments": ["strip-comments@2.0.1", "", {}, "sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw=="],
|
|
1114
1112
|
|
|
1115
|
-
"style-mod": ["style-mod@4.1.3", "", {}, "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ=="],
|
|
1116
|
-
|
|
1117
1113
|
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
|
|
1118
1114
|
|
|
1119
1115
|
"tailwind-merge": ["tailwind-merge@3.5.0", "", {}, "sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A=="],
|
|
@@ -1174,9 +1170,9 @@
|
|
|
1174
1170
|
|
|
1175
1171
|
"vite": ["vite@8.0.0", "", { "dependencies": { "@oxc-project/runtime": "0.115.0", "lightningcss": "^1.32.0", "picomatch": "^4.0.3", "postcss": "^8.5.8", "rolldown": "1.0.0-rc.9", "tinyglobby": "^0.2.15" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", "@vitejs/devtools": "^0.0.0-alpha.31", "esbuild": "^0.27.0", "jiti": ">=1.21.0", "less": "^4.0.0", "sass": "^1.70.0", "sass-embedded": "^1.70.0", "stylus": ">=0.54.8", "sugarss": "^5.0.0", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "@vitejs/devtools", "esbuild", "jiti", "less", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-fPGaRNj9Zytaf8LEiBhY7Z6ijnFKdzU/+mL8EFBaKr7Vw1/FWcTBAMW0wLPJAGMPX38ZPVCVgLceWiEqeoqL2Q=="],
|
|
1176
1172
|
|
|
1177
|
-
"vite-plugin-
|
|
1173
|
+
"vite-plugin-monaco-editor": ["vite-plugin-monaco-editor@1.1.0", "", { "peerDependencies": { "monaco-editor": ">=0.33.0" } }, "sha512-IvtUqZotrRoVqwT0PBBDIZPNraya3BxN/bfcNfnxZ5rkJiGcNtO5eAOWWSgT7zullIAEqQwxMU83yL9J5k7gww=="],
|
|
1178
1174
|
|
|
1179
|
-
"
|
|
1175
|
+
"vite-plugin-pwa": ["vite-plugin-pwa@1.2.0", "", { "dependencies": { "debug": "^4.3.6", "pretty-bytes": "^6.1.1", "tinyglobby": "^0.2.10", "workbox-build": "^7.4.0", "workbox-window": "^7.4.0" }, "peerDependencies": { "@vite-pwa/assets-generator": "^1.0.0", "vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" }, "optionalPeers": ["@vite-pwa/assets-generator"] }, "sha512-a2xld+SJshT9Lgcv8Ji4+srFJL4k/1bVbd1x06JIkvecpQkwkvCncD1+gSzcdm3s+owWLpMJerG3aN5jupJEVw=="],
|
|
1180
1176
|
|
|
1181
1177
|
"web-push": ["web-push@3.6.7", "", { "dependencies": { "asn1.js": "^5.3.0", "http_ece": "1.2.0", "https-proxy-agent": "^7.0.0", "jws": "^4.0.0", "minimist": "^1.2.5" }, "bin": { "web-push": "src/cli.js" } }, "sha512-OpiIUe8cuGjrj3mMBFWY+e4MMIkW3SVT+7vEIjvD9kejGUypv8GPDf84JdPWskK8zMRIJ6xYGm+Kxr8YkPyA0A=="],
|
|
1182
1178
|
|
|
@@ -1256,6 +1252,8 @@
|
|
|
1256
1252
|
|
|
1257
1253
|
"filelist/minimatch": ["minimatch@5.1.9", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],
|
|
1258
1254
|
|
|
1255
|
+
"monaco-editor/marked": ["marked@14.0.0", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ=="],
|
|
1256
|
+
|
|
1259
1257
|
"path-scurry/lru-cache": ["lru-cache@11.2.7", "", {}, "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA=="],
|
|
1260
1258
|
|
|
1261
1259
|
"rolldown/@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-rc.9", "", {}, "sha512-w6oiRWgEBl04QkFZgmW+jnU1EC9b57Oihi2ot3HNWIQRqgHp5PnYDia5iZ5FF7rpa4EQdiqMDXjlqKGXBhsoXw=="],
|
package/dist/ppm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-BFALxl05.js";import{n as i,t as a}from"./marked.esm-DhBtkBa8.js";import{t as o}from"./columns-2-DFQ3yid7.js";import{t as s}from"./copy-B-kLwqzg.js";import{t as c}from"./external-link-Dim3NH6h.js";import{n as l,r as u,t as d}from"./api-client-BCjah751.js";import{n as f}from"./utils-B-_GCz7E.js";import{A as p,C as m,D as h,E as g,I as _,N as v,O as y,P as b,_ as x,b as S,g as C,j as w,m as T,n as E,r as D,t as O,x as k,y as A}from"./index-wdrrHLzl.js";var ee=t(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),j=t(`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`}]]),M=t(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),N=t(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),P=t(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),F=t(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),I=t(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),te=t(`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`}]]),L=t(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),R=t(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),z=t(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),ne=t(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),B=e(n(),1),re=3e4,V=1e3,H=class{ws=null;url;handlers=[];reconnectAttempts=0;reconnectTimer=null;intentionalClose=!1;constructor(e){this.url=e}connect(){this.intentionalClose=!1,this.cleanup();let e=window.location.protocol===`https:`?`wss:`:`ws:`,t=this.url.startsWith(`ws`)?this.url:`${e}//${window.location.host}${this.url}`;this.ws=new WebSocket(t),this.ws.onopen=()=>{this.reconnectAttempts=0},this.ws.onmessage=e=>{for(let t of this.handlers)t(e)},this.ws.onclose=()=>{this.intentionalClose||this.scheduleReconnect()},this.ws.onerror=()=>{this.ws?.close()}}disconnect(){this.intentionalClose=!0,this.cleanup(),this.reconnectTimer&&=(clearTimeout(this.reconnectTimer),null)}send(e){this.ws?.readyState===WebSocket.OPEN&&this.ws.send(e)}onMessage(e){return this.handlers.push(e),()=>{this.handlers=this.handlers.filter(t=>t!==e)}}get isConnected(){return this.ws?.readyState===WebSocket.OPEN}cleanup(){this.ws&&=(this.ws.onopen=null,this.ws.onclose=null,this.ws.onmessage=null,this.ws.onerror=null,(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING)&&this.ws.close(),null)}scheduleReconnect(){let e=Math.min(V*2**this.reconnectAttempts,re);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>this.connect(),e)}};function U({url:e,onMessage:t,autoConnect:n=!0}){let r=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let i=new H(e);return r.current=i,t&&i.onMessage(t),n&&i.connect(),()=>{i.disconnect(),r.current=null}},[e,n]),{send:(0,B.useCallback)(e=>{r.current?.send(e)},[]),connect:(0,B.useCallback)(()=>{r.current?.connect()},[]),disconnect:(0,B.useCallback)(()=>{r.current?.disconnect()},[])}}function ie(e,t=`claude-sdk`,n=``,r){let[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)(!1),[c,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),[m,h]=(0,B.useState)(!1),g=(0,B.useRef)(r?.onUsageEvent);g.current=r?.onUsageEvent;let _=(0,B.useRef)(``),v=(0,B.useRef)([]),y=(0,B.useRef)(!1),b=(0,B.useRef)(null),x=(0,B.useRef)(()=>{}),S=(0,B.useRef)(null),C=(0,B.useCallback)(e=>{let t;try{t=JSON.parse(e.data)}catch{return}if(t.type!==`ping`){if(t.type===`connected`){h(!0);return}if(t.type===`status`){h(!0);let e=t;e.isStreaming&&(y.current=!0,d(!0)),e.pendingApproval&&p({requestId:e.pendingApproval.requestId,tool:e.pendingApproval.tool,input:e.pendingApproval.input}),S.current?.();return}switch(t.type){case`text`:{_.current+=t.content,v.current.push(t);let e=_.current,n=[...v.current];a(t=>{let r=t[t.length-1];return r?.role===`assistant`&&!r.id.startsWith(`final-`)?[...t.slice(0,-1),{...r,content:e,events:n}]:[...t,{id:`streaming-${Date.now()}`,role:`assistant`,content:e,events:n,timestamp:new Date().toISOString()}]});break}case`tool_use`:{v.current.push(t);let e=_.current,n=[...v.current];a(t=>{let r=t[t.length-1];return r?.role===`assistant`?[...t.slice(0,-1),{...r,events:n}]:[...t,{id:`streaming-${Date.now()}`,role:`assistant`,content:e,events:n,timestamp:new Date().toISOString()}]});break}case`tool_result`:{v.current.push(t);let e=[...v.current];a(t=>{let n=t[t.length-1];return n?.role===`assistant`?[...t.slice(0,-1),{...n,events:e}]:t});break}case`approval_request`:v.current.push(t),p({requestId:t.requestId,tool:t.tool,input:t.input});break;case`usage`:g.current?.(t.usage);break;case`error`:{v.current.push(t);let e=[...v.current];a(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,events:e}]:[...n,{id:`error-${Date.now()}`,role:`system`,content:t.message,events:[t],timestamp:new Date().toISOString()}]}),y.current=!1,d(!1);break}case`done`:{let e=_.current,t=[...v.current];a(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n}),_.current=``,v.current=[];let n=b.current;n?(b.current=null,a(e=>[...e,{id:`user-${Date.now()}`,role:`user`,content:n,timestamp:new Date().toISOString()}]),_.current=``,v.current=[],y.current=!0,d(!0),x.current(JSON.stringify({type:`message`,content:n}))):(y.current=!1,d(!1));break}}}},[]),{send:w,connect:T}=U({url:e&&n?`/ws/project/${encodeURIComponent(n)}/chat/${e}`:``,onMessage:C,autoConnect:!!e&&!!n});x.current=w,(0,B.useEffect)(()=>{let r=!1;return d(!1),p(null),_.current=``,v.current=[],h(!1),e&&n?(s(!0),fetch(`${u(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${l()}`}}).then(e=>e.json()).then(e=>{r||y.current||(e.ok&&Array.isArray(e.data)&&e.data.length>0?a(e.data):a([]))}).catch(()=>{!r&&!y.current&&a([])}).finally(()=>{r||s(!1)})):a([]),()=>{r=!0}},[e,t,n]);let E=(0,B.useCallback)(e=>{if(e.trim()){if(c){b.current=e;return}a(t=>[...t,{id:`user-${Date.now()}`,role:`user`,content:e,timestamp:new Date().toISOString()}]),_.current=``,v.current=[],y.current=!0,d(!0),w(JSON.stringify({type:`message`,content:e}))}},[w,c]),D=(0,B.useCallback)((e,t,n)=>{if(w(JSON.stringify({type:`approval_response`,requestId:e,approved:t,data:n})),t&&n){let t=v.current.find(t=>t.type===`approval_request`&&t.requestId===e&&t.tool===`AskUserQuestion`);if(t){let e=t.input;e&&typeof e==`object`&&(e.answers=n)}a(e=>[...e])}p(null)},[w]),O=(0,B.useCallback)(()=>{if(!y.current)return;w(JSON.stringify({type:`cancel`}));let e=_.current,t=[...v.current];a(n=>{let r=n[n.length-1];return r?.role===`assistant`?[...n.slice(0,-1),{...r,id:`final-${Date.now()}`,content:e||r.content,events:t.length>0?t:r.events}]:n}),_.current=``,v.current=[],b.current=null,y.current=!1,d(!1),p(null)},[w]),k=(0,B.useCallback)(()=>{h(!1),T(),S.current?.()},[T]),A=(0,B.useCallback)(()=>{!e||!n||(s(!0),fetch(`${u(n)}/chat/sessions/${e}/messages?providerId=${t}`,{headers:{Authorization:`Bearer ${l()}`}}).then(e=>e.json()).then(e=>{e.ok&&Array.isArray(e.data)&&e.data.length>0&&(a(e.data),_.current=``,v.current=[])}).catch(()=>{}).finally(()=>s(!1)))},[e,t,n]);return S.current=A,{messages:i,messagesLoading:o,isStreaming:c,pendingApproval:f,sendMessage:E,respondToApproval:D,cancelStreaming:O,reconnect:k,refetchMessages:A,isConnected:m}}var ae=6e4;function oe(e,t=`claude-sdk`){let[n,r]=(0,B.useState)({}),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(null),d=(0,B.useCallback)((n=!1)=>{if(!e)return;a(!0);let i=n?`&_t=${Date.now()}`:``;fetch(`${u(e)}/chat/usage?providerId=${t}${i}`,{headers:{Authorization:`Bearer ${l()}`}}).then(e=>e.json()).then(e=>{e.ok&&e.data&&(r(t=>({...t,...e.data})),s(Date.now()))}).catch(()=>{}).finally(()=>a(!1))},[e,t]);return(0,B.useEffect)(()=>(d(),c.current=setInterval(()=>d(!0),ae),()=>{c.current&&clearInterval(c.current)}),[d]),{usageInfo:n,usageLoading:i,lastUpdatedAt:o,refreshUsage:(0,B.useCallback)(()=>{d(!0)},[d]),mergeUsage:(0,B.useCallback)(e=>{r(t=>{let n={...t,...e};return e.totalCostUsd!=null&&(n.queryCostUsd=e.totalCostUsd,n.totalCostUsd=(t.totalCostUsd??0)+e.totalCostUsd),n})},[])}}var W=r();function se(e){let t=e.type===`approval_request`;return{toolName:e.type===`tool_use`?e.tool:t?e.tool??`Tool`:`Tool`,input:e.type===`tool_use`?e.input:t?e.input??{}:{}}}function ce({tool:e,result:t,completed:n,projectName:r}){let[i,a]=(0,B.useState)(!1);if(e.type===`error`)return(0,W.jsxs)(`div`,{className:`flex items-center gap-2 rounded bg-red-500/10 border border-red-500/20 px-2 py-1.5 text-xs text-red-400`,children:[(0,W.jsx)(w,{className:`size-3`}),(0,W.jsx)(`span`,{children:e.message})]});let{toolName:o,input:s}=se(e),c=t?.type===`tool_result`,l=c&&!!t.isError,u=o===`AskUserQuestion`&&!!s?.answers;return(0,W.jsxs)(`div`,{className:`rounded border border-border bg-background text-xs`,children:[(0,W.jsxs)(`button`,{onClick:()=>a(!i),className:`flex items-center gap-2 px-2 py-1.5 w-full text-left hover:bg-surface transition-colors min-w-0`,children:[i?(0,W.jsx)(b,{className:`size-3 shrink-0`}):(0,W.jsx)(v,{className:`size-3 shrink-0`}),l?(0,W.jsx)(M,{className:`size-3 text-red-400 shrink-0`}):c||u||n?(0,W.jsx)(p,{className:`size-3 text-green-400 shrink-0`}):(0,W.jsx)(m,{className:`size-3 text-yellow-400 shrink-0 animate-spin`}),(0,W.jsx)(`span`,{className:`truncate text-text-primary`,children:(0,W.jsx)(le,{name:o,input:s})})]}),i&&(0,W.jsxs)(`div`,{className:`px-2 pb-2 space-y-1.5`,children:[(e.type===`tool_use`||e.type===`approval_request`)&&(0,W.jsx)(G,{name:o,input:s,projectName:r}),c&&(0,W.jsx)(ue,{toolName:o,output:t.output})]})]})}function le({name:e,input:t}){let n=e=>String(e??``);switch(e){case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:return(0,W.jsxs)(W.Fragment,{children:[e,` `,(0,W.jsx)(`span`,{className:`text-text-subtle`,children:fe(n(t.file_path))})]});case`Bash`:return(0,W.jsxs)(W.Fragment,{children:[e,` `,(0,W.jsx)(`span`,{className:`font-mono text-text-subtle`,children:J(n(t.command),60)})]});case`Glob`:return(0,W.jsxs)(W.Fragment,{children:[e,` `,(0,W.jsx)(`span`,{className:`font-mono text-text-subtle`,children:n(t.pattern)})]});case`Grep`:return(0,W.jsxs)(W.Fragment,{children:[e,` `,(0,W.jsx)(`span`,{className:`font-mono text-text-subtle`,children:J(n(t.pattern),40)})]});case`WebSearch`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(S,{className:`size-3 inline`}),` `,e,` `,(0,W.jsx)(`span`,{className:`text-text-subtle`,children:J(n(t.query),50)})]});case`WebFetch`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(N,{className:`size-3 inline`}),` `,e,` `,(0,W.jsx)(`span`,{className:`text-text-subtle`,children:J(n(t.url),50)})]});case`ToolSearch`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(S,{className:`size-3 inline`}),` `,e,` `,(0,W.jsx)(`span`,{className:`text-text-subtle`,children:J(n(t.query),50)})]});case`Agent`:case`Task`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(j,{className:`size-3 inline`}),` `,e,` `,(0,W.jsx)(`span`,{className:`text-text-subtle`,children:J(n(t.description||t.prompt),60)})]});case`TodoWrite`:{let n=t.todos??[],r=n.filter(e=>e.status===`completed`).length;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(F,{className:`size-3 inline`}),` `,e,` `,(0,W.jsxs)(`span`,{className:`text-text-subtle`,children:[r,`/`,n.length,` done`]})]})}case`AskUserQuestion`:{let n=t.questions??[],r=!!t.answers;return(0,W.jsxs)(W.Fragment,{children:[e,` `,(0,W.jsxs)(`span`,{className:`text-text-subtle`,children:[n.length,` question`,n.length===1?``:`s`,r?` ✓`:``]})]})}default:return(0,W.jsx)(W.Fragment,{children:e})}}function G({name:e,input:t,projectName:n}){let r=e=>String(e??``),{openTab:i}=T(),a=e=>{n&&i({type:`editor`,title:e.split(`/`).pop()??e,metadata:{filePath:e,projectName:n},projectId:n,closable:!0})},s=(e,t,r)=>{i({type:`git-diff`,title:`Diff ${e.split(`/`).pop()??e}`,metadata:{filePath:e,projectName:n,original:t,modified:r},projectId:n??null,closable:!0})};switch(e){case`Bash`:return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,W.jsx)(`p`,{className:`text-text-subtle italic`,children:r(t.description)}),(0,W.jsx)(`pre`,{className:`font-mono text-text-secondary overflow-x-auto whitespace-pre-wrap break-all`,children:r(t.command)})]});case`Read`:case`Write`:case`Edit`:case`MultiEdit`:case`NotebookEdit`:{let n=r(t.file_path);return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`font-mono text-text-secondary break-all hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>a(n),title:`Open file in editor`,children:[(0,W.jsx)(c,{className:`size-3 shrink-0`}),n]}),e===`Edit`&&(!!t.old_string||!!t.new_string)&&(0,W.jsxs)(`button`,{type:`button`,className:`text-text-subtle hover:text-primary hover:underline text-left flex items-center gap-1`,onClick:()=>s(n,r(t.old_string),r(t.new_string)),title:`View diff in new tab`,children:[(0,W.jsx)(o,{className:`size-3 shrink-0`}),`View Diff`]}),e===`Write`&&!!t.content&&(0,W.jsx)(`pre`,{className:`font-mono text-text-subtle overflow-x-auto max-h-32 whitespace-pre-wrap`,children:J(r(t.content),300)})]})}case`Glob`:return(0,W.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[r(t.pattern),t.path?` in ${r(t.path)}`:``]});case`Grep`:return(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsxs)(`p`,{className:`font-mono text-text-secondary`,children:[`/`,r(t.pattern),`/`]}),!!t.path&&(0,W.jsxs)(`p`,{className:`text-text-subtle`,children:[`in `,r(t.path)]})]});case`TodoWrite`:return(0,W.jsx)(K,{todos:t.todos??[]});case`Agent`:case`Task`:return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[!!t.description&&(0,W.jsx)(`p`,{className:`text-text-secondary font-medium`,children:r(t.description)}),!!t.subagent_type&&(0,W.jsxs)(`p`,{className:`text-text-subtle`,children:[`Type: `,r(t.subagent_type)]}),!!t.prompt&&(0,W.jsx)(q,{content:r(t.prompt),maxHeight:`max-h-48`})]});case`ToolSearch`:return(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsx)(`p`,{className:`font-mono text-text-secondary`,children:r(t.query)}),!!t.max_results&&(0,W.jsxs)(`p`,{className:`text-text-subtle`,children:[`Max results: `,r(t.max_results)]})]});case`WebFetch`:return(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsxs)(`a`,{href:r(t.url),target:`_blank`,rel:`noopener noreferrer`,className:`font-mono text-primary hover:underline break-all flex items-center gap-1`,children:[(0,W.jsx)(N,{className:`size-3 shrink-0`}),r(t.url)]}),!!t.prompt&&(0,W.jsx)(`p`,{className:`text-text-subtle`,children:J(r(t.prompt),100)})]});case`AskUserQuestion`:{let e=t.questions??[],n=t.answers??{};return(0,W.jsx)(`div`,{className:`space-y-2`,children:e.map((e,t)=>(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsxs)(`p`,{className:`text-text-primary font-medium`,children:[e.header?`${e.header}: `:``,e.question]}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.options.map((t,r)=>(0,W.jsx)(`span`,{className:`inline-block rounded px-1.5 py-0.5 text-xs border ${(n[e.question]??``).split(`, `).includes(t.label)?`border-accent bg-accent/20 text-text-primary`:`border-border text-text-subtle`}`,children:t.label},r))}),n[e.question]&&(0,W.jsxs)(`p`,{className:`text-accent text-xs`,children:[`Answer: `,n[e.question]]})]},t))})}default:return(0,W.jsx)(`pre`,{className:`overflow-x-auto text-text-secondary font-mono whitespace-pre-wrap break-all`,children:JSON.stringify(t,null,2)})}}function K({todos:e}){return(0,W.jsx)(`div`,{className:`space-y-0.5`,children:e.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,W.jsx)(`span`,{className:`shrink-0 mt-0.5 ${e.status===`completed`?`text-green-400`:e.status===`in_progress`?`text-yellow-400`:`text-text-subtle`}`,children:e.status===`completed`?`✓`:e.status===`in_progress`?`▶`:`○`}),(0,W.jsx)(`span`,{className:e.status===`completed`?`line-through text-text-subtle`:`text-text-secondary`,children:e.content})]},t))})}function ue({toolName:e,output:t}){let[n,r]=(0,B.useState)(!1),a=(0,B.useMemo)(()=>{if(e!==`Agent`&&e!==`Task`)return null;try{let e=JSON.parse(t);if(Array.isArray(e)){let t=e.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
2
|
+
|
|
3
|
+
`);if(t)return t}if(typeof e==`string`)return e}catch{if(t&&!t.startsWith(`[{`))return t}return null},[e,t]);return a?(0,W.jsxs)(`div`,{className:`border-t border-border pt-1.5 space-y-1`,children:[(0,W.jsx)(q,{content:a,maxHeight:`max-h-60`}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>r(!n),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors`,children:[(0,W.jsx)(i,{className:`size-3`}),n?`Hide`:`Show`,` raw`]}),n&&(0,W.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono max-h-40 whitespace-pre-wrap break-all text-[10px]`,children:t})]}):(0,W.jsx)(de,{output:t})}function de({output:e}){let t=e.split(`
|
|
4
|
+
`).length,n=t>3||e.length>200,[r,i]=(0,B.useState)(n);return(0,W.jsxs)(`div`,{className:`border-t border-border pt-1.5`,children:[n&&(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:`flex items-center gap-1 text-[10px] text-text-subtle hover:text-text-secondary transition-colors mb-1`,children:[r?(0,W.jsx)(v,{className:`size-3`}):(0,W.jsx)(b,{className:`size-3`}),`Output (`,t,` lines)`]}),(0,W.jsx)(`pre`,{className:`overflow-x-auto text-text-subtle font-mono whitespace-pre-wrap break-all ${r?`max-h-16 overflow-hidden`:`max-h-60`}`,children:e})]})}function q({content:e,maxHeight:t=`max-h-48`}){let n=(0,B.useMemo)(()=>{try{return a.parse(e,{gfm:!0,breaks:!0})}catch{return e}},[e]);return(0,W.jsx)(`div`,{className:`markdown-content prose-sm text-text-secondary overflow-auto ${t}`,dangerouslySetInnerHTML:{__html:n}})}function fe(e){return e?e.split(`/`).pop()??e:``}function J(e,t=50){return e?e.length>t?e.slice(0,t)+`…`:e:``}function pe({messages:e,messagesLoading:t,pendingApproval:n,onApprovalResponse:r,isStreaming:i,projectName:a}){let o=(0,B.useRef)(null),s=(0,B.useRef)(!0);return(0,B.useEffect)(()=>{let t=s.current?`instant`:`smooth`;o.current?.scrollIntoView({behavior:t}),s.current&&e.length>0&&(s.current=!1)},[e,n]),t?(0,W.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,W.jsx)(j,{className:`size-10 text-text-subtle animate-pulse`}),(0,W.jsx)(`p`,{className:`text-sm`,children:`Loading messages...`})]}):e.length===0&&!i?(0,W.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,W.jsx)(j,{className:`size-10 text-text-subtle`}),(0,W.jsx)(`p`,{className:`text-sm`,children:`Send a message to start the conversation`})]}):(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4 space-y-4`,children:[e.filter(e=>{let t=e.content&&e.content.trim().length>0,n=e.events&&e.events.length>0;return t||n}).map(e=>(0,W.jsx)(Y,{message:e,isStreaming:i&&e.id.startsWith(`streaming-`),projectName:a},e.id)),n&&(n.tool===`AskUserQuestion`?(0,W.jsx)(we,{approval:n,onRespond:r}):(0,W.jsx)(Ce,{approval:n,onRespond:r})),i&&(0,W.jsx)(xe,{lastMessage:e[e.length-1]}),(0,W.jsx)(`div`,{ref:o})]})}function Y({message:e,isStreaming:t,projectName:n}){return e.role===`user`?(0,W.jsx)(_e,{content:e.content,projectName:n}):e.role===`system`?(0,W.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:[(0,W.jsx)(w,{className:`size-4 shrink-0`}),(0,W.jsx)(`p`,{children:e.content})]}):(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.events&&e.events.length>0?(0,W.jsx)(ye,{events:e.events,isStreaming:t,projectName:n}):e.content&&(0,W.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,W.jsx)(Se,{content:e.content,projectName:n})})})}var me=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`]);function X(e){let t=e.match(/^\[Attached file: (.+?)\]\n\n?/);if(t)return{files:[t[1]],text:e.slice(t[0].length)};let n=e.match(/^\[Attached files:\n([\s\S]+?)\]\n\n?/);return n?{files:n[1].split(`
|
|
5
|
+
`).map(e=>e.trim()).filter(Boolean),text:e.slice(n[0].length)}:{files:[],text:e}}function Z(e,t){let n=e.split(`/`).pop()??``;return`/api/project/${encodeURIComponent(t??`_`)}/chat/uploads/${encodeURIComponent(n)}`}function he(e){let t=e.lastIndexOf(`.`);return t===-1?!1:me.has(e.slice(t).toLowerCase())}function ge(e){return e.toLowerCase().endsWith(`.pdf`)}function _e({content:e,projectName:t}){let{files:n,text:r}=(0,B.useMemo)(()=>X(e),[e]);return(0,W.jsx)(`div`,{className:`flex justify-end`,children:(0,W.jsxs)(`div`,{className:`rounded-lg bg-primary/10 px-3 py-2 text-sm text-text-primary max-w-[85%] space-y-2`,children:[n.length>0&&(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map((e,n)=>he(e)?(0,W.jsx)(Q,{src:Z(e,t),alt:e.split(`/`).pop()??`image`},n):ge(e)?(0,W.jsx)(ve,{src:Z(e,t),filename:e.split(`/`).pop()??`document.pdf`,mimeType:`application/pdf`},n):(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-background/50 px-2 py-1 text-xs text-text-secondary`,children:[(0,W.jsx)(y,{className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate max-w-40`,children:e.split(`/`).pop()})]},n))}),r&&(0,W.jsx)(`p`,{className:`whitespace-pre-wrap break-words`,children:r})]})})}function Q({src:e,alt:t}){let[n,r]=(0,B.useState)(null),[i,a]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let t,n=l();return fetch(e,{headers:n?{Authorization:`Bearer ${n}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed to load`);return e.blob()}).then(e=>{let n=URL.createObjectURL(e);t=n,r(n)}).catch(()=>a(!0)),()=>{t&&URL.revokeObjectURL(t)}},[e]),i?(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-background/50 px-2 py-1 text-xs text-text-secondary`,children:[(0,W.jsx)(P,{className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate max-w-40`,children:t})]}):n?(0,W.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`block`,children:(0,W.jsx)(`img`,{src:n,alt:t,className:`rounded-md max-h-48 max-w-full object-contain border border-border`})}):(0,W.jsx)(`div`,{className:`rounded-md bg-surface border border-border h-24 w-32 animate-pulse`})}function ve({src:e,filename:t,mimeType:n}){let[r,i]=(0,B.useState)(!1);return(0,W.jsxs)(`button`,{type:`button`,onClick:(0,B.useCallback)(async()=>{i(!0);try{let t=l(),r=await fetch(e,{headers:t?{Authorization:`Bearer ${t}`}:{}});if(!r.ok)throw Error(`Failed to load`);let i=await r.blob(),a=URL.createObjectURL(new Blob([i],{type:n}));window.open(a,`_blank`),setTimeout(()=>URL.revokeObjectURL(a),6e4)}catch{window.open(e,`_blank`)}finally{i(!1)}},[e,n]),disabled:r,className:`flex items-center gap-1.5 rounded-md border border-border bg-background/50 px-2 py-1 text-xs text-text-secondary hover:bg-surface hover:text-text-primary transition-colors cursor-pointer disabled:opacity-50`,children:[(0,W.jsx)(y,{className:`size-3.5 shrink-0 text-red-400`}),(0,W.jsx)(`span`,{className:`truncate max-w-40`,children:t}),r&&(0,W.jsx)(`span`,{className:`animate-spin text-[10px]`,children:`...`})]})}function ye({events:e,isStreaming:t,projectName:n}){let r=[],i=``;for(let t=0;t<e.length;t++){let n=e[t];n.type===`text`?i+=n.content:n.type===`tool_use`?(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n})):n.type===`tool_result`||(i&&=(r.push({kind:`text`,content:i}),``),r.push({kind:`tool`,tool:n}))}i&&r.push({kind:`text`,content:i});let a=e.filter(e=>e.type===`tool_result`);for(let e of a){let t=e.toolUseId;if(t){let n=r.find(e=>e.kind===`tool`&&e.tool.type===`tool_use`&&e.tool.toolUseId===t);if(n){n.result=e;continue}}let n=r.find(e=>e.kind===`tool`&&!e.result);n&&(n.result=e)}for(let e=0;e<r.length;e++){let n=r[e];if(n.kind===`tool`&&!n.result){let i=!1;if(n.tool.type===`tool_use`&&n.tool.tool===`Read`){let t=n.tool.input?.file_path;t&&(i=r.slice(e+1).some(e=>e.kind===`tool`&&e.result&&e.tool.type===`tool_use`&&e.tool.tool===`Edit`&&e.tool.input?.file_path===t))}n.completed=i||!t}}return(0,W.jsx)(W.Fragment,{children:r.map((e,i)=>{if(e.kind===`text`){let a=t&&i===r.length-1;return(0,W.jsx)(`div`,{className:`text-sm text-text-primary`,children:(0,W.jsx)(be,{content:e.content,animate:a,projectName:n})},`text-${i}`)}return(0,W.jsx)(ce,{tool:e.tool,result:e.result,completed:e.completed,projectName:n},`tool-${i}`)})})}function be({content:e,animate:t,projectName:n}){return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Se,{content:e,projectName:n}),t&&(0,W.jsx)(`span`,{className:`text-text-subtle text-sm animate-pulse`,children:`Thinking...`})]})}function xe({lastMessage:e}){if(!e||e.role!==`assistant`)return(0,W.jsx)(`div`,{className:`flex items-center gap-2 text-text-subtle text-sm`,children:(0,W.jsx)(`span`,{className:`animate-pulse`,children:`Thinking...`})});let t=e.events;if(t&&t.length>0){let e=t[t.length-1];if(e?.type===`tool_use`||e?.type===`tool_result`)return(0,W.jsx)(`div`,{className:`flex items-center gap-2 text-text-subtle text-sm`,children:(0,W.jsx)(`span`,{className:`animate-pulse`,children:`Thinking...`})})}return null}a.setOptions({gfm:!0,breaks:!0});function Se({content:e,projectName:t}){let n=(0,B.useMemo)(()=>{try{return a.parse(e)}catch{return e}},[e]),r=(0,B.useRef)(null),{openTab:i}=T();return(0,B.useEffect)(()=>{let e=r.current;if(!e)return;e.querySelectorAll(`pre`).forEach(e=>{if(e.querySelector(`.code-actions`))return;let n=e.querySelector(`code`),r=n?.textContent??e.textContent??``,a=n?.className??``,o=/language-(bash|sh|shell|zsh)/.test(a)||!a.includes(`language-`)&&r.startsWith(`$`);e.style.position=`relative`;let s=document.createElement(`div`);s.className=`code-actions absolute top-1 right-1 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity`,e.classList.add(`group`);let c=document.createElement(`button`);if(c.className=`flex items-center justify-center size-6 rounded bg-surface-elevated/80 hover:bg-surface-elevated text-text-secondary hover:text-text-primary transition-colors border border-border/50`,c.title=`Copy`,c.innerHTML=`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,c.addEventListener(`click`,()=>{navigator.clipboard.writeText(r),c.innerHTML=`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`,setTimeout(()=>{c.innerHTML=`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`},2e3)}),s.appendChild(c),o){let e=document.createElement(`button`);e.className=`flex items-center justify-center size-6 rounded bg-surface-elevated/80 hover:bg-surface-elevated text-text-secondary hover:text-text-primary transition-colors border border-border/50`,e.title=`Run in terminal`,e.innerHTML=`<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>`,e.addEventListener(`click`,()=>{navigator.clipboard.writeText(r.replace(/^\$\s*/gm,``)),t&&i({type:`terminal`,title:`Terminal`,metadata:{projectName:t},projectId:t,closable:!0})}),s.appendChild(e)}e.appendChild(s)});let n=n=>{let r=n.target.closest(`a`);if(!r||!e.contains(r))return;let a=r.getAttribute(`href`)??``;(/^(\/|\.\/|\.\.\/)/.test(a)||/\.(ts|tsx|js|jsx|py|json|md|yaml|yml|toml|css|html|sh|go|rs|sql)$/i.test(a))&&t&&(n.preventDefault(),i({type:`editor`,title:a.split(`/`).pop()??a,metadata:{filePath:a,projectName:t},projectId:t,closable:!0}))};return e.addEventListener(`click`,n),()=>e.removeEventListener(`click`,n)},[n,t,i]),(0,W.jsx)(`div`,{ref:r,className:`markdown-content prose-sm`,dangerouslySetInnerHTML:{__html:n}})}function Ce({approval:e,onRespond:t}){return(0,W.jsxs)(`div`,{className:`rounded-lg border-2 border-yellow-500/40 bg-yellow-500/10 p-3 space-y-2`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-yellow-400 text-sm font-medium`,children:[(0,W.jsx)(L,{className:`size-4`}),(0,W.jsx)(`span`,{children:`Tool Approval Required`})]}),(0,W.jsx)(`div`,{className:`text-xs text-text-primary`,children:(0,W.jsx)(`span`,{className:`font-medium`,children:e.tool})}),(0,W.jsx)(`pre`,{className:`text-xs font-mono text-text-secondary overflow-x-auto bg-background rounded p-2 border border-border`,children:JSON.stringify(e.input,null,2)}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(`button`,{onClick:()=>t(e.requestId,!0),className:`px-4 py-1.5 rounded bg-green-600 text-white text-xs font-medium hover:bg-green-500 transition-colors`,children:`Allow`}),(0,W.jsx)(`button`,{onClick:()=>t(e.requestId,!1),className:`px-4 py-1.5 rounded bg-red-600 text-white text-xs font-medium hover:bg-red-500 transition-colors`,children:`Deny`})]})]})}function we({approval:e,onRespond:t}){let n=e.input.questions??[],[r,i]=(0,B.useState)({}),[a,o]=(0,B.useState)({}),s=(e,t,n)=>{o(t=>({...t,[e]:!1})),i(r=>{if(!n)return{...r,[e]:t};let i=r[e]??``,a=i?i.split(`, `):[],o=a.indexOf(t);return o>=0?a.splice(o,1):a.push(t),{...r,[e]:a.join(`, `)}})},c=e=>{o(t=>({...t,[e]:!0})),i(t=>({...t,[e]:``}))},l=(e,t)=>{i(n=>({...n,[e]:t}))},u=n.every(e=>r[e.question]?.trim());return(0,W.jsxs)(`div`,{className:`rounded-lg border-2 border-accent/40 bg-accent/5 p-3 space-y-3`,children:[n.map((e,t)=>(0,W.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,W.jsxs)(`p`,{className:`text-sm text-text-primary font-medium`,children:[e.header?`${e.header}: `:``,e.question]}),e.multiSelect&&(0,W.jsx)(`p`,{className:`text-xs text-text-subtle`,children:`Select multiple`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.options.map((t,n)=>(0,W.jsxs)(`button`,{onClick:()=>s(e.question,t.label,e.multiSelect),className:`text-left rounded px-2.5 py-1.5 text-xs border transition-colors ${!a[e.question]&&(r[e.question]??``).split(`, `).includes(t.label)?`border-accent bg-accent/20 text-text-primary`:`border-border bg-background text-text-secondary hover:bg-surface-elevated`}`,children:[(0,W.jsx)(`span`,{className:`font-medium`,children:t.label}),t.description&&(0,W.jsxs)(`span`,{className:`text-text-subtle ml-1.5`,children:[`— `,t.description]})]},n)),a[e.question]?(0,W.jsx)(`input`,{type:`text`,autoFocus:!0,placeholder:`Type your answer...`,value:r[e.question]??``,onChange:t=>l(e.question,t.target.value),className:`rounded px-2.5 py-1.5 text-xs border border-accent bg-accent/10 text-text-primary outline-none placeholder:text-text-subtle`}):(0,W.jsx)(`button`,{onClick:()=>c(e.question),className:`text-left rounded px-2.5 py-1.5 text-xs border border-dashed border-border text-text-subtle hover:bg-surface-elevated transition-colors`,children:`Other — type your own answer`})]})]},t)),(0,W.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,W.jsx)(`button`,{onClick:()=>t(e.requestId,!0,r),disabled:!u,className:`px-4 py-1.5 rounded bg-accent text-white text-xs font-medium hover:bg-accent/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:`Submit`}),(0,W.jsx)(`button`,{onClick:()=>t(e.requestId,!1),className:`px-4 py-1.5 rounded bg-surface-elevated text-text-secondary text-xs hover:bg-surface transition-colors`,children:`Skip`})]})]})}var Te=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),Ee=new Set([`application/pdf`]),De=[`text/`,`application/json`,`application/xml`,`application/javascript`,`application/typescript`,`application/x-yaml`,`application/toml`,`application/x-sh`],Oe=new Set(`.ts,.tsx,.js,.jsx,.mjs,.cjs,.py,.rb,.go,.rs,.java,.kt,.swift,.c,.cpp,.h,.hpp,.cs,.json,.yaml,.yml,.toml,.xml,.md,.mdx,.txt,.csv,.tsv,.html,.css,.scss,.less,.sass,.sh,.bash,.zsh,.fish,.sql,.graphql,.gql,.env,.ini,.cfg,.conf,.dockerfile,.makefile,.vue,.svelte,.astro,.ipynb`.split(`,`));function ke(e){return Te.has(e.type)}function Ae(e){if(Te.has(e.type)||Ee.has(e.type)||De.some(t=>e.type.startsWith(t)))return!0;let t=je(e.name);return!!(t&&Oe.has(t))}function je(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t).toLowerCase()}function Me({attachments:e,onRemove:t}){return e.length===0?null:(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pt-2`,children:e.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border bg-surface px-2 py-1 text-xs text-text-secondary max-w-48`,children:[e.previewUrl?(0,W.jsx)(`img`,{src:e.previewUrl,alt:e.name,className:`size-5 rounded object-cover shrink-0`}):e.isImage?(0,W.jsx)(P,{className:`size-3.5 shrink-0 text-text-subtle`}):(0,W.jsx)(y,{className:`size-3.5 shrink-0 text-text-subtle`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.name}),e.status===`uploading`?(0,W.jsx)(m,{className:`size-3 shrink-0 animate-spin text-text-subtle`}):e.status===`error`?(0,W.jsx)(`span`,{className:`text-red-500 shrink-0`,title:`Upload failed`,children:`!`}):null,(0,W.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),className:`shrink-0 rounded-sm p-0.5 hover:bg-border/50 transition-colors`,"aria-label":`Remove ${e.name}`,children:(0,W.jsx)(x,{className:`size-3`})})]},e.id))})}function Ne(e){let t=[];function n(e){for(let r of e)t.push(r),r.children&&n(r.children)}return n(e),t}function Pe({items:e,filter:t,onSelect:n,onClose:r,visible:i}){let[a,o]=(0,B.useState)(0),s=(0,B.useRef)(null),c=(()=>{if(!t)return e.slice(0,50);let n=t.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)).slice(0,50)})();(0,B.useEffect)(()=>{o(0)},[t]),(0,B.useEffect)(()=>{let e=s.current;e&&e.children[a]?.scrollIntoView({block:`nearest`})},[a]);let l=(0,B.useCallback)(e=>{if(!i||c.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),o(e=>e>0?e-1:c.length-1),!0;case`ArrowDown`:return e.preventDefault(),o(e=>e<c.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),c[a]&&n(c[a]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,c,a,n,r]);return(0,B.useEffect)(()=>{if(!i)return;let e=e=>{l(e)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,l]),!i||c.length===0?null:(0,W.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,W.jsx)(`div`,{ref:s,className:`py-1`,children:c.map((e,t)=>(0,W.jsxs)(`button`,{className:`flex items-center gap-2 w-full px-3 py-1.5 text-left transition-colors ${t===a?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>o(t),onClick:()=>n(e),children:[(0,W.jsx)(`span`,{className:`shrink-0`,children:e.type===`directory`?(0,W.jsx)(g,{className:`size-4 text-amber-500`}):(0,W.jsx)(h,{className:`size-4 text-blue-400`})}),(0,W.jsx)(`span`,{className:`text-sm truncate`,children:e.path})]},e.path))})})}function Fe({onSend:e,isStreaming:t,onCancel:n,disabled:r,projectName:i,onSlashStateChange:a,onSlashItemsLoaded:o,slashSelected:s,onFileStateChange:c,onFileItemsLoaded:p,fileSelected:m,externalFiles:h}){let[g,_]=(0,B.useState)(``),[v,y]=(0,B.useState)([]),b=(0,B.useRef)(null),x=(0,B.useRef)(null),S=(0,B.useRef)([]),C=(0,B.useRef)([]);(0,B.useEffect)(()=>{if(!i){S.current=[],o?.([]);return}d.get(`${u(i)}/chat/slash-items`).then(e=>{S.current=e,o?.(e)}).catch(()=>{S.current=[],o?.([])})},[i]),(0,B.useEffect)(()=>{if(!i){C.current=[],p?.([]);return}d.get(`${u(i)}/files/tree?depth=5`).then(e=>{let t=Ne(e);C.current=t,p?.(t)}).catch(()=>{C.current=[],p?.([])})},[i]),(0,B.useEffect)(()=>{if(!s)return;let e=b.current,t=e?.selectionStart??g.length,n=g.slice(0,t),r=g.slice(t),i=n.replace(/(?:^|\s)\/\S*$/,e=>`${e.startsWith(`/`)?``:e[0]}/${s.name} `);_(i+r),a?.(!1,``),c?.(!1,``),e&&(e.focus(),setTimeout(()=>{e.selectionStart=e.selectionEnd=i.length},0))},[s]),(0,B.useEffect)(()=>{if(!m)return;let e=b.current;if(!e)return;let t=e.selectionStart,n=g.slice(0,t),r=g.slice(t),i=n.match(/@(\S*)$/);if(i){let t=n.length-i[0].length;_(n.slice(0,t)+`@${m.path} `+r);let a=t+m.path.length+2;setTimeout(()=>{e.selectionStart=e.selectionEnd=a,e.focus()},0)}else{let t=g+`@${m.path} `;_(t),setTimeout(()=>{e.selectionStart=e.selectionEnd=t.length,e.focus()},0)}c?.(!1,``)},[m]),(0,B.useEffect)(()=>{!h||h.length===0||T(h)},[h]);let w=(0,B.useCallback)(async e=>{if(!i)return null;try{let t=new FormData;t.append(`files`,e);let n={},r=l();r&&(n.Authorization=`Bearer ${r}`);let a=await(await fetch(`${u(i)}/chat/upload`,{method:`POST`,headers:n,body:t})).json();return a.ok&&Array.isArray(a.data)&&a.data.length>0?a.data[0].path:null}catch{return null}},[i]),T=(0,B.useCallback)(e=>{for(let t of e){if(!Ae(t)){_(e=>e+(e.length>0&&!e.endsWith(` `)?` `:``)+t.name);continue}let e=f(),n=ke(t),r=n?URL.createObjectURL(t):void 0,i={id:e,name:t.name,file:t,isImage:n,previewUrl:r,status:`uploading`};y(e=>[...e,i]),w(t).then(t=>{y(n=>n.map(n=>n.id===e?{...n,serverPath:t??void 0,status:t?`ready`:`error`}:n))})}b.current?.focus()},[w]),E=(0,B.useCallback)(e=>{y(t=>{let n=t.find(t=>t.id===e);return n?.previewUrl&&URL.revokeObjectURL(n.previewUrl),t.filter(t=>t.id!==e)})},[]),D=(0,B.useCallback)(()=>{let t=g.trim(),n=v.filter(e=>e.status===`ready`);if(!(!t&&n.length===0)&&!r){a?.(!1,``),c?.(!1,``),e(t,n),_(``);for(let e of v)e.previewUrl&&URL.revokeObjectURL(e.previewUrl);y([]),b.current&&(b.current.style.height=`auto`)}},[g,v,r,e,a,c]),O=(0,B.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},[D]),k=(0,B.useCallback)((e,t)=>{let n=e.slice(0,t),r=n.match(/(?:^|\s)\/(\S*)$/);if(r&&S.current.length>0){a?.(!0,r[1]??``),c?.(!1,``);return}let i=n.match(/@(\S*)$/);if(i&&C.current.length>0){c?.(!0,i[1]??``),a?.(!1,``);return}a?.(!1,``),c?.(!1,``)},[a,c]),A=(0,B.useCallback)(e=>{_(e),setTimeout(()=>{k(e,b.current?.selectionStart??e.length)},0)},[k]),ee=(0,B.useCallback)(()=>{let e=b.current;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,160)+`px`)},[]),j=(0,B.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t)if(e.kind===`file`){let t=e.getAsFile();t&&n.push(t)}n.length>0&&(e.preventDefault(),T(n))},[T]),M=(0,B.useCallback)(e=>{e.preventDefault();let t=Array.from(e.dataTransfer.files);t.length>0&&T(t)},[T]),N=(0,B.useCallback)(e=>{e.preventDefault()},[]),P=(0,B.useCallback)(()=>{x.current?.click()},[]),F=(0,B.useCallback)(e=>{let t=Array.from(e.target.files??[]);t.length>0&&T(t),e.target.value=``},[T]),L=g.trim().length>0||v.some(e=>e.status===`ready`),R=t&&!L;return(0,W.jsxs)(`div`,{className:`border-t border-border bg-background`,children:[(0,W.jsx)(Me,{attachments:v,onRemove:E}),(0,W.jsxs)(`div`,{className:`flex items-end gap-2 p-3`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:P,disabled:r,className:`flex items-center justify-center rounded-lg p-2 text-text-subtle hover:text-text-primary hover:bg-surface transition-colors shrink-0 disabled:opacity-50`,"aria-label":`Attach file`,children:(0,W.jsx)(I,{className:`size-4`})}),(0,W.jsx)(`input`,{ref:x,type:`file`,multiple:!0,className:`hidden`,onChange:F}),(0,W.jsx)(`textarea`,{ref:b,value:g,onChange:e=>{A(e.target.value),ee()},onKeyDown:O,onPaste:j,onDrop:M,onDragOver:N,placeholder:t?`Follow-up or Stop...`:`Message... (↵ to send)`,disabled:r,rows:1,className:`flex-1 resize-none rounded-lg border border-border bg-surface px-3 py-2 text-base md:text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-ring disabled:opacity-50 max-h-40`}),R?(0,W.jsx)(`button`,{onClick:n,className:`flex items-center justify-center rounded-lg bg-red-600 p-2 text-white hover:bg-red-500 transition-colors shrink-0`,"aria-label":`Stop response`,children:(0,W.jsx)(z,{className:`size-4`})}):(0,W.jsx)(`button`,{onClick:D,disabled:r||!L,className:`flex items-center justify-center rounded-lg bg-primary p-2 text-white hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0`,"aria-label":`Send message`,children:(0,W.jsx)(te,{className:`size-4`})})]})]})}function Ie({items:e,filter:t,onSelect:n,onClose:r,visible:i}){let[a,o]=(0,B.useState)(0),s=(0,B.useRef)(null),c=e.filter(e=>{let n=t.toLowerCase();return e.name.toLowerCase().includes(n)||e.description.toLowerCase().includes(n)});(0,B.useEffect)(()=>{o(0)},[t]),(0,B.useEffect)(()=>{let e=s.current;e&&e.children[a]?.scrollIntoView({block:`nearest`})},[a]);let l=(0,B.useCallback)(e=>{if(!i||c.length===0)return!1;switch(e.key){case`ArrowUp`:return e.preventDefault(),o(e=>e>0?e-1:c.length-1),!0;case`ArrowDown`:return e.preventDefault(),o(e=>e<c.length-1?e+1:0),!0;case`Enter`:case`Tab`:return e.preventDefault(),c[a]&&n(c[a]),!0;case`Escape`:return e.preventDefault(),r(),!0}return!1},[i,c,a,n,r]);return(0,B.useEffect)(()=>{if(!i)return;let e=e=>{l(e)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[i,l]),!i||c.length===0?null:(0,W.jsx)(`div`,{className:`max-h-52 overflow-y-auto border-b border-border bg-surface`,children:(0,W.jsx)(`div`,{ref:s,className:`py-1`,children:c.map((e,t)=>(0,W.jsxs)(`button`,{className:`flex items-start gap-3 w-full px-3 py-2 text-left transition-colors ${t===a?`bg-primary/10 text-primary`:`hover:bg-surface-hover text-text-primary`}`,onMouseEnter:()=>o(t),onClick:()=>n(e),children:[(0,W.jsx)(`span`,{className:`shrink-0 mt-0.5`,children:e.type===`skill`?(0,W.jsx)(R,{className:`size-4 text-amber-500`}):(0,W.jsx)(A,{className:`size-4 text-blue-500`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,W.jsxs)(`span`,{className:`font-medium text-sm`,children:[`/`,e.name]}),e.argumentHint&&(0,W.jsx)(`span`,{className:`text-xs text-text-subtle`,children:e.argumentHint}),(0,W.jsx)(`span`,{className:`text-xs text-text-subtle capitalize ml-auto`,children:e.scope===`user`?`global`:e.type})]}),e.description&&(0,W.jsx)(`p`,{className:`text-xs text-text-subtle mt-0.5 line-clamp-2`,children:e.description})]})]},`${e.type}-${e.name}`))})})}function Le(e){return e>=90?`text-red-500`:e>=70?`text-amber-500`:`text-green-500`}function Re(e){return e>=90?`bg-red-500`:e>=70?`bg-amber-500`:`bg-green-500`}function ze({usage:e,loading:t,onClick:n}){let r=e.fiveHour==null?null:Math.round(e.fiveHour*100),i=e.sevenDay==null?null:Math.round(e.sevenDay*100),a=r==null?`--%`:`${r}%`,o=i==null?`--%`:`${i}%`;return(0,W.jsxs)(`button`,{onClick:n,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-medium tabular-nums transition-colors hover:bg-surface-hover ${r!=null||i!=null?Le(Math.max(r??0,i??0)):`text-text-subtle`}`,title:`Click for usage details`,children:[t?(0,W.jsx)(k,{className:`size-3 animate-spin`}):(0,W.jsx)(ee,{className:`size-3`}),(0,W.jsxs)(`span`,{children:[`5h:`,a]}),(0,W.jsx)(`span`,{className:`text-text-subtle`,children:`·`}),(0,W.jsxs)(`span`,{children:[`Wk:`,o]})]})}function Be(e){if(!e)return null;let t=null;if(e.resetsInMinutes!=null)t=e.resetsInMinutes;else if(e.resetsInHours!=null)t=Math.round(e.resetsInHours*60);else if(e.resetsAt){let n=new Date(e.resetsAt).getTime()-Date.now();t=n>0?Math.ceil(n/6e4):0}if(t==null)return null;if(t<=0)return`now`;let n=Math.floor(t/1440),r=Math.floor(t%1440/60),i=t%60;return n>0?i>0?`${n}d ${r}h ${i}m`:r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:`${i}m`}function $({label:e,bucket:t}){if(!t)return null;let n=Math.round(t.utilization*100),r=Be(t);return(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium text-text-primary`,children:e}),r&&(0,W.jsxs)(`span`,{className:`text-[10px] text-text-subtle`,children:[`↻ `,r]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`div`,{className:`flex-1 h-2 rounded-full bg-border overflow-hidden`,children:(0,W.jsx)(`div`,{className:`h-full rounded-full transition-all ${Re(n)}`,style:{width:`${Math.min(n,100)}%`}})}),(0,W.jsxs)(`span`,{className:`text-xs font-medium tabular-nums w-10 text-right ${Le(n)}`,children:[n,`%`]})]})]})}function Ve(e){if(!e)return null;let t=Math.round((Date.now()-e)/1e3);return t<5?`just now`:t<60?`${t}s ago`:`${Math.floor(t/60)}m ago`}function He({usage:e,visible:t,onClose:n,onReload:r,loading:i,lastUpdatedAt:a}){if(!t)return null;let o=e.queryCostUsd!=null||e.totalCostUsd!=null,s=e.session||e.weekly||e.weeklyOpus||e.weeklySonnet;return(0,W.jsxs)(`div`,{className:`border-b border-border bg-surface px-3 py-2.5 space-y-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-xs font-semibold text-text-primary`,children:`Usage Limits`}),a&&(0,W.jsx)(`span`,{className:`text-[10px] text-text-subtle`,children:Ve(a)})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[r&&(0,W.jsx)(`button`,{onClick:r,disabled:i,className:`text-xs text-text-subtle hover:text-text-primary px-1 disabled:opacity-50`,title:`Refresh usage data`,children:(0,W.jsx)(k,{className:`size-3 ${i?`animate-spin`:``}`})}),(0,W.jsx)(`button`,{onClick:n,className:`text-xs text-text-subtle hover:text-text-primary px-1`,children:`✕`})]})]}),s?(0,W.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,W.jsx)($,{label:`5-Hour Session`,bucket:e.session}),(0,W.jsx)($,{label:`Weekly`,bucket:e.weekly}),(0,W.jsx)($,{label:`Weekly (Opus)`,bucket:e.weeklyOpus}),(0,W.jsx)($,{label:`Weekly (Sonnet)`,bucket:e.weeklySonnet})]}):(0,W.jsxs)(`p`,{className:`text-xs text-text-subtle`,children:[`No data — run `,(0,W.jsx)(`code`,{className:`bg-surface-elevated px-1 rounded`,children:`bun install`})]}),o&&(0,W.jsxs)(`div`,{className:`border-t border-border pt-2 space-y-1`,children:[e.queryCostUsd!=null&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,W.jsx)(`span`,{className:`text-text-subtle`,children:`Last query`}),(0,W.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.queryCostUsd.toFixed(4)]})]}),e.totalCostUsd!=null&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,W.jsx)(`span`,{className:`text-text-subtle`,children:`Session total`}),(0,W.jsxs)(`span`,{className:`text-text-primary font-medium tabular-nums`,children:[`$`,e.totalCostUsd.toFixed(4)]})]})]})]})}function Ue({metadata:e,tabId:t}){let[n,r]=(0,B.useState)(e?.sessionId??null),[i,a]=(0,B.useState)(e?.providerId??`claude`),[o,l]=(0,B.useState)([]),[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),[g,v]=(0,B.useState)(null),[y,b]=(0,B.useState)([]),[S,w]=(0,B.useState)(!1),[k,A]=(0,B.useState)(``),[ee,M]=(0,B.useState)(null),[N,P]=(0,B.useState)(!1),[F,I]=(0,B.useState)(null),[te,L]=(0,B.useState)(!1),[R,z]=(0,B.useState)(!1),[re,V]=(0,B.useState)(null),H=(0,B.useRef)(0),U=e?.projectName??``,ae=T(e=>e.updateTab),se=C(e=>e.version),[ce,le]=(0,B.useState)(``);(0,B.useEffect)(()=>{d.get(`/api/settings/ai`).then(e=>{let t=e.providers[e.default_provider];le(t?.model??e.default_provider)}).catch(()=>{})},[]);let{usageInfo:G,usageLoading:K,lastUpdatedAt:ue,refreshUsage:de,mergeUsage:q}=oe(U,i);(0,B.useEffect)(()=>{!t||!n||ae(t,{metadata:{...e,sessionId:n,providerId:i}})},[n,i]);let{messages:fe,messagesLoading:J,isStreaming:Y,pendingApproval:me,sendMessage:X,respondToApproval:Z,cancelStreaming:he,reconnect:ge,refetchMessages:_e,isConnected:Q}=ie(n,i,U,{onUsageEvent:q});(0,B.useCallback)(()=>{T.getState().openTab({type:`chat`,title:`AI Chat`,metadata:{projectName:U},projectId:U||null,closable:!0})},[U]),(0,B.useCallback)(e=>{r(e.id),a(e.providerId)},[]);let ve=(0,B.useCallback)((e,t)=>{if(t.length===0)return e;let n=t.filter(e=>e.serverPath).map(e=>e.serverPath).join(`
|
|
6
|
+
`);return n?(t.length===1?`[Attached file: ${n}]\n\n`:`[Attached files:\n${n}\n]\n\n`)+e:e},[]),ye=(0,B.useCallback)(async(e,t=[])=>{let o=ve(e,t);if(o.trim()){if(!n)try{let t=U,n=await d.post(`${u(t)}/chat/sessions`,{providerId:i,title:e.slice(0,50)});r(n.id),a(n.providerId),setTimeout(()=>{X(o)},500);return}catch(e){console.error(`Failed to create session:`,e);return}X(o)}},[n,i,U,X,ve]),be=(0,B.useCallback)((e,t)=>{p(e),h(t)},[]),xe=(0,B.useCallback)(e=>{v(e),p(!1),h(``),setTimeout(()=>v(null),50)},[]),Se=(0,B.useCallback)(()=>{p(!1),h(``)},[]),Ce=(0,B.useCallback)((e,t)=>{w(e),A(t)},[]),we=(0,B.useCallback)(e=>{M(e),w(!1),A(``),setTimeout(()=>M(null),50)},[]),Te=(0,B.useCallback)(()=>{w(!1),A(``)},[]);return(0,W.jsxs)(`div`,{className:`flex flex-col h-full relative`,onDragEnter:(0,B.useCallback)(e=>{e.preventDefault(),H.current++,e.dataTransfer.types.includes(`Files`)&&z(!0)},[]),onDragLeave:(0,B.useCallback)(e=>{e.preventDefault(),H.current--,H.current===0&&z(!1)},[]),onDragOver:(0,B.useCallback)(e=>{e.preventDefault()},[]),onDrop:(0,B.useCallback)(e=>{e.preventDefault(),H.current=0,z(!1);let t=Array.from(e.dataTransfer.files);t.length>0&&(V(t),setTimeout(()=>V(null),100))},[]),children:[R&&(0,W.jsx)(`div`,{className:`absolute inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm border-2 border-dashed border-primary rounded-lg pointer-events-none`,children:(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-primary`,children:[(0,W.jsx)(ne,{className:`size-8`}),(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Drop files to attach`})]})}),(0,W.jsx)(pe,{messages:fe,messagesLoading:J,pendingApproval:me,onApprovalResponse:Z,isStreaming:Y,projectName:U}),(0,W.jsxs)(`div`,{className:`border-t border-border bg-background shrink-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border/50`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-text-secondary px-1`,children:[(0,W.jsx)(j,{className:`size-3.5`}),(0,W.jsx)(`span`,{className:`truncate max-w-[180px]`,children:ce||`AI`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ze,{usage:G,loading:K,onClick:()=>P(e=>!e)}),n&&(0,W.jsx)(`button`,{onClick:async()=>{I(await O(se,{sessionId:n,projectName:U})),L(!1)},className:`p-0.5 rounded hover:bg-surface-elevated text-text-subtle hover:text-text-secondary transition-colors`,title:`Report bug for this chat session`,children:(0,W.jsx)(_,{className:`size-3.5`})}),(0,W.jsx)(`button`,{onClick:()=>{Q||ge(),_e()},className:`group relative size-4 flex items-center justify-center rounded-full hover:bg-surface-hover transition-colors`,title:Q?`Connected — click to refetch messages`:`Disconnected — click to reconnect`,children:(0,W.jsx)(`span`,{className:`size-2 rounded-full transition-colors ${Q?`bg-green-500`:`bg-red-500 animate-pulse`}`})})]})]}),(0,W.jsx)(He,{usage:G,visible:N,onClose:()=>P(!1),onReload:de,loading:K,lastUpdatedAt:ue}),(0,W.jsx)(Ie,{items:o,filter:m,onSelect:xe,onClose:Se,visible:f}),(0,W.jsx)(Pe,{items:y,filter:k,onSelect:we,onClose:Te,visible:S}),(0,W.jsx)(Fe,{onSend:ye,isStreaming:Y,onCancel:he,projectName:U,onSlashStateChange:be,onSlashItemsLoaded:l,slashSelected:g,onFileStateChange:Ce,onFileItemsLoaded:b,fileSelected:ee,externalFiles:re})]}),F&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/50`,onClick:()=>I(null)}),(0,W.jsxs)(`div`,{className:`fixed inset-x-4 top-[10%] bottom-[10%] z-50 mx-auto max-w-lg flex flex-col rounded-lg border border-border bg-background shadow-xl`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2 border-b border-border`,children:[(0,W.jsx)(`span`,{className:`text-sm font-medium`,children:`Bug Report`}),(0,W.jsx)(`button`,{onClick:()=>I(null),className:`p-1 rounded hover:bg-surface-elevated`,children:(0,W.jsx)(x,{className:`size-4`})})]}),(0,W.jsx)(`pre`,{className:`flex-1 overflow-auto px-4 py-2 text-xs font-mono whitespace-pre-wrap break-all`,children:F}),(0,W.jsxs)(`div`,{className:`flex gap-2 px-4 py-3 border-t border-border`,children:[(0,W.jsxs)(`button`,{onClick:async()=>{await E(F)&&L(!0)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm rounded-lg bg-surface hover:bg-surface-elevated border border-border transition-colors`,children:[(0,W.jsx)(s,{className:`size-4`}),te?`Copied!`:`Copy`]}),(0,W.jsxs)(`button`,{onClick:()=>{D(F),I(null)},className:`flex-1 flex items-center justify-center gap-2 px-3 py-2 text-sm rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors`,children:[(0,W.jsx)(c,{className:`size-4`}),`GitHub Issue`]})]})]})]})]})}export{Ue as ChatTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-BFALxl05.js";import{n as i,t as a}from"./marked.esm-DhBtkBa8.js";import{t as o}from"./external-link-Dim3NH6h.js";import{i as s,n as c,t as l}from"./use-monaco-theme-DGDiih0R.js";import{n as u,r as d,t as f}from"./api-client-BCjah751.js";import{C as p,g as m,m as h}from"./index-wdrrHLzl.js";var g=t(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),_=t(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),v=e(n(),1),y=r(),b=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`]);function x(e){return e.split(`.`).pop()?.toLowerCase()??``}function S(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[x(e)]??`plaintext`}function C({metadata:e,tabId:t}){let n=e?.filePath,r=e?.projectName,[a,o]=(0,v.useState)(null),[u,C]=(0,v.useState)(`utf-8`),[D,O]=(0,v.useState)(!0),[k,A]=(0,v.useState)(null),[j,M]=(0,v.useState)(!1),N=(0,v.useRef)(null),P=(0,v.useRef)(``),F=(0,v.useRef)(null),{tabs:I,updateTab:L}=h(),{wordWrap:R,toggleWordWrap:z}=m(),B=l(),V=I.find(e=>e.id===t),H=n?x(n):``,U=b.has(H),W=H===`pdf`,G=H===`md`||H===`mdx`,[K,q]=(0,v.useState)(`preview`);(0,v.useEffect)(()=>{if(!(!n||!r)){if(U||W){O(!1);return}return O(!0),A(null),f.get(`${d(r)}/files/read?path=${encodeURIComponent(n)}`).then(e=>{o(e.content),C(e.encoding),P.current=e.content,O(!1)}).catch(e=>{A(e instanceof Error?e.message:`Failed to load file`),O(!1)}),()=>{N.current&&clearTimeout(N.current)}}},[n,r,U,W]),(0,v.useEffect)(()=>{if(!V)return;let e=n?.split(`/`).pop()??`Untitled`,t=j?`${e} \u25CF`:e;V.title!==t&&L(V.id,{title:t})},[j]);let J=(0,v.useCallback)(async e=>{if(!(!n||!r))try{await f.put(`${d(r)}/files/write`,{path:n,content:e}),M(!1)}catch{}},[n,r]);function Y(e){let t=e??``;o(t),P.current=t,M(!0),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>J(P.current),1e3)}let X=(0,v.useCallback)((e,t)=>{F.current=e,e.addCommand(t.KeyMod.Alt|t.KeyCode.KeyZ,()=>m.getState().toggleWordWrap())},[]);if(!n||!r)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:`No file selected.`});if(D)return(0,y.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,y.jsx)(p,{className:`size-5 animate-spin`}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Loading file...`})]});if(k)return(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full text-error text-sm`,children:k});if(U)return(0,y.jsx)(T,{filePath:n,projectName:r});if(W)return(0,y.jsx)(E,{filePath:n,projectName:r});if(u===`base64`)return(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,y.jsx)(_,{className:`size-10 text-text-subtle`}),(0,y.jsx)(`p`,{className:`text-sm`,children:`This file is a binary format and cannot be displayed.`}),(0,y.jsx)(`p`,{className:`text-xs text-text-subtle`,children:n})]});let Z=G?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`button`,{type:`button`,onClick:()=>q(`edit`),className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${K===`edit`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,y.jsx)(i,{className:`size-3`}),` Edit`]}),(0,y.jsxs)(`button`,{type:`button`,onClick:()=>q(`preview`),className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${K===`preview`?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,y.jsx)(g,{className:`size-3`}),` Preview`]})]}):null,Q=(0,y.jsxs)(`button`,{type:`button`,onClick:z,title:`Toggle word wrap (Alt+Z)`,className:`flex items-center gap-1 px-2 py-1 rounded text-xs transition-colors ${R?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:[(0,y.jsx)(s,{className:`size-3`}),(0,y.jsx)(`span`,{className:`hidden sm:inline`,children:`Wrap`})]});return(0,y.jsxs)(`div`,{className:`flex flex-col h-full w-full overflow-hidden`,children:[(0,y.jsxs)(`div`,{className:`hidden md:flex items-center gap-1 px-2 py-1 border-b shrink-0 bg-background`,children:[Z,(0,y.jsx)(`div`,{className:`flex-1`}),Q]}),G&&K===`preview`?(0,y.jsx)(w,{content:a??``}):(0,y.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,y.jsx)(c,{height:`100%`,language:S(n),value:a??``,onChange:Y,onMount:X,theme:B,options:{fontSize:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:R?`on`:`off`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbers:`on`,folding:!0,bracketPairColorization:{enabled:!0}},loading:(0,y.jsx)(p,{className:`size-5 animate-spin text-text-subtle`})})}),(0,y.jsxs)(`div`,{className:`md:hidden flex items-center gap-1 px-2 py-1 border-t shrink-0 bg-background`,children:[Z,(0,y.jsx)(`div`,{className:`flex-1`}),Q]})]})}function w({content:e}){return(0,y.jsx)(`div`,{className:`flex-1 overflow-auto p-4 markdown-content prose-sm`,dangerouslySetInnerHTML:{__html:(0,v.useMemo)(()=>{try{return a.parse(e,{gfm:!0,breaks:!0})}catch{return e}},[e])}})}function T({filePath:e,projectName:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let n,i=`${d(t)}/files/raw?path=${encodeURIComponent(e)}`,o=u();return fetch(i,{headers:o?{Authorization:`Bearer ${o}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{let t=URL.createObjectURL(e);n=t,r(t)}).catch(()=>a(!0)),()=>{n&&URL.revokeObjectURL(n)}},[e,t]),i?(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,y.jsx)(_,{className:`size-10 text-text-subtle`}),(0,y.jsx)(`p`,{className:`text-sm`,children:`Failed to load image.`})]}):n?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 bg-surface overflow-auto`,children:(0,y.jsx)(`img`,{src:n,alt:e,className:`max-w-full max-h-full object-contain`})}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(p,{className:`size-5 animate-spin text-text-subtle`})})}function E({filePath:e,projectName:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let n,i=`${d(t)}/files/raw?path=${encodeURIComponent(e)}`,o=u();return fetch(i,{headers:o?{Authorization:`Bearer ${o}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{let t=URL.createObjectURL(new Blob([e],{type:`application/pdf`}));n=t,r(t)}).catch(()=>a(!0)),()=>{n&&URL.revokeObjectURL(n)}},[e,t]);let s=(0,v.useCallback)(()=>{n&&window.open(n,`_blank`)},[n]);return i?(0,y.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,y.jsx)(_,{className:`size-10 text-text-subtle`}),(0,y.jsx)(`p`,{className:`text-sm`,children:`Failed to load PDF.`})]}):n?(0,y.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,y.jsx)(`span`,{className:`text-xs text-text-secondary truncate`,children:e}),(0,y.jsxs)(`button`,{onClick:s,className:`flex items-center gap-1 text-xs text-text-secondary hover:text-text-primary transition-colors`,children:[(0,y.jsx)(o,{className:`size-3`}),` Open in new tab`]})]}),(0,y.jsx)(`iframe`,{src:n,title:e,className:`flex-1 w-full border-none`})]}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(p,{className:`size-5 animate-spin text-text-subtle`})})}export{C as CodeEditor};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-BFALxl05.js";import{t as i}from"./columns-2-DFQ3yid7.js";import{i as a,r as o,t as s}from"./use-monaco-theme-DGDiih0R.js";import{r as c,t as l}from"./api-client-BCjah751.js";import{C as u,S as d,g as f,k as p}from"./index-wdrrHLzl.js";var m=t(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),h=e(n(),1),g=r();function _(e){return{js:`javascript`,jsx:`javascript`,ts:`typescript`,tsx:`typescript`,py:`python`,html:`html`,css:`css`,scss:`scss`,json:`json`,md:`markdown`,mdx:`markdown`,yaml:`yaml`,yml:`yaml`,sh:`shell`,bash:`shell`}[e.split(`.`).pop()?.toLowerCase()??``]??`plaintext`}function v({metadata:e}){let t=e?.filePath,n=e?.projectName,r=e?.ref1,v=e?.ref2,b=e?.file1,x=e?.file2,S=e?.original,C=e?.modified,w=S!=null||C!=null,T=!!(b&&x),[E,D]=(0,h.useState)(null),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(!w),[M,N]=(0,h.useState)(null),[P,F]=(0,h.useState)(`both`),{wordWrap:I,toggleWordWrap:L}=f(),R=s();(0,h.useEffect)(()=>{if(w||!n)return;if(j(!0),N(null),b&&x){let e=new URLSearchParams({file1:b,file2:x});l.get(`${c(n)}/files/compare?${e}`).then(e=>{k(e),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to compare files`),j(!1)});return}let e;if(t){let i=new URLSearchParams({file:t});r&&i.set(`ref`,r),e=`${c(n)}/git/file-diff?${i}`}else if(r||v){let t=new URLSearchParams;r&&t.set(`ref1`,r),v&&t.set(`ref2`,v),e=`${c(n)}/git/diff?${t}`}else e=`${c(n)}/git/diff`;l.get(e).then(e=>{D(e.diff),j(!1)}).catch(e=>{N(e instanceof Error?e.message:`Failed to load diff`),j(!1)})},[t,n,r,v,b,x,w]);let{original:z,modified:B}=(0,h.useMemo)(()=>w?{original:S??``,modified:C??``}:T&&O?O:E?y(E):{original:``,modified:``},[E,w,S,C,T,O]),V=(0,h.useMemo)(()=>{let e=t??x??b;return e?_(e):`plaintext`},[t,b,x]);if(!n&&!w)return(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`});if(A)return(0,g.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(u,{className:`size-5 animate-spin`}),(0,g.jsx)(`span`,{className:`text-sm`,children:`Loading diff...`})]});if(M)return(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full text-destructive text-sm`,children:M});if(!w&&!T&&(!E||E.trim()===``)&&!z&&!B)return(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,g.jsx)(p,{className:`size-8`}),(0,g.jsx)(`p`,{className:`text-sm`,children:`No changes detected`}),t&&(0,g.jsx)(`p`,{className:`text-xs font-mono`,children:t})]});let H=P===`both`,U=(0,g.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`left`?`both`:`left`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`left`?`bg-muted text-foreground`:``}`,title:`Expand original`,children:(0,g.jsx)(d,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(`both`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`both`?`bg-muted text-foreground`:``}`,title:`Side by side`,children:(0,g.jsx)(i,{className:`size-3.5`})}),(0,g.jsx)(`button`,{type:`button`,onClick:()=>F(P===`right`?`both`:`right`),className:`p-1 rounded hover:bg-muted transition-colors ${P===`right`?`bg-muted text-foreground`:``}`,title:`Expand modified`,children:(0,g.jsx)(m,{className:`size-3.5`})}),(0,g.jsx)(`div`,{className:`w-px h-3.5 bg-border mx-0.5 shrink-0`}),(0,g.jsx)(`button`,{type:`button`,onClick:L,title:`Toggle word wrap`,className:`p-1 rounded hover:bg-muted transition-colors ${I?`bg-muted text-foreground`:``}`,children:(0,g.jsx)(a,{className:`size-3.5`})})]});return(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b text-xs text-muted-foreground`,children:[(0,g.jsx)(p,{className:`size-3.5`}),T?(0,g.jsxs)(`span`,{className:`font-mono truncate flex-1`,children:[b,` vs `,x]}):(0,g.jsxs)(`span`,{className:`flex-1 truncate`,children:[(0,g.jsx)(`span`,{className:`font-mono`,children:t??`Working tree changes`}),(r||v)&&(0,g.jsxs)(`span`,{children:[` (`,r?.slice(0,7)??`HEAD`,` vs `,v?.slice(0,7)??`working tree`,`)`]})]}),(0,g.jsx)(`div`,{className:`hidden md:block`,children:U})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,g.jsx)(o,{height:`100%`,language:V,original:z,modified:B,theme:R,options:{fontSize:13,fontFamily:`Menlo, Monaco, Consolas, monospace`,wordWrap:I?`on`:`off`,renderSideBySide:H,readOnly:!0,automaticLayout:!0,scrollBeyondLastLine:!1},loading:(0,g.jsx)(u,{className:`size-5 animate-spin text-text-subtle`})})}),(0,g.jsx)(`div`,{className:`md:hidden flex justify-center border-t py-1 bg-background shrink-0`,children:U})]})}function y(e){let t=e.split(`
|
|
2
|
+
`),n=[],r=[],i=!1;for(let e of t)if(!(e.startsWith(`diff --git`)||e.startsWith(`diff --no-index`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`Binary files`)||e.startsWith(`\\ No newline`))){if(e.startsWith(`@@`)){i=!0;continue}if(i)if(e.startsWith(`-`))n.push(e.slice(1));else if(e.startsWith(`+`))r.push(e.slice(1));else{let t=e.startsWith(` `)?e.slice(1):e;n.push(t),r.push(t)}}return{original:n.join(`
|
|
3
|
+
`),modified:r.join(`
|
|
4
|
+
`)}}export{v as DiffViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,r as n,t as r}from"./jsx-runtime-BFALxl05.js";import{n as i,t as a}from"./input-CTnwfHVN.js";import{t as o}from"./copy-B-kLwqzg.js";import{t as s}from"./external-link-Dim3NH6h.js";import{r as c,t as l}from"./api-client-BCjah751.js";import{C as u,L as d,T as f,a as p,c as m,d as h,f as g,i as ee,l as _,m as te,o as ne,p as v,s as re,u as y,v as b,w as ie,x as ae}from"./index-wdrrHLzl.js";var oe=t(`cherry`,[[`path`,{d:`M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z`,key:`cvxqlc`}],[`path`,{d:`M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z`,key:`1ostrc`}],[`path`,{d:`M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12`,key:`hqx58h`}],[`path`,{d:`M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z`,key:`eykp1o`}]]),x=t(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),se=t(`rotate-ccw`,[[`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`}]]),S=t(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),C=e(n(),1),w=r(),T=[`#4fc3f7`,`#81c784`,`#ffb74d`,`#e57373`,`#ba68c8`,`#4dd0e1`,`#aed581`,`#ff8a65`,`#f06292`,`#7986cb`],E=32,D=20,O=5;function k({metadata:e}){let t=e?.projectName,[n,r]=(0,C.useState)(null),[s,d]=(0,C.useState)(!0),[b,x]=(0,C.useState)(null),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)({type:null}),[N,P]=(0,C.useState)(``),[F,I]=(0,C.useState)(null),[L,R]=(0,C.useState)([]),[le,z]=(0,C.useState)(!1),{openTab:B}=te(),V=(0,C.useCallback)(async()=>{if(t)try{d(!0),r(await l.get(`${c(t)}/git/graph?max=200`)),x(null)}catch(e){x(e instanceof Error?e.message:`Failed to fetch graph`)}finally{d(!1)}},[t]);(0,C.useEffect)(()=>{V();let e=setInterval(V,1e4);return()=>clearInterval(e)},[V]);let H=async(e,n)=>{if(t){A(!0);try{await l.post(`${c(t)}${e}`,n),await V()}catch(e){x(e instanceof Error?e.message:`Action failed`)}finally{A(!1)}}},U=e=>H(`/git/checkout`,{ref:e}),W=e=>H(`/git/cherry-pick`,{hash:e}),ue=e=>H(`/git/revert`,{hash:e}),de=e=>H(`/git/merge`,{source:e}),fe=e=>H(`/git/branch/delete`,{name:e}),pe=e=>H(`/git/push`,{branch:e}),G=async(e,t)=>{if(n?.branches.some(t=>t.name===e||t.name.endsWith(`/${e}`))){if(!window.confirm(`Branch "${e}" already exists.\nDelete it and recreate from this commit?`))return;await H(`/git/branch/delete`,{name:e})}await H(`/git/branch/create`,{name:e,from:t})},K=(e,t)=>H(`/git/tag`,{name:e,hash:t}),me=async e=>{if(t)try{let n=await l.get(`${c(t)}/git/pr-url?branch=${encodeURIComponent(e)}`);n.url&&window.open(n.url,`_blank`)}catch{}},q=e=>{navigator.clipboard.writeText(e)},he=async e=>{if(F?.hash===e.hash){I(null);return}I(e),z(!0);try{let n=e.parents[0]??``,r=n?`ref1=${encodeURIComponent(n)}&`:``,i=await l.get(`${c(t)}/git/diff-stat?${r}ref2=${encodeURIComponent(e.hash)}`);R(Array.isArray(i)?i:[])}catch(e){console.error(`diff-stat error:`,e),R([])}finally{z(!1)}},ge=e=>{let n=e.parents[0];B({type:`git-diff`,title:`Diff ${e.abbreviatedHash}`,closable:!0,metadata:{projectName:t,ref1:n??void 0,ref2:e.hash},projectId:t??null})},{laneMap:J,maxLane:_e}=(0,C.useMemo)(()=>{let e=new Map;if(!n)return{laneMap:e,maxLane:0};let t=0,r=new Map;for(let i of n.commits){let n=r.get(i.hash);n===void 0&&(n=t++),e.set(i.hash,n),r.delete(i.hash);for(let e=0;e<i.parents.length;e++){let a=i.parents[e];r.has(a)||r.set(a,e===0?n:t++)}}return{laneMap:e,maxLane:Math.max(t-1,0)}},[n]),Y=n?.branches.find(e=>e.current),ve=(0,C.useMemo)(()=>{let e=new Map;if(!n)return e;for(let t of n.branches){let n=e.get(t.commitHash)??[];n.push({name:t.name,type:`branch`}),e.set(t.commitHash,n)}for(let t of n.commits)for(let n of t.refs)if(n.startsWith(`tag: `)){let r=n.replace(`tag: `,``),i=e.get(t.hash)??[];i.push({name:r,type:`tag`}),e.set(t.hash,i)}return e},[n]),ye=(0,C.useMemo)(()=>{if(!n)return[];let e=[];for(let t=0;t<n.commits.length;t++){let r=n.commits[t],i=J.get(r.hash)??0,a=T[i%T.length];for(let o of r.parents){let s=n.commits.findIndex(e=>e.hash===o);if(s<0)continue;let c=J.get(o)??0,l=T[c%T.length],u=i*D+D/2,d=t*E+E/2,f=c*D+D/2,p=s*E+E/2,m,h=r.parents.indexOf(o)>0;if(u===f)m=`M ${u} ${d} L ${f} ${p}`;else if(h){let e=d+E;m=`M ${u} ${d} C ${u} ${e} ${f} ${d} ${f} ${e} L ${f} ${p}`}else{let e=p-E;m=`M ${u} ${d} L ${u} ${e} C ${u} ${p} ${f} ${e} ${f} ${p}`}let g=r.parents.indexOf(o)===0?a:l;e.push({d:m,color:g})}}return e},[n,J]);(_e+1)*D+D;let X=(n?.commits.length??0)*E,[Z,be]=(0,C.useState)((typeof window<`u`&&window.innerWidth<768?6:10)*D+D),Q=(0,C.useRef)(!1),$=(0,C.useCallback)(e=>{Q.current=!0;let t=Z,n=n=>{if(!Q.current)return;let r=`touches`in n?n.touches[0].clientX:n.clientX;be(Math.max(40,t+r-e))},r=()=>{Q.current=!1,window.removeEventListener(`mousemove`,n),window.removeEventListener(`mouseup`,r),window.removeEventListener(`touchmove`,n),window.removeEventListener(`touchend`,r)};window.addEventListener(`mousemove`,n),window.addEventListener(`mouseup`,r),window.addEventListener(`touchmove`,n,{passive:!1}),window.addEventListener(`touchend`,r)},[Z]),xe=(0,C.useCallback)(e=>{e.preventDefault(),$(e.clientX)},[$]),Se=(0,C.useCallback)(e=>{$(e.touches[0].clientX)},[$]);if(!t)return(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground text-sm`,children:`No project selected.`});if(s&&!n)return(0,w.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-muted-foreground`,children:[(0,w.jsx)(u,{className:`size-5 animate-spin`}),(0,w.jsx)(`span`,{className:`text-sm`,children:`Loading git graph...`})]});if(b&&!n)return(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-2 text-destructive text-sm`,children:[(0,w.jsx)(`p`,{children:b}),(0,w.jsx)(i,{variant:`outline`,size:`sm`,onClick:V,children:`Retry`})]});function Ce(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/6e4);if(r<1)return`just now`;if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;let o=Math.floor(a/30);return o<12?`${o}mo ago`:`${Math.floor(o/12)}y ago`}return(0,w.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b`,children:[(0,w.jsxs)(`span`,{className:`text-sm font-medium`,children:[`Git Graph`,Y?` - ${Y.name}`:``]}),(0,w.jsx)(i,{variant:`ghost`,size:`icon-xs`,onClick:V,disabled:k,children:(0,w.jsx)(ae,{className:s?`animate-spin`:``})})]}),b&&(0,w.jsx)(`div`,{className:`px-3 py-1.5 text-xs text-destructive bg-destructive/10`,children:b}),(0,w.jsx)(`div`,{className:`flex-1 overflow-y-auto overflow-x-auto md:overflow-x-hidden`,children:(0,w.jsxs)(`div`,{className:`flex min-w-max md:min-w-0`,style:{height:`${X}px`},children:[(0,w.jsxs)(`div`,{className:`sticky left-0 z-10 shrink-0 bg-background`,style:{width:`${Z}px`},children:[(0,w.jsxs)(`svg`,{width:Z,height:X,children:[ye.map((e,t)=>(0,w.jsx)(`path`,{d:e.d,stroke:e.color,strokeWidth:2,fill:`none`},t)),n?.commits.map((e,t)=>{let n=J.get(e.hash)??0,r=n*D+D/2,i=t*E+E/2,a=T[n%T.length];return(0,w.jsx)(`circle`,{cx:r,cy:i,r:O,fill:a,stroke:`#0f1419`,strokeWidth:2},e.hash)})]}),(0,w.jsx)(`div`,{className:`absolute top-0 right-0 w-3 md:w-2 h-full cursor-col-resize hover:bg-primary/20 flex items-center justify-center bg-primary/10 md:bg-transparent`,onMouseDown:xe,onTouchStart:Se,children:(0,w.jsx)(ie,{className:`size-3 text-muted-foreground md:opacity-0 md:hover:opacity-100`})})]}),(0,w.jsx)(`div`,{className:`flex-1 min-w-[400px]`,children:n?.commits.map((e,t)=>{let n=T[(J.get(e.hash)??0)%T.length],r=ve.get(e.hash)??[],i=r.filter(e=>e.type===`branch`),a=r.filter(e=>e.type===`tag`);return(0,w.jsxs)(_,{children:[(0,w.jsx)(v,{asChild:!0,children:(0,w.jsx)(`div`,{className:`flex items-center hover:bg-muted/50 cursor-pointer text-sm border-b border-border/30 ${F?.hash===e.hash?`bg-primary/10`:``}`,style:{height:`${E}px`},onClick:()=>he(e),children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 px-2`,children:[(0,w.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground w-14 shrink-0`,children:e.abbreviatedHash}),i.map(e=>(0,w.jsx)(ce,{label:e,color:n,currentBranch:Y,onCheckout:U,onMerge:de,onPush:pe,onCreatePr:me,onDelete:fe},`branch-${e.name}`)),a.map(e=>(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium shrink-0 bg-amber-500/20 text-amber-500 border border-amber-500/30`,children:[(0,w.jsx)(S,{className:`size-2.5`}),e.name]},`tag-${e.name}`)),(0,w.jsx)(`span`,{className:`flex-1 truncate`,children:e.subject}),(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 hidden sm:inline`,children:e.authorName}),(0,w.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 w-14 text-right`,children:Ce(e.authorDate)})]})})}),(0,w.jsxs)(y,{children:[(0,w.jsx)(h,{onClick:()=>U(e.hash),children:`Checkout`}),(0,w.jsxs)(h,{onClick:()=>{M({type:`branch`,hash:e.hash}),P(``)},children:[(0,w.jsx)(f,{className:`size-3`}),`Create Branch...`]}),(0,w.jsx)(g,{}),(0,w.jsxs)(h,{onClick:()=>W(e.hash),children:[(0,w.jsx)(oe,{className:`size-3`}),`Cherry Pick`]}),(0,w.jsxs)(h,{onClick:()=>ue(e.hash),children:[(0,w.jsx)(se,{className:`size-3`}),`Revert`]}),(0,w.jsxs)(h,{onClick:()=>{M({type:`tag`,hash:e.hash}),P(``)},children:[(0,w.jsx)(S,{className:`size-3`}),`Create Tag...`]}),(0,w.jsx)(g,{}),(0,w.jsx)(h,{onClick:()=>ge(e),children:`View Diff`}),(0,w.jsxs)(h,{onClick:()=>q(e.hash),children:[(0,w.jsx)(o,{className:`size-3`}),`Copy Hash`]})]})]},e.hash)})})]})}),F&&(0,w.jsxs)(`div`,{className:`border-t bg-muted/30 max-h-[40%] overflow-auto`,children:[(0,w.jsxs)(`div`,{className:`px-3 py-2 border-b flex items-center justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-sm font-medium truncate`,children:[F.abbreviatedHash,` — `,F.subject]}),(0,w.jsx)(i,{variant:`ghost`,size:`icon-xs`,onClick:()=>I(null),children:`✕`})]}),(0,w.jsxs)(`div`,{className:`px-3 py-2 text-xs space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex gap-4`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Author`}),(0,w.jsxs)(`span`,{children:[F.authorName,` <`,F.authorEmail,`>`]})]}),(0,w.jsxs)(`div`,{className:`flex gap-4`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Date`}),(0,w.jsx)(`span`,{children:new Date(F.authorDate).toLocaleString()})]}),(0,w.jsxs)(`div`,{className:`flex gap-4`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Hash`}),(0,w.jsx)(`span`,{className:`font-mono cursor-pointer hover:text-primary`,onClick:()=>q(F.hash),children:F.hash})]}),F.parents.length>0&&(0,w.jsxs)(`div`,{className:`flex gap-4`,children:[(0,w.jsx)(`span`,{className:`text-muted-foreground`,children:`Parents`}),(0,w.jsx)(`span`,{className:`font-mono`,children:F.parents.map(e=>e.slice(0,7)).join(`, `)})]}),F.body&&(0,w.jsx)(`div`,{className:`mt-2 p-2 bg-background rounded text-xs whitespace-pre-wrap`,children:F.body})]}),(0,w.jsxs)(`div`,{className:`px-3 py-1 border-t`,children:[(0,w.jsx)(`div`,{className:`text-xs text-muted-foreground py-1`,children:le?`Loading files...`:`${L.length} file${L.length===1?``:`s`} changed`}),L.map(e=>(0,w.jsxs)(`div`,{className:`flex items-center gap-2 py-0.5 text-xs hover:bg-muted/50 rounded px-1 cursor-pointer`,onClick:()=>B({type:`git-diff`,title:`Diff ${e.path.split(`/`).pop()}`,closable:!0,metadata:{projectName:t,ref1:F.parents[0]??void 0,ref2:F.hash,filePath:e.path},projectId:t??null}),children:[(0,w.jsx)(`span`,{className:`flex-1 truncate font-mono`,children:e.path}),e.additions>0&&(0,w.jsxs)(`span`,{className:`text-green-500`,children:[`+`,e.additions]}),e.deletions>0&&(0,w.jsxs)(`span`,{className:`text-red-500`,children:[`-`,e.deletions]})]},e.path))]})]}),(0,w.jsx)(ee,{open:j.type!==null,onOpenChange:e=>{e||M({type:null})},children:(0,w.jsxs)(p,{children:[(0,w.jsx)(re,{children:(0,w.jsx)(m,{children:j.type===`branch`?`Create Branch`:`Create Tag`})}),(0,w.jsx)(a,{placeholder:j.type===`branch`?`Branch name`:`Tag name`,value:N,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key===`Enter`&&N.trim()&&(j.type===`branch`?G(N.trim(),j.hash):K(N.trim(),j.hash),M({type:null}))},autoFocus:!0}),(0,w.jsxs)(ne,{children:[(0,w.jsx)(i,{variant:`outline`,onClick:()=>M({type:null}),children:`Cancel`}),(0,w.jsx)(i,{disabled:!N.trim(),onClick:()=>{j.type===`branch`?G(N.trim(),j.hash):K(N.trim(),j.hash),M({type:null})},children:`Create`})]})]})})]})}function ce({label:e,color:t,currentBranch:n,onCheckout:r,onMerge:i,onPush:a,onCreatePr:o,onDelete:c}){return(0,w.jsxs)(_,{children:[(0,w.jsx)(v,{asChild:!0,children:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium shrink-0 cursor-context-menu`,style:{backgroundColor:`${t}30`,color:t,border:`1px solid ${t}50`},children:[(0,w.jsx)(f,{className:`size-2.5`}),e.name]})}),(0,w.jsxs)(y,{children:[(0,w.jsx)(h,{onClick:()=>r(e.name),children:`Checkout`}),(0,w.jsxs)(h,{onClick:()=>i(e.name),disabled:e.name===n?.name,children:[(0,w.jsx)(x,{className:`size-3`}),`Merge into current`]}),(0,w.jsx)(g,{}),(0,w.jsxs)(h,{onClick:()=>a(e.name),children:[(0,w.jsx)(d,{className:`size-3`}),`Push`]}),(0,w.jsxs)(h,{onClick:()=>o(e.name),children:[(0,w.jsx)(s,{className:`size-3`}),`Create PR`]}),(0,w.jsx)(g,{}),(0,w.jsxs)(h,{variant:`destructive`,onClick:()=>c(e.name),disabled:e.name===n?.name,children:[(0,w.jsx)(b,{className:`size-3`}),`Delete`]})]})]})}export{k as GitGraph};
|