@ironmussa/funny 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -214
- package/bin/funny.js +80 -80
- package/package.json +79 -59
- package/packages/client/dist/assets/AddProjectView-yopCTuKC.js +1 -0
- package/packages/client/dist/assets/AllThreadsView-vCQJYKkF.js +2 -0
- package/packages/client/dist/assets/AnalyticsView-vz1-NSOv.js +36 -0
- package/packages/client/dist/assets/App-BEFplUGa.js +2 -0
- package/packages/client/dist/assets/AutomationInboxView-Dj7f9gOu.js +1 -0
- package/packages/client/dist/assets/CircuitBreakerDialog-C76CZi4q.js +1 -0
- package/packages/client/dist/assets/CommandPalette-7Y8qqH7R.js +1 -0
- package/packages/client/dist/assets/LiveColumnsView-CSRiYBNg.js +1 -0
- package/packages/client/dist/assets/LoginPage-C61IUXzX.js +1 -0
- package/packages/client/dist/assets/MobilePage-B4kbWfE1.js +1 -0
- package/packages/client/dist/assets/MonacoEditorDialog-PPXTSIdX.js +1 -0
- package/packages/client/dist/assets/PreviewBrowser-Bo2zmDPh.js +2 -0
- package/packages/client/dist/assets/PromptInput-Cq_fXmwj.js +1 -0
- package/packages/client/dist/assets/ReviewPane-1r1cuH2I.js +10 -0
- package/packages/client/dist/assets/SettingsDetailView-D-J9TfZx.js +1 -0
- package/packages/client/dist/assets/SetupWizard-BbLWm6BX.js +1 -0
- package/packages/client/dist/assets/Sidebar-3Jd5JyAp.js +1 -0
- package/packages/client/dist/assets/SlideUpPrompt-_ulHi9sN.js +1 -0
- package/packages/client/dist/assets/TerminalPanel-BiLDlQZQ.js +4 -0
- package/packages/client/dist/assets/ThreadListView-DthHUodE.js +1 -0
- package/packages/client/dist/assets/ThreadView-DsqoxCXZ.js +16 -0
- package/packages/client/dist/assets/ToolCallGroup-BgROpRwn.js +22 -0
- package/packages/client/dist/assets/_basePickBy-BeHeP2rS.js +1 -0
- package/packages/client/dist/assets/_baseUniq-CZf5jOXa.js +1 -0
- package/packages/client/dist/assets/ansi_to_html-DYje8R53.js +3 -0
- package/packages/client/dist/assets/app-store-B3iAaYzj.js +1 -0
- package/packages/client/dist/assets/architectureDiagram-VXUJARFQ-CysgSV_T.js +36 -0
- package/packages/client/dist/assets/arrow-down-DQYiOM3D.js +1 -0
- package/packages/client/dist/assets/arrow-right-Bbusk4uX.js +1 -0
- package/packages/client/dist/assets/automation-store-DiFgwQi4.js +1 -0
- package/packages/client/dist/assets/badge-CrCqde50.js +1 -0
- package/packages/client/dist/assets/blockDiagram-VD42YOAC-DU32EjW8.js +122 -0
- package/packages/client/dist/assets/breadcrumb-BiY69_Mg.js +1 -0
- package/packages/client/dist/assets/button-D8qrc3hb.js +1 -0
- package/packages/client/dist/assets/c4Diagram-YG6GDRKO-D31N17G_.js +10 -0
- package/packages/client/dist/assets/check-Dj_ZR5Y7.js +1 -0
- package/packages/client/dist/assets/chevron-down-BJhJsMnL.js +1 -0
- package/packages/client/dist/assets/chevron-left-BVsM9RGq.js +1 -0
- package/packages/client/dist/assets/chevron-right-PEOnBrxM.js +1 -0
- package/packages/client/dist/assets/chevrons-up-down-Sa8XJRBx.js +1 -0
- package/packages/client/dist/assets/chunk-4BX2VUAB-CSqlINSL.js +1 -0
- package/packages/client/dist/assets/chunk-55IACEB6-D5_ai8AA.js +1 -0
- package/packages/client/dist/assets/chunk-B4BG7PRW-DKOAlNfo.js +165 -0
- package/packages/client/dist/assets/chunk-DI55MBZ5-BNwqKgG-.js +220 -0
- package/packages/client/dist/assets/chunk-FMBD7UC4-MKWtG46g.js +15 -0
- package/packages/client/dist/assets/chunk-QN33PNHL-BWGv-iLk.js +1 -0
- package/packages/client/dist/assets/chunk-QZHKN3VN-Brx07f_u.js +1 -0
- package/packages/client/dist/assets/chunk-TZMSLE5B-Cgz2v9ud.js +1 -0
- package/packages/client/dist/assets/circle-x-BNvrcCvx.js +1 -0
- package/packages/client/dist/assets/classDiagram-2ON5EDUG-Bi8VPWgp.js +1 -0
- package/packages/client/dist/assets/classDiagram-v2-WZHVMYZB-Bi8VPWgp.js +1 -0
- package/packages/client/dist/assets/clipboard-list-zkC7qTDO.js +1 -0
- package/packages/client/dist/assets/clone-CzE9L7Ig.js +1 -0
- package/packages/client/dist/assets/collapsible-DP3s_8s3.js +1 -0
- package/packages/client/dist/assets/columns-3-DhvlrNjA.js +1 -0
- package/packages/client/dist/assets/command-DOlrnbnh.js +1 -0
- package/packages/client/dist/assets/copy-DXKK6zMx.js +1 -0
- package/packages/client/dist/assets/cose-bilkent-S5V4N54A-DabFXskf.js +1 -0
- package/packages/client/dist/assets/createLucideIcon-CsWFljth.js +1 -0
- package/packages/client/dist/assets/cytoscape.esm-5J0xJHOV.js +321 -0
- package/packages/client/dist/assets/dagre-6UL2VRFP-BgQrFrWh.js +4 -0
- package/packages/client/dist/assets/diagram-PSM6KHXK-B0rQdwLC.js +24 -0
- package/packages/client/dist/assets/diagram-QEK2KX5R-aX13lt6A.js +43 -0
- package/packages/client/dist/assets/diagram-S2PKOQOG-cgHvdjCm.js +24 -0
- package/packages/client/dist/assets/dialog-DapeOKPE.js +1 -0
- package/packages/client/dist/assets/draft-store-DnVbStYY.js +1 -0
- package/packages/client/dist/assets/dropdown-menu-Bi54WPTK.js +1 -0
- package/packages/client/dist/assets/editor-utils-DgK9pIvP.js +2 -0
- package/packages/client/dist/assets/erDiagram-Q2GNP2WA-DwocRLhB.js +60 -0
- package/packages/client/dist/assets/external-link-Dg0Hq511.js +1 -0
- package/packages/client/dist/assets/eye-BAXsQYWt.js +1 -0
- package/packages/client/dist/assets/eye-off-ICXVwkI1.js +1 -0
- package/packages/client/dist/assets/flowDiagram-NV44I4VS-C0ldc02M.js +162 -0
- package/packages/client/dist/assets/folder-d8RRIu-j.js +1 -0
- package/packages/client/dist/assets/folder-open-BbwqJxUi.js +1 -0
- package/packages/client/dist/assets/ganttDiagram-JELNMOA3-DxdfUar4.js +267 -0
- package/packages/client/dist/assets/git-merge-CB0ebeXg.js +1 -0
- package/packages/client/dist/assets/gitGraphDiagram-V2S2FVAM-uM_Ec7JF.js +65 -0
- package/packages/client/dist/assets/github-DiENtmNz.js +1 -0
- package/packages/client/dist/assets/globe-B1hiCqlb.js +1 -0
- package/packages/client/dist/assets/graph-Qo1vygVG.js +1 -0
- package/packages/client/dist/assets/history-D7cvrs7x.js +1 -0
- package/packages/client/dist/assets/inbox-4g-W9WtW.js +1 -0
- package/packages/client/dist/assets/index-BplxL2Qj.js +1 -0
- package/packages/client/dist/assets/index-DmIp58b6.js +1 -0
- package/packages/client/dist/assets/index-Z_QI94Zg.js +18 -0
- package/packages/client/dist/assets/{index-B0nLATLY.js → index-cSW024sc.js} +1 -1
- package/packages/client/dist/assets/index-zxpgGDAW.css +1 -0
- package/packages/client/dist/assets/infoDiagram-HS3SLOUP-C-koF35b.js +2 -0
- package/packages/client/dist/assets/input-Dyxe5hqI.js +1 -0
- package/packages/client/dist/assets/internal-editor-store-CuhCMFlj.js +1 -0
- package/packages/client/dist/assets/journeyDiagram-XKPGCS4Q-DRqupubT.js +139 -0
- package/packages/client/dist/assets/kanban-definition-3W4ZIXB7-BvWguxdE.js +89 -0
- package/packages/client/dist/assets/katex-DhXJpUyf.js +261 -0
- package/packages/client/dist/assets/layout-UD4laNpY.js +1 -0
- package/packages/client/dist/assets/markdown-9_JKOUHQ.js +29 -0
- package/packages/client/dist/assets/maximize-2-DW-IsQiI.js +1 -0
- package/packages/client/dist/assets/mermaid-C0IQv4mH.js +250 -0
- package/packages/client/dist/assets/mindmap-definition-VGOIOE7T-C0fzBd6g.js +68 -0
- package/packages/client/dist/assets/minimize-2-CWn5BNKr.js +1 -0
- package/packages/client/dist/assets/monaco-CvC2RZDL.js +11 -0
- package/packages/client/dist/assets/{motion-DRu4QWVj.js → motion-Cyp39Uo1.js} +1 -1
- package/packages/client/dist/assets/pencil-pMey300q.js +1 -0
- package/packages/client/dist/assets/pieDiagram-ADFJNKIX-CUBE4hL3.js +30 -0
- package/packages/client/dist/assets/pin-off-DpiyTpTd.js +1 -0
- package/packages/client/dist/assets/pin-uzq68OVB.js +1 -0
- package/packages/client/dist/assets/plus-ChfperZy.js +1 -0
- package/packages/client/dist/assets/popover-CRZjc4jI.js +1 -0
- package/packages/client/dist/assets/project-chip-CkL3EaeE.js +5 -0
- package/packages/client/dist/assets/providers-Bv7fzJNY.js +1 -0
- package/packages/client/dist/assets/quadrantDiagram-AYHSOK5B-DF7I9OHz.js +7 -0
- package/packages/client/dist/assets/refresh-cw-Svvcff2v.js +1 -0
- package/packages/client/dist/assets/requirementDiagram-UZGBJVZJ-BBI4q-3_.js +64 -0
- package/packages/client/dist/assets/review-pane-store-CrK1Czq6.js +1 -0
- package/packages/client/dist/assets/rotate-ccw-DFiWNcpH.js +1 -0
- package/packages/client/dist/assets/sankeyDiagram-TZEHDZUN-lqpKxyZi.js +10 -0
- package/packages/client/dist/assets/scroll-area-Bj4yTRJP.js +1 -0
- package/packages/client/dist/assets/search-JGV9EPmW.js +1 -0
- package/packages/client/dist/assets/select-CkTnmILP.js +1 -0
- package/packages/client/dist/assets/sequenceDiagram-WL72ISMW-DHImpRwJ.js +145 -0
- package/packages/client/dist/assets/shallow-B0DA4RsP.js +1 -0
- package/packages/client/dist/assets/square-BqmNpRIH.js +1 -0
- package/packages/client/dist/assets/stateDiagram-FKZM4ZOC-C7L7Pt_V.js +1 -0
- package/packages/client/dist/assets/stateDiagram-v2-4FDKWEC3-FyYG2QfD.js +1 -0
- package/packages/client/dist/assets/{syntax-qKqB8BhQ.js → syntax-CG1UoaFw.js} +17 -17
- package/packages/client/dist/assets/terminal-CuAYwdh-.js +1 -0
- package/packages/client/dist/assets/timeline-definition-IT6M3QCI-BGABo1HM.js +61 -0
- package/packages/client/dist/assets/trash-2-QvY6JeI_.js +1 -0
- package/packages/client/dist/assets/treemap-GDKQZRPO-DZ7i2Nwu.js +160 -0
- package/packages/client/dist/assets/upload-DXXUmYu2.js +1 -0
- package/packages/client/dist/assets/use-minute-tick-BoS3Ec2H.js +1 -0
- package/packages/client/dist/assets/use-ws-BIe6kKa2.js +48 -0
- package/packages/client/dist/assets/utils-VDOOGGvU.js +2 -0
- package/packages/client/dist/assets/x-AprddF_b.js +1 -0
- package/packages/client/dist/assets/xychartDiagram-PRI3JC2R-D_bazwNo.js +7 -0
- package/packages/client/dist/index.html +9 -13
- package/packages/server/dist/index.js +117479 -69360
- package/packages/server/dist/index.js.map +682 -138
- package/packages/server/dist/pty-helper.mjs +115 -115
- package/packages/client/dist/assets/AddProjectView-CODm54MP.js +0 -1
- package/packages/client/dist/assets/AllThreadsView--Dd7YSK5.js +0 -1
- package/packages/client/dist/assets/AnalyticsView-eRhWGG3y.js +0 -36
- package/packages/client/dist/assets/AutomationInboxView-DwBaGJed.js +0 -1
- package/packages/client/dist/assets/CircuitBreakerDialog-C2iBwp5W.js +0 -1
- package/packages/client/dist/assets/CommandPalette-BXweSrdO.js +0 -1
- package/packages/client/dist/assets/ReviewPane-DxtlJNNu.js +0 -10
- package/packages/client/dist/assets/SettingsDetailView-BKh9OBM2.js +0 -1
- package/packages/client/dist/assets/SetupWizard-BekJX-tc.js +0 -1
- package/packages/client/dist/assets/TerminalPanel-DC4U0OTm.js +0 -4
- package/packages/client/dist/assets/ThreadListView-B6HvQ8NV.js +0 -1
- package/packages/client/dist/assets/arrow-right-3Bby9NNK.js +0 -1
- package/packages/client/dist/assets/command-B76T8z-A.js +0 -1
- package/packages/client/dist/assets/index-BRi6al6L.js +0 -99
- package/packages/client/dist/assets/index-DXO1sSe9.css +0 -1
- package/packages/client/dist/assets/markdown-B7CXSXYD.js +0 -29
- package/packages/client/dist/assets/review-pane-store-BLhxZHRI.js +0 -1
package/package.json
CHANGED
|
@@ -1,59 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ironmussa/funny",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "Codex App clone powered by Claude Code — parallel agent orchestration with git worktrees",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/ironmussa/funny.git"
|
|
11
|
-
},
|
|
12
|
-
"bin": {
|
|
13
|
-
"funny": "./bin/funny.js"
|
|
14
|
-
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
"dev": "
|
|
29
|
-
"dev:
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"tauri": "tauri",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
},
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
},
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ironmussa/funny",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Codex App clone powered by Claude Code — parallel agent orchestration with git worktrees",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Anthropic",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/ironmussa/funny.git"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"funny": "./bin/funny.js"
|
|
14
|
+
},
|
|
15
|
+
"workspaces": [
|
|
16
|
+
"packages/*"
|
|
17
|
+
],
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"packages/server/dist",
|
|
21
|
+
"packages/client/dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"start": "bun ./bin/funny.js",
|
|
25
|
+
"dev": "concurrently --kill-others \"bun run --cwd packages/server dev\" \"bun run --cwd packages/client dev\"",
|
|
26
|
+
"dev:test": "concurrently --kill-others \"bun run --cwd packages/server dev:test\" \"bun run --cwd packages/client dev:test\"",
|
|
27
|
+
"dev:server": "bun run --cwd packages/server dev",
|
|
28
|
+
"dev:client": "bun run --cwd packages/client dev",
|
|
29
|
+
"dev:agent": "bun run --cwd packages/agent dev",
|
|
30
|
+
"build": "bun run --cwd packages/client build && bun run --cwd packages/server build",
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"db:push": "bun run --cwd packages/server db:push",
|
|
33
|
+
"db:studio": "bun run --cwd packages/server db:studio",
|
|
34
|
+
"tauri": "tauri",
|
|
35
|
+
"tauri:dev": "tauri dev",
|
|
36
|
+
"tauri:build": "tauri build",
|
|
37
|
+
"build:sidecar": "bun scripts/build-sidecar.ts",
|
|
38
|
+
"test": "bun run --cwd packages/shared test && bun run --cwd packages/core test && bun run --cwd packages/agent test && bun run --cwd packages/server test && bun run --cwd packages/client test",
|
|
39
|
+
"prepare": "husky",
|
|
40
|
+
"security:check": "npm run security:secrets && npm run security:audit",
|
|
41
|
+
"security:secrets": "npx secretlint \"**/*\"",
|
|
42
|
+
"security:audit": "npx audit-ci --moderate",
|
|
43
|
+
"security:snyk": "npx snyk test --all-projects",
|
|
44
|
+
"lint": "oxlint .",
|
|
45
|
+
"lint:fix": "oxlint --fix .",
|
|
46
|
+
"format": "oxfmt --write .",
|
|
47
|
+
"format:check": "oxfmt --check .",
|
|
48
|
+
"test:e2e": "bunx playwright test",
|
|
49
|
+
"test:e2e:ui": "bunx playwright test --ui",
|
|
50
|
+
"codegen": "bunx playwright codegen http://localhost:5173"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@agentclientprotocol/sdk": "^0.14.1",
|
|
54
|
+
"node-pty": "^1.1.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@playwright/test": "^1.58.2",
|
|
58
|
+
"@secretlint/secretlint-rule-preset-recommend": "^11.3.1",
|
|
59
|
+
"@tauri-apps/api": "^2.10.1",
|
|
60
|
+
"@tauri-apps/cli": "^2.10.0",
|
|
61
|
+
"@tauri-apps/plugin-shell": "^2.3.5",
|
|
62
|
+
"concurrently": "^9.2.1",
|
|
63
|
+
"husky": "^9.1.7",
|
|
64
|
+
"neverthrow": "^8.2.0",
|
|
65
|
+
"oxfmt": "^0.35.0",
|
|
66
|
+
"oxlint": "^1.50.0",
|
|
67
|
+
"secretlint": "^11.3.1"
|
|
68
|
+
},
|
|
69
|
+
"optionalDependencies": {
|
|
70
|
+
"@openai/codex-sdk": "^0.101.0",
|
|
71
|
+
"playwright": "^1.50.0"
|
|
72
|
+
},
|
|
73
|
+
"resolutions": {
|
|
74
|
+
"esbuild": ">=0.24.3"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"bun": ">=1.0.0"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e}from"./markdown-9_JKOUHQ.js";import{A as oe,t as R}from"./use-ws-BIe6kKa2.js";import{B as i,L as U}from"./button-D8qrc3hb.js";import{D as ce,a as ie,b as de,c as ue,g as me,d as ke}from"./dialog-DapeOKPE.js";import{u as te,I as H}from"./input-Dyxe5hqI.js";import{b as j,d as xe}from"./index-Z_QI94Zg.js";import{u as Z}from"./app-store-B3iAaYzj.js";import{S as he}from"./scroll-area-Bj4yTRJP.js";import{A as ye}from"./arrow-right-Bbusk4uX.js";import{C as ne}from"./chevron-right-PEOnBrxM.js";import{c as J}from"./createLucideIcon-CsWFljth.js";import{S as fe}from"./search-JGV9EPmW.js";import{F as Ce}from"./folder-d8RRIu-j.js";import{G as Y}from"./github-DiENtmNz.js";import{C as Pe}from"./check-Dj_ZR5Y7.js";import{C as Se}from"./copy-DXKK6zMx.js";import{E as Re}from"./external-link-Dg0Hq511.js";import{G as Ie}from"./globe-B1hiCqlb.js";import{F as ee}from"./folder-open-BbwqJxUi.js";import{P as De}from"./plus-ChfperZy.js";import"./terminal-CuAYwdh-.js";import"./mermaid-C0IQv4mH.js";import"./x-AprddF_b.js";import"./index-DmIp58b6.js";const Fe=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],_e=J("hard-drive",Fe);const ze=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Ee=J("house",ze);const Me=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],le=J("lock",Me);const Ae=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Oe=J("log-out",Ae);function Ge(t){if(!t)return[];const y=/^[A-Za-z]:\\/.test(t),d=y?"\\":"/",u=t.split(d).filter(Boolean),o=[];if(y){o.push({label:u[0],path:u[0]+"\\"});for(let l=1;l<u.length;l++)o.push({label:u[l],path:u.slice(0,l+1).join(d)+(l<u.length-1,"")})}else{o.push({label:"/",path:"/"});for(let l=0;l<u.length;l++)o.push({label:u[l],path:"/"+u.slice(0,l+1).join(d)})}return o}function pe({onSelect:t,onClose:y}){const{t:d}=te(),[u,o]=r.useState(""),[l,g]=r.useState(null),[v,N]=r.useState([]),[A,O]=r.useState([]),[z,E]=r.useState(""),[f,P]=r.useState(!0),[w,I]=r.useState(""),[S,a]=r.useState(""),m=r.useRef([]),h=r.useRef(-1),[M,T]=r.useState(-1),G=r.useRef(!1),q=M>0,K=M<m.current.length-1;r.useEffect(()=>{(async()=>{const n=await j.browseRoots();if(n.isErr()){I(n.error.message),P(!1);return}const c=n.value;O(c.roots||[]),E(c.home||"");const x=localStorage.getItem("funny:last-browse-path");if(x&&x!==c.home){const F=await j.browseList(x);F.isErr()||F.value.error?(localStorage.removeItem("funny:last-browse-path"),k(c.home)):(o(F.value.path),g(F.value.parent),N(F.value.dirs),L(F.value.path),P(!1))}else k(c.home)})()},[]);const W=r.useMemo(()=>{if(!S.trim())return v;const n=S.toLowerCase();return v.filter(c=>c.name.toLowerCase().includes(n))},[v,S]),L=r.useCallback(n=>{if(G.current){G.current=!1;return}const c=h.current;m.current=m.current.slice(0,c+1),m.current.push(n),h.current=m.current.length-1,T(h.current)},[]),k=async n=>{P(!0),I(""),a("");const c=await j.browseList(n);if(c.isErr()){I(c.error.message),P(!1);return}const x=c.value;if(x.path&&o(x.path),x.parent!==void 0&&g(x.parent),x.dirs&&N(x.dirs),x.error){I(x.error),P(!1);return}L(x.path),localStorage.setItem("funny:last-browse-path",x.path),P(!1)},C=r.useCallback(()=>{h.current<=0||(h.current--,T(h.current),G.current=!0,k(m.current[h.current]))},[]),Q=r.useCallback(()=>{h.current>=m.current.length-1||(h.current++,T(h.current),G.current=!0,k(m.current[h.current]))},[]),D=r.useMemo(()=>Ge(u),[u]);return e.jsx(ce,{open:!0,onOpenChange:n=>!n&&y(),children:e.jsxs(ie,{className:"flex flex-col gap-0 p-0",style:{maxWidth:"60vw",height:"70vh"},children:[e.jsx(de,{className:"p-4 pb-0",children:e.jsx(ue,{className:"text-sm",children:d("folderPicker.title")})}),e.jsxs("div",{className:"flex items-center gap-1 border-b border-border bg-muted/30 px-4 py-2",children:[e.jsx(i,{variant:"ghost",size:"icon",onClick:C,disabled:!q,className:"h-6 w-6 flex-shrink-0",title:d("folderPicker.back"),children:e.jsx(oe,{className:"h-3.5 w-3.5"})}),e.jsx(i,{variant:"ghost",size:"icon",onClick:Q,disabled:!K,className:"h-6 w-6 flex-shrink-0",title:d("folderPicker.forward"),children:e.jsx(ye,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"no-scrollbar flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto",children:[D.length===0&&e.jsx("span",{className:"text-xs text-muted-foreground",children:d("folderPicker.loading")}),D.map((n,c)=>e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-0.5",children:[c>0&&e.jsx(ne,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground/50"}),e.jsx("button",{onClick:()=>k(n.path),className:`max-w-[120px] truncate rounded px-1 py-0.5 text-xs transition-colors hover:bg-accent hover:text-foreground ${c===D.length-1?"font-medium text-foreground":"text-muted-foreground"}`,title:n.path,children:n.label})]},n.path))]})]}),e.jsxs("div",{className:"flex gap-1 border-b border-border px-4 py-1.5",children:[e.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>k(z),className:"h-6 px-2 text-xs text-muted-foreground",children:[e.jsx(Ee,{className:"mr-1 h-3 w-3"}),d("folderPicker.home")]}),A.map(n=>e.jsxs(i,{variant:"ghost",size:"sm",onClick:()=>k(n),className:"h-6 px-2 text-xs text-muted-foreground",title:n,children:[e.jsx(_e,{className:"mr-1 h-3 w-3"}),n.replace(":\\","")]},n))]}),!f&&v.length>0&&e.jsx("div",{className:"border-b border-border px-4 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(fe,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(H,{type:"text",value:S,onChange:n=>a(n.target.value),placeholder:d("folderPicker.searchPlaceholder"),className:"h-7 pl-7 pr-2 text-xs",autoFocus:!1})]})}),e.jsxs(he,{className:"flex-1 p-2",children:[w&&e.jsx("p",{className:"px-2 py-1 text-xs text-status-error",children:w}),f&&!w&&e.jsx("p",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:d("folderPicker.loading")}),!f&&v.length===0&&!w&&e.jsx("p",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:d("folderPicker.noSubdirs")}),!f&&v.length>0&&W.length===0&&e.jsx("p",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:d("folderPicker.noResults")}),W.map(n=>e.jsxs("button",{onClick:()=>k(n.path),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 flex-shrink-0 text-status-info"}),e.jsx("span",{className:"truncate",children:n.name}),e.jsx(ne,{className:"ml-auto h-3 w-3 flex-shrink-0 opacity-40"})]},n.path))]}),e.jsxs(me,{className:"border-t border-border p-4",children:[e.jsx(i,{variant:"outline",size:"sm",onClick:y,children:d("folderPicker.cancel")}),e.jsx(i,{size:"sm",onClick:()=>t(u),disabled:!u,children:d("folderPicker.selectFolder")})]})]})})}function Le(){const{t}=te(),y=xe(),d=Z(s=>s.loadProjects),u=Z(s=>s.setAddProjectOpen),[o,l]=r.useState("checking"),[g,v]=r.useState(null),[N,A]=r.useState(""),[O,z]=r.useState(""),[E,f]=r.useState(""),[P,w]=r.useState(5),[I,S]=r.useState(!1),a=r.useRef(null),[m,h]=r.useState([]),[M,T]=r.useState(""),[G,q]=r.useState(1),[K,W]=r.useState(!1),[L,k]=r.useState(!1),[C,Q]=r.useState(null),[D,n]=r.useState(""),[c,x]=r.useState(""),[F,X]=r.useState(!1),[He,se]=r.useState(!1),V=r.useRef(null);r.useEffect(()=>{(async()=>{const s=await j.githubStatus();s.isOk()&&s.value.connected?(await re(),l("repos")):l("connect")})()},[]);const re=async()=>{const s=await j.githubUser();s.isOk()&&v(s.value)},$=r.useCallback(async(s,b,_=!1)=>{k(!0);const p=await j.githubRepos({page:b,per_page:30,search:s||void 0,sort:"updated"});p.isOk()&&(h(B=>_?[...B,...p.value.repos]:p.value.repos),W(p.value.hasMore)),k(!1)},[]);r.useEffect(()=>{o==="repos"&&$("",1)},[o,$]),r.useEffect(()=>{if(o==="repos")return V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{q(1),$(M,1)},300),()=>{V.current&&clearTimeout(V.current)}},[M,o,$]),r.useEffect(()=>()=>{a.current&&clearInterval(a.current)},[]);const ge=async()=>{const s=await j.githubStartDevice();if(s.isErr()){R.error(s.error.message);return}const b=s.value;A(b.device_code),z(b.user_code),f(b.verification_uri),w(b.interval),l("device-flow"),ae(b.device_code,b.interval)},ae=(s,b)=>{a.current&&clearInterval(a.current),a.current=setInterval(async()=>{const _=await j.githubPoll(s);if(_.isErr())return;const p=_.value;p.status==="success"?(a.current&&clearInterval(a.current),await re(),l("repos"),R.success(t("github.connected",{login:""}))):p.status==="expired"||p.status==="denied"?(a.current&&clearInterval(a.current),R.error(p.status==="expired"?t("github.deviceFlow.expired"):t("github.deviceFlow.denied")),l("connect")):p.interval&&(a.current&&clearInterval(a.current),ae(s,p.interval))},(b+1)*1e3)},je=()=>{navigator.clipboard.writeText(O),S(!0),setTimeout(()=>S(!1),2e3)},ve=s=>{Q(s),x(s.name),l("clone-config")},be=async()=>{if(!C||!D||!c)return;se(!0),l("cloning");const s=await j.cloneRepo(C.clone_url,D,c);if(s.isErr()){R.error(s.error.message),se(!1),l("clone-config");return}R.success(t("github.clone.success")),await d(),u(!1),y(`/projects/${s.value.id}`)},Ne=async()=>{await j.githubDisconnect(),v(null),h([]),l("connect"),R.success(t("github.disconnected"))},we=s=>{const b=Date.now()-new Date(s).getTime(),_=Math.floor(b/6e4);if(_<60)return t("time.minutes",{count:_});const p=Math.floor(_/60);if(p<24)return t("time.hours",{count:p});const B=Math.floor(p/24);return B<30?t("time.days",{count:B}):t("time.months",{count:Math.floor(B/30)})};return o==="checking"?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(U,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o==="connect"?e.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(Y,{className:"h-6 w-6"})}),e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("h3",{className:"font-medium",children:t("github.connectGithub")}),e.jsx("p",{className:"max-w-xs text-sm text-muted-foreground",children:t("github.connectDesc")})]}),e.jsxs(i,{onClick:ge,children:[e.jsx(Y,{className:"mr-2 h-4 w-4"}),t("github.connectGithub")]})]}):o==="device-flow"?e.jsxs("div",{className:"flex flex-col items-center gap-5 py-8",children:[e.jsxs("div",{className:"space-y-1 text-center",children:[e.jsx("h3",{className:"font-medium",children:t("github.deviceFlow.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("github.deviceFlow.desc")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-4 py-2 font-mono text-2xl font-bold tracking-widest",children:O}),e.jsx(i,{variant:"outline",size:"sm",onClick:je,children:I?e.jsx(Pe,{className:"h-4 w-4"}):e.jsx(Se,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex gap-2",children:e.jsxs(i,{variant:"outline",onClick:()=>window.open(E,"_blank"),children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),t("github.deviceFlow.openGithub")]})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(U,{className:"h-4 w-4 animate-spin"}),t("github.deviceFlow.waitingAuth")]}),e.jsx(i,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>{a.current&&clearInterval(a.current),l("connect")},children:t("common.cancel")})]}):o==="repos"?e.jsxs("div",{className:"flex h-full flex-col",children:[g&&e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("img",{src:g.avatar_url,alt:g.login,className:"h-6 w-6 rounded-full"}),e.jsx("span",{className:"text-sm font-medium",children:g.login}),e.jsxs(i,{variant:"ghost",size:"sm",className:"ml-auto h-7 text-xs text-muted-foreground",onClick:Ne,children:[e.jsx(Oe,{className:"mr-1 h-3 w-3"}),t("github.disconnect")]})]}),e.jsxs("div",{className:"relative mb-3",children:[e.jsx(fe,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(H,{className:"h-auto w-full py-1.5 pl-8 pr-3",placeholder:t("github.repos.searchPlaceholder"),value:M,onChange:s=>T(s.target.value)})]}),e.jsxs(he,{className:"-mx-1 flex-1",children:[m.map(s=>e.jsxs("button",{onClick:()=>ve(s),className:"flex w-full flex-col gap-0.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-accent",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:s.full_name}),s.private?e.jsx(le,{className:"h-3 w-3 flex-shrink-0 text-status-pending"}):e.jsx(Ie,{className:"h-3 w-3 flex-shrink-0 text-muted-foreground"})]}),s.description&&e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s.description}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[s.language&&e.jsx("span",{children:s.language}),e.jsx("span",{children:we(s.updated_at)})]})]},s.id)),L&&e.jsx("div",{className:"flex justify-center py-4",children:e.jsx(U,{className:"h-4 w-4 animate-spin text-muted-foreground"})}),!L&&m.length===0&&e.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:t("github.repos.noRepos")}),K&&!L&&e.jsx("div",{className:"flex justify-center py-2",children:e.jsx(i,{variant:"ghost",size:"sm",onClick:()=>{const s=G+1;q(s),$(M,s,!0)},children:t("github.repos.loadMore")})})]})]}):o==="clone-config"&&C?e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{variant:"ghost",size:"sm",className:"-ml-2 text-muted-foreground",onClick:()=>l("repos"),children:[e.jsx(oe,{className:"mr-1 h-3.5 w-3.5"}),t("github.repos.title")]}),e.jsxs("div",{className:"space-y-1 rounded-md border border-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:C.full_name}),C.private&&e.jsx(le,{className:"h-3 w-3 text-status-pending"})]}),C.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:C.description})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("github.clone.destination")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(H,{className:"flex-1",placeholder:t("github.clone.destinationDesc"),value:D,onChange:s=>n(s.target.value)}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>X(!0),children:e.jsx(ee,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("github.clone.projectName")}),e.jsx(H,{value:c,onChange:s=>x(s.target.value)})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(i,{variant:"outline",className:"flex-1",onClick:()=>l("repos"),children:t("common.cancel")}),e.jsx(i,{className:"flex-1",onClick:be,disabled:!D||!c,children:t("github.clone.cloneAndCreate")})]}),F&&e.jsx(pe,{onSelect:s=>{n(s),X(!1)},onClose:()=>X(!1)})]}):o==="cloning"?e.jsxs("div",{className:"flex flex-col items-center gap-4 py-12",children:[e.jsx(U,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("github.clone.cloning",{repo:C?.full_name})})]}):null}function ut(){const{t}=te(),y=xe(),d=Z(a=>a.loadProjects),u=Z(a=>a.setAddProjectOpen),[o,l]=r.useState("local"),[g,v]=r.useState(""),[N,A]=r.useState(""),[O,z]=r.useState(!1),[E,f]=r.useState(!1),[P,w]=r.useState(!1),I=async()=>{w(!1),f(!0);const a=await j.gitInit(N);if(a.isErr()){R.error(a.error.message),f(!1);return}const m=await j.createProject(g,N);if(m.isErr()){R.error(m.error.message),f(!1);return}await d(),u(!1),y(`/projects/${m.value.id}`),f(!1)},S=async()=>{if(!g||!N||E)return;f(!0);const a=await j.createProject(g,N);if(a.isErr()){if(a.error.message?.includes("Not a git repository")){f(!1),w(!0);return}R.error(a.error.message),f(!1);return}await d(),u(!1),y(`/projects/${a.value.id}`),f(!1)};return e.jsxs("div",{className:"flex flex-1 items-center justify-center",children:[e.jsxs("div",{className:"w-full max-w-md space-y-6 px-4",children:[e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:e.jsx(De,{className:"h-6 w-6 text-primary"})}),e.jsx("h2",{className:"text-xl font-semibold",children:t("sidebar.addProject")})]}),e.jsxs("div",{className:"flex gap-1 rounded-lg bg-muted p-1",children:[e.jsxs("button",{className:`flex flex-1 items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${o==="local"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>l("local"),children:[e.jsx(ee,{className:"h-3.5 w-3.5"}),t("github.localFolder")]}),e.jsxs("button",{className:`flex flex-1 items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${o==="github"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>l("github"),children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),t("github.cloneFromGithub")]})]}),o==="local"?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:t("sidebar.addProjectDescription",{defaultValue:"Enter the project name and select the folder path."})}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("sidebar.projectName")}),e.jsx(H,{placeholder:t("sidebar.projectName"),value:g,onChange:a=>v(a.target.value),autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-sm font-medium",children:t("sidebar.absolutePath")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(H,{className:"flex-1",placeholder:t("sidebar.absolutePath"),value:N,onChange:a=>A(a.target.value)}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>z(!0),title:t("sidebar.browseFolder"),children:e.jsx(ee,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsx(i,{variant:"outline",className:"flex-1",onClick:()=>u(!1),children:t("common.cancel",{defaultValue:"Cancel"})}),e.jsx(i,{className:"flex-1",onClick:S,disabled:E||!g||!N,children:E?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"mr-2 h-4 w-4 animate-spin"}),t("common.loading")]}):t("sidebar.add")})]})]}):e.jsx(Le,{})]}),O&&e.jsx(pe,{onSelect:async a=>{if(A(a),z(!1),!g){const m=await j.repoName(a);if(m.isOk()&&m.value.name)v(m.value.name);else{const h=a.split(/[\\/]/).filter(Boolean).pop()||"";v(h)}}},onClose:()=>z(!1)}),e.jsx(ce,{open:P,onOpenChange:w,children:e.jsxs(ie,{children:[e.jsxs(de,{children:[e.jsx(ue,{children:t("confirm.gitInitTitle",{defaultValue:"Initialize Git Repository"})}),e.jsx(ke,{children:t("confirm.notGitRepo",{path:N})})]}),e.jsxs(me,{children:[e.jsx(i,{variant:"outline",onClick:()=>w(!1),children:t("common.cancel",{defaultValue:"Cancel"})}),e.jsx(i,{onClick:I,children:t("confirm.gitInitAction",{defaultValue:"Initialize"})})]})]})})]})}export{ut as AddProjectView};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as u,j as r}from"./markdown-9_JKOUHQ.js";import{g as yt,_ as ae,o as Ee,c as St,m as at,a as wt,d as Nt,P as st,B as Ct}from"./project-chip-CkL3EaeE.js";import{b as Y,c as ot,t as X,a as it,u as Tt,m as Fe}from"./use-ws-BIe6kKa2.js";import{S as kt}from"./SlideUpPrompt-_ulHi9sN.js";import{B as Q}from"./button-D8qrc3hb.js";import{D as Oe,a as Ie,b as Me,c as Le,d as Re,g as ze}from"./dialog-DapeOKPE.js";import{H as $e,n as J,T as Pt}from"./ThreadListView-DthHUodE.js";import{u as de,I as ct}from"./input-Dyxe5hqI.js";import{P as be,a as ve,b as je}from"./popover-CRZjc4jI.js";import{d as Pe,a as At,b as Ne,s as Dt,c as E,k as Be,l as Ue,m as He,L as Et,U as Ft}from"./index-Z_QI94Zg.js";import{c as Z,s as Ke,a as lt,G as Ot,t as It,g as Mt}from"./use-minute-tick-BoS3Ec2H.js";import{u as We}from"./app-store-B3iAaYzj.js";import{P as qe}from"./plus-ChfperZy.js";import{S as Ce}from"./search-JGV9EPmW.js";import{P as Ge}from"./pin-uzq68OVB.js";import{T as Lt}from"./trash-2-QvY6JeI_.js";import{c as dt}from"./createLucideIcon-CsWFljth.js";import{T as Rt}from"./terminal-CuAYwdh-.js";import{C as zt}from"./chevron-left-BVsM9RGq.js";import{L as $t}from"./select-CkTnmILP.js";import{C as Bt}from"./columns-3-DhvlrNjA.js";import{X as Ut}from"./x-AprddF_b.js";import{C as ut}from"./chevron-down-BJhJsMnL.js";import{C as ce}from"./check-Dj_ZR5Y7.js";import{A as Ve}from"./arrow-down-DQYiOM3D.js";import{A as Xe}from"./PromptInput-Cq_fXmwj.js";import"./mermaid-C0IQv4mH.js";import"./chevron-right-PEOnBrxM.js";import"./git-merge-CB0ebeXg.js";import"./circle-x-BNvrcCvx.js";import"./eye-BAXsQYWt.js";import"./index-DmIp58b6.js";import"./index-BplxL2Qj.js";import"./providers-Bv7fzJNY.js";import"./draft-store-DnVbStYY.js";import"./square-BqmNpRIH.js";import"./github-DiENtmNz.js";import"./globe-B1hiCqlb.js";import"./inbox-4g-W9WtW.js";import"./folder-open-BbwqJxUi.js";import"./copy-DXKK6zMx.js";const Ht=[["path",{d:"M10.88 21.94 15.46 14",key:"xkve6t"}],["path",{d:"M21.17 8H12",key:"19dcdn"}],["path",{d:"M3.95 6.06 8.54 14",key:"g8jz9m"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],Kt=dt("chromium",Ht);const Wt=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],qt=dt("webhook",Wt);var le=new Map,xe=new Set;function mt(e){Gt(e);var t=le.get(e);if(t)return t;var n={timeOfEngagementStart:Date.now()};return le.set(e,n),n}function Gt(e){xe.add(e)}function Vt(e){xe.clear(),e(),le.forEach(function(t,n){xe.has(n)||le.delete(n)}),xe.clear()}function Xt(){le.clear()}var Ye=new Map;function Yt(e){var t=Ye.get(e);if(t)return t;var n=Jt(e);return Ye.set(e,n),n}function Jt(e){var t={type:"idle"},n=[];function o(d){if(t.type==="running"){var l=d-t.timeLastFrameFinished,s=t,h=s.latestArgs,y=yt({x:h.location.current.input.clientX,y:h.location.current.input.clientY});Vt(function(){n.forEach(function(S){return S({underUsersPointer:y,latestArgs:h,timeSinceLastFrame:l})})}),t.timeLastFrameFinished=d,t.frameId=requestAnimationFrame(o)}}function m(){t.type!=="idle"&&(cancelAnimationFrame(t.frameId),Xt(),t={type:"idle"})}function i(d){t.type==="idle"&&(t={type:"initializing",latestArgs:d,frameId:requestAnimationFrame(function(l){t.type==="initializing"&&(t={type:"running",timeLastFrameFinished:l,latestArgs:t.latestArgs,frameId:requestAnimationFrame(o)})})})}function p(d){if(t.type==="idle"){i(d);return}t.latestArgs=d}e({onDragStart:i,onDropTargetChange:p,onDrag:p,onDrop:m});var g={onFrame:function(l){n.push(l)}};return g}var Te="data-auto-scrollable",Qt="[".concat(Te,'="true"]');function Zt(e){return e.setAttribute(Te,"true"),function(){return e.removeAttribute(Te)}}function Je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),n.push.apply(n,o)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Je(Object(n),!0).forEach(function(o){ae(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}var _t={startHitboxAtPercentageRemainingOfElement:{top:.25,right:.25,bottom:.25,left:.25},maxScrollAtPercentageRemainingOfHitbox:{top:.5,right:.5,bottom:.5,left:.5},timeDampeningDurationMs:400,maxMainAxisHitboxSize:180},er={standard:900,fast:1500};function gt(e){var t;return Qe(Qe({},_t),{},{maxPixelScrollPerSecond:er[(t=e?.maxScrollSpeed)!==null&&t!==void 0?t:"standard"]})}var tr={top:function(t){return t.scrollTop>0},right:function(t){return Math.ceil(t.scrollLeft)+t.clientWidth<t.scrollWidth},bottom:function(t){return Math.ceil(t.scrollTop)+t.clientHeight<t.scrollHeight},left:function(t){return t.scrollLeft>0}},rr=["top","right","bottom","left"],nr={top:"vertical",right:"horizontal",bottom:"vertical",left:"horizontal"},Ze={start:"top",end:"bottom",point:"y",size:"height"},_e={start:"left",end:"right",point:"x",size:"width"},ft={vertical:{mainAxis:Ze,crossAxis:_e},horizontal:{mainAxis:_e,crossAxis:Ze}},Ae={top:"start",right:"end",bottom:"end",left:"start"};function fe(e){var t=e.edge,n=e.axis;return function(m){var i=m.clientRect,p=m.config,g=ft[n],d=g.mainAxis,l=g.crossAxis,s=Ae[t],h=Math.min(p.startHitboxAtPercentageRemainingOfElement[t]*i[d.size],p.maxMainAxisHitboxSize);return DOMRect.fromRect(ae(ae(ae(ae({},d.point,s==="start"?i[d.point]:i[d.point]+i[d.size]-h),l.point,i[l.point]),d.size,h),l.size,i[l.size]))}}var ar={top:fe({axis:"vertical",edge:"top"}),right:fe({axis:"horizontal",edge:"right"}),bottom:fe({axis:"vertical",edge:"bottom"}),left:fe({axis:"horizontal",edge:"left"})};function ke(e){var t=e.startOfRange,n=e.endOfRange,o=e.value,m=t<n;if(!m||o<t)return 0;if(o>n)return 1;var i=n-t;return(o-t)/i}function sr(e){var t=e.timeSinceLastFrame,n=e.config,o=n.maxPixelScrollPerSecond/1e3,m=Math.ceil(o*t),i=n.maxPixelScrollPerSecond/60;return Math.min(m,i)}function or(e){var t=e.client,n=e.axis,o=e.edge,m=e.hitbox,i=e.config,p=ft[n].mainAxis,g=Ae[o],d=m[p.size]*i.maxScrollAtPercentageRemainingOfHitbox[o];if(g==="end")return ke({startOfRange:m[p.start],endOfRange:m[p.end]-d,value:t[p.point]});var l=ke({startOfRange:m[p.start]+d,endOfRange:m[p.end],value:t[p.point]});return 1-l}function pe(e){var t=e.client,n=e.timeSinceLastFrame,o=e.engagement,m=e.axis,i=e.hitbox,p=e.edge,g=e.isDistanceDampeningEnabled,d=e.config,l=sr({timeSinceLastFrame:n,config:d}),s=g?or({client:t,edge:p,hitbox:i,axis:m,config:d}):1,h=ke({startOfRange:o.timeOfEngagementStart,endOfRange:o.timeOfEngagementStart+d.timeDampeningDurationMs,value:Date.now()}),y=s*h,S=Math.max(l*y,1),w=Ae[p];return w==="end"?S:-1*S}function ir(e,t){return t==="all"||e===t}function cr(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function lr(e){return e.getBoundingClientRect()}function pt(e){var t=e.element,n=e.input,o=e.timeSinceLastFrame,m=e.engagement,i=e.config,p=e.allowedAxis,g=e.getRect,d=g===void 0?lr:g,l={x:n.clientX,y:n.clientY},s=d(t),h=rr.reduce(function(w,j){var v=ar[j]({clientRect:s,config:i}),P=nr[j];return!ir(P,p)||!cr({client:l,clientRect:v})||!tr[j](t)||w.set(j,{edge:j,hitbox:v}),w},new Map),y=(function(){var w="horizontal",j=h.get("left");if(j)return pe({client:l,edge:j.edge,hitbox:j.hitbox,axis:w,timeSinceLastFrame:o,engagement:m,isDistanceDampeningEnabled:!0,config:i});var v=h.get("right");return v?pe({client:l,edge:v.edge,hitbox:v.hitbox,axis:w,timeSinceLastFrame:o,engagement:m,isDistanceDampeningEnabled:!0,config:i}):0})(),S=(function(){var w="vertical",j=h.get("bottom");if(j)return pe({client:l,edge:j.edge,hitbox:j.hitbox,axis:w,timeSinceLastFrame:o,engagement:m,isDistanceDampeningEnabled:!0,config:i});var v=h.get("top");return v?pe({client:l,edge:v.edge,hitbox:v.hitbox,axis:w,timeSinceLastFrame:o,engagement:m,isDistanceDampeningEnabled:!0,config:i}):0})();return{left:y,top:S}}function dr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ur(e))||t){n&&(e=n);var o=0,m=function(){};return{s:m,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(l){throw l},f:m}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,p=!0,g=!1;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return p=l.done,l},e:function(l){g=!0,i=l},f:function(){try{p||n.return==null||n.return()}finally{if(g)throw i}}}}function ur(e,t){if(e){if(typeof e=="string")return et(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?et(e,t):void 0}}function et(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function ht(e){return!!(e.top||e.left)}function xt(e){var t,n,o,m=e.target,i=e.input,p=e.source,g=e.findEntry,d=e.timeSinceLastFrame,l=e.available,s=l===void 0?{top:!0,left:!0}:l;if(!ht(s)||!m)return s;var h=m.closest(Qt);if(!h)return s;var y=g(h);if(!y)return s;function S(){var T;return xt({target:(T=h?.parentElement)!==null&&T!==void 0?T:null,findEntry:g,source:p,timeSinceLastFrame:d,input:i,available:s})}var w={input:i,source:p,element:h};if(y.canScroll&&!y.canScroll(w))return S();var j=mt(h),v=gt((t=y.getConfiguration)===null||t===void 0?void 0:t.call(y,w)),P=(n=(o=y.getAllowedAxis)===null||o===void 0?void 0:o.call(y,w))!==null&&n!==void 0?n:"all",A=pt({element:h,engagement:j,input:i,timeSinceLastFrame:d,allowedAxis:P,config:v}),N={top:0,left:0};return s.top&&A.top!==0&&(N.top=A.top,s.top=!1),s.left&&A.left!==0&&(N.left=A.left,s.left=!1),(N.top!==0||N.left!==0)&&h.scrollBy(N),S()}function mr(e){var t=e.input,n=e.timeSinceLastFrame,o=e.available,m=e.source,i=e.entries,p=document.documentElement,g={input:t,source:m,element:p},d=dr(i),l;try{for(d.s();!(l=d.n()).done;){var s,h,y,S=l.value;if(!(S.canScroll&&!S.canScroll(g))){var w=mt(p),j=gt((s=S.getConfiguration)===null||s===void 0?void 0:s.call(S,g)),v=(h=(y=S.getAllowedAxis)===null||y===void 0?void 0:y.call(S,g))!==null&&h!==void 0?h:"all",P=pt({element:p,engagement:w,input:t,config:j,allowedAxis:v,getRect:function(T){return DOMRect.fromRect({y:0,x:0,width:T.clientWidth,height:T.clientHeight})},timeSinceLastFrame:n}),A={top:o.top?P.top:0,left:o.left?P.left:0};(A.top!==0||A.left!==0)&&p.scrollBy(A);break}}}catch(N){d.e(N)}finally{d.f()}}function gr(e){var t=e.input,n=e.findEntry,o=e.timeSinceLastFrame,m=e.source,i=e.getWindowScrollEntries,p=e.underUsersPointer,g=xt({target:p,timeSinceLastFrame:o,input:t,source:m,findEntry:n});ht(g)&&mr({input:t,source:m,entries:i(),timeSinceLastFrame:o,available:g})}function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(m){return Object.getOwnPropertyDescriptor(e,m).enumerable})),n.push.apply(n,o)}return n}function fr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?tt(Object(n),!0).forEach(function(o){ae(e,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function pr(e){var t=e.monitor,n=new Map,o=new Set;function m(l){n.set(l.element,l);var s=St(Zt(l.element),function(){return n.delete(l.element)});return Ee(s)}function i(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=fr({},l);o.add(s);function h(){o.delete(s)}return Ee(h)}function p(l){var s;return(s=n.get(l))!==null&&s!==void 0?s:null}function g(){return Array.from(o)}function d(l){var s=l.latestArgs,h=l.underUsersPointer,y=l.timeSinceLastFrame;gr({input:s.location.current.input,source:s.source,findEntry:p,underUsersPointer:h,timeSinceLastFrame:y,getWindowScrollEntries:g})}return Yt(t).onFrame(d),{autoScroll:m,autoScrollWindow:i}}var hr=pr({monitor:at}),bt=hr.autoScroll;const rt=["backlog","planning","in_progress","review","done","archived"],nt={chrome_extension:Kt,api:Rt,automation:Ct,ingest:qt},xr=u.memo(function({thread:t,projectInfo:n,onDelete:o,search:m,ghost:i,contentSnippet:p,projectId:g,highlighted:d,stage:l,gitStatus:s}){const{t:h}=de(),y=Pe(),S=it(b=>b.setKanbanContext),w=Y(b=>b.pinThread),j=u.useRef(null),[v,P]=u.useState(!1);u.useEffect(()=>{d&&j.current&&j.current.scrollIntoView({block:"center",behavior:"instant"})},[d]),u.useEffect(()=>{const b=j.current;if(b)return Nt({element:b,getInitialData:()=>({type:"kanban-card",threadId:t.id,sourceStage:t.archived?"archived":t.stage||"backlog",projectId:t.projectId}),onDragStart:()=>P(!0),onDrop:()=>P(!1)})},[t.id,t.stage,t.archived,t.projectId]);const A=Ke[t.status].icon,N=Ke[t.status].className,T=s?lt[s.state]:null,R=T?.icon,z=t.branch||t.baseBranch;return r.jsxs("div",{ref:j,className:E("group/card relative rounded-md border bg-card p-2.5 cursor-pointer transition-[opacity,box-shadow] duration-300",v&&"opacity-40",i&&!v&&"opacity-50 hover:opacity-80",d&&"ring-2 ring-ring shadow-md"),onClick:()=>{v||u.startTransition(()=>{S({projectId:g,search:m,threadId:t.id}),y(`/projects/${t.projectId}/threads/${t.id}`)})},children:[r.jsxs("div",{className:"absolute right-1.5 top-1.5 flex items-center gap-0.5",children:[t.pinned?r.jsx("button",{className:"rounded p-1 text-primary transition-opacity hover:bg-primary/10",onClick:async b=>{b.stopPropagation(),await w(t.id,t.projectId,!1)},"aria-label":"Unpin thread",children:r.jsx(Ge,{className:"h-3 w-3 rotate-45"})}):r.jsx("button",{className:"rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-primary/10 hover:text-primary group-hover/card:opacity-100",onClick:async b=>{b.stopPropagation(),await w(t.id,t.projectId,!0)},"aria-label":"Pin thread",children:r.jsx(Ge,{className:"h-3 w-3"})}),r.jsx("button",{className:"rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-destructive/10 hover:text-destructive group-hover/card:opacity-100",onClick:b=>{b.stopPropagation(),o(t)},"aria-label":"Delete thread",children:r.jsx(Lt,{className:"h-3.5 w-3.5"})})]}),n&&r.jsx(st,{name:n.name,color:n.color,className:"mb-1"}),z&&r.jsxs("div",{className:"mb-1.5 flex min-w-0 items-center gap-1","aria-label":"Branch information",children:[T&&R?r.jsxs(Be,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(R,{className:E("h-3 w-3 shrink-0",T.className)})}),r.jsx(He,{side:"top",className:"text-xs",children:h(T.labelKey)})]}):r.jsx(Ot,{className:"h-3 w-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",title:z,children:z})]}),r.jsx($e,{text:t.title,query:m||"",className:"mb-1 line-clamp-3 pr-5 text-xs font-medium"}),p&&m&&!J(t.title).includes(J(m))&&r.jsx($e,{text:p,query:m,className:"mb-1.5 line-clamp-2 block text-[11px] italic text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[r.jsx(A,{className:E("h-3 w-3 shrink-0",N)}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:h(`thread.status.${t.status}`)}),t.source&&t.source!=="web"&&nt[t.source]&&(()=>{const b=nt[t.source];return r.jsxs(Be,{children:[r.jsx(Ue,{asChild:!0,children:r.jsx(b,{className:"h-3 w-3 shrink-0 text-muted-foreground"})}),r.jsx(He,{side:"top",className:"text-xs",children:h(`thread.source.${t.source}`)})]})})()]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:It(t.completedAt||t.createdAt,h)}),t.cost>0&&r.jsxs("span",{children:["$",t.cost.toFixed(3)]})]})]})]})});function br({projectId:e,projects:t,onSelect:n}){const{t:o}=de(),[m,i]=u.useState(!1),[p,g]=u.useState(""),d=u.useRef(null);if(e)return r.jsx("button",{className:"ml-auto rounded p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",onClick:()=>n(e),title:o("kanban.addThread"),children:r.jsx(qe,{className:"h-4 w-4"})});const l=p?t.filter(s=>s.name.toLowerCase().includes(p.toLowerCase())):t;return r.jsxs(be,{open:m,onOpenChange:s=>{i(s),s||g("")},children:[r.jsx(ve,{asChild:!0,children:r.jsx("button",{className:"ml-auto rounded p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:o("kanban.addThread"),children:r.jsx(qe,{className:"h-4 w-4"})})}),r.jsxs(je,{align:"start",className:"w-56 p-0",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-2.5 py-2",children:[r.jsx(Ce,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(ct,{ref:d,value:p,onChange:s=>g(s.target.value),placeholder:o("kanban.searchProject"),className:"h-auto flex-1 border-0 bg-transparent px-0 py-0 text-xs shadow-none placeholder:text-muted-foreground focus-visible:ring-0",autoFocus:!0})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:l.length===0?r.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:o("commandPalette.noResults")}):l.map(s=>r.jsxs("button",{className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs transition-colors hover:bg-accent",onClick:()=>{i(!1),g(""),n(s.id)},children:[r.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:s.color||"#3b82f6"}}),r.jsx("span",{className:"truncate",children:s.name})]},s.id))})]})]})}const vr=u.memo(function({stage:t,threads:n,projectInfoById:o,onDelete:m,projectId:i,projects:p,onAddThread:g,search:d,contentSnippets:l,highlightThreadId:s,statusByThread:h}){const{t:y}=de(),S=u.useRef(null),w=u.useRef(null),[j,v]=u.useState(!1),[P,A]=u.useState(20);u.useEffect(()=>{const b=S.current;if(b)return wt({element:b,getData:()=>({type:"kanban-column",stage:t}),canDrop:({source:I})=>I.data.type==="kanban-card",onDragEnter:()=>v(!0),onDragLeave:()=>v(!1),onDrop:()=>v(!1)})},[t]),u.useEffect(()=>{const b=w.current;if(b)return bt({element:b})},[]),u.useEffect(()=>{A(20)},[d,i]),u.useEffect(()=>{if(!s)return;const b=n.findIndex(I=>I.id===s);b>=P&&A(b+1)},[s,n,P]);const N=Z[t].icon,T=Z[t].className,R=n.slice(0,P),z=n.length>P;return r.jsxs("div",{ref:S,className:E("flex flex-col w-80 min-w-[20rem] flex-shrink-0 rounded-lg bg-secondary/30 transition-colors",j&&"ring-2 ring-ring bg-secondary/50"),children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-3 py-2.5",children:[r.jsx(N,{className:E("h-4 w-4",T)}),r.jsx("span",{className:"text-sm font-medium",children:y(Z[t].labelKey)}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",n.length,")"]}),p.length>0&&t!=="review"&&t!=="done"&&t!=="archived"&&r.jsx(br,{projectId:i,projects:p,onSelect:b=>g(b,t)})]}),r.jsx("div",{ref:w,className:"min-h-[200px] flex-1 space-y-2 overflow-y-auto p-2",children:n.length===0?r.jsx("div",{className:"py-8 text-center text-xs text-muted-foreground",children:y("kanban.emptyColumn")}):r.jsxs(r.Fragment,{children:[R.map(b=>r.jsx(xr,{thread:b,projectInfo:o?.[b.projectId],onDelete:m,search:d,ghost:t==="archived",contentSnippet:l?.get(b.id),projectId:i,highlighted:b.id===s,stage:t,gitStatus:h[b.id]},b.id)),z&&r.jsx("button",{onClick:()=>A(b=>b+20),className:"w-full rounded-md py-2 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:y("kanban.loadMore",{count:Math.min(20,n.length-P)})})]})})]})});function jr({threads:e,projectId:t,search:n,contentSnippets:o,highlightThreadId:m}){const{t:i}=de(),p=Pe(),g=Y(c=>c.updateThreadStage),d=Y(c=>c.archiveThread),l=Y(c=>c.unarchiveThread),s=Y(c=>c.deleteThread),h=Y(c=>c.selectedThreadId),y=We(c=>c.projects),S=We(c=>c.loadThreadsForProject),w=At(c=>c.toolPermissions),[j,v]=u.useState(null),[P,A]=u.useState(!1),[N,T]=u.useState(void 0),[R,z]=u.useState("backlog"),[b,I]=u.useState(!1),[ue,W]=u.useState(!1),[M,$]=u.useState(null),_=ot(c=>c.statusByThread),[q,ye]=u.useState(m);u.useEffect(()=>{if(!q)return;const c=setTimeout(()=>ye(void 0),3e3);return()=>clearTimeout(c)},[q]);const ee=u.useCallback((c,C)=>{T(c),z(C),A(!0)},[]),se=u.useCallback(c=>{v({threadId:c.id,projectId:c.projectId,title:c.title,isWorktree:c.mode==="worktree"&&!!c.branch})},[]),G=u.useCallback(async()=>{if(!j)return;W(!0);const{threadId:c,projectId:C,title:D}=j,k=h===c;await s(c,C),W(!1),v(null),X.success(i("toast.threadDeleted",{title:D})),k&&p(`/projects/${C}`)},[j,h,s,p,i]),V=u.useCallback(()=>{if(!M)return;const{threadId:c,title:C,sourceStage:D,newStage:k}=M,O=t||e.find(B=>B.id===c)?.projectId;if(O){g(c,O,k);const B=i(Z[D].labelKey),L=i(Z[k].labelKey);X.success(i("toast.threadMoved",{title:C,from:B,to:L}))}$(null)},[M,t,e,g,i]),oe=u.useCallback(async(c,C,D)=>{if(!N||b)return!1;I(!0);const k=y.find(L=>L.id===N),O=C.threadMode||k?.defaultMode||"worktree";if(C.sendToBacklog||R==="backlog"||R==="planning"){const L=await Ne.createIdleThread({projectId:N,title:c.slice(0,200),mode:O,baseBranch:C.baseBranch,prompt:c,stage:R==="planning"?"planning":void 0,images:D});return L.isErr()?(X.error(L.error.message),I(!1),!1):(await S(N),I(!1),X.success(i("toast.threadCreated",{title:c.slice(0,200)})),!0)}else{const{allowedTools:L,disallowedTools:U}=Dt(w),K=await Ne.createThread({projectId:N,title:c.slice(0,200),mode:O,model:C.model,permissionMode:C.mode,baseBranch:C.baseBranch,prompt:c,images:D,allowedTools:L,disallowedTools:U});return K.isErr()?(X.error(K.error.message),I(!1),!1):(await S(N),I(!1),X.success(i("toast.threadCreated",{title:c.slice(0,200)})),!0)}},[N,R,b,y,w,S,i]),ie=u.useMemo(()=>{if(t)return;const c={};for(const C of y)c[C.id]={name:C.name,color:C.color};return c},[t,y]),te=u.useMemo(()=>{const c={backlog:[],planning:[],in_progress:[],review:[],done:[],archived:[]};for(const C of e){const D=C.archived?"archived":C.stage||"backlog";c[D]&&c[D].push(C)}for(const C of rt)c[C].sort((D,k)=>{if(D.pinned!==k.pinned)return D.pinned?-1:1;const O=D.completedAt||D.createdAt,B=k.completedAt||k.createdAt;return new Date(B).getTime()-new Date(O).getTime()});return c},[e]),H=u.useCallback(({source:c,location:C})=>{const D=C.current.dropTargets;if(!D.length||c.data.type!=="kanban-card")return;const k=c.data.threadId,O=c.data.sourceStage,B=c.data.projectId,L=D.find(x=>x.data.type==="kanban-column");if(!L)return;const U=L.data.stage;if(U===O)return;const K=t||B;if(U==="done"){const x=_[k],F=e.find(re=>re.id===k);if(F?.branch&&x&&x.state==="dirty"){$({threadId:k,title:F.title,sourceStage:O,newStage:U,gitState:x.state});return}}U==="archived"?d(k,K):O==="archived"?l(k,K,U):g(k,K,U);const Se=e.find(x=>x.id===k)?.title||k,a=i(Z[O].labelKey),f=i(Z[U].labelKey);X.success(i("toast.threadMoved",{title:Se,from:a,to:f}))},[t,g,d,l,_,e,i]);u.useEffect(()=>at({onDrop:H}),[H]);const me=u.useRef(null);return u.useEffect(()=>{const c=me.current;if(c)return bt({element:c})},[]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:me,className:"flex h-full gap-3 overflow-x-auto p-4",children:rt.map(c=>r.jsx(vr,{stage:c,threads:te[c],projectInfoById:ie,onDelete:se,projectId:t,projects:y,onAddThread:ee,search:n,contentSnippets:o,highlightThreadId:q,statusByThread:_},c))}),r.jsx(Oe,{open:!!j,onOpenChange:c=>{c||v(null)},children:r.jsxs(Ie,{className:"max-w-sm",children:[r.jsxs(Me,{children:[r.jsx(Le,{children:i("dialog.deleteThread")}),r.jsx(Re,{className:"break-all",children:i("dialog.deleteThreadDesc",{title:j?.title&&j.title.length>80?j.title.slice(0,80)+"…":j?.title})})]}),j?.isWorktree&&r.jsx("p",{className:"rounded-md bg-status-warning/10 px-3 py-2 text-xs text-status-warning/80",children:i("dialog.worktreeWarning")}),r.jsxs(ze,{children:[r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>v(null),children:i("common.cancel")}),r.jsx(Q,{variant:"destructive",size:"sm",onClick:G,loading:ue,children:i("common.delete")})]})]})}),r.jsx(Oe,{open:!!M,onOpenChange:c=>{c||$(null)},children:r.jsxs(Ie,{className:"max-w-sm",children:[r.jsxs(Me,{children:[r.jsx(Le,{children:i(`dialog.${M?.gitState==="unpushed"?"unpushedChanges":M?.gitState==="dirty"?"dirtyChanges":"unmergedChanges"}`)}),r.jsx(Re,{className:"break-all",children:i(`dialog.${M?.gitState==="unpushed"?"unpushedChangesDesc":M?.gitState==="dirty"?"dirtyChangesDesc":"unmergedChangesDesc"}`,{title:M?.title&&M.title.length>80?M.title.slice(0,80)+"…":M?.title})})]}),r.jsxs(ze,{children:[r.jsx(Q,{variant:"outline",size:"sm",onClick:()=>$(null),children:i("common.cancel")}),r.jsx(Q,{variant:"default",size:"sm",onClick:V,children:i("common.continue")})]})]})}),r.jsx(kt,{open:P,onClose:()=>A(!1),onSubmit:oe,loading:b,projectId:N})]})}const he=20;function we({label:e,options:t,selected:n,onToggle:o,counts:m}){const i=n.size,p=i===0?e:i===1?t.find(g=>n.has(g.value))?.label??e:`${e} (${i})`;return r.jsxs(be,{children:[r.jsx(ve,{asChild:!0,children:r.jsxs("button",{className:E("inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border transition-colors whitespace-nowrap",i>0?"bg-accent text-accent-foreground border-accent-foreground/20":"bg-transparent text-muted-foreground border-border hover:bg-accent/50 hover:text-foreground"),children:[p,r.jsx(ut,{className:"h-3 w-3 opacity-50"})]})}),r.jsx(je,{align:"start",className:"w-auto min-w-[160px] p-1",children:t.map(g=>{const d=n.has(g.value),l=m?.[g.value];return r.jsxs("button",{onClick:()=>o(g.value),className:E("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded-sm transition-colors text-left","hover:bg-accent hover:text-accent-foreground",d&&"text-accent-foreground"),children:[r.jsx("span",{className:E("flex h-3.5 w-3.5 items-center justify-center rounded-sm border",d?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:d&&r.jsx(ce,{className:"h-2.5 w-2.5"})}),r.jsx("span",{className:"flex-1",children:g.label}),l!=null&&l>0&&r.jsx("span",{className:"tabular-nums text-muted-foreground",children:l})]},g.value)})})]})}function ln(){const{t:e}=de(),t=Pe(),n=Et(),[o,m]=Ft(),i=it(a=>a.allThreadsProjectId),p=Y(a=>a.threadsByProject),g=Tt(a=>a.projects),d=ot(a=>a.statusByThread),l=o.get("status")?"list":n.pathname==="/kanban"?"board":"list",[s,h]=u.useState(()=>o.get("project")||null),y=a=>{const f={},x=a?.project!==void 0?a.project:s;x&&(f.project=x);const F=o.get("status");return F&&(f.status=F),f};u.useEffect(()=>{const a=o.get("project")||null,f=o.get("status");if(a!==s&&h(a),f){const x=f.split(",").filter(Boolean);R(new Set(x))}},[o]);const S=s?g.find(a=>a.id===s):null,w=a=>{h(a),N(1),m(y({project:a}),{replace:!0})},j=a=>{const f=y(),x=new URLSearchParams(f).toString(),F=a==="board"?"/kanban":"/list";t(x?`${F}?${x}`:F,{replace:!0})},[v,P]=u.useState(""),[A,N]=u.useState(1),[T,R]=u.useState(()=>{const a=o.get("status");return a?new Set(a.split(",").filter(Boolean)):new Set}),[z,b]=u.useState(new Set),[I,ue]=u.useState(new Set),[W,M]=u.useState(!1),[$,_]=u.useState("updated"),[q,ye]=u.useState("desc"),[ee,se]=u.useState(new Map),G=u.useRef(void 0),V=u.useRef(new Map);u.useEffect(()=>{G.current&&clearTimeout(G.current);const a=v.trim();if(!a){se(new Map);return}const f=`${a}|${s||""}`,x=V.current.get(f);if(x){se(x);return}return G.current=setTimeout(()=>{const F=s||void 0;Ne.searchThreadContent(a,F).then(re=>{if(re.isOk()){const ne=new Map,{threadIds:vt,snippets:jt}=re.value;for(const ge of vt)ne.set(ge,jt[ge]||"");if(V.current.set(f,ne),V.current.size>50){const ge=V.current.keys().next().value;V.current.delete(ge)}se(ne)}})},300),()=>{G.current&&clearTimeout(G.current)}},[v,s]);const oe=u.useMemo(()=>{const a={};for(const f of g)a[f.id]={name:f.name,color:f.color};return a},[g]),ie=u.useMemo(()=>{const a={};for(const f of g)a[f.id]=f.name;return a},[g]),te=u.useMemo(()=>{const a=Object.values(p).flat();return s?a.filter(f=>f.projectId===s):a},[p,s]),H=u.useMemo(()=>l==="board"||W?te:te.filter(a=>!a.archived),[te,W,l]),me=Mt(e),c=u.useMemo(()=>{let a=H;if(v.trim()){const f=J(v);a=a.filter(x=>J(x.title).includes(f)||x.branch&&J(x.branch).includes(f)||J(x.status).includes(f)||!s&&ie[x.projectId]&&J(ie[x.projectId]).includes(f)||ee.has(x.id))}return T.size>0&&(a=a.filter(f=>T.has(f.status))),z.size>0&&(a=a.filter(f=>{const x=d[f.id];return x?z.has(x.state):!1})),I.size>0&&(a=a.filter(f=>I.has(f.mode))),a=[...a].sort((f,x)=>{const F=$==="updated"?f.completedAt??f.createdAt:f.createdAt,re=$==="updated"?x.completedAt??x.createdAt:x.createdAt,ne=new Date(F).getTime()-new Date(re).getTime();return q==="desc"?-ne:ne}),a},[H,v,T,z,I,d,s,ie,$,q,ee]),C=Math.min(A,Math.max(1,Math.ceil(c.length/he))),D=c.slice((C-1)*he,C*he),k=()=>{P(""),R(new Set),b(new Set),ue(new Set),M(!1),s&&h(null),m(y({project:null}),{replace:!0}),N(1)},O=a=>{P(a),N(1)},B=a=>f=>{a(x=>{const F=new Set(x);return F.has(f)?F.delete(f):F.add(f),F}),N(1)},L=T.size>0||z.size>0||I.size>0||W||!!s;if(!i)return null;const U=u.useMemo(()=>{const a={};for(const f of H)a[f.status]=(a[f.status]||0)+1;return a},[H]),K=u.useMemo(()=>{const a={};for(const f of H){const x=d[f.id];x&&(a[x.state]=(a[x.state]||0)+1)}return a},[H,d]),De=["running","waiting","completed","failed","stopped","pending","interrupted"],Se=["dirty","unpushed","pushed","merged","clean"];return r.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[r.jsx(Q,{variant:"ghost",size:"icon-xs",onClick:()=>{t(s?`/projects/${s}`:"/")},className:"text-muted-foreground hover:text-foreground",children:s?r.jsx(zt,{className:"h-4 w-4"}):r.jsx(Ce,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"text-sm font-medium",children:e(s&&S?"allThreads.title":"allThreads.globalTitle")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s&&S?`${S.name} · ${H.length} ${e("allThreads.threads")}`:`${g.length} ${e("allThreads.projects")} · ${H.length} ${e("allThreads.threads")}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:r.jsxs("div",{className:"flex items-center gap-1 rounded-md bg-secondary/50 p-0.5",children:[r.jsx(Q,{variant:l==="list"?"secondary":"ghost",size:"icon-xs",onClick:()=>j("list"),className:"h-6 w-6",title:e("kanban.listView"),children:r.jsx($t,{className:"h-3.5 w-3.5"})}),r.jsx(Q,{variant:l==="board"?"secondary":"ghost",size:"icon-xs",onClick:()=>j("board"),className:"h-6 w-6",title:e("kanban.boardView"),children:r.jsx(Bt,{className:"h-3.5 w-3.5"})})]})})]}),r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-4 py-2",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(Ce,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-sm text-muted-foreground"}),r.jsx(ct,{type:"text",placeholder:e(s?"allThreads.searchPlaceholder":"allThreads.globalSearchPlaceholder"),value:v,onChange:a=>O(a.target.value),className:"h-7 w-72 bg-transparent py-1 pl-6 pr-7 text-xs md:text-xs"}),v&&r.jsx("button",{onClick:()=>O(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(Ut,{className:"h-3 w-3"})})]}),r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsxs(be,{children:[r.jsx(ve,{asChild:!0,children:r.jsxs("button",{className:E("inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border transition-colors whitespace-nowrap",s?"bg-accent text-accent-foreground border-accent-foreground/20":"bg-transparent text-muted-foreground border-border hover:bg-accent/50 hover:text-foreground"),children:[s&&S?S.name:e("allThreads.filterProject"),r.jsx(ut,{className:"h-3 w-3 opacity-50"})]})}),r.jsxs(je,{align:"start",className:"max-h-[300px] w-auto min-w-[180px] overflow-y-auto p-1",children:[r.jsxs("button",{onClick:()=>w(null),className:E("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded-sm transition-colors text-left","hover:bg-accent hover:text-accent-foreground",!s&&"text-accent-foreground"),children:[r.jsx("span",{className:E("flex h-3.5 w-3.5 items-center justify-center rounded-full border",s?"border-muted-foreground/30":"bg-primary border-primary text-primary-foreground"),children:!s&&r.jsx(ce,{className:"h-2.5 w-2.5"})}),r.jsx("span",{className:"flex-1",children:e("allThreads.allProjects")})]}),g.map(a=>{const f=s===a.id;return r.jsxs("button",{onClick:()=>w(a.id),className:E("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded-sm transition-colors text-left","hover:bg-accent hover:text-accent-foreground",f&&"text-accent-foreground"),children:[r.jsx("span",{className:E("flex h-3.5 w-3.5 items-center justify-center rounded-full border",f?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:f&&r.jsx(ce,{className:"h-2.5 w-2.5"})}),r.jsx("span",{className:"flex-1 truncate",children:a.name})]},a.id)})]})]}),r.jsx(we,{label:e("allThreads.filterStatus"),options:De.filter(a=>(U[a]||0)>0).map(a=>({value:a,label:me[a]})),selected:T,onToggle:B(R),counts:U}),r.jsx(we,{label:"Git",options:Se.filter(a=>(K[a]||0)>0).map(a=>({value:a,label:e(`gitStatus.${a}`)})),selected:z,onToggle:B(b),counts:K}),r.jsx(we,{label:e("allThreads.filterMode"),options:[{value:"local",label:e("thread.mode.local")},{value:"worktree",label:e("thread.mode.worktree")}],selected:I,onToggle:B(ue)}),r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsxs(be,{children:[r.jsx(ve,{asChild:!0,children:r.jsxs("button",{className:"inline-flex items-center gap-1 whitespace-nowrap rounded-md border border-border bg-transparent px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[e("allThreads.sortLabel"),":"," ",e($==="updated"?"allThreads.sortUpdated":"allThreads.sortCreated"),q==="desc"?r.jsx(Ve,{className:"h-3 w-3"}):r.jsx(Xe,{className:"h-3 w-3"})]})}),r.jsxs(je,{align:"start",className:"w-auto min-w-[140px] p-1",children:[r.jsxs("button",{onClick:()=>{_("updated"),N(1)},className:E("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded-sm transition-colors text-left","hover:bg-accent hover:text-accent-foreground"),children:[r.jsx("span",{className:E("flex h-3.5 w-3.5 items-center justify-center rounded-full border",$==="updated"?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:$==="updated"&&r.jsx(ce,{className:"h-2.5 w-2.5"})}),e("allThreads.sortUpdated")]}),r.jsxs("button",{onClick:()=>{_("created"),N(1)},className:E("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded-sm transition-colors text-left","hover:bg-accent hover:text-accent-foreground"),children:[r.jsx("span",{className:E("flex h-3.5 w-3.5 items-center justify-center rounded-full border",$==="created"?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:$==="created"&&r.jsx(ce,{className:"h-2.5 w-2.5"})}),e("allThreads.sortCreated")]}),r.jsx("div",{className:"my-1 h-px bg-border"}),r.jsx("button",{onClick:()=>{ye(a=>a==="desc"?"asc":"desc"),N(1)},className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs transition-colors hover:bg-accent hover:text-accent-foreground",children:q==="desc"?r.jsxs(r.Fragment,{children:[r.jsx(Ve,{className:"h-3 w-3"}),e("allThreads.sortDesc")]}):r.jsxs(r.Fragment,{children:[r.jsx(Xe,{className:"h-3 w-3"}),e("allThreads.sortAsc")]})})]})]}),r.jsxs("button",{onClick:()=>{M(!W),N(1)},className:E("inline-flex items-center gap-1 px-2 py-1 text-xs rounded-md border transition-colors whitespace-nowrap",W?"bg-status-warning/10 border-status-warning/20 text-status-warning/80":"bg-transparent text-muted-foreground border-border hover:bg-accent/50 hover:text-foreground"),children:[r.jsx(Fe,{className:"h-3 w-3"}),e("allThreads.showArchived")]}),L&&r.jsx("button",{onClick:k,className:"whitespace-nowrap px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:e("allThreads.clearFilters")})]}),r.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:l==="board"?r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(jr,{threads:c,projectId:s||void 0,search:v,contentSnippets:ee,highlightThreadId:o.get("highlight")||void 0})}):r.jsx("div",{className:"h-full px-4 py-3",children:r.jsx(Pt,{className:"h-full",autoFocusSearch:!1,threads:D,totalCount:c.length,search:v,onSearchChange:O,searchPlaceholder:e(s?"allThreads.searchPlaceholder":"allThreads.globalSearchPlaceholder"),page:C,onPageChange:N,pageSize:he,emptyMessage:e("allThreads.noThreads"),searchEmptyMessage:e("allThreads.noMatch"),onThreadClick:a=>{u.startTransition(()=>{t(`/projects/${a.projectId}/threads/${a.id}`)})},paginationLabel:({total:a})=>`${a} ${e("allThreads.threads")}${v||L?` ${e("allThreads.found")}`:""}`,hideSearch:!0,contentSnippets:ee,renderExtraBadges:a=>{const f=d[a.id],x=f?lt[f.state]:null;return r.jsxs(r.Fragment,{children:[!s&&oe[a.projectId]&&r.jsx(st,{name:oe[a.projectId].name,color:oe[a.projectId].color}),!!a.archived&&r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-status-warning/10 px-1.5 py-0.5 text-xs text-status-warning/80",children:[r.jsx(Fe,{className:"h-2.5 w-2.5"}),e("allThreads.archived")]}),x&&r.jsx("span",{className:E("text-xs px-1.5 py-0.5 rounded bg-secondary",x.className),children:e(x.labelKey)}),r.jsx("span",{className:"rounded bg-secondary px-1.5 py-0.5 text-xs text-muted-foreground",children:e(`thread.mode.${a.mode}`)})]})}})})})]})}export{ln as AllThreadsView};
|