@geminilight/mindos 0.6.58 → 0.6.60
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/_standalone/.mindos-build-version +1 -1
- package/_standalone/.next/BUILD_ID +1 -1
- package/_standalone/.next/app-path-routes-manifest.json +23 -22
- package/_standalone/.next/build-manifest.json +3 -3
- package/_standalone/.next/cache/.previewinfo +1 -1
- package/_standalone/.next/cache/.rscinfo +1 -1
- package/_standalone/.next/cache/config.json +3 -3
- package/_standalone/.next/prerender-manifest.json +3 -3
- package/_standalone/.next/react-loadable-manifest.json +1 -1
- package/_standalone/.next/routes-manifest.json +6 -0
- package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/_global-error.html +2 -2
- package/_standalone/.next/server/app/_global-error.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/_standalone/.next/server/app/_not-found/page.js +1 -1
- package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/agents/page.js +2 -2
- package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/copy-skill/route.js +1 -0
- package/_standalone/.next/server/app/api/agents/copy-skill/route.js.nft.json +1 -0
- package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -0
- package/_standalone/.next/server/app/api/agents/custom/detect/route.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route.js +1 -1
- package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask/route.js +18 -7
- package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/extract-pdf/route.js +2 -2
- package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route.js +1 -1
- package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/changes/page.js +2 -2
- package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page.js +3 -3
- package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/echo/page.js +1 -1
- package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/explore/page.js +2 -2
- package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/help/page.js +2 -2
- package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js +1 -1
- package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/login/page.js +2 -2
- package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/page.js +2 -8
- package/_standalone/.next/server/app/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/setup/page.js +2 -2
- package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/trash/page.js +3 -3
- package/_standalone/.next/server/app/trash/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/view/[...path]/page.js +3 -3
- package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app/wiki/page.js +2 -2
- package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -1
- package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -1
- package/_standalone/.next/server/app-paths-manifest.json +23 -22
- package/_standalone/.next/server/chunks/1550.js +1 -1
- package/_standalone/.next/server/chunks/3484.js +1 -1
- package/_standalone/.next/server/chunks/530.js +70 -71
- package/_standalone/.next/server/chunks/{6793.js → 9753.js} +2 -2
- package/_standalone/.next/server/chunks/9787.js +2 -0
- package/_standalone/.next/server/middleware-build-manifest.js +1 -1
- package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/_standalone/.next/server/pages/500.html +2 -2
- package/_standalone/.next/server/server-reference-manifest.js +1 -1
- package/_standalone/.next/server/server-reference-manifest.json +1 -1
- package/_standalone/.next/static/K3wZNf5bj_AFYwtqcRXIf/_buildManifest.js +1 -0
- package/_standalone/.next/static/chunks/1369-7d0ac5d1564eed1e.js +1 -0
- package/_standalone/.next/static/chunks/{1814.a7c127b2c73d1f70.js → 1814.a79b84d37df75c43.js} +1 -1
- package/_standalone/.next/static/chunks/3427-2e61a5df1f5e55fb.js +1 -0
- package/_standalone/.next/static/chunks/{1053-fe009233cff06e72.js → 5581-974dfb26d1d1b38f.js} +3 -3
- package/_standalone/.next/static/chunks/6297-085daa21037d5f81.js +1 -0
- package/_standalone/.next/static/chunks/7249-b0a9c77b9a84b11c.js +11 -0
- package/_standalone/.next/static/chunks/7637-904b0a381dc3ec02.js +1 -0
- package/_standalone/.next/static/chunks/8520-76d1b05072178b43.js +22 -0
- package/_standalone/.next/static/chunks/9186-ead47513192f658b.js +1 -0
- package/_standalone/.next/static/chunks/9905-a19d379cb225246e.js +1 -0
- package/_standalone/.next/static/chunks/app/.well-known/agent-card.json/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/_global-error/{page-2f4705aa66819b86.js → page-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-0ea3571c8fbae823.js +1 -0
- package/_standalone/.next/static/chunks/app/agents/page-66858acbcd1d4bf8.js +1 -0
- package/_standalone/.next/static/chunks/app/api/a2a/agents/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/delegations/{route-2f4705aa66819b86.js → route-2ceea6eabf25b1f2.js} +1 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/a2a/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/config/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/install/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/acp/session/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/copy-skill/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/auth/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/backlinks/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/changes/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/export/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/import/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/raw/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/file/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/files/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/git/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/graph/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/health/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/inbox/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/init/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/monitoring/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/recent-files/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/restart/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/search/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/setup/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/skills/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/sync/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/tree-version/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/uninstall/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-check/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/update-status/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/api/workflows/route-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/changes/page-dd0b00a7b81f74e2.js +1 -0
- package/_standalone/.next/static/chunks/app/echo/[segment]/page-bf5c290fa3ccff09.js +11 -0
- package/_standalone/.next/static/chunks/app/echo/page-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/explore/{page-d3d99308146c2240.js → page-d9f58000bc445360.js} +2 -2
- package/_standalone/.next/static/chunks/app/help/{page-222df603080b5fab.js → page-f8cb806371b3175f.js} +1 -1
- package/_standalone/.next/static/chunks/app/inbox/history/{page-07819cf95cb0805f.js → page-3279585360df132c.js} +1 -1
- package/_standalone/.next/static/chunks/app/layout-6a0169582db11a08.js +164 -0
- package/_standalone/.next/static/chunks/app/loading-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/login/{page-0eeef685052869a6.js → page-18fb00d568cd1f0e.js} +1 -1
- package/_standalone/.next/static/chunks/app/page-6a1f8d21c12b829e.js +1 -0
- package/_standalone/.next/static/chunks/app/setup/{page-99fcfc460fa29733.js → page-821714e7477be46c.js} +1 -1
- package/_standalone/.next/static/chunks/app/trash/page-ed7ba3b0b50223a6.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/app/view/[...path]/{not-found-fc04c2bd4f35bc6f.js → not-found-6e0c75ad26ce8572.js} +1 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-678139779971cfcb.js +12 -0
- package/_standalone/.next/static/chunks/app/wiki/page-194ae9af2d461481.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2ceea6eabf25b1f2.js +1 -0
- package/_standalone/.next/static/chunks/{webpack-2c19436659aa657b.js → webpack-72e8d9e9073fd1f9.js} +1 -1
- package/_standalone/.next/static/css/9c558c42831fae58.css +1 -0
- package/_standalone/.next/trace +65 -64
- package/_standalone/.next/types/routes.d.ts +2 -1
- package/_standalone/.next/types/validator.ts +9 -0
- package/_standalone/__tests__/api/mcp-install.test.ts +4 -2
- package/_standalone/app/globals.css +2 -1
- package/_standalone/components/AskFab.tsx +11 -5
- package/_standalone/components/AskModal.tsx +1 -1
- package/_standalone/components/FileTree.tsx +83 -1
- package/_standalone/components/GuideCard.tsx +101 -152
- package/_standalone/components/Panel.tsx +6 -1
- package/_standalone/components/RightAskPanel.tsx +2 -2
- package/_standalone/components/agents/AgentsOverviewSection.tsx +13 -11
- package/_standalone/components/agents/CustomAgentModal.tsx +72 -18
- package/_standalone/components/ask/AskContent.tsx +109 -54
- package/_standalone/components/ask/AskHeader.tsx +218 -18
- package/_standalone/components/ask/FileChip.tsx +93 -12
- package/_standalone/components/ask/MessageList.tsx +66 -47
- package/_standalone/components/ask/SessionHistory.tsx +86 -60
- package/_standalone/components/ask/SessionTabBar.tsx +29 -21
- package/_standalone/components/ask/ThinkingBlock.tsx +6 -5
- package/_standalone/components/ask/ToolCallBlock.tsx +10 -9
- package/_standalone/components/changes/ChangesBanner.tsx +1 -1
- package/_standalone/components/settings/SettingsContent.tsx +1 -1
- package/_standalone/components/walkthrough/WalkthroughTooltip.tsx +3 -1
- package/_standalone/components/walkthrough/steps.ts +1 -1
- package/_standalone/data/skills/mindos/SKILL.md +67 -15
- package/_standalone/data/skills/mindos-zh/SKILL.md +67 -11
- package/_standalone/hooks/useAskChat.ts +10 -8
- package/_standalone/hooks/useAskSession.ts +23 -1
- package/_standalone/hooks/useFileUpload.ts +97 -43
- package/_standalone/hooks/useImageUpload.ts +1 -1
- package/_standalone/lib/inbox-upload.ts +86 -0
- package/_standalone/lib/stores/locale-store.ts +20 -6
- package/_standalone/package-lock.json +2 -2
- package/_standalone/package.json +1 -1
- package/_standalone/scripts/extract-pdf.cjs +110 -3
- package/_standalone/tsconfig.tsbuildinfo +1 -1
- package/app/app/api/agents/copy-skill/route.ts +110 -0
- package/app/app/api/agents/custom/detect/route.ts +16 -1
- package/app/app/api/ask/route.ts +7 -1
- package/app/app/api/extract-pdf/route.ts +12 -5
- package/app/app/api/mcp/agents/route.ts +64 -2
- package/app/app/globals.css +2 -1
- package/app/app/layout.tsx +16 -4
- package/app/components/AskFab.tsx +11 -5
- package/app/components/AskModal.tsx +1 -1
- package/app/components/FileTree.tsx +83 -1
- package/app/components/GuideCard.tsx +101 -152
- package/app/components/HomeContent.tsx +123 -574
- package/app/components/Panel.tsx +6 -1
- package/app/components/RightAskPanel.tsx +2 -2
- package/app/components/WikiHomeContent.tsx +151 -3
- package/app/components/agents/AgentDetailContent.tsx +58 -1
- package/app/components/agents/AgentsOverviewSection.tsx +13 -11
- package/app/components/agents/CustomAgentModal.tsx +72 -18
- package/app/components/ask/AskContent.tsx +109 -54
- package/app/components/ask/AskHeader.tsx +218 -18
- package/app/components/ask/FileChip.tsx +93 -12
- package/app/components/ask/MessageList.tsx +66 -47
- package/app/components/ask/SessionHistory.tsx +86 -60
- package/app/components/ask/SessionTabBar.tsx +29 -21
- package/app/components/ask/ThinkingBlock.tsx +6 -5
- package/app/components/ask/ToolCallBlock.tsx +10 -9
- package/app/components/changes/ChangesBanner.tsx +1 -1
- package/app/components/changes/ChangesContentPage.tsx +368 -168
- package/app/components/settings/SettingsContent.tsx +1 -1
- package/app/components/walkthrough/WalkthroughTooltip.tsx +3 -1
- package/app/components/walkthrough/steps.ts +1 -1
- package/app/data/skills/mindos/SKILL.md +67 -15
- package/app/data/skills/mindos-zh/SKILL.md +67 -11
- package/app/hooks/useAskChat.ts +10 -8
- package/app/hooks/useAskSession.ts +23 -1
- package/app/hooks/useFileUpload.ts +97 -43
- package/app/hooks/useImageUpload.ts +1 -1
- package/app/lib/agent/prompt.ts +15 -4
- package/app/lib/custom-agents.ts +109 -1
- package/app/lib/file-ops.ts +58 -0
- package/app/lib/i18n/modules/ai-chat.ts +134 -10
- package/app/lib/i18n/modules/knowledge.ts +2 -0
- package/app/lib/i18n/modules/onboarding.ts +12 -12
- package/app/lib/inbox-upload.ts +86 -0
- package/app/lib/mcp-agents.ts +21 -1
- package/app/lib/stores/LocaleStoreInit.tsx +24 -1
- package/app/lib/stores/locale-store.ts +20 -6
- package/app/lib/types.ts +13 -0
- package/app/package.json +1 -1
- package/app/scripts/extract-pdf.cjs +110 -3
- package/package.json +1 -1
- package/skills/mindos/SKILL.md +67 -15
- package/skills/mindos/references/knowledge-health.md +120 -0
- package/skills/mindos-max/SKILL.md +52 -5
- package/skills/mindos-max-zh/SKILL.md +55 -6
- package/skills/mindos-zh/SKILL.md +67 -11
- package/_standalone/.next/server/chunks/2364.js +0 -2
- package/_standalone/.next/server/chunks/357.js +0 -1
- package/_standalone/.next/static/2ksXveDzEcnCMRIElDkLq/_buildManifest.js +0 -1
- package/_standalone/.next/static/chunks/178-105779afb62d36d9.js +0 -1
- package/_standalone/.next/static/chunks/2218-d54538000574ffef.js +0 -1
- package/_standalone/.next/static/chunks/2549-e63cf57fa927a41d.js +0 -1
- package/_standalone/.next/static/chunks/4237-ffc6e7c15d4007b6.js +0 -1
- package/_standalone/.next/static/chunks/6878-e2c5459e1c608f89.js +0 -1
- package/_standalone/.next/static/chunks/7249-fa98ca10e9a10f39.js +0 -11
- package/_standalone/.next/static/chunks/9274-296ab35f9f09e42e.js +0 -1
- package/_standalone/.next/static/chunks/9286-5b09baa5200318c2.js +0 -1
- package/_standalone/.next/static/chunks/app/agents/[agentKey]/page-7bdeab5af8e4f5f2.js +0 -1
- package/_standalone/.next/static/chunks/app/agents/page-5d1446665ddb3801.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/discover/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/a2a/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/config/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/detect/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/install/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/registry/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/acp/session/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agent-activity/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/detect/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/agents/custom/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/ask-sessions/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/auth/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/backlinks/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/bootstrap/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/changes/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/export/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/extract-pdf/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/import/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/raw/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/file/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/files/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/git/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/graph/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/health/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/inbox/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/init/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/agents/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/install-skill/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/restart/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/status/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/mcp/uninstall/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/monitoring/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/recent-files/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/restart/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/search/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/list-models/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/reset-token/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/settings/test-key/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-path/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/check-port/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/generate-token/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/ls/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/setup/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/skills/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/sync/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/tree-version/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/uninstall/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-check/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/update-status/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/api/workflows/route-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/changes/page-5a72144d1080a699.js +0 -1
- package/_standalone/.next/static/chunks/app/echo/[segment]/page-b0103509ce34444b.js +0 -11
- package/_standalone/.next/static/chunks/app/echo/page-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/layout-7e02ddf4144b01f1.js +0 -186
- package/_standalone/.next/static/chunks/app/loading-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/page-6a6a12bd6d6812d0.js +0 -7
- package/_standalone/.next/static/chunks/app/trash/page-54cbd5c98d9de69b.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/loading-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/app/view/[...path]/page-ca7bdcbf27f88a46.js +0 -12
- package/_standalone/.next/static/chunks/app/wiki/page-d492256a93f0b8bc.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2f4705aa66819b86.js +0 -1
- package/_standalone/.next/static/css/fd84c8316ead16eb.css +0 -1
- /package/_standalone/.next/static/{2ksXveDzEcnCMRIElDkLq → K3wZNf5bj_AFYwtqcRXIf}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8520],{2431:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var n=r(12115);let s="mindos:acp-detection";function a(){let e=(0,n.useRef)(function(){try{let e=sessionStorage.getItem(s);if(!e)return null;let t=JSON.parse(e);if("number"!=typeof t.ts||Date.now()-t.ts>18e5)return null;return t}catch{return null}}()),[t,r]=(0,n.useState)(e.current?.installed??[]),[a,o]=(0,n.useState)(e.current?.notInstalled??[]),[l,i]=(0,n.useState)(!e.current),[u,d]=(0,n.useState)(null),[c,m]=(0,n.useState)(0),p=(0,n.useRef)(!1),f=(0,n.useRef)(!1),g=(0,n.useCallback)(()=>{try{sessionStorage.removeItem(s)}catch{}e.current=null,f.current=!0,m(e=>e+1)},[]);return(0,n.useEffect)(()=>{let e=()=>g();return window.addEventListener("mindos:settings-changed",e),()=>window.removeEventListener("mindos:settings-changed",e)},[g]),(0,n.useEffect)(()=>{let n=f.current;if(f.current=!1,e.current&&Date.now()-e.current.ts<18e5&&0===c||p.current)return;p.current=!0;let l=t.length>0||a.length>0;l||i(!0),d(null);let u=!1;return fetch(`/api/acp/detect${n?"?force=1":""}`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(t=>{if(u)return;let n=t.installed??[],a=t.notInstalled??[];try{sessionStorage.setItem(s,JSON.stringify({installed:n,notInstalled:a,ts:Date.now()}))}catch{}e.current={installed:n,notInstalled:a,ts:Date.now()},r(n),o(a)}).catch(e=>{!u&&(l||d(e.message))}).finally(()=>{p.current=!1,u||i(!1)}),()=>{u=!0}},[c]),{installedAgents:t,notInstalledAgents:a,loading:l,error:u,refresh:g}}},27318:(e,t,r)=>{"use strict";r.d(t,{KT:()=>d,NH:()=>u});var n=r(12115);let s={open:!1,initialMessage:"",source:"user",acpAgent:null},a=new Set;function o(){a.forEach(e=>e())}function l(e){return a.add(e),()=>{a.delete(e)}}function i(){return s}function u(e="",t="user",r=null){s={open:!0,initialMessage:e,source:t,acpAgent:r},o()}function d(){let e=(0,n.useSyncExternalStore)(l,i,i);return{open:e.open,initialMessage:e.initialMessage,source:e.source,acpAgent:e.acpAgent,openWith:(0,n.useCallback)((e,t="user",r=null)=>u(e,t,r),[]),close:(0,n.useCallback)(()=>void(s={open:!1,initialMessage:"",source:"user",acpAgent:null},o()),[])}}},47376:(e,t,r)=>{"use strict";r.d(t,{Ot:()=>c,T_:()=>s,Ux:()=>d,bf:()=>l,jt:()=>a,rl:()=>o});var n=r(20699);r(87358);let s={anthropic:{id:"anthropic",name:"Anthropic",nameZh:"Anthropic",defaultModel:"claude-sonnet-4-6",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://console.anthropic.com/settings/keys",category:"primary"},openai:{id:"openai",name:"OpenAI",nameZh:"OpenAI",defaultModel:"gpt-5.4",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.openai.com/api-keys",category:"primary"},google:{id:"google",name:"Google Gemini",nameZh:"Google Gemini",defaultModel:"gemini-2.5-flash",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://aistudio.google.com/apikey",category:"primary"},groq:{id:"groq",name:"Groq",nameZh:"Groq",defaultModel:"llama-3.3-70b-versatile",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://console.groq.com/keys",category:"more"},xai:{id:"xai",name:"xAI (Grok)",nameZh:"xAI (Grok)",defaultModel:"grok-3",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},openrouter:{id:"openrouter",name:"OpenRouter",nameZh:"OpenRouter",defaultModel:"anthropic/claude-sonnet-4",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},mistral:{id:"mistral",name:"Mistral",nameZh:"Mistral",defaultModel:"mistral-large-latest",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},deepseek:{id:"deepseek",name:"DeepSeek",nameZh:"DeepSeek",defaultModel:"deepseek-chat",piProviderOverride:"openai",fixedBaseUrl:"https://api.deepseek.com/v1",supportsBaseUrl:!0,supportsThinking:!0,supportsListModels:!0,signupUrl:"https://platform.deepseek.com/api_keys",category:"more"},zai:{id:"zai",name:"ZhipuAI (GLM)",nameZh:"智谱 AI (GLM 国际版)",defaultModel:"glm-4-plus",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"zai-cn":{id:"zai-cn",name:"ZhipuAI (GLM China)",nameZh:"智谱 AI (GLM 国内版)",defaultModel:"glm-4-plus",piProviderOverride:"zai",fixedBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,signupUrl:"https://open.bigmodel.cn/",category:"more"},"kimi-coding":{id:"kimi-coding",name:"Kimi Coding",nameZh:"Kimi Coding (月之暗面)",defaultModel:"kimi-k2-thinking",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},cerebras:{id:"cerebras",name:"Cerebras",nameZh:"Cerebras",defaultModel:"llama-4-scout-17b-16e",supportsBaseUrl:!1,supportsThinking:!1,supportsListModels:!0,category:"more"},minimax:{id:"minimax",name:"MiniMax",nameZh:"MiniMax (国际版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},"minimax-cn":{id:"minimax-cn",name:"MiniMax (China)",nameZh:"MiniMax (国内版)",defaultModel:"MiniMax-M2.5",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},huggingface:{id:"huggingface",name:"Hugging Face",nameZh:"Hugging Face",defaultModel:"Qwen/Qwen3-235B-A22B-Thinking-2507",supportsBaseUrl:!1,supportsThinking:!0,supportsListModels:!1,category:"more"},ollama:{id:"ollama",name:"Ollama",nameZh:"Ollama (本地)",defaultModel:"llama3.2",piProviderOverride:"openai",fixedBaseUrl:"http://localhost:11434/v1",apiKeyFallback:"ollama",supportsBaseUrl:!0,supportsThinking:!1,supportsListModels:!0,signupUrl:"https://ollama.com/download",category:"more"}},a=Object.keys(s);function o(e){return e in s}function l(){let e=[],t=[];for(let r of a)"primary"===s[r].category?e.push(r):t.push(r);return t.sort((e,t)=>s[e].name.localeCompare(s[t].name)),{primary:e,more:t}}function i(e){return s[e].piProviderOverride??e}let u={deepseek:"DEEPSEEK_API_KEY"};function d(e){return u[e]?u[e]:m[i(e)]}function c(e){let t=s[e];if(t.fixedBaseUrl)return t.fixedBaseUrl;try{let t=(0,n.zr)(i(e));return t[0]?.baseUrl??""}catch{return""}}let m={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","azure-openai-responses":"AZURE_OPENAI_API_KEY",google:"GEMINI_API_KEY",groq:"GROQ_API_KEY",cerebras:"CEREBRAS_API_KEY",xai:"XAI_API_KEY",openrouter:"OPENROUTER_API_KEY",zai:"ZAI_API_KEY","zai-cn":"ZAI_API_KEY",mistral:"MISTRAL_API_KEY",minimax:"MINIMAX_API_KEY","minimax-cn":"MINIMAX_API_KEY",huggingface:"HF_TOKEN","kimi-coding":"KIMI_API_KEY"}},48391:(e,t,r)=>{"use strict";r.d(t,{Oo:()=>s,dB:()=>d});var n=r(12115);function s(e){let t=e.replace(/<(thinking|reasoning|scratchpad)>[\s\S]*?<\/\1>/gi,"");return(t=t.replace(/<(?:thinking|reasoning|scratchpad)>[\s\S]*$/gi,"")).trim()}let a=new Set(["create_file","write_file","batch_create_files","append_to_file","insert_after_heading","update_section","edit_lines","delete_file","rename_file","move_file","append_csv"]),o=new Set(["read_file","read_lines","search","list_files"]);function l(e,t){return t&&"object"==typeof t?"string"==typeof t.path?t.path:"string"==typeof t.from_path?t.from_path:"batch_create_files"===e&&Array.isArray(t.files)?t.files.map(e=>e.path??"").filter(Boolean).join(", "):"":""}async function i(e){try{let t=await fetch(`/api/file?path=${encodeURIComponent(e)}&op=read_file`);if(!t.ok)return"";return(await t.json()).content??""}catch{return""}}async function u(e,t,r,n){let u=e.getReader(),d=new TextDecoder,c="",m=[],p=new Map,f="",g=0,h=new Set;try{for(;!n?.aborted;){let{done:e,value:n}=await u.read();if(e)break;let y=(c+=d.decode(n,{stream:!0})).split("\n");for(let e of(c=y.pop()??"",y)){let n,u=e.trim();if(!u.startsWith("data:"))continue;let d=u.slice(5).trim();if(!d)continue;try{n=JSON.parse(d)}catch{continue}let c=n.type;switch(c){case"tool_start":{var x,b,v;let e=n.toolName,s=n.toolCallId,u=n.args;g++;let d=(x=c,b=e,v=u,"text_delta"===x?{stage:"analyzing"}:"tool_start"===x&&b?a.has(b)?{stage:"writing",detail:l(b,v)||void 0}:o.has(b)?{stage:"reading",detail:v&&"object"==typeof v&&"path"in v&&"string"==typeof v.path?v.path:void 0}:{stage:"analyzing"}:null);if(d&&t({stageHint:d}),a.has(e)){let n=l(e,u),a="update";"create_file"===e||"batch_create_files"===e?a="create":("delete_file"===e||"rename_file"===e||"move_file"===e)&&(a="unknown"),"update"===a&&n&&!h.has(n)&&(h.add(n),i(n).then(e=>{e&&r(n,e)})),p.set(s,{name:e,path:n,action:a}),t({currentTool:{name:e,path:n}})}break}case"tool_end":{let e=n.toolCallId,r=!!n.isError,s=p.get(e);if(s){if("batch_create_files"===s.name)for(let t of s.path.split(", ").filter(Boolean))m.push({action:s.action,path:t,toolCallId:e,ok:!r});else m.push({action:s.action,path:s.path,toolCallId:e,ok:!r});p.delete(e),t({changes:[...m],currentTool:null})}break}case"text_delta":f+=n.delta??"",t({stageHint:{stage:"analyzing"},summary:s(f)});break;case"error":throw Error(n.message||"AI organize failed")}}}}finally{u.releaseLock()}return{changes:m,summary:s(f),toolCallCount:g}}function d(){let[e,t]=(0,n.useState)("idle"),[r,s]=(0,n.useState)([]),[a,o]=(0,n.useState)(null),[l,i]=(0,n.useState)(null),[d,c]=(0,n.useState)(""),[m,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(0),h=(0,n.useRef)(null),x=(0,n.useRef)(0),b=(0,n.useRef)(new Map),[v,y]=(0,n.useState)([]),[k,w]=(0,n.useState)("upload"),j=(0,n.useRef)(0),[N,A]=(0,n.useState)(0),C=(0,n.useCallback)(async(e,r,n="upload")=>{t("organizing"),s([]),o(null),i({stage:"connecting"}),c(""),p(null),g(0),y(e.map(e=>e.name)),w(n),j.current=Date.now(),A(0),b.current=new Map,x.current=Date.now();let a=new AbortController;h.current=a;let l=e.map(e=>({name:e.name,content:e.content.length>2e4?e.content.slice(0,2e4)+"\n\n[...truncated to first ~20000 chars]":e.content}));try{let e=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"user",content:r}],uploadedFiles:l,maxSteps:15,mode:"organize"}),signal:a.signal});if(!e.ok){let t=`Request failed (${e.status})`;try{let r=await e.json();"string"==typeof r?.error?t=r.error:"object"==typeof r?.error&&r.error?.message?t=r.error.message:r?.message&&(t=r.message)}catch{}throw Error(t)}if(!e.body)throw Error("No response body");let n=await u(e.body,e=>{x.current=Date.now(),e.changes&&s(e.changes),void 0!==e.currentTool&&o(e.currentTool),e.stageHint&&i(e.stageHint),void 0!==e.summary&&c(e.summary)},(e,t)=>{b.current.set(e,t)},a.signal);s(n.changes),c(n.summary),g(n.toolCallCount),o(null),A(Date.now()-j.current),t("done")}catch(e){"AbortError"===e.name?t("idle"):(p(e.message),t("error"))}finally{h.current=null}},[]),S=(0,n.useCallback)(()=>{h.current?.abort()},[]),E=(0,n.useCallback)(async e=>{let t=r.find(t=>t.path===e&&t.ok&&!t.undone);if(!t)return!1;try{if("create"===t.action){if(!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:t.path})})).ok)return!1}else{if("update"!==t.action)return!1;let r=b.current.get(e);if(!r||!(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:t.path,content:r})})).ok)return!1}return s(t=>t.map(t=>t.path===e&&t.ok&&!t.undone?{...t,undone:!0}:t)),!0}catch{return!1}},[r]),_=(0,n.useCallback)(async()=>{let e=r.filter(e=>e.ok&&!e.undone&&("create"===e.action||"update"===e.action&&b.current.has(e.path))),t=0;for(let r of e)try{if("create"===r.action)(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"delete_file",path:r.path})})).ok&&t++;else if("update"===r.action){let e=b.current.get(r.path);e&&(await fetch("/api/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({op:"write_file",path:r.path,content:e})})).ok&&t++}}catch{}return t>0&&s(e=>e.map(e=>!e.ok||e.undone?e:"create"===e.action||"update"===e.action&&b.current.has(e.path)?{...e,undone:!0}:e)),t},[r]),M=(0,n.useCallback)(e=>{let t=r.find(t=>t.path===e&&t.ok&&!t.undone);return!!t&&("create"===t.action||"update"===t.action&&b.current.has(e))},[r]),R=r.some(e=>e.ok&&!e.undone&&("create"===e.action||"update"===e.action&&b.current.has(e.path))),z=(0,n.useCallback)(()=>{t("idle"),s([]),o(null),i(null),c(""),p(null),g(0),y([]),w("upload"),A(0),j.current=0,b.current=new Map,x.current=0},[]);return{phase:e,changes:r,currentTool:a,stageHint:l,summary:d,error:m,toolCallCount:f,sourceFileNames:v,source:k,durationMs:N,snapshots:b,start:C,abort:S,undoOne:E,undoAll:_,canUndo:M,hasAnyUndoable:R,reset:z}}},51541:(e,t,r)=>{"use strict";r.d(t,{A:()=>eX});var n=r(95155),s=r(12115),a=r(51914),o=r(48368),l=r(17243),i=r(33210),u=r(46757),d=r(56204),c=r(35581),m=r(47650),p=r(96035),f=r(86901),g=r(94514),h=r(66088);let x="mindos-ask-mode",b=["agent","chat"];function v({mode:e,onChange:t,disabled:r}){let{t:a}=(0,c.Y)(),[o,l]=(0,s.useState)(!1),[i,u]=(0,s.useState)(null),d=(0,s.useRef)(null),v=(0,s.useRef)(null),y=(0,s.useCallback)(()=>{if(!d.current)return;let e=d.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>120?"up":"down";u({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[]);(0,s.useEffect)(()=>{o&&y()},[o,y]),(0,s.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;d.current&&!d.current.contains(t)&&v.current&&!v.current.contains(t)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,s.useEffect)(()=>{if(!o)return;let e=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o]),(0,s.useEffect)(()=>{if(o)return window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y)}},[o,y]);let k=(0,s.useCallback)(e=>{t(e);try{localStorage.setItem(x,e)}catch{}l(!1)},[t]),w="chat"===e,j=(e,t)=>"chat"===e?(0,n.jsx)(p.A,{size:t,className:"shrink-0"}):(0,n.jsx)(f.A,{size:t,className:"shrink-0"}),N=e=>"chat"===e?a.ask.modeChat:a.ask.modeAgent,A=e=>"chat"===e?a.ask.modeChatHint:a.ask.modeAgentHint,C=o&&i?(0,n.jsx)("div",{ref:v,role:"listbox","aria-label":"Select mode",className:"fixed z-50 min-w-[200px] max-w-[260px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:i.left,..."up"===i.direction?{bottom:window.innerHeight-i.top}:{top:i.top}},children:b.map(t=>{let r=e===t;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>k(t),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:j(t,13)}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:N(t)}),(0,n.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:A(t)})]}),r&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},t)})}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:d,type:"button",onClick:()=>{r||l(e=>!e)},disabled:r,className:`
|
|
2
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
3
|
+
text-2xs font-medium transition-colors select-none
|
|
4
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
5
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
6
|
+
${w?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
|
|
7
|
+
`,title:A(e),"aria-expanded":o,"aria-haspopup":"listbox",children:[j(e,11),(0,n.jsx)("span",{className:"truncate max-w-[80px]",children:N(e)}),(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&C&&(0,m.createPortal)(C,document.body)]})}function y(e){let t=Date.now();return{id:`${t}-${Math.random().toString(36).slice(2,8)}`,currentFile:e,createdAt:t,updatedAt:t,messages:[]}}function k(e){if(e.title)return e.title;let t=e.messages.find(e=>"user"===e.role);if(!t)return"(empty session)";let r=t.content.replace(/\s+/g," ").trim();return!r&&t.images&&t.images.length>0?`[${t.images.length} image${t.images.length>1?"s":""}]`:r.length>42?`${r.slice(0,42)}...`:r||"(empty session)"}async function w(){try{let e=await fetch("/api/ask-sessions",{cache:"no-store"});if(!e.ok)return[];let t=await e.json();if(!Array.isArray(t))return[];return t.slice(0,30)}catch{return[]}}async function j(e){try{let t={...e,messages:e.messages.map(e=>e.images&&0!==e.images.length?{...e,images:e.images.map(e=>({...e,data:""}))}:e)};await fetch("/api/ask-sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:t})})}catch{}}async function N(e){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})}catch{}}async function A(e){try{await fetch("/api/ask-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})})}catch{}}let C=new Set([".txt",".md",".markdown",".csv",".json",".yaml",".yml",".xml",".html",".htm",".pdf"]);function S(e){let t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}async function E(e){let t=e.name;try{let r=await e.arrayBuffer(),n=function(e){let t="";for(let r=0;r<e.length;r+=32768)t+=String.fromCharCode(...e.subarray(r,r+32768));return btoa(t)}(new Uint8Array(r)),s=await fetch("/api/extract-pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,dataBase64:n})}),a={};try{a=await s.json()}catch{throw Error("Failed to parse extraction response")}if(!s.ok)throw Error(a.error||`PDF extraction failed (${s.status})`);let o=a.extracted&&a.text||"";if(!o)return{name:t,content:`[PDF: ${t}] Could not extract readable text (possibly scanned/image PDF).`,status:"error",error:"Scanned or image-only PDF — no extractable text"};let l={name:t,content:`[PDF TEXT EXTRACTED: ${t}]
|
|
8
|
+
|
|
9
|
+
${o}`,status:"success"};return a.truncated&&a.totalChars&&(l.truncatedInfo={totalChars:a.totalChars,includedChars:o.length,totalPages:a.pagesParsed??0}),l}catch(e){return{name:t,content:`[PDF: ${t}] Failed to extract text from this PDF.`,status:"error",error:e instanceof Error?e.message:"Unknown error"}}}let _=new Set(["image/png","image/jpeg","image/gif","image/webp"]);async function M(e){let t=e.type;if(e.size<=5242880){let r=new Uint8Array(await e.arrayBuffer()),n="";for(let e=0;e<r.length;e+=32768)n+=String.fromCharCode(...r.subarray(e,e+32768));return{data:btoa(n),mimeType:t}}return new Promise((t,r)=>{let n=new Image;n.onload=()=>{let{width:e,height:s}=n;if(e>1920||s>1920){let t=Math.min(1920/e,1920/s);e=Math.round(e*t),s=Math.round(s*t)}let a=document.createElement("canvas");a.width=e,a.height=s;let o=a.getContext("2d");o?(o.drawImage(n,0,0,e,s),t({data:a.toDataURL("image/jpeg",.85).split(",")[1],mimeType:"image/jpeg"}),URL.revokeObjectURL(n.src)):r(Error("Canvas not supported"))},n.onerror=()=>{r(Error("Failed to load image")),URL.revokeObjectURL(n.src)},n.src=URL.createObjectURL(e)})}function R(e){let t=[];for(let r of Array.from(e))if("file"===r.kind&&_.has(r.type)){let e=r.getAsFile();e&&t.push(e)}return t}var z=r(67635),L=r(53961),T=r(6296),I=r(32967),P=r(59511),D=r(61878),$=r(37618),O=r(31885),U=r(13545),F=r(84755),B=r(56842),H=r(66804),K=r(32957),Z=r(48391),Y=r(7834),W=r(42129),q=r(97810),Q=r(49387),G=r(93631),J=r(45049),X=r(68459),V=r(48334),ee=r(97233),et=r(50538),er=r(84980),en=r(33078),es=r(21362),ea=r(41585),eo=r(12651),el=r(62791);let ei=new Set(["delete_file","move_file","rename_file","write_file"]),eu=new Set(["write_file","create_file","update_section","insert_after_heading","edit_lines","append_to_file"]),ed={search:D.A,list_files:W.A,read_file:q.A,write_file:Q.A,create_file:G.A,append_to_file:o.A,insert_after_heading:J.A,update_section:Q.A,delete_file:X.A,rename_file:o.A,move_file:V.A,get_backlinks:ee.A,get_history:et.A,get_file_at_version:et.A,get_recent:er.A,append_csv:en.A},ec="--- changes ---";function em({part:e}){let t=eu.has(e.toolName),r="done"===e.state,[a,o]=(0,s.useState)(null),l=a??(t&&r),i=ed[e.toolName]??I.A,u=ei.has(e.toolName),d=(0,s.useMemo)(()=>(function(e){if(!e)return{header:"",stats:"",diffLines:[]};let t=e.indexOf(ec);if(-1===t)return{header:e,stats:"",diffLines:[]};let r=e.slice(0,t).trim(),n=e.slice(t+ec.length).trim(),s=r.match(/\((\+\d+\s*−\d+)\)/);return{header:r,stats:s?s[1]:"",diffLines:n.split("\n").map(e=>e.startsWith("+ ")?{prefix:"+",text:e.slice(2)}:e.startsWith("- ")?{prefix:"-",text:e.slice(2)}:e.startsWith(" ")?{prefix:" ",text:e.slice(2)}:{prefix:" ",text:e})}})(e.output),[e.output]),c=(0,s.useMemo)(()=>e.input&&"object"==typeof e.input?e.input.path??"":"",[e.input]),m=c?`${c.split("/").pop()??c}${d.stats?` (${d.stats})`:""}`:function(e){if(!e||"object"!=typeof e)return String(e??"");let t=[];for(let r of Object.values(e))"string"==typeof r?t.push(r.length>60?`${r.slice(0,60)}…`:r):Array.isArray(r)?t.push(`[${r.length} items]`):null!=r&&t.push(String(r));return t.join(", ")}(e.input);return(0,n.jsxs)("div",{className:`my-1.5 rounded-lg border text-xs font-mono ${u?"border-[var(--amber)]/30 bg-background/60":"border-border/40 bg-background/50"}`,children:[(0,n.jsxs)("button",{type:"button",onClick:()=>o(e=>null===e?!l:!e),"aria-expanded":l,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[l?(0,n.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)(es.A,{size:12,className:"shrink-0 text-muted-foreground"}),u&&(0,n.jsx)(ea.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)(i,{size:12,className:`shrink-0 ${u?"text-[var(--amber)]":"text-muted-foreground"}`}),(0,n.jsx)("span",{className:`font-medium ${u?"text-[var(--amber)]":"text-foreground"}`,children:e.toolName}),(0,n.jsx)("span",{className:"text-muted-foreground truncate flex-1",children:m}),(0,n.jsx)("span",{className:"shrink-0 ml-auto",children:"pending"===e.state||"running"===e.state?(0,n.jsx)(T.A,{size:12,className:"animate-spin text-[var(--amber)]"}):"done"===e.state?(0,n.jsx)(eo.A,{size:12,className:"text-success"}):(0,n.jsx)(el.A,{size:12,className:"text-error"})})]}),l&&(0,n.jsx)("div",{className:"border-t border-border/30",children:t&&r&&d.diffLines.length>0?(0,n.jsx)("div",{className:"max-h-64 overflow-y-auto",children:d.diffLines.map((e,t)=>(0,n.jsxs)("div",{className:`px-2 py-px flex items-start gap-1.5 ${"+"===e.prefix?"bg-success/8":"-"===e.prefix?"bg-error/8":""}`,children:[(0,n.jsx)("span",{className:`select-none w-3 shrink-0 text-right ${"+"===e.prefix?"text-success":"-"===e.prefix?"text-error":"text-muted-foreground/50"}`,children:e.prefix}),(0,n.jsx)("span",{className:`whitespace-pre-wrap break-all flex-1 ${"+"===e.prefix?"text-success":"-"===e.prefix?"text-error":"text-muted-foreground"}`,children:e.text||"\xa0"})]},t))}):(0,n.jsxs)("div",{className:"px-2.5 pb-2.5 pt-1.5 space-y-1.5",children:["running"===e.state&&(0,n.jsxs)("div",{className:"text-muted-foreground/60 text-2xs flex items-center gap-1.5",children:[(0,n.jsx)(T.A,{size:10,className:"animate-spin"})," Running..."]}),(0,n.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,n.jsx)("span",{className:"font-semibold text-foreground/70",children:"Input: "}),(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:JSON.stringify(e.input,null,2)})]}),void 0!==e.output&&""!==e.output&&(0,n.jsxs)("div",{className:"text-muted-foreground leading-relaxed",children:[(0,n.jsx)("span",{className:"font-semibold text-foreground/70",children:"Output: "}),(0,n.jsx)("span",{className:"break-all whitespace-pre-wrap",children:e.output.length>500?e.output.slice(0,500)+"…":e.output})]})]})})]})}var ep=r(90718);function ef({text:e,isStreaming:t}){let[r,a]=(0,s.useState)(!1),{t:o}=(0,c.Y)();return e||t?(0,n.jsxs)("div",{className:"my-1.5 rounded-lg border border-border/30 bg-muted/15 text-xs",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":r,className:"w-full flex items-center gap-1.5 px-2.5 py-2 text-left hover:bg-muted/30 transition-colors rounded-lg",children:[r?(0,n.jsx)(h.A,{size:12,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)(es.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsx)(ep.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("span",{className:"text-muted-foreground font-medium",children:[o.ask.thinkingLabel,t&&!r&&(0,n.jsx)("span",{className:"ml-1 animate-pulse",children:"..."})]}),!r&&e&&(0,n.jsxs)("span",{className:"text-muted-foreground/50 truncate flex-1 ml-1",children:[e.slice(0,80),e.length>80?"...":""]})]}),r&&(0,n.jsx)("div",{className:"px-2.5 pb-2.5 pt-1 border-t border-border/20",children:(0,n.jsxs)("div",{className:"text-muted-foreground whitespace-pre-wrap leading-relaxed",children:[e,t&&(0,n.jsx)("span",{className:"inline-block w-1 h-3 bg-muted-foreground/40 ml-0.5 align-middle animate-pulse rounded-full"})]})})]}):null}let eg=/^Use the skill ([^:]+):\s*/;function eh({text:e,label:t}){let[r,a]=(0,s.useState)(!1),o=(0,s.useCallback)(()=>{(0,Y.l)(e).then(e=>{e&&(a(!0),setTimeout(()=>a(!1),2e3))})},[e]);return(0,n.jsx)("button",{type:"button",onClick:o,className:"absolute -bottom-1 right-1 p-1 rounded-md bg-card border border-border/60 shadow-sm text-muted-foreground hover:text-foreground opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",title:t??"Copy",children:r?(0,n.jsx)(g.A,{size:11,className:"text-success"}):(0,n.jsx)(z.A,{size:11})})}function ex({content:e,skillName:t,images:r}){let s=t??e.match(eg)?.[1],a=e.match(eg),o=a?e.slice(a[0].length):e;return(0,n.jsxs)(n.Fragment,{children:[r&&r.length>0&&(0,n.jsx)("div",{className:`flex flex-wrap gap-1.5${e?" mb-2":""}`,children:r.map((e,t)=>e.data?(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`Image ${t+1}`,className:"max-h-48 max-w-full rounded-md object-contain"},t):(0,n.jsx)("div",{className:"h-12 px-3 rounded-md bg-muted flex items-center gap-1.5 text-xs text-muted-foreground",children:(0,n.jsxs)("span",{children:["[Image ",t+1,"]"]})},t))}),s&&(0,n.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[11px] font-medium bg-white/20 text-white/90 mr-1 align-middle",children:[(0,n.jsx)(L.A,{size:10,className:"shrink-0"}),s]}),s?o:e]})}function eb({content:e,isStreaming:t}){let r=(0,Z.Oo)(e);return r||t?(0,n.jsxs)("div",{className:"prose prose-sm prose-panel dark:prose-invert max-w-none text-foreground prose-p:my-2 prose-p:leading-relaxed prose-headings:font-semibold prose-headings:my-3 prose-h1:text-base prose-h2:text-[15px] prose-h3:text-sm prose-ul:my-1.5 prose-li:my-0.5 prose-ol:my-1.5 prose-code:text-[0.8em] prose-code:bg-muted/80 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded-md prose-code:before:content-none prose-code:after:content-none prose-code:font-mono prose-pre:bg-muted/60 prose-pre:text-foreground prose-pre:text-xs prose-pre:rounded-lg prose-blockquote:border-l-[var(--amber)] prose-blockquote:text-muted-foreground prose-blockquote:not-italic prose-a:text-[var(--amber)] prose-a:no-underline hover:prose-a:underline prose-strong:text-foreground prose-strong:font-semibold prose-table:text-xs prose-th:py-1.5 prose-td:py-1 ",children:[(0,n.jsx)(H.oz,{remarkPlugins:[K.A],children:r}),t&&(0,n.jsx)("span",{className:"inline-block w-1.5 h-3.5 bg-[var(--amber)] ml-0.5 align-middle animate-pulse rounded-full"})]}):null}function ev({message:e,isStreaming:t}){let r=e.parts;if(!r||0===r.length)return e.content?(0,n.jsx)(eb,{content:e.content,isStreaming:t}):null;let s=r[r.length-1],a=t&&"tool-call"===s.type&&("running"===s.state||"pending"===s.state);return(0,n.jsxs)("div",{children:[r.map((e,s)=>{if("reasoning"===e.type){let a=t&&s===r.length-1;return(0,n.jsx)(ef,{text:e.text,isStreaming:a},`reasoning-${s}`)}if("text"===e.type){let a=t&&s===r.length-1;return e.text?(0,n.jsx)(eb,{content:e.text,isStreaming:a},s):null}return"tool-call"===e.type?(0,n.jsx)(em,{part:e},e.toolCallId):null}),a&&(0,n.jsxs)("div",{className:"flex items-center gap-2 py-1.5 mt-1.5",children:[(0,n.jsx)(T.A,{size:12,className:"animate-spin text-[var(--amber)]"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Executing tool…"})]})]})}function ey({parts:e}){if(!e)return null;let t=e.filter(e=>"tool-call"===e.type);if(0===t.length)return null;let r=t[t.length-1],s="tool-call"===r.type?r.toolName:"";return(0,n.jsxs)("div",{className:"flex items-center gap-1.5 mt-2 pt-1.5 border-t border-border/15 text-xs text-muted-foreground/60",children:[(0,n.jsx)(I.A,{size:10}),(0,n.jsxs)("span",{className:"font-medium",children:["Step ",t.length,s?` — ${s}`:""]})]})}let ek=(0,s.memo)(function({messages:e,isLoading:t,loadingPhase:r,emptyPrompt:a,emptyHint:o,suggestions:l,onSuggestionClick:i,labels:u}){let d=(0,s.useRef)(null),c=(0,s.useRef)(null),[m,p]=(0,s.useState)(!1),g=(0,s.useCallback)(()=>{let e=c.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[]);return(0,s.useEffect)(()=>{g()},[e,g]),(0,s.useEffect)(()=>{let e=c.current;if(!e)return;let t=()=>{let{scrollTop:t,scrollHeight:r,clientHeight:n}=e;p(r-t-n>100)};return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[]),(0,n.jsxs)("div",{ref:c,role:"log","aria-live":"polite",className:"relative flex-1 overflow-y-auto overflow-x-hidden px-4 py-5 space-y-5 min-h-0",children:[0===e.length&&(0,n.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1 min-h-[260px] px-6 pt-10 pb-4",children:[(0,n.jsxs)("div",{className:"relative w-12 h-12 rounded-2xl bg-[var(--amber)]/10 flex items-center justify-center mb-6",children:[(0,n.jsx)("div",{className:"absolute inset-0 rounded-2xl bg-[var(--amber)]/5 scale-[1.4]"}),(0,n.jsx)(f.A,{size:22,className:"text-[var(--amber)] relative z-10"})]}),(0,n.jsx)("p",{className:"text-center text-[15px] font-semibold text-foreground tracking-tight mb-2",children:a}),o&&(0,n.jsx)("p",{className:"text-center text-xs text-muted-foreground/80 mb-10 tracking-wide",children:o}),(0,n.jsx)("div",{className:"flex flex-col gap-2.5 max-w-[280px] w-full",children:l.map((e,t)=>{let r=[P.A,D.A,$.A,O.A],s=r[t%r.length];return(0,n.jsxs)("button",{type:"button",onClick:()=>i(e.prompt),className:"group/sug flex items-center gap-3 text-left text-[13px] px-3.5 py-3 rounded-xl border border-border/40 bg-transparent text-muted-foreground hover:text-foreground hover:border-[var(--amber)]/30 hover:bg-[var(--amber)]/5 transition-all leading-snug","aria-label":e.prompt,children:[(0,n.jsx)("span",{className:"shrink-0 w-8 h-8 rounded-lg bg-muted/60 flex items-center justify-center group-hover/sug:bg-[var(--amber)]/10 transition-colors",children:(0,n.jsx)(s,{size:15,className:"text-muted-foreground/70 group-hover/sug:text-[var(--amber)] transition-colors"})}),(0,n.jsx)("span",{className:"flex-1",children:e.label})]},t)})})]}),e.map((s,a)=>(0,n.jsxs)("div",{className:`flex gap-3 animate-[fadeSlideUp_0.22s_ease_both] ${"user"===s.role?"justify-end":"justify-start"}`,children:["assistant"===s.role&&(0,n.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center shrink-0 mt-0.5 bg-[var(--amber)]/8",children:(0,n.jsx)(f.A,{size:13,className:"text-[var(--amber)]"})}),"user"===s.role?(0,n.jsx)("div",{className:"max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-br-lg text-sm leading-relaxed whitespace-pre-wrap bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/10",children:(0,n.jsx)(ex,{content:s.content,skillName:s.skillName,images:s.images})}):s.content.startsWith("__error__")?(0,n.jsx)("div",{className:"max-w-[85%] px-3.5 py-3 rounded-2xl rounded-bl-md border border-error/30 bg-error/10 text-sm shadow-sm",children:(0,n.jsxs)("div",{className:"flex items-start gap-2.5 text-error",children:[(0,n.jsx)(U.A,{size:15,className:"shrink-0 mt-0.5"}),(0,n.jsx)("span",{className:"leading-relaxed font-medium",children:s.content.slice(9)})]})}):(0,n.jsx)("div",{className:"group relative max-w-[85%] px-3.5 py-2.5 rounded-2xl rounded-bl-lg bg-card border border-border/30 shadow-sm text-foreground text-sm",children:s.parts&&s.parts.length>0||(0,Z.Oo)(s.content)?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ev,{message:s,isStreaming:t&&a===e.length-1}),t&&a===e.length-1&&(0,n.jsx)(ey,{parts:s.parts}),!(t&&a===e.length-1)&&(0,Z.Oo)(s.content)&&(0,n.jsx)(eh,{text:(0,Z.Oo)(s.content),label:u.copyMessage})]}):t&&a===e.length-1?(0,n.jsxs)("div",{className:"flex items-center gap-2.5 py-1",children:["reconnecting"===r?(0,n.jsx)(F.A,{size:14,className:"text-[var(--amber)] animate-pulse"}):(0,n.jsx)(T.A,{size:14,className:"animate-spin text-[var(--amber)]"}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,n.jsxs)("span",{className:"inline-flex items-center gap-1",children:["reconnecting"===r?u.reconnecting??"Reconnecting...":"connecting"===r?u.connecting:"thinking"===r?u.thinking:u.generating,(0,n.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:0ms]"}),(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:150ms]"}),(0,n.jsx)("span",{className:"w-1 h-1 rounded-full bg-[var(--amber)] animate-bounce [animation-delay:300ms]"})]})]})})]}):null})]},a)),(0,n.jsx)("div",{ref:d}),m&&e.length>0&&(0,n.jsx)("button",{type:"button",onClick:g,className:"sticky bottom-2 left-1/2 -translate-x-1/2 z-10 p-2 rounded-full border border-border/60 bg-card shadow-md text-muted-foreground hover:text-foreground hover:bg-muted transition-all hover:shadow-lg",title:"Scroll to bottom",children:(0,n.jsx)(B.A,{size:14})})]})});function ew({text:e,query:t}){if(!t)return(0,n.jsx)(n.Fragment,{children:e});let r=e.toLowerCase().indexOf(t.toLowerCase());return -1===r?(0,n.jsx)(n.Fragment,{children:e}):(0,n.jsxs)(n.Fragment,{children:[e.slice(0,r),(0,n.jsx)("span",{className:"text-[var(--amber)] font-semibold",children:e.slice(r,r+t.length)}),e.slice(r+t.length)]})}function ej({results:e,selectedIndex:t,query:r,onSelect:a}){let l=(0,s.useRef)(null),i=(0,s.useRef)(null),[u,d]=(0,s.useState)(280);return((0,s.useEffect)(()=>{let e=i.current;e&&d(Math.max(120,Math.min(320,Math.min(e.getBoundingClientRect().top-8,.5*window.innerHeight)-80)))},[e.length]),(0,s.useEffect)(()=>{let e=l.current;if(!e)return;let r=e.children[t];r?.scrollIntoView({block:"nearest"})},[t]),0===e.length)?null:(0,n.jsxs)("div",{ref:i,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,n.jsx)(W.A,{size:11,className:"text-muted-foreground/50"}),(0,n.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Files"}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:e.length})]}),(0,n.jsx)("div",{ref:l,className:"overflow-y-auto",style:{maxHeight:u},children:e.map((e,s)=>{let l=e.split("/").pop()??e,i=e.split("/").slice(0,-1).join("/"),u=l.endsWith(".csv");return(0,n.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),a(e)},className:`w-full flex items-center gap-2 px-3 py-2 text-sm text-left transition-colors ${s===t?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[u?(0,n.jsx)(en.A,{size:13,className:"text-success shrink-0"}):(0,n.jsx)(o.A,{size:13,className:"text-muted-foreground shrink-0"}),(0,n.jsx)("span",{className:"truncate font-medium flex-1",title:l,children:(0,n.jsx)(ew,{text:l,query:r})}),i&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 truncate max-w-[140px] shrink-0",title:i,children:(0,n.jsx)(ew,{text:i,query:r})})]},e)})}),(0,n.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,n.jsx)("span",{children:"↑↓ navigate"}),(0,n.jsx)("span",{children:"↵ select"}),(0,n.jsx)("span",{children:"ESC dismiss"})]})]})}function eN({results:e,selectedIndex:t,query:r,onSelect:a}){let o=(0,s.useRef)(null),l=(0,s.useRef)(null),[i,u]=(0,s.useState)(280);return((0,s.useEffect)(()=>{let e=l.current;e&&u(Math.max(120,Math.min(320,Math.min(e.getBoundingClientRect().top-8,.5*window.innerHeight)-80)))},[e.length]),(0,s.useEffect)(()=>{let e=o.current;if(!e)return;let r=e.children[t];r?.scrollIntoView({block:"nearest"})},[t]),0===e.length)?null:(0,n.jsxs)("div",{ref:l,className:"border border-border rounded-lg bg-card shadow-lg overflow-hidden",children:[(0,n.jsxs)("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-1.5",children:[(0,n.jsx)(L.A,{size:11,className:"text-[var(--amber)]/50"}),(0,n.jsx)("span",{className:"text-2xs font-medium text-muted-foreground/70 uppercase tracking-wider",children:"Skills"}),(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/40 ml-auto",children:e.length})]}),(0,n.jsx)("div",{ref:o,className:"overflow-y-auto",style:{maxHeight:i},children:e.map((e,s)=>(0,n.jsxs)("button",{type:"button",onMouseDown:t=>{t.preventDefault(),a(e)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors ${s===t?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:[(0,n.jsx)(L.A,{size:13,className:"text-[var(--amber)] shrink-0"}),(0,n.jsxs)("span",{className:"text-sm font-medium shrink-0",children:["/",(0,n.jsx)(ew,{text:e.name,query:r})]}),e.description&&(0,n.jsx)("span",{className:"text-2xs text-muted-foreground/50 truncate min-w-0 flex-1",title:e.description,children:e.description})]},e.name))}),(0,n.jsxs)("div",{className:"px-3 py-1.5 border-t border-border flex gap-3 text-2xs text-muted-foreground/40 shrink-0",children:[(0,n.jsx)("span",{children:"↑↓ navigate"}),(0,n.jsx)("span",{children:"↵ / Tab select"}),(0,n.jsx)("span",{children:"ESC dismiss"})]})]})}var eA=r(36261);function eC({sessions:e,activeSessionId:t,onLoad:r,onDelete:a,onRename:o,onTogglePin:l,onClearAll:i,labels:u}){let[d,c]=(0,s.useState)(!1),m=(0,s.useRef)(void 0),[p,f]=(0,s.useState)(null),[g,h]=(0,s.useState)(""),x=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]),(0,s.useEffect)(()=>{p&&x.current&&(x.current.focus(),x.current.select())},[p]);let b=(0,s.useCallback)(e=>{f(e.id),h(k(e))},[]),v=(0,s.useCallback)(()=>{p&&(o(p,g),f(null))},[p,g,o]),y=(0,s.useCallback)(()=>{f(null)},[]);return(0,n.jsxs)("div",{className:"border-b border-border/40 px-4 py-3 max-h-[220px] overflow-y-auto",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,n.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:u.title}),e.length>1&&(0,n.jsx)("button",{type:"button",onClick:()=>{if(!d){c(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(!1),3e3);return}m.current&&clearTimeout(m.current),i(),c(!1)},className:`text-2xs px-2 py-0.5 rounded-md transition-colors ${d?"bg-error/10 text-error font-medium":"text-muted-foreground/60 hover:text-error hover:bg-muted"}`,children:d?u.confirmClear:u.clearAll})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[0===e.length&&(0,n.jsx)("div",{className:"text-xs text-muted-foreground/50 py-2 text-center",children:u.noSessions}),e.map(e=>{let s=t===e.id;return(0,n.jsxs)("div",{className:"group flex items-center gap-0.5",children:[e.pinned&&(0,n.jsx)(J.A,{size:10,className:"shrink-0 text-[var(--amber)]/50 -rotate-45 ml-1"}),(0,n.jsxs)("button",{type:"button",onClick:()=>r(e.id),onDoubleClick:()=>b(e),className:`flex-1 text-left px-2.5 py-2 rounded-lg text-xs transition-colors min-w-0 ${s?"bg-[var(--amber)]/8 text-foreground border border-[var(--amber)]/15":"text-muted-foreground hover:bg-muted hover:text-foreground border border-transparent"}`,children:[p===e.id?(0,n.jsx)("input",{ref:x,type:"text",value:g,onChange:e=>h(e.target.value),onBlur:v,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),v()),"Escape"===e.key&&(e.preventDefault(),y())},onClick:e=>e.stopPropagation(),className:"w-full bg-transparent border-b border-[var(--amber)] outline-none text-xs text-foreground"}):(0,n.jsx)("div",{className:"truncate font-medium",children:k(e)}),p!==e.id&&(0,n.jsx)("div",{className:"text-2xs text-muted-foreground/50 mt-0.5",children:function(e){let t=Math.floor((Date.now()-e.getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;let r=Math.floor(t/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return n<7?`${n}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(new Date(e.updatedAt))})]}),(0,n.jsx)("button",{type:"button",onClick:()=>l(e.id),className:`p-1.5 rounded-lg transition-opacity opacity-0 group-hover:opacity-100 ${e.pinned?"text-[var(--amber)] hover:text-muted-foreground":"text-muted-foreground hover:text-[var(--amber)]"}`,title:e.pinned?"Unpin":"Pin",children:e.pinned?(0,n.jsx)(eA.A,{size:11}):(0,n.jsx)(J.A,{size:11})}),(0,n.jsx)("button",{type:"button",onClick:()=>b(e),className:"p-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:u.rename,children:(0,n.jsx)(Q.A,{size:11})}),(0,n.jsx)("button",{type:"button",onClick:()=>a(e.id),className:"p-1.5 rounded-lg text-muted-foreground hover:text-error hover:bg-error/5 opacity-0 group-hover:opacity-100 transition-opacity",title:"Delete session",children:(0,n.jsx)(X.A,{size:11})})]},e.id)})]})]})}var eS=r(89823),eE=r(60241),e_=r(24371),eM=r(52335),eR=r(94852);let ez=(0,s.memo)(function({isPanel:e,showHistory:t,onToggleHistory:r,onReset:a,isLoading:o,maximized:l,onMaximize:u,askMode:d,onModeSwitch:p,onClose:x,hideTitle:b,sessions:v,activeSessionId:y,onLoadSession:w,onDeleteSession:j,onRenameSession:N,onTogglePinSession:A}){let{t:C}=(0,c.Y)(),S=v&&v.length>=1,E=v?.find(e=>e.id===y),_=E?k(E):null,[M,R]=(0,s.useState)(!1),z=(0,s.useRef)(null),L=(0,s.useRef)(null),[T,I]=(0,s.useState)(null),[P,D]=(0,s.useState)(""),$=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!M)return;let e=e=>{let t=e.target;z.current&&!z.current.contains(t)&&L.current&&!L.current.contains(t)&&(R(!1),I(null))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[M]),(0,s.useEffect)(()=>{if(!M)return;let e=e=>{"Escape"===e.key&&(T?I(null):R(!1))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[M,T]),(0,s.useEffect)(()=>{T&&setTimeout(()=>$.current?.focus(),0)},[T]);let O=(0,s.useCallback)(e=>{w?.(e),R(!1)},[w]),U=(0,s.useCallback)((e,t)=>{I(e),D("(empty session)"===t?"":t)},[]),F=(0,s.useCallback)(()=>{T&&N&&P.trim()&&N(T,P.trim()),I(null)},[T,P,N]),[B,H]=(0,s.useState)(null);(0,s.useEffect)(()=>{if(!M||!z.current)return;let e=z.current.getBoundingClientRect();H({top:e.bottom+4,left:e.left,width:Math.max(e.width,240)})},[M]);let K=M&&B&&v?(0,m.createPortal)((0,n.jsx)("div",{ref:L,className:"fixed z-50 rounded-xl border border-border/50 bg-card shadow-lg py-1 animate-in fade-in-0 slide-in-from-top-1 duration-100",style:{top:B.top,left:B.left,minWidth:B.width,maxWidth:320},role:"listbox",children:v.map(e=>{let t=e.id===y,r=k(e),s="(empty session)"===r?C.hints?.newChat??"New chat":r;return T===e.id?(0,n.jsx)("div",{className:"flex items-center gap-1 px-2 py-1.5",children:(0,n.jsx)("input",{ref:$,type:"text",value:P,onChange:e=>D(e.target.value),onKeyDown:e=>{"Enter"===e.key&&F(),"Escape"===e.key&&I(null)},onBlur:F,className:"flex-1 min-w-0 px-2 py-1 text-xs rounded-md border border-border bg-background text-foreground outline-none focus:border-[var(--amber)]/50",placeholder:"Session name..."})},e.id):(0,n.jsxs)("div",{className:"group/item flex items-center",children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":t,onClick:()=>O(e.id),className:`flex-1 min-w-0 flex items-center gap-2 px-3 py-2 text-xs text-left transition-colors ${t?"text-foreground font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,children:[e.pinned&&(0,n.jsx)(J.A,{size:10,className:"shrink-0 text-[var(--amber)]/60 -rotate-45"}),t&&!e.pinned&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"}),(0,n.jsx)("span",{className:"truncate",children:s})]}),(0,n.jsxs)("div",{className:"shrink-0 flex items-center gap-0.5 mr-1 opacity-0 group-hover/item:opacity-100 transition-opacity",children:[A&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),A(e.id)},className:`p-1.5 rounded-md transition-colors ${e.pinned?"text-[var(--amber)] hover:text-muted-foreground hover:bg-muted/60":"text-muted-foreground/40 hover:text-[var(--amber)] hover:bg-[var(--amber)]/5"}`,"aria-label":e.pinned?"Unpin":"Pin",children:e.pinned?(0,n.jsx)(eA.A,{size:10}):(0,n.jsx)(J.A,{size:10})}),N&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),U(e.id,r)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-foreground hover:bg-muted/60","aria-label":`Rename: ${s}`,children:(0,n.jsx)(Q.A,{size:10})}),v.length>1&&j&&(0,n.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),j(e.id)},className:"p-1.5 rounded-md text-muted-foreground/40 hover:text-error hover:bg-error/5","aria-label":`Delete: ${s}`,children:(0,n.jsx)(X.A,{size:10})})]})]},e.id)})}),document.body):null;return(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2.5 shrink-0",children:[!e&&(0,n.jsx)("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-8 h-1 rounded-full bg-muted-foreground/20 md:hidden"}),!b&&(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,n.jsx)("div",{className:"w-6 h-6 rounded-lg bg-[var(--amber)]/10 flex items-center justify-center shrink-0",children:(0,n.jsx)(f.A,{size:13,className:"text-[var(--amber)]"})}),S&&_?(0,n.jsxs)("button",{ref:z,type:"button",onClick:()=>{v&&v.length>=2?R(e=>!e):r()},className:"flex items-center gap-1 min-w-0 text-sm font-medium text-[var(--amber)] hover:text-[var(--amber)]/80 transition-colors","aria-expanded":M,"aria-haspopup":"listbox",children:[(0,n.jsx)("span",{className:"truncate max-w-[180px]",children:"(empty session)"===_?C.hints?.newChat??"New chat":_}),(0,n.jsx)(h.A,{size:12,className:`shrink-0 text-muted-foreground transition-transform duration-150 ${M?"rotate-180":""}`})]}):_?(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground/60 truncate max-w-[180px]",children:"(empty session)"===_?C.hints?.newChat??"New chat":_}):(0,n.jsx)("span",{className:"text-sm font-medium text-muted-foreground/40",children:C.hints?.newChat??"New chat"})]}),b&&(0,n.jsx)("div",{}),(0,n.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),r()},"aria-pressed":t,className:`p-2 rounded-lg transition-colors ${t?"bg-[var(--amber)]/10 text-[var(--amber)]":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,title:C.hints.sessionHistory,children:(0,n.jsx)(et.A,{size:14})}),(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a()},disabled:o,className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors disabled:opacity-40",title:C.hints.newSession,children:(0,n.jsx)(eS.A,{size:14})}),u&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),u()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:l?C.hints.restorePanel:C.hints.maximizePanel,children:l?(0,n.jsx)(eE.A,{size:14}):(0,n.jsx)(e_.A,{size:14})}),p&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),p()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"popup"===d?C.hints.dockToSide:C.hints.openAsPopup,children:"popup"===d?(0,n.jsx)(eM.A,{size:14}):(0,n.jsx)(eR.A,{size:14})}),x&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),x()},className:"p-2 rounded-lg hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:C.hints.closePanel,"aria-label":"Close",children:(0,n.jsx)(i.A,{size:14})})]}),"u">typeof document&&K]})});var eL=r(56558),eT=r(49619),eI=r(38798);let eP={kb:{icon:o.A,cls:"text-muted-foreground"},upload:{icon:eL.A,cls:"text-muted-foreground"},image:{icon:l.A,cls:"text-muted-foreground"},skill:{icon:L.A,cls:"text-[var(--amber)]"},agent:{icon:eT.A,cls:"text-muted-foreground"}},eD={kb:"border-border bg-muted text-foreground",upload:"border-border bg-muted text-foreground",image:"border-border bg-muted text-foreground",skill:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground",agent:"border-[var(--amber)]/25 bg-[var(--amber)]/10 text-foreground"};function e$({path:e,onRemove:t,variant:r="kb",imageData:a,imageMime:o,status:l,error:u,truncatedInfo:d}){let[c,p]=(0,s.useState)(!1),[f,g]=(0,s.useState)(!1),[h,x]=(0,s.useState)(!1),b=(0,s.useRef)(null),[v,y]=(0,s.useState)(null),[k,w]=(0,s.useState)(null);(0,s.useEffect)(()=>x(!0),[]);let j="kb"===r&&e.endsWith("/"),N=j?e.slice(0,-1):e,A=N.split("/").pop()??N,C="kb"===r&&!j&&A.endsWith(".csv"),{icon:S,cls:E}=j?{icon:eI.A,cls:"text-yellow-400"}:C?{icon:en.A,cls:"text-success"}:eP[r],_=!!d,M=null,R="";"loading"===l?(M=T.A,R="text-muted-foreground animate-spin"):"error"===l?(M=U.A,R="text-destructive"):_?(M=ea.A,R="text-amber-500"):"success"===l&&(M=eo.A,R="text-emerald-500");let z="error"===l?"border-destructive/30 bg-destructive/5 text-foreground":_?"border-amber-500/30 bg-amber-500/5 text-foreground":eD[r],L=null;if("error"===l&&u)L=u;else if(_){let e=d.totalChars>0?Math.round(d.includedChars/d.totalChars*100):0;L=`Document truncated — only ${e}% included (${Math.round(d.includedChars/1e3)}K / ${Math.round(d.totalChars/1e3)}K chars, ${d.totalPages} pages total)`}(0,s.useEffect)(()=>{if(!c||!b.current)return void y(null);let e=b.current.getBoundingClientRect();y({top:e.top-8,left:e.left})},[c]),(0,s.useEffect)(()=>{if(!f||!b.current)return void w(null);let e=b.current.getBoundingClientRect();w({top:e.top-8,left:e.left})},[f]);let I=c&&v&&a&&o?(0,n.jsx)("div",{className:"fixed z-50 p-1 rounded-lg border border-border bg-card shadow-lg pointer-events-none",style:{left:v.left,bottom:window.innerHeight-v.top},children:(0,n.jsx)("img",{src:`data:${o};base64,${a}`,alt:A,className:"max-h-48 max-w-64 rounded object-contain"})}):null,P=f&&k&&L?(0,n.jsx)("div",{className:`fixed z-50 px-2.5 py-1.5 rounded-lg border bg-card text-xs shadow-lg pointer-events-none max-w-[280px] ${"error"===l?"border-destructive/20 text-destructive":"border-amber-500/20 text-amber-600 dark:text-amber-400"}`,style:{left:k.left,bottom:window.innerHeight-k.top},children:L}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{ref:b,className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-xs border max-w-[220px] ${z}`,onMouseEnter:()=>{a&&p(!0),L&&g(!0)},onMouseLeave:()=>{p(!1),g(!1)},children:[(0,n.jsx)(S,{size:11,className:`${E} shrink-0`}),(0,n.jsx)("span",{className:"truncate",title:j?N:e,children:A}),M&&(0,n.jsx)(M,{size:10,className:`${R} shrink-0`}),(0,n.jsx)("button",{type:"button",onClick:t,"aria-label":`Remove ${A}`,className:"p-0.5 -mr-1 rounded hover:text-foreground transition-colors shrink-0 text-muted-foreground",children:(0,n.jsx)(i.A,{size:10})})]}),h&&I&&(0,m.createPortal)(I,document.body),h&&P&&(0,m.createPortal)(P,document.body)]})}function eO({selectedAgent:e,onSelect:t,installedAgents:r,loading:a=!1}){let{t:o}=(0,c.Y)(),l=o.panels.agents,[u,d]=(0,s.useState)(!1),[p,f]=(0,s.useState)(null),x=(0,s.useRef)(null),b=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!u||!x.current)return;let e=x.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>200?"up":"down";f({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[u]),(0,s.useEffect)(()=>{if(!u)return;let e=e=>{let t=e.target;x.current&&!x.current.contains(t)&&b.current&&!b.current.contains(t)&&d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]),(0,s.useEffect)(()=>{if(!u)return;let e=e=>{"Escape"===e.key&&d(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u]),(0,s.useEffect)(()=>{if(!u||!x.current)return;let e=()=>{if(!x.current)return;let e=x.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>200?"up":"down";f({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[u]);let v=(0,s.useCallback)(()=>{t(null),d(!1)},[t]),y=(0,s.useCallback)(e=>{t({id:e.id,name:e.name}),d(!1)},[t]),k=(0,s.useCallback)(e=>{e.stopPropagation(),t(null)},[t]),w=!e,j=e?.name??l.acpDefaultAgent;if(!a&&0===r.length&&!e)return null;let N=u&&p?(0,n.jsxs)("div",{ref:b,role:"listbox","aria-label":l.acpSelectAgent,className:"fixed z-50 min-w-[180px] max-w-[240px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:p.left,..."up"===p.direction?{bottom:window.innerHeight-p.top}:{top:p.top}},children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":w,onClick:v,className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eT.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsx)("span",{className:"flex-1 truncate font-medium",children:l.acpDefaultAgent}),w&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]}),r.length>0&&(0,n.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),r.map(t=>{let r=e?.id===t.id;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":r,onClick:()=>y(t),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)("span",{className:"w-2 h-2 rounded-full bg-[var(--success)] shrink-0"}),(0,n.jsx)("span",{className:"flex-1 truncate",children:t.name}),r&&(0,n.jsx)(g.A,{size:11,className:"shrink-0 text-[var(--amber)]"})]},t.id)})]}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:x,type:"button",onClick:()=>d(e=>!e),className:`
|
|
10
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
11
|
+
text-2xs font-medium transition-colors
|
|
12
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
13
|
+
${w?"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground":"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15"}
|
|
14
|
+
`,title:l.acpChangeAgent,"aria-expanded":u,"aria-haspopup":"listbox",children:[w?(0,n.jsx)(eT.A,{size:11,className:"shrink-0 text-muted-foreground"}):(0,n.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-[var(--success)] shrink-0"}),(0,n.jsx)("span",{className:"truncate max-w-[120px]",children:j}),e?(0,n.jsx)("span",{role:"button",tabIndex:0,onClick:k,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),k(e))},className:"p-0.5 -mr-1 rounded-full text-muted-foreground hover:text-foreground transition-colors","aria-label":`Remove ${e.name}`,children:(0,n.jsx)(i.A,{size:9})}):(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&N&&(0,m.createPortal)(N,document.body)]})}var eU=r(89363),eF=r(65576),eB=r(47376);let eH="mindos-provider-override";function eK(e){try{e?localStorage.setItem(eH,e):localStorage.removeItem(eH)}catch{}}function eZ({value:e,onChange:t,disabled:r=!1}){let{t:a,locale:o}=(0,c.Y)(),[l,i]=(0,s.useState)(!1),[u,d]=(0,s.useState)(null),p=(0,s.useRef)(null),f=(0,s.useRef)(null),[x,b]=(0,s.useState)(null);(0,s.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/settings",{cache:"no-store"}).then(e=>e.json()).then(t=>{e||b(t)}).catch(()=>{})};t();let r=()=>{"visible"===document.visibilityState&&t()},n=()=>t();return document.addEventListener("visibilitychange",r),window.addEventListener("mindos:settings-changed",n),()=>{e=!0,document.removeEventListener("visibilitychange",r),window.removeEventListener("mindos:settings-changed",n)}},[]);let v=x?.ai?.provider&&(0,eB.rl)(x.ai.provider)?x.ai.provider:"anthropic",y=(0,s.useMemo)(()=>x?function(e){let t=[],r=e.ai?.providers??{},n=e.envOverrides??{};for(let s of eB.jt){let a=eB.T_[s],o=r[s]?.apiKey==="***set***",l=(0,eB.Ux)(s),i=!!l&&!!n[l];if(o||i)t.push(s);else if(a.apiKeyFallback){let n=e.ai?.provider===s,a=r[s];(n||a&&(a.model||a.baseUrl))&&t.push(s)}}return t}(x):[],[x]);(0,s.useEffect)(()=>{x&&e&&(y.includes(e)||(t(null),eK(null)))},[x,e,y,t]);let k=e??v,w=eB.T_[k],j=x?.ai?.providers?.[k]?.model||w.defaultModel,N="zh"===o?w.nameZh:w.name,A=(0,s.useCallback)(()=>{if(!p.current)return;let e=p.current.getBoundingClientRect(),t=e.top,r=t>window.innerHeight-e.bottom&&t>240?"up":"down";d({left:e.left,top:"up"===r?e.top-6:e.bottom+6,direction:r})},[]);(0,s.useEffect)(()=>{l&&A()},[l,A]),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{let t=e.target;p.current&&!p.current.contains(t)&&f.current&&!f.current.contains(t)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l]),(0,s.useEffect)(()=>{if(!l)return;let e=e=>{"Escape"===e.key&&i(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[l]),(0,s.useEffect)(()=>{if(l)return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[l,A]);let C=(0,s.useCallback)(e=>{t(e),eK(e),i(!1)},[t]);if(!x||0===y.length)return null;let S=j.length>24?j.slice(0,22)+"…":j,E=l&&u?(0,n.jsxs)("div",{ref:f,role:"listbox","aria-label":a.ask.providerCapsule,className:"fixed z-50 min-w-[200px] max-w-[280px] rounded-lg border border-border bg-card shadow-lg py-1 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:u.left,..."up"===u.direction?{bottom:window.innerHeight-u.top}:{top:u.top}},children:[(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":null===e,onClick:()=>C(null),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eU.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:a.ask.providerDefault}),(0,n.jsxs)("div",{className:"text-2xs text-muted-foreground mt-0.5",children:["zh"===o?eB.T_[v].nameZh:eB.T_[v].name," \xb7 ",x?.ai?.providers?.[v]?.model||eB.T_[v].defaultModel]})]}),null===e&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]}),y.length>0&&(0,n.jsx)("div",{className:"mx-2 my-1 border-t border-border/60"}),y.map(t=>{let r=eB.T_[t],s="zh"===o?r.nameZh:r.name,a=x?.ai?.providers?.[t]?.model||r.defaultModel,l=e===t;return(0,n.jsxs)("button",{type:"button",role:"option","aria-selected":l,onClick:()=>C(t),className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs text-left transition-colors hover:bg-muted",children:[(0,n.jsx)(eF.A,{size:12,className:"shrink-0 text-muted-foreground"}),(0,n.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,n.jsx)("div",{className:"font-medium",children:s}),(0,n.jsx)("div",{className:"text-2xs text-muted-foreground mt-0.5 truncate",children:a})]}),l&&(0,n.jsx)(g.A,{size:12,className:"shrink-0 text-[var(--amber)]"})]},t)})]}):null;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{ref:p,type:"button",onClick:()=>{r||i(e=>!e)},disabled:r,className:`
|
|
15
|
+
inline-flex items-center gap-1 rounded-full px-2.5 py-0.5
|
|
16
|
+
text-2xs font-medium transition-colors select-none
|
|
17
|
+
border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
18
|
+
disabled:opacity-40 disabled:cursor-not-allowed
|
|
19
|
+
${e?"bg-[var(--amber)]/10 border-[var(--amber)]/25 text-foreground hover:bg-[var(--amber)]/15":"bg-muted/50 border-border/50 text-muted-foreground hover:bg-muted hover:text-foreground"}
|
|
20
|
+
`,title:a.ask.providerCapsule,"aria-expanded":l,"aria-haspopup":"listbox",children:[(0,n.jsx)(eF.A,{size:11,className:"shrink-0"}),(0,n.jsxs)("span",{className:"truncate max-w-[140px]",children:[N,(0,n.jsx)("span",{className:"text-muted-foreground",children:" \xb7 "}),(0,n.jsx)("span",{className:"text-muted-foreground",children:S})]}),(0,n.jsx)(h.A,{size:10,className:"shrink-0 text-muted-foreground"})]}),"u">typeof document&&E&&(0,m.createPortal)(E,document.body)]})}var eY=r(68589);let eW=new Set([401,403,429]),eq=[/api.?key/i,/model.*not.?found/i,/authentication/i,/unauthorized/i,/forbidden/i];var eQ=r(91337),eG=r(2431);let eJ=new WeakMap;function eX({visible:e,currentFile:t,initialMessage:r,initialAcpAgent:m,onFirstMessage:p,variant:f,onClose:g,maximized:h,onMaximize:b,askMode:k,onModeSwitch:z}){let L="panel"===f,T="home"===f,I=(0,s.useRef)(null),P=(0,s.useRef)(null),{t:D}=(0,c.Y)(),[$,O]=(0,s.useState)(!1);(0,s.useEffect)(()=>O(!0),[]);let[U,F]=(0,s.useState)(""),B=(0,s.useRef)("");B.current=U;let[H,K]=(0,s.useState)([]),Z=(0,s.useRef)(H);Z.current=H;let[Y,W]=(0,s.useState)(!1),[q,Q]=(0,s.useState)(!1),[G,J]=(0,s.useState)(!1),[X,V]=(0,s.useState)(null),ee=(0,s.useRef)(X);ee.current=X;let[et,er]=(0,s.useState)(null),en=(0,s.useRef)(et);en.current=et;let[es,ea]=(0,s.useState)("agent"),[eo,el]=(0,s.useState)(null);(0,s.useEffect)(()=>{ea(function(){try{let e=localStorage.getItem(x);if("chat"===e||"agent"===e)return e}catch{}return"agent"}()),el(function(){try{let e=localStorage.getItem(eH);if(e&&(0,eB.rl)(e))return e}catch{}return null}())},[]);let ei=function(e){let[t,r]=(0,s.useState)([]),[n,a]=(0,s.useState)([]),[o,l]=(0,s.useState)(null),i=(0,s.useRef)(null),u=(0,s.useCallback)(async()=>{let t=(await w()).sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30),n=t.filter(e=>0===e.messages.length).map(e=>e.id),s=n.length>0?t.filter(e=>!n.includes(e.id)):t;n.length>0&&A(n);let o=y(e),i=e?s.find(t=>t.currentFile===e):s[0];i?(l(i.id),r(i.messages),a([...s])):(l(o.id),r([]),a([o,...s].slice(0,30)))},[e]),d=(0,s.useCallback)((t,r)=>{if(!r||0===t.length)return;let n=null;a(s=>{let a=Date.now(),o=s.find(e=>e.id===r);n=o?{...o,currentFile:e,updatedAt:a,messages:t}:{id:r,currentFile:e,createdAt:a,updatedAt:a,messages:t};let l=s.filter(e=>e.id!==r);return[n,...l].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30)}),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{n&&j(n)},600)},[e]),c=(0,s.useCallback)(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]),m=(0,s.useCallback)(()=>{a(t=>{let n=t.find(e=>e.id===o);if(n&&0===n.messages.length)return t;let s=y(e);return l(s.id),r([]),[s,...t].sort((e,t)=>t.updatedAt-e.updatedAt).slice(0,30)})},[e,o]),p=(0,s.useCallback)(e=>{let t=n.find(t=>t.id===e);if(!t)return;let s=o?n.find(e=>e.id===o):null;s&&0===s.messages.length&&s.id!==e&&a(e=>e.filter(e=>e.id!==s.id)),l(t.id),r(t.messages)},[n,o]),f=(0,s.useCallback)(t=>{let s=n.find(e=>e.id===t);s&&s.messages.length>0&&N(t);let i=n.filter(e=>e.id!==t);if(a(i),o===t){let t=y(e);l(t.id),r([]),a([t,...i].slice(0,30))}},[o,e,n]),g=(0,s.useCallback)((e,t)=>{let r=t.trim();a(t=>{let n=t.findIndex(t=>t.id===e);if(n<0)return t;let s={...t[n],title:r||void 0},a=[...t];return a[n]=s,j(s),a})},[]),h=(0,s.useCallback)(e=>{a(t=>{let r=t.findIndex(t=>t.id===e);if(r<0)return t;let n={...t[r],pinned:!t[r].pinned},s=[...t];return s[r]=n,n.messages.length>0&&j(n),s})},[]),x=(0,s.useCallback)(()=>{let t=n.filter(e=>e.messages.length>0).map(e=>e.id);t.length>0&&A(t);let s=y(e);l(s.id),r([]),a([s])},[e,n]);return{messages:t,setMessages:r,sessions:[...n].sort((e,t)=>e.pinned&&!t.pinned?-1:!e.pinned&&t.pinned?1:t.updatedAt-e.updatedAt),activeSessionId:o,initSessions:u,persistSession:d,clearPersistTimer:c,resetSession:m,loadSession:p,deleteSession:f,renameSession:g,togglePinSession:h,clearAllSessions:x}}(t),eu=(0,s.useRef)(ei);eu.current=ei;let ed=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(""),a=(0,s.useRef)(null),o=(0,s.useCallback)(async e=>{if(!e||0===e.length)return;let r=Array.from(e).slice(0,8),s=[],a=[];for(let e of r){let t=S(e.name);C.has(t)?s.push(e):a.push(e.name)}a.length>0?n(`Unsupported file type: ${a.join(", ")}`):n("");let o=[],l=[];for(let e of s)".pdf"===S(e.name)?(l.push({name:e.name,content:"",status:"loading"}),o.push(e)):l.push({name:e.name,content:await e.text(),status:"success"});if(t(e=>{let t=[...e];for(let e of l)t.some(t=>t.name===e.name)||t.push(e);return t}),o.length>0){let e=await Promise.all(o.map(E));t(t=>t.map(t=>"loading"!==t.status?t:e.find(e=>e.name===t.name)??t))}},[]),l=(0,s.useCallback)(e=>{t(t=>t.filter((t,r)=>r!==e))},[]);return{localAttachments:e,uploadError:r,uploadInputRef:a,pickFiles:o,removeAttachment:l,clearAttachments:(0,s.useCallback)(()=>{t([]),n("")},[]),injectFiles:(0,s.useCallback)(e=>{t(t=>{let r=[...t];for(let t of e)r.some(e=>e.name===t.name)||r.push(t);return r})},[])}}(),ec=(0,s.useRef)(ed);ec.current=ed;let em=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(""),a=(0,s.useCallback)(async e=>{n("");let r=e.slice(0,4),s=[];for(let e of r){var a;if(a=e.type,!_.has(a)){n(`Unsupported image type: ${e.type}`);continue}try{let{data:t,mimeType:r}=await M(e);s.push({type:"image",data:t,mimeType:r,fileName:e.name||void 0})}catch{n(`Failed to process image: ${e.name}`)}}t(e=>{let t=[...e,...s];return t.length>4?(n("Maximum 4 images allowed"),t.slice(0,4)):t})},[]),o=(0,s.useCallback)(async e=>{let t=e.clipboardData?.items;if(!t)return!1;let r=R(t);return 0!==r.length&&(await a(r),!0)},[a]),l=(0,s.useCallback)(async e=>{let t=e.dataTransfer?.items;if(!t)return;let r=R(t);r.length>0&&(e.preventDefault(),await a(r))},[a]),i=(0,s.useCallback)(async e=>{if(!e)return;let t=Array.from(e).filter(e=>{var t;return t=e.type,_.has(t)});await a(t)},[a]);return{images:e,imageError:r,addImages:a,handlePaste:o,handleDrop:l,handleFileSelect:i,removeImage:(0,s.useCallback)(e=>{t(t=>t.filter((t,r)=>r!==e))},[]),clearImages:(0,s.useCallback)(()=>{t([]),n("")},[])}}(),ep=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(null),[a,o]=(0,s.useState)([]),[l,i]=(0,s.useState)(0),u=(0,s.useCallback)(()=>{fetch("/api/files").then(e=>e.ok?e.json():[]).then(e=>Array.isArray(e)?e:[]).catch(()=>[]).then(t)},[]);(0,s.useEffect)(()=>{u();let e=()=>u();return window.addEventListener("mindos:files-changed",e),()=>window.removeEventListener("mindos:files-changed",e)},[u]);let d=(0,s.useCallback)((t,r)=>{let s=r??t.length,a=t.slice(0,s),l=a.lastIndexOf("@");if(-1===l||l>0&&" "!==a[l-1]&&"\n"!==a[l-1])return void n(null);let u=a.slice(l+1);if(u.includes(" ")||u.includes("\n")){n(null),o([]),i(0);return}let d=u.toLowerCase();if(!d){n(u),o(e.slice(0,30)),i(0);return}let c=e.map(e=>{let t=(e.split("/").pop()??e).toLowerCase(),r=e.toLowerCase(),n=0;return t.startsWith(d)?n=100:t.includes(d)?n=50:r.includes(d)&&(n=10),{path:e,score:n}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,30);if(0===c.length){n(null),o([]),i(0);return}n(u),o(c.map(e=>e.path)),i(0)},[e]),c=(0,s.useCallback)(e=>{0!==a.length&&("down"===e?i(e=>Math.min(e+1,a.length-1)):i(e=>Math.max(e-1,0)))},[a.length]);return{mentionQuery:r,mentionResults:a,mentionIndex:l,updateMentionFromInput:d,navigateMention:c,resetMention:(0,s.useCallback)(()=>{n(null),o([]),i(0)},[])}}(),ef=function(){let[e,t]=(0,s.useState)([]),[r,n]=(0,s.useState)(null),[a,o]=(0,s.useState)([]),[l,i]=(0,s.useState)(0),u=(0,s.useRef)(!1),d=(0,s.useCallback)(async()=>{t((await fetch("/api/skills").then(e=>e.ok?e.json():{skills:[]}).then(e=>Array.isArray(e?.skills)?e.skills:[]).catch(()=>[])).filter(e=>e.enabled)),u.current=!0},[]);(0,s.useEffect)(()=>{d();let e=()=>d();return window.addEventListener("mindos:skills-changed",e),()=>window.removeEventListener("mindos:skills-changed",e)},[d]);let c=(0,s.useCallback)((t,r)=>{let s=t.slice(0,r),a=s.lastIndexOf("/");if(-1===a||a>0&&" "!==s[a-1]&&"\n"!==s[a-1])return void n(null);let l=s.slice(a+1);if(l.includes(" "))return void n(null);if(!u.current){d(),n(null);return}let c=l.toLowerCase(),m=c?e.map(e=>{let t=e.name.toLowerCase(),r=0;return t.startsWith(c)?r=100:t.includes(c)?r=50:e.description.toLowerCase().includes(c)&&(r=10),{s:e,score:r}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,20).map(e=>({type:"skill",name:e.s.name,description:e.s.description})):e.slice(0,20).map(e=>({type:"skill",name:e.name,description:e.description}));if(0===m.length){n(null),o([]),i(0);return}n(l),o(m),i(0)},[e,d]),m=(0,s.useCallback)(e=>{0!==a.length&&("down"===e?i(e=>Math.min(e+1,a.length-1)):i(e=>Math.max(e-1,0)))},[a.length]);return{slashQuery:r,slashResults:a,slashIndex:l,updateSlashFromInput:c,navigateSlash:m,resetSlash:(0,s.useCallback)(()=>{n(null),o([]),i(0)},[])}}(),eg=(0,eG.z)(),eh=(0,s.useRef)(em);eh.current=em;let ex=(0,s.useRef)(ep);ex.current=ep;let eb=(0,s.useRef)(ef);eb.current=ef;let ev=(0,s.useCallback)(()=>{F(""),V(null),er(null),K(t?[t]:[])},[t]),ey=(0,s.useRef)({inputValueRef:B,mentionRef:ex,slashRef:eb,imageUploadRef:eh,sessionRef:eu,uploadRef:ec,selectedSkillRef:ee,selectedAcpAgentRef:en,attachedFilesRef:Z}),ew=function({currentFile:e,chatMode:t,providerOverride:r,onFirstMessage:n,refs:a,errorLabels:o,resetInputState:l}){let[i,u]=(0,s.useState)(!1),[d,c]=(0,s.useState)("connecting"),[m,p]=(0,s.useState)(0),f=(0,s.useRef)(3),g=(0,s.useRef)(null),h=(0,s.useRef)(!1),x=(0,s.useCallback)(()=>{g.current?.abort()},[]),b=(0,s.useCallback)(async s=>{s.preventDefault();let i=a.mentionRef.current,d=a.slashRef.current,m=a.imageUploadRef.current,x=a.sessionRef.current,b=a.uploadRef.current;if(!i||!d||!m||!x||!b||null!==i.mentionQuery||null!==d.slashQuery)return;let y=a.inputValueRef.current?.trim()??"";if(!y&&0===m.images.length||v.current)return;let k=a.selectedSkillRef.current,w=a.selectedAcpAgentRef.current,j=m.images.length>0?[...m.images]:void 0,N={role:"user",content:y,timestamp:Date.now(),...k&&{skillName:k.name},...j&&{images:j}};m.clearImages();let A=[...x.messages,N];x.setMessages([...A,{role:"assistant",content:"",timestamp:Date.now()}]),l(),n&&!h.current&&(h.current=!0,n()),u(!0),c("connecting"),p(0);let C=new AbortController;g.current=C;let S=3;try{let e=localStorage.getItem("mindos-reconnect-retries");if(null!==e){let t=parseInt(e,10);Number.isFinite(t)&&(S=Math.max(0,Math.min(10,t)))}}catch{}f.current=S;let E=JSON.stringify({messages:A,currentFile:e,attachedFiles:a.attachedFilesRef.current,uploadedFiles:b.localAttachments.filter(e=>"loading"!==e.status).map(e=>({name:e.name,content:e.content.length>8e4?e.content.slice(0,8e4)+"\n\n[...truncated to first ~80000 chars]":e.content})),selectedAcpAgent:w,mode:t,providerOverride:r??void 0}),_=async()=>{let e=await fetch("/api/ask",{method:"POST",headers:{"Content-Type":"application/json"},body:E,signal:C.signal});if(!e.ok){let t=`Request failed (${e.status})`;try{let r=await e.json();"string"==typeof r?.error&&r.error.trim()?t=r.error:"object"==typeof r?.error&&"string"==typeof r.error?.message&&r.error.message.trim()?t=r.error.message:"string"==typeof r?.message&&r.message.trim()&&(t=r.message)}catch(e){console.warn("[useAskChat] error body parse failed:",e)}let r=Error(t);throw r.httpStatus=e.status,r}if(!e.body)throw Error("No response body");return c("thinking"),{finalMessage:await (0,eY.m)(e.body,e=>{c("streaming"),a.sessionRef.current?.setMessages(t=>{let r=[...t];return r[r.length-1]=e,r})},C.signal)}};try{let e=null;for(let t=0;t<=S&&!C.signal.aborted;t++){if(t>0){var M;p(t),c("reconnecting"),a.sessionRef.current?.setMessages(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:"",timestamp:Date.now()},t}),await function(e,t){return new Promise((r,n)=>{let s=()=>t?.reason??new DOMException("The operation was aborted.","AbortError");if(t?.aborted)return void n(s());let a=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(a),n(s())},{once:!0})})}((M=t-1,Math.min(1e3*2**M,1e4)),C.signal),c("connecting")}try{let{finalMessage:e}=await _();e.content.trim()||e.parts&&0!==e.parts.length||a.sessionRef.current?.setMessages(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:`__error__${o.noResponse}`},t});return}catch(n){e=n instanceof Error?n:Error(String(n));let r=n.httpStatus;if(!function(e,t){if(e instanceof DOMException&&"AbortError"===e.name||t&&eW.has(t))return!1;if(e instanceof Error){let t=e.message;if(eq.some(e=>e.test(t)))return!1}return!0}(n,r)||t>=S)break}}if(e)throw e}catch(e){if("AbortError"===e.name)a.sessionRef.current?.setMessages(e=>{let t=[...e],r=t.length-1;if(r>=0&&"assistant"===t[r].role){let e=t[r];e.content.trim()||e.parts&&e.parts.length>0||(t[r]={role:"assistant",content:`__error__${o.stopped}`})}return t});else{let t=e instanceof Error?e.message:"Something went wrong";a.sessionRef.current?.setMessages(e=>{let r=[...e],n=r.length-1;if(n>=0&&"assistant"===r[n].role){let e=r[n];if(!(e.content.trim()||e.parts&&e.parts.length>0))return r[n]={role:"assistant",content:`__error__${t}`},r}return[...r,{role:"assistant",content:`__error__${t}`}]})}}finally{u(!1),p(0),g.current=null}},[e,t,r,o.noResponse,o.stopped,n,a,l]),v=(0,s.useRef)(i);return v.current=i,{isLoading:i,isLoadingRef:v,loadingPhase:d,reconnectAttempt:m,reconnectMaxRef:f,abortRef:g,firstMessageFired:h,submit:b,stop:x}}({currentFile:t,chatMode:es,providerOverride:eo,onFirstMessage:p,refs:ey.current,errorLabels:{noResponse:D.ask.errorNoResponse,stopped:D.ask.stopped},resetInputState:ev}),{isLoading:eA,loadingPhase:eS,reconnectAttempt:eE,reconnectMaxRef:e_}=ew,eM=ew.submit,eR=ew.stop;(0,s.useEffect)(()=>{let e=e=>{let t=e.detail?.files;Array.isArray(t)&&t.length>0&&ec.current.injectFiles(t)};return window.addEventListener("mindos:inject-ask-files",e),()=>window.removeEventListener("mindos:inject-ask-files",e)},[]),(0,s.useEffect)(()=>{if(!T)return;let e=e=>{let t=e.detail?.text;"string"==typeof t&&(F(t),setTimeout(()=>I.current?.focus(),50))};return window.addEventListener("mindos:home-suggestion",e),()=>window.removeEventListener("mindos:home-suggestion",e)},[T]);let eL=(0,s.useRef)(!1),eT=(0,s.useRef)(t);(0,s.useEffect)(()=>{let n="panel"===f||"home"===f?e&&!eL.current:e,s=e&&eL.current&&t!==eT.current;n?(setTimeout(()=>I.current?.focus(),50),ei.initSessions(),F(r||""),ew.firstMessageFired.current=!1,K(t?[t]:[]),ed.clearAttachments(),em.clearImages(),ep.resetMention(),ef.resetSlash(),V(null),er(m??null),W(!1)):s?K(t?[t]:[]):e||"modal"!==f||ew.abortRef.current?.abort(),"home"===f&&e&&!eL.current&&setTimeout(()=>I.current?.focus(),150),eL.current=e,eT.current=t},[e,t]),(0,s.useEffect)(()=>{if(!e||!ei.activeSessionId)return;let t=ei.messages;if(ew.isLoading&&t.length>0){let e=t[t.length-1];if("assistant"===e.role&&!e.content.trim()&&(!e.parts||0===e.parts.length))return}return ei.persistSession(t,ei.activeSessionId),()=>ei.clearPersistTimer()},[e,ei.messages,ei.activeSessionId,ew.isLoading]),(0,s.useEffect)(()=>{if(!e||"home"===f)return;let t="modal"===f,r="panel"===f&&h;if(!t&&!r)return;let n=e=>{if("Escape"===e.key){if(null!==ex.current.mentionQuery)return void ex.current.resetMention();if(null!==eb.current.slashQuery)return void eb.current.resetSlash();if(r&&b)return void b();t&&g&&g()}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[f,e,g,h,b]),(0,s.useEffect)(()=>{if(!G)return;let e=()=>J(!1),t=setTimeout(()=>document.addEventListener("click",e),0);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[G]);let eI=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>{if(!e)return;let t=I.current;t&&t instanceof HTMLTextAreaElement&&function(e,t){let r=eJ.get(e);if(!r){let t=getComputedStyle(e),n=parseFloat(t.lineHeight),s=parseFloat(t.fontSize),a=Number.isFinite(s)?s:14,o=8*(Number.isFinite(n)?n:1.375*a)+((Number.isFinite(parseFloat(t.paddingTop))?parseFloat(t.paddingTop):0)+(Number.isFinite(parseFloat(t.paddingBottom))?parseFloat(t.paddingBottom):0));if(!Number.isFinite(o)||o<=0)return;r={maxH:o},eJ.set(e,r)}let{maxH:n}=r;e.style.height="auto";let s=e.scrollHeight,a=Math.min(s,n);e.style.height=`${a}px`,e.style.overflowY=s>n?"auto":"hidden"}(t,0)},[U,eA,e]),(0,s.useEffect)(()=>{let e=I.current;if(!e)return;let t=()=>eJ.delete(e);return window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]);let eP=(0,s.useRef)(null),eD=(0,s.useRef)(null),eU=(0,s.useCallback)((e,t)=>{F(e);let r=t??e.length;eP.current&&clearTimeout(eP.current),eD.current&&clearTimeout(eD.current),eP.current=setTimeout(()=>ex.current.updateMentionFromInput(e,r),80),eD.current=setTimeout(()=>eb.current.updateSlashFromInput(e,r),80)},[]);(0,s.useEffect)(()=>()=>{eP.current&&clearTimeout(eP.current),eD.current&&clearTimeout(eD.current)},[]);let eF=(0,s.useCallback)(e=>{let t=I.current,r=B.current,n=t?.selectionStart??r.length,s=r.slice(0,n).lastIndexOf("@");F(r.slice(0,s)+r.slice(n)),ex.current.resetMention(),Z.current.includes(e)||K(t=>[...t,e]),setTimeout(()=>{I.current?.focus(),I.current?.setSelectionRange(s,s)},0)},[]),eK=(0,s.useCallback)(e=>{let t=I.current,r=B.current,n=t?.selectionStart??r.length,s=r.slice(0,n).lastIndexOf("/");F(r.slice(0,s)+r.slice(n)),V(e),eb.current.resetSlash(),setTimeout(()=>{I.current?.focus(),I.current?.setSelectionRange(s,s)},0)},[]),eX=(0,s.useRef)(eF);eX.current=eF;let eV=(0,s.useRef)(eK);eV.current=eK;let e0=(0,s.useCallback)(e=>{let t=ex.current,r=eb.current;if(null!==t.mentionQuery){if("Escape"===e.key){e.preventDefault(),t.resetMention();return}if("ArrowDown"===e.key)e.preventDefault(),t.navigateMention("down");else if("ArrowUp"===e.key)e.preventDefault(),t.navigateMention("up");else if("Enter"===e.key||"Tab"===e.key){if("Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing))return;t.mentionResults.length>0&&(e.preventDefault(),eX.current(t.mentionResults[t.mentionIndex]))}return}if(null!==r.slashQuery){if("Escape"===e.key){e.preventDefault(),r.resetSlash();return}if("ArrowDown"===e.key)e.preventDefault(),r.navigateSlash("down");else if("ArrowUp"===e.key)e.preventDefault(),r.navigateSlash("up");else if("Enter"===e.key||"Tab"===e.key){if("Enter"===e.key&&(e.shiftKey||e.nativeEvent.isComposing))return;r.slashResults.length>0&&(e.preventDefault(),eV.current(r.slashResults[r.slashIndex]))}return}"Enter"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&!ew.isLoadingRef.current&&(B.current.trim()||eh.current.images.length>0)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},[]),e1=(0,s.useCallback)(()=>{ew.isLoadingRef.current||(eu.current.resetSession(),F(""),K(t?[t]:[]),ec.current.clearAttachments(),eh.current.clearImages(),ex.current.resetMention(),eb.current.resetSlash(),V(null),er(null),W(!1),ew.firstMessageFired.current=!1,setTimeout(()=>I.current?.focus(),0))},[t]),e5=(0,s.useCallback)(e=>{(e.dataTransfer.types.includes("text/mindos-path")||e.dataTransfer.types.includes("Files"))&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",Q(!0))},[]),e2=(0,s.useCallback)(()=>Q(!1),[]),e3=(0,s.useCallback)(async e=>{e.preventDefault(),e.stopPropagation(),Q(!1);let t=e.dataTransfer.getData("text/mindos-path");if(t){let r="directory"===e.dataTransfer.getData("text/mindos-type")?t.replace(/\/?$/,"/"):t;Z.current.includes(r)||K(e=>[...e,r]);return}let r=e.dataTransfer.files;if(r.length>0){Array.from(r).some(e=>e.type.startsWith("image/"))&&await eh.current.handleDrop(e);let t=Array.from(r).filter(e=>!e.type.startsWith("image/"));if(t.length>0){let e=new DataTransfer;t.forEach(t=>e.items.add(t)),await ec.current.pickFiles(e.files)}}},[]),e4=(0,s.useCallback)(e=>{let t=e.clipboardData?.items;!t||Array.from(t).some(e=>"file"===e.kind&&e.type.startsWith("image/"))&&(e.preventDefault(),eh.current.handlePaste(e))},[]),e8=(0,s.useCallback)(e=>{eu.current.loadSession(e),W(!1),F(""),K(t?[t]:[]),ec.current.clearAttachments(),eh.current.clearImages(),ex.current.resetMention(),eb.current.resetSlash(),V(null),er(null),setTimeout(()=>I.current?.focus(),0)},[t]),e6=(0,s.useCallback)(()=>W(e=>!e),[]),e7=(0,s.useMemo)(()=>({connecting:D.ask.connecting,thinking:D.ask.thinking,generating:D.ask.generating,reconnecting:eE>0?D.ask.reconnecting(eE,e_.current):void 0,copyMessage:D.ask.copyMessage}),[D,eE]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ez,{isPanel:L||T,showHistory:Y,onToggleHistory:e6,onReset:e1,isLoading:eA,maximized:h,onMaximize:b,askMode:T?void 0:k,onModeSwitch:T?void 0:z,onClose:T?void 0:g,sessions:ei.sessions,activeSessionId:ei.activeSessionId,onLoadSession:e8,onDeleteSession:ei.deleteSession,onRenameSession:ei.renameSession,onTogglePinSession:ei.togglePinSession}),Y&&(0,n.jsx)(eC,{sessions:ei.sessions,activeSessionId:ei.activeSessionId,onLoad:e8,onDelete:ei.deleteSession,onRename:ei.renameSession,onTogglePin:ei.togglePinSession,onClearAll:ei.clearAllSessions,labels:{title:D.ask.sessionHistory??"Session History",clearAll:D.ask.clearAll??"Clear all",confirmClear:D.ask.confirmClear??"Confirm clear?",noSessions:D.ask.noSessions??"No saved sessions.",rename:D.ask.renameSession??"Rename"}}),!T&&(0,n.jsx)(ek,{messages:ei.messages,isLoading:eA,loadingPhase:eS,emptyPrompt:D.ask.emptyPrompt,emptyHint:D.ask.emptyHint,suggestions:D.ask.suggestions,onSuggestionClick:F,labels:e7}),T&&ei.messages.length>0&&(0,n.jsx)(ek,{messages:ei.messages,isLoading:eA,loadingPhase:eS,emptyPrompt:D.ask.emptyPrompt,emptyHint:D.ask.emptyHint,suggestions:[],onSuggestionClick:F,labels:e7}),null!==ep.mentionQuery&&ep.mentionResults.length>0&&(0,n.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,n.jsx)(ej,{results:ep.mentionResults,selectedIndex:ep.mentionIndex,query:ep.mentionQuery??void 0,onSelect:eF})}),null!==ef.slashQuery&&ef.slashResults.length>0&&(0,n.jsx)("div",{className:"shrink-0 px-3 pb-1",children:(0,n.jsx)(eN,{results:ef.slashResults,selectedIndex:ef.slashIndex,query:ef.slashQuery??void 0,onSelect:eK})}),(0,n.jsx)("div",{className:"shrink-0 px-3 pb-2.5 pt-1",children:(0,n.jsxs)("div",{className:(0,eQ.cn)("rounded-xl bg-muted/40 transition-all focus-within:bg-muted/60",q&&"ring-2 ring-[var(--amber)] bg-[var(--amber-dim)]"),onDragOver:e5,onDragLeave:e2,onDrop:e3,children:[(H.length>0||ed.localAttachments.length>0||em.images.length>0||X||et||ed.uploadError||em.imageError)&&(0,n.jsxs)("div",{className:(0,eQ.cn)("px-3 pt-2.5 pb-1",L?"max-h-24 overflow-y-auto":"max-h-28 overflow-y-auto"),children:[(0,n.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[H.map(e=>(0,n.jsx)(e$,{path:e,variant:"kb",onRemove:()=>K(t=>t.filter(t=>t!==e))},e)),ed.localAttachments.map((e,t)=>(0,n.jsx)(e$,{path:e.name,variant:"upload",status:e.status,error:e.error,truncatedInfo:e.truncatedInfo,onRemove:()=>ed.removeAttachment(t)},`up-${e.name}-${t}`)),em.images.map((e,t)=>(0,n.jsx)(e$,{path:e.fileName||`Image ${t+1}`,variant:"image",imageData:e.data,imageMime:e.mimeType,onRemove:()=>em.removeImage(t)},`img-${t}`)),X&&(0,n.jsx)(e$,{path:X.name,variant:"skill",onRemove:()=>{V(null),I.current?.focus()}})]}),(ed.uploadError||em.imageError)&&(0,n.jsx)("div",{className:"mt-1 text-xs text-error",children:ed.uploadError||em.imageError})]}),(0,n.jsxs)("form",{ref:eI,onSubmit:eM,className:"flex items-end gap-1.5 px-3 py-2",children:[(0,n.jsxs)("div",{className:"relative shrink-0",children:[(0,n.jsx)("button",{type:"button",onClick:()=>J(e=>!e),className:"p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors",title:D.hints.attachFile,children:(0,n.jsx)(a.A,{size:15})}),G&&(0,n.jsxs)("div",{className:"absolute bottom-full left-0 mb-1.5 py-1 rounded-xl border border-border/60 bg-card shadow-lg z-50 min-w-[150px] animate-in fade-in-0 slide-in-from-bottom-2 duration-150",children:[(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{J(!1),ed.uploadInputRef.current?.click()},children:[(0,n.jsx)(o.A,{size:12,className:"shrink-0 text-muted-foreground"}),D.ask.attachFileLabel]}),(0,n.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2.5 px-3 py-2 text-xs hover:bg-muted transition-colors text-left rounded-lg",onClick:()=>{J(!1),P.current?.click()},children:[(0,n.jsx)(l.A,{size:12,className:"shrink-0 text-muted-foreground"}),D.ask.attachImageLabel]})]})]}),(0,n.jsx)("input",{ref:ed.uploadInputRef,type:"file",className:"hidden",multiple:!0,accept:".txt,.md,.markdown,.csv,.json,.yaml,.yml,.xml,.html,.htm,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf",onChange:async e=>{let t=e.currentTarget;await ed.pickFiles(t.files),t.value=""}}),(0,n.jsx)("input",{ref:P,type:"file",className:"hidden",multiple:!0,accept:"image/png,image/jpeg,image/gif,image/webp",onChange:async e=>{let t=e.currentTarget;await em.handleFileSelect(t.files),t.value=""}}),(0,n.jsx)("textarea",{ref:e=>{I.current=e},value:U,onChange:e=>eU(e.target.value,e.target.selectionStart??void 0),onKeyDown:e0,onPaste:e4,placeholder:D.ask.placeholder,rows:1,className:"min-w-0 flex-1 resize-none overflow-y-hidden bg-transparent py-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/50 outline-none focus-visible:ring-0"}),eA?(0,n.jsx)("button",{type:"button",onClick:eR,className:"p-2 rounded-xl transition-colors shrink-0 text-foreground bg-muted hover:bg-muted/80",title:"reconnecting"===eS?D.ask.cancelReconnect:D.ask.stopTitle,children:"reconnecting"===eS?(0,n.jsx)(i.A,{size:15}):(0,n.jsx)(u.A,{size:15})}):(0,n.jsx)("button",{type:"submit",disabled:!U.trim()&&0===em.images.length,className:"p-2 rounded-xl disabled:opacity-20 disabled:scale-95 disabled:cursor-not-allowed transition-all duration-150 shrink-0 bg-[var(--amber)] text-[var(--amber-foreground)] shadow-sm shadow-[var(--amber)]/15 hover:shadow-md hover:shadow-[var(--amber)]/20 active:scale-95",children:(0,n.jsx)(d.A,{size:14})})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between px-3 pb-2 pt-1.5 border-t border-border/10",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(v,{mode:es,onChange:ea,disabled:eA}),$&&eg.installedAgents.length>0&&(0,n.jsx)(eO,{selectedAgent:et,onSelect:er,installedAgents:eg.installedAgents,loading:eg.loading}),$&&(0,n.jsx)(eZ,{value:eo,onChange:el,disabled:eA})]}),(0,n.jsxs)("span",{className:"hidden md:inline text-2xs text-muted-foreground/40 select-none",children:[(0,n.jsx)("kbd",{className:"font-mono",children:"Enter"})," ",D.ask.send," \xb7 ",(0,n.jsx)("kbd",{className:"font-mono",children:"Shift+Enter"})," ",D.ask.newlineHint]})]})]})})]})}},59960:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(95155);function s({id:e,className:t="w-8 h-4"}){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 40",fill:"none",className:`${t} text-[var(--amber)]`,"aria-hidden":"true",children:[(0,n.jsxs)("defs",{children:[(0,n.jsxs)("linearGradient",{id:`grad-human-${e}`,x1:"35",y1:"20",x2:"5",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,n.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.3"})]}),(0,n.jsxs)("linearGradient",{id:`grad-agent-${e}`,x1:"35",y1:"20",x2:"75",y2:"20",gradientUnits:"userSpaceOnUse",children:[(0,n.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.8"}),(0,n.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"1"})]})]}),(0,n.jsx)("path",{d:"M35,20 C25,35 8,35 8,20 C8,5 25,5 35,20",stroke:`url(#grad-human-${e})`,strokeWidth:"3",strokeDasharray:"2 4",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M35,20 C45,2 75,2 75,20 C75,38 45,38 35,20",stroke:`url(#grad-agent-${e})`,strokeWidth:"4.5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M35,17.5 Q35,20 37.5,20 Q35,20 35,22.5 Q35,20 32.5,20 Q35,20 35,17.5 Z",fill:"#FEF3C7"})]})}},60392:e=>{function t(e){return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=60392,e.exports=t},68589:(e,t,r)=>{"use strict";r.d(t,{m:()=>s});let n=new Set(["write_file","create_file","batch_create_files","update_section","insert_after_heading","delete_file","rename_file","create_space"]);async function s(e,t,r){let s=e.getReader(),a=new TextDecoder,o="",l=[],i=new Map,u=null,d=null,c=Date.now();function m(){let e=l.map(e=>"text"===e.type?{type:"text",text:e.text}:"reasoning"===e.type?{type:"reasoning",text:e.text}:{...e});return{role:"assistant",content:e.filter(e=>"text"===e.type).map(e=>e.text).join(""),parts:e,timestamp:c}}try{for(;!r?.aborted;){let{done:e,value:r}=await s.read();if(e)break;let c=(o+=a.decode(r,{stream:!0})).split("\n");o=c.pop()??"";let p=!1;for(let e of c){let t,r=e.trim(),s=null;if(r.startsWith("data:")&&(s=r.slice(5).trim()),s){try{t=JSON.parse(s)}catch{continue}switch(t.type){case"text_delta":{let e=function(e){if(u===e){let e=l[l.length-1];if(e&&"text"===e.type)return e}let t={type:"text",text:""};return l.push(t),u=e,t}("text");e.text+=t.delta??"",p=!0;break}case"thinking_delta":d||(d={type:"reasoning",text:""},l.push(d),u=null),d.text+=t.delta??"",p=!0;break;case"tool_start":{let e=t.toolCallId,r=t.toolName,n=function(e,t){let r=i.get(e);return r||(r={type:"tool-call",toolCallId:e,toolName:t??"unknown",input:void 0,state:"pending"},i.set(e,r),l.push(r),u=null),r}(e,r);n.input=t.args,n.state="running",p=!0;break}case"tool_end":{let e=t.toolCallId,r=i.get(e);r&&(r.output=t.output??"",r.state=t.isError?"error":"done",p=!0,!t.isError&&n.has(r.toolName)&&window.dispatchEvent(new Event("mindos:files-changed")));break}case"error":{let e=t.message;l.push({type:"text",text:`
|
|
21
|
+
|
|
22
|
+
**Stream Error:** ${e}`}),u=null,p=!0}}}}p&&t(m())}}finally{s.releaseLock()}let p=!1;for(let e of i.values())("running"===e.state||"pending"===e.state)&&(e.state="error",e.output=e.output??"Stream ended before tool completed",p=!0);return p&&t(m()),m()}},76449:(e,t,r)=>{"use strict";r.d(t,{g:()=>n});let n=[{anchor:"files-panel",position:"right"},{anchor:"ask-button",position:"bottom"},{anchor:"agents-panel",position:"right"}]},84825:e=>{function t(e){return Promise.resolve().then(()=>{var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=()=>[],t.resolve=t,t.id=84825,e.exports=t}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9186],{1934:(e,t,r)=>{r.d(t,{v:()=>a});var n=r(12115);let o=e=>{let t,r=new Set,n=(e,n)=>{let o="function"==typeof e?e(t):e;if(!Object.is(o,t)){let e=t;t=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},t,o),r.forEach(r=>r(t,e))}},o=()=>t,u={setState:n,getState:o,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,o,u);return u},u=e=>{let t=e?o(e):o,r=e=>(function(e,t=e=>e){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},a=e=>e?u(e):u},10857:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return E},MissingStaticPage:function(){return v},NormalizeError:function(){return m},PageNotFoundError:function(){return b},SP:function(){return h},ST:function(){return y},WEB_VITALS:function(){return o},execOnce:function(){return u},getDisplayName:function(){return s},getLocationOrigin:function(){return i},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return f},loadGetInitialProps:function(){return p},normalizeRepeatedSlashes:function(){return d},stringifyError:function(){return _}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let o=["CLS","FCP","FID","INP","LCP","TTFB"];function u(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let a=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>a.test(e);function i(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=i();return e.substring(t.length)}function s(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function d(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function p(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await p(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${s(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return n}let h="u">typeof performance,y=h&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class m extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class v extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class E extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function _(e){return JSON.stringify({message:e.message,stack:e.stack})}},20091:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={formatUrl:function(){return l},formatWithValidation:function(){return c},urlObjectKeys:function(){return i}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388)._(r(31393)),a=/https?|ftp|gopher|file/;function l(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",l=e.hash||"",i=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),i&&"object"==typeof i&&(i=String(u.urlQueryToSearchParams(i)));let s=e.search||i&&`?${i}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||a.test(n))&&!1!==c?(c="//"+(c||""),o&&"/"!==o[0]&&(o="/"+o)):c||(c=""),l&&"#"!==l[0]&&(l="#"+l),s&&"?"!==s[0]&&(s="?"+s),o=o.replace(/[?#]/g,encodeURIComponent),s=s.replace("#","%23"),`${n}${c}${o}${s}${l}`}let i=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return l(e)}},21172:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=r(12115);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=u(e,n)),t&&(o.current=u(t,n))},[e,t])}function u(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},29842:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"errorOnce",{enumerable:!0,get:function(){return r}});let r=e=>{}},31393:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});var r={assign:function(){return l},searchParamsToUrlQuery:function(){return o},urlQueryToSearchParams:function(){return a}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});function o(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function u(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function a(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,u(e));else t.set(r,u(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},48368:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},66088:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},69470:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return u}});let n=r(10857),o=r(48512);function u(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},90425:(e,t,r)=>{r.d(t,{A:()=>i});var n=r(12115);let o=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),u=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let l=(0,n.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:u,className:l="",children:i,iconNode:c,...s},f)=>(0,n.createElement)("svg",{ref:f,...a,width:t,height:t,stroke:e,strokeWidth:u?24*Number(r)/Number(t):r,className:o("lucide",l),...!i&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(s)&&{"aria-hidden":"true"},...s},[...c.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(i)?i:[i]])),i=(e,t)=>{let r=(0,n.forwardRef)(({className:r,...a},i)=>(0,n.createElement)(l,{ref:i,iconNode:t,className:o(`lucide-${u(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...a}));return r.displayName=u(e),r}},94514:(e,t,r)=>{r.d(t,{A:()=>n});let n=(0,r(90425).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},98500:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return m},useLinkStatus:function(){return v}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388),a=r(95155),l=u._(r(12115)),i=r(20091),c=r(22909),s=r(21172),f=r(10857),d=r(70127);r(47284);let p=r(24972),h=r(69470),y=r(77565);function g(e){return"string"==typeof e?e:(0,i.formatUrl)(e)}function m(e){var t;let n,o,u,[i,m]=(0,l.useOptimistic)(p.IDLE_LINK_STATUS),v=(0,l.useRef)(null),{href:E,as:_,children:P,prefetch:O=null,passHref:j,replace:k,shallow:C,scroll:S,onClick:w,onMouseEnter:A,onTouchStart:N,legacyBehavior:M=!1,onNavigate:R,ref:T,unstable_dynamicOnHover:x,...L}=e;n=P,M&&("string"==typeof n||"number"==typeof n)&&(n=(0,a.jsx)("a",{children:n}));let $=l.default.useContext(c.AppRouterContext),I=!1!==O,U=!1!==O?null===(t=O)||"auto"===t?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,{href:F,as:D}=l.default.useMemo(()=>{let e=g(E);return{href:e,as:_?g(_):e}},[E,_]);if(M){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=l.default.Children.only(n)}let z=M?o&&"object"==typeof o&&o.ref:T,B=l.default.useCallback(e=>(null!==$&&(v.current=(0,p.mountLinkInstance)(e,F,$,U,I,m)),()=>{v.current&&((0,p.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,p.unmountPrefetchableInstance)(e)}),[I,F,$,U,m]),K={ref:(0,s.useMergedRef)(B,z),onClick(e){M||"function"!=typeof w||w(e),M&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(e),!$||e.defaultPrevented||function(e,t,n,o,u,a,i){{let c,{nodeName:s}=e.currentTarget;if("A"===s.toUpperCase()&&((c=e.currentTarget.getAttribute("target"))&&"_self"!==c||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which)||e.currentTarget.hasAttribute("download"))return;if(!(0,h.isLocalURL)(t)){u&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:f}=r(70156);l.default.startTransition(()=>{f(n||t,u?"replace":"push",a??!0,o.current)})}}(e,F,D,v,k,S,R)},onMouseEnter(e){M||"function"!=typeof A||A(e),M&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),$&&I&&(0,p.onNavigationIntent)(e.currentTarget,!0===x)},onTouchStart:function(e){M||"function"!=typeof N||N(e),M&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),$&&I&&(0,p.onNavigationIntent)(e.currentTarget,!0===x)}};return(0,f.isAbsoluteUrl)(D)?K.href=D:M&&!j&&("a"!==o.type||"href"in o.props)||(K.href=(0,d.addBasePath)(D)),u=M?l.default.cloneElement(o,K):(0,a.jsx)("a",{...L,...K,children:n}),(0,a.jsx)(b.Provider,{value:i,children:u})}r(29842);let b=(0,l.createContext)(p.IDLE_LINK_STATUS),v=()=>(0,l.useContext)(b);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9905],{997:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]])},5214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorage",{enumerable:!0,get:function(){return i.workAsyncStorageInstance}});let i=r(17828)},6962:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]])},7915:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},8434:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]])},9339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i={callServer:function(){return s.callServer},createServerReference:function(){return o.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var n in i)Object.defineProperty(t,n,{enumerable:!0,get:i[n]});let s=r(77304),a=r(4060),o=r(77197)},17828:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return i}});let i=(0,r(64054).createAsyncLocalStorage)()},21957:(e,t,r)=>{"use strict";function i({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return i}}),r(95155),r(47650),r(5214),r(2451),r(53887)},33078:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]])},37206:(e,t,r)=>{"use strict";r.d(t,{default:()=>n.a});var i=r(75707),n=r.n(i)},37595:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]])},37618:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]])},38798:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},41112:(e,t,r)=>{"use strict";function i({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return i}}),r(1980)},42129:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])},49387:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},56563:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]])},59386:function(e,t){var r,i;void 0===(i="function"==typeof(r=function e(){var t,r="u">typeof self?self:"u">typeof window?window:void 0!==r?r:{},i=!r.document&&!!r.postMessage,n=r.IS_PAPA_WORKER||!1,s={},a=0,o={};function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(e){var t=k(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new f(t),(this._handle.streamer=this)._config=t}).call(this,e),this.parseChunk=function(e,t){var i=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<i){let t=this._config.newline;t||(s=this._config.quoteChar||'"',t=this._handle.guessLineEndings(e,s)),e=[...e.split(t).slice(i)].join(t)}this.isFirstChunk&&v(this._config.beforeFirstChunk)&&void 0!==(s=this._config.beforeFirstChunk(e))&&(e=s),this.isFirstChunk=!1,this._halted=!1;var i=this._partialLine+e,s=(this._partialLine="",this._handle.parse(i,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=s.meta.cursor,this._finished||(this._partialLine=i.substring(e-this._baseIndex),this._baseIndex=e),s&&s.data&&(this._rowCount+=s.data.length),i=this._finished||this._config.preview&&this._rowCount>=this._config.preview,n)r.postMessage({results:s,workerId:o.WORKER_ID,finished:i});else if(v(this._config.chunk)&&!t){if(this._config.chunk(s,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=s=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(s.data),this._completeResults.errors=this._completeResults.errors.concat(s.errors),this._completeResults.meta=s.meta),this._completed||!i||!v(this._config.complete)||s&&s.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),i||s&&s.meta.paused||this._nextChunk(),s}this._halted=!0},this._sendError=function(e){v(this._config.error)?this._config.error(e):n&&this._config.error&&r.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function h(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),u.call(this,e),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),i||(t.onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var e,r,n=this._config.downloadRequestHeaders;for(r in n)t.setRequestHeader(r,n[r])}this._config.chunkSize&&(e=this._start+this._config.chunkSize-1,t.setRequestHeader("Range","bytes="+this._start+"-"+e));try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}i&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){let e;4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize||t.responseText.length,this._finished=!this._config.chunkSize||this._start>=(null!==(e=(e=t).getResponseHeader("Content-Range"))?parseInt(e.substring(e.lastIndexOf("/")+1)):-1),this.parseChunk(t.responseText)))},this._chunkError=function(e){e=t.statusText||e,this._sendError(Error(e))}}function l(e){(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),u.call(this,e);var t,r,i="u">typeof FileReader;this.stream=function(e){this._input=e,r=e.slice||e.webkitSlice||e.mozSlice,i?((t=new FileReader).onload=b(this._chunkLoaded,this),t.onerror=b(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input,n=(this._config.chunkSize&&(n=Math.min(this._start+this._config.chunkSize,this._input.size),e=r.call(e,this._start,n)),t.readAsText(e,this._config.encoding));i||this._chunkLoaded({target:{result:n}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function d(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){var e,r;if(!this._finished)return t=(e=this._config.chunkSize)?(r=t.substring(0,e),t.substring(e)):(r=t,""),this._finished=!t,this.parseChunk(r)}}function c(e){u.call(this,e=e||{});var t=[],r=!0,i=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){i&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):r=!0},this._streamData=b(function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=b(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=b(function(){this._streamCleanUp(),i=!0,this._streamData("")},this),this._streamCleanUp=b(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function f(e){var t,r,i,n,s=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,a=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,u=this,h=0,l=0,d=!1,c=!1,f=[],_={data:[],errors:[],meta:{}};function m(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function y(){if(_&&i&&(w("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),i=!1),e.skipEmptyLines&&(_.data=_.data.filter(function(e){return!m(e)})),b()){if(_)if(Array.isArray(_.data[0])){for(var t,r=0;b()&&r<_.data.length;r++)_.data[r].forEach(n);_.data.splice(0,1)}else _.data.forEach(n);function n(t,r){v(e.transformHeader)&&(t=e.transformHeader(t,r)),f.push(t)}}function u(t,r){for(var i=e.header?{}:[],n=0;n<t.length;n++){var o=n,u=t[n],u=((t,r)=>(e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping))?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&((e=>{if(s.test(e)&&-0x20000000000000<(e=parseFloat(e))&&e<0x20000000000000)return 1})(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r)(o=e.header?n>=f.length?"__parsed_extra":f[n]:o,u=e.transform?e.transform(u,o):u);"__parsed_extra"===o?(i[o]=i[o]||[],i[o].push(u)):i[o]=u}return e.header&&(n>f.length?w("FieldMismatch","TooManyFields","Too many fields: expected "+f.length+" fields but parsed "+n,l+r):n<f.length&&w("FieldMismatch","TooFewFields","Too few fields: expected "+f.length+" fields but parsed "+n,l+r)),i}_&&(e.header||e.dynamicTyping||e.transform)&&(t=1,!_.data.length||Array.isArray(_.data[0])?(_.data=_.data.map(u),t=_.data.length):_.data=u(_.data,0),e.header&&_.meta&&(_.meta.fields=f),l+=t)}function b(){return e.header&&0===f.length}function w(e,t,r,i){e={type:e,code:t,message:r},void 0!==i&&(e.row=i),_.errors.push(e)}v(e.step)&&(n=e.step,e.step=function(t){_=t,b()?y():(y(),0!==_.data.length&&(h+=t.data.length,e.preview&&h>e.preview?r.abort():(_.data=_.data[0],n(_,u))))}),this.parse=function(n,s,a){var u=e.quoteChar||'"',u=(e.newline||(e.newline=this.guessLineEndings(n,u)),i=!1,e.delimiter?v(e.delimiter)&&(e.delimiter=e.delimiter(n),_.meta.delimiter=e.delimiter):((u=((t,r,i,n,s)=>{var a,u,h,l;s=s||[","," ","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var d=0;d<s.length;d++){for(var c,f=s[d],p=0,_=0,y=0,k=(h=void 0,new g({comments:n,delimiter:f,newline:r,preview:10}).parse(t)),b=0;b<k.data.length;b++)i&&m(k.data[b])?y++:(_+=c=k.data[b].length,void 0===h?h=c:0<c&&(p+=Math.abs(c-h),h=c));0<k.data.length&&(_/=k.data.length-y),(void 0===u||p<=u)&&(void 0===l||l<_)&&1.99<_&&(u=p,a=f,l=_)}return{successful:!!(e.delimiter=a),bestDelimiter:a}})(n,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess)).successful?e.delimiter=u.bestDelimiter:(i=!0,e.delimiter=o.DefaultDelimiter),_.meta.delimiter=e.delimiter),k(e));return e.preview&&e.header&&u.preview++,t=n,_=(r=new g(u)).parse(t,s,a),y(),d?{meta:{paused:!0}}:_||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,r.abort(),t=v(e.chunk)?"":t.substring(r.getCharIndex())},this.resume=function(){u.streamer._halted?(d=!1,u.streamer.parseChunk(t,!0)):setTimeout(u.resume,3)},this.aborted=function(){return c},this.abort=function(){c=!0,r.abort(),_.meta.aborted=!0,v(e.complete)&&e.complete(_),t=""},this.guessLineEndings=function(e,t){e=e.substring(0,1048576);var t=RegExp(p(t)+"([^]*?)"+p(t),"gm"),r=(e=e.replace(t,"")).split("\r"),t=e.split("\n"),e=1<t.length&&t[0].length<r[0].length;if(1===r.length||e)return"\n";for(var i=0,n=0;n<r.length;n++)"\n"===r[n][0]&&i++;return i>=r.length/2?"\r\n":"\r"}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t=(e=e||{}).delimiter,r=e.newline,i=e.comments,n=e.step,s=e.preview,a=e.fastMode,u=null,h=!1,l=null==e.quoteChar?'"':e.quoteChar,d=l;if(void 0!==e.escapeChar&&(d=e.escapeChar),("string"!=typeof t||-1<o.BAD_DELIMITERS.indexOf(t))&&(t=","),i===t)throw Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var c=0,f=!1;this.parse=function(o,g,_){if("string"!=typeof o)throw Error("Input must be a string");var m=o.length,y=t.length,k=r.length,b=i.length,w=v(n),x=[],E=[],R=[],A=c=0;if(!o)return z();if(a||!1!==a&&-1===o.indexOf(l)){for(var O=o.split(r),S=0;S<O.length;S++){if(R=O[S],c+=R.length,S!==O.length-1)c+=r.length;else if(_)break;if(!i||R.substring(0,b)!==i){if(w){if(x=[],T(R.split(t)),U(),f)return z()}else T(R.split(t));if(s&&s<=S)return x=x.slice(0,s),z(!0)}}return z()}for(var C=o.indexOf(t,c),j=o.indexOf(r,c),L=RegExp(p(d)+p(l),"g"),M=o.indexOf(l,c);;)if(o[c]===l)for(M=c,c++;;){if(-1===(M=o.indexOf(l,M+1)))return _||E.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:x.length,index:c}),P();if(M===m-1)return P(o.substring(c,M).replace(L,l));if(l===d&&o[M+1]===d)M++;else if(l===d||0===M||o[M-1]!==d){-1!==C&&C<M+1&&(C=o.indexOf(t,M+1));var I=D(-1===(j=-1!==j&&j<M+1?o.indexOf(r,M+1):j)?C:Math.min(C,j));if(o.substr(M+1+I,y)===t){R.push(o.substring(c,M).replace(L,l)),o[c=M+1+I+y]!==l&&(M=o.indexOf(l,c)),C=o.indexOf(t,c),j=o.indexOf(r,c);break}if(I=D(j),o.substring(M+1+I,M+1+I+k)===r){if(R.push(o.substring(c,M).replace(L,l)),F(M+1+I+k),C=o.indexOf(t,c),M=o.indexOf(l,c),w&&(U(),f))return z();if(s&&x.length>=s)return z(!0);break}E.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:x.length,index:c}),M++}}else if(i&&0===R.length&&o.substring(c,c+b)===i){if(-1===j)return z();c=j+k,j=o.indexOf(r,c),C=o.indexOf(t,c)}else if(-1!==C&&(C<j||-1===j))R.push(o.substring(c,C)),c=C+y,C=o.indexOf(t,c);else{if(-1===j)break;if(R.push(o.substring(c,j)),F(j+k),w&&(U(),f))return z();if(s&&x.length>=s)return z(!0)}return P();function T(e){x.push(e),A=c}function D(e){return -1!==e&&(e=o.substring(M+1,e))&&""===e.trim()?e.length:0}function P(e){return _||(void 0===e&&(e=o.substring(c)),R.push(e),c=m,T(R),w&&U()),z()}function F(e){c=e,T(R),R=[],j=o.indexOf(r,c)}function z(i){if(e.header&&!g&&x.length&&!h){var n=x[0],s=Object.create(null),a=new Set(n);let t=!1;for(let r=0;r<n.length;r++){let i=n[r];if(s[i=v(e.transformHeader)?e.transformHeader(i,r):i]){let e,o=s[i];for(;e=i+"_"+o,o++,a.has(e););a.add(e),n[r]=e,s[i]++,t=!0,(u=null===u?{}:u)[e]=i}else s[i]=1,n[r]=i;a.add(i)}t&&console.warn("Duplicate headers found and renamed."),h=!0}return{data:x,errors:E,meta:{delimiter:t,linebreak:r,aborted:f,truncated:!!i,cursor:A+(g||0),renamedHeaders:u}}}function U(){n(z()),x=[],E=[]}},this.abort=function(){f=!0},this.getCharIndex=function(){return c}}function _(e){var t=e.data,r=s[t.workerId],i=!1;if(t.error)r.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){i=!0,m(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(v(r.userStep)){for(var a=0;a<t.results.data.length&&(r.userStep({data:t.results.data[a],errors:t.results.errors,meta:t.results.meta},n),!i);a++);delete t.results}else v(r.userChunk)&&(r.userChunk(t.results,n,t.file),delete t.results)}t.finished&&!i&&m(t.workerId,t.results)}function m(e,t){var r=s[e];v(r.userComplete)&&r.userComplete(t),r.terminate(),delete s[e]}function y(){throw Error("Not implemented.")}function k(e){if("object"!=typeof e||null===e)return e;var t,r=Array.isArray(e)?[]:{};for(t in e)r[t]=k(e[t]);return r}function b(e,t){return function(){e.apply(t,arguments)}}function v(e){return"function"==typeof e}return o.parse=function(t,i){var n,u,f,p=(i=i||{}).dynamicTyping||!1;if(v(p)&&(i.dynamicTypingFunction=p,p={}),i.dynamicTyping=p,i.transform=!!v(i.transform)&&i.transform,!i.worker||!o.WORKERS_SUPPORTED){let e;return p=null,o.NODE_STREAM_INPUT,"string"==typeof t?(t=65279!==(e=t).charCodeAt(0)?e:e.slice(1),p=new(i.download?h:d)(i)):!0===t.readable&&v(t.read)&&v(t.on)?p=new c(i):(r.File&&t instanceof File||t instanceof Object)&&(p=new l(i)),p.stream(t)}(p=!!o.WORKERS_SUPPORTED&&(u=r.URL||r.webkitURL||null,f=e.toString(),n=o.BLOB_URL||(o.BLOB_URL=u.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",f,")();"],{type:"text/javascript"}))),(n=new r.Worker(n)).onmessage=_,n.id=a++,s[n.id]=n)).userStep=i.step,p.userChunk=i.chunk,p.userComplete=i.complete,p.userError=i.error,i.step=v(i.step),i.chunk=v(i.chunk),i.complete=v(i.complete),i.error=v(i.error),delete i.worker,p.postMessage({input:t,config:i,workerId:p.id})},o.unparse=function(e,t){var r=!1,i=!0,n=",",s="\r\n",a='"',u=a+a,h=!1,l=null,d=!1,c=((()=>{if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter(function(e){return -1!==t.delimiter.indexOf(e)}).length||(n=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(h=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(i=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw Error("Option columns is empty");l=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+a),t.escapeFormulae instanceof RegExp?d=t.escapeFormulae:"boolean"==typeof t.escapeFormulae&&t.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),RegExp(p(a),"g"));if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return f(null,e,h);if("object"==typeof e[0])return f(l||Object.keys(e[0]),e,h)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields||l),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),f(e.fields||[],e.data||[],h);throw Error("Unable to serialize unrecognized input");function f(e,t,r){var a="",o=("string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t)),Array.isArray(e)&&0<e.length),u=!Array.isArray(t[0]);if(o&&i){for(var h=0;h<e.length;h++)0<h&&(a+=n),a+=g(e[h],h);0<t.length&&(a+=s)}for(var l=0;l<t.length;l++){var d=(o?e:t[l]).length,c=!1,f=o?0===Object.keys(t[l]).length:0===t[l].length;if(r&&!o&&(c="greedy"===r?""===t[l].join("").trim():1===t[l].length&&0===t[l][0].length),"greedy"===r&&o){for(var p=[],_=0;_<d;_++){var m=u?e[_]:_;p.push(t[l][m])}c=""===p.join("").trim()}if(!c){for(var y=0;y<d;y++){0<y&&!f&&(a+=n);var k=o&&u?e[y]:y;a+=g(t[l][k],y)}l<t.length-1&&(!r||0<d&&!f)&&(a+=s)}}return a}function g(e,t){var i,s;return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(s=!1,d&&"string"==typeof e&&d.test(e)&&(e="'"+e,s=!0),i=e.toString().replace(c,u),(s=s||!0===r||"function"==typeof r&&r(e,t)||Array.isArray(r)&&r[t]||((e,t)=>{for(var r=0;r<t.length;r++)if(-1<e.indexOf(t[r]))return!0;return!1})(i,o.BAD_DELIMITERS)||-1<i.indexOf(n)||" "===i.charAt(0)||" "===i.charAt(i.length-1))?a+i+a:i)}},o.RECORD_SEP="\x1e",o.UNIT_SEP="\x1f",o.BYTE_ORDER_MARK="\uFEFF",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!i&&!!r.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=0xa00000,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=f,o.NetworkStreamer=h,o.FileStreamer=l,o.StringStreamer=d,o.ReadableStreamStreamer=c,r.jQuery&&((t=r.jQuery).fn.parse=function(e){var i=e.config||{},n=[];return this.each(function(e){if(!("INPUT"===t(this).prop("tagName").toUpperCase()&&"file"===t(this).attr("type").toLowerCase()&&r.FileReader)||!this.files||0===this.files.length)return!0;for(var s=0;s<this.files.length;s++)n.push({file:this.files[s],inputElem:this,instanceConfig:t.extend({},i)})}),s(),this;function s(){if(0===n.length)v(e.complete)&&e.complete();else{var r,i,s,u=n[0];if(v(e.before)){var h=e.before(u.file,u.inputElem);if("object"==typeof h){if("abort"===h.action)return r=u.file,i=u.inputElem,s=h.reason,void(v(e.error)&&e.error({name:"AbortError"},r,i,s));if("skip"===h.action)return void a();"object"==typeof h.config&&(u.instanceConfig=t.extend(u.instanceConfig,h.config))}else if("skip"===h)return void a()}var l=u.instanceConfig.complete;u.instanceConfig.complete=function(e){v(l)&&l(e,u.file,u.inputElem),a()},o.parse(u.file,u.instanceConfig)}}function a(){n.splice(0,1),s()}}),n&&(r.onmessage=function(e){e=e.data,void 0===o.WORKER_ID&&e&&(o.WORKER_ID=e.workerId),"string"==typeof e.input?r.postMessage({workerId:o.WORKER_ID,results:o.parse(e.input,e.config),finished:!0}):(r.File&&e.input instanceof File||e.input instanceof Object)&&(e=o.parse(e.input,e.config))&&r.postMessage({workerId:o.WORKER_ID,results:e,finished:!0})}),(h.prototype=Object.create(u.prototype)).constructor=h,(l.prototype=Object.create(u.prototype)).constructor=l,(d.prototype=Object.create(d.prototype)).constructor=d,(c.prototype=Object.create(u.prototype)).constructor=c,o})?r.apply(t,[]):r)||(e.exports=i)},64054:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={bindSnapshot:function(){return u},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return h}};for(var i in r)Object.defineProperty(t,i,{enumerable:!0,get:r[i]});let n=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class s{disable(){throw n}getStore(){}run(){throw n}exit(){throw n}enterWith(){throw n}static bind(e){return e}}let a="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return a?new a:new s}function u(e){return a?a.bind(e):s.bind(e)}function h(){return a?a.snapshot():function(e,...t){return e(...t)}}},68635:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let i=r(95155),n=r(12115),s=r(41112);function a(e){return{default:e&&"default"in e?e.default:e}}r(21957);let o={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},u=function(e){let t={...o,...e},r=(0,n.lazy)(()=>t.loader().then(a)),u=t.loading;function h(e){let a=u?(0,i.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,h=o?n.Suspense:n.Fragment,l=t.ssr?(0,i.jsxs)(i.Fragment,{children:[null,(0,i.jsx)(r,{...e})]}):(0,i.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,i.jsx)(r,{...e})});return(0,i.jsx)(h,{...o?{fallback:a}:{},children:l})}return h.displayName="LoadableComponent",h}},75707:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n}});let i=r(73623)._(r(68635));function n(e,t){let r={};"function"==typeof e&&(r.loader=e);let n={...r,...t};return(0,i.default)({...n,modules:n.loadableGenerated?.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},89363:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},94290:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]])},95057:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=(0,r(90425).A)("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]])}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8372,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[44,160,165,635,706,910,1124,1131,1165,1212,1288,2036,2287,2437,2522,2772,2920,2950,3358,3390,3757,3896,3945,4048,4209,4230,4473,4503,4558,4888,4896,5177,5245,5411,5620,5684,5704,5931,6202,6306,6819,6828,6988,7330,7538,7581,7607,7646,7711,7822,7839,7851,8167,8181,8232,8372,8616,8641,9120,9188,9303,9491,9596,9725,9861,9968],{84441:()=>{}},_=>{_.O(0,[8441,3794,7358],()=>_(_.s=84441)),_N_E=_.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2114],{74009:(e,t,s)=>{Promise.resolve().then(s.bind(s,96485))},96485:(e,t,s)=>{"use strict";s.d(t,{default:()=>J});var r=s(95155),n=s(98500),a=s.n(n),l=s(12115),i=s(80723),o=s(49387),d=s(68459),c=s(15573),u=s(53961),m=s(61878),x=s(41585),p=s(67635),g=s(92451),f=s(73035),b=s(84755),h=s(93219),v=s(6296),j=s(52905),N=s(44478),y=s(439),k=s(84980),w=s(3926),S=s(93631),A=s(10762),C=s(97810),M=s(12651),z=s(13545),R=s(66088),T=s(35581),F=s(4235),E=s(91337),P=s(70617),$=s(2857),O=s(22356),D=s(7834),L=s(13845),I=s(3590),U=s(39498),_=s(85641),H=s(90777);function J({agentKey:e}){let{t}=(0,T.Y)(),s=t.agentsContent,n=t.panels.agents,h=(0,P.kr)(),v=(0,$.V)(),j=(0,l.useMemo)(()=>h.agents.find(t=>t.key===e),[h.agents,e]),[N,y]=(0,l.useState)(""),[k,w]=(0,l.useState)("all"),[S,A]=(0,l.useState)(null),[C,M]=(0,l.useState)(null),[z,R]=(0,l.useState)(""),[E,J]=(0,l.useState)(null),[q,B]=(0,l.useState)(!1),[X,Z]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(null),[es,er]=(0,l.useState)(null),[en,ea]=(0,l.useState)(null),[el,ei]=(0,l.useState)(null),[eo,ed]=(0,l.useState)(null),[ec,eu]=(0,l.useState)(null),[em,ex]=(0,l.useState)(!1),[ep,eg]=(0,l.useState)(!1),ef=(0,l.useCallback)(async()=>{if(j?.isCustom)try{let e=await fetch("/api/agents/custom",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:j.key})});if(e.ok)F.oR.success(s.overview.customAgentRemoved(j.name)),h.refresh(),window.location.href="/agents";else{let t=await e.json();F.oR.error(t.error||s.overview.customAgentFailedRemove)}}catch{F.oR.error(s.overview.customAgentNetworkError)}finally{eg(!1)}},[j,s.overview,h]),eb=(0,l.useMemo)(()=>(0,I.qC)(h.skills,{query:N,source:k}),[h.skills,N,k]),eh=(0,l.useMemo)(()=>({total:h.skills.length,enabled:h.skills.filter(e=>e.enabled).length,builtin:h.skills.filter(e=>"builtin"===e.source).length,user:h.skills.filter(e=>"user"===e.source).length}),[h.skills]),ev=(0,l.useMemo)(()=>{let e=(0,I.HL)(h.agents),t=new Map;for(let s of e)t.set(s.serverName,s.agents);return t},[h.agents]),ej=(0,l.useMemo)(()=>{let e=(0,I.x3)(h.agents),t=new Map;for(let s of e)t.set(s.skillName,s.agents);return t},[h.agents]),eN="mindos"===e,ey=j?(0,I.yv)(j):"notFound",ek=j?.scope==="project"?"project":"global",ew=j?.transport==="http"?"http":"stdio",eS=(0,l.useMemo)(()=>j?(0,L.$k)(j,h.status,ew):{snippet:"",path:""},[j,h.status,ew]),eA=(0,l.useMemo)(()=>new Set(h.skills.map(e=>e.name)),[h.skills]),eC=(0,l.useMemo)(()=>(j?.installedSkillNames??[]).filter(e=>!eA.has(e)),[j?.installedSkillNames,eA]),eM=j?.configuredMcpServers??[],ez=(0,l.useCallback)(async(e,t)=>{A(e),J(null);try{await h.toggleSkill(e,t),await h.refresh()}finally{A(null)}},[h]),eR=(0,l.useCallback)(async e=>{J(null),A(e);try{let t=await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"read",name:e})});M(e),R(t.content)}catch(e){J(e instanceof Error?e.message:s.detail.skillReadFailed)}finally{A(null)}},[s.detail.skillReadFailed]),eT=(0,l.useCallback)(async()=>{if(C){B(!0),J(null);try{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"update",name:C,content:z})}),M(null),R(""),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()}catch(e){J(e instanceof Error?e.message:s.detail.skillSaveFailed)}finally{B(!1)}}},[C,z,s.detail.skillSaveFailed,h]),eF=(0,l.useCallback)(async e=>{er(null),A(e);try{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",name:e})}),ea(s.detail.skillDeleteSuccess),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()}catch{ea(s.detail.skillDeleteFailed)}finally{A(null),setTimeout(()=>ea(null),3e3)}},[s.detail.skillDeleteSuccess,s.detail.skillDeleteFailed,h]),eE=(0,l.useCallback)(async e=>{if(j?.skillWorkspacePath){A(e),J(null);try{(await (0,O.n)("/api/agents/copy-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skillName:e,targetPath:j.skillWorkspacePath})})).success&&(F.oR.success(`Skill "${e}" copied to ${j.name}`),await h.refresh())}catch(t){let e=t instanceof Error?t.message:"Failed to copy skill";J(e),F.oR.error(e)}finally{A(null)}}},[j,h]),eP=(0,l.useCallback)(async()=>{await (0,D.l)(eS.snippet)&&F.oR.copy()},[eS.snippet]),e$=(0,l.useCallback)(async(e,t)=>{if(j){Z(!0),et(s.detail.mcpApplying);try{let r=await h.installAgent(j.key,{scope:e,transport:t});await h.refresh(),et(r?s.detail.mcpApplySuccess:s.detail.mcpApplyFailed)}finally{Z(!1)}}},[s.detail.mcpApplying,s.detail.mcpApplySuccess,s.detail.mcpApplyFailed,h,j]),eO=(0,l.useCallback)(async e=>{await (0,O.n)("/api/skills",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",name:e})}),window.dispatchEvent(new Event("mindos:skills-changed")),await h.refresh()},[h]),eD=(0,l.useCallback)(()=>{ei(null),ed(s.detail.mcpServerHint),setTimeout(()=>ed(null),4e3)},[s.detail.mcpServerHint]);if(!j){let t=h.agents.filter(t=>t.key!==e&&"connected"===(0,I.yv)(t)).slice(0,3);return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-8 md:py-10",children:[(0,r.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground mb-4",children:[(0,r.jsx)(i.A,{size:14}),s.backToOverview]}),(0,r.jsxs)("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-foreground font-medium",children:s.detailNotFound}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:s.detailNotFoundHint}),t.length>0&&(0,r.jsxs)("div",{className:"pt-2 border-t border-border",children:[(0,r.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:s.detailNotFoundSuggestion}),(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:t.map(e=>(0,r.jsx)(a(),{href:`/agents/${encodeURIComponent(e.key)}`,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-muted text-foreground hover:bg-muted/80 transition-colors",children:e.name},e.key))})]})]})]})}return(0,r.jsxs)("div",{className:"content-width px-4 md:px-6 py-8 md:py-10 space-y-4",children:[(0,r.jsxs)(a(),{href:"/agents",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[(0,r.jsx)(i.A,{size:14}),s.backToOverview]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3.5 px-5 py-4",children:[(0,r.jsx)(U.lx,{name:j.name,status:ey,size:"md"}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("h1",{className:"text-lg font-semibold tracking-tight text-foreground truncate",children:j.name}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-0.5 text-2xs text-muted-foreground/60",children:[(0,r.jsx)("span",{className:`font-medium px-1.5 py-px rounded-full ${"connected"===ey?"bg-muted text-muted-foreground":"detected"===ey?"bg-[var(--amber-subtle)] text-[var(--amber-text)]":"bg-error/10 text-error"}`,children:ey}),(0,r.jsx)("span",{className:"font-mono",children:j.transport??j.preferredTransport}),(0,r.jsx)("span",{className:"text-muted-foreground/25","aria-hidden":"true",children:"\xb7"}),(0,r.jsx)("span",{children:j.skillMode??s.na})]})]}),j.isCustom&&(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:()=>ex(!0),className:"w-8 h-8 rounded-lg flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-muted transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":s.overview.customAgentEdit,title:s.overview.customAgentEdit,children:(0,r.jsx)(o.A,{size:14})}),(0,r.jsx)("button",{type:"button",onClick:()=>eg(!0),className:"w-8 h-8 rounded-lg flex items-center justify-center text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors duration-150 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":s.overview.customAgentRemove,title:s.overview.customAgentRemove,children:(0,r.jsx)(d.A,{size:14})})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-muted-foreground/50 px-5 py-2 border-t border-border/40",children:[(0,r.jsxs)("span",{children:[j.format," ",(0,r.jsx)("span",{className:"text-muted-foreground/30",children:"\xb7"})," ",W(j.runtimeLastActivityAt)]}),(0,r.jsxs)("span",{className:"tabular-nums",children:[eM.length," MCP ",(0,r.jsx)("span",{className:"text-muted-foreground/30",children:"\xb7"})," ",eC.length," skills"]})]})]}),(0,r.jsx)(G,{}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(c.A,{size:12,className:"text-muted-foreground/50"}),s.detail.mcpManagement]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[!eN&&(0,r.jsx)(U.rA,{onClick:()=>void eP(),disabled:!1,busy:!1,label:s.detail.mcpCopySnippet}),(0,r.jsx)(U.rA,{onClick:()=>void h.refresh(),disabled:!1,busy:!1,label:s.detail.mcpRefresh}),!eN&&(0,r.jsx)(U.rA,{onClick:()=>void e$(ek,ew),disabled:X,busy:X,label:s.detail.mcpReconnect})]})]}),ee&&(0,r.jsx)("p",{className:"text-2xs text-muted-foreground animate-in fade-in duration-200",children:ee}),(0,r.jsx)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:eN?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:"Status",value:h.status?.running?"Running":"Stopped"}),(0,r.jsx)(V,{label:"Endpoint",value:h.status?.endpoint??s.na}),(0,r.jsx)(V,{label:"Tools",value:h.status?.toolCount!=null?String(h.status.toolCount):s.na})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:s.detail.mcpInstalled,value:j.installed?s.detail.yes:s.detail.no}),(0,r.jsx)(V,{label:s.detail.mcpScope,value:j.scope??s.na}),(0,r.jsx)(V,{label:s.detail.mcpConfigPath,value:j.configPath??s.na})]})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider",children:s.detail.configuredMcpServers}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/40 tabular-nums",children:eM.length})]}),eo&&(0,r.jsx)("div",{role:"status","aria-live":"polite",className:"rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground animate-in fade-in duration-200",children:eo}),0===eM.length?(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:s.detail.configuredMcpServersEmpty}):(0,r.jsx)("div",{className:"space-y-1 max-h-[240px] overflow-y-auto",children:eM.map(e=>{let t=(ev.get(e)??[]).filter(e=>e!==j.name);return(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-md px-2 py-1.5 group/mcp hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsx)(c.A,{size:11,className:"text-muted-foreground/40 shrink-0"}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate",children:e}),t.length>0&&(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[t.slice(0,3).map(e=>(0,r.jsx)(U.lx,{name:e,size:"sm"},e)),t.length>3&&(0,r.jsxs)("span",{className:"text-2xs text-muted-foreground/50",children:["+",t.length-3]})]}),(0,r.jsx)("button",{type:"button",onClick:()=>ei(e),className:"text-muted-foreground/40 hover:text-destructive cursor-pointer opacity-0 group-hover/mcp:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded p-0.5 transition-all duration-150","aria-label":`${s.detail.mcpServerRemove} ${e}`,children:(0,r.jsx)(d.A,{size:11})})]},e)})})]})]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(u.A,{size:12,className:"text-muted-foreground/50"}),s.detail.skillAssignments]}),(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-2xs text-muted-foreground/50 tabular-nums",children:[(0,r.jsxs)("span",{children:[eh.enabled,"/",eh.total," enabled"]}),(0,r.jsx)("span",{className:"text-muted-foreground/25",children:"\xb7"}),(0,r.jsxs)("span",{children:[eC.length," native"]})]})]}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-2",children:[(0,r.jsxs)("label",{className:"relative flex-1",children:[(0,r.jsx)(m.A,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),(0,r.jsx)("input",{value:N,onChange:e=>y(e.target.value),placeholder:s.detail.skillsSearchPlaceholder,className:"w-full h-9 rounded-md border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors duration-150"})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 rounded-md border border-border p-0.5 bg-background",children:[(0,r.jsx)(U.KF,{active:"all"===k,label:s.detail.skillsFilterAll,onClick:()=>w("all")}),(0,r.jsx)(U.KF,{active:"builtin"===k,label:s.detail.skillsFilterBuiltin,onClick:()=>w("builtin")}),(0,r.jsx)(U.KF,{active:"user"===k,label:s.detail.skillsFilterUser,onClick:()=>w("user")})]})]}),en&&(0,r.jsx)("div",{role:"status","aria-live":"polite",className:"rounded-md border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground animate-in fade-in duration-200",children:en}),j?.skillMode==="unsupported"&&(0,r.jsxs)("div",{className:"rounded-lg border border-[var(--amber)]/20 bg-[var(--amber-dim)] p-3 mb-2",children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-foreground mb-2 flex items-center gap-1.5",children:[(0,r.jsx)(x.A,{size:14,className:"text-[var(--amber)] shrink-0","aria-hidden":"true"}),"Manual Skill Installation"]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mb-3",children:["This agent doesn't support ",(0,r.jsx)("code",{className:"bg-background px-1 py-0.5 rounded text-xs font-mono",children:"npx skills"}),". Copy skills manually:"]}),(0,r.jsxs)("div",{className:"bg-background rounded-md px-3 py-2 font-mono text-xs overflow-x-auto border border-border/50 select-all",children:["cp -r ~/.mindos/skills/<skill-name> ",j.skillWorkspacePath||"~/.agent/skills/"]})]}),eb.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1.5",children:["MindOS Skills ",(0,r.jsxs)("span",{className:"tabular-nums",children:["(",eb.filter(e=>e.enabled).length,"/",eb.length,")"]})]}),(0,r.jsx)("ul",{className:"space-y-0.5",children:eb.map(e=>{let t=C===e.name;return(0,r.jsxs)("li",{className:"rounded-md hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 py-1.5 px-1.5 group/skill",children:[(0,r.jsx)(u.A,{size:13,className:`shrink-0 ${e.enabled?"text-[var(--amber)]":"text-muted-foreground/50"}`,"aria-hidden":"true"}),(0,r.jsx)("button",{type:"button",onClick:()=>eu(e.name),className:"text-xs text-foreground flex-1 min-w-0 truncate hover:text-[var(--amber)] cursor-pointer transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded text-left",children:e.name}),(0,r.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded shrink-0 ${"builtin"===e.source?"bg-muted text-muted-foreground":"bg-[var(--amber-dim)] text-[var(--amber-text)]"}`,children:"builtin"===e.source?s.detail.skillsSourceBuiltin:s.detail.skillsSourceUser}),(0,r.jsxs)("div",{className:"flex items-center gap-1 shrink-0 md:opacity-0 md:group-hover/skill:opacity-100 md:focus-within:opacity-100 transition-opacity duration-150",children:[(0,r.jsx)(U.rA,{onClick:()=>void ez(e.name,!e.enabled),disabled:S===e.name,busy:S===e.name,label:e.enabled?s.detail.skillDisable:s.detail.skillEnable}),e.editable&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(U.rA,{onClick:()=>void eR(e.name),disabled:S===e.name||q,busy:!1,label:s.detail.skillEdit}),(0,r.jsx)("button",{type:"button",onClick:()=>er(e.name),disabled:S===e.name,className:"inline-flex items-center justify-center min-h-[28px] px-1.5 rounded-md text-muted-foreground hover:text-destructive cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150","aria-label":`${s.detail.skillDelete} ${e.name}`,children:(0,r.jsx)(d.A,{size:13})})]}),j?.skillMode==="unsupported"&&(0,r.jsx)("button",{type:"button",onClick:()=>void eE(e.name),disabled:S===e.name,className:"inline-flex items-center justify-center min-h-[28px] px-1.5 rounded-md text-muted-foreground hover:text-[var(--amber)] cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:cursor-not-allowed transition-colors duration-150",title:`Copy ${e.name} to ${j.name}`,"aria-label":`Copy ${e.name} to ${j.name}`,children:(0,r.jsx)(p.A,{size:13})})]})]}),t&&(0,r.jsxs)("div",{className:"px-3 pb-3 pt-0 space-y-2",children:[(0,r.jsx)("textarea",{value:z,onChange:e=>R(e.target.value),className:"mt-2 w-full h-40 rounded-md border border-border bg-background px-3 py-2 text-xs font-mono text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring resize-y"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(U.rA,{onClick:()=>void eT(),disabled:q,busy:q,label:s.detail.skillSave,variant:"primary"}),(0,r.jsx)(U.rA,{onClick:()=>M(null),disabled:!1,busy:!1,label:s.detail.skillCancel})]})]})]},e.name)})})]}),0===eb.length&&0===eC.length&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:s.detail.noSkills}),eC.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-2xs font-medium text-muted-foreground uppercase tracking-wider mb-1.5",children:[s.detail.nativeInstalledSkills," ",(0,r.jsxs)("span",{className:"tabular-nums",children:["(",eC.length,")"]})]}),(0,r.jsx)("div",{className:"space-y-0.5 max-h-[280px] overflow-y-auto",children:eC.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>eu(e),className:"w-full flex items-center gap-2 py-1.5 px-1.5 rounded-md hover:bg-muted/30 transition-colors duration-100 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,r.jsx)(u.A,{size:13,className:"shrink-0 text-muted-foreground/50","aria-hidden":"true"}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate hover:text-[var(--amber)] transition-colors duration-150",children:e})]},e))})]}),E&&(0,r.jsx)("p",{className:"text-xs text-error",children:E})]}),(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(g.A,{size:12,className:"text-muted-foreground/50"}),n.a2aCapabilities]}),(0,r.jsx)("span",{className:`text-2xs px-1.5 py-0.5 rounded font-medium shrink-0 ${"connected"===ey?"bg-[var(--success)]/15 text-[var(--success)]":"bg-muted text-muted-foreground/60"}`,children:"connected"===ey?n.a2aConnected:n.a2aUnavailable})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:n.a2aStatus,value:"connected"===ey?n.a2aConnected:n.a2aUnavailable}),(0,r.jsx)(V,{label:s.detail.transport,value:j.transport??j.preferredTransport}),v.agents.length>0&&(0,r.jsx)(V,{label:"Remote agents",value:String(v.agents.length)})]}),v.agents.length>0?(0,r.jsx)("div",{className:"space-y-1",children:v.agents.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1.5 hover:bg-muted/30 transition-colors duration-100",children:[(0,r.jsx)("div",{className:"w-6 h-6 rounded-md bg-muted/40 flex items-center justify-center shrink-0",children:(0,r.jsx)(g.A,{size:11,className:"text-muted-foreground/60"})}),(0,r.jsx)("span",{className:"text-xs text-foreground flex-1 min-w-0 truncate",children:e.card.name}),e.reachable?(0,r.jsx)(f.A,{size:11,className:"text-[var(--success)] shrink-0"}):(0,r.jsx)(b.A,{size:11,className:"text-muted-foreground/50 shrink-0"}),(0,r.jsxs)("span",{className:"text-2xs text-muted-foreground/50 tabular-nums shrink-0",children:[e.card.skills.length," skills"]})]},e.id))}):(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:n.a2aNoRemoteHint})]}),(0,r.jsx)(K,{agent:j,status:ey,isMindOS:eN,mcpStatus:h.status}),(0,r.jsx)(Y,{agent:j,isMindOS:eN}),(0,r.jsx)(Q,{agent:j}),(0,r.jsx)(U.TM,{open:null!==es,title:s.detail.skillDelete,message:es?s.detail.skillDeleteConfirm(es):"",confirmLabel:s.detail.skillDelete,cancelLabel:s.detail.skillCancel,onConfirm:()=>es&&void eF(es),onCancel:()=>er(null),variant:"destructive"}),(0,r.jsx)(U.TM,{open:null!==el,title:s.detail.mcpServerRemove,message:el?s.detail.mcpServerRemoveConfirm(el):"",confirmLabel:s.detail.mcpServerRemove,cancelLabel:s.detail.skillCancel,onConfirm:eD,onCancel:()=>ei(null),variant:"destructive"}),(0,r.jsx)(_.A,{open:null!==ec,skillName:ec,skill:ec?h.skills.find(e=>e.name===ec)??null:null,agentNames:ec?ej.get(ec)??[]:[],isNative:!!ec&&!h.skills.some(e=>e.name===ec),nativeSourcePath:j?.installedSkillSourcePath,copy:s.skills.skillPopover,onClose:()=>eu(null),onToggle:h.toggleSkill,onDelete:eO,onRefresh:h.refresh}),j?.isCustom&&(0,r.jsx)(H.A,{open:em,onClose:()=>ex(!1),onSuccess:()=>{h.refresh(),ex(!1)},existingAgents:h.agents,editAgent:j}),(0,r.jsx)(U.TM,{open:ep,title:j?s.overview.customAgentRemoveTitle(j.name):"",message:s.overview.customAgentRemoveMessage,confirmLabel:s.overview.customAgentRemoveConfirm,cancelLabel:s.detail.skillCancel,onConfirm:ef,onCancel:()=>eg(!1),variant:"destructive"})]})}function V({label:e,value:t}){return(0,r.jsxs)("div",{className:"flex items-baseline gap-2 px-0.5 min-w-0",children:[(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider shrink-0 min-w-[60px]",children:e}),(0,r.jsx)("span",{className:"text-xs text-foreground/80 font-mono truncate min-w-0",children:t})]})}function W(e){if(!e)return"—";try{let t=Date.now()-new Date(e).getTime();if(t<0)return"just now";let s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let r=Math.floor(s/60);if(r<24)return`${r}h ago`;let n=Math.floor(r/24);return`${n}d ago`}catch{return e}}function K({agent:e,status:t,isMindOS:s,mcpStatus:n}){let{t:a}=(0,T.Y)(),i=a.agentsContent.detail,[o,d]=(0,l.useState)("idle"),[c,u]=(0,l.useState)(0),m=(0,l.useCallback)(async()=>{d("pinging");let e=performance.now();try{let t=await fetch("/api/mcp/status",{method:"GET",signal:AbortSignal.timeout(5e3)}),s=Math.round(performance.now()-e);u(s),d(t.ok?"ok":"fail")}catch{d("fail")}},[]);return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(h.A,{size:12,className:"text-muted-foreground/50"}),i.runtimeDiagTitle]}),(0,r.jsx)("button",{type:"button",onClick:()=>void m(),disabled:"pinging"===o,className:"inline-flex items-center gap-1 px-2.5 py-1 text-2xs font-medium rounded-md border border-border text-muted-foreground hover:text-foreground hover:bg-muted transition-colors disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"pinging"===o?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.A,{size:10,className:"animate-spin"})," ",i.runtimePinging]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.A,{size:10})," ",i.runtimePing]})})]}),"ok"===o&&(0,r.jsx)("div",{role:"status",className:"rounded-md bg-[var(--success)]/10 border border-[var(--success)]/20 px-3 py-1.5 text-2xs text-[var(--success)] font-medium animate-in fade-in duration-200",children:i.runtimePingOk(c)}),"fail"===o&&(0,r.jsx)("div",{role:"status",className:"rounded-md bg-error/10 border border-error/20 px-3 py-1.5 text-2xs text-error font-medium animate-in fade-in duration-200",children:i.runtimePingFail}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:i.status,value:t}),(0,r.jsx)(V,{label:i.transport,value:e.transport??e.preferredTransport}),s&&n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{label:i.runtimeVersion,value:n.endpoint}),(0,r.jsx)(V,{label:i.port,value:String(n.port)})]}),(0,r.jsx)(V,{label:i.lastActivityAt,value:W(e.runtimeLastActivityAt)}),void 0!==e.runtimeConversationSignal&&(0,r.jsx)(V,{label:i.conversationSignal,value:e.runtimeConversationSignal?"Active":"Inactive"}),void 0!==e.runtimeUsageSignal&&(0,r.jsx)(V,{label:i.usageSignal,value:e.runtimeUsageSignal?"Active":"Inactive"})]}),!e.runtimeLastActivityAt&&"idle"===o&&(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:i.runtimeNoData})]})}function Y({agent:e,isMindOS:t}){let{t:s}=(0,T.Y)(),n=s.agentsContent.detail,a=e.scope??(e.hasProjectScope?"project":e.hasGlobalScope?"global":"—");e.hiddenRootPresent;let l=[{label:n.envFileAccess,allowed:!0},{label:n.envNetworkAccess,allowed:"http"===e.transport||t},{label:n.envWriteAccess,allowed:!0},{label:n.envReadOnly,allowed:!1}];return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(j.A,{size:12,className:"text-muted-foreground/50"}),n.envPermTitle]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-x-6 gap-y-1 py-2 border-y border-border/30",children:[(0,r.jsx)(V,{label:n.envScope,value:a}),(0,r.jsx)(V,{label:n.format,value:e.format}),e.hiddenRootPath&&(0,r.jsx)(V,{label:n.hiddenRoot,value:e.hiddenRootPath}),(0,r.jsx)(V,{label:n.skillMode,value:e.skillMode??"—"})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider mb-1.5",children:n.envVars}),e.configuredMcpServers&&e.configuredMcpServers.length>0?(0,r.jsx)("p",{className:"text-2xs text-muted-foreground",children:n.envVarsCount(e.configuredMcpServers.length)}):(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:n.envVarsEmpty})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("p",{className:"text-2xs font-medium text-muted-foreground/60 uppercase tracking-wider",children:"Permissions"}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1.5",children:l.map(({label:e,allowed:t})=>(0,r.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 bg-muted/20",children:[t?(0,r.jsx)(N.A,{size:12,className:"text-[var(--success)] shrink-0"}):(0,r.jsx)(y.A,{size:12,className:"text-muted-foreground/40 shrink-0"}),(0,r.jsx)("span",{className:"text-2xs text-foreground/80",children:e}),(0,r.jsx)("span",{className:`ml-auto text-2xs font-medium ${t?"text-[var(--success)]":"text-muted-foreground/50"}`,children:t?n.envAllowed:n.envRestricted})]},e))})]})]})}function q(e){return/search/.test(e)?"search":/read|list|get/.test(e)?"read":/create|batch_create/.test(e)?"create":/delete/.test(e)?"delete":/write|update|insert|append|edit|rename|move/.test(e)?"write":"other"}let B={read:{icon:k.A,color:"text-blue-400"},write:{icon:w.A,color:"text-[var(--amber)]"},create:{icon:S.A,color:"text-[var(--success)]"},delete:{icon:d.A,color:"text-[var(--error)]"},search:{icon:m.A,color:"text-purple-400"},other:{icon:A.A,color:"text-muted-foreground"}};function G(){let{t:e}=(0,T.Y)(),t=e.agentsContent?.detail,[s,n]=(0,l.useState)([]),[i,o]=(0,l.useState)(!0),[d,c]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=!1,t=()=>{fetch("/api/agent-activity?limit=50").then(e=>e.json()).then(t=>{e||n(t.events??[])}).catch(()=>{}).finally(()=>{e||o(!1)})};t();let s=()=>{"visible"===document.visibilityState&&t()};return document.addEventListener("visibilitychange",s),()=>{e=!0,document.removeEventListener("visibilitychange",s)}},[]);let u=(0,l.useMemo)(()=>{if(0===s.length)return null;let e=s.filter(e=>"read"===q(e.tool)).length,t=s.filter(e=>["write","create","delete"].includes(q(e.tool))).length,r=s.filter(e=>"error"===e.result).length,n=s.filter(e=>"number"==typeof e.durationMs).map(e=>e.durationMs),a=n.length>0?Math.round(n.reduce((e,t)=>e+t,0)/n.length):null,l=new Set;for(let e of s){let t=e.params.path;"string"==typeof t&&l.add(t)}let i=s.length>0?Math.round(r/s.length*100):0;return{total:s.length,reads:e,writes:t,errors:r,errorRate:i,avgMs:a,filesCount:l.size}},[s]),m=(0,l.useMemo)(()=>{let e=s.filter(e=>{let t=q(e.tool);return"write"===t||"create"===t||"delete"===t});return e.length>=3?e:s},[s]),x=d?m:m.slice(0,5),p=m.length-5;return i?(0,r.jsx)("section",{className:"rounded-xl border border-border bg-card p-4",children:(0,r.jsx)("div",{className:"flex justify-center py-6",children:(0,r.jsx)(v.A,{size:16,className:"animate-spin text-muted-foreground"})})}):0===s.length?(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(C.A,{size:12,className:"text-muted-foreground/50"}),t?.knowledgeInteraction??"Knowledge Interaction"]}),(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-card/30 px-4 py-6 text-center",children:[(0,r.jsx)(C.A,{size:20,className:"text-muted-foreground/30 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:t?.knowledgeNoData??"No interactions yet. Agents will show activity here once they start working with your knowledge base."})]})]}):(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4 pb-2",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(C.A,{size:12,className:"text-muted-foreground/50"}),t?.knowledgeInteraction??"Knowledge Interaction"]}),(0,r.jsxs)(a(),{href:`/view/${(0,E.O0)(".mindos/agent-audit-log.json")}`,className:"text-2xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity",children:[t?.viewFullLog??"View log"," →"]})]}),u&&(0,r.jsxs)("div",{className:"flex items-center gap-px mx-4 mb-3 rounded-lg overflow-hidden border border-border/40",children:[(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statTotalCalls??"Calls"}),(0,r.jsx)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:u.total})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statFilesTouched??"Files"}),(0,r.jsx)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:u.filesCount})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statReadWrite??"R / W"}),(0,r.jsxs)("p",{className:"text-sm font-semibold text-foreground font-mono tabular-nums leading-none",children:[(0,r.jsx)("span",{className:"text-blue-400",children:u.reads}),(0,r.jsx)("span",{className:"text-muted-foreground/30 mx-0.5",children:"/"}),(0,r.jsx)("span",{className:"text-[var(--amber)]",children:u.writes})]})]}),(0,r.jsxs)("div",{className:"flex-1 px-3 py-2 bg-muted/20 border-l border-border/30",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 leading-none mb-1",children:t?.statHealth??"Health"}),(0,r.jsx)("p",{className:"text-sm font-semibold font-mono tabular-nums leading-none",children:u.errors>0?(0,r.jsxs)("span",{className:"text-[var(--error)]",children:[u.errorRate,"% err"]}):(0,r.jsx)("span",{className:"text-[var(--success)]",children:"100%"})})]})]}),(0,r.jsxs)("div",{className:"border-t border-border/40",children:[(0,r.jsx)("div",{className:"px-4 py-2 flex items-center justify-between",children:(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/40 uppercase tracking-wider",children:t?.recentOps??"Recent operations"})}),x.map((e,t)=>{let{icon:s,color:n}=B[q(e.tool)],l="string"==typeof e.params.path?e.params.path:null,i=e.tool.replace(/^mindos_/,"");return(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border/20 hover:bg-muted/20 transition-colors",children:[(0,r.jsx)("div",{className:"w-5 h-5 rounded-md bg-muted/40 flex items-center justify-center shrink-0",children:(0,r.jsx)(s,{size:11,className:n})}),(0,r.jsx)("span",{className:"text-xs font-medium text-foreground/80 font-mono shrink-0 min-w-[90px]",children:i}),l?(0,r.jsx)(a(),{href:`/view/${(0,E.O0)(l)}`,className:"text-xs text-muted-foreground hover:text-[var(--amber)] truncate min-w-0 flex-1 font-mono transition-colors",title:l,children:l}):(0,r.jsx)("span",{className:"flex-1"}),"ok"===e.result?(0,r.jsx)(M.A,{size:10,className:"shrink-0 text-[var(--success)]/40"}):(0,r.jsx)(z.A,{size:10,className:"shrink-0 text-[var(--error)]/60"}),(0,r.jsx)("span",{className:"text-2xs text-muted-foreground/30 tabular-nums shrink-0 font-mono w-[28px] text-right",title:e.ts,children:function(e){let t=Date.now()-new Date(e).getTime(),s=Math.floor(t/6e4);if(s<1)return"<1m";if(s<60)return`${s}m`;let r=Math.floor(t/36e5);return r<24?`${r}h`:`${Math.floor(t/864e5)}d`}(e.ts)})]},e.id??t)})]}),p>0&&(0,r.jsx)("div",{className:"px-4 py-2 border-t border-border/20",children:(0,r.jsxs)("button",{onClick:()=>c(e=>!e),className:"flex items-center gap-1.5 text-xs font-medium text-[var(--amber)] hover:opacity-80 transition-opacity cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",children:[(0,r.jsx)(R.A,{size:12,className:`transition-transform duration-200 ${d?"rotate-180":""}`}),(0,r.jsx)("span",{children:d?t?.showLess??"Show less":`${p} more`})]})})]})}function Q({agent:e}){let{t}=(0,T.Y)(),s=t.agentsContent.detail,n=!!e.runtimeLastActivityAt;return(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[(0,r.jsxs)("h2",{className:"text-xs font-semibold text-foreground flex items-center gap-2 shrink-0",children:[(0,r.jsx)(h.A,{size:12,className:"text-muted-foreground/50"}),s.activityTitle]}),n?(0,r.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:[(0,r.jsx)(X,{label:s.activityLastInvocation,value:W(e.runtimeLastActivityAt)}),(0,r.jsx)(X,{label:s.activityTotal,value:e.runtimeConversationSignal?"Active":"—"}),(0,r.jsx)(X,{label:s.activityLast7d,value:e.runtimeUsageSignal?"Active":"—"})]}):(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-card/30 px-4 py-6 text-center",children:[(0,r.jsx)(h.A,{size:20,className:"text-muted-foreground/30 mx-auto mb-2"}),(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50",children:s.activityNoData})]})]})}function X({label:e,value:t}){return(0,r.jsxs)("div",{className:"rounded-lg border border-border/40 bg-muted/10 px-3 py-2.5",children:[(0,r.jsx)("p",{className:"text-2xs text-muted-foreground/50 uppercase tracking-wider mb-0.5",children:e}),(0,r.jsx)("p",{className:"text-sm font-medium text-foreground font-mono tabular-nums",children:t})]})}}},e=>{e.O(0,[9186,8409,7637,5581,8252,6636,7249,8441,3794,7358],()=>e(e.s=74009)),_N_E=e.O()}]);
|