profclaw 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +215 -0
- package/CHANGELOG.md +49 -0
- package/CONTRIBUTING.md +119 -0
- package/Dockerfile +107 -0
- package/LICENSE +661 -0
- package/README.md +196 -0
- package/config/agents.yml +55 -0
- package/config/budget.yml +15 -0
- package/config/pricing.yml +46 -0
- package/config/settings.yml +168 -0
- package/dist/adapters/claude-code.d.ts +46 -0
- package/dist/adapters/claude-code.js +215 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +4 -0
- package/dist/adapters/ollama.d.ts +45 -0
- package/dist/adapters/ollama.js +277 -0
- package/dist/adapters/openclaw.d.ts +60 -0
- package/dist/adapters/openclaw.js +289 -0
- package/dist/adapters/registry.d.ts +56 -0
- package/dist/adapters/registry.js +163 -0
- package/dist/agents/executor.d.ts +78 -0
- package/dist/agents/executor.js +657 -0
- package/dist/agents/index.d.ts +10 -0
- package/dist/agents/index.js +27 -0
- package/dist/agents/stop-conditions.d.ts +108 -0
- package/dist/agents/stop-conditions.js +299 -0
- package/dist/agents/types.d.ts +185 -0
- package/dist/agents/types.js +14 -0
- package/dist/ai/embedding-service.d.ts +96 -0
- package/dist/ai/embedding-service.js +333 -0
- package/dist/auth/api-tokens.d.ts +71 -0
- package/dist/auth/api-tokens.js +235 -0
- package/dist/auth/auth-service.d.ts +75 -0
- package/dist/auth/auth-service.js +557 -0
- package/dist/auth/device-identity.d.ts +96 -0
- package/dist/auth/device-identity.js +250 -0
- package/dist/auth/github-oauth.d.ts +20 -0
- package/dist/auth/github-oauth.js +59 -0
- package/dist/auth/jira-oauth.d.ts +25 -0
- package/dist/auth/jira-oauth.js +75 -0
- package/dist/auth/linear-oauth.d.ts +21 -0
- package/dist/auth/linear-oauth.js +59 -0
- package/dist/auth/middleware.d.ts +44 -0
- package/dist/auth/middleware.js +190 -0
- package/dist/auth/pairing-codes.d.ts +109 -0
- package/dist/auth/pairing-codes.js +274 -0
- package/dist/auth/password.d.ts +53 -0
- package/dist/auth/password.js +126 -0
- package/dist/auth/qr-pairing.d.ts +36 -0
- package/dist/auth/qr-pairing.js +138 -0
- package/dist/auth/slack-oauth.d.ts +31 -0
- package/dist/auth/slack-oauth.js +80 -0
- package/dist/backup/index.d.ts +50 -0
- package/dist/backup/index.js +184 -0
- package/dist/browser/adapters.d.ts +25 -0
- package/dist/browser/adapters.js +32 -0
- package/dist/browser/cli.d.ts +19 -0
- package/dist/browser/cli.js +277 -0
- package/dist/browser/compression.d.ts +32 -0
- package/dist/browser/compression.js +269 -0
- package/dist/browser/extensions.d.ts +144 -0
- package/dist/browser/extensions.js +251 -0
- package/dist/browser/index.d.ts +37 -0
- package/dist/browser/index.js +43 -0
- package/dist/browser/refs.d.ts +46 -0
- package/dist/browser/refs.js +120 -0
- package/dist/browser/search.d.ts +36 -0
- package/dist/browser/search.js +193 -0
- package/dist/browser/service.d.ts +94 -0
- package/dist/browser/service.js +358 -0
- package/dist/browser/snapshot.d.ts +19 -0
- package/dist/browser/snapshot.js +250 -0
- package/dist/browser/tools.d.ts +259 -0
- package/dist/browser/tools.js +463 -0
- package/dist/browser/types.d.ts +134 -0
- package/dist/browser/types.js +17 -0
- package/dist/chat/agentic-executor.d.ts +108 -0
- package/dist/chat/agentic-executor.js +739 -0
- package/dist/chat/api-key-detector.d.ts +41 -0
- package/dist/chat/api-key-detector.js +290 -0
- package/dist/chat/auto-reply.d.ts +90 -0
- package/dist/chat/auto-reply.js +272 -0
- package/dist/chat/conversations.d.ts +91 -0
- package/dist/chat/conversations.js +297 -0
- package/dist/chat/execution/audit.d.ts +192 -0
- package/dist/chat/execution/audit.js +323 -0
- package/dist/chat/execution/executor.d.ts +56 -0
- package/dist/chat/execution/executor.js +654 -0
- package/dist/chat/execution/guardrails.d.ts +98 -0
- package/dist/chat/execution/guardrails.js +571 -0
- package/dist/chat/execution/index.d.ts +61 -0
- package/dist/chat/execution/index.js +129 -0
- package/dist/chat/execution/model-capability.d.ts +34 -0
- package/dist/chat/execution/model-capability.js +96 -0
- package/dist/chat/execution/process-pool.d.ts +110 -0
- package/dist/chat/execution/process-pool.js +290 -0
- package/dist/chat/execution/pty.d.ts +92 -0
- package/dist/chat/execution/pty.js +285 -0
- package/dist/chat/execution/rate-limiter.d.ts +87 -0
- package/dist/chat/execution/rate-limiter.js +305 -0
- package/dist/chat/execution/registry.d.ts +54 -0
- package/dist/chat/execution/registry.js +220 -0
- package/dist/chat/execution/sandbox.d.ts +109 -0
- package/dist/chat/execution/sandbox.js +684 -0
- package/dist/chat/execution/secrets.d.ts +45 -0
- package/dist/chat/execution/secrets.js +338 -0
- package/dist/chat/execution/security.d.ts +179 -0
- package/dist/chat/execution/security.js +739 -0
- package/dist/chat/execution/self-correction.d.ts +162 -0
- package/dist/chat/execution/self-correction.js +557 -0
- package/dist/chat/execution/session-manager.d.ts +79 -0
- package/dist/chat/execution/session-manager.js +356 -0
- package/dist/chat/execution/session-spawn/config.d.ts +37 -0
- package/dist/chat/execution/session-spawn/config.js +83 -0
- package/dist/chat/execution/session-spawn/index.d.ts +10 -0
- package/dist/chat/execution/session-spawn/index.js +10 -0
- package/dist/chat/execution/session-spawn/manager.d.ts +35 -0
- package/dist/chat/execution/session-spawn/manager.js +418 -0
- package/dist/chat/execution/session-spawn/types.d.ts +117 -0
- package/dist/chat/execution/session-spawn/types.js +16 -0
- package/dist/chat/execution/smart-prompts.d.ts +34 -0
- package/dist/chat/execution/smart-prompts.js +151 -0
- package/dist/chat/execution/stream-results.d.ts +65 -0
- package/dist/chat/execution/stream-results.js +156 -0
- package/dist/chat/execution/tool-router.d.ts +76 -0
- package/dist/chat/execution/tool-router.js +296 -0
- package/dist/chat/execution/tools/agents-list.d.ts +49 -0
- package/dist/chat/execution/tools/agents-list.js +165 -0
- package/dist/chat/execution/tools/browser.d.ts +12 -0
- package/dist/chat/execution/tools/browser.js +14 -0
- package/dist/chat/execution/tools/canvas.d.ts +61 -0
- package/dist/chat/execution/tools/canvas.js +150 -0
- package/dist/chat/execution/tools/complete-task.d.ts +72 -0
- package/dist/chat/execution/tools/complete-task.js +104 -0
- package/dist/chat/execution/tools/cron-tool.d.ts +204 -0
- package/dist/chat/execution/tools/cron-tool.js +680 -0
- package/dist/chat/execution/tools/discord-actions.d.ts +120 -0
- package/dist/chat/execution/tools/discord-actions.js +361 -0
- package/dist/chat/execution/tools/exec.d.ts +43 -0
- package/dist/chat/execution/tools/exec.js +223 -0
- package/dist/chat/execution/tools/file-ops.d.ts +175 -0
- package/dist/chat/execution/tools/file-ops.js +723 -0
- package/dist/chat/execution/tools/git.d.ts +143 -0
- package/dist/chat/execution/tools/git.js +395 -0
- package/dist/chat/execution/tools/github.d.ts +42 -0
- package/dist/chat/execution/tools/github.js +184 -0
- package/dist/chat/execution/tools/glinr-ops.d.ts +202 -0
- package/dist/chat/execution/tools/glinr-ops.js +694 -0
- package/dist/chat/execution/tools/image-analyze.d.ts +29 -0
- package/dist/chat/execution/tools/image-analyze.js +127 -0
- package/dist/chat/execution/tools/index.d.ts +64 -0
- package/dist/chat/execution/tools/index.js +245 -0
- package/dist/chat/execution/tools/integrations.d.ts +109 -0
- package/dist/chat/execution/tools/integrations.js +237 -0
- package/dist/chat/execution/tools/link-understand.d.ts +34 -0
- package/dist/chat/execution/tools/link-understand.js +307 -0
- package/dist/chat/execution/tools/maintenance.d.ts +29 -0
- package/dist/chat/execution/tools/maintenance.js +105 -0
- package/dist/chat/execution/tools/memory-tools.d.ts +76 -0
- package/dist/chat/execution/tools/memory-tools.js +278 -0
- package/dist/chat/execution/tools/openai-image-gen.d.ts +51 -0
- package/dist/chat/execution/tools/openai-image-gen.js +212 -0
- package/dist/chat/execution/tools/profclaw-ops.d.ts +204 -0
- package/dist/chat/execution/tools/profclaw-ops.js +665 -0
- package/dist/chat/execution/tools/session-spawn.d.ts +146 -0
- package/dist/chat/execution/tools/session-spawn.js +544 -0
- package/dist/chat/execution/tools/session-status.d.ts +38 -0
- package/dist/chat/execution/tools/session-status.js +185 -0
- package/dist/chat/execution/tools/sessions-list.d.ts +49 -0
- package/dist/chat/execution/tools/sessions-list.js +153 -0
- package/dist/chat/execution/tools/sessions-send.d.ts +48 -0
- package/dist/chat/execution/tools/sessions-send.js +207 -0
- package/dist/chat/execution/tools/sessions-spawn.d.ts +51 -0
- package/dist/chat/execution/tools/sessions-spawn.js +137 -0
- package/dist/chat/execution/tools/slack-actions.d.ts +90 -0
- package/dist/chat/execution/tools/slack-actions.js +272 -0
- package/dist/chat/execution/tools/subagent-orchestrate.d.ts +66 -0
- package/dist/chat/execution/tools/subagent-orchestrate.js +313 -0
- package/dist/chat/execution/tools/system.d.ts +121 -0
- package/dist/chat/execution/tools/system.js +415 -0
- package/dist/chat/execution/tools/telegram-actions.d.ts +126 -0
- package/dist/chat/execution/tools/telegram-actions.js +339 -0
- package/dist/chat/execution/tools/test-run.d.ts +43 -0
- package/dist/chat/execution/tools/test-run.js +391 -0
- package/dist/chat/execution/tools/tts-speak.d.ts +39 -0
- package/dist/chat/execution/tools/tts-speak.js +199 -0
- package/dist/chat/execution/tools/web-fetch.d.ts +42 -0
- package/dist/chat/execution/tools/web-fetch.js +247 -0
- package/dist/chat/execution/tools/web-search.d.ts +53 -0
- package/dist/chat/execution/tools/web-search.js +130 -0
- package/dist/chat/execution/types.d.ts +337 -0
- package/dist/chat/execution/types.js +8 -0
- package/dist/chat/execution/workflows/built-in.d.ts +10 -0
- package/dist/chat/execution/workflows/built-in.js +249 -0
- package/dist/chat/execution/workflows/executor.d.ts +13 -0
- package/dist/chat/execution/workflows/executor.js +259 -0
- package/dist/chat/execution/workflows/index.d.ts +5 -0
- package/dist/chat/execution/workflows/index.js +5 -0
- package/dist/chat/execution/workflows/trigger.d.ts +15 -0
- package/dist/chat/execution/workflows/trigger.js +111 -0
- package/dist/chat/execution/workflows/types.d.ts +80 -0
- package/dist/chat/execution/workflows/types.js +2 -0
- package/dist/chat/failover/error.d.ts +73 -0
- package/dist/chat/failover/error.js +412 -0
- package/dist/chat/failover/index.d.ts +10 -0
- package/dist/chat/failover/index.js +11 -0
- package/dist/chat/failover/model-fallback.d.ts +97 -0
- package/dist/chat/failover/model-fallback.js +328 -0
- package/dist/chat/failover/types.d.ts +47 -0
- package/dist/chat/failover/types.js +8 -0
- package/dist/chat/format/chunk.d.ts +59 -0
- package/dist/chat/format/chunk.js +253 -0
- package/dist/chat/format/index.d.ts +7 -0
- package/dist/chat/format/index.js +7 -0
- package/dist/chat/format/tool-result-formatter.d.ts +30 -0
- package/dist/chat/format/tool-result-formatter.js +177 -0
- package/dist/chat/group.d.ts +232 -0
- package/dist/chat/group.js +311 -0
- package/dist/chat/index.d.ts +21 -0
- package/dist/chat/index.js +30 -0
- package/dist/chat/memory.d.ts +108 -0
- package/dist/chat/memory.js +343 -0
- package/dist/chat/message-handler.d.ts +38 -0
- package/dist/chat/message-handler.js +274 -0
- package/dist/chat/proactive/index.d.ts +167 -0
- package/dist/chat/proactive/index.js +721 -0
- package/dist/chat/prompt-adapter.d.ts +52 -0
- package/dist/chat/prompt-adapter.js +245 -0
- package/dist/chat/providers/dingtalk/index.d.ts +69 -0
- package/dist/chat/providers/dingtalk/index.js +225 -0
- package/dist/chat/providers/discord/index.d.ts +264 -0
- package/dist/chat/providers/discord/index.js +657 -0
- package/dist/chat/providers/feishu/index.d.ts +97 -0
- package/dist/chat/providers/feishu/index.js +362 -0
- package/dist/chat/providers/googlechat/index.d.ts +269 -0
- package/dist/chat/providers/googlechat/index.js +634 -0
- package/dist/chat/providers/imessage/index.d.ts +61 -0
- package/dist/chat/providers/imessage/index.js +166 -0
- package/dist/chat/providers/index.d.ts +76 -0
- package/dist/chat/providers/index.js +430 -0
- package/dist/chat/providers/irc/index.d.ts +101 -0
- package/dist/chat/providers/irc/index.js +557 -0
- package/dist/chat/providers/line/index.d.ts +113 -0
- package/dist/chat/providers/line/index.js +434 -0
- package/dist/chat/providers/matrix/index.d.ts +161 -0
- package/dist/chat/providers/matrix/index.js +559 -0
- package/dist/chat/providers/mattermost/index.d.ts +106 -0
- package/dist/chat/providers/mattermost/index.js +425 -0
- package/dist/chat/providers/msteams/index.d.ts +198 -0
- package/dist/chat/providers/msteams/index.js +694 -0
- package/dist/chat/providers/nextcloud/index.d.ts +52 -0
- package/dist/chat/providers/nextcloud/index.js +156 -0
- package/dist/chat/providers/nostr/index.d.ts +60 -0
- package/dist/chat/providers/nostr/index.js +200 -0
- package/dist/chat/providers/qq/index.d.ts +57 -0
- package/dist/chat/providers/qq/index.js +260 -0
- package/dist/chat/providers/registry.d.ts +89 -0
- package/dist/chat/providers/registry.js +213 -0
- package/dist/chat/providers/signal/index.d.ts +88 -0
- package/dist/chat/providers/signal/index.js +357 -0
- package/dist/chat/providers/slack/index.d.ts +52 -0
- package/dist/chat/providers/slack/index.js +477 -0
- package/dist/chat/providers/synology/index.d.ts +50 -0
- package/dist/chat/providers/synology/index.js +138 -0
- package/dist/chat/providers/telegram/index.d.ts +148 -0
- package/dist/chat/providers/telegram/index.js +492 -0
- package/dist/chat/providers/tlon/index.d.ts +44 -0
- package/dist/chat/providers/tlon/index.js +243 -0
- package/dist/chat/providers/twitch/index.d.ts +79 -0
- package/dist/chat/providers/twitch/index.js +349 -0
- package/dist/chat/providers/types.d.ts +437 -0
- package/dist/chat/providers/types.js +14 -0
- package/dist/chat/providers/webchat/index.d.ts +38 -0
- package/dist/chat/providers/webchat/index.js +214 -0
- package/dist/chat/providers/wecom/index.d.ts +62 -0
- package/dist/chat/providers/wecom/index.js +228 -0
- package/dist/chat/providers/whatsapp/index.d.ts +147 -0
- package/dist/chat/providers/whatsapp/index.js +396 -0
- package/dist/chat/providers/zalo/index.d.ts +54 -0
- package/dist/chat/providers/zalo/index.js +158 -0
- package/dist/chat/providers/zalo-personal/index.d.ts +53 -0
- package/dist/chat/providers/zalo-personal/index.js +212 -0
- package/dist/chat/skills.d.ts +82 -0
- package/dist/chat/skills.js +410 -0
- package/dist/chat/system-prompts.d.ts +76 -0
- package/dist/chat/system-prompts.js +407 -0
- package/dist/chat/tool-handler.d.ts +57 -0
- package/dist/chat/tool-handler.js +336 -0
- package/dist/chat/tools.d.ts +373 -0
- package/dist/chat/tools.js +512 -0
- package/dist/cli/commands/agent.d.ts +3 -0
- package/dist/cli/commands/agent.js +108 -0
- package/dist/cli/commands/auth.d.ts +12 -0
- package/dist/cli/commands/auth.js +301 -0
- package/dist/cli/commands/browser.d.ts +3 -0
- package/dist/cli/commands/browser.js +138 -0
- package/dist/cli/commands/canvas.d.ts +3 -0
- package/dist/cli/commands/canvas.js +155 -0
- package/dist/cli/commands/channels.d.ts +3 -0
- package/dist/cli/commands/channels.js +167 -0
- package/dist/cli/commands/chat.d.ts +9 -0
- package/dist/cli/commands/chat.js +360 -0
- package/dist/cli/commands/completion.d.ts +3 -0
- package/dist/cli/commands/completion.js +170 -0
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.js +193 -0
- package/dist/cli/commands/cost.d.ts +3 -0
- package/dist/cli/commands/cost.js +134 -0
- package/dist/cli/commands/daemon.d.ts +3 -0
- package/dist/cli/commands/daemon.js +381 -0
- package/dist/cli/commands/devices.d.ts +3 -0
- package/dist/cli/commands/devices.js +150 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.js +295 -0
- package/dist/cli/commands/logs.d.ts +3 -0
- package/dist/cli/commands/logs.js +139 -0
- package/dist/cli/commands/mcp.d.ts +15 -0
- package/dist/cli/commands/mcp.js +157 -0
- package/dist/cli/commands/memory.d.ts +3 -0
- package/dist/cli/commands/memory.js +170 -0
- package/dist/cli/commands/models.d.ts +3 -0
- package/dist/cli/commands/models.js +197 -0
- package/dist/cli/commands/nodes.d.ts +3 -0
- package/dist/cli/commands/nodes.js +193 -0
- package/dist/cli/commands/onboard.d.ts +13 -0
- package/dist/cli/commands/onboard.js +360 -0
- package/dist/cli/commands/plugin.d.ts +15 -0
- package/dist/cli/commands/plugin.js +226 -0
- package/dist/cli/commands/provider.d.ts +16 -0
- package/dist/cli/commands/provider.js +320 -0
- package/dist/cli/commands/security.d.ts +3 -0
- package/dist/cli/commands/security.js +180 -0
- package/dist/cli/commands/serve.d.ts +3 -0
- package/dist/cli/commands/serve.js +179 -0
- package/dist/cli/commands/session.d.ts +3 -0
- package/dist/cli/commands/session.js +172 -0
- package/dist/cli/commands/setup.d.ts +13 -0
- package/dist/cli/commands/setup.js +636 -0
- package/dist/cli/commands/skill.d.ts +15 -0
- package/dist/cli/commands/skill.js +191 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.js +71 -0
- package/dist/cli/commands/summary.d.ts +3 -0
- package/dist/cli/commands/summary.js +160 -0
- package/dist/cli/commands/task.d.ts +3 -0
- package/dist/cli/commands/task.js +170 -0
- package/dist/cli/commands/ticket.d.ts +3 -0
- package/dist/cli/commands/ticket.js +421 -0
- package/dist/cli/commands/tools.d.ts +9 -0
- package/dist/cli/commands/tools.js +508 -0
- package/dist/cli/commands/tui.d.ts +3 -0
- package/dist/cli/commands/tui.js +158 -0
- package/dist/cli/commands/tunnel.d.ts +3 -0
- package/dist/cli/commands/tunnel.js +135 -0
- package/dist/cli/commands/webhooks.d.ts +3 -0
- package/dist/cli/commands/webhooks.js +191 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +127 -0
- package/dist/cli/utils/api.d.ts +17 -0
- package/dist/cli/utils/api.js +63 -0
- package/dist/cli/utils/config.d.ts +31 -0
- package/dist/cli/utils/config.js +81 -0
- package/dist/cli/utils/output.d.ts +58 -0
- package/dist/cli/utils/output.js +148 -0
- package/dist/core/deployment.d.ts +30 -0
- package/dist/core/deployment.js +114 -0
- package/dist/core/sandbox-config.d.ts +63 -0
- package/dist/core/sandbox-config.js +148 -0
- package/dist/costs/budget.d.ts +28 -0
- package/dist/costs/budget.js +57 -0
- package/dist/costs/persistence.d.ts +77 -0
- package/dist/costs/persistence.js +210 -0
- package/dist/costs/pricing.d.ts +16 -0
- package/dist/costs/pricing.js +39 -0
- package/dist/costs/token-tracker.d.ts +34 -0
- package/dist/costs/token-tracker.js +141 -0
- package/dist/cron/heartbeat.d.ts +23 -0
- package/dist/cron/heartbeat.js +109 -0
- package/dist/cron/index.d.ts +22 -0
- package/dist/cron/index.js +37 -0
- package/dist/cron/issue-poller.d.ts +15 -0
- package/dist/cron/issue-poller.js +174 -0
- package/dist/cron/scheduler.d.ts +315 -0
- package/dist/cron/scheduler.js +1008 -0
- package/dist/cron/stale-checker.d.ts +16 -0
- package/dist/cron/stale-checker.js +61 -0
- package/dist/cron/templates.d.ts +107 -0
- package/dist/cron/templates.js +395 -0
- package/dist/diagnostics/exporters.d.ts +21 -0
- package/dist/diagnostics/exporters.js +138 -0
- package/dist/diagnostics/index.d.ts +10 -0
- package/dist/diagnostics/index.js +9 -0
- package/dist/diagnostics/middleware.d.ts +12 -0
- package/dist/diagnostics/middleware.js +58 -0
- package/dist/diagnostics/tracer.d.ts +133 -0
- package/dist/diagnostics/tracer.js +257 -0
- package/dist/discovery/index.d.ts +8 -0
- package/dist/discovery/index.js +7 -0
- package/dist/discovery/mdns.d.ts +40 -0
- package/dist/discovery/mdns.js +249 -0
- package/dist/gateway/index.d.ts +35 -0
- package/dist/gateway/index.js +36 -0
- package/dist/gateway/router.d.ts +110 -0
- package/dist/gateway/router.js +649 -0
- package/dist/gateway/types.d.ts +275 -0
- package/dist/gateway/types.js +2 -0
- package/dist/gateway/workflows.d.ts +37 -0
- package/dist/gateway/workflows.js +748 -0
- package/dist/hooks/agent-webhook.d.ts +277 -0
- package/dist/hooks/agent-webhook.js +197 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +15 -0
- package/dist/hooks/prompt-submit.d.ts +45 -0
- package/dist/hooks/prompt-submit.js +111 -0
- package/dist/hooks/schemas.d.ts +563 -0
- package/dist/hooks/schemas.js +108 -0
- package/dist/hooks/session-end.d.ts +25 -0
- package/dist/hooks/session-end.js +153 -0
- package/dist/hooks/tool-use.d.ts +41 -0
- package/dist/hooks/tool-use.js +201 -0
- package/dist/hooks/types.d.ts +76 -0
- package/dist/hooks/types.js +7 -0
- package/dist/integrations/cloudflare-tunnel.d.ts +78 -0
- package/dist/integrations/cloudflare-tunnel.js +268 -0
- package/dist/integrations/github-client.d.ts +27 -0
- package/dist/integrations/github-client.js +79 -0
- package/dist/integrations/github-projects.d.ts +97 -0
- package/dist/integrations/github-projects.js +433 -0
- package/dist/integrations/github-ticket-sync.d.ts +82 -0
- package/dist/integrations/github-ticket-sync.js +352 -0
- package/dist/integrations/github.d.ts +11 -0
- package/dist/integrations/github.js +241 -0
- package/dist/integrations/jira-client.d.ts +30 -0
- package/dist/integrations/jira-client.js +67 -0
- package/dist/integrations/jira.d.ts +13 -0
- package/dist/integrations/jira.js +108 -0
- package/dist/integrations/linear-client.d.ts +23 -0
- package/dist/integrations/linear-client.js +52 -0
- package/dist/integrations/linear.d.ts +15 -0
- package/dist/integrations/linear.js +312 -0
- package/dist/integrations/tailscale.d.ts +68 -0
- package/dist/integrations/tailscale.js +173 -0
- package/dist/integrations/web-search.d.ts +112 -0
- package/dist/integrations/web-search.js +287 -0
- package/dist/intelligence/index.d.ts +8 -0
- package/dist/intelligence/index.js +8 -0
- package/dist/intelligence/ollama.d.ts +50 -0
- package/dist/intelligence/ollama.js +213 -0
- package/dist/intelligence/rules.d.ts +39 -0
- package/dist/intelligence/rules.js +308 -0
- package/dist/labels/index.d.ts +93 -0
- package/dist/labels/index.js +248 -0
- package/dist/mcp/browser-tools.d.ts +10 -0
- package/dist/mcp/browser-tools.js +16 -0
- package/dist/mcp/client.d.ts +54 -0
- package/dist/mcp/client.js +153 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/server.d.ts +40 -0
- package/dist/mcp/server.js +826 -0
- package/dist/mcp/tool-adapter.d.ts +49 -0
- package/dist/mcp/tool-adapter.js +193 -0
- package/dist/memory/experience-store.d.ts +121 -0
- package/dist/memory/experience-store.js +439 -0
- package/dist/memory/index.d.ts +8 -0
- package/dist/memory/index.js +25 -0
- package/dist/memory/memory-service.d.ts +312 -0
- package/dist/memory/memory-service.js +1172 -0
- package/dist/memory/memory-watcher.d.ts +116 -0
- package/dist/memory/memory-watcher.js +239 -0
- package/dist/middleware/logging.d.ts +34 -0
- package/dist/middleware/logging.js +184 -0
- package/dist/middleware/rate-limit.d.ts +29 -0
- package/dist/middleware/rate-limit.js +91 -0
- package/dist/notifications/in-app.d.ts +28 -0
- package/dist/notifications/in-app.js +53 -0
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.js +3 -0
- package/dist/notifications/push.d.ts +74 -0
- package/dist/notifications/push.js +175 -0
- package/dist/notifications/slack.d.ts +32 -0
- package/dist/notifications/slack.js +157 -0
- package/dist/plugins/clawhub.d.ts +70 -0
- package/dist/plugins/clawhub.js +260 -0
- package/dist/plugins/loader.d.ts +23 -0
- package/dist/plugins/loader.js +140 -0
- package/dist/plugins/marketplace.d.ts +77 -0
- package/dist/plugins/marketplace.js +275 -0
- package/dist/plugins/registry.d.ts +122 -0
- package/dist/plugins/registry.js +352 -0
- package/dist/plugins/sandbox.d.ts +77 -0
- package/dist/plugins/sandbox.js +287 -0
- package/dist/plugins/scaffolder.d.ts +28 -0
- package/dist/plugins/scaffolder.js +409 -0
- package/dist/plugins/sdk.d.ts +35 -0
- package/dist/plugins/sdk.js +8 -0
- package/dist/plugins/search/brave.d.ts +9 -0
- package/dist/plugins/search/brave.js +157 -0
- package/dist/plugins/search/duckduckgo.d.ts +9 -0
- package/dist/plugins/search/duckduckgo.js +171 -0
- package/dist/plugins/search/index.d.ts +13 -0
- package/dist/plugins/search/index.js +23 -0
- package/dist/plugins/search/searxng.d.ts +9 -0
- package/dist/plugins/search/searxng.js +170 -0
- package/dist/plugins/search/serper.d.ts +9 -0
- package/dist/plugins/search/serper.js +135 -0
- package/dist/plugins/search/tavily.d.ts +9 -0
- package/dist/plugins/search/tavily.js +146 -0
- package/dist/plugins/types.d.ts +174 -0
- package/dist/plugins/types.js +8 -0
- package/dist/projects/index.d.ts +133 -0
- package/dist/projects/index.js +897 -0
- package/dist/projects/types.d.ts +444 -0
- package/dist/projects/types.js +207 -0
- package/dist/providers/adapters/anthropic.d.ts +26 -0
- package/dist/providers/adapters/anthropic.js +306 -0
- package/dist/providers/adapters/base.d.ts +53 -0
- package/dist/providers/adapters/base.js +99 -0
- package/dist/providers/adapters/ollama.d.ts +30 -0
- package/dist/providers/adapters/ollama.js +292 -0
- package/dist/providers/ai-sdk.d.ts +178 -0
- package/dist/providers/ai-sdk.js +1552 -0
- package/dist/providers/core/index.d.ts +8 -0
- package/dist/providers/core/index.js +10 -0
- package/dist/providers/core/models.d.ts +31 -0
- package/dist/providers/core/models.js +949 -0
- package/dist/providers/core/types.d.ts +117 -0
- package/dist/providers/core/types.js +83 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/registry.d.ts +93 -0
- package/dist/providers/registry.js +228 -0
- package/dist/providers/schema-utils.d.ts +23 -0
- package/dist/providers/schema-utils.js +545 -0
- package/dist/providers/types.d.ts +609 -0
- package/dist/providers/types.js +279 -0
- package/dist/queue/failure-handler.d.ts +93 -0
- package/dist/queue/failure-handler.js +379 -0
- package/dist/queue/index.d.ts +23 -0
- package/dist/queue/index.js +86 -0
- package/dist/queue/memory-queue.d.ts +30 -0
- package/dist/queue/memory-queue.js +429 -0
- package/dist/queue/notifications.d.ts +6 -0
- package/dist/queue/notifications.js +128 -0
- package/dist/queue/task-queue.d.ts +55 -0
- package/dist/queue/task-queue.js +518 -0
- package/dist/queue/webhook-queue.d.ts +47 -0
- package/dist/queue/webhook-queue.js +158 -0
- package/dist/routes/agents.d.ts +4 -0
- package/dist/routes/agents.js +45 -0
- package/dist/routes/auth.d.ts +19 -0
- package/dist/routes/auth.js +492 -0
- package/dist/routes/backup.d.ts +6 -0
- package/dist/routes/backup.js +71 -0
- package/dist/routes/chat.d.ts +10 -0
- package/dist/routes/chat.js +1678 -0
- package/dist/routes/clawhub.d.ts +8 -0
- package/dist/routes/clawhub.js +89 -0
- package/dist/routes/costs.d.ts +4 -0
- package/dist/routes/costs.js +78 -0
- package/dist/routes/cron.d.ts +11 -0
- package/dist/routes/cron.js +708 -0
- package/dist/routes/devices.d.ts +9 -0
- package/dist/routes/devices.js +490 -0
- package/dist/routes/discord.d.ts +15 -0
- package/dist/routes/discord.js +524 -0
- package/dist/routes/dlq.d.ts +4 -0
- package/dist/routes/dlq.js +64 -0
- package/dist/routes/gateway.d.ts +4 -0
- package/dist/routes/gateway.js +253 -0
- package/dist/routes/health.d.ts +29 -0
- package/dist/routes/health.js +296 -0
- package/dist/routes/hooks.d.ts +4 -0
- package/dist/routes/hooks.js +170 -0
- package/dist/routes/import.d.ts +9 -0
- package/dist/routes/import.js +540 -0
- package/dist/routes/index.d.ts +38 -0
- package/dist/routes/index.js +39 -0
- package/dist/routes/integrations.d.ts +10 -0
- package/dist/routes/integrations.js +200 -0
- package/dist/routes/labels.d.ts +8 -0
- package/dist/routes/labels.js +240 -0
- package/dist/routes/mcp.d.ts +14 -0
- package/dist/routes/mcp.js +125 -0
- package/dist/routes/memory.d.ts +10 -0
- package/dist/routes/memory.js +622 -0
- package/dist/routes/notifications.d.ts +9 -0
- package/dist/routes/notifications.js +154 -0
- package/dist/routes/oobe.d.ts +10 -0
- package/dist/routes/oobe.js +405 -0
- package/dist/routes/openapi.d.ts +9 -0
- package/dist/routes/openapi.js +537 -0
- package/dist/routes/plugins.d.ts +8 -0
- package/dist/routes/plugins.js +108 -0
- package/dist/routes/projects.d.ts +8 -0
- package/dist/routes/projects.js +592 -0
- package/dist/routes/push.d.ts +8 -0
- package/dist/routes/push.js +75 -0
- package/dist/routes/search.d.ts +4 -0
- package/dist/routes/search.js +189 -0
- package/dist/routes/security.d.ts +10 -0
- package/dist/routes/security.js +189 -0
- package/dist/routes/settings.d.ts +4 -0
- package/dist/routes/settings.js +119 -0
- package/dist/routes/setup.d.ts +11 -0
- package/dist/routes/setup.js +525 -0
- package/dist/routes/skills.d.ts +13 -0
- package/dist/routes/skills.js +152 -0
- package/dist/routes/slack.d.ts +12 -0
- package/dist/routes/slack.js +999 -0
- package/dist/routes/states.d.ts +8 -0
- package/dist/routes/states.js +123 -0
- package/dist/routes/stats.d.ts +6 -0
- package/dist/routes/stats.js +369 -0
- package/dist/routes/summaries.d.ts +4 -0
- package/dist/routes/summaries.js +344 -0
- package/dist/routes/sync.d.ts +13 -0
- package/dist/routes/sync.js +268 -0
- package/dist/routes/tasks.d.ts +4 -0
- package/dist/routes/tasks.js +473 -0
- package/dist/routes/telegram.d.ts +14 -0
- package/dist/routes/telegram.js +420 -0
- package/dist/routes/tickets.d.ts +4 -0
- package/dist/routes/tickets.js +1090 -0
- package/dist/routes/tokens.d.ts +4 -0
- package/dist/routes/tokens.js +83 -0
- package/dist/routes/tools.d.ts +14 -0
- package/dist/routes/tools.js +790 -0
- package/dist/routes/tunnels.d.ts +8 -0
- package/dist/routes/tunnels.js +145 -0
- package/dist/routes/users.d.ts +15 -0
- package/dist/routes/users.js +998 -0
- package/dist/routes/voice.d.ts +8 -0
- package/dist/routes/voice.js +127 -0
- package/dist/routes/webchat.d.ts +11 -0
- package/dist/routes/webchat.js +173 -0
- package/dist/routes/webhook-dedup.d.ts +11 -0
- package/dist/routes/webhook-dedup.js +49 -0
- package/dist/routes/webhooks.d.ts +4 -0
- package/dist/routes/webhooks.js +71 -0
- package/dist/routes/whatsapp.d.ts +14 -0
- package/dist/routes/whatsapp.js +391 -0
- package/dist/security/audit-scanner.d.ts +32 -0
- package/dist/security/audit-scanner.js +217 -0
- package/dist/security/fs-guard.d.ts +41 -0
- package/dist/security/fs-guard.js +206 -0
- package/dist/security/prompt-guard.d.ts +47 -0
- package/dist/security/prompt-guard.js +198 -0
- package/dist/security/ssrf-guard.d.ts +38 -0
- package/dist/security/ssrf-guard.js +266 -0
- package/dist/security/types.d.ts +92 -0
- package/dist/security/types.js +8 -0
- package/dist/server/route-loader.d.ts +15 -0
- package/dist/server/route-loader.js +135 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +835 -0
- package/dist/settings/index.d.ts +841 -0
- package/dist/settings/index.js +451 -0
- package/dist/skills/compiler.d.ts +83 -0
- package/dist/skills/compiler.js +358 -0
- package/dist/skills/frontmatter.d.ts +33 -0
- package/dist/skills/frontmatter.js +175 -0
- package/dist/skills/index.d.ts +19 -0
- package/dist/skills/index.js +24 -0
- package/dist/skills/installer.d.ts +22 -0
- package/dist/skills/installer.js +220 -0
- package/dist/skills/loader.d.ts +72 -0
- package/dist/skills/loader.js +484 -0
- package/dist/skills/prompt-builder.d.ts +48 -0
- package/dist/skills/prompt-builder.js +135 -0
- package/dist/skills/registry.d.ts +115 -0
- package/dist/skills/registry.js +225 -0
- package/dist/skills/types.d.ts +202 -0
- package/dist/skills/types.js +24 -0
- package/dist/states/index.d.ts +64 -0
- package/dist/states/index.js +142 -0
- package/dist/storage/adapter.d.ts +146 -0
- package/dist/storage/adapter.js +2 -0
- package/dist/storage/index.d.ts +48 -0
- package/dist/storage/index.js +135 -0
- package/dist/storage/libsql.d.ts +99 -0
- package/dist/storage/libsql.js +1873 -0
- package/dist/storage/migrations.d.ts +65 -0
- package/dist/storage/migrations.js +289 -0
- package/dist/storage/schema.d.ts +10185 -0
- package/dist/storage/schema.js +1113 -0
- package/dist/summaries/extractor.d.ts +56 -0
- package/dist/summaries/extractor.js +377 -0
- package/dist/summaries/index.d.ts +13 -0
- package/dist/summaries/index.js +14 -0
- package/dist/summaries/storage.d.ts +51 -0
- package/dist/summaries/storage.js +101 -0
- package/dist/summaries/templates.d.ts +68 -0
- package/dist/summaries/templates.js +245 -0
- package/dist/sync/adapters/base.d.ts +42 -0
- package/dist/sync/adapters/base.js +142 -0
- package/dist/sync/adapters/github.d.ts +45 -0
- package/dist/sync/adapters/github.js +445 -0
- package/dist/sync/adapters/linear.d.ts +40 -0
- package/dist/sync/adapters/linear.js +434 -0
- package/dist/sync/config.d.ts +388 -0
- package/dist/sync/config.js +281 -0
- package/dist/sync/engine.d.ts +112 -0
- package/dist/sync/engine.js +623 -0
- package/dist/sync/index.d.ts +31 -0
- package/dist/sync/index.js +34 -0
- package/dist/sync/integration.d.ts +53 -0
- package/dist/sync/integration.js +231 -0
- package/dist/sync/types.d.ts +249 -0
- package/dist/sync/types.js +30 -0
- package/dist/tickets/index.d.ts +139 -0
- package/dist/tickets/index.js +1406 -0
- package/dist/tickets/types.d.ts +817 -0
- package/dist/tickets/types.js +310 -0
- package/dist/tools/adapters.d.ts +56 -0
- package/dist/tools/adapters.js +183 -0
- package/dist/tools/index.d.ts +66 -0
- package/dist/tools/index.js +105 -0
- package/dist/tools/types.d.ts +117 -0
- package/dist/tools/types.js +20 -0
- package/dist/types/agent.d.ts +101 -0
- package/dist/types/agent.js +2 -0
- package/dist/types/errors.d.ts +150 -0
- package/dist/types/errors.js +338 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +3 -0
- package/dist/types/summary.d.ts +638 -0
- package/dist/types/summary.js +137 -0
- package/dist/types/task.d.ts +123 -0
- package/dist/types/task.js +46 -0
- package/dist/utils/ai-cache.d.ts +72 -0
- package/dist/utils/ai-cache.js +204 -0
- package/dist/utils/ai-inference.d.ts +57 -0
- package/dist/utils/ai-inference.js +190 -0
- package/dist/utils/ai-responder.d.ts +44 -0
- package/dist/utils/ai-responder.js +272 -0
- package/dist/utils/circuit-breaker.d.ts +139 -0
- package/dist/utils/circuit-breaker.js +281 -0
- package/dist/utils/config-loader.d.ts +12 -0
- package/dist/utils/config-loader.js +44 -0
- package/dist/utils/crypto.d.ts +10 -0
- package/dist/utils/crypto.js +59 -0
- package/dist/utils/env-validator.d.ts +44 -0
- package/dist/utils/env-validator.js +236 -0
- package/dist/utils/file-lock.d.ts +85 -0
- package/dist/utils/file-lock.js +204 -0
- package/dist/utils/logger.d.ts +153 -0
- package/dist/utils/logger.js +282 -0
- package/dist/utils/metrics.d.ts +183 -0
- package/dist/utils/metrics.js +345 -0
- package/dist/utils/security.d.ts +90 -0
- package/dist/utils/security.js +347 -0
- package/dist/voice/index.d.ts +79 -0
- package/dist/voice/index.js +144 -0
- package/dist/voice/stt/whisper.d.ts +13 -0
- package/dist/voice/stt/whisper.js +116 -0
- package/dist/voice/tts/elevenlabs.d.ts +18 -0
- package/dist/voice/tts/elevenlabs.js +178 -0
- package/dist/voice/tts/openai-tts.d.ts +19 -0
- package/dist/voice/tts/openai-tts.js +127 -0
- package/dist/voice/tts/system.d.ts +26 -0
- package/dist/voice/tts/system.js +146 -0
- package/dist/voice/wake-word.d.ts +44 -0
- package/dist/voice/wake-word.js +145 -0
- package/docker-compose.yml +222 -0
- package/package.json +154 -0
- package/profclaw.mjs +24 -0
- package/skills/1password/SKILL.md +155 -0
- package/skills/api-tester/SKILL.md +177 -0
- package/skills/apple-notes/SKILL.md +167 -0
- package/skills/apple-reminders/SKILL.md +178 -0
- package/skills/bear-notes/SKILL.md +166 -0
- package/skills/blogwatcher/SKILL.md +177 -0
- package/skills/camsnap/SKILL.md +130 -0
- package/skills/code-generation/SKILL.md +139 -0
- package/skills/code-review/SKILL.md +116 -0
- package/skills/coding-agent/SKILL.md +184 -0
- package/skills/cron-manager/SKILL.md +141 -0
- package/skills/debug-helper/SKILL.md +134 -0
- package/skills/docker-ops/SKILL.md +246 -0
- package/skills/file-manager/SKILL.md +160 -0
- package/skills/git-workflow/SKILL.md +171 -0
- package/skills/github-issues/SKILL.md +244 -0
- package/skills/gog/SKILL.md +191 -0
- package/skills/goplaces/SKILL.md +156 -0
- package/skills/healthcheck/SKILL.md +270 -0
- package/skills/himalaya/SKILL.md +165 -0
- package/skills/mcp-discovery/SKILL.md +109 -0
- package/skills/memory-manager/SKILL.md +151 -0
- package/skills/model-usage/SKILL.md +177 -0
- package/skills/nano-banana-pro/SKILL.md +214 -0
- package/skills/nano-pdf/SKILL.md +165 -0
- package/skills/notion/SKILL.md +147 -0
- package/skills/obsidian/SKILL.md +163 -0
- package/skills/openai-image-gen/SKILL.md +194 -0
- package/skills/openai-whisper/SKILL.md +98 -0
- package/skills/openai-whisper-api/SKILL.md +130 -0
- package/skills/openhue/SKILL.md +203 -0
- package/skills/oracle/SKILL.md +236 -0
- package/skills/phone-control/SKILL.md +201 -0
- package/skills/profclaw-assistant/SKILL.md +81 -0
- package/skills/profclaw-projects/SKILL.md +68 -0
- package/skills/profclaw-tickets/SKILL.md +91 -0
- package/skills/session-logs/SKILL.md +216 -0
- package/skills/sherpa-onnx-tts/SKILL.md +134 -0
- package/skills/skill-creator/SKILL.md +183 -0
- package/skills/songsee/SKILL.md +170 -0
- package/skills/spotify-player/SKILL.md +254 -0
- package/skills/summarize/SKILL.md +155 -0
- package/skills/system-admin/SKILL.md +179 -0
- package/skills/things-mac/SKILL.md +179 -0
- package/skills/tmux/SKILL.md +170 -0
- package/skills/trello/SKILL.md +154 -0
- package/skills/video-frames/SKILL.md +127 -0
- package/skills/weather/SKILL.md +186 -0
- package/skills/web-research/SKILL.md +128 -0
- package/skills/xurl/SKILL.md +198 -0
- package/ui/README.md +73 -0
- package/ui/dist/assets/ActivityView-CkPgKhwm.js +1 -0
- package/ui/dist/assets/AgentList-C3SVdeEz.js +1 -0
- package/ui/dist/assets/AnalyticsDashboard-DVU--vlP.js +1 -0
- package/ui/dist/assets/AreaChart-B5qMEGWj.js +1 -0
- package/ui/dist/assets/CartesianChart-B50bcUJi.js +36 -0
- package/ui/dist/assets/ChatView-BZFJs7w_.js +10 -0
- package/ui/dist/assets/CostsDashboard-ChfH8BlG.js +1 -0
- package/ui/dist/assets/EstimateSelect-CLpB4NQO.js +1 -0
- package/ui/dist/assets/FloatingChatbot-CBzBY9a0.js +2 -0
- package/ui/dist/assets/InviteCodeManagement-DsbdPa6W.js +2 -0
- package/ui/dist/assets/ProjectDetail-BEM3tFXg.js +2 -0
- package/ui/dist/assets/ProjectDetail-D1-0B2xV.css +1 -0
- package/ui/dist/assets/ProjectIcon-CN1FmFAk.js +1 -0
- package/ui/dist/assets/ProjectList-DSDaNhxQ.js +4 -0
- package/ui/dist/assets/Settings-dPVcqC_d.js +6 -0
- package/ui/dist/assets/StatusIndicator-DA3NAo_b.js +1 -0
- package/ui/dist/assets/SummaryDetail-Bjnf9lT8.js +27 -0
- package/ui/dist/assets/SummaryList-ENwKDBKW.js +1 -0
- package/ui/dist/assets/TaskDetail-DnwG6MzB.js +1 -0
- package/ui/dist/assets/TaskList-D9Ug_HiV.js +1 -0
- package/ui/dist/assets/TicketBoard-CviH1571.js +1 -0
- package/ui/dist/assets/TicketDetail-8Jk8O-33.js +1 -0
- package/ui/dist/assets/TicketList-B-iV4rRA.js +1 -0
- package/ui/dist/assets/UserManagement-CPZ8s7s2.js +2 -0
- package/ui/dist/assets/ViewSwitcher-BUyOOWDI.js +1 -0
- package/ui/dist/assets/alert-dialog-BOmnTkN-.js +7 -0
- package/ui/dist/assets/archive-D5my9zOG.js +1 -0
- package/ui/dist/assets/badge-B4ov81_m.js +1 -0
- package/ui/dist/assets/brain-C53ElFLD.js +1 -0
- package/ui/dist/assets/bug-D0TJoCYn.js +1 -0
- package/ui/dist/assets/calendar-BkWIhKa1.js +1 -0
- package/ui/dist/assets/chevron-up-BRTtndUZ.js +1 -0
- package/ui/dist/assets/circle-x-BN89YhbS.js +1 -0
- package/ui/dist/assets/constants-fc7TFI7u.js +1 -0
- package/ui/dist/assets/cpu-B41x1-vV.js +1 -0
- package/ui/dist/assets/database-D9Cnfmzj.js +1 -0
- package/ui/dist/assets/defineProperty-CoXUr7_6.js +2 -0
- package/ui/dist/assets/dialog-DrWB4EYD.js +1 -0
- package/ui/dist/assets/element-adapter-DL0DQilL.js +4 -0
- package/ui/dist/assets/ellipsis-NuUWekvu.js +1 -0
- package/ui/dist/assets/ellipsis-vertical-BueMfuCw.js +1 -0
- package/ui/dist/assets/file-code-HR9829Jc.js +1 -0
- package/ui/dist/assets/folder-open-C_7oYEqe.js +1 -0
- package/ui/dist/assets/funnel-B5gmNXGf.js +1 -0
- package/ui/dist/assets/git-branch-BRMiJmV3.js +1 -0
- package/ui/dist/assets/git-commit-horizontal-CXOUQeJI.js +1 -0
- package/ui/dist/assets/globe-CCspjvus.js +1 -0
- package/ui/dist/assets/hash-g3102kPC.js +1 -0
- package/ui/dist/assets/history-CNqcBBrV.js +1 -0
- package/ui/dist/assets/index-27mTPKuh.js +1 -0
- package/ui/dist/assets/index-BMx3fH-e.js +1 -0
- package/ui/dist/assets/index-C9jNQXzL.js +1 -0
- package/ui/dist/assets/index-CEZ6R2Uw.js +7 -0
- package/ui/dist/assets/index-DURTouJI.js +1 -0
- package/ui/dist/assets/index-WclMPci1.css +1 -0
- package/ui/dist/assets/index-kb4AJXUB.js +67 -0
- package/ui/dist/assets/layers-CLXiHN6o.js +1 -0
- package/ui/dist/assets/layout-dashboard-B07MFhBs.js +1 -0
- package/ui/dist/assets/lightbulb-B2dgG5ks.js +1 -0
- package/ui/dist/assets/link-2-BxNmr9hL.js +1 -0
- package/ui/dist/assets/markdown-renderer-CjU6hBcW.js +36 -0
- package/ui/dist/assets/message-square-Bf2-CVbt.js +1 -0
- package/ui/dist/assets/pencil-D096Ey62.js +1 -0
- package/ui/dist/assets/play-DfdcSI3x.js +1 -0
- package/ui/dist/assets/popover-BV0QJDQq.js +1 -0
- package/ui/dist/assets/progress-DjPEDJfI.js +1 -0
- package/ui/dist/assets/rocket-CPsTc-5G.js +1 -0
- package/ui/dist/assets/select-LsO16slr.js +1 -0
- package/ui/dist/assets/send-BDYBZDUZ.js +1 -0
- package/ui/dist/assets/server-B3k6noce.js +1 -0
- package/ui/dist/assets/settings-2-Cu4xTjhG.js +1 -0
- package/ui/dist/assets/sheet-BScLnPKX.js +1 -0
- package/ui/dist/assets/shield-check-CQqkwufI.js +1 -0
- package/ui/dist/assets/shield-off-ZFruH9KO.js +1 -0
- package/ui/dist/assets/skeleton-CtkIA_MU.js +1 -0
- package/ui/dist/assets/smartphone-DnoksVkc.js +1 -0
- package/ui/dist/assets/square-uD9ZHMfW.js +1 -0
- package/ui/dist/assets/switch-MQPnwGJK.js +1 -0
- package/ui/dist/assets/table-B8cqlywA.js +1 -0
- package/ui/dist/assets/tag-wEJQRWlV.js +1 -0
- package/ui/dist/assets/textarea-D5LJCOGl.js +1 -0
- package/ui/dist/assets/timer-mbGHegmr.js +1 -0
- package/ui/dist/assets/tooltip-Df1CunSp.js +1 -0
- package/ui/dist/assets/trash-2-B4oAXsX-.js +1 -0
- package/ui/dist/assets/trending-up-BGWxvlmZ.js +1 -0
- package/ui/dist/assets/wand-sparkles-CZy4xvL3.js +1 -0
- package/ui/dist/assets/wrench-ByZkjO6m.js +1 -0
- package/ui/dist/audio-worklets/vad-processor.js +132 -0
- package/ui/dist/brand/profclaw-appicon-192.png +0 -0
- package/ui/dist/brand/profclaw-appicon-512.png +0 -0
- package/ui/dist/brand/profclaw-appicon-shadow.svg +51 -0
- package/ui/dist/brand/profclaw-appicon.svg +50 -0
- package/ui/dist/brand/profclaw-favicon-coral-bg-128.png +0 -0
- package/ui/dist/brand/profclaw-favicon-coral-bg-64.png +0 -0
- package/ui/dist/brand/profclaw-favicon-coral-bg.svg +52 -0
- package/ui/dist/brand/profclaw-favicon-coral-body-128.png +0 -0
- package/ui/dist/brand/profclaw-favicon-coral-body.svg +41 -0
- package/ui/dist/brand/profclaw-favicon-shadow-128.png +0 -0
- package/ui/dist/brand/profclaw-favicon-shadow-64.png +0 -0
- package/ui/dist/brand/profclaw-favicon-shadow.svg +51 -0
- package/ui/dist/brand/profclaw-mark-coral-256.png +0 -0
- package/ui/dist/brand/profclaw-mark-coral-64.png +0 -0
- package/ui/dist/brand/profclaw-mark-coral.svg +31 -0
- package/ui/dist/brand/profclaw-mono-white.svg +18 -0
- package/ui/dist/brand/profclaw-text-dark.svg +18 -0
- package/ui/dist/brand/profclaw-text-light.svg +18 -0
- package/ui/dist/brand/profclaw-wordmark-dark.svg +48 -0
- package/ui/dist/brand/profclaw-wordmark-light.svg +48 -0
- package/ui/dist/brand/safari-pinned-tab.svg +15 -0
- package/ui/dist/favicon/android-chrome-192x192.png +0 -0
- package/ui/dist/favicon/android-chrome-384x384.png +0 -0
- package/ui/dist/favicon/android-chrome-512x512.png +0 -0
- package/ui/dist/favicon/apple-touch-icon.png +0 -0
- package/ui/dist/favicon/browserconfig.xml +9 -0
- package/ui/dist/favicon/favicon-16x16.png +0 -0
- package/ui/dist/favicon/favicon-32x32.png +0 -0
- package/ui/dist/favicon/favicon.ico +0 -0
- package/ui/dist/favicon/mstile-150x150.png +0 -0
- package/ui/dist/favicon/safari-pinned-tab.svg +46 -0
- package/ui/dist/favicon/site.webmanifest +22 -0
- package/ui/dist/index.html +32 -0
- package/ui/dist/manifest.json +49 -0
- package/ui/dist/sw.js +124 -0
- package/ui/dist/vite.svg +1 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{c as we,r as C,j as n,as as bt,ap as W,ao as _t,at as Ft,ar as oe,b9 as Gn,av as Pt,ba as Ln,aq as Hn,bb as zn,bc as On,bd as kt,V as It,ay as Bn,_ as $t,o as L,t as $,m as ie,S as We,k as _,L as ae,i as F,H as Mt,U as Q,O as K,A as z,J as Le,w as Vt,I as xe,be as qn,l as Et,C as ve,N as At,g as Un,n as Dt,u as X,$ as he,an as Kn,ai as ht,Q as Qn,p as ne,R as Wn,v as Xn,G as Jn,s as Yn,P as vt,F as Zn,D as es,x as ts,y as ns,z as de,aw as ss,ad as wt}from"./index-kb4AJXUB.js";import{D as Tt,b as Gt,c as Lt,d as Ht,e as rs,f as os}from"./dialog-DrWB4EYD.js";import{C as zt,R as is}from"./rocket-CPsTc-5G.js";import{L as as}from"./lightbulb-B2dgG5ks.js";import{T as Ot,P as ls,a as Bt,b as jt}from"./ProjectIcon-CN1FmFAk.js";import{S as us,C as cs}from"./smartphone-DnoksVkc.js";import{G as ds}from"./globe-CCspjvus.js";import{W as gs}from"./wrench-ByZkjO6m.js";import{P as ms}from"./progress-DjPEDJfI.js";import{S as ke}from"./switch-MQPnwGJK.js";import{B as M}from"./badge-B4ov81_m.js";import{u as ps,S as qt,a as Ut,b as Kt,c as Qt,d as Wt}from"./select-LsO16slr.js";import{T as fs,a as xs,b as Ie,c as hs,d as vs,e as Ct}from"./table-B8cqlywA.js";import{c as ws,T as js,a as Cs,b as Ss}from"./tooltip-Df1CunSp.js";import{T as ys}from"./tag-wEJQRWlV.js";import{L as Ns}from"./link-2-BxNmr9hL.js";import{E as Rs}from"./ellipsis-NuUWekvu.js";import{P as bs}from"./pencil-D096Ey62.js";import{A as _s}from"./archive-D5my9zOG.js";import{T as Fs}from"./trash-2-B4oAXsX-.js";import"./chevron-up-BRTtndUZ.js";const Ps=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],ks=we("arrow-up-down",Ps);const Is=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],$s=we("chevrons-left",Is);const Ms=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Vs=we("chevrons-right",Ms);const Es=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],As=we("folder-git-2",Es);var je="Checkbox",[Ds]=Pt(je),[Ts,Xe]=Ds(je);function Gs(e){const{__scopeCheckbox:r,checked:t,children:s,defaultChecked:o,disabled:i,form:a,name:c,onCheckedChange:d,required:g,value:f="on",internal_do_not_use_render:p}=e,[u,l]=_t({prop:t,defaultProp:o??!1,onChange:d,caller:je}),[h,m]=C.useState(null),[x,v]=C.useState(null),j=C.useRef(!1),R=h?!!a||!!h.closest("form"):!0,N={checked:u,disabled:i,setChecked:l,control:h,setControl:m,name:c,form:a,value:f,hasConsumerStoppedPropagationRef:j,required:g,defaultChecked:O(o)?!1:o,isFormControl:R,bubbleInput:x,setBubbleInput:v};return n.jsx(Ts,{scope:r,...N,children:Ls(p)?p(N):s})}var Xt="CheckboxTrigger",Jt=C.forwardRef(({__scopeCheckbox:e,onKeyDown:r,onClick:t,...s},o)=>{const{control:i,value:a,disabled:c,checked:d,required:g,setControl:f,setChecked:p,hasConsumerStoppedPropagationRef:u,isFormControl:l,bubbleInput:h}=Xe(Xt,e),m=Ft(o,f),x=C.useRef(d);return C.useEffect(()=>{const v=i?.form;if(v){const j=()=>p(x.current);return v.addEventListener("reset",j),()=>v.removeEventListener("reset",j)}},[i,p]),n.jsx(W.button,{type:"button",role:"checkbox","aria-checked":O(d)?"mixed":d,"aria-required":g,"data-state":nn(d),"data-disabled":c?"":void 0,disabled:c,value:a,...s,ref:m,onKeyDown:oe(r,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:oe(t,v=>{p(j=>O(j)?!0:!j),h&&l&&(u.current=v.isPropagationStopped(),u.current||v.stopPropagation())})})});Jt.displayName=Xt;var Je=C.forwardRef((e,r)=>{const{__scopeCheckbox:t,name:s,checked:o,defaultChecked:i,required:a,disabled:c,value:d,onCheckedChange:g,form:f,...p}=e;return n.jsx(Gs,{__scopeCheckbox:t,checked:o,defaultChecked:i,disabled:c,required:a,onCheckedChange:g,name:s,form:f,value:d,internal_do_not_use_render:({isFormControl:u})=>n.jsxs(n.Fragment,{children:[n.jsx(Jt,{...p,ref:r,__scopeCheckbox:t}),u&&n.jsx(tn,{__scopeCheckbox:t})]})})});Je.displayName=je;var Yt="CheckboxIndicator",Zt=C.forwardRef((e,r)=>{const{__scopeCheckbox:t,forceMount:s,...o}=e,i=Xe(Yt,t);return n.jsx(bt,{present:s||O(i.checked)||i.checked===!0,children:n.jsx(W.span,{"data-state":nn(i.checked),"data-disabled":i.disabled?"":void 0,...o,ref:r,style:{pointerEvents:"none",...e.style}})})});Zt.displayName=Yt;var en="CheckboxBubbleInput",tn=C.forwardRef(({__scopeCheckbox:e,...r},t)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:i,defaultChecked:a,required:c,disabled:d,name:g,value:f,form:p,bubbleInput:u,setBubbleInput:l}=Xe(en,e),h=Ft(t,l),m=ps(i),x=Gn(s);C.useEffect(()=>{const j=u;if(!j)return;const R=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(R,"checked").set,k=!o.current;if(m!==i&&b){const G=new Event("click",{bubbles:k});j.indeterminate=O(i),b.call(j,O(i)?!1:i),j.dispatchEvent(G)}},[u,m,i,o]);const v=C.useRef(O(i)?!1:i);return n.jsx(W.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??v.current,required:c,disabled:d,name:g,value:f,form:p,...r,tabIndex:-1,ref:h,style:{...r.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});tn.displayName=en;function Ls(e){return typeof e=="function"}function O(e){return e==="indeterminate"}function nn(e){return O(e)?"indeterminate":e?"checked":"unchecked"}var Ce="Tabs",[Hs]=Pt(Ce,[kt]),sn=kt(),[zs,Ye]=Hs(Ce),rn=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:c,activationMode:d="automatic",...g}=e,f=Ln(c),[p,u]=_t({prop:s,onChange:o,defaultProp:i??"",caller:Ce});return n.jsx(zs,{scope:t,baseId:Hn(),value:p,onValueChange:u,orientation:a,dir:f,activationMode:d,children:n.jsx(W.div,{dir:f,"data-orientation":a,...g,ref:r})})});rn.displayName=Ce;var on="TabsList",an=C.forwardRef((e,r)=>{const{__scopeTabs:t,loop:s=!0,...o}=e,i=Ye(on,t),a=sn(t);return n.jsx(zn,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:s,children:n.jsx(W.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:r})})});an.displayName=on;var ln="TabsTrigger",un=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,disabled:o=!1,...i}=e,a=Ye(ln,t),c=sn(t),d=gn(a.baseId,s),g=mn(a.baseId,s),f=s===a.value;return n.jsx(On,{asChild:!0,...c,focusable:!o,active:f,children:n.jsx(W.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":g,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...i,ref:r,onMouseDown:oe(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?a.onValueChange(s):p.preventDefault()}),onKeyDown:oe(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&a.onValueChange(s)}),onFocus:oe(e.onFocus,()=>{const p=a.activationMode!=="manual";!f&&!o&&p&&a.onValueChange(s)})})})});un.displayName=ln;var cn="TabsContent",dn=C.forwardRef((e,r)=>{const{__scopeTabs:t,value:s,forceMount:o,children:i,...a}=e,c=Ye(cn,t),d=gn(c.baseId,s),g=mn(c.baseId,s),f=s===c.value,p=C.useRef(f);return C.useEffect(()=>{const u=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(u)},[]),n.jsx(bt,{present:o||f,children:({present:u})=>n.jsx(W.div,{"data-state":f?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!u,id:g,tabIndex:0,...a,ref:r,style:{...e.style,animationDuration:p.current?"0s":void 0},children:u&&i})})});dn.displayName=cn;function gn(e,r){return`${e}-trigger-${r}`}function mn(e,r){return`${e}-content-${r}`}var Os=rn,pn=an,fn=un,xn=dn;const $e=["#6366f1","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#3b82f6"],ge=[{name:"clipboard-list",icon:zt},{name:"rocket",icon:is},{name:"lightbulb",icon:as},{name:"target",icon:Ot},{name:"smartphone",icon:us},{name:"globe",icon:ds},{name:"settings",icon:It},{name:"wrench",icon:gs},{name:"bar-chart-3",icon:Bn},{name:"palette",icon:ls},{name:"code",icon:cs},{name:"shield",icon:$t}];function Bs({open:e,onOpenChange:r,onSuccess:t}){const[s,o]=C.useState(""),[i,a]=C.useState(""),[c,d]=C.useState(""),[g,f]=C.useState($e[0]),[p,u]=C.useState(ge[0].name),[l,h]=C.useState(""),m=ge.find(N=>N.name===p)?.icon||zt,x=L({mutationFn:()=>ie.projects.create({key:s.toUpperCase(),name:i,description:c||void 0,color:g,icon:p}),onSuccess:()=>{$.success(`Project ${s.toUpperCase()} created`),r(!1),v(),t?.()},onError:N=>{N.message?.includes("already exists")?h("This project key is already taken"):$.error(N.message||"Failed to create project")}}),v=()=>{o(""),a(""),d(""),f($e[0]),u(ge[0].name),h("")},j=N=>{const b=N.toUpperCase().replace(/[^A-Z0-9]/g,"");o(b),h("")},R=N=>{if(N.preventDefault(),s.length<2){h("Key must be at least 2 characters");return}if(s.length>10){h("Key must be at most 10 characters");return}if(!/^[A-Z]/.test(s)){h("Key must start with a letter");return}i.trim()&&x.mutate()};return n.jsx(Tt,{open:e,onOpenChange:r,children:n.jsxs(Gt,{className:"sm:max-w-lg",children:[n.jsxs(Lt,{children:[n.jsxs(Ht,{className:"flex items-center gap-2",children:[n.jsx(We,{className:"h-5 w-5 text-primary"}),"Create New Project"]}),n.jsx(rs,{children:"Create a project to organize your tickets. Each project gets a unique key prefix (e.g., PROFCLAW-1, MOBILE-1)."})]}),n.jsxs("form",{onSubmit:R,className:"space-y-6",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Project Key ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"text",value:s,onChange:N=>j(N.target.value),placeholder:"PROJ",maxLength:10,className:"w-32 field font-mono uppercase"}),n.jsx("span",{className:"text-muted-foreground",children:"-"}),n.jsx("span",{className:"text-muted-foreground font-mono",children:"123"})]}),l&&n.jsx("p",{className:"text-xs text-destructive",children:l}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"2-10 uppercase letters/numbers. This will be the prefix for all tickets in this project."})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("label",{className:"text-sm font-medium",children:["Project Name ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx("input",{type:"text",value:i,onChange:N=>a(N.target.value),placeholder:"My Awesome Project",className:"w-full field"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Description"}),n.jsx("textarea",{value:c,onChange:N=>d(N.target.value),placeholder:"Optional description...",rows:2,className:"w-full field resize-none"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:ge.map(({name:N,icon:b})=>n.jsx("button",{type:"button",onClick:()=>u(N),className:`w-9 h-9 rounded-lg flex items-center justify-center transition-all ${p===N?"bg-primary/20 ring-2 ring-primary":"bg-muted/50 hover:bg-muted"}`,children:n.jsx(b,{className:"h-5 w-5"})},N))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("label",{className:"text-sm font-medium",children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:$e.map(N=>n.jsx("button",{type:"button",onClick:()=>f(N),className:`w-7 h-7 rounded-full transition-all ${g===N?"ring-2 ring-offset-2 ring-offset-background ring-primary":""}`,style:{backgroundColor:N}},N))})]})]}),n.jsxs("div",{className:"p-4 bg-muted/30 rounded-lg border border-border",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Preview"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`${g}20`},children:n.jsx(m,{className:"h-5 w-5",style:{color:g}})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${g}20`,color:g},children:s||"PROJ"}),n.jsx("p",{className:"font-medium mt-0.5",children:i||"Project Name"})]})]})]}),n.jsxs(os,{children:[n.jsx(_,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),n.jsxs(_,{type:"submit",disabled:!s||!i.trim()||x.isPending,className:"gap-2",children:[x.isPending&&n.jsx(ae,{className:"h-4 w-4 animate-spin"}),"Create Project"]})]})]})]})})}const qs=Os,hn=C.forwardRef(({className:e,...r},t)=>n.jsx(pn,{ref:t,className:F("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...r}));hn.displayName=pn.displayName;const He=C.forwardRef(({className:e,...r},t)=>n.jsx(fn,{ref:t,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-lg px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/20 disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-gradient-to-br data-[state=active]:from-primary data-[state=active]:to-primary-hover data-[state=active]:text-white data-[state=active]:shadow-[0_0_15px_-3px_var(--primary-glow)] data-[state=active]:border-primary/20","hover:text-foreground hover:bg-muted/50 transition-colors",e),...r}));He.displayName=fn.displayName;const ze=C.forwardRef(({className:e,...r},t)=>n.jsx(xn,{ref:t,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r}));ze.displayName=xn.displayName;const vn=[{value:"backlog",label:"Backlog",color:"#6b7280"},{value:"todo",label:"To Do",color:"#3b82f6"},{value:"in_progress",label:"In Progress",color:"#f59e0b"},{value:"in_review",label:"In Review",color:"#8b5cf6"},{value:"done",label:"Done",color:"#22c55e"},{value:"cancelled",label:"Cancelled",color:"#ef4444"}],wn=[{value:"critical",label:"Critical",color:"#ef4444"},{value:"high",label:"High",color:"#f97316"},{value:"medium",label:"Medium",color:"#eab308"},{value:"low",label:"Low",color:"#22c55e"},{value:"none",label:"None",color:"#6b7280"}],jn=[{value:"task",label:"Task",icon:"📋"},{value:"bug",label:"Bug",icon:"🐛"},{value:"feature",label:"Feature",icon:"✨"},{value:"epic",label:"Epic",icon:"🎯"},{value:"story",label:"Story",icon:"📖"},{value:"subtask",label:"Subtask",icon:"📎"},{value:"improvement",label:"Improvement",icon:"💡"}],St=[{key:"status",label:"Status",options:vn,defaultValue:"backlog"},{key:"priority",label:"Priority",options:wn,defaultValue:"medium"},{key:"type",label:"Type",options:jn,defaultValue:"task"}];function Us({items:e,mappings:r,onMappingsChange:t}){const s=C.useMemo(()=>{const p={status:new Set,priority:new Set,type:new Set};for(const u of e)u.status&&p.status.add(u.status),u.priority&&p.priority.add(u.priority),u.type&&p.type.add(u.type);return{status:Array.from(p.status).sort(),priority:Array.from(p.priority).sort(),type:Array.from(p.type).sort()}},[e]),o=C.useMemo(()=>{const p={status:{},priority:{},type:{}};for(const u of e)u.status&&(p.status[u.status]=(p.status[u.status]||0)+1),u.priority&&(p.priority[u.priority]=(p.priority[u.priority]||0)+1),u.type&&(p.type[u.type]=(p.type[u.type]||0)+1);return p},[e]),i=(p,u)=>!!r[p][u],a=C.useMemo(()=>({status:s.status.filter(p=>!i("status",p)).length,priority:s.priority.filter(p=>!i("priority",p)).length,type:s.type.filter(p=>!i("type",p)).length}),[s,r]),c=(p,u,l)=>{t({...r,[p]:{...r[p],[u]:l}})},d=()=>{const p={...r};for(const u of St){const l=u.key;for(const h of s[l])if(!p[l][h]){const m=u.options.find(x=>x.label.toLowerCase()===h.toLowerCase()||x.value.toLowerCase()===h.toLowerCase());p[l][h]=m?.value||u.defaultValue}}t(p)},g=()=>{t({status:{},priority:{},type:{}})},f=a.status+a.priority+a.type;return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Field Mappings"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Map GitHub fields to profClaw values"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[f>0&&n.jsxs(_,{variant:"outline",size:"sm",onClick:d,className:"gap-2",children:[n.jsx(We,{className:"h-3.5 w-3.5"}),"Auto-map ",f," values"]}),n.jsxs(_,{variant:"ghost",size:"sm",onClick:g,className:"gap-2 text-muted-foreground",children:[n.jsx(Mt,{className:"h-3.5 w-3.5"}),"Reset"]})]})]}),f>0&&n.jsxs("div",{className:"flex items-center gap-2 p-3 bg-amber-500/10 border border-amber-500/20 rounded-lg text-sm",children:[n.jsx(Q,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsxs("span",{className:"text-amber-700 dark:text-amber-400",children:[f," value",f!==1?"s":""," need",f===1?"s":""," mapping. Items with unmapped values will use defaults."]})]}),n.jsx("div",{className:"space-y-6",children:St.map(p=>{const u=s[p.key],l=a[p.key];return u.length===0?null:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"text-sm font-medium",children:p.label}),l>0?n.jsxs(M,{variant:"outline",className:"text-amber-600 border-amber-300 bg-amber-50 dark:bg-amber-900/20",children:[l," unmapped"]}):n.jsxs(M,{variant:"outline",className:"text-green-600 border-green-300 bg-green-50 dark:bg-green-900/20",children:[n.jsx(K,{className:"h-3 w-3 mr-1"}),"All mapped"]})]}),n.jsx("div",{className:"rounded-2xl glass shadow-lg overflow-hidden",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-muted/50",children:[n.jsx("th",{className:"text-left py-2 px-3 font-medium text-muted-foreground",children:"GitHub Value"}),n.jsx("th",{className:"w-10"}),n.jsx("th",{className:"text-left py-2 px-3 font-medium text-muted-foreground",children:"profClaw Value"}),n.jsx("th",{className:"text-right py-2 px-3 font-medium text-muted-foreground w-20",children:"Count"})]})}),n.jsx("tbody",{className:"divide-y divide-border",children:u.map(h=>{const m=i(p.key,h),x=r[p.key][h],v=p.options.find(j=>j.value===x);return n.jsxs("tr",{className:F("transition-colors",!m&&"bg-amber-50/50 dark:bg-amber-900/10"),children:[n.jsx("td",{className:"py-2 px-3",children:n.jsxs("div",{className:"flex items-center gap-2",children:[!m&&n.jsx(Q,{className:"h-3.5 w-3.5 text-amber-500"}),n.jsx("span",{className:"font-mono text-xs bg-muted px-2 py-0.5 rounded",children:h})]})}),n.jsx("td",{className:"text-center text-muted-foreground",children:n.jsx(z,{className:"h-4 w-4 mx-auto"})}),n.jsx("td",{className:"py-2 px-3",children:n.jsxs(qt,{value:x||"",onValueChange:j=>c(p.key,h,j),children:[n.jsx(Ut,{className:F("h-8 w-48",!m&&"border-amber-300 bg-amber-50 dark:bg-amber-900/20"),children:n.jsx(Kt,{placeholder:"Select mapping...",children:v&&n.jsxs("div",{className:"flex items-center gap-2",children:["color"in v&&n.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:v.color}}),"icon"in v&&n.jsx("span",{children:v.icon}),n.jsx("span",{children:v.label})]})})}),n.jsx(Qt,{children:p.options.map(j=>n.jsx(Wt,{value:j.value,children:n.jsxs("div",{className:"flex items-center gap-2",children:["color"in j&&n.jsx("span",{className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:j.color}}),"icon"in j&&n.jsx("span",{children:j.icon}),n.jsx("span",{children:j.label})]})},j.value))})]})}),n.jsx("td",{className:"py-2 px-3 text-right text-muted-foreground tabular-nums",children:o[p.key][h]||0})]},h)})})]})})]},p.key)})})]})}function H(e,r){return typeof e=="function"?e(r):e}function V(e,r){return t=>{r.setState(s=>({...s,[e]:H(t,s[e])}))}}function Se(e){return e instanceof Function}function Ks(e){return Array.isArray(e)&&e.every(r=>typeof r=="number")}function Qs(e,r){const t=[],s=o=>{o.forEach(i=>{t.push(i);const a=r(i);a!=null&&a.length&&s(a)})};return s(e),t}function S(e,r,t){let s=[],o;return i=>{let a;t.key&&t.debug&&(a=Date.now());const c=e(i);if(!(c.length!==s.length||c.some((f,p)=>s[p]!==f)))return o;s=c;let g;if(t.key&&t.debug&&(g=Date.now()),o=r(...c),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const f=Math.round((Date.now()-a)*100)/100,p=Math.round((Date.now()-g)*100)/100,u=p/16,l=(h,m)=>{for(h=String(h);h.length<m;)h=" "+h;return h};console.info(`%c⏱ ${l(p,5)} /${l(f,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*u,120))}deg 100% 31%);`,t?.key)}return o}}function y(e,r,t,s){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[r]},key:!1,onChange:s}}function Ws(e,r,t,s){const o=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${r.id}_${t.id}`,row:r,column:t,getValue:()=>r.getValue(s),renderValue:o,getContext:S(()=>[e,t,r,i],(a,c,d,g)=>({table:a,column:c,row:d,cell:g,getValue:g.getValue,renderValue:g.renderValue}),y(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,r,e)},{}),i}function Xs(e,r,t,s){var o,i;const c={...e._getDefaultColumnDef(),...r},d=c.accessorKey;let g=(o=(i=c.id)!=null?i:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?o:typeof c.header=="string"?c.header:void 0,f;if(c.accessorFn?f=c.accessorFn:d&&(d.includes(".")?f=u=>{let l=u;for(const m of d.split(".")){var h;l=(h=l)==null?void 0:h[m]}return l}:f=u=>u[c.accessorKey]),!g)throw new Error;let p={id:`${String(g)}`,accessorFn:f,parent:s,depth:t,columnDef:c,columns:[],getFlatColumns:S(()=>[!0],()=>{var u;return[p,...(u=p.columns)==null?void 0:u.flatMap(l=>l.getFlatColumns())]},y(e.options,"debugColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],u=>{var l;if((l=p.columns)!=null&&l.length){let h=p.columns.flatMap(m=>m.getLeafColumns());return u(h)}return[p]},y(e.options,"debugColumns"))};for(const u of e._features)u.createColumn==null||u.createColumn(p,e);return p}const P="debugHeaders";function yt(e,r,t){var s;let i={id:(s=t.id)!=null?s:r.id,column:r,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],c=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(c),a.push(d)};return c(i),a},getContext:()=>({table:e,header:i,column:r})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const Js={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>{var i,a;const c=(i=s?.map(p=>t.find(u=>u.id===p)).filter(Boolean))!=null?i:[],d=(a=o?.map(p=>t.find(u=>u.id===p)).filter(Boolean))!=null?a:[],g=t.filter(p=>!(s!=null&&s.includes(p.id))&&!(o!=null&&o.includes(p.id)));return me(r,[...c,...g,...d],e)},y(e.options,P)),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s,o)=>(t=t.filter(i=>!(s!=null&&s.includes(i.id))&&!(o!=null&&o.includes(i.id))),me(r,t,e,"center")),y(e.options,P)),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(r,t,s)=>{var o;const i=(o=s?.map(a=>t.find(c=>c.id===a)).filter(Boolean))!=null?o:[];return me(r,i,e,"left")},y(e.options,P)),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(r,t,s)=>{var o;const i=(o=s?.map(a=>t.find(c=>c.id===a)).filter(Boolean))!=null?o:[];return me(r,i,e,"right")},y(e.options,P)),e.getFooterGroups=S(()=>[e.getHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],r=>[...r].reverse(),y(e.options,P)),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],r=>r.map(t=>t.headers).flat(),y(e.options,P)),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],r=>r.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),y(e.options,P)),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(r,t,s)=>{var o,i,a,c,d,g;return[...(o=(i=r[0])==null?void 0:i.headers)!=null?o:[],...(a=(c=t[0])==null?void 0:c.headers)!=null?a:[],...(d=(g=s[0])==null?void 0:g.headers)!=null?d:[]].map(f=>f.getLeafHeaders()).flat()},y(e.options,P))}};function me(e,r,t,s){var o,i;let a=0;const c=function(u,l){l===void 0&&(l=1),a=Math.max(a,l),u.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&c(h.columns,l+1)},0)};c(e);let d=[];const g=(u,l)=>{const h={depth:l,id:[s,`${l}`].filter(Boolean).join("_"),headers:[]},m=[];u.forEach(x=>{const v=[...m].reverse()[0],j=x.column.depth===h.depth;let R,N=!1;if(j&&x.column.parent?R=x.column.parent:(R=x.column,N=!0),v&&v?.column===R)v.subHeaders.push(x);else{const b=yt(t,R,{id:[s,l,R.id,x?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${m.filter(k=>k.column===R).length}`:void 0,depth:l,index:m.length});b.subHeaders.push(x),m.push(b)}h.headers.push(x),x.headerGroup=h}),d.push(h),l>0&&g(m,l-1)},f=r.map((u,l)=>yt(t,u,{depth:a,index:l}));g(f,a-1),d.reverse();const p=u=>u.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,x=0,v=[0];h.subHeaders&&h.subHeaders.length?(v=[],p(h.subHeaders).forEach(R=>{let{colSpan:N,rowSpan:b}=R;m+=N,v.push(b)})):m=1;const j=Math.min(...v);return x=x+j,h.colSpan=m,h.rowSpan=x,{colSpan:m,rowSpan:x}});return p((o=(i=d[0])==null?void 0:i.headers)!=null?o:[]),d}const Ze=(e,r,t,s,o,i,a)=>{let c={id:r,index:s,original:t,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(c._valuesCache.hasOwnProperty(d))return c._valuesCache[d];const g=e.getColumn(d);if(g!=null&&g.accessorFn)return c._valuesCache[d]=g.accessorFn(c.original,s),c._valuesCache[d]},getUniqueValues:d=>{if(c._uniqueValuesCache.hasOwnProperty(d))return c._uniqueValuesCache[d];const g=e.getColumn(d);if(g!=null&&g.accessorFn)return g.columnDef.getUniqueValues?(c._uniqueValuesCache[d]=g.columnDef.getUniqueValues(c.original,s),c._uniqueValuesCache[d]):(c._uniqueValuesCache[d]=[c.getValue(d)],c._uniqueValuesCache[d])},renderValue:d=>{var g;return(g=c.getValue(d))!=null?g:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Qs(c.subRows,d=>d.subRows),getParentRow:()=>c.parentId?e.getRow(c.parentId,!0):void 0,getParentRows:()=>{let d=[],g=c;for(;;){const f=g.getParentRow();if(!f)break;d.push(f),g=f}return d.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],d=>d.map(g=>Ws(e,c,g,g.id)),y(e.options,"debugRows")),_getAllCellsByColumnId:S(()=>[c.getAllCells()],d=>d.reduce((g,f)=>(g[f.column.id]=f,g),{}),y(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const g=e._features[d];g==null||g.createRow==null||g.createRow(c,e)}return c},Ys={createColumn:(e,r)=>{e._getFacetedRowModel=r.options.getFacetedRowModel&&r.options.getFacetedRowModel(r,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():r.getPreFilteredRowModel(),e._getFacetedUniqueValues=r.options.getFacetedUniqueValues&&r.options.getFacetedUniqueValues(r,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=r.options.getFacetedMinMaxValues&&r.options.getFacetedMinMaxValues(r,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Cn=(e,r,t)=>{var s,o;const i=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((o=e.getValue(r))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};Cn.autoRemove=e=>E(e);const Sn=(e,r,t)=>{var s;return!!(!((s=e.getValue(r))==null||(s=s.toString())==null)&&s.includes(t))};Sn.autoRemove=e=>E(e);const yn=(e,r,t)=>{var s;return((s=e.getValue(r))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};yn.autoRemove=e=>E(e);const Nn=(e,r,t)=>{var s;return(s=e.getValue(r))==null?void 0:s.includes(t)};Nn.autoRemove=e=>E(e);const Rn=(e,r,t)=>!t.some(s=>{var o;return!((o=e.getValue(r))!=null&&o.includes(s))});Rn.autoRemove=e=>E(e)||!(e!=null&&e.length);const bn=(e,r,t)=>t.some(s=>{var o;return(o=e.getValue(r))==null?void 0:o.includes(s)});bn.autoRemove=e=>E(e)||!(e!=null&&e.length);const _n=(e,r,t)=>e.getValue(r)===t;_n.autoRemove=e=>E(e);const Fn=(e,r,t)=>e.getValue(r)==t;Fn.autoRemove=e=>E(e);const et=(e,r,t)=>{let[s,o]=t;const i=e.getValue(r);return i>=s&&i<=o};et.resolveFilterValue=e=>{let[r,t]=e,s=typeof r!="number"?parseFloat(r):r,o=typeof t!="number"?parseFloat(t):t,i=r===null||Number.isNaN(s)?-1/0:s,a=t===null||Number.isNaN(o)?1/0:o;if(i>a){const c=i;i=a,a=c}return[i,a]};et.autoRemove=e=>E(e)||E(e[0])&&E(e[1]);const T={includesString:Cn,includesStringSensitive:Sn,equalsString:yn,arrIncludes:Nn,arrIncludesAll:Rn,arrIncludesSome:bn,equals:_n,weakEquals:Fn,inNumberRange:et};function E(e){return e==null||e===""}const Zs={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:V("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,r)=>{e.getAutoFilterFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?T.includesString:typeof s=="number"?T.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?T.equals:Array.isArray(s)?T.arrIncludes:T.weakEquals},e.getFilterFn=()=>{var t,s;return Se(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=r.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:T[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=r.options.enableColumnFilters)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=r.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=r.getState().columnFilters)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{r.setColumnFilters(s=>{const o=e.getFilterFn(),i=s?.find(f=>f.id===e.id),a=H(t,i?i.value:void 0);if(Nt(o,a,e)){var c;return(c=s?.filter(f=>f.id!==e.id))!=null?c:[]}const d={id:e.id,value:a};if(i){var g;return(g=s?.map(f=>f.id===e.id?d:f))!=null?g:[]}return s!=null&&s.length?[...s,d]:[d]})}},createRow:(e,r)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=r=>{const t=e.getAllLeafColumns(),s=o=>{var i;return(i=H(r,o))==null?void 0:i.filter(a=>{const c=t.find(d=>d.id===a.id);if(c){const d=c.getFilterFn();if(Nt(d,a.value,c))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=r=>{var t,s;e.setColumnFilters(r?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Nt(e,r,t){return(e&&e.autoRemove?e.autoRemove(r,t):!1)||typeof r>"u"||typeof r=="string"&&!r}const er=(e,r,t)=>t.reduce((s,o)=>{const i=o.getValue(e);return s+(typeof i=="number"?i:0)},0),tr=(e,r,t)=>{let s;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(s>i||s===void 0&&i>=i)&&(s=i)}),s},nr=(e,r,t)=>{let s;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(s<i||s===void 0&&i>=i)&&(s=i)}),s},sr=(e,r,t)=>{let s,o;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(s===void 0?a>=a&&(s=o=a):(s>a&&(s=a),o<a&&(o=a)))}),[s,o]},rr=(e,r)=>{let t=0,s=0;if(r.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,s+=i)}),t)return s/t},or=(e,r)=>{if(!r.length)return;const t=r.map(i=>i.getValue(e));if(!Ks(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),o=t.sort((i,a)=>i-a);return t.length%2!==0?o[s]:(o[s-1]+o[s])/2},ir=(e,r)=>Array.from(new Set(r.map(t=>t.getValue(e))).values()),ar=(e,r)=>new Set(r.map(t=>t.getValue(e))).size,lr=(e,r)=>r.length,Me={sum:er,min:tr,max:nr,extent:sr,mean:rr,median:or,unique:ir,uniqueCount:ar,count:lr},ur={getDefaultColumnDef:()=>({aggregatedCell:e=>{var r,t;return(r=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?r:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:V("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,r)=>{e.toggleGrouping=()=>{r.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=r.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=r.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=r.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return Me.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Me.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return Se(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=r.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:Me[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=r=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(r),e.resetGrouping=r=>{var t,s;e.setGrouping(r?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,r)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=r.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,r,t,s)=>{e.getIsGrouped=()=>r.getIsGrouped()&&r.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&r.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function cr(e,r,t){if(!(r!=null&&r.length)||!t)return e;const s=e.filter(i=>!r.includes(i.id));return t==="remove"?s:[...r.map(i=>e.find(a=>a.id===i)).filter(Boolean),...s]}const dr={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:V("columnOrder",e)}),createColumn:(e,r)=>{e.getIndex=S(t=>[le(r,t)],t=>t.findIndex(s=>s.id===e.id),y(r.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=le(r,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const o=le(r,t);return((s=o[o.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=r=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(r),e.resetColumnOrder=r=>{var t;e.setColumnOrder(r?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(r,t,s)=>o=>{let i=[];if(!(r!=null&&r.length))i=o;else{const a=[...r],c=[...o];for(;c.length&&a.length;){const d=a.shift(),g=c.findIndex(f=>f.id===d);g>-1&&i.push(c.splice(g,1)[0])}i=[...i,...c]}return cr(i,t,s)},y(e.options,"debugTable"))}},Ve=()=>({left:[],right:[]}),gr={getInitialState:e=>({columnPinning:Ve(),...e}),getDefaultOptions:e=>({onColumnPinningChange:V("columnPinning",e)}),createColumn:(e,r)=>{e.pin=t=>{const s=e.getLeafColumns().map(o=>o.id).filter(Boolean);r.setColumnPinning(o=>{var i,a;if(t==="right"){var c,d;return{left:((c=o?.left)!=null?c:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((d=o?.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(t==="left"){var g,f;return{left:[...((g=o?.left)!=null?g:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((f=o?.right)!=null?f:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((i=o?.left)!=null?i:[]).filter(p=>!(s!=null&&s.includes(p))),right:((a=o?.right)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var o,i,a;return((o=s.columnDef.enablePinning)!=null?o:!0)&&((i=(a=r.options.enableColumnPinning)!=null?a:r.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(c=>c.id),{left:s,right:o}=r.getState().columnPinning,i=t.some(c=>s?.includes(c)),a=t.some(c=>o?.includes(c));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();return o?(t=(s=r.getState().columnPinning)==null||(s=s[o])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,r)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left,r.getState().columnPinning.right],(t,s,o)=>{const i=[...s??[],...o??[]];return t.filter(a=>!i.includes(a.column.id))},y(r.options,"debugRows")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.left],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),y(r.options,"debugRows")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),r.getState().columnPinning.right],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),y(r.options,"debugRows"))},createTable:e=>{e.setColumnPinning=r=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(r),e.resetColumnPinning=r=>{var t,s;return e.setColumnPinning(r?Ve():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:Ve())},e.getIsSomeColumnsPinned=r=>{var t;const s=e.getState().columnPinning;if(!r){var o,i;return!!((o=s.left)!=null&&o.length||(i=s.right)!=null&&i.length)}return!!((t=s[r])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),y(e.options,"debugColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(r,t)=>(t??[]).map(s=>r.find(o=>o.id===s)).filter(Boolean),y(e.options,"debugColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(r,t,s)=>{const o=[...t??[],...s??[]];return r.filter(i=>!o.includes(i.id))},y(e.options,"debugColumns"))}};function mr(e){return e||(typeof document<"u"?document:null)}const pe={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Ee=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),pr={getDefaultColumnDef:()=>pe,getInitialState:e=>({columnSizing:{},columnSizingInfo:Ee(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:V("columnSizing",e),onColumnSizingInfoChange:V("columnSizingInfo",e)}),createColumn:(e,r)=>{e.getSize=()=>{var t,s,o;const i=r.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:pe.minSize,(s=i??e.columnDef.size)!=null?s:pe.size),(o=e.columnDef.maxSize)!=null?o:pe.maxSize)},e.getStart=S(t=>[t,le(r,t),r.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),y(r.options,"debugColumns")),e.getAfter=S(t=>[t,le(r,t),r.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),y(r.options,"debugColumns")),e.resetSize=()=>{r.setColumnSizing(t=>{let{[e.id]:s,...o}=t;return o})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=r.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>r.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,r)=>{e.getSize=()=>{let t=0;const s=o=>{if(o.subHeaders.length)o.subHeaders.forEach(s);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=r.getColumn(e.column.id),o=s?.getCanResize();return i=>{if(!s||!o||(i.persist==null||i.persist(),Ae(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),c=e?e.getLeafHeaders().map(v=>[v.column.id,v.column.getSize()]):[[s.id,s.getSize()]],d=Ae(i)?Math.round(i.touches[0].clientX):i.clientX,g={},f=(v,j)=>{typeof j=="number"&&(r.setColumnSizingInfo(R=>{var N,b;const k=r.options.columnResizeDirection==="rtl"?-1:1,G=(j-((N=R?.startOffset)!=null?N:0))*k,q=Math.max(G/((b=R?.startSize)!=null?b:0),-.999999);return R.columnSizingStart.forEach(J=>{let[Y,Z]=J;g[Y]=Math.round(Math.max(Z+Z*q,0)*100)/100}),{...R,deltaOffset:G,deltaPercentage:q}}),(r.options.columnResizeMode==="onChange"||v==="end")&&r.setColumnSizing(R=>({...R,...g})))},p=v=>f("move",v),u=v=>{f("end",v),r.setColumnSizingInfo(j=>({...j,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},l=mr(t),h={moveHandler:v=>p(v.clientX),upHandler:v=>{l?.removeEventListener("mousemove",h.moveHandler),l?.removeEventListener("mouseup",h.upHandler),u(v.clientX)}},m={moveHandler:v=>(v.cancelable&&(v.preventDefault(),v.stopPropagation()),p(v.touches[0].clientX),!1),upHandler:v=>{var j;l?.removeEventListener("touchmove",m.moveHandler),l?.removeEventListener("touchend",m.upHandler),v.cancelable&&(v.preventDefault(),v.stopPropagation()),u((j=v.touches[0])==null?void 0:j.clientX)}},x=fr()?{passive:!1}:!1;Ae(i)?(l?.addEventListener("touchmove",m.moveHandler,x),l?.addEventListener("touchend",m.upHandler,x)):(l?.addEventListener("mousemove",h.moveHandler,x),l?.addEventListener("mouseup",h.upHandler,x)),r.setColumnSizingInfo(v=>({...v,startOffset:d,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:c,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=r=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(r),e.setColumnSizingInfo=r=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(r),e.resetColumnSizing=r=>{var t;e.setColumnSizing(r?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=r=>{var t;e.setColumnSizingInfo(r?Ee():(t=e.initialState.columnSizingInfo)!=null?t:Ee())},e.getTotalSize=()=>{var r,t;return(r=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getLeftTotalSize=()=>{var r,t;return(r=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getCenterTotalSize=()=>{var r,t;return(r=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0},e.getRightTotalSize=()=>{var r,t;return(r=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,o)=>s+o.getSize(),0))!=null?r:0}}};let fe=null;function fr(){if(typeof fe=="boolean")return fe;let e=!1;try{const r={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,r),window.removeEventListener("test",t)}catch{e=!1}return fe=e,fe}function Ae(e){return e.type==="touchstart"}const xr={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:V("columnVisibility",e)}),createColumn:(e,r)=>{e.toggleVisibility=t=>{e.getCanHide()&&r.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(s=r.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=r.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,r)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),r.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),y(r.options,"debugRows")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,o)=>[...t,...s,...o],y(r.options,"debugRows"))},createTable:e=>{const r=(t,s)=>S(()=>[s(),s().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),y(e.options,"debugColumns"));e.getVisibleFlatColumns=r("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=r("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=r("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=r("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=r("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function le(e,r){return r?r==="center"?e.getCenterVisibleLeafColumns():r==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const hr={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},vr={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:V("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:r=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[r.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,r)=>{e.getCanGlobalFilter=()=>{var t,s,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=r.options.enableGlobalFilter)!=null?s:!0)&&((o=r.options.enableFilters)!=null?o:!0)&&((i=r.options.getColumnCanGlobalFilter==null?void 0:r.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>T.includesString,e.getGlobalFilterFn=()=>{var r,t;const{globalFilterFn:s}=e.options;return Se(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(r=(t=e.options.filterFns)==null?void 0:t[s])!=null?r:T[s]},e.setGlobalFilter=r=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(r)},e.resetGlobalFilter=r=>{e.setGlobalFilter(r?void 0:e.initialState.globalFilter)}}},wr={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:V("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let r=!1,t=!1;e._autoResetExpanded=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var o,i;e.setExpanded(s?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");s=Math.max(s,a.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,r)=>{e.toggleExpanded=t=>{r.setExpanded(s=>{var o;const i=s===!0?!0:!!(s!=null&&s[e.id]);let a={};if(s===!0?Object.keys(r.getRowModel().rowsById).forEach(c=>{a[c]=!0}):a=s,t=(o=t)!=null?o:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:c,...d}=a;return d}return s})},e.getIsExpanded=()=>{var t;const s=r.getState().expanded;return!!((t=r.options.getIsRowExpanded==null?void 0:r.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,o;return(t=r.options.getRowCanExpand==null?void 0:r.options.getRowCanExpand(e))!=null?t:((s=r.options.enableExpanding)!=null?s:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=r.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Oe=0,Be=10,De=()=>({pageIndex:Oe,pageSize:Be}),jr={getInitialState:e=>({...e,pagination:{...De(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:V("pagination",e)}),createTable:e=>{let r=!1,t=!1;e._autoResetPageIndex=()=>{var s,o;if(!r){e._queue(()=>{r=!0});return}if((s=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const o=i=>H(s,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=s=>{var o;e.setPagination(s?De():(o=e.initialState.pagination)!=null?o:De())},e.setPageIndex=s=>{e.setPagination(o=>{let i=H(s,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...o,pageIndex:i}})},e.resetPageIndex=s=>{var o,i;e.setPageIndex(s?Oe:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:Oe)},e.resetPageSize=s=>{var o,i;e.setPageSize(s?Be:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:Be)},e.setPageSize=s=>{e.setPagination(o=>{const i=Math.max(1,H(s,o.pageSize)),a=o.pageSize*o.pageIndex,c=Math.floor(a/i);return{...o,pageIndex:c,pageSize:i}})},e.setPageCount=s=>e.setPagination(o=>{var i;let a=H(s,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=S(()=>[e.getPageCount()],s=>{let o=[];return s&&s>0&&(o=[...new Array(s)].fill(null).map((i,a)=>a)),o},y(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:s<o-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},Te=()=>({top:[],bottom:[]}),Cr={getInitialState:e=>({rowPinning:Te(),...e}),getDefaultOptions:e=>({onRowPinningChange:V("rowPinning",e)}),createRow:(e,r)=>{e.pin=(t,s,o)=>{const i=s?e.getLeafRows().map(d=>{let{id:g}=d;return g}):[],a=o?e.getParentRows().map(d=>{let{id:g}=d;return g}):[],c=new Set([...a,e.id,...i]);r.setRowPinning(d=>{var g,f;if(t==="bottom"){var p,u;return{top:((p=d?.top)!=null?p:[]).filter(m=>!(c!=null&&c.has(m))),bottom:[...((u=d?.bottom)!=null?u:[]).filter(m=>!(c!=null&&c.has(m))),...Array.from(c)]}}if(t==="top"){var l,h;return{top:[...((l=d?.top)!=null?l:[]).filter(m=>!(c!=null&&c.has(m))),...Array.from(c)],bottom:((h=d?.bottom)!=null?h:[]).filter(m=>!(c!=null&&c.has(m)))}}return{top:((g=d?.top)!=null?g:[]).filter(m=>!(c!=null&&c.has(m))),bottom:((f=d?.bottom)!=null?f:[]).filter(m=>!(c!=null&&c.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:o}=r.options;return typeof s=="function"?s(e):(t=s??o)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:o}=r.getState().rowPinning,i=t.some(c=>s?.includes(c)),a=t.some(c=>o?.includes(c));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const o=e.getIsPinned();if(!o)return-1;const i=(t=o==="top"?r.getTopRows():r.getBottomRows())==null?void 0:t.map(a=>{let{id:c}=a;return c});return(s=i?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=r=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(r),e.resetRowPinning=r=>{var t,s;return e.setRowPinning(r?Te():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:Te())},e.getIsSomeRowsPinned=r=>{var t;const s=e.getState().rowPinning;if(!r){var o,i;return!!((o=s.top)!=null&&o.length||(i=s.bottom)!=null&&i.length)}return!!((t=s[r])!=null&&t.length)},e._getPinnedRows=(r,t,s)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(a=>{const c=e.getRow(a,!0);return c.getIsAllParentsExpanded()?c:null}):(t??[]).map(a=>r.find(c=>c.id===a))).filter(Boolean).map(a=>({...a,position:s}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(r,t)=>e._getPinnedRows(r,t,"top"),y(e.options,"debugRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(r,t)=>e._getPinnedRows(r,t,"bottom"),y(e.options,"debugRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(r,t,s)=>{const o=new Set([...t??[],...s??[]]);return r.filter(i=>!o.has(i.id))},y(e.options,"debugRows"))}},Sr={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:V("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=r=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(r),e.resetRowSelection=r=>{var t;return e.setRowSelection(r?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=r=>{e.setRowSelection(t=>{r=typeof r<"u"?r:!e.getIsAllRowsSelected();const s={...t},o=e.getPreGroupedRowModel().flatRows;return r?o.forEach(i=>{i.getCanSelect()&&(s[i.id]=!0)}):o.forEach(i=>{delete s[i.id]}),s})},e.toggleAllPageRowsSelected=r=>e.setRowSelection(t=>{const s=typeof r<"u"?r:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{qe(o,i.id,s,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(r,t)=>Object.keys(r).length?Ge(e,t):{rows:[],flatRows:[],rowsById:{}},y(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const r=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(r.length&&Object.keys(t).length);return s&&r.some(o=>o.getCanSelect()&&!t[o.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState();let s=!!r.length;return s&&r.some(o=>!t[o.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var r;const t=Object.keys((r=e.getState().rowSelection)!=null?r:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const r=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:r.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>r=>{e.toggleAllRowsSelected(r.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>r=>{e.toggleAllPageRowsSelected(r.target.checked)}},createRow:(e,r)=>{e.toggleSelected=(t,s)=>{const o=e.getIsSelected();r.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;const c={...i};return qe(c,e.id,t,(a=s?.selectChildren)!=null?a:!0,r),c})},e.getIsSelected=()=>{const{rowSelection:t}=r.getState();return tt(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=r.getState();return Ue(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=r.getState();return Ue(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof r.options.enableRowSelection=="function"?r.options.enableRowSelection(e):(t=r.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof r.options.enableSubRowSelection=="function"?r.options.enableSubRowSelection(e):(t=r.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof r.options.enableMultiRowSelection=="function"?r.options.enableMultiRowSelection(e):(t=r.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var o;t&&e.toggleSelected((o=s.target)==null?void 0:o.checked)}}}},qe=(e,r,t,s,o)=>{var i;const a=o.getRow(r,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(c=>delete e[c]),a.getCanSelect()&&(e[r]=!0)):delete e[r],s&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(c=>qe(e,c.id,t,s,o))};function Ge(e,r){const t=e.getState().rowSelection,s=[],o={},i=function(a,c){return a.map(d=>{var g;const f=tt(d,t);if(f&&(s.push(d),o[d.id]=d),(g=d.subRows)!=null&&g.length&&(d={...d,subRows:i(d.subRows)}),f)return d}).filter(Boolean)};return{rows:i(r.rows),flatRows:s,rowsById:o}}function tt(e,r){var t;return(t=r[e.id])!=null?t:!1}function Ue(e,r,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let o=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!o)&&(a.getCanSelect()&&(tt(a,r)?i=!0:o=!1),a.subRows&&a.subRows.length)){const c=Ue(a,r);c==="all"?i=!0:(c==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const Ke=/([0-9]+)/gm,yr=(e,r,t)=>Pn(B(e.getValue(t)).toLowerCase(),B(r.getValue(t)).toLowerCase()),Nr=(e,r,t)=>Pn(B(e.getValue(t)),B(r.getValue(t))),Rr=(e,r,t)=>nt(B(e.getValue(t)).toLowerCase(),B(r.getValue(t)).toLowerCase()),br=(e,r,t)=>nt(B(e.getValue(t)),B(r.getValue(t))),_r=(e,r,t)=>{const s=e.getValue(t),o=r.getValue(t);return s>o?1:s<o?-1:0},Fr=(e,r,t)=>nt(e.getValue(t),r.getValue(t));function nt(e,r){return e===r?0:e>r?1:-1}function B(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Pn(e,r){const t=e.split(Ke).filter(Boolean),s=r.split(Ke).filter(Boolean);for(;t.length&&s.length;){const o=t.shift(),i=s.shift(),a=parseInt(o,10),c=parseInt(i,10),d=[a,c].sort();if(isNaN(d[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(d[1]))return isNaN(a)?-1:1;if(a>c)return 1;if(c>a)return-1}return t.length-s.length}const se={alphanumeric:yr,alphanumericCaseSensitive:Nr,text:Rr,textCaseSensitive:br,datetime:_r,basic:Fr},Pr={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:V("sorting",e),isMultiSortEvent:r=>r.shiftKey}),createColumn:(e,r)=>{e.getAutoSortingFn=()=>{const t=r.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const o of t){const i=o?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return se.datetime;if(typeof i=="string"&&(s=!0,i.split(Ke).length>1))return se.alphanumeric}return s?se.text:se.basic},e.getAutoSortDir=()=>{const t=r.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return Se(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=r.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:se[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;r.setSorting(a=>{const c=a?.find(l=>l.id===e.id),d=a?.findIndex(l=>l.id===e.id);let g=[],f,p=i?t:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&s?c?f="toggle":f="add":a!=null&&a.length&&d!==a.length-1?f="replace":c?f="toggle":f="replace",f==="toggle"&&(i||o||(f="remove")),f==="add"){var u;g=[...a,{id:e.id,desc:p}],g.splice(0,g.length-((u=r.options.maxMultiSortColCount)!=null?u:Number.MAX_SAFE_INTEGER))}else f==="toggle"?g=a.map(l=>l.id===e.id?{...l,desc:p}:l):f==="remove"?g=a.filter(l=>l.id!==e.id):g=[{id:e.id,desc:p}];return g})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:r.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,o;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((s=r.options.enableSortingRemoval)==null||s)&&(!(t&&(o=r.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=r.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:r.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=r.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=r.getState().sorting)==null?void 0:s.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{r.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?r.options.isMultiSortEvent==null?void 0:r.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=r=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(r),e.resetSorting=r=>{var t,s;e.setSorting(r?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},kr=[Js,xr,dr,gr,Ys,Zs,hr,vr,Pr,ur,wr,jr,Cr,Sr,pr];function Ir(e){var r,t;const s=[...kr,...(r=e._features)!=null?r:[]];let o={_features:s};const i=o._features.reduce((u,l)=>Object.assign(u,l.getDefaultOptions==null?void 0:l.getDefaultOptions(o)),{}),a=u=>o.options.mergeOptions?o.options.mergeOptions(i,u):{...i,...u};let d={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(u=>{var l;d=(l=u.getInitialState==null?void 0:u.getInitialState(d))!=null?l:d});const g=[];let f=!1;const p={_features:s,options:{...i,...e},initialState:d,_queue:u=>{g.push(u),f||(f=!0,Promise.resolve().then(()=>{for(;g.length;)g.shift()();f=!1}).catch(l=>setTimeout(()=>{throw l})))},reset:()=>{o.setState(o.initialState)},setOptions:u=>{const l=H(u,o.options);o.options=a(l)},getState:()=>o.options.state,setState:u=>{o.options.onStateChange==null||o.options.onStateChange(u)},_getRowId:(u,l,h)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(u,l,h))!=null?m:`${h?[h.id,l].join("."):l}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(u,l)=>{let h=(l?o.getPrePaginationRowModel():o.getRowModel()).rowsById[u];if(!h&&(h=o.getCoreRowModel().rowsById[u],!h))throw new Error;return h},_getDefaultColumnDef:S(()=>[o.options.defaultColumn],u=>{var l;return u=(l=u)!=null?l:{},{header:h=>{const m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,x;return(m=(x=h.renderValue())==null||x.toString==null?void 0:x.toString())!=null?m:null},...o._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...u}},y(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:S(()=>[o._getColumnDefs()],u=>{const l=function(h,m,x){return x===void 0&&(x=0),h.map(v=>{const j=Xs(o,v,x,m),R=v;return j.columns=R.columns?l(R.columns,j,x+1):[],j})};return l(u)},y(e,"debugColumns")),getAllFlatColumns:S(()=>[o.getAllColumns()],u=>u.flatMap(l=>l.getFlatColumns()),y(e,"debugColumns")),_getAllFlatColumnsById:S(()=>[o.getAllFlatColumns()],u=>u.reduce((l,h)=>(l[h.id]=h,l),{}),y(e,"debugColumns")),getAllLeafColumns:S(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(u,l)=>{let h=u.flatMap(m=>m.getLeafColumns());return l(h)},y(e,"debugColumns")),getColumn:u=>o._getAllFlatColumnsById()[u]};Object.assign(o,p);for(let u=0;u<o._features.length;u++){const l=o._features[u];l==null||l.createTable==null||l.createTable(o)}return o}function $r(){return e=>S(()=>[e.options.data],r=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(o,i,a){i===void 0&&(i=0);const c=[];for(let g=0;g<o.length;g++){const f=Ze(e,e._getRowId(o[g],g,a),o[g],g,i,void 0,a?.id);if(t.flatRows.push(f),t.rowsById[f.id]=f,c.push(f),e.options.getSubRows){var d;f.originalSubRows=e.options.getSubRows(o[g],g),(d=f.originalSubRows)!=null&&d.length&&(f.subRows=s(f.originalSubRows,i+1,f))}}return c};return t.rows=s(r),t},y(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Mr(e){const r=[],t=s=>{var o;r.push(s),(o=s.subRows)!=null&&o.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:r,flatRows:e.flatRows,rowsById:e.rowsById}}function Vr(e,r,t){return t.options.filterFromLeafRows?Er(e,r,t):Ar(e,r,t)}function Er(e,r,t){var s;const o=[],i={},a=(s=t.options.maxLeafRowFilterDepth)!=null?s:100,c=function(d,g){g===void 0&&(g=0);const f=[];for(let u=0;u<d.length;u++){var p;let l=d[u];const h=Ze(t,l.id,l.original,l.index,l.depth,void 0,l.parentId);if(h.columnFilters=l.columnFilters,(p=l.subRows)!=null&&p.length&&g<a){if(h.subRows=c(l.subRows,g+1),l=h,r(l)&&!h.subRows.length){f.push(l),i[l.id]=l,o.push(l);continue}if(r(l)||h.subRows.length){f.push(l),i[l.id]=l,o.push(l);continue}}else l=h,r(l)&&(f.push(l),i[l.id]=l,o.push(l))}return f};return{rows:c(e),flatRows:o,rowsById:i}}function Ar(e,r,t){var s;const o=[],i={},a=(s=t.options.maxLeafRowFilterDepth)!=null?s:100,c=function(d,g){g===void 0&&(g=0);const f=[];for(let u=0;u<d.length;u++){let l=d[u];if(r(l)){var p;if((p=l.subRows)!=null&&p.length&&g<a){const m=Ze(t,l.id,l.original,l.index,l.depth,void 0,l.parentId);m.subRows=c(l.subRows,g+1),l=m}f.push(l),o.push(l),i[l.id]=l}}return f};return{rows:c(e),flatRows:o,rowsById:i}}function Dr(){return e=>S(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(r,t,s)=>{if(!r.rows.length||!(t!=null&&t.length)&&!s){for(let u=0;u<r.flatRows.length;u++)r.flatRows[u].columnFilters={},r.flatRows[u].columnFiltersMeta={};return r}const o=[],i=[];(t??[]).forEach(u=>{var l;const h=e.getColumn(u.id);if(!h)return;const m=h.getFilterFn();m&&o.push({id:u.id,filterFn:m,resolvedValue:(l=m.resolveFilterValue==null?void 0:m.resolveFilterValue(u.value))!=null?l:u.value})});const a=(t??[]).map(u=>u.id),c=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(u=>u.getCanGlobalFilter());s&&c&&d.length&&(a.push("__global__"),d.forEach(u=>{var l;i.push({id:u.id,filterFn:c,resolvedValue:(l=c.resolveFilterValue==null?void 0:c.resolveFilterValue(s))!=null?l:s})}));let g,f;for(let u=0;u<r.flatRows.length;u++){const l=r.flatRows[u];if(l.columnFilters={},o.length)for(let h=0;h<o.length;h++){g=o[h];const m=g.id;l.columnFilters[m]=g.filterFn(l,m,g.resolvedValue,x=>{l.columnFiltersMeta[m]=x})}if(i.length){for(let h=0;h<i.length;h++){f=i[h];const m=f.id;if(f.filterFn(l,m,f.resolvedValue,x=>{l.columnFiltersMeta[m]=x})){l.columnFilters.__global__=!0;break}}l.columnFilters.__global__!==!0&&(l.columnFilters.__global__=!1)}}const p=u=>{for(let l=0;l<a.length;l++)if(u.columnFilters[a[l]]===!1)return!1;return!0};return Vr(r.rows,p,e)},y(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function Tr(e){return r=>S(()=>[r.getState().pagination,r.getPrePaginationRowModel(),r.options.paginateExpandedRows?void 0:r.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:o,pageIndex:i}=t;let{rows:a,flatRows:c,rowsById:d}=s;const g=o*i,f=g+o;a=a.slice(g,f);let p;r.options.paginateExpandedRows?p={rows:a,flatRows:c,rowsById:d}:p=Mr({rows:a,flatRows:c,rowsById:d}),p.flatRows=[];const u=l=>{p.flatRows.push(l),l.subRows.length&&l.subRows.forEach(u)};return p.rows.forEach(u),p},y(r.options,"debugTable"))}function Gr(){return e=>S(()=>[e.getState().sorting,e.getPreSortedRowModel()],(r,t)=>{if(!t.rows.length||!(r!=null&&r.length))return t;const s=e.getState().sorting,o=[],i=s.filter(d=>{var g;return(g=e.getColumn(d.id))==null?void 0:g.getCanSort()}),a={};i.forEach(d=>{const g=e.getColumn(d.id);g&&(a[d.id]={sortUndefined:g.columnDef.sortUndefined,invertSorting:g.columnDef.invertSorting,sortingFn:g.getSortingFn()})});const c=d=>{const g=d.map(f=>({...f}));return g.sort((f,p)=>{for(let l=0;l<i.length;l+=1){var u;const h=i[l],m=a[h.id],x=m.sortUndefined,v=(u=h?.desc)!=null?u:!1;let j=0;if(x){const R=f.getValue(h.id),N=p.getValue(h.id),b=R===void 0,k=N===void 0;if(b||k){if(x==="first")return b?-1:1;if(x==="last")return b?1:-1;j=b&&k?0:b?x:-x}}if(j===0&&(j=m.sortingFn(f,p,h.id)),j!==0)return v&&(j*=-1),m.invertSorting&&(j*=-1),j}return f.index-p.index}),g.forEach(f=>{var p;o.push(f),(p=f.subRows)!=null&&p.length&&(f.subRows=c(f.subRows))}),g};return{rows:c(t.rows),flatRows:o,rowsById:t.rowsById}},y(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Rt(e,r){return e?Lr(e)?C.createElement(e,r):e:null}function Lr(e){return Hr(e)||typeof e=="function"||zr(e)}function Hr(e){return typeof e=="function"&&(()=>{const r=Object.getPrototypeOf(e);return r.prototype&&r.prototype.isReactComponent})()}function zr(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Or(e){const r={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=C.useState(()=>({current:Ir(r)})),[s,o]=C.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...s,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}const Qe=C.forwardRef(({className:e,...r},t)=>n.jsx(Je,{ref:t,className:F("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...r,children:n.jsx(Zt,{className:F("flex items-center justify-center text-current"),children:n.jsx(K,{className:"h-4 w-4"})})}));Qe.displayName=Je.displayName;function Br(e,r){return e.map(t=>{const s=t.status?!!r.status[t.status]:!0,o=t.priority?!!r.priority[t.priority]:!0,i=t.type?!!r.type[t.type]:!0,a=[];return!s&&t.status&&a.push({field:"status",severity:"warning",message:`Status "${t.status}" is not mapped`,suggestion:"Will use default: backlog"}),!o&&t.priority&&a.push({field:"priority",severity:"warning",message:`Priority "${t.priority}" is not mapped`,suggestion:"Will use default: medium"}),!i&&t.type&&a.push({field:"type",severity:"warning",message:`Type "${t.type}" is not mapped`,suggestion:"Will use default: task"}),{id:t.id,source:t,target:{title:t.title,description:t.body||"",status:t.status&&r.status[t.status]||"backlog",priority:t.priority&&r.priority[t.priority]||"medium",type:t.type&&r.type[t.type]||"task",labels:t.labels,assignee:t.assignees[0]||null,createdAt:t.createdAt,updatedAt:t.updatedAt},mappingStatus:{status:s?"mapped":"unmapped",priority:o?"mapped":"unmapped",type:i?"mapped":"unmapped"},conflicts:a,selected:!0}})}function qr({items:e,mappings:r,selectedIds:t,onSelectionChange:s}){const[o,i]=C.useState([]),[a,c]=C.useState([]),[d,g]=C.useState(""),f=C.useMemo(()=>Br(e,r),[e,r]),p=C.useMemo(()=>[{id:"select",header:({table:m})=>n.jsx(Qe,{checked:m.getIsAllPageRowsSelected()||m.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>{m.toggleAllPageRowsSelected(!!x);const v=new Set;x&&f.forEach(j=>v.add(j.id)),s(v)},"aria-label":"Select all"}),cell:({row:m})=>n.jsx(Qe,{checked:t.has(m.original.id),onCheckedChange:x=>{const v=new Set(t);x?v.add(m.original.id):v.delete(m.original.id),s(v)},"aria-label":"Select row"}),enableSorting:!1,enableHiding:!1,size:40},{id:"status-indicator",header:"",cell:({row:m})=>{const x=m.original.conflicts.length>0;return n.jsx(ws,{children:n.jsxs(js,{children:[n.jsx(Cs,{asChild:!0,children:n.jsx("div",{className:"flex items-center justify-center",children:x?n.jsx(Q,{className:"h-4 w-4 text-amber-500"}):n.jsx(K,{className:"h-4 w-4 text-green-500"})})}),n.jsx(Ss,{children:x?m.original.conflicts.map(v=>v.message).join(", "):"Ready to import"})]})})},size:40},{accessorKey:"source.title",header:({column:m})=>n.jsxs(_,{variant:"ghost",onClick:()=>m.toggleSorting(m.getIsSorted()==="asc"),className:"-ml-4",children:["Title",n.jsx(ks,{className:"ml-2 h-4 w-4"})]}),cell:({row:m})=>n.jsxs("div",{className:"max-w-[300px]",children:[n.jsx("p",{className:"font-medium truncate",title:m.original.source.title,children:m.original.source.title}),m.original.source.url&&n.jsxs("a",{href:m.original.source.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary inline-flex items-center gap-1",children:["#",m.original.source.issueNumber||"View",n.jsx(Le,{className:"h-3 w-3"})]})]})},{id:"status-mapping",header:"Status",cell:({row:m})=>{const x=m.original.source.status,v=m.original.target.status,j=m.original.mappingStatus.status==="mapped",R=vn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[80px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R&&n.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R.color}}),R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{id:"priority-mapping",header:"Priority",cell:({row:m})=>{const x=m.original.source.priority,v=m.original.target.priority,j=m.original.mappingStatus.priority==="mapped",R=wn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[60px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R&&n.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:R.color}}),R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{id:"type-mapping",header:"Type",cell:({row:m})=>{const x=m.original.source.type,v=m.original.target.type,j=m.original.mappingStatus.type==="mapped",R=jn.find(N=>N.value===v);return n.jsx("div",{className:"flex items-center gap-1.5 text-xs",children:x?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded truncate max-w-[60px]",children:x}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground shrink-0"}),n.jsxs(M,{variant:j?"outline":"secondary",className:F("gap-1",!j&&"bg-amber-100 text-amber-700 border-amber-200"),children:[R?.icon," ",R?.label||v]})]}):n.jsx("span",{className:"text-muted-foreground",children:"—"})})}},{accessorKey:"source.labels",header:"Labels",cell:({row:m})=>{const x=m.original.source.labels;return x.length===0?n.jsx("span",{className:"text-muted-foreground",children:"—"}):n.jsxs("div",{className:"flex flex-wrap gap-1 max-w-[150px]",children:[x.slice(0,2).map(v=>n.jsx(M,{variant:"secondary",className:"text-[10px]",children:v},v)),x.length>2&&n.jsxs(M,{variant:"outline",className:"text-[10px]",children:["+",x.length-2]})]})}},{accessorKey:"source.createdAt",header:"Created",cell:({row:m})=>{const x=new Date(m.original.source.createdAt);return n.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:x.toLocaleDateString()})}}],[f,t,s]),u=Or({data:f,columns:p,state:{sorting:o,columnFilters:a,globalFilter:d},onSortingChange:i,onColumnFiltersChange:c,onGlobalFilterChange:g,getCoreRowModel:$r(),getFilteredRowModel:Dr(),getPaginationRowModel:Tr(),getSortedRowModel:Gr(),initialState:{pagination:{pageSize:20}}}),l=f.filter(m=>m.conflicts.length>0).length,h=t.size;return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"relative max-w-sm",children:[n.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx(xe,{placeholder:"Search items...",value:d??"",onChange:m=>g(m.target.value),className:"pl-9 h-9"})]}),n.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[n.jsxs("span",{children:[n.jsx("span",{className:"font-medium",children:h}),n.jsxs("span",{className:"text-muted-foreground",children:[" of ",f.length," selected"]})]}),l>0&&n.jsxs("span",{className:"flex items-center gap-1 text-amber-600",children:[n.jsx(Q,{className:"h-4 w-4"}),l," with warnings"]})]})]}),n.jsx("div",{className:"rounded-2xl glass shadow-lg overflow-hidden",children:n.jsxs(fs,{children:[n.jsx(xs,{children:u.getHeaderGroups().map(m=>n.jsx(Ie,{className:"bg-muted/50",children:m.headers.map(x=>n.jsx(hs,{style:{width:x.getSize()!==150?x.getSize():void 0},children:x.isPlaceholder?null:Rt(x.column.columnDef.header,x.getContext())},x.id))},m.id))}),n.jsx(vs,{children:u.getRowModel().rows.length?u.getRowModel().rows.map(m=>n.jsx(Ie,{"data-state":t.has(m.original.id)&&"selected",className:F(m.original.conflicts.length>0&&"bg-amber-50/50 dark:bg-amber-900/10"),children:m.getVisibleCells().map(x=>n.jsx(Ct,{children:Rt(x.column.columnDef.cell,x.getContext())},x.id))},m.id)):n.jsx(Ie,{children:n.jsx(Ct,{colSpan:p.length,className:"h-24 text-center",children:"No items found."})})})]})}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx("span",{children:"Show"}),n.jsxs(qt,{value:String(u.getState().pagination.pageSize),onValueChange:m=>u.setPageSize(Number(m)),children:[n.jsx(Ut,{className:"h-8 w-[70px]",children:n.jsx(Kt,{})}),n.jsx(Qt,{children:[10,20,50,100].map(m=>n.jsx(Wt,{value:String(m),children:m},m))})]}),n.jsx("span",{children:"per page"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.setPageIndex(0),disabled:!u.getCanPreviousPage(),children:n.jsx($s,{className:"h-4 w-4"})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.previousPage(),disabled:!u.getCanPreviousPage(),children:n.jsx(qn,{className:"h-4 w-4"})}),n.jsxs("span",{className:"text-sm",children:["Page ",u.getState().pagination.pageIndex+1," of ",u.getPageCount()]}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.nextPage(),disabled:!u.getCanNextPage(),children:n.jsx(Et,{className:"h-4 w-4"})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>u.setPageIndex(u.getPageCount()-1),disabled:!u.getCanNextPage(),children:n.jsx(Vs,{className:"h-4 w-4"})})]})]})]})}function Ur({summary:e,iterations:r,projectKey:t,enableSync:s}){const o=e.conflicts.errors>0,i=e.conflicts.warnings>0;return n.jsxs("div",{className:"space-y-4",children:[o?n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-destructive/10 border border-destructive/20 rounded-lg",children:[n.jsx(Q,{className:"h-5 w-5 text-destructive"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-destructive",children:"Cannot proceed with import"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.conflicts.errors," error",e.conflicts.errors!==1?"s":""," must be resolved"]})]})]}):i?n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-amber-500/10 border border-amber-500/20 rounded-lg",children:[n.jsx(Q,{className:"h-5 w-5 text-amber-500"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-amber-700 dark:text-amber-400",children:"Ready with warnings"}),n.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.conflicts.warnings," item",e.conflicts.warnings!==1?"s":""," will use default values"]})]})]}):n.jsxs("div",{className:"flex items-center gap-3 p-4 bg-green-500/10 border border-green-500/20 rounded-lg",children:[n.jsx(ve,{className:"h-5 w-5 text-green-500"}),n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-green-700 dark:text-green-400",children:"Ready to import"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"All fields mapped correctly"})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("h4",{className:"text-sm font-medium",children:"What will be created"}),n.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center",children:n.jsx(At,{className:"h-4 w-4 text-primary"})}),n.jsx("span",{className:"text-2xl font-bold",children:e.itemsToCreate})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Tickets"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t,"-1 → ",t,"-",e.itemsToCreate]})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-500/10 flex items-center justify-center",children:n.jsx(Ot,{className:"h-4 w-4 text-amber-500"})}),n.jsx("span",{className:"text-2xl font-bold",children:r.length})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Sprints"}),r.length>0&&n.jsxs("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:[r[0].title,r.length>1&&` +${r.length-1} more`]})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-4",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500/10 flex items-center justify-center",children:n.jsx(ys,{className:"h-4 w-4 text-indigo-500"})}),n.jsx("span",{className:"text-2xl font-bold",children:e.unmappedValues.status.length+e.unmappedValues.priority.length+e.unmappedValues.type.length||"—"})]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique labels"})]})]})]}),s&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[n.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium",children:"Bidirectional sync enabled"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Changes will sync between profClaw and GitHub"})]}),n.jsxs(M,{variant:"outline",className:"text-green-600",children:[n.jsx(ve,{className:"h-3 w-3 mr-1"}),"Active"]})]}),n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[n.jsx(Un,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"text-sm font-medium",children:"Original dates preserved"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Created/updated timestamps will be imported from GitHub"})]})]}),e.itemsToSkip>0&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[n.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-sm",children:[n.jsx("span",{className:"font-medium",children:e.itemsToSkip})," items will be skipped"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"These items are deselected or have errors"})]})]}),(e.unmappedValues.status.length>0||e.unmappedValues.priority.length>0||e.unmappedValues.type.length>0)&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("h4",{className:"text-sm font-medium text-amber-600",children:"Unmapped values (using defaults)"}),n.jsxs("div",{className:"space-y-1 text-xs",children:[e.unmappedValues.status.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Status:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.status.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"backlog"})]}),e.unmappedValues.priority.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Priority:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.priority.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"medium"})]}),e.unmappedValues.type.length>0&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-foreground w-16",children:"Type:"}),n.jsx("div",{className:"flex flex-wrap gap-1",children:e.unmappedValues.type.map(a=>n.jsx("span",{className:"font-mono bg-muted px-1.5 py-0.5 rounded",children:a},a))}),n.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),n.jsx(M,{variant:"secondary",children:"task"})]})]})]})]})}const re=["connect","select","mapping","preview","configure","import"],Kr={connect:"Connect",select:"Select",mapping:"Map Fields",preview:"Preview",configure:"Configure",import:"Import"},Qr=["📋","🚀","💡","🎯","⚡","🔧","📱","🌐","🎨","📊"],Wr=["#6366f1","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#84cc16"],Xr=["read:project","repo","user:email"];function Jr({open:e,onOpenChange:r,onSuccess:t}){const s=Dt(),[o,i]=C.useState("connect"),[a,c]=C.useState("oauth"),[d,g]=C.useState(""),[f,p]=C.useState(!1),[u,l]=C.useState(null),[h,m]=C.useState(null),[x,v]=C.useState({status:{},priority:{},type:{}}),[j,R]=C.useState(new Set),[N,b]=C.useState(null),[k,G]=C.useState(""),[q,J]=C.useState(""),[Y,Z]=C.useState("📋"),[ee,st]=C.useState("#6366f1"),[rt,ot]=C.useState(!0),[ye,it]=C.useState(!0),[at,lt]=C.useState(!0),[ue,ut]=C.useState(null),{data:A,isLoading:kn}=X({queryKey:["auth-status"],queryFn:async()=>{const w=await fetch("/api/auth/me");return w.ok?w.json():{authenticated:!1}},enabled:e}),{data:ct,isLoading:In}=X({queryKey:["github-token-status"],queryFn:async()=>{const w=await fetch("/api/import/github/status");if(!w.ok)throw new Error("Failed to check token");return w.json()},enabled:e&&!A?.user?.hasGitHubToken}),ce=A?.user?.hasGitHubToken||ct?.hasToken,dt=A?.user?.connectedAccounts?.find(w=>w.provider==="github")?.username||ct?.username;C.useEffect(()=>{ce&&o==="connect"&&i("select")},[ce,o]);const{data:gt,isLoading:Ne,refetch:$n}=X({queryKey:["github-projects"],queryFn:async()=>{const w=await fetch("/api/import/github/projects");if(!w.ok)throw new Error("Failed to fetch projects");return w.json()},enabled:o==="select"}),{data:mt}=X({queryKey:["github-oauth-url"],queryFn:async()=>{const w=await fetch("/api/auth/github/url");return w.ok?w.json():null},enabled:e&&a==="oauth"}),Re=L({mutationFn:async w=>{const I=await fetch("/api/import/github/validate-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:w})});if(!I.ok){const U=await I.json();throw new Error(U.error||"Token validation failed")}return I.json()},onSuccess:w=>{$.success(`Connected as ${w.username}`),s.invalidateQueries({queryKey:["github-token-status"]}),s.invalidateQueries({queryKey:["auth-status"]}),i("select")},onError:w=>{$.error(w.message)}}),be=L({mutationFn:async w=>{const I=await fetch(`/api/import/github/projects/${encodeURIComponent(w)}/preview`);if(!I.ok)throw new Error("Failed to fetch project preview");return I.json()},onSuccess:w=>{m(w),v(w.fieldMappings),R(new Set(w.items.map(U=>U.id)));const I=w.project.title.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);G(I),J(w.project.title),i("mapping")},onError:w=>{$.error(w.message)}}),_e=L({mutationFn:async()=>{const w=await fetch(`/api/import/github/projects/${encodeURIComponent(u)}/dry-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({fieldMappings:x,selectedItemIds:Array.from(j)})});if(!w.ok)throw new Error("Dry run failed");return w.json()},onSuccess:w=>{b(w)},onError:w=>{$.error(w.message)}}),te=L({mutationFn:async()=>{const w=await fetch(`/api/import/github/projects/${encodeURIComponent(u)}/execute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectKey:k,projectName:q,icon:Y,color:ee,importIterations:rt,enableSync:ye,preserveTimestamps:at,selectedItemIds:Array.from(j),fieldMappings:x})});if(!w.ok){const I=await w.json();throw new Error(I.error||"Import failed")}return w.json()},onSuccess:w=>{ut(w),s.invalidateQueries({queryKey:["projects"]}),$.success("Project imported successfully!"),t?.()},onError:w=>{$.error(w.message)}}),pt=L({mutationFn:async()=>{const w=await fetch("/api/import/github/disconnect",{method:"DELETE"});if(!w.ok)throw new Error("Failed to disconnect");return w.json()},onSuccess:()=>{$.success("Disconnected from GitHub"),s.invalidateQueries({queryKey:["github-token-status"]}),s.invalidateQueries({queryKey:["auth-status"]}),i("connect"),g("")}});C.useEffect(()=>{e||setTimeout(()=>{i(ce?"select":"connect"),g(""),c("oauth"),p(!1),l(null),m(null),b(null),ut(null),G(""),J(""),Z("📋"),st("#6366f1"),ot(!0),it(!0),lt(!0),R(new Set),v({status:{},priority:{},type:{}})},200)},[e,ce]);const ft=re.indexOf(o),Mn=(ft+1)/re.length*100,xt=o!=="connect"&&o!=="import",Vn=()=>{switch(o){case"connect":return a==="oauth"||d.length>0;case"select":return u!==null;case"mapping":return!0;case"preview":return j.size>0;case"configure":return k.length>=2&&q.length>=1;default:return!1}},En=()=>{const w=re.indexOf(o);w>0&&i(re[w-1])},An=async()=>{switch(o){case"connect":a==="oauth"&&mt?.url?window.location.href=mt.url:Re.mutate(d);break;case"select":u&&be.mutate(u);break;case"mapping":i("preview");break;case"preview":await _e.mutateAsync(),i("configure");break;case"configure":i("import"),te.mutate();break}},Dn=w=>{navigator.clipboard.writeText(w),$.success("Copied to clipboard")},Tn=C.useMemo(()=>{if(N)return N.summary;const w=h?.items||[],I=j,U=new Set,Fe=new Set,Pe=new Set;for(const D of w)D.status&&!x.status[D.status]&&U.add(D.status),D.priority&&!x.priority[D.priority]&&Fe.add(D.priority),D.type&&!x.type[D.type]&&Pe.add(D.type);return{totalItems:w.length,itemsToCreate:I.size,itemsToSkip:w.length-I.size,iterations:h?.iterations.length||0,conflicts:{errors:0,warnings:U.size+Fe.size+Pe.size},unmappedValues:{status:Array.from(U),priority:Array.from(Fe),type:Array.from(Pe)}}},[h,j,x,N]);return n.jsx(Tt,{open:e,onOpenChange:r,children:n.jsxs(Gt,{className:"sm:max-w-4xl max-h-[90vh] flex flex-col",children:[n.jsx(Lt,{children:n.jsxs(Ht,{className:"flex items-center gap-2",children:[n.jsx(he,{className:"h-5 w-5"}),"Import from GitHub Projects"]})}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"flex justify-between text-xs text-muted-foreground",children:re.map((w,I)=>n.jsx("span",{className:F("transition-colors",I<=ft?"text-primary font-medium":""),children:Kr[w]},w))}),n.jsx(ms,{value:Mn,className:"h-1"})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto py-4 min-h-[400px]",children:[o==="connect"&&n.jsxs("div",{className:"space-y-6",children:[A?.authenticated&&A.user&&!A.user.hasGitHubToken&&n.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 rounded-lg border border-primary/20",children:[A.user.avatarUrl?n.jsx("img",{src:A.user.avatarUrl,alt:A.user.name,className:"w-10 h-10 rounded-full"}):n.jsx("div",{className:"w-10 h-10 rounded-full bg-muted flex items-center justify-center",children:n.jsx(Kn,{className:"h-5 w-5 text-muted-foreground"})}),n.jsxs("div",{className:"flex-1",children:[n.jsx("p",{className:"font-medium",children:A.user.name}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Connect GitHub to import your projects"})]})]}),n.jsxs("div",{className:"text-center py-4",children:[n.jsx("div",{className:"w-16 h-16 rounded-full bg-gradient-to-br from-gray-800 to-gray-900 flex items-center justify-center mx-auto mb-4",children:n.jsx(he,{className:"h-8 w-8 text-white"})}),n.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Connect Your GitHub"}),n.jsx("p",{className:"text-muted-foreground text-sm max-w-md mx-auto",children:"Connect your GitHub account to import Projects, Issues, and more."})]}),n.jsxs("div",{className:"flex items-center justify-center gap-2 p-1 bg-muted rounded-lg max-w-xs mx-auto",children:[n.jsxs("button",{onClick:()=>c("oauth"),className:F("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all",a==="oauth"?"bg-background shadow-sm":"hover:bg-background/50 text-muted-foreground"),children:[n.jsx($t,{className:"h-4 w-4 inline-block mr-2"}),"OAuth"]}),n.jsxs("button",{onClick:()=>c("pat"),className:F("flex-1 py-2 px-4 rounded-md text-sm font-medium transition-all",a==="pat"?"bg-background shadow-sm":"hover:bg-background/50 text-muted-foreground"),children:[n.jsx(ht,{className:"h-4 w-4 inline-block mr-2"}),"Token"]})]}),a==="oauth"&&n.jsx("div",{className:"max-w-md mx-auto space-y-4",children:n.jsxs("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-4",children:[n.jsxs("h4",{className:"font-medium text-green-600 flex items-center gap-2 mb-2",children:[n.jsx(ve,{className:"h-4 w-4"}),"Recommended Method"]}),n.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"One-click authentication"]}),n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"Automatic token refresh"]}),n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(K,{className:"h-3 w-3 text-green-500"}),"Secure OAuth 2.0 flow"]})]})]})}),a==="pat"&&n.jsx("div",{className:"max-w-md mx-auto space-y-4",children:f?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[n.jsx("h4",{className:"font-medium text-sm",children:"Create a Personal Access Token"}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"1"}),n.jsxs("a",{href:"https://github.com/settings/tokens?type=beta",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline font-medium inline-flex items-center gap-1",children:["Open GitHub Token Settings ",n.jsx(Le,{className:"h-3 w-3"})]})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"2"}),n.jsx("span",{children:'Click "Generate new token" and choose "Fine-grained token"'})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"3"}),n.jsxs("div",{className:"flex-1 space-y-2",children:[n.jsx("span",{children:"Enable these permissions:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:Xr.map(w=>n.jsxs("button",{onClick:()=>Dn(w),className:"inline-flex items-center gap-1 px-2 py-0.5 bg-background rounded text-xs font-mono border border-border hover:border-primary transition-colors",children:[w,n.jsx(Qn,{className:"h-3 w-3 opacity-50"})]},w))})]})]}),n.jsxs("div",{className:"flex items-start gap-3 text-sm",children:[n.jsx("span",{className:"w-5 h-5 rounded-full bg-primary text-primary-foreground flex items-center justify-center text-xs font-bold shrink-0",children:"4"}),n.jsx("span",{children:"Copy the token and paste it below"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{htmlFor:"pat",children:"Personal Access Token"}),n.jsx(xe,{id:"pat",type:"password",value:d,onChange:w=>g(w.target.value),placeholder:"github_pat_xxxxxxxxxxxxxxxxxxxxxxxx",className:"font-mono bg-muted/50",autoComplete:"off"})]})]}):n.jsxs(_,{variant:"outline",className:"w-full",onClick:()=>p(!0),children:[n.jsx(ht,{className:"h-4 w-4 mr-2"}),"I have a Personal Access Token"]})})]}),o==="select"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Your GitHub Projects"}),dt&&n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Connected as ",n.jsxs("span",{className:"font-medium",children:["@",dt]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(_,{variant:"ghost",size:"sm",onClick:()=>$n(),disabled:Ne,children:n.jsx(Wn,{className:F("h-4 w-4",Ne&&"animate-spin")})}),n.jsx(_,{variant:"outline",size:"sm",onClick:()=>pt.mutate(),disabled:pt.isPending,children:"Disconnect"})]})]}),Ne||In||kn?n.jsx("div",{className:"flex items-center justify-center py-12",children:n.jsx(ae,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):gt?.projects?.length===0?n.jsxs("div",{className:"text-center py-12",children:[n.jsx(As,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),n.jsx("p",{className:"text-muted-foreground",children:"No GitHub Projects found"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Make sure you have at least one Project V2 in your account"}),n.jsxs(_,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>window.open("https://github.com/new/project","_blank"),children:["Create a GitHub Project ",n.jsx(Le,{className:"h-3 w-3 ml-2"})]})]}):n.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto",children:gt?.projects?.map(w=>n.jsx("button",{onClick:()=>l(w.id),className:F("w-full text-left p-4 rounded-lg border transition-all",u===w.id?"border-primary bg-primary/5":"border-border hover:border-primary/30 hover:bg-muted/50"),children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("h4",{className:"font-medium truncate",children:w.title}),w.public?n.jsx(M,{variant:"outline",className:"text-[10px]",children:"Public"}):n.jsx(M,{variant:"secondary",className:"text-[10px]",children:"Private"})]}),w.shortDescription&&n.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:w.shortDescription}),n.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-muted-foreground",children:[n.jsxs("span",{children:[w.items.totalCount," items"]}),n.jsxs("span",{children:[w.fields.totalCount," fields"]}),w.creator&&n.jsxs("span",{children:["by ",w.creator.login]})]})]}),u===w.id&&n.jsx(K,{className:"h-5 w-5 text-primary shrink-0 ml-2"})]})},w.id))})]}),o==="mapping"&&h&&n.jsx(Us,{items:h.items,mappings:x,onMappingsChange:v}),o==="preview"&&h&&n.jsx(qr,{items:h.items,mappings:x,selectedIds:j,onSelectionChange:R}),o==="configure"&&n.jsx("div",{className:"space-y-6",children:n.jsxs(qs,{defaultValue:"project",className:"w-full",children:[n.jsxs(hn,{className:"grid w-full grid-cols-2",children:[n.jsxs(He,{value:"project",className:"gap-2",children:[n.jsx(It,{className:"h-4 w-4"}),"Project Settings"]}),n.jsxs(He,{value:"summary",className:"gap-2",children:[n.jsx(At,{className:"h-4 w-4"}),"Import Summary"]})]}),n.jsxs(ze,{value:"project",className:"space-y-4 mt-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ne,{htmlFor:"project-key",children:["Project Key ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(xe,{id:"project-key",value:k,onChange:w=>G(w.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,10)),placeholder:"PROJ",className:"font-mono uppercase bg-muted/50",maxLength:10}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used as ticket prefix (e.g., ",k||"PROJ","-1)"]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(ne,{htmlFor:"project-name",children:["Project Name ",n.jsx("span",{className:"text-destructive",children:"*"})]}),n.jsx(xe,{id:"project-name",value:q,onChange:w=>J(w.target.value),placeholder:"My Project",className:"bg-muted/50"})]})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{children:"Icon"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:Qr.map(w=>n.jsx("button",{type:"button",onClick:()=>Z(w),className:F("w-10 h-10 flex items-center justify-center rounded-lg border text-xl transition-all",Y===w?"border-primary bg-primary/10":"border-border hover:border-primary/30"),children:w},w))})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(ne,{children:"Color"}),n.jsx("div",{className:"flex flex-wrap gap-2",children:Wr.map(w=>n.jsx("button",{type:"button",onClick:()=>st(w),className:F("w-10 h-10 rounded-lg border-2 transition-all",ee===w?"border-primary scale-110":"border-transparent"),style:{backgroundColor:w}},w))})]})]}),n.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg",children:[n.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Preview"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{icon:Y,color:ee,size:"lg"}),n.jsxs("div",{children:[n.jsx("div",{className:"flex items-center gap-2",children:n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${ee}20`,color:ee},children:k||"KEY"})}),n.jsx("p",{className:"font-medium mt-1",children:q||"Project Name"})]})]})]}),n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"Import Iterations as Sprints"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:[h?.iterations.length||0," iterations will become sprints"]})]}),n.jsx(ke,{checked:rt,onCheckedChange:ot})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsxs("p",{className:"font-medium text-sm flex items-center gap-2",children:[n.jsx(We,{className:"h-4 w-4 text-primary"}),"Enable Bidirectional Sync"]}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Keep tickets synchronized with GitHub issues"})]}),n.jsx(ke,{checked:ye,onCheckedChange:it})]}),n.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/30 rounded-lg",children:[n.jsxs("div",{children:[n.jsx("p",{className:"font-medium text-sm",children:"Preserve Original Timestamps"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Use GitHub's created/updated dates"})]}),n.jsx(ke,{checked:at,onCheckedChange:lt})]})]})]}),n.jsx(ze,{value:"summary",className:"mt-4",children:n.jsx(Ur,{summary:Tn,iterations:h?.iterations||[],projectKey:k,enableSync:ye})})]})}),o==="import"&&n.jsxs("div",{className:"space-y-6 py-8",children:[te.isPending&&n.jsxs("div",{className:"text-center",children:[n.jsx(ae,{className:"h-12 w-12 animate-spin text-primary mx-auto mb-4"}),n.jsx("p",{className:"font-medium",children:"Importing from GitHub..."}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Creating project, sprints, and tickets"})]}),te.isError&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"w-12 h-12 rounded-full bg-destructive/10 flex items-center justify-center mx-auto mb-4",children:n.jsx(Xn,{className:"h-6 w-6 text-destructive"})}),n.jsx("p",{className:"font-medium text-destructive",children:"Import Failed"}),n.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:te.error?.message||"An error occurred"}),n.jsx(_,{variant:"outline",className:"mt-4",onClick:()=>te.mutate(),children:"Try Again"})]}),ue&&n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mx-auto mb-4",children:n.jsx(ve,{className:"h-8 w-8 text-green-500"})}),n.jsx("p",{className:"text-lg font-semibold",children:"Import Complete!"}),n.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6 max-w-md mx-auto",children:[n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-primary",children:"1"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Project"})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-amber-500",children:ue.summary.sprintsCreated}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Sprints"})]}),n.jsxs("div",{className:"bg-card rounded-lg border border-border p-3 text-center",children:[n.jsx("p",{className:"text-2xl font-bold text-green-500",children:ue.summary.ticketsCreated}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"Tickets"})]})]}),n.jsxs("div",{className:"flex items-center justify-center gap-3 mt-6",children:[n.jsx(_,{variant:"outline",onClick:()=>r(!1),children:"Close"}),n.jsx(_,{onClick:()=>{r(!1),window.location.href=`/projects/${ue.project.id}`},children:"View Project"})]})]})]})]}),o!=="import"&&n.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[n.jsxs(_,{variant:"ghost",onClick:En,disabled:!xt,className:F(!xt&&"invisible"),children:[n.jsx(Jn,{className:"h-4 w-4 mr-2"}),"Back"]}),n.jsxs(_,{onClick:An,disabled:!Vn()||Re.isPending||be.isPending||_e.isPending||a==="pat"&&o==="connect"&&!f,className:"gap-2",children:[(Re.isPending||be.isPending||_e.isPending)&&n.jsx(ae,{className:"h-4 w-4 animate-spin"}),o==="connect"&&a==="oauth"?n.jsxs(n.Fragment,{children:[n.jsx(he,{className:"h-4 w-4"}),"Continue with GitHub"]}):o==="configure"?"Start Import":"Continue",n.jsx(z,{className:"h-4 w-4"})]})]})]})})}function Yr({projectId:e}){const{data:r,isLoading:t}=X({queryKey:["stats","project",e],queryFn:()=>ie.stats.projectStats(e),staleTime:6e4});if(t)return n.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(jt,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"animate-pulse",children:"..."})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(wt,{className:"h-3.5 w-3.5"}),n.jsx("span",{className:"animate-pulse",children:"..."})]})]});const s=r?.tickets?.total??0,o=r?.sprints?.total??0,i=r?.sprints?.active??0;return n.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(jt,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[s," ",s===1?"ticket":"tickets"]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(wt,{className:"h-3.5 w-3.5"}),n.jsx("span",{children:i>0?n.jsxs(n.Fragment,{children:[i," active"]}):n.jsxs(n.Fragment,{children:[o," ",o===1?"sprint":"sprints"]})})]})]})}function Co(){const e=Yn(),r=Dt(),[t,s]=C.useState(""),[o,i]=C.useState(!1),[a,c]=C.useState(!1),[d,g]=C.useState(!1),{data:f,isLoading:p,error:u}=X({queryKey:["projects",{search:t,includeArchived:o}],queryFn:()=>ie.projects.list({search:t||void 0,includeArchived:o})}),l=L({mutationFn:x=>ie.projects.archive(x),onSuccess:()=>{$.success("Project archived"),r.invalidateQueries({queryKey:["projects"]})},onError:x=>{$.error(`Failed to archive: ${x.message}`)}}),h=L({mutationFn:x=>ie.projects.delete(x),onSuccess:()=>{$.success("Project deleted"),r.invalidateQueries({queryKey:["projects"]})},onError:x=>{$.error(`Failed to delete: ${x.message}`)}}),m=f?.projects||[];return p?n.jsx("div",{className:"flex items-center justify-center h-64",children:n.jsx(ae,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):u?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 gap-4",children:[n.jsx("p",{className:"text-destructive",children:"Failed to load projects"}),n.jsx(_,{variant:"outline",onClick:()=>r.invalidateQueries({queryKey:["projects"]}),children:"Retry"})]}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),n.jsx("p",{className:"text-muted-foreground",children:"Manage your projects and ticket prefixes"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(_,{variant:"outline",onClick:()=>g(!0),className:"gap-2",children:[n.jsx(he,{className:"h-4 w-4"}),"Import"]}),n.jsxs(_,{onClick:()=>c(!0),className:"gap-2",children:[n.jsx(vt,{className:"h-4 w-4"}),"New Project"]})]})]}),n.jsxs("div",{className:"flex items-center gap-4",children:[n.jsxs("div",{className:"relative flex-1 max-w-md",children:[n.jsx(Vt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),n.jsx("input",{type:"text",placeholder:"Search projects...",value:t,onChange:x=>s(x.target.value),className:"w-full field pl-10 pr-4"})]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:o,onChange:x=>i(x.target.checked),className:"rounded"}),"Show archived"]})]}),m.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-64 bg-muted/30 rounded-xl border border-dashed border-border",children:[n.jsx(Zn,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),n.jsx("p",{className:"text-muted-foreground mb-4",children:"No projects yet"}),n.jsxs(_,{onClick:()=>c(!0),variant:"outline",className:"gap-2",children:[n.jsx(vt,{className:"h-4 w-4"}),"Create your first project"]})]}):n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:m.map(x=>n.jsxs("div",{onClick:()=>e(`/projects/${x.id}`),className:F("group relative bg-card rounded-xl border border-border p-5 cursor-pointer transition-all","hover:border-primary/50 hover:shadow-lg hover:shadow-primary/5",x.status==="archived"&&"opacity-60"),children:[n.jsxs("div",{className:"flex items-start justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{icon:x.icon,color:x.color,size:"md"}),n.jsxs("div",{children:[n.jsx("span",{className:"text-xs font-mono font-bold px-2 py-0.5 rounded",style:{backgroundColor:`${x.color}20`,color:x.color},children:x.key}),x.status==="archived"&&n.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(Archived)"})]})]}),n.jsxs(es,{children:[n.jsx(ts,{asChild:!0,children:n.jsx("button",{onClick:v=>v.stopPropagation(),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1.5 hover:bg-muted rounded-lg",children:n.jsx(Rs,{className:"h-4 w-4 text-muted-foreground"})})}),n.jsxs(ns,{align:"end",className:"w-48",children:[n.jsxs(de,{onClick:v=>{v.stopPropagation(),e(`/projects/${x.id}/settings`)},children:[n.jsx(bs,{className:"h-4 w-4 mr-2"}),"Edit Project"]}),n.jsx(ss,{}),x.status==="archived"?n.jsxs(de,{onClick:v=>{v.stopPropagation(),$.info("Unarchive coming soon")},children:[n.jsx(Mt,{className:"h-4 w-4 mr-2"}),"Restore Project"]}):n.jsxs(de,{onClick:v=>{v.stopPropagation(),l.mutate(x.id)},className:"text-amber-600",children:[n.jsx(_s,{className:"h-4 w-4 mr-2"}),"Archive Project"]}),n.jsxs(de,{onClick:v=>{v.stopPropagation(),window.confirm(`Delete project "${x.name}"? This cannot be undone.`)&&h.mutate(x.id)},className:"text-destructive",children:[n.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Delete Project"]})]})]})]}),n.jsx("h3",{className:"font-semibold mb-1",children:x.name}),n.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-4",children:x.description||"No description"}),n.jsx(Yr,{projectId:x.id}),n.jsx(Et,{className:"absolute right-4 top-1/2 -translate-y-1/2 h-5 w-5 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]},x.id))}),n.jsx(Bs,{open:a,onOpenChange:c,onSuccess:()=>{r.invalidateQueries({queryKey:["projects"]})}}),n.jsx(Jr,{open:d,onOpenChange:g,onSuccess:()=>{r.invalidateQueries({queryKey:["projects"]})}})]})}export{Co as ProjectList};
|