@surething/cockpit 1.0.205 → 1.0.206
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/.next-prod/BUILD_ID +1 -1
- package/.next-prod/app-path-routes-manifest.json +25 -25
- package/.next-prod/build-manifest.json +3 -3
- package/.next-prod/prerender-manifest.json +3 -3
- package/.next-prod/react-loadable-manifest.json +3 -3
- package/.next-prod/required-server-files.js +12 -0
- package/.next-prod/required-server-files.json +12 -0
- package/.next-prod/server/app/_global-error/page.js.nft.json +1 -1
- package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_global-error.html +1 -1
- package/.next-prod/server/app/_global-error.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found/page.js +2 -2
- package/.next-prod/server/app/_not-found/page.js.nft.json +1 -1
- package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/_not-found.html +2 -2
- package/.next-prod/server/app/_not-found.rsc +4 -3
- package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +4 -3
- package/.next-prod/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +4 -3
- package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +3 -2
- package/.next-prod/server/app/api/bash/route.js +1 -1
- package/.next-prod/server/app/api/bash/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/codex/route.js +3 -3
- package/.next-prod/server/app/api/chat/codex/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/deepseek/route.js +6 -6
- package/.next-prod/server/app/api/chat/deepseek/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/kimi/route.js +3 -3
- package/.next-prod/server/app/api/chat/kimi/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/ollama/route.js +7 -7
- package/.next-prod/server/app/api/chat/ollama/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/chat/route.js +3 -3
- package/.next-prod/server/app/api/chat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/claude-stats/route.js +1 -1
- package/.next-prod/server/app/api/claude-stats/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/commands/route.js +1 -1
- package/.next-prod/server/app/api/commands/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/comments/route.js +1 -1
- package/.next-prod/server/app/api/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/columns/route.js +4 -4
- package/.next-prod/server/app/api/db/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/connect/route.js +1 -1
- package/.next-prod/server/app/api/db/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/db/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/export/route.js +1 -1
- package/.next-prod/server/app/api/db/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/query/route.js +1 -1
- package/.next-prod/server/app/api/db/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/db/schemas/route.js +2 -2
- package/.next-prod/server/app/api/db/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/extension/version/route.js +1 -1
- package/.next-prod/server/app/api/extension/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/file/route.js +1 -1
- package/.next-prod/server/app/api/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/blame/route.js +1 -1
- package/.next-prod/server/app/api/files/blame/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/clipboard/route.js +1 -1
- package/.next-prod/server/app/api/files/clipboard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/copy/route.js +1 -1
- package/.next-prod/server/app/api/files/copy/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/delete/route.js +1 -1
- package/.next-prod/server/app/api/files/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/expanded/route.js +1 -1
- package/.next-prod/server/app/api/files/expanded/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/index/route.js +1 -1
- package/.next-prod/server/app/api/files/index/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/init/route.js +1 -1
- package/.next-prod/server/app/api/files/init/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/paste/route.js +1 -1
- package/.next-prod/server/app/api/files/paste/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/read/route.js +1 -1
- package/.next-prod/server/app/api/files/read/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/readdir/route.js +1 -1
- package/.next-prod/server/app/api/files/readdir/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/recent/route.js +1 -1
- package/.next-prod/server/app/api/files/recent/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/save/route.js +1 -1
- package/.next-prod/server/app/api/files/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/search/route.js +1 -1
- package/.next-prod/server/app/api/files/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/stat/route.js +1 -1
- package/.next-prod/server/app/api/files/stat/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/files/text/route.js +1 -1
- package/.next-prod/server/app/api/files/text/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branch-diff/route.js +1 -1
- package/.next-prod/server/app/api/git/branch-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/branches/route.js +1 -1
- package/.next-prod/server/app/api/git/branches/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commit-diff/route.js +1 -1
- package/.next-prod/server/app/api/git/commit-diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/commits/route.js +1 -1
- package/.next-prod/server/app/api/git/commits/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/diff/route.js +1 -1
- package/.next-prod/server/app/api/git/diff/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/discard/route.js +1 -1
- package/.next-prod/server/app/api/git/discard/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/stage/route.js +1 -1
- package/.next-prod/server/app/api/git/stage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/status/route.js +1 -1
- package/.next-prod/server/app/api/git/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/unstage/route.js +1 -1
- package/.next-prod/server/app/api/git/unstage/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/git/worktree/route.js +1 -1
- package/.next-prod/server/app/api/git/worktree/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/global-state/route.js +1 -1
- package/.next-prod/server/app/api/global-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/load/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/load/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/save/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/save/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/jupyter/shutdown/route.js +1 -1
- package/.next-prod/server/app/api/jupyter/shutdown/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/definition/route.js +1 -1
- package/.next-prod/server/app/api/lsp/definition/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/hover/route.js +1 -1
- package/.next-prod/server/app/api/lsp/hover/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/references/route.js +1 -1
- package/.next-prod/server/app/api/lsp/references/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/status/route.js +1 -1
- package/.next-prod/server/app/api/lsp/status/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/lsp/warmup/route.js +1 -1
- package/.next-prod/server/app/api/lsp/warmup/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/columns/route.js +4 -4
- package/.next-prod/server/app/api/mysql/columns/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/connect/route.js +1 -1
- package/.next-prod/server/app/api/mysql/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/mysql/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/export/route.js +1 -1
- package/.next-prod/server/app/api/mysql/export/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/query/route.js +1 -1
- package/.next-prod/server/app/api/mysql/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/mysql/schemas/route.js +2 -2
- package/.next-prod/server/app/api/mysql/schemas/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/connect/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/query/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/query/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/neo4j/schema/route.js +1 -1
- package/.next-prod/server/app/api/neo4j/schema/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/note/route.js +1 -1
- package/.next-prod/server/app/api/note/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/models/route.js +1 -1
- package/.next-prod/server/app/api/ollama/models/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/ollama/start/route.js +1 -1
- package/.next-prod/server/app/api/ollama/start/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-cursor/route.js +1 -1
- package/.next-prod/server/app/api/open-cursor/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/open-vscode/route.js +1 -1
- package/.next-prod/server/app/api/open-vscode/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pick-folder/route.js +1 -1
- package/.next-prod/server/app/api/pick-folder/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/pinned-sessions/route.js +1 -1
- package/.next-prod/server/app/api/pinned-sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-settings/route.js +1 -1
- package/.next-prod/server/app/api/project-settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/project-state/route.js +1 -1
- package/.next-prod/server/app/api/project-state/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/file/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/file/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/file-functions/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/file-functions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projectGraph/search/route.js +1 -1
- package/.next-prod/server/app/api/projectGraph/search/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/projects/route.js +1 -1
- package/.next-prod/server/app/api/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/command/route.js +1 -1
- package/.next-prod/server/app/api/redis/command/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/connect/route.js +1 -1
- package/.next-prod/server/app/api/redis/connect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/delete/route.js +1 -1
- package/.next-prod/server/app/api/redis/delete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/disconnect/route.js +1 -1
- package/.next-prod/server/app/api/redis/disconnect/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/get/route.js +1 -1
- package/.next-prod/server/app/api/redis/get/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/keys/route.js +1 -1
- package/.next-prod/server/app/api/redis/keys/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/redis/set/route.js +1 -1
- package/.next-prod/server/app/api/redis/set/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/comments/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/comments/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/replies/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/replies/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/[id]/route.js +1 -1
- package/.next-prod/server/app/api/review/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/identify/route.js +1 -1
- package/.next-prod/server/app/api/review/identify/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/order/route.js +1 -1
- package/.next-prod/server/app/api/review/order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/route.js +1 -1
- package/.next-prod/server/app/api/review/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/share-info/route.js +1 -1
- package/.next-prod/server/app/api/review/share-info/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/review/users/route.js +1 -1
- package/.next-prod/server/app/api/review/users/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
- package/.next-prod/server/app/api/scheduled-tasks/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/config/route.js +1 -1
- package/.next-prod/server/app/api/services/config/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/services/scripts/route.js +1 -1
- package/.next-prod/server/app/api/services/scripts/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/fork/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
- package/.next-prod/server/app/api/session/[sessionId]/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js +1 -1
- package/.next-prod/server/app/api/session-by-path/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js +1 -1
- package/.next-prod/server/app/api/sessions/projects/[encodedPath]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/projects/route.js +1 -1
- package/.next-prod/server/app/api/sessions/projects/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/sessions/route.js +1 -1
- package/.next-prod/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/settings/route.js +1 -1
- package/.next-prod/server/app/api/settings/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/[id]/route.js +1 -1
- package/.next-prod/server/app/api/skills/[id]/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/content/route.js +1 -1
- package/.next-prod/server/app/api/skills/content/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/skills/route.js +1 -1
- package/.next-prod/server/app/api/skills/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/aliases/route.js +1 -1
- package/.next-prod/server/app/api/terminal/aliases/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/autocomplete/route.js +1 -1
- package/.next-prod/server/app/api/terminal/autocomplete/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/bubble-order/route.js +1 -1
- package/.next-prod/server/app/api/terminal/bubble-order/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/env/route.js +1 -1
- package/.next-prod/server/app/api/terminal/env/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/terminal/history/route.js +1 -1
- package/.next-prod/server/app/api/terminal/history/route.js.nft.json +1 -1
- package/.next-prod/server/app/api/version/route.js +1 -1
- package/.next-prod/server/app/api/version/route.js.nft.json +1 -1
- package/.next-prod/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next-prod/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next-prod/server/app/page.js +2 -99
- package/.next-prod/server/app/page.js.nft.json +1 -1
- package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/project/page.js +2 -30
- package/.next-prod/server/app/project/page.js.nft.json +1 -1
- package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app/review/[id]/page.js +2 -2
- package/.next-prod/server/app/review/[id]/page.js.nft.json +1 -1
- package/.next-prod/server/app/review/[id]/page_client-reference-manifest.js +1 -1
- package/.next-prod/server/app-paths-manifest.json +25 -25
- package/.next-prod/server/chunks/240.js +1 -0
- package/.next-prod/server/chunks/{4098.js → 5466.js} +1 -1
- package/.next-prod/server/chunks/554.js +101 -0
- package/.next-prod/server/chunks/{4272.js → 6007.js} +2 -2
- package/.next-prod/server/chunks/7264.js +5 -0
- package/.next-prod/server/chunks/8750.js +1 -0
- package/.next-prod/server/chunks/{4490.js → 8764.js} +1 -1
- package/.next-prod/server/chunks/900.js +1 -0
- package/.next-prod/server/chunks/9255.js +1 -0
- package/.next-prod/server/chunks/9658.js +59 -0
- package/.next-prod/server/chunks/987.js +139 -0
- package/.next-prod/server/functions-config-manifest.json +1 -26
- package/.next-prod/server/middleware-build-manifest.js +1 -1
- package/.next-prod/server/middleware-react-loadable-manifest.js +1 -1
- package/.next-prod/server/pages/404.html +2 -2
- package/.next-prod/server/pages/500.html +1 -1
- package/.next-prod/server/server-reference-manifest.json +1 -1
- package/.next-prod/static/chunks/{700.8d53bb1a328c3f97.js → 1959.b9473117faf354bf.js} +1 -1
- package/.next-prod/static/chunks/5204-c8293184aa55cdd5.js +23 -0
- package/.next-prod/static/chunks/5660-9ffe0abe675caac1.js +29 -0
- package/.next-prod/static/chunks/6028-1d6ced1439a3f01f.js +1 -0
- package/.next-prod/static/chunks/6345-6b34b0528ff833a1.js +14 -0
- package/.next-prod/static/chunks/app/layout-421143dba2c69478.js +1 -0
- package/.next-prod/static/chunks/app/page-db32ebfdf1ac9174.js +1 -0
- package/.next-prod/static/chunks/app/project/page-db32ebfdf1ac9174.js +1 -0
- package/.next-prod/static/chunks/app/review/[id]/page-05cd4cb51babd64c.js +1 -0
- package/.next-prod/static/chunks/webpack-bb0c02e3a9602d78.js +1 -0
- package/.next-prod/static/css/a7974d62fe853925.css +1 -0
- package/.next-prod/trace +12 -12
- package/.next-prod/trace-build +1 -1
- package/dist/{chunk-5NL2LMKP.mjs → chunk-HIRLDMCH.mjs} +24 -140
- package/dist/chunk-RSHKDWJM.mjs +136 -0
- package/dist/chunk-VCZEGP64.mjs +984 -0
- package/dist/scheduledTasks.mjs +6 -4
- package/dist/server-K6XWP7DX.mjs +69 -0
- package/dist/wsServer.mjs +60 -482
- package/next.config.mjs +15 -0
- package/package.json +15 -17
- package/server.mjs +1 -1
- package/.next-prod/server/chunks/2338.js +0 -1
- package/.next-prod/server/chunks/3353.js +0 -1
- package/.next-prod/server/chunks/3863.js +0 -1
- package/.next-prod/server/chunks/4732.js +0 -1
- package/.next-prod/server/chunks/4793.js +0 -1
- package/.next-prod/server/chunks/5147.js +0 -1
- package/.next-prod/server/chunks/5394.js +0 -1
- package/.next-prod/server/chunks/6043.js +0 -4
- package/.next-prod/server/chunks/7051.js +0 -1
- package/.next-prod/server/chunks/7514.js +0 -31
- package/.next-prod/server/chunks/8491.js +0 -5
- package/.next-prod/server/chunks/9298.js +0 -139
- package/.next-prod/static/chunks/1705-906aa28943dbc391.js +0 -4
- package/.next-prod/static/chunks/3530-42727255f967251e.js +0 -14
- package/.next-prod/static/chunks/3579-51f0ad7204c67e22.js +0 -1
- package/.next-prod/static/chunks/3643-fe2ac2f1accd0649.js +0 -1
- package/.next-prod/static/chunks/3743-1f5d8cfd9d92ad97.js +0 -4
- package/.next-prod/static/chunks/4186-2bbbcdf03b3c15f5.js +0 -17
- package/.next-prod/static/chunks/9062-8d92cbc176f388a0.js +0 -1
- package/.next-prod/static/chunks/9114-0d2717c9c2752d0f.js +0 -1
- package/.next-prod/static/chunks/app/layout-e091cf70aaec617b.js +0 -1
- package/.next-prod/static/chunks/app/page-c9a30c88afc0a0c5.js +0 -1
- package/.next-prod/static/chunks/app/project/page-bd8c46d229676a01.js +0 -29
- package/.next-prod/static/chunks/app/review/[id]/page-f8bb4748e9a94a0f.js +0 -1
- package/.next-prod/static/chunks/webpack-c6cffb10a569677a.js +0 -1
- package/.next-prod/static/css/23784ace5d9f83d5.css +0 -1
- package/dist/JupyterKernelManager-VBKKSRVJ.mjs +0 -269
- /package/.next-prod/static/{T6-Nq3sO9DxU5E0rsM6aX → VAwjvIwxO_lfKwd6A4ptI}/_buildManifest.js +0 -0
- /package/.next-prod/static/{T6-Nq3sO9DxU5E0rsM6aX → VAwjvIwxO_lfKwd6A4ptI}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9062],{24750:(e,t,r)=>{r.d(t,{_:()=>c});var n=r(95155),o=r(12115),s=r(79114),l=r(44810),i=r(38093),a=r(87918);function d(e,t,r){let n=(e,r)=>t[e]||r,o=[],s=null!=r?`[${r+1}] `:"",l=e.anchor.selectedText.length>200?e.anchor.selectedText.slice(0,197)+"...":e.anchor.selectedText;for(let t of(o.push(`${s}${a.A.t("review.quoteRef",{text:l})}`),o.push(a.A.t("review.commentAuthor",{author:n(e.authorId,e.author),content:e.content})),e.replies))o.push(a.A.t("review.replyAuthor",{author:n(t.authorId,t.author),content:t.content}));return o.join("\n")}function c({isOpen:e,onClose:t,comments:r,reviewTitle:h,userNameMap:x,onCommentClick:p}){let{t:m}=(0,s.Bd)(),[f,g]=(0,o.useState)(null),[v,b]=(0,o.useState)(!1);if(!e)return null;let j=[...r].sort((e,t)=>e.anchor.startOffset-t.anchor.startOffset),w=(e,t)=>x[e]||t,N=async e=>{g(e.id);try{let t=d(e,x);await navigator.clipboard.writeText(t),(0,i.oR)(m("toast.copiedComment"))}catch{(0,i.oR)(m("toast.copyFailed"),"error")}finally{g(null)}},y=async()=>{if(0!==r.length){b(!0);try{let e=function(e,t,r){if(0===e.length)return"";let n=[...e].sort((e,t)=>e.anchor.startOffset-t.anchor.startOffset),o=[a.A.t("review.reviewSummary",{title:t}),""];return n.forEach((e,t)=>{o.push(d(e,r,t)),o.push("")}),o.push(a.A.t("review.totalNComments",{count:e.length})),o.join("\n").trim()}(r,h,x);await navigator.clipboard.writeText(e),(0,i.oR)(m("toast.copiedAllComments"))}catch{(0,i.oR)(m("toast.copyFailed"),"error")}finally{b(!1)}}},k=e=>{p?.(e),t()},C=j.filter(e=>!e.closed),L=j.filter(e=>e.closed),A=(0,n.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:t,children:(0,n.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] bg-card border border-border rounded-lg shadow-xl flex flex-col overflow-hidden",onClick:e=>e.stopPropagation(),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-secondary",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m("review.allCommentsTitle")}),(0,n.jsxs)("span",{className:"text-xs text-muted-foreground",children:[m("review.commentsCountBrief",{count:r.length}),L.length>0&&` (${m("review.closedCount",{count:L.length})})`]}),r.length>0&&(0,n.jsx)("button",{onClick:y,disabled:v,className:"p-1 rounded hover:bg-accent text-muted-foreground disabled:opacity-50",title:m("review.copyAllComments"),children:v?(0,n.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]}),(0,n.jsx)("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground",children:(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto p-3",children:0===r.length?(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,n.jsx)("div",{className:"text-2xl mb-2",children:"\uD83D\uDCAC"}),(0,n.jsx)("span",{className:"text-sm",children:m("review.noComments")})]}):(0,n.jsxs)("div",{className:"space-y-2",children:[C.map((e,t)=>(0,n.jsx)(u,{comment:e,index:t,resolveAuthor:w,copyingId:f,onCopy:N,onClick:k},e.id)),L.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-[11px] text-muted-foreground/60 pt-2 pb-1 px-1",children:m("review.closedComments",{count:L.length})}),L.map((e,t)=>(0,n.jsx)(u,{comment:e,index:C.length+t,resolveAuthor:w,copyingId:f,onCopy:N,onClick:k,closed:!0},e.id))]})]})})]})});return(0,n.jsx)(l.ZL,{children:A})}function u({comment:e,index:t,resolveAuthor:r,copyingId:o,onCopy:s,onClick:l,closed:i}){let d=e.anchor.selectedText.length>100?e.anchor.selectedText.slice(0,97)+"...":e.anchor.selectedText;return(0,n.jsxs)("div",{className:`rounded-lg border border-border hover:border-muted-foreground/30 transition-all cursor-pointer group ${i?"opacity-50":""}`,onClick:()=>l(e.id),children:[(0,n.jsx)("div",{className:"px-3 pt-2.5 pb-1",children:(0,n.jsx)("div",{className:"text-xs bg-yellow-500/10 border-l-2 border-yellow-500 px-2 py-1 rounded-r text-muted-foreground truncate",children:d})}),(0,n.jsxs)("div",{className:"px-3 pt-1.5 pb-2 flex items-start gap-2",children:[(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,n.jsx)("span",{className:"w-4 h-4 rounded-full bg-brand/20 text-brand flex items-center justify-center text-[9px] font-bold flex-shrink-0",children:r(e.authorId,e.author).charAt(0)}),(0,n.jsx)("span",{className:"text-xs font-medium",children:r(e.authorId,e.author)}),(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(e.createdAt).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}),i&&(0,n.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:a.A.t("review.closedLabel")})]}),(0,n.jsx)("p",{className:"text-sm text-foreground line-clamp-2 pl-6",children:e.content}),e.replies.length>0&&(0,n.jsxs)("div",{className:"pl-6 mt-1 space-y-0.5",children:[e.replies.slice(0,3).map(e=>(0,n.jsxs)("div",{className:"text-xs text-muted-foreground truncate",children:[(0,n.jsx)("span",{className:"font-medium",children:r(e.authorId,e.author)}),": ",e.content]},e.id)),e.replies.length>3&&(0,n.jsx)("div",{className:"text-[10px] text-muted-foreground/60",children:a.A.t("review.moreReplies",{count:e.replies.length-3})})]})]}),(0,n.jsx)("button",{onClick:t=>{t.stopPropagation(),s(e)},disabled:o===e.id,className:"p-1 rounded opacity-0 group-hover:opacity-100 hover:bg-accent text-muted-foreground transition-opacity disabled:opacity-50 flex-shrink-0 mt-0.5",title:a.A.t("review.copyComment"),children:o===e.id?(0,n.jsx)("span",{className:"inline-block w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})]})]})}},80777:(e,t,r)=>{r.d(t,{m:()=>s});var n=r(95155),o=r(12115);function s({content:e,children:t,className:r}){if(r)return(0,n.jsx)("div",{"data-tooltip":e,className:r,children:t});let l=o.Children.toArray(t);if(1===l.length&&(0,o.isValidElement)(l[0])){let t=l[0];return(0,o.cloneElement)(t,{"data-tooltip":e})}return(0,n.jsx)("div",{"data-tooltip":e,style:{display:"contents"},children:t})}},94002:(e,t,r)=>{r.d(t,{l:()=>a});var n=r(95155),o=r(12115),s=r(79114),l=r(80777);let i=e=>`h1[data-source-start="${e}"], h2[data-source-start="${e}"], h3[data-source-start="${e}"], h4[data-source-start="${e}"], h5[data-source-start="${e}"], h6[data-source-start="${e}"]`;function a({content:e,containerRef:t,width:r="w-80"}){let{t:d}=(0,s.Bd)(),c=(0,o.useMemo)(()=>(function(e){let t=[],r=e.split("\n"),n=!1;for(let e=0;e<r.length;e++){let o=r[e];if(o.trimStart().startsWith("```")){n=!n;continue}if(n)continue;let s=/^(#{1,6})\s+(.+)$/.exec(o);s&&t.push({level:s[1].length,text:s[2].replace(/\s*#+\s*$/,""),sourceLine:e+1})}return t})(e),[e]),[u,h]=(0,o.useState)(!1),[x,p]=(0,o.useState)(null),m=(0,o.useCallback)(e=>{let r=t.current;if(!r)return;let n=r.querySelector(i(e));n&&n.scrollIntoView({behavior:"smooth",block:"start"})},[t]);return((0,o.useEffect)(()=>{let e=t.current;if(!e||0===c.length)return;let r=()=>{let t=[];for(let r of c){let n=e.querySelector(i(r.sourceLine));if(n){let o=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t.push({line:r.sourceLine,top:o})}}let r=null;for(let e of t)e.top<=60&&(r=e.line);null===r&&t.length>0&&(r=t[0].line),p(r)},n=setTimeout(r,150);return e.addEventListener("scroll",r,{passive:!0}),()=>{clearTimeout(n),e.removeEventListener("scroll",r)}},[c,e,t]),0===c.length)?null:(0,n.jsxs)("div",{className:`border-r border-border flex-shrink-0 flex flex-col transition-[width] duration-200 ${u?"w-8":r}`,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b border-border flex-shrink-0",children:[!u&&(0,n.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:d("editor.toc")}),(0,n.jsx)("button",{onClick:()=>h(e=>!e),className:"p-0.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:d(u?"editor.expandToc":"editor.collapseToc"),children:(0,n.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:u?(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}):(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})})]}),!u&&(0,n.jsx)("nav",{className:"flex-1 overflow-y-auto py-1",children:c.map((e,t)=>(0,n.jsx)(l.m,{content:e.text,delay:400,children:(0,n.jsx)("button",{onClick:()=>m(e.sourceLine),className:`block w-full text-left text-sm py-1 px-2 truncate transition-colors hover:bg-accent ${x===e.sourceLine?"text-brand font-medium bg-brand/5":"text-muted-foreground"}`,style:{paddingLeft:`${(e.level-1)*12+8}px`},children:e.text})},t))})]})}},95766:(e,t,r)=>{r.d(t,{W:()=>s});var n=r(48250);let o=new Set(["p","h1","h2","h3","h4","h5","h6","li","blockquote","pre","table","tr","hr","div","ul","ol"]);function s(){return e=>{(0,n.YR)(e,"element",e=>{if(o.has(e.tagName)&&e.position&&(e.properties||(e.properties={}),e.properties["data-source-start"]=e.position.start.line,e.properties["data-source-end"]=e.position.end.line,"pre"===e.tagName)){let t=e.children?.find(e=>"element"===e.type&&"code"===e.tagName);t&&(t.properties||(t.properties={}),t.properties["data-source-start"]=e.position.start.line,t.properties["data-source-end"]=e.position.end.line)}})}}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9114],{5504:e=>{e.exports={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}},8039:(e,t,s)=>{"use strict";e.exports=s(65538)},50931:(e,t,s)=>{"use strict";s.d(t,{Ay:()=>J});var i=s(41463);let r=e=>"string"==typeof e,a=()=>{let e,t,s=new Promise((s,i)=>{e=s,t=i});return s.resolve=e,s.reject=t,s},o=e=>null==e?"":""+e,n=/###/g,l=e=>e&&e.indexOf("###")>-1?e.replace(n,"."):e,u=e=>!e||r(e),p=(e,t,s)=>{let i=r(t)?t.split("."):t,a=0;for(;a<i.length-1;){if(u(e))return{};let t=l(i[a]);!e[t]&&s&&(e[t]=new s),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++a}return u(e)?{}:{obj:e,k:l(i[a])}},h=(e,t,s)=>{let{obj:i,k:r}=p(e,t,Object);if(void 0!==i||1===t.length){i[r]=s;return}let a=t[t.length-1],o=t.slice(0,t.length-1),n=p(e,o,Object);for(;void 0===n.obj&&o.length;)a=`${o[o.length-1]}.${a}`,n=p(e,o=o.slice(0,o.length-1),Object),n?.obj&&void 0!==n.obj[`${n.k}.${a}`]&&(n.obj=void 0);n.obj[`${n.k}.${a}`]=s},g=(e,t)=>{let{obj:s,k:i}=p(e,t);if(s&&Object.prototype.hasOwnProperty.call(s,i))return s[i]},c=(e,t,s)=>{for(let i in t)"__proto__"!==i&&"constructor"!==i&&(i in e?r(e[i])||e[i]instanceof String||r(t[i])||t[i]instanceof String?s&&(e[i]=t[i]):c(e[i],t[i],s):e[i]=t[i]);return e};var d={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};let f=e=>r(e)?e.replace(/[&<>"'\/]/g,e=>d[e]):e;class m{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(void 0!==t)return t;let s=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,s),this.regExpQueue.push(e),s}}let y=[" ",",","?","!",";"],b=new m(20),v=(e,t,s=".")=>{if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}let i=t.split(s),r=e;for(let e=0;e<i.length;){let t;if(!r||"object"!=typeof r)return;let a="";for(let o=e;o<i.length;++o)if(o!==e&&(a+=s),a+=i[o],void 0!==(t=r[a])){if(["string","number","boolean"].indexOf(typeof t)>-1&&o<i.length-1)continue;e+=o-e+1;break}r=t}return r},x=e=>e?.replace(/_/g,"-"),k={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class S{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||"i18next:",this.logger=e||k,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,"log","",!0)}warn(...e){return this.forward(e,"warn","",!0)}error(...e){return this.forward(e,"error","")}deprecate(...e){return this.forward(e,"warn","WARNING DEPRECATED: ",!0)}forward(e,t,s,i){return i&&!this.debug?null:(r(e[0])&&(e[0]=`${s}${this.prefix} ${e[0]}`),this.logger[t](e))}create(e){return new S(this.logger,{...{prefix:`${this.prefix}:${e}:`},...this.options})}clone(e){return(e=e||this.options).prefix=e.prefix||this.prefix,new S(this.logger,e)}}var O=new S;class L{constructor(){this.observers={}}on(e,t){return e.split(" ").forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let s=this.observers[e].get(t)||0;this.observers[e].set(t,s+1)}),this}off(e,t){if(this.observers[e]){if(!t)return void delete this.observers[e];this.observers[e].delete(t)}}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,s])=>{for(let i=0;i<s;i++)e(...t)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(([s,i])=>{for(let r=0;r<i;r++)s.apply(s,[e,...t])})}}class w extends L{constructor(e,t={ns:["translation"],defaultNS:"translation"}){super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,s,i={}){let a,o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,n=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;e.indexOf(".")>-1?a=e.split("."):(a=[e,t],s&&(Array.isArray(s)?a.push(...s):r(s)&&o?a.push(...s.split(o)):a.push(s)));let l=g(this.data,a);return(!l&&!t&&!s&&e.indexOf(".")>-1&&(e=a[0],t=a[1],s=a.slice(2).join(".")),!l&&n&&r(s))?v(this.data?.[e]?.[t],s,o):l}addResource(e,t,s,i,r={silent:!1}){let a=void 0!==r.keySeparator?r.keySeparator:this.options.keySeparator,o=[e,t];s&&(o=o.concat(a?s.split(a):s)),e.indexOf(".")>-1&&(o=e.split("."),i=t,t=o[1]),this.addNamespaces(t),h(this.data,o,i),r.silent||this.emit("added",e,t,s,i)}addResources(e,t,s,i={silent:!1}){for(let i in s)(r(s[i])||Array.isArray(s[i]))&&this.addResource(e,t,i,s[i],{silent:!0});i.silent||this.emit("added",e,t,s)}addResourceBundle(e,t,s,i,r,a={silent:!1,skipCopy:!1}){let o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),i=s,s=t,t=o[1]),this.addNamespaces(t);let n=g(this.data,o)||{};a.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?c(n,s,r):n={...n,...s},h(this.data,o,n),a.silent||this.emit("added",e,t,s)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var $={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,s,i,r){return e.forEach(e=>{t=this.processors[e]?.process(t,s,i,r)??t}),t}};let N=Symbol("i18next/PATH_KEY");function R(e,t){let s,i,r,{[N]:a}=e((i=[],(r=Object.create(null)).get=(e,t)=>(s?.revoke?.(),t===N)?i:(i.push(t),(s=Proxy.revocable(e,r)).proxy),Proxy.revocable(Object.create(null),r).proxy)),o=t?.keySeparator??".",n=t?.nsSeparator??":";if(a.length>1&&n){let e=t?.ns,s=Array.isArray(e)?e:null;if(s&&s.length>1&&s.slice(1).includes(a[0]))return`${a[0]}${n}${a.slice(1).join(o)}`}return a.join(o)}let C={},P=e=>!r(e)&&"boolean"!=typeof e&&"number"!=typeof e;class j extends L{constructor(e,t={}){super(),((e,t,s)=>{e.forEach(e=>{t[e]&&(s[e]=t[e])})})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=O.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let s={...t};if(null==e)return!1;let i=this.resolve(e,s);if(i?.res===void 0)return!1;let r=P(i.res);return!1!==s.returnObjects||!r}extractFromKey(e,t){let s=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===s&&(s=":");let i=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,a=t.ns||this.options.defaultNS||[],o=s&&e.indexOf(s)>-1,n=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,s)=>{t=t||"",s=s||"";let i=y.filter(e=>0>t.indexOf(e)&&0>s.indexOf(e));if(0===i.length)return!0;let r=b.getRegExp(`(${i.map(e=>"?"===e?"\\?":e).join("|")})`),a=!r.test(e);if(!a){let t=e.indexOf(s);t>0&&!r.test(e.substring(0,t))&&(a=!0)}return a})(e,s,i);if(o&&!n){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:r(a)?[a]:a};let o=e.split(s);(s!==i||s===i&&this.options.ns.indexOf(o[0])>-1)&&(a=o.shift()),e=o.join(i)}return{key:e,namespaces:r(a)?[a]:a}}translate(e,t,s){let i="object"==typeof t?{...t}:t;if("object"!=typeof i&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof i&&(i={...i}),i||(i={}),null==e)return"";"function"==typeof e&&(e=R(e,{...this.options,...i})),Array.isArray(e)||(e=[String(e)]),e=e.map(e=>"function"==typeof e?R(e,{...this.options,...i}):String(e));let a=void 0!==i.returnDetails?i.returnDetails:this.options.returnDetails,o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,{key:n,namespaces:l}=this.extractFromKey(e[e.length-1],i),u=l[l.length-1],p=void 0!==i.nsSeparator?i.nsSeparator:this.options.nsSeparator;void 0===p&&(p=":");let h=i.lng||this.language,g=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode")return g?a?{res:`${u}${p}${n}`,usedKey:n,exactUsedKey:n,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:`${u}${p}${n}`:a?{res:n,usedKey:n,exactUsedKey:n,usedLng:h,usedNS:u,usedParams:this.getUsedParamsDetails(i)}:n;let c=this.resolve(e,i),d=c?.res,f=c?.usedKey||n,m=c?.exactUsedKey||n,y=void 0!==i.joinArrays?i.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,v=void 0!==i.count&&!r(i.count),x=j.hasDefaultValue(i),k=v?this.pluralResolver.getSuffix(h,i.count,i):"",S=i.ordinal&&v?this.pluralResolver.getSuffix(h,i.count,{ordinal:!1}):"",O=v&&!i.ordinal&&0===i.count,L=O&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${k}`]||i[`defaultValue${S}`]||i.defaultValue,w=d;b&&!d&&x&&(w=L);let $=P(w),N=Object.prototype.toString.apply(w);if(b&&w&&$&&0>["[object Number]","[object Function]","[object RegExp]"].indexOf(N)&&!(r(y)&&Array.isArray(w))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(f,w,{...i,ns:l}):`key '${n} (${this.language})' returned an object instead of string.`;return a?(c.res=e,c.usedParams=this.getUsedParamsDetails(i),c):e}if(o){let e=Array.isArray(w),t=e?[]:{},s=e?m:f;for(let e in w)if(Object.prototype.hasOwnProperty.call(w,e)){let r=`${s}${o}${e}`;x&&!d?t[e]=this.translate(r,{...i,defaultValue:P(L)?L[e]:void 0,...{joinArrays:!1,ns:l}}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:l}),t[e]===r&&(t[e]=w[e])}d=t}}else if(b&&r(y)&&Array.isArray(d))(d=d.join(y))&&(d=this.extendTranslation(d,e,i,s));else{let t=!1,r=!1;!this.isValidLookup(d)&&x&&(t=!0,d=L),this.isValidLookup(d)||(r=!0,d=n);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&r?void 0:d,l=x&&L!==d&&this.options.updateMissing;if(r||t||l){if(this.logger.log(l?"updateKey":"missingKey",h,u,n,l?L:d),o){let e=this.resolve(n,{...i,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let s=0;s<t.length;s++)e.push(t[s]);else"all"===this.options.saveMissingTo?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let s=(e,t,s)=>{let r=x&&s!==d?s:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,u,t,r,l,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,u,t,r,l,i),this.emit("missingKey",e,u,t,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&v?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);O&&i[`defaultValue${this.options.pluralSeparator}zero`]&&0>t.indexOf(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{s([e],n+t,i[`defaultValue${t}`]||L)})}):s(e,n,L))}d=this.extendTranslation(d,e,i,c,s),r&&d===n&&this.options.appendNamespaceToMissingKey&&(d=`${u}${p}${n}`),(r||t)&&this.options.parseMissingKeyHandler&&(d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${u}${p}${n}`:n,t?d:void 0,i))}return a?(c.res=d,c.usedParams=this.getUsedParamsDetails(i),c):d}extendTranslation(e,t,s,i,a){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){let o;s.interpolation&&this.interpolator.init({...s,...{interpolation:{...this.options.interpolation,...s.interpolation}}});let n=r(e)&&(s?.interpolation?.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);if(n){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let l=s.replace&&!r(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,s.lng||this.language||i.usedLng,s),n){let t=e.match(this.interpolator.nestingRegexp);o<(t&&t.length)&&(s.nest=!1)}!s.lng&&i&&i.res&&(s.lng=this.language||i.usedLng),!1!==s.nest&&(e=this.interpolator.nest(e,(...e)=>a?.[0]!==e[0]||s.context?this.translate(...e,t):(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null),s)),s.interpolation&&this.interpolator.reset()}let o=s.postProcess||this.options.postProcess,n=r(o)?[o]:o;return null!=e&&n?.length&&!1!==s.applyPostProcessor&&(e=$.handle(n,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),e}resolve(e,t={}){let s,i,a,o,n;return r(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>"function"==typeof e?R(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(s))return;let l=this.extractFromKey(e,t),u=l.key;i=u;let p=l.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));let h=void 0!==t.count&&!r(t.count),g=h&&!t.ordinal&&0===t.count,c=void 0!==t.context&&(r(t.context)||"number"==typeof t.context)&&""!==t.context,d=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);p.forEach(e=>{this.isValidLookup(s)||(n=e,!C[`${d[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(n)&&(C[`${d[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${d.join(", ")}" won't get resolved as namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),d.forEach(i=>{let r;if(this.isValidLookup(s))return;o=i;let n=[u];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(n,u,i,e,t);else{let e;h&&(e=this.pluralResolver.getSuffix(i,t.count,t));let s=`${this.options.pluralSeparator}zero`,r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(h&&(t.ordinal&&0===e.indexOf(r)&&n.push(u+e.replace(r,this.options.pluralSeparator)),n.push(u+e),g&&n.push(u+s)),c){let i=`${u}${this.options.contextSeparator||"_"}${t.context}`;n.push(i),h&&(t.ordinal&&0===e.indexOf(r)&&n.push(i+e.replace(r,this.options.pluralSeparator)),n.push(i+e),g&&n.push(i+s))}}for(;r=n.pop();)this.isValidLookup(s)||(a=r,s=this.getResource(i,e,r,t))}))})}),{res:s,usedKey:i,exactUsedKey:a,usedLng:o,usedNS:n}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,s,i={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,s,i):this.resourceStore.getResource(e,t,s,i)}getUsedParamsDetails(e={}){let t=e.replace&&!r(e.replace),s=t?e.replace:e;if(t&&void 0!==e.count&&(s.count=e.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!t)for(let e of(s={...s},["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"]))delete s[e];return s}static hasDefaultValue(e){let t="defaultValue";for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&t===s.substring(0,t.length)&&void 0!==e[s])return!0;return!1}}class E{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=O.create("languageUtils")}getScriptPartFromCode(e){if(!(e=x(e))||0>e.indexOf("-"))return null;let t=e.split("-");return 2===t.length||(t.pop(),"x"===t[t.length-1].toLowerCase())?null:this.formatLanguageCode(t.join("-"))}getLanguagePartFromCode(e){if(!(e=x(e))||0>e.indexOf("-"))return e;let t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(r(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)?t:this.options.lowerCaseLng?e.toLowerCase():e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){let t;return e?(e.forEach(e=>{if(t)return;let s=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(s))&&(t=s)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let s=this.getScriptPartFromCode(e);if(this.isSupportedCode(s))return t=s;let i=this.getLanguagePartFromCode(e);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find(e=>{if(e===i||!(0>e.indexOf("-")&&0>i.indexOf("-"))&&(e.indexOf("-")>0&&0>i.indexOf("-")&&e.substring(0,e.indexOf("-"))===i||0===e.indexOf(i)&&i.length>1))return e})}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t):null}getFallbackCodes(e,t){if(!e)return[];if("function"==typeof e&&(e=e(t)),r(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let s=e[t];return s||(s=e[this.getScriptPartFromCode(t)]),s||(s=e[this.formatLanguageCode(t)]),s||(s=e[this.getLanguagePartFromCode(t)]),s||(s=e.default),s||[]}toResolveHierarchy(e,t){let s=this.getFallbackCodes((!1===t?[]:t)||this.options.fallbackLng||[],e),i=[],a=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return r(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&a(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&a(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&a(this.getLanguagePartFromCode(e))):r(e)&&a(this.formatLanguageCode(e)),s.forEach(e=>{0>i.indexOf(e)&&a(this.formatLanguageCode(e))}),i}}let T={zero:0,one:1,two:2,few:3,many:4,other:5},I={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class F{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=O.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let s,i=x("dev"===e?"en":e),r=t.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:i,type:r});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];try{s=new Intl.PluralRules(i,{type:r})}catch(r){if("u"<typeof Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),I;if(!e.match(/-|_/))return I;let i=this.languageUtils.getLanguagePartFromCode(e);s=this.getRule(i,t)}return this.pluralRulesCache[a]=s,s}needsPlural(e,t={}){let s=this.getRule(e,t);return s||(s=this.getRule("dev",t)),s?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,s={}){return this.getSuffixes(e,s).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let s=this.getRule(e,t);return(s||(s=this.getRule("dev",t)),s)?s.resolvedOptions().pluralCategories.sort((e,t)=>T[e]-T[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t,s={}){let i=this.getRule(e,s);return i?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,s))}}let A=(e,t,s,i=".",a=!0)=>{let o,n=void 0!==(o=g(e,s))?o:g(t,s);return!n&&a&&r(s)&&void 0===(n=v(e,s,i))&&(n=v(t,s,i)),n};class D{constructor(e={}){this.logger=O.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||(e.interpolation={escapeValue:!0});let{escape:t,escapeValue:s,useRawValueToEscape:i,prefix:r,prefixEscaped:a,suffix:o,suffixEscaped:n,formatSeparator:l,unescapeSuffix:u,unescapePrefix:p,nestingPrefix:h,nestingPrefixEscaped:g,nestingSuffix:c,nestingSuffixEscaped:d,nestingOptionsSeparator:m,maxReplaces:y,alwaysFormat:b}=e.interpolation;this.escape=void 0!==t?t:f,this.escapeValue=void 0===s||s,this.useRawValueToEscape=void 0!==i&&i,this.prefix=r?r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):a||"{{",this.suffix=o?o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):n||"}}",this.formatSeparator=l||",",this.unescapePrefix=u?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=h?h.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):g||"$t(".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingSuffix=c?c.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"):d||")".replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),this.nestingOptionsSeparator=m||",",this.maxReplaces=y||1e3,this.alwaysFormat=void 0!==b&&b,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,s,i){let a,n,l,u=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=e=>{if(0>e.indexOf(this.formatSeparator)){let r=A(t,u,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(r,void 0,s,{...i,...t,interpolationkey:e}):r}let r=e.split(this.formatSeparator),a=r.shift().trim(),o=r.join(this.formatSeparator).trim();return this.format(A(t,u,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,s,{...i,...t,interpolationkey:a})};this.resetRegExp();let h=i?.missingInterpolationHandler||this.options.missingInterpolationHandler,g=i?.interpolation?.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e.replace(/\$/g,"$$$$")},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e).replace(/\$/g,"$$$$"):e.replace(/\$/g,"$$$$")}].forEach(t=>{for(l=0;a=t.regex.exec(e);){let s=a[1].trim();if(void 0===(n=p(s)))if("function"==typeof h){let t=h(e,a,i);n=r(t)?t:""}else if(i&&Object.prototype.hasOwnProperty.call(i,s))n="";else if(g){n=a[0];continue}else this.logger.warn(`missed to pass in variable ${s} for interpolating ${e}`),n="";else r(n)||this.useRawValueToEscape||(n=o(n));let u=t.safeValue(n);if(e=e.replace(a[0],u),g?(t.regex.lastIndex+=n.length,t.regex.lastIndex-=a[0].length):t.regex.lastIndex=0,++l>=this.maxReplaces)break}}),e}nest(e,t,s={}){let i,a,n,l=(e,t)=>{let s=this.nestingOptionsSeparator;if(0>e.indexOf(s))return e;let i=e.split(RegExp(`${s.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}[ ]*{`)),r=`{${i[1]}`;e=i[0];let a=(r=this.interpolate(r,n)).match(/'/g),o=r.match(/"/g);((a?.length??0)%2!=0||o)&&(o?.length??0)%2==0||(r=r.replace(/'/g,'"'));try{n=JSON.parse(r),t&&(n={...t,...n})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${s}${r}`}return n.defaultValue&&n.defaultValue.indexOf(this.prefix)>-1&&delete n.defaultValue,e};for(;i=this.nestingRegexp.exec(e);){let u=[];(n=(n={...s}).replace&&!r(n.replace)?n.replace:n).applyPostProcessor=!1,delete n.defaultValue;let p=/{.*}/.test(i[1])?i[1].lastIndexOf("}")+1:i[1].indexOf(this.formatSeparator);if(-1!==p&&(u=i[1].slice(p).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),i[1]=i[1].slice(0,p)),(a=t(l.call(this,i[1].trim(),n),n))&&i[0]===e&&!r(a))return a;r(a)||(a=o(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),a=""),u.length&&(a=u.reduce((e,t)=>this.format(e,t,s.lng,{...s,interpolationkey:i[1].trim()}),a.trim())),e=e.replace(i[0],a),this.regexp.lastIndex=0}return e}}let V=e=>{let t={};return(s,i,r)=>{let a=r;r&&r.interpolationkey&&r.formatParams&&r.formatParams[r.interpolationkey]&&r[r.interpolationkey]&&(a={...a,[r.interpolationkey]:void 0});let o=i+JSON.stringify(a),n=t[o];return n||(n=e(x(i),r),t[o]=n),n(s)}},U=e=>(t,s,i)=>e(x(s),i)(t);class _{constructor(e={}){this.logger=O.create("formatter"),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||",";let s=t.cacheInBuiltFormats?V:U;this.formats={number:s((e,t)=>{let s=new Intl.NumberFormat(e,{...t});return e=>s.format(e)}),currency:s((e,t)=>{let s=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>s.format(e)}),datetime:s((e,t)=>{let s=new Intl.DateTimeFormat(e,{...t});return e=>s.format(e)}),relativetime:s((e,t)=>{let s=new Intl.RelativeTimeFormat(e,{...t});return e=>s.format(e,t.range||"day")}),list:s((e,t)=>{let s=new Intl.ListFormat(e,{...t});return e=>s.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=V(t)}format(e,t,s,i={}){let r=t.split(this.formatSeparator);if(r.length>1&&r[0].indexOf("(")>1&&0>r[0].indexOf(")")&&r.find(e=>e.indexOf(")")>-1)){let e=r.findIndex(e=>e.indexOf(")")>-1);r[0]=[r[0],...r.splice(1,e)].join(this.formatSeparator)}return r.reduce((e,t)=>{let{formatName:r,formatOptions:a}=(e=>{let t=e.toLowerCase().trim(),s={};if(e.indexOf("(")>-1){let i=e.split("(");t=i[0].toLowerCase().trim();let r=i[1].substring(0,i[1].length-1);"currency"===t&&0>r.indexOf(":")?s.currency||(s.currency=r.trim()):"relativetime"===t&&0>r.indexOf(":")?s.range||(s.range=r.trim()):r.split(";").forEach(e=>{if(e){let[t,...i]=e.split(":"),r=i.join(":").trim().replace(/^'+|'+$/g,""),a=t.trim();s[a]||(s[a]=r),"false"===r&&(s[a]=!1),"true"===r&&(s[a]=!0),isNaN(r)||(s[a]=parseInt(r,10))}})}return{formatName:t,formatOptions:s}})(t);if(this.formats[r]){let t=e;try{let o=i?.formatParams?.[i.interpolationkey]||{},n=o.locale||o.lng||i.locale||i.lng||s;t=this.formats[r](e,n,{...a,...i,...o})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${r}`),e},e)}}class z extends L{constructor(e,t,s,i={}){super(),this.backend=e,this.store=t,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=O.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(s,i.backend,i)}queueLoad(e,t,s,i){let r={},a={},o={},n={};return e.forEach(e=>{let i=!0;t.forEach(t=>{let o=`${e}|${t}`;!s.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===a[o]&&(a[o]=!0):(this.state[o]=1,i=!1,void 0===a[o]&&(a[o]=!0),void 0===r[o]&&(r[o]=!0),void 0===n[t]&&(n[t]=!0)))}),i||(o[e]=!0)}),(Object.keys(r).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(r),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(n)}}loaded(e,t,s){let i=e.split("|"),r=i[0],a=i[1];t&&this.emit("failedLoading",r,a,t),!t&&s&&this.store.addResourceBundle(r,a,s,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&s&&(this.state[e]=0);let o={};this.queue.forEach(s=>{((e,t,s,i)=>{let{obj:r,k:a}=p(e,t,Object);r[a]=r[a]||[],r[a].push(s)})(s.loaded,[r],a),void 0!==s.pending[e]&&(delete s.pending[e],s.pendingCount--),t&&s.errors.push(t),0!==s.pendingCount||s.done||(Object.keys(s.loaded).forEach(e=>{o[e]||(o[e]={});let t=s.loaded[e];t.length&&t.forEach(t=>{void 0===o[e][t]&&(o[e][t]=!0)})}),s.done=!0,s.errors.length?s.callback(s.errors):s.callback())}),this.emit("loaded",o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,s,i=0,r=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:s,tried:i,wait:r,callback:a});this.readingCalls++;let o=(o,n)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&n&&i<this.maxRetries?setTimeout(()=>{this.read.call(this,e,t,s,i+1,2*r,a)},r):a(o,n)},n=this.backend[s].bind(this.backend);if(2===n.length){try{let s=n(e,t);s&&"function"==typeof s.then?s.then(e=>o(null,e)).catch(o):o(null,s)}catch(e){o(e)}return}return n(e,t,o)}prepareLoading(e,t,s={},i){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();r(e)&&(e=this.languageUtils.toResolveHierarchy(e)),r(t)&&(t=[t]);let a=this.queueLoad(e,t,s,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,s){this.prepareLoading(e,t,{},s)}reload(e,t,s){this.prepareLoading(e,t,{reload:!0},s)}loadOne(e,t=""){let s=e.split("|"),i=s[0],r=s[1];this.read(i,r,"read",void 0,void 0,(s,a)=>{s&&this.logger.warn(`${t}loading namespace ${r} for language ${i} failed`,s),!s&&a&&this.logger.log(`${t}loaded namespace ${r} for language ${i}`,a),this.loaded(e,s,a)})}saveMissing(e,t,s,i,r,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t))return void this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");if(null!=s&&""!==s){if(this.backend?.create){let n={...a,isUpdate:r},l=this.backend.create.bind(this.backend);if(l.length<6)try{let r;(r=5===l.length?l(e,t,s,i,n):l(e,t,s,i))&&"function"==typeof r.then?r.then(e=>o(null,e)).catch(o):o(null,r)}catch(e){o(e)}else l(e,t,s,i,o,n)}e&&e[0]&&this.store.addResource(e[0],t,s,i)}}}let M=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"==typeof e[1]&&(t=e[1]),r(e[1])&&(t.defaultValue=e[1]),r(e[2])&&(t.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){let s=e[3]||e[2];Object.keys(s).forEach(e=>{t[e]=s[e]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),K=e=>(r(e.ns)&&(e.ns=[e.ns]),r(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),r(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),H=()=>{},B="__i18next_supportNoticeShown";class q extends L{constructor(e={},t){if(super(),this.options=K(e),this.services={},this.logger=O,this.modules={external:[]},(e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{"function"==typeof e[t]&&(e[t]=e[t].bind(e))})})(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,"function"==typeof e&&(t=e,e={}),null==e.defaultNS&&e.ns&&(r(e.ns)?e.defaultNS=e.ns:0>e.ns.indexOf("translation")&&(e.defaultNS=e.ns[0]));let s=M();this.options={...s,...this.options,...K(e)},this.options.interpolation={...s.interpolation,...this.options.interpolation},void 0!==e.keySeparator&&(this.options.userDefinedKeySeparator=e.keySeparator),void 0!==e.nsSeparator&&(this.options.userDefinedNsSeparator=e.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=s.overloadTranslationOptionHandler),!1!==this.options.showSupportNotice&&!(this?.modules?.backend?.name?.indexOf("Locize")>0||this?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||this?.options?.backend?.backends&&this.options.backend.backends.some(e=>e?.name?.indexOf("Locize")>0||e?.constructor?.name?.indexOf("Locize")>0)||this?.options?.backend?.projectId||this?.options?.backend?.backendOptions&&this.options.backend.backendOptions.some(e=>e?.projectId))&&1&&!("u">typeof globalThis&&globalThis[B]||void 0!==i&&i.env&&i.env.I18NEXT_NO_SUPPORT_NOTICE||void 0!==i&&i.env&&1)&&("u">typeof console&&void 0!==console.info&&console.info("\uD83C\uDF10 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \uD83D\uDC99"),"u">typeof globalThis&&(globalThis[B]=!0));let o=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let e;this.modules.logger?O.init(o(this.modules.logger),this.options):O.init(null,this.options),e=this.modules.formatter?this.modules.formatter:_;let t=new E(this.options);this.store=new w(this.options.resources,this.options);let i=this.services;i.logger=O,i.resourceStore=this.store,i.languageUtils=t,i.pluralResolver=new F(t,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==s.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),e&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(i.formatter=o(e),i.formatter.init&&i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new D(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new z(o(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(i.languageDetector=o(this.modules.languageDetector),i.languageDetector.init&&i.languageDetector.init(i,this.options.detection,this.options)),this.modules.i18nFormat&&(i.i18nFormat=o(this.modules.i18nFormat),i.i18nFormat.init&&i.i18nFormat.init(this)),this.translator=new j(this.services,this.options),this.translator.on("*",(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||(t=H),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let n=a(),l=()=>{let e=(e,s)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),n.resolve(s),t(e,s)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?l():setTimeout(l,0),n}loadResources(e,t=H){let s=t,i=r(e)?e:this.language;if("function"==typeof e&&(s=e),!this.options.resources||this.options.partialBundledLanguages){if(i?.toLowerCase()==="cimode"&&(!this.options.preload||0===this.options.preload.length))return s();let e=[],t=t=>{t&&"cimode"!==t&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&0>e.indexOf(t)&&e.push(t)})};i?t(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),s(e)})}else s(null)}reloadResources(e,t,s){let i=a();return"function"==typeof e&&(s=e,e=void 0),"function"==typeof t&&(s=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),s||(s=H),this.services.backendConnector.reload(e,t,e=>{i.resolve(),s(e)}),i}use(e){if(!e)throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&$.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(!(["cimode","dev"].indexOf(t)>-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&0>this.languages.indexOf(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let s=a();this.emit("languageChanging",e);let i=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},o=(r,a)=>{a?this.isLanguageChangingTo===e&&(i(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit("languageChanged",a),this.logger.log("languageChanged",a)):this.isLanguageChangingTo=void 0,s.resolve((...e)=>this.t(...e)),t&&t(r,(...e)=>this.t(...e))},n=t=>{e||t||!this.services.languageDetector||(t=[]);let s=r(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(s)?s:this.services.languageUtils.getBestMatchFromCodes(r(t)?[t]:t);a&&(this.language||i(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{o(e,a)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(n):this.services.languageDetector.detect(n):n(e):n(this.services.languageDetector.detect()),s}getFixedT(e,t,s){let i=(e,t,...r)=>{let a,o;(a="object"!=typeof t?this.options.overloadTranslationOptionHandler([e,t].concat(r)):{...t}).lng=a.lng||i.lng,a.lngs=a.lngs||i.lngs,a.ns=a.ns||i.ns,""!==a.keyPrefix&&(a.keyPrefix=a.keyPrefix||s||i.keyPrefix);let n={...this.options,...a};"function"==typeof a.keyPrefix&&(a.keyPrefix=R(a.keyPrefix,n));let l=this.options.keySeparator||".";return a.keyPrefix&&Array.isArray(e)?o=e.map(e=>("function"==typeof e&&(e=R(e,n)),`${a.keyPrefix}${l}${e}`)):("function"==typeof e&&(e=R(e,n)),o=a.keyPrefix?`${a.keyPrefix}${l}${e}`:e),this.t(o,a)};return r(e)?i.lng=e:i.lngs=e,i.ns=t,i.keyPrefix=s,i}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;let s=t.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,r=this.languages[this.languages.length-1];if("cimode"===s.toLowerCase())return!0;let a=(e,t)=>{let s=this.services.backendConnector.state[`${e}|${t}`];return -1===s||0===s||2===s};if(t.precheck){let e=t.precheck(this,a);if(void 0!==e)return e}return!!(this.hasResourceBundle(s,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(s,e)&&(!i||a(r,e)))}loadNamespaces(e,t){let s=a();return this.options.ns?(r(e)&&(e=[e]),e.forEach(e=>{0>this.options.ns.indexOf(e)&&this.options.ns.push(e)}),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}loadLanguages(e,t){let s=a();r(e)&&(e=[e]);let i=this.options.preload||[],o=e.filter(e=>0>i.indexOf(e)&&this.services.languageUtils.isSupportedCode(e));return o.length?(this.options.preload=i.concat(o),this.loadResources(e=>{s.resolve(),t&&t(e)}),s):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch(e){}let t=this.services?.languageUtils||new E(M());return e.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(e={},t){let s=new q(e,t);return s.createInstance=q.createInstance,s}cloneInstance(e={},t=H){let s=e.forkResourceStore;s&&delete e.forkResourceStore;let i={...this.options,...e,isClone:!0},r=new q(i);if((void 0!==e.debug||void 0!==e.prefix)&&(r.logger=r.logger.clone(e)),["store","services","language"].forEach(e=>{r[e]=this[e]}),r.services={...this.services},r.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},s&&(r.store=new w(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((s,i)=>(s[i]={...e[t][i]},s),e[t]),e),{}),i),r.services.resourceStore=r.store),e.interpolation){let t={...M().interpolation,...this.options.interpolation,...e.interpolation},s={...i,interpolation:t};r.services.interpolator=new D(s)}return r.translator=new j(r.services,i),r.translator.on("*",(e,...t)=>{r.emit(e,...t)}),r.init(i,t),r.translator.options=i,r.translator.backendConnector.services.utils={hasLoadedNamespace:r.hasLoadedNamespace.bind(r)},r}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}let J=q.createInstance();J.createInstance,J.dir,J.init,J.loadResources,J.reloadResources,J.use,J.changeLanguage,J.getFixedT,J.t,J.exists,J.setDefaultNamespace,J.hasLoadedNamespace,J.loadNamespaces,J.loadLanguages},65538:(e,t,s)=>{"use strict";var i=s(12115),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useState,o=i.useEffect,n=i.useLayoutEffect,l=i.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!r(e,s)}catch(e){return!0}}var p="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var s=t(),i=a({inst:{value:s,getSnapshot:t}}),r=i[0].inst,p=i[1];return n(function(){r.value=s,r.getSnapshot=t,u(r)&&p({inst:r})},[e,s,t]),o(function(){return u(r)&&p({inst:r}),e(function(){u(r)&&p({inst:r})})},[e]),l(s),s};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:p},79114:(e,t,s)=>{"use strict";let i;s.d(t,{xC:()=>L,Bd:()=>O});var r=s(12115);s(50931),s(5504),Object.create(null);let a=(e,t,s,i)=>{let r=[s,{code:t,...i||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(r,"warn","react-i18next::",!0);h(r[0])&&(r[0]=`react-i18next:: ${r[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...r):console?.warn&&console.warn(...r)},o={},n=(e,t,s,i)=>{h(s)&&o[s]||(h(s)&&(o[s]=new Date),a(e,t,s,i))},l=(e,t)=>()=>{if(e.isInitialized)t();else{let s=()=>{setTimeout(()=>{e.off("initialized",s)},0),t()};e.on("initialized",s)}},u=(e,t,s)=>{e.loadNamespaces(t,l(e,s))},p=(e,t,s,i)=>{if(h(s)&&(s=[s]),e.options.preload&&e.options.preload.indexOf(t)>-1)return u(e,s,i);s.forEach(t=>{0>e.options.ns.indexOf(t)&&e.options.ns.push(t)}),e.loadLanguages(t,l(e,i))},h=e=>"string"==typeof e,g=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,c={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"\xa9","©":"\xa9","®":"\xae","®":"\xae","…":"…","…":"…","/":"/","/":"/"},d=e=>c[e],f={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(g,d),transDefaultProps:void 0},m=(0,r.createContext)();class y{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}let b={" ":"\xa0","&":"&","<":"<",">":">",""":'"',"'":"'","©":"\xa9","®":"\xae","™":"™","…":"…","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","′":"′","″":"″","‹":"‹","›":"›","§":"\xa7","¶":"\xb6","·":"\xb7"," ":" "," ":" "," ":" ","€":"€","£":"\xa3","¥":"\xa5","¢":"\xa2","¤":"\xa4","×":"\xd7","÷":"\xf7","−":"−","±":"\xb1","≠":"≠","≤":"≤","≥":"≥","≈":"≈","≡":"≡","∞":"∞","∫":"∫","∑":"∑","∏":"∏","√":"√","∂":"∂","‰":"‰","°":"\xb0","µ":"\xb5","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","À":"\xc0","Á":"\xc1","Â":"\xc2","Ã":"\xc3","Ä":"\xc4","Å":"\xc5","Æ":"\xc6","Ç":"\xc7","È":"\xc8","É":"\xc9","Ê":"\xca","Ë":"\xcb","Ì":"\xcc","Í":"\xcd","Î":"\xce","Ï":"\xcf","Ð":"\xd0","Ñ":"\xd1","Ò":"\xd2","Ó":"\xd3","Ô":"\xd4","Õ":"\xd5","Ö":"\xd6","Ø":"\xd8","Ù":"\xd9","Ú":"\xda","Û":"\xdb","Ü":"\xdc","Ý":"\xdd","Þ":"\xde","ß":"\xdf","à":"\xe0","á":"\xe1","â":"\xe2","ã":"\xe3","ä":"\xe4","å":"\xe5","æ":"\xe6","ç":"\xe7","è":"\xe8","é":"\xe9","ê":"\xea","ë":"\xeb","ì":"\xec","í":"\xed","î":"\xee","ï":"\xef","ð":"\xf0","ñ":"\xf1","ò":"\xf2","ó":"\xf3","ô":"\xf4","õ":"\xf5","ö":"\xf6","ø":"\xf8","ù":"\xf9","ú":"\xfa","û":"\xfb","ü":"\xfc","ý":"\xfd","þ":"\xfe","ÿ":"\xff","¡":"\xa1","¿":"\xbf","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ª":"\xaa","º":"\xba","¯":"\xaf","´":"\xb4","¸":"\xb8","¹":"\xb9","²":"\xb2","³":"\xb3","¼":"\xbc","½":"\xbd","¾":"\xbe","♠":"♠","♣":"♣","♥":"♥","♦":"♦","◊":"◊","‾":"‾","⁄":"⁄","℘":"℘","ℑ":"ℑ","ℜ":"ℜ","ℵ":"ℵ"},v=RegExp(Object.keys(b).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),"g");var x=s(8039);let k={t:(e,t)=>{if(h(t))return t;if("object"==typeof t&&null!==t&&h(t.defaultValue))return t.defaultValue;if("function"==typeof e)return"";if(Array.isArray(e)){let t=e[e.length-1];return"function"==typeof t?"":t}return e},ready:!1},S=()=>()=>{},O=(e,t={})=>{let{i18n:s}=t,{i18n:a,defaultNS:o}=(0,r.useContext)(m)||{},l=s||a||i;l&&!l.reportNamespaces&&(l.reportNamespaces=new y),l||n(l,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");let g=(0,r.useMemo)(()=>({...f,...l?.options?.react,...t}),[l,t]),{useSuspense:c,keyPrefix:d}=g,b=e||o||l?.options?.defaultNS,v=h(b)?[b]:b||["translation"],O=(0,r.useMemo)(()=>v,v);l?.reportNamespaces?.addUsedNamespaces?.(O);let L=(0,r.useRef)(0),w=(0,r.useCallback)(e=>{if(!l)return S;let{bindI18n:t,bindI18nStore:s}=g,i=()=>{L.current+=1,e()};return t&&l.on(t,i),s&&l.store.on(s,i),()=>{t&&t.split(" ").forEach(e=>l.off(e,i)),s&&s.split(" ").forEach(e=>l.store.off(e,i))}},[l,g]),$=(0,r.useRef)(),N=(0,r.useCallback)(()=>{if(!l)return k;let e=!!(l.isInitialized||l.initializedStoreOnce)&&O.every(e=>((e,t,s={})=>t.languages&&t.languages.length?t.hasLoadedNamespace(e,{lng:s.lng,precheck:(t,i)=>{if(s.bindI18n&&s.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!i(t.isLanguageChangingTo,e))return!1}}):(n(t,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:t.languages}),!0))(e,l,g)),s=t.lng||l.language,i=L.current,r=$.current;if(r&&r.ready===e&&r.lng===s&&r.keyPrefix===d&&r.revision===i)return r;let a={t:l.getFixedT(s,"fallback"===g.nsMode?O:O[0],d),ready:e,lng:s,keyPrefix:d,revision:i};return $.current=a,a},[l,O,d,g,t.lng]),[R,C]=(0,r.useState)(0),{t:P,ready:j}=(0,x.useSyncExternalStore)(w,N,N);(0,r.useEffect)(()=>{if(l&&!j&&!c){let e=()=>C(e=>e+1);t.lng?p(l,t.lng,O,e):u(l,O,e)}},[l,t.lng,O,j,c,R]);let E=l||{},T=(0,r.useRef)(null),I=(0,r.useRef)(),F=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let s=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(s,"__original"))try{Object.defineProperty(s,"__original",{value:e,writable:!1,enumerable:!1,configurable:!1})}catch(e){}return s},A=(0,r.useMemo)(()=>{let e=E?.language,t=E;E&&(T.current&&T.current.__original===E?I.current!==e?(T.current=t=F(E),I.current=e):t=T.current:(T.current=t=F(E),I.current=e));let s=j||c?P:(...e)=>(n(l,"USE_T_BEFORE_READY","useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."),P(...e)),i=[s,t,j];return i.t=s,i.i18n=t,i.ready=j,i},[P,E,j,E.resolvedLanguage,E.language,E.languages]);if(l&&c&&!j)throw new Promise(e=>{let s=()=>e();t.lng?p(l,t.lng,O,s):u(l,O,s)});return A};function L({i18n:e,defaultNS:t,children:s}){let i=(0,r.useMemo)(()=>({i18n:e,defaultNS:t}),[e,t]);return(0,r.createElement)(m.Provider,{value:i},s)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{7815:e=>{e.exports={style:{fontFamily:"'Lora', 'Lora Fallback'",fontStyle:"normal"},className:"__className_c1a059",variable:"__variable_c1a059"}},14872:(e,t,n)=>{"use strict";n.d(t,{Providers:()=>g});var r=n(95155),a=n(12115),o=n(79114),l=n(87918);function u(e){return"auto"!==e&&e?e:navigator.language.startsWith("zh")?"zh":"en"}function s({children:e}){return(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{let t=u(e.language||"auto");l.A.language!==t&&l.A.changeLanguage(t)}).catch(()=>{let e=u("auto");l.A.language!==e&&l.A.changeLanguage(e)})},[]),(0,a.useEffect)(()=>{let e=e=>(function(e){for(let t of document.querySelectorAll("iframe"))try{t.contentWindow?.postMessage({type:"cockpit:language-change",lang:e},"*")}catch{}})(e);return l.A.on("languageChanged",e),()=>{l.A.off("languageChanged",e)}},[]),(0,a.useEffect)(()=>{if(window===window.parent)return;let e=e=>{e.data?.type==="cockpit:language-change"&&e.data.lang&&l.A.language!==e.data.lang&&l.A.changeLanguage(e.data.lang)};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),(0,r.jsx)(o.xC,{i18n:l.A,children:e})}var i=n(72816),c=n(38093),d=n(47650);function f(e){let t=e;for(;t;){let e=t.dataset?.tooltip;if(e)return e;t=t.parentElement}return null}function m(){let[e,t]=(0,a.useState)(null),n=(0,a.useRef)(null);n.current=e;let o=(0,a.useRef)(null),l=(0,a.useRef)(null),[u,s]=(0,a.useState)({left:0,top:0}),[i,c]=(0,a.useState)(!1);return((0,a.useEffect)(()=>c(!0),[]),(0,a.useEffect)(()=>{let e=()=>{o.current&&(clearTimeout(o.current),o.current=null)},r=r=>{let a=f(r.target);if(!a){e(),n.current&&t(null);return}if(n.current&&n.current.text===a)return void t({text:a,x:r.clientX,y:r.clientY});e();let l=r.clientX,u=r.clientY;o.current=setTimeout(()=>{t({text:a,x:l,y:u}),o.current=null},300)},a=r=>{if(!n.current)return;let a=f(r.target);if(!a){e(),t(null);return}t({text:a,x:r.clientX,y:r.clientY})},l=()=>{e(),n.current&&t(null)};return document.addEventListener("mouseover",r,!0),document.addEventListener("mousemove",a),document.addEventListener("mouseleave",l),document.addEventListener("mousedown",l),()=>{document.removeEventListener("mouseover",r,!0),document.removeEventListener("mousemove",a),document.removeEventListener("mouseleave",l),document.removeEventListener("mousedown",l),e()}},[]),(0,a.useLayoutEffect)(()=>{if(!e||!l.current)return;let t=l.current.getBoundingClientRect(),n=window.innerWidth,r=window.innerHeight,a=e.x+12,o=e.y+16;a+t.width>n-8&&(a=n-t.width-8),a<8&&(a=8),o+t.height>r-8&&(o=e.y-t.height-8),s({left:a,top:o})},[e]),i&&e)?(0,d.createPortal)((0,r.jsx)("div",{ref:l,className:"fixed z-[9999] px-2 py-1 bg-popover text-popover-foreground text-xs font-mono rounded shadow-lg border border-brand whitespace-nowrap pointer-events-none max-w-[80vw] overflow-hidden text-ellipsis",style:{left:u.left,top:u.top},children:e.text}),document.body):null}function g({children:e}){return(0,r.jsx)(s,{children:(0,r.jsx)(i.N,{children:(0,r.jsxs)(c.tE,{children:[e,(0,r.jsx)(m,{})]})})})}},36791:e=>{e.exports={style:{fontFamily:"'Inter', 'Inter Fallback'",fontStyle:"normal"},className:"__className_f367f3",variable:"__variable_f367f3"}},51743:()=>{},66924:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_3c557b",variable:"__variable_3c557b"}},76823:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,36791,23)),Promise.resolve().then(n.t.bind(n,7815,23)),Promise.resolve().then(n.t.bind(n,66924,23)),Promise.resolve().then(n.t.bind(n,51743,23)),Promise.resolve().then(n.bind(n,14872))}},e=>{e.O(0,[8225,3334,9114,3530,8441,3794,7358],()=>e(e.s=76823)),_N_E=e.O()}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{1874:(e,t,s)=>{"use strict";s.d(t,{EmptyState:()=>l});var r=s(95155),n=s(12115),o=s(79114);function l({onSelectSession:e}){let{t}=(0,o.Bd)(),[s,a]=(0,n.useState)([]),[i,c]=(0,n.useState)({}),[d,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),[m,f]=(0,n.useState)(""),p=(0,n.useRef)(null),g=(0,n.useCallback)(async()=>{u(!0),h(null),c({});try{let e=await fetch("/api/sessions/projects");if(!e.ok)throw Error("Failed to load projects");let t=await e.json();a(t)}catch(e){h(e instanceof Error?e.message:"Unknown error")}finally{u(!1)}},[]),v=(0,n.useCallback)(async e=>{c(t=>({...t,[e]:{...t[e],isExpanded:!0,isLoading:!0,sessions:[],error:null}}));try{let t=await fetch(`/api/sessions/projects/${encodeURIComponent(e)}`);if(!t.ok)throw Error("Failed to load sessions");let s=await t.json();c(t=>({...t,[e]:{...t[e],isLoading:!1,sessions:s}}))}catch(t){c(s=>({...s,[e]:{...s[e],isLoading:!1,error:t instanceof Error?t.message:"Unknown error"}}))}},[]),j=(0,n.useCallback)(e=>{let t=i[e];t?.isExpanded?c(t=>({...t,[e]:{...t[e],isExpanded:!1}})):t?.sessions?.length?c(t=>({...t,[e]:{...t[e],isExpanded:!0}})):v(e)},[i,v]);return(0,n.useEffect)(()=>{g(),setTimeout(()=>{p.current?.focus()},100)},[g]),(0,r.jsxs)("div",{className:"flex-1 flex flex-col bg-card",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[(0,r.jsx)("h2",{className:"text-lg font-medium text-foreground",children:t("workspace.selectProject")}),(0,r.jsx)("input",{ref:p,type:"text",placeholder:t("workspace.searchProjectPath"),value:m,onChange:e=>f(e.target.value),className:"px-3 py-1.5 text-sm border border-border rounded-lg bg-card text-foreground placeholder-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-6",children:[d&&(0,r.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:t("workspace.loadingProjects")})]})}),x&&(0,r.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,r.jsx)("div",{className:"text-sm text-red-500",children:x})}),!d&&!x&&0===s.length&&(0,r.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,r.jsx)("div",{className:"text-sm text-muted-foreground",children:t("workspace.projectNotFound")})}),!d&&!x&&(0,r.jsx)("div",{className:"space-y-2",children:s.filter(e=>e.fullPath.toLowerCase().includes(m.toLowerCase())).map(s=>{let n=i[s.encodedPath]||{isExpanded:!1,isLoading:!1,sessions:[],error:null};return(0,r.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>j(s.encodedPath),className:"w-full flex items-center gap-3 p-3 hover:bg-accent transition-colors text-left",children:[(0,r.jsx)("svg",{className:`w-4 h-4 text-muted-foreground transition-transform ${n.isExpanded?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,r.jsx)("svg",{className:"w-5 h-5 text-brand",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-foreground truncate",children:s.name}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:s.fullPath})]}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground bg-secondary px-2 py-0.5 rounded",children:t("workspace.sessions",{count:s.sessionCount})})]}),n.isExpanded&&(0,r.jsxs)("div",{className:"border-t border-border bg-secondary/30",children:[n.isLoading&&(0,r.jsxs)("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:t("workspace.loadingSessions")})]}),n.error&&(0,r.jsx)("div",{className:"p-3 text-xs text-red-500",children:n.error}),!n.isLoading&&!n.error&&0===n.sessions.length&&(0,r.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:t("workspace.noSessions")}),!n.isLoading&&!n.error&&n.sessions.map(t=>(0,r.jsxs)("button",{onClick:()=>{e(s.fullPath,(t.path.split("/").pop()||"").replace(".jsonl",""))},className:"w-full flex items-start gap-3 p-3 hover:bg-accent transition-colors text-left border-t border-border first:border-t-0",children:[(0,r.jsx)("svg",{className:"w-4 h-4 text-muted-foreground mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm text-foreground truncate",children:t.title}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:new Date(t.modifiedAt).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}),t.firstMessages.length>0&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:t.firstMessages[0]})]})]},t.path))]})]},s.encodedPath)})})]})]})}},30231:(e,t,s)=>{Promise.resolve().then(s.bind(s,1874)),Promise.resolve().then(s.bind(s,65438)),Promise.resolve().then(s.bind(s,80475)),Promise.resolve().then(s.bind(s,54962))},54962:(e,t,s)=>{"use strict";s.d(t,{Workspace:()=>Q});var r=s(95155),n=s(12115),o=s(79114),l=s(80475),a=s(1874),i=s(97440),c=s(31914);let d={"claude-opus-4-6":{label:"Opus 4.6",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"},"claude-opus-4-5-20251101":{label:"Opus 4.5",input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#fb923c"},"claude-sonnet-4-6":{label:"Sonnet 4.6",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#3b82f6"},"claude-sonnet-4-5-20250929":{label:"Sonnet 4.5",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#60a5fa"},"claude-haiku-4-5-20251001":{label:"Haiku 4.5",input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}},u={label:"",input:3,output:15,cacheRead:.3,cacheWrite:3.75,color:"#94a3b8"};function x(e){if(d[e])return d[e];let t=e.toLowerCase();return t.includes("opus")?{...u,input:5,output:25,cacheRead:.5,cacheWrite:6.25,color:"#f97316"}:t.includes("haiku")?{...u,input:1,output:5,cacheRead:.1,cacheWrite:1.25,color:"#22c55e"}:u}function h(e){let t=d[e];return t?t.label:e.replace(/^claude-/,"").replace(/-\d{8}$/,"").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function m(e){return(d[e]??x(e)).color}function f(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function p(e){return e>=1e3?`$${e.toFixed(0)}`:e>=100?`$${e.toFixed(1)}`:`$${e.toFixed(2)}`}function g({data:e,height:t=200,formatValue:s=f}){let o=(0,n.useRef)(null),l=(0,n.useRef)(null),[a,i]=(0,n.useState)(null),c=(0,n.useRef)([]),d=(0,n.useCallback)(()=>{let r=o.current,n=l.current;if(!r||!n)return;let a=window.devicePixelRatio||1,i=n.getBoundingClientRect().width;r.width=i*a,r.height=t*a,r.style.width=`${i}px`,r.style.height=`${t}px`;let d=r.getContext("2d");d.scale(a,a),d.clearRect(0,0,i,t);let{labels:u,datasets:x}=e;if(0===u.length)return;let h=i-50-12,m=t-8-28,f=function(e){if(e<=0)return 1;let t=Math.pow(10,Math.floor(Math.log10(e))),s=e/t;return s<=1?t:s<=2?2*t:s<=5?5*t:10*t}(Math.max(1,...u.map((e,t)=>x.reduce((e,s)=>e+s.data[t],0))));d.fillStyle=getComputedStyle(r).getPropertyValue("color")||"#888",d.font="10px ui-monospace, monospace",d.textAlign="right",d.textBaseline="middle";for(let e=0;e<=4;e++){var p;let t=f/4*e,n=8+m-t/f*m;d.fillText(s(t),44,n),d.strokeStyle=(p="--border",getComputedStyle(r).getPropertyValue(p).trim()||"#333"),d.lineWidth=.5,d.beginPath(),d.moveTo(50,n),d.lineTo(50+h,n),d.stroke()}let g=h/u.length,v=Math.max(4,Math.min(.6*g,32)),j=[];u.forEach((e,t)=>{let s=50+t*g+(g-v)/2,n=0;x.forEach(r=>{var o,l,a,i,c,u;let x=r.data[t];if(x<=0)return;let h=x/f*m,p=8+m-n-h;d.fillStyle=r.color,o=d,l=s,a=p,i=v,u=2,(c=h)<1||(u=Math.min(u,c/2,i/2),o.beginPath(),o.moveTo(l+u,a),o.lineTo(l+i-u,a),o.quadraticCurveTo(l+i,a,l+i,a+u),o.lineTo(l+i,a+c-u),o.quadraticCurveTo(l+i,a+c,l+i-u,a+c),o.lineTo(l+u,a+c),o.quadraticCurveTo(l,a+c,l,a+c-u),o.lineTo(l,a+u),o.quadraticCurveTo(l,a,l+u,a),o.fill()),j.push({x:s,y:p,w:v,h:h,label:e,value:x,dataset:r.label,color:r.color}),n+=h}),d.fillStyle=getComputedStyle(r).getPropertyValue("color")||"#888",d.font="9px ui-monospace, monospace",d.textAlign="center",d.textBaseline="top",t%(u.length>20?Math.ceil(u.length/15):1)==0&&d.fillText(e,s+v/2,8+m+6)}),c.current=j},[e,t,s]);(0,n.useEffect)(()=>{d();let e=new ResizeObserver(()=>d());return l.current&&e.observe(l.current),()=>e.disconnect()},[d]);let u=(0,n.useCallback)(e=>{let t=o.current?.getBoundingClientRect();if(!t)return;let r=e.clientX-t.left,n=e.clientY-t.top,l=c.current.find(e=>r>=e.x&&r<=e.x+e.w&&n>=e.y&&n<=e.y+e.h);l?i({x:e.clientX-t.left,y:l.y-4,content:`${l.dataset}: ${s(l.value)}`}):i(null)},[s]);return(0,r.jsxs)("div",{ref:l,className:"relative w-full text-muted-foreground",children:[(0,r.jsx)("canvas",{ref:o,className:"w-full",style:{height:t},onMouseMove:u,onMouseLeave:()=>i(null)}),a&&(0,r.jsx)("div",{className:"absolute pointer-events-none bg-popover text-popover-foreground text-[10px] px-2 py-1 rounded shadow-lg border border-border whitespace-nowrap z-10",style:{left:a.x,top:a.y,transform:"translate(-50%, -100%)"},children:a.content})]})}function v({hourCounts:e}){let{t}=(0,o.Bd)(),s=Math.max(1,...Object.values(e)),n=Array.from({length:24},(e,t)=>t);return(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:t("tokenStats.activeHours")}),(0,r.jsx)("div",{className:"flex gap-[2px] items-end h-16",children:n.map(n=>{let o=e[String(n)]||0,l=o/s;return(0,r.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-0.5",title:t("tokenStats.hourSessions",{h:n,count:o}),children:[(0,r.jsx)("div",{className:"w-full rounded-sm transition-all",style:{height:`${Math.max(2,48*l)}px`,backgroundColor:l>0?`rgba(59, 130, 246, ${.2+.8*l})`:"var(--muted)"}}),n%3==0&&(0,r.jsx)("span",{className:"text-[8px] text-muted-foreground",children:n})]},n)})})]})}function j({isOpen:e,onClose:t}){var s;let l,a,{t:i}=(0,o.Bd)(),[c,d]=(0,n.useState)(null),[u,k]=(0,n.useState)(!0),[w,N]=(0,n.useState)("day"),[y,C]=(0,n.useState)("tokens"),[L,S]=(0,n.useState)("claude");(0,n.useEffect)(()=>{e&&(queueMicrotask(()=>k(!0)),fetch(`/api/claude-stats?engine=${L}`).then(e=>e.json()).then(e=>{e.error||queueMicrotask(()=>d(e))}).catch(()=>{}).finally(()=>queueMicrotask(()=>k(!1))))},[e,L]);let M=(0,n.useMemo)(()=>c?.modelUsage?Object.entries(c.modelUsage).filter(([e])=>!e.startsWith("<")).map(([e,t])=>{let s;return{id:e,label:h(e),color:m(e),usage:t,cost:(s=x(e),t.inputTokens/1e6*s.input+t.outputTokens/1e6*s.output+t.cacheReadInputTokens/1e6*s.cacheRead+t.cacheCreationInputTokens/1e6*s.cacheWrite),totalTokens:t.inputTokens+t.outputTokens+t.cacheReadInputTokens+t.cacheCreationInputTokens}}).sort((e,t)=>t.cost-e.cost):[],[c]),T=(0,n.useMemo)(()=>M.reduce((e,t)=>e+t.cost,0),[M]),E=(0,n.useMemo)(()=>M.map(e=>e.id),[M]),B=(0,n.useMemo)(()=>{let e={};for(let t of M)e[t.id]=t.totalTokens>0?t.cost/t.totalTokens:0;return e},[M]),{activityChart:z,tokenChart:H,costChart:R}=(0,n.useMemo)(()=>{let e=c?.dailyActivity||[],t=c?.dailyModelTokens||[];if("day"===w){let s=e.slice(-60),r=t.slice(-60),n={labels:s.map(e=>e.date.slice(5)),datasets:[{label:i("tokenStats.messages"),data:s.map(e=>e.messageCount),color:"#3b82f6"},{label:i("tokenStats.toolCalls"),data:s.map(e=>e.toolCallCount),color:"#22c55e"}]},o=r.map(e=>e.date.slice(5));return{activityChart:n,tokenChart:{labels:o,datasets:E.map(e=>({label:h(e),data:r.map(t=>t.tokensByModel[e]||0),color:m(e)}))},costChart:{labels:o,datasets:E.map(e=>({label:h(e),data:r.map(t=>(t.tokensByModel[e]||0)*(B[e]||0)),color:m(e)}))}}}if("week"===w){let s=function(e,t){let s=new Map;for(let t of e){let e=new Date(t.date),r=new Date(e);r.setDate(e.getDate()-e.getDay());let n=r.toISOString().slice(0,10),o=n.slice(5);s.has(n)||s.set(n,{label:o,messages:0,sessions:0,tools:0,tokensByModel:{}});let l=s.get(n);l.messages+=t.messageCount,l.sessions+=t.sessionCount,l.tools+=t.toolCallCount}for(let e of t){let t=new Date(e.date),r=new Date(t);r.setDate(t.getDate()-t.getDay());let n=r.toISOString().slice(0,10);s.has(n)||s.set(n,{label:n.slice(5),messages:0,sessions:0,tools:0,tokensByModel:{}});let o=s.get(n);for(let[t,s]of Object.entries(e.tokensByModel))o.tokensByModel[t]=(o.tokensByModel[t]||0)+s}return Array.from(s.values()).sort((e,t)=>e.label.localeCompare(t.label))}(e,t),r=s.map(e=>e.label),n={labels:r,datasets:[{label:i("tokenStats.messages"),data:s.map(e=>e.messages),color:"#3b82f6"},{label:i("tokenStats.toolCalls"),data:s.map(e=>e.tools),color:"#22c55e"}]};return{activityChart:n,tokenChart:{labels:r,datasets:E.map(e=>({label:h(e),data:s.map(t=>t.tokensByModel[e]||0),color:m(e)}))},costChart:{labels:r,datasets:E.map(e=>({label:h(e),data:s.map(t=>(t.tokensByModel[e]||0)*(B[e]||0)),color:m(e)}))}}}let s=function(e,t){let s=new Map;for(let t of e){let e=t.date.slice(0,7);s.has(e)||s.set(e,{label:e,messages:0,sessions:0,tools:0,tokensByModel:{}});let r=s.get(e);r.messages+=t.messageCount,r.sessions+=t.sessionCount,r.tools+=t.toolCallCount}for(let e of t){let t=e.date.slice(0,7);s.has(t)||s.set(t,{label:t,messages:0,sessions:0,tools:0,tokensByModel:{}});let r=s.get(t);for(let[t,s]of Object.entries(e.tokensByModel))r.tokensByModel[t]=(r.tokensByModel[t]||0)+s}return Array.from(s.values()).sort((e,t)=>e.label.localeCompare(t.label))}(e,t),r=s.map(e=>e.label),n={labels:r,datasets:[{label:i("tokenStats.messages"),data:s.map(e=>e.messages),color:"#3b82f6"},{label:i("tokenStats.toolCalls"),data:s.map(e=>e.tools),color:"#22c55e"}]};return{activityChart:n,tokenChart:{labels:r,datasets:E.map(e=>({label:h(e),data:s.map(t=>t.tokensByModel[e]||0),color:m(e)}))},costChart:{labels:r,datasets:E.map(e=>({label:h(e),data:s.map(t=>(t.tokensByModel[e]||0)*(B[e]||0)),color:m(e)}))}}},[c,w,E,B,i]);if((0,n.useEffect)(()=>{if(!e)return;let s=e=>{"Escape"===e.key&&t()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t]),!e)return null;let A=[{key:"day",label:i("tokenStats.day")},{key:"week",label:i("tokenStats.week")},{key:"month",label:i("tokenStats.month")}];return(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:t}),(0,r.jsxs)("div",{className:"relative bg-card rounded-xl shadow-xl w-full max-w-4xl mx-4 max-h-[90vh] flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground",children:i("tokenStats.title")}),(0,r.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:["claude","claude2"].map(e=>(0,r.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${L===e?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{d(null),S(e)},children:"claude"===e?"Claude":"Claude 2"},e))}),(0,r.jsx)("div",{className:"flex bg-muted rounded-md p-0.5",children:A.map(e=>(0,r.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${w===e.key?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>N(e.key),children:e.label},e.key))})]}),(0,r.jsx)("button",{onClick:t,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:u?(0,r.jsx)("div",{className:"text-center text-muted-foreground py-12",children:i("common.loading")}):c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid grid-cols-5 gap-3",children:[(0,r.jsx)(b,{label:i("tokenStats.totalSessions"),value:String(c.totalSessions??0)}),(0,r.jsx)(b,{label:i("tokenStats.totalMessages"),value:f(c.totalMessages??0)}),(0,r.jsx)(b,{label:i("tokenStats.equivalentApiCost"),value:p(T),highlight:!0}),(0,r.jsx)(b,{label:i("tokenStats.longestSession"),value:c.longestSession?(l=Math.floor((s=c.longestSession.duration)/36e5),a=Math.floor(s%36e5/6e4),l>0?`${l}h ${a}m`:`${a}m`):"-"}),(0,r.jsx)(b,{label:i("tokenStats.firstUse"),value:c.firstSessionDate?c.firstSessionDate.slice(0,10):"-"})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:i("tokenStats.activityTrend")}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-[10px]",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#3b82f6"}}),i("tokenStats.messages")]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:"#22c55e"}}),i("tokenStats.toolCalls")]})]})]}),(0,r.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,r.jsx)(g,{data:z,height:180})})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:i("tokenStats.byModel")}),(0,r.jsxs)("div",{className:"flex bg-muted rounded-md p-0.5",children:[(0,r.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"tokens"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>C("tokens"),children:i("tokenStats.tokenUsage")}),(0,r.jsx)("button",{className:`px-2.5 py-0.5 text-[11px] rounded transition-colors ${"cost"===y?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>C("cost"),children:i("tokenStats.equivalentCost")})]})]}),(0,r.jsx)("div",{className:"flex items-center gap-3 text-[10px] flex-wrap",children:M.map(e=>(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("span",{className:"inline-block w-2.5 h-2.5 rounded-sm",style:{backgroundColor:e.color}}),e.label]},e.id))})]}),(0,r.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,r.jsx)(g,{data:"tokens"===y?H:R,height:180,formatValue:"tokens"===y?f:p})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:i("tokenStats.modelCostDetail")}),(0,r.jsx)("div",{className:"border border-border rounded-lg overflow-hidden",children:(0,r.jsxs)("table",{className:"w-full text-xs",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-muted/50 text-muted-foreground",children:[(0,r.jsx)("th",{className:"text-left px-3 py-2 font-medium",children:i("tokenStats.model")}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Input"}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Output"}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Read"}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:"Cache Write"}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:i("tokenStats.share")}),(0,r.jsx)("th",{className:"text-right px-3 py-2 font-medium",children:i("tokenStats.equivalentCost")})]})}),(0,r.jsxs)("tbody",{children:[M.map(e=>(0,r.jsxs)("tr",{className:"border-t border-border",children:[(0,r.jsx)("td",{className:"px-3 py-2 font-mono text-foreground",children:(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,r.jsx)("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),e.label]})}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(e.usage.inputTokens)}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(e.usage.outputTokens)}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(e.usage.cacheReadInputTokens)}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(e.usage.cacheCreationInputTokens)}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:T>0?`${(e.cost/T*100).toFixed(1)}%`:"-"}),(0,r.jsx)("td",{className:"px-3 py-2 text-right font-medium text-foreground",children:p(e.cost)})]},e.id)),(0,r.jsxs)("tr",{className:"border-t-2 border-border bg-muted/30",children:[(0,r.jsx)("td",{className:"px-3 py-2 font-medium text-foreground",children:i("tokenStats.total")}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(M.reduce((e,t)=>e+t.usage.inputTokens,0))}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(M.reduce((e,t)=>e+t.usage.outputTokens,0))}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(M.reduce((e,t)=>e+t.usage.cacheReadInputTokens,0))}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:f(M.reduce((e,t)=>e+t.usage.cacheCreationInputTokens,0))}),(0,r.jsx)("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"100%"}),(0,r.jsx)("td",{className:"px-3 py-2 text-right font-bold text-foreground",children:p(T)})]})]})]})})]}),c.hourCounts&&Object.keys(c.hourCounts).length>0&&(0,r.jsx)("div",{className:"border border-border rounded-lg p-3 bg-muted/20",children:(0,r.jsx)(v,{hourCounts:c.hourCounts})})]}):(0,r.jsx)("div",{className:"text-center text-muted-foreground py-12",children:i("tokenStats.notFound")})})]})]})}function b({label:e,value:t,highlight:s}){return(0,r.jsxs)("div",{className:"bg-muted/30 rounded-lg px-3 py-2.5",children:[(0,r.jsx)("div",{className:"text-[10px] text-muted-foreground",children:e}),(0,r.jsx)("div",{className:`text-sm font-semibold mt-0.5 ${s?"text-brand":"text-foreground"}`,children:t})]})}var k=s(87918),w=s(13439),N=s(37795),y=s(43561),C=s(5989),L=s(76065),S=s(43203),M=s(6268),T=s(48434),E=s(44695),B=s(59265),z=s(26932);function H(e){return e.storage.markdown.getMarkdown()}function R(){return[{label:k.A.t("slashCommands.heading1"),icon:"H1",description:k.A.t("slashCommands.heading1Desc"),action:e=>e.chain().focus().toggleHeading({level:1}).run()},{label:k.A.t("slashCommands.heading2"),icon:"H2",description:k.A.t("slashCommands.heading2Desc"),action:e=>e.chain().focus().toggleHeading({level:2}).run()},{label:k.A.t("slashCommands.heading3"),icon:"H3",description:k.A.t("slashCommands.heading3Desc"),action:e=>e.chain().focus().toggleHeading({level:3}).run()},{label:k.A.t("slashCommands.bulletList"),icon:"•",description:k.A.t("slashCommands.bulletListDesc"),action:e=>e.chain().focus().toggleBulletList().run()},{label:k.A.t("slashCommands.orderedList"),icon:"1.",description:k.A.t("slashCommands.orderedListDesc"),action:e=>e.chain().focus().toggleOrderedList().run()},{label:k.A.t("slashCommands.taskList"),icon:"☑",description:k.A.t("slashCommands.taskListDesc"),action:e=>e.chain().focus().toggleTaskList().run()},{label:k.A.t("slashCommands.blockquote"),icon:"❝",description:k.A.t("slashCommands.blockquoteDesc"),action:e=>e.chain().focus().toggleBlockquote().run()},{label:k.A.t("slashCommands.codeBlock"),icon:"<>",description:k.A.t("slashCommands.codeBlockDesc"),action:e=>e.chain().focus().toggleCodeBlock().run()},{label:k.A.t("slashCommands.table"),icon:"▦",description:k.A.t("slashCommands.tableDesc"),action:e=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{label:k.A.t("slashCommands.horizontalRule"),icon:"──",description:k.A.t("slashCommands.horizontalRuleDesc"),action:e=>e.chain().focus().setHorizontalRule().run()},{label:k.A.t("slashCommands.link"),icon:"\uD83D\uDD17",description:k.A.t("slashCommands.linkDesc"),action:e=>{window.dispatchEvent(new CustomEvent("tiptap-insert-link"))}}]}function A({editor:e,query:t,position:s,onClose:o}){let[l,a]=(0,n.useState)(0),i=(0,n.useRef)(null),c=R().filter(e=>e.label.toLowerCase().includes(t.toLowerCase())||e.description.toLowerCase().includes(t.toLowerCase()));(0,n.useEffect)(()=>{queueMicrotask(()=>a(0))},[t]);let d=s=>{e.chain().focus().deleteRange({from:e.state.selection.from-t.length-1,to:e.state.selection.from}).run(),s.action(e),o()};return((0,n.useEffect)(()=>{let e=e=>{"ArrowDown"===e.key?(e.preventDefault(),a(e=>(e+1)%c.length)):"ArrowUp"===e.key?(e.preventDefault(),a(e=>(e-1+c.length)%c.length)):"Enter"===e.key?(e.preventDefault(),c[l]&&d(c[l])):"Escape"===e.key&&(e.preventDefault(),o())};return document.addEventListener("keydown",e,!0),()=>document.removeEventListener("keydown",e,!0)},[c,l,o]),0===c.length)?null:(0,r.jsx)("div",{ref:i,className:"slash-command-menu fixed z-[60] bg-popover border border-border rounded-lg shadow-lg py-1 w-56 max-h-64 overflow-y-auto",style:{top:s.top,left:s.left},children:c.map((e,t)=>(0,r.jsxs)("button",{className:`w-full flex items-center gap-3 px-3 py-2 text-left text-sm transition-colors ${t===l?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"}`,onClick:()=>d(e),onMouseEnter:()=>a(t),children:[(0,r.jsx)("span",{className:"w-6 text-center text-xs font-mono flex-shrink-0",children:e.icon}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"font-medium",children:e.label}),(0,r.jsx)("div",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.label))})}function P({editor:e,onClose:t,position:s}){let{t:l}=(0,o.Bd)(),[a,i]=(0,n.useState)(()=>e.getAttributes("link").href||""),c=(0,n.useRef)(null);(0,n.useEffect)(()=>{c.current?.focus()},[]);let d=()=>{let s=a.trim();if(s){let t=s.match(/^https?:\/\//)?s:`https://${s}`;e.chain().focus().extendMarkRange("link").setLink({href:t}).run()}else e.chain().focus().extendMarkRange("link").unsetLink().run();t()},u=s?{top:s.top,left:s.left}:{};return(0,r.jsxs)("div",{className:`${s?"fixed":"absolute top-full left-0 mt-1"} z-[60] bg-popover border border-border rounded-lg shadow-lg p-2 flex items-center gap-2`,style:u,children:[(0,r.jsx)("input",{ref:c,type:"text",value:a,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),d()):"Escape"===e.key&&(e.preventDefault(),t())},placeholder:l("editor.linkPlaceholder"),className:"bg-background border border-border rounded px-2 py-1 text-sm w-64 outline-none focus:border-brand"}),(0,r.jsx)("button",{onClick:d,className:"p-1 rounded text-sm font-medium text-brand hover:bg-brand/10 transition-colors",title:l("editor.confirmLink"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})})}),e.isActive("link")&&(0,r.jsx)("button",{onClick:()=>{e.chain().focus().extendMarkRange("link").unsetLink().run(),t()},className:"p-1 rounded text-sm font-medium text-red-500 hover:bg-red-500/10 transition-colors",title:l("editor.removeLink"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})}function $({editor:e}){let{t}=(0,o.Bd)(),[s,l]=(0,n.useState)(!1),a=(0,n.useRef)(null),[,i]=(0,n.useState)(0);if((0,n.useEffect)(()=>{if(!e)return;let t=()=>i(e=>e+1);return e.on("selectionUpdate",t),e.on("transaction",t),()=>{e.off("selectionUpdate",t),e.off("transaction",t)}},[e]),(0,n.useEffect)(()=>{let e=()=>l(!0);return window.addEventListener("tiptap-insert-link",e),()=>window.removeEventListener("tiptap-insert-link",e)},[]),!e)return null;let c=e=>`p-1.5 rounded text-xs font-medium transition-colors ${e?"bg-brand/15 text-brand":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,d="w-px h-5 bg-border mx-0.5",u=e.isActive("table");return(0,r.jsxs)("div",{className:"flex items-center gap-0.5 px-4 py-1.5 border-b border-border flex-shrink-0 flex-wrap",children:[(0,r.jsx)("button",{className:c(e.isActive("heading",{level:1})),onClick:()=>e.chain().focus().toggleHeading({level:1}).run(),title:t("editor.heading1"),children:"H1"}),(0,r.jsx)("button",{className:c(e.isActive("heading",{level:2})),onClick:()=>e.chain().focus().toggleHeading({level:2}).run(),title:t("editor.heading2"),children:"H2"}),(0,r.jsx)("button",{className:c(e.isActive("heading",{level:3})),onClick:()=>e.chain().focus().toggleHeading({level:3}).run(),title:t("editor.heading3"),children:"H3"}),(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:c(e.isActive("bold")),onClick:()=>e.chain().focus().toggleBold().run(),title:t("editor.bold"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"})})}),(0,r.jsx)("button",{className:c(e.isActive("italic")),onClick:()=>e.chain().focus().toggleItalic().run(),title:t("editor.italic"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"})})}),(0,r.jsx)("button",{className:c(e.isActive("strike")),onClick:()=>e.chain().focus().toggleStrike().run(),title:t("editor.strikethrough"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"})})}),(0,r.jsx)("button",{className:c(e.isActive("code")),onClick:()=>e.chain().focus().toggleCode().run(),title:t("editor.inlineCode"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})})}),(0,r.jsx)("div",{className:d}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("button",{ref:a,className:c(e.isActive("link")),onClick:()=>l(!s),title:t("editor.link"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"})})}),s&&(0,r.jsx)(P,{editor:e,onClose:()=>l(!1),position:null})]}),(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:c(e.isActive("bulletList")),onClick:()=>e.chain().focus().toggleBulletList().run(),title:t("editor.bulletList"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"})})}),(0,r.jsx)("button",{className:c(e.isActive("orderedList")),onClick:()=>e.chain().focus().toggleOrderedList().run(),title:t("editor.orderedList"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"})})}),(0,r.jsx)("button",{className:c(e.isActive("taskList")),onClick:()=>e.chain().focus().toggleTaskList().run(),title:t("editor.taskList"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z"})})}),(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:c(e.isActive("blockquote")),onClick:()=>e.chain().focus().toggleBlockquote().run(),title:t("editor.blockquote"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"})})}),(0,r.jsx)("button",{className:c(e.isActive("codeBlock")),onClick:()=>e.chain().focus().toggleCodeBlock().run(),title:t("editor.codeBlock"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14zm-7.5-4.5L15 12l-2.5-2.5L11 11l1.5 1.5L11 14l1.5 1.5zM9.5 14.5L7 12l2.5-2.5L11 11 9.5 12.5 11 14l-1.5.5z"})})}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),title:t("editor.table"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-9 15H4v-4h7v4zm0-6H4V7h7v4zm9 6h-7v-4h7v4zm0-6h-7V7h7v4z"})})}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().setHorizontalRule().run(),title:t("editor.horizontalRule"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M4 11h16v2H4z"})})}),u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().addRowBefore().run(),title:t("editor.insertRowAbove"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zM11 17H4v-2h7v2zm0-4H4v-2h7v2zm9 4h-7v-2h7v2zm0-4h-7v-2h7v2z"}),(0,r.jsx)("path",{d:"M14 1h-4v2H8v2h2v2h4V5h2V3h-2z",opacity:".6"})]})}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().addRowAfter().run(),title:t("editor.insertRowBelow"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v10h20V6c0-1.1-.9-2-2-2zM11 12H4v-2h7v2zm0-4H4V6h7v2zm9 4h-7v-2h7v2zm0-4h-7V6h7v2z"}),(0,r.jsx)("path",{d:"M14 19h-4v2H8v2h2v-2h4v2h2v-2h-2z",opacity:".6"})]})}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().addColumnBefore().run(),title:t("editor.insertColumnLeft"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 11H10v-2h7v2zm0-4H10V9h7v2z"}),(0,r.jsx)("path",{d:"M1 14v-4h2V8h2v2h-2v4h2v2H3v-2z",opacity:".6"})]})}),(0,r.jsx)("button",{className:c(!1),onClick:()=>e.chain().focus().addColumnAfter().run(),title:t("editor.insertColumnRight"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M4 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h10V4H4zm7 11H4v-2h7v2zm0-4H4V9h7v2z"}),(0,r.jsx)("path",{d:"M18 4v20h2c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-2z"}),(0,r.jsx)("path",{d:"M21 14v-4h2V8h2v2h-2v4h2v2h-2v-2z",opacity:".6"})]})}),(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>e.chain().focus().deleteRow().run(),title:t("editor.deleteRow"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M20 4H4c-1.1 0-2 .9-2 2v2h20V6c0-1.1-.9-2-2-2zm0 6H2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10zm-8 8H4v-2h8v2z"}),(0,r.jsx)("path",{d:"M15 13l-1.41 1.41L15.17 16l-1.58 1.59L15 19l1.59-1.59L18.17 19l1.42-1.41L18 16l1.59-1.59L18.17 13 16.59 14.41z",fill:"currentColor"})]})}),(0,r.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-orange-500 hover:bg-orange-500/10",onClick:()=>e.chain().focus().deleteColumn().run(),title:t("editor.deleteColumn"),children:(0,r.jsxs)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,r.jsx)("path",{d:"M6 4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h2V4H6zm4 0v20h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2H10zm7 7H10V9h7v2z"}),(0,r.jsx)("path",{d:"M13 16l-1.41 1.41L13.17 19l-1.58 1.59L13 22l1.59-1.59L16.17 22l1.42-1.41L16 19l1.59-1.59L16.17 16l-1.58 1.41z",fill:"currentColor"})]})}),(0,r.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>e.chain().focus().deleteTable().run(),title:t("editor.deleteTable"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]}),e.isActive("codeBlock")&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:d}),(0,r.jsx)("button",{className:"p-1.5 rounded text-xs font-medium transition-colors text-red-500 hover:bg-red-500/10",onClick:()=>e.chain().focus().toggleCodeBlock().run(),title:t("editor.deleteCodeBlock"),children:(0,r.jsx)("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"})})})]})]})}function I({isOpen:e,onClose:t,projectCwd:s,projectName:l}){let{t:a}=(0,o.Bd)(),[i,c]=(0,n.useState)(!0),[d,u]=(0,n.useState)(!1),x=(0,n.useRef)(null),h=(0,n.useRef)(!1),[m,f]=(0,n.useState)(null),p=(0,n.useRef)(null),g=s?`/api/note?cwd=${encodeURIComponent(s)}`:"/api/note",v=(0,n.useCallback)(async e=>{u(!0);try{await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e})}),h.current=!1}catch(e){console.error("Failed to save note:",e)}finally{u(!1)}},[g]),j=(0,n.useCallback)(e=>{h.current=!0,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{v(e)},5e3)},[v]),b=(0,w.hG)({immediatelyRender:!1,extensions:[N.A.configure({heading:{levels:[1,2,3]}}),y.A.configure({placeholder:()=>k.A.t("editor.placeholder")}),C.XI.configure({resizable:!0}),L.H,S.n,M.A,T._,B.Ay.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1,HTMLAttributes:{class:"tiptap-link",target:"_blank",rel:"noopener noreferrer"}}),E.L.configure({nested:!0}),z.o.configure({html:!0,transformCopiedText:!0,transformPastedText:!0})],editorProps:{attributes:{class:"tiptap-editor focus:outline-none min-h-[60vh] px-6 py-4"},handleClick:(e,t,s)=>{if(s.metaKey||s.ctrlKey){let s=e.state.doc.resolve(t).marks().find(e=>"link"===e.type.name)?.attrs;if(s?.href)return window.open(s.href,"_blank","noopener,noreferrer"),!0}return!1},handleKeyDown:(e,t)=>{if("Backspace"===t.key&&R.current){let e=R.current;if(e.isActive("codeBlock")){let{$from:t}=e.state.selection,s=t.node(t.depth);if("codeBlock"===s.type.name&&""===s.textContent)return e.chain().focus().toggleCodeBlock().run(),!0}}return"/"!==t.key||m||setTimeout(()=>{if(!R.current)return;let{from:e}=R.current.state.selection;if("/"===R.current.state.doc.textBetween(Math.max(0,e-1),e,"\n")){p.current=e;let t=R.current.view.coordsAtPos(e);f({query:"",position:{top:t.bottom+4,left:t.left}})}},0),!1}},onUpdate:({editor:e})=>{if(j(H(e)),null!==p.current){let{from:t}=e.state.selection;if(t<p.current)f(null),p.current=null;else{let s=e.state.doc.textBetween(p.current,t,"\n");s.includes(" ")||s.includes("\n")?(f(null),p.current=null):f(e=>e?{...e,query:s}:null)}}}}),R=(0,n.useRef)(b);(0,n.useEffect)(()=>{R.current=b},[b]),(0,n.useEffect)(()=>{e&&b&&(c(!0),f(null),p.current=null,fetch(g).then(e=>e.json()).then(e=>{b.commands.setContent(e.content||""),h.current=!1}).catch(e=>console.error("Failed to load note:",e)).finally(()=>c(!1)))},[e,b,g]);let P=(0,n.useCallback)(()=>{x.current&&(clearTimeout(x.current),x.current=null),h.current&&b&&v(H(b)),f(null),p.current=null,t()},[b,v,t]);return((0,n.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]),(0,n.useEffect)(()=>{if(!e)return;let t=e=>{"Escape"===e.key&&(m?(f(null),p.current=null):P())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,P,m]),e)?(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:P}),(0,r.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-6xl h-[90vh] mx-4 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground",children:l?a("editor.noteTitle",{name:l}):a("editor.noteUntitled")}),d&&(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:a("editor.saving")})]}),(0,r.jsx)("button",{onClick:P,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)($,{editor:b}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:i?(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:(0,r.jsx)("span",{children:a("common.loading")})}):(0,r.jsx)(w.$Z,{editor:b})})]}),m&&b&&(0,r.jsx)(A,{editor:b,query:m.query,position:m.position,onClose:()=>{f(null),p.current=null}})]}):null}R();var W=s(38093),D=s(14978),V=s(89662);function O({skillId:e,onClose:t}){let[s,o]=(0,n.useState)(null),[l,a]=(0,n.useState)(!0),[i,c]=(0,n.useState)("preview");(0,n.useEffect)(()=>{let t=!1;return a(!0),fetch(`/api/skills/content?id=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>{t||o(e)}).catch(e=>console.error("Failed to load skill content",e)).finally(()=>{t||a(!1)}),()=>{t=!0}},[e]),(0,n.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.stopPropagation(),t())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]);let d=(0,n.useCallback)(async()=>{if(s?.path)try{await navigator.clipboard.writeText(s.path),(0,W.oR)("Path copied","success")}catch{(0,W.oR)("Failed to copy","error")}},[s]);return(0,r.jsxs)("div",{className:"fixed inset-0 z-[70] flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:t}),(0,r.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-4xl h-[85vh] mx-4 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground truncate",children:s?.name?`/${s.name}`:"Skill Preview"}),(0,r.jsx)("button",{onClick:d,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Copy path",children:(0,r.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,r.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",strokeWidth:2}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]})})]}),s?.path&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5",children:s.path})]}),(0,r.jsxs)("div",{className:"flex items-center rounded-md border border-border overflow-hidden text-xs flex-shrink-0",children:[(0,r.jsx)("button",{onClick:()=>c("preview"),className:`px-3 py-1 transition-colors ${"preview"===i?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Preview"}),(0,r.jsx)("button",{onClick:()=>c("source"),className:`px-3 py-1 transition-colors ${"source"===i?"bg-brand text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,children:"Source"})]}),(0,r.jsx)("button",{onClick:t,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors flex-shrink-0",title:"Close",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-auto",children:l?(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"Loading..."}):s&&s.valid?"preview"===i?(0,r.jsx)("div",{className:"px-6 py-4",children:(0,r.jsx)(D.T,{content:s.content})}):(0,r.jsx)(V.XO,{content:s.content,filePath:s.path,className:"min-h-full"}):(0,r.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:"File cannot be read."})})]})]})}var F=s(74446);function U({isOpen:e,onClose:t}){let[s,o]=(0,n.useState)([]),[l,a]=(0,n.useState)(!1),[i,c]=(0,n.useState)(""),[d,u]=(0,n.useState)(!1),[x,h]=(0,n.useState)(""),[m,f]=(0,n.useState)(!1),[p,g]=(0,n.useState)(null),v=(0,n.useCallback)(async()=>{a(!0);try{let e=await fetch("/api/skills");if(e.ok){let t=await e.json();o(t)}}catch(e){console.error("Failed to load skills",e)}finally{a(!1)}},[]);(0,n.useEffect)(()=>{e&&v()},[e,v]),(0,n.useEffect)(()=>{if(!e)return;let s=e=>{if("Escape"===e.key&&!p){if(d){u(!1),h("");return}t()}};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t,d,p]);let j=(0,n.useMemo)(()=>{let e=i.trim().toLowerCase();return e?s.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||t.path.toLowerCase().includes(e)):s},[s,i]),b=(0,n.useCallback)(async()=>{let e=x.trim();if(e){f(!0);try{let t=await fetch("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})});if(!t.ok){let e=await t.json().catch(()=>({}));(0,W.oR)(e.error||"Failed to add skill","error");return}(0,W.oR)("Skill added","success"),h(""),u(!1),await v(),(0,F.k)()}catch(e){console.error(e),(0,W.oR)("Failed to add skill","error")}finally{f(!1)}}},[x,v]),k=(0,n.useCallback)(async e=>{try{if(!(await fetch(`/api/skills/${encodeURIComponent(e)}`,{method:"DELETE"})).ok)return void(0,W.oR)("Failed to delete","error");o(t=>t.filter(t=>t.id!==e)),(0,F.k)()}catch(e){console.error(e),(0,W.oR)("Failed to delete","error")}},[]),w=(0,n.useCallback)(async e=>{try{await navigator.clipboard.writeText(e),(0,W.oR)("Path copied","success")}catch{(0,W.oR)("Failed to copy","error")}},[]);return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:t}),(0,r.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-3xl h-[80vh] mx-4 flex flex-col overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Skills"}),(0,r.jsx)("button",{onClick:t,className:"p-1 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors",title:"Close",children:(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b border-border flex-shrink-0",children:[(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsxs)("svg",{className:"w-4 h-4 absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{cx:"11",cy:"11",r:"7",strokeWidth:2}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-4.35-4.35"})]}),(0,r.jsx)("input",{type:"text",value:i,onChange:e=>c(e.target.value),placeholder:"Search skills...",className:"w-full pl-8 pr-3 py-1.5 text-sm border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"})]}),(0,r.jsx)("button",{onClick:()=>u(!0),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 active:scale-95 transition-all",children:"+ Add Skill"})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:l?(0,r.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:"Loading..."}):0===j.length?(0,r.jsx)("div",{className:"text-center text-muted-foreground py-8 text-sm",children:0===s.length?'No skills yet. Click "Add Skill" to add one.':"No skills match your search."}):j.map(e=>(0,r.jsx)(_,{skill:e,onPreview:()=>g(e.id),onDelete:()=>k(e.id),onCopyPath:()=>w(e.path)},e.id))})]})]}),d&&(0,r.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50",onClick:()=>{m||(u(!1),h(""))}}),(0,r.jsxs)("div",{className:"relative bg-card rounded-lg shadow-xl w-full max-w-lg mx-4 p-5",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-foreground mb-3",children:"Add Skill"}),(0,r.jsx)("label",{className:"block text-xs text-muted-foreground mb-1",children:"Absolute path to SKILL.md"}),(0,r.jsx)("input",{type:"text",value:x,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"!==e.key||m||b()},placeholder:"/Users/you/.../skills/foo/SKILL.md",autoFocus:!0,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-md bg-card text-foreground placeholder-slate-9 focus:outline-none focus:ring-2 focus:ring-ring"}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 mt-4",children:[(0,r.jsx)("button",{onClick:()=>{u(!1),h("")},disabled:m,className:"px-3 py-1.5 text-sm rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50",children:"Cancel"}),(0,r.jsx)("button",{onClick:b,disabled:m||!x.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-brand text-white hover:bg-teal-10 transition-colors disabled:opacity-50",children:m?"Adding...":"Add"})]})]})]}),p&&(0,r.jsx)(O,{skillId:p,onClose:()=>g(null)})]}):null}function _({skill:e,onPreview:t,onDelete:s,onCopyPath:o}){let[l,a]=(0,n.useState)(!1);return(0,r.jsx)("div",{className:`border border-border rounded-lg p-3 bg-card hover:bg-accent/30 transition-colors ${e.valid?"":"opacity-60"}`,children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"w-9 h-9 flex-shrink-0 flex items-center justify-center rounded-md bg-brand/10 text-brand text-lg",children:e.icon?(0,r.jsx)("span",{children:e.icon}):(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsxs)("span",{className:"font-mono text-sm font-medium text-foreground",children:["/",e.name]}),e.description&&(0,r.jsx)("span",{className:"text-sm text-muted-foreground line-clamp-2",children:e.description}),!e.valid&&(0,r.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-red-9/15 text-red-11",children:"Invalid"})]}),e.argumentHint&&(0,r.jsx)("div",{className:"font-mono text-xs text-muted-foreground mt-0.5 truncate",children:e.argumentHint}),(0,r.jsx)("div",{className:"flex items-center gap-1 mt-1",children:(0,r.jsx)("button",{onClick:o,className:"text-xs text-muted-foreground hover:text-foreground font-mono truncate text-left",title:"Copy path",children:e.path})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,r.jsx)("button",{onClick:t,disabled:!e.valid,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-accent rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:"Preview",children:(0,r.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]})}),l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>{a(!1),s()},className:"px-2 py-1 text-xs rounded bg-red-9 text-white hover:bg-red-10",children:"Confirm"}),(0,r.jsx)("button",{onClick:()=>a(!1),className:"px-2 py-1 text-xs rounded border border-border text-muted-foreground hover:text-foreground",children:"Cancel"})]}):(0,r.jsx)("button",{onClick:()=>a(!0),className:"p-1.5 text-muted-foreground hover:text-red-11 hover:bg-red-9/10 rounded transition-colors",title:"Delete",children:(0,r.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M1 7h22M9 7V4a1 1 0 011-1h4a1 1 0 011 1v3"})})})]})]})})}var q=s(47650);let K=[],J=[];function X(){J.forEach(e=>e())}function G(e){K=K.filter(t=>t.id!==e),X()}function Y({onNavigate:e}){let t=function(){let[,e]=(0,n.useState)(0);return(0,n.useEffect)(()=>{let t=()=>e(e=>e+1);return J.push(t),()=>{J=J.filter(e=>e!==t)}},[]),K}();return 0===t.length?null:(0,q.createPortal)((0,r.jsx)("div",{className:"fixed bottom-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none",children:t.map(t=>(0,r.jsx)(Z,{item:t,onNavigate:e,onRemove:G},t.id))}),document.body)}function Z({item:e,onNavigate:t,onRemove:s}){let{t:l}=(0,o.Bd)(),[a,i]=(0,n.useState)(!1),c=(0,n.useRef)(void 0),d=(0,n.useCallback)(()=>{i(!0),setTimeout(()=>s(e.id),300)},[e.id,s]);(0,n.useEffect)(()=>(c.current=setTimeout(d,5e3),()=>clearTimeout(c.current)),[d]);let u=(0,n.useCallback)(()=>{clearTimeout(c.current),t(e.cwd,e.sessionId),s(e.id)},[e,t,s]),x=(0,n.useCallback)(()=>{clearTimeout(c.current)},[]),h=(0,n.useCallback)(()=>{c.current=setTimeout(d,2e3)},[d]);return(0,r.jsxs)("div",{className:`pointer-events-auto bg-card border border-border rounded-lg shadow-lg px-3 py-2.5 min-w-[260px] max-w-[340px] cursor-pointer hover:bg-accent transition-all ${a?"opacity-0 -translate-x-4":"opacity-100 translate-x-0"}`,style:{animation:a?void 0:"slideInLeft 0.3s ease-out"},onClick:u,onMouseEnter:x,onMouseLeave:h,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"w-4 h-4 text-green-9 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),(0,r.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:e.projectName}),(0,r.jsx)("span",{className:"text-xs text-green-11 flex-shrink-0",children:l("common.done")}),(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},className:"ml-auto p-0.5 text-muted-foreground hover:text-foreground rounded transition-colors",children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),e.message&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-1 ml-6",children:e.message})]})}function Q({initialCwd:e,initialSessionId:t}){let{t:s}=(0,o.Bd)(),[d,u]=(0,n.useState)([]),[x,h]=(0,n.useState)(0),[m,f]=(0,n.useState)(!1),[p,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!1),[k,w]=(0,n.useState)(!1),[N,y]=(0,n.useState)(!1),[C,L]=(0,n.useState)(null),[S,M]=(0,n.useState)(!1),[T,E]=(0,n.useState)(!1),[B,z]=(0,n.useState)(new Set),H=(0,n.useRef)(new Map),R=(0,n.useRef)(new Map),A=(0,n.useRef)(new Map),P=(0,n.useRef)(null),$=(0,n.useCallback)(async()=>{try{let e=await fetch("/api/projects");if(e.ok){let t=await e.json();u(t.projects||[]),h(t.activeIndex||0),f(t.collapsed||!1)}}catch(e){console.error("Failed to load projects:",e)}finally{E(!0)}},[]),W=(0,n.useCallback)(async(e,t,s)=>{try{await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projects:e,activeIndex:t,collapsed:s})})}catch(e){console.error("Failed to save projects:",e)}},[]);(0,n.useEffect)(()=>{let e=d[x]?.cwd;e&&z(t=>t.has(e)?t:new Set(t).add(e))},[x,d]),(0,n.useEffect)(()=>{for(let[e,t]of H.current.entries()){let s=d[x]?.cwd===e;t.contentWindow?.postMessage({type:"IFRAME_VISIBILITY",visible:s},"*")}},[x,d]),(0,n.useEffect)(()=>{$()},[$]);let D=(0,n.useCallback)((e,t)=>{let s=new URL(window.location.href);s.searchParams.set("cwd",e),t?s.searchParams.set("sessionId",t):s.searchParams.delete("sessionId"),window.history.replaceState({},"",s.toString());let r=e.split("/").filter(Boolean).pop();document.title=r?`Cockpit - ${r}`:"Cockpit"},[]),V=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(!T||V.current||!e)return;V.current=!0,t&&(R.current.set(e,{sessionId:t}),A.current.set(e,t));let s=d.findIndex(t=>t.cwd===e);if(s>=0)s!==x&&(h(s),W(d,s,m));else{let t=[...d,{cwd:e}],s=t.length-1;u(t),h(s),W(t,s,m)}D(e,t)},[T,e,t,d,x,m,W,D]),(0,n.useEffect)(()=>{let e=e=>{if(e.data?.type==="SESSION_CHANGE"&&e.data?.cwd&&e.data?.sessionId){let{cwd:t,sessionId:s}=e.data;A.current.set(t,s);let r=d[x];r?.cwd===t&&D(t,s)}if(e.data?.type==="SESSION_COMPLETE"&&e.data?.cwd&&e.data?.sessionId){let{cwd:s,sessionId:r,lastUserMessage:n}=e.data,o=d[x];if(o?.cwd!==s){var t;let e;t={projectName:s.split("/").pop()||s,message:n,cwd:s,sessionId:r},e=`session-toast-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,K=[...K,{...t,id:e}],X()}}if(e.data?.type==="OPEN_TOKEN_STATS"&&w(!0),e.data?.type==="OPEN_NOTE"&&e.data?.cwd&&(L(e.data.cwd),y(!0)),e.data?.type==="SCREENSHOT_PREPARE"&&e.data?.cwd){P.current=x;let t=e.data.cwd,s=d.findIndex(e=>e.cwd===t);s>=0&&s!==x&&h(s);return}if(e.data?.type==="SCREENSHOT_DONE"){null!==P.current&&P.current!==x&&h(P.current),P.current=null;return}if(e.data?.type==="OPEN_PROJECT"&&e.data?.cwd){let{cwd:t,sessionId:s}=e.data,r=s||"";A.current.set(t,r);let n=d.findIndex(e=>e.cwd===t);if(n>=0){if(r){let e=H.current.get(t);e?.contentWindow&&e.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:r},"*")}n!==x&&(h(n),W(d,n,m))}else{let e=[...d,{cwd:t}],s=e.length-1;u(e),h(s),W(e,s,m),r&&R.current.set(t,{sessionId:r})}D(t,r)}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[d,x,m,D,W]);let O=(0,n.useCallback)(e=>{h(e),W(d,e,m);let t=d[e];if(t?.cwd){let e=A.current.get(t.cwd);D(t.cwd,e)}},[d,m,W,D]),F=(0,n.useCallback)(e=>{let t=d.filter((t,s)=>s!==e),s=x;e<x?s=x-1:e===x&&s>=t.length&&(s=Math.max(0,t.length-1)),u(t),h(s),W(t,s,m)},[d,x,m,W]),_=(0,n.useCallback)(e=>{let t=d[x],s=e.findIndex(e=>e.cwd===t?.cwd);u(e),h(s>=0?s:0),W(e,s>=0?s:0,m)},[d,x,m,W]),q=(0,n.useCallback)(()=>{let e=!m;f(e),W(d,x,e)},[d,x,m,W]),J=(0,n.useCallback)((e,t)=>{A.current.set(e,t);let s=d.findIndex(t=>t.cwd===e);if(s>=0){let r=H.current.get(e);r?.contentWindow&&r.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:t,switchToAgent:!0},"*"),h(s),W(d,s,m)}else{let s=[...d,{cwd:e}],r=s.length-1;u(s),h(r),W(s,r,m),R.current.set(e,{sessionId:t,switchToAgent:!0})}D(e,t),g(!1)},[d,m,W,D]),G=(0,n.useCallback)((e,t)=>{A.current.set(e,t);let s=d.findIndex(t=>t.cwd===e);if(s>=0){let r=H.current.get(e);r?.contentWindow&&r.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:t,switchToAgent:!0},"*"),s!==x&&(h(s),W(d,s,m))}else{let s=[...d,{cwd:e}],r=s.length-1;u(s),h(r),W(s,r,m),R.current.set(e,{sessionId:t,switchToAgent:!0})}D(e,t)},[d,x,m,W,D]),Z=(0,n.useCallback)(e=>{let t=R.current.get(e);if(t){let s=H.current.get(e);s?.contentWindow&&s.contentWindow.postMessage({type:"SWITCH_SESSION",sessionId:t.sessionId,switchToAgent:t.switchToAgent},"*"),R.current.delete(e)}},[]);return T?(0,r.jsxs)("div",{className:"h-screen flex bg-background overflow-hidden",children:[(0,r.jsx)(l.ProjectSidebar,{projects:d,activeIndex:x,collapsed:m,currentCwd:d[x]?.cwd,onSelectProject:O,onRemoveProject:F,onReorderProjects:_,onToggleCollapse:q,onOpenSessionBrowser:()=>g(!0),onOpenSettings:()=>b(!0),onOpenNote:e=>{L(e??null),y(!0)},onOpenSkills:()=>M(!0),onSwitchProject:G,onAddProject:e=>{let t=d.findIndex(t=>t.cwd===e);if(t>=0)h(t),W(d,t,m);else{let t=[...d,{cwd:e}],s=t.length-1;u(t),h(s),W(t,s,m)}}}),(0,r.jsx)("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:0===d.length?(0,r.jsx)(a.EmptyState,{onSelectSession:J}):(0,r.jsx)("div",{className:"flex-1 relative overflow-hidden",children:d.map((e,t)=>B.has(e.cwd)&&(0,r.jsx)("iframe",{ref:t=>{t?H.current.set(e.cwd,t):H.current.delete(e.cwd)},src:`/project?cwd=${encodeURIComponent(e.cwd)}`,onLoad:()=>Z(e.cwd),className:`absolute inset-0 w-full h-full border-0 ${t===x?"block":"hidden"}`,title:`Project: ${e.cwd}`},e.cwd))})}),(0,r.jsx)(i.r,{isOpen:p,onClose:()=>g(!1),onSelectSession:J,onAddProject:e=>{let t=d.findIndex(t=>t.cwd===e);if(t>=0)h(t),W(d,t,m);else{let t=[...d,{cwd:e}],s=t.length-1;u(t),h(s),W(t,s,m)}g(!1)}}),(0,r.jsx)(c.b,{isOpen:v,onClose:()=>b(!1)}),(0,r.jsx)(j,{isOpen:k,onClose:()=>w(!1)}),(0,r.jsx)(I,{isOpen:N,onClose:()=>{y(!1),L(null)},projectCwd:C,projectName:C?C.split("/").pop():null}),(0,r.jsx)(U,{isOpen:S,onClose:()=>M(!1)}),(0,r.jsx)(Y,{onNavigate:G})]}):(0,r.jsx)("div",{className:"h-screen flex items-center justify-center bg-card",children:(0,r.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),(0,r.jsx)("span",{children:s("workspace.loadingText")})]})})}},65438:(e,t,s)=>{"use strict";s.d(t,{ProjectItem:()=>a});var r=s(95155),n=s(12115),o=s(79114);function l({number:e,isActive:t}){return(0,r.jsxs)("svg",{className:`w-6 h-6 flex-shrink-0 ${t?"text-brand":"text-muted-foreground"}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,r.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),(0,r.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"currentColor",stroke:"none",fontSize:"12",fontWeight:"500",children:e})]})}function a({index:e,name:t,cwd:s,isActive:i,collapsed:c,hasUnread:d,isLoading:u,onClick:x,onRemove:h,onOpenNote:m}){let{t:f}=(0,o.Bd)(),[p,g]=(0,n.useState)(!1);return(0,r.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1 rounded-lg cursor-pointer transition-colors relative ${c?"justify-center":""} ${i?"bg-accent text-foreground":"text-muted-foreground hover:bg-secondary hover:text-foreground"}`,onClick:x,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),title:s,children:[(0,r.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,r.jsx)(l,{number:e+1,isActive:i}),d&&!i&&!u&&(0,r.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-red-500"}),u&&(0,r.jsx)("span",{className:"absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orange-9 animate-pulse"})]}),!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"flex-1 truncate text-sm",children:t}),!u&&i?(0,r.jsx)("span",{className:"w-2 h-2 rounded-full bg-brand flex-shrink-0"}):null]}),p&&!c&&(0,r.jsxs)("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[m&&(0,r.jsx)("button",{className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:e=>{e.stopPropagation(),m()},title:f("workspace.projectNotes"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),(0,r.jsx)("button",{className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-500 transition-colors",onClick:e=>{e.stopPropagation(),h()},title:f("workspace.closeProject"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})}},80475:(e,t,s)=>{"use strict";s.d(t,{ProjectSidebar:()=>p});var r=s(95155),n=s(12115),o=s(79114),l=s(65438);function a({currentCwd:e,onSwitchProject:t,collapsed:s,sessions:l}){let{t:i}=(0,o.Bd)(),[c,d]=(0,n.useState)(!1),[u,x]=(0,n.useState)(0),h=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!c)return;let e=e=>{h.current&&!h.current.contains(e.target)&&d(!1)},t=()=>{d(!1)};return document.addEventListener("mousedown",e),window.addEventListener("blur",t),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("blur",t)}},[c]);let m=(0,n.useCallback)(e=>{t(e.cwd,e.sessionId),d(!1)},[t]),f=l.filter(e=>"loading"===e.status).length,p=l.filter(e=>"unread"===e.status).length,g=(0,n.useCallback)(e=>{let t=Math.floor((u-e)/6e4);if(t<1)return i("common.justNow");if(t<60)return i("common.minutesAgo",{count:t});let s=Math.floor(t/60);return s<24?i("common.hoursAgo",{count:s}):i("common.daysAgo",{count:Math.floor(s/24)})},[i,u]);return(0,r.jsxs)("div",{className:"relative",ref:h,children:[(0,r.jsxs)("button",{onClick:()=>{x(Date.now()),d(!c)},className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${s?"w-full justify-center":"w-full"}`,title:i("sessions.recentSessions"),children:[(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),!s&&(0,r.jsx)("span",{className:"text-sm flex-1 text-left",children:i("sessions.recentSessions")}),f>0&&(0,r.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-orange-9 animate-pulse ${s?"absolute -top-1 -right-1":""}`,children:f}),p>0&&(0,r.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${s&&!f?"absolute -top-1 -right-1":""}`,children:p})]}),c&&(0,r.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,r.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:[(0,r.jsx)("span",{className:"text-sm font-medium",children:i("sessions.recentSessions")}),f>0&&(0,r.jsxs)("span",{className:"ml-2 text-xs text-orange-11",children:["(",i("sessions.runningCount",{count:f}),")"]}),p>0&&(0,r.jsxs)("span",{className:"ml-2 text-xs text-red-500",children:["(",i("sessions.unreadCount",{count:p}),")"]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===l.length?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:i("sessions.noSessions")}):l.map((t,s)=>{let n;return(0,r.jsxs)("button",{onClick:()=>m(t),className:`w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 ${s!==l.length-1?"border-b border-border/50":""} ${e===t.cwd?"bg-accent/50":""}`,children:[(0,r.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${"loading"===t.status?"bg-orange-9 animate-pulse":"unread"===t.status?"bg-red-500":"bg-muted-foreground/30"}`}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",title:t.cwd,children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-medium text-sm truncate",children:(n=t.cwd).split("/").pop()||n}),"loading"===t.status&&(0,r.jsx)("span",{className:"text-xs text-orange-11 flex-shrink-0",children:i("sessions.running")}),"unread"===t.status&&(0,r.jsx)("span",{className:"text-xs text-red-500 flex-shrink-0",children:i("sessions.done")}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:g(t.lastActive)})]}),(t.lastUserMessage||t.title)&&(0,r.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:t.lastUserMessage||t.title})]})]},`${t.cwd}-${t.sessionId}`)})})]})]})}function i({collapsed:e,pinnedSessions:t,onSwitchProject:s,onUnpin:l,onUpdateTitle:a,onReorder:c}){let{t:d}=(0,o.Bd)(),[u,x]=(0,n.useState)(!1),h=(0,n.useRef)(null),[m,f]=(0,n.useState)(null),[p,g]=(0,n.useState)(""),v=(0,n.useRef)(null),[j,b]=(0,n.useState)(null),[k,w]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!u)return;let e=e=>{h.current&&!h.current.contains(e.target)&&(x(!1),f(null))},t=()=>{x(!1),f(null)};return document.addEventListener("mousedown",e),window.addEventListener("blur",t),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("blur",t)}},[u]),(0,n.useEffect)(()=>{m&&(v.current?.focus(),v.current?.select())},[m]);let N=(0,n.useCallback)(e=>{m||(s(e.cwd,e.sessionId),x(!1))},[s,m]),y=(0,n.useCallback)((e,t)=>{t.stopPropagation(),f(e.sessionId),g(e.customTitle||"")},[]),C=(0,n.useCallback)(()=>{m&&p.trim()&&a(m,p.trim()),f(null)},[m,p,a]),L=(0,n.useCallback)(e=>{b(e)},[]),S=(0,n.useCallback)((e,t)=>{e.preventDefault(),w(t)},[]),M=(0,n.useCallback)(e=>{if(null===j||j===e){b(null),w(null);return}let s=[...t],[r]=s.splice(j,1);s.splice(e,0,r),c(s),b(null),w(null)},[j,t,c]),T=(0,n.useCallback)(()=>{b(null),w(null)},[]);return(0,r.jsxs)("div",{className:"relative",ref:h,children:[(0,r.jsxs)("button",{onClick:()=>x(!u),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${e?"w-full justify-center":"w-full"}`,title:d("sessions.pinnedSessions"),children:[(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z"})}),!e&&(0,r.jsx)("span",{className:"text-sm flex-1 text-left",children:d("sessions.pinnedSessions")}),e&&t.length>0&&(0,r.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:t.length})]}),u&&(0,r.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-80 max-h-[450px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg",children:(0,r.jsx)("span",{className:"text-sm font-medium",children:d("sessions.pinnedSessions")})}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===t.length?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:d("sessions.noPinnedSessions")}):t.map((e,s)=>{let n;return(0,r.jsxs)("div",{draggable:!0,onDragStart:()=>L(s),onDragOver:e=>S(e,s),onDrop:()=>M(s),onDragEnd:T,onClick:()=>N(e),className:`group w-full px-3 py-2 text-left hover:bg-accent transition-colors flex items-start gap-2 cursor-pointer ${s!==t.length-1?"border-b border-border/50":""} ${j===s?"opacity-50":""} ${k===s?"border-t-2 border-brand":""}`,children:[(0,r.jsx)("span",{className:"mt-1.5 text-muted-foreground/30 flex-shrink-0 cursor-grab",children:(0,r.jsxs)("svg",{className:"w-3 h-3",viewBox:"0 0 10 16",fill:"currentColor",children:[(0,r.jsx)("circle",{cx:"3",cy:"2",r:"1.5"}),(0,r.jsx)("circle",{cx:"7",cy:"2",r:"1.5"}),(0,r.jsx)("circle",{cx:"3",cy:"8",r:"1.5"}),(0,r.jsx)("circle",{cx:"7",cy:"8",r:"1.5"}),(0,r.jsx)("circle",{cx:"3",cy:"14",r:"1.5"}),(0,r.jsx)("circle",{cx:"7",cy:"14",r:"1.5"})]})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",title:e.cwd,children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)("span",{className:"font-medium text-sm truncate",children:(n=e.cwd).split("/").pop()||n})}),m===e.sessionId?(0,r.jsx)("input",{ref:v,type:"text",value:p,onChange:e=>g(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||("Enter"===e.key&&C(),"Escape"===e.key&&f(null))},onBlur:C,onClick:e=>e.stopPropagation(),className:"w-full text-xs px-1 py-0.5 border border-border rounded bg-card text-foreground focus:outline-none focus:ring-1 focus:ring-ring mt-0.5"}):(0,r.jsx)("div",{className:"text-xs text-foreground/80 truncate",children:e.customTitle||e.sessionId.slice(0,8)})]}),m!==e.sessionId&&(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity mt-0.5",children:[(0,r.jsx)("button",{onClick:t=>y(e,t),className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:d("sessions.editTitle"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})}),(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),l(e.sessionId)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:d("sessions.remove"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},e.sessionId)})})]})]})}var c=s(28147);function d(e,t){if("once"===e.type)return t("scheduledTasks.onceType",{minutes:e.delayMinutes});if("interval"===e.type){let s=t("scheduledTasks.everyNMinutes",{minutes:e.intervalMinutes});return e.activeFrom&&e.activeTo?`${s} (${e.activeFrom}-${e.activeTo})`:s}return"cron"===e.type?e.cron||"cron":e.type}function u(e){return e.unread?"bg-red-500":e.completed?"bg-muted-foreground":e.paused?"bg-yellow-500":"error"===e.lastResult?"bg-red-500":"bg-green-500"}function x({collapsed:e,tasks:t,unreadCount:s,onSwitchProject:l,onPause:a,onResume:i,onTrigger:h,onDelete:m,onMarkRead:f,onUpdateTask:p,onReorder:g}){let{t:v}=(0,o.Bd)(),[j,b]=(0,n.useState)(!1),[k,w]=(0,n.useState)(null),N=(0,n.useRef)(null),y=t.filter(e=>!e.completed),C=y.filter(e=>!e.paused).length,L=t.filter(e=>e.completed),[S,M]=(0,n.useState)(null),[T,E]=(0,n.useState)(null),B=(0,n.useCallback)(e=>{M(e)},[]),z=(0,n.useCallback)((e,t)=>{e.preventDefault(),E(t)},[]),H=(0,n.useCallback)(e=>{if(null===S||S===e){M(null),E(null);return}let t=[...y],[s]=t.splice(S,1);t.splice(e,0,s),g([...t,...L].map(e=>e.id)),M(null),E(null)},[S,y,L,g]),R=(0,n.useCallback)(()=>{M(null),E(null)},[]),[,A]=(0,n.useState)(0);return(0,n.useEffect)(()=>{if(!j)return;let e=setInterval(()=>A(e=>e+1),1e4);return()=>clearInterval(e)},[j]),(0,n.useEffect)(()=>{if(!j)return;let e=e=>{N.current&&!N.current.contains(e.target)&&b(!1)},t=()=>b(!1);return document.addEventListener("mousedown",e),window.addEventListener("blur",t),()=>{document.removeEventListener("mousedown",e),window.removeEventListener("blur",t)}},[j]),(0,r.jsxs)("div",{className:"relative",ref:N,children:[(0,r.jsxs)("button",{onClick:()=>b(!j),className:`relative flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${e?"w-full justify-center":"w-full"}`,title:v("scheduledTasks.title"),children:[(0,r.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeWidth:2}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 6v6l4 2"})]}),!e&&(0,r.jsx)("span",{className:"text-sm flex-1 text-left",children:v("scheduledTasks.title")}),s>0?(0,r.jsx)("span",{className:`min-w-[18px] h-[18px] px-1 text-white text-xs font-medium rounded-full flex items-center justify-center bg-red-500 ${e?"absolute -top-1 -right-1":""}`,children:s}):e&&t.length>0?(0,r.jsx)("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 text-muted-foreground text-xs font-medium rounded-full flex items-center justify-center bg-accent",children:t.length}):null]}),j&&(0,r.jsxs)("div",{className:"absolute left-full bottom-0 ml-2 w-96 max-h-[500px] bg-popover border border-border rounded-lg shadow-lg z-50 flex flex-col",children:[(0,r.jsxs)("div",{className:"px-3 py-2 border-b border-border bg-muted/50 flex-shrink-0 rounded-t-lg flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-medium",children:v("scheduledTasks.title")}),y.length>0&&(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[v("scheduledTasks.activeCount",{running:C}),y.length-C>0?` \xb7 ${v("scheduledTasks.pausedCount",{paused:y.length-C})}`:""]})]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:0===t.length?(0,r.jsx)("div",{className:"px-3 py-4 text-sm text-muted-foreground text-center",children:v("scheduledTasks.noScheduledTasks")}):(0,r.jsxs)(r.Fragment,{children:[y.map((e,t)=>{var s;return(0,r.jsx)("div",{draggable:!0,onDragStart:()=>B(t),onDragOver:e=>z(e,t),onDrop:()=>H(t),onDragEnd:R,className:`group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 cursor-pointer ${e.unread?"bg-brand/5":""} ${S===t?"opacity-50":""} ${T===t?"border-t-2 border-brand":""}`,onClick:()=>{l(e.cwd,e.sessionId),e.unread&&f(e.id),b(!1)},children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${u(e)}`}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground font-mono",children:(s=e.cwd).split("/").pop()||s}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"\xb7"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:e.completed?v("scheduledTasks.completed"):e.paused?v("scheduledTasks.paused"):v("common.running")})]}),(0,r.jsx)("div",{className:"text-sm text-foreground truncate mt-0.5",title:e.message,children:e.message}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[(0,r.jsx)("span",{children:d(e,v)}),(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsx)("span",{children:e.paused?v("scheduledTasks.paused"):function(e,t){if(!e)return"-";let s=e-Date.now();if(s<=0)return t("scheduledTasks.aboutToTrigger");if(s<6e4)return t("scheduledTasks.secondsLater",{count:Math.ceil(s/1e3)});if(s<36e5)return t("scheduledTasks.minutesLater",{count:Math.ceil(s/6e4)});if(s<864e5){let e=Math.floor(s/36e5),r=Math.ceil(s%36e5/6e4);return r>0?t("scheduledTasks.hoursMinutesLater",{h:e,m:r}):t("scheduledTasks.hoursLater",{h:e})}return new Date(e).toLocaleDateString("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(e.nextFireTime,v)}),e.lastFiredAt&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("span",{children:[v("scheduledTasks.lastResult"),": ","success"===e.lastResult?"✓":"✗"]})]})]})]}),(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),h(e.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-brand",title:v("scheduledTasks.runNow"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M8 5v14l11-7z"})})}),(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),w(e)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",title:v("common.edit"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),e.paused?(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),i(e.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-green-500",title:v("scheduledTasks.resume"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"})})}):(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),a(e.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-yellow-500",title:v("scheduledTasks.pause"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 9v6m4-6v6"})})}),(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),m(e.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:v("common.delete"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]})},e.id)}),L.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-3 py-1.5 text-xs text-muted-foreground bg-muted/30 border-b border-border/50",children:v("scheduledTasks.completedCount",{count:L.length})}),L.map(e=>(0,r.jsx)("div",{className:"group px-3 py-2 hover:bg-accent transition-colors border-b border-border/50 opacity-60 cursor-pointer",onClick:()=>{l(e.cwd,e.sessionId),b(!1)},children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[(0,r.jsx)("span",{className:`mt-1.5 w-2 h-2 rounded-full flex-shrink-0 ${u(e)}`}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm text-foreground truncate",children:e.message}),(0,r.jsxs)("div",{className:"text-xs text-muted-foreground mt-0.5",children:[d(e,v)," \xb7 ","success"===e.lastResult?v("scheduledTasks.success"):v("scheduledTasks.failure")]})]}),(0,r.jsx)("div",{className:"flex-shrink-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,r.jsx)("button",{onClick:t=>{t.stopPropagation(),m(e.id)},className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-destructive",title:v("common.delete"),children:(0,r.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})})]})},e.id))]})]})})]}),k&&(0,r.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/30",onClick:()=>w(null)}),(0,r.jsx)("div",{className:"relative",children:(0,r.jsx)(c.E,{onClose:()=>w(null),onCreate:()=>{},editTask:{id:k.id,message:k.message,type:k.type,delayMinutes:k.delayMinutes,intervalMinutes:k.intervalMinutes,activeFrom:k.activeFrom,activeTo:k.activeTo,cron:k.cron},onUpdate:(e,t)=>{p(e,t),w(null)}})})]})]})}var h=s(36998),m=s(18658),f=s(22552);function p({projects:e,activeIndex:t,collapsed:s,currentCwd:c,onSelectProject:d,onRemoveProject:u,onReorderProjects:g,onToggleCollapse:v,onOpenSessionBrowser:j,onOpenSettings:b,onOpenNote:k,onOpenSkills:w,onSwitchProject:N,onAddProject:y}){let{t:C}=(0,o.Bd)(),{pinnedSessions:L,unpinSession:S,updateTitle:M,reorder:T}=(0,h.P)(),{tasks:E,unreadCount:B,reload:z,pauseTask:H,resumeTask:R,triggerTask:A,deleteTask:P,updateTask:$,markRead:I,reorderTasks:W}=(0,m.n)(),[D,V]=(0,n.useState)(!1),[O,F]=(0,n.useState)(null),[U,_]=(0,n.useState)(null),[q,K]=(0,n.useState)([]),J=(0,n.useRef)(q);(0,n.useEffect)(()=>{J.current=q});let X=(0,n.useRef)(z);(0,n.useEffect)(()=>{X.current=z});let G=(0,n.useCallback)(e=>{try{if("task-fired"===e.type)return void X.current();let{data:t}=e;if(!t)return;K(t.sessions||[])}catch{}},[]);(0,f.h)({url:"/ws/global-state",onMessage:G});let Y=new Set(q.filter(e=>"loading"===e.status).map(e=>e.cwd)),Z=new Set(q.filter(e=>"unread"===e.status).map(e=>e.cwd)),Q=(0,n.useCallback)(e=>{F(e)},[]),ee=(0,n.useCallback)((e,t)=>{e.preventDefault(),null!==O&&O!==t&&_(t)},[O]),et=(0,n.useCallback)(t=>{if(null!==O&&O!==t){let s=[...e],[r]=s.splice(O,1);s.splice(t,0,r),g(s)}F(null),_(null)},[O,e,g]),es=(0,n.useCallback)(()=>{F(null),_(null)},[]);return(0,r.jsxs)("div",{className:`h-full bg-card border-r border-border flex flex-col transition-all duration-200 ${s?"w-12":"w-56"}`,children:[(0,r.jsxs)("div",{className:"p-2 border-b border-border relative",onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),children:[(0,r.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${s?"justify-center":""}`,onClick:j,title:C("workspace.openProject"),children:[(0,r.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),!s&&(0,r.jsx)("span",{className:"text-sm",children:C("workspace.openProject")})]}),D&&(s?(0,r.jsx)("button",{className:"absolute inset-0 m-2 flex items-center justify-center px-2 py-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:v,title:C("workspace.expandSidebar"),children:(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0 rotate-180",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}):(0,r.jsx)("button",{className:"absolute top-1/2 -translate-y-1/2 right-2 p-2 rounded-lg bg-accent text-foreground transition-colors z-10",onClick:v,title:C("workspace.collapseSidebar"),children:(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}))]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:e.map((e,n)=>{var o;let a;return(0,r.jsx)("div",{draggable:!0,onDragStart:()=>Q(n),onDragOver:e=>ee(e,n),onDrop:()=>et(n),onDragEnd:es,className:`${U===n?"border-t-2 border-brand":""} ${O===n?"opacity-50":""}`,children:(0,r.jsx)(l.ProjectItem,{index:n,name:(a=(o=e.cwd).split("/").filter(Boolean))[a.length-1]||o,cwd:e.cwd,isActive:n===t,collapsed:s,hasUnread:Z.has(e.cwd),isLoading:Y.has(e.cwd),onClick:()=>d(n),onRemove:()=>u(n),onOpenNote:()=>k(e.cwd)})},e.cwd)})}),(0,r.jsxs)("div",{className:"p-2 border-t border-border space-y-1",children:[(0,r.jsx)(a,{currentCwd:c,onSwitchProject:N,collapsed:s,sessions:q}),(0,r.jsx)(i,{collapsed:s,pinnedSessions:L,onSwitchProject:N,onUnpin:S,onUpdateTitle:M,onReorder:T}),(0,r.jsx)(x,{collapsed:s,tasks:E,unreadCount:B,onSwitchProject:N,onPause:H,onResume:R,onTrigger:A,onDelete:P,onMarkRead:I,onUpdateTask:$,onReorder:W}),(0,r.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${s?"justify-center":""}`,onClick:()=>k(),title:C("workspace.notes"),children:[(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),!s&&(0,r.jsx)("span",{className:"text-sm",children:C("workspace.notes")})]}),(0,r.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${s?"justify-center":""}`,onClick:w,title:C("workspace.skills"),children:[(0,r.jsx)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3l1.9 4.8L19 9l-4.1 3.1L16 18l-4-2.8L8 18l1.1-5.9L5 9l5.1-1.2L12 3z"})}),!s&&(0,r.jsx)("span",{className:"text-sm",children:C("workspace.skills")})]}),(0,r.jsxs)("button",{className:`w-full flex items-center gap-2 px-2 py-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent transition-colors ${s?"justify-center":""}`,onClick:b,title:C("workspace.settings"),children:[(0,r.jsxs)("svg",{className:"w-5 h-5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),!s&&(0,r.jsx)("span",{className:"text-sm",children:C("workspace.settings")})]})]})]})}}},e=>{e.O(0,[8653,7330,5004,277,9114,3643,3743,4186,3530,3579,8441,3794,7358],()=>e(e.s=30231)),_N_E=e.O()}]);
|