agent-tower 0.7.2-beta.7 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +4 -1
- package/dist/app.js.map +1 -1
- package/dist/app.test.js +80 -1
- package/dist/app.test.js.map +1 -1
- package/dist/cli.js +4 -10
- package/dist/cli.js.map +1 -1
- package/dist/core/container.d.ts +8 -0
- package/dist/core/container.d.ts.map +1 -1
- package/dist/core/container.js +42 -0
- package/dist/core/container.js.map +1 -1
- package/dist/core/event-bus.d.ts +2 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/executors/__tests__/image-utils.test.d.ts +2 -0
- package/dist/executors/__tests__/image-utils.test.d.ts.map +1 -0
- package/dist/executors/__tests__/image-utils.test.js +25 -0
- package/dist/executors/__tests__/image-utils.test.js.map +1 -0
- package/dist/executors/base.executor.d.ts +2 -0
- package/dist/executors/base.executor.d.ts.map +1 -1
- package/dist/executors/base.executor.js +6 -0
- package/dist/executors/base.executor.js.map +1 -1
- package/dist/executors/image-utils.d.ts.map +1 -1
- package/dist/executors/image-utils.js +10 -8
- package/dist/executors/image-utils.js.map +1 -1
- package/dist/git/git-cli.d.ts +2 -0
- package/dist/git/git-cli.d.ts.map +1 -1
- package/dist/git/git-cli.js +2 -0
- package/dist/git/git-cli.js.map +1 -1
- package/dist/git/worktree.manager.d.ts +2 -1
- package/dist/git/worktree.manager.d.ts.map +1 -1
- package/dist/git/worktree.manager.js +18 -12
- package/dist/git/worktree.manager.js.map +1 -1
- package/dist/index.js +16 -31
- package/dist/index.js.map +1 -1
- package/dist/mcp/http-client.d.ts +1 -0
- package/dist/mcp/http-client.d.ts.map +1 -1
- package/dist/mcp/http-client.js +3 -0
- package/dist/mcp/http-client.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +15 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/sessions.js +2 -2
- package/dist/mcp/tools/sessions.js.map +1 -1
- package/dist/mcp/tools/workspaces.d.ts.map +1 -1
- package/dist/mcp/tools/workspaces.js +2 -1
- package/dist/mcp/tools/workspaces.js.map +1 -1
- package/dist/middleware/access-auth.d.ts +1 -0
- package/dist/middleware/access-auth.d.ts.map +1 -1
- package/dist/middleware/access-auth.js +1 -1
- package/dist/middleware/access-auth.js.map +1 -1
- package/dist/output/__tests__/text-block-lifecycle.test.d.ts +2 -0
- package/dist/output/__tests__/text-block-lifecycle.test.d.ts.map +1 -0
- package/dist/output/__tests__/text-block-lifecycle.test.js +241 -0
- package/dist/output/__tests__/text-block-lifecycle.test.js.map +1 -0
- package/dist/output/claude-code-parser.d.ts +3 -0
- package/dist/output/claude-code-parser.d.ts.map +1 -1
- package/dist/output/claude-code-parser.js +58 -7
- package/dist/output/claude-code-parser.js.map +1 -1
- package/dist/output/codex-parser.d.ts.map +1 -1
- package/dist/output/codex-parser.js +4 -6
- package/dist/output/codex-parser.js.map +1 -1
- package/dist/output/cursor-agent-parser.d.ts.map +1 -1
- package/dist/output/cursor-agent-parser.js +4 -0
- package/dist/output/cursor-agent-parser.js.map +1 -1
- package/dist/output/gemini-parser.d.ts +18 -0
- package/dist/output/gemini-parser.d.ts.map +1 -0
- package/dist/output/gemini-parser.js +91 -0
- package/dist/output/gemini-parser.js.map +1 -0
- package/dist/output/msg-store.d.ts +6 -0
- package/dist/output/msg-store.d.ts.map +1 -1
- package/dist/output/msg-store.js +17 -0
- package/dist/output/msg-store.js.map +1 -1
- package/dist/output/text-block-tracker.d.ts +29 -0
- package/dist/output/text-block-tracker.d.ts.map +1 -0
- package/dist/output/text-block-tracker.js +149 -0
- package/dist/output/text-block-tracker.js.map +1 -0
- package/dist/output/types.d.ts +9 -0
- package/dist/output/types.d.ts.map +1 -1
- package/dist/output/types.js +0 -4
- package/dist/output/types.js.map +1 -1
- package/dist/routes/__tests__/sessions-runtime.test.js +3 -0
- package/dist/routes/__tests__/sessions-runtime.test.js.map +1 -1
- package/dist/routes/__tests__/team-run-translations.test.d.ts +2 -0
- package/dist/routes/__tests__/team-run-translations.test.d.ts.map +1 -0
- package/dist/routes/__tests__/team-run-translations.test.js +418 -0
- package/dist/routes/__tests__/team-run-translations.test.js.map +1 -0
- package/dist/routes/__tests__/translations.test.d.ts +2 -0
- package/dist/routes/__tests__/translations.test.d.ts.map +1 -0
- package/dist/routes/__tests__/translations.test.js +286 -0
- package/dist/routes/__tests__/translations.test.js.map +1 -0
- package/dist/routes/__tests__/workspaces.test.js +140 -0
- package/dist/routes/__tests__/workspaces.test.js.map +1 -1
- package/dist/routes/conversations.d.ts.map +1 -1
- package/dist/routes/conversations.js +19 -2
- package/dist/routes/conversations.js.map +1 -1
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +2 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +32 -3
- package/dist/routes/sessions.js.map +1 -1
- package/dist/routes/team-runs.d.ts.map +1 -1
- package/dist/routes/team-runs.js +84 -15
- package/dist/routes/team-runs.js.map +1 -1
- package/dist/routes/translations.d.ts +4 -0
- package/dist/routes/translations.d.ts.map +1 -0
- package/dist/routes/translations.js +148 -0
- package/dist/routes/translations.js.map +1 -0
- package/dist/routes/user-input-origin.d.ts +4 -0
- package/dist/routes/user-input-origin.d.ts.map +1 -0
- package/dist/routes/user-input-origin.js +7 -0
- package/dist/routes/user-input-origin.js.map +1 -0
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/routes/workspaces.js +32 -2
- package/dist/routes/workspaces.js.map +1 -1
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.js +2 -2
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.js.map +1 -1
- package/dist/runtime/__tests__/acp-driver-submission.test.d.ts +2 -0
- package/dist/runtime/__tests__/acp-driver-submission.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/acp-driver-submission.test.js +88 -0
- package/dist/runtime/__tests__/acp-driver-submission.test.js.map +1 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.js +244 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.js.map +1 -1
- package/dist/runtime/__tests__/acp-projector.test.js +36 -0
- package/dist/runtime/__tests__/acp-projector.test.js.map +1 -1
- package/dist/runtime/__tests__/claude-cli-control.test.js +20 -0
- package/dist/runtime/__tests__/claude-cli-control.test.js.map +1 -1
- package/dist/runtime/__tests__/cli-driver-submission.test.d.ts +2 -0
- package/dist/runtime/__tests__/cli-driver-submission.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/cli-driver-submission.test.js +61 -0
- package/dist/runtime/__tests__/cli-driver-submission.test.js.map +1 -0
- package/dist/runtime/__tests__/codex-cli-control.test.js +25 -0
- package/dist/runtime/__tests__/codex-cli-control.test.js.map +1 -1
- package/dist/runtime/acp/acp-driver.js +38 -1
- package/dist/runtime/acp/acp-driver.js.map +1 -1
- package/dist/runtime/acp/history-reconciler.d.ts.map +1 -1
- package/dist/runtime/acp/history-reconciler.js +95 -36
- package/dist/runtime/acp/history-reconciler.js.map +1 -1
- package/dist/runtime/acp/projector.d.ts +5 -2
- package/dist/runtime/acp/projector.d.ts.map +1 -1
- package/dist/runtime/acp/projector.js +50 -23
- package/dist/runtime/acp/projector.js.map +1 -1
- package/dist/runtime/claude-cli-control.d.ts +4 -1
- package/dist/runtime/claude-cli-control.d.ts.map +1 -1
- package/dist/runtime/claude-cli-control.js +3 -1
- package/dist/runtime/claude-cli-control.js.map +1 -1
- package/dist/runtime/cli-driver.js +21 -7
- package/dist/runtime/cli-driver.js.map +1 -1
- package/dist/runtime/cli-parser.d.ts.map +1 -1
- package/dist/runtime/cli-parser.js +3 -0
- package/dist/runtime/cli-parser.js.map +1 -1
- package/dist/runtime/codex-cli-control.d.ts +4 -1
- package/dist/runtime/codex-cli-control.d.ts.map +1 -1
- package/dist/runtime/codex-cli-control.js +9 -6
- package/dist/runtime/codex-cli-control.js.map +1 -1
- package/dist/runtime/codex-cli-projector.d.ts +1 -1
- package/dist/runtime/codex-cli-projector.d.ts.map +1 -1
- package/dist/runtime/codex-cli-projector.js +4 -2
- package/dist/runtime/codex-cli-projector.js.map +1 -1
- package/dist/runtime/contracts.d.ts +15 -2
- package/dist/runtime/contracts.d.ts.map +1 -1
- package/dist/runtime/runtime-coordinator.d.ts.map +1 -1
- package/dist/runtime/runtime-coordinator.js +34 -1
- package/dist/runtime/runtime-coordinator.js.map +1 -1
- package/dist/services/__tests__/conflict-admission.test.d.ts +2 -0
- package/dist/services/__tests__/conflict-admission.test.d.ts.map +1 -0
- package/dist/services/__tests__/conflict-admission.test.js +37 -0
- package/dist/services/__tests__/conflict-admission.test.js.map +1 -0
- package/dist/services/__tests__/conflict-recovery-key.test.d.ts +2 -0
- package/dist/services/__tests__/conflict-recovery-key.test.d.ts.map +1 -0
- package/dist/services/__tests__/conflict-recovery-key.test.js +143 -0
- package/dist/services/__tests__/conflict-recovery-key.test.js.map +1 -0
- package/dist/services/__tests__/message-delivery.integration.test.d.ts +2 -0
- package/dist/services/__tests__/message-delivery.integration.test.d.ts.map +1 -0
- package/dist/services/__tests__/message-delivery.integration.test.js +1137 -0
- package/dist/services/__tests__/message-delivery.integration.test.js.map +1 -0
- package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts +2 -0
- package/dist/services/__tests__/review-team-user-counterexamples.test.d.ts.map +1 -0
- package/dist/services/__tests__/review-team-user-counterexamples.test.js +200 -0
- package/dist/services/__tests__/review-team-user-counterexamples.test.js.map +1 -0
- package/dist/services/__tests__/session-manager.lifecycle.test.js +37 -0
- package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
- package/dist/services/__tests__/session-manager.team-run.test.js +19 -2
- package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
- package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts +2 -0
- package/dist/services/__tests__/team-initial-delivery.integration.test.d.ts.map +1 -0
- package/dist/services/__tests__/team-initial-delivery.integration.test.js +469 -0
- package/dist/services/__tests__/team-initial-delivery.integration.test.js.map +1 -0
- package/dist/services/__tests__/team-reconciler.service.test.js +102 -101
- package/dist/services/__tests__/team-reconciler.service.test.js.map +1 -1
- package/dist/services/__tests__/team-room-delivery.test.d.ts +2 -0
- package/dist/services/__tests__/team-room-delivery.test.d.ts.map +1 -0
- package/dist/services/__tests__/team-room-delivery.test.js +670 -0
- package/dist/services/__tests__/team-room-delivery.test.js.map +1 -0
- package/dist/services/__tests__/team-user-delivery.integration.test.d.ts +2 -0
- package/dist/services/__tests__/team-user-delivery.integration.test.d.ts.map +1 -0
- package/dist/services/__tests__/team-user-delivery.integration.test.js +622 -0
- package/dist/services/__tests__/team-user-delivery.integration.test.js.map +1 -0
- package/dist/services/__tests__/translation-client.test.d.ts +2 -0
- package/dist/services/__tests__/translation-client.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-client.test.js +240 -0
- package/dist/services/__tests__/translation-client.test.js.map +1 -0
- package/dist/services/__tests__/translation-protection.test.d.ts +2 -0
- package/dist/services/__tests__/translation-protection.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-protection.test.js +156 -0
- package/dist/services/__tests__/translation-protection.test.js.map +1 -0
- package/dist/services/__tests__/translation-queue.test.d.ts +2 -0
- package/dist/services/__tests__/translation-queue.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-queue.test.js +277 -0
- package/dist/services/__tests__/translation-queue.test.js.map +1 -0
- package/dist/services/__tests__/translation-room-admission.test.d.ts +2 -0
- package/dist/services/__tests__/translation-room-admission.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-room-admission.test.js +371 -0
- package/dist/services/__tests__/translation-room-admission.test.js.map +1 -0
- package/dist/services/__tests__/translation-session-blocks.test.d.ts +2 -0
- package/dist/services/__tests__/translation-session-blocks.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-session-blocks.test.js +367 -0
- package/dist/services/__tests__/translation-session-blocks.test.js.map +1 -0
- package/dist/services/__tests__/translation-settings.service.test.d.ts +2 -0
- package/dist/services/__tests__/translation-settings.service.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation-settings.service.test.js +154 -0
- package/dist/services/__tests__/translation-settings.service.test.js.map +1 -0
- package/dist/services/__tests__/translation.service.test.d.ts +2 -0
- package/dist/services/__tests__/translation.service.test.d.ts.map +1 -0
- package/dist/services/__tests__/translation.service.test.js +480 -0
- package/dist/services/__tests__/translation.service.test.js.map +1 -0
- package/dist/services/access-auth.service.d.ts +1 -0
- package/dist/services/access-auth.service.d.ts.map +1 -1
- package/dist/services/access-auth.service.js +8 -0
- package/dist/services/access-auth.service.js.map +1 -1
- package/dist/services/attachment-context.d.ts +7 -1
- package/dist/services/attachment-context.d.ts.map +1 -1
- package/dist/services/attachment-context.js +23 -2
- package/dist/services/attachment-context.js.map +1 -1
- package/dist/services/conflict-admission.d.ts +37 -0
- package/dist/services/conflict-admission.d.ts.map +1 -0
- package/dist/services/conflict-admission.js +97 -0
- package/dist/services/conflict-admission.js.map +1 -0
- package/dist/services/conflict-resolution-context.d.ts +33 -0
- package/dist/services/conflict-resolution-context.d.ts.map +1 -0
- package/dist/services/conflict-resolution-context.js +434 -0
- package/dist/services/conflict-resolution-context.js.map +1 -0
- package/dist/services/message-delivery.service.d.ts +195 -0
- package/dist/services/message-delivery.service.d.ts.map +1 -0
- package/dist/services/message-delivery.service.js +956 -0
- package/dist/services/message-delivery.service.js.map +1 -0
- package/dist/services/project.service.d.ts +1 -1
- package/dist/services/session-manager.d.ts +94 -74
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +91 -17
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/task.service.d.ts +26 -20
- package/dist/services/task.service.d.ts.map +1 -1
- package/dist/services/task.service.js +9 -26
- package/dist/services/task.service.js.map +1 -1
- package/dist/services/team-room-delivery.d.ts +541 -0
- package/dist/services/team-room-delivery.d.ts.map +1 -0
- package/dist/services/team-room-delivery.js +123 -0
- package/dist/services/team-room-delivery.js.map +1 -0
- package/dist/services/team-run.service.d.ts +83 -0
- package/dist/services/team-run.service.d.ts.map +1 -1
- package/dist/services/team-run.service.js +207 -18
- package/dist/services/team-run.service.js.map +1 -1
- package/dist/services/team-scheduler.service.d.ts +3 -0
- package/dist/services/team-scheduler.service.d.ts.map +1 -1
- package/dist/services/team-scheduler.service.js +65 -11
- package/dist/services/team-scheduler.service.js.map +1 -1
- package/dist/services/team-task-input.d.ts +37 -0
- package/dist/services/team-task-input.d.ts.map +1 -0
- package/dist/services/team-task-input.js +98 -0
- package/dist/services/team-task-input.js.map +1 -0
- package/dist/services/team-task-input.service.d.ts +72 -0
- package/dist/services/team-task-input.service.d.ts.map +1 -0
- package/dist/services/team-task-input.service.js +205 -0
- package/dist/services/team-task-input.service.js.map +1 -0
- package/dist/services/translation-client.d.ts +31 -0
- package/dist/services/translation-client.d.ts.map +1 -0
- package/dist/services/translation-client.js +169 -0
- package/dist/services/translation-client.js.map +1 -0
- package/dist/services/translation-errors.d.ts +14 -0
- package/dist/services/translation-errors.d.ts.map +1 -0
- package/dist/services/translation-errors.js +16 -0
- package/dist/services/translation-errors.js.map +1 -0
- package/dist/services/translation-protection.d.ts +27 -0
- package/dist/services/translation-protection.d.ts.map +1 -0
- package/dist/services/translation-protection.js +547 -0
- package/dist/services/translation-protection.js.map +1 -0
- package/dist/services/translation-queue.d.ts +49 -0
- package/dist/services/translation-queue.d.ts.map +1 -0
- package/dist/services/translation-queue.js +211 -0
- package/dist/services/translation-queue.js.map +1 -0
- package/dist/services/translation-settings.service.d.ts +152 -0
- package/dist/services/translation-settings.service.d.ts.map +1 -0
- package/dist/services/translation-settings.service.js +174 -0
- package/dist/services/translation-settings.service.js.map +1 -0
- package/dist/services/translation.service.d.ts +168 -0
- package/dist/services/translation.service.d.ts.map +1 -0
- package/dist/services/translation.service.js +861 -0
- package/dist/services/translation.service.js.map +1 -0
- package/dist/services/workspace.service.d.ts +84 -93
- package/dist/services/workspace.service.d.ts.map +1 -1
- package/dist/services/workspace.service.js +69 -5
- package/dist/services/workspace.service.js.map +1 -1
- package/dist/socket/__tests__/socket-gateway.test.js +131 -1
- package/dist/socket/__tests__/socket-gateway.test.js.map +1 -1
- package/dist/socket/socket-gateway.d.ts +6 -0
- package/dist/socket/socket-gateway.d.ts.map +1 -1
- package/dist/socket/socket-gateway.js +312 -6
- package/dist/socket/socket-gateway.js.map +1 -1
- package/dist/utils/database-runtime.test.js +82 -5
- package/dist/utils/database-runtime.test.js.map +1 -1
- package/dist/utils/database-schema.d.ts +9 -0
- package/dist/utils/database-schema.d.ts.map +1 -0
- package/dist/utils/database-schema.js +434 -0
- package/dist/utils/database-schema.js.map +1 -0
- package/dist/utils/database-schema.test.d.ts +2 -0
- package/dist/utils/database-schema.test.d.ts.map +1 -0
- package/dist/utils/database-schema.test.js +359 -0
- package/dist/utils/database-schema.test.js.map +1 -0
- package/dist/utils/database-team-foundation.test.d.ts +2 -0
- package/dist/utils/database-team-foundation.test.d.ts.map +1 -0
- package/dist/utils/database-team-foundation.test.js +467 -0
- package/dist/utils/database-team-foundation.test.js.map +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +29 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/owned-child-process.test.js +6 -3
- package/dist/utils/owned-child-process.test.js.map +1 -1
- package/dist/utils/text-preview.d.ts +4 -0
- package/dist/utils/text-preview.d.ts.map +1 -0
- package/dist/utils/text-preview.js +21 -0
- package/dist/utils/text-preview.js.map +1 -0
- package/dist/web/assets/AgentDemoPage-BfXkNCdN.js +1 -0
- package/dist/web/assets/{AgentEnvironmentSettingsPage-SnxiaHvN.js → AgentEnvironmentSettingsPage-GHjKIWpb.js} +1 -1
- package/dist/web/assets/AttachmentPreview-CLN1lnLe.js +2 -0
- package/dist/web/assets/BranchSelect-Cofp8vYf.js +1 -0
- package/dist/web/assets/BrandLogo-BUimEX-9.js +1 -0
- package/dist/web/assets/ConversationPage-R7vNaOQv.js +1 -0
- package/dist/web/assets/CreateTaskInput-CasITF8y.js +1 -0
- package/dist/web/assets/{DemoPage-BHbnnZFF.js → DemoPage-DK-ikg1_.js} +3 -3
- package/dist/web/assets/DesignSystemPage-BhjNs2vP.js +12 -0
- package/dist/web/assets/EditableTaskTitle-BJ9Rxggf.js +70 -0
- package/dist/web/assets/{ExecutionPermissionSelector-DcC4IBOF.js → ExecutionPermissionSelector-B8befbxJ.js} +1 -1
- package/dist/web/assets/GeneralSettingsPage-RMN2al8I.js +1 -0
- package/dist/web/assets/{LoadingPreviewPage-dE_jyl19.js → LoadingPreviewPage-BDlf89rJ.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-CIuQ4bvy.js → McpSettingsPage-CPNxFF67.js} +1 -1
- package/dist/web/assets/{MemberAvatar-BG0VDZKf.js → MemberAvatar-YVr_erAr.js} +1 -1
- package/dist/web/assets/MobileTaskDetail-QNUHMq7u.js +3 -0
- package/dist/web/assets/NotificationSettingsPage-BEyuyu3Z.js +1 -0
- package/dist/web/assets/ProfileSettingsPage-CHe4LlRp.js +3 -0
- package/dist/web/assets/ProjectKanbanPage-Bt_01giW.js +12 -0
- package/dist/web/assets/ProjectSettingsPage-cus6Ns97.js +2 -0
- package/dist/web/assets/{ProviderSettingsPage-DLq-GBxp.js → ProviderSettingsPage-DqA_B1Ey.js} +2 -2
- package/dist/web/assets/{SettingsMasterDetail-UfyoKAum.js → SettingsMasterDetail-DjWR9Sqk.js} +1 -1
- package/dist/web/assets/TaskDetail-rEXNe2h3.js +1 -0
- package/dist/web/assets/TeamSettingsPage-DwWROtW6.js +1 -0
- package/dist/web/assets/TranslationSettingsPage-Cod9c4Ug.js +1 -0
- package/dist/web/assets/arc-DEy33vTc.js +1 -0
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BCNj6ZWE.js → architectureDiagram-3BPJPVTR-Ky1D1LBk.js} +1 -1
- package/dist/web/assets/{at-sign-C4VhWike.js → at-sign-C48_y345.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-D1kmB9gz.js → blockDiagram-GPEHLZMM-BNgB7kNT.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-DbWKTkSe.js → c4Diagram-AAUBKEIU-4GMrPMgQ.js} +1 -1
- package/dist/web/assets/channel-DTP-syjA.js +1 -0
- package/dist/web/assets/check-BmiJ7qMY.js +1 -0
- package/dist/web/assets/chevron-down-3y5Aiolp.js +1 -0
- package/dist/web/assets/{chevron-up-DOkDFvIc.js → chevron-up-DqaYcjpq.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-B3TA0-LD.js → chunk-2J33WTMH-C439hRe_.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-CvPTiBSV.js → chunk-4BX2VUAB-D8GK3M3t.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-xGe9Fu9Z.js → chunk-55IACEB6-Dl4UhJ8X.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-H8pz3amK.js → chunk-727SXJPM-BSEeayBq.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-BmYYNxcL.js → chunk-AQP2D5EJ-B6chbZfT.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-BmOEsLTE.js → chunk-FMBD7UC4-DaLkiLdQ.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-C5MfA0xc.js → chunk-ND2GUHAM-DeQwZAAT.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-BcrGYZ7V.js → chunk-QZHKN3VN-CLRr4YRM.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CUKgurLa.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CUKgurLa.js +1 -0
- package/dist/web/assets/code-block-OCS4YCEC-CnoxUpOx.js +2 -0
- package/dist/web/assets/confirm-dialog-ltNBFYCs.js +1 -0
- package/dist/web/assets/content-DPQMfMae.js +2 -0
- package/dist/web/assets/{copy-CdzVE3kf.js → copy-HRMhTkIG.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-CLQ-m71G.js → cose-bilkent-S5V4N54A-C1UiYzfk.js} +1 -1
- package/dist/web/assets/cssMode-DkuSsGeg.js +1 -0
- package/dist/web/assets/{dagre-BM42HDAG-CmDqxOfn.js → dagre-BM42HDAG-CTJpBgye.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-D-fSbEll.js → diagram-2AECGRRQ-Dj1_TEYp.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-HPywThAf.js → diagram-5GNKFQAL-V-KUpwqh.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-DAzLhllz.js → diagram-KO2AKTUF-CXG1ZIeX.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-DXYB9h8L.js → diagram-LMA3HP47-BZSJUwk9.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-vv4kz4Zo.js → diagram-OG6HWLK6-CCr4gq4u.js} +1 -1
- package/dist/web/assets/dialog-CuFEdqLg.js +5 -0
- package/dist/web/assets/{erDiagram-TEJ5UH35-Cu6aVKAa.js → erDiagram-TEJ5UH35-Djtyzh6z.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-BKDe8WSQ.js → flowDiagram-I6XJVG4X-BmSVSiXJ.js} +1 -1
- package/dist/web/assets/{freemarker2-DI2giuAo.js → freemarker2-DdptX5f1.js} +2 -2
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-DMVLzmAE.js → ganttDiagram-6RSMTGT7-r5vQX-b5.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-vogzYdKn.js → gitGraphDiagram-PVQCEYII-Zj9aloh9.js} +1 -1
- package/dist/web/assets/{globe-Rnn-nKw-.js → globe-B9I-jHBB.js} +1 -1
- package/dist/web/assets/handlebars-B34f-LAf.js +1 -0
- package/dist/web/assets/hooks-BLxb16IA.js +1 -0
- package/dist/web/assets/html-CnvOQ63o.js +1 -0
- package/dist/web/assets/htmlMode-RdxZ8Svp.js +1 -0
- package/dist/web/assets/{icon-button-CuSuXgr_.js → icon-button-CYiKa-7C.js} +1 -1
- package/dist/web/assets/index-0XPZayUU.css +1 -0
- package/dist/web/assets/index-B1oVmCie.js +1 -0
- package/dist/web/assets/index-BJObbxud.js +122 -0
- package/dist/web/assets/index-Bhvt-E6d.js +41 -0
- package/dist/web/assets/index-BtUQYU5l.js +1 -0
- package/dist/web/assets/index-CThFsQNP.js +1 -0
- package/dist/web/assets/index-DZLnTISJ.js +1 -0
- package/dist/web/assets/index-DcOU2m2F.js +1 -0
- package/dist/web/assets/{index-CMjLMilU.js → index-Dk3bRQAK.js} +1 -1
- package/dist/web/assets/{index-B88xAivn.js → index-DkRy6eNX.js} +5 -5
- package/dist/web/assets/{infoDiagram-5YYISTIA-CEfSHkNq.js → infoDiagram-5YYISTIA-BHtVaxZx.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BXKZuWtD.js → ishikawaDiagram-YF4QCWOH-BYmwjkbC.js} +5 -5
- package/dist/web/assets/javascript-BhombDEO.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-wsOUYlu7.js → journeyDiagram-JHISSGLW-c8BBqqRS.js} +1 -1
- package/dist/web/assets/jsonMode-BJGOUeaV.js +7 -0
- package/dist/web/assets/{kanban-definition-UN3LZRKU-DNsuvOrU.js → kanban-definition-UN3LZRKU-D4Vr-oFT.js} +1 -1
- package/dist/web/assets/{kbd-B3m64lRd.js → kbd-C88ut3t9.js} +1 -1
- package/dist/web/assets/{key-round-DpYSyeDH.js → key-round-Cjbj2qNa.js} +1 -1
- package/dist/web/assets/{layers-CxqMQVmH.js → layers-eaHAVcc3.js} +1 -1
- package/dist/web/assets/{linear-BmmCZdOQ.js → linear-opi90s0L.js} +1 -1
- package/dist/web/assets/{link-DbSpzB1w.js → link-BSGb85gq.js} +1 -1
- package/dist/web/assets/liquid-Czy1WpPz.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-WhdC7zdf.js → lspLanguageFeatures-DWu2Ubf0.js} +1 -1
- package/dist/web/assets/mdx-DhXfoSnM.js +1 -0
- package/dist/web/assets/menu--sjyisSg.js +1 -0
- package/dist/web/assets/{mermaid-NOHMQCX5-DmKVQY9m.js → mermaid-NOHMQCX5-BSNbBj78.js} +71 -71
- package/dist/web/assets/{message-square-CfNb-MTd.js → message-square-BLEJN6p7.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-0RzXjZ9G.js → mindmap-definition-RKZ34NQL-BN3ZjBh-.js} +1 -1
- package/dist/web/assets/{modal-Kpqn-nDO.js → modal-CSGOqphK.js} +1 -1
- package/dist/web/assets/{monaco-I1fXAMIt.js → monaco-BkuNyOkP.js} +3 -3
- package/dist/web/assets/{paperclip-BBrzKZQC.js → paperclip-CTNoXpUW.js} +1 -1
- package/dist/web/assets/{pencil-pzVKblxj.js → pencil-Cp70ZwtG.js} +1 -1
- package/dist/web/assets/{people-C6b3eeLq.js → people-DT78SebR.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-Bcvzb8TW.js → pieDiagram-4H26LBE5-CfmFHpPI.js} +2 -2
- package/dist/web/assets/popover-BiVxGGgp.js +1 -0
- package/dist/web/assets/python-DIcQDjcf.js +1 -0
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-DwNhxMxj.js → quadrantDiagram-W4KKPZXB-CeaumJAa.js} +1 -1
- package/dist/web/assets/razor-DYK6Rxer.js +1 -0
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-D2wSGYn2.js → requirementDiagram-4Y6WPE33-BWWCDXCE.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-l3LLF--T.js → sankeyDiagram-5OEKKPKP-DAJut743.js} +1 -1
- package/dist/web/assets/search-DniD_AGC.js +1 -0
- package/dist/web/assets/search-field-CQLDXLeA.js +1 -0
- package/dist/web/assets/select-B5RYunTs.js +1 -0
- package/dist/web/assets/{select-DGwKE4l0.js → select-BPdJrr5M.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-BAGsbTS_.js → sequenceDiagram-3UESZ5HK-CynjRGW4.js} +1 -1
- package/dist/web/assets/{server-BIPZ9Ka-.js → server-xswxWpKD.js} +1 -1
- package/dist/web/assets/stateDiagram-AJRCARHV-amAtpx9w.js +1 -0
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-V-lSceg1.js +1 -0
- package/dist/web/assets/{textarea-Bnfq7adW.js → textarea-BVyPl9rM.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-Dt-DcRrG.js → timeline-definition-PNZ67QCA-DZ9W7WlP.js} +1 -1
- package/dist/web/assets/toggles-QcIz43DP.js +1 -0
- package/dist/web/assets/tooltip-CPqGK_WZ.js +1 -0
- package/dist/web/assets/{track-B_K578io.js → track-Ckye0-tt.js} +1 -1
- package/dist/web/assets/{trash-2-ALAYDudv.js → trash-2-CvUJsbtT.js} +1 -1
- package/dist/web/assets/tsMode-c5x0d47n.js +11 -0
- package/dist/web/assets/typescript-i7eYblLt.js +1 -0
- package/dist/web/assets/{upload-D7hKT2VA.js → upload-CsXAmAun.js} +1 -1
- package/dist/web/assets/{use-profiles-Ncqxdw7S.js → use-profiles-DuXaBRju.js} +1 -1
- package/dist/web/assets/{use-projects-Dwy9AfAG.js → use-projects-Ddz0knyr.js} +1 -1
- package/dist/web/assets/{use-providers-BRyZjuBG.js → use-providers-Td1-gyrN.js} +1 -1
- package/dist/web/assets/use-translation-settings-NYM0lmBx.js +1 -0
- package/dist/web/assets/use-workspaces-CdJZLmGh.js +1 -0
- package/dist/web/assets/useNormalizedLogs--RbVywYa.js +1 -0
- package/dist/web/assets/useTokenUsage-DDXf7E4p.js +1 -0
- package/dist/web/assets/{vennDiagram-CIIHVFJN-Cr55FtiY.js → vennDiagram-CIIHVFJN-CB2Ubvy9.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-CtwMk9MJ.js → wardley-L42UT6IY-BXOkk77I.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-BeyHmTu3.js → wardleyDiagram-YWT4CUSO-VA6ywdQQ.js} +1 -1
- package/dist/web/assets/xml-D2EGActB.js +1 -0
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-9g34Lq8E.js → xychartDiagram-2RQKCTM6-FNcvDj5G.js} +1 -1
- package/dist/web/assets/yaml-jeiIZSL4.js +1 -0
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/index.d.ts +1 -0
- package/node_modules/@agent-tower/shared/dist/index.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/index.js +1 -0
- package/node_modules/@agent-tower/shared/dist/index.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +11 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/log-adapter.js +2 -0
- package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts +5 -2
- package/node_modules/@agent-tower/shared/dist/socket/events.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/socket/events.js +2 -0
- package/node_modules/@agent-tower/shared/dist/socket/events.js.map +1 -1
- package/node_modules/@agent-tower/shared/dist/translation.d.ts +306 -0
- package/node_modules/@agent-tower/shared/dist/translation.d.ts.map +1 -0
- package/node_modules/@agent-tower/shared/dist/translation.js +8 -0
- package/node_modules/@agent-tower/shared/dist/translation.js.map +1 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts +23 -0
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261016000000_add_translation_foundation/migration.sql +104 -0
- package/prisma/migrations/20261016010000_add_message_deliveries/migration.sql +158 -0
- package/prisma/migrations/20261019000000_add_room_translation_eligibility/migration.sql +3 -0
- package/prisma/migrations/20261019100000_add_team_delivery_foundation/migration.sql +217 -0
- package/prisma/schema.prisma +224 -0
- package/dist/web/assets/AgentDemoPage-CaR_Yk9_.js +0 -1
- package/dist/web/assets/BranchSelect-D-kqavDG.js +0 -1
- package/dist/web/assets/BrandLogo-CC1alVsd.js +0 -1
- package/dist/web/assets/ConversationPage-RWKLxe1j.js +0 -3
- package/dist/web/assets/CreateTaskInput-SHJ1YpRe.js +0 -1
- package/dist/web/assets/DesignSystemPage-ChCrzeKT.js +0 -12
- package/dist/web/assets/EditableTaskTitle-CGVeZUSt.js +0 -70
- package/dist/web/assets/GeneralSettingsPage-C_tkwpmF.js +0 -1
- package/dist/web/assets/MobileTaskDetail-DxE6ZDAS.js +0 -5
- package/dist/web/assets/NotificationSettingsPage-B-Ot2OMg.js +0 -1
- package/dist/web/assets/ProfileSettingsPage-Dn1lrjJr.js +0 -3
- package/dist/web/assets/ProjectKanbanPage-jcW8sA7x.js +0 -12
- package/dist/web/assets/ProjectSettingsPage-BFPty2eA.js +0 -2
- package/dist/web/assets/TaskDetail-a1jalILy.js +0 -3
- package/dist/web/assets/TeamSettingsPage-BxGc4W7K.js +0 -1
- package/dist/web/assets/arc-dhk0OSs5.js +0 -1
- package/dist/web/assets/channel-K0AG6Tl1.js +0 -1
- package/dist/web/assets/check-DYlb0A_N.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-BTJ44hwx.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-BTJ44hwx.js +0 -1
- package/dist/web/assets/code-block-OCS4YCEC-DLPrDBDy.js +0 -2
- package/dist/web/assets/confirm-dialog-BRkrtULz.js +0 -1
- package/dist/web/assets/content-DPCGELMz.js +0 -2
- package/dist/web/assets/cssMode-ChMyv9Nj.js +0 -1
- package/dist/web/assets/dialog-B_vC5R4B.js +0 -5
- package/dist/web/assets/handlebars-B9tmKQPV.js +0 -1
- package/dist/web/assets/hooks-DK4m7-FN.js +0 -1
- package/dist/web/assets/html-B_E2U0g5.js +0 -1
- package/dist/web/assets/htmlMode-DRHM_Cwq.js +0 -1
- package/dist/web/assets/index-B6Lvy5Sr.js +0 -1
- package/dist/web/assets/index-BCV57B4O.js +0 -41
- package/dist/web/assets/index-CTG-4w90.js +0 -1
- package/dist/web/assets/index-Cz73HpYH.js +0 -122
- package/dist/web/assets/index-CzvAGoau.css +0 -1
- package/dist/web/assets/index-DENY_U7o.js +0 -1
- package/dist/web/assets/index-ZO2tqdha.js +0 -1
- package/dist/web/assets/javascript-ClWqjgn3.js +0 -1
- package/dist/web/assets/jsonMode-DVAoDfae.js +0 -7
- package/dist/web/assets/liquid-CZf3xdoq.js +0 -1
- package/dist/web/assets/mdx-xzVEPP01.js +0 -1
- package/dist/web/assets/menu-0A0v_lRV.js +0 -1
- package/dist/web/assets/popover-BYz89aiY.js +0 -1
- package/dist/web/assets/python-DL05HvW4.js +0 -1
- package/dist/web/assets/razor-BCZ3_uDf.js +0 -1
- package/dist/web/assets/search-field-B5czD2Pl.js +0 -1
- package/dist/web/assets/select-yem-xN9Z.js +0 -1
- package/dist/web/assets/stateDiagram-AJRCARHV-C0BHmXYX.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Be3UCkeQ.js +0 -1
- package/dist/web/assets/toggles-DxNDJZsN.js +0 -1
- package/dist/web/assets/tooltip-CHOgkFbE.js +0 -1
- package/dist/web/assets/tsMode-kXxq-Lw7.js +0 -11
- package/dist/web/assets/typescript-E3_QcT_u.js +0 -1
- package/dist/web/assets/use-attachments-CK7y5KsN.js +0 -2
- package/dist/web/assets/use-workspaces-BBbahdwU.js +0 -1
- package/dist/web/assets/useNormalizedLogs-CRHRedwp.js +0 -1
- package/dist/web/assets/useTokenUsage-YwiF0xnT.js +0 -1
- package/dist/web/assets/xml-DxKND8qX.js +0 -1
- package/dist/web/assets/yaml-BqpCqTY6.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as te,a as ne,d as le,e as ie,f as re,g as oe,h as ce,r as t,t as m,j as s,i as de,k as ue,l as A,m as G,B as p,I as z}from"./index-Cz73HpYH.js";import{S as U}from"./select-DGwKE4l0.js";import{T as me}from"./textarea-Bnfq7adW.js";import{S as pe}from"./toggles-DxNDJZsN.js";import{u as ge}from"./use-providers-BRyZjuBG.js";import"./select-yem-xN9Z.js";import"./menu-styles-DWynpVVz.js";import"./index-B6Lvy5Sr.js";import"./check-DYlb0A_N.js";import"./index-ZO2tqdha.js";import"./index-BCV57B4O.js";import"./index-CTG-4w90.js";import"./index-CMjLMilU.js";import"./index-DENY_U7o.js";const fe=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],N="__follow_task__",R=8;function W(P,y){return P instanceof Error?P.message:y}function _e(){const{locale:P,setLocale:y,t:e}=te(),{data:g}=ne(),{data:H}=ge(),{data:w}=le(),{data:r}=ie(),u=re(),i=oe(),S=ce(),[K,D]=t.useState(N),[E,k]=t.useState(""),[V,j]=t.useState(!1),[d,_]=t.useState(""),[o,L]=t.useState(""),[C,I]=t.useState(""),[M,f]=t.useState(!1),[q,h]=t.useState(!1),[b,l]=t.useState(null);t.useEffect(()=>{!g||!w||(D(g.commitMessageProviderId||N),k(g.commitMessagePrompt||w.prompt),j(!1))},[g,w]),t.useEffect(()=>{r&&(f(r.enabled),h(!1),l(null),_(""),L(""),I(""))},[r?.enabled]);const J=[{value:N,label:e("跟随任务")},...(H??[]).filter(a=>a.availability.type!=="NOT_FOUND").map(a=>({value:a.provider.id,label:a.provider.name}))],x=r?.enabled??!1,n=!x&&M?"enable":x&&!M?"disable":x&&q?"change":"idle",O=n!=="idle",Q=e(O?n==="disable"?"将关闭":n==="enable"?"将启用":"已启用":x?"已启用":"未启用"),X=t.useCallback(a=>{D(a);const v=a===N?null:a;u.mutate({commitMessageProviderId:v},{onError:()=>m.error(e("保存失败"))})},[u,e]),Y=t.useCallback(()=>{const a=E.trim()||null;u.mutate({commitMessagePrompt:a},{onSuccess:()=>{j(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[E,u,e]),c=t.useCallback(()=>{_(""),L(""),I("")},[]),Z=t.useCallback(()=>{f(r?.enabled??!1),h(!1),l(null),c()},[r?.enabled,c]),F=t.useCallback(a=>{if((a==="change"||a==="disable")&&!d)return l(e("请输入当前密码")),!1;if(a==="enable"||a==="change"){if(o.length<R)return l(e("密码至少需要 8 个字符")),!1;if(o!==C)return l(e("两次输入不一致")),!1}return l(null),!0},[C,d,o,e]),B=t.useCallback(()=>{if(n==="idle"||!F(n))return;const a=n==="disable"?{enabled:!1,currentPassword:d}:n==="enable"?{enabled:!0,newPassword:o}:{currentPassword:d,newPassword:o};i.mutate(a,{onSuccess:v=>{f(v.enabled),h(!1),l(null),c(),m.success(e(n==="disable"?"已关闭":"已保存"))},onError:v=>{const T=W(v,e("保存失败"));T.toLowerCase().includes("current password")?l(e("当前密码不正确")):T.toLowerCase().includes("at least 8")?l(e("密码至少需要 8 个字符")):l(T)}})},[n,c,d,o,e,i,F]),$=t.useCallback(a=>{!r||i.isPending||(f(a),h(!1),l(null),c())},[r,c,i.isPending]),ee=t.useCallback(()=>{S.mutate(void 0,{onSuccess:()=>m.success(e("已退出登录")),onError:a=>m.error(W(a,e("退出登录失败")))})},[S,e]),se=t.useCallback(a=>{a.preventDefault(),B()},[B]),ae=t.useCallback(()=>{!r||i.isPending||(f(!0),h(!0),l(null),c())},[r,c,i.isPending]);return s.jsxs(de,{children:[s.jsx(ue,{title:e("通用设置"),className:"mb-1"}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:s.jsx(U,{value:P,onChange:a=>y(a),options:fe})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("访问安全")}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("访问密码"),description:e("开启后,进入 Agent Tower 需要输入密码。"),controlWidth:"fixed",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:Q}),s.jsx(pe,{checked:M,onCheckedChange:$,disabled:!r||i.isPending,"aria-label":e("访问密码")})]}),x&&n==="idle"&&s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[s.jsx(p,{type:"button",size:"sm",variant:"outline",className:"w-full sm:w-auto",onClick:ae,disabled:i.isPending,children:e("修改密码")}),s.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:ee,disabled:S.isPending,children:S.isPending?e("退出中..."):e("退出登录")})]}),O&&s.jsxs("form",{className:"space-y-2",onSubmit:se,children:[(n==="change"||n==="disable")&&s.jsx(z,{type:"password",autoComplete:"current-password",placeholder:e("当前密码"),value:d,onChange:a=>{_(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&!d)}),(n==="enable"||n==="change")&&s.jsxs(s.Fragment,{children:[s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e(n==="enable"?"访问密码":"新密码"),value:o,onChange:a=>{L(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o.length<R)}),s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e("确认密码"),value:C,onChange:a=>{I(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o!==C)})]}),(n==="change"||n==="disable")&&s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e(n==="disable"?"关闭后不再要求访问密码。":"保存后其他已登录页面需要重新输入。")}),b&&s.jsx("p",{className:"text-xs text-destructive-ink",children:b}),s.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-1 sm:flex-row sm:justify-end",children:[s.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:Z,disabled:i.isPending,children:e("取消")}),s.jsx(p,{type:"submit",size:"sm",className:"w-full sm:w-auto",disabled:i.isPending,children:i.isPending?e("保存中..."):e(n==="disable"?"关闭访问密码":"保存")})]})]})]})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("Git Commit Message")}),s.jsxs("div",{className:"divide-y divide-border/60",children:[s.jsx(A,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:s.jsx(U,{value:K,onChange:X,options:J})}),s.jsx(A,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{value:E,onChange:a=>{k(a.target.value),j(!0)},rows:5,className:"font-mono resize-y"}),V&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(p,{size:"sm",variant:"ghost",onClick:()=>{k(g?.commitMessagePrompt||w?.prompt||""),j(!1)},children:e("取消")}),s.jsx(p,{size:"sm",onClick:Y,disabled:u.isPending,children:u.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{_e as GeneralSettingsPage};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{u as F,j as e,S as $,r as n,ay as Ce,n as ke,v as Ls,s as Qe,az as ye,ao as bt,q as vt,ai as jt,aj as yt,ak as Nt,aA as kt,al as Ct,am as wt,an as L,w as As,B as He,at as Rs,au as It,av as St,aw as oe,V as At}from"./index-Cz73HpYH.js";import{a as Ts,Q as Rt,s as Tt}from"./mermaid-NOHMQCX5-DmKVQY9m.js";import{u as Et,a as Pt,R as Mt,P as Ot,T as Lt}from"./useTokenUsage-YwiF0xnT.js";import{u as Dt,a as Wt,L as Es,T as Ps}from"./useNormalizedLogs-CRHRedwp.js";import{g as zt}from"./ExecutionPermissionSelector-DcC4IBOF.js";import{u as Bt,A as Ft}from"./use-attachments-CK7y5KsN.js";import{u as Gt,a as qt,b as Ut,d as Vt,e as Ht,S as Ms}from"./CreateTaskInput-SHJ1YpRe.js";import{b as Ds,G as Xe,m as $t,D as Ws,n as Kt,o as _t,p as Qt,u as Xt,r as Yt,g as Ne,c as Zt,e as Jt,a as en,f as sn,W as tn,E as nn,h as rn,S as on,R as an,T as ln,j as cn,q as dn,s as un,i as mn,k as xn,l as pn}from"./EditableTaskTitle-CGVeZUSt.js";import{F as zs,H as Bs,a as Fs,C as fn,P as $e}from"./content-DPCGELMz.js";import{C as we}from"./index-B6Lvy5Sr.js";import{a as hn,b as gn,c as bn}from"./use-workspaces-BBbahdwU.js";import{u as vn}from"./use-providers-BRyZjuBG.js";import{D as jn}from"./ProjectKanbanPage-jcW8sA7x.js";import{M as Gs}from"./message-square-CfNb-MTd.js";import{T as yn}from"./trash-2-ALAYDudv.js";import{P as Nn}from"./paperclip-BBrzKZQC.js";import"./tooltip-CHOgkFbE.js";import"./kbd-B3m64lRd.js";import"./index-CTG-4w90.js";import"./index-CMjLMilU.js";import"./menu-0A0v_lRV.js";import"./menu-styles-DWynpVVz.js";import"./check-DYlb0A_N.js";import"./index-ZO2tqdha.js";import"./index-BCV57B4O.js";import"./index-DENY_U7o.js";import"./track-B_K578io.js";import"./use-projects-Dwy9AfAG.js";import"./MemberAvatar-BG0VDZKf.js";import"./people-C6b3eeLq.js";import"./BrandLogo-CC1alVsd.js";import"./hooks-DK4m7-FN.js";import"./chevron-up-DOkDFvIc.js";import"./at-sign-C4VhWike.js";import"./confirm-dialog-BRkrtULz.js";import"./dialog-B_vC5R4B.js";import"./modal-Kpqn-nDO.js";import"./select-DGwKE4l0.js";import"./select-yem-xN9Z.js";import"./layers-CxqMQVmH.js";import"./textarea-Bnfq7adW.js";import"./server-BIPZ9Ka-.js";import"./icon-button-CuSuXgr_.js";import"./search-field-B5czD2Pl.js";import"./popover-BYz89aiY.js";import"./upload-D7hKT2VA.js";import"./globe-Rnn-nKw-.js";import"./BranchSelect-D-kqavDG.js";import"./pencil-pzVKblxj.js";import"./copy-CdzVE3kf.js";function kn(s){const o=s.split("/");return o[o.length-1]||s}function Cn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function wn({workingDir:s,filePath:o,type:l}){const{t:c}=F(),{data:b,isLoading:d,isError:g}=$t(s,o,l);if(d)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx($,{}),e.jsx("span",{className:"text-xs",children:c("Loading diff...")})]});if(g)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:c("Failed to load diff.")});const a=b?.diff||"";if(!a.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:c("No diff content available.")});const h=a.split(`
|
|
2
|
-
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:h.map((x,y)=>e.jsx(Ws,{line:x,lineNum:y+1},y))})})}function In({entry:s,type:o,workingDir:l}){const[c,b]=n.useState(!1),d=Cn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>b(g=>!g),className:ke("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-accent",c&&"bg-muted/50"),children:[e.jsx(zs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:kn(s.path)}),d&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:d})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:c?e.jsx(we,{size:14}):e.jsx(Ce,{size:14})})]}),c&&e.jsx(wn,{workingDir:l,filePath:s.path,type:o})]})}function Os({title:s,entries:o,type:l,workingDir:c,defaultOpen:b}){const{t:d}=F(),[g,a]=n.useState(b);return o.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>a(h=>!h),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-accent",children:[e.jsx("span",{className:"text-muted-foreground",children:g?e.jsx(we,{size:14}):e.jsx(Ce,{size:14})}),e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:d(s)}),e.jsx("span",{className:"text-[11px] tabular-nums bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:o.length})]}),g&&e.jsx("div",{className:"divide-y divide-border/60",children:o.map(h=>e.jsx(In,{entry:h,type:l,workingDir:c},`${l}:${h.path}`))})]})}function Sn({workingDir:s}){const{t:o}=F(),{data:l,isLoading:c,isError:b}=Ds(s);if(!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")});if(c)return e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx($,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading changes...")})]});if(b)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load changes.")});const d=l?.uncommitted||[],g=l?.committed||[];return d.length+g.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(Xe,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("No pending changes")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx(Os,{title:"Uncommitted",entries:d,type:"uncommitted",workingDir:s,defaultOpen:!0}),e.jsx(Os,{title:"Committed",entries:g,type:"committed",workingDir:s,defaultOpen:!1})]})}const Ke=50;function An(s){const l=Math.floor(Date.now()/1e3)-s;return l<60?ye("{count}s ago",{count:l}):l<3600?ye("{count}m ago",{count:Math.floor(l/60)}):l<86400?ye("{count}h ago",{count:Math.floor(l/3600)}):l<604800?ye("{count}d ago",{count:Math.floor(l/86400)}):new Date(s*1e3).toLocaleDateString()}function Rn(s){const o=s.split("/");return o[o.length-1]||s}function Tn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function En({workingDir:s,hash:o,filePath:l}){const{t:c}=F(),{data:b,isLoading:d,isError:g}=Qt(s,o,l);if(d)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx($,{}),e.jsx("span",{className:"text-xs",children:c("Loading diff...")})]});if(g)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:c("Failed to load diff.")});const a=b?.diff||"";if(!a.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:c("No diff content available.")});const h=a.split(`
|
|
3
|
-
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:h.map((x,y)=>e.jsx(Ws,{line:x,lineNum:y+1},y))})})}function Pn({entry:s,workingDir:o,hash:l}){const[c,b]=n.useState(!1),d=Tn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>b(g=>!g),className:ke("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-accent",c&&"bg-muted/50"),children:[e.jsx(zs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:Rn(s.path)}),d&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:d})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:c?e.jsx(we,{size:14}):e.jsx(Ce,{size:14})})]}),c&&e.jsx(En,{workingDir:o,hash:l,filePath:s.path})]})}function Mn({commit:s,workingDir:o}){const{t:l}=F(),[c,b]=n.useState(!1),{data:d,isLoading:g}=_t(o,c?s.hash:null),a=d?.files||[];return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>b(h=>!h),className:ke("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-accent",c&&"bg-muted/50"),children:[e.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:e.jsx("div",{className:ke("w-2.5 h-2.5 rounded-full shrink-0",c?"bg-info":"bg-foreground/15")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:s.shortHash}),e.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:s.message})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:s.author}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:An(s.timestamp)})]})]}),e.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5",children:c?e.jsx(we,{size:14}):e.jsx(Ce,{size:14})})]}),c&&e.jsxs("div",{className:"pl-4 border-l-2 border-border ml-[22px]",children:[s.body&&e.jsx("div",{className:"px-3 py-2 text-xs text-foreground/70 whitespace-pre-wrap leading-4",children:s.body}),g?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-muted-foreground",children:[e.jsx($,{}),e.jsx("span",{className:"text-xs",children:l("Loading files...")})]}):a.length===0?e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:l("No files changed")}):e.jsx("div",{className:"divide-y divide-border/60",children:a.map(h=>e.jsx(Pn,{entry:h,workingDir:o,hash:s.hash},h.path))})]})]})}function On({workingDir:s}){const{t:o}=F(),{data:l,isLoading:c,isError:b,fetchNextPage:d,hasNextPage:g,isFetchingNextPage:a}=Kt({queryKey:Qe.git.log(s||""),queryFn:({pageParam:x=0})=>Ls.get("/git/log",{params:{workingDir:s||"",limit:String(Ke),skip:String(x)}}),initialPageParam:0,getNextPageParam:(x,y)=>x.commits.length<Ke?void 0:y.length*Ke,enabled:!!s}),h=l?.pages.flatMap(x=>x.commits)||[];return s?c?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx($,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading history...")})]}):b?e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load history.")}):h.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(Bs,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("No commit history")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx("div",{className:"divide-y divide-border/60",children:h.map(x=>e.jsx(Mn,{commit:x,workingDir:s},x.hash))}),g&&e.jsx("button",{type:"button",onClick:()=>d(),disabled:a,className:"w-full py-4 text-sm text-muted-foreground active:text-foreground/80 active:bg-accent flex items-center justify-center gap-2",children:a?e.jsxs(e.Fragment,{children:[e.jsx($,{})," ",o("Loading...")]}):o("Load more")})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")})}const Ln=At(),Dn=s=>s.includes("://")||s.startsWith("/api/")?s:s.startsWith("/")?`${Ln}/attachments/by-path?path=${encodeURIComponent(s)}`:s;function Wn({status:s}){const o={[oe.Running]:"bg-info",[oe.Review]:"bg-warning",[oe.Pending]:"bg-muted-foreground/60",[oe.Done]:"bg-success",[oe.Cancelled]:"bg-muted-foreground/60"};return e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${o[s]}`})}const zn=[{key:"chat",label:"Chat",icon:Gs},{key:"changes",label:"Changes",icon:Xe},{key:"history",label:"History",icon:Bs},{key:"workspace",label:"Workspace",icon:Fs}],Bn=[{key:"chat",label:"Team room",icon:Gs},{key:"team-status",label:"Team Status",icon:kt},{key:"changes",label:"Changes",icon:Xe},{key:"workspace",label:"Workspace",icon:Fs}];function Dr({task:s,onBack:o,onDeleteTask:l,onTaskPriorityChange:c,isDeleting:b,autoStartState:d,onAutoStartRecovered:g}){const{t:a}=F(),h=bt(t=>t.setVisibleContext),[x,y]=n.useState("chat"),[T,K]=n.useState(""),[qs,ae]=n.useState(!1),[Us,Ie]=n.useState(!1),[Se,Ae]=n.useState(!1),[A,Re]=n.useState(null),[_,Q]=n.useState(void 0),Ye=n.useRef(0),[Vs,Te]=n.useState(),Ee=n.useRef(null),Pe=n.useRef(null),X=n.useRef(null),Ze=n.useRef(null),{scrollRef:D,contentRef:Je,isAtBottom:es,scrollToBottom:ie,stopScroll:ss}=Et({resize:"smooth",initial:"instant"}),G=vt();n.useEffect(()=>{if(!Se)return;const t=r=>{Pe.current&&!Pe.current.contains(r.target)&&Ae(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[Se]);const{data:i,isLoading:Hs}=hn(s.id),Y=Xt(s.id),ts=Y?.status==="completed"&&d?.status!=="failed"?null:d,Me=!!(ts||Y&&Y.status!=="completed"),{data:le}=jt(s.id),{data:$s}=yt(le?.id??""),ns=Nt(le?.id??""),f=le??null,E=s.isGitRepo!==!1&&s.worktreeReady!==!1,Oe=n.useMemo(()=>(f?Bn:zn).filter(t=>E||t.key!=="changes"&&t.key!=="history"),[E,f]),Ks=le===null,{data:Z,isLoading:_s}=Ct(s.id,Ks),N=!!s.projectArchivedAt,rs=!!s.projectRepoDeletedAt,Le=a(rs?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。");n.useEffect(()=>{Q(void 0),Re(null),Te(void 0)},[s.id]),n.useEffect(()=>{f&&x==="history"&&y("chat"),!f&&x==="team-status"&&y("chat"),Oe.some(t=>t.key===x)||y("chat")},[x,Oe,f]);const W=n.useMemo(()=>Yt(i,f,_),[_,f,i]);n.useEffect(()=>{_&&!i?.some(t=>t.id===_)&&Q(void 0)},[_,i]);const k=n.useMemo(()=>i?.find(t=>t.id===W),[W,i]),I=n.useMemo(()=>{if(i){if(k)return Ne(k);for(const t of i)if(t.status==="ACTIVE"&&Ne(t))return Ne(t);return Ne(i[0])}},[k,i]),R=k?.status===wt.ACTIVE?k.id:void 0,De=E&&Zt(k,f),We=k?.branchName??"",os=k?.commitMessage,ze=n.useMemo(()=>Jt(k,i,s?.mainBranch??""),[k,s?.mainBranch,i]),J=!!(De&&R&&I&&!N),{data:P,isLoading:Qs}=gn(R??"",{enabled:J}),{data:as}=Ds(I,{enabled:J}),Xs=as?.committed?.length,[is,ls]=n.useState(!1),[cs,ds]=n.useState(null);n.useEffect(()=>{const t=E&&(x==="changes"||x==="chat"&&J)?"changes":E&&x==="history"?"history":null;if(!R||!I||!t){h(null);return}return h({workspaceId:R,workingDir:I,tab:t}),()=>{h(null)}},[x,E,R,h,J,I]);const C=n.useMemo(()=>P?.conflictOp&&P.conflictedFiles.length>0?{conflictOp:P.conflictOp,conflictedFiles:P.conflictedFiles}:cs,[P?.conflictOp,P?.conflictedFiles,cs]),us=C?.targetWorkspaceId??R,Ys=C?.targetWorktreePath??k?.worktreePath,Zs=C?.sourceBranch??We,Js=C?.targetBranch??ze,et=k?.sessions??[],Be=n.useCallback(t=>{ds(t??null),ls(!0)},[]),ms=n.useCallback(()=>s?.id?G.invalidateQueries({queryKey:Qe.workspaces.list(s.id)}):Promise.resolve(),[s?.id,G]),Fe=n.useCallback(async()=>G.fetchQuery({queryKey:Qe.tasks.body(s.id),queryFn:()=>Ls.get(`/tasks/${s.id}/body`)}),[G,s.id]),w=n.useMemo(()=>{if(!i)return null;const t=i.filter(p=>p.status==="ACTIVE"&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]),r=p=>{const V=p.createdAt,H=p.endedAt??p.startedAt??V;if(!H)return 0;const je=Date.parse(H);return Number.isNaN(je)?0:je},u=p=>{const V=t.filter(H=>p.includes(H.status));return V.length===0?null:V.sort((H,je)=>r(je)-r(H))[0]??null},m=u([L.RUNNING])??u([L.PENDING])??u([L.COMPLETED,L.FAILED,L.CANCELLED]);if(m)return m;const O=i.filter(p=>(p.status==="ABANDONED"||p.status==="MERGED"||p.status==="HIBERNATED")&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]).filter(p=>[L.COMPLETED,L.FAILED,L.CANCELLED].includes(p.status));return O.length===0?null:O.sort((p,V)=>r(V)-r(p))[0]??null},[i]),v=w?.id??"",ce=f?A??"":v,st=n.useMemo(()=>{if(!A||!i)return null;for(const t of i){const r=t.sessions?.find(u=>u.id===A);if(r)return r}return null},[A,i]),Ge=n.useMemo(()=>{if(!A||!f?.invocations)return null;const t=f.invocations.filter(r=>r.sessionId===A);return t.length===0?null:t.sort((r,u)=>{const m=Date.parse(r.updatedAt??r.createdAt??""),S=Date.parse(u.updatedAt??u.createdAt??"");return(Number.isNaN(S)?0:S)-(Number.isNaN(m)?0:m)})[0]??null},[A,f?.invocations]),tt=n.useMemo(()=>!Ge?.memberId||!f?.members?null:f.members.find(t=>t.id===Ge.memberId)??null,[Ge?.memberId,f?.members]),j=A?st:w??null,q=j?.id,U=n.useMemo(()=>{if(j?.workspaceId)return j.workspaceId;if(!(!j||!i))return i.find(t=>t.sessions?.some(r=>r.id===j.id))?.id},[j,i]),de=n.useCallback((t,r)=>{const m=(r&&i?.some(S=>S.id===r)?r:void 0)??U??W??void 0;m&&Q(m),Ye.current+=1,Te({id:Ye.current,source:t,workspaceId:m}),y("workspace")},[U,W,i]),qe=n.useCallback((t,r)=>{de({kind:"web",url:t},r)},[de]),Ue=n.useCallback((t,r,u)=>{de({kind:"visualization",sessionId:t,file:r},u)},[de]),xs=n.useCallback(t=>{qe(t,U)},[U,qe]),ps=n.useCallback(t=>{q&&Ue(q,t,U)},[q,U,Ue]),{isActive:ee,isCancelling:se}=Gt(q??"",j?.status),nt=n.useMemo(()=>!w||!i?!1:!i.some(r=>r.status==="ACTIVE"&&r.sessions?.some(u=>u.id===w.id)),[w,i]),{data:ue}=vn(),[fs,rt]=n.useState(null),me=fs?.sessionId===v?fs.providerId:w?.providerId??null,xe=w?zt(ue,me):void 0,ot=n.useCallback(t=>{rt({sessionId:v,providerId:t})},[v]),z=qt({agentType:w?.agentType,workingDir:I,input:T,setInput:K,textareaRef:X,minHeight:40,maxHeight:140}),B=en({agentType:w?.agentType,workingDir:I,input:T,setInput:K,textareaRef:X,minHeight:40,maxHeight:140}),pe=I&&k?k.id:void 0,fe=Ut(),hs=bn(),M=Vt(),{isConnected:gs,isLoadingSnapshot:bs,isOutputActive:vs,lastExitAt:js,logs:te,entries:at,attach:he}=Dt({sessionId:ce,sessionStatus:j?.status,sessionStartedAt:j?.startedAt??j?.createdAt,sessionEndedAt:j?.endedAt??(ee?null:j?.updatedAt),onExit:n.useCallback(()=>{G.invalidateQueries({queryKey:["workspaces"]})},[G])}),{todos:ge}=Wt(at),{files:it,addFiles:be,removeFile:lt,clear:ys,buildMarkdownLinks:Ns,hasFiles:ne,isUploading:ve}=Bt(),ct=n.useMemo(()=>sn(j),[j?.tokenUsage]),ks=Pt(te,ct);n.useEffect(()=>{ce&&gs&&he()},[ce,gs,he]);const Cs=n.useRef(null);n.useEffect(()=>{if(Cs.current!==s.id&&D.current){const t=D.current;requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}Cs.current=s.id},[s.id,D]);const Ve=n.useRef(!1),ws=n.useCallback(async()=>{if(!T.trim()&&!ne||!v||Ve.current||M.isPending||se||ve||xe)return;Ve.current=!0;const t=Ns(),r=[T.trim(),t].filter(Boolean).join(`
|
|
4
|
-
|
|
5
|
-
`);K(""),ys(),X.current&&(X.current.style.height="40px"),fe.mutate({id:v,message:r,providerId:me??void 0},{onSuccess:()=>he(),onError:()=>K(u=>u||r),onSettled:()=>{Ve.current=!1}})},[T,v,fe,he,ne,ve,Ns,ys,me,xe,M.isPending,se]),dt=n.useCallback(()=>{!v||M.isPending||M.mutate(v)},[v,M]),ut=n.useCallback(t=>ns.mutateAsync(t),[ns]),Is=n.useCallback(t=>{Re(t),y("chat"),requestAnimationFrame(()=>{ie()})},[ie]),mt=n.useCallback(()=>{Re(null)},[]),xt=n.useCallback(()=>{y("changes")},[]),Ss=J&&R?e.jsx(tn,{projectId:s?.projectId??"",workspaceId:R,branchName:We,targetBranch:ze,commitMessage:os,changes:as,gitStatus:P,isGitStatusLoading:Qs,canRunGitOperations:De,onOpenChanges:xt,onRefreshCommitMessage:ms,onConflict:Be,className:"mb-2"}):null,pt=n.useCallback(t=>{const r=t.target.files;r&&r.length>0&&be(Array.from(r)),t.target.value=""},[be]),ft=n.useCallback(t=>{const r=t.clipboardData.items,u=[];for(const m of r)if(m.kind==="file"){const S=m.getAsFile();S&&u.push(S)}u.length>0&&(t.preventDefault(),be(u))},[be]),ht=n.useCallback(t=>{K(t.target.value);const r=t.target;r.style.height="auto",r.style.height=`${Math.max(40,Math.min(r.scrollHeight,140))}px`},[]),gt=n.useCallback(()=>{pe&&hs.mutate({workspaceId:pe})},[hs,pe]),re=n.useRef(null);return n.useEffect(()=>{const t=window.visualViewport;if(!t)return;let r=!1;const u=()=>{re.current&&(re.current.style.height=`${t.height}px`,re.current.style.top=`${t.offsetTop}px`)},m=()=>u(),S=()=>{r||u()},O=()=>{r=!0},p=()=>{r=!1,requestAnimationFrame(u)};return t.addEventListener("resize",m),t.addEventListener("scroll",S),document.addEventListener("touchstart",O,{passive:!0}),document.addEventListener("touchend",p,{passive:!0}),document.addEventListener("touchcancel",p,{passive:!0}),()=>{t.removeEventListener("resize",m),t.removeEventListener("scroll",S),document.removeEventListener("touchstart",O),document.removeEventListener("touchend",p),document.removeEventListener("touchcancel",p)}},[]),n.useEffect(()=>{const t=re.current;if(!t)return;const r=u=>{let m=u.target;for(;m&&m!==t;){if(m.tagName==="TEXTAREA"){if(m.scrollHeight>m.clientHeight)return;m=m.parentElement;continue}const O=window.getComputedStyle(m).overflowY;if((O==="auto"||O==="scroll")&&m.scrollHeight>m.clientHeight)return;m=m.parentElement}u.preventDefault()};return t.addEventListener("touchmove",r,{passive:!1}),()=>t.removeEventListener("touchmove",r)},[]),e.jsxs("div",{ref:re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-background overflow-hidden overscroll-none",children:[e.jsxs("header",{className:"shrink-0 bg-background border-b border-border z-20",children:[e.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[e.jsx("button",{onClick:o,className:"p-1.5 -ml-0.5 text-foreground/70 active:text-foreground",children:e.jsx(As,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(nn,{taskId:s.id,title:s.title,readOnly:N,titleClassName:"text-[13px] font-semibold text-foreground truncate leading-tight",compact:!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground leading-tight",children:[e.jsx("span",{className:`truncate font-medium ${s.projectColor}`,children:s.projectName}),s.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:s.projectRepoDeletedAt?a("源码已删除"):a("已删除")}),e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("span",{className:"font-mono truncate",children:s.branch})]})]}),e.jsx(Wn,{status:s.status}),e.jsx(Ht,{value:s.priority,compact:!0,onChange:!N&&c?t=>c(s.id,t):void 0}),e.jsx("button",{onClick:gt,disabled:!pe||N,className:"p-1.5 text-muted-foreground active:text-foreground disabled:opacity-30",children:e.jsx(fn,{size:16})}),l&&!N&&e.jsxs("div",{className:"relative",ref:Pe,children:[e.jsx("button",{onClick:()=>Ae(t=>!t),className:"p-1.5 text-muted-foreground active:text-foreground","aria-label":"More actions",children:e.jsx(rn,{size:16})}),Se&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-background rounded-lg border border-border shadow-popover z-50 py-1",children:e.jsxs("button",{onClick:()=>{Ie(!0),Ae(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive-ink active:bg-destructive/10",children:[e.jsx(yn,{size:15}),e.jsx("span",{children:a("删除任务")})]})})]})]}),e.jsx("div",{className:"flex border-t border-border/60",children:Oe.map(({key:t,label:r,icon:u})=>e.jsxs("button",{onClick:()=>y(t),className:`flex min-w-0 flex-1 items-center justify-center gap-1 px-1 py-2 text-xs font-medium transition-colors ${x===t?"text-foreground border-b-2 border-foreground":"text-muted-foreground border-b-2 border-transparent"}`,children:[e.jsx(u,{size:13,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a(r)})]},t))})]}),x==="chat"&&(f?e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",children:A?e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-border px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:a("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:A})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(on,{session:j,providers:ue,usage:ks,compact:!0,providerIdFallback:tt?.providerId,agentTypeFallback:j?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(He,{type:"button",size:"xs",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-border bg-background/60 px-1.5 text-xs font-medium text-muted-foreground hover:border-foreground/20 hover:bg-accent hover:text-foreground active:bg-accent",onClick:mt,children:[e.jsx(As,{size:12}),e.jsx("span",{children:a("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:D,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsx("div",{ref:Je,children:bs?e.jsx(_e,{label:a("Loading logs...")}):te.length===0?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:a(ee?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Es,{children:e.jsx(Ts,{logs:te,downloadSessionId:q,isOutputActive:vs,lastExitAt:js,onUserToggleDetails:ss,scrollElementRef:D,onOpenPreviewUrl:xs,onOpenVisualization:ps})})})}),!es&&e.jsxs("button",{onClick:()=>ie(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":a("Scroll to bottom"),children:[e.jsx(Rs,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),ge.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Ps,{todos:ge,compact:!0})})]}):e.jsx(an,{teamRun:f,messages:$s??f.messages??[],readOnly:N,readOnlyMessage:Le,onSendMessage:ut,onViewInvocationSession:Is,changeSummaryBar:Ss,compactComposer:!0,workingDir:I,onOpenPreviewUrl:qe,onOpenVisualization:Ue})}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:D,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsxs("div",{ref:Je,children:[e.jsx("div",{className:"mb-3 pb-2 border-b border-border/60",children:_s?e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:a("Loading...")}):Z?.body?e.jsx("div",{className:"text-[13px] text-muted-foreground leading-relaxed prose prose-sm max-w-none",children:e.jsx(Rt,{urlTransform:Dn,components:Tt,children:Z.body})}):e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:"No description"})}),!N&&e.jsx(ln,{state:ts,setupProgress:Y,sessionStarted:!!w?.startedAt,onRetry:v&&d?.status==="failed"?async()=>{await Fe(),ae(!0)}:void 0,compact:!0},s.id),Hs?(!Me||N)&&e.jsx(_e,{label:"Loading..."}):v?bs?e.jsx(_e,{label:"Loading logs..."}):te.length===0?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:ee?"Waiting for agent output...":"No logs recorded."}):e.jsx(Es,{children:e.jsx(Ts,{logs:te,downloadSessionId:q,isOutputActive:vs,lastExitAt:js,onUserToggleDetails:ss,scrollElementRef:D,onOpenPreviewUrl:xs,onOpenVisualization:ps})}):!Me||d?.status==="failed"||Y?.status==="failed"||N?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(!Me||N)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-4",children:e.jsx($e,{size:20,className:"text-muted-foreground/70 ml-0.5"})}),e.jsx("h3",{className:"text-sm font-medium text-foreground mb-1",children:a("尚未启动 Agent")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-5 max-w-[240px]",children:N?Le:a("选择一个 Agent 来执行此任务")})]}),!N&&(!d||d.status==="failed")&&e.jsxs(He,{onClick:async()=>{await Fe(),ae(!0)},disabled:!!(d&&d.status!=="failed"),children:[e.jsx($e,{size:16,className:"mr-1.5"}),d?.status==="failed"?a("重试启动 Agent"):a("启动 Agent")]})]}):null]})}),!es&&e.jsxs("button",{onClick:()=>ie(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":"Scroll to bottom",children:[e.jsx(Rs,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),ge.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Ps,{todos:ge,compact:!0})}),N?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsx("div",{className:"rounded-xl border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:Le})}):nt?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/50 px-3 py-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:a("代码已合并,以上为历史沟通记录")}),e.jsxs(He,{size:"sm",onClick:async()=>{await Fe(),ae(!0)},children:[e.jsx($e,{size:14,className:"mr-1.5"}),a("启动新 Agent")]})]})}):v&&e.jsxs("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:[Ss,e.jsx(Mt,{sessionId:ce||v,compact:!0}),e.jsxs("div",{ref:Ee,className:"relative bg-background rounded-xl border border-border shadow-raised focus-within:border-ring",children:[e.jsx(Ft,{files:it,onRemove:lt}),e.jsx("textarea",{ref:X,value:T,onChange:ht,onPaste:ft,onKeyDown:t=>{B.handleKeyDown(t)||z.handleKeyDown(t)||t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),ws())},rows:1,placeholder:ee?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/70",style:{minHeight:40,maxHeight:140}}),e.jsx("input",{ref:Ze,type:"file",multiple:!0,className:"hidden",onChange:pt}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsx("button",{onClick:()=>Ze.current?.click(),className:"p-1 text-muted-foreground active:text-foreground/70 rounded-lg",children:e.jsx(Nn,{size:15})})}),e.jsxs("div",{className:"flex items-center gap-1",children:[w&&ue&&e.jsx(Ot,{providers:ue,currentProviderId:me,agentType:w.agentType,runtimeType:w.runtimeType,onSelect:ot}),e.jsx(Lt,{usage:ks}),ee&&!T.trim()&&!ne?e.jsx("button",{onClick:dt,disabled:M.isPending||se,"aria-label":a("Stop"),className:"p-1.5 rounded-lg bg-destructive-ink text-white active:bg-destructive-ink/90 disabled:opacity-50",children:e.jsx(It,{size:12})}):e.jsx("button",{onClick:ws,disabled:!T.trim()&&!ne||ve||fe.isPending||M.isPending||se||!!xe,className:`p-1.5 rounded-lg transition-colors ${(T.trim()||ne)&&!ve&&!fe.isPending&&!M.isPending&&!se&&!xe?"bg-primary text-primary-foreground active:bg-primary":"bg-transparent text-muted-foreground"}`,children:e.jsx(St,{size:15})})]})]})]}),e.jsx(Ms,{open:z.query!==null,anchorRef:Ee,commands:z.filteredCommands,selectedIndex:z.selectedIndex,query:z.query??"",hasCatalog:z.allCommands.length>0,compact:!0,onSelect:z.applyCommand}),e.jsx(Ms,{open:B.query!==null,anchorRef:Ee,commands:B.filteredSkills,selectedIndex:B.selectedIndex,query:B.query??"",hasCatalog:B.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:B.applySkill})]})]})),x==="team-status"&&f&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(cn,{teamRun:f,workspaces:i,selectedWorkspaceId:W,onSelectWorkspace:Q,onViewInvocationSession:Is})}),x==="changes"&&E&&e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[i&&i.length>1&&e.jsx("div",{className:"shrink-0 border-b border-border/60 bg-background px-3 py-2",children:e.jsx(dn,{workspaces:i,teamRun:f,selectedWorkspaceId:W,onSelectWorkspace:Q,className:"w-full",buttonClassName:"w-full max-w-none min-w-0 justify-start"})}),De&&R&&e.jsx("div",{className:"shrink-0",children:e.jsx(un,{projectId:s.projectId,workspaceId:R,branchName:We,targetBranch:ze,commitMessage:os,committedFileCount:Xs,onRefreshCommitMessage:ms,onConflict:Be,onResolveConflicts:()=>Be()})}),e.jsx(Sn,{workingDir:I})]}),x==="history"&&e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(On,{workingDir:I})}),x==="workspace"&&e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(mn,{sessionId:v||void 0,workspaceId:W,workingDir:I,projectId:s.projectId,className:"h-full",hideChanges:!0,gitAvailable:E,readOnly:N,repoDeleted:rs,previewRequest:Vs,onPreviewRequestHandled:t=>{Te(r=>r?.id===t?void 0:r)}})}),!N&&e.jsx(xn,{isOpen:qs,onClose:()=>ae(!1),taskId:s.id,projectId:s.projectId,taskTitle:Z?.title??s.title,taskDescription:Z?.body??"",taskPrompt:Z?.prompt,projectIsGitRepo:s.isGitRepo,projectWorktreeReady:s.worktreeReady,projectGitReason:s.reason,onStarted:()=>g?.(s.id)}),e.jsx(jn,{isOpen:Us,onClose:()=>Ie(!1),onConfirm:()=>{l?.(s.id),Ie(!1)},taskId:s.id,taskTitle:s.title,workspaces:i,isLoading:b}),is&&C&&us&&e.jsx(pn,{open:is,onOpenChange:t=>{ls(t),t||ds(null)},workspaceId:us,conflictOp:C.conflictOp,conflictedFiles:C.conflictedFiles,sourceBranch:Zs,targetBranch:Js,operation:P?.operation,worktreePath:Ys,mergeAborted:C.mergeAborted,mergeStrategy:C.mergeStrategy,sourceWorkspaceId:C.sourceWorkspaceId,targetWorkspaceId:C.targetWorkspaceId,sourceWorktreePath:C.sourceWorktreePath,targetWorktreePath:C.targetWorktreePath,sessions:et,currentSessionId:f?void 0:v,teamRunId:f?.id})]})}function _e({label:s}){return e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:s})]})}export{Dr as MobileTaskDetail};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as F,q as P,p as k,s as v,v as h,u as R,r as o,j as e,i as g,W as B,k as q,l as j,Y as W,I as d,B as z,E as L,Z as A,_ as K,m as M,$ as Q}from"./index-Cz73HpYH.js";import{S as O}from"./select-DGwKE4l0.js";import{S as D}from"./toggles-DxNDJZsN.js";import{M as H}from"./message-square-CfNb-MTd.js";import{L as Y}from"./link-DbSpzB1w.js";import"./select-yem-xN9Z.js";import"./menu-styles-DWynpVVz.js";import"./index-B6Lvy5Sr.js";import"./check-DYlb0A_N.js";import"./index-ZO2tqdha.js";import"./index-BCV57B4O.js";import"./index-CTG-4w90.js";import"./index-CMjLMilU.js";import"./index-DENY_U7o.js";function Z(){return F({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function _(){const t=P();return k({mutationFn:a=>h.put("/notifications/settings",a),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function $(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function de(){const{t}=R(),{data:a,isLoading:T}=Z(),l=_(),n=$(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[i,p]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,x]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{a&&!m&&p({webhookUrl:a.feishuWebhookUrl??"",baseUrl:a.thirdPartyBaseUrl??"",titleTemplate:a.taskInReviewTitleTemplate??"",bodyTemplate:a.taskInReviewBodyTemplate??""})},[a,m]),o.useEffect(()=>(n.isSuccess?(r("success"),u.current=setTimeout(()=>r("idle"),3e3)):n.isError&&(r("error"),u.current=setTimeout(()=>r("idle"),5e3)),()=>clearTimeout(u.current)),[n.isSuccess,n.isError]),T)return e.jsx(g,{children:e.jsx(B,{rows:3})});const y=a?.osNotificationEnabled??!0,b=a?.thirdPartyChannel??"none",c=(s,I)=>{p(E=>({...E,[s]:I})),x(!0)},S=s=>{l.mutate({osNotificationEnabled:s})},C=s=>{l.mutate({thirdPartyChannel:s})},U=()=>{l.mutate({feishuWebhookUrl:i.webhookUrl.trim()||null,thirdPartyBaseUrl:i.baseUrl.trim()||null,taskInReviewTitleTemplate:i.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:i.bodyTemplate.trim()||t('✅ "{taskTitle}" 已完成,等待审查')},{onSuccess:()=>x(!1)})},w=()=>{i.webhookUrl.trim()&&n.mutate({channel:"feishu",webhookUrl:i.webhookUrl.trim(),baseUrl:i.baseUrl.trim()||void 0})};return e.jsxs(g,{children:[e.jsx(q,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:W,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(D,{checked:y,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:H,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(O,{value:b,onChange:s=>C(s),options:N})}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4 sm:pl-11",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-webhook-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"feishu-webhook-url",value:i.webhookUrl,onChange:s=>c("webhookUrl",s.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"min-w-0 flex-1 font-mono"}),e.jsxs(z,{size:"sm",variant:"outline",onClick:w,disabled:!i.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(L,{size:12,className:"mr-1 animate-spin motion-reduce:animate-none"}),t("测试")]})]}),f==="success"&&e.jsxs("div",{role:"status",className:"mt-2 flex items-center gap-1.5 text-xs text-success-ink",children:[e.jsx(A,{size:12,"aria-hidden":"true"}),t("测试消息发送成功")]}),f==="error"&&e.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-xs text-destructive-ink",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),t("发送失败,请检查 Webhook 地址")]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-base-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(Y,{size:11,"aria-hidden":"true"}),t("跳转地址")]})}),e.jsx(d,{id:"feishu-base-url",value:i.baseUrl,onChange:s=>c("baseUrl",s.target.value),placeholder:"http://localhost:5173",className:"font-mono"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t('通知卡片中的"查看任务"按钮跳转地址前缀')})]})]})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(M,{children:t("通知模板")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("支持变量: {taskTitle}, {taskId}, {projectId}, {projectName}, {status}",{taskTitle:"{taskTitle}",taskId:"{taskId}",projectId:"{projectId}",projectName:"{projectName}",status:"{status}"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-title-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("标题")}),e.jsx(d,{id:"notification-title-template",value:i.titleTemplate,onChange:s=>c("titleTemplate",s.target.value),placeholder:"Agent Tower"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-body-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("内容")}),e.jsx(d,{id:"notification-body-template",value:i.bodyTemplate,onChange:s=>c("bodyTemplate",s.target.value),placeholder:t('✅ "{taskTitle}" 已完成,等待审查')})]})]})]})]}),m&&e.jsx(Q,{saving:l.isPending,onSave:U})]})}export{de as NotificationSettingsPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{u as T,r as g,j as e,i as S,k as J,x as z,y as w,I as M,B as E,z as p,n as P}from"./index-Cz73HpYH.js";import{u as U,a as _,b as B,c as F}from"./use-profiles-Ncqxdw7S.js";import{M as G}from"./modal-Kpqn-nDO.js";import{C as $}from"./confirm-dialog-BRkrtULz.js";import{T as R}from"./textarea-Bnfq7adW.js";import{L as H}from"./layers-CxqMQVmH.js";import{C as q}from"./index-B6Lvy5Sr.js";import{P as K,T as Q}from"./trash-2-ALAYDudv.js";import{P as W}from"./pencil-pzVKblxj.js";import"./dialog-B_vC5R4B.js";import"./index-BCV57B4O.js";function X(t){const a=Object.entries(t);return a.length===0?"(empty)":a.map(([m,c])=>`${m}: ${JSON.stringify(c)}`).join(", ")}const y={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function Y({agentType:t,variants:a,isBuiltIn:m,onEdit:c,onNew:h,onDelete:j}){const{t:n}=T(),[r,b]=g.useState(!0),u=Object.entries(a);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-muted/40 px-4 py-3",children:[e.jsxs("button",{type:"button",onClick:()=>b(i=>!i),"aria-expanded":r,className:"flex items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:y[t]??t}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.length," ",n("个变体")]}),e.jsx(q,{size:14,"aria-hidden":"true",className:P("text-muted-foreground transition-transform motion-reduce:transition-none",r&&"rotate-180")})]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),n("新增")]})]}),r&&e.jsxs("div",{className:"divide-y divide-border/60",children:[u.map(([i,x])=>{const f=m(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40",children:[e.jsx("span",{className:P("inline-flex shrink-0 items-center rounded px-2 py-0.5 text-xs font-semibold",i==="DEFAULT"?"bg-primary/[0.06] text-primary":"bg-muted text-muted-foreground"),children:i}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:X(x)}),f&&e.jsx("span",{className:"shrink-0 text-xs font-medium text-muted-foreground",children:n("内置")}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx("button",{onClick:()=>c(i,x),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("编辑"),"aria-label":n("编辑"),children:e.jsx(W,{size:12})}),!f&&e.jsx("button",{onClick:()=>j(i),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("删除"),"aria-label":n("删除"),children:e.jsx(Q,{size:12})})]})]},i)}),u.length===0&&e.jsx("div",{className:"px-4 py-4 text-center text-xs text-muted-foreground",children:n("暂无变体")})]})]})}function Z(){return e.jsxs("div",{role:"status","aria-label":"Loading",children:[e.jsx(p,{className:"h-7 w-36"}),e.jsx(p,{className:"mt-2 h-3.5 w-72 max-w-full"}),e.jsx("div",{className:"mt-5 space-y-3",children:Array.from({length:2}).map((t,a)=>e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-muted/40 px-4 py-3",children:[e.jsx(p,{className:"h-4 w-28"}),e.jsx(p,{className:"h-3 w-14"})]}),e.jsx("div",{className:"divide-y divide-border/60",children:Array.from({length:2}).map((m,c)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(p,{className:"h-5 w-16 rounded"}),e.jsx(p,{className:"h-3.5 flex-1"})]},c))})]},a))})]})}function ue(){const{t}=T(),{data:a,isLoading:m}=U(),{data:c}=_(),h=B(),j=F(),[n,r]=g.useState(null),[b,u]=g.useState(""),[i,x]=g.useState(""),[f,v]=g.useState(""),[o,N]=g.useState(null),k=(s,l,d)=>{r({agentType:s,variant:l,config:d,isNew:!1}),x(l),u(JSON.stringify(d,null,2)),v("")},O=s=>{r({agentType:s,variant:"",config:{},isNew:!0}),x(""),u(`{
|
|
2
|
-
|
|
3
|
-
}`),v("")},D=()=>{if(!(!n||!i.trim()))try{const s=JSON.parse(b);v(""),h.mutate({agentType:n.agentType,variant:i.trim().toUpperCase(),config:s},{onSuccess:()=>r(null)})}catch{v(t("JSON 格式错误"))}},L=(s,l)=>{N({agentType:s,variant:l})},A=()=>{o&&j.mutate({agentType:o.agentType,variant:o.variant},{onSettled:()=>N(null)})},I=(s,l)=>!!c?.executors[s]?.[l];if(m)return e.jsx(S,{children:e.jsx(Z,{})});const C=a?.executors??{};return e.jsxs(S,{children:[e.jsx(J,{title:t("Profile 配置"),description:t("管理 Agent 执行器的配置变体。每个变体定义一组运行参数。"),className:"mb-4"}),e.jsx("div",{className:"space-y-3",children:Object.entries(C).map(([s,l])=>e.jsx(Y,{agentType:s,variants:l,isBuiltIn:d=>I(s,d),onEdit:(d,V)=>k(s,d,V),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(z,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(G,{isOpen:!!n,onClose:()=>r(null),title:n?.isNew?t("新增 Variant — {agentType}",{agentType:y[n.agentType]??n.agentType}):t("编辑 {variant}",{variant:n?.variant??""}),action:e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"outline",onClick:()=>r(null),children:t("取消")}),e.jsx(E,{onClick:D,disabled:h.isPending,children:h.isPending?t("保存中..."):t("保存")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{label:t("Variant 名称"),htmlFor:"profile-variant-name",children:e.jsx(M,{id:"profile-variant-name",value:i,onChange:s=>x(s.target.value),disabled:!n?.isNew,placeholder:t("例如: CUSTOM"),className:"font-mono"})}),e.jsxs(w,{label:t("配置 (JSON)"),htmlFor:"profile-variant-json",children:[e.jsx(R,{id:"profile-variant-json",value:b,onChange:s=>{u(s.target.value),v("")},rows:6,className:"resize-none font-mono","aria-invalid":!!f}),f&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive-ink",children:f})]})]})}),e.jsx($,{isOpen:o!==null,onClose:()=>{j.isPending||N(null)},onConfirm:A,title:t("删除 Profile Variant"),description:o?t('确定删除 "{name}"?此操作不可撤销。',{name:`${y[o.agentType]??o.agentType} / ${o.variant}`}):"",confirmText:t("删除"),cancelText:t("取消"),variant:"danger",isLoading:j.isPending})]})}export{ue as ProfileSettingsPage};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskDetail-a1jalILy.js","assets/index-Cz73HpYH.js","assets/index-CzvAGoau.css","assets/mermaid-NOHMQCX5-DmKVQY9m.js","assets/use-attachments-CK7y5KsN.js","assets/tooltip-CHOgkFbE.js","assets/kbd-B3m64lRd.js","assets/index-B6Lvy5Sr.js","assets/index-CTG-4w90.js","assets/index-CMjLMilU.js","assets/mermaid-NOHMQCX5-lI9o3AWT.css","assets/useTokenUsage-YwiF0xnT.js","assets/CreateTaskInput-SHJ1YpRe.js","assets/use-projects-Dwy9AfAG.js","assets/MemberAvatar-BG0VDZKf.js","assets/people-C6b3eeLq.js","assets/BrandLogo-CC1alVsd.js","assets/hooks-DK4m7-FN.js","assets/index-DENY_U7o.js","assets/index-ZO2tqdha.js","assets/use-providers-BRyZjuBG.js","assets/check-DYlb0A_N.js","assets/trash-2-ALAYDudv.js","assets/ExecutionPermissionSelector-DcC4IBOF.js","assets/paperclip-BBrzKZQC.js","assets/menu-0A0v_lRV.js","assets/menu-styles-DWynpVVz.js","assets/index-BCV57B4O.js","assets/useNormalizedLogs-CRHRedwp.js","assets/track-B_K578io.js","assets/EditableTaskTitle-CGVeZUSt.js","assets/chevron-up-DOkDFvIc.js","assets/at-sign-C4VhWike.js","assets/confirm-dialog-BRkrtULz.js","assets/dialog-B_vC5R4B.js","assets/modal-Kpqn-nDO.js","assets/select-DGwKE4l0.js","assets/select-yem-xN9Z.js","assets/layers-CxqMQVmH.js","assets/message-square-CfNb-MTd.js","assets/textarea-Bnfq7adW.js","assets/content-DPCGELMz.js","assets/copy-CdzVE3kf.js","assets/search-field-B5czD2Pl.js","assets/popover-BYz89aiY.js","assets/server-BIPZ9Ka-.js","assets/icon-button-CuSuXgr_.js","assets/use-workspaces-BBbahdwU.js","assets/upload-D7hKT2VA.js","assets/globe-Rnn-nKw-.js","assets/BranchSelect-D-kqavDG.js","assets/pencil-pzVKblxj.js","assets/EditableTaskTitle-DcpNTP1B.css","assets/MobileTaskDetail-DxE6ZDAS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Wr,r as u,a5 as F,aM as ct,u as Ie,j as o,an as Nn,n as ae,ax as gt,ay as Qr,aw as ne,bi as Dt,bk as Yr,bh as Hr,bl as qr,aC as ir,aG as Xr,aq as et,bm as De,a_ as Re,o as Vr,q as Bt,p as gn,s as me,v as Ke,X as Jr,S as Zr,aa as es,D as Me,ag as kt,aI as ts,t as Fe,bn as ns,ae as rs,bo as ss,bp as os,bq as is,aE as Rn,aF as jn,br as ar}from"./index-Cz73HpYH.js";import{C as as}from"./confirm-dialog-BRkrtULz.js";import{a as ls,F as cs}from"./use-workspaces-BBbahdwU.js";import{h as kn,i as us,c as ds,C as Tn}from"./CreateTaskInput-SHJ1YpRe.js";import{C as pt}from"./check-DYlb0A_N.js";import{T as fs,P as hs}from"./trash-2-ALAYDudv.js";import{S as lr}from"./hooks-DK4m7-FN.js";import{F as ms,c as gs,P as ps,a as vs,b as xs,I as bs}from"./popover-BYz89aiY.js";import{S as ys,B as An}from"./BrandLogo-CC1alVsd.js";import{M as ws}from"./message-square-CfNb-MTd.js";import{L as on}from"./layers-CxqMQVmH.js";import{e as Cs,a as Ss}from"./use-projects-Dwy9AfAG.js";import{I as Xt}from"./icon-button-CuSuXgr_.js";import{C as Dn}from"./copy-CdzVE3kf.js";import{u as Es}from"./use-providers-BRyZjuBG.js";import{M as Mn}from"./modal-Kpqn-nDO.js";import{a as Vt}from"./ExecutionPermissionSelector-DcC4IBOF.js";import{C as Ns}from"./index-B6Lvy5Sr.js";const Rs=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],In=Wr("smartphone",Rs),Ut=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tt(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pn(e){return"nodeType"in e}function ve(e){var t,n;return e?tt(e)?e:pn(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function vn(e){const{Document:t}=ve(e);return e instanceof t}function yt(e){return tt(e)?!1:e instanceof ve(e).HTMLElement}function cr(e){return e instanceof ve(e).SVGElement}function nt(e){return e?tt(e)?e.document:pn(e)?vn(e)?e:yt(e)||cr(e)?e.ownerDocument:document:document:document}const _e=Ut?u.useLayoutEffect:u.useEffect;function $t(e){const t=u.useRef(e);return _e(()=>{t.current=e}),u.useCallback(function(){for(var n=arguments.length,r=new Array(n),c=0;c<n;c++)r[c]=arguments[c];return t.current==null?void 0:t.current(...r)},[])}function js(){const e=u.useRef(null),t=u.useCallback((r,c)=>{e.current=setInterval(r,c)},[]),n=u.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function vt(e,t){t===void 0&&(t=[e]);const n=u.useRef(e);return _e(()=>{n.current!==e&&(n.current=e)},t),n}function wt(e,t){const n=u.useRef();return u.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Mt(e){const t=$t(e),n=u.useRef(null),r=u.useCallback(c=>{c!==n.current&&t?.(c,n.current),n.current=c},[]);return[n,r]}function It(e){const t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}let Jt={};function Kt(e,t){return u.useMemo(()=>{if(t)return t;const n=Jt[e]==null?0:Jt[e]+1;return Jt[e]=n,e+"-"+n},[e,t])}function ur(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),c=1;c<n;c++)r[c-1]=arguments[c];return r.reduce((l,h)=>{const f=Object.entries(h);for(const[s,i]of f){const a=l[s];a!=null&&(l[s]=a+e*i)}return l},{...t})}}const Ze=ur(1),Pt=ur(-1);function ks(e){return"clientX"in e&&"clientY"in e}function xn(e){if(!e)return!1;const{KeyboardEvent:t}=ve(e.target);return t&&e instanceof t}function Ts(e){if(!e)return!1;const{TouchEvent:t}=ve(e.target);return t&&e instanceof t}function Ot(e){if(Ts(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ks(e)?{x:e.clientX,y:e.clientY}:null}const xt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[xt.Translate.toString(e),xt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Pn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function As(e){return e.matches(Pn)?e:e.querySelector(Pn)}const Ds={display:"none"};function Ms(e){let{id:t,value:n}=e;return F.createElement("div",{id:t,style:Ds},n)}function Is(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const c={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return F.createElement("div",{id:t,style:c,role:"status","aria-live":r,"aria-atomic":!0},n)}function Ps(){const[e,t]=u.useState("");return{announce:u.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const dr=u.createContext(null);function Os(e){const t=u.useContext(dr);u.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Ls(){const[e]=u.useState(()=>new Set),t=u.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[u.useCallback(r=>{let{type:c,event:l}=r;e.forEach(h=>{var f;return(f=h[c])==null?void 0:f.call(h,l)})},[e]),t]}const zs={draggable:`
|
|
3
|
-
To pick up a draggable item, press the space bar.
|
|
4
|
-
While dragging, use the arrow keys to move the item.
|
|
5
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},Fs={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function _s(e){let{announcements:t=Fs,container:n,hiddenTextDescribedById:r,screenReaderInstructions:c=zs}=e;const{announce:l,announcement:h}=Ps(),f=Kt("DndLiveRegion"),[s,i]=u.useState(!1);if(u.useEffect(()=>{i(!0)},[]),Os(u.useMemo(()=>({onDragStart(d){let{active:m}=d;l(t.onDragStart({active:m}))},onDragMove(d){let{active:m,over:p}=d;t.onDragMove&&l(t.onDragMove({active:m,over:p}))},onDragOver(d){let{active:m,over:p}=d;l(t.onDragOver({active:m,over:p}))},onDragEnd(d){let{active:m,over:p}=d;l(t.onDragEnd({active:m,over:p}))},onDragCancel(d){let{active:m,over:p}=d;l(t.onDragCancel({active:m,over:p}))}}),[l,t])),!s)return null;const a=F.createElement(F.Fragment,null,F.createElement(Ms,{id:r,value:c.draggable}),F.createElement(Is,{id:f,announcement:h}));return n?ct.createPortal(a,n):a}var ce;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ce||(ce={}));function Lt(){}function Bs(e,t){return u.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Us(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const je=Object.freeze({x:0,y:0});function $s(e,t){const n=Ot(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function Ks(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Gs(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Ws(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),c=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),h=c-r,f=l-n;if(r<c&&n<l){const s=t.width*t.height,i=e.width*e.height,a=h*f,d=a/(s+i-a);return Number(d.toFixed(4))}return 0}const Qs=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const c=[];for(const l of r){const{id:h}=l,f=n.get(h);if(f){const s=Ws(f,t);s>0&&c.push({id:h,data:{droppableContainer:l,value:s}})}}return c.sort(Ks)};function Ys(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function fr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:je}function Hs(e){return function(n){for(var r=arguments.length,c=new Array(r>1?r-1:0),l=1;l<r;l++)c[l-1]=arguments[l];return c.reduce((h,f)=>({...h,top:h.top+e*f.y,bottom:h.bottom+e*f.y,left:h.left+e*f.x,right:h.right+e*f.x}),{...n})}}const qs=Hs(1);function hr(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xs(e,t,n){const r=hr(t);if(!r)return e;const{scaleX:c,scaleY:l,x:h,y:f}=r,s=e.left-h-(1-c)*parseFloat(n),i=e.top-f-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),a=c?e.width/c:e.width,d=l?e.height/l:e.height;return{width:a,height:d,top:i,right:s+a,bottom:i+d,left:s}}const Vs={ignoreTransform:!1};function Ct(e,t){t===void 0&&(t=Vs);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:i,transformOrigin:a}=ve(e).getComputedStyle(e);i&&(n=Xs(n,i,a))}const{top:r,left:c,width:l,height:h,bottom:f,right:s}=n;return{top:r,left:c,width:l,height:h,bottom:f,right:s}}function On(e){return Ct(e,{ignoreTransform:!0})}function Js(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Zs(e,t){return t===void 0&&(t=ve(e).getComputedStyle(e)),t.position==="fixed"}function eo(e,t){t===void 0&&(t=ve(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const l=t[c];return typeof l=="string"?n.test(l):!1})}function bn(e,t){const n=[];function r(c){if(t!=null&&n.length>=t||!c)return n;if(vn(c)&&c.scrollingElement!=null&&!n.includes(c.scrollingElement))return n.push(c.scrollingElement),n;if(!yt(c)||cr(c)||n.includes(c))return n;const l=ve(e).getComputedStyle(c);return c!==e&&eo(c,l)&&n.push(c),Zs(c,l)?n:r(c.parentNode)}return e?r(e):n}function mr(e){const[t]=bn(e,1);return t??null}function Zt(e){return!Ut||!e?null:tt(e)?e:pn(e)?vn(e)||e===nt(e).scrollingElement?window:yt(e)?e:null:null}function gr(e){return tt(e)?e.scrollX:e.scrollLeft}function pr(e){return tt(e)?e.scrollY:e.scrollTop}function an(e){return{x:gr(e),y:pr(e)}}var de;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(de||(de={}));function vr(e){return!Ut||!e?!1:e===document.scrollingElement}function xr(e){const t={x:0,y:0},n=vr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},c=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,h=e.scrollTop>=r.y,f=e.scrollLeft>=r.x;return{isTop:c,isLeft:l,isBottom:h,isRight:f,maxScroll:r,minScroll:t}}const to={x:.2,y:.2};function no(e,t,n,r,c){let{top:l,left:h,right:f,bottom:s}=n;r===void 0&&(r=10),c===void 0&&(c=to);const{isTop:i,isBottom:a,isLeft:d,isRight:m}=xr(e),p={x:0,y:0},g={x:0,y:0},v={height:t.height*c.y,width:t.width*c.x};return!i&&l<=t.top+v.height?(p.y=de.Backward,g.y=r*Math.abs((t.top+v.height-l)/v.height)):!a&&s>=t.bottom-v.height&&(p.y=de.Forward,g.y=r*Math.abs((t.bottom-v.height-s)/v.height)),!m&&f>=t.right-v.width?(p.x=de.Forward,g.x=r*Math.abs((t.right-v.width-f)/v.width)):!d&&h<=t.left+v.width&&(p.x=de.Backward,g.x=r*Math.abs((t.left+v.width-h)/v.width)),{direction:p,speed:g}}function ro(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:h}=window;return{top:0,left:0,right:l,bottom:h,width:l,height:h}}const{top:t,left:n,right:r,bottom:c}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:c,width:e.clientWidth,height:e.clientHeight}}function br(e){return e.reduce((t,n)=>Ze(t,an(n)),je)}function so(e){return e.reduce((t,n)=>t+gr(n),0)}function oo(e){return e.reduce((t,n)=>t+pr(n),0)}function yr(e,t){if(t===void 0&&(t=Ct),!e)return;const{top:n,left:r,bottom:c,right:l}=t(e);mr(e)&&(c<=0||l<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const io=[["x",["left","right"],so],["y",["top","bottom"],oo]];class yn{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=bn(n),c=br(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,h,f]of io)for(const s of h)Object.defineProperty(this,s,{get:()=>{const i=f(r),a=c[l]-i;return this.rect[s]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ft{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var c;(c=this.target)==null||c.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ao(e){const{EventTarget:t}=ve(e);return e instanceof t?e:nt(e)}function en(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Se;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Se||(Se={}));function Ln(e){e.preventDefault()}function lo(e){e.stopPropagation()}var X;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(X||(X={}));const wr={start:[X.Space,X.Enter],cancel:[X.Esc],end:[X.Space,X.Enter,X.Tab]},co=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case X.Right:return{...n,x:n.x+25};case X.Left:return{...n,x:n.x-25};case X.Down:return{...n,y:n.y+25};case X.Up:return{...n,y:n.y-25}}};class Cr{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new ft(nt(n)),this.windowListeners=new ft(ve(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Se.Resize,this.handleCancel),this.windowListeners.add(Se.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Se.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&yr(r),n(je)}handleKeyDown(t){if(xn(t)){const{active:n,context:r,options:c}=this.props,{keyboardCodes:l=wr,coordinateGetter:h=co,scrollBehavior:f="smooth"}=c,{code:s}=t;if(l.end.includes(s)){this.handleEnd(t);return}if(l.cancel.includes(s)){this.handleCancel(t);return}const{collisionRect:i}=r.current,a=i?{x:i.left,y:i.top}:je;this.referenceCoordinates||(this.referenceCoordinates=a);const d=h(t,{active:n,context:r.current,currentCoordinates:a});if(d){const m=Pt(d,a),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const v of g){const x=t.code,{isTop:S,isRight:b,isLeft:w,isBottom:E,maxScroll:R,minScroll:D}=xr(v),j=ro(v),C={x:Math.min(x===X.Right?j.right-j.width/2:j.right,Math.max(x===X.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(x===X.Down?j.bottom-j.height/2:j.bottom,Math.max(x===X.Down?j.top:j.top+j.height/2,d.y))},P=x===X.Right&&!b||x===X.Left&&!w,k=x===X.Down&&!E||x===X.Up&&!S;if(P&&C.x!==d.x){const T=v.scrollLeft+m.x,_=x===X.Right&&T<=R.x||x===X.Left&&T>=D.x;if(_&&!m.y){v.scrollTo({left:T,behavior:f});return}_?p.x=v.scrollLeft-T:p.x=x===X.Right?v.scrollLeft-R.x:v.scrollLeft-D.x,p.x&&v.scrollBy({left:-p.x,behavior:f});break}else if(k&&C.y!==d.y){const T=v.scrollTop+m.y,_=x===X.Down&&T<=R.y||x===X.Up&&T>=D.y;if(_&&!m.x){v.scrollTo({top:T,behavior:f});return}_?p.y=v.scrollTop-T:p.y=x===X.Down?v.scrollTop-R.y:v.scrollTop-D.y,p.y&&v.scrollBy({top:-p.y,behavior:f});break}}this.handleMove(t,Ze(Pt(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Cr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=wr,onActivation:c}=t,{active:l}=n;const{code:h}=e.nativeEvent;if(r.start.includes(h)){const f=l.activatorNode.current;return f&&e.target!==f?!1:(e.preventDefault(),c?.({event:e.nativeEvent}),!0)}return!1}}];function zn(e){return!!(e&&"distance"in e)}function Fn(e){return!!(e&&"delay"in e)}class wn{constructor(t,n,r){var c;r===void 0&&(r=ao(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:l}=t,{target:h}=l;this.props=t,this.events=n,this.document=nt(h),this.documentListeners=new ft(this.document),this.listeners=new ft(r),this.windowListeners=new ft(ve(h)),this.initialCoordinates=(c=Ot(l))!=null?c:je,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Se.Resize,this.handleCancel),this.windowListeners.add(Se.DragStart,Ln),this.windowListeners.add(Se.VisibilityChange,this.handleCancel),this.windowListeners.add(Se.ContextMenu,Ln),this.documentListeners.add(Se.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Fn(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(zn(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:c}=this.props;c(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Se.Click,lo,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Se.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:c,props:l}=this,{onMove:h,options:{activationConstraint:f}}=l;if(!c)return;const s=(n=Ot(t))!=null?n:je,i=Pt(c,s);if(!r&&f){if(zn(f)){if(f.tolerance!=null&&en(i,f.tolerance))return this.handleCancel();if(en(i,f.distance))return this.handleStart()}if(Fn(f)&&en(i,f.tolerance))return this.handleCancel();this.handlePending(f,i);return}t.cancelable&&t.preventDefault(),h(s)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===X.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const uo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Cn extends wn{constructor(t){const{event:n}=t,r=nt(n.target);super(t,uo,r)}}Cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const fo={move:{name:"mousemove"},end:{name:"mouseup"}};var ln;(function(e){e[e.RightClick=2]="RightClick"})(ln||(ln={}));class ho extends wn{constructor(t){super(t,fo,nt(t.event.target))}}ho.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ln.RightClick?!1:(r?.({event:n}),!0)}}];const tn={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class mo extends wn{constructor(t){super(t,tn)}static setup(){return window.addEventListener(tn.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(tn.move.name,t)};function t(){}}}mo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:c}=n;return c.length>1?!1:(r?.({event:n}),!0)}}];var ht;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ht||(ht={}));var zt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(zt||(zt={}));function go(e){let{acceleration:t,activator:n=ht.Pointer,canScroll:r,draggingRect:c,enabled:l,interval:h=5,order:f=zt.TreeOrder,pointerCoordinates:s,scrollableAncestors:i,scrollableAncestorRects:a,delta:d,threshold:m}=e;const p=vo({delta:d,disabled:!l}),[g,v]=js(),x=u.useRef({x:0,y:0}),S=u.useRef({x:0,y:0}),b=u.useMemo(()=>{switch(n){case ht.Pointer:return s?{top:s.y,bottom:s.y,left:s.x,right:s.x}:null;case ht.DraggableRect:return c}},[n,c,s]),w=u.useRef(null),E=u.useCallback(()=>{const D=w.current;if(!D)return;const j=x.current.x*S.current.x,C=x.current.y*S.current.y;D.scrollBy(j,C)},[]),R=u.useMemo(()=>f===zt.TreeOrder?[...i].reverse():i,[f,i]);u.useEffect(()=>{if(!l||!i.length||!b){v();return}for(const D of R){if(r?.(D)===!1)continue;const j=i.indexOf(D),C=a[j];if(!C)continue;const{direction:P,speed:k}=no(D,C,b,t,m);for(const T of["x","y"])p[T][P[T]]||(k[T]=0,P[T]=0);if(k.x>0||k.y>0){v(),w.current=D,g(E,h),x.current=k,S.current=P;return}}x.current={x:0,y:0},S.current={x:0,y:0},v()},[t,E,r,v,l,h,JSON.stringify(b),JSON.stringify(p),g,i,R,a,JSON.stringify(m)])}const po={x:{[de.Backward]:!1,[de.Forward]:!1},y:{[de.Backward]:!1,[de.Forward]:!1}};function vo(e){let{delta:t,disabled:n}=e;const r=It(t);return wt(c=>{if(n||!r||!c)return po;const l={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[de.Backward]:c.x[de.Backward]||l.x===-1,[de.Forward]:c.x[de.Forward]||l.x===1},y:{[de.Backward]:c.y[de.Backward]||l.y===-1,[de.Forward]:c.y[de.Forward]||l.y===1}}},[n,t,r])}function xo(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return wt(c=>{var l;return t==null?null:(l=r??c)!=null?l:null},[r,t])}function bo(e,t){return u.useMemo(()=>e.reduce((n,r)=>{const{sensor:c}=r,l=c.activators.map(h=>({eventName:h.eventName,handler:t(h.handler,r)}));return[...n,...l]},[]),[e,t])}var bt;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(bt||(bt={}));var cn;(function(e){e.Optimized="optimized"})(cn||(cn={}));const _n=new Map;function yo(e,t){let{dragging:n,dependencies:r,config:c}=t;const[l,h]=u.useState(null),{frequency:f,measure:s,strategy:i}=c,a=u.useRef(e),d=x(),m=vt(d),p=u.useCallback(function(S){S===void 0&&(S=[]),!m.current&&h(b=>b===null?S:b.concat(S.filter(w=>!b.includes(w))))},[m]),g=u.useRef(null),v=wt(S=>{if(d&&!n)return _n;if(!S||S===_n||a.current!==e||l!=null){const b=new Map;for(let w of e){if(!w)continue;if(l&&l.length>0&&!l.includes(w.id)&&w.rect.current){b.set(w.id,w.rect.current);continue}const E=w.node.current,R=E?new yn(s(E),E):null;w.rect.current=R,R&&b.set(w.id,R)}return b}return S},[e,l,n,d,s]);return u.useEffect(()=>{a.current=e},[e]),u.useEffect(()=>{d||p()},[n,d]),u.useEffect(()=>{l&&l.length>0&&h(null)},[JSON.stringify(l)]),u.useEffect(()=>{d||typeof f!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},f))},[f,d,p,...r]),{droppableRects:v,measureDroppableContainers:p,measuringScheduled:l!=null};function x(){switch(i){case bt.Always:return!1;case bt.BeforeDragging:return n;default:return!n}}}function Sn(e,t){return wt(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function wo(e,t){return Sn(e,t)}function Co(e){let{callback:t,disabled:n}=e;const r=$t(t),c=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(r)},[r,n]);return u.useEffect(()=>()=>c?.disconnect(),[c]),c}function Gt(e){let{callback:t,disabled:n}=e;const r=$t(t),c=u.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(r)},[n]);return u.useEffect(()=>()=>c?.disconnect(),[c]),c}function So(e){return new yn(Ct(e),e)}function Bn(e,t,n){t===void 0&&(t=So);const[r,c]=u.useState(null);function l(){c(s=>{if(!e)return null;if(e.isConnected===!1){var i;return(i=s??n)!=null?i:null}const a=t(e);return JSON.stringify(s)===JSON.stringify(a)?s:a})}const h=Co({callback(s){if(e)for(const i of s){const{type:a,target:d}=i;if(a==="childList"&&d instanceof HTMLElement&&d.contains(e)){l();break}}}}),f=Gt({callback:l});return _e(()=>{l(),e?(f?.observe(e),h?.observe(document.body,{childList:!0,subtree:!0})):(f?.disconnect(),h?.disconnect())},[e]),r}function Eo(e){const t=Sn(e);return fr(e,t)}const Un=[];function No(e){const t=u.useRef(e),n=wt(r=>e?r&&r!==Un&&e&&t.current&&e.parentNode===t.current.parentNode?r:bn(e):Un,[e]);return u.useEffect(()=>{t.current=e},[e]),n}function Ro(e){const[t,n]=u.useState(null),r=u.useRef(e),c=u.useCallback(l=>{const h=Zt(l.target);h&&n(f=>f?(f.set(h,an(h)),new Map(f)):null)},[]);return u.useEffect(()=>{const l=r.current;if(e!==l){h(l);const f=e.map(s=>{const i=Zt(s);return i?(i.addEventListener("scroll",c,{passive:!0}),[i,an(i)]):null}).filter(s=>s!=null);n(f.length?new Map(f):null),r.current=e}return()=>{h(e),h(l)};function h(f){f.forEach(s=>{const i=Zt(s);i?.removeEventListener("scroll",c)})}},[c,e]),u.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,h)=>Ze(l,h),je):br(e):je,[e,t])}function $n(e,t){t===void 0&&(t=[]);const n=u.useRef(null);return u.useEffect(()=>{n.current=null},t),u.useEffect(()=>{const r=e!==je;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Pt(e,n.current):je}function jo(e){u.useEffect(()=>{if(!Ut)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function ko(e,t){return u.useMemo(()=>e.reduce((n,r)=>{let{eventName:c,handler:l}=r;return n[c]=h=>{l(h,t)},n},{}),[e,t])}function Sr(e){return u.useMemo(()=>e?Js(e):null,[e])}const Kn=[];function To(e,t){t===void 0&&(t=Ct);const[n]=e,r=Sr(n?ve(n):null),[c,l]=u.useState(Kn);function h(){l(()=>e.length?e.map(s=>vr(s)?r:new yn(t(s),s)):Kn)}const f=Gt({callback:h});return _e(()=>{f?.disconnect(),h(),e.forEach(s=>f?.observe(s))},[e]),c}function Er(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return yt(t)?t:e}function Ao(e){let{measure:t}=e;const[n,r]=u.useState(null),c=u.useCallback(i=>{for(const{target:a}of i)if(yt(a)){r(d=>{const m=t(a);return d?{...d,width:m.width,height:m.height}:m});break}},[t]),l=Gt({callback:c}),h=u.useCallback(i=>{const a=Er(i);l?.disconnect(),a&&l?.observe(a),r(a?t(a):null)},[t,l]),[f,s]=Mt(h);return u.useMemo(()=>({nodeRef:f,rect:n,setRef:s}),[n,f,s])}const Do=[{sensor:Cn,options:{}},{sensor:Cr,options:{}}],Mo={current:{}},Tt={draggable:{measure:On},droppable:{measure:On,strategy:bt.WhileDragging,frequency:cn.Optimized},dragOverlay:{measure:Ct}};class mt extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Io={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Lt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Tt,measureDroppableContainers:Lt,windowRect:null,measuringScheduled:!1},Nr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Lt,draggableNodes:new Map,over:null,measureDroppableContainers:Lt},St=u.createContext(Nr),Rr=u.createContext(Io);function Po(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mt}}}function Oo(e,t){switch(t.type){case ce.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ce.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case ce.DragEnd:case ce.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ce.RegisterDroppable:{const{element:n}=t,{id:r}=n,c=new mt(e.droppable.containers);return c.set(r,n),{...e,droppable:{...e.droppable,containers:c}}}case ce.SetDroppableDisabled:{const{id:n,key:r,disabled:c}=t,l=e.droppable.containers.get(n);if(!l||r!==l.key)return e;const h=new mt(e.droppable.containers);return h.set(n,{...l,disabled:c}),{...e,droppable:{...e.droppable,containers:h}}}case ce.UnregisterDroppable:{const{id:n,key:r}=t,c=e.droppable.containers.get(n);if(!c||r!==c.key)return e;const l=new mt(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Lo(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:c}=u.useContext(St),l=It(r),h=It(n?.id);return u.useEffect(()=>{if(!t&&!r&&l&&h!=null){if(!xn(l)||document.activeElement===l.target)return;const f=c.get(h);if(!f)return;const{activatorNode:s,node:i}=f;if(!s.current&&!i.current)return;requestAnimationFrame(()=>{for(const a of[s.current,i.current]){if(!a)continue;const d=As(a);if(d){d.focus();break}}})}},[r,t,c,h,l]),null}function jr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((c,l)=>l({transform:c,...r}),n):n}function zo(e){return u.useMemo(()=>({draggable:{...Tt.draggable,...e?.draggable},droppable:{...Tt.droppable,...e?.droppable},dragOverlay:{...Tt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fo(e){let{activeNode:t,measure:n,initialRect:r,config:c=!0}=e;const l=u.useRef(!1),{x:h,y:f}=typeof c=="boolean"?{x:c,y:c}:c;_e(()=>{if(!h&&!f||!t){l.current=!1;return}if(l.current||!r)return;const i=t?.node.current;if(!i||i.isConnected===!1)return;const a=n(i),d=fr(a,r);if(h||(d.x=0),f||(d.y=0),l.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const m=mr(i);m&&m.scrollBy({top:d.y,left:d.x})}},[t,h,f,r,n])}const Wt=u.createContext({...je,scaleX:1,scaleY:1});var $e;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})($e||($e={}));const _o=u.memo(function(t){var n,r,c,l;let{id:h,accessibility:f,autoScroll:s=!0,children:i,sensors:a=Do,collisionDetection:d=Qs,measuring:m,modifiers:p,...g}=t;const v=u.useReducer(Oo,void 0,Po),[x,S]=v,[b,w]=Ls(),[E,R]=u.useState($e.Uninitialized),D=E===$e.Initialized,{draggable:{active:j,nodes:C,translate:P},droppable:{containers:k}}=x,T=j!=null?C.get(j):null,_=u.useRef({initial:null,translated:null}),q=u.useMemo(()=>{var H;return j!=null?{id:j,data:(H=T?.data)!=null?H:Mo,rect:_}:null},[j,T]),N=u.useRef(null),[O,V]=u.useState(null),[L,M]=u.useState(null),B=vt(g,Object.values(g)),$=Kt("DndDescribedBy",h),oe=u.useMemo(()=>k.getEnabled(),[k]),ue=zo(m),{droppableRects:ee,measureDroppableContainers:A,measuringScheduled:Q}=yo(oe,{dragging:D,dependencies:[P.x,P.y],config:ue.droppable}),z=xo(C,j),re=u.useMemo(()=>L?Ot(L):null,[L]),G=Y(),K=wo(z,ue.draggable.measure);Fo({activeNode:j!=null?C.get(j):null,config:G.layoutShiftCompensation,initialRect:K,measure:ue.draggable.measure});const ie=Bn(z,ue.draggable.measure,K),ke=Bn(z?z.parentElement:null),be=u.useRef({activatorEvent:null,active:null,activeNode:z,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=k.getNodeFor((n=be.current.over)==null?void 0:n.id),ye=Ao({measure:ue.dragOverlay.measure}),Xe=(r=ye.nodeRef.current)!=null?r:z,Ee=D?(c=ye.rect)!=null?c:ie:null,Et=!!(ye.nodeRef.current&&ye.rect),Ve=Eo(Et?null:ie),Ge=Sr(Xe?ve(Xe):null),Ne=No(D?Te??z:null),We=To(Ne),Qe=jr(p,{transform:{x:P.x-Ve.x,y:P.y-Ve.y,scaleX:1,scaleY:1},activatorEvent:L,active:q,activeNodeRect:ie,containerNodeRect:ke,draggingNodeRect:Ee,over:be.current.over,overlayNodeRect:ye.rect,scrollableAncestors:Ne,scrollableAncestorRects:We,windowRect:Ge}),Ae=re?Ze(re,P):null,rt=Ro(Ne),st=$n(rt),Nt=$n(rt,[ie]),Pe=Ze(Qe,st),Oe=Ee?qs(Ee,Qe):null,Ye=q&&Oe?d({active:q,collisionRect:Oe,droppableRects:ee,droppableContainers:oe,pointerCoordinates:Ae}):null,Rt=Gs(Ye,"id"),[we,Le]=u.useState(null),Qt=Et?Qe:Ze(Qe,Nt),Yt=Ys(Qt,(l=we?.rect)!=null?l:null,ie),ot=u.useRef(null),jt=u.useCallback((H,Z)=>{let{sensor:J,options:pe}=Z;if(N.current==null)return;const te=C.get(N.current);if(!te)return;const fe=H.nativeEvent,xe=new J({active:N.current,activeNode:te,event:fe,options:pe,context:be,onAbort(le){if(!C.get(le))return;const{onDragAbort:ge}=B.current,Ce={id:le};ge?.(Ce),b({type:"onDragAbort",event:Ce})},onPending(le,he,ge,Ce){if(!C.get(le))return;const{onDragPending:it}=B.current,Ue={id:le,constraint:he,initialCoordinates:ge,offset:Ce};it?.(Ue),b({type:"onDragPending",event:Ue})},onStart(le){const he=N.current;if(he==null)return;const ge=C.get(he);if(!ge)return;const{onDragStart:Ce}=B.current,ze={activatorEvent:fe,active:{id:he,data:ge.data,rect:_}};ct.unstable_batchedUpdates(()=>{Ce?.(ze),R($e.Initializing),S({type:ce.DragStart,initialCoordinates:le,active:he}),b({type:"onDragStart",event:ze}),V(ot.current),M(fe)})},onMove(le){S({type:ce.DragMove,coordinates:le})},onEnd:Be(ce.DragEnd),onCancel:Be(ce.DragCancel)});ot.current=xe;function Be(le){return async function(){const{active:ge,collisions:Ce,over:ze,scrollAdjustedTranslate:it}=be.current;let Ue=null;if(ge&&it){const{cancelDrop:at}=B.current;Ue={activatorEvent:fe,active:ge,collisions:Ce,delta:it,over:ze},le===ce.DragEnd&&typeof at=="function"&&await Promise.resolve(at(Ue))&&(le=ce.DragCancel)}N.current=null,ct.unstable_batchedUpdates(()=>{S({type:le}),R($e.Uninitialized),Le(null),V(null),M(null),ot.current=null;const at=le===ce.DragEnd?"onDragEnd":"onDragCancel";if(Ue){const qt=B.current[at];qt?.(Ue),b({type:at,event:Ue})}})}}},[C]),Ht=u.useCallback((H,Z)=>(J,pe)=>{const te=J.nativeEvent,fe=C.get(pe);if(N.current!==null||!fe||te.dndKit||te.defaultPrevented)return;const xe={active:fe};H(J,Z.options,xe)===!0&&(te.dndKit={capturedBy:Z.sensor},N.current=pe,jt(J,Z))},[C,jt]),y=bo(a,Ht);jo(a),_e(()=>{ie&&E===$e.Initializing&&R($e.Initialized)},[ie,E]),u.useEffect(()=>{const{onDragMove:H}=B.current,{active:Z,activatorEvent:J,collisions:pe,over:te}=be.current;if(!Z||!J)return;const fe={active:Z,activatorEvent:J,collisions:pe,delta:{x:Pe.x,y:Pe.y},over:te};ct.unstable_batchedUpdates(()=>{H?.(fe),b({type:"onDragMove",event:fe})})},[Pe.x,Pe.y]),u.useEffect(()=>{const{active:H,activatorEvent:Z,collisions:J,droppableContainers:pe,scrollAdjustedTranslate:te}=be.current;if(!H||N.current==null||!Z||!te)return;const{onDragOver:fe}=B.current,xe=pe.get(Rt),Be=xe&&xe.rect.current?{id:xe.id,rect:xe.rect.current,data:xe.data,disabled:xe.disabled}:null,le={active:H,activatorEvent:Z,collisions:J,delta:{x:te.x,y:te.y},over:Be};ct.unstable_batchedUpdates(()=>{Le(Be),fe?.(le),b({type:"onDragOver",event:le})})},[Rt]),_e(()=>{be.current={activatorEvent:L,active:q,activeNode:z,collisionRect:Oe,collisions:Ye,droppableRects:ee,draggableNodes:C,draggingNode:Xe,draggingNodeRect:Ee,droppableContainers:k,over:we,scrollableAncestors:Ne,scrollAdjustedTranslate:Pe},_.current={initial:Ee,translated:Oe}},[q,z,Ye,Oe,C,Xe,Ee,ee,k,we,Ne,Pe]),go({...G,delta:P,draggingRect:Oe,pointerCoordinates:Ae,scrollableAncestors:Ne,scrollableAncestorRects:We});const I=u.useMemo(()=>({active:q,activeNode:z,activeNodeRect:ie,activatorEvent:L,collisions:Ye,containerNodeRect:ke,dragOverlay:ye,draggableNodes:C,droppableContainers:k,droppableRects:ee,over:we,measureDroppableContainers:A,scrollableAncestors:Ne,scrollableAncestorRects:We,measuringConfiguration:ue,measuringScheduled:Q,windowRect:Ge}),[q,z,ie,L,Ye,ke,ye,C,k,ee,we,A,Ne,We,ue,Q,Ge]),W=u.useMemo(()=>({activatorEvent:L,activators:y,active:q,activeNodeRect:ie,ariaDescribedById:{draggable:$},dispatch:S,draggableNodes:C,over:we,measureDroppableContainers:A}),[L,y,q,ie,S,$,C,we,A]);return F.createElement(dr.Provider,{value:w},F.createElement(St.Provider,{value:W},F.createElement(Rr.Provider,{value:I},F.createElement(Wt.Provider,{value:Yt},i)),F.createElement(Lo,{disabled:f?.restoreFocus===!1})),F.createElement(_s,{...f,hiddenTextDescribedById:$}));function Y(){const H=O?.autoScrollEnabled===!1,Z=typeof s=="object"?s.enabled===!1:s===!1,J=D&&!H&&!Z;return typeof s=="object"?{...s,enabled:J}:{enabled:J}}}),Bo=u.createContext(null),Gn="button",Uo="Draggable";function $o(e){let{id:t,data:n,disabled:r=!1,attributes:c}=e;const l=Kt(Uo),{activators:h,activatorEvent:f,active:s,activeNodeRect:i,ariaDescribedById:a,draggableNodes:d,over:m}=u.useContext(St),{role:p=Gn,roleDescription:g="draggable",tabIndex:v=0}=c??{},x=s?.id===t,S=u.useContext(x?Wt:Bo),[b,w]=Mt(),[E,R]=Mt(),D=ko(h,t),j=vt(n);_e(()=>(d.set(t,{id:t,key:l,node:b,activatorNode:E,data:j}),()=>{const P=d.get(t);P&&P.key===l&&d.delete(t)}),[d,t]);const C=u.useMemo(()=>({role:p,tabIndex:v,"aria-disabled":r,"aria-pressed":x&&p===Gn?!0:void 0,"aria-roledescription":g,"aria-describedby":a.draggable}),[r,p,v,x,g,a.draggable]);return{active:s,activatorEvent:f,activeNodeRect:i,attributes:C,isDragging:x,listeners:r?void 0:D,node:b,over:m,setNodeRef:w,setActivatorNodeRef:R,transform:S}}function Ko(){return u.useContext(Rr)}const Go="Droppable",Wo={timeout:25};function Qo(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:c}=e;const l=Kt(Go),{active:h,dispatch:f,over:s,measureDroppableContainers:i}=u.useContext(St),a=u.useRef({disabled:n}),d=u.useRef(!1),m=u.useRef(null),p=u.useRef(null),{disabled:g,updateMeasurementsFor:v,timeout:x}={...Wo,...c},S=vt(v??r),b=u.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{i(Array.isArray(S.current)?S.current:[S.current]),p.current=null},x)},[x]),w=Gt({callback:b,disabled:g||!h}),E=u.useCallback((C,P)=>{w&&(P&&(w.unobserve(P),d.current=!1),C&&w.observe(C))},[w]),[R,D]=Mt(E),j=vt(t);return u.useEffect(()=>{!w||!R.current||(w.disconnect(),d.current=!1,w.observe(R.current))},[R,w]),u.useEffect(()=>(f({type:ce.RegisterDroppable,element:{id:r,key:l,disabled:n,node:R,rect:m,data:j}}),()=>f({type:ce.UnregisterDroppable,key:l,id:r})),[r]),u.useEffect(()=>{n!==a.current.disabled&&(f({type:ce.SetDroppableDisabled,id:r,key:l,disabled:n}),a.current.disabled=n)},[r,l,n,f]),{active:h,rect:m,isOver:s?.id===r,node:R,over:s,setNodeRef:D}}function Yo(e){let{animation:t,children:n}=e;const[r,c]=u.useState(null),[l,h]=u.useState(null),f=It(n);return!n&&!r&&f&&c(f),_e(()=>{if(!l)return;const s=r?.key,i=r?.props.id;if(s==null||i==null){c(null);return}Promise.resolve(t(i,l)).then(()=>{c(null)})},[t,r,l]),F.createElement(F.Fragment,null,n,r?u.cloneElement(r,{ref:h}):null)}const Ho={x:0,y:0,scaleX:1,scaleY:1};function qo(e){let{children:t}=e;return F.createElement(St.Provider,{value:Nr},F.createElement(Wt.Provider,{value:Ho},t))}const Xo={position:"fixed",touchAction:"none"},Vo=e=>xn(e)?"transform 250ms ease":void 0,Jo=u.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:c,children:l,className:h,rect:f,style:s,transform:i,transition:a=Vo}=e;if(!f)return null;const d=c?i:{...i,scaleX:1,scaleY:1},m={...Xo,width:f.width,height:f.height,top:f.top,left:f.left,transform:xt.Transform.toString(d),transformOrigin:c&&r?$s(r,f):void 0,transition:typeof a=="function"?a(r):a,...s};return F.createElement(n,{className:h,style:m,ref:t},l)}),Zo=e=>t=>{let{active:n,dragOverlay:r}=t;const c={},{styles:l,className:h}=e;if(l!=null&&l.active)for(const[f,s]of Object.entries(l.active))s!==void 0&&(c[f]=n.node.style.getPropertyValue(f),n.node.style.setProperty(f,s));if(l!=null&&l.dragOverlay)for(const[f,s]of Object.entries(l.dragOverlay))s!==void 0&&r.node.style.setProperty(f,s);return h!=null&&h.active&&n.node.classList.add(h.active),h!=null&&h.dragOverlay&&r.node.classList.add(h.dragOverlay),function(){for(const[s,i]of Object.entries(c))n.node.style.setProperty(s,i);h!=null&&h.active&&n.node.classList.remove(h.active)}},ei=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:xt.Transform.toString(t)},{transform:xt.Transform.toString(n)}]},ti={duration:250,easing:"ease",keyframes:ei,sideEffects:Zo({styles:{active:{opacity:"0"}}})};function ni(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:c}=e;return $t((l,h)=>{if(t===null)return;const f=n.get(l);if(!f)return;const s=f.node.current;if(!s)return;const i=Er(h);if(!i)return;const{transform:a}=ve(h).getComputedStyle(h),d=hr(a);if(!d)return;const m=typeof t=="function"?t:ri(t);return yr(s,c.draggable.measure),m({active:{id:l,data:f.data,node:s,rect:c.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:h,rect:c.dragOverlay.measure(i)},droppableContainers:r,measuringConfiguration:c,transform:d})})}function ri(e){const{duration:t,easing:n,sideEffects:r,keyframes:c}={...ti,...e};return l=>{let{active:h,dragOverlay:f,transform:s,...i}=l;if(!t)return;const a={x:f.rect.left-h.rect.left,y:f.rect.top-h.rect.top},d={scaleX:s.scaleX!==1?h.rect.width*s.scaleX/f.rect.width:1,scaleY:s.scaleY!==1?h.rect.height*s.scaleY/f.rect.height:1},m={x:s.x-a.x,y:s.y-a.y,...d},p=c({...i,active:h,dragOverlay:f,transform:{initial:s,final:m}}),[g]=p,v=p[p.length-1];if(JSON.stringify(g)===JSON.stringify(v))return;const x=r?.({active:h,dragOverlay:f,...i}),S=f.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(b=>{S.onfinish=()=>{x?.(),b()}})}}let Wn=0;function si(e){return u.useMemo(()=>{if(e!=null)return Wn++,Wn},[e])}const oi=F.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:c,transition:l,modifiers:h,wrapperElement:f="div",className:s,zIndex:i=999}=e;const{activatorEvent:a,active:d,activeNodeRect:m,containerNodeRect:p,draggableNodes:g,droppableContainers:v,dragOverlay:x,over:S,measuringConfiguration:b,scrollableAncestors:w,scrollableAncestorRects:E,windowRect:R}=Ko(),D=u.useContext(Wt),j=si(d?.id),C=jr(h,{activatorEvent:a,active:d,activeNodeRect:m,containerNodeRect:p,draggingNodeRect:x.rect,over:S,overlayNodeRect:x.rect,scrollableAncestors:w,scrollableAncestorRects:E,transform:D,windowRect:R}),P=Sn(m),k=ni({config:r,draggableNodes:g,droppableContainers:v,measuringConfiguration:b}),T=P?x.setRef:void 0;return F.createElement(qo,null,F.createElement(Yo,{animation:k},d&&j?F.createElement(Jo,{key:j,id:d.id,ref:T,as:f,activatorEvent:a,adjustScale:t,className:s,transition:l,rect:P,style:{zIndex:i,...c},transform:C},n):null))}),kr=768;function ii(e){const t=window.matchMedia(`(max-width: ${kr-1}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function ai(){return window.innerWidth<kr}function li(){return!1}function Tr(){return u.useSyncExternalStore(ii,ai,li)}function ci(e,t){const n=[];if(!e||e.length===0)return n;const r=e.some(l=>l.status==="ACTIVE");return e.some(l=>l.sessions?.some(h=>h.status===Nn.RUNNING||h.status===Nn.PENDING))&&n.push(t("正在运行的 Agent 将被停止")),r&&(n.push(t("分支上未合并的变更将丢失")),n.push(t("关联的工作目录(worktree)将被清理"))),n}function ui({isOpen:e,onClose:t,onConfirm:n,taskId:r,taskTitle:c,workspaces:l,isLoading:h}){const{t:f}=Ie(),{data:s,isLoading:i}=ls(l===void 0&&e?r:""),a=l??s,d=l===void 0&&e&&i,m=u.useMemo(()=>ci(a,f),[a,f]);return o.jsx(as,{isOpen:e,onClose:t,onConfirm:n,title:f("删除任务"),description:o.jsxs(o.Fragment,{children:[o.jsx("p",{children:f("确认删除任务「{title}」?此操作不可撤销。",{title:c})}),d?o.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f("加载中...")}):m.length>0?o.jsx("ul",{className:"mt-2 space-y-1",children:m.map((p,g)=>o.jsxs("li",{className:"flex items-start gap-1.5 text-warning-ink",children:[o.jsx("span",{className:"mt-1 shrink-0 w-1.5 h-1.5 rounded-full bg-warning"}),o.jsx("span",{children:p})]},g))}):null]}),confirmText:f("删除"),variant:"danger",isLoading:h||d})}const di="flex w-full min-w-0 items-center gap-2.5 rounded-md px-2 text-sm pointer-coarse:text-[15px] text-left transition-[background-color,box-shadow,color] duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",fi="h-8 pointer-coarse:h-10";function ut(e){return ae(di,fi,e?"bg-background text-foreground shadow-xs ring-1 ring-border/80":"text-foreground/80 hover:bg-accent hover:text-foreground active:bg-foreground/[0.06]")}const un=60,dn=60*un,nn=24*dn,Qn=new Map;function hi(e){let t=Qn.get(e);return t||(t={monthDay:new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}),yearMonth:new Intl.DateTimeFormat(e,{year:"numeric",month:"numeric"})},Qn.set(e,t)),t}function mi(e,t,n){const r=new Date(e);if(!Number.isFinite(r.getTime()))return"—";const c=new Date,l=Math.max(0,Math.floor((c.getTime()-r.getTime())/1e3));if(l<un)return t("now");if(l<dn)return t("{count}m",{count:Math.floor(l/un)});if(l<nn)return t("{count}h",{count:Math.floor(l/dn)});if(l<7*nn)return t("{count}d",{count:Math.floor(l/nn)});const h=hi(n);return(r.getFullYear()===c.getFullYear()?h.monthDay:h.yearMonth).format(r)}let gi;function pi(e,t,n){const r=e.replace(/\s+/g," ").trim();if(n(r)<=t)return r;if(n("…")>t)return"";const c=typeof Intl.Segmenter>"u"?Array.from(r):Array.from((gi??=new Intl.Segmenter(void 0,{granularity:"grapheme"})).segment(r),f=>f.segment);let l=0,h=c.length;for(;l<h;){const f=Math.ceil((l+h)/2);n(`${c.slice(0,f).join("")}…`)<=t?l=f:h=f-1}return`${c.slice(0,l).join("")}…`}const dt=new Map,At=new Set;let He;function Yn(){for(const e of At)dt.get(e)?.(document.visibilityState!=="hidden")}function vi(e,t){if(typeof IntersectionObserver>"u")return()=>{};if(!He){const n=new IntersectionObserver(r=>{if(He===n)for(const c of r){const l=dt.get(c.target);if(!l)continue;const h=c.isIntersecting&&c.intersectionRatio>0;h?At.add(c.target):At.delete(c.target),l(h&&document.visibilityState!=="hidden")}});He=n,document.addEventListener("visibilitychange",Yn)}return dt.set(e,t),He.observe(e),()=>{dt.delete(e),At.delete(e),He?.unobserve(e),dt.size===0&&(He?.disconnect(),He=void 0,document.removeEventListener("visibilitychange",Yn))}}const fn=4200,Hn=fn*.4,xi=1e3/30;function bi(e){try{return e?.getContext("2d")??null}catch{return null}}function yi({hostRef:e,text:t,variant:n,animate:r}){const c=u.useRef(null);return u.useLayoutEffect(()=>{const l=e.current,h=c.current,f=bi(h);if(!l||!h||!f)return;const s=l.closest(".task-row"),i=matchMedia("(prefers-reduced-motion: reduce)"),a=matchMedia("(hover: hover)");let d=0,m,p=0,g=0,v=0,x=0,S=0,b=0,w="",E="",R="",D=!1;function j(){cancelAnimationFrame(d),clearTimeout(m),d=0,m=void 0}function C(N){if(!(!f||!l)){if(f.clearRect(0,0,v,x),f.globalCompositeOperation="source-over",n==="project"){const O=f.createLinearGradient(b*.6,0,b*2.6,0);O.addColorStop(0,w),O.addColorStop(1,E),f.fillStyle=O}else f.fillStyle=w;if(f.fillText(R,0,S),n==="running"&&N<1){const O=(-1.5+1.5*N)*v,V=f.createLinearGradient(O,0,O+v*2.5,0),L=M=>`rgba(0, 0, 0, ${M})`;V.addColorStop(0,L(1)),V.addColorStop(.4,L(1)),V.addColorStop(.5,L(.4)),V.addColorStop(.6,L(1)),V.addColorStop(1,L(1)),f.globalCompositeOperation="destination-in",f.fillStyle=V,f.fillRect(0,0,v,x),f.globalCompositeOperation="source-over"}l.dataset.gradientReady="true"}}function P(N){if(D)return;const O=(N-p)%fn;N-g>=xi&&(C(Math.min(O/Hn,1)),g=N),O>=Hn?(C(1),m=setTimeout(()=>{d=requestAnimationFrame(P)},fn-O)):d=requestAnimationFrame(P)}function k(){if(j(),!l||!h||!f||D||(delete l.dataset.gradientReady,v=l.clientWidth,x=l.clientHeight,!v||!x))return;const N=getComputedStyle(l),O=Math.min(window.devicePixelRatio||1,3);h.width=Math.ceil(v*O),h.height=Math.ceil(x*O),f.setTransform(O,0,0,O,0,0),f.font=`${N.fontStyle} ${N.fontWeight} ${N.fontSize} ${N.fontFamily}`,f.textBaseline="alphabetic",b=Number.parseFloat(N.fontSize);const V=f.measureText("Mg"),L=V.fontBoundingBoxAscent??b*.8,M=V.fontBoundingBoxDescent??b*.2;S=(x-L-M)/2+L,w=N.color,E=N.getPropertyValue("--muted-foreground").trim()||w,R=pi(t,v,$=>f.measureText($).width);try{C(1)}catch{return}const B=i.matches||s?.matches(":focus-visible")||a.matches&&s?.matches(":hover");n==="running"&&r&&!B&&(p=performance.now(),g=0,d=requestAnimationFrame(P))}const T=typeof ResizeObserver>"u"?void 0:new ResizeObserver(k);T?.observe(l);const _=new MutationObserver(k);_.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),_.observe(l,{attributes:!0,attributeFilter:["class","style"]});const q=()=>{j(),delete l.dataset.gradientReady};h.addEventListener("contextlost",q),h.addEventListener("contextrestored",k),i.addEventListener("change",k),a.addEventListener("change",k);for(const N of["pointerenter","pointerleave","focus","blur"])s?.addEventListener(N,k);return window.addEventListener("resize",k),document.fonts?.addEventListener("loadingdone",k),k(),()=>{D=!0,j(),T?.disconnect(),_.disconnect(),i.removeEventListener("change",k),a.removeEventListener("change",k);for(const N of["pointerenter","pointerleave","focus","blur"])s?.removeEventListener(N,k);window.removeEventListener("resize",k),document.fonts?.removeEventListener("loadingdone",k),h.removeEventListener("contextlost",q),h.removeEventListener("contextrestored",k),delete l.dataset.gradientReady,h.width=0,h.height=0}},[e,t,n,r]),o.jsx("canvas",{ref:c,className:"task-gradient-text__canvas","aria-hidden":"true"})}function qn({text:e,variant:t,animate:n=!0,className:r}){const c=u.useRef(null),[l,h]=u.useState(!1);return u.useEffect(()=>{if(c.current)return vi(c.current,h)},[]),o.jsxs("span",{ref:c,className:ae("task-gradient-text",r),"data-text-effect":t,children:[o.jsx("span",{className:"task-gradient-text__text",children:e}),l&&o.jsx(yi,{hostRef:c,text:e,variant:t,animate:n})]})}const Ar=u.createContext(null),wi=3e4;function Ci(e=wi){const[,t]=u.useState(0);u.useEffect(()=>{const n=setInterval(()=>t(r=>r+1),e);return()=>clearInterval(n)},[e])}function Si(e){const t=qr(e,9,"..");if(t===e)return e;const n=t.slice(0,-2),r=n.search(/[-_.\s][^-_.\s]*$/);return`${r>=3?n.slice(0,r):n}..`}const rn="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] text-foreground/80 transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:outline-none",Xn="px-2 pb-1 pt-1.5 text-xs font-medium text-muted-foreground",Vn=o.jsx("div",{className:"-mx-1 my-1 h-px bg-border/60"});function Ei({task:e,status:t,isSelected:n,project:r,showProject:c,onSelectTask:l,onTaskStatusChange:h,onDeleteTask:f,onTaskPriorityChange:s,disableDrag:i}){const{t:a,locale:d}=Ie(),m=u.useContext(Ar),p=u.useRef(null),g=!!e.projectArchivedAt,v=g||!!i,{attributes:x,listeners:S,setNodeRef:b,isDragging:w}=$o({id:e.id,data:{task:e,fromStatus:t},disabled:v}),E=u.useCallback(M=>{p.current=M,b(M),m&&(M?m.registry.set(e.id,M):m.registry.delete(e.id))},[b,m,e.id]);u.useEffect(()=>()=>{m?.registry.delete(e.id)},[e.id,m]);const[R,D]=u.useState(null),[j,C]=u.useState(!1),P=u.useRef(null),k=u.useRef(null),T=u.useCallback(M=>{g||!h&&!f&&!s||(M.preventDefault(),D({x:M.clientX,y:M.clientY}))},[g,h,f,s]),_=u.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null)},[]),q=u.useCallback(M=>{if(!i||g||!h&&!f)return;const B=M.touches[0];if(!B)return;const{clientX:$,clientY:oe}=B;k.current=setTimeout(()=>{k.current=null,D({x:$,y:oe})},500)},[i,g,h,f]);u.useEffect(()=>{if(!R)return;const M=()=>D(null),B=oe=>{P.current&&!P.current.contains(oe.target)&&M()},$=oe=>{oe.key==="Escape"&&M()};return document.addEventListener("mousedown",B),document.addEventListener("touchstart",B),document.addEventListener("keydown",$),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{document.removeEventListener("mousedown",B),document.removeEventListener("touchstart",B),document.removeEventListener("keydown",$),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M)}},[R]),u.useLayoutEffect(()=>{const M=P.current;if(!R||!M)return;const B=8;M.style.left=`${Math.max(B,Math.min(R.x,window.innerWidth-M.offsetWidth-B))}px`,M.style.top=`${Math.max(B,Math.min(R.y,window.innerHeight-M.offsetHeight-B))}px`},[R]);const N=r?r.name:void 0,O=c?r:void 0,V=e.updatedAt?mi(e.updatedAt,a,d):null,{titleClass:L}=gt[t];return o.jsxs(o.Fragment,{children:[o.jsxs("button",{ref:E,type:"button",onClick:()=>l(e.id),onContextMenu:T,onTouchStart:q,onTouchEnd:_,onTouchMove:_,title:O?`${e.title} · ${O.name}`:e.title,"aria-label":N?`${e.title} — ${N}`:e.title,"aria-current":n||void 0,"data-sidebar-item":"",className:ae("task-row animate-task-enter",ut(n),w&&"opacity-30"),...v?{}:S,...v?{}:x,children:[t===ne.Running?o.jsx(qn,{text:e.title,variant:"running",animate:!n,className:ae("min-w-0 flex-1 truncate",L)}):o.jsx("span",{className:ae("min-w-0 flex-1 truncate",L),children:e.title}),e.priority!==void 0&&e.priority!==Dt.NORMAL&&o.jsx(kn,{priority:e.priority}),e.projectArchivedAt&&o.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full bg-foreground/[0.06] px-1.5 py-0.5 text-xs font-medium leading-none text-muted-foreground",children:e.projectRepoDeletedAt?a("源码已删除"):a("已删除")}),(V||O)&&o.jsx("span",{className:"task-row-meta",children:o.jsxs("span",{className:"flex items-center gap-1",children:[O&&o.jsx("span",{className:"shrink-0 whitespace-nowrap rounded bg-foreground/[0.05] px-1 py-0.5 text-[10px] font-medium leading-none @max-[22rem]:hidden",children:o.jsx(qn,{text:Si(O.name),variant:"project",className:O.color})}),V&&o.jsx("span",{className:"shrink-0 text-[11px] tabular-nums text-muted-foreground",children:V})]})})]}),R&&o.jsxs("div",{ref:P,role:"menu",className:"fixed z-[100] w-48 rounded-lg border border-border bg-popover p-1 shadow-popover shadow-black/5 animate-in fade-in zoom-in-95 duration-100",children:[h&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:Xn,children:a("Move to")}),Yr.filter(M=>M!==t).map(M=>{const{icon:B,label:$,accentClass:oe}=gt[M];return o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(e.id,M),D(null)},className:rn,children:[o.jsx(B,{className:ae("size-3.5 shrink-0",oe)}),o.jsx("span",{children:a($)})]},M)})]}),s&&o.jsxs(o.Fragment,{children:[h&&Vn,o.jsx("div",{className:Xn,children:a("Priority")}),Hr.map(M=>{const B=(e.priority??Dt.NORMAL)===M.value;return o.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":B,onClick:()=>{s(e.id,M.value),D(null)},className:rn,children:[o.jsx(kn,{priority:M.value}),o.jsx("span",{className:"flex-1",children:a(M.label)}),B&&o.jsx(pt,{className:"size-3.5 shrink-0 text-foreground","aria-hidden":!0})]},M.value)})]}),f&&o.jsxs(o.Fragment,{children:[(h||s)&&Vn,o.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{C(!0),D(null)},className:ae(rn,"text-destructive-ink hover:bg-destructive/10 hover:text-destructive-ink focus-visible:bg-destructive/10"),children:[o.jsx(fs,{className:"size-3.5 shrink-0","aria-hidden":!0}),o.jsx("span",{children:a("Delete Task")})]})]})]}),o.jsx(ui,{isOpen:j,onClose:()=>C(!1),onConfirm:()=>{f?.(e.id),C(!1)},taskId:e.id,taskTitle:e.title})]})}const Ni=u.memo(function({title:t,tasks:n,status:r,defaultOpen:c,selectedTaskId:l,onSelectTask:h,projects:f,showProject:s=!0,isDragging:i,dragFromStatus:a,onTaskStatusChange:d,onDeleteTask:m,onTaskPriorityChange:p,disableDrag:g}){const{t:v}=Ie(),[x,S]=u.useState(c);Ci();const b=n.length===0,w=i&&a===r,E=i&&a!==r,{setNodeRef:R,isOver:D}=Qo({id:`group-${r}`,data:{status:r}}),j=r===ne.Review,C=v(t),{icon:P,accentClass:k}=gt[r],T=u.useId(),_=i?w:x,q=_&&!E&&!b;return o.jsxs("div",{className:q?"mb-4":"mb-2","data-task-group-status":r,children:[o.jsx("div",{className:"sticky top-0 z-10 bg-sidebar px-2",children:o.jsxs("button",{type:"button",onClick:()=>!i&&S(N=>!N),"aria-expanded":x,"data-sidebar-item":"",className:"group/header flex h-8 w-full items-center gap-1 rounded-md px-2 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 pointer-coarse:h-10 pointer-coarse:text-[15px]",children:[o.jsx(P,{className:ae("mr-1.5 size-4 shrink-0 -translate-y-px",k)}),o.jsx("span",{id:T,className:"truncate",children:C}),o.jsx(Qr,{size:14,"aria-hidden":!0,className:ae("shrink-0 text-muted-foreground transition-transform duration-150 group-hover/header:text-muted-foreground",_&&"rotate-90")}),j&&!b?o.jsx("span",{className:"ml-auto rounded-full bg-warning/15 px-1.5 text-xs font-semibold leading-5 tabular-nums text-warning-ink",children:n.length}):o.jsx("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:n.length})]})}),E&&o.jsx("div",{ref:R,className:ae("mx-2 mt-0.5 flex h-9 items-center justify-center rounded-md border border-dashed text-xs font-medium transition-colors duration-150",D?"border-foreground/30 bg-foreground/[0.04] text-foreground/80":"border-border bg-foreground/[0.02] text-muted-foreground"),children:D?v("Drop into {title}",{title:C}):v("Drop here")}),q&&o.jsx("div",{ref:w?void 0:R,role:"group","aria-labelledby":T,className:"mt-0.5 flex flex-col gap-px px-2",children:n.map(N=>{const O=l===N.id,V=N.projectId?f.find(L=>L.id===N.projectId):void 0;return o.jsx(Ei,{task:N,status:r,isSelected:O,project:V,showProject:s,onSelectTask:h,onTaskStatusChange:N.projectArchivedAt?void 0:d,onDeleteTask:N.projectArchivedAt?void 0:m,onTaskPriorityChange:N.projectArchivedAt?void 0:p,disableDrag:g},N.id)})})]})}),Ri=12,ji=50;function ki({isOpen:e,onClose:t,tasks:n,projects:r,onSelectTask:c}){const{t:l}=Ie(),[h,f]=u.useState(""),[s,i]=u.useState(0),a=u.useRef(null);u.useEffect(()=>{e&&(f(""),i(0))},[e]);const d=u.useMemo(()=>{const g=h.trim().toLowerCase();return g?n.filter(v=>v.title.toLowerCase().includes(g)).slice(0,ji):n.slice(0,Ri)},[n,h]);u.useEffect(()=>{i(0)},[h]),u.useEffect(()=>{a.current?.children[s]?.scrollIntoView({block:"nearest"})},[s]);const m=u.useCallback(g=>{c(g),t()},[c,t]),p=u.useCallback(g=>{if(g.key==="Escape")g.preventDefault(),t();else if(g.key==="ArrowDown")g.preventDefault(),i(v=>Math.min(v+1,d.length-1));else if(g.key==="ArrowUp")g.preventDefault(),i(v=>Math.max(v-1,0));else if(g.key==="Enter"&&!g.nativeEvent.isComposing){g.preventDefault();const v=d[s];v&&m(v.id)}},[t,d,s,m]);return e?o.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[o.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:t}),o.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 bg-popover rounded-xl border border-border shadow-popover overflow-hidden animate-in fade-in zoom-in-95 duration-100",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 border-b border-border/60",children:[o.jsx(lr,{size:15,className:"text-muted-foreground/70 shrink-0"}),o.jsx("input",{value:h,onChange:g=>f(g.target.value),onKeyDown:p,placeholder:l("Search tasks..."),"aria-label":l("Search tasks..."),autoFocus:!0,className:"flex-1 py-3 bg-transparent border-none focus:outline-none text-sm text-foreground placeholder-muted-foreground/60"})]}),d.length>0?o.jsxs(o.Fragment,{children:[!h.trim()&&o.jsx("div",{className:"px-4 pt-2.5 pb-1 text-xs font-medium text-muted-foreground",children:l("Recent tasks")}),o.jsx("div",{ref:a,className:"max-h-[46vh] overflow-y-auto scrollbar-app-thin pb-1.5 pt-0.5",children:d.map((g,v)=>{const x=r.find(w=>w.id===g.projectId),{icon:S,iconClass:b}=gt[g.status];return o.jsxs("button",{onClick:()=>m(g.id),onMouseEnter:()=>i(v),className:`w-full flex items-center gap-2.5 px-4 py-2 text-left transition-colors
|
|
7
|
-
${v===s?"bg-accent":""}`,children:[o.jsx(S,{className:`${b} size-4 shrink-0`}),o.jsx("span",{className:"flex-1 min-w-0 truncate text-sm text-foreground/90",title:g.title,children:g.title}),x&&o.jsx("span",{className:"shrink-0 max-w-[120px] truncate text-xs text-muted-foreground",children:x.name})]},g.id)})})]}):o.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:l("No matching tasks")})]})]}):null}const Ti=260,Ai=220;function Di(e){const t={[ne.Review]:[],[ne.Running]:[],[ne.Pending]:[],[ne.Done]:[],[ne.Cancelled]:[]};for(const n of e)t[n.status].push(n);return t[ne.Review].sort((n,r)=>(r.priority??Dt.NORMAL)-(n.priority??Dt.NORMAL)),t}const Mi=[{status:ne.Review,title:"Review",defaultOpen:!0},{status:ne.Running,title:"Running",defaultOpen:!0},{status:ne.Pending,title:"Pending",defaultOpen:!1},{status:ne.Done,title:"Done",defaultOpen:!1},{status:ne.Cancelled,title:"Cancelled",defaultOpen:!1}];function Ii(){return o.jsx("div",{className:"flex-1 overflow-hidden px-2 pt-3 motion-safe:animate-pulse","aria-hidden":!0,children:[3,4].map((e,t)=>o.jsxs("div",{className:"mb-4",children:[o.jsxs("div",{className:"flex h-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"size-4 shrink-0 rounded-full bg-foreground/[0.06]"}),o.jsx("div",{className:"h-3 w-14 rounded-full bg-foreground/[0.06]"})]}),Array.from({length:e}).map((n,r)=>o.jsxs("div",{className:"flex h-8 items-center gap-2.5 px-2 pointer-coarse:h-10",children:[o.jsx("div",{className:"h-3 rounded-full bg-foreground/[0.06]",style:{width:`${64-(r+t)%3*14}%`}}),o.jsx("div",{className:"ml-auto h-2.5 w-8 shrink-0 rounded-full bg-foreground/[0.05]"})]},r))]},t))})}function Jn({tasks:e=[],projects:t=[],selectedTaskId:n,onSelectTask:r,filterProjectId:c,setFilterProjectId:l,width:h=320,onCreateTask:f,onCreateProject:s,isCreateActive:i,onTaskStatusChange:a,onDeleteTask:d,onTaskPriorityChange:m,isLoading:p=!1}){const{t:g}=Ie(),{preserveDesktopSearch:v}=ir(),x=Tr(),[S,b]=u.useState(null),[w,E]=u.useState(null),[R,D]=u.useState(!1),j=u.useRef(new Map),C=u.useRef(new Set),P=u.useRef(new Map),k=u.useMemo(()=>({registry:j.current}),[]),T=u.useCallback(A=>{A.remove(),C.current.delete(A)},[]),_=c?e.filter(A=>A.projectId===c):e,q=u.useCallback((A,Q)=>{const z=document.querySelector(`[data-task-group-status="${A}"]`);if(!z)return null;const G=(z.querySelector("button")??z).getBoundingClientRect();return G.width===0||G.height===0?null:new DOMRect(G.left,G.bottom+2,Q.width,Q.height)},[]),N=u.useCallback((A,Q,z,re=!1)=>{const G=document.createElement("div");G.setAttribute("aria-hidden","true"),G.innerHTML=z,G.querySelectorAll("[data-gradient-ready]").forEach(Te=>Te.removeAttribute("data-gradient-ready")),G.querySelectorAll(".task-gradient-text__canvas").forEach(Te=>Te.remove());const K=G.firstElementChild;K&&(K.style.cssText="",K.className=K.className.replace(/\bopacity-\S*/g,"").replace(/\banimate-task-enter\b/g,""),K.style.pointerEvents="none",K.style.width=`${A.width}px`,K.style.height=`${A.height}px`,K.style.margin="0",K.style.backgroundColor="var(--background)",K.style.borderRadius="0.5rem",K.style.boxShadow="var(--shadow-popover), 0 0 0 1px var(--border)",K.style.opacity="0.96",K.style.transition="none",K.setAttribute("tabindex","-1")),Object.assign(G.style,{position:"fixed",left:`${A.left}px`,top:`${A.top}px`,width:`${A.width}px`,height:`${A.height}px`,zIndex:"9999",pointerEvents:"none",overflow:"visible",transformOrigin:"top left",willChange:"transform, opacity"}),document.body.appendChild(G),C.current.add(G);const ie=Q.left-A.left,ke=Q.top-A.top;G.animate([{transform:"translate(0, 0)",opacity:.96,offset:0},{transform:`translate(${ie}px, ${ke}px)`,opacity:re?.12:.96,offset:1}],{duration:re?Ai:Ti,easing:"cubic-bezier(0.2, 0, 0, 1)",fill:"forwards"}).finished.then(()=>T(G),()=>T(G))},[T]);u.useLayoutEffect(()=>{const A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=new Map;for(const z of _){const re=j.current.get(z.id);if(!re)continue;const G={status:z.status,rect:re.getBoundingClientRect(),html:re.outerHTML};if(Q.set(z.id,G),A)continue;const K=P.current.get(z.id);if(!K||K.status===z.status)continue;const ie=G.rect.left-K.rect.left,ke=G.rect.top-K.rect.top;Math.abs(ie)<1&&Math.abs(ke)<1||N(K.rect,G.rect,K.html)}if(!A)for(const[z,re]of P.current){if(Q.has(z))continue;const G=_.find(ie=>ie.id===z);if(!G||G.status===re.status)continue;const K=q(G.status,re.rect);K&&N(re.rect,K,re.html,!0)}P.current=Q},[_,N,q]),u.useEffect(()=>()=>{for(const A of C.current)A.remove();C.current.clear()},[]);const O=Us(Bs(Cn,{activationConstraint:{distance:8}})),V=u.useCallback(A=>{const Q=A.active.data.current?.task,z=A.active.data.current?.fromStatus;Q&&b(Q),z&&E(z)},[]),L=u.useCallback(A=>{b(null),E(null);const{active:Q,over:z}=A;if(!z)return;const re=Q.data.current?.task,G=Q.data.current?.fromStatus,K=z.data.current?.status;!re||!G||!K||re.projectArchivedAt||G!==K&&a?.(re.id,K)},[a]),$=!!!(c?t.find(A=>A.id===c)??null:null)?.archivedAt,oe=Di(_),ue=S?gt[S.status]:null,ee=u.useCallback(A=>{if(A.key!=="ArrowDown"&&A.key!=="ArrowUp"||A.altKey||A.ctrlKey||A.metaKey||A.shiftKey)return;const Q=Array.from(A.currentTarget.querySelectorAll("[data-sidebar-item]:not(:disabled)")),z=Q.indexOf(A.target);z!==-1&&(A.preventDefault(),Q[z+(A.key==="ArrowDown"?1:-1)]?.focus())},[]);return o.jsxs("div",{className:"@container h-full flex flex-col flex-shrink-0",style:{width:h},onKeyDown:ee,children:[o.jsxs("div",{className:"px-2 pt-2 pb-1 flex flex-col gap-px flex-shrink-0",children:[s&&o.jsxs("button",{type:"button",onClick:s,"data-sidebar-item":"",className:ut(!1),children:[o.jsx(ms,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("New Project")})]}),o.jsxs("button",{type:"button",onClick:f,disabled:!$,"aria-current":i||void 0,"data-sidebar-item":"",className:ae(ut(!!i),"disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"),title:$?void 0:g("Deleted projects are read-only"),children:[o.jsx(ys,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("New Task")})]}),o.jsxs("button",{type:"button",onClick:()=>D(!0),"data-sidebar-item":"",className:ut(!1),children:[o.jsx(lr,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("Search")})]}),o.jsxs(Xr,{to:v("/conversations"),"data-sidebar-item":"",className:ut(!1),children:[o.jsx(ws,{size:16,className:"shrink-0 text-muted-foreground"}),o.jsx("span",{className:"truncate",children:g("对话")})]})]}),p?o.jsx(Ii,{}):_.length===0?o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 pb-[10vh] text-center select-none",children:[o.jsx(on,{size:36,"aria-hidden":"true",className:"text-muted-foreground/50 mb-3",strokeWidth:1.5}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:g("No tasks")}),$&&f?o.jsx("button",{type:"button",onClick:f,className:"px-3.5 py-1.5 rounded-md bg-brand text-brand-foreground text-xs font-medium hover:bg-brand/90 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-2",children:g("New Task")}):null]}):o.jsx(Ar.Provider,{value:k,children:o.jsxs(_o,{sensors:O,onDragStart:V,onDragEnd:L,children:[o.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin scroll-pt-8 pointer-coarse:scroll-pt-10 relative",children:o.jsx("div",{className:"pt-3 pb-4",children:Mi.map(({status:A,title:Q,defaultOpen:z})=>o.jsx(Ni,{title:Q,tasks:oe[A],status:A,defaultOpen:z,selectedTaskId:n,onSelectTask:r,projects:t,showProject:!c,isDragging:S!==null,dragFromStatus:w,onTaskStatusChange:a,onDeleteTask:d,onTaskPriorityChange:m,disableDrag:x},A))})}),o.jsx(oi,{dropAnimation:null,children:S&&ue?o.jsxs("div",{className:"flex h-8 w-fit max-w-[280px] items-center gap-2.5 rounded-md bg-background px-2 text-sm text-foreground shadow-overlay ring-1 ring-border/80",children:[o.jsx(ue.icon,{className:ae("size-4 shrink-0",ue.iconClass)}),o.jsx("span",{className:"truncate",title:S.title,children:S.title})]}):null})]})}),!p&&o.jsxs("div",{className:"h-9 px-4 flex flex-shrink-0 items-center justify-between border-t border-border/60 text-xs text-muted-foreground",children:[o.jsx("span",{className:"tabular-nums",children:g("{count} tasks",{count:_.length})}),c?o.jsx("button",{type:"button",onClick:()=>l(null),className:"rounded-sm hover:text-foreground underline decoration-border underline-offset-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:g("Clear filter")}):null]}),o.jsx(ki,{isOpen:R,onClose:()=>D(!1),tasks:_,projects:t,onSelectTask:r})]})}function En(e){switch(e){case De.TODO:return ne.Pending;case De.IN_PROGRESS:return ne.Running;case De.IN_REVIEW:return ne.Review;case De.DONE:return ne.Done;case De.CANCELLED:return ne.Cancelled}}function Pi(e){switch(e){case ne.Pending:return De.TODO;case ne.Running:return De.IN_PROGRESS;case ne.Review:return De.IN_REVIEW;case ne.Done:return De.DONE;case ne.Cancelled:return De.CANCELLED}}function Oi(e){switch(e){case Re.CLAUDE_CODE:return"Claude Code";case Re.GEMINI_CLI:return"Gemini CLI";case Re.CURSOR_AGENT:return"Cursor Agent";case Re.CODEX:return"Codex";case Re.QWEN_CODE:return"Qwen Code";case Re.KIRO_CLI:return"Kiro CLI";case Re.OPENCODE:return"OpenCode";case Re.PI_CODING_AGENT:return"Pi Coding Agent";case Re.GROK_BUILD:return"Grok Build";case Re.MINION_CODE:return"Minion Code";case Re.DEEPSEEK_HERMES:return"DeepSeek Harness"}}const Ft=["text-indigo-600","text-emerald-600","text-rose-600","text-amber-600","text-cyan-600","text-violet-600","text-teal-600","text-pink-600"];function Dr(e,t){let n=0;for(let r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r)|0;return Math.abs(n)%t}function Li(e){return{id:e.id,name:e.name,color:e.color||Ft[Dr(e.name,Ft.length)],isGitRepo:e.isGitRepo,worktreeReady:e.worktreeReady,reason:e.reason,archivedAt:e.archivedAt??null,repoDeletedAt:e.repoDeletedAt??null}}function zi(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,projectId:e.projectId,title:e.title,status:En(e.status),priority:e.priority,agent:e.latestAgentType?Oi(e.latestAgentType):"—",branch:n,description:"",updatedAt:new Date(e.updatedAt).toISOString(),isGitRepo:t?.isGitRepo,worktreeReady:t?.worktreeReady,reason:t?.reason,projectArchivedAt:t?.archivedAt??null,projectRepoDeletedAt:t?.repoDeletedAt??null}}function Fi(e,t){const n=e.preferredWorkspace?e.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":e.preferredWorkspace.branchName:"—";return{id:e.id,projectId:t.id,projectName:t.name,projectColor:t.color||Ft[Dr(t.name,Ft.length)],title:e.title,status:En(e.status),priority:e.priority,branch:n,mainBranch:t.mainBranch??"main",description:"",isGitRepo:t.isGitRepo,worktreeReady:t.worktreeReady,reason:t.reason,projectArchivedAt:t.archivedAt??null,projectRepoDeletedAt:t.repoDeletedAt??null}}var _i=Object.defineProperty,_t=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,Zn=(e,t,n)=>t in e?_i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hn=(e,t)=>{for(var n in t||(t={}))Mr.call(t,n)&&Zn(e,n,t[n]);if(_t)for(var n of _t(t))Ir.call(t,n)&&Zn(e,n,t[n]);return e},mn=(e,t)=>{var n={};for(var r in e)Mr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_t)for(var r of _t(e))t.indexOf(r)<0&&Ir.call(e,r)&&(n[r]=e[r]);return n};var qe;(e=>{const t=class U{constructor(s,i,a,d){if(this.version=s,this.errorCorrectionLevel=i,this.modules=[],this.isFunction=[],s<U.MIN_VERSION||s>U.MAX_VERSION)throw new RangeError("Version value out of range");if(d<-1||d>7)throw new RangeError("Mask value out of range");this.size=s*4+17;let m=[];for(let g=0;g<this.size;g++)m.push(!1);for(let g=0;g<this.size;g++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const p=this.addEccAndInterleave(a);if(this.drawCodewords(p),d==-1){let g=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const x=this.getPenaltyScore();x<g&&(d=v,g=x),this.applyMask(v)}}c(0<=d&&d<=7),this.mask=d,this.applyMask(d),this.drawFormatBits(d),this.isFunction=[]}static encodeText(s,i){const a=e.QrSegment.makeSegments(s);return U.encodeSegments(a,i)}static encodeBinary(s,i){const a=e.QrSegment.makeBytes(s);return U.encodeSegments([a],i)}static encodeSegments(s,i,a=1,d=40,m=-1,p=!0){if(!(U.MIN_VERSION<=a&&a<=d&&d<=U.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let g,v;for(g=a;;g++){const w=U.getNumDataCodewords(g,i)*8,E=h.getTotalBits(s,g);if(E<=w){v=E;break}if(g>=d)throw new RangeError("Data too long")}for(const w of[U.Ecc.MEDIUM,U.Ecc.QUARTILE,U.Ecc.HIGH])p&&v<=U.getNumDataCodewords(g,w)*8&&(i=w);let x=[];for(const w of s){n(w.mode.modeBits,4,x),n(w.numChars,w.mode.numCharCountBits(g),x);for(const E of w.getData())x.push(E)}c(x.length==v);const S=U.getNumDataCodewords(g,i)*8;c(x.length<=S),n(0,Math.min(4,S-x.length),x),n(0,(8-x.length%8)%8,x),c(x.length%8==0);for(let w=236;x.length<S;w^=253)n(w,8,x);let b=[];for(;b.length*8<x.length;)b.push(0);return x.forEach((w,E)=>b[E>>>3]|=w<<7-(E&7)),new U(g,i,b,m)}getModule(s,i){return 0<=s&&s<this.size&&0<=i&&i<this.size&&this.modules[i][s]}getModules(){return this.modules}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),i=s.length;for(let a=0;a<i;a++)for(let d=0;d<i;d++)a==0&&d==0||a==0&&d==i-1||a==i-1&&d==0||this.drawAlignmentPattern(s[a],s[d]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const i=this.errorCorrectionLevel.formatBits<<3|s;let a=i;for(let m=0;m<10;m++)a=a<<1^(a>>>9)*1335;const d=(i<<10|a)^21522;c(d>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(d,m));this.setFunctionModule(8,7,r(d,6)),this.setFunctionModule(8,8,r(d,7)),this.setFunctionModule(7,8,r(d,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(d,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(d,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(d,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let a=0;a<12;a++)s=s<<1^(s>>>11)*7973;const i=this.version<<12|s;c(i>>>18==0);for(let a=0;a<18;a++){const d=r(i,a),m=this.size-11+a%3,p=Math.floor(a/3);this.setFunctionModule(m,p,d),this.setFunctionModule(p,m,d)}}drawFinderPattern(s,i){for(let a=-4;a<=4;a++)for(let d=-4;d<=4;d++){const m=Math.max(Math.abs(d),Math.abs(a)),p=s+d,g=i+a;0<=p&&p<this.size&&0<=g&&g<this.size&&this.setFunctionModule(p,g,m!=2&&m!=4)}}drawAlignmentPattern(s,i){for(let a=-2;a<=2;a++)for(let d=-2;d<=2;d++)this.setFunctionModule(s+d,i+a,Math.max(Math.abs(d),Math.abs(a))!=1)}setFunctionModule(s,i,a){this.modules[i][s]=a,this.isFunction[i][s]=!0}addEccAndInterleave(s){const i=this.version,a=this.errorCorrectionLevel;if(s.length!=U.getNumDataCodewords(i,a))throw new RangeError("Invalid argument");const d=U.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][i],m=U.ECC_CODEWORDS_PER_BLOCK[a.ordinal][i],p=Math.floor(U.getNumRawDataModules(i)/8),g=d-p%d,v=Math.floor(p/d);let x=[];const S=U.reedSolomonComputeDivisor(m);for(let w=0,E=0;w<d;w++){let R=s.slice(E,E+v-m+(w<g?0:1));E+=R.length;const D=U.reedSolomonComputeRemainder(R,S);w<g&&R.push(0),x.push(R.concat(D))}let b=[];for(let w=0;w<x[0].length;w++)x.forEach((E,R)=>{(w!=v-m||R>=g)&&b.push(E[w])});return c(b.length==p),b}drawCodewords(s){if(s.length!=Math.floor(U.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let i=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let d=0;d<this.size;d++)for(let m=0;m<2;m++){const p=a-m,v=(a+1&2)==0?this.size-1-d:d;!this.isFunction[v][p]&&i<s.length*8&&(this.modules[v][p]=r(s[i>>>3],7-(i&7)),i++)}}c(i==s.length*8)}applyMask(s){if(s<0||s>7)throw new RangeError("Mask value out of range");for(let i=0;i<this.size;i++)for(let a=0;a<this.size;a++){let d;switch(s){case 0:d=(a+i)%2==0;break;case 1:d=i%2==0;break;case 2:d=a%3==0;break;case 3:d=(a+i)%3==0;break;case 4:d=(Math.floor(a/3)+Math.floor(i/2))%2==0;break;case 5:d=a*i%2+a*i%3==0;break;case 6:d=(a*i%2+a*i%3)%2==0;break;case 7:d=((a+i)%2+a*i%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[i][a]&&d&&(this.modules[i][a]=!this.modules[i][a])}}getPenaltyScore(){let s=0;for(let m=0;m<this.size;m++){let p=!1,g=0,v=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[m][x]==p?(g++,g==5?s+=U.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),p||(s+=this.finderPenaltyCountPatterns(v)*U.PENALTY_N3),p=this.modules[m][x],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,v)*U.PENALTY_N3}for(let m=0;m<this.size;m++){let p=!1,g=0,v=[0,0,0,0,0,0,0];for(let x=0;x<this.size;x++)this.modules[x][m]==p?(g++,g==5?s+=U.PENALTY_N1:g>5&&s++):(this.finderPenaltyAddHistory(g,v),p||(s+=this.finderPenaltyCountPatterns(v)*U.PENALTY_N3),p=this.modules[x][m],g=1);s+=this.finderPenaltyTerminateAndCount(p,g,v)*U.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let p=0;p<this.size-1;p++){const g=this.modules[m][p];g==this.modules[m][p+1]&&g==this.modules[m+1][p]&&g==this.modules[m+1][p+1]&&(s+=U.PENALTY_N2)}let i=0;for(const m of this.modules)i=m.reduce((p,g)=>p+(g?1:0),i);const a=this.size*this.size,d=Math.ceil(Math.abs(i*20-a*10)/a)-1;return c(0<=d&&d<=9),s+=d*U.PENALTY_N4,c(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,i=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2;let a=[6];for(let d=this.size-7;a.length<s;d-=i)a.splice(1,0,d);return a}}static getNumRawDataModules(s){if(s<U.MIN_VERSION||s>U.MAX_VERSION)throw new RangeError("Version number out of range");let i=(16*s+128)*s+64;if(s>=2){const a=Math.floor(s/7)+2;i-=(25*a-10)*a-55,s>=7&&(i-=36)}return c(208<=i&&i<=29648),i}static getNumDataCodewords(s,i){return Math.floor(U.getNumRawDataModules(s)/8)-U.ECC_CODEWORDS_PER_BLOCK[i.ordinal][s]*U.NUM_ERROR_CORRECTION_BLOCKS[i.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw new RangeError("Degree out of range");let i=[];for(let d=0;d<s-1;d++)i.push(0);i.push(1);let a=1;for(let d=0;d<s;d++){for(let m=0;m<i.length;m++)i[m]=U.reedSolomonMultiply(i[m],a),m+1<i.length&&(i[m]^=i[m+1]);a=U.reedSolomonMultiply(a,2)}return i}static reedSolomonComputeRemainder(s,i){let a=i.map(d=>0);for(const d of s){const m=d^a.shift();a.push(0),i.forEach((p,g)=>a[g]^=U.reedSolomonMultiply(p,m))}return a}static reedSolomonMultiply(s,i){if(s>>>8||i>>>8)throw new RangeError("Byte out of range");let a=0;for(let d=7;d>=0;d--)a=a<<1^(a>>>7)*285,a^=(i>>>d&1)*s;return c(a>>>8==0),a}finderPenaltyCountPatterns(s){const i=s[1];c(i<=this.size*3);const a=i>0&&s[2]==i&&s[3]==i*3&&s[4]==i&&s[5]==i;return(a&&s[0]>=i*4&&s[6]>=i?1:0)+(a&&s[6]>=i*4&&s[0]>=i?1:0)}finderPenaltyTerminateAndCount(s,i,a){return s&&(this.finderPenaltyAddHistory(i,a),i=0),i+=this.size,this.finderPenaltyAddHistory(i,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(s,i){i[0]==0&&(s+=this.size),i.pop(),i.unshift(s)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(f,s,i){if(s<0||s>31||f>>>s)throw new RangeError("Value out of range");for(let a=s-1;a>=0;a--)i.push(f>>>a&1)}function r(f,s){return(f>>>s&1)!=0}function c(f){if(!f)throw new Error("Assertion error")}const l=class se{constructor(s,i,a){if(this.mode=s,this.numChars=i,this.bitData=a,i<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(s){let i=[];for(const a of s)n(a,8,i);return new se(se.Mode.BYTE,s.length,i)}static makeNumeric(s){if(!se.isNumeric(s))throw new RangeError("String contains non-numeric characters");let i=[];for(let a=0;a<s.length;){const d=Math.min(s.length-a,3);n(parseInt(s.substring(a,a+d),10),d*3+1,i),a+=d}return new se(se.Mode.NUMERIC,s.length,i)}static makeAlphanumeric(s){if(!se.isAlphanumeric(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");let i=[],a;for(a=0;a+2<=s.length;a+=2){let d=se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a))*45;d+=se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a+1)),n(d,11,i)}return a<s.length&&n(se.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a)),6,i),new se(se.Mode.ALPHANUMERIC,s.length,i)}static makeSegments(s){return s==""?[]:se.isNumeric(s)?[se.makeNumeric(s)]:se.isAlphanumeric(s)?[se.makeAlphanumeric(s)]:[se.makeBytes(se.toUtf8ByteArray(s))]}static makeEci(s){let i=[];if(s<0)throw new RangeError("ECI assignment value out of range");if(s<128)n(s,8,i);else if(s<16384)n(2,2,i),n(s,14,i);else if(s<1e6)n(6,3,i),n(s,21,i);else throw new RangeError("ECI assignment value out of range");return new se(se.Mode.ECI,0,i)}static isNumeric(s){return se.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return se.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,i){let a=0;for(const d of s){const m=d.mode.numCharCountBits(i);if(d.numChars>=1<<m)return 1/0;a+=4+m+d.bitData.length}return a}static toUtf8ByteArray(s){s=encodeURI(s);let i=[];for(let a=0;a<s.length;a++)s.charAt(a)!="%"?i.push(s.charCodeAt(a)):(i.push(parseInt(s.substring(a+1,a+3),16)),a+=2);return i}};l.NUMERIC_REGEX=/^[0-9]*$/,l.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,l.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let h=l;e.QrSegment=l})(qe||(qe={}));(e=>{(t=>{const n=class{constructor(c,l){this.ordinal=c,this.formatBits=l}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(qe||(qe={}));(e=>{(t=>{const n=class{constructor(c,l){this.modeBits=c,this.numBitsCharCount=l}numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(qe||(qe={}));var Je=qe;var Bi={L:Je.QrCode.Ecc.LOW,M:Je.QrCode.Ecc.MEDIUM,Q:Je.QrCode.Ecc.QUARTILE,H:Je.QrCode.Ecc.HIGH},Pr=128,Or="L",Lr="#FFFFFF",zr="#000000",Fr=!1,_r=1,Ui=4,$i=0,Ki=.1;function Br(e,t=0){const n=[];return e.forEach(function(r,c){let l=null;r.forEach(function(h,f){if(!h&&l!==null){n.push(`M${l+t} ${c+t}h${f-l}v1H${l+t}z`),l=null;return}if(f===r.length-1){if(!h)return;l===null?n.push(`M${f+t},${c+t} h1v1H${f+t}z`):n.push(`M${l+t},${c+t} h${f+1-l}v1H${l+t}z`);return}h&&l===null&&(l=f)})}),n.join("")}function Ur(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((c,l)=>l<t.x||l>=t.x+t.w?c:!1))}function Gi(e,t,n,r){if(r==null)return null;const c=e.length+n*2,l=Math.floor(t*Ki),h=c/t,f=(r.width||l)*h,s=(r.height||l)*h,i=r.x==null?e.length/2-f/2:r.x*h,a=r.y==null?e.length/2-s/2:r.y*h,d=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let g=Math.floor(i),v=Math.floor(a),x=Math.ceil(f+i-g),S=Math.ceil(s+a-v);m={x:g,y:v,w:x,h:S}}const p=r.crossOrigin;return{x:i,y:a,h:s,w:f,excavation:m,opacity:d,crossOrigin:p}}function Wi(e,t){return t!=null?Math.max(Math.floor(t),0):e?Ui:$i}function $r({value:e,level:t,minVersion:n,includeMargin:r,marginSize:c,imageSettings:l,size:h,boostLevel:f}){let s=F.useMemo(()=>{const g=(Array.isArray(e)?e:[e]).reduce((v,x)=>(v.push(...Je.QrSegment.makeSegments(x)),v),[]);return Je.QrCode.encodeSegments(g,Bi[t],n,void 0,void 0,f)},[e,t,n,f]);const{cells:i,margin:a,numCells:d,calculatedImageSettings:m}=F.useMemo(()=>{let p=s.getModules();const g=Wi(r,c),v=p.length+g*2,x=Gi(p,h,g,l);return{cells:p,margin:g,numCells:v,calculatedImageSettings:x}},[s,h,l,r,c]);return{qrcode:s,margin:a,cells:i,numCells:d,calculatedImageSettings:m}}var Qi=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Yi=F.forwardRef(function(t,n){const r=t,{value:c,size:l=Pr,level:h=Or,bgColor:f=Lr,fgColor:s=zr,includeMargin:i=Fr,minVersion:a=_r,boostLevel:d,marginSize:m,imageSettings:p}=r,v=mn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:x}=v,S=mn(v,["style"]),b=p?.src,w=F.useRef(null),E=F.useRef(null),R=F.useCallback(N=>{w.current=N,typeof n=="function"?n(N):n&&(n.current=N)},[n]),[D,j]=F.useState(!1),{margin:C,cells:P,numCells:k,calculatedImageSettings:T}=$r({value:c,level:h,minVersion:a,boostLevel:d,includeMargin:i,marginSize:m,imageSettings:p,size:l});F.useEffect(()=>{if(w.current!=null){const N=w.current,O=N.getContext("2d");if(!O)return;let V=P;const L=E.current,M=T!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;M&&T.excavation!=null&&(V=Ur(P,T.excavation));const B=window.devicePixelRatio||1;N.height=N.width=l*B;const $=l/k*B;O.scale($,$),O.fillStyle=f,O.fillRect(0,0,k,k),O.fillStyle=s,Qi?O.fill(new Path2D(Br(V,C))):P.forEach(function(oe,ue){oe.forEach(function(ee,A){ee&&O.fillRect(A+C,ue+C,1,1)})}),T&&(O.globalAlpha=T.opacity),M&&O.drawImage(L,T.x+C,T.y+C,T.w,T.h)}}),F.useEffect(()=>{j(!1)},[b]);const _=hn({height:l,width:l},x);let q=null;return b!=null&&(q=F.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{j(!0)},ref:E,crossOrigin:T?.crossOrigin})),F.createElement(F.Fragment,null,F.createElement("canvas",hn({style:_,height:l,width:l,ref:R,role:"img"},S)),q)});Yi.displayName="QRCodeCanvas";var Kr=F.forwardRef(function(t,n){const r=t,{value:c,size:l=Pr,level:h=Or,bgColor:f=Lr,fgColor:s=zr,includeMargin:i=Fr,minVersion:a=_r,boostLevel:d,title:m,marginSize:p,imageSettings:g}=r,v=mn(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:x,cells:S,numCells:b,calculatedImageSettings:w}=$r({value:c,level:h,minVersion:a,boostLevel:d,includeMargin:i,marginSize:p,imageSettings:g,size:l});let E=S,R=null;g!=null&&w!=null&&(w.excavation!=null&&(E=Ur(S,w.excavation)),R=F.createElement("image",{href:g.src,height:w.h,width:w.w,x:w.x+x,y:w.y+x,preserveAspectRatio:"none",opacity:w.opacity,crossOrigin:w.crossOrigin}));const D=Br(E,x);return F.createElement("svg",hn({height:l,width:l,viewBox:`0 0 ${b} ${b}`,ref:n,role:"img"},v),!!m&&F.createElement("title",null,m),F.createElement("path",{fill:f,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),F.createElement("path",{fill:s,d:D,shapeRendering:"crispEdges"}),R)});Kr.displayName="QRCodeSVG";function Gr(){return parseInt(window.location.port||(window.location.protocol==="https:"?"443":"80"),10)}function Hi(){return Vr({queryKey:me.tunnel.status,queryFn:()=>Ke.get("/tunnel/status"),refetchInterval:e=>e.state.data?.running?5e3:!1})}function qi(){const e=Bt();return gn({mutationFn:()=>Ke.post("/tunnel/start",{port:Gr()}),onSuccess:()=>{e.invalidateQueries({queryKey:me.tunnel.status})}})}function Xi(){const e=Bt();return gn({mutationFn:()=>Ke.post("/tunnel/regenerate",{port:Gr()}),onSuccess:()=>{e.invalidateQueries({queryKey:me.tunnel.status})}})}function Vi(){const e=Bt();return gn({mutationFn:()=>Ke.post("/tunnel/stop"),onSuccess:()=>{e.invalidateQueries({queryKey:me.tunnel.status})}})}function Ji(e){if(!e||e.status==="stopped")return{button:"text-muted-foreground hover:text-foreground hover:bg-accent",dot:"",label:"Use Agent Tower on your phone",icon:"idle"};switch(e.status){case"healthy":case"checking":return{button:"text-success-ink hover:bg-success/10",dot:"bg-success",label:e.status==="healthy"?"Tunnel healthy":"Checking tunnel health",icon:"ok"};case"degraded":case"localUnhealthy":case"linkReplaced":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel needs attention",icon:"warn"};case"exited":case"error":return{button:"text-destructive-ink hover:bg-destructive/10",dot:"bg-destructive",label:"Tunnel unavailable",icon:"error"};case"starting":return{button:"text-warning-ink hover:bg-warning/10",dot:"bg-warning",label:"Tunnel starting",icon:"loading"}}}function Zi(e){if(!e||e.status==="stopped")return"Tunnel is off";switch(e.status){case"healthy":return"Tunnel healthy";case"checking":return"Checking tunnel health";case"degraded":return"Observing original link";case"localUnhealthy":return"Local service unavailable";case"exited":return"Tunnel process exited";case"error":return"Tunnel error";case"linkReplaced":return"New link generated";case"starting":return"Tunnel starting"}}function ea(e){if(!e||e.status==="stopped")return"Start a temporary Quick Tunnel when you need to share this Agent Tower session.";switch(e.status){case"healthy":return"The Cloudflare tunnel is running and the local Agent Tower health check passed.";case"checking":return"The Cloudflare tunnel is running. Agent Tower is waiting for the first local health check.";case"degraded":return"The original public URL is currently unreachable. Agent Tower is watching for it to recover and will not generate a new link automatically.";case"localUnhealthy":return"The local Agent Tower target is not responding, so the tunnel cannot be considered healthy.";case"exited":return"The tunnel process has exited. The old Quick Tunnel link is unlikely to recover.";case"error":return"The tunnel reported an error. Check the diagnostics before generating a new link.";case"linkReplaced":return"A new Quick Tunnel link was generated. The old link and token are no longer valid.";case"starting":return"Agent Tower is asking Cloudflare Quick Tunnel for a temporary public URL."}}function er(e){if(!e)return"Never";const t=new Date(e).getTime();if(!Number.isFinite(t))return e;const n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`${n}s ago`;const r=Math.round(n/60);if(r<60)return`${r}m ago`;const c=Math.round(r/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}function lt(e){const t=e?.trim();return t||null}function ta(e){if(!e)return"";const t=[lt(e.lastLocalError),lt(e.lastRemoteError),lt(e.lastError)].filter(c=>c!==null),n=lt(e.lastProcessOutput),r=!!n&&(e.status==="error"||e.status==="exited"||!!lt(e.lastError));return n&&r&&t.push(n),t.join(`
|
|
8
|
-
`)}function tr(){const{t:e}=Ie(),{data:t}=Hi(),n=qi(),r=Vi(),c=Xi(),[l,h]=u.useState(!1),[f,s]=u.useState(null),[i,a]=u.useState(!1),[d,m]=u.useState(!1),p=t?.status!==void 0&&t.status!=="stopped",g=n.isPending||t?.status==="starting",v=c.isPending,x=t?.shareableUrl,S=t?.token,b=Ji(t),w=Zi(t),E=ta(t),R=t?.status==="healthy"||t?.status==="checking"?"text-success-ink":t?.status==="exited"||t?.status==="error"?"text-destructive-ink":"text-warning-ink",D=u.useCallback(()=>{n.mutate(void 0,{onSuccess:()=>h(!0)})},[n]),j=u.useCallback(()=>{x&&(navigator.clipboard.writeText(x),s("url"),setTimeout(()=>s(null),2e3))},[x]),C=u.useCallback(()=>{S&&(navigator.clipboard.writeText(S),s("token"),setTimeout(()=>s(null),2e3))},[S]),P=u.useCallback(()=>{r.mutate(),h(!1),a(!1),m(!1)},[r]),k=u.useCallback(()=>{c.mutate(void 0,{onSuccess:()=>{m(!1),h(!0)}})},[c]),T=o.jsx(gs,{asChild:!0,children:o.jsx(Xt,{size:"xs",label:e("Close"),className:"-mr-1 -mt-0.5 shrink-0",children:o.jsx(Jr,{})})});return o.jsxs(ps,{open:l,onOpenChange:h,children:[o.jsxs("div",{className:"relative",children:[o.jsx(vs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:g,className:ae("p-1.5 rounded-md transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/60",b.button),title:e(b.label),"aria-label":e(b.label),children:g?o.jsx(Zr,{size:"md"}):b.icon==="warn"?o.jsx(es,{size:16}):o.jsx(In,{size:16})})}),p&&!g&&o.jsx("span",{className:`pointer-events-none absolute top-0.5 right-0.5 w-2 h-2 ${b.dot} rounded-full`})]}),o.jsx(xs,{align:"end",className:ae("max-w-[calc(100vw-1rem)]",p?"w-96":"w-80"),children:p?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("span",{className:ae("flex items-center gap-1.5 text-xs font-medium",R),children:[o.jsx("span",{className:`inline-block w-1.5 h-1.5 ${b.dot} rounded-full`}),e(w)]}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:e(ea(t))})]}),T]}),S&&o.jsxs("div",{className:"mb-2 flex items-center gap-1.5 rounded-md bg-muted/50 px-2 py-1 text-xs text-foreground/80",children:[o.jsx(us,{size:12}),o.jsx("span",{children:e("Token protected")})]}),x&&o.jsx("div",{className:"flex justify-center py-3",children:o.jsx(Kr,{value:x,size:160})}),x||t?.url?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(bs,{size:"sm",readOnly:!0,value:x??t?.url??"",onFocus:_=>_.target.select(),"aria-label":e("Copy shareable link"),className:"select-all text-xs"}),o.jsx(Xt,{size:"sm",label:e("Copy shareable link"),onClick:j,disabled:!x,children:f==="url"?o.jsx(pt,{className:"text-success"}):o.jsx(Dn,{})})]}):o.jsx("div",{className:"rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-muted-foreground",children:e("No tunnel link available")}),o.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{className:"rounded-md border border-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last checked")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:er(t?.lastCheckedAt)})]}),o.jsxs("div",{className:"rounded-md border border-border px-2 py-1.5",children:[o.jsx("div",{className:"text-muted-foreground",children:e("Last healthy")}),o.jsx("div",{className:"mt-0.5 text-foreground",children:er(t?.lastHealthyAt)})]})]}),E&&o.jsx(kt,{tone:"warning",size:"sm",className:"mt-2 max-h-28 overflow-auto",children:o.jsx("div",{className:"whitespace-pre-wrap break-words",children:E})}),t?.status==="degraded"&&o.jsx(kt,{tone:"warning",size:"sm",className:"mt-2",children:e("Agent Tower is keeping the same URL and waiting for Cloudflare Quick Tunnel to recover.")}),t?.status==="linkReplaced"&&o.jsx(kt,{tone:"warning",size:"sm",className:"mt-2",children:e("The previous tunnel link and token are no longer valid.")}),S&&o.jsxs("div",{className:"mt-2",children:[o.jsx("button",{type:"button",onClick:()=>a(!i),className:"rounded-sm text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:e(i?"Hide token":"Show token")}),i&&o.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 min-w-0 break-all rounded-md border border-border bg-muted/50 px-2 py-1.5 text-xs text-foreground/80",children:S}),o.jsx(Xt,{size:"sm",label:e("Copy token"),onClick:C,className:"shrink-0",children:f==="token"?o.jsx(pt,{className:"text-success"}):o.jsx(Dn,{})})]})]}),d?o.jsxs(kt,{tone:"danger",size:"sm",className:"mt-3",children:[e("Generating a new link will invalidate the current link. People using the old URL must receive the new one."),o.jsxs("div",{className:"mt-2 flex gap-2",children:[o.jsx(Me,{variant:"secondary",size:"xs",className:"flex-1",onClick:()=>m(!1),children:e("Cancel")}),o.jsx(Me,{variant:"primary",tone:"danger",size:"xs",className:"flex-1",onClick:k,loading:v,children:e(v?"Generating...":"Regenerate link")})]})]}):o.jsxs(Me,{variant:"ghost",size:"sm",block:!0,className:"mt-3",onClick:()=>m(!0),disabled:v||t?.canRegenerate===!1,children:[o.jsx(ts,{}),e("Regenerate link")]}),o.jsx(Me,{variant:"ghost",tone:"danger",size:"sm",block:!0,className:"mt-1",onClick:P,loading:r.isPending,children:r.isPending?e("Stopping..."):e("Stop Tunnel")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-foreground/80",children:o.jsx(In,{size:16})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-medium text-foreground",children:e("Use Agent Tower on your phone")}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:e("After enabling the tunnel, you can scan a QR code with your phone to visit this Agent Tower instance, assign tasks, and check agent status.")})]})]}),T]}),o.jsx(Me,{variant:"primary",size:"sm",block:!0,className:"mt-3",onClick:D,loading:g,children:e(g?"Starting tunnel...":"Enable phone access")})]})})]})}function sn({isOpen:e,onClose:t}){const{t:n}=Ie(),r=Cs(),[c,l]=u.useState(""),[h,f]=u.useState(""),[s,i]=u.useState(null),[a,d]=u.useState(!1),[m,p]=u.useState(!1),g=c.trim(),v=h.trim(),x=a||r.isPending,S=u.useMemo(()=>!!(g&&v&&!x),[g,v,x]),b=u.useCallback(()=>{l(""),f(""),i(null),p(!1)},[]),w=u.useCallback(()=>{x||(b(),t())},[x,t,b]);u.useEffect(()=>{e||b()},[e,b]);const E=u.useCallback(async C=>{try{await r.mutateAsync({name:g,repoPath:v,initEmptyRepo:C}),b(),t()}catch(P){const k=P instanceof Error?P.message:n("Failed to create project");i(k),Fe.error(k)}},[r,t,b,n,g,v]),R=u.useCallback(async()=>{if(!(!g||!v||x)){i(null),d(!0);try{const C=await Ke.get("/filesystem/validate",{params:{path:v}});if(!C.valid){i(C.error??n("Selected path is not a valid directory"));return}if(C.isGitRepo){await E(!1);return}if(C.reason==="no_git"&&C.isEmpty){p(!0);return}if(C.reason==="no_git"){await E(!1);return}await E(!1)}catch(C){i(C instanceof Error?C.message:n("Could not check project path"))}finally{d(!1)}}},[E,x,n,g,v]),D=u.useCallback(()=>{p(!1),E(!1)},[E]),j=u.useCallback(()=>{p(!1),E(!0)},[E]);return o.jsxs(o.Fragment,{children:[o.jsx(Mn,{isOpen:e,onClose:w,title:n("Create New Project"),action:o.jsxs(o.Fragment,{children:[o.jsx(Me,{onClick:w,disabled:x,children:n("Cancel")}),o.jsx(Me,{variant:"primary",onClick:R,disabled:!S,children:a?n("Checking..."):r.isPending?n("Creating..."):n("Create Project")})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-1.5",children:n("Project Name")}),o.jsx("input",{type:"text",value:c,onChange:C=>l(C.target.value),placeholder:n("e.g., Agent Tower"),disabled:x,className:"w-full px-3 py-2 border border-border rounded-lg text-sm focus:outline-none focus:border-ring transition-colors disabled:bg-muted/50 disabled:text-muted-foreground",autoFocus:!0})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-1.5",children:n("Project Path")}),o.jsx(cs,{value:h,onChange:f,validationMode:"directory"})]}),s&&o.jsx("p",{className:"text-xs text-destructive-ink leading-relaxed",children:s})]})}),o.jsx(Mn,{isOpen:m,onClose:()=>{r.isPending||p(!1)},title:n("Initialize Git repository?"),action:o.jsxs(o.Fragment,{children:[o.jsx(Me,{onClick:()=>p(!1),disabled:r.isPending,children:n("Cancel")}),o.jsx(Me,{onClick:D,disabled:r.isPending,children:n("Create Local Project")}),o.jsx(Me,{variant:"primary",onClick:j,disabled:r.isPending,children:r.isPending?n("Creating..."):n("Initialize and Create")})]}),children:o.jsxs("div",{className:"space-y-3 text-sm text-foreground/70 leading-relaxed",children:[o.jsx("p",{children:n("This directory is empty and does not have Git version control yet. Agent Tower can initialize Git and create the initial commit before creating the project.")}),o.jsx("p",{children:n("You can also create it as a local project now. Local projects only support local Solo tasks until Git is initialized.")})]})})]})}function nr(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function na(e){return e.map((t,n)=>({project:t,index:n,activityTime:nr(t.lastActivityAt??t.createdAt),createdTime:nr(t.createdAt)})).sort((t,n)=>{const r=n.activityTime-t.activityTime;if(r!==0)return r;const c=n.createdTime-t.createdTime;return c!==0?c:t.index-n.index}).map(({project:t})=>t)}const ra=u.lazy(()=>ar(()=>import("./TaskDetail-a1jalILy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])).then(e=>({default:e.TaskDetail}))),sa=u.lazy(()=>ar(()=>import("./MobileTaskDetail-DxE6ZDAS.js"),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])).then(e=>({default:e.MobileTaskDetail})));function rr(){const{t:e}=Ie();return o.jsx("div",{role:"status",className:"flex flex-1 items-center justify-center bg-background p-4 text-sm text-muted-foreground",children:e("Loading...")})}function sr({projects:e,filterProjectId:t,setFilterProjectId:n,onCreateProject:r,className:c}){const{t:l}=Ie(),[h,f]=u.useState(!1),s=e.filter(a=>!a.archivedAt),i=t?e.find(a=>a.id===t)??null:null;return o.jsxs("div",{className:ae("relative flex items-center min-w-0",c),children:[o.jsx("span",{className:"mx-1.5 text-muted-foreground select-none",children:"/"}),o.jsxs("button",{onClick:()=>f(a=>!a),className:"flex items-center gap-1.5 px-2 py-1 rounded-md text-sm text-foreground/90 hover:bg-accent transition-colors min-w-0",children:[i?o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${i.color.replace("text-","bg-")}`}):o.jsx(on,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:"truncate max-w-[200px] font-medium",children:i?i.name:l("All Projects")}),o.jsx(Ns,{size:13,className:`text-muted-foreground/70 shrink-0 transition-transform duration-200 ${h?"rotate-180":""}`})]}),h?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-30",onClick:()=>f(!1)}),o.jsxs("div",{className:"absolute left-4 top-full mt-1.5 w-60 bg-popover border border-border rounded-lg shadow-popover shadow-black/5 z-40 py-1 animate-in fade-in zoom-in-95 duration-100 origin-top-left",children:[o.jsxs("button",{onClick:()=>{n(null),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx(on,{size:13,className:"text-muted-foreground shrink-0"}),o.jsx("span",{className:`flex-1 truncate ${t===null?"text-foreground font-medium":"text-muted-foreground"}`,children:l("All Projects")}),t===null?o.jsx(pt,{size:14,className:"text-foreground shrink-0"}):null]}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsx("div",{className:"max-h-[40vh] overflow-y-auto scrollbar-app-thin",children:s.map(a=>{const d=t===a.id;return o.jsxs("button",{onClick:()=>{n(a.id),f(!1)},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 hover:bg-accent/50 transition-colors",children:[o.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${a.color.replace("text-","bg-")}`}),o.jsx("span",{className:`flex-1 truncate ${d?"text-foreground font-medium":"text-muted-foreground"}`,children:a.name}),d?o.jsx(pt,{size:14,className:"text-foreground shrink-0"}):null]},a.id)})}),o.jsx("div",{className:"h-px bg-border/60 my-1 mx-2"}),o.jsxs("button",{onClick:()=>{f(!1),r()},className:"w-full text-left px-3 py-1.5 text-[13px] flex items-center gap-2 text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors",children:[o.jsx(hs,{size:13}),o.jsx("span",{children:l("Create New Project...")})]})]})]}):null]})}const oa=260,ia=600,or=400,aa=100,la=1e3;function ca(e){const t=e.workspaces?.find(r=>r.status==="ACTIVE")??e.workspaces?.[0],n=t?.sessions?.at(-1);return{id:e.id,projectId:e.projectId,title:e.titlePreview??e.title,status:e.status,priority:e.priority,...t?{preferredWorkspace:{...t.workspaceKind===et.MAIN_DIRECTORY?{workspaceKind:et.MAIN_DIRECTORY}:{},branchName:t.branchName}}:{},...n?{latestAgentType:n.agentType}:{},...e.workspaces?.some(r=>r.sessions?.some(c=>c.status==="RUNNING"||c.status==="PENDING"))?{hasRunningSession:!0}:{},updatedAt:e.updatedAt?new Date(e.updatedAt).getTime():Date.now()}}function ua(){const{t:e,locale:t}=Ie(),[n,r]=u.useState(null),[c,l]=u.useState(null),[h,f]=u.useState(or),[s,i]=u.useState(!1),[a,d]=u.useState("idle"),[m,p]=u.useState({}),g=u.useRef(!1),v=u.useRef(0),x=u.useRef(or),S=u.useRef(null),b=Bt(),{data:w,isLoading:E}=Es(),{data:R,isLoading:D}=Ss({limit:aa}),j=u.useMemo(()=>R?.data??[],[R?.data]),C=c&&j.some(y=>y.id===c)?c:null,{data:P,isLoading:k}=ns({...C?{projectId:C}:{},limit:la}),T=u.useMemo(()=>P?.data??[],[P?.data]),[_,q]=u.useState([]),N=u.useMemo(()=>{if(_.length===0)return T;const y=new Set(T.map(I=>I.id));return[..._.filter(I=>!y.has(I.id)),...T]},[T,_]),[O,V]=u.useState(null),L=u.useMemo(()=>n&&N.some(y=>y.id===n)?n:O&&n===O?O:null,[n,N,O]);u.useEffect(()=>{O&&N.some(y=>y.id===O)&&V(null)},[O,N]),u.useEffect(()=>{if(_.length===0)return;const y=new Set(T.map(I=>I.id));_.some(I=>y.has(I.id))&&q(I=>I.filter(W=>!y.has(W.id)))},[T,_]);const M=u.useMemo(()=>na(j),[j]),B=u.useMemo(()=>M.map(Li),[M]),$=u.useMemo(()=>M.filter(y=>!y.archivedAt),[M]),oe=u.useMemo(()=>{if(!w)return[];const y=localStorage.getItem("providerUsageCount"),I=y?JSON.parse(y):{};return[...w].sort((W,Y)=>{const H=W.availability.type!=="NOT_FOUND",Z=Y.availability.type!=="NOT_FOUND";if(H!==Z)return H?-1:1;const J=I[W.provider.id]??0;return(I[Y.provider.id]??0)-J})},[w]),ue=u.useMemo(()=>N.map(y=>zi(y,j.find(I=>I.id===y.projectId))),[j,N]),ee=u.useMemo(()=>{if(!L)return null;const y=N.find(W=>W.id===L);if(!y)return null;const I=j.find(W=>W.id===y.projectId);if(!I){const W=y.preferredWorkspace?y.preferredWorkspace.workspaceKind===et.MAIN_DIRECTORY?"Project directory":y.preferredWorkspace.branchName:"—";return{id:y.id,projectId:y.projectId,projectName:"Unknown",projectColor:"text-muted-foreground",title:y.title,status:En(y.status),priority:y.priority,branch:W,mainBranch:"main",description:"",isGitRepo:!1,worktreeReady:!1,reason:"NO_GIT",projectArchivedAt:null,projectRepoDeletedAt:null}}return Fi(y,I)},[L,N,j]),A=rs(),Q=ss(),z=os(),re=is(),G=ds(),K=u.useCallback(y=>{const I=ca(y);q(W=>W.some(Y=>Y.id===y.id)?W.map(Y=>Y.id===y.id?I:Y):[I,...W]),b.setQueryData(me.tasks.detail(y.id),y),V(y.id),r(y.id)},[b]),ie=u.useCallback((y,I,W)=>{const Y=y.id,H=[y.title,y.description].filter(Boolean).join(`
|
|
9
|
-
|
|
10
|
-
`),Z=W===et.WORKTREE?$.find(J=>J.id===y.projectId)?.setupScript??null:null;p(J=>({...J,[Y]:{status:"creating-workspace",setupScript:Z}})),(async()=>{try{const J=await Ke.post(`/tasks/${Y}/workspaces`,{workspaceKind:W});p(te=>({...te,[Y]:{status:"creating-session",setupScript:Z}}));const pe=await Ke.post(`/workspaces/${J.id}/sessions`,{providerId:I,prompt:H});p(te=>({...te,[Y]:{status:"starting-session",setupScript:Z}})),await G.mutateAsync(pe.id),await b.invalidateQueries({queryKey:me.workspaces.list(Y)}),await b.invalidateQueries({queryKey:me.workspaces.setupProgress(Y)}),await b.invalidateQueries({queryKey:me.tasks.all}),p(te=>{const{[Y]:fe,...xe}=te;return xe})}catch(J){const pe=J instanceof Error?J.message:e("启动 Agent 失败");p(te=>({...te,[Y]:{status:"failed",error:pe,setupScript:Z}})),Fe.error(e("任务已创建,但启动 Agent 失败,可在详情中重试")),b.invalidateQueries({queryKey:me.workspaces.list(Y)}),b.invalidateQueries({queryKey:me.tasks.all})}})()},[$,b,G,e]),ke=u.useCallback(y=>{p(I=>{const{[y]:W,...Y}=I;return Y}),b.invalidateQueries({queryKey:me.workspaces.list(y)}),b.invalidateQueries({queryKey:me.tasks.all})},[b]),be=u.useCallback(y=>{Q.mutate(y,{onSuccess:()=>{L===y&&r(null),p(I=>{const{[y]:W,...Y}=I;return Y}),q(I=>I.filter(W=>W.id!==y)),b.invalidateQueries({queryKey:me.tasks.all})},onError:()=>{Fe.error(e("删除任务失败"))}})},[Q,L,b,e]),Te=u.useCallback((y,I)=>{z.mutate({id:y,status:Pi(I)},{onError:()=>{Fe.error(e("状态变更失败,该操作不被允许"))}})},[z,e]),ye=u.useCallback((y,I)=>{re.mutate({id:y,priority:I},{onError:()=>{Fe.error(e("优先级变更失败"))}})},[re,e]),Xe=u.useCallback(y=>{y.preventDefault(),g.current=!0,v.current=y.clientX,x.current=h,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[h]);u.useEffect(()=>{const y=W=>{if(!g.current)return;const Y=W.clientX-v.current,H=Math.max(oa,Math.min(ia,x.current+Y));f(H)},I=()=>{g.current&&(g.current=!1,document.body.style.cursor="",document.body.style.userSelect="")};return document.addEventListener("mousemove",y),document.addEventListener("mouseup",I),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",I)}},[]);const Ee=u.useCallback(()=>{i(!0)},[]),Et=u.useCallback(()=>{if($.length===0){Fe.error(e("没有可用项目,请先创建或恢复项目"));return}r(null)},[$,e]),Ve=u.useCallback(()=>{i(!1)},[]),Ge=u.useCallback(async y=>{const{title:I,description:W,projectId:Y,providerId:H,mode:Z,workspaceMode:J,teamRunMode:pe,teamTemplateId:te,memberPresetIds:fe,attachmentLinks:xe,priority:Be}=y,le=[W,xe].filter(Boolean).join(`
|
|
11
|
-
|
|
12
|
-
`);let he=null;try{if(d("creating-task"),he=await Ke.post(`/projects/${Y}/tasks`,{title:I,description:le||void 0,priority:Be}),localStorage.setItem("lastSelectedProjectId",Y),Z==="SOLO"&&H){localStorage.setItem("lastSelectedProviderId",H);const Ce=localStorage.getItem("providerUsageCount"),ze=Ce?JSON.parse(Ce):{};ze[H]=(ze[H]??0)+1,localStorage.setItem("providerUsageCount",JSON.stringify(ze))}Z==="TEAM"?(d("creating-teamrun"),await A.mutateAsync({taskId:he.id,mode:pe,...te?{teamTemplateId:te}:{},...fe.length>0?{memberPresetIds:fe}:{}})):H&&ie(he,H,J),C&&Y!==C&&l(null),K(he),d("idle"),b.invalidateQueries({queryKey:me.tasks.all}),b.invalidateQueries({queryKey:me.projects.all})}catch(ge){if(d("idle"),he&&Z==="TEAM"){try{await Q.mutateAsync(he.id)}catch{}throw Fe.error(e("TeamRun 创建失败,请检查团队配置后重试")),ge}else if(he)C&&Y!==C&&l(null),K(he),b.invalidateQueries({queryKey:me.tasks.all}),b.invalidateQueries({queryKey:me.projects.all});else throw Fe.error(ge instanceof Error?ge.message:e("Failed to create task")),ge}},[$,A,ie,Q,b,e,C,K]),Ne=D||k,We=u.useMemo(()=>$.map(y=>({id:y.id,name:y.name,color:B.find(I=>I.id===y.id)?.color,repoPath:y.repoPath,isGitRepo:y.isGitRepo,worktreeReady:y.worktreeReady,reason:y.reason})),[$,B]),Qe=u.useMemo(()=>oe.map(y=>{const I=Vt(y);return{id:y.provider.id,name:y.provider.name,agentType:y.provider.agentType,available:!I,permissionMode:y.provider.executionPermission,reason:I}}),[oe]),Ae=u.useMemo(()=>{if(C&&$.find(I=>I.id===C))return C;const y=localStorage.getItem("lastSelectedProjectId");return y&&$.find(I=>I.id===y)?y:$[0]?.id??""},[$,C]),[rt,st]=u.useState(Ae);u.useEffect(()=>{st(Ae)},[Ae]);const Nt=u.useMemo(()=>$.find(y=>y.id===rt)?.name??$.find(y=>y.id===Ae)?.name??e("Project"),[$,rt,Ae,e]),Pe=t==="zh-CN"?`你需要在 ${Nt} 中做点什么?`:`What do you need to do in ${Nt}?`,Oe=u.useMemo(()=>{const y=localStorage.getItem("lastSelectedProviderId");return y&&oe.find(W=>W.provider.id===y&&!Vt(W))?y:oe.find(W=>!Vt(W))?.provider.id??""},[oe]),Ye=Tr(),[Rt,we]=u.useState(!1),{usesIntegratedTitlebar:Le,desktopPlatform:Qt,hasMacTrafficLights:Yt}=ir(),ot=Le&&Qt==="win32",jt=u.useCallback(()=>{if($.length===0){Fe.error(e("没有可用项目,请先创建或恢复项目"));return}we(!0)},[$,e]),Ht=u.useCallback(async y=>{await Ge(y),we(!1)},[Ge]);return Ye?Rt?o.jsxs("div",{className:"flex flex-col h-dvh bg-background overflow-hidden text-sm",children:[o.jsx("header",{className:"h-12 border-b border-border/60 flex items-center px-4 shrink-0",children:o.jsx("button",{onClick:()=>we(!1),className:"text-sm text-muted-foreground active:text-foreground",children:e("Cancel")})}),o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4 pb-[8vh]",children:[o.jsx("h1",{className:"max-w-full text-center text-[22px] font-medium tracking-tight leading-snug text-foreground mb-5 break-words",children:Pe}),o.jsx(Tn,{projects:We,providers:Qe,isProvidersLoading:E,onSubmit:Ht,defaultProjectId:Ae,defaultProviderId:Oe,onProjectChange:st,createStep:a})]})]}):L&&ee?o.jsxs(o.Fragment,{children:[o.jsx(u.Suspense,{fallback:o.jsx("div",{className:"flex h-dvh",children:o.jsx(rr,{})}),children:o.jsx(sa,{task:ee,onBack:()=>r(null),onDeleteTask:ee.projectArchivedAt?void 0:be,onTaskPriorityChange:ee.projectArchivedAt?void 0:ye,isDeleting:Q.isPending,autoStartState:m[ee.id]??null,onAutoStartRecovered:ke})}),o.jsx(sn,{isOpen:s,onClose:Ve})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex flex-col h-dvh bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:"h-12 bg-sidebar flex items-center px-4 justify-between shrink-0 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx(An,{}),o.jsx(sr,{projects:B,filterProjectId:C,setFilterProjectId:l,onCreateProject:Ee})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tr,{}),o.jsx("button",{onClick:()=>jn.getState().openSettings(),className:"p-1.5 text-muted-foreground active:text-foreground rounded-md",children:o.jsx(Rn,{size:16})})]})]}),o.jsx(Jn,{tasks:ue,projects:B,selectedTaskId:null,onSelectTask:r,filterProjectId:C,setFilterProjectId:l,width:"100%",onCreateTask:jt,onCreateProject:Ee,onTaskStatusChange:Te,onTaskPriorityChange:ye,isLoading:Ne&&ue.length===0})]}),o.jsx(sn,{isOpen:s,onClose:Ve})]}):o.jsxs("div",{ref:S,className:"flex flex-col h-screen bg-sidebar overflow-hidden text-sm",children:[o.jsxs("header",{className:ae("h-12 bg-sidebar flex items-center px-4 justify-between flex-shrink-0 z-20 relative",Le&&"app-region-drag",ot&&"pr-[150px]"),children:[o.jsxs("div",{className:ae("flex items-center gap-2 min-w-0",Yt&&"pl-[72px]"),children:[o.jsx(An,{}),o.jsx(sr,{projects:B,filterProjectId:C,setFilterProjectId:l,onCreateProject:Ee,className:Le?"app-region-no-drag":void 0})]}),o.jsxs("div",{className:ae("flex items-center gap-1",Le&&"app-region-no-drag"),children:[o.jsx("div",{className:Le?"app-region-no-drag":void 0,children:o.jsx(tr,{})}),o.jsx("button",{onClick:()=>jn.getState().openSettings(),className:ae("p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded-md transition-colors",Le&&"app-region-no-drag"),children:o.jsx(Rn,{size:16})})]})]}),o.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[o.jsx(Jn,{tasks:ue,projects:B,selectedTaskId:L,onSelectTask:r,filterProjectId:C,setFilterProjectId:l,width:h,onCreateTask:Et,onCreateProject:Ee,isCreateActive:!L,onTaskStatusChange:Te,onDeleteTask:be,onTaskPriorityChange:ye,isLoading:Ne&&ue.length===0}),o.jsx("div",{onMouseDown:Xe,className:"w-1 cursor-col-resize hover:bg-border active:bg-ring/40 transition-colors z-50 -ml-[2px] flex-shrink-0 h-full",title:e("Drag to resize")}),o.jsx("div",{className:"flex-1 flex min-w-0 mb-2 mr-2 rounded-xl border border-border/50 bg-background overflow-hidden",children:L&&ee?o.jsx(u.Suspense,{fallback:o.jsx(rr,{}),children:o.jsx(ra,{task:ee,onDeleteTask:ee.projectArchivedAt?void 0:be,isDeleting:Q.isPending,onTaskStatusChange:ee.projectArchivedAt?void 0:Te,onTaskPriorityChange:ee.projectArchivedAt?void 0:ye,autoStartState:m[ee.id]??null,onAutoStartRecovered:ke})}):L&&!ee?o.jsx("div",{className:"flex-1 flex items-center justify-center bg-background min-w-0",children:o.jsx("span",{className:"text-sm text-muted-foreground",children:e("Loading...")})}):o.jsx("div",{className:"flex-1 flex flex-col items-center justify-center bg-background min-w-0 px-8 pb-[10vh]",children:o.jsxs("div",{className:"w-full max-w-2xl flex flex-col items-center animate-[fadeInUp_0.5s_cubic-bezier(0.16,1,0.3,1)]",children:[o.jsx("h1",{className:"max-w-full text-center text-[26px] font-medium tracking-tight leading-snug text-foreground mb-6 break-words",children:Pe}),o.jsx(Tn,{projects:We,providers:Qe,isProvidersLoading:E,onSubmit:Ge,defaultProjectId:Ae,defaultProviderId:Oe,onProjectChange:st,createStep:a})]})})})]}),o.jsx(sn,{isOpen:s,onClose:Ve})]})}const Da=Object.freeze(Object.defineProperty({__proto__:null,ProjectKanbanPage:ua},Symbol.toStringTag,{value:"Module"}));export{ui as D,Da as P};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as B,r as o,v as ue,j as e,X as se,B as R,aI as me,t as T,i as $,aJ as xe,k as Q,x as H,n as J,ag as pe,aa as he,$ as fe,as as ge}from"./index-Cz73HpYH.js";import{u as re,a as je,b as be,c as ve}from"./use-projects-Dwy9AfAG.js";import{F as X}from"./search-field-B5czD2Pl.js";import{F as V}from"./hooks-DK4m7-FN.js";import{P as ne,T as ye}from"./trash-2-ALAYDudv.js";import{F as Ne}from"./popover-BYz89aiY.js";import{M as Y}from"./modal-Kpqn-nDO.js";import{f as ke,F as Pe}from"./use-workspaces-BBbahdwU.js";import{S as we}from"./SettingsMasterDetail-UfyoKAum.js";import{B as Se}from"./BranchSelect-D-kqavDG.js";import"./kbd-B3m64lRd.js";import"./index-B6Lvy5Sr.js";import"./index-BCV57B4O.js";import"./index-CTG-4w90.js";import"./dialog-B_vC5R4B.js";import"./check-DYlb0A_N.js";import"./menu-styles-DWynpVVz.js";function Ce({value:t,onChange:x,repoPath:a,placeholder:v,disabled:i,disabledMessage:c}){const{t:u}=B(),[d,j]=o.useState(""),[m,n]=o.useState([]),[p,h]=o.useState(!1),[f,N]=o.useState(-1),k=o.useRef(null),A=o.useRef(null),D=o.useRef(void 0),q=o.useCallback(async s=>{if(i||!a||!s){n([]),h(!1);return}try{const l=await ue.get("/filesystem/complete",{params:{basePath:a,prefix:s}});n(l.results),h(l.results.length>0),N(-1)}catch{n([]),h(!1)}},[i,a]);o.useEffect(()=>{if(clearTimeout(D.current),!d){n([]),h(!1);return}return D.current=setTimeout(()=>q(d),200),()=>clearTimeout(D.current)},[d,q]),o.useEffect(()=>{const s=l=>{A.current&&!A.current.contains(l.target)&&k.current&&!k.current.contains(l.target)&&h(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(i)return;const l=s.trim();!l||t.includes(l)||(x([...t,l]),j(""),h(!1),k.current?.focus())},S=s=>{i||x(t.filter((l,z)=>z!==s))},F=s=>{i||(s.type==="directory"?(j(s.path),k.current?.focus()):w(s.path))},M=(s,l)=>{i||(l.stopPropagation(),w(s.path.replace(/\/$/,"")))},E=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||i||(p&&m.length>0?s.key==="ArrowDown"?(s.preventDefault(),N(l=>Math.min(l+1,m.length-1))):s.key==="ArrowUp"?(s.preventDefault(),N(l=>Math.max(l-1,-1))):s.key==="Enter"?(s.preventDefault(),f>=0?F(m[f]):w(d)):s.key==="Escape"&&h(!1):s.key==="Enter"&&(s.preventDefault(),w(d)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-border rounded-lg mb-2 divide-y divide-border/60",children:t.map((s,l)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(X,{size:14,className:"text-muted-foreground/70 shrink-0"}):e.jsx(V,{size:14,className:"text-warning shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-foreground/80 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(l),disabled:i,className:"p-0.5 text-muted-foreground hover:text-destructive-ink opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-muted-foreground",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:k,type:"text",value:d,onChange:s=>j(s.target.value),onKeyDown:E,onFocus:()=>{d&&m.length>0&&h(!0)},placeholder:v??u("输入文件路径..."),disabled:i,className:"flex-1 px-3 py-2 border border-border rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-ring/60 disabled:cursor-not-allowed disabled:bg-muted/50 disabled:text-muted-foreground"}),e.jsxs("button",{onClick:()=>w(d),disabled:i||!d.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:u("添加")})]})]}),p&&e.jsx("div",{ref:A,className:"absolute z-50 left-0 right-0 mt-1 bg-background border border-border rounded-lg shadow-popover max-h-[200px] overflow-y-auto",children:m.map((s,l)=>e.jsxs("button",{onClick:()=>F(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-accent transition-colors ${l===f?"bg-muted":""}`,children:[s.type==="directory"?e.jsx(V,{size:14,className:"text-warning shrink-0"}):e.jsx(X,{size:14,className:"text-muted-foreground/70 shrink-0"}),e.jsx("span",{className:"font-mono text-foreground/80 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:z=>M(s,z),className:"p-0.5 text-muted-foreground hover:text-success-ink shrink-0",title:u("添加此目录"),children:e.jsx(Ne,{size:14})})]},s.path))})]}),i&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function Re({value:t,onChange:x}){const{t:a}=B(),[v,i]=o.useState(""),[c,u]=o.useState(""),d=()=>{const n=v.trim(),p=c.trim();!n||!p||(x([...t,{name:n,command:p}]),i(""),u(""))},j=n=>{x(t.filter((p,h)=>h!==n))},m=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),d())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-border rounded-lg mb-2 divide-y divide-border/60",children:t.map((n,p)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-foreground/80 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-muted-foreground flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(p),className:"p-0.5 text-muted-foreground hover:text-destructive-ink opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},p))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:n=>i(n.target.value),onKeyDown:m,placeholder:a("名称"),className:"w-28 shrink-0 px-3 py-2 border border-border rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-ring/60"}),e.jsx("input",{type:"text",value:c,onChange:n=>u(n.target.value),onKeyDown:m,placeholder:a("命令"),className:"flex-1 px-3 py-2 border border-border rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-ring/60"}),e.jsxs("button",{onClick:d,disabled:!v.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(ne,{size:14}),e.jsx("span",{children:a("添加")})]})]})]})}function De({projectId:t}){const{t:x}=B(),a=ke(t);return e.jsxs("div",{className:"py-5 first:pt-0 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:x("Default base branch")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:x("New task and TeamRun main workspaces start from this branch. Existing workspaces keep their base branch.")})]}),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>{a.refetch()},disabled:a.isFetching,"aria-label":x("Refresh"),children:e.jsx(me,{size:13,className:a.isFetching?"animate-spin motion-reduce:[animation-duration:2.4s]":""})})]}),a.isPending?e.jsx("p",{className:"text-xs text-muted-foreground",children:x("Loading...")}):a.isError?e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:x("Could not load branches. Refresh to try again.")}):a.data&&e.jsx(Fe,{projectId:t,mainBranch:a.data.mainBranch,branches:a.data.branches,isRefreshing:a.isFetching,onRefresh:()=>{a.refetch()}},`${t}:${a.data.mainBranch}`)]})}function Fe({projectId:t,mainBranch:x,branches:a,isRefreshing:v,onRefresh:i}){const{t:c}=B(),u=o.useId(),[d,j]=o.useState(x),m=re(),n=async()=>{try{await m.mutateAsync({id:t,mainBranch:d}),T.success(c("Default base branch saved"))}catch{}};return e.jsxs("div",{className:"space-y-3",children:[e.jsx("label",{htmlFor:u,className:"block text-xs font-medium",children:c("Default base branch")}),e.jsx(Se,{id:u,label:c("Default base branch"),value:d,branches:a,disabled:m.isPending,isRefreshing:v,onOpen:i,onChange:p=>{j(p),m.reset()}}),m.isError&&e.jsx("p",{role:"alert",className:"text-xs text-destructive-ink",children:c("Could not save the default base branch. Refresh and choose an existing local branch.")}),e.jsx(R,{size:"sm",onClick:()=>{n()},disabled:d===x||!a.includes(d)||m.isPending||v,children:m.isPending?c("Saving"):c("Save default base branch")})]})}function Z(t){return t?t.split(",").map(x=>x.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function Qe(){const{t}=B(),{data:x,isLoading:a}=je({limit:100,includeArchived:!0}),v=re(),i=be(),c=ve(),[u,d]=o.useState(""),[j,m]=o.useState(null),[n,p]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[h,f]=o.useState(!1),[N,k]=o.useState(null),[A,D]=o.useState(!1),[q,w]=o.useState(!1),[S,F]=o.useState(!1),[M,E]=o.useState(!1),[s,l]=o.useState(""),[z,U]=o.useState(!1),C=x?.data??[],y=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),g=y.find(r=>r.id===u),L=o.useMemo(()=>C.find(r=>r.id===N)??null,[N,C]);if(o.useEffect(()=>{!u&&y.length>0&&d(y[0].id)},[y,u]),o.useEffect(()=>{if(j){y.some(r=>r.id===j)&&(d(j),m(null));return}u&&!y.some(r=>r.id===u)&&(d(y[0]?.id??""),f(!1))},[y,j,u]),o.useEffect(()=>{g&&!h&&p({copyFiles:Z(g.copyFiles),setupScript:g.setupScript??"",quickCommands:ee(g.quickCommands)})},[g,h]),a)return e.jsx($,{className:"max-w-5xl",children:e.jsx(xe,{})});if(C.length===0)return e.jsxs($,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const oe=()=>{u&&v.mutate({id:u,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>f(!1)})},ie=r=>{m(null),d(r),f(!1),U(!0)},ae=()=>{g&&(k(g.id),F(!1),E(!1),D(!0))},G=()=>{i.isPending||(D(!1),k(null),F(!1),E(!1))},ce=async()=>{if(N)try{await i.mutateAsync({id:N,deleteRepo:S}),T.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),f(!1),G()}catch{}},le=r=>{const b=I.find(P=>P.id===r);k(r),l(b?.repoDeletedAt?b.repoPath:""),w(!0)},W=()=>{c.isPending||(w(!1),k(null),l(""))},de=async()=>{if(!(!N||L?.repoDeletedAt&&!s.trim()))try{const b=await c.mutateAsync({id:N,repoPath:s.trim()||void 0});T.success(t("项目已恢复"));for(const P of b.warnings)T.warning(P);f(!1),m(b.project.id),d(b.project.id),W()}catch{}},_=L?.name??t("this project"),K=!!L?.repoDeletedAt,O=g?.isGitRepo!==!1&&g?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs($,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),y.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(we,{items:y,selectedId:u,onSelectItem:ie,getItemId:r=>r.id,mobileShowDetail:z,onMobileBack:()=>U(!1),renderListItem:r=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:J("h-2 w-2 rounded-full shrink-0",te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:J("truncate text-[11px] font-mono","text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-xs hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(ge,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:J("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx(pe,{tone:"info",size:"sm",className:"mb-5",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[O&&e.jsx(De,{projectId:r.id},r.id),e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Ce,{value:n.copyFiles,onChange:b=>{p(P=>({...P,copyFiles:b})),f(!0)},repoPath:r.repoPath,disabled:!O,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:b=>{p(P=>({...P,setupScript:b.target.value})),f(!0)},placeholder:`pnpm install
|
|
2
|
-
pnpm run setup`,rows:4,disabled:!O,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!O&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(Re,{value:n.quickCommands,onChange:b=>{p(P=>({...P,quickCommands:b})),f(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(he,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(R,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ae,disabled:i.isPending||c.isPending,children:[e.jsx(ye,{size:13}),t("删除项目")]})]})}),h&&e.jsx(fe,{saving:v.isPending,onSave:oe,onCancel:()=>{g&&p({copyFiles:Z(g.copyFiles),setupScript:g.setupScript??"",quickCommands:ee(g.quickCommands)}),f(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:y.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:A,onClose:G,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:G,disabled:i.isPending,children:t("Cancel")}),e.jsx(R,{variant:"destructive",onClick:ce,disabled:i.isPending||S&&!M,children:i.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:_})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{F(r.target.checked),r.target.checked||E(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive-ink",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>E(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),i.isError&&e.jsx("p",{className:"text-xs text-destructive-ink",children:i.error instanceof Error?i.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:W,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(R,{variant:"outline",onClick:W,disabled:c.isPending,children:t("Cancel")}),e.jsx(R,{onClick:de,disabled:c.isPending||K&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:K?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:_}):t("恢复后,项目会重新出现在默认项目列表中。")}),K&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(Pe,{value:s,onChange:l,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive-ink",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{Qe as ProjectSettingsPage};
|