@agent-spaces/server 0.3.64 → 0.3.65
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/dist/adapters/claude-code-runtime/index.js +68 -2
- package/dist/adapters/claude-code-runtime/message-format.js +26 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
- package/dist/adapters/git.js +13 -6
- package/dist/agents/agent-message-parts.js +1 -1
- package/dist/agents/commit-agent.js +4 -2
- package/dist/agents/issue-task-controller.js +6 -2
- package/dist/app.js +6 -68
- package/dist/routes/agent-sse.js +1 -0
- package/dist/routes/agent.js +3 -0
- package/dist/routes/database.js +1 -0
- package/dist/routes/git.js +197 -317
- package/dist/routes/robot-account.js +68 -0
- package/dist/services/agent.js +36 -2
- package/dist/services/builtin-tools/kanban-tools.js +4 -0
- package/dist/services/git-operation-log.js +40 -0
- package/dist/services/global-wechat-qr.js +72 -0
- package/dist/services/hook-engine.js +175 -17
- package/dist/services/notification-hub/bot-agent.js +3 -1
- package/dist/services/notification-hub/service.js +12 -2
- package/dist/services/robot-account.js +34 -0
- package/dist/services/workspace.js +2 -0
- package/dist/storage/robot-account-store.js +39 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +23 -25
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0-a.-hl3wv99k.js} +1 -1
- package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0-pi.67w.ymsr.js} +3 -3
- package/dist/web/_next/static/chunks/0-v_p6j5u3_9l.js +1 -0
- package/dist/web/_next/static/chunks/0.-x29t-8gk0r.js +1 -0
- package/dist/web/_next/static/chunks/0.6b64sy0g5.3.js +3 -0
- package/dist/web/_next/static/chunks/0.l5e8~r7_0~p.js +1 -0
- package/dist/web/_next/static/chunks/00-syqzi-6zxr.js +1 -0
- package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
- package/dist/web/_next/static/chunks/02j4sr9psucf-.js +1 -0
- package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
- package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
- package/dist/web/_next/static/chunks/06si8l0doqe8p.js +1 -0
- package/dist/web/_next/static/chunks/08ugbvzr20drp.js +2 -0
- package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 08x85faoz58i7.js} +2 -2
- package/dist/web/_next/static/chunks/{0v3a_x4vt42kx.js → 0_cqojbge48kq.js} +1 -1
- package/dist/web/_next/static/chunks/{0a5y-vhf4i5id.js → 0d6~~lv0-6kex.js} +1 -1
- package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0db14450oqzhg.js} +1 -1
- package/dist/web/_next/static/chunks/0gdwop9cnpmtu.js +1 -0
- package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
- package/dist/web/_next/static/chunks/0kbvoxla7f751.js +1 -0
- package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 0l2w0qz1ea7ql.js} +2 -2
- package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
- package/dist/web/_next/static/chunks/0paaat8y96ayc.js +7 -0
- package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
- package/dist/web/_next/static/chunks/0pq318f8xgafg.js +1 -0
- package/dist/web/_next/static/chunks/0t6s8of0qr6nc.js +1 -0
- package/dist/web/_next/static/chunks/0u6h-hqc_i52e.js +1 -0
- package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
- package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0vis~lx0nxgn-.js} +2 -2
- package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0w7.tb29958zj.js} +1 -1
- package/dist/web/_next/static/chunks/0yd.m1afqg.2t.js +3 -0
- package/dist/web/_next/static/chunks/0yhbr8hl09b-5.js +1 -0
- package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
- package/dist/web/_next/static/chunks/0~~_ltu6dx_ch.js +1 -0
- package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 11cchuwoupmbf.js} +1 -1
- package/dist/web/_next/static/chunks/12oxcgyhpaxw~.js +1 -0
- package/dist/web/_next/static/chunks/1452eibz62gs6.css +1 -0
- package/dist/web/_next/static/chunks/16zlreiems5cn.js +1 -0
- package/dist/web/_next/static/chunks/18awqjk9-o5m0.js +1 -0
- package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -29
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +30 -29
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +23 -25
- package/dist/web/login/__next._full.txt +28 -28
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +28 -28
- package/dist/web/settings/__next._full.txt +33 -32
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +24 -24
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +24 -24
- package/dist/web/settings/mcps/__next._full.txt +24 -24
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +24 -24
- package/dist/web/settings/models/__next._full.txt +24 -24
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +24 -24
- package/dist/web/settings/output-styles/__next._full.txt +24 -24
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +24 -24
- package/dist/web/settings/prompts/__next._full.txt +24 -24
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +24 -24
- package/dist/web/settings/providers/__next._full.txt +24 -24
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +24 -24
- package/dist/web/settings/skills/__next._full.txt +24 -24
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +24 -24
- package/dist/web/settings/tools/__next._full.txt +24 -24
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +24 -24
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +33 -32
- package/dist/web/workflows/__next._full.txt +31 -33
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +31 -33
- package/dist/web/workspace/_/__next._full.txt +28 -29
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +28 -29
- package/dist/web/workspaces/__next._full.txt +29 -31
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +29 -31
- package/dist/ws/agent-runner.js +82 -6
- package/package.json +10 -11
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
- package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
- package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
- package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
- package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
- package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
- package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
- package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
- package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
- package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
- package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
- package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
- package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
- package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
- package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
- package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
- package/dist/web/_next/static/chunks/0ppr271hz0xoq.js +0 -1
- package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
- package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
- package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
- package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
- package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
- package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
- package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
- package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
- package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
- package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
- package/public/output-styles/carmack-mode.md +0 -381
- package/public/output-styles/codex-rigor-mode.md +0 -114
- package/public/output-styles/dhh-mode.md +0 -265
- package/public/output-styles/evan-you-mode.md +0 -539
- package/public/output-styles/index.json +0 -37
- package/public/output-styles/jobs-mode.md +0 -369
- package/public/output-styles/linus-mode.md +0 -135
- package/public/output-styles/uncle-bob-mode.md +0 -221
- package/public/prompt/andrej-karpathy-skills.md +0 -65
- package/public/prompt/claude-token-efficient-coding.md +0 -35
- package/public/prompt/index.json +0 -12
- package/public/skills/index.json +0 -92
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
- package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
- package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
- package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
- package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
- package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
- package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
- package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
- package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
- package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
- package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
- package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
- package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → x4-CsKe6qUQyFDWVtfvUg}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → x4-CsKe6qUQyFDWVtfvUg}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → x4-CsKe6qUQyFDWVtfvUg}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,144988,e=>{"use strict";let t=(0,e.i(433721).default)("file",[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);e.s(["default",0,t])},193251,e=>{"use strict";let t=(0,e.i(433721).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,t],193251)},984178,e=>{"use strict";var t=e.i(144988);e.s(["FileIcon",()=>t.default])},460578,e=>{"use strict";var t=e.i(344180),n=e.i(764556),i=e.i(898822),r=e.i(129981),a=e.i(972846),l=e.i(984178),o=e.i(465458);let s=0;e.s(["FileUpload",0,function({value:e=[],onChange:u,accept:c,maxFiles:d=0,maxSize:f,disabled:p=!1,className:b,placeholder:g}){let[h,v]=(0,n.useState)(null),m=(0,n.useCallback)((t,n)=>{if(v(null),n.length>0){let e=n[0].errors[0]?.message;e&&v(e)}if(0===t.length)return;let i=t.map(e=>{let t={id:`upload-${++s}`,file:e};return e.type.startsWith("image/")&&(t.preview=URL.createObjectURL(e)),t}),r=d>0?[...e,...i].slice(0,d):[...e,...i];u?.(r)},[e,u,d]),x=(0,n.useCallback)(t=>{let n=e.find(e=>e.id===t);n?.preview&&URL.revokeObjectURL(n.preview),u?.(e.filter(e=>e.id!==t))},[e,u]),{getRootProps:y,getInputProps:C,isDragActive:R}=(0,i.useDropzone)({onDrop:m,accept:c,maxFiles:d||void 0,maxSize:f,disabled:p,noClick:!1});return(0,t.jsxs)("div",{className:(0,o.cn)("space-y-3",b),children:[(0,t.jsxs)("div",{...y(),className:(0,o.cn)("relative flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-6 py-8 transition-colors cursor-pointer",R?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50",p&&"pointer-events-none opacity-50"),children:[(0,t.jsx)("input",{...C()}),(0,t.jsx)(r.Upload,{className:"size-8 text-muted-foreground"}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:g??(R?"松开即可上传":"拖拽文件到此处,或点击选择")}),!R&&(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["支持多文件",f?`,单文件最大 ${(f/1024/1024).toFixed(0)}MB`:""]})]})]}),h&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:h}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{var n;return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2 overflow-hidden",children:[e.preview?(0,t.jsx)("img",{src:e.preview,alt:"",className:"size-10 rounded-md object-cover"}):(0,t.jsx)("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted",children:(0,t.jsx)(l.FileIcon,{className:"size-5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-sm",children:e.file.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(n=e.file.size)<1024?`${n} B`:n<1048576?`${(n/1024).toFixed(1)} KB`:`${(n/1024/1024).toFixed(1)} MB`})]}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),x(e.id)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",children:(0,t.jsx)(a.X,{className:"size-4 text-muted-foreground"})})]},e.id)})})]})}])},790766,e=>{"use strict";e.s([])},257295,619279,415279,439485,e=>{"use strict";var t,n,i=e.i(764556),r=e.i(535270),a=e.i(277642),l=e.i(29905),o=e.i(139236),s=e.i(602453),u=e.i(742665),c=e.i(427708),d=e.i(254891);e.s(["useCollapsibleRoot",0,function(e){let{open:t,defaultOpen:n,onOpenChange:f,disabled:p}=e,b=void 0!==t,[g,h]=(0,r.useControlled)({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:v,setMounted:m,transitionStatus:x}=(0,d.useTransitionStatus)(g,!0,!0),[y,C]=i.useState(g),[{height:R,width:S},E]=i.useState({height:void 0,width:void 0}),A=(0,o.useBaseUiId)(),[I,M]=i.useState(),T=I??A,[w,O]=i.useState(!1),[k,D]=i.useState(!1),N=i.useRef(null),L=i.useRef(null),P=i.useRef(null),j=i.useRef(null),W=(0,c.useAnimationsFinished)(j,!1),_=(0,l.useStableCallback)(e=>{let t=!g,n=(0,s.createChangeEventDetails)(u.REASONS.triggerPress,e.nativeEvent);if(f(t,n),n.isCanceled)return;let i=j.current;"css-animation"===L.current&&null!=i&&i.style.removeProperty("animation-name"),w||k||(null!=L.current&&"css-animation"!==L.current&&!v&&t&&m(!0),"css-animation"===L.current&&(!y&&t&&C(!0),!v&&t&&m(!0))),h(t),"none"===L.current&&v&&!t&&m(!1)});return(0,a.useIsoLayoutEffect)(()=>{b&&"none"===L.current&&!g&&m(!1)},[b,g,t,m]),i.useMemo(()=>({abortControllerRef:N,animationTypeRef:L,disabled:p,handleTrigger:_,height:R,mounted:v,open:g,panelId:T,panelRef:j,runOnceAnimationsFinish:W,setDimensions:E,setHiddenUntilFound:O,setKeepMounted:D,setMounted:m,setOpen:h,setPanelIdState:M,setVisible:C,transitionDimensionRef:P,transitionStatus:x,visible:y,width:S}),[N,L,p,_,R,v,g,T,j,W,E,O,D,m,h,C,P,x,y,S])}],257295),e.i(8890);var f=e.i(267805);let p=i.createContext(void 0);e.s(["CollapsibleRootContext",0,p,"useCollapsibleRootContext",0,function(){let e=i.useContext(p);if(void 0===e)throw Error((0,f.default)(15));return e}],619279);var b=e.i(282458);let g=((t={}).open="data-open",t.closed="data-closed",t[t.startingStyle=b.TransitionStatusDataAttributes.startingStyle]="startingStyle",t[t.endingStyle=b.TransitionStatusDataAttributes.endingStyle]="endingStyle",t);e.s(["CollapsiblePanelDataAttributes",0,g],415279);let h=((n={}).panelOpen="data-panel-open",n),v={[g.open]:""},m={[g.closed]:""};e.s(["collapsibleOpenStateMapping",0,{open:e=>e?v:m},"triggerOpenStateMapping",0,{open:e=>e?{[h.panelOpen]:""}:null}],439485)},998723,406899,134319,e=>{"use strict";e.i(8890);var t=e.i(764556),n=e.i(29905),i=e.i(969490),r=e.i(257295),a=e.i(619279),l=e.i(439485),o=e.i(282458);let s={...l.collapsibleOpenStateMapping,...o.transitionStatusMapping};e.s(["collapsibleStateAttributesMapping",0,s],406899);var u=e.i(344180);let c=t.forwardRef(function(e,l){let{render:o,className:c,defaultOpen:d=!1,disabled:f=!1,onOpenChange:p,open:b,style:g,...h}=e,v=(0,n.useStableCallback)(p),m=(0,r.useCollapsibleRoot)({open:b,defaultOpen:d,onOpenChange:v,disabled:f}),x=t.useMemo(()=>({open:m.open,disabled:m.disabled,transitionStatus:m.transitionStatus}),[m.open,m.disabled,m.transitionStatus]),y=t.useMemo(()=>({...m,onOpenChange:v,state:x}),[m,v,x]),C=(0,i.useRenderElement)("div",e,{state:x,ref:l,props:h,stateAttributesMapping:s});return(0,u.jsx)(a.CollapsibleRootContext.Provider,{value:y,children:C})});e.s(["CollapsibleRoot",0,c],998723);var d=e.i(931709);let f={...l.triggerOpenStateMapping,...o.transitionStatusMapping},p=t.forwardRef(function(e,n){let{panelId:r,open:l,handleTrigger:o,state:s,disabled:u}=(0,a.useCollapsibleRootContext)(),{className:c,disabled:p=u,id:b,render:g,nativeButton:h=!0,style:v,...m}=e,{getButtonProps:x,buttonRef:y}=(0,d.useButton)({disabled:p,focusableWhenDisabled:!0,native:h}),C=t.useMemo(()=>({"aria-controls":l?r:void 0,"aria-expanded":l,onClick:o}),[r,l,o]);return(0,i.useRenderElement)("button",e,{state:s,ref:[n,y],props:[C,m,x],stateAttributesMapping:f})});e.s(["CollapsibleTrigger",0,p],134319)},18158,e=>{"use strict";e.i(8890);var t,n=e.i(764556),i=e.i(422561),r=e.i(277642),a=e.i(29905),l=e.i(204133),o=e.i(130522),s=e.i(859092),u=e.i(602453),c=e.i(742665),d=e.i(415279);let f=((t={}).disabled="data-disabled",t.orientation="data-orientation",t);e.s(["useCollapsiblePanel",0,function(e){let{abortControllerRef:t,animationTypeRef:p,externalRef:b,height:g,hiddenUntilFound:h,keepMounted:v,id:m,mounted:x,onOpenChange:y,open:C,panelRef:R,runOnceAnimationsFinish:S,setDimensions:E,setMounted:A,setOpen:I,setVisible:M,transitionDimensionRef:T,visible:w,width:O}=e,k=n.useRef(!1),D=n.useRef(null),N=n.useRef(C),L=n.useRef(C),P=(0,s.useAnimationFrame)(),j=n.useMemo(()=>"css-animation"===p.current?!w:!C&&!x,[C,x,w,p]),W=(0,a.useStableCallback)(e=>{if(!e)return;if(null==p.current||null==T.current){let t=getComputedStyle(e),n="none"!==t.animationName&&""!==t.animationName,i="0s"!==t.transitionDuration&&""!==t.transitionDuration;n&&i||("none"===t.animationName&&"0s"!==t.transitionDuration?p.current="css-transition":"none"!==t.animationName&&"0s"===t.transitionDuration?p.current="css-animation":p.current="none"),"horizontal"===e.getAttribute(f.orientation)||t.transitionProperty.indexOf("width")>-1?T.current="width":T.current="height"}if("css-transition"!==p.current)return;(void 0===g||void 0===O)&&(E({height:e.scrollHeight,width:e.scrollWidth}),L.current&&e.style.setProperty("transition-duration","0s"));let t=-1,n=-1;return t=s.AnimationFrame.request(()=>{L.current=!1,n=s.AnimationFrame.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})}),()=>{s.AnimationFrame.cancel(t),s.AnimationFrame.cancel(n)}}),_=(0,l.useMergedRefs)(b,R,W);return(0,r.useIsoLayoutEffect)(()=>{if("css-transition"!==p.current)return;let e=R.current;if(!e)return;let n=-1;if(null!=t.current&&(t.current.abort(),t.current=null),C){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,"initial","important")}),L.current||v||e.setAttribute(d.CollapsiblePanelDataAttributes.startingStyle,""),E({height:e.scrollHeight,width:e.scrollWidth}),n=s.AnimationFrame.request(()=>{Object.entries(t).forEach(([t,n])=>{""===n?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(0===e.scrollHeight&&0===e.scrollWidth)return;E({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let i=n.signal,r=null,a=d.CollapsiblePanelDataAttributes.endingStyle;return(r=new MutationObserver(l=>{l.some(e=>"attributes"===e.type&&e.attributeName===a)&&(r?.disconnect(),r=null,S(()=>{E({height:0,width:0}),e.style.removeProperty("content-visibility"),A(!1),t.current===n&&(t.current=null)},i))})).observe(e,{attributes:!0,attributeFilter:[a]}),()=>{r?.disconnect(),P.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{s.AnimationFrame.cancel(n)}},[t,p,P,h,v,x,C,R,S,E,A]),(0,r.useIsoLayoutEffect)(()=>{if("css-animation"!==p.current)return;let e=R.current;e&&(D.current=e.style.animationName||D.current,e.style.setProperty("animation-name","none"),E({height:e.scrollHeight,width:e.scrollWidth}),N.current||k.current||e.style.removeProperty("animation-name"),C?(null!=t.current&&(t.current.abort(),t.current=null),A(!0),M(!0)):(t.current=new AbortController,S(()=>{A(!1),M(!1),t.current=null},t.current.signal)))},[t,p,C,R,S,E,A,M,w]),(0,o.useOnMount)(()=>{let e=s.AnimationFrame.request(()=>{N.current=!1});return()=>s.AnimationFrame.cancel(e)}),(0,r.useIsoLayoutEffect)(()=>{if(!h)return;let e=R.current;if(!e)return;let t=-1,n=-1;return C&&k.current&&(e.style.transitionDuration="0s",E({height:e.scrollHeight,width:e.scrollWidth}),t=s.AnimationFrame.request(()=>{k.current=!1,n=s.AnimationFrame.request(()=>{setTimeout(()=>{e.style.removeProperty("transition-duration")})})})),()=>{s.AnimationFrame.cancel(t),s.AnimationFrame.cancel(n)}},[h,C,R,E]),(0,r.useIsoLayoutEffect)(()=>{let e=R.current;e&&h&&j&&(e.setAttribute("hidden","until-found"),"css-transition"===p.current&&e.setAttribute(d.CollapsiblePanelDataAttributes.startingStyle,""))},[h,j,p,R]),n.useEffect(function(){let e=R.current;if(e)return(0,i.addEventListener)(e,"beforematch",function(e){k.current=!0,I(!0),y(!0,(0,u.createChangeEventDetails)(c.REASONS.none,e))})},[y,R,I]),n.useMemo(()=>({props:{hidden:j,id:m,ref:_}}),[j,m,_])}],18158)},256186,e=>{"use strict";var t,n=e.i(344180);e.i(790766);var i=e.i(998723),r=e.i(134319);e.i(8890);var a=e.i(764556),l=e.i(277642),o=e.i(969490),s=e.i(619279),u=e.i(406899),c=e.i(18158);let d=((t={}).collapsiblePanelHeight="--collapsible-panel-height",t.collapsiblePanelWidth="--collapsible-panel-width",t);var f=e.i(273598);let p=a.forwardRef(function(e,t){let{className:n,hiddenUntilFound:i,keepMounted:r,render:p,id:b,style:g,...h}=e,{abortControllerRef:v,animationTypeRef:m,height:x,mounted:y,onOpenChange:C,open:R,panelId:S,panelRef:E,runOnceAnimationsFinish:A,setDimensions:I,setHiddenUntilFound:M,setKeepMounted:T,setMounted:w,setPanelIdState:O,setOpen:k,setVisible:D,state:N,transitionDimensionRef:L,visible:P,width:j,transitionStatus:W}=(0,s.useCollapsibleRootContext)(),_=i??!1,z=r??!1;(0,l.useIsoLayoutEffect)(()=>{if(b)return O(b),()=>{O(void 0)}},[b,O]),(0,l.useIsoLayoutEffect)(()=>{M(_)},[M,_]),(0,l.useIsoLayoutEffect)(()=>{T(z)},[T,z]);let{props:F}=(0,c.useCollapsiblePanel)({abortControllerRef:v,animationTypeRef:m,externalRef:t,height:x,hiddenUntilFound:_,id:S,keepMounted:z,mounted:y,onOpenChange:C,open:R,panelRef:E,runOnceAnimationsFinish:A,setDimensions:I,setMounted:w,setOpen:k,setVisible:D,transitionDimensionRef:L,visible:P,width:j});(0,f.useOpenChangeComplete)({open:R&&"idle"===W,ref:E,onComplete(){R&&I({height:void 0,width:void 0})}});let H=a.useMemo(()=>({...N,transitionStatus:W}),[N,W]),B=(0,o.useRenderElement)("div",e,{state:H,ref:[t,E],props:[F,{style:{[d.collapsiblePanelHeight]:void 0===x?"auto":`${x}px`,[d.collapsiblePanelWidth]:void 0===j?"auto":`${j}px`}},h],stateAttributesMapping:u.collapsibleStateAttributesMapping});return z||_||y?B:null});e.s(["Panel",0,p,"Root",()=>i.CollapsibleRoot,"Trigger",()=>r.CollapsibleTrigger],917853);var b=e.i(917853),b=b;e.s(["Collapsible",0,function({...e}){return(0,n.jsx)(b.Root,{"data-slot":"collapsible",...e})},"CollapsibleContent",0,function({...e}){return(0,n.jsx)(b.Panel,{"data-slot":"collapsible-content",...e})},"CollapsibleTrigger",0,function({...e}){return(0,n.jsx)(b.Trigger,{"data-slot":"collapsible-trigger",...e})}],256186)},383171,415955,e=>{"use strict";var t=e.i(220336);e.s(["FolderIcon",()=>t.default],383171);var n=e.i(680422);e.s(["FolderOpenIcon",()=>n.default],415955)},517432,e=>{"use strict";var t=e.i(56032),n=e.i(863728);function i(){return n.NOOP}function r(){return!1}function a(){return!0}e.s(["useIsHydrating",0,function(){return(0,t.useSyncExternalStore)(i,r,a)}])},9174,e=>{"use strict";e.s(["ACTIVE_COMPOSITE_ITEM",0,"data-composite-item-active"])},568769,e=>{"use strict";e.s(["isElementDisabled",0,function(e){return null==e||e.hasAttribute("disabled")||"true"===e.getAttribute("aria-disabled")}])},972308,e=>{"use strict";var t=e.i(764556),n=e.i(863728),i=e.i(756432),r=e.i(568769),a=e.i(29905),l=e.i(204133),o=e.i(100229),s=e.i(877580),u=e.i(9174),c=e.i(410421);let d=[];var f=e.i(352360),p=e.i(969490),b=e.i(189131),g=e.i(344180);e.s(["CompositeRoot",0,function(e){let{render:h,className:v,style:m,refs:x=n.EMPTY_ARRAY,props:y=n.EMPTY_ARRAY,state:C=n.EMPTY_OBJECT,stateAttributesMapping:R,highlightedIndex:S,onHighlightedIndexChange:E,orientation:A,dense:I,itemSizes:M,loopFocus:T,onLoop:w,cols:O,enableHomeAndEndKeys:k,onMapChange:D,stopEventPropagation:N=!0,rootRef:L,disabledIndices:P,modifierKeys:j,highlightItemOnHover:W=!1,tag:_="div",...z}=e,{props:F,highlightedIndex:H,onHighlightedIndexChange:B,elementsRef:K,onMapChange:V,relayKeyboardEvent:Y}=function(e){let{itemSizes:n,cols:i=1,loopFocus:f=!0,onLoop:p,dense:b=!1,orientation:g="both",direction:h,highlightedIndex:v,onHighlightedIndexChange:m,rootRef:x,enableHomeAndEndKeys:y=!1,stopEventPropagation:C=!1,disabledIndices:R,modifierKeys:S=d}=e,[E,A]=t.useState(0),I=i>1,M=t.useRef(null),T=(0,l.useMergedRefs)(M,x),w=t.useRef([]),O=t.useRef(!1),k=v??E,D=(0,a.useStableCallback)((e,t=!1)=>{if((m??A)(e),t){let t=w.current[e];(0,o.scrollIntoViewIfNeeded)(M.current,t,h,g)}}),N=(0,a.useStableCallback)(e=>{if(0===e.size||O.current)return;O.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(u.ACTIVE_COMPOSITE_ITEM))??null,i=n?t.indexOf(n):-1;-1!==i&&D(i),(0,o.scrollIntoViewIfNeeded)(M.current,n,h,g)}),L=(0,a.useStableCallback)((e,t,n)=>p?p?.(e,t,n,w):n),P=t.useMemo(()=>({"aria-orientation":"both"===g?void 0:g,ref:T,onFocus(e){let t=M.current,n=(0,c.getTarget)(e.nativeEvent);t&&null!=n&&(0,o.isNativeInput)(n)&&n.setSelectionRange(0,n.value.length??0)},onKeyDown(e){let t=y?o.ALL_KEYS:o.ARROW_KEYS;if(!t.has(e.key)||function(e,t){for(let n of o.MODIFIER_KEYS.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}(e,S)||!M.current)return;let a="rtl"===h,l=a?o.ARROW_LEFT:o.ARROW_RIGHT,u={horizontal:l,vertical:o.ARROW_DOWN,both:l}[g],d=a?o.ARROW_RIGHT:o.ARROW_LEFT,v={horizontal:d,vertical:o.ARROW_UP,both:d}[g],m=(0,c.getTarget)(e.nativeEvent);if(null!=m&&(0,o.isNativeInput)(m)&&!(0,r.isElementDisabled)(m)){let t=m.selectionStart,n=m.selectionEnd,i=m.value??"";if(null==t||e.shiftKey||t!==n||e.key!==v&&t<i.length||e.key!==u&&t>0)return}let x=k,E=(0,s.getMinListIndex)(w,R),A=(0,s.getMaxListIndex)(w,R);if(I){let t=n||Array.from({length:w.current.length},()=>({width:1,height:1})),r=(0,s.createGridCellMap)(t,i,b),l=r.findIndex(e=>null!=e&&!(0,s.isListIndexDisabled)(w.current,e,R)),u=r.reduce((e,t,n)=>null==t||(0,s.isListIndexDisabled)(w.current,t,R)?e:n,-1);x=r[(0,s.getGridNavigatedIndex)(r.map(e=>null!=e?w.current[e]:null),{event:e,orientation:g,loopFocus:f,onLoop:L,cols:i,disabledIndices:(0,s.getGridCellIndices)([...R||w.current.map((e,t)=>(0,s.isListIndexDisabled)(w.current,t)?t:void 0),void 0],r),minIndex:l,maxIndex:u,prevIndex:(0,s.getGridCellIndexOfCorner)(k>A?E:k,t,r,i,e.key===o.ARROW_DOWN?"bl":e.key===o.ARROW_RIGHT?"tr":"tl"),rtl:a})]}let T={horizontal:[l],vertical:[o.ARROW_DOWN],both:[l,o.ARROW_DOWN]}[g],O={horizontal:[d],vertical:[o.ARROW_UP],both:[d,o.ARROW_UP]}[g],N=I?t:({horizontal:y?o.HORIZONTAL_KEYS_WITH_EXTRA_KEYS:o.HORIZONTAL_KEYS,vertical:y?o.VERTICAL_KEYS_WITH_EXTRA_KEYS:o.VERTICAL_KEYS,both:t})[g];y&&(e.key===o.HOME?x=E:e.key===o.END&&(x=A)),x===k&&(T.includes(e.key)||O.includes(e.key))&&(f&&x===A&&T.includes(e.key)?(x=E,p&&(x=p(e,k,x,w))):f&&x===E&&O.includes(e.key)?(x=A,p&&(x=p(e,k,x,w))):x=(0,s.findNonDisabledListIndex)(w.current,{startingIndex:x,decrement:O.includes(e.key),disabledIndices:R})),x===k||(0,s.isIndexOutOfListBounds)(w.current,x)||(C&&e.stopPropagation(),N.has(e.key)&&e.preventDefault(),D(x,!0),queueMicrotask(()=>{w.current[x]?.focus()}))}}),[i,b,h,R,w,y,k,I,n,f,p,L,T,S,D,g,C]);return t.useMemo(()=>({props:P,highlightedIndex:k,onHighlightedIndexChange:D,elementsRef:w,disabledIndices:R,onMapChange:N,relayKeyboardEvent:P.onKeyDown}),[P,k,D,w,R,N])}({itemSizes:M,cols:O,loopFocus:T,onLoop:w,dense:I,orientation:A,highlightedIndex:S,onHighlightedIndexChange:E,rootRef:L,stopEventPropagation:N,enableHomeAndEndKeys:k,direction:(0,b.useDirection)(),disabledIndices:P,modifierKeys:j}),U=(0,p.useRenderElement)(_,e,{state:C,ref:x,props:[F,...y,z],stateAttributesMapping:R}),$=t.useMemo(()=>({highlightedIndex:H,onHighlightedIndexChange:B,highlightItemOnHover:W,relayKeyboardEvent:Y}),[H,B,W,Y]);return(0,g.jsx)(f.CompositeRootContext.Provider,{value:$,children:(0,g.jsx)(i.CompositeList,{elementsRef:K,onMapChange:e=>{D?.(e),V(e)},children:U})})}],972308)},812057,e=>{"use strict";var t,n,i,r=e.i(344180);e.s([],236634),e.i(236634),e.i(8890);var a=e.i(764556),l=e.i(535270),o=e.i(277642),s=e.i(29905),u=e.i(969490),c=e.i(756432),d=e.i(267805);let f=a.createContext(void 0);function p(){let e=a.useContext(f);if(void 0===e)throw Error((0,d.default)(64));return e}let b=((t={}).activationDirection="data-activation-direction",t.orientation="data-orientation",t),g={tabActivationDirection:e=>({[b.activationDirection]:e})},h=a.forwardRef(function(e,t){let{className:n,defaultValue:i=0,onValueChange:d,orientation:p="horizontal",render:b,value:h,style:m,...x}=e,y=Object.hasOwn(e,"defaultValue"),C=a.useRef([]),[R,S]=a.useState(()=>new Map),[E,A]=(0,l.useControlled)({controlled:h,default:i,name:"Tabs",state:"value"}),I=void 0!==h,[M,T]=a.useState(()=>new Map),w=a.useCallback(e=>{if(void 0===e)return null;for(let[t,n]of M.entries())if(null!=n&&e===(n.value??n.index))return t;return null},[M]),[O,k]=a.useState(()=>({previousValue:E,tabActivationDirection:"none"})),{previousValue:D,tabActivationDirection:N}=O,L=N,P=!1;D!==E&&(L=v(D,E,p,M),P=null!=D&&null!=E&&null==w(E));let j=P?D:E,W=D!==j||N!==L;(0,o.useIsoLayoutEffect)(()=>{W&&k({previousValue:j,tabActivationDirection:L})},[j,W,L]);let _=(0,s.useStableCallback)((e,t)=>{t.activationDirection=v(E,e,p,M),d?.(e,t),t.isCanceled||A(e)}),z=(0,s.useStableCallback)((e,t)=>{S(n=>{if(n.get(e)===t)return n;let i=new Map(n);return i.set(e,t),i})}),F=(0,s.useStableCallback)((e,t)=>{S(n=>{if(!n.has(e)||n.get(e)!==t)return n;let i=new Map(n);return i.delete(e),i})}),H=a.useCallback(e=>R.get(e),[R]),B=a.useCallback(e=>{for(let t of M.values())if(e===t?.value)return t?.id},[M]),K=a.useMemo(()=>({getTabElementBySelectedValue:w,getTabIdByPanelValue:B,getTabPanelIdByValue:H,onValueChange:_,orientation:p,registerMountedTabPanel:z,setTabMap:T,unregisterMountedTabPanel:F,tabActivationDirection:L,value:E}),[w,B,H,_,p,z,T,F,L,E]),V=a.useMemo(()=>{for(let e of M.values())if(null!=e&&e.value===E)return e},[M,E]),Y=a.useMemo(()=>{for(let e of M.values())if(null!=e&&!e.disabled)return e.value},[M]);(0,o.useIsoLayoutEffect)(()=>{if(I||0===M.size)return;let e=V?.disabled,t=null==V&&null!==E;if(y&&e&&E===i||!e&&!t)return;let n=Y??null;E!==n&&(A(n),k(e=>"none"===e.tabActivationDirection?e:{...e,tabActivationDirection:"none"}))},[i,Y,y,I,V,A,M,E]);let U={orientation:p,tabActivationDirection:L},$=(0,u.useRenderElement)("div",e,{state:U,ref:t,props:x,stateAttributesMapping:g});return(0,r.jsx)(f.Provider,{value:K,children:(0,r.jsx)(c.CompositeList,{elementsRef:C,children:$})})});function v(e,t,n,i){if(null==e||null==t)return"none";let r=null,a=null;for(let[n,l]of i.entries()){if(null==l)continue;let i=l.value??l.index;if(e===i&&(r=n),t===i&&(a=n),null!=r&&null!=a)break}if(null==r||null==a)return r!==a&&("number"==typeof e||"string"==typeof e)&&typeof e==typeof t?"horizontal"===n?t>e?"right":"left":t>e?"down":"up":"none";let l=r.getBoundingClientRect(),o=a.getBoundingClientRect();if("horizontal"===n){if(o.left<l.left)return"left";if(o.left>l.left)return"right"}else{if(o.top<l.top)return"up";if(o.top>l.top)return"down"}return"none"}var m=e.i(526850),x=e.i(139236),y=e.i(931709),C=e.i(9174),R=e.i(530909);let S=a.createContext(void 0);function E(){let e=a.useContext(S);if(void 0===e)throw Error((0,d.default)(65));return e}var A=e.i(602453),I=e.i(742665),M=e.i(410421);let T=a.forwardRef(function(e,t){let{className:n,disabled:i=!1,render:r,value:l,id:s,nativeButton:c=!0,style:d,...f}=e,{value:b,getTabPanelIdByValue:g,orientation:h}=p(),{activateOnFocus:v,highlightedTabIndex:S,onTabActivation:T,registerTabResizeObserverElement:w,setHighlightedTabIndex:O,tabsListElement:k}=E(),D=(0,x.useBaseUiId)(s),N=a.useMemo(()=>({disabled:i,id:D,value:l}),[i,D,l]),{compositeProps:L,compositeRef:P,index:j}=(0,R.useCompositeItem)({metadata:N}),W=l===b,_=a.useRef(!1),z=a.useRef(null);a.useEffect(()=>{let e=z.current;if(e)return w(e)},[w]),(0,o.useIsoLayoutEffect)(()=>{if(_.current){_.current=!1;return}if(W&&j>-1&&S!==j){if(null!=k){let e=(0,M.activeElement)((0,m.ownerDocument)(k));if(e&&(0,M.contains)(k,e))return}i||O(j)}},[W,j,S,O,i,k]);let{getButtonProps:F,buttonRef:H}=(0,y.useButton)({disabled:i,native:c,focusableWhenDisabled:!0}),B=g(l),K=a.useRef(!1),V=a.useRef(!1);return(0,u.useRenderElement)("button",e,{state:{disabled:i,active:W,orientation:h},ref:[t,H,P,z],props:[L,{role:"tab","aria-controls":B,"aria-selected":W,id:D,onClick:function(e){W||i||T(l,(0,A.createChangeEventDetails)(I.REASONS.none,e.nativeEvent,void 0,{activationDirection:"none"}))},onFocus:function(e){W||(j>-1&&!i&&O(j),!i&&v&&(!K.current||K.current&&V.current)&&T(l,(0,A.createChangeEventDetails)(I.REASONS.none,e.nativeEvent,void 0,{activationDirection:"none"})))},onPointerDown:function(e){W||i||(K.current=!0,e.button&&0!==e.button||(V.current=!0,(0,m.ownerDocument)(e.currentTarget).addEventListener("pointerup",function(){K.current=!1,V.current=!1},{once:!0})))},[C.ACTIVE_COMPOSITE_ITEM]:W?"":void 0,onKeyDownCapture(){_.current=!0}},f,F]})});var w=e.i(730774),O=e.i(517432);let k=((n={}).activeTabLeft="--active-tab-left",n.activeTabRight="--active-tab-right",n.activeTabTop="--active-tab-top",n.activeTabBottom="--active-tab-bottom",n.activeTabWidth="--active-tab-width",n.activeTabHeight="--active-tab-height",n);var D=e.i(394394);let N={...g,activeTabPosition:()=>null,activeTabSize:()=>null},L=a.forwardRef(function(e,t){let{className:n,render:i,renderBeforeHydration:l=!1,style:o,...s}=e,{nonce:c}=(0,D.useCSPContext)(),{getTabElementBySelectedValue:d,orientation:f,tabActivationDirection:b,value:g}=p(),{tabsListElement:h,registerIndicatorUpdateListener:v}=E(),m=(0,O.useIsHydrating)(),x=function(){let[,e]=a.useState({});return a.useCallback(()=>{e({})},[])}();a.useEffect(()=>v(x),[v,x]);let y=0,C=0,R=0,S=0,A=0,I=0,M=!1;if(null!=g&&null!=h){let e=d(g);if(M=!0,null!=e){let{width:t,height:n}=(0,w.getCssDimensions)(e),{width:i,height:r}=(0,w.getCssDimensions)(h),a=e.getBoundingClientRect(),l=h.getBoundingClientRect(),o=i>0?l.width/i:1,s=r>0?l.height/r:1;if(Math.abs(o)>Number.EPSILON&&Math.abs(s)>Number.EPSILON){let e=a.left-l.left,t=a.top-l.top;y=e/o+h.scrollLeft-h.clientLeft,R=t/s+h.scrollTop-h.clientTop}else y=e.offsetLeft,R=e.offsetTop;A=t,I=n,C=h.scrollWidth-y-A,S=h.scrollHeight-R-I}}let T=a.useMemo(()=>M?{left:y,right:C,top:R,bottom:S}:null,[y,C,R,S,M]),L=a.useMemo(()=>M?{width:A,height:I}:null,[A,I,M]),P=a.useMemo(()=>{if(M)return{[k.activeTabLeft]:`${y}px`,[k.activeTabRight]:`${C}px`,[k.activeTabTop]:`${R}px`,[k.activeTabBottom]:`${S}px`,[k.activeTabWidth]:`${A}px`,[k.activeTabHeight]:`${I}px`}},[y,C,R,S,A,I,M]),j=M&&A>0&&I>0,W=(0,u.useRenderElement)("span",e,{state:{orientation:f,activeTabPosition:T,activeTabSize:L,tabActivationDirection:b},ref:t,props:[{role:"presentation",style:P,hidden:!j},s,{suppressHydrationWarning:!0}],stateAttributesMapping:N});return null==g?null:(0,r.jsxs)(a.Fragment,{children:[W,m&&l&&(0,r.jsx)("script",{nonce:c,dangerouslySetInnerHTML:{__html:'!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const i=e.querySelector("[data-active]");if(!i)return;if(0===i.offsetWidth||0===e.offsetWidth)return;let o=0,n=0,h=0,l=0,r=0,f=0;function s(t){const e=getComputedStyle(t);let i=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(i)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(i=t.offsetWidth,o=t.offsetHeight),{width:i,height:o}}if(null!=i&&null!=e){const{width:t,height:c}=s(i),{width:u,height:d}=s(e),a=i.getBoundingClientRect(),g=e.getBoundingClientRect(),p=u>0?g.width/u:1,b=d>0?g.height/d:1;if(Math.abs(p)>Number.EPSILON&&Math.abs(b)>Number.EPSILON){const t=a.left-g.left,i=a.top-g.top;o=t/p+e.scrollLeft-e.clientLeft,h=i/b+e.scrollTop-e.clientTop}else o=i.offsetLeft,h=i.offsetTop;r=t,f=c,n=e.scrollWidth-o-r,l=e.scrollHeight-h-f}function c(e,i){t.style.setProperty(`--active-tab-${e}`,`${i}px`)}c("left",o),c("right",n),c("top",h),c("bottom",l),c("width",r),c("height",f),r>0&&f>0&&t.removeAttribute("hidden")}();'},suppressHydrationWarning:!0})]})});var P=e.i(677822),j=e.i(282458),W=e.i(273598),_=e.i(254891),z=e.i(296615);let F=((i={}).index="data-index",i.activationDirection="data-activation-direction",i.orientation="data-orientation",i.hidden="data-hidden",i[i.startingStyle=j.TransitionStatusDataAttributes.startingStyle]="startingStyle",i[i.endingStyle=j.TransitionStatusDataAttributes.endingStyle]="endingStyle",i),H={...g,...j.transitionStatusMapping},B=a.forwardRef(function(e,t){let{className:n,value:i,render:r,keepMounted:l=!1,style:s,...c}=e,{value:d,getTabIdByPanelValue:f,orientation:b,tabActivationDirection:g,registerMountedTabPanel:h,unregisterMountedTabPanel:v}=p(),m=(0,x.useBaseUiId)(),y=a.useMemo(()=>({id:m,value:i}),[m,i]),{ref:C,index:R}=(0,z.useCompositeListItem)({metadata:y}),S=i===d,{mounted:E,transitionStatus:A,setMounted:I}=(0,_.useTransitionStatus)(S),M=!E,T=f(i),w=a.useRef(null),O=(0,u.useRenderElement)("div",e,{state:{hidden:M,orientation:b,tabActivationDirection:g,transitionStatus:A},ref:[t,C,w],props:[{"aria-labelledby":T,hidden:M,id:m,role:"tabpanel",tabIndex:S?0:-1,inert:(0,P.inertValue)(!S),[F.index]:R},c],stateAttributesMapping:H});return((0,W.useOpenChangeComplete)({open:S,ref:w,onComplete(){S||I(!1)}}),(0,o.useIsoLayoutEffect)(()=>{if((!M||l)&&null!=m)return h(i,m),()=>{v(i,m)}},[M,l,i,m,h,v]),l||E)?O:null});var K=e.i(863728),V=e.i(972308);let Y=a.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:i,loopFocus:l=!0,render:o,style:u,...c}=e,{onValueChange:d,orientation:f,value:b,setTabMap:h,tabActivationDirection:v}=p(),[m,x]=a.useState(0),[y,C]=a.useState(null),R=a.useRef(new Set),E=a.useRef(new Set),A=a.useRef(null),I=(0,s.useStableCallback)(()=>{R.current.forEach(e=>{e()})});a.useEffect(()=>{if("u"<typeof ResizeObserver)return;let e=new ResizeObserver(()=>{R.current.size&&I()});return A.current=e,y&&e.observe(y),E.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),A.current=null}},[y,I]);let M=(0,s.useStableCallback)(e=>(R.current.add(e),()=>{R.current.delete(e)})),T=(0,s.useStableCallback)(e=>(E.current.add(e),A.current?.observe(e),()=>{E.current.delete(e),A.current?.unobserve(e)})),w=(0,s.useStableCallback)((e,t)=>{e!==b&&d(e,t)}),O=a.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:m,registerIndicatorUpdateListener:M,registerTabResizeObserverElement:T,onTabActivation:w,setHighlightedTabIndex:x,tabsListElement:y}),[n,m,M,T,w,x,y]);return(0,r.jsx)(S.Provider,{value:O,children:(0,r.jsx)(V.CompositeRoot,{render:o,className:i,style:u,state:{orientation:f,tabActivationDirection:v},refs:[t,C],props:[{"aria-orientation":"vertical"===f?"vertical":void 0,role:"tablist"},c],stateAttributesMapping:g,highlightedIndex:m,enableHomeAndEndKeys:!0,loopFocus:l,orientation:f,onHighlightedIndexChange:x,onMapChange:h,disabledIndices:K.EMPTY_ARRAY})})});e.s(["Indicator",0,L,"List",0,Y,"Panel",0,B,"Root",0,h,"Tab",0,T],227146);var U=e.i(227146),U=U,$=e.i(294237),q=e.i(465458);let G=(0,$.cva)("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});e.s(["Tabs",0,function({className:e,orientation:t="horizontal",...n}){return(0,r.jsx)(U.Root,{"data-slot":"tabs","data-orientation":t,className:(0,q.cn)("group/tabs flex gap-2 data-horizontal:flex-col",e),...n})},"TabsContent",0,function({className:e,...t}){return(0,r.jsx)(U.Panel,{"data-slot":"tabs-content",className:(0,q.cn)("flex-1 text-sm outline-none",e),...t})},"TabsList",0,function({className:e,variant:t="default",...n}){return(0,r.jsx)(U.List,{"data-slot":"tabs-list","data-variant":t,className:(0,q.cn)(G({variant:t}),e),...n})},"TabsTrigger",0,function({className:e,...t}){return(0,r.jsx)(U.Tab,{"data-slot":"tabs-trigger",className:(0,q.cn)("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}],812057)},551157,e=>{"use strict";let t=(0,e.i(433721).default)("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"}]]);e.s(["default",0,t])},882469,e=>{"use strict";var t=e.i(551157);e.s(["Globe",()=>t.default])}]);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,600304,759309,e=>{"use strict";let t=(0,e.i(433721).default)("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"}]]);e.s(["default",0,t],759309),e.s(["Send",0,t],600304)},583705,e=>{"use strict";let t=(0,e.i(433721).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,t],583705)},244996,444741,e=>{"use strict";let t=(0,e.i(433721).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["default",0,t],444741),e.s(["CheckCircle2",0,t],244996)},294543,e=>{"use strict";let t=(0,e.i(433721).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",0,t])},896841,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(191118),n=e.i(31807),r=e.i(327964),o=e.i(355819),c=e.i(361031),l=e.i(588591),d=e.i(62669),m=e.i(515104),p=e.i(226624),u=e.i(817854),h=e.i(451534),x=e.i(227634),f=e.i(191441);function g({icon:e,label:s,value:a}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:s}),(0,t.jsx)("span",{className:"truncate text-foreground ml-auto",title:a,children:a})]})}function j({workspace:e,channelCount:i,issueCount:n}){let r=(0,a.useTranslations)("projectSettings"),[o,c]=(0,s.useState)(!1!==e.autoProcessIssues),[l,m]=(0,s.useState)(!1!==e.hooksEnabled),[v,w]=(0,s.useState)(!1),N=async t=>{if(!v){w(!0);try{let s=await fetch(`/api/workspaces/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoProcessIssues:t})}),a=await s.json();c(!1!==a.autoProcessIssues)}finally{w(!1)}}},y=async t=>{if(!v){w(!0);try{let s=await fetch(`/api/workspaces/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hooksEnabled:t})}),a=await s.json();m(!1!==a.hooksEnabled)}finally{w(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:r("info.title")}),(0,t.jsx)(g,{icon:(0,t.jsx)(h.FolderOpen,{size:14}),label:r("info.path"),value:e.boundDirs[0]??"-"}),(0,t.jsx)(g,{icon:(0,t.jsx)(x.Hash,{size:14}),label:r("info.channels"),value:String(i)}),(0,t.jsx)(g,{icon:(0,t.jsx)(f.ListChecks,{size:14}),label:r("info.issues"),value:String(n)})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:r("automation.title")}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(u.Label,{htmlFor:"auto-process",className:"text-sm font-medium",children:r("automation.autoProcess")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r("automation.autoProcessDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(p.Switch,{id:"auto-process",checked:o,onCheckedChange:N,disabled:v})]})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Hooks"}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(u.Label,{htmlFor:"hooks-enabled",className:"text-sm font-medium",children:"Enable Hooks"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enable per-tool-call hooks for this workspace"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(p.Switch,{id:"hooks-enabled",checked:l,onCheckedChange:y,disabled:v})]})]})]})]})}var v=e.i(260218),w=e.i(681622),N=e.i(812057),y=e.i(209988),k=e.i(36539),k=k,b=e.i(325443),S=e.i(244996),C=e.i(294543),C=C,T=e.i(92457);let I=(0,e.i(433721).default)("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);var P=e.i(601039),F=e.i(600304),E=e.i(360112);let O=[{value:"issue_started",labelKey:"events.issueStarted"},{value:"issue_completed",labelKey:"events.issueCompleted"},{value:"issue_task_completed",labelKey:"events.taskCompleted"},{value:"channel_agent_completed",labelKey:"events.channelAgentCompleted"}];function D(){return{enabled:!1,provider:"lark",events:["issue_started","issue_completed","issue_task_completed"],lark:{},wechat:{}}}let L=`{
|
|
2
|
-
"scopes": {
|
|
3
|
-
"tenant": [
|
|
4
|
-
"contact:contact.base:readonly",
|
|
5
|
-
"im:chat:readonly",
|
|
6
|
-
"im:chat.members:read",
|
|
7
|
-
"im:message",
|
|
8
|
-
"im:message.group_at_msg:readonly",
|
|
9
|
-
"im:message.group_msg",
|
|
10
|
-
"im:message.p2p_msg:readonly",
|
|
11
|
-
"im:message:send_as_bot",
|
|
12
|
-
"im:resource"
|
|
13
|
-
],
|
|
14
|
-
"user": []
|
|
15
|
-
}
|
|
16
|
-
}`;function z(){let[e,a]=(0,s.useState)(!1);return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(L).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})},children:[e?(0,t.jsx)(S.CheckCircle2,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-600"}):null,e?"已复制":"复制批量权限配置"]}),(0,t.jsxs)("details",{className:"group",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"展开查看权限详情"}),(0,t.jsx)("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-muted p-2 text-xs",children:L})]})]})}function _({workspaceId:e,workspace:i,notificationDraft:n,setNotificationDraft:r,setWorkspace:o,botAgents:l,agentDialogOpen:h,setAgentDialogOpen:x}){var f;let g=(0,a.useTranslations)("projectSettings"),j=(0,a.useTranslations)("common"),[L,q]=(0,s.useState)(!1),[A,R]=(0,s.useState)(!1),[B,$]=(0,s.useState)(!1),[M,U]=(0,s.useState)(!1),[W,G]=(0,s.useState)({status:"idle"}),K=(0,s.useRef)(!1),[J,Q]=(0,s.useState)("default"),[H,V]=(0,s.useState)(!1),[X,Y]=(0,s.useState)(!1),Z=!!(n.wechat?.token&&n.wechat?.accountId),ee=(0,c.useWorkspaceStore)(e=>e.upsertWorkspace);(0,s.useEffect)(()=>{if(!n.enabled||"wechat"!==n.provider||!["wait","scaned"].includes(W.status))return;let t=window.setInterval(()=>{K.current||(K.current=!0,fetch(`/api/workspaces/${e}/notifications/wechat/qr?poll=1`,{method:"POST"}).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||"Failed to poll WeChat QR status");G({status:t.status??"wait",qrcodeImgContent:t.qrcodeImgContent??W.qrcodeImgContent,accountId:t.accountId,baseUrl:t.baseUrl}),t.workspace&&(o(t.workspace),r(t.workspace.notificationSettings??D()),E.toast.success(g("wechat.connectedToast")))}).catch(e=>{E.toast.error(g("wechat.pollFailed"),{description:e instanceof Error?e.message:void 0})}).finally(()=>{K.current=!1}))},2e3);return()=>window.clearInterval(t)},[n.enabled,n.provider,r,o,g,W.qrcodeImgContent,W.status,e]),(0,s.useEffect)(()=>{V((0,m.isNativeAndroidEnvironment)()),(0,m.getNotificationPermission)().then(Q)},[]);let et=async t=>{if(!i||L)return null;q(!0);try{let s=await fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationSettings:t})});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.error||"Failed to save notification settings")}let a=await s.json();return o(a),ee(a),r(a.notificationSettings??D()),a}catch(e){return E.toast.error(g("notifications.saveFailed"),{description:e instanceof Error?e.message:void 0}),null}finally{q(!1)}},es=e=>{let t={...n,...e,lark:{...n.lark,...e.lark},wechat:{...n.wechat,...e.wechat},native:{...n.native,...e.native}};r(t),et(t)},ea=async()=>{if(!A){R(!0);try{if(!await et(n))throw Error("Failed to save notification settings");let t=await fetch(`/api/workspaces/${e}/notifications/start`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to start notification service")}let s=await t.json();s.workspace?(o(s.workspace),r(s.workspace.notificationSettings??D())):r({...n,serviceRunning:!0}),E.toast.success(g("notifications.startSuccess"))}catch(e){E.toast.error(g("notifications.startFailed"),{description:e instanceof Error?e.message:void 0})}finally{R(!1)}}},ei=async()=>{if(!A){R(!0);try{let t=await fetch(`/api/workspaces/${e}/notifications/stop`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to stop notification service")}let s=await t.json();s.workspace?(o(s.workspace),r(s.workspace.notificationSettings??D())):r({...n,serviceRunning:!1}),E.toast.success(g("notifications.stopSuccess"))}catch(e){E.toast.error(g("notifications.stopFailed"),{description:e instanceof Error?e.message:void 0})}finally{R(!1)}}},en=async()=>{if(!B){$(!0);try{let t=await fetch(`/api/workspaces/${e}/notifications/test`,{method:"POST"}),s=await t.json().catch(()=>null);if(!t.ok)throw Error(s?.reason||s?.error||"Failed to send test notification");E.toast.success(g("notifications.testSuccess"))}catch(e){E.toast.error(g("notifications.testFailed"),{description:e instanceof Error?e.message:void 0})}finally{$(!1)}}},er=async()=>{if(!M){U(!0);try{if(!await et({...n,provider:"wechat"}))throw Error("Failed to save notification settings");let t=await fetch(`/api/workspaces/${e}/notifications/wechat/qr${Z?"?refresh=1":""}`,{method:"POST"}),s=await t.json().catch(()=>null);if(!t.ok)throw Error(s?.error||"Failed to get WeChat QR code");G({status:s.status??"wait",qrcodeImgContent:s.qrcodeImgContent,accountId:s.accountId,baseUrl:s.baseUrl}),s.workspace&&(o(s.workspace),r(s.workspace.notificationSettings??D()))}catch(e){E.toast.error(g("wechat.getQrFailed"),{description:e instanceof Error?e.message:void 0})}finally{U(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:g("notifications.title")}),(0,t.jsxs)("div",{className:"space-y-4 rounded-md border px-3 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(u.Label,{htmlFor:"message-notifications",className:"text-sm font-medium",children:g("notifications.messageNotifications")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g("notifications.messageNotificationsDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[L&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(p.Switch,{id:"message-notifications",checked:n.enabled,onCheckedChange:e=>es({enabled:e}),disabled:L})]})]}),n.enabled&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(N.Tabs,{value:n.provider,onValueChange:e=>es({provider:e}),className:"flex flex-col",children:[(0,t.jsxs)(N.TabsList,{className:"grid w-full grid-cols-3",children:[(0,t.jsx)(N.TabsTrigger,{value:"lark",children:g("notifications.lark")}),(0,t.jsx)(N.TabsTrigger,{value:"wechat",children:g("notifications.wechat")}),(0,t.jsx)(N.TabsTrigger,{value:"native",children:g("notifications.native")})]}),(0,t.jsxs)(N.TabsContent,{value:"lark",className:"space-y-3 pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"飞书 Bot 配置"}),(0,t.jsxs)(v.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>Y(!0),children:[(0,t.jsx)(C.default,{className:"h-3.5 w-3.5"}),"部署教程"]})]}),(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)(u.Label,{htmlFor:"lark-app-id",className:"text-xs text-muted-foreground",children:g("notifications.appId")}),(0,t.jsx)(w.Input,{id:"lark-app-id",value:n.lark?.appId??"",onChange:e=>r({...n,lark:{...n.lark,appId:e.target.value}}),placeholder:"cli_xxx",disabled:A})]}),(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)(u.Label,{htmlFor:"lark-app-secret",className:"text-xs text-muted-foreground",children:g("notifications.appSecret")}),(0,t.jsx)(w.Input,{id:"lark-app-secret",type:"password",value:n.lark?.appSecret??"",onChange:e=>r({...n,lark:{...n.lark,appSecret:e.target.value}}),placeholder:"app secret",disabled:A})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:n.serviceRunning?"outline":"default",onClick:n.serviceRunning?ei:ea,disabled:A||L||!n.lark?.appId||!n.lark?.appSecret,children:[A?(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(F.Send,{className:"mr-2 h-3.5 w-3.5"}),n.serviceRunning?g("notifications.stopService"):g("notifications.startService")]}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:en,disabled:B||L||!n.serviceRunning,children:[B&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),g("notifications.testSend")]})]})]}),(0,t.jsxs)(N.TabsContent,{value:"wechat",className:"space-y-3 pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[Z?(0,t.jsx)(S.CheckCircle2,{className:"h-4 w-4 text-emerald-600"}):(0,t.jsx)(I,{className:"h-4 w-4"}),g("wechat.robot")]}),(0,t.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:Z?g("wechat.connected",{accountId:n.wechat?.accountId??""}):"scaned"===W.status?g("wechat.scanned"):"expired"===W.status?g("wechat.expired"):g("wechat.scanQr")})]}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:er,disabled:M||L||A,children:[M?(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(P.RefreshCw,{className:"mr-2 h-3.5 w-3.5"}),Z?g("wechat.refreshLogin"):g("wechat.getQr")]})]}),W.qrcodeImgContent&&!Z&&(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-dashed px-3 py-3",children:[(0,t.jsx)("img",{src:(f=W.qrcodeImgContent,`https://api.qrserver.com/v1/create-qr-code/?size=180x180&margin=8&data=${encodeURIComponent(f)}`),alt:"WeChat robot login QR code",className:"h-36 w-36 shrink-0 rounded border bg-white p-2"}),(0,t.jsxs)("div",{className:"min-w-0 space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{children:g("wechat.status",{status:"scaned"===W.status?"scanned":W.status})}),(0,t.jsx)("p",{className:"break-all",children:g("wechat.loginUrl",{url:W.qrcodeImgContent})})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:n.serviceRunning?"outline":"default",onClick:n.serviceRunning?ei:ea,disabled:A||L||!Z,children:[A?(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(F.Send,{className:"mr-2 h-3.5 w-3.5"}),n.serviceRunning?g("notifications.stopService"):g("notifications.startService")]}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:en,disabled:B||L||!n.serviceRunning,children:[B&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),g("notifications.testSend")]})]})]}),(0,t.jsxs)(N.TabsContent,{value:"native",className:"space-y-3 pt-2",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g("notifications.nativeDescription")}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(T.Monitor,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsxs)("span",{className:"font-medium",children:["granted"===J&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(S.CheckCircle2,{className:"h-4 w-4 text-emerald-600"}),g("notifications.nativePermissionGranted")]}),"denied"===J&&g("notifications.nativePermissionDenied"),"default"===J&&g("notifications.nativePermissionDefault"),"unsupported"===J&&g("notifications.nativePermissionUnsupported")]})]}),"unsupported"!==J&&"granted"!==J&&(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{let e=await (0,m.requestNotificationPermission)();Q(e),"granted"===e?(es({native:{permissionGranted:!0}}),E.toast.success(g("notifications.nativePermissionGrantedToast"))):"denied"===e&&E.toast.error(g("notifications.nativePermissionDeniedToast"))},disabled:"denied"===J,children:g("notifications.nativeRequestPermission")})]}),H&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(u.Label,{htmlFor:"android-ongoing-task-notification",className:"text-sm font-medium",children:g("notifications.androidOngoingTaskNotification")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g("notifications.androidOngoingTaskNotificationDescription")})]}),(0,t.jsx)(p.Switch,{id:"android-ongoing-task-notification",checked:n.native?.androidOngoingTaskNotification??!1,onCheckedChange:e=>es({native:{permissionGranted:n.native?.permissionGranted,androidOngoingTaskNotification:e}}),disabled:L||"granted"!==J})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{try{await (0,m.sendNativeNotification)("Agent Spaces",g("notifications.nativeTestSuccess")),E.toast.success(g("notifications.nativeTestSent"),{duration:5e3})}catch(e){E.toast.error(`${g("notifications.nativeTestFailed")}: ${e instanceof Error?e.message:e}`,{duration:5e3})}},disabled:"granted"!==J,children:g("notifications.testSend")})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(b.Bot,{className:"h-3.5 w-3.5"}),g("botAgent.title")]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("select",{value:n.botAgentId??"",onChange:e=>{es({botAgentId:e.target.value||void 0})},disabled:L,className:"h-8 min-w-0 flex-1 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:[(0,t.jsx)("option",{value:"",children:g("botAgent.selectAgent")}),l.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:()=>x(!0),children:j("manage")})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(k.default,{className:"h-3.5 w-3.5"}),g("events.title")]}),(0,t.jsx)("div",{className:"grid gap-2",children:O.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)("input",{type:"checkbox",className:"h-4 w-4 accent-primary",checked:n.events.includes(e.value),onChange:t=>{var s,a;let i;return s=e.value,a=t.target.checked,i=new Set(n.events),void(a?i.add(s):i.delete(s),es({events:Array.from(i)}))},disabled:L}),(0,t.jsx)("span",{children:g(e.labelKey)})]},e.value))})]})]})]}),(0,t.jsx)(y.Dialog,{open:X,onOpenChange:Y,children:(0,t.jsxs)(y.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(y.DialogHeader,{children:[(0,t.jsx)(y.DialogTitle,{children:"创建飞书 Bot"}),(0,t.jsx)(y.DialogDescription,{children:"首次使用?按以下步骤在飞书开放平台创建机器人应用"})]}),(0,t.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"1. 创建自建应用"}),(0,t.jsxs)("p",{className:"text-muted-foreground",children:["前往"," ",(0,t.jsx)("a",{href:"https://open.feishu.cn/app",target:"_blank",rel:"noreferrer",className:"underline underline-offset-3 hover:text-foreground",children:"飞书开放平台"})," ","(海外版:"," ",(0,t.jsx)("a",{href:"https://open.larksuite.com/app",target:"_blank",rel:"noreferrer",className:"underline underline-offset-3 hover:text-foreground",children:"Lark 开放平台"}),"),点击「创建自建应用」并填写名称描述。"]})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"2. 获取凭证"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"进入详情页,在「凭证与基础信息」中找到 App ID 和 App Secret,复制到上方的配置表单。"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"3. 启用机器人能力"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"进入「添加应用能力」页面,启用「机器人」能力。这样应用才能接收和发送飞书消息。"})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"4. 配置权限"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"进入「权限管理」页面,点击下方按钮复制权限配置 JSON,然后在飞书开放平台通过「批量开通」粘贴即可一键添加所有权限:"}),(0,t.jsx)(z,{})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"5. 配置事件订阅(关键步骤)"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"进入「事件与回调」页面:"}),(0,t.jsxs)("ul",{className:"list-disc space-y-1 pl-4 text-muted-foreground",children:[(0,t.jsx)("li",{children:"事件订阅方式选择「使用长连接接收事件」(而非 Webhook,无需公网 IP)"}),(0,t.jsxs)("li",{children:["添加事件 ",(0,t.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"im.message.receive_v1"}),"(接收消息)"]})]})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("p",{className:"font-medium",children:"6. 发布应用"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"进入「版本管理与发布」→ 创建版本 → 提交审核。需要企业管理员在管理后台审核通过后,机器人才能正常使用。"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"版本审核通过并发布后,在飞书中搜索机器人名称添加到聊天,即可通过飞书向 Proma Agent 发送指令。"})]})]})]})})]})}var q=e.i(788010),A=e.i(583705),R=e.i(638322);function B({workspaceId:e,initialPrompt:i}){let n=(0,a.useTranslations)("projectSettings"),[r,o]=(0,s.useState)(i),[c,l]=(0,s.useState)(i),[m,p]=(0,s.useState)(!1),h=r!==c,x=async()=>{if(!m){p(!0);try{let t=await fetch(`/api/workspaces/${e}/prompt`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to save workspace prompt")}let s=await t.json();o(s.prompt),l(s.prompt),E.toast.success(n("prompt.saveSuccess"))}catch(e){E.toast.error(n("prompt.saveFailed"),{description:e instanceof Error?e.message:void 0})}finally{p(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("prompt.title")}),(0,t.jsxs)("div",{className:"space-y-3 rounded-md border px-3 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(u.Label,{htmlFor:"workspace-prompt",className:"text-sm font-medium",children:n("prompt.workspacePrompt")}),(0,t.jsx)(R.TooltipProvider,{delay:200,children:(0,t.jsxs)(R.Tooltip,{children:[(0,t.jsx)(R.TooltipTrigger,{className:"inline-flex",children:(0,t.jsx)(A.Info,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),(0,t.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,t.jsx)("p",{children:n("prompt.description")})})]})})]}),(0,t.jsx)(q.Textarea,{id:"workspace-prompt",value:r,onChange:e=>o(e.target.value),className:"min-h-36 resize-y text-sm"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(v.Button,{type:"button",size:"sm",onClick:x,disabled:m||!h,children:[m&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),n("prompt.savePrompt")]})})]})]})}e.s(["ProjectSettingsPanel",0,function({workspaceId:e}){let p=(0,a.useTranslations)("projectSettings"),[u,h]=(0,s.useState)(null),[x,f]=(0,s.useState)(""),[g,v]=(0,s.useState)(!0),[w,N]=(0,s.useState)(!1),[y,k]=(0,s.useState)(D()),b=(0,n.useChannelStore)(e=>e.channels),S=(0,r.useIssueStore)(e=>e.issues),C=(0,o.useAgentStore)(e=>e.agents).filter(e=>"bot"===e.role&&!1!==e.enabled),T=(0,c.useWorkspaceStore)(e=>e.upsertWorkspace);return((0,s.useEffect)(()=>{Promise.all([fetch(`/api/workspaces/${e}`).then(e=>e.json()),fetch(`/api/workspaces/${e}/prompt`).then(e=>e.json())]).then(([t,s])=>{h(t),T(t),f(s.prompt??"");let a=t.notificationSettings??D();k(a),v(!1),(0,m.getNotificationPermission)().then(t=>{if("granted"===t&&"native"===a.provider&&!a.native?.permissionGranted){let t={...a,native:{...a.native,permissionGranted:!0}};k(t),fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationSettings:t})}).then(e=>e.json()).then(e=>{h(e),T(e)})}})}).catch(()=>v(!1))},[e,T]),g)?(0,t.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),p("loading")]}):u?(0,t.jsxs)(i.ScrollArea,{className:"h-full",children:[(0,t.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b text-xs font-medium text-muted-foreground",children:(0,t.jsx)("span",{children:p("title")})}),(0,t.jsxs)("div",{className:"p-4 space-y-6",children:[(0,t.jsx)(j,{workspace:u,channelCount:b.length,issueCount:S.length}),(0,t.jsx)(_,{workspaceId:e,workspace:u,notificationDraft:y,setNotificationDraft:k,setWorkspace:h,botAgents:C,agentDialogOpen:w,setAgentDialogOpen:N}),(0,t.jsx)(B,{workspaceId:e,initialPrompt:x})]}),(0,t.jsx)(l.AgentDialog,{open:w,onOpenChange:N,roleFilter:"bot"})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:p("workspaceNotFound")})}],896841)},985646,e=>{e.n(e.i(896841))}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,625873,e=>{"use strict";var t=e.i(344180),s=e.i(764556),n=e.i(244073),a=e.i(209988),i=e.i(260218),l=e.i(191118),r=e.i(513501),o=e.i(989484),c=e.i(193251),d=e.i(973370),m=e.i(887354),p=e.i(681622),h=e.i(917955),u=e.i(611176),x=e.i(255742),f=e.i(973767),g=e.i(129981),j=e.i(601039),y=e.i(977694),v=e.i(137340),N=e.i(401058),k=e.i(451534);let w=(0,e.i(433721).default)("file-archive",[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);var b=e.i(327962),C=e.i(62669),S=e.i(465458),z=e.i(256186),T=e.i(650654),D=e.i(992764);function I({items:e,onItemsChange:a,onConfirm:r,onCancel:o,defaultGroup:c}){let d=(0,n.useTranslations)("skills"),[m,h]=(0,s.useState)(""),[u,x]=(0,s.useState)(new Set),f=(t,s)=>{a(e.map(e=>e.id===t?{...e,...s}:e))},g=e.filter(e=>e.selected).length;return(0,t.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 pt-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-2",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:d("importPreviewTitle")}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:()=>{a(e.map(e=>({...e,selected:!0})))},children:d("importPreviewSelectAll")}),(0,t.jsx)(i.Button,{variant:"ghost",size:"sm",onClick:()=>{a(e.map(e=>({...e,selected:!1})))},children:d("importPreviewDeselectAll")})]}),(0,t.jsx)(p.Input,{value:m,onChange:e=>h(e.target.value),placeholder:c||d("importPreviewGroupPlaceholder"),className:"h-7 text-sm w-32"})]}),0===e.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:d("importPreviewEmpty")}):(0,t.jsx)(l.ScrollArea,{className:"flex-1 min-h-0",children:(0,t.jsx)("div",{className:"space-y-2 pr-2",children:e.map(s=>{let n=u.has(s.id);return(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-background p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"checkbox",checked:s.selected,onChange:()=>{var t;f(t=s.id,{selected:!e.find(e=>e.id===t).selected})},className:"mt-0.5 size-3.5 accent-primary shrink-0"}),(0,t.jsx)(p.Input,{value:s.name,onChange:e=>f(s.id,{name:e.target.value}),placeholder:d("importPreviewNamePlaceholder"),className:"h-7 text-sm flex-1"}),(0,t.jsx)(p.Input,{value:s.group,onChange:e=>f(s.id,{group:e.target.value}),placeholder:d("importPreviewGroupPlaceholder"),className:"h-7 text-sm w-32"}),(0,t.jsx)("button",{type:"button",onClick:()=>{var e;return e=s.id,void x(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},className:"p-1 rounded hover:bg-accent shrink-0 cursor-pointer",children:n?(0,t.jsx)(T.ChevronDown,{className:"size-3.5 text-muted-foreground"}):(0,t.jsx)(D.ChevronRight,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)(z.Collapsible,{open:n,children:(0,t.jsx)(z.CollapsibleContent,{children:(0,t.jsxs)("pre",{className:"mt-2 p-2 bg-muted rounded text-xs overflow-auto max-h-48 whitespace-pre-wrap",children:[s.content.slice(0,2e3),s.content.length>2e3?"\n...":""]})})})]},s.id)})})}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-2 mt-2 border-t",children:[(0,t.jsx)(i.Button,{variant:"outline",size:"sm",onClick:o,children:d("importPreviewCancel")}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{let t=e.filter(e=>e.selected).map(e=>({...e,group:e.group||m}));0!==t.length&&r(t)},disabled:0===g,children:d("importPreviewConfirm",{selected:g,total:e.length})})]})]})}function A({skills:r,agents:c,loading:z,syncLoading:T,onToggleFavorite:D,onDelete:$,onEdit:F,onBind:B,onImportBatch:P,onImportFromGit:L,onSyncCheck:M,onBindAll:O}){let U=(0,n.useTranslations)("skills"),R=(0,n.useTranslations)("common"),[_,E]=(0,s.useState)(""),[G,J]=(0,s.useState)("all"),[H,K]=(0,s.useState)(""),[W,q]=(0,s.useState)(""),V=(0,s.useRef)(null),Z=(0,s.useRef)(null),Q=(0,s.useRef)(null),[X,Y]=(0,s.useState)([]),[ee,et]=(0,s.useState)(!1),[es,en]=(0,s.useState)(""),[ea,ei]=(0,s.useState)(""),[el,er]=(0,s.useState)(!1),[eo,ec]=(0,s.useState)(!1),ed=Array.from(new Set(r.map(e=>e.group).filter(Boolean))),em=r.filter(e=>{if(_){let t=_.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}if("favorites"===G&&!e.favorited||"agent"===G&&H&&!e.boundAgents.some(e=>e.id===H))return!1;if(W){if("__none__"===W){if(e.group)return!1}else if(e.group!==W)return!1}return!0}),ep=async e=>{let t=e.target.files;if(!t||0===t.length)return;let s=[];for(let e of Array.from(t)){let t=await e.text(),n=e.name.replace(/\.md$/i,"");s.push({id:`md-${n}-${Math.random().toString(36).slice(2,8)}`,name:n,group:"",content:t,selected:!0,sourceName:e.name})}Y(s),en(""),et(!0),e.target.value=""},eh=async e=>{let t=e.target.files;if(!t||0===t.length)return;let s=new Map;for(let e of Array.from(t)){let t=e.webkitRelativePath.split("/")[0];s.has(t)||s.set(t,[]),s.get(t).push(e)}let n=[];for(let[e,t]of s){let s=t.find(e=>"SKILL.md"===e.name);if(s||(s=t.find(e=>e.name.endsWith(".md"))),!s)continue;let a=await s.text();n.push({id:`folder-${e}-${Math.random().toString(36).slice(2,8)}`,name:e,group:"",content:a,selected:!0,sourceName:e})}Y(n),en(""),et(!0),e.target.value=""},eu=async t=>{let s=t.target.files?.[0];if(s){try{let t=(await e.A(980476)).default,n=await t.loadAsync(s),a=s.name.replace(/\.zip$/i,""),i=new Map;n.forEach((e,t)=>{if(t.dir)return;let s=e.split("/").pop()||"",n=e.substring(0,e.lastIndexOf("/"));if(!n){if(s.endsWith(".md")&&"SKILL.md"!==s){let t=s.replace(/\.md$/i,"");i.has(t)||i.set(t,[]),i.get(t).push({file:s,path:e})}return}let a=n.split("/")[0];i.has(a)||i.set(a,[]),i.get(a).push({file:s,path:e})});let l=[];for(let[e,t]of i){let s=t.find(e=>"SKILL.md"===e.file);if(s||(s=t.find(e=>e.file.endsWith(".md"))),!s)continue;let a=await n.file(s.path).async("string");l.push({id:`zip-${e}-${Math.random().toString(36).slice(2,8)}`,name:e,group:"",content:a,selected:!0,sourceName:e})}Y(l),en(a),et(!0)}catch(e){console.error("Failed to extract ZIP:",e)}t.target.value=""}},ex=async()=>{let e=ea.trim();if(!e)return;er(!0);let t=await L(e);if(er(!1),t&&t.length>0){let s=e.split("/").pop()?.replace(/\.git$/i,"")||"";Y(t),en(s),et(!0),ec(!1)}ei("")};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:V,type:"file",accept:".md",multiple:!0,className:"hidden",onChange:ep}),(0,t.jsx)("input",{ref:Z,type:"file",className:"hidden",onChange:eh,webkitdirectory:"",directory:""}),(0,t.jsx)("input",{ref:Q,type:"file",accept:".zip",className:"hidden",onChange:eu}),(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:M,disabled:T,children:[(0,t.jsx)(j.RefreshCw,{className:(0,S.cn)("size-3.5 mr-1",T&&"animate-spin")}),U("syncToAgents")]}),(0,t.jsxs)(h.DropdownMenu,{children:[(0,t.jsx)(h.DropdownMenuTrigger,{render:(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(g.Upload,{className:"size-3.5 mr-1"}),U("import")]})}),(0,t.jsxs)(h.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>V.current?.click(),children:[(0,t.jsx)(o.FileText,{className:"size-3.5 mr-1.5"}),U("importFromMd")]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>Z.current?.click(),children:[(0,t.jsx)(k.FolderOpen,{className:"size-3.5 mr-1.5"}),U("importFromFolder")]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>Q.current?.click(),children:[(0,t.jsx)(w,{className:"size-3.5 mr-1.5"}),U("importFromZip")]}),(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>ec(!0),disabled:el,children:[(0,t.jsx)(b.GitBranch,{className:"size-3.5 mr-1.5"}),U("importFromGit")]})]})]})]}),ee?(0,t.jsx)(I,{items:X,onItemsChange:Y,onConfirm:e=>{P(e),et(!1),Y([])},onCancel:()=>{et(!1),Y([])},defaultGroup:es}):(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsx)(l.ScrollArea,{className:"hidden md:block w-44 shrink-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 pr-2",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(i.Button,{variant:"all"!==G||W?"ghost":"secondary",size:"sm",className:"w-full justify-start",onClick:()=>{J("all"),K(""),q("")},children:[(0,t.jsx)(o.FileText,{className:"size-3.5 mr-1.5"}),U("filterAll")]}),(0,t.jsxs)(i.Button,{variant:"favorites"===G?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{J("favorites"),K(""),q("")},children:[(0,t.jsx)(x.Star,{className:"size-3.5 mr-1.5"}),U("filterFavorites")]})]}),c.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:U("filterByAgent")}),c.map(e=>(0,t.jsxs)(i.Button,{variant:"agent"===G&&H===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{J("agent"),K(e.id),q("")},children:[(0,t.jsx)(u.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))]}),ed.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:U("filterGroups")}),ed.map(e=>(0,t.jsxs)(i.Button,{variant:W===e?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{q(W===e?"":e),J("all"),K("")},children:[(0,t.jsx)(d.Folder,{className:"size-3.5 mr-1.5"}),(0,t.jsx)("span",{className:"truncate",children:e})]},e)),r.some(e=>!e.group)&&(0,t.jsxs)(i.Button,{variant:"__none__"===W?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{q("__none__"===W?"":"__none__"),J("all"),K("")},children:[(0,t.jsx)(o.FileText,{className:"size-3.5 mr-1.5"}),U("filterNoGroup")]})]})]})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3 min-h-0",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(m.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{value:_,onChange:e=>E(e.target.value),placeholder:U("search"),className:"pl-8"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,S.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"!==G||W?"text-muted-foreground hover:text-foreground":"bg-muted"),onClick:()=>{J("all"),K(""),q("")},children:U("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,S.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===G?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{J("favorites"),K(""),q("")},children:[(0,t.jsx)(x.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),U("filterFavorites")]})]})})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(m.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{value:_,onChange:e=>E(e.target.value),placeholder:U("search"),className:"pl-8"})]}),(0,t.jsx)(l.ScrollArea,{className:"flex-1 min-h-0",children:z?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:R("loading")}):0===em.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:U("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:em.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>F(e),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),e.group&&(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e.group}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent cursor-pointer",onClick:t=>{t.stopPropagation(),D(e)},children:e.favorited?(0,t.jsx)(x.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(f.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.content.slice(0,120).replace(/^#\s+/,"")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:()=>B(e),children:[(0,t.jsx)(y.Rocket,{className:"size-3.5 mr-1"}),U("apply")]}),(0,t.jsxs)(h.DropdownMenu,{children:[(0,t.jsx)(h.DropdownMenuTrigger,{render:(0,t.jsx)(i.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(N.MoreVertical,{className:"size-3.5"})}),(0,t.jsxs)(h.DropdownMenuContent,{align:"end",children:[(0,t.jsxs)(h.DropdownMenuItem,{onClick:()=>fetch(`/api/skills/${encodeURIComponent(e.name)}/reveal`,{method:"POST"}),children:[(0,t.jsx)(k.FolderOpen,{className:"size-3.5 mr-1.5"}),U("revealFolder")]}),(0,t.jsxs)(h.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>$(e),children:[(0,t.jsx)(v.Trash2,{className:"size-3.5 mr-1.5"}),U("delete")]})]})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(u.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})}),(0,t.jsx)("div",{className:"hidden md:flex items-center justify-end gap-3 pt-2 border-t shrink-0",children:(0,t.jsxs)(i.Button,{variant:"outline",size:"sm",onClick:O,disabled:0===em.length,children:[(0,t.jsx)(y.Rocket,{className:"size-3.5 mr-1"}),U("applyAllToAgent")]})})]})]}),(0,t.jsx)(a.Dialog,{open:eo,onOpenChange:ec,children:(0,t.jsxs)(a.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:U("importFromGit")}),(0,t.jsx)(a.DialogDescription,{children:U("importFromGitDesc")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(p.Input,{value:ea,onChange:e=>ei(e.target.value),placeholder:"https://github.com/user/skills-repo.git",onKeyDown:e=>{"Enter"===e.key&&ex()},disabled:el,autoFocus:!0}),(0,t.jsx)(i.Button,{onClick:ex,disabled:el||!ea.trim(),children:el?(0,t.jsx)(C.Loader2,{className:"size-4 animate-spin"}):U("import")})]})]})})]})}var $=e.i(887836),F=e.i(984178),B=e.i(383171),P=e.i(415955),L=e.i(932031),M=e.i(111343),O=e.i(564822);e.i(462506);let U=(0,$.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});function R({node:e,depth:s,selectedPath:n,onSelect:a,expandedPaths:i,toggleExpand:l}){let r=i.has(e.path),o=n===e.path;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,S.cn)("flex items-center gap-1 rounded px-2 py-1 cursor-pointer hover:bg-muted/50 text-sm",o&&"bg-muted"),style:{paddingLeft:`${12*s+8}px`},onClick:()=>{e.isDirectory?l(e.path):a(e)},children:[e.isDirectory&&(0,t.jsx)(L.ChevronRightIcon,{className:(0,S.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",r&&"rotate-90")}),!e.isDirectory&&(0,t.jsx)("span",{className:"size-3.5 shrink-0"}),e.isDirectory?r?(0,t.jsx)(P.FolderOpenIcon,{className:"size-4 text-blue-500 shrink-0"}):(0,t.jsx)(B.FolderIcon,{className:"size-4 text-blue-500 shrink-0"}):(0,t.jsx)(F.FileIcon,{className:"size-4 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]}),e.isDirectory&&r&&e.children.map(e=>(0,t.jsx)(R,{node:e,depth:s+1,selectedPath:n,onSelect:a,expandedPaths:i,toggleExpand:l},e.path))]})}function _({skill:e,content:l,onContentChange:r,onClose:o,onSave:c}){let d=(0,n.useTranslations)("skills"),m=(0,n.useTranslations)("common"),p=(0,O.useIsMobile)(),[h,u]=(0,s.useState)([]),[x,f]=(0,s.useState)(null),[g,j]=(0,s.useState)({}),[y,v]=(0,s.useState)(new Set),[N,k]=(0,s.useState)(!1),[w,b]=(0,s.useState)(new Set),z=(0,s.useRef)(new Set);(0,s.useEffect)(()=>{if(!e)return;f(null),j({}),b(new Set),v(new Set),u([]),z.current=new Set,k(!0);let t=e.name;fetch(`/api/skills/${encodeURIComponent(t)}/files`).then(e=>e.ok?e.json():[]).then(e=>{u(e),v(new Set(e.filter(e=>e.isDirectory&&!e.path.includes("/")).map(e=>e.path)));let s=e.find(e=>"SKILL.md"===e.path&&!e.isDirectory)||e.find(e=>!e.isDirectory);if(!s)return void k(!1);f(s.path);let n=s.path.split("/").map(encodeURIComponent).join("/");fetch(`/api/skills/${encodeURIComponent(t)}/files/${n}`).then(e=>e.ok?e.json():null).then(e=>{e&&(j({[s.path]:e.content}),z.current.add(s.path))}).catch(()=>{}).finally(()=>k(!1))}).catch(()=>{u([]),k(!1)})},[e]);let T=(0,s.useCallback)((e,t)=>{if(z.current.has(t))return;z.current.add(t),k(!0);let s=t.split("/").map(encodeURIComponent).join("/");fetch(`/api/skills/${encodeURIComponent(e)}/files/${s}`).then(e=>e.ok?e.json():null).then(e=>{e&&j(s=>({...s,[t]:e.content}))}).catch(()=>{}).finally(()=>k(!1))},[]),D=(0,s.useMemo)(()=>(function(e){let t=[],s=new Map;for(let n of e){let e=n.path.split("/"),a=t;for(let t=0;t<e.length;t++){let i=e.slice(0,t+1).join("/"),l=t<e.length-1||n.isDirectory,r=a.find(s=>s.name===e[t]);if(r)a=r.children;else{let n={name:e[t],path:i,isDirectory:l,children:[]};a.push(n),l&&s.set(i,n),a=n.children}}}return t})(h),[h]),I=t=>{!t.isDirectory&&(f(t.path),e&&T(e.name,t.path))},A=e=>{v(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},$=x?g[x]??"":"",F=x?({md:"markdown",markdown:"markdown",json:"json",js:"javascript",ts:"typescript",tsx:"typescript",jsx:"javascript",py:"python",sh:"shell",bash:"shell",yaml:"yaml",yml:"yaml",xml:"xml",html:"html",css:"css",sql:"sql"})[x.split(".").pop()?.toLowerCase()||""]||"plaintext":"markdown",B=e=>{if(!x)return;let t=e||"";j(e=>({...e,[x]:t})),b(e=>new Set(e).add(x)),r(t)},P=async()=>{if(!e||!x)return;let t=g[x];if(void 0===t)return;let s=x.split("/").map(encodeURIComponent).join("/");(await fetch(`/api/skills/${encodeURIComponent(e.name)}/files/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})})).ok&&(b(e=>{let t=new Set(e);return t.delete(x),t}),c())},L=(0,s.useMemo)(()=>h.filter(e=>!e.isDirectory),[h]);return(0,t.jsx)(a.Dialog,{open:!!e,onOpenChange:e=>{e||o()},children:(0,t.jsxs)(a.DialogContent,{className:"!w-[85vw] !max-w-[85vw] !h-[85vh] flex flex-col",children:[(0,t.jsx)(a.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(a.DialogTitle,{children:d("editTitle",{name:e?.name||""})}),(0,t.jsx)(a.DialogDescription,{children:d("editDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w.size>0&&(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:[w.size," unsaved"]}),(0,t.jsxs)(i.Button,{size:"sm",onClick:P,disabled:!x||!w.has(x??""),children:[(0,t.jsx)(M.Save,{className:"size-3.5 mr-1"}),m("save")]})]})]})}),p?(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col pt-2",children:[(0,t.jsx)("div",{className:"flex overflow-x-auto border-b gap-0.5 px-1 shrink-0",children:L.map(e=>(0,t.jsx)("button",{className:(0,S.cn)("shrink-0 px-3 py-1.5 text-xs rounded-t transition-colors whitespace-nowrap",x===e.path?"bg-muted font-medium":"text-muted-foreground hover:text-foreground",w.has(e.path)&&'after:content-[""] after:inline-block after:size-1.5 after:bg-orange-500 after:rounded-full after:ml-1'),onClick:()=>I({name:e.name,path:e.path,isDirectory:!1,children:[]}),children:e.name},e.path))}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:N?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsx)(C.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,t.jsx)(U,{height:"100%",language:F,value:$,onChange:B,theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]}):(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex gap-0 pt-2 border rounded-md overflow-hidden",children:[(0,t.jsxs)("div",{className:"w-48 shrink-0 border-r bg-muted/20 overflow-y-auto py-1",children:[D.map(e=>(0,t.jsx)(R,{node:e,depth:0,selectedPath:x??"",onSelect:I,expandedPaths:y,toggleExpand:A},e.path)),0===h.length&&(0,t.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No files"})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:N?(0,t.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,t.jsx)(C.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,t.jsx)(U,{height:"100%",language:F,value:$,onChange:B,theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})]})})}var E=e.i(239340);function G({skill:e,titleOverride:s,descriptionOverride:a,agents:i,selected:l,onToggle:r,onClose:o,onConfirm:c}){let d=(0,n.useTranslations)("skills"),m=(0,n.useTranslations)("common");return(0,t.jsx)(E.AgentPickerDialog,{open:!!e,onClose:o,onConfirm:c,title:s||d("bindTitle",{name:e?.name||""}),description:a||d("bindDescription"),agents:i,selected:l,onToggle:r,cancelText:m("cancel"),confirmText:m("confirm")})}function J({open:e,onOpenChange:s,items:r,selected:o,onToggle:c,onConfirm:d}){let m=(0,n.useTranslations)("skills"),p=(0,n.useTranslations)("common");return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(a.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:m("syncTitle")}),(0,t.jsx)(a.DialogDescription,{children:m("syncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[0===r.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:m("syncEmpty")}):(0,t.jsx)(l.ScrollArea,{className:"max-h-72",children:(0,t.jsx)("div",{className:"space-y-1",children:r.map(e=>{let s=`${e.agentId}::${e.skillName}`;return(0,t.jsxs)("button",{type:"button",onClick:()=>c(e.agentId,e.skillName),className:"flex items-center gap-3 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)("div",{className:(0,S.cn)("flex items-center justify-center size-4 rounded border shrink-0",o.has(s)?"bg-primary border-primary text-primary-foreground":"border-input")}),(0,t.jsx)(u.AgentIcon,{agentId:e.agentId,name:e.agentName,className:"size-5 rounded-full"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.agentName}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs shrink-0",children:[e.skillName,".md"]})]},s)})})}),r.length>0&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>s(!1),children:p("cancel")}),(0,t.jsx)(i.Button,{onClick:d,disabled:0===o.size,children:m("syncConfirm")})]})]})]})})}e.s(["SkillsDialog",0,function({open:e,onOpenChange:h,standalone:u}){let x=(0,n.useTranslations)("skills"),f=(0,n.useTranslations)("common"),[g,j]=(0,s.useState)("local"),{skills:y,setSkills:v,agents:N,loading:k,fetchSkills:w,storeSkills:b,storeLoading:C,importingPaths:S,importFromStore:z}=function(e,t){let[n,a]=(0,s.useState)([]),[i,l]=(0,s.useState)([]),[r,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)([]),[m,p]=(0,s.useState)(!1),[h,u]=(0,s.useState)(new Set),x=(0,s.useCallback)(async()=>{o(!0);try{let e=await fetch("/api/skills");e.ok&&a(await e.json())}catch{}o(!1)},[]),f=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();l(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]),g=(0,s.useCallback)(async()=>{p(!0);try{let e=await fetch("/public/skills/index.json");e.ok&&d(await e.json())}catch{}p(!1)},[]);(0,s.useEffect)(()=>{(e||t)&&(x(),f(),g())},[e,t,x,f,g]);let j=new Set(n.map(e=>e.name)),y=async e=>{if(j.has(e.id)||h.has(e.path))return!1;u(t=>new Set(t).add(e.path));try{if((await fetch("/api/skills/import-store",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.path,group:e.group})})).ok)return await x(),!0}catch{}return u(t=>{let s=new Set(t);return s.delete(e.path),s}),!1};return{skills:n,setSkills:a,agents:i,loading:r,fetchSkills:x,storeSkills:c,storeLoading:m,importingPaths:h,importFromStore:y}}(e,u),T={toggleFavorite:async e=>{try{let t=await fetch(`/api/skills/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();v(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},deleteSkill:async e=>{try{(await fetch(`/api/skills/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&v(t=>t.filter(t=>t.name!==e.name))}catch{}},saveEdit:async(e,t)=>{try{if((await fetch(`/api/skills/${encodeURIComponent(e)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})})).ok)return v(s=>s.map(s=>s.name===e?{...s,content:t}:s)),!0}catch{}return!1},importBatch:async e=>{let t=e.map(e=>({name:e.name,content:e.content,group:e.group}));try{(await fetch("/api/skills/import-batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t})})).ok&&w()}catch{}},importFromGit:async e=>{try{let t=await fetch("/api/skills/import-git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})});if(!t.ok)return null;return(await t.json()).map(e=>({id:`git-${e.name}-${Math.random().toString(36).slice(2,8)}`,name:e.name,group:"",content:e.content,selected:!0,sourceName:e.name}))}catch{}return null},bindConfirm:async(e,t,s)=>{for(let n of s){let s=e.boundAgents.some(e=>e.id===n.id),a=t.includes(n.id);if(s&&!a){let t=await fetch(`/api/agents/presets/${n.id}`);if(!t.ok)continue;let s=await t.json(),a=(s.skills||[]).filter(t=>t.replace(/\.md$/i,"")!==e.name);await fetch(`/api/agents/presets/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:a})})}else if(!s&&a){let t=await fetch(`/api/agents/presets/${n.id}`);if(!t.ok)continue;let s=await t.json();if(!(s.skills||[]).map(e=>e.replace(/\.md$/i,"")).includes(e.name)){let t=[...s.skills||[],e.name];await fetch(`/api/agents/presets/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:t})})}}}w()},applyAllToAgent:async(e,t)=>{try{let s=await fetch(`/api/agents/presets/${e}`);if(!s.ok)return;let n=await s.json(),a=new Set((n.skills||[]).map(e=>e.replace(/\.md$/i,""))),i=[...n.skills||[]];for(let e of t)a.has(e)||i.push(e);await fetch(`/api/agents/presets/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,skills:i})}),w()}catch{}},syncCheck:async()=>{let e=await fetch("/api/skills/sync-check");return e.ok?e.json():[]},syncConfirm:async e=>{let t=await fetch("/api/skills/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e.map(e=>({agentId:e.agentId,skillName:e.skillName}))})});return t.ok&&w(),t.ok}},[D,I]=(0,s.useState)(null),[$,F]=(0,s.useState)(""),[B,P]=(0,s.useState)(null),[L,M]=(0,s.useState)([]),[O,U]=(0,s.useState)([]),[R,E]=(0,s.useState)(new Set),[H,K]=(0,s.useState)(!1),[W,q]=(0,s.useState)(!1),[V,Z]=(0,s.useState)(""),[Q,X]=(0,s.useState)(""),Y="__bind_all__",ee=B?.name===Y,et=async()=>{!D||await T.saveEdit(D.name,$)&&I(null)},es=async()=>{if(B){if(ee){let e=y.map(e=>e.name);for(let t of L)await T.applyAllToAgent(t,e)}else await T.bindConfirm(B,L,N);P(null)}},en=async()=>{q(!0);let e=await T.syncCheck();e.length>0&&(U(e),E(new Set(e.map(e=>`${e.agentId}::${e.skillName}`))),K(!0)),q(!1)},ea=async()=>{let e=O.filter(e=>R.has(`${e.agentId}::${e.skillName}`));0===e.length||await T.syncConfirm(e)&&K(!1)},ei=(u||e)&&!B&&!D,el=Array.from(new Set(b.map(e=>e.group).filter(Boolean))),er=new Set(y.map(e=>e.name)),eo=b.filter(e=>{if(V&&e.group!==V)return!1;if(Q){let t=Q.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.id.toLowerCase().includes(t)&&!e.group.toLowerCase().includes(t))return!1}return!0}),ec=async e=>{await z(e)},ed=(0,t.jsx)("div",{className:"flex items-center gap-1 border-b border-border px-1",children:[["local",o.FileText,x("tabLocal")],["store",r.Store,x("tabStore")]].map(([e,s,n])=>(0,t.jsxs)("button",{onClick:()=>j(e),className:`flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g===e?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[(0,t.jsx)(s,{className:"size-3.5"}),n]},e))}),em=(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[el.length>0&&(0,t.jsx)(l.ScrollArea,{className:"hidden md:block w-44 shrink-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1 pr-2",children:[(0,t.jsxs)(i.Button,{variant:V?"ghost":"secondary",size:"sm",className:"w-full justify-start",onClick:()=>Z(""),children:[(0,t.jsx)(o.FileText,{className:"size-3.5 mr-1.5"}),x("filterAll")]}),el.map(e=>(0,t.jsxs)(i.Button,{variant:V===e?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>Z(V===e?"":e),children:[(0,t.jsx)(d.Folder,{className:"size-3.5 mr-1.5"}),(0,t.jsx)("span",{className:"truncate",children:e})]},e))]})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"relative mb-3",children:[(0,t.jsx)(m.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{value:Q,onChange:e=>X(e.target.value),placeholder:x("search"),className:"pl-8"})]}),(0,t.jsx)(l.ScrollArea,{className:"flex-1",children:C?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:f("loading")}):0===eo.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:x("storeEmpty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:eo.map(e=>{let s=er.has(e.id),n=S.has(e.path);return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors",children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(r.Store,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e.group})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.id})]}),(0,t.jsx)(i.Button,{variant:s?"ghost":"outline",size:"sm",className:"shrink-0",disabled:s||n,onClick:()=>ec(e),children:s?x("imported"):n?x("importing"):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.Download,{className:"size-3.5 mr-1"}),x("importTo")]})})]})},e.path)})})})]})]}),ep=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.DialogHeader,{children:(0,t.jsxs)("div",{className:"hidden md:block",children:[u?(0,t.jsx)("h2",{className:"text-base font-semibold",children:x("title")}):(0,t.jsx)(a.DialogTitle,{children:x("title")}),u?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("description")}):(0,t.jsx)(a.DialogDescription,{children:x("description")})]})}),ed,(0,t.jsx)("div",{className:"flex flex-1 min-h-0 flex-col",children:"local"===g?(0,t.jsx)(A,{skills:y,agents:N,loading:k,syncLoading:W,onToggleFavorite:T.toggleFavorite,onDelete:T.deleteSkill,onEdit:e=>{I(e),F(e.content)},onBind:e=>{P(e),M(e.boundAgents.map(e=>e.id))},onImportBatch:T.importBatch,onImportFromGit:T.importFromGit,onSyncCheck:en,onBindAll:()=>{P({name:Y,description:"",filename:"",content:"",favorited:!1,group:"",boundAgents:[]}),M([])}}):em})]});return(0,t.jsxs)(t.Fragment,{children:[u&&ei&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ep}),!u&&(0,t.jsx)(a.Dialog,{open:ei,onOpenChange:h,children:(0,t.jsx)(a.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col overflow-hidden",children:ep})}),(0,t.jsx)(_,{skill:D,content:$,onContentChange:F,onClose:()=>I(null),onSave:et}),(0,t.jsx)(G,{skill:B,titleOverride:ee?x("applyAllToAgent"):void 0,descriptionOverride:ee?x("applyAllToAgentDescription"):void 0,agents:N,selected:L,onToggle:e=>M(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),onClose:()=>P(null),onConfirm:es}),(0,t.jsx)(J,{open:H,onOpenChange:K,items:O,selected:R,onToggle:(e,t)=>{let s=`${e}::${t}`;E(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},onConfirm:ea})]})}],625873)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,386041,e=>{"use strict";let t=(0,e.i(433721).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);e.s(["Code2",0,t],386041)},194228,e=>{"use strict";let t=(0,e.i(433721).default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);e.s(["GitCommitHorizontal",0,t],194228)},363156,e=>{"use strict";var t=e.i(816709);let r=/not a git repository/i;function i(e){return e instanceof Error&&r.test(e.message)}let s=(0,t.create)(e=>({status:null,diffs:[],selectedFile:null,log:[],branches:[],loading:!1,error:null,notGitRepo:!1,commitMsg:"",loadStatus:async t=>{try{let r=await fetch(`/api/workspaces/${t}/git/status`);if(!r.ok)throw Error(await r.text());let i=await r.json();e({status:i,notGitRepo:!1})}catch(t){e({error:t instanceof Error?t.message:String(t),notGitRepo:i(t)})}},loadDiffs:async(t,r)=>{e({loading:!0});try{let i=r?`/api/workspaces/${t}/git/diff?path=${encodeURIComponent(r)}`:`/api/workspaces/${t}/git/diff`,s=await fetch(i);if(!s.ok)throw Error(await s.text());let a=await s.json();e({diffs:a,loading:!1,notGitRepo:!1})}catch(t){e({error:t instanceof Error?t.message:String(t),loading:!1,notGitRepo:i(t)})}},loadLog:async t=>{try{let r=await fetch(`/api/workspaces/${t}/git/log`);if(!r.ok)throw Error(await r.text());let i=await r.json();e({log:i,notGitRepo:!1})}catch(t){e({error:t instanceof Error?t.message:String(t),notGitRepo:i(t)})}},loadBranches:async t=>{try{let r=await fetch(`/api/workspaces/${t}/git/branches`);if(!r.ok)throw Error(await r.text());let i=await r.json();e({branches:i,notGitRepo:!1})}catch(t){e({error:t instanceof Error?t.message:String(t),notGitRepo:i(t)})}},initRepo:async t=>{try{let r=await fetch(`/api/workspaces/${t}/git/init`,{method:"POST"});if(!r.ok)throw Error(await r.text());e({error:null,notGitRepo:!1})}catch(t){e({error:t instanceof Error?t.message:String(t)})}},commit:async(t,r)=>{try{let e=await fetch(`/api/workspaces/${t}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:r})});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},discard:async(t,r)=>{try{let e=await fetch(`/api/workspaces/${t}/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},discardAll:async t=>{try{let e=await fetch(`/api/workspaces/${t}/git/discard-all`,{method:"POST"});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},stage:async(t,r)=>{try{let e=await fetch(`/api/workspaces/${t}/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},unstage:async(t,r)=>{try{let e=await fetch(`/api/workspaces/${t}/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},resolveFile:async(e,t,r,i=!0)=>{let s=await fetch(`/api/workspaces/${e}/git/resolve-file`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,content:r,stage:i})});if(!s.ok)throw Error(await s.text())},checkout:async(t,r)=>{try{let e=await fetch(`/api/workspaces/${t}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:r})});if(!e.ok)throw Error(await e.text())}catch(t){e({error:t instanceof Error?t.message:String(t)})}},push:async e=>{let t=await fetch(`/api/workspaces/${e}/git/push`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Push failed"}))).error)},pull:async e=>{let t=await fetch(`/api/workspaces/${e}/git/pull`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Pull failed"}))).error)},fetchRemote:async e=>{let t=await fetch(`/api/workspaces/${e}/git/fetch`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({error:"Fetch failed"}))).error)},getRemotes:async e=>{let t=await fetch(`/api/workspaces/${e}/git/remotes`);if(!t.ok)throw Error(await t.text());return t.json()},addRemote:async(e,t,r)=>{let i=await fetch(`/api/workspaces/${e}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,url:r})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Failed to add remote"}))).error)},selectFile:t=>e({selectedFile:t}),setCommitMsg:t=>e({commitMsg:t}),checkoutDetached:async(e,t)=>{let r=await fetch(`/api/workspaces/${e}/git/checkout-detached`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:t})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error)},cherryPick:async(e,t)=>{let r=await fetch(`/api/workspaces/${e}/git/cherry-pick`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:t})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error)},createBranch:async(e,t,r)=>{let i=await fetch(`/api/workspaces/${e}/git/create-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,startPoint:r})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},deleteBranch:async(e,t,r)=>{let i=await fetch(`/api/workspaces/${e}/git/delete-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,force:r})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},createTag:async(e,t,r)=>{let i=await fetch(`/api/workspaces/${e}/git/create-tag`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,commitHash:r})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},getCommitDiff:async(e,t)=>{let r=await fetch(`/api/workspaces/${e}/git/commit-diff?hash=${encodeURIComponent(t)}`);if(!r.ok)throw Error((await r.json().catch(()=>({}))).error);return r.json()},getRemoteUrl:async e=>{let t=await fetch(`/api/workspaces/${e}/git/remote-url`);if(!t.ok)throw Error((await t.json().catch(()=>({}))).error);return(await t.json()).url},getMergeBase:async e=>{let t=await fetch(`/api/workspaces/${e}/git/merge-base`);if(!t.ok)throw Error((await t.json().catch(()=>({}))).error);return(await t.json()).hash}}));e.s(["useGitStore",0,s])},253307,e=>{"use strict";let t=(0,e.i(433721).default)("file-diff",[["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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);e.s(["FileDiff",0,t],253307)},524360,e=>{"use strict";var t=e.i(816709),r=e.i(360112);let i=new Map,s=(0,t.create)((e,t)=>({sessions:[],activeId:null,ws:null,workspaceId:null,_initialized:!1,_restored:!1,init:(s,a)=>{let o=t();if(o._initialized&&o.ws===s)return;let n=o.workspaceId!==s.workspaceId;n&&i.clear(),e({ws:s,workspaceId:s.workspaceId,sessions:n?[]:o.sessions,activeId:n?null:o.activeId,_initialized:!0,_restored:!1}),s.on("terminal.created",t=>{let{sessionId:r,cwd:i,shell:s}=t;e(e=>e.sessions.some(e=>e.id===r)?e:{sessions:[...e.sessions,{id:r,cwd:i,shell:s}],activeId:r})}),s.on("terminal.error",e=>{let{error:t}=e;r.toast.error(t)}),s.on("terminal.closed",t=>{let{sessionId:r}=t;e(e=>{let t=e.sessions.filter(e=>e.id!==r),i=e.activeId===r?t[0]?.id??null:e.activeId;return{sessions:t,activeId:i}})}),s.on("terminal.sessions",t=>{let{sessions:r}=t;e(e=>{let t=new Map(e.sessions.map(e=>[e.id,e])),s=r.map(e=>{let r=t.get(e.sessionId);return e.buffer&&i.set(e.sessionId,e.buffer),{...r,id:e.sessionId,cwd:e.cwd,shell:e.shell??r?.shell}}),a=!!e.activeId&&s.some(t=>t.id===e.activeId);for(let e of r)e.buffer||i.delete(e.sessionId);return{sessions:s,activeId:a?e.activeId:s[0]?.id??null,_restored:!0}}),a?.()})},createSession:(e,r)=>{let{ws:i}=t();i?.send("terminal.create",{sessionId:crypto.randomUUID?.()??crypto.getRandomValues(new Uint8Array(16)).reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),shell:e,cwd:r})},setActive:t=>e({activeId:t}),setSessionName:(t,r)=>e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,name:r}:e)})),removeSession:r=>{let{ws:i,sessions:s,activeId:a}=t();i?.send("terminal.close",{sessionId:r});let o=s.filter(e=>e.id!==r),n=a===r?o[0]?.id??null:a;e({sessions:o,activeId:n})},sendInput:(e,r)=>{t().ws?.send("terminal.input",{sessionId:e,data:r})},resize:(e,r,i)=>{t().ws?.send("terminal.resize",{sessionId:e,cols:r,rows:i})}}));e.s(["consumeSessionBuffer",0,function(e){let t=i.get(e);return i.delete(e),t},"useTerminalStore",0,s])},191441,e=>{"use strict";let t=(0,e.i(433721).default)("list-checks",[["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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]);e.s(["ListChecks",0,t],191441)},404175,e=>{"use strict";var t=e.i(344180),r=e.i(227634),i=e.i(191441),s=e.i(451534),a=e.i(386041),o=e.i(426022),n=e.i(989484),c=e.i(433721);let l=(0,c.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var d=e.i(253307),h=e.i(194228),p=e.i(210),f=e.i(255742),g=e.i(943997);let u=(0,c.default)("kanban",[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]]),m=[{id:"channel-list",icon:r.Hash,group:"channel"},{id:"chat",icon:o.MessageSquare,group:"channel"},{id:"issue-list",icon:i.ListChecks,group:"issue"},{id:"issue-detail",icon:d.FileDiff,group:"issue"},{id:"workfolder",icon:s.FolderOpen,group:"workfolder"},{id:"code-editor",icon:a.Code2,group:"workfolder"},{id:"terminal",icon:l,group:"tools"},{id:"git-commits",icon:h.GitCommitHorizontal,group:"git"},{id:"project-settings",icon:p.Settings2,group:"settings"},{id:"code-favorites",icon:f.Star,group:"workfolder"},{id:"database",icon:g.Database,group:"workfolder"},{id:"kanban",icon:u,group:"workfolder"}],w={"channel-list":(0,t.jsx)(r.Hash,{size:16}),"issue-list":(0,t.jsx)(i.ListChecks,{size:16}),workfolder:(0,t.jsx)(s.FolderOpen,{size:16}),"code-editor":(0,t.jsx)(a.Code2,{size:16}),chat:(0,t.jsx)(o.MessageSquare,{size:16}),"issue-detail":(0,t.jsx)(n.FileText,{size:16}),terminal:(0,t.jsx)(l,{size:16}),"git-commits":(0,t.jsx)(h.GitCommitHorizontal,{size:16}),"project-settings":(0,t.jsx)(p.Settings2,{size:16}),"code-favorites":(0,t.jsx)(f.Star,{size:16}),database:(0,t.jsx)(g.Database,{size:16}),kanban:(0,t.jsx)(u,{size:16}),...{}};function y(e,r,i,s,a){if("git-commits"===e&&r&&!r.clean){let e=r.insertions>0||r.deletions>0,i=(0,t.jsx)("span",{className:"ml-1 text-[10px] font-medium leading-none flex items-center gap-0.5",children:e?(0,t.jsxs)(t.Fragment,{children:[r.insertions>0&&(0,t.jsxs)("span",{className:"text-green-600",children:["+",r.insertions]}),r.deletions>0&&(0,t.jsxs)("span",{className:"text-red-500",children:["-",r.deletions]})]}):(0,t.jsx)("span",{className:"text-orange-500",children:r.files.length})}),s=r.files.length;return{trailing:i,badge:s>0?(0,t.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-blue-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:s}):null}}if("terminal"===e&&i.length>0)return{trailing:null,badge:(0,t.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-green-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:i.length})};let o=(0,t.jsxs)("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]});return"channel-list"===e&&Object.values(s).some(e=>e.some(e=>"streaming"===e.status||"pending"===e.status))||"issue-detail"===e&&a.some(e=>"pending"===e.status||"running"===e.status||"retrying"===e.status||"waiting_review"===e.status)?{trailing:null,badge:o}:{trailing:null,badge:null}}e.s(["RIGHT_TO_LEFT_TAB_MAP",0,{"code-editor":"workfolder",chat:"channel-list","issue-detail":"issue-list",database:"workfolder"},"TAB_ITEMS",0,m,"getTabBadge",0,y,"renderTabIcon",0,function(e,r,i,s,a,o){let n=w[e];if(!n)return null;let{trailing:c,badge:l}=y(e,i,s,a,o);return(0,t.jsxs)("span",{title:r,className:"flex items-center justify-center",children:[(0,t.jsxs)("span",{className:"relative",children:[n,l]}),c]})}],404175)},217061,e=>{"use strict";var t=e.i(344180),r=e.i(250226),i=e.i(363156),s=e.i(524360),a=e.i(31807),o=e.i(873111),n=e.i(465458),c=e.i(404175);e.s(["MobileTabBar",0,function(){let{activePanel:e,setActivePanel:l}=(0,r.useMobilePanelStore)(),d=(0,i.useGitStore)(e=>e.status),h=(0,s.useTerminalStore)(e=>e.sessions),p=(0,a.useChannelStore)(e=>e.messages),f=(0,o.useTaskStore)(e=>e.tasks);return(0,t.jsx)("div",{className:"relative shrink-0 bg-background",children:(0,t.jsx)("div",{className:"flex items-center h-10 border-b px-1 gap-2 shrink-0 overflow-x-auto overflow-y-visible md:hidden",children:c.TAB_ITEMS.map((r,i)=>{let s=r.icon,a=i>0?c.TAB_ITEMS[i-1].group:null,o=null!==a&&a!==r.group,{trailing:g,badge:u}=(0,c.getTabBadge)(r.id,d,h,p,f);return(0,t.jsxs)("div",{className:"flex items-center shrink-0 overflow-visible",children:[o&&(0,t.jsx)("div",{className:"w-px h-4 bg-border mx-0.5"}),(0,t.jsxs)("button",{onClick:()=>{var e;l(e=r.id),c.RIGHT_TO_LEFT_TAB_MAP[e]},className:(0,n.cn)("relative flex items-center justify-center h-8 min-w-8 px-1 rounded-md transition-colors",e===r.id?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50"),children:[(0,t.jsxs)("span",{className:"relative",children:[(0,t.jsx)(s,{size:16}),u]}),g]})]},r.id)})})})}])},404069,e=>{e.n(e.i(217061))}]);
|