@seqyuan/annovibe 0.8.134 → 0.8.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +19 -12
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +46 -0
- package/.next/server/app/_global-error/page.js +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +2 -2
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +4 -4
- package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/agent/[id]/prepare/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js +2 -2
- package/.next/server/app/api/agent/running/events/route.js +2 -2
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/agent/runtime/route.js +1 -1
- package/.next/server/app/api/apps/[id]/[[...path]]/route.js +2 -2
- package/.next/server/app/api/apps/route.js +2 -2
- package/.next/server/app/api/auth/all-providers/route.js +1 -1
- package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
- package/.next/server/app/api/auth/login/route.js +1 -1
- package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
- package/.next/server/app/api/auth/providers/route.js +1 -1
- package/.next/server/app/api/auth/status/route.js +1 -1
- package/.next/server/app/api/auth/totp/route.js +1 -1
- package/.next/server/app/api/debug-models/route.js +1 -1
- package/.next/server/app/api/default-cwd/route.js +1 -1
- package/.next/server/app/api/file-index/route.js +1 -0
- package/.next/server/app/api/file-index/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/file-tree/delete/route.js +1 -1
- package/.next/server/app/api/file-tree/mkdir/route.js +1 -1
- package/.next/server/app/api/file-tree/rename/route.js +1 -1
- package/.next/server/app/api/file-tree/reveal/route.js +1 -1
- package/.next/server/app/api/file-tree/write/route.js +1 -1
- package/.next/server/app/api/file-watch/route.js +3 -3
- package/.next/server/app/api/files/[...path]/route.js +2 -2
- package/.next/server/app/api/harness/route.js +1 -1
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/im/cancel/route.js +1 -1
- package/.next/server/app/api/im/gateway-status/route.js +1 -1
- package/.next/server/app/api/im/gateway-token/route.js +1 -1
- package/.next/server/app/api/im/project/route.js +1 -1
- package/.next/server/app/api/im/projects/route.js +1 -1
- package/.next/server/app/api/im/session-ids/route.js +1 -1
- package/.next/server/app/api/im/turn/route.js +2 -2
- package/.next/server/app/api/images/upload/route.js +1 -1
- package/.next/server/app/api/internal/runtime/route.js +1 -1
- package/.next/server/app/api/memory/dismiss/route.js +2 -2
- package/.next/server/app/api/memory/promote/route.js +2 -2
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models-config/discover/route.js +1 -1
- package/.next/server/app/api/models-config/route.js +1 -1
- package/.next/server/app/api/models-config/test/route.js +1 -1
- package/.next/server/app/api/plot-kernels/route.js +1 -1
- package/.next/server/app/api/plot-kernels/save/route.js +1 -1
- package/.next/server/app/api/plot-kernels/status/route.js +1 -1
- package/.next/server/app/api/plot-kernels/stop/route.js +1 -1
- package/.next/server/app/api/plugins/route.js +1 -0
- package/.next/server/app/api/plugins/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/project-trust/route.js +1 -0
- package/.next/server/app/api/project-trust/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/browse/route.js +1 -1
- package/.next/server/app/api/projects/route.js +1 -1
- package/.next/server/app/api/search/route.js +1 -1
- package/.next/server/app/api/session-index/events/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +9 -8
- package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/export/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/kernel-state/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/media/route.js +1 -0
- package/.next/server/app/api/sessions/[id]/media/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/shadowed/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/workbench-artifact/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/workbench-review/route.js +1 -1
- package/.next/server/app/api/sessions/new/route.js +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/settings/route.js +1 -1
- package/.next/server/app/api/skills/check/route.js +1 -0
- package/.next/server/app/api/skills/check/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/skills/install/route.js +2 -2
- package/.next/server/app/api/skills/route.js +2 -2
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js +2 -0
- package/.next/server/app/api/skills/update/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/smoke/prompt-admission/route.js +1 -1
- package/.next/server/app/api/soul/route.js +1 -1
- package/.next/server/app/api/subagents/status/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/favicon.ico/route.js +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +5 -5
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/.next/server/app/index.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login/page.js +2 -2
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +4 -4
- package/.next/server/app/login.segments/_full.segment.rsc +4 -4
- package/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/.next/server/app/page.js +24 -24
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/page.js +3 -3
- package/.next/server/app/smoke/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/session-stream/page.js +2 -2
- package/.next/server/app/smoke/session-stream/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/session-stream.html +1 -1
- package/.next/server/app/smoke/session-stream.rsc +5 -5
- package/.next/server/app/smoke/session-stream.segments/_full.segment.rsc +5 -5
- package/.next/server/app/smoke/session-stream.segments/_head.segment.rsc +1 -1
- package/.next/server/app/smoke/session-stream.segments/_index.segment.rsc +4 -4
- package/.next/server/app/smoke/session-stream.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/smoke/session-stream.segments/smoke/session-stream/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/smoke/session-stream.segments/smoke/session-stream.segment.rsc +1 -1
- package/.next/server/app/smoke/session-stream.segments/smoke.segment.rsc +1 -1
- package/.next/server/app/smoke.html +2 -2
- package/.next/server/app/smoke.rsc +5 -5
- package/.next/server/app/smoke.segments/_full.segment.rsc +5 -5
- package/.next/server/app/smoke.segments/_head.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_index.segment.rsc +4 -4
- package/.next/server/app/smoke.segments/_tree.segment.rsc +3 -3
- package/.next/server/app/smoke.segments/smoke/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/smoke.segments/smoke.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +19 -12
- package/.next/server/chunks/1761.js +1 -1
- package/.next/server/chunks/402.js +4 -2
- package/.next/server/chunks/6429.js +9 -8
- package/.next/server/chunks/707.js +2 -2
- package/.next/server/chunks/7303.js +260 -0
- package/.next/server/chunks/7365.js +1 -0
- package/.next/server/chunks/7890.js +1 -1
- package/.next/server/chunks/8304.js +1 -1
- package/.next/server/chunks/8797.js +22 -0
- package/.next/server/functions-config-manifest.json +11 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{2693-b831832202452107.js → 2693-52c358cf5d84b069.js} +1 -1
- package/.next/static/chunks/291-bfdfc8bcf5d0a962.js +22 -0
- package/.next/static/chunks/{5618-3b8444e736e6ae4d.js → 5618-5e2e47e6ed401a75.js} +3 -3
- package/.next/static/chunks/{1960.b1e26436d7a5f586.js → 7198.4c3df741a5e26fb2.js} +1 -1
- package/.next/static/chunks/9867-b1d15d9354f100e7.js +260 -0
- package/.next/static/chunks/app/_global-error/page-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/prepare/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/running/events/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/agent/runtime/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/apps/[id]/[[...path]]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/apps/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/login/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/status/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/auth/totp/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/debug-models/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-tree/delete/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-tree/mkdir/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-tree/rename/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-tree/reveal/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-tree/write/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/file-watch/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/harness/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/home/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/cancel/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/gateway-status/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/gateway-token/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/project/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/projects/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/session-ids/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/im/turn/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/images/upload/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/internal/runtime/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/memory/dismiss/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/memory/promote/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/models/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/plot-kernels/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/plot-kernels/save/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/plot-kernels/status/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/plot-kernels/stop/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/projects/browse/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/projects/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/search/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/session-index/events/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/kernel-state/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/media/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/shadowed/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/workbench-artifact/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/workbench-review/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/new/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/settings/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/skills/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/smoke/prompt-admission/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/soul/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/subagents/status/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/api/version/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/favicon.ico/route-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/app/{layout-5608bfe5e8f4e4c0.js → layout-101c4ccdf12880f0.js} +1 -1
- package/.next/static/chunks/app/page-703d91d8bff67f70.js +44 -0
- package/.next/static/chunks/app/smoke/{page-35df723c803f35e1.js → page-32674afc320aa48b.js} +2 -2
- package/.next/static/chunks/app/smoke/session-stream/page-e754151f65003821.js +6 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-dcc4d4b28dc1e9eb.js +1 -0
- package/.next/static/chunks/{webpack-abcc6ba654c7ed4b.js → webpack-0d1f7348ddb20bdc.js} +1 -1
- package/.next/static/css/738b0b1c24aae500.css +1 -0
- package/.next/static/css/{88714c00e109ce28.css → 9bcd6051db4f8890.css} +1 -1
- package/.next/static/zeWki1Z47rqBkR2ph5H6N/_buildManifest.js +1 -0
- package/README.md +4 -1
- package/bin/annovibe-im-gateway.js +0 -4
- package/bin/pi-web.js +103 -37
- package/package.json +6 -5
- package/.next/server/chunks/4584.js +0 -260
- package/.next/server/chunks/9230.js +0 -22
- package/.next/static/2gyhgfAo_GNB2lRPOJwF9/_buildManifest.js +0 -1
- package/.next/static/chunks/4456-91f92907e8ef1f89.js +0 -260
- package/.next/static/chunks/9544-5e2696923ae4f6b5.js +0 -22
- package/.next/static/chunks/app/_global-error/page-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/prepare/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/running/events/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/agent/runtime/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/apps/[id]/[[...path]]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/apps/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/all-providers/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/login/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/status/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/auth/totp/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/debug-models/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-tree/delete/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-tree/mkdir/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-tree/rename/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-tree/reveal/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-tree/write/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/file-watch/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/harness/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/home/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/cancel/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/gateway-status/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/gateway-token/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/project/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/projects/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/session-ids/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/im/turn/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/images/upload/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/internal/runtime/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/memory/dismiss/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/memory/promote/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/models/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/plot-kernels/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/plot-kernels/save/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/plot-kernels/status/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/plot-kernels/stop/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/projects/browse/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/projects/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/search/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/session-index/events/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/kernel-state/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/shadowed/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/workbench-artifact/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/workbench-review/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/new/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/settings/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/skills/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/smoke/prompt-admission/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/soul/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/subagents/status/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/api/version/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/favicon.ico/route-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/app/page-959c2935e21471e4.js +0 -44
- package/.next/static/chunks/app/smoke/session-stream/page-49b8cf27895b9187.js +0 -6
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-c47e15c89def27e4.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c47e15c89def27e4.js +0 -1
- package/.next/static/css/fdfd4d4bcfae3c6a.css +0 -1
- /package/.next/static/{2gyhgfAo_GNB2lRPOJwF9 → zeWki1Z47rqBkR2ph5H6N}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[291],{14755:(e,t,n)=>{n.d(t,{ES:()=>p,IB:()=>m,SN:()=>a,tE:()=>f,xG:()=>d});let r="subagent",a=["retain","recall","reflect"],o=[],s=["read","bash","edit","write"],l=["bash","read","edit","write","grep","find","ls"],i=[...l,"kernel_plot_run","kernel_plot_render","kernel_plot_inspect","kernel_plot_stop","kernel_plot_artifacts"],u=[...l,r];function c(e){return[...e].sort().join(",")}function d(e){switch(e){case"none":return o;case"default":return s;case"workbench":return i;case"agent":return u;default:return l}}function p(e){let t=e.filter(e=>e.active).map(e=>e.name),n=t.filter(e=>!a.includes(e)),o=c(t),d=c(n);return""===o?"none":o===c(s)?"default":o===c(l)?"full":o===c(i)?"workbench":o===c(u)?"agent":""===d?"none":d===c(s)?"default":d===c(l)?"full":d===c(i)?"workbench":d===c(u)||t.includes(r)?"agent":"default"}function m(e){return a.filter(t=>e.some(e=>e.active&&e.name===t))}function f(e,t){return[...new Set([...d(e),...t])]}},16865:(e,t,n)=>{n.d(t,{O:()=>w});let r=new Set,a=null,o=null,s=null,l=null,i=null,u=!1,c=!1;function d(e){for(let t of(a=[...new Set(e.filter(e=>"string"==typeof e))],r))try{t(a)}catch{}}async function p(){try{let e=await fetch("/api/agent/running",{cache:"no-store"});if(!e.ok)return;let t=await e.json();Array.isArray(t.runningSessionIds)&&d(t.runningSessionIds)}catch{}}function m(){s||0===r.size||(p(),s=setInterval(()=>{p()},5e3))}function f(){s&&(clearInterval(s),s=null)}function g(){if(!u){if(u=!0,window.__annovibeRunningSessionSubscribe){i=window.__annovibeRunningSessionSubscribe(d);return}if("u"<typeof SharedWorker)return void m();try{(o=new SharedWorker("/running-session-worker.js?v=1",{name:"annovibe-running-sessions-v1",type:"classic"})).port.onmessage=e=>{let t=e.data;"transport"===t.type?m():"running"===t.type&&Array.isArray(t.runningSessionIds)&&(l&&clearTimeout(l),l=null,f(),d(t.runningSessionIds.filter(e=>"string"==typeof e)))},o.onerror=()=>m(),o.port.start(),o.port.postMessage({type:"subscribe"}),l=setTimeout(()=>m(),3e3)}catch{o=null,m()}}}function h(){if(u){if(u=!1,l&&clearTimeout(l),l=null,f(),i?.(),i=null,o){try{o.port.postMessage({type:"disconnect"})}catch{}try{o.port.close()}catch{}}o=null,a=null}}function y(){r.size>0&&g()}function w(e){return r.add(e),a&&e(a),c||(c=!0,window.addEventListener("pagehide",h),window.addEventListener("pageshow",y)),g(),()=>{r.delete(e),0===r.size&&(h(),c&&(c=!1,window.removeEventListener("pagehide",h),window.removeEventListener("pageshow",y)))}}},40291:(e,t,n)=>{n.d(t,{T:()=>Q});var r=n(12115);function a(e){return e?.phase==="running_tools"?{kind:"running_tools",tools:(e.activeTools??[]).map(e=>({id:e.id,name:e.name}))}:e?.phase==="streaming"||e?.phase==="compacting"||e?.phase==="idle"?null:{kind:"waiting_model"}}function o(e){if("assistant"!==e.role)return e;let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>("object"!=typeof e||null===e||Array.isArray(e)||"toolCall"!==e.type?null:{type:"toolCall",toolCallId:"string"==typeof e.toolCallId?e.toolCallId:"string"==typeof e.id?e.id:"",toolName:"string"==typeof e.toolName?e.toolName:"string"==typeof e.name?e.name:"",input:"object"!=typeof e.input||null===e.input||Array.isArray(e.input)?"object"!=typeof e.arguments||null===e.arguments||Array.isArray(e.arguments)?{}:e.arguments:e.input})??e);return{...e,content:n}}let s={isStreaming:!1,streamingMessage:null};function l(){return{role:"assistant",content:[],model:"",provider:"",timestamp:Date.now()}}function i(e,t,n){if(!Number.isInteger(t)||void 0===t||t<0)return e;let r=e.streamingMessage??l(),a=[...r.content],o=n(a[t]);return o?(a[t]=o,{isStreaming:!0,streamingMessage:{...r,content:a}}):e}function u(e){if(e.id||e.toolName)return{...e.id?{id:e.id}:{},...e.toolName?{toolName:e.toolName}:{}};let t=e.partial,n=e.contentIndex;if(!t||!Array.isArray(t.content)||void 0===n)return{};let r=t.content[n];return r&&"toolCall"===r.type?{..."string"==typeof r.id?{id:r.id}:"string"==typeof r.toolCallId?{id:r.toolCallId}:{},..."string"==typeof r.name?{toolName:r.name}:"string"==typeof r.toolName?{toolName:r.toolName}:{}}:{}}function c(e,t){switch(t.type){case"start":return{isStreaming:!0,streamingMessage:null};case"snapshot":return"assistant"===t.message.role?{isStreaming:!0,streamingMessage:t.message}:e;case"delta":var n=t.event;switch(n.type){case"start":return{isStreaming:!0,streamingMessage:e.streamingMessage??l()};case"text_start":return i(e,n.contentIndex,e=>e?.type==="text"?e:{type:"text",text:""});case"text_delta":return i(e,n.contentIndex,e=>({type:"text",text:(e?.type==="text"?e.text:"")+(n.delta??"")}));case"text_end":return i(e,n.contentIndex,e=>({type:"text",text:n.content??(e?.type==="text"?e.text:"")}));case"thinking_start":return i(e,n.contentIndex,e=>e?.type==="thinking"?e:{type:"thinking",thinking:""});case"thinking_delta":return i(e,n.contentIndex,e=>({type:"thinking",thinking:(e?.type==="thinking"?e.thinking:"")+(n.delta??"")}));case"thinking_end":return i(e,n.contentIndex,e=>({type:"thinking",thinking:n.content??(e?.type==="thinking"?e.thinking:"")}));case"toolcall_start":return i(e,n.contentIndex,e=>{let t=u(n);return e?.type==="toolCall"?{...e,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:e.rawInput??""}:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{},rawInput:""}});case"toolcall_delta":return i(e,n.contentIndex,e=>{let t=u(n),r=e?.type==="toolCall"?e:{type:"toolCall",toolCallId:t.id??"",toolName:t.toolName??"tool",input:{}};return{...r,...t.id?{toolCallId:t.id}:{},...t.toolName?{toolName:t.toolName}:{},rawInput:(r.rawInput??"")+(n.delta??"")}});case"toolcall_end":return i(e,n.contentIndex,()=>({type:"toolCall",toolCallId:n.toolCall?.id??"",toolName:n.toolCall?.name??"tool",input:n.toolCall?.arguments??{}}));default:return e}case"end":case"reset":return s;default:return e}}function d(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function p(e){if("assistant"!==e.role)return null;let t=e.timestamp;return"number"!=typeof t?null:`assistant:${t}`}class m extends Error{constructor(e,t,n){super(e),this.status=t,this.code=n,this.name="AgentCommandError"}}async function f(e,t){let n=await fetch(`/api/agent/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw new m(r.error??`HTTP ${n.status}`,n.status,r.code);return r.data}var g=n(28999);async function h(e,t){if(!t.length)return[];let n=await fetch("/api/images/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,images:t.map(e=>({data:e.data,mimeType:e.mimeType,name:e.name}))})}),r=await n.json().catch(()=>({}));if(!n.ok||r.error)throw Error(r.error??`Upload failed (HTTP ${n.status})`);return(r.uploaded??[]).map((e,n)=>({...e,previewUrl:t[n]?.previewUrl}))}async function y(e,t,n){let r,a=new TextDecoder,o="",s=e=>{if(e.startsWith("id: ")){r=e.slice(4);return}if(!e.startsWith("data: "))return;let n=e.slice(6);if("[DONE]"!==n)try{t(n,r)}catch{}finally{r=void 0}},l=new Promise(e=>{n?.aborted?e():n?.addEventListener("abort",()=>e(),{once:!0})});for(;;){let t=await Promise.race([e.read(),l.then(()=>({done:!0,value:void 0}))]);if(t.done)break;let n=(o+=a.decode(t.value,{stream:!0})).split("\n");for(let e of(o=n.pop()||"",n))s(e)}if(o.trim())for(let e of o.split("\n"))s(e)}var w=n(16865);let k="__annovibeStreamSessions__",b="__annovibeStreamListeners__",v="__annovibeStreamErrorCallbacks__";function x(){let e=globalThis;return e[k]||(e[k]=new Map),e[k]}function C(){let e=globalThis;return e[v]||(e[v]=new Map),e[v]}function T(e){return{sessionId:e,phase:"idle",startedAt:null,lastEventAt:null,lastHeartbeatAt:null,reconnectCount:0,lastSyncReason:null,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!1,error:null}}function I(e,t){let n;for(let r of(!(n=globalThis)[b]&&(n[b]=new Map),n[b]).get(e)??[])try{r(t)}catch{}}function _(e){e.textThrottleTimer&&(clearTimeout(e.textThrottleTimer),e.textThrottleTimer=null),e.textDirty&&(e.textDirty=!1,M(e))}function S(e,t=!1){let n=Date.now();if(e.snapshot.lastEventAt=n,!t){e.textDirty=!0,e.textThrottleTimer||(e.textThrottleTimer=setTimeout(()=>{e.textThrottleTimer=null,e.textDirty&&(e.textDirty=!1,M(e))},100));return}_(e),M(e)}function M(e,t){let n=Date.now(),r=function(e){let t=[];for(let n of e.toolCalls.values())t.push({type:"toolCall",toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??{}});let n=e.accumulatedText.trim();return n&&t.push({type:"text",text:n}),t}(e),a=(t??e.snapshot.phase)==="active";e.snapshot={...e.snapshot,phase:t??e.snapshot.phase,lastEventAt:n,accumulatedText:e.accumulatedText,toolCalls:[...e.toolCalls.values()],toolResults:[...e.toolResults.values()],statusText:a?function(e){if(e.activeToolId){let t=e.toolCalls.get(e.activeToolId);if(t){let e=Math.max(0,Math.floor((Date.now()-t.startedAt)/1e3));return`Running ${t.toolName||"tool"}… (${e}s)`}}return e.accumulatedText.trim()?"Generating response…":e.toolCalls.size>0?"Finishing tool results…":null}(e):e.snapshot.statusText,streamingMessage:a&&r.length>0?{role:"assistant",content:r}:null,isStreaming:a},I(e.snapshot.sessionId,{type:"snapshot-updated",snapshot:e.snapshot})}function A(e){E(e),e.idleCheckTimer=setInterval(()=>{if("connected"!==e.connectionState)return;let t=Math.max(e.snapshot.lastEventAt??0,e.snapshot.lastHeartbeatAt??0);if(Date.now()-t>=18e4){R(e),_(e);let t="Stream idle timeout — no activity for 180s.";e.snapshot={...e.snapshot,phase:"error",isStreaming:!1,streamingMessage:null,statusText:null,error:t},E(e),I(e.snapshot.sessionId,{type:"error",snapshot:e.snapshot});let n=C().get(e.snapshot.sessionId);if(n)try{n(e.snapshot.sessionId,t)}catch{}}},1e4)}function E(e){e.idleCheckTimer&&(clearInterval(e.idleCheckTimer),e.idleCheckTimer=null)}function R(e){e.toolProgressTimer&&(clearInterval(e.toolProgressTimer),e.toolProgressTimer=null)}function $(e){let t=x(),n=t.get(e);return n||(n={snapshot:T(e),accumulatedText:"",toolCalls:new Map,toolResults:new Map,toolProgressTimer:null,activeToolId:null,textThrottleTimer:null,textDirty:!1,connectionState:"idle",idleCheckTimer:null},t.set(e,n)),n}function N(e,t){let n=C();return n.set(e,t),()=>{n.get(e)===t&&n.delete(e)}}function D(e){let t=x(),n=t.get(e);n&&(R(n),E(n),_(n)),t.delete(e)}function L(e){let t=x().get(e);t&&(t.snapshot={...t.snapshot,reconnectCount:t.snapshot.reconnectCount+1,lastSyncReason:"sse-reconnect",lastEventAt:Date.now()},S(t,!0))}let U="__annovibeSessionMessageCache__";function P(){let e=globalThis;if(!e[U]){var t;let n={entries:new Map,cleanupTimer:null};e[U]=n,(t=n).cleanupTimer||(t.cleanupTimer=setInterval(()=>{let e=Date.now();for(let[n,r]of t.entries)e-r.loadedAt>72e5&&t.entries.delete(n)},6e4))}return e[U]}function j(e){let t=P(),n=t.entries.get(e);return n?Date.now()-n.loadedAt>72e5?(t.entries.delete(e),null):(n.loadedAt=Date.now(),{...n,messages:[...n.messages],entryIds:[...n.entryIds]}):null}function O(e,t,n,r,a){let o=P(),s=o.entries.get(e);if(!s)return;let l=new Set(s.entryIds),i=[],u=[];for(let e=0;e<t.length;e++){let r=n[e];r&&!l.has(r)&&(i.push(t[e]),u.push(r))}0!==i.length&&o.entries.set(e,{...s,messages:[...i,...s.messages],entryIds:[...u,...s.entryIds],hasMore:r,loadedMessagesCount:a,loadedAt:Date.now()})}function F(e){P().entries.delete(e)}var H=n(14755);function W(e){return{steering:e?.steering??[],followUp:e?.followUp??[]}}let q=[500,1500,3e3];function B(e,t){return new DOMException(e,t)}function J(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}-${Math.random().toString(36).slice(2,11)}`}function K(e,t){return e.trim()||0!==t?`text:${e}|images:${t}`:null}function z(e){return"string"==typeof e?K(e,0):Array.isArray(e)?K(e.filter(e=>!!e&&"object"==typeof e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n"),e.filter(e=>!!e&&"object"==typeof e&&"image"===e.type).length):null}function G(e){let t=new Map;for(let n of e){let e="user"!==n.role?null:z(n.content);e&&t.set(e,(t.get(e)??0)+1)}return t}function V(e,t,n){return e.sessionId===t&&(!e.leafId||n.includes(e.leafId))}function Y(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Q(e){let{session:t,newSessionCwd:n,onAgentEnd:l,onSessionCreated:i,onSessionForked:u,modelsRefreshKey:k,onBranchDataChange:b,chatInputRef:v}=e,C=null===t&&null!==n,[M,U]=(0,r.useState)(null),[Q,X]=(0,r.useState)(!C),[Z,ee]=(0,r.useState)(null),[et,en]=(0,r.useState)(null),[er,ea]=(0,r.useState)([]),[eo,es]=(0,r.useState)([]),[el,ei]=(0,r.useState)(0),[eu,ec]=(0,r.useState)(!1),[ed,ep]=(0,r.useState)(0),[em,ef]=(0,r.useReducer)(c,s),[eg,eh]=(0,r.useState)(!1),[ey,ew]=(0,r.useState)({}),[ek,eb]=(0,r.useState)([]),[ev,ex]=(0,r.useState)({}),[eC,eT]=(0,r.useState)({}),[eI,e_]=(0,r.useState)(null),[eS,eM]=(0,r.useState)("full"),[eA,eE]=(0,r.useState)([...H.SN]),[eR,e$]=(0,r.useState)([]),[eN,eD]=(0,r.useState)([]),[eL,eU]=(0,r.useState)([]),[eP,ej]=(0,r.useState)(null),[eO,eF]=(0,r.useState)([]),[eH,eW]=(0,r.useState)(null),[eq,eB]=(0,r.useState)(!1),[eJ,eK]=(0,r.useState)("auto"),[ez,eG]=(0,r.useState)(null),[eV,eY]=(0,r.useState)(null),[eQ,eX]=(0,r.useState)(null),[eZ,e0]=(0,r.useState)(null),[e1,e3]=(0,r.useState)(null),[e4,e5]=(0,r.useState)(null),[e2,e6]=(0,r.useState)(!1),[e8,e9]=(0,r.useState)(null),[e7,te]=(0,r.useState)(null),[tt,tn]=(0,r.useState)(null),[tr,ta]=(0,r.useState)({steering:[],followUp:[]}),[to,ts]=(0,r.useState)(null),tl=(0,r.useRef)(null),ti=(0,r.useRef)(t?.id??null),tu=(0,r.useRef)(!1),tc=(0,r.useRef)(null),td=(0,r.useRef)(null),tp=(0,r.useRef)(null),tm=(0,r.useRef)(!1),tf=(0,r.useRef)(null),tg=(0,r.useRef)(!1),th=(0,r.useRef)(null),ty=(0,r.useRef)(null),tw=(0,r.useRef)(new Map),tk=(0,r.useRef)(new Map),tb=(0,r.useRef)(new Map),tv=(0,r.useRef)(new Map),tx=(0,r.useRef)(null),tC=(0,r.useRef)([]),tT=(0,r.useRef)(null),tI=(0,r.useRef)(0),t_=(0,r.useRef)(!1),tS=(0,r.useRef)(0),tM=(0,r.useRef)(!1),tA=(0,r.useRef)(!1),tE=(0,r.useRef)(0),tR=(0,r.useRef)(null),t$=(0,r.useRef)(null),tN=(0,r.useRef)(0),tD=(0,r.useRef)(!1),tL=(0,r.useRef)(!1),tU=(0,r.useRef)(""),tP=(0,r.useRef)(null);(0,r.useEffect)(()=>{tx.current=et},[et]),(0,r.useEffect)(()=>{tD.current=em.isStreaming},[em.isStreaming]),(0,r.useEffect)(()=>{tv.current.clear()},[t?.id]);let tj=e.setNewSessionModel??e_,tO=e.setToolPreset??eM,tF=e.setMemoryTools??eE,tH=e1??M?.context.model??e4??null,tW=C?eI:tH,tq=(0,r.useCallback)(()=>(0,H.tE)(eS,eA),[eA,eS]),tB=(0,r.useCallback)(e=>e?.length?e.map((e,t)=>{let n=`Attachment ${t+1}: ${e.fileName} (${e.mimeType||"application/octet-stream"}, ${e.size} bytes)`;if(e.extractedText){let t=e.truncated?"\n[The extracted text was truncated before sending.]":"";return`${n}
|
|
2
|
+
${t}
|
|
3
|
+
${e.extractedText}`.trim()}return`${n}
|
|
4
|
+
[Text extraction unavailable: ${e.extractionError??"unsupported file type"}]`}).join("\n\n---\n\n"):"",[]),tJ=(0,r.useCallback)(async e=>{let t=await fetch(`/api/agent/${encodeURIComponent(e)}/prepare`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error??`Failed to prepare session (HTTP ${t.status})`)},[]),tK=(()=>{let e={input:0,output:0,cacheRead:0,cacheWrite:0};for(let t of er){if("assistant"!==t.role)continue;let n=t.usage;n&&(e.input+=n.input??0,e.output+=n.output??0,e.cacheRead+=n.cacheRead??0,e.cacheWrite+=n.cacheWrite??0)}return e.input+e.output+e.cacheRead+e.cacheWrite>0?{tokens:e}:null})(),tz=(0,r.useRef)(!1),tG=(0,r.useCallback)(async()=>{let e=ti.current;if(!e||tz.current||tM.current)return;tz.current=!0,t_.current=!0;let t=0,n=j(e);t=n?n.loadedMessagesCount:50;try{for(;;)try{let n=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=100&offset=${t}&deferThinking=1&deferMedia=1`);if(!n.ok)break;let r=await n.json();if(ti.current!==e)break;let a=r.context.messages,o=r.context.entryIds??[];if(0===a.length)break;ea(e=>[...a,...e]),es(e=>{let t=[...o,...e];return tC.current=t,t});let s=t+a.length;if(ep(s),tS.current=s,ec(r.hasMore??!1),O(e,a,o,r.hasMore??!1,s),t=s,!r.hasMore)break;await new Promise(e=>setTimeout(e,800))}catch{break}}finally{tz.current=!1,tM.current=!0,t_.current=!1}},[]),tV=(0,r.useCallback)(async(e,t=!1,n=!1,r=!1)=>{var a;let o=null;try{if(t&&X(!0),!n&&!tu.current&&!r){let n=j(e);if(n)return ei(n.totalMessages),ec(n.hasMore),ep(n.loadedMessagesCount),ea(n.messages),tC.current=n.entryIds,es(n.entryIds),tx.current=n.leafId,en(n.leafId),tS.current=n.loadedMessagesCount,t&&X(!1),n.hasMore&&!tM.current&&setTimeout(()=>{tG()},1500),null}let s=n?`/api/sessions/${encodeURIComponent(e)}?includeState&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=0&deferThinking=1&deferMedia=1`,l=t$.current;if(l?.sid===e&&!t)return null;l?.controller.abort(B("Session load superseded","AbortError"));let i=new AbortController;o=i,t$.current={sid:e,controller:i};let u=setTimeout(()=>{i.abort(B("Session load timed out after 30 seconds","TimeoutError"))},3e4),c=await fetch(s,{signal:i.signal}).finally(()=>clearTimeout(u));if(ti.current&&ti.current!==e)return null;if(404===c.status)return t&&(U(null),tx.current=null,en(null),ea([]),ee(null)),null;if(!c.ok)throw Error(`HTTP ${c.status}`);let d=await c.json();n?(ei(d.totalMessages??d.context.messages.length),ec(!1)):(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)),ep(d.context.messages.length),U(d),tx.current=d.leafId,en(d.leafId);let m=d.context.messages,f=G(m),g=new Map,h=Date.now();for(let[t,n]of tw.current)if(n.sessionId===e){if(h-n.createdAt>12e4){tw.current.delete(t);continue}if(n.confirmKey){let e=f.get(n.confirmKey)??0,r=g.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tw.current.delete(t),g.set(n.confirmKey,r+1))}}tk.current=f;let y=d.context.entryIds??[],w=[...tw.current.values()].filter(t=>V(t,e,y)).map(e=>e.message),k=w.length>0?[...m,...w]:m,b=function(e,t,n){if(0===t.size)return e;let r=!1,a=e.map(e=>{let a=p(e);if(!a)return e;let o=t.get(a);return o?n-o.observedAt>5e3||function(e,t){let n=e.timestamp,r=t.timestamp;if("number"!=typeof n||"number"!=typeof r||n!==r||e.role!==t.role)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}(o.message,e)?(t.delete(a),e):(r=!0,o.message):e});return r?a:e}(k,tv.current,Date.now()),v=tb.current.get(e);if(v){for(let[e,t]of v)h-t>12e4&&v.delete(e);0===v.size&&tb.current.delete(e)}let x=v?.size?v:null,C=x?new Set(y):null,T=!!x&&!!C&&[...x.keys()].some(e=>!C.has(e));x&&C&&!T&&tb.current.delete(e);let I=b.length;return!n&&(tS.current>I||T)?(ei(d.totalMessages??d.context.messages.length),ec(d.hasMore??!1)):(ea(e=>(function(e,t){if(e.length!==t.length)return t;let n=!1,r=t.map((t,r)=>Y(e[r],t)?e[r]:(n=!0,t));return n?r:e})(e,b)),tC.current=y,es(y),n?tS.current=I:tS.current=Math.max(tS.current,I),a={sessionId:e,leafId:d.leafId,messages:b,entryIds:y,totalMessages:d.totalMessages??d.context.messages.length,hasMore:!n&&(d.hasMore??!1),loadedMessagesCount:d.context.messages.length},P().entries.set(e,{...a,loadedAt:Date.now()})),e3(e=>{if(!e)return null;let t=d.context.model;return t?.provider===e.provider&&t.modelId===e.modelId?null:e}),ee(null),!d.agentState?.state?.thinkingLevel&&d.context.thinkingLevel&&"off"!==d.context.thinkingLevel&&eK(d.context.thinkingLevel),d.agentState??null}catch(e){if(e instanceof DOMException&&("AbortError"===e.name||"TimeoutError"===e.name)||e instanceof Error&&/aborted without reason|AbortError|Session load (?:timed out|superseded)/i.test(e.message))return null;return ee(String(e)),null}finally{o&&t$.current?.controller===o&&(t$.current=null),t&&X(!1)}},[tG]),tY=(0,r.useRef)(!1),tQ=(0,r.useCallback)(async()=>{if(tY.current)return;tY.current=!0;let e=ti.current;if(!e){tY.current=!1;return}try{let t=await fetch(`/api/sessions/${encodeURIComponent(e)}?limit=50&offset=${ed}&deferThinking=1&deferMedia=1`);if(!t.ok)return;let n=await t.json(),r=n.context.messages,a=n.context.entryIds??[];ea(e=>[...r,...e]),es(e=>{let t=[...a,...e];return tC.current=t,t}),ep(e=>e+r.length),ec(n.hasMore??!1),O(e,r,a,n.hasMore??!1,ed+r.length)}catch{}finally{tY.current=!1}},[ed]),tX=(0,r.useCallback)(async e=>{let t=ti.current;if(!t)return[];let n=tx.current,r=n?`?leafId=${encodeURIComponent(n)}`:"";try{let n=await fetch(`/api/sessions/${encodeURIComponent(t)}/shadowed${r}`);if(!n.ok)return[];let a=await n.json(),o=a.groups?.find(t=>t.compactionEntryId===e);return o?.messages??[]}catch{return[]}},[]),tZ=(0,r.useCallback)(async(e,t)=>{try{let n=t?`/api/sessions/${encodeURIComponent(e)}/context?leafId=${encodeURIComponent(t)}&deferThinking=1&deferMedia=1`:`/api/sessions/${encodeURIComponent(e)}/context?deferThinking=1&deferMedia=1`,r=await fetch(n);if(!r.ok)throw Error(`HTTP ${r.status}`);let a=await r.json(),o=a.context.messages,s=a.context.entryIds??[],l=G(o),i=new Map,u=Date.now();for(let[t,n]of tw.current)if(n.sessionId===e){if(u-n.createdAt>12e4){tw.current.delete(t);continue}if(n.confirmKey){let e=l.get(n.confirmKey)??0,r=i.get(n.confirmKey)??0;e-r>n.confirmCountAtCreate&&(tw.current.delete(t),i.set(n.confirmKey,r+1))}}tk.current=l;let c=[...tw.current.values()].filter(t=>V(t,e,s)).map(e=>e.message);ea(c.length>0?[...o,...c]:o),tC.current=s,es(s)}catch(e){console.error("Failed to load context:",e)}},[]),t0=(0,r.useCallback)(async e=>{try{let t=await f(e,{type:"get_tools"});t&&(tO((0,H.ES)(t)),tF((0,H.IB)(t)))}catch(e){console.error("Failed to load tools:",e)}},[tF,tO]),t1=(0,r.useCallback)(async e=>{try{let t=await f(e,{type:"get_commands"});e$(Array.isArray(t?.commands)?t.commands:[])}catch{e$([])}},[]),t3=(0,r.useCallback)((e,t={})=>{tl.current?.close(),tl.current=null;let n=`/api/agent/${encodeURIComponent(e)}/events${t.replay?"?replay=1":""}`;return!function(e){let t=$(e);if("active"===t.snapshot.phase)return S(t,!0),A(t),t.snapshot;let n=Date.now();t.snapshot={...T(e),phase:"active",startedAt:n,lastEventAt:n,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},A(t),S(t,!0),t.snapshot}(e),new Promise((r,a)=>{let o=!1,s=!1,l=null,i=e=>{if(!o){if(o=!0,clearTimeout(u),e){l?.close(),tl.current===l&&(tl.current=null),a(e);return}r()}},u=setTimeout(()=>{t.requireConnected?i(Error("Timed out waiting for event stream connection")):i()},t.timeoutMs??3e4);tl.current=l=function(e){let{url:t,onEvent:n,onStateChange:r,onFatalError:a,maxReconnectAttempts:o=1/0,reconnectBaseMs:s=1e3,reconnectMaxMs:l=3e4,autoReconnect:i=!0}=e,u="idle",c=new AbortController,d=0,p=null,m=null,f=!1,g=(e,t)=>{t&&(m=t),n(e,t)},h=e=>{u!==e&&(u=e,r?.(e))},w=()=>{null!==p&&(clearTimeout(p),p=null)},k=()=>{if(f)return;if(!i)return void h("error");if(d>=o){h("error"),a?.(Error(`Max reconnect attempts (${o}) reached`));return}let e=Math.min(l,s*2**d);d+=1,h("connecting"),p=setTimeout(()=>{p=null,b()},e)},b=async()=>{if(!f){w(),c=new AbortController,h("connecting");try{let e=await fetch(t,{signal:c.signal,headers:{Accept:"text/event-stream","Cache-Control":"no-cache",...m?{"Last-Event-ID":m}:{}}});if(!e.ok)throw Error(`HTTP ${e.status}: ${e.statusText}`);let n=e.body;if(!n)throw Error("Response has no readable body");let r=n.getReader();if(h("connected"),d=0,await y(r,g,c.signal),c.signal.aborted)try{await r.cancel()}catch{}r.releaseLock(),h("closed"),!f&&i&&k()}catch(e){if(f||e instanceof DOMException&&"AbortError"===e.name)return void h("closed");h("error"),i&&k()}}};return{get state(){return u},connect:()=>{f=!1,d=0,w(),b()},close:()=>{f=!0,w(),c.abort(),h("closed")},get abortController(){return c}}}({url:n,onEvent:t=>{try{let n=JSON.parse(t);if("connected"===n.type&&i(),ti.current!==e)return;tc.current?.(n)}catch{}},onStateChange:t=>{!function(e,t){let n=x().get(e);if(!n)return;let r=n.connectionState;n.connectionState=t,"connected"===t&&"connected"!==r&&(n.snapshot={...n.snapshot,lastEventAt:Date.now(),lastHeartbeatAt:Date.now()},A(n)),"connected"!==t&&"connected"===r&&E(n)}(e,t),"connected"===t&&(s&&(L(e),td.current?.(e,"sse_reconnected")),s=!0)},reconnectBaseMs:1e3,reconnectMaxMs:3e4}),l.connect()})},[]),t4=(0,r.useCallback)(async(e,t="manual")=>{if(!e||ti.current!==e)return;let n=tI.current;try{let t=await fetch(`/api/agent/${encodeURIComponent(e)}`),r=await t.json().catch(()=>({}));if(ti.current!==e||tI.current!==n)return;r.running?(tu.current=!0,eh(!0),tn(a(r.state)),tl.current&&"closed"!==tl.current.state&&"error"!==tl.current.state||(L(e),t3(e,{replay:!0}))):(tu.current=!1,tl.current?.close(),tl.current=null,D(e),eh(!1),tn(null),eG(null),ef({type:"end"}),F(e),await tV(e,!1,!1,!0)),r.state?.contextUsage!==void 0&&eY(r.state.contextUsage??null),r.state?.systemPrompt!==void 0&&eX(r.state.systemPrompt??null),r.state?.isCompacting!==void 0&&e6(r.state.isCompacting),r.state?.thinkingLevel!==void 0&&eK(r.state.thinkingLevel??"auto"),r.state?.queuedMessages!==void 0&&ta(W(r.state.queuedMessages)),Array.isArray(r.state?.extensionStatuses)&&eD(r.state.extensionStatuses),Array.isArray(r.state?.extensionWidgets)&&eU(r.state.extensionWidgets),r.state?.isBashRunning&&(tL.current=!0,eB(!0),eh(!0),tn({kind:"running_tools",tools:[{id:"bash",name:"bash"}]}))}catch{}},[t3,tV]);(0,r.useEffect)(()=>{td.current=t4},[t4]),(0,r.useEffect)(()=>{tu.current=eg},[eg]),tc.current=(0,r.useCallback)(e=>{let t=ti.current;switch(t&&function(e,t){let n=$(e),r=Date.now();switch(t.type){case"agent_start":if("active"===n.snapshot.phase)return S(n,!0),n.snapshot;return R(n),n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.activeToolId=null,n.snapshot={...T(e),phase:"active",startedAt:r,lastEventAt:r,isStreaming:!0,streamingMessage:{role:"assistant",content:[]}},A(n),S(n,!0),n.snapshot;case"message_update":{let e=t.message;if(e?.role==="assistant"){let t=e.content;for(let e of Array.isArray(t)?t:[])"object"==typeof e&&null!==e&&"type"in e&&("text"===e.type?n.accumulatedText=e.text??"":"toolCall"===e.type&&e.toolCallId&&!n.toolCalls.has(e.toolCallId)&&n.toolCalls.set(e.toolCallId,{...e,startedAt:r}))}else{let e=t.assistantMessageEvent;e?.type==="text_delta"?n.accumulatedText+=e.delta??"":e?.type==="text_end"?n.accumulatedText=e.content??n.accumulatedText:(e?.type==="toolcall_start"||e?.type==="toolcall_delta")&&e.id&&!n.toolCalls.has(e.id)&&n.toolCalls.set(e.id,{type:"toolCall",toolCallId:e.id,toolName:e.toolName??"tool",input:{},startedAt:r})}return S(n,!1),n.snapshot}case"tool_execution_start":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o=t.input??{};if(!e)return n.snapshot;let s=n.toolCalls.get(e);return n.toolCalls.set(e,{type:"toolCall",toolCallId:e,toolName:a,input:s&&Object.keys(s.input).length>0?s.input:o,startedAt:s?.startedAt??r}),n.activeToolId=e,R(n),n.activeToolId&&(n.toolProgressTimer=setInterval(()=>S(n,!0),1e3)),S(n,!0),n.snapshot}case"tool_execution_end":{let e="string"==typeof t.toolCallId?t.toolCallId:"",a="string"==typeof t.toolName?t.toolName:"tool",o="string"==typeof t.result?t.result:JSON.stringify(t.result??"");if(e){let s=n.toolCalls.get(e);s&&n.toolCalls.set(e,{...s,endedAt:r}),n.toolResults.set(e,{role:"toolResult",toolCallId:e,toolName:a,content:[{type:"text",text:o}],isError:!!t.isError,timestamp:r}),n.activeToolId===e&&(n.activeToolId=null,R(n))}return S(n,!0),n.snapshot}case"message_end":return _(n),S(n,!0),n.snapshot;case"agent_end":{if(_(n),R(n),n.activeToolId=null,!0===t.willRetry)return n.accumulatedText="",n.toolCalls.clear(),n.toolResults.clear(),n.snapshot={...n.snapshot,phase:"active",lastEventAt:r,accumulatedText:"",toolCalls:[],toolResults:[],statusText:null,streamingMessage:null,isStreaming:!0,error:null},A(n),I(e,{type:"snapshot-updated",snapshot:n.snapshot}),n.snapshot;E(n);let a="string"==typeof t.error?t.error:null;return n.snapshot={...n.snapshot,phase:a?"error":"completed",isStreaming:!1,streamingMessage:null,statusText:null,error:a},I(e,a?{type:"error",snapshot:n.snapshot}:{type:"completed",snapshot:n.snapshot}),n.snapshot}case"heartbeat":return n.snapshot={...n.snapshot,lastHeartbeatAt:r},n.snapshot;default:return n.snapshot}}(t,e),"heartbeat"!==e.type&&(tN.current=Date.now()),e.type){case"prompt_admitted":case"agent_start":ts(null),tu.current=!0,eh(!0),tn({kind:"waiting_model"}),ef({type:"start"});break;case"agent_end":if(!0===e.willRetry){tu.current=!0,eh(!0),tn({kind:"waiting_model"});break}if(tu.current=!1,eh(!1),tn(null),eG(null),ef({type:"end"}),t){tR.current&&clearTimeout(tR.current);let e=tI.current,n=0,r=async()=>{if(ti.current!==t||tu.current||tI.current!==e)return;F(t),await tV(t,!1,!1,!0);let a=q[n++];void 0===a||ti.current!==t||tu.current||tI.current!==e||(tR.current=setTimeout(()=>{tR.current=null,r()},a))};r(),fetch(`/api/agent/${encodeURIComponent(t)}`).then(e=>e.json()).then(e=>{e.state?.contextUsage!==void 0&&eY(e.state.contextUsage??null),e.state?.systemPrompt!==void 0&&eX(e.state.systemPrompt??null),e.state?.isCompacting!==void 0&&e6(e.state.isCompacting)}).catch(()=>{})}l?.();break;case"agent_settled":tn(null),eG(null),tu.current&&(tu.current=!1,eh(!1),ef({type:"end"}));break;case"message_start":case"message_update":{let t=e.message;if(t?.role==="user")break;tu.current||(tu.current=!0,eh(!0),tn({kind:"waiting_model"}));let n=e.assistantMessageEvent;t?.role==="assistant"?ef({type:"snapshot",message:o(t)}):n&&ef({type:"delta",event:n}),tn(null);break}case"message_end":{let n=e.message,r="string"==typeof e.__entryId?e.__entryId:null,a=tu.current;if(n&&"user"!==n.role){"assistant"===n.role&&"error"===n.stopReason&&n.errorMessage?.trim()&&ts(`Model response failed: ${n.errorMessage.trim()}`);let e=o(n),a=p(e);if(a&&tv.current.set(a,{observedAt:Date.now(),message:e}),!(r&&tC.current.includes(r))){if(t&&r){let e=tb.current.get(t)??new Map;e.set(r,Date.now()),tb.current.set(t,e)}ea(t=>t.some(t=>Y(t,e))?t:[...t,e]),r&&es(e=>{if(e.includes(r))return e;let t=[...e,r];return tC.current=t,t})}}a&&(ef({type:"reset"}),tn({kind:"waiting_model"}));break}case"replay_gap":t&&(F(t),tV(t,!1,!1,!0));break;case"prompt_done":if(!tu.current)break;t4(ti.current??"","prompt_done");break;case"prompt_error":{let n="string"==typeof e.error&&e.error.trim()?e.error.trim():"The model request failed before producing a response.";if(tu.current=!1,eh(!1),tn(null),eG(null),ef({type:"end"}),tl.current?.close(),tl.current=null,t){for(let[e,n]of(D(t),tw.current))n.sessionId===t&&"prompt"===n.kind&&tw.current.delete(e);F(t),tV(t,!1,!1,!0)}ts(`Model request failed: ${n}`),l?.();break}case"tool_execution_start":{let t=e.toolCallId,n=e.toolName,r=e.args,a="bash"===n&&"string"==typeof r?.command?r.command:void 0;tn(e=>{let r=e?.kind==="running_tools"?[...e.tools]:[];return r.some(e=>e.id===t)||r.push({id:t,name:n,args:a}),{kind:"running_tools",tools:r}});break}case"tool_execution_update":{let t=e.toolCallId,n=e.toolName,r=function(e){if(!d(e))return null;let t=e.content;if(!Array.isArray(t))return null;let n=t.filter(e=>d(e)&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("\n").split(/\r?\n/),r="";for(let e=n.length-1;e>=0&&!(r=n[e].trim());e-=1);if(!r)return null;let a=r.replace(/\s+/g," ");return a.length<=500?a:`...${a.slice(-497)}`}(e.partialResult);if(!t)break;tn(e=>{let a=e?.kind==="running_tools"?[...e.tools]:[],o=a.find(e=>e.id===t),s={id:t,name:n||o?.name||"tool",args:o?.args,progress:r??o?.progress};return{kind:"running_tools",tools:[...a.filter(e=>e.id!==t),s]}});break}case"tool_execution_end":{let t=e.toolCallId;tn(e=>{if(e?.kind!=="running_tools")return e;let n=e.tools.filter(e=>e.id!==t);return 0===n.length?{kind:"waiting_model"}:{kind:"running_tools",tools:n}});break}case"extension_ui_request":{let t="string"==typeof e.method?e.method:"";if("select"===t||"confirm"===t||"input"===t||"editor"===t){ej({id:String(e.id??""),method:t,title:"string"==typeof e.title?e.title:"",...Array.isArray(e.options)?{options:e.options}:{},..."string"==typeof e.message?{message:e.message}:{},..."string"==typeof e.placeholder?{placeholder:e.placeholder}:{},..."string"==typeof e.prefill?{prefill:e.prefill}:{}});break}if("notify"===t){let t="warning"===e.notifyType||"error"===e.notifyType?e.notifyType:"info",n={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,message:String(e.message??""),type:t};eF(e=>[...e,n].slice(-4)),setTimeout(()=>{eF(e=>e.filter(e=>e.id!==n.id))},8e3);break}if("setStatus"===t){let t=String(e.statusKey??"");if(!t)break;let n="string"==typeof e.statusText?e.statusText:null;eD(e=>{let r=e.filter(e=>e.key!==t);return n?[...r,{key:t,text:n}]:r});break}if("setWidget"===t){let t=String(e.widgetKey??"");if(!t)break;let n=Array.isArray(e.widgetLines)?e.widgetLines.filter(e=>"string"==typeof e):null;eU(r=>{let a=r.filter(e=>e.key!==t);return n&&n.length>0?[...a,{key:t,lines:n,placement:"string"==typeof e.widgetPlacement?e.widgetPlacement:"aboveEditor"}]:a});break}if("dismiss"===t){ej(t=>t?.id===e.id?null:t);break}if("set_editor_text"===t&&"string"==typeof e.text){v?.current?.setText?.(e.text);break}"setTitle"===t&&"string"==typeof e.title&&(document.title=e.title);break}case"extension_error":{let t={id:`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,message:"string"==typeof e.error?e.error:"Extension command failed",type:"error"};eF(e=>[...e,t].slice(-4)),setTimeout(()=>{eF(e=>e.filter(e=>e.id!==t.id))},8e3);break}case"bash_execution_start":{let t=String(e.command??"");tL.current=!0,eB(!0),eW({command:t,output:""}),eh(!0),tn({kind:"running_tools",tools:[{id:"bash",name:"bash",args:t}]});break}case"bash_execution_update":{let t="string"==typeof e.chunk?e.chunk:"";if(!t)break;tU.current+=t,tP.current||(tP.current=setTimeout(()=>{tP.current=null;let e=tU.current;tU.current="",e&&eW(t=>t?{...t,output:t.output+e}:t)},60));break}case"bash_done":{tP.current&&(clearTimeout(tP.current),tP.current=null),tU.current="",tL.current=!1,eB(!1),eW(null),eh(!1),tn(null);let e=ti.current;e&&(F(e),tV(e,!1,!1,!0));break}case"queue_update":ta(W({steering:Array.isArray(e.steering)?e.steering:[],followUp:Array.isArray(e.followUp)?e.followUp:[]}));break;case"auto_retry_start":ts(null),tu.current=!0,eh(!0),tn({kind:"waiting_model"}),eG({attempt:e.attempt,maxAttempts:e.maxAttempts,errorMessage:e.errorMessage});break;case"auto_retry_end":eG(null),!1===e.success&&"string"==typeof e.finalError&&e.finalError.trim()?ts(`Model response failed after retries: ${e.finalError.trim()}`):!0===e.success&&ts(null);break;case"auto_compaction_start":case"compaction_start":e6(!0),e9(null);break;case"auto_compaction_end":case"compaction_end":e6(!1),e.errorMessage?e9(e.errorMessage):!e.aborted&&ti.current&&tV(ti.current)}},[tV,l,t4,v]);let t5=(0,r.useCallback)(async(e,r,a,o)=>{if(!e.trim()&&!r?.length&&!a?.length||eg)return;tI.current+=1;let s=tB(a),l=e.trim()?s?`${e}
|
|
5
|
+
|
|
6
|
+
Attached document text:
|
|
7
|
+
|
|
8
|
+
${s}`:e:s?`Attached document text:
|
|
9
|
+
|
|
10
|
+
${s}`:"",u=[],c=C?n:t?.cwd??M?.info?.cwd;if(r?.length&&c)try{u=await h(c,r)}catch(e){ts(e instanceof Error?e.message:String(e));return}let d=u.length?u.map(e=>{var t;return{type:"image",path:e.path,mimeType:e.mimeType,name:e.name,source:{type:"url",url:(t=e.path,`/api/files/${(0,g.HG)(t)}?type=read`),media_type:e.mimeType}}}):r?.map(e=>({type:"image",source:{type:"base64",media_type:e.mimeType,data:e.data}})),p={role:"user",content:d?.length?[...l.trim()?[{type:"text",text:l}]:[],...d]:l,timestamp:Date.now()},y=J(),w=C?null:t?.id??null;w&&F(w);let k=tx.current,b=z(p.content);tw.current.set(y,{localId:y,sessionId:w??"__new__",leafId:k,message:p,createdAt:Date.now(),kind:"prompt",confirmKey:b,confirmCountAtCreate:C?0:b?tk.current.get(b)??0:0}),ea(e=>[...e,p]),ts(null),tu.current=!0,eh(!0),tn({kind:"waiting_model"}),ef({type:"start"}),tg.current=!0;let x=ek.find(e=>e.provider===tH?.provider&&e.id===tH?.modelId)?.input,T=!x||0===x.length||x.includes("image")?r?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0;try{if(C&&n){eI&&e5(eI);let t=o??tq(),r=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:n,type:"prompt",message:l,toolNames:t,deferPrompt:!0,...T?.length?{images:T}:{},...eI?{provider:eI.provider,modelId:eI.modelId}:{},..."auto"!==eJ?{thinkingLevel:eJ}:{}})}),a=await r.json().catch(()=>({}));if(!r.ok||a.error||!a.sessionId)throw Error(a.error??`HTTP ${r.status}`);let s=a.sessionId;ti.current=s;let u=tw.current.get(y);u&&(u.sessionId=s),tp.current?.(),tp.current=N(s,()=>{ti.current===s&&(eh(!1),tn(null))}),tT.current=s,await t3(s,{requireConnected:!0,timeoutMs:1e4}),await f(s,{type:"prompt",message:l,toolNames:t,...T?.length?{images:T}:{}}),i?.({id:s,path:"",cwd:n,name:void 0,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e})}else if(t){let e=o??tq();await tJ(t.id),tp.current?.(),tp.current=N(t.id,()=>{ti.current===t.id&&(eh(!1),tn(null))}),await t3(t.id,{requireConnected:!0,timeoutMs:1e4}),await f(t.id,{type:"prompt",message:l,toolNames:e,leafId:k,...tH?{provider:tH.provider,modelId:tH.modelId}:{},..."auto"!==eJ?{thinkingLevel:eJ}:{},...T?.length?{images:T}:{}})}}catch(n){let t=ti.current;if(tw.current.delete(y),ea(e=>e.filter(e=>e!==p)),n instanceof m&&(409===n.status||"SESSION_BUSY"===n.code)){ts("This session is already running in another tab. Showing that active run instead."),tu.current=!0,eh(!0),tn({kind:"waiting_model"}),ef({type:"start"}),t&&(tl.current?.close(),tl.current=null,L(t),t3(t,{replay:!0}),td.current?.(t,"prompt_conflict"));return}if(console.error("Failed to send message:",n),C&&ti.current){let e=ti.current;ti.current=null,tT.current=null,fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{})}v?.current&&e.trim()&&v.current.insertIfEmpty(e),v?.current&&r?.length&&v.current.addBase64Images?.(r.map(({data:e,mimeType:t})=>({data:e,mimeType:t}))),ts(n instanceof Error?n.message:String(n)),tl.current?.close(),tl.current=null,t&&D(t),tu.current=!1,eh(!1),tn(null),ef({type:"end"})}},[C,n,eI,tq,eJ,t,M?.info?.cwd,eg,t3,i,tB,ek,tH,tJ,v]),t2=(0,r.useCallback)(async()=>{let e=ti.current;if(!e)return;let t=tL.current;tu.current=!1,eB(!1),eW(null),ts(null),eh(!1),tn(null),ef({type:"end"}),tl.current?.close(),tl.current=null,D(e),F(e);try{await f(e,{type:t?"abort_bash":"abort"}),await tV(e,!1,!1,!0)}catch(t){console.error("Failed to abort:",t),await tV(e,!1,!1,!0)}finally{t&&(tL.current=!1,eB(!1),eW(null))}},[tV]),t6=(0,r.useCallback)(async(e,t)=>{let n=ti.current,r=e.trim();if(n&&r){tL.current=!0,eB(!0),ts(null),eW({command:r,output:""}),tu.current=!0,eh(!0),tn({kind:"running_tools",tools:[{id:"bash",name:"bash",args:r}]});try{await f(n,{type:"bash",command:r,excludeFromContext:t})}catch(e){ts(e instanceof Error?e.message:String(e))}finally{tP.current&&(clearTimeout(tP.current),tP.current=null),tU.current="",tL.current=!1,eB(!1),eW(null),tu.current=!1,eh(!1),tn(null),F(n),await tV(n,!1,!1,!0)}}},[tV]),t8=(0,r.useCallback)(async e=>{let t=ti.current;if(t){e0(e);try{let{cancelled:n,newSessionId:r}=await f(t,{type:"fork",entryId:e})??{};!n&&r&&u?.(r)}catch(e){console.error("Fork failed:",e)}finally{e0(null)}}},[u]),t9=(0,r.useCallback)(async e=>{let r=ti.current,a=M?.info?.cwd??t?.cwd??n??null;if(!r||!a)return{ok:!1,error:"No active session to fork"};if(tu.current)return{ok:!1,error:"Agent is still running"};try{let t=tq(),n=await fetch("/api/agent/new",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a,type:"prompt",parentSessionId:r,deferPrompt:!0,toolNames:t,...tH?{provider:tH.provider,modelId:tH.modelId}:{},..."auto"!==eJ?{thinkingLevel:eJ}:{}})}),o=await n.json().catch(()=>({}));if(!n.ok||o.error||!o.sessionId)return{ok:!1,error:o.error??`HTTP ${n.status}`};let s=o.sessionId;try{await f(s,{type:"append_message",message:e,customType:"fork_handoff",display:!0})}catch{}return i?.({id:s,path:"",cwd:a,created:new Date().toISOString(),modified:new Date().toISOString(),messageCount:1,firstMessage:e.slice(0,120),parentSessionId:r}),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},[M?.info?.cwd,t?.cwd,n,tH,eJ,tq,i]),t7=(0,r.useCallback)(async e=>{let t=ti.current;t&&(tb.current.delete(t),F(t),tx.current=e,en(e),await tZ(t,e))},[tZ]),ne=(0,r.useCallback)(async e=>{tx.current=e,en(e);let t=ti.current;t&&(tb.current.delete(t),F(t),await tZ(t,e))},[tZ]),nt=(0,r.useCallback)(async(e,t)=>{if(C)return void tj({provider:e,modelId:t});let n=ti.current;if(n)try{var r;ts(null);let a=await f(n,{type:"set_model",provider:e,modelId:t}),o={provider:a.provider,modelId:a.id};a.thinkingLevel&&(r=a.thinkingLevel,"auto"===r||"off"===r||"minimal"===r||"low"===r||"medium"===r||"high"===r||"xhigh"===r)&&eK(a.thinkingLevel),e3(o),U(e=>e?{...e,context:{...e.context,model:o}}:e)}catch(t){let e=t instanceof Error?t.message:String(t);console.error("Failed to set model:",t),ts(e)}},[C,tj]),nn=(0,r.useCallback)(async()=>{let e=ti.current;if(e&&!e2){e6(!0),e9(null),te(null);try{let t=await f(e,{type:"compact"});t?.reducedBy!=null&&te(`Compacted ~${t.tokensBefore??"?"} → ~${t.tokensAfter??"?"} tokens (−${t.reducedBy})`),await tV(e,!0)}catch(e){e9(e instanceof Error?e.message:String(e))}finally{e6(!1)}}},[e2,tV]),nr=(0,r.useCallback)(async(e,t,n)=>{let r=ti.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
|
|
11
|
+
|
|
12
|
+
Attached document text:
|
|
13
|
+
|
|
14
|
+
${a}`:e:a?`Attached document text:
|
|
15
|
+
|
|
16
|
+
${a}`:"",s=ek.find(e=>e.provider===tH?.provider&&e.id===tH?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:`[steer] ${o}`,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tw.current.set(u,{localId:u,sessionId:r,leafId:tx.current,message:i,createdAt:Date.now(),kind:"steer",confirmKey:c,confirmCountAtCreate:c?tk.current.get(c)??0:0}),ea(e=>[...e,i]);try{await f(r,{type:"steer",message:o,...l?.length?{images:l}:{}})}catch(e){tw.current.delete(u),console.error("Failed to steer:",e)}},[tB,ek,tH]),na=(0,r.useCallback)(async(e,t,n)=>{let r=ti.current;if(!r)return;F(r);let a=tB(n),o=e.trim()?a?`${e}
|
|
17
|
+
|
|
18
|
+
Attached document text:
|
|
19
|
+
|
|
20
|
+
${a}`:e:a?`Attached document text:
|
|
21
|
+
|
|
22
|
+
${a}`:"",s=ek.find(e=>e.provider===tH?.provider&&e.id===tH?.modelId)?.input,l=!s||0===s.length||s.includes("image")?t?.map(e=>({type:"image",data:e.data,mimeType:e.mimeType})):void 0,i={role:"user",content:o,timestamp:Date.now()},u=J(),c=K(o,l?.length??0);tw.current.set(u,{localId:u,sessionId:r,leafId:tx.current,message:i,createdAt:Date.now(),kind:"follow_up",confirmKey:c,confirmCountAtCreate:c?tk.current.get(c)??0:0}),ea(e=>[...e,i]);try{await f(r,{type:"follow_up",message:o,...l?.length?{images:l}:{}})}catch(e){tw.current.delete(u),console.error("Failed to follow up:",e)}},[tB,ek,tH]),no=(0,r.useCallback)(async()=>{let e=ti.current;if(e)try{await f(e,{type:"abort_compaction"})}catch(e){console.error("Failed to abort compaction:",e)}},[]),ns=(0,r.useCallback)(async e=>{if(eK(e),"auto"===e)return;let t=ti.current;if(t)try{await f(t,{type:"set_thinking_level",level:e})}catch(e){console.error("Failed to set thinking level:",e)}},[]),nl=(0,r.useCallback)(async e=>{tO(e);let t=(0,H.tE)(e,eA),n=ti.current;if(n)try{await f(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set tools:",e)}},[eA,tO]),ni=(0,r.useCallback)(async e=>{tF(e);let t=(0,H.tE)(eS,e),n=ti.current;if(n)try{await f(n,{type:"set_tools",toolNames:t})}catch(e){console.error("Failed to set memory tools:",e)}},[tF,eS]),nu=(0,r.useCallback)((e="smooth")=>{th.current?.scrollIntoView({behavior:e})},[]),nc=(0,r.useCallback)(()=>{let e=ty.current,t=tf.current;if(!e||!t)return;let n=t.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;e.scrollTo({top:n-16,behavior:"smooth"})},[]);(0,r.useEffect)(()=>{if(t){var e;let n;if(ti.current=t.id,t.id===tT.current)return tT.current=null,()=>{tR.current&&clearTimeout(tR.current),tR.current=null,tl.current?.close(),tl.current=null,tp.current?.(),tp.current=null};tM.current=!1,tS.current=0;let r=(e=t.id,(n=x().get(e))&&"idle"!==n.snapshot.phase?n.snapshot:null);r?.phase==="active"&&(tu.current=!0,eh(!0),tn({kind:"waiting_model"}),ef({type:"start"})),(async()=>{let e=await tV(t.id,!0,!0,!0);ti.current===t.id&&(await t0(t.id),t1(t.id),e?.running?(tu.current=!0,eh(!0),tn(a(e.state)),ef({type:"start"}),t3(t.id,{replay:!0}),tp.current?.(),tp.current=N(t.id,()=>{ti.current===t.id&&td.current?.(t.id,"stream_watchdog")})):e&&r?.phase==="active"?(tu.current=!1,eh(!1),tn(null),ef({type:"end"}),D(t.id)):e||r?.phase!=="active"||td.current?.(t.id,"mount_state_load_failed"),e?.state&&(void 0!==e.state.isCompacting&&e6(e.state.isCompacting),void 0!==e.state.contextUsage&&eY(e.state.contextUsage??null),void 0!==e.state.systemPrompt&&eX(e.state.systemPrompt??null),void 0!==e.state.queuedMessages&&ta(W(e.state.queuedMessages)),Array.isArray(e.state.extensionStatuses)&&eD(e.state.extensionStatuses),Array.isArray(e.state.extensionWidgets)&&eU(e.state.extensionWidgets),e.state.isBashRunning&&(tL.current=!0,eB(!0),eh(!0),tn({kind:"running_tools",tools:[{id:"bash",name:"bash"}]})),void 0!==e.state.thinkingLevel&&eK(e.state.thinkingLevel??"auto")),e&&!tu.current&&e.state?.contextUsage===void 0&&td.current?.(t.id,"mount_context_usage"))})()}return()=>{tT.current&&ti.current===tT.current||(tR.current&&clearTimeout(tR.current),tR.current=null,t$.current?.controller.abort(B("Session changed","AbortError")),t$.current=null,tl.current?.close(),tl.current=null,tp.current?.(),tp.current=null)}},[t3,tV,t0,t1,b,t]),(0,r.useEffect)(()=>{let e=()=>{let e=ti.current;e&&t4(e,"foreground")},t=()=>{"visible"===document.visibilityState&&e()};return document.addEventListener("visibilitychange",t),window.addEventListener("focus",e),window.addEventListener("online",e),()=>{document.removeEventListener("visibilitychange",t),window.removeEventListener("focus",e),window.removeEventListener("online",e)}},[t4]),(0,r.useEffect)(()=>{let e=ti.current;if(e)return tA.current=!1,(0,w.O)(t=>{let n=t.includes(e),r=tA.current;tA.current=n,n&&!tu.current?(F(e),t4(e,"running_feed_start")):!n&&r&&(F(e),tu.current?t4(e,"running_feed_stop"):tV(e,!1,!1,!0))})},[tV,t4,t?.id]),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{let e=ti.current;e&&(tu.current?(t4(e,"interval"),tD.current&&Date.now()-tN.current>25e3&&(tN.current=Date.now(),F(e),tV(e,!1,!1,!0))):Date.now()-tE.current>=3e4?(tE.current=Date.now(),F(e),tV(e,!1,!1,!0)):tV(e))},15e3);return()=>window.clearInterval(e)},[tV,t4]),(0,r.useEffect)(()=>{b&&b(M?.tree??[],et,ne)},[M?.tree,et,ne,b]),(0,r.useEffect)(()=>{er.length>0&&!t_.current&&(tg.current?(tg.current=!1,tm.current=!0,nc()):tm.current?tu.current||nu("smooth"):(tm.current=!0,nu("instant")))},[er.length,eg,nu,nc]),(0,r.useEffect)(()=>{fetch("/api/models").then(e=>e.json()).then(e=>{if(ew(e.models),e.thinkingLevels&&ex(e.thinkingLevels),e.thinkingLevelMaps&&eT(e.thinkingLevelMaps),e.modelList&&(eb(e.modelList),C&&e.modelList.length>0)){let t=e.defaultModel,n=t&&e.modelList.find(e=>e.id===t.modelId&&e.provider===t.provider);tj(n?{provider:n.provider,modelId:n.id}:{provider:e.modelList[0].provider,modelId:e.modelList[0].id})}}).catch(()=>{})},[C,k,tj]),(0,r.useEffect)(()=>{if(!e8)return;let e=setTimeout(()=>e9(null),3e3);return()=>clearTimeout(e)},[e8]),(0,r.useEffect)(()=>{if(!e7)return;let e=setTimeout(()=>te(null),6e3);return()=>clearTimeout(e)},[e7]);let nd=(0,r.useCallback)(async(e,t)=>{let n=ti.current;if(ej(t=>t?.id===e?null:t),n)try{await f(n,{type:"extension_ui_response",id:e,...t})}catch(e){ts(e instanceof Error?e.message:String(e))}},[]),np=(0,r.useCallback)(e=>{eF(t=>t.filter(t=>t.id!==e))},[]),nm=(0,r.useCallback)(async()=>{let e=ti.current;if(e)try{await f(e,{type:"clear_queue"}),ta({steering:[],followUp:[]})}catch(e){ts(e instanceof Error?e.message:String(e))}},[]);return{data:M,loading:Q,error:Z,activeLeafId:et,messages:er,entryIds:eo,streamState:em,agentRunning:eg,modelNames:ey,modelList:ek,modelThinkingLevels:ev,modelThinkingLevelMaps:eC,newSessionModel:eI,toolPreset:eS,memoryTools:eA,thinkingLevel:eJ,retryInfo:ez,queuedMessages:tr,extensionStatuses:eN,extensionWidgets:eL,extensionDialog:eP,extensionNotices:eO,bashLive:eH,bashRunning:eq,contextUsage:eV,systemPrompt:eQ,forkingEntryId:eZ,isCompacting:e2,compactError:e8,compactInfo:e7,currentModel:tH,displayModel:tW,sessionStats:tK,agentPhase:tt,agentError:to,isNew:C,sessionIdRef:ti,sseReaderRef:tl,messagesEndRef:th,scrollContainerRef:ty,lastUserMsgRef:tf,pendingScrollToUserRef:tg,initialScrollDoneRef:tm,handleSend:t5,handleAbort:t2,handleFork:t8,handleNavigate:t7,handleModelChange:nt,handleCompact:nn,handleSteer:nr,handleFollowUp:na,handleAbortCompaction:no,handleToolPresetChange:nl,handleMemoryToolsChange:ni,handleThinkingLevelChange:ns,handleClearQueue:nm,handleBash:t6,respondToExtensionUi:nd,dismissExtensionNotice:np,loadTools:t0,loadSlashCommands:t1,slashCommands:eR,setActiveLeafId:en,setData:U,setMessages:ea,dispatch:ef,setAgentRunning:eh,setForkingEntryId:e0,forkToNewSession:t9,loadMoreMessages:tQ,hasMoreMessages:eu,totalMessages:el,loadedMessagesCount:ed,loadShadowedMessages:tX,handleAgentEventRef:tc}}}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5618],{6750:(e,t,r)=>{r.d(t,{OI:()=>o,PH:()=>a,QG:()=>l,ok:()=>i});var n=r(95155);function l({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-stage",style:{width:"100%",display:"flex",justifyContent:"center",alignItems:"flex-start",...t},children:e})}function i({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-card",style:{background:"#fff",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 2px 8px rgba(0,0,0,0.08)",overflow:"hidden",...t},children:e})}function a({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-header",style:{padding:"8px 16px",background:"var(--bg)",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",fontFamily:"var(--font-mono)",...t},children:e})}function o({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-body",style:{padding:"24px 32px 40px",...t},children:e})}},25618:(e,t,r)=>{r.d(t,{h:()=>_});var n=r(95155),l=r(12115),i=r(76577),a=r(27568);function o({dir:e}){return(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:"asc"===e?(0,n.jsx)("polyline",{points:"2 6 5 3 8 6"}):(0,n.jsx)("polyline",{points:"2 4 5 7 8 4"})})}function s(e,t,r){let n=new Blob([e],{type:r}),l=URL.createObjectURL(n),i=document.createElement("a");i.href=l,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(l),1e3)}function d({content:e,delimiter:t,fileName:r="table"}){let[i,a]=(0,l.useState)(null),[c,u]=(0,l.useState)("asc"),{header:h,rows:p}=(0,l.useMemo)(()=>(function(e,t){let r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),n=[],l=[],i="",a=!1;for(let e=0;e<r.length;e+=1){let o=r[e];if('"'===o){a&&'"'===r[e+1]?(i+='"',e+=1):a=!a;continue}if(o===t&&!a){l.push(i),i="";continue}if("\n"===o&&!a){l.push(i),l.some(e=>e.length>0)&&n.push(l),l=[],i="";continue}i+=o}l.push(i),l.some(e=>e.length>0)&&n.push(l);let o=n[0]??[],s=o.length;return{header:o,rows:n.slice(1).map(e=>{let t=[...e];for(;t.length<s;)t.push("");return t.slice(0,s)})}})(e,t),[e,t]),x=(0,l.useMemo)(()=>{if(null===i)return p;let e=[...p];return e.sort((e,t)=>{let r=e[i]??"",n=t[i]??"",l=Number(r),a=Number(n),o=""===r||""===n||Number.isNaN(l)||Number.isNaN(a)?r.localeCompare(n):l-a;return"asc"===c?o:-o}),e},[p,c,i]);return 0===h.length&&0===p.length?(0,n.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:"No tabular data to display"}):(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:[(0,n.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:[p.length," rows, ",h.length," columns"]}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,n.jsxs)("button",{onClick:()=>{s(e,r," "===t?"text/tab-separated-values;charset=utf-8":"text/csv;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:["Export "," "===t?"TSV":"CSV"]}),(0,n.jsx)("button",{onClick:()=>{s(JSON.stringify(x.map(e=>Object.fromEntries(h.map((t,r)=>[t||`column_${r+1}`,e[r]??""]))),null,2),r.replace(/\.[^.]+$/,"")+".json","application/json;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:"Export JSON"})]})]}),(0,n.jsx)("div",{style:{minHeight:0,flex:1,overflow:"auto",background:"var(--bg)"},children:(0,n.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:12},children:[(0,n.jsx)("thead",{style:{position:"sticky",top:0,zIndex:1,background:"var(--bg-panel)"},children:(0,n.jsx)("tr",{children:h.map((e,t)=>(0,n.jsx)("th",{onClick:()=>{i===t?u(e=>"asc"===e?"desc":"asc"):(a(t),u("asc"))},title:e,style:{padding:"8px 10px",borderBottom:"1px solid var(--border)",textAlign:"left",color:"var(--text-muted)",fontWeight:600,cursor:"pointer",userSelect:"none",fontSize:11,whiteSpace:"nowrap"},children:(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[(0,n.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:e||`column_${t+1}`}),i===t&&(0,n.jsx)("span",{style:{color:"var(--accent)",display:"inline-flex",flexShrink:0},children:(0,n.jsx)(o,{dir:c})})]})},`${e}-${t}`))})}),(0,n.jsx)("tbody",{children:x.map((e,t)=>(0,n.jsx)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.14)",background:t%2==1?"var(--bg-subtle)":"transparent"},children:h.map((r,l)=>(0,n.jsx)("td",{title:e[l]??"",style:{padding:"6px 10px",color:"var(--text)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:0},children:e[l]??""},`${r}-${t}-${l}`))},t))})]})})]})}var c=r(99947),u=r(7834),h=r(72518);let p={display:"inline-block",minWidth:"3em",paddingRight:"1em",textAlign:"right",color:"var(--text-dim)",fontStyle:"normal",userSelect:"none"};function x({code:e,language:t,isDark:r,wrapLines:i=!1,scrollToLine:a}){let o="text"===t||"csv"===t||"tsv"===t?"plaintext":t||"plaintext",s=e.split("\n").length,d=(0,l.useRef)(new Map),f=(0,l.useMemo)(()=>(0,h.Rd)(e,o,r),[e,r,o]),[g,m]=(0,l.useState)(()=>f?.tokens??null),y=(0,l.useRef)(""),b=(0,l.useMemo)(()=>(0,h.nS)(e).tokens,[e]);(0,l.useEffect)(()=>{let t=`${e}:${o}:${r?"dark":"light"}`;y.current=t;let n=!1;return f?(m(f.tokens),()=>{n=!0}):((0,h.wY)(e,o,r,e=>{n||y.current!==t||m(e.tokens)}),()=>{n=!0})},[f,e,r,o]);let v=g??f?.tokens??b;return(0,l.useEffect)(()=>{if(null==a||a<1)return;let e=d.current.get(Math.min(a,s));e?.scrollIntoView({block:"center"})},[s,a,v]),(0,n.jsxs)(c.NG,{style:{border:"none",borderRadius:0,minHeight:"100%"},children:[(0,n.jsx)(c.iO,{title:`${o} \xb7 ${s} lines`,actions:(0,n.jsx)(c.Mi,{onClick:()=>{(0,u.D)(e)},ariaLabel:"Copy file contents",title:"Copy file contents",label:"copy"}),style:{padding:"4px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"}}),(0,n.jsx)("pre",{style:{margin:0,padding:"12px 0",background:"var(--bg)",fontSize:13,lineHeight:1.6,fontFamily:"var(--font-mono)",minHeight:"100%",overflow:"auto",whiteSpace:i?"pre-wrap":"pre",wordBreak:i?"break-word":void 0},children:(0,n.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:v.map((e,t)=>{let r=t+1,l=a===r;return(0,n.jsxs)("span",{ref:e=>{e?d.current.set(r,e):d.current.delete(r)},style:{display:"block",background:l?"color-mix(in srgb, var(--accent) 14%, transparent)":void 0},children:[(0,n.jsx)("span",{style:p,children:r}),0===e.length?"\n":e.map((e,t)=>{let r=(0,h.tG)(e.fontStyle);return(0,n.jsx)("span",{style:{color:e.color??"inherit",...r},children:e.content},t)})]},t)})})})]})}var f=r(8391),g=r(28999);function m(e){return`/api/files/${(0,g.HG)(e)}?type=read&raw=1`}async function y(e){let t=await fetch(m(e),{method:"HEAD"});if(!t.ok){let e=`HTTP ${t.status}`;try{let r=await t.json().catch(()=>null);r?.error&&(e=r.error)}catch{}throw Error(e)}let r=document.createElement("a");r.href=m(e),r.download=(0,g.WP)(e),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function b({filePath:e}){let[t,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);return(0,n.jsx)("button",{onClick:()=>{a(null),r(!0),y(e).catch(e=>a(e instanceof Error?e.message:String(e))).finally(()=>r(!1))},disabled:t,title:i??"Download original file",style:{padding:"2px 10px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5,fontWeight:600,opacity:t?.7:1,...i?{borderColor:"#ef4444",color:"#ef4444"}:{}},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--accent)",e.currentTarget.style.color="#fff",e.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:e=>{i||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.borderColor="var(--border)")},children:t?"Downloading…":"Download"})}var v=r(96793);function j(e){let t=(0,g.WP)(e).toLowerCase().split(".").pop()??"";return"csv"===t?",":"tsv"===t?" ":null}function w(e){let t=e.includes("/")?e.slice(0,e.lastIndexOf("/")):".",r=(0,g.HG)(t);return`/api/files/${r}/?type=read&raw=1`}function k({oldContent:e,newContent:t,language:r}){let l=function(e,t){let r=e.length,n=t.length,l=r+n,i=Array(2*l+1).fill(0),a=[];for(let o=0;o<=l;o++){a.push([...i]);for(let s=-o;s<=o;s+=2){let d,c=(d=s===-o||s!==o&&i[s-1+l]<i[s+1+l]?i[s+1+l]:i[s-1+l]+1)-s;for(;d<r&&c<n&&e[d]===t[c];)d++,c++;if(i[s+l]=d,d>=r&&c>=n){let i=[],s=r,d=n;for(let r=o;r>0;r--){let n,o=a[r-1],c=s-d;n=c===-r||c!==r&&o[c-1+l]<o[c+1+l]?c+1:c-1;let u=o[n+l],h=u-n;for(;s>u&&d>h;)s--,d--,i.unshift({type:"unchanged",text:e[s],lineNo:s+1});r>0&&(s>u?(s--,i.unshift({type:"removed",text:e[s],lineNo:s+1})):(d--,i.unshift({type:"added",text:t[d],lineNo:d+1})))}for(;s>0&&d>0;)s--,d--,i.unshift({type:"unchanged",text:e[s],lineNo:s+1});return i}}}return[...e.map((e,t)=>({type:"removed",text:e,lineNo:t+1})),...t.map((e,t)=>({type:"added",text:e,lineNo:t+1}))]}(e.split("\n"),t.split("\n"));return(0,n.jsx)(i.pg,{diff:l})}function S({filePath:e,cwd:t,onOpenFile:r,scrollToLine:o}){let{isDark:s}=(0,v.D)(),[c,u]=(0,l.useState)(null),[h,p]=(0,l.useState)(null),[m,y]=(0,l.useState)(!0),[C,L]=(0,l.useState)(null),[P,$]=(0,l.useState)(null),[E,H]=(0,l.useState)(!1),[W,T]=(0,l.useState)("source"),[R,z]=(0,l.useState)(!1),[M,N]=(0,l.useState)(0),[B,F]=(0,l.useState)(!1),[I,G]=(0,l.useState)(0),[O,A]=(0,l.useState)(!1),[D,_]=(0,l.useState)(""),[U,K]=(0,l.useState)(!1),[q,Z]=(0,l.useState)(!1),[V,J]=(0,l.useState)(!1),[X,Q]=(0,l.useState)(null),Y=(0,l.useRef)(null),ee=(0,l.useRef)(!1);ee.current=O;let et=(0,l.useCallback)((e,t=!1)=>{let r=(0,g.HG)(e);return fetch(`/api/files/${r}?type=read`).then(e=>e.json()).then(e=>e.error?(L(e.error),null):(t?(u(t=>(t&&p(t.content),e)),G(e=>e+1)):u(e),L(null),e)).catch(e=>(L(String(e)),null))},[]);(0,l.useEffect)(()=>{y(!0),L(null),u(null),p(null),H(!1),T("source"),z(!1),N(0),G(0),F(!1),Y.current&&(Y.current.close(),Y.current=null),et(e).then(t=>{(t?.language==="markdown"||j(e))&&H(!0)}).finally(()=>y(!1)).catch(()=>{});let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return Y.current=r,r.addEventListener("connected",()=>{F(!0)}),r.addEventListener("change",()=>{ee.current?Z(!0):et(e,!0)}),r.addEventListener("error",()=>{F(!1),r.close()}),r.onerror=()=>{F(!1),r.close()},()=>{r.close(),Y.current=null}},[e,et]);let er=(0,l.useCallback)(()=>{c&&(A(!0),_(c.content),Q(c.mtime??null),J(!1),$(null),Z(!1),H(!1),T("source"))},[c]),en=(0,l.useCallback)(async(t=!1)=>{let r=(0,g.HG)(e);K(!0),J(!1),$(null);try{let n=await fetch(`/api/files/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:D,...t||!X?{}:{baseMtime:X}})});if(409===n.status){let e=await n.json().catch(()=>({error:"File changed on disk since it was opened"}));throw J(!0),Z(!0),Error(e.error??"File changed on disk since it was opened")}if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));throw Error(e.error??`HTTP ${n.status}`)}let l=await et(e,!0);Q(l?.mtime??null),A(!1),Z(!1),J(!1)}catch(e){$(e instanceof Error?e.message:String(e))}finally{K(!1)}},[X,D,et,e]),el=(0,l.useCallback)(()=>{A(!1),Z(!1),J(!1),$(null),Q(null)},[]),ei=(0,l.useCallback)(()=>{N(e=>e+1)},[]),ea=(0,l.useCallback)(async()=>{let t=await et(e,!0);t&&(_(t.content),Q(t.mtime??null),Z(!1),J(!1),$(null),L(null))},[et,e]),eo=c?.content??"",es=c?.language??"",ed="html"===es,ec="markdown"===es,eu=j(e),eh=null!==eu,ep=eo.split("\n"),ex=null!==c&&null!==h&&h!==eo,ef=(0,l.useMemo)(()=>{let t,r,n;return ed?(t=w(e),r=`<base href="${t}">`,n=eo,(n=/<head(\s[^>]*)?>/i.test(n)?n.replace(/<head(\s[^>]*)?>/i,e=>`${e}${r}`):/<html(\s[^>]*)?>/i.test(n)?n.replace(/<html(\s[^>]*)?>/i,e=>`${e}<head>${r}</head>`):`<!doctype html><html><head>${r}</head><body>${n}</body></html>`).replace(/<script\b/gi,'<script data-annovibe-disabled="true" type="application/json"').replace(/\s(?:on[a-z]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"")):""},[eo,e,ed]),eg=!ed&&!ec&&!eh&&ep.length>5e4,em=eh&&(ep.length>5e3||ep.slice(0,25).reduce((e,t)=>Math.max(e,t.split(eu??",").length),0)>100),ey=(0,l.useMemo)(()=>{if(!ed)return"";let t=w(e).includes("?")?"&":"?";return`${w(e)}${encodeURIComponent((0,g.WP)(e))}${t}v=${M}`},[e,M,ed]);return m?(0,n.jsx)(i.nG,{children:"Loading..."}):C?(0,n.jsx)(i.nG,{tone:"error",children:C}):c?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:c.language}),"source"===W&&(0,n.jsxs)("span",{children:[ep.length," lines"]}),(0,n.jsx)("span",{children:(0,i.v7)(c.size)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:B}),O?(0,n.jsxs)(n.Fragment,{children:[(q||V||P)&&(0,n.jsxs)("span",{title:"File changed on disk while editing",style:{padding:"2px 8px",fontSize:11,background:"rgba(234,179,8,0.1)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:5,display:"flex",alignItems:"center",gap:4},children:[(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,n.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),P??"External change",(q||V)&&(0,n.jsx)(i.ml,{onClick:ea,style:{marginLeft:4,fontSize:10,background:"rgba(234,179,8,0.2)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:3,fontWeight:600},children:"Reload"}),V&&(0,n.jsx)(i.ml,{onClick:()=>void en(!0),disabled:U,emphasis:"danger",style:{marginLeft:4,fontSize:10,borderRadius:3,fontWeight:600},children:"Overwrite"})]}),(0,n.jsx)(i.ml,{onClick:()=>void en(),disabled:U,title:"Save file (Ctrl+S)",emphasis:"primary",style:{fontWeight:600},children:U?"Saving…":"Save"}),(0,n.jsx)(i.ml,{onClick:el,title:"Cancel editing",emphasis:"danger",style:{fontWeight:600},children:"Cancel"})]}):(0,n.jsx)(i.ml,{onClick:er,title:"Edit file",style:{fontWeight:600},children:"Edit"}),ex&&(0,n.jsx)(i.Tg,{options:[{key:"source",label:"Source",active:"source"===W,onClick:()=>T("source")},{key:"diff",label:(0,n.jsxs)(n.Fragment,{children:["Diff ",I>0&&(0,n.jsxs)("span",{style:{color:"#4ade80",marginLeft:2},children:["+",I]})]}),active:"diff"===W,onClick:()=>T("diff")}]}),"source"===W&&!E&&(0,n.jsx)(i.ml,{onClick:()=>z(e=>!e),title:R?"Disable word wrap":"Enable word wrap",active:R,children:"wrap"}),ed&&E&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.ml,{onClick:ei,title:"Reload the HTML preview",children:"Refresh preview"}),ey&&(0,n.jsx)(i.ml,{onClick:()=>window.open(ey,"_blank","noopener,noreferrer"),title:"Open HTML preview in a new tab",children:"Open in new tab"})]}),ed&&"source"===W&&(0,n.jsx)(i.Tg,{options:[{key:"code",label:"Code",active:!E,onClick:()=>H(!1)},{key:"preview",label:"Preview",active:E,onClick:()=>H(!0)}]}),ec&&"source"===W&&(0,n.jsx)(i.Tg,{options:[{key:"preview",label:"Preview",active:E,onClick:()=>H(!0)},{key:"raw",label:O?"Edit":"Raw",active:!E,onClick:()=>H(!1)}]}),eh&&"source"===W&&(0,n.jsx)(i.Tg,{options:[{key:"table",label:"Table",active:E,onClick:()=>H(!0)},{key:"raw",label:"Raw",active:!E,onClick:()=>H(!1)}]})]})}),(0,n.jsx)(i.Ph,{children:O&&!(ec&&E)?(0,n.jsx)(a.g,{initialContent:D,language:c.language,isDark:s,onChange:_,onSave:()=>void en(),scrollToLine:o}):O&&ec&&E?(0,n.jsx)(f.T,{content:D,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:t,baseFilePath:e,onOpenLocalFile:r,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):"diff"===W&&ex?(0,n.jsx)(k,{oldContent:h,newContent:c.content,language:c.language}):ed&&E?(0,n.jsx)("iframe",{srcDoc:ef,sandbox:"",style:{width:"100%",height:"100%",border:"none",background:"var(--bg)"},title:"HTML preview"},M):ec&&E?(0,n.jsx)(f.T,{content:c.content,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:t,baseFilePath:e,onOpenLocalFile:r,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):eh&&E&&eu?em?(0,n.jsx)(i.nG,{children:"Table preview disabled for very large files. Switch to Raw mode or export the file."}):(0,n.jsx)(d,{content:c.content,delimiter:eu,fileName:(0,g.WP)(e)}):eg?(0,n.jsx)(i.nG,{children:"Text preview is too large for the rich viewer. Use Edit/Raw workflows instead."}):(0,n.jsx)(x,{code:c.content,language:c.language,isDark:s,wrapLines:R,scrollToLine:o})})]}):null}var C=r(6750),L=r(63161);let P=null;function $({arrayBuffer:e,fileName:t,toolbarExtra:a}){let o=(0,l.useRef)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),[h,p]=(0,l.useState)(0),[x,f]=(0,l.useState)(1),[g,m]=(0,l.useState)(1),y=(0,l.useRef)(g);y.current=g;let b=(0,l.useRef)(null),v=(0,l.useRef)(null),j=(0,l.useCallback)(async e=>{if(!P||!b.current)return;let t=b.current;if(!(e<1)&&!(e>t.numPages)){v.current&&(v.current.cancel(),v.current=null);try{let r=await t.getPage(e),n=r.getViewport({scale:y.current*(window.devicePixelRatio||1)}),l=o.current;if(!l)return;let i=l.querySelector("canvas");if(i||((i=document.createElement("canvas")).style.display="block",i.style.margin="0 auto",l.innerHTML="",l.appendChild(i)),i.width=n.width,i.height=n.height,i.style.width=`${n.width/(window.devicePixelRatio||1)}px`,i.style.height=`${n.height/(window.devicePixelRatio||1)}px`,!i.getContext("2d"))return;let a=r.render({canvas:i,viewport:n});v.current=a,await a.promise,v.current=null}catch(e){"RenderingCancelledException"!==e.name&&console.error("PDF render error:",e)}}},[]);return(0,l.useEffect)(()=>{let t=!1;return async function(){d(!0),u(null);try{P||((P=await Promise.all([r.e(2213),r.e(2619)]).then(r.bind(r,12810))).GlobalWorkerOptions.workerSrc=new r.U(r(53228)).toString());let n=await P.getDocument({data:e}).promise;if(t)return;b.current=n,p(n.numPages),f(1),d(!1)}catch(e){t||(u(String(e)),d(!1))}}(),()=>{t=!0,v.current&&(v.current.cancel(),v.current=null)}},[e]),(0,l.useEffect)(()=>{!s&&h>0&&j(x)},[s,x,h,j]),(0,l.useEffect)(()=>{!s&&h>0&&j(x)},[g]),(0,n.jsx)(L.B,{fileName:t,pageInfo:h>0?`Page ${x} / ${h}`:void 0,zoom:g,onZoomIn:()=>m(e=>Math.min(e+.25,3)),onZoomOut:()=>m(e=>Math.max(e-.25,.25)),loading:s,loadingLabel:"Loading PDF...",error:c,bodyStyle:{background:"#525659",display:"flex",justifyContent:"center",padding:16},extra:(0,n.jsxs)(n.Fragment,{children:[a,h>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>f(e=>Math.max(e-1,1)),title:"Previous page",disabled:x<=1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[x,"/",h]}),(0,n.jsx)(i.ml,{onClick:()=>f(e=>Math.min(e+1,h)),title:"Next page",disabled:x>=h,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!s&&!c&&(0,n.jsx)(C.QG,{style:{minWidth:"100%"},children:(0,n.jsx)("div",{ref:o})})})}function E({arrayBuffer:e,fileName:t,toolbarExtra:i}){let a=(0,l.useRef)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(""),p=(0,l.useMemo)(()=>`<!doctype html>
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5618],{6750:(e,t,r)=>{r.d(t,{OI:()=>o,PH:()=>a,QG:()=>l,ok:()=>i});var n=r(95155);function l({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-stage",style:{width:"100%",display:"flex",justifyContent:"center",alignItems:"flex-start",...t},children:e})}function i({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-card",style:{background:"#fff",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 2px 8px rgba(0,0,0,0.08)",overflow:"hidden",...t},children:e})}function a({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-header",style:{padding:"8px 16px",background:"var(--bg)",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",fontFamily:"var(--font-mono)",...t},children:e})}function o({children:e,style:t}){return(0,n.jsx)("div",{"data-document-surface":"canvas-body",style:{padding:"24px 32px 40px",...t},children:e})}},25618:(e,t,r)=>{r.d(t,{h:()=>_});var n=r(95155),l=r(12115),i=r(76577),a=r(27568);function o({dir:e}){return(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:"asc"===e?(0,n.jsx)("polyline",{points:"2 6 5 3 8 6"}):(0,n.jsx)("polyline",{points:"2 4 5 7 8 4"})})}function s(e,t,r){let n=new Blob([e],{type:r}),l=URL.createObjectURL(n),i=document.createElement("a");i.href=l,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(l),1e3)}function d({content:e,delimiter:t,fileName:r="table"}){let[i,a]=(0,l.useState)(null),[c,u]=(0,l.useState)("asc"),{header:h,rows:p}=(0,l.useMemo)(()=>(function(e,t){let r=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),n=[],l=[],i="",a=!1;for(let e=0;e<r.length;e+=1){let o=r[e];if('"'===o){a&&'"'===r[e+1]?(i+='"',e+=1):a=!a;continue}if(o===t&&!a){l.push(i),i="";continue}if("\n"===o&&!a){l.push(i),l.some(e=>e.length>0)&&n.push(l),l=[],i="";continue}i+=o}l.push(i),l.some(e=>e.length>0)&&n.push(l);let o=n[0]??[],s=o.length;return{header:o,rows:n.slice(1).map(e=>{let t=[...e];for(;t.length<s;)t.push("");return t.slice(0,s)})}})(e,t),[e,t]),x=(0,l.useMemo)(()=>{if(null===i)return p;let e=[...p];return e.sort((e,t)=>{let r=e[i]??"",n=t[i]??"",l=Number(r),a=Number(n),o=""===r||""===n||Number.isNaN(l)||Number.isNaN(a)?r.localeCompare(n):l-a;return"asc"===c?o:-o}),e},[p,c,i]);return 0===h.length&&0===p.length?(0,n.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:"No tabular data to display"}):(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:[(0,n.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:[p.length," rows, ",h.length," columns"]}),(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,n.jsxs)("button",{onClick:()=>{s(e,r," "===t?"text/tab-separated-values;charset=utf-8":"text/csv;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:["Export "," "===t?"TSV":"CSV"]}),(0,n.jsx)("button",{onClick:()=>{s(JSON.stringify(x.map(e=>Object.fromEntries(h.map((t,r)=>[t||`column_${r+1}`,e[r]??""]))),null,2),r.replace(/\.[^.]+$/,"")+".json","application/json;charset=utf-8")},style:{padding:"2px 8px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5},children:"Export JSON"})]})]}),(0,n.jsx)("div",{style:{minHeight:0,flex:1,overflow:"auto",background:"var(--bg)"},children:(0,n.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:12},children:[(0,n.jsx)("thead",{style:{position:"sticky",top:0,zIndex:1,background:"var(--bg-panel)"},children:(0,n.jsx)("tr",{children:h.map((e,t)=>(0,n.jsx)("th",{onClick:()=>{i===t?u(e=>"asc"===e?"desc":"asc"):(a(t),u("asc"))},title:e,style:{padding:"8px 10px",borderBottom:"1px solid var(--border)",textAlign:"left",color:"var(--text-muted)",fontWeight:600,cursor:"pointer",userSelect:"none",fontSize:11,whiteSpace:"nowrap"},children:(0,n.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,minWidth:0},children:[(0,n.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:e||`column_${t+1}`}),i===t&&(0,n.jsx)("span",{style:{color:"var(--accent)",display:"inline-flex",flexShrink:0},children:(0,n.jsx)(o,{dir:c})})]})},`${e}-${t}`))})}),(0,n.jsx)("tbody",{children:x.map((e,t)=>(0,n.jsx)("tr",{style:{borderBottom:"1px solid rgba(127,127,127,0.14)",background:t%2==1?"var(--bg-subtle)":"transparent"},children:h.map((r,l)=>(0,n.jsx)("td",{title:e[l]??"",style:{padding:"6px 10px",color:"var(--text)",fontFamily:"var(--font-mono)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:0},children:e[l]??""},`${r}-${t}-${l}`))},t))})]})})]})}var c=r(99947),u=r(7834),h=r(72518);let p={display:"inline-block",minWidth:"3em",paddingRight:"1em",textAlign:"right",color:"var(--text-dim)",fontStyle:"normal",userSelect:"none"};function x({code:e,language:t,isDark:r,wrapLines:i=!1,scrollToLine:a}){let o="text"===t||"csv"===t||"tsv"===t?"plaintext":t||"plaintext",s=e.split("\n").length,d=(0,l.useRef)(new Map),f=(0,l.useMemo)(()=>(0,h.Rd)(e,o,r),[e,r,o]),[g,m]=(0,l.useState)(()=>f?.tokens??null),y=(0,l.useRef)(""),b=(0,l.useMemo)(()=>(0,h.nS)(e).tokens,[e]);(0,l.useEffect)(()=>{let t=`${e}:${o}:${r?"dark":"light"}`;y.current=t;let n=!1;return f?(m(f.tokens),()=>{n=!0}):((0,h.wY)(e,o,r,e=>{n||y.current!==t||m(e.tokens)}),()=>{n=!0})},[f,e,r,o]);let v=g??f?.tokens??b;return(0,l.useEffect)(()=>{if(null==a||a<1)return;let e=d.current.get(Math.min(a,s));e?.scrollIntoView({block:"center"})},[s,a,v]),(0,n.jsxs)(c.NG,{style:{border:"none",borderRadius:0,minHeight:"100%"},children:[(0,n.jsx)(c.iO,{title:`${o} \xb7 ${s} lines`,actions:(0,n.jsx)(c.Mi,{onClick:()=>{(0,u.D)(e)},ariaLabel:"Copy file contents",title:"Copy file contents",label:"copy"}),style:{padding:"4px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"}}),(0,n.jsx)("pre",{style:{margin:0,padding:"12px 0",background:"var(--bg)",fontSize:13,lineHeight:1.6,fontFamily:"var(--font-mono)",minHeight:"100%",overflow:"auto",whiteSpace:i?"pre-wrap":"pre",wordBreak:i?"break-word":void 0},children:(0,n.jsx)("code",{style:{fontFamily:"var(--font-mono)"},children:v.map((e,t)=>{let r=t+1,l=a===r;return(0,n.jsxs)("span",{ref:e=>{e?d.current.set(r,e):d.current.delete(r)},style:{display:"block",background:l?"color-mix(in srgb, var(--accent) 14%, transparent)":void 0},children:[(0,n.jsx)("span",{style:p,children:r}),0===e.length?"\n":e.map((e,t)=>{let r=(0,h.tG)(e.fontStyle);return(0,n.jsx)("span",{style:{color:e.color??"inherit",...r},children:e.content},t)})]},t)})})})]})}var f=r(8391),g=r(28999);function m(e){return`/api/files/${(0,g.HG)(e)}?type=read&raw=1`}async function y(e){let t=await fetch(m(e),{method:"HEAD"});if(!t.ok){let e=`HTTP ${t.status}`;try{let r=await t.json().catch(()=>null);r?.error&&(e=r.error)}catch{}throw Error(e)}let r=document.createElement("a");r.href=m(e),r.download=(0,g.WP)(e),r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function b({filePath:e}){let[t,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null);return(0,n.jsx)("button",{onClick:()=>{a(null),r(!0),y(e).catch(e=>a(e instanceof Error?e.message:String(e))).finally(()=>r(!1))},disabled:t,title:i??"Download original file",style:{padding:"2px 10px",fontSize:11,cursor:"pointer",background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:5,fontWeight:600,opacity:t?.7:1,...i?{borderColor:"#ef4444",color:"#ef4444"}:{}},onMouseEnter:e=>{t||(e.currentTarget.style.background="var(--accent)",e.currentTarget.style.color="#fff",e.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:e=>{i||(e.currentTarget.style.background="var(--bg-hover)",e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.borderColor="var(--border)")},children:t?"Downloading…":"Download"})}var v=r(96793);function j(e){let t=(0,g.WP)(e).toLowerCase().split(".").pop()??"";return"csv"===t?",":"tsv"===t?" ":null}function w(e){let t=e.includes("/")?e.slice(0,e.lastIndexOf("/")):".",r=(0,g.HG)(t);return`/api/files/${r}/?type=read&raw=1`}function k({oldContent:e,newContent:t,language:r}){let l=function(e,t){let r=e.length,n=t.length,l=r+n,i=Array(2*l+1).fill(0),a=[];for(let o=0;o<=l;o++){a.push([...i]);for(let s=-o;s<=o;s+=2){let d,c=(d=s===-o||s!==o&&i[s-1+l]<i[s+1+l]?i[s+1+l]:i[s-1+l]+1)-s;for(;d<r&&c<n&&e[d]===t[c];)d++,c++;if(i[s+l]=d,d>=r&&c>=n){let i=[],s=r,d=n;for(let r=o;r>0;r--){let n,o=a[r-1],c=s-d;n=c===-r||c!==r&&o[c-1+l]<o[c+1+l]?c+1:c-1;let u=o[n+l],h=u-n;for(;s>u&&d>h;)s--,d--,i.unshift({type:"unchanged",text:e[s],lineNo:s+1});r>0&&(s>u?(s--,i.unshift({type:"removed",text:e[s],lineNo:s+1})):(d--,i.unshift({type:"added",text:t[d],lineNo:d+1})))}for(;s>0&&d>0;)s--,d--,i.unshift({type:"unchanged",text:e[s],lineNo:s+1});return i}}}return[...e.map((e,t)=>({type:"removed",text:e,lineNo:t+1})),...t.map((e,t)=>({type:"added",text:e,lineNo:t+1}))]}(e.split("\n"),t.split("\n"));return(0,n.jsx)(i.pg,{diff:l})}function S({filePath:e,cwd:t,onOpenFile:r,scrollToLine:o,viewerState:s,onViewerStateChange:c}){let{isDark:u}=(0,v.D)(),h=(0,l.useRef)(s),p=(0,l.useRef)(null),m=(0,l.useRef)(!1),y=(0,l.useRef)(null),C=(0,l.useRef)(!1),L=(0,l.useRef)(c);L.current=c;let[P,$]=(0,l.useState)(null),[E,H]=(0,l.useState)(null),[R,T]=(0,l.useState)(!0),[W,z]=(0,l.useState)(null),[M,F]=(0,l.useState)(null),[N,B]=(0,l.useState)(s?.previewMode??!1),[I,G]=(0,l.useState)(s?.viewMode??"source"),[O,A]=(0,l.useState)(s?.wrapLines??!1),[D,_]=(0,l.useState)(0),[U,q]=(0,l.useState)(!1),[K,V]=(0,l.useState)(0),[Z,J]=(0,l.useState)(!1),[X,Q]=(0,l.useState)(""),[Y,ee]=(0,l.useState)(!1),[et,er]=(0,l.useState)(!1),[en,el]=(0,l.useState)(!1),[ei,ea]=(0,l.useState)(null),eo=(0,l.useRef)(null),es=(0,l.useRef)(!1);es.current=Z;let ed=(0,l.useCallback)((e,t=!1)=>{let r=(0,g.HG)(e);return fetch(`/api/files/${r}?type=read`).then(e=>e.json()).then(e=>e.error?(z(e.error),null):(t?($(t=>(t&&H(t.content),e)),V(e=>e+1)):$(e),z(null),e)).catch(e=>(z(String(e)),null))},[]);(0,l.useEffect)(()=>{T(!0),z(null),$(null),H(null),B(h.current?.previewMode??!1),G(h.current?.viewMode??"source"),A(h.current?.wrapLines??!1),m.current=!1,_(0),V(0),q(!1),eo.current&&(eo.current.close(),eo.current=null),ed(e).then(t=>{h.current?.previewMode===void 0&&(t?.language==="markdown"||j(e))&&B(!0)}).finally(()=>T(!1)).catch(()=>{});let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return eo.current=r,r.addEventListener("connected",()=>{q(!0)}),r.addEventListener("change",()=>{es.current?er(!0):ed(e,!0)}),r.addEventListener("error",()=>{q(!1),r.close()}),r.onerror=()=>{q(!1),r.close()},()=>{r.close(),eo.current=null}},[e,ed]);let ec=(0,l.useCallback)(()=>{P&&(J(!0),Q(P.content),ea(P.mtime??null),el(!1),F(null),er(!1),B(!1),G("source"))},[P]),eu=(0,l.useCallback)(async(t=!1)=>{let r=(0,g.HG)(e);ee(!0),el(!1),F(null);try{let n=await fetch(`/api/files/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:X,...t||!ei?{}:{baseMtime:ei}})});if(409===n.status){let e=await n.json().catch(()=>({error:"File changed on disk since it was opened"}));throw el(!0),er(!0),Error(e.error??"File changed on disk since it was opened")}if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));throw Error(e.error??`HTTP ${n.status}`)}let l=await ed(e,!0);ea(l?.mtime??null),J(!1),er(!1),el(!1)}catch(e){F(e instanceof Error?e.message:String(e))}finally{ee(!1)}},[ei,X,ed,e]),eh=(0,l.useCallback)(()=>{J(!1),er(!1),el(!1),F(null),ea(null)},[]),ep=(0,l.useCallback)(()=>{_(e=>e+1)},[]),ex=(0,l.useCallback)(async()=>{let t=await ed(e,!0);t&&(Q(t.content),ea(t.mtime??null),er(!1),el(!1),F(null),z(null))},[ed,e]),ef=P?.content??"",eg=P?.language??"",em="html"===eg,ey="markdown"===eg,eb=j(e),ev=null!==eb,ej=ef.split("\n"),ew=null!==P&&null!==E&&E!==ef,ek=(0,l.useMemo)(()=>{let t,r,n;return em?(t=w(e),r=`<base href="${t}">`,n=ef,(n=/<head(\s[^>]*)?>/i.test(n)?n.replace(/<head(\s[^>]*)?>/i,e=>`${e}${r}`):/<html(\s[^>]*)?>/i.test(n)?n.replace(/<html(\s[^>]*)?>/i,e=>`${e}<head>${r}</head>`):`<!doctype html><html><head>${r}</head><body>${n}</body></html>`).replace(/<script\b/gi,'<script data-annovibe-disabled="true" type="application/json"').replace(/\s(?:on[a-z]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,"")):""},[ef,e,em]),eS=!em&&!ey&&!ev&&ej.length>5e4,eC=(0,l.useCallback)(()=>{L.current&&L.current({scrollTop:p.current?.scrollTop??0,previewMode:N,viewMode:I,wrapLines:O})},[N,I,O]);(0,l.useEffect)(()=>{if(!P||m.current)return;m.current=!0;let e=h.current?.scrollTop??0;if(e<=0)return;let t=requestAnimationFrame(()=>{p.current&&(p.current.scrollTop=e)});return()=>cancelAnimationFrame(t)},[P]),(0,l.useEffect)(()=>{if(!C.current){C.current=!0;return}eC()},[eC]);let eL=(0,l.useCallback)(()=>{L.current&&!y.current&&(y.current=setTimeout(()=>{y.current=null,eC()},150))},[eC]);(0,l.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let eP=ev&&(ej.length>5e3||ej.slice(0,25).reduce((e,t)=>Math.max(e,t.split(eb??",").length),0)>100),e$=(0,l.useMemo)(()=>{if(!em)return"";let t=w(e).includes("?")?"&":"?";return`${w(e)}${encodeURIComponent((0,g.WP)(e))}${t}v=${D}`},[e,D,em]);return R?(0,n.jsx)(i.nG,{children:"Loading..."}):W?(0,n.jsx)(i.nG,{tone:"error",children:W}):P?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:P.language}),"source"===I&&(0,n.jsxs)("span",{children:[ej.length," lines"]}),(0,n.jsx)("span",{children:(0,i.v7)(P.size)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:U}),Z?(0,n.jsxs)(n.Fragment,{children:[(et||en||M)&&(0,n.jsxs)("span",{title:"File changed on disk while editing",style:{padding:"2px 8px",fontSize:11,background:"rgba(234,179,8,0.1)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:5,display:"flex",alignItems:"center",gap:4},children:[(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,n.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),M??"External change",(et||en)&&(0,n.jsx)(i.ml,{onClick:ex,style:{marginLeft:4,fontSize:10,background:"rgba(234,179,8,0.2)",color:"#b8860b",border:"1px solid rgba(234,179,8,0.3)",borderRadius:3,fontWeight:600},children:"Reload"}),en&&(0,n.jsx)(i.ml,{onClick:()=>void eu(!0),disabled:Y,emphasis:"danger",style:{marginLeft:4,fontSize:10,borderRadius:3,fontWeight:600},children:"Overwrite"})]}),(0,n.jsx)(i.ml,{onClick:()=>void eu(),disabled:Y,title:"Save file (Ctrl+S)",emphasis:"primary",style:{fontWeight:600},children:Y?"Saving…":"Save"}),(0,n.jsx)(i.ml,{onClick:eh,title:"Cancel editing",emphasis:"danger",style:{fontWeight:600},children:"Cancel"})]}):(0,n.jsx)(i.ml,{onClick:ec,title:"Edit file",style:{fontWeight:600},children:"Edit"}),ew&&(0,n.jsx)(i.Tg,{options:[{key:"source",label:"Source",active:"source"===I,onClick:()=>G("source")},{key:"diff",label:(0,n.jsxs)(n.Fragment,{children:["Diff ",K>0&&(0,n.jsxs)("span",{style:{color:"#4ade80",marginLeft:2},children:["+",K]})]}),active:"diff"===I,onClick:()=>G("diff")}]}),"source"===I&&!N&&(0,n.jsx)(i.ml,{onClick:()=>A(e=>!e),title:O?"Disable word wrap":"Enable word wrap",active:O,children:"wrap"}),em&&N&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.ml,{onClick:ep,title:"Reload the HTML preview",children:"Refresh preview"}),e$&&(0,n.jsx)(i.ml,{onClick:()=>window.open(e$,"_blank","noopener,noreferrer"),title:"Open HTML preview in a new tab",children:"Open in new tab"})]}),em&&"source"===I&&(0,n.jsx)(i.Tg,{options:[{key:"code",label:"Code",active:!N,onClick:()=>B(!1)},{key:"preview",label:"Preview",active:N,onClick:()=>B(!0)}]}),ey&&"source"===I&&(0,n.jsx)(i.Tg,{options:[{key:"preview",label:"Preview",active:N,onClick:()=>B(!0)},{key:"raw",label:Z?"Edit":"Raw",active:!N,onClick:()=>B(!1)}]}),ev&&"source"===I&&(0,n.jsx)(i.Tg,{options:[{key:"table",label:"Table",active:N,onClick:()=>B(!0)},{key:"raw",label:"Raw",active:!N,onClick:()=>B(!1)}]})]})}),(0,n.jsx)(i.Ph,{bodyRef:p,onScroll:eL,children:Z&&!(ey&&N)?(0,n.jsx)(a.g,{initialContent:X,language:P.language,isDark:u,onChange:Q,onSave:()=>void eu(),scrollToLine:o}):Z&&ey&&N?(0,n.jsx)(f.T,{content:X,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:t,baseFilePath:e,onOpenLocalFile:r,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):"diff"===I&&ew?(0,n.jsx)(k,{oldContent:E,newContent:P.content,language:P.language}):em&&N?(0,n.jsx)("iframe",{srcDoc:ek,sandbox:"",style:{width:"100%",height:"100%",border:"none",background:"var(--bg)"},title:"HTML preview"},D):ey&&N?(0,n.jsx)(f.T,{content:P.content,className:"markdown-body markdown-file-preview",codeBlockVariant:"file",cwd:t,baseFilePath:e,onOpenLocalFile:r,style:{padding:"28px 36px",maxWidth:920,margin:"0 auto"}}):ev&&N&&eb?eP?(0,n.jsx)(i.nG,{children:"Table preview disabled for very large files. Switch to Raw mode or export the file."}):(0,n.jsx)(d,{content:P.content,delimiter:eb,fileName:(0,g.WP)(e)}):eS?(0,n.jsx)(i.nG,{children:"Text preview is too large for the rich viewer. Use Edit/Raw workflows instead."}):(0,n.jsx)(x,{code:P.content,language:P.language,isDark:u,wrapLines:O,scrollToLine:o})})]}):null}var C=r(6750),L=r(63161);let P=null;function $({arrayBuffer:e,fileName:t,toolbarExtra:a}){let o=(0,l.useRef)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),[h,p]=(0,l.useState)(0),[x,f]=(0,l.useState)(1),[g,m]=(0,l.useState)(1),y=(0,l.useRef)(g);y.current=g;let b=(0,l.useRef)(null),v=(0,l.useRef)(null),j=(0,l.useCallback)(async e=>{if(!P||!b.current)return;let t=b.current;if(!(e<1)&&!(e>t.numPages)){v.current&&(v.current.cancel(),v.current=null);try{let r=await t.getPage(e),n=r.getViewport({scale:y.current*(window.devicePixelRatio||1)}),l=o.current;if(!l)return;let i=l.querySelector("canvas");if(i||((i=document.createElement("canvas")).style.display="block",i.style.margin="0 auto",l.innerHTML="",l.appendChild(i)),i.width=n.width,i.height=n.height,i.style.width=`${n.width/(window.devicePixelRatio||1)}px`,i.style.height=`${n.height/(window.devicePixelRatio||1)}px`,!i.getContext("2d"))return;let a=r.render({canvas:i,viewport:n});v.current=a,await a.promise,v.current=null}catch(e){"RenderingCancelledException"!==e.name&&console.error("PDF render error:",e)}}},[]);return(0,l.useEffect)(()=>{let t=!1;return async function(){d(!0),u(null);try{P||((P=await Promise.all([r.e(2213),r.e(2619)]).then(r.bind(r,12810))).GlobalWorkerOptions.workerSrc=new r.U(r(53228)).toString());let n=await P.getDocument({data:e}).promise;if(t)return;b.current=n,p(n.numPages),f(1),d(!1)}catch(e){t||(u(String(e)),d(!1))}}(),()=>{t=!0,v.current&&(v.current.cancel(),v.current=null)}},[e]),(0,l.useEffect)(()=>{!s&&h>0&&j(x)},[s,x,h,j]),(0,l.useEffect)(()=>{!s&&h>0&&j(x)},[g]),(0,n.jsx)(L.B,{fileName:t,pageInfo:h>0?`Page ${x} / ${h}`:void 0,zoom:g,onZoomIn:()=>m(e=>Math.min(e+.25,3)),onZoomOut:()=>m(e=>Math.max(e-.25,.25)),loading:s,loadingLabel:"Loading PDF...",error:c,bodyStyle:{background:"#525659",display:"flex",justifyContent:"center",padding:16},extra:(0,n.jsxs)(n.Fragment,{children:[a,h>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>f(e=>Math.max(e-1,1)),title:"Previous page",disabled:x<=1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[x,"/",h]}),(0,n.jsx)(i.ml,{onClick:()=>f(e=>Math.min(e+1,h)),title:"Next page",disabled:x>=h,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!s&&!c&&(0,n.jsx)(C.QG,{style:{minWidth:"100%"},children:(0,n.jsx)("div",{ref:o})})})}function E({arrayBuffer:e,fileName:t,toolbarExtra:i}){let a=(0,l.useRef)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(""),p=(0,l.useMemo)(()=>`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
<body>
|
|
14
14
|
<div class="docx-host">${u}</div>
|
|
15
15
|
</body>
|
|
16
|
-
</html>`,[u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null),h("");try{let{renderAsync:n}=await Promise.all([r.e(2619),r.e(4453),r.e(2274)]).then(r.bind(r,52274)),l=a.current;if(!l||t||(l.innerHTML="",await n(e,l,void 0,{className:"docx-preview",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,ignoreFonts:!1,breakPages:!0,ignoreLastRenderedPageBreak:!1,experimental:!1,trimXmlDeclaration:!0,useBase64URL:!1,renderChanges:!1,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0}),t))return;h(l.innerHTML.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi,(e,t,r,n,l)=>{let i=String(r??n??l??"").trim();return/^\s*(javascript|data)\s*:/i.test(i)?"":e})),l.innerHTML="",s(!1)}catch(e){t||(console.error("DOCX render error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsxs)(L.B,{fileName:t,loading:o,loadingLabel:"Loading document...",extra:i,error:d,bodyStyle:{background:"#e8e8e8",padding:"24px 0"},children:[(0,n.jsx)("div",{ref:a,style:{display:"none"},"aria-hidden":"true"}),!o&&!d&&(0,n.jsx)(C.QG,{children:(0,n.jsx)(C.ok,{style:{width:"100%",maxWidth:816,minHeight:100,visibility:o?"hidden":"visible",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",overflow:"hidden"},children:(0,n.jsx)("iframe",{srcDoc:p,sandbox:"",title:t?`${t} preview`:"DOCX preview",style:{width:"100%",minHeight:720,border:"none",background:"transparent"}})})})]})}let H=/<(script|style|iframe|object|embed|form|meta|link)([\s\S]*?)>([\s\S]*?)<\/\1>|<(script|style|iframe|object|embed|form|meta|link)([^>]*)\/?>/gi,
|
|
16
|
+
</html>`,[u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null),h("");try{let{renderAsync:n}=await Promise.all([r.e(2619),r.e(4453),r.e(2274)]).then(r.bind(r,52274)),l=a.current;if(!l||t||(l.innerHTML="",await n(e,l,void 0,{className:"docx-preview",inWrapper:!0,ignoreWidth:!1,ignoreHeight:!1,ignoreFonts:!1,breakPages:!0,ignoreLastRenderedPageBreak:!1,experimental:!1,trimXmlDeclaration:!0,useBase64URL:!1,renderChanges:!1,renderHeaders:!0,renderFooters:!0,renderFootnotes:!0,renderEndnotes:!0}),t))return;h(l.innerHTML.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi,(e,t,r,n,l)=>{let i=String(r??n??l??"").trim();return/^\s*(javascript|data)\s*:/i.test(i)?"":e})),l.innerHTML="",s(!1)}catch(e){t||(console.error("DOCX render error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsxs)(L.B,{fileName:t,loading:o,loadingLabel:"Loading document...",extra:i,error:d,bodyStyle:{background:"#e8e8e8",padding:"24px 0"},children:[(0,n.jsx)("div",{ref:a,style:{display:"none"},"aria-hidden":"true"}),!o&&!d&&(0,n.jsx)(C.QG,{children:(0,n.jsx)(C.ok,{style:{width:"100%",maxWidth:816,minHeight:100,visibility:o?"hidden":"visible",boxShadow:"0 1px 4px rgba(0,0,0,0.12)",overflow:"hidden"},children:(0,n.jsx)("iframe",{srcDoc:p,sandbox:"",title:t?`${t} preview`:"DOCX preview",style:{width:"100%",minHeight:720,border:"none",background:"transparent"}})})})]})}let H=/<(script|style|iframe|object|embed|form|meta|link)([\s\S]*?)>([\s\S]*?)<\/\1>|<(script|style|iframe|object|embed|form|meta|link)([^>]*)\/?>/gi,R=/\son[a-z]+\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi,T=/\s(href|src)\s*=\s*("\s*javascript:[^"]*"|'\s*javascript:[^']*'|javascript:[^\s>]+)/gi;function W({arrayBuffer:e,fileName:t,toolbarExtra:a}){let[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[p,x]=(0,l.useState)(0),f=(0,l.useMemo)(()=>{var e;return e=u[p]?.html??"",`<!doctype html><html><head><style>
|
|
17
17
|
body{margin:0;padding:16px;background:white;color:#111827;font:13px system-ui,sans-serif}
|
|
18
18
|
table{border-collapse:collapse;width:100%}
|
|
19
19
|
td,th{border:1px solid #d1d5db;padding:4px 6px;vertical-align:top}
|
|
20
20
|
th{background:#f3f4f6;font-weight:600}
|
|
21
21
|
img{max-width:100%;height:auto}
|
|
22
|
-
</style></head><body><div class="xlsx-preview">${e}</div></body></html>`},[p,u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=await Promise.all([r.e(3524),r.e(8436)]).then(r.bind(r,15967)),l=n.read(e,{type:"array"}),i=l.SheetNames.map(e=>{let t=l.Sheets[e],r=n.utils.sheet_to_html(t,{editable:!1}).replace(H,"").replace(W,"").replace(T,"");return{name:e,html:r}});t||(h(i),x(0),s(!1))}catch(e){t||(console.error("XLSX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsx)(L.B,{fileName:t,loading:o,loadingLabel:"Loading spreadsheet...",error:d,bodyStyle:{background:"var(--bg-panel)"},extra:(0,n.jsxs)(n.Fragment,{children:[a,u.length>1&&(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",maxWidth:"min(520px, 48vw)"},children:(0,n.jsx)(i.Tg,{options:u.map((e,t)=>({key:e.name,label:(0,n.jsx)("span",{title:e.name,style:{display:"block",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),active:t===p,onClick:()=>x(t)}))})})]}),children:!o&&!d&&u.length>0&&(0,n.jsx)("iframe",{title:t?`${t} preview`:"Spreadsheet preview",sandbox:"",srcDoc:f,style:{width:"100%",height:"100%",minHeight:320,border:"none",background:"white"}})})}var z=r(53308);function M({arrayBuffer:e,fileName:t,toolbarExtra:a}){let[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[p,x]=(0,l.useState)(0);(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=(await Promise.all([r.e(2619),r.e(4453)]).then(r.t.bind(r,54453,23))).default,l=await n.loadAsync(e),i=[];l.forEach(e=>{let t=/^ppt\/slides\/slide(\d+)\.xml$/i.exec(e);t&&i.push({name:e,index:parseInt(t[1],10)})}),i.sort((e,t)=>e.index-t.index);let a=[];for(let e of i){let r;if(t)return;let n=await l.file(e.name).async("string"),i=/<a:t[^>]*>([^<]*)<\/a:t>/g,o=[];for(;null!==(r=i.exec(n));){let e=r[1].trim();e&&o.push(e)}a.push({index:e.index,texts:o})}t||(h(a),s(!1))}catch(e){t||(console.error("PPTX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]);let f=u[p],g=u.length;return(0,n.jsx)(L.B,{fileName:t,pageInfo:g>0?`Slide ${p+1} / ${g}`:void 0,loading:o,loadingLabel:"Loading presentation...",error:d,bodyStyle:{background:"var(--bg-panel)",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:24},extra:(0,n.jsxs)(n.Fragment,{children:[a,g>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.max(e-1,0)),title:"Previous slide",disabled:p<=0,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[p+1,"/",g]}),(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.min(e+1,g-1)),title:"Next slide",disabled:p>=g-1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!o&&!d&&f&&(0,n.jsx)(C.QG,{children:(0,n.jsxs)("div",{style:{width:"100%",maxWidth:800},children:[(0,n.jsxs)(C.ok,{children:[(0,n.jsxs)(C.PH,{children:["Slide ",f.index]}),(0,n.jsx)(C.OI,{style:{minHeight:200},children:0===f.texts.length?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontStyle:"italic",fontSize:13},children:"(No text content)"}):(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:f.texts.map((e,t)=>(0,n.jsx)("li",{style:{padding:"4px 0",fontSize:14,lineHeight:1.6,color:"var(--text)",borderBottom:t<f.texts.length-1?"1px solid var(--bg-panel)":"none"},children:e},t))})})]}),g>1&&(0,n.jsx)(z._t,{title:"All slides",children:(0,n.jsx)(z.S7,{children:u.map((e,t)=>(0,n.jsx)(z.HF,{title:`Slide ${e.index}`,summary:e.texts[0]||"(empty)",active:t===p,onClick:()=>x(t)},e.index))})})]})})})}function N(e){return Array.isArray(e)?e.join(""):e}function B({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),u=(0,l.useRef)(null);return((0,l.useEffect)(()=>{let t=(0,g.HG)(e);fetch(`/api/files/${t}?type=read`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(t.error)throw Error(t.error);if(!t.content)throw Error("Empty file");let r=JSON.parse(t.content);if(!r.cells||!Array.isArray(r.cells))throw Error("Invalid notebook format");a(r.cells)}).catch(e=>c(e.message)).finally(()=>s(!1));let r=new EventSource(`/api/files/${t}?type=watch`);return u.current=r,()=>{r.close(),u.current=null}},[e]),o)?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:"Loading notebook..."})]}):d||!r?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:d??"Failed to load notebook"})]}):(0,n.jsxs)(i.fj,{style:{background:"var(--bg)",overflowY:"auto"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:`${(0,g.WP)(e)} \xb7 ${r.length} cells`,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.Ph,{style:{padding:0},children:(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:r.map((e,t)=>(0,n.jsx)(F,{cell:e},t))})})]})}function F({cell:e}){if("markdown"===e.cell_type){let t=N(e.source).trim();return t?(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"},children:(0,n.jsx)(f.T,{content:t})}):null}if("code"===e.cell_type){let t=N(e.source),r=e.execution_count,l=e.outputs&&e.outputs.length>0;return(0,n.jsxs)("div",{style:{borderBottom:"1px solid var(--border)"},children:[(0,n.jsxs)("div",{style:{display:"flex",background:"var(--bg-panel)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0,padding:"6px 0",textAlign:"center",fontSize:10,fontFamily:"var(--font-mono)",color:"var(--text-dim)",userSelect:"none"},children:null!=r?`[${r}]`:"[ ]"}),(0,n.jsx)("div",{style:{flex:1,minWidth:0,padding:"6px 12px 6px 0",overflow:"auto"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,n.jsx)("code",{children:t})})})]}),l&&e.outputs.map((e,t)=>{let r=function(e){let t=[];if(!e.data)return t;for(let r of["image/png","image/jpeg","image/svg+xml","image/webp"])if(e.data[r]){let n=N(e.data[r]);t.push({data:n,mimeType:r})}return t}(e),l=function(e){if("stream"===e.output_type)return N(e.text??"").trim()||null;if(("execute_result"===e.output_type||"display_data"===e.output_type)&&e.data?.["text/plain"])return N(e.data["text/plain"]).trim()||null;if("error"===e.output_type){let t=e.ename??"Error",r=e.evalue??"";return`${t}: ${r}`}return null}(e);return"error"===e.output_type?(0,n.jsxs)("div",{style:{display:"flex",background:"rgba(248,113,113,0.04)",borderTop:"1px solid rgba(248,113,113,0.15)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 12px 6px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"#f87171",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l})})]},t):(0,n.jsxs)("div",{style:{borderTop:"1px solid rgba(34,197,94,0.08)",background:"var(--bg-subtle)"},children:[r.length>0&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 0"},children:r.map((e,r)=>(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`output ${t}`,style:{maxWidth:"100%",display:"block"}},r))})]}),l&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"4px 12px 4px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"var(--text-muted)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:l})})]})]},t)})]})}return(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-dim)",whiteSpace:"pre-wrap"},children:N(e.source)})})}let I=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),G=new Set(["mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","webm"]),O=new Set(["pdf","docx","xlsx","pptx","doc","xls","ppt"]);function A({filePath:e,cwd:t,workbenchSessionId:r,onAskAboutArtifact:a,onEditArtifact:o}){let[s,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(0),[h,p]=(0,l.useState)(null),[x,f]=(0,l.useState)(null),[m,y]=(0,l.useState)(null),[v,j]=(0,l.useState)(100),[w,k]=(0,l.useState)(null),S=(0,l.useRef)(null),C=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{u(0),p(null),f(null),y(null),d(!1),j(100),S.current&&(S.current.close(),S.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return S.current=r,r.addEventListener("connected",()=>d(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&p(t.size)}catch{}u(e=>e+1)}),r.addEventListener("error",()=>d(!1)),r.onerror=()=>d(!1),()=>{r.close(),S.current=null}},[e]),(0,l.useEffect)(()=>{if(!r)return void k(null);let t=!1,n=new URLSearchParams({path:e});return fetch(`/api/sessions/${encodeURIComponent(r)}/workbench-artifact?${n}`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>{t||k(e.artifact??null)}).catch(()=>{t||k(null)}),()=>{t=!0}},[e,r]);let L=(0,g.HG)(e),P=`/api/files/${L}?type=read${c?`&v=${c}`:""}`,$=null!=h?(0,i.v7)(h):null,E=e=>j(Math.max(10,Math.min(500,e)));return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[(0,n.jsx)(i.ml,{onClick:()=>E(v-25),title:"Zoom out",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"-"}),(0,n.jsx)("select",{value:v,onChange:e=>E(Number(e.target.value)),title:"Image zoom",style:{height:22,border:"1px solid var(--border)",borderRadius:5,background:"var(--bg-panel)",color:"var(--text)",fontSize:11,fontFamily:"var(--font-mono)",outline:"none",cursor:"pointer"},children:[25,50,75,100,125,150,200,300].map(e=>(0,n.jsxs)("option",{value:e,children:[e,"%"]},e))}),(0,n.jsx)(i.ml,{onClick:()=>E(v+25),title:"Zoom in",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"+"})]}),w&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{title:w.provenance.title,children:["Cell #",w.provenance.cellIndex]}),(0,n.jsx)(i.ml,{onClick:()=>a?.(w),title:"Ask about this Workbench artifact",children:"Ask"}),(0,n.jsx)(i.ml,{onClick:()=>o?.(w),title:"Edit this Workbench artifact",children:"Edit"})]}),(0,n.jsx)("span",{style:{flexShrink:0},children:C||"image"}),x&&(0,n.jsxs)("span",{children:[x.w," \xd7 ",x.h]}),$&&(0,n.jsx)("span",{children:$}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:s})]})}),(0,n.jsx)(i.Ph,{style:{background:"var(--bg-panel)",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",backgroundImage:"linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:m?(0,n.jsx)(i.nG,{tone:"error",style:{minWidth:"100%",minHeight:"100%"},children:m}):(0,n.jsx)("div",{style:{minWidth:"100%",minHeight:"100%",width:"max-content",height:"max-content",boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"flex-start",padding:16},children:(0,n.jsx)("img",{src:P,alt:e,onLoad:e=>{let t=e.currentTarget;f({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>y("Failed to load image"),style:{width:x?Math.max(1,Math.round(x.w*v/100)):"auto",height:x?Math.max(1,Math.round(x.h*v/100)):"auto",maxWidth:"none",maxHeight:"none",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})})})]})}function D({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),f=(0,l.useRef)(null),m=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),f.current&&(f.current.close(),f.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return f.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}h(null),x(null),s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),f.current=null}},[e]);let y=(0,g.HG)(e),v=`/api/files/${y}?type=read${o?`&v=${o}`:""}`;return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:m||"audio"}),null!=u&&(0,n.jsx)("span",{children:function(e){if(!Number.isFinite(e))return"";let t=Math.round(e),r=Math.floor(t/60);return`${r}:${String(t%60).padStart(2,"0")}`}(u)}),null!=d&&(0,n.jsx)("span",{children:(0,i.v7)(d)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--bg-panel)"},children:(0,n.jsxs)("div",{style:{width:"min(680px, 100%)"},children:[p&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:13,marginBottom:12,textAlign:"center"},children:p}),(0,n.jsx)("audio",{controls:!0,preload:"metadata",src:v,onLoadedMetadata:e=>h(e.currentTarget.duration),onError:()=>x("Failed to load audio"),style:{width:"100%"}},v)]})})]})}function _({filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,workbenchSessionId:i,onAskAboutArtifact:a,onEditArtifact:o}){let s,d,c;return(0,g.WP)(e).toLowerCase().endsWith(".h5ad")?(0,n.jsx)(U,{filePath:e,cwd:t}):(0,g.WP)(e).toLowerCase().endsWith(".ipynb")?(0,n.jsx)(B,{filePath:e,cwd:t}):(s=(0,g.WP)(e).toLowerCase().split(".").pop()??"",I.has(s))?(0,n.jsx)(A,{filePath:e,cwd:t,workbenchSessionId:i,onAskAboutArtifact:a,onEditArtifact:o}):(d=(0,g.WP)(e).toLowerCase().split(".").pop()??"",G.has(d))?(0,n.jsx)(D,{filePath:e,cwd:t}):(c=(0,g.WP)(e).toLowerCase().split(".").pop()??"",O.has(c))?(0,n.jsx)(K,{filePath:e,cwd:t}):(0,n.jsx)(S,{filePath:e,cwd:t,onOpenFile:r,scrollToLine:l})}function U({filePath:e,cwd:t}){return(0,n.jsxs)(i.fj,{style:{background:"var(--bg)"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.nG,{children:"H5AD is a binary dataset. Use @explore from the file tree to open the interactive explorer."})]})}function K({filePath:e,cwd:t}){let r,[a,o]=(0,l.useState)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),h=(0,l.useRef)(null),p=(0,l.useRef)(0),x="pdf"===(r=(0,g.WP)(e).toLowerCase().split(".").pop()??"")?"pdf":"docx"===r||"doc"===r?"docx":"xlsx"===r||"xls"===r?"xlsx":"pptx"===r||"ppt"===r?"pptx":"other",f=(0,g.WP)(e).toLowerCase().split(".").pop()??"",m=(0,l.useCallback)(async e=>{try{let t=(0,g.HG)(e),r=p.current?`&v=${p.current}`:"",n=await fetch(`/api/files/${t}?type=read${r}`);if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));u(e.error??`HTTP ${n.status}`);return}let l=await n.arrayBuffer();o(l),u(null)}catch(e){u(String(e))}},[]);if((0,l.useEffect)(()=>{d(!0),u(null),o(null),p.current=0,h.current&&(h.current.close(),h.current=null),m(e).finally(()=>d(!1));let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return h.current=r,r.addEventListener("connected",()=>{}),r.addEventListener("change",()=>{p.current+=1,m(e)}),r.addEventListener("error",()=>{}),r.onerror=()=>{},()=>{r.close(),h.current=null}},[e,m]),s&&!a)return(0,n.jsx)(i.nG,{children:"Loading..."});if(c&&!a)return(0,n.jsx)(i.nG,{tone:"error",children:c});if(!a)return null;let y=(0,g.qP)(e,t),v=(0,n.jsx)(b,{filePath:e});return(0,n.jsxs)(i.fj,{children:["pdf"===x&&(0,n.jsx)($,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"docx"===x&&(0,n.jsx)(E,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"xlsx"===x&&(0,n.jsx)(R,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"pptx"===x&&(0,n.jsx)(M,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"other"===x&&(0,n.jsxs)(i.nG,{children:["Unsupported document format: .",f]})]})}},27568:(e,t,r)=>{r.d(t,{g:()=>f});var n=r(95155),l=r(12115),i=r(27071),a=r(89561),o=r(82228),s=r(46732),d=r(74059),c=r(4238),u=r(44542);let h={javascript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript()),typescript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript({typescript:!0})),python:()=>Promise.all([r.e(2320),r.e(3689)]).then(r.bind(r,53689)).then(e=>e.python()),sql:()=>Promise.all([r.e(2320),r.e(4097)]).then(r.bind(r,14097)).then(e=>e.sql()),json:()=>Promise.all([r.e(2320),r.e(5460)]).then(r.bind(r,25460)).then(e=>e.json()),html:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144)]).then(r.bind(r,20144)).then(e=>e.html()),css:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),scss:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),less:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),markdown:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144),r.e(2733)]).then(r.bind(r,62733)).then(e=>e.markdown()),xml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),yaml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),toml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),rust:()=>Promise.all([r.e(2320),r.e(5135)]).then(r.bind(r,55135)).then(e=>e.rust()),go:()=>Promise.all([r.e(2320),r.e(1209)]).then(r.bind(r,11209)).then(e=>e.go()),java:()=>Promise.all([r.e(2320),r.e(8198)]).then(r.bind(r,88198)).then(e=>e.java())},p=new Map;async function x(e){let t=h[e];if(!t)return null;let r=p.get(e);if(r)return r;let n=await t();return p.set(e,n),n}function f({initialContent:e,language:t,isDark:r,onChange:h,onSave:p,scrollToLine:g}){let m=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(h),v=(0,l.useRef)(p);return b.current=h,v.current=p,(0,l.useEffect)(()=>{let n=m.current;if(!n)return;let l=!1,h=y.current;return h&&(h.destroy(),y.current=null),(async()=>{let h=await x(t);if(l||!n)return;let p=v.current?a.w4.of([{key:"Mod-s",run:()=>(v.current?.(),!0),preventDefault:!0}]):[],f=i.$t.create({doc:e,extensions:[(0,a.$K)(),(0,a.dz)(),(0,o.b6)(),(0,s.y9)(s.Zt),a.w4.of([...o.pw,...o.cL,...u.OO,...c.Eo]),p,(0,u.yU)(),...r?[d.bM]:[],...h?[h]:[],a.Lz.updateListener.of(e=>{e.docChanged&&b.current?.(e.state.doc.toString())}),a.Lz.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto",fontFamily:"var(--font-mono)"},".cm-content":{padding:"8px 0"},".cm-gutters":{borderRight:"1px solid var(--border)",background:"var(--bg)",color:"var(--text-dim)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{background:r?"#3a3d4e":"#b4d5fe"}})]});l||!n||(y.current&&y.current.destroy(),y.current=new a.Lz({state:f,parent:n}))})(),()=>{l=!0,y.current?.destroy(),y.current=null}},[t,r]),(0,l.useEffect)(()=>{let t=y.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,l.useEffect)(()=>{let e=y.current;if(!e||null==g||g<1)return;let t=e.state.doc.line(Math.min(g,e.state.doc.lines));e.dispatch({effects:a.Lz.scrollIntoView(t.from,{y:"center"})})},[g]),(0,n.jsx)("div",{ref:m,style:{height:"100%",overflow:"hidden"}})}},53308:(e,t,r)=>{r.d(t,{HF:()=>a,S7:()=>i,_t:()=>l});var n=r(95155);function l({title:e,children:t,style:r}){return(0,n.jsxs)("div",{"data-document-surface":"outline",style:{marginTop:24,...r},children:[e&&(0,n.jsx)("div",{"data-document-surface":"outline-title",style:{fontSize:12,color:"var(--text-dim)",marginBottom:8},children:e}),t]})}function i({children:e,minItemWidth:t=140,style:r}){return(0,n.jsx)("div",{"data-document-surface":"outline-grid",style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:8,...r},children:e})}function a({title:e,summary:t,active:r=!1,onClick:l}){return(0,n.jsxs)("button",{"data-document-surface":"outline-item","data-document-active":r?"true":"false",onClick:l,style:{padding:"10px 12px",background:r?"var(--bg-selected)":"var(--bg)",border:r?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:6,cursor:"pointer",textAlign:"left",fontSize:11,color:"var(--text-muted)",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:e=>{r||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="var(--bg)")},children:[(0,n.jsx)("div",{style:{fontWeight:600,marginBottom:2*!!t,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}},63161:(e,t,r)=>{r.d(t,{B:()=>a});var n=r(95155),l=r(76577);function i({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:a,zoom:o,extra:s}){let d=(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)("span",{children:t}),void 0!==o&&a&&r&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(l.ml,{onClick:a,title:"Zoom out",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})})}),(0,n.jsxs)("span",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*o),"%"]}),(0,n.jsx)(l.ml,{onClick:r,title:"Zoom in",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"5",y1:"2",x2:"5",y2:"8"}),(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})]})})]}),s]});return(0,n.jsx)(l.K$,{pathLabel:e??"document",title:e,trailing:d,style:{minHeight:32}})}function a({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d,bodyStyle:c,loading:u=!1,loadingLabel:h="Loading document...",error:p=null,children:x}){return(0,n.jsxs)(l.fj,{children:[(0,n.jsx)(i,{fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d}),(0,n.jsx)(l.Ph,{style:c,children:u?(0,n.jsx)(l.nG,{children:h}):p?(0,n.jsx)(l.nG,{tone:"error",children:p}):x})]})}r(12115)}}]);
|
|
22
|
+
</style></head><body><div class="xlsx-preview">${e}</div></body></html>`},[p,u]);return(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=await Promise.all([r.e(3524),r.e(8436)]).then(r.bind(r,15967)),l=n.read(e,{type:"array"}),i=l.SheetNames.map(e=>{let t=l.Sheets[e],r=n.utils.sheet_to_html(t,{editable:!1}).replace(H,"").replace(R,"").replace(T,"");return{name:e,html:r}});t||(h(i),x(0),s(!1))}catch(e){t||(console.error("XLSX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]),(0,n.jsx)(L.B,{fileName:t,loading:o,loadingLabel:"Loading spreadsheet...",error:d,bodyStyle:{background:"var(--bg-panel)"},extra:(0,n.jsxs)(n.Fragment,{children:[a,u.length>1&&(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",maxWidth:"min(520px, 48vw)"},children:(0,n.jsx)(i.Tg,{options:u.map((e,t)=>({key:e.name,label:(0,n.jsx)("span",{title:e.name,style:{display:"block",maxWidth:120,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name}),active:t===p,onClick:()=>x(t)}))})})]}),children:!o&&!d&&u.length>0&&(0,n.jsx)("iframe",{title:t?`${t} preview`:"Spreadsheet preview",sandbox:"",srcDoc:f,style:{width:"100%",height:"100%",minHeight:320,border:"none",background:"white"}})})}var z=r(53308);function M({arrayBuffer:e,fileName:t,toolbarExtra:a}){let[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)([]),[p,x]=(0,l.useState)(0);(0,l.useEffect)(()=>{let t=!1;return async function(){s(!0),c(null);try{let n=(await Promise.all([r.e(2619),r.e(4453)]).then(r.t.bind(r,54453,23))).default,l=await n.loadAsync(e),i=[];l.forEach(e=>{let t=/^ppt\/slides\/slide(\d+)\.xml$/i.exec(e);t&&i.push({name:e,index:parseInt(t[1],10)})}),i.sort((e,t)=>e.index-t.index);let a=[];for(let e of i){let r;if(t)return;let n=await l.file(e.name).async("string"),i=/<a:t[^>]*>([^<]*)<\/a:t>/g,o=[];for(;null!==(r=i.exec(n));){let e=r[1].trim();e&&o.push(e)}a.push({index:e.index,texts:o})}t||(h(a),s(!1))}catch(e){t||(console.error("PPTX parse error:",e),c(String(e)),s(!1))}}(),()=>{t=!0}},[e]);let f=u[p],g=u.length;return(0,n.jsx)(L.B,{fileName:t,pageInfo:g>0?`Slide ${p+1} / ${g}`:void 0,loading:o,loadingLabel:"Loading presentation...",error:d,bodyStyle:{background:"var(--bg-panel)",display:"flex",justifyContent:"center",alignItems:"flex-start",padding:24},extra:(0,n.jsxs)(n.Fragment,{children:[a,g>1&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.max(e-1,0)),title:"Previous slide",disabled:p<=0,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"6 2 3 5 6 8"})})}),(0,n.jsxs)("span",{style:{fontSize:11,color:"var(--text-dim)",minWidth:28,textAlign:"center"},children:[p+1,"/",g]}),(0,n.jsx)(i.ml,{onClick:()=>x(e=>Math.min(e+1,g-1)),title:"Next slide",disabled:p>=g-1,style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("polyline",{points:"4 2 7 5 4 8"})})})]})]}),children:!o&&!d&&f&&(0,n.jsx)(C.QG,{children:(0,n.jsxs)("div",{style:{width:"100%",maxWidth:800},children:[(0,n.jsxs)(C.ok,{children:[(0,n.jsxs)(C.PH,{children:["Slide ",f.index]}),(0,n.jsx)(C.OI,{style:{minHeight:200},children:0===f.texts.length?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontStyle:"italic",fontSize:13},children:"(No text content)"}):(0,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none"},children:f.texts.map((e,t)=>(0,n.jsx)("li",{style:{padding:"4px 0",fontSize:14,lineHeight:1.6,color:"var(--text)",borderBottom:t<f.texts.length-1?"1px solid var(--bg-panel)":"none"},children:e},t))})})]}),g>1&&(0,n.jsx)(z._t,{title:"All slides",children:(0,n.jsx)(z.S7,{children:u.map((e,t)=>(0,n.jsx)(z.HF,{title:`Slide ${e.index}`,summary:e.texts[0]||"(empty)",active:t===p,onClick:()=>x(t)},e.index))})})]})})})}function F(e){return Array.isArray(e)?e.join(""):e}function N({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(!0),[d,c]=(0,l.useState)(null),u=(0,l.useRef)(null);return((0,l.useEffect)(()=>{let t=(0,g.HG)(e);fetch(`/api/files/${t}?type=read`).then(async e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();if(t.error)throw Error(t.error);if(!t.content)throw Error("Empty file");let r=JSON.parse(t.content);if(!r.cells||!Array.isArray(r.cells))throw Error("Invalid notebook format");a(r.cells)}).catch(e=>c(e.message)).finally(()=>s(!1));let r=new EventSource(`/api/files/${t}?type=watch`);return u.current=r,()=>{r.close(),u.current=null}},[e]),o)?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:"Loading notebook..."})]}):d||!r?(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e}),(0,n.jsx)(i.nG,{children:d??"Failed to load notebook"})]}):(0,n.jsxs)(i.fj,{style:{background:"var(--bg)",overflowY:"auto"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:`${(0,g.WP)(e)} \xb7 ${r.length} cells`,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.Ph,{style:{padding:0},children:(0,n.jsx)("div",{style:{display:"flex",flexDirection:"column"},children:r.map((e,t)=>(0,n.jsx)(B,{cell:e},t))})})]})}function B({cell:e}){if("markdown"===e.cell_type){let t=F(e.source).trim();return t?(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg)"},children:(0,n.jsx)(f.T,{content:t})}):null}if("code"===e.cell_type){let t=F(e.source),r=e.execution_count,l=e.outputs&&e.outputs.length>0;return(0,n.jsxs)("div",{style:{borderBottom:"1px solid var(--border)"},children:[(0,n.jsxs)("div",{style:{display:"flex",background:"var(--bg-panel)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0,padding:"6px 0",textAlign:"center",fontSize:10,fontFamily:"var(--font-mono)",color:"var(--text-dim)",userSelect:"none"},children:null!=r?`[${r}]`:"[ ]"}),(0,n.jsx)("div",{style:{flex:1,minWidth:0,padding:"6px 12px 6px 0",overflow:"auto"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(0,n.jsx)("code",{children:t})})})]}),l&&e.outputs.map((e,t)=>{let r=function(e){let t=[];if(!e.data)return t;for(let r of["image/png","image/jpeg","image/svg+xml","image/webp"])if(e.data[r]){let n=F(e.data[r]);t.push({data:n,mimeType:r})}return t}(e),l=function(e){if("stream"===e.output_type)return F(e.text??"").trim()||null;if(("execute_result"===e.output_type||"display_data"===e.output_type)&&e.data?.["text/plain"])return F(e.data["text/plain"]).trim()||null;if("error"===e.output_type){let t=e.ename??"Error",r=e.evalue??"";return`${t}: ${r}`}return null}(e);return"error"===e.output_type?(0,n.jsxs)("div",{style:{display:"flex",background:"rgba(248,113,113,0.04)",borderTop:"1px solid rgba(248,113,113,0.15)"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 12px 6px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"#f87171",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:l})})]},t):(0,n.jsxs)("div",{style:{borderTop:"1px solid rgba(34,197,94,0.08)",background:"var(--bg-subtle)"},children:[r.length>0&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"6px 0"},children:r.map((e,r)=>(0,n.jsx)("img",{src:`data:${e.mimeType};base64,${e.data}`,alt:`output ${t}`,style:{maxWidth:"100%",display:"block"}},r))})]}),l&&(0,n.jsxs)("div",{style:{display:"flex"},children:[(0,n.jsx)("div",{style:{width:48,flexShrink:0}}),(0,n.jsx)("div",{style:{flex:1,padding:"4px 12px 4px 0"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:11,lineHeight:1.5,color:"var(--text-muted)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:300,overflow:"auto"},children:l})})]})]},t)})]})}return(0,n.jsx)("div",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border)",background:"var(--bg-panel)"},children:(0,n.jsx)("pre",{style:{margin:0,fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-dim)",whiteSpace:"pre-wrap"},children:F(e.source)})})}let I=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),G=new Set(["mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","webm"]),O=new Set(["pdf","docx","xlsx","pptx","doc","xls","ppt"]);function A({filePath:e,cwd:t,workbenchSessionId:r,onAskAboutArtifact:a,onEditArtifact:o}){let[s,d]=(0,l.useState)(!1),[c,u]=(0,l.useState)(0),[h,p]=(0,l.useState)(null),[x,f]=(0,l.useState)(null),[m,y]=(0,l.useState)(null),[v,j]=(0,l.useState)(100),[w,k]=(0,l.useState)(null),S=(0,l.useRef)(null),C=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{u(0),p(null),f(null),y(null),d(!1),j(100),S.current&&(S.current.close(),S.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return S.current=r,r.addEventListener("connected",()=>d(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&p(t.size)}catch{}u(e=>e+1)}),r.addEventListener("error",()=>d(!1)),r.onerror=()=>d(!1),()=>{r.close(),S.current=null}},[e]),(0,l.useEffect)(()=>{if(!r)return void k(null);let t=!1,n=new URLSearchParams({path:e});return fetch(`/api/sessions/${encodeURIComponent(r)}/workbench-artifact?${n}`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>{t||k(e.artifact??null)}).catch(()=>{t||k(null)}),()=>{t=!0}},[e,r]);let L=(0,g.HG)(e),P=`/api/files/${L}?type=read${c?`&v=${c}`:""}`,$=null!=h?(0,i.v7)(h):null,E=e=>j(Math.max(10,Math.min(500,e)));return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:[(0,n.jsx)(i.ml,{onClick:()=>E(v-25),title:"Zoom out",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"-"}),(0,n.jsx)("select",{value:v,onChange:e=>E(Number(e.target.value)),title:"Image zoom",style:{height:22,border:"1px solid var(--border)",borderRadius:5,background:"var(--bg-panel)",color:"var(--text)",fontSize:11,fontFamily:"var(--font-mono)",outline:"none",cursor:"pointer"},children:[25,50,75,100,125,150,200,300].map(e=>(0,n.jsxs)("option",{value:e,children:[e,"%"]},e))}),(0,n.jsx)(i.ml,{onClick:()=>E(v+25),title:"Zoom in",style:{width:24,height:22,fontSize:13,lineHeight:1,padding:0},children:"+"})]}),w&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{title:w.provenance.title,children:["Cell #",w.provenance.cellIndex]}),(0,n.jsx)(i.ml,{onClick:()=>a?.(w),title:"Ask about this Workbench artifact",children:"Ask"}),(0,n.jsx)(i.ml,{onClick:()=>o?.(w),title:"Edit this Workbench artifact",children:"Edit"})]}),(0,n.jsx)("span",{style:{flexShrink:0},children:C||"image"}),x&&(0,n.jsxs)("span",{children:[x.w," \xd7 ",x.h]}),$&&(0,n.jsx)("span",{children:$}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:s})]})}),(0,n.jsx)(i.Ph,{style:{background:"var(--bg-panel)",WebkitOverflowScrolling:"touch",overscrollBehavior:"contain",backgroundImage:"linear-gradient(45deg, var(--bg) 25%, transparent 25%), linear-gradient(-45deg, var(--bg) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg) 75%), linear-gradient(-45deg, transparent 75%, var(--bg) 75%)",backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px"},children:m?(0,n.jsx)(i.nG,{tone:"error",style:{minWidth:"100%",minHeight:"100%"},children:m}):(0,n.jsx)("div",{style:{minWidth:"100%",minHeight:"100%",width:"max-content",height:"max-content",boxSizing:"border-box",display:"flex",alignItems:"flex-start",justifyContent:"flex-start",padding:16},children:(0,n.jsx)("img",{src:P,alt:e,onLoad:e=>{let t=e.currentTarget;f({w:t.naturalWidth,h:t.naturalHeight})},onError:()=>y("Failed to load image"),style:{width:x?Math.max(1,Math.round(x.w*v/100)):"auto",height:x?Math.max(1,Math.round(x.h*v/100)):"auto",maxWidth:"none",maxHeight:"none",objectFit:"contain",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"}})})})]})}function D({filePath:e,cwd:t}){let[r,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(0),[d,c]=(0,l.useState)(null),[u,h]=(0,l.useState)(null),[p,x]=(0,l.useState)(null),f=(0,l.useRef)(null),m=(0,g.WP)(e).toLowerCase().split(".").pop()??"";(0,l.useEffect)(()=>{s(0),c(null),h(null),x(null),a(!1),f.current&&(f.current.close(),f.current=null);let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return f.current=r,r.addEventListener("connected",()=>a(!0)),r.addEventListener("change",e=>{try{let t=JSON.parse(e.data);"number"==typeof t.size&&c(t.size)}catch{}h(null),x(null),s(e=>e+1)}),r.addEventListener("error",()=>a(!1)),r.onerror=()=>a(!1),()=>{r.close(),f.current=null}},[e]);let y=(0,g.HG)(e),v=`/api/files/${y}?type=read${o?`&v=${o}`:""}`;return(0,n.jsxs)(i.fj,{children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,trailing:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:m||"audio"}),null!=u&&(0,n.jsx)("span",{children:function(e){if(!Number.isFinite(e))return"";let t=Math.round(e),r=Math.floor(t/60);return`${r}:${String(t%60).padStart(2,"0")}`}(u)}),null!=d&&(0,n.jsx)("span",{children:(0,i.v7)(d)}),(0,n.jsx)(b,{filePath:e}),(0,n.jsx)(i.mK,{watching:r})]})}),(0,n.jsx)(i.Ph,{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--bg-panel)"},children:(0,n.jsxs)("div",{style:{width:"min(680px, 100%)"},children:[p&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:13,marginBottom:12,textAlign:"center"},children:p}),(0,n.jsx)("audio",{controls:!0,preload:"metadata",src:v,onLoadedMetadata:e=>h(e.currentTarget.duration),onError:()=>x("Failed to load audio"),style:{width:"100%"}},v)]})})]})}function _({filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,workbenchSessionId:i,onAskAboutArtifact:a,onEditArtifact:o,viewerState:s,onViewerStateChange:d}){let c,u,h;return(0,g.WP)(e).toLowerCase().endsWith(".h5ad")?(0,n.jsx)(U,{filePath:e,cwd:t}):(0,g.WP)(e).toLowerCase().endsWith(".ipynb")?(0,n.jsx)(N,{filePath:e,cwd:t}):(c=(0,g.WP)(e).toLowerCase().split(".").pop()??"",I.has(c))?(0,n.jsx)(A,{filePath:e,cwd:t,workbenchSessionId:i,onAskAboutArtifact:a,onEditArtifact:o}):(u=(0,g.WP)(e).toLowerCase().split(".").pop()??"",G.has(u))?(0,n.jsx)(D,{filePath:e,cwd:t}):(h=(0,g.WP)(e).toLowerCase().split(".").pop()??"",O.has(h))?(0,n.jsx)(q,{filePath:e,cwd:t}):(0,n.jsx)(S,{filePath:e,cwd:t,onOpenFile:r,scrollToLine:l,viewerState:s,onViewerStateChange:d})}function U({filePath:e,cwd:t}){return(0,n.jsxs)(i.fj,{style:{background:"var(--bg)"},children:[(0,n.jsx)(i.K$,{pathLabel:(0,g.qP)(e,t),title:e,style:{padding:"9px 12px",fontSize:12,color:"var(--text-muted)"}}),(0,n.jsx)(i.nG,{children:"H5AD is a binary dataset. Use @explore from the file tree to open the interactive explorer."})]})}function q({filePath:e,cwd:t}){let r,[a,o]=(0,l.useState)(null),[s,d]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),h=(0,l.useRef)(null),p=(0,l.useRef)(0),x="pdf"===(r=(0,g.WP)(e).toLowerCase().split(".").pop()??"")?"pdf":"docx"===r||"doc"===r?"docx":"xlsx"===r||"xls"===r?"xlsx":"pptx"===r||"ppt"===r?"pptx":"other",f=(0,g.WP)(e).toLowerCase().split(".").pop()??"",m=(0,l.useCallback)(async e=>{try{let t=(0,g.HG)(e),r=p.current?`&v=${p.current}`:"",n=await fetch(`/api/files/${t}?type=read${r}`);if(!n.ok){let e=await n.json().catch(()=>({error:String(n.status)}));u(e.error??`HTTP ${n.status}`);return}let l=await n.arrayBuffer();o(l),u(null)}catch(e){u(String(e))}},[]);if((0,l.useEffect)(()=>{d(!0),u(null),o(null),p.current=0,h.current&&(h.current.close(),h.current=null),m(e).finally(()=>d(!1));let t=(0,g.HG)(e),r=new EventSource(`/api/files/${t}?type=watch`);return h.current=r,r.addEventListener("connected",()=>{}),r.addEventListener("change",()=>{p.current+=1,m(e)}),r.addEventListener("error",()=>{}),r.onerror=()=>{},()=>{r.close(),h.current=null}},[e,m]),s&&!a)return(0,n.jsx)(i.nG,{children:"Loading..."});if(c&&!a)return(0,n.jsx)(i.nG,{tone:"error",children:c});if(!a)return null;let y=(0,g.qP)(e,t),v=(0,n.jsx)(b,{filePath:e});return(0,n.jsxs)(i.fj,{children:["pdf"===x&&(0,n.jsx)($,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"docx"===x&&(0,n.jsx)(E,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"xlsx"===x&&(0,n.jsx)(W,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"pptx"===x&&(0,n.jsx)(M,{arrayBuffer:a,fileName:y,toolbarExtra:v}),"other"===x&&(0,n.jsxs)(i.nG,{children:["Unsupported document format: .",f]})]})}},27568:(e,t,r)=>{r.d(t,{g:()=>f});var n=r(95155),l=r(12115),i=r(27071),a=r(89561),o=r(82228),s=r(46732),d=r(74059),c=r(4238),u=r(44542);let h={javascript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript()),typescript:()=>Promise.all([r.e(2320),r.e(3307)]).then(r.bind(r,13307)).then(e=>e.javascript({typescript:!0})),python:()=>Promise.all([r.e(2320),r.e(3689)]).then(r.bind(r,53689)).then(e=>e.python()),sql:()=>Promise.all([r.e(2320),r.e(4097)]).then(r.bind(r,14097)).then(e=>e.sql()),json:()=>Promise.all([r.e(2320),r.e(5460)]).then(r.bind(r,25460)).then(e=>e.json()),html:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144)]).then(r.bind(r,20144)).then(e=>e.html()),css:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),scss:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),less:()=>Promise.all([r.e(2320),r.e(2774)]).then(r.bind(r,82774)).then(e=>e.css()),markdown:()=>Promise.all([r.e(2320),r.e(3307),r.e(2774),r.e(144),r.e(2733)]).then(r.bind(r,62733)).then(e=>e.markdown()),xml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),yaml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),toml:()=>Promise.all([r.e(2320),r.e(7482)]).then(r.bind(r,77482)).then(e=>e.xml()),rust:()=>Promise.all([r.e(2320),r.e(5135)]).then(r.bind(r,55135)).then(e=>e.rust()),go:()=>Promise.all([r.e(2320),r.e(1209)]).then(r.bind(r,11209)).then(e=>e.go()),java:()=>Promise.all([r.e(2320),r.e(8198)]).then(r.bind(r,88198)).then(e=>e.java())},p=new Map;async function x(e){let t=h[e];if(!t)return null;let r=p.get(e);if(r)return r;let n=await t();return p.set(e,n),n}function f({initialContent:e,language:t,isDark:r,onChange:h,onSave:p,scrollToLine:g}){let m=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useRef)(h),v=(0,l.useRef)(p);return b.current=h,v.current=p,(0,l.useEffect)(()=>{let n=m.current;if(!n)return;let l=!1,h=y.current;return h&&(h.destroy(),y.current=null),(async()=>{let h=await x(t);if(l||!n)return;let p=v.current?a.w4.of([{key:"Mod-s",run:()=>(v.current?.(),!0),preventDefault:!0}]):[],f=i.$t.create({doc:e,extensions:[(0,a.$K)(),(0,a.dz)(),(0,o.b6)(),(0,s.y9)(s.Zt),a.w4.of([...o.pw,...o.cL,...u.OO,...c.Eo]),p,(0,u.yU)(),...r?[d.bM]:[],...h?[h]:[],a.Lz.updateListener.of(e=>{e.docChanged&&b.current?.(e.state.doc.toString())}),a.Lz.theme({"&":{height:"100%",fontSize:"13px"},".cm-scroller":{overflow:"auto",fontFamily:"var(--font-mono)"},".cm-content":{padding:"8px 0"},".cm-gutters":{borderRight:"1px solid var(--border)",background:"var(--bg)",color:"var(--text-dim)"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground":{background:r?"#3a3d4e":"#b4d5fe"}})]});l||!n||(y.current&&y.current.destroy(),y.current=new a.Lz({state:f,parent:n}))})(),()=>{l=!0,y.current?.destroy(),y.current=null}},[t,r]),(0,l.useEffect)(()=>{let t=y.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),(0,l.useEffect)(()=>{let e=y.current;if(!e||null==g||g<1)return;let t=e.state.doc.line(Math.min(g,e.state.doc.lines));e.dispatch({effects:a.Lz.scrollIntoView(t.from,{y:"center"})})},[g]),(0,n.jsx)("div",{ref:m,style:{height:"100%",overflow:"hidden"}})}},53308:(e,t,r)=>{r.d(t,{HF:()=>a,S7:()=>i,_t:()=>l});var n=r(95155);function l({title:e,children:t,style:r}){return(0,n.jsxs)("div",{"data-document-surface":"outline",style:{marginTop:24,...r},children:[e&&(0,n.jsx)("div",{"data-document-surface":"outline-title",style:{fontSize:12,color:"var(--text-dim)",marginBottom:8},children:e}),t]})}function i({children:e,minItemWidth:t=140,style:r}){return(0,n.jsx)("div",{"data-document-surface":"outline-grid",style:{display:"grid",gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`,gap:8,...r},children:e})}function a({title:e,summary:t,active:r=!1,onClick:l}){return(0,n.jsxs)("button",{"data-document-surface":"outline-item","data-document-active":r?"true":"false",onClick:l,style:{padding:"10px 12px",background:r?"var(--bg-selected)":"var(--bg)",border:r?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:6,cursor:"pointer",textAlign:"left",fontSize:11,color:"var(--text-muted)",transition:"border-color 0.12s, background 0.12s"},onMouseEnter:e=>{r||(e.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:e=>{r||(e.currentTarget.style.background="var(--bg)")},children:[(0,n.jsx)("div",{style:{fontWeight:600,marginBottom:2*!!t,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),t&&(0,n.jsx)("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t})]})}},63161:(e,t,r)=>{r.d(t,{B:()=>a});var n=r(95155),l=r(76577);function i({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:a,zoom:o,extra:s}){let d=(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsx)("span",{children:t}),void 0!==o&&a&&r&&(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,n.jsx)(l.ml,{onClick:a,title:"Zoom out",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})})}),(0,n.jsxs)("span",{style:{minWidth:36,textAlign:"center",fontVariantNumeric:"tabular-nums"},children:[Math.round(100*o),"%"]}),(0,n.jsx)(l.ml,{onClick:r,title:"Zoom in",style:{width:24,height:24,padding:0,lineHeight:1},children:(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,n.jsx)("line",{x1:"5",y1:"2",x2:"5",y2:"8"}),(0,n.jsx)("line",{x1:"2",y1:"5",x2:"8",y2:"5"})]})})]}),s]});return(0,n.jsx)(l.K$,{pathLabel:e??"document",title:e,trailing:d,style:{minHeight:32}})}function a({fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d,bodyStyle:c,loading:u=!1,loadingLabel:h="Loading document...",error:p=null,children:x}){return(0,n.jsxs)(l.fj,{children:[(0,n.jsx)(i,{fileName:e,pageInfo:t,onZoomIn:r,onZoomOut:o,zoom:s,extra:d}),(0,n.jsx)(l.Ph,{style:c,children:u?(0,n.jsx)(l.nG,{children:h}):p?(0,n.jsx)(l.nG,{tone:"error",children:p}):x})]})}r(12115)}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7198],{1155:(t,e,r)=>{r.d(e,{CP:()=>p,Ck:()=>h,HT:()=>y,PB:()=>c,aC:()=>x,lC:()=>d,m:()=>o,tk:()=>n});var a=r(97096),s=r(32165),l=r(84485),i=r(33948),n=(0,s.K2)((t,e)=>{let r=t.append("rect");if(r.attr("x",e.x),r.attr("y",e.y),r.attr("fill",e.fill),r.attr("stroke",e.stroke),r.attr("width",e.width),r.attr("height",e.height),e.name&&r.attr("name",e.name),e.rx&&r.attr("rx",e.rx),e.ry&&r.attr("ry",e.ry),void 0!==e.attrs)for(let t in e.attrs)r.attr(t,e.attrs[t]);return e.class&&r.attr("class",e.class),r},"drawRect"),d=(0,s.K2)((t,e)=>{n(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"}).lower()},"drawBackgroundRect"),o=(0,s.K2)((t,e)=>{let r=e.text.replace(a.H1," "),s=t.append("text");s.attr("x",e.x),s.attr("y",e.y),s.attr("class","legend"),s.style("text-anchor",e.anchor),e.class&&s.attr("class",e.class);let l=s.append("tspan");return l.attr("x",e.x+2*e.textMargin),l.text(r),s},"drawText"),x=(0,s.K2)((t,e,r,a)=>{let s=t.append("image");s.attr("x",e),s.attr("y",r);let i=(0,l.J)(a);s.attr("xlink:href",i)},"drawImage"),p=(0,s.K2)((t,e,r,a)=>{let s=t.append("use");s.attr("x",e),s.attr("y",r);let i=(0,l.J)(a);s.attr("xlink:href",`#${i}`)},"drawEmbeddedImage"),c=(0,s.K2)(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),y=(0,s.K2)(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),h=(0,s.K2)(()=>{let t=(0,i.Ltv)(".mermaidTooltip");return t.empty()&&(t=(0,i.Ltv)("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),t},"createTooltip")},87722:(t,e,r)=>{r.d(e,{m:()=>s});var a=r(32165),s=class{constructor(t){this.init=t,this.records=this.init()}static{(0,a.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}}}]);
|