@baique/pi-web-sky 0.1.39 → 0.1.41
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 +7 -12
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +51 -51
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/routes-manifest.json +3 -45
- package/.next/server/app/_global-error/page.js +2 -2
- 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/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js +1 -1
- 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 +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/agent/[id]/bash-output/route.js +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/agent/[id]/route.js +2 -2
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/running/route.js +1 -1
- package/.next/server/app/api/app-update/route.js +1 -1
- 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 +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/boards/[id]/reconcile/route.js +1 -0
- package/.next/server/app/api/boards/[id]/reconcile/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/boards/[id]/route.js +1 -1
- package/.next/server/app/api/boards/purge-orphans/route.js +1 -1
- package/.next/server/app/api/boards/reorder/route.js +1 -1
- package/.next/server/app/api/boards/route.js +1 -1
- package/.next/server/app/api/cwd/browse/route.js +1 -1
- package/.next/server/app/api/cwd/validate/route.js +2 -2
- package/.next/server/app/api/default-cwd/route.js +2 -2
- package/.next/server/app/api/file-index/route.js +2 -2
- package/.next/server/app/api/files/[...path]/route.js +3 -3
- package/.next/server/app/api/files/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/git/diff/route.js +1 -1
- package/.next/server/app/api/git/status/route.js +1 -1
- package/.next/server/app/api/home/route.js +1 -1
- package/.next/server/app/api/mcp/route.js +1 -1
- package/.next/server/app/api/models/route.js +2 -2
- package/.next/server/app/api/models-config/catalog/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/plugins/route.js +2 -2
- package/.next/server/app/api/project-trust/route.js +2 -2
- package/.next/server/app/api/quota/route.js +1 -1
- package/.next/server/app/api/search/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/auto-name/route.js +3 -3
- package/.next/server/app/api/sessions/[id]/context/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/state/route.js +2 -2
- package/.next/server/app/api/sessions/[id]/todos/route.js +2 -2
- package/.next/server/app/api/sessions/route.js +2 -2
- package/.next/server/app/api/skills/check/route.js +1 -1
- package/.next/server/app/api/skills/install/route.js +2 -2
- package/.next/server/app/api/skills/route.js +1 -1
- package/.next/server/app/api/skills/search/route.js +1 -1
- package/.next/server/app/api/skills/update/route.js +1 -1
- package/.next/server/app/api/task-card-questions/[id]/answer/route.js +1 -1
- package/.next/server/app/api/task-card-questions/route.js +1 -1
- package/.next/server/app/api/task-cards/[id]/route.js +1 -1
- package/.next/server/app/api/task-cards/route.js +1 -1
- package/.next/server/app/api/task-scheduler/status/route.js +1 -1
- package/.next/server/app/api/tasks/[id]/board/route.js +1 -1
- package/.next/server/app/api/tasks/[id]/route.js +1 -1
- package/.next/server/app/api/tasks/reorder/route.js +1 -1
- package/.next/server/app/api/tasks/route.js +1 -1
- package/.next/server/app/api/terminal/[id]/events/route.js +2 -2
- package/.next/server/app/api/terminal/[id]/route.js +2 -2
- package/.next/server/app/api/terminal/route.js +2 -2
- package/.next/server/app/api/worktrees/route.js +2 -2
- package/.next/server/app/favicon.ico/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 +5 -5
- package/.next/server/app/index.segments/_full.segment.rsc +5 -5
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/page.js +7 -7
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +7 -12
- package/.next/server/chunks/1094.js +2 -2
- package/.next/server/chunks/1601.js +1 -1
- package/.next/server/chunks/1860.js +1 -1
- package/.next/server/chunks/2075.js +1 -1
- package/.next/server/chunks/2169.js +1 -1
- package/.next/server/chunks/2404.js +1 -1
- package/.next/server/chunks/2524.js +1 -0
- package/.next/server/chunks/3012.js +1 -1
- package/.next/server/chunks/{5760.js → 3379.js} +1 -1
- package/.next/server/chunks/3500.js +1 -1
- package/.next/server/chunks/4226.js +5 -2
- package/.next/server/chunks/4267.js +1 -1
- package/.next/server/chunks/4563.js +1 -1
- package/.next/server/chunks/5318.js +1 -1
- package/.next/server/chunks/542.js +3 -44
- package/.next/server/chunks/5794.js +1 -1
- package/.next/server/chunks/6052.js +1 -1
- package/.next/server/chunks/6253.js +1 -1
- package/.next/server/chunks/6288.js +1 -1
- package/.next/server/chunks/6366.js +1 -1
- package/.next/server/chunks/673.js +1 -1
- package/.next/server/chunks/6916.js +2 -2
- package/.next/server/chunks/7128.js +43 -0
- package/.next/server/chunks/7265.js +2 -2
- package/.next/server/chunks/7799.js +1 -1
- package/.next/server/chunks/8106.js +1 -1
- package/.next/server/chunks/8333.js +1 -1
- package/.next/server/chunks/8604.js +1 -1
- package/.next/server/chunks/861.js +1 -0
- package/.next/server/chunks/8713.js +1 -1
- package/.next/server/chunks/8782.js +2 -2
- package/.next/server/chunks/898.js +1 -1
- package/.next/server/chunks/922.js +2 -2
- package/.next/server/chunks/9280.js +6 -6
- package/.next/server/chunks/9510.js +1 -1
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- 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/{103.23142a67b02246a8.js → 103.6c91a059aa01d92c.js} +2 -2
- package/.next/static/chunks/{1032.12b382a9096ab2a4.js → 1032.9e8f793d46f463f8.js} +1 -1
- package/.next/static/chunks/{1063.775c442bdbeef08b.js → 1063.470df8a037dc8409.js} +1 -1
- package/.next/static/chunks/1a258343.f4fc2c133917ded8.js +2 -0
- package/.next/static/chunks/{1ba63609.b2ae90f43319a29e.js → 1ba63609.569928c7234f832c.js} +1 -1
- package/.next/static/chunks/{2181.ba21239d3ac39f81.js → 2181.b8dda21843ef5e74.js} +1 -1
- package/.next/static/chunks/{2325.23caf22075e51aa5.js → 2325.23e538886331cf64.js} +1 -1
- package/.next/static/chunks/{2356.523277bb8c6bf72a.js → 2356.b7312589c345edec.js} +1 -1
- package/.next/static/chunks/{268.72794ee2773c2060.js → 268.a1d90aca268be18a.js} +1 -1
- package/.next/static/chunks/{2695.6f49435bae1e6f33.js → 2695.5624aa3aae540e87.js} +1 -1
- package/.next/static/chunks/{2703.495a65ed14b2f094.js → 2703.097bc88286733740.js} +1 -1
- package/.next/static/chunks/{2821.934bcf60fbdc28c6.js → 2821.d2392a93d192fe92.js} +1 -1
- package/.next/static/chunks/3308.2cd6f20e6c0f4e92.js +73 -0
- package/.next/static/chunks/{3336.a76f9485fe7cb762.js → 3336.9b1dc9ec3507d64f.js} +1 -1
- package/.next/static/chunks/3546.779d2c7646aa77cc.js +1 -0
- package/.next/static/chunks/{370.8e8f3cf8eb0e29dd.js → 370.cde2a84caa84054f.js} +1 -1
- package/.next/static/chunks/{3716.72bf4c9d7325debd.js → 3716.5bac496cea32ca8f.js} +1 -1
- package/.next/static/chunks/{3995.eca0f5bef1fc3ae5.js → 3995.cd112debcd64c610.js} +1 -1
- package/.next/static/chunks/{4004.74b9bcf5478b1663.js → 4004.a8f79ef62f32aa30.js} +2 -2
- package/.next/static/chunks/{4202.8440832386f023c7.js → 4202.96f5b1beb8b3e3f5.js} +1 -1
- package/.next/static/chunks/{4238.6f102dcbcf2ae339.js → 4238.28efbf9aa0c82d90.js} +1 -1
- package/.next/static/chunks/{4405.7a19458960a1058e.js → 4405.cda46a596a02aef7.js} +1 -1
- package/.next/static/chunks/54a60aa6.5e4421e7afde4de8.js +78 -0
- package/.next/static/chunks/{6121.eb9023b1cbc78ee2.js → 6121.5e650e714b402b6f.js} +1 -1
- package/.next/static/chunks/{6195.1153369f5f8b13a2.js → 6195.1b7f9dc127381bbc.js} +1 -1
- package/.next/static/chunks/6380.d148a8e2c701ad78.js +68 -0
- package/.next/static/chunks/6582.fb2c709abc2c5981.js +1 -0
- package/.next/static/chunks/6be7e44c.00d0163f409986f0.js +1 -0
- package/.next/static/chunks/{7331.2add3c4e125a2dba.js → 7331.4afa66d6353c8e07.js} +1 -1
- package/.next/static/chunks/752.a05a2904b96af4d0.js +1 -0
- package/.next/static/chunks/{8200.a36b9f8c983c6b9e.js → 8200.350d650649b977eb.js} +1 -1
- package/.next/static/chunks/{8885.cf60cac98bf8b70c.js → 8885.2c060cb45c85547b.js} +1 -1
- package/.next/static/chunks/{918.6a9bbe564e4a2d0f.js → 918.593eb466d35cb8ad.js} +1 -1
- package/.next/static/chunks/{9698.4d09a99b9d99f3e5.js → 9698.758755d0387e0e22.js} +2 -2
- package/.next/static/chunks/97.fb73c551e14b3612.js +2 -0
- package/.next/static/chunks/{993e5495.8797001fcfcf2889.js → 993e5495.12cdfbc3af5c79e9.js} +1 -1
- package/.next/static/chunks/{9974.9a0f79beca65e8c4.js → 9974.5ee982e074ad047e.js} +1 -1
- package/.next/static/chunks/app/_global-error/page-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/agent/running/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/app-update/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/auth/all-providers/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/auth/login/[provider]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/auth/providers/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/boards/[id]/reconcile/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/boards/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/boards/purge-orphans/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/boards/reorder/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/boards/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/cwd/browse/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/cwd/validate/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/default-cwd/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/file-index/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/files/[...path]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/git/diff/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/git/status/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/home/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/mcp/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/models/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/models-config/catalog/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/models-config/discover/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/models-config/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/models-config/test/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/project-trust/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/quota/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/search/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/context/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/state/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/todos/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/skills/check/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/skills/install/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/skills/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/skills/search/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/skills/update/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/task-card-questions/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/task-cards/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/task-cards/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/task-scheduler/status/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/board/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/tasks/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/tasks/reorder/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/tasks/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/events/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/terminal/[id]/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/terminal/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/api/worktrees/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/{layout-7761e430ed68b347.js → layout-2bec2662143a3d1b.js} +1 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/app/page-e38c6cf3174fa143.js +89 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-bb8f79f321e26750.js +1 -0
- package/.next/static/chunks/webpack-b4924d2a22ad3650.js +1 -0
- package/.next/static/css/0c7244f7214af81f.css +1 -0
- package/.next/static/css/12456255969ac8de.css +31 -0
- package/.next/trace +8 -49
- package/.next/trace-build +1 -1
- package/.next/types/app/api/boards/[id]/{reconcile-task-edges → reconcile}/route.ts +3 -3
- package/.next/types/routes.d.ts +2 -7
- package/.next/types/validator.ts +3 -48
- package/README.md +6 -9
- package/THIRD_PARTY_NOTICES.md +10 -82
- package/bin/pi-web-sky.js +3 -3
- package/lib/board-reconcile-scheduler.ts +56 -0
- package/lib/board-reconcile.test.mjs +252 -0
- package/lib/board-reconcile.ts +421 -0
- package/lib/board-store.test.mjs +26 -4
- package/lib/board-store.ts +44 -6
- package/lib/board-types.ts +7 -2
- package/lib/i18n/messages/en.ts +1 -1
- package/lib/i18n/messages/zh-CN.ts +1 -1
- package/lib/session-delete.ts +5 -0
- package/lib/sqlite-db.ts +13 -1
- package/lib/task-card-store.test.mjs +16 -1
- package/lib/task-card-store.ts +37 -1
- package/lib/task-scheduler.test.mjs +79 -0
- package/lib/task-scheduler.ts +195 -21
- package/lib/yjs-room-server.mjs +139 -0
- package/package.json +12 -9
- package/server.mjs +7 -7
- package/.next/server/app/api/boards/[id]/canvas/route.js +0 -1
- package/.next/server/app/api/boards/[id]/canvas/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/boards/[id]/edges/[eid]/route.js +0 -1
- package/.next/server/app/api/boards/[id]/edges/[eid]/route.js.nft.json +0 -1
- package/.next/server/app/api/boards/[id]/edges/[eid]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/boards/[id]/edges/route.js +0 -1
- package/.next/server/app/api/boards/[id]/edges/route.js.nft.json +0 -1
- package/.next/server/app/api/boards/[id]/edges/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/boards/[id]/nodes/[nid]/route.js +0 -1
- package/.next/server/app/api/boards/[id]/nodes/[nid]/route.js.nft.json +0 -1
- package/.next/server/app/api/boards/[id]/nodes/[nid]/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/boards/[id]/nodes/route.js +0 -1
- package/.next/server/app/api/boards/[id]/nodes/route.js.nft.json +0 -1
- package/.next/server/app/api/boards/[id]/nodes/route_client-reference-manifest.js +0 -1
- package/.next/server/app/api/boards/[id]/reconcile-task-edges/route.js +0 -1
- package/.next/server/app/api/boards/[id]/reconcile-task-edges/route.js.nft.json +0 -1
- package/.next/server/app/api/boards/[id]/reconcile-task-edges/route_client-reference-manifest.js +0 -1
- package/.next/static/chunks/3308.857c554428b3294e.js +0 -73
- package/.next/static/chunks/333.bf0651c789b2eb33.js +0 -1
- package/.next/static/chunks/5315.dba7515ae6e139ae.js +0 -4
- package/.next/static/chunks/54a60aa6.0e43cde7298ebcb7.js +0 -78
- package/.next/static/chunks/7999.879d5a20e8641752.js +0 -259
- package/.next/static/chunks/app/_global-error/page-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/bash-output/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/agent/running/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/app-update/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/auth/all-providers/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/auth/api-key/[provider]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/auth/login/[provider]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/auth/logout/[provider]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/auth/providers/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/canvas/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/edges/[eid]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/edges/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/nodes/[nid]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/nodes/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/reconcile-task-edges/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/purge-orphans/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/reorder/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/boards/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/cwd/browse/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/cwd/validate/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/default-cwd/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/file-index/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/files/[...path]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/git/diff/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/git/status/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/home/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/mcp/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/models/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/models-config/catalog/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/models-config/discover/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/models-config/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/models-config/test/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/project-trust/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/quota/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/search/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/context/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/state/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/todos/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/skills/check/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/skills/install/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/skills/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/skills/search/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/skills/update/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/task-card-questions/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/task-cards/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/task-cards/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/task-scheduler/status/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/board/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/tasks/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/tasks/reorder/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/tasks/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/events/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/terminal/[id]/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/terminal/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/api/worktrees/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/manifest.webmanifest/route-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/app/page-2c87c41e7f848f45.js +0 -89
- package/.next/static/chunks/e3e7ddb2.a35db430b3564999.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-d6f52627eddf9119.js +0 -1
- package/.next/static/chunks/webpack-4bbf04891e910713.js +0 -1
- package/.next/static/css/80c818c5781fbadc.css +0 -4
- package/.next/static/css/d3a2b5077b52c727.css +0 -1
- package/.next/types/app/api/boards/[id]/canvas/route.ts +0 -353
- package/.next/types/app/api/boards/[id]/edges/[eid]/route.ts +0 -353
- package/.next/types/app/api/boards/[id]/edges/route.ts +0 -353
- package/.next/types/app/api/boards/[id]/nodes/[nid]/route.ts +0 -353
- package/.next/types/app/api/boards/[id]/nodes/route.ts +0 -353
- package/lib/board-search.test.mjs +0 -110
- package/lib/board-search.ts +0 -63
- package/lib/file-explorer-state.test.mjs +0 -63
- package/lib/file-explorer-state.ts +0 -36
- package/lib/sync-room-server.mjs +0 -137
- /package/.next/server/app/api/boards/[id]/{canvas → reconcile}/route.js.nft.json +0 -0
- /package/.next/static/{IzmOG04jJst1VpUvr_fr5 → 8V884w_cp5HEp_rRpjnCR}/_buildManifest.js +0 -0
- /package/.next/static/{IzmOG04jJst1VpUvr_fr5 → 8V884w_cp5HEp_rRpjnCR}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6582],{86582:(e,t,r)=>{r.r(t),r.d(t,{CanvasStage:()=>eu});var n=r(95155),o=r(12115),a=r(81750);r(53255);var i=r(39247),s=r(85610),l=r(47650),d=r(60015);function c({stats:e,contextUsage:t}){if(!e)return null;let r=e.tokens,o=e.cost??0,a=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e),i=o>0?o>=.01?`$${o.toFixed(2)}`:"<$0.01":null,s="var(--text-muted)",l=null;if(t?.contextWindow){let e=t.percent;null!==e&&e>90?s="#ef4444":null!==e&&e>70&&(s="rgba(234,179,8,0.95)"),l=null!==e?`${e.toFixed(0)}% / ${a(t.contextWindow)}`:`? / ${a(t.contextWindow)}`}let d={display:"flex",alignItems:"center",gap:4,flexShrink:0};return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0,fontSize:11,color:"var(--text-muted)",whiteSpace:"nowrap",fontVariantNumeric:"tabular-nums"},children:[r.input>0&&(0,n.jsxs)("span",{style:d,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"5",y1:"8.5",x2:"5",y2:"1.5"}),(0,n.jsx)("polyline",{points:"2 4 5 1.5 8 4"})]}),a(r.input)]}),r.output>0&&(0,n.jsxs)("span",{style:d,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,n.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),a(r.output)]}),r.cacheRead>0&&(0,n.jsxs)("span",{style:d,children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M8.5 5a3.5 3.5 0 1 1-1-2.45"}),(0,n.jsx)("polyline",{points:"6.5 1.5 8.5 2.5 7.5 4.5"})]}),a(r.cacheRead)]}),i&&(0,n.jsx)("span",{style:{display:"flex",alignItems:"center",color:"var(--text)",fontWeight:500,flexShrink:0},children:i}),l&&(0,n.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:s,flexShrink:0},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M1 9 L1 5 Q1 1 5 1 Q9 1 9 5 L9 9"}),(0,n.jsx)("line",{x1:"1",y1:"9",x2:"9",y2:"9"})]}),l]})]})}let u=(0,o.forwardRef)(function({sessionId:e,stats:t,contextUsage:r,todos:a},s){let{t:l}=(0,i.s)(),[d,c]=(0,o.useState)(!1),[u,m]=(0,o.useState)(!1),k=(0,o.useRef)(null),w=(0,o.useRef)(null),j=(0,o.useRef)(null);(0,o.useImperativeHandle)(s,()=>({openStats:()=>{c(!0),m(!1)}}),[]);let S=e=>{c("stats"===e),m("todo"===e)},C=(0,o.useCallback)(()=>{window.open(`/api/sessions/${encodeURIComponent(e)}/export?inline=1`,"_blank","noopener,noreferrer")},[e]),R=r?.contextWindow&&null!==r.percent?`${r.percent.toFixed(0)}% / ${b(r.contextWindow)}`:l("nav.stats"),E=a.filter(e=>"completed"!==e.status).length,W=(0,o.useCallback)(()=>{let e=k.current?.closest("[data-session-titlebar]");return e?.getBoundingClientRect().width??300},[]),L=d||u;return(0,o.useEffect)(()=>{if(!L)return;let e=e=>{let t=e.target;t instanceof Node&&(k.current?.contains(t)||document.querySelector("[data-session-nav-popover]")?.contains(t)||document.querySelector("[data-session-nav-todo]")?.contains(t)||document.querySelector(".glass-top-panel")?.contains(t))||(c(!1),m(!1))},t=e=>{"Escape"===e.key&&(c(!1),m(!1))};return document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",t,!0),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",t,!0)}},[L]),(0,n.jsxs)("div",{ref:k,style:{display:"flex",alignItems:"center",gap:2,padding:"0 4px",position:"relative",pointerEvents:"all",height:"100%"},children:[(0,n.jsxs)("button",{type:"button",onClick:C,title:l("history.full"),"aria-label":l("history.full"),style:p,onMouseEnter:e=>{e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=g},onMouseLeave:e=>{e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent"},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),(0,n.jsx)("path",{d:"M3 3v5h5"}),(0,n.jsx)("path",{d:"M12 7v5l3 2"})]}),(0,n.jsx)("span",{style:x,children:l("history.full")})]}),(0,n.jsx)("span",{style:h}),(0,n.jsxs)("button",{ref:w,type:"button",onClick:()=>S(d?"none":"stats"),title:l("session.title"),"aria-label":l("session.title"),"aria-expanded":d,style:{...p,background:d?f:"transparent",color:d?"var(--accent)":"var(--text-muted)"},onMouseEnter:e=>{d||(e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=g)},onMouseLeave:e=>{d||(e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent")},children:[(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"10"}),(0,n.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"4"}),(0,n.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"16"})]}),(0,n.jsx)("span",{style:x,children:R})]}),a.length>0&&(0,n.jsxs)("button",{ref:j,type:"button",onClick:()=>S(u?"none":"todo"),title:l("todo.title"),"aria-label":l("todo.title"),"aria-expanded":u,style:{...p,background:u?f:"transparent",color:u?"var(--accent)":"var(--text-muted)"},onMouseEnter:e=>{u||(e.currentTarget.style.color="var(--text)",e.currentTarget.style.background=g)},onMouseLeave:e=>{u||(e.currentTarget.style.color="var(--text-muted)",e.currentTarget.style.background="transparent")},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"3",y:"4",width:"18",height:"16",rx:"3"}),(0,n.jsx)("path",{d:"M8 9h8M8 13h5"})]}),(0,n.jsx)("span",{style:x,children:l("nav.todo")}),(0,n.jsx)("span",{style:{fontSize:10,fontWeight:700,color:"var(--text-muted)"},children:E>0?E:"✓"})]}),d&&t&&(0,n.jsx)(v,{navRef:k,navWidth:W(),stats:t,contextUsage:r,onClose:()=>c(!1)}),u&&a.length>0&&(0,n.jsx)(y,{navRef:k,navWidth:W(),todos:a,onClose:()=>m(!1)})]})}),p={flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",gap:4,width:"auto",height:26,padding:"0 6px",border:"none",borderRadius:6,background:"transparent",color:"var(--text-muted)",cursor:"pointer",transition:"color 0.12s, background 0.12s"},x={fontSize:11,fontWeight:600,lineHeight:1,whiteSpace:"nowrap"},h={flexShrink:0,width:1,height:16,alignSelf:"center",background:"color-mix(in srgb, var(--border) 70%, transparent)",margin:"0 3px"},g="color-mix(in srgb, var(--glass-bg-strong) 40%, transparent)",f="color-mix(in srgb, var(--glass-bg-strong) 60%, transparent)";function b(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}k`:String(e)}function v({navRef:e,navWidth:t,stats:r,contextUsage:a,onClose:s}){let{t:d}=(0,i.s)(),[u,p]=(0,o.useState)(null),x=(0,o.useRef)(null);if((0,o.useEffect)(()=>{let r=()=>{let r=e.current;if(!r)return;let n=r.getBoundingClientRect(),o=r.closest("[data-session-titlebar]"),a=o?.getBoundingClientRect(),i=a?a.left:Math.min(n.right-t,Math.max(8,n.left));p({top:a?a.bottom:n.bottom,left:i})};r();let n=new ResizeObserver(r);return e.current&&n.observe(e.current),e.current?.closest("[data-session-titlebar]")&&n.observe(e.current.closest("[data-session-titlebar]")),window.addEventListener("resize",r),()=>{n.disconnect(),window.removeEventListener("resize",r)}},[e,t]),(0,o.useEffect)(()=>{let t=t=>{let r=t.target;x.current?.contains(r)||e.current?.contains(r)||s()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,s]),!u)return null;let h=r.totalActiveMs??0,g=[...r.sessionName?[{label:d("session.name"),value:r.sessionName}]:[],{label:d("session.id"),value:r.sessionId},...h>0?[{label:d("session.totalActive"),value:(e=>{if(e<=0)return"0s";let t=Math.floor(e/1e3),r=Math.floor(t/3600),n=Math.floor(t%3600/60),o=t%60;return r>0?`${r}h ${n}m`:n>0?`${n}m ${o}s`:`${o}s`})(h)}]:[]],f=[[d("session.user"),r.userMessages.toLocaleString()],[d("session.assistant"),r.assistantMessages.toLocaleString()],[d("session.toolCalls"),r.toolCalls.toLocaleString()],[d("session.toolResults"),r.toolResults.toLocaleString()],[d("session.total"),r.totalMessages.toLocaleString()]],y=[[d("session.input"),r.tokens.input.toLocaleString()],[d("session.output"),r.tokens.output.toLocaleString()],...r.tokens.cacheRead>0?[[d("session.cacheRead"),r.tokens.cacheRead.toLocaleString()]]:[],...r.tokens.cacheWrite>0?[[d("session.cacheWrite"),r.tokens.cacheWrite.toLocaleString()]]:[],[d("session.total"),r.tokens.total.toLocaleString()],...r.cost>0?[[d("session.cost"),`$${r.cost.toFixed(4)}`]]:[],...r.contextUsage?.contextWindow?[[d("session.context"),`${null!==r.contextUsage.percent?`${r.contextUsage.percent.toFixed(1)}%`:"?"} / ${b(r.contextUsage.contextWindow)}`]]:[]],m=(e,t,r="left",o=!1)=>(0,n.jsxs)("div",{style:{minWidth:0},children:[(0,n.jsx)("div",{style:{fontSize:11,fontWeight:700,color:"var(--text)",marginBottom:6},children:e}),(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:o?"max-content minmax(0, 1fr)":"auto minmax(0, 1fr)",columnGap:o?14:12,rowGap:4,justifyContent:o?"start":void 0},children:t.map(([t,o])=>(0,n.jsxs)("div",{style:{display:"contents"},children:[(0,n.jsx)("div",{style:{color:"var(--text-meta)",whiteSpace:"nowrap"},children:t}),(0,n.jsx)("div",{style:{color:"var(--text-muted)",minWidth:0,overflowWrap:"anywhere",textAlign:r,whiteSpace:"normal"},children:o})]},`${e}:${t}`))})]}),k=(0,n.jsx)("div",{ref:x,"data-session-nav-popover":!0,role:"dialog","aria-label":d("session.title"),className:"glass-panel",style:{position:"fixed",top:u.top,left:u.left,width:t,maxHeight:"min(560px, calc(100dvh - 44px))",overflowY:"auto",zIndex:1200,padding:"12px 16px",fontSize:12,lineHeight:1.5,fontFamily:"var(--font-mono)",borderRadius:12,border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)"},children:(0,n.jsxs)("div",{style:{display:"grid",gap:16,fontSize:12,lineHeight:1.5,fontFamily:"var(--font-mono)"},children:[(0,n.jsx)(c,{stats:r,contextUsage:a}),(0,n.jsx)("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr)",columnGap:12,rowGap:8,alignItems:"start"},children:g.map(e=>(0,n.jsxs)("div",{style:{display:"contents"},children:[(0,n.jsx)("div",{style:{color:"var(--text-meta)",whiteSpace:"nowrap"},children:e.label}),(0,n.jsx)("div",{style:{color:"var(--text-muted)",minWidth:0,overflowWrap:"anywhere",wordBreak:"break-word",whiteSpace:"normal"},children:e.value})]},e.label))}),(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"minmax(160px, 0.5fr) minmax(240px, 0.7fr)",gap:24},children:[m(d("session.messages"),f),m(d("session.tokens"),y,"right",!0)]})]})});return(0,l.createPortal)(k,document.body)}function y({navRef:e,navWidth:t,todos:r,onClose:a}){let{t:s}=(0,i.s)(),[d,c]=(0,o.useState)(null),u=(0,o.useRef)(null);if((0,o.useEffect)(()=>{let r=()=>{let r=e.current;if(!r)return;let n=r.getBoundingClientRect(),o=r.closest("[data-session-titlebar]"),a=o?.getBoundingClientRect(),i=a?a.left:Math.min(n.right-t,Math.max(8,n.left));c({top:a?a.bottom:n.bottom,left:i})};r();let n=new ResizeObserver(r);return e.current&&n.observe(e.current),e.current?.closest("[data-session-titlebar]")&&n.observe(e.current.closest("[data-session-titlebar]")),window.addEventListener("resize",r),()=>{n.disconnect(),window.removeEventListener("resize",r)}},[e,t]),(0,o.useEffect)(()=>{let t=t=>{let r=t.target;u.current?.contains(r)||e.current?.contains(r)||a()};return document.addEventListener("pointerdown",t,!0),()=>document.removeEventListener("pointerdown",t,!0)},[e,a]),!d)return null;let p=(0,n.jsxs)("div",{ref:u,"data-session-nav-todo":!0,role:"menu","aria-label":s("todo.title"),className:"glass-panel",style:{position:"fixed",top:d.top,left:d.left,width:t,maxHeight:"min(440px, calc(100dvh - 44px))",overflowY:"auto",zIndex:1200,fontFamily:"inherit",borderRadius:12,border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"9px 12px",borderBottom:"1px solid color-mix(in srgb, var(--border) 70%, transparent)",fontSize:12,fontWeight:650,color:"var(--text)"},children:[s("todo.title"),(0,n.jsxs)("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-meta)",fontWeight:500},children:[r.filter(e=>"completed"===e.status).length,"/",r.length," ",s("todo.completed")]})]}),0===r.length?(0,n.jsx)("div",{style:{padding:"12px 14px",fontSize:12,color:"var(--text-muted)",fontStyle:"italic"},children:s("todo.empty")}):(0,n.jsx)("div",{style:{maxHeight:330,overflowY:"auto"},children:r.map(e=>{let t="completed"===e.status,r="high"===e.priority?"#ef4444":"medium"===e.priority?"rgba(234,179,8,0.9)":"var(--text-meta)";return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:"7px 12px",borderBottom:"1px solid color-mix(in srgb, var(--border) 45%, transparent)"},children:[(0,n.jsx)("span",{"aria-hidden":"true",style:{flexShrink:0,marginTop:2,width:13,height:13,borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:800,lineHeight:1,color:t?"#fff":"transparent",background:t?"#16a34a":"color-mix(in srgb, var(--border) 70%, transparent)",border:t?"none":"1px solid color-mix(in srgb, var(--border) 80%, transparent)"},children:"✓"}),(0,n.jsx)("span",{style:{flex:1,minWidth:0,fontSize:12,lineHeight:1.4,color:t?"var(--text-meta)":"var(--text)",textDecoration:t?"line-through":"none",wordBreak:"break-word"},children:e.content}),(0,n.jsx)("span",{"aria-hidden":"true",style:{flexShrink:0,marginTop:5,width:7,height:7,borderRadius:"50%",background:r}})]},e.id??e.content)})})]});return(0,l.createPortal)(p,document.body)}var m=r(32782),k=r(15934);let w=(0,o.memo)(function({sessionId:e,cwd:t,taskId:r,onPromote:a}){let{t:s}=(0,i.s)(),{soundEnabled:c,onSoundToggle:p,playDoneSound:x,unlockAudio:h}=(0,m.G)(),[g,f]=(0,o.useState)(null),[b,v]=(0,o.useState)(null),[y,w]=(0,o.useState)(0),S=(0,o.useRef)(null),C=(0,o.useRef)(null),R=(0,o.useRef)(null),E=!!t,W=(0,o.useRef)(null);W.current=E&&r?{taskId:r}:null;let L=(0,o.useRef)(e),z=(0,o.useRef)(t??null),I=(0,o.useRef)(E),N=(0,o.useRef)(!1),T=(0,o.useRef)(t);(0,o.useEffect)(()=>{let e=T.current;T.current=t,!e||t||I.current&&!N.current&&(I.current=!1,w(e=>e+1))},[t]);let[M,$]=(0,o.useState)(null);(0,o.useEffect)(()=>{let e=S.current?.closest("[data-board-node]"),t=e?.querySelector("[data-session-navbar-slot]")??null;$(e=>e===t?e:t)});let[D,H]=(0,o.useState)(null),[P,F]=(0,o.useState)(null),[B,A]=(0,o.useState)([]),O=(0,o.useCallback)(e=>{H(e)},[]),U=(0,o.useCallback)(()=>{R.current?.openStats()},[]),Y=(0,o.useCallback)(e=>{F(e)},[]),_=(0,o.useCallback)(e=>{A(e)},[]),q=(0,o.useCallback)(e=>{e?.id&&(N.current=!0,a?.(),(0,k.PH)(e.id))},[a]),X=(0,o.useCallback)(t=>{(0,k.PK)(e,t)},[e]),V=(0,o.useCallback)(t=>{(0,k.Wd)(e,t)},[e]),G=(0,o.useCallback)(()=>{(0,k.Ho)(e,g?.name)},[e,g?.name]),K=(0,o.useCallback)(t=>{(0,k.sV)(e,{title:"custom"===t.method?void 0:t.title,method:t.method})},[e]);return((0,o.useEffect)(()=>{let e=S.current;if(!e)return;let t=t=>{if(t.ctrlKey||t.metaKey)return;let r=t.target;r instanceof Node&&e.contains(r)&&function(e,t){let r=e instanceof Element?e:e.parentElement;for(;r&&r instanceof HTMLElement&&r!==t;){let e=r.scrollHeight>r.clientHeight,t=r.scrollWidth>r.clientWidth;if(e||t){let n=getComputedStyle(r),o=n.overflowY,a=n.overflowX;if(e&&("auto"===o||"scroll"===o||"overlay"===o)||t&&("auto"===a||"scroll"===a||"overlay"===a))return!0}r=r.parentElement}return!1}(r,e)&&t.stopPropagation()};return e.addEventListener("wheel",t),()=>{e.removeEventListener("wheel",t)}}),(0,o.useEffect)(()=>{let e=S.current;if(!e)return;let t=e=>{let t=window.getSelection();t&&t.toString().length>0&&e.stopPropagation()};return e.addEventListener("copy",t),()=>e.removeEventListener("copy",t)}),(0,o.useEffect)(()=>{if(E)return;let t=!1;return I.current?(v(null),(async()=>{try{let r=await fetch("/api/sessions",{cache:"no-store"});if(!r.ok)throw Error(`HTTP ${r.status}`);let n=(await r.json()).sessions.find(t=>t.id===e);if(t)return;n&&f(n)}catch(e){console.warn("new session metadata load failed:",e)}})(),()=>{t=!0}):(f(null),v(null),(async()=>{try{let r=await fetch("/api/sessions",{cache:"no-store"});if(!r.ok)throw Error(`HTTP ${r.status}`);let n=(await r.json()).sessions.find(t=>t.id===e);if(t)return;if(!n)return void v(s("boards.sessionMissing"));f(n),w(e=>e+1)}catch(e){t||v(e instanceof Error?e.message:String(e))}})(),()=>{t=!0})},[e,s,E]),b)?(0,n.jsx)("div",{style:j,children:(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#f87171",fontSize:13},children:b})}):g||E||I.current?(0,n.jsxs)("div",{ref:S,className:"board-workbench",style:j,onPointerDown:e=>{0===e.button&&e.stopPropagation()},onPointerUp:e=>{0===e.button&&e.stopPropagation()},onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[M&&g&&(0,l.createPortal)((0,n.jsx)(u,{ref:R,sessionId:g.id,stats:D,contextUsage:P,todos:B}),M),(0,n.jsx)(d.l,{session:E||I.current?null:g,newSessionCwd:E||I.current?z.current??null:null,newSessionDraftKey:E||I.current?L.current:null,pendingNewSessionTaskRef:E||I.current?W:void 0,chatInputRef:C,inWorkbench:!0,onSessionStatsChange:O,onContextUsageChange:Y,onSessionStatsPanelOpen:U,onTodosChange:_,onOpenFile:X,onSessionCreated:E?e=>q(e):void 0,onSessionForked:V,onAgentEnd:G,onAttentionNeeded:K,soundEnabled:c,onSoundToggle:p,playDoneSound:x,unlockAudio:h},y)]}):(0,n.jsx)("div",{style:j,children:(0,n.jsx)("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",fontSize:13},children:s("boards.loadingSession")})})}),j={display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"visible",color:"var(--text)"};var S=r(64536);function C(e,t=[]){let r=(0,a.FC)(),{flowToScreenPosition:n}=(0,a.VH)(),i=(0,a.PI)(),s=(0,o.useRef)(null),l=(0,o.useRef)(""),d=(0,o.useCallback)(()=>{let e=s.current;if(!e||!r)return;let t=i.getState(),o=t.nodeLookup.get(r);if(!o)return;let a=t.transform[2],d=n({x:o.position.x,y:o.position.y}),c=window.innerWidth/a,u=window.innerHeight/a,p=`${d.x.toFixed(1)}|${d.y.toFixed(1)}|${a.toFixed(3)}|${c}|${u}`;p!==l.current&&(l.current=p,e.style.width=`${c}px`,e.style.height=`${u}px`,e.style.transform=`translate(${-d.x/a}px, ${-d.y/a}px)`)},[r,i,n]),c=(0,o.useCallback)(t=>{if(!t)return;let r=t.querySelector("[data-glass-clip]");if(r){s.current=r.querySelector("[data-glass-layer]"),d();return}let n=document.createElement("div");n.dataset.glassClip="1",n.style.cssText="position:absolute;left:0;top:0;width:100%;height:100%;border-radius:inherit;overflow:hidden;pointer-events:none;z-index:-1;";let o=document.createElement("div");o.dataset.glassLayer="1",o.style.cssText=`position:absolute;left:0;top:0;pointer-events:none;will-change:transform;background-image:linear-gradient(${e}, ${e}), var(--glass-bg-image, none);background-repeat:no-repeat,no-repeat;background-size:100% 100%,100% 100%;`,n.appendChild(o),t.prepend(n),s.current=o,d()},[d]);return(0,o.useEffect)(()=>{if(!r)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,d()}))},n=i.subscribe(()=>t());return t(),()=>{n(),e&&cancelAnimationFrame(e)}},t),{setContainer:c}}let R=(0,o.createContext)(null);function E({value:e,children:t}){return(0,n.jsx)(R.Provider,{value:e,children:t})}function W(){let e=(0,o.useContext)(R);return e||{updateNode:()=>{},deleteNode:()=>{},normalizeNodeId:()=>{},deleteEdge:()=>{},addEdge:()=>{},addNode:()=>{},boardId:null}}function L(e,t){return e.id===t.id&&e.type===t.type&&e.data===t.data&&e.selected===t.selected&&e.width===t.width&&e.height===t.height}function z(e){let t=(0,o.memo)(e,L);return t.displayName=`MemoBoardNode(${e.displayName??e.name??"Node"})`,t}var I=r(71309);let N={session:"会话",note:"便笺",task:"任务"};function T({kind:e,color:t}){return(0,n.jsxs)("span",{title:`${N[e]} \xb7 状态由圆点颜色表示`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0,lineHeight:1},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:t,flexShrink:0}}),(0,n.jsx)("span",{style:{fontSize:11,color:"var(--text-muted)",whiteSpace:"nowrap"},children:N[e]})]})}let M={waiting_model:{dot:"var(--accent)",label:"thinking"},running_tools:{dot:"#f59e0b",label:"tools"},running_command:{dot:"#f59e0b",label:"command"},waiting_input:{dot:"var(--text)",label:"waiting"},idle:{dot:"var(--text-dim)",label:"idle"},"just-ended":{dot:"#10b981",label:"done"}},$=z(function({id:e,data:t,selected:r,width:i,height:l}){let{updateNode:d,deleteNode:c}=W(),{highlightId:u}=(0,I.kz)(),p=u===e,x=i??t.w??S.ZI,h=l??t.h??S.eo,g=!!t.expanded,f=(0,o.useRef)(t);f.current=t;let{title:b,projectName:v,messageCount:y,phase:m,runningMs:j,endedAt:R,lastActivityAt:E,stale:L,sessionId:z,lastReply:N,cwd:$,taskId:D}=t,H=!!$,{setContainer:P}=C("var(--board-card-glass)"),F=(0,o.useRef)(null),[B,A]=(0,o.useState)(!1),[O,U]=(0,o.useState)(""),Y=(0,o.useRef)(null),_=async()=>{if(!z)return;let r=O.trim();if(A(!1),r&&r!==b){d(e,{data:{...t,title:r}});try{(await fetch(`/api/sessions/${encodeURIComponent(z)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r})})).ok?(0,k.z6)(z,r):d(e,{data:{...t,title:b}})}catch{d(e,{data:{...t,title:b}})}}},q=r=>{var n,o,a;if(r.stopPropagation(),H)return void c(e);let i=(n=t,o=x,a=h,n.expanded?{data:{...n,expanded:!1,expandedW:o,expandedH:a,w:n.collapsedW||S.ZI,h:n.collapsedH||S.eo},w:n.collapsedW||S.ZI,h:n.collapsedH||S.eo}:{data:{...n,expanded:!0,collapsedW:o,collapsedH:a,w:n.expandedW||840,h:n.expandedH||600},w:n.expandedW||840,h:n.expandedH||600});d(e,{data:i.data}),d(e,{width:i.w,height:i.h,style:{width:i.w,height:i.h}})},X=(0,o.useCallback)((r,n)=>{d(e,{data:{...t,w:n.width,h:n.height}})},[e,t,d]),V=(0,o.useCallback)(()=>{d(e,{data:{...f.current,cwd:"",taskId:""}})},[e,d]),G=M[m]??M.idle;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.PN,{isVisible:r,minWidth:g?600:S.ZI,minHeight:g?500:S.eo,onResize:X,keepAspectRatio:!1}),(0,n.jsx)(a.h7,{type:"target",position:s.yX.Left,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsx)(a.h7,{type:"source",position:s.yX.Right,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsxs)("div",{ref:P,"data-board-node":!0,"data-testid":`session-card-${z}`,onDoubleClick:q,style:{position:"relative",width:"100%",height:"100%",borderRadius:g?18:14,border:p?"2px solid var(--accent)":`1px solid ${L?"color-mix(in srgb, var(--border) 80%, transparent)":"color-mix(in srgb, var(--border) 60%, transparent)"}`,background:"transparent",boxShadow:r?"0 0 0 5px transparent, 0 0 16px 5px color-mix(in srgb, var(--accent) 28%, transparent), 0 2px 12px -6px rgba(0,0,0,0.18)":p?I.u:"0 2px 12px -6px rgba(0,0,0,0.18)",animation:p?"board-search-glow 1.8s ease-out forwards":void 0,opacity:L?.55:1,display:"flex",flexDirection:"column",color:"var(--text)",userSelect:"none",padding:g?8:"8px 10px 6px",cursor:"grab",overflow:g?"visible":"hidden"},children:[(0,n.jsxs)("div",{"data-session-titlebar":!0,style:{flexShrink:0,display:"flex",alignItems:"center",gap:6,padding:"0 10px",height:g?"calc(36px + env(safe-area-inset-top))":void 0,minHeight:g?void 0:20,borderBottom:g?"1px solid color-mix(in srgb, var(--border) 50%, transparent)":"none",cursor:"grab",position:"relative",...g?{}:{marginBottom:2}},children:[(0,n.jsx)(T,{kind:"session",color:G.dot}),B?(0,n.jsx)("input",{ref:Y,value:O,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key&&_(),"Escape"===e.key&&A(!1)},onBlur:()=>void _(),className:"nodrag",style:{flex:1,minWidth:0,fontSize:12.5,fontWeight:600,padding:"2px 6px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)"}}):(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:600,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text)"},children:H?"New session":b||"Untitled"}),L&&(0,n.jsx)("span",{style:{flexShrink:0,fontSize:9.5,color:"var(--text-dim)",border:"1px solid color-mix(in srgb, var(--border) 70%, transparent)",borderRadius:4,padding:"0 4px"},children:"stale"}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("div",{"data-session-navbar-slot":!0,className:"nodrag",style:{display:"flex",alignItems:"center"}}),!H&&!B&&(0,n.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),U(b||""),A(!0),requestAnimationFrame(()=>{Y.current?.focus(),Y.current?.select()})},title:"Rename","aria-label":"Rename",className:"nodrag",style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:20,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer",opacity:.65},children:(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),(0,n.jsx)("button",{type:"button",onClick:q,className:"nodrag",title:H?"Discard":g?"Collapse":"Expand",style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,border:"none",borderRadius:5,background:"transparent",color:"var(--text-dim)",cursor:"pointer"},children:H?(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,n.jsx)("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),(0,n.jsx)("path",{d:"M10 11v6M14 11v6"}),(0,n.jsx)("path",{d:"M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"})]}):g?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M18 15l-6-6-6 6"})}):(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M6 9l6 6 6-6"})})})]}),g?(0,n.jsx)("div",{className:"nodrag",style:{flex:1,minHeight:0,padding:"0 12px 0",pointerEvents:"all",overflow:"visible",cursor:"default",userSelect:"text"},children:(0,n.jsx)(w,{sessionId:z,cwd:$,taskId:D,onPromote:V})}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{ref:F,className:"nowheel nodrag",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",gap:2,overflowY:"auto",overflowX:"hidden",padding:"2px 12px 0",scrollbarWidth:"thin",scrollbarColor:"color-mix(in srgb, var(--border) 70%, transparent) transparent",userSelect:"text",cursor:"default"},children:N?(0,n.jsx)("div",{style:{fontSize:11.5,lineHeight:1.45,color:"var(--text-muted)",wordBreak:"break-word",overflowWrap:"anywhere",whiteSpace:"pre-wrap",maxWidth:"100%",userSelect:"text"},children:N}):(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:10.5,color:"var(--text-dim)"},children:[v&&(0,n.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:1},children:v}),y>0&&(0,n.jsxs)("span",{style:{flexShrink:0,whiteSpace:"nowrap"},children:[y," msgs"]})]})}),(0,n.jsxs)("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:6,fontSize:10,color:"var(--text-dim)",borderTop:"1px solid color-mix(in srgb, var(--border) 50%, transparent)",paddingTop:3},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0},children:"\uD83D\uDD52"}),(0,n.jsx)("span",{children:function(e){if(e<=0)return"";let t=new Date(e),r=new Date;return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):`${t.getMonth()+1}/${t.getDate()} ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}(E)}),(0,n.jsx)("div",{style:{flex:1}}),j>0&&"idle"!==m&&(0,n.jsx)("span",{style:{fontFamily:"var(--font-mono)",whiteSpace:"nowrap",flexShrink:0},children:function(e){let t=Math.max(1,Math.round(e/1e3));if(t<60)return`${t}s`;let r=Math.floor(t/60);if(r<60)return`${r}m${t%60}s`;let n=Math.floor(r/60);return`${n}h${r%60}m`}(j)})]})]})]})]})});var D=r(32316),H=r(13439),P=r(57575),F=r(17366);r(54420);let B={blue:"#3184f8",green:"#10b981",red:"#ef4444",yellow:"#f59e0b",purple:"#8b5cf6"},A={blue:"蓝",green:"绿",red:"红",yellow:"黄",purple:"紫"},O={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer"};function U({initialText:e,onDraftChange:t,onExit:r,onCancel:a,onBlurExit:i,rootRef:s}){let l=(0,o.useRef)(!1),d=(0,H.hGv)({extensions:[P.A,F.oz],content:e||"",contentType:"markdown",editorProps:{attributes:{class:"markdown-body sticky-note-editor",spellcheck:"false"}},onUpdate:({editor:e})=>{l.current||t(e.getMarkdown())},onBlur:({editor:e,event:r})=>{if(l.current)return;t(e.getMarkdown());let n=r.relatedTarget,o=s.current;o&&n instanceof Node&&o.contains(n)||i()}});(0,o.useEffect)(()=>{requestAnimationFrame(()=>{d?.commands.focus("start")})},[d]);let c=(0,o.useCallback)(()=>{l.current=!0,requestAnimationFrame(()=>{a()})},[a]),u=(0,o.useCallback)(e=>{e.stopPropagation(),"Enter"===e.key&&(e.ctrlKey||e.metaKey)?(e.preventDefault(),d&&t(d.getMarkdown()),r()):"Escape"===e.key&&(e.preventDefault(),c())},[d,t,r,c]);return(0,n.jsx)("div",{className:"nodrag nowheel sticky-note-edit-wrap","data-testid":"sticky-note-editor",onKeyDown:u,style:{flex:1,minHeight:0,overflowY:"auto",userSelect:"text",padding:"var(--bubble-pad-y, 8px) var(--bubble-pad-x, 12px)"},children:(0,n.jsx)(H.$Z$,{editor:d})})}let Y=z(function({id:e,data:t,selected:r,width:i,height:l}){let d,c,{updateNode:u,deleteNode:p}=W(),{highlightId:x}=(0,I.kz)(),h=x===e,g=t.text??"",f=t.badge??"blue",{setContainer:b}=C("var(--assistant-card-glass)"),[v,y]=(0,o.useState)(!1),[m,k]=(0,o.useState)(f),w=(0,o.useRef)(null),j=(0,o.useRef)(null),S=(0,o.useRef)(g),[R]=(0,o.useState)(()=>t.createdAt??Date.now()),[E,L]=(0,o.useState)(!1),z=(0,o.useRef)(null);(0,o.useEffect)(()=>{v&&(k(f),S.current=g)},[v,g,f]);let N=(0,o.useCallback)(e=>{S.current=e},[]),M=(0,o.useCallback)(()=>{let r=S.current;(r!==g||m!==f)&&u(e,{data:{...t,text:r,badge:m}})},[m,g,f,u,e,t]),$=(0,o.useCallback)(()=>{M(),y(!1)},[M]),H=(0,o.useCallback)(()=>{k(f),S.current=g,y(!1)},[g,f]),P=(0,o.useCallback)(()=>{M(),y(!1)},[M]),F=(0,o.useCallback)(e=>{e.stopPropagation();let t=w.current?.querySelector(".markdown-body")?.innerText??g;navigator.clipboard.writeText(t).then(()=>{L(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>L(!1),1200)}).catch(()=>{})},[g]);(0,o.useEffect)(()=>()=>{z.current&&clearTimeout(z.current)},[]);let Y={position:"relative",width:"100%",height:"100%",borderRadius:"var(--bubble-radius, 12px)",border:h?"2px solid var(--accent)":"1px solid var(--bubble-border)",background:"transparent",boxShadow:h?I.u:r?"0 2px 10px -6px rgba(0,0,0,0.2), 0 0 0 5px transparent, 0 0 16px 5px color-mix(in srgb, var(--accent) 28%, transparent)":"0 2px 10px -6px rgba(0,0,0,0.2)",animation:h?"board-search-glow 1.8s ease-out forwards":void 0,color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",fontSize:13,lineHeight:1.5,userSelect:"none",cursor:"default",padding:6},_=(0,o.useCallback)(e=>{0===e.button&&e.stopPropagation()},[]),q=(0,o.useCallback)((r,n)=>{u(e,{data:{...t,w:n.width,h:n.height}})},[e,t,u]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.PN,{isVisible:r,minWidth:120,minHeight:60,onResize:q,keepAspectRatio:!1}),(0,n.jsx)(a.h7,{type:"target",position:s.yX.Left,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsx)(a.h7,{type:"source",position:s.yX.Right,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsxs)("div",{ref:e=>{b(e),j.current=e},"data-board-node":!0,"data-testid":`sticky-note-${e}`,style:Y,className:"nowheel",onDoubleClick:e=>{e.stopPropagation(),y(!0)},children:[(0,n.jsxs)("div",{className:v?"nodrag":"",style:{flexShrink:0,height:32,display:"flex",alignItems:"center",gap:6,padding:"0 var(--bubble-pad-x, 12px)",fontSize:10,color:"var(--text-muted)",cursor:v?"default":"grab",boxSizing:"border-box"},children:[(0,n.jsx)(T,{kind:"note",color:B[v?m:f]??B.blue}),v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"nodrag",style:{display:"flex",alignItems:"center",gap:5},children:Object.entries(B).map(([e,t])=>(0,n.jsx)("button",{type:"button",title:`徽记\xb7${A[e]??e}`,className:"nodrag",onClick:t=>{t.stopPropagation(),k(e)},style:{width:14,height:14,padding:0,border:"none",borderRadius:"50%",background:t,cursor:"pointer",boxShadow:m===e?`0 0 0 2px var(--bg-panel), 0 0 0 3.5px ${t}`:`0 0 0 1px color-mix(in srgb, ${t} 45%, transparent)`,opacity:m===e?1:.72}},e))}),(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("button",{type:"button",className:"nodrag",onClick:H,style:O,title:"放弃变更 (Esc)",children:"取消"}),(0,n.jsx)("button",{type:"button",className:"nodrag",onClick:$,style:O,title:"完成 (Ctrl+Enter)",children:"完成"})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{flex:1}}),(0,n.jsx)("span",{style:{fontFamily:"var(--font-mono)",whiteSpace:"nowrap"},children:(d=new Date(R),c=new Date,d.getFullYear()===c.getFullYear()&&d.getMonth()===c.getMonth()&&d.getDate()===c.getDate()?d.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):`${d.getMonth()+1}/${d.getDate()}`)}),(0,n.jsx)("button",{type:"button",title:E?"已复制":"复制内容",onClick:F,className:"nodrag",style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:22,height:20,padding:0,border:"none",borderRadius:5,background:"transparent",color:E?"var(--accent)":"var(--text-dim)",cursor:"pointer"},children:E?(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,n.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),v?(0,n.jsx)(U,{initialText:g,onDraftChange:N,onExit:$,onCancel:H,onBlurExit:P,rootRef:j},`${e}-edit`):(0,n.jsx)("div",{ref:w,className:"nowheel nodrag",style:{flex:1,minHeight:0,overflowY:"auto",padding:"4px var(--bubble-pad-x, 12px) var(--bubble-pad-y, 8px)",textAlign:"left",cursor:"text",userSelect:"text"},onPointerDown:_,onPointerUp:_,onDoubleClick:e=>{e.stopPropagation(),y(!0)},children:g.trim()?(0,n.jsx)("div",{className:"markdown-body",style:{wordBreak:"break-word"},children:(0,n.jsx)(D.oz,{children:g})}):(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,cursor:"text"},children:"双击编辑 markdown"})})]})]})});var _=r(43561);function q(e,t){return(e??[]).filter(e=>e.kind===t).map(e=>e.targetCardId)}var X=r(20985);function V({value:e,options:t,onChange:r,width:a="100%"}){let[i,s]=(0,o.useState)(!1),[l,d]=(0,o.useState)(!1),c=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!i)return;let e=e=>{c.current&&!c.current.contains(e.target)&&s(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[i]);let u=t.find(t=>t.value===e);return(0,n.jsxs)("div",{ref:c,style:{position:"relative",width:a},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:i?"var(--side-active)":l?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u?.label??""}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),i&&(0,n.jsx)(X.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:120,maxHeight:200,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:t.map(t=>(0,n.jsx)("button",{type:"button",onClick:()=>{r(t.value),s(!1)},style:{display:"block",width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:t.value===e?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.background="var(--side-hover)"},onMouseLeave:r=>{r.currentTarget.style.background=t.value===e?"var(--side-active)":"transparent"},children:t.label},t.value))})]})}function G({candidates:e,selected:t,onChange:r,placeholder:a="选择任务卡…",excludeId:i,width:s="100%"}){let[l,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(!1),p=(0,o.useRef)(null),x=e.filter(e=>e.id!==i),h=new Set(t);(0,o.useEffect)(()=>{if(!l)return;let e=e=>{p.current&&!p.current.contains(e.target)&&d(!1)},t=e=>{"Escape"===e.key&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[l]);let g=x.filter(e=>h.has(e.id)),f=g.length>3?g.length-3:0,b=g.slice(0,3);return(0,n.jsxs)("div",{ref:p,style:{position:"relative",width:s},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:4,padding:"0 6px",background:l?"var(--side-active)":c?"var(--side-hover)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",transition:"background 0.12s"},children:[b.length>0?(0,n.jsxs)(n.Fragment,{children:[b.map(e=>(0,n.jsxs)("span",{style:{flexShrink:0,display:"inline-flex",alignItems:"center",gap:3,padding:"1px 5px",borderRadius:999,background:"var(--side-selected)",color:"var(--accent)",fontFamily:"var(--font-mono)",fontSize:10},children:["#",e.number]},e.id)),f>0&&(0,n.jsxs)("span",{style:{flexShrink:0,color:"var(--text-muted)",fontSize:10},children:["+",f]})]}):(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--text-dim)"},children:a}),(0,n.jsx)("span",{style:{flex:1}}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),l&&(0,n.jsx)(X.f,{open:!0,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:160,maxHeight:180,overflowY:"auto",background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",padding:4},children:0===x.length?(0,n.jsx)("div",{style:{padding:"8px",color:"var(--text-dim)",fontSize:11},children:"本看板无其他任务卡"}):x.map(e=>{let o=h.has(e.id);return(0,n.jsxs)("button",{type:"button",onClick:n=>{var o;n.stopPropagation(),o=e.id,r(h.has(o)?t.filter(e=>e!==o):[...t,o])},style:{display:"flex",alignItems:"center",gap:7,width:"100%",boxSizing:"border-box",padding:"5px 8px",border:"none",borderRadius:4,background:o?"var(--side-selected)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{e.currentTarget.style.background=o?"var(--side-selected)":"transparent"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,width:12,height:12,borderRadius:3,border:"1px solid var(--border)",background:o?"var(--accent)":"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"var(--accent-contrast, #fff)"},children:o&&(0,n.jsx)("svg",{width:"8",height:"8",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"1.5 5 3.5 7 8.5 2"})})}),(0,n.jsxs)("span",{style:{fontFamily:"var(--font-mono)",color:"var(--text-muted)",flexShrink:0},children:["#",e.number]}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.name})]},e.id)})})]})}var K=r(29608);function J({cwd:e,value:t,onChange:r}){let[a,i]=(0,o.useState)(null),[s,l]=(0,o.useState)(!1),[d,c]=(0,o.useState)(!1),[u,p]=(0,o.useState)(""),[x,h]=(0,o.useState)(!1),[g,f]=(0,o.useState)(null),b=(0,o.useRef)(null),v=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!e)return void i(null);let t=!1;return(async()=>{try{let r=await fetch(`/api/worktrees?cwd=${encodeURIComponent(e)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();if(t)return;i({forCwd:e,projectRoot:n.projectRoot??e,isGit:n.isGit??!1,currentWorktreePath:n.currentWorktreePath??null,worktrees:(n.worktrees??[]).map(e=>({path:e.path,branch:e.branch??null,isMain:!!e.isMain}))})}catch{t||i(null)}})(),()=>{t=!0}},[e]);let y=a?.worktrees.find(e=>e.path===t)??a?.worktrees.find(t=>t.path===e)??(a?.currentWorktreePath?a.worktrees.find(e=>e.path===a.currentWorktreePath):void 0)??a?.worktrees.find(e=>e.isMain)??null,m=async()=>{let e=u.trim();if(e&&!x&&a){h(!0),f(null);try{let t=await fetch("/api/worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:a.projectRoot,branch:e})}),n=await t.json().catch(()=>({}));if(!t.ok||!n.path){f(n.error??"创建失败"),h(!1);return}p(""),c(!1),l(!1),r(n.path)}catch(e){f(e instanceof Error?e.message:String(e))}h(!1)}};(0,o.useEffect)(()=>{if(!s)return;let e=e=>{b.current&&!b.current.contains(e.target)&&l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[s]);let k=y?y.isMain?`主 checkout(${y.branch??""})`:y.branch??y.path:a?.isGit?"选择工作区…":"非 git 项目";return(0,n.jsxs)("div",{ref:b,style:{position:"relative"},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>{l(e=>!e),f(null)},style:{width:"100%",height:28,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,padding:"0 8px",background:s?"var(--side-active)":"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer",fontSize:11,color:"var(--text)",textAlign:"left",fontFamily:"var(--font-mono)"},title:y?.path??void 0,children:[(0,n.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:y&&!y.isMain?"var(--accent)":"var(--text-dim)"},children:[(0,n.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,n.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,n.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,n.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,n.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k}),(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,color:"var(--text-dim)"},children:(0,n.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})]}),(0,n.jsxs)(X.f,{open:s,style:{position:"absolute",top:"calc(100% + 4px)",left:0,right:0,zIndex:120,minWidth:200,background:"var(--popover-glass)",border:"1px solid var(--border)",borderRadius:6,boxShadow:"0 6px 20px -6px rgba(0,0,0,0.35)",overflow:"hidden"},children:[(0,n.jsx)("div",{style:{maxHeight:"min(40vh, 260px)",overflowY:"auto",padding:4},children:0===(a?.worktrees??[]).length?(0,n.jsx)("div",{style:{padding:"8px 10px",fontSize:11,color:"var(--text-dim)"},children:a?.isGit===!1?"非 git 项目,无法创建工作区":"暂无工作区"}):(a?.worktrees??[]).map(e=>{let o=e.path===(y?.path??t);return(0,n.jsxs)("button",{type:"button",onClick:()=>{r(e.path),l(!1),f(null)},title:e.path,style:{display:"block",width:"100%",boxSizing:"border-box",padding:"6px 8px",border:"none",borderRadius:4,background:o?"var(--side-active)":"transparent",color:"var(--text)",fontSize:11,textAlign:"left",cursor:"pointer",fontFamily:"var(--font-mono)"},onMouseEnter:e=>{o||(e.currentTarget.style.background="var(--side-hover)")},onMouseLeave:e=>{o||(e.currentTarget.style.background="transparent")},children:[(0,n.jsx)("span",{style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.isMain?`主 checkout(${e.branch??""})`:e.branch??e.path}),(0,n.jsx)("span",{style:{display:"block",fontSize:9.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]},e.path)})}),d?(0,n.jsxs)("div",{style:{padding:"6px 8px",borderTop:"1px solid var(--bubble-hairline)"},children:[(0,n.jsx)("input",{ref:v,value:u,onChange:e=>{p(e.target.value),f(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),m()),"Escape"===e.key&&(c(!1),p(""),f(null))},placeholder:"新分支名",style:{width:"100%",fontSize:11,fontFamily:"var(--font-mono)",padding:"5px 8px",border:"1px solid var(--accent)",borderRadius:5,outline:"none",background:"var(--side-input)",color:"var(--text)",boxSizing:"border-box"}}),(0,n.jsxs)("div",{style:{display:"flex",gap:5,marginTop:5},children:[(0,n.jsx)("button",{type:"button",onClick:()=>void m(),disabled:x||!u.trim(),style:{flex:1,padding:"4px 0",background:"var(--accent)",border:"none",borderRadius:5,color:"var(--accent-contrast, #fff)",fontSize:11,fontWeight:600,cursor:x||!u.trim()?"not-allowed":"pointer",opacity:x||!u.trim()?.65:1},children:x?"创建中…":"创建"}),(0,n.jsx)("button",{type:"button",onClick:()=>{c(!1),p(""),f(null)},style:{flex:1,padding:"4px 0",background:"transparent",border:"1px solid var(--border)",borderRadius:5,color:"var(--text-muted)",fontSize:11,cursor:"pointer"},children:"取消"})]})]}):(0,n.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),c(!0),f(null),setTimeout(()=>v.current?.focus(),0)},style:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"7px 10px",background:"none",border:"none",borderTop:"1px solid var(--bubble-hairline)",color:"var(--text-muted)",cursor:"pointer",textAlign:"left",fontSize:11},children:[(0,n.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",style:{flexShrink:0},children:[(0,n.jsx)("line",{x1:"5",y1:"1",x2:"5",y2:"9"}),(0,n.jsx)("line",{x1:"1",y1:"5",x2:"9",y2:"5"})]}),(0,n.jsx)("span",{children:"新建工作区"})]}),g&&(0,n.jsx)("div",{style:{padding:"5px 10px 8px",color:"#dc2626",fontSize:11,lineHeight:1.35,overflowWrap:"anywhere"},children:g})]})]})}var Z=r(56314);let Q={not_started:{color:"#9ca3af",label:"未开始"},running:{color:"#10b981",label:"进行中"},review:{color:"#f59e0b",label:"待审核"},done:{color:"#10b981",label:"完成"},failed:{color:"#ef4444",label:"失败"},abandoned:{color:"#9ca3af",label:"放弃"},waiting_reply:{color:"#3184f8",label:"等回复"}},ee={width:"100%",boxSizing:"border-box",border:"1px solid var(--border)",borderRadius:6,background:"transparent",color:"var(--text)",fontSize:12,padding:"4px 8px",outline:"none"},et={display:"block",fontSize:10,color:"var(--text)",fontWeight:600,margin:"8px 0 3px"},er={border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:5,padding:"2px 10px",fontSize:11,cursor:"pointer",whiteSpace:"nowrap"};function en({title:e,open:t,onToggle:r,children:o}){return(0,n.jsxs)("div",{children:[(0,n.jsxs)("button",{type:"button",onClick:r,style:{display:"flex",alignItems:"center",gap:4,width:"100%",marginTop:10,padding:"5px 0 3px",border:"none",borderTop:"1px solid var(--bubble-hairline)",background:"transparent",color:"var(--text-muted)",fontSize:11,fontWeight:600,cursor:"pointer",textAlign:"left"},children:[(0,n.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transform:t?"rotate(90deg)":"none",transition:"transform 0.12s"},children:(0,n.jsx)("polyline",{points:"3 2 6.5 5 3 8"})}),e]}),t&&(0,n.jsx)("div",{children:o})]})}function eo({due:e,onChange:t}){let r=new Date,o=e?new Date(e):r,[a,i,s]=[o.getFullYear(),o.getMonth()+1,o.getDate()],l=[];for(let e=r.getFullYear()-2;e<=r.getFullYear()+3;e++)l.push(String(e));let d=Array.from({length:12},(e,t)=>String(t+1)),c=new Date(a,i,0).getDate(),u=Array.from({length:c},(e,t)=>String(t+1)),p=(e,r,n)=>{let o=new Date(e,r-1,n,0,0,0,0).getTime();t(Number.isNaN(o)?null:o)};return(0,n.jsxs)("div",{style:{display:"flex",gap:4},children:[(0,n.jsx)("div",{style:{flex:1.4,minWidth:0},children:(0,n.jsx)(V,{value:String(a),options:l.map(e=>({value:e,label:e})),onChange:e=>p(Number(e),i,Math.min(s,c))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(V,{value:String(i),options:d.map(e=>({value:e,label:`${e}月`})),onChange:e=>p(a,Number(e),Math.min(s,new Date(a,Number(e),0).getDate()))})}),(0,n.jsx)("div",{style:{flex:1,minWidth:0},children:(0,n.jsx)(V,{value:String(s),options:u.map(e=>({value:e,label:e})),onChange:e=>p(a,i,Number(e))})})]})}function ea({value:e,onChange:t,placeholder:r}){let a=(0,H.hGv)({extensions:[P.A,F.oz,_.O.configure({placeholder:r})],content:e||"",contentType:"markdown",editorProps:{attributes:{class:"markdown-body task-card-md-field",spellcheck:"false"}},onUpdate:({editor:e})=>{t(e.getMarkdown())}});return(0,o.useEffect)(()=>{a&&a.getMarkdown()!==e&&a.commands.setContent(e||"",{contentType:"markdown"})},[a,e]),(0,n.jsx)("div",{className:"nodrag nowheel task-card-md-wrap",style:{...ee,flex:1,minHeight:70,overflowY:"auto",cursor:"text",padding:0,userSelect:"text"},children:(0,n.jsx)(H.$Z$,{editor:a})})}let ei=z(function({id:e,data:t,selected:r,width:i,height:l}){let{updateNode:d,deleteNode:c,normalizeNodeId:u}=W(),p=i??t.w??380,x=l??t.h??270,h=!!t.expanded,{cardId:g}=t,f=(0,Z.Lv)(),b=(0,Z.ZY)(),{detail:v,candidates:y,loading:m,error:w,reload:j,createCard:R,saveCard:E}=function(e,t){let[r,n]=(0,o.useState)(null),[a,i]=(0,o.useState)([]),[s,l]=(0,o.useState)(!1),[d,c]=(0,o.useState)(null),u=(0,o.useRef)(null);u.current=r;let p=(0,o.useCallback)(async(t=!1)=>{if(!e)return void n(null);t||l(!0);try{let t=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok){if(404===t.status)return void n(null);throw Error(`HTTP ${t.status}`)}let r=await t.json();n(r)}catch(e){t||c(e instanceof Error?e.message:String(e))}finally{t||l(!1)}},[e]),x=(0,o.useCallback)(()=>p(!1),[p]);(0,o.useEffect)(()=>{x()},[x]),(0,o.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{try{let r=await fetch(`/api/task-cards?boardId=${encodeURIComponent(t)}`,{cache:"no-store"});if(!r.ok)return;let n=await r.json();e||i(n.cards)}catch{}})(),()=>{e=!0}},[t]);let h=(0,o.useCallback)(async e=>{try{let t=await fetch("/api/task-cards",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`HTTP ${t.status}`)}let r=await t.json();return"number"==typeof r.updated&&(0,k.D2)(e.boardId,r.updated),r.card}catch(e){return c(e instanceof Error?e.message:String(e)),null}},[]),g=(0,o.useCallback)(async t=>{if(!e)return!1;try{let r=await fetch(`/api/task-cards/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error??`HTTP ${r.status}`)}let n=await r.json();return"number"==typeof n.updated&&u.current?.card.boardId&&(0,k.D2)(u.current.card.boardId,n.updated),await x(),!0}catch(e){return c(e instanceof Error?e.message:String(e)),!1}},[e,x]);return{detail:r,candidates:a,loading:s,error:d,reload:x,createCard:h,saveCard:g}}(g||null,f),{setContainer:L}=C("var(--assistant-card-glass)"),z=!g;v?.card.sessionId;let{register:I,unregister:N}=(0,S.VX)();(0,o.useEffect)(()=>{if(g)return I(g),()=>N(g)},[g,I,N]);let M=(0,S.rD)(g),$=M?.execStatus??"not_started";(0,o.useEffect)(()=>{h&&!z&&j()},[h,z,j]);let[D,H]=(0,o.useState)(()=>z?{id:"",boardId:"",projectKey:"",number:0,name:"新建任务"===t.name?"":t.name,description:t.description??"",readyStatus:"draft",execStatus:"not_started",priority:0,due:null,attachments:[],cwd:b,useWorktree:!1,maxRetries:3,retryCount:0,sessionId:null,dispatchToken:null,owner:null,heartbeat:0,created:0,updated:0}:null);(0,o.useEffect)(()=>{!z&&v?.card&&!D&&H({...v.card})},[z,v,D]);let[P,F]=(0,o.useState)([]),[B,A]=(0,o.useState)([]),O=(0,o.useRef)(!1);(0,o.useEffect)(()=>{v&&!O.current&&(O.current=!0,F(q(v.links,"prerequisite")),A(q(v.links,"related")))},[v]);let[U,Y]=(0,o.useState)(!1),_=(0,o.useRef)(!1),[X,ei]=(0,o.useState)(null),[es,el]=(0,o.useState)(null),[ed,ec]=(0,o.useState)(!1);(0,o.useEffect)(()=>{ec(h)},[h]);let[eu,ep]=(0,o.useState)(!1),[ex,eh]=(0,o.useState)(null),eg=(0,o.useRef)(null),ef=(r,n)=>{H(o=>{let a=o?{...o,[r]:n}:o;return a&&("name"===r||"description"===r)&&d(e,{data:{...t,name:"name"===r?n:a.name,description:"description"===r?n:a.description??""}}),a})},eb=async()=>{if(!f)return void ei("缺少看板上下文,无法创建");if(!D?.name.trim())return void el("请填写任务名称");if(_.current)return;Y(!0),_.current=!0,ei(null);let r=await R({boardId:f,name:D.name,description:D.description,readyStatus:"todo",priority:D.priority,due:D.due??null,cwd:D.cwd??void 0,useWorktree:D.useWorktree,maxRetries:D.maxRetries,attachments:D.attachments,prerequisites:P,related:B});if(_.current=!1,Y(!1),r){let n=`task-${r.id}`;u(e,n),d(n,{data:{...t,cardId:r.id,number:r.number,name:r.name,readyStatus:r.readyStatus,priority:r.priority,due:r.due??void 0}}),H(e=>e?{...e,...r,sessionId:r.sessionId}:e),j()}},ev=async()=>{if(!D?.name.trim())return void el("请填写任务名称");if(_.current)return;Y(!0),_.current=!0,ei(null);let r=await E({name:D.name,description:D.description,readyStatus:D.readyStatus,priority:D.priority,due:D.due??null,attachments:D.attachments,cwd:D.cwd??null,useWorktree:D.useWorktree,maxRetries:D.maxRetries,prerequisites:P,related:B});_.current=!1,Y(!1),r?d(e,{data:{...t,name:D.name,description:D.description??"",readyStatus:D.readyStatus,priority:D.priority,due:D.due??void 0}}):ei(w??"保存失败")},ey=(0,o.useMemo)(()=>{if(z||!v?.card||!D)return!1;let e=v.card;return D.name!==e.name||D.description!==e.description||D.priority!==e.priority||D.due!==e.due||D.cwd!==e.cwd||D.useWorktree!==e.useWorktree||D.maxRetries!==e.maxRetries||JSON.stringify(D.attachments??[])!==JSON.stringify(e.attachments??[])||JSON.stringify([...P].sort())!==JSON.stringify(q(v.links,"prerequisite").sort())||JSON.stringify([...B].sort())!==JSON.stringify(q(v.links,"related").sort())},[z,v,D,P,B]),em=(0,o.useRef)(r),ek=(0,o.useRef)(ey);ek.current=ey,(0,o.useEffect)(()=>{let e=em.current;em.current=r,e&&!r&&!z&&ek.current&&ev()},[r,z]);let ew=(0,o.useCallback)(r=>{if(r.stopPropagation(),h){let r=t.collapsedW>=380&&t.collapsedH>=240,n=r?t.collapsedW:380,o=r?t.collapsedH:270;d(e,{data:{...t,expanded:!1,expandedW:p,expandedH:x,w:n,h:o},width:n,height:o,style:{width:n,height:o}})}else{let r=t.expandedW>=480&&t.expandedH>=400,n=r?t.expandedW:760,o=r?t.expandedH:620;d(e,{data:{...t,expanded:!0,collapsedW:p,collapsedH:x,w:n,h:o},width:n,height:o,style:{width:n,height:o}})}},[e,t,h,p,x,d]),ej=(0,o.useCallback)((r,n)=>{d(e,{data:{...t,w:n.width,h:n.height}})},[e,t,d]),eS=D?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("label",{style:et,children:"任务名称 *"}),(0,n.jsx)("input",{style:{...ee,...es?{borderColor:"#f87171",boxShadow:"0 0 0 1px #f87171"}:{}},value:D.name,onChange:e=>{ef("name",e.target.value),es&&el(null)},placeholder:"任务名称"}),es&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:3},children:es}),(0,n.jsx)("label",{style:et,children:"需求说明"}),(0,n.jsx)(ea,{value:D.description,onChange:e=>ef("description",e),placeholder:"任务描述"}),(0,n.jsxs)(en,{title:"高级",open:ed,onToggle:()=>ec(e=>!e),children:[(0,n.jsx)("label",{style:et,children:"工作目录"}),(0,n.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,n.jsx)("input",{style:{...ee,flex:1},value:D.cwd??"",onChange:e=>ef("cwd",e.target.value||null),placeholder:"默认项目根目录",readOnly:!0}),(0,n.jsx)("button",{type:"button",style:er,onClick:()=>ep(!0),children:"选择目录"})]}),eu&&D&&(0,n.jsx)(K.K,{onCancel:()=>ep(!1),onSelect:e=>{ef("cwd",e),ep(!1)}}),(0,n.jsx)("label",{style:et,children:"工作区"}),(0,n.jsx)(J,{cwd:D.cwd,value:ex,onChange:e=>{eh(e),ef("cwd",e)}}),(0,n.jsx)("label",{style:et,children:"预计截止"}),(0,n.jsx)(eo,{due:D.due??null,onChange:e=>ef("due",e)}),(0,n.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:et,children:"优先级"}),(0,n.jsx)(V,{value:String(D.priority),onChange:e=>ef("priority",Number(e)),options:[{value:"1",label:"高"},{value:"0",label:"中"},{value:"-1",label:"低"}]})]}),(0,n.jsxs)("div",{style:{flex:1},children:[(0,n.jsx)("label",{style:et,children:"最大重试次数"}),(0,n.jsx)("input",{style:ee,type:"number",min:0,value:D.maxRetries,onChange:e=>ef("maxRetries",Math.max(0,Number(e.target.value)||0))})]})]}),(0,n.jsx)("label",{style:et,children:"前置任务(可多选)"}),(0,n.jsx)(G,{candidates:y,selected:P,onChange:F,excludeId:g,placeholder:"本看板内选择前置任务…"}),(0,n.jsx)("label",{style:et,children:"关联任务(可多选)"}),(0,n.jsx)(G,{candidates:y,selected:B,onChange:A,excludeId:g,placeholder:"本看板内选择关联任务…"}),(0,n.jsx)("label",{style:et,children:"附件(引用文件路径,每行一个)"}),(0,n.jsx)("textarea",{style:{...ee,minHeight:46,resize:"vertical",fontFamily:"var(--font-mono)",fontSize:11},value:(D.attachments??[]).join("\n"),onChange:e=>ef("attachments",e.target.value.split("\n").map(e=>e.trim()).filter(Boolean)),placeholder:"/path/to/file",spellCheck:!1})]}),(X||w)&&(0,n.jsx)("div",{style:{color:"#f87171",fontSize:11,marginTop:6},children:X??w})]}):m?(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"加载中…"}):(0,n.jsx)("div",{style:{color:"var(--text-dim)",fontSize:12,padding:20,textAlign:"center"},children:"未找到任务卡"});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.PN,{isVisible:r,minWidth:h?480:380,minHeight:h?400:240,onResize:ej,keepAspectRatio:!1}),(0,n.jsx)(a.h7,{type:"target",position:s.yX.Left,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsx)(a.h7,{type:"source",position:s.yX.Right,className:"board-handle",style:{background:"var(--text-dim)",width:8,height:8,border:"1px solid var(--bg-panel)",opacity:.85}}),(0,n.jsxs)("div",{ref:e=>{eg.current=e,L(e)},"data-board-node":!0,"data-testid":`task-card-${e}`,onDoubleClick:ew,style:{position:"relative",width:"100%",height:"100%",borderRadius:"var(--bubble-radius, 12px)",border:"1px solid var(--bubble-border)",background:"transparent",boxShadow:r?"0 2px 10px -6px rgba(0,0,0,0.2), 0 0 0 5px transparent, 0 0 16px 5px color-mix(in srgb, var(--accent) 28%, transparent)":"0 2px 10px -6px rgba(0,0,0,0.2)",color:"var(--text)",display:"flex",flexDirection:"column",overflow:"hidden",userSelect:"none",cursor:"grab",padding:6},children:[(0,n.jsxs)("div",{style:{flexShrink:0,height:36,display:"flex",alignItems:"center",gap:6,padding:"0 10px",borderBottom:"1px solid var(--bubble-hairline)",cursor:"grab",fontSize:11,color:"var(--text-muted)"},children:[(0,n.jsx)("span",{title:`执行状态:${(Q[$]??Q.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,flexShrink:0},children:(0,n.jsx)(T,{kind:"task",color:(Q[$]??Q.not_started).color})}),(0,n.jsx)("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontSize:12.5,fontWeight:600,color:"var(--text)"},children:D?.name||(z?"新建任务卡":"任务卡")}),D?.number?(0,n.jsxs)("span",{style:{flexShrink:0,fontSize:12.5,fontWeight:600,color:"var(--text)",marginLeft:4},children:["#",D.number]}):null,(0,n.jsxs)("div",{className:"nodrag",style:{display:"flex",alignItems:"center",gap:6,flexShrink:0},onPointerDown:e=>e.stopPropagation(),children:[z?(0,n.jsx)("button",{type:"button",style:er,disabled:U||!f,onClick:()=>void eb(),title:"创建任务并派发(转待办,调度器可执行)",children:U?"创建中…":"派发"}):D?.readyStatus==="draft"?(0,n.jsx)("button",{type:"button",style:er,disabled:U,onClick:()=>{ef("readyStatus","todo"),!z&&g&&E({readyStatus:"todo"})},title:"派发(转待办,调度器可执行)",children:U?"派发中…":"派发"}):D?.readyStatus==="todo"?(0,n.jsxs)("span",{title:`执行状态:${(Q[$]??Q.not_started).label}`,style:{display:"flex",alignItems:"center",gap:4,fontSize:11,fontWeight:600,color:(Q[$]??Q.not_started).color,whiteSpace:"nowrap"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",background:(Q[$]??Q.not_started).color,..."running"===$?{animation:"pulse-dot 1.6s ease-in-out infinite"}:{}}}),(Q[$]??Q.not_started).label]}):null,z?null:ey?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",style:er,onClick:()=>{v&&(H({...v.card}),F(q(v.links,"prerequisite")),A(q(v.links,"related")),eh(null),ei(null),el(null))},title:"撤销本次编辑",children:"取消"}),(0,n.jsx)("button",{type:"button",style:er,disabled:U,onClick:()=>void ev(),title:"完成(保存)",children:U?"保存中…":"完成"})]}):null]})]}),(0,n.jsx)("div",{style:{flex:1,minHeight:0,display:"flex"},children:(0,n.jsx)("div",{className:"[scrollbar-width:none] nodrag nowheel",style:{flex:"1 1 auto",minWidth:0,overflowY:"auto",padding:"10px 12px",display:"flex",flexDirection:"column",cursor:"default",userSelect:"text"},children:eS})})]})]})});function es({menu:e,onClose:t}){let{t:r}=(0,i.s)(),a=W(),{node:s,edgeId:l,x:d,y:c,edgeDerived:u}=e,p=!!(l&&u),x=(0,o.useCallback)(()=>{s&&a.deleteNode(s.id),t()},[s,a,t]),h=(0,o.useCallback)(()=>{l&&!p&&a.deleteEdge(l),t()},[l,p,a,t]),g=(0,o.useCallback)(()=>{a.addNode({id:crypto.randomUUID(),type:"sticky-note",position:{x:d,y:c},style:{width:338,height:230},data:{text:"",badge:"blue"}}),t()},[a,d,c,t]),f=(0,o.useCallback)(()=>{a.addNode({id:crypto.randomUUID(),type:"task-card",position:{x:d,y:c},style:{width:380,height:270},data:{cardId:"",number:0,name:"新建任务",description:"",readyStatus:"draft",priority:0,expanded:!1,w:380,h:270,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}}),t()},[a,d,c,t]),b=s?.type??null;return(0,n.jsxs)("div",{className:"glass-popover",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:{position:"fixed",left:d,top:c,zIndex:1200,minWidth:168,padding:4,borderRadius:10,border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 8px 30px -8px rgba(0,0,0,0.4)",color:"var(--text)",fontSize:12.5,userSelect:"none"},children:[l&&(p?(0,n.jsx)(el,{disabled:!0,label:"派生连线(自动生成,不可删除)"}):(0,n.jsx)(el,{danger:!0,label:"删除连线",onClick:h})),s&&(0,n.jsx)(el,{label:"session-card"===b?"移除会话卡片":"task-card"===b?"删除任务卡":"删除便笺",danger:!0,onClick:x}),!s&&!l&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(el,{label:"新建便笺",onClick:g}),(0,n.jsx)(el,{label:"新建任务卡",onClick:f})]})]})}function el({label:e,onClick:t,danger:r,disabled:o}){return(0,n.jsx)("button",{type:"button",disabled:o,onClick:t,style:{display:"flex",alignItems:"center",width:"100%",padding:"6px 10px",border:"none",borderRadius:7,background:"transparent",color:r?"#ef4444":o?"var(--text-dim)":"var(--text)",fontSize:12.5,textAlign:"left",cursor:o?"default":"pointer"},onMouseEnter:e=>{o||(e.currentTarget.style.background="color-mix(in srgb, var(--accent) 14%, transparent)")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:e})}var ed=r(84876);let ec={"session-card":$,"task-card":ei,"sticky-note":Y,text:Y};function eu({board:e,isDark:t}){let{t:r}=(0,i.s)(),{screenToFlowPosition:s}=(0,a.VH)(),[l,d]=(0,o.useState)(!1),[c,u]=(0,o.useState)(null),p=(0,o.useMemo)(()=>({boardId:e.board?.id??null,updateNode:(t,r)=>{e.updateNode?.(t,r)},deleteNode:t=>{let r=e.nodes.find(e=>e.id===t);r&&e.deleteNodeWithConfirm?.(r)},normalizeNodeId:(t,r)=>{e.normalizeNodeId?.(t,r)},deleteEdge:t=>{e.onEdgesChange?.([{type:"remove",id:t}])},addEdge:t=>e.addEdge?.(t),addNode:t=>e.addNode?.(t)}),[e]),x=(0,o.useCallback)((e,t)=>{"sticky-note"===e?p.addNode({id:crypto.randomUUID(),type:e,position:{x:t.x,y:t.y},style:{width:380,height:280},data:{text:"",badge:"blue"}}):p.addNode({id:crypto.randomUUID(),type:e,position:{x:t.x,y:t.y},style:{width:380,height:270},data:{cardId:"",number:0,name:"新建任务",description:"",readyStatus:"draft",priority:0,expanded:!1,w:380,h:270,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}})},[p]),h=(0,o.useCallback)(e=>{let t=document.querySelector(".react-flow__pane"),r=t?.getBoundingClientRect();x(e,s({x:r?r.left+r.width/2:window.innerWidth/2,y:r?r.top+r.height/2:window.innerHeight/2}))},[x,s]),g=(0,o.useCallback)((e,t)=>{e.dataTransfer.setData("text/board-tool",t),e.dataTransfer.effectAllowed="copy"},[]),f=(0,o.useRef)(null);(0,o.useEffect)(()=>{let t=f.current;if(!t)return;let r=e=>{let t=e.dataTransfer?.types??[];(t.includes("text/session-id")||t.includes("text/board-tool"))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=t.includes("text/board-tool")?"copy":"move"),d(!0))},n=e=>{let r=e.relatedTarget;r&&t.contains(r)||d(!1)},o=()=>d(!1),a=t=>{let r=t.dataTransfer?.types??[];if(!r.includes("text/session-id")&&!r.includes("text/board-tool"))return;t.preventDefault(),t.stopPropagation(),d(!1);let n=t.dataTransfer;if(!n)return;let o=s({x:t.clientX,y:t.clientY}),a=n.getData("text/session-id");if(a)return void e.addSessionNode(a,o.x,o.y);let i=n.getData("text/board-tool");"sticky-note"===i?x("sticky-note",o):"task-card"===i&&x("task-card",o)};return t.addEventListener("dragover",r,!0),t.addEventListener("dragleave",n,!0),t.addEventListener("dragend",o,!0),t.addEventListener("drop",a,!0),()=>{t.removeEventListener("dragover",r,!0),t.removeEventListener("dragleave",n,!0),t.removeEventListener("dragend",o,!0),t.removeEventListener("drop",a,!0)}},[e,s,x]);let b=(0,o.useCallback)(async({nodes:t})=>{if(!t||0===t.length)return!0;let r=t[0],n=e.nodes.find(e=>e.id===r.id);return n&&e.deleteNodeWithConfirm?.(n),!1},[e]),v=(0,o.useRef)(null),y=(0,o.useCallback)(e=>{u(null);let t=Date.now(),r=v.current;if(r&&t-r.t<320){v.current=null,x("sticky-note",s({x:e.clientX,y:e.clientY}));return}v.current={t:t}},[s,x]),m=(0,o.useCallback)((e,t)=>{e.preventDefault(),u({x:e.clientX,y:e.clientY,node:t,edgeId:null})},[]),k=(0,o.useCallback)(e=>{e.preventDefault(),u({x:e.clientX,y:e.clientY,node:null,edgeId:null})},[]),w=(0,o.useCallback)((t,r)=>{t.preventDefault();let n=e.edges.find(e=>e.id===r.id),o=n?.data;u({x:t.clientX,y:t.clientY,node:null,edgeId:n?.id??null,edgeDerived:!!(o?.execLink||o?.taskLink)})},[e.edges]),j=(0,o.useCallback)(e=>{h(e)},[h]);return(0,n.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",position:"relative"},children:(0,n.jsxs)("div",{ref:f,style:{flex:1,minHeight:0,position:"relative"},children:[(0,n.jsx)("div",{style:{position:"absolute",inset:0,zIndex:0,pointerEvents:"none",background:"var(--board-scrim-bg)",backdropFilter:"var(--board-scrim-filter, none)",WebkitBackdropFilter:"var(--board-scrim-filter, none)"}}),l&&(0,n.jsx)("div",{style:{position:"absolute",inset:0,zIndex:30,display:"flex",alignItems:"center",justifyContent:"center",background:"color-mix(in srgb, var(--accent) 10%, transparent)",border:"2px dashed var(--accent)",borderRadius:10,pointerEvents:"none",color:"var(--accent)",fontSize:13,fontWeight:600},children:r("boards.dropToAdd")}),e.error?(0,n.jsx)("div",{style:{position:"absolute",inset:0,zIndex:30,display:"flex",alignItems:"center",justifyContent:"center",color:"#f87171",fontSize:13},children:e.error}):e.loading?(0,n.jsx)(ed.N,{label:r("boards.loadingCanvas")}):(0,n.jsxs)(E,{value:p,children:[(0,n.jsxs)(a.Gc,{nodes:e.nodes,edges:e.edges,onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect,nodeTypes:ec,onBeforeDelete:b,onNodeContextMenu:m,onPaneContextMenu:k,onEdgeContextMenu:w,onPaneClick:y,zoomOnDoubleClick:!1,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,colorMode:t?"dark":"light",deleteKeyCode:["Backspace","Delete"],proOptions:{hideAttribution:!1},defaultEdgeOptions:{markerEnd:{type:"arrowclosed"},style:{strokeWidth:1.5,stroke:"#8b8fa3"}},children:[(0,n.jsx)(a.VS,{variant:a._5.Dots,gap:24,size:1.2,color:"color-mix(in srgb, var(--border) 45%, transparent)"}),(0,n.jsx)(a.H2,{position:"bottom-left",showInteractive:!1}),(0,n.jsx)(a.of,{pannable:!0,zoomable:!0,style:{background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",borderRadius:12,boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",overflow:"hidden"},maskColor:"color-mix(in srgb, var(--board-card-glass) 78%, transparent)",nodeColor:()=>"color-mix(in srgb, var(--accent) 50%, transparent)",nodeStrokeColor:()=>"var(--accent)"})]}),c&&(0,n.jsx)(es,{menu:c,onClose:()=>u(null)}),(0,n.jsxs)("div",{style:{position:"absolute",left:"50%",transform:"translateX(-50%)",bottom:16,zIndex:30,display:"flex",gap:4,padding:4,borderRadius:10,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsx)(ep,{label:"便笺",onClick:()=>j("sticky-note"),onDragStart:e=>g(e,"sticky-note")}),(0,n.jsx)(ep,{label:"任务",onClick:()=>j("task-card"),onDragStart:e=>g(e,"task-card")})]})]})]})})}function ep({label:e,onClick:t,onDragStart:r}){return(0,n.jsx)("button",{type:"button",draggable:!0,title:e,"aria-label":e,onClick:t,onDragStart:r,style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"6px 14px",border:"none",borderRadius:7,background:"transparent",color:"var(--text-muted)",fontSize:12.5,cursor:"grab",userSelect:"none",transition:"background 0.12s, color 0.12s"},onMouseEnter:e=>{e.currentTarget.style.background="color-mix(in srgb, var(--accent) 12%, transparent)",e.currentTarget.style.color="var(--accent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent",e.currentTarget.style.color="var(--text-muted)"},children:e})}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1375],{44706:(t,e,r)=>{r.d(e,{FX:()=>P,JA:()=>O,PR:()=>$,QE:()=>K,vm:()=>tD});var n=r(80702),i=r(6648),l=r(62261),s=r(87443),o=r(14214),c=r(9182),h=r(30200),d=r(23180),a=r(70489),u=r(1651),g=r(79274),f=r(33867),p=r(19441),w=r(33496),_=r(63758),k=(r(76290),r(6773)),m=r(90756),b=r(48273);n.W;class y{constructor(t,e){this.clock=t,this.len=e}}class D{constructor(){this.clients=new Map}}let S=(t,e,r)=>e.clients.forEach((e,n)=>{let i=t.doc.store.clients.get(n);if(null!=i){let n=i[i.length-1],l=n.id.clock+n.length;for(let n=0,s=e[n];n<e.length&&s.clock<l;s=e[++n])tg(t,i,s.clock,s.len,r)}}),C=(t,e)=>{let r=t.clients.get(e.client);return void 0!==r&&null!==((t,e)=>{let r=0,n=t.length-1;for(;r<=n;){let i=l.RI((r+n)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;r=i+1}else n=i-1}return null})(r,e.clock)},E=t=>{t.clients.forEach(t=>{let e,r;for(t.sort((t,e)=>t.clock-e.clock),e=1,r=1;e<t.length;e++){let n=t[r-1],i=t[e];n.clock+n.len>=i.clock?t[r-1]=new y(n.clock,l.T9(n.len,i.clock+i.len-n.clock)):(r<e&&(t[r]=i),r++)}t.length=r})},v=(t,e,r,n)=>{s._4(t.clients,e,()=>[]).push(new y(r,n))},A=()=>new D,x=(t,e)=>{o.zd(t.restEncoder,e.clients.size),i.HT(e.clients.entries()).sort((t,e)=>e[0]-t[0]).forEach(([e,r])=>{t.resetDsCurVal(),o.zd(t.restEncoder,e);let n=r.length;o.zd(t.restEncoder,n);for(let e=0;e<n;e++){let n=r[e];t.writeDsClock(n.clock),t.writeDsLen(n.len)}})},I=t=>{let e=new D,r=c.cw(t.restDecoder);for(let n=0;n<r;n++){t.resetDsCurVal();let r=c.cw(t.restDecoder),n=c.cw(t.restDecoder);if(n>0){let i=s._4(e.clients,r,()=>[]);for(let e=0;e<n;e++)i.push(new y(t.readDsClock(),t.readDsLen()))}}return e},M=(t,e,r)=>{let n=new D,i=c.cw(t.restDecoder);for(let l=0;l<i;l++){t.resetDsCurVal();let i=c.cw(t.restDecoder),l=c.cw(t.restDecoder),s=r.clients.get(i)||[],o=ts(r,i);for(let r=0;r<l;r++){let r=t.readDsClock(),l=r+t.readDsLen();if(r<o){o<l&&v(n,i,o,l-o);let t=tc(s,r),c=s[t];for(!c.deleted&&c.id.clock<r&&(s.splice(t+1,0,eV(e,c,r-c.id.clock)),t++);t<s.length;)if((c=s[t++]).id.clock<l)c.deleted||(l<c.id.clock+c.length&&s.splice(t,0,eV(e,c,l-c.id.clock)),c.delete(e));else break}else v(n,i,r,l-r)}}if(n.clients.size>0){let t=new W;return o.zd(t.restEncoder,0),x(t,n),t.toUint8Array()}return null},L=h.S8;class O extends n.W{constructor({guid:t=h.gZ(),collectionid:e=null,gc:r=!0,gcFilter:n=()=>!0,meta:i=null,autoLoad:l=!1,shouldLoad:s=!0}={}){super(),this.gc=r,this.gcFilter=n,this.clientID=L(),this.guid=t,this.collectionid=e,this.share=new Map,this.store=new ti,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=s,this.autoLoad=l,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=d.vt(t=>{this.on("load",()=>{this.isLoaded=!0,t(this)})});const o=()=>d.vt(t=>{let e=r=>{(void 0===r||!0===r)&&(this.off("sync",e),t())};this.on("sync",e)});this.on("sync",t=>{!1===t&&this.isSynced&&(this.whenSynced=o()),this.isSynced=void 0===t||!0===t,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=o()}load(){let t=this._item;null===t||this.shouldLoad||tm(t.parent.doc,t=>{t.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(i.HT(this.subdocs).map(t=>t.guid))}transact(t,e=null){return tm(this,t,e)}get(t,e=tW){let r=s._4(this.share,t,()=>{let t=new e;return t._integrate(this,null),t}),n=r.constructor;if(e!==tW&&n!==e)if(n===tW){let n=new e;n._map=r._map,r._map.forEach(t=>{for(;null!==t;t=t.left)t.parent=n}),n._start=r._start;for(let t=n._start;null!==t;t=t.right)t.parent=n;return n._length=r._length,this.share.set(t,n),n._integrate(this,null),n}else throw Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,t8)}getText(t=""){return this.get(t,ed)}getMap(t=""){return this.get(t,t7)}getXmlElement(t=""){return this.get(t,eg)}getXmlFragment(t=""){return this.get(t,eu)}toJSON(){let t={};return this.share.forEach((e,r)=>{t[r]=e.toJSON()}),t}destroy(){this.isDestroyed=!0,i.HT(this.subdocs).forEach(t=>t.destroy());let t=this._item;if(null!==t){this._item=null;let e=t.content;e.doc=new O({guid:this.guid,...e.opts,shouldLoad:!1}),e.doc._item=t,tm(t.parent.doc,r=>{let n=e.doc;t.deleted||r.subdocsAdded.add(n),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class N{constructor(t){this.restDecoder=t}resetDsCurVal(){}readDsClock(){return c.cw(this.restDecoder)}readDsLen(){return c.cw(this.restDecoder)}}class R extends N{readLeftID(){return tt(c.cw(this.restDecoder),c.cw(this.restDecoder))}readRightID(){return tt(c.cw(this.restDecoder),c.cw(this.restDecoder))}readClient(){return c.cw(this.restDecoder)}readInfo(){return c.xh(this.restDecoder)}readString(){return c.t3(this.restDecoder)}readParentInfo(){return 1===c.cw(this.restDecoder)}readTypeRef(){return c.cw(this.restDecoder)}readLen(){return c.cw(this.restDecoder)}readAny(){return c.Jg(this.restDecoder)}readBuf(){return a.HR(c.bo(this.restDecoder))}readJSON(){return JSON.parse(c.t3(this.restDecoder))}readKey(){return c.t3(this.restDecoder)}}class T{constructor(t){this.dsCurrVal=0,this.restDecoder=t}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=c.cw(this.restDecoder),this.dsCurrVal}readDsLen(){let t=c.cw(this.restDecoder)+1;return this.dsCurrVal+=t,t}}class z extends T{constructor(t){super(t),this.keys=[],c.cw(t),this.keyClockDecoder=new c.xK(c.bo(t)),this.clientDecoder=new c.VQ(c.bo(t)),this.leftClockDecoder=new c.xK(c.bo(t)),this.rightClockDecoder=new c.xK(c.bo(t)),this.infoDecoder=new c.cQ(c.bo(t),c.xh),this.stringDecoder=new c.Ib(c.bo(t)),this.parentInfoDecoder=new c.cQ(c.bo(t),c.xh),this.typeRefDecoder=new c.VQ(c.bo(t)),this.lenDecoder=new c.VQ(c.bo(t))}readLeftID(){return new X(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new X(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return 1===this.parentInfoDecoder.read()}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return c.Jg(this.restDecoder)}readBuf(){return c.bo(this.restDecoder)}readJSON(){return c.Jg(this.restDecoder)}readKey(){let t=this.keyClockDecoder.read();if(t<this.keys.length)return this.keys[t];{let t=this.stringDecoder.read();return this.keys.push(t),t}}}class J{constructor(){this.restEncoder=o.xv()}toUint8Array(){return o.Fo(this.restEncoder)}resetDsCurVal(){}writeDsClock(t){o.zd(this.restEncoder,t)}writeDsLen(t){o.zd(this.restEncoder,t)}}class U extends J{writeLeftID(t){o.zd(this.restEncoder,t.client),o.zd(this.restEncoder,t.clock)}writeRightID(t){o.zd(this.restEncoder,t.client),o.zd(this.restEncoder,t.clock)}writeClient(t){o.zd(this.restEncoder,t)}writeInfo(t){o.QJ(this.restEncoder,t)}writeString(t){o.Qj(this.restEncoder,t)}writeParentInfo(t){o.zd(this.restEncoder,+!!t)}writeTypeRef(t){o.zd(this.restEncoder,t)}writeLen(t){o.zd(this.restEncoder,t)}writeAny(t){o.IO(this.restEncoder,t)}writeBuf(t){o.Gu(this.restEncoder,t)}writeJSON(t){o.Qj(this.restEncoder,JSON.stringify(t))}writeKey(t){o.Qj(this.restEncoder,t)}}class V{constructor(){this.restEncoder=o.xv(),this.dsCurrVal=0}toUint8Array(){return o.Fo(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(t){let e=t-this.dsCurrVal;this.dsCurrVal=t,o.zd(this.restEncoder,e)}writeDsLen(t){0===t&&u.Mq(),o.zd(this.restEncoder,t-1),this.dsCurrVal+=t}}class W extends V{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new o.FA,this.clientEncoder=new o.D$,this.leftClockEncoder=new o.FA,this.rightClockEncoder=new o.FA,this.infoEncoder=new o.cq(o.QJ),this.stringEncoder=new o.Sw,this.parentInfoEncoder=new o.cq(o.QJ),this.typeRefEncoder=new o.D$,this.lenEncoder=new o.D$}toUint8Array(){let t=o.xv();return o.zd(t,0),o.Gu(t,this.keyClockEncoder.toUint8Array()),o.Gu(t,this.clientEncoder.toUint8Array()),o.Gu(t,this.leftClockEncoder.toUint8Array()),o.Gu(t,this.rightClockEncoder.toUint8Array()),o.Gu(t,o.Fo(this.infoEncoder)),o.Gu(t,this.stringEncoder.toUint8Array()),o.Gu(t,o.Fo(this.parentInfoEncoder)),o.Gu(t,this.typeRefEncoder.toUint8Array()),o.Gu(t,this.lenEncoder.toUint8Array()),o.LH(t,o.Fo(this.restEncoder)),o.Fo(t)}writeLeftID(t){this.clientEncoder.write(t.client),this.leftClockEncoder.write(t.clock)}writeRightID(t){this.clientEncoder.write(t.client),this.rightClockEncoder.write(t.clock)}writeClient(t){this.clientEncoder.write(t)}writeInfo(t){this.infoEncoder.write(t)}writeString(t){this.stringEncoder.write(t)}writeParentInfo(t){this.parentInfoEncoder.write(+!!t)}writeTypeRef(t){this.typeRefEncoder.write(t)}writeLen(t){this.lenEncoder.write(t)}writeAny(t){o.IO(this.restEncoder,t)}writeBuf(t){o.Gu(this.restEncoder,t)}writeJSON(t){o.IO(this.restEncoder,t)}writeKey(t){let e=this.keyMap.get(t);void 0===e?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(t)):this.keyClockEncoder.write(e)}}let F=(t,e,r)=>{let n=new Map;r.forEach((t,r)=>{ts(e,r)>t&&n.set(r,t)}),tl(e).forEach((t,e)=>{r.has(e)||n.set(e,0)}),o.zd(t.restEncoder,n.size),i.HT(n.entries()).sort((t,e)=>e[0]-t[0]).forEach(([r,n])=>{((t,e,r,n)=>{n=l.T9(n,e[0].id.clock);let i=tc(e,n);o.zd(t.restEncoder,e.length-i),t.writeClient(r),o.zd(t.restEncoder,n);let s=e[i];s.write(t,n-s.id.clock);for(let r=i+1;r<e.length;r++)e[r].write(t,0)})(t,e.clients.get(r),r,n)})},H=(t,e,r,n=z)=>{let l=c.$C(e);((t,e,r,n=new z(t))=>tm(e,t=>{t.local=!1;let e=!1,r=t.doc,l=r.store,h=((t,e,r)=>{let n=[],l=i.HT(r.keys()).sort((t,e)=>t-e);if(0===l.length)return null;let c=()=>{if(0===l.length)return null;let t=r.get(l[l.length-1]);for(;t.refs.length===t.i;){if(l.pop(),!(l.length>0))return null;t=r.get(l[l.length-1])}return t},h=c();if(null===h)return null;let d=new ti,a=new Map,u=(t,e)=>{let r=a.get(t);(null==r||r>e)&&a.set(t,e)},g=h.refs[h.i++],f=new Map,p=()=>{for(let t of n){let e=t.id.client,n=r.get(e);n?(n.i--,d.clients.set(e,n.refs.slice(n.i)),r.delete(e),n.i=0,n.refs=[]):d.clients.set(e,[t]),l=l.filter(t=>t!==e)}n.length=0};for(;;){if(g.constructor!==ej){let i=s._4(f,g.id.client,()=>ts(e,g.id.client))-g.id.clock;if(i<0)n.push(g),u(g.id.client,g.id.clock-1),p();else{let l=g.getMissing(t,e);if(null!==l){n.push(g);let t=r.get(l)||{refs:[],i:0};if(t.refs.length===t.i)u(l,ts(e,l)),p();else{g=t.refs[t.i++];continue}}else(0===i||i<g.length)&&(g.integrate(t,i),f.set(g.id.client,g.id.clock+g.length))}}if(n.length>0)g=n.pop();else if(null!==h&&h.i<h.refs.length)g=h.refs[h.i++];else{if(null===(h=c()))break;g=h.refs[h.i++]}}if(d.clients.size>0){let t=new W;return F(t,d,new Map),o.zd(t.restEncoder,0),{missing:a,update:t.toUint8Array()}}return null})(t,l,((t,e)=>{let r=s.vt(),n=c.cw(t.restDecoder);for(let i=0;i<n;i++){let n=c.cw(t.restDecoder),i=Array(n),l=t.readClient(),s=c.cw(t.restDecoder);r.set(l,{i:0,refs:i});for(let r=0;r<n;r++){let n=t.readInfo();switch(g.WY&n){case 0:{let e=t.readLen();i[r]=new ek(tt(l,s),e),s+=e;break}case 10:{let e=c.cw(t.restDecoder);i[r]=new ej(tt(l,s),e),s+=e;break}default:{let o=(n&(g.D7|g.wt))==0,c=new eH(tt(l,s),null,(n&g.wt)===g.wt?t.readLeftID():null,null,(n&g.D7)===g.D7?t.readRightID():null,o?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,o&&(n&g.KJ)===g.KJ?t.readString():null,eK(t,n));i[r]=c,s+=c.length}}}}return r})(n,r)),d=l.pendingStructs;if(d){for(let[t,r]of d.missing)if(r<ts(l,t)){e=!0;break}if(h){for(let[t,e]of h.missing){let r=d.missing.get(t);(null==r||r>e)&&d.missing.set(t,e)}d.update=tC([d.update,h.update])}}else l.pendingStructs=h;let a=M(n,t,l);if(l.pendingDs){let e=new z(c.$C(l.pendingDs));c.cw(e.restDecoder);let r=M(e,t,l);a&&r?l.pendingDs=tC([a,r]):l.pendingDs=a||r}else l.pendingDs=a;if(e){let e=l.pendingStructs.update;l.pendingStructs=null,H(t.doc,e)}},r,!1))(l,t,r,new n(l))},K=(t,e,r)=>H(t,e,r,R),$=(t,e)=>((t,e=new Uint8Array([0]),r=new W)=>{((t,e,r=new Map)=>{var n;let i;F(t,e.store,r),x(t,(n=e.store,i=A(),n.clients.forEach((t,e)=>{let r=[];for(let e=0;e<t.length;e++){let n=t[e];if(n.deleted){let i=n.id.clock,l=n.length;if(e+1<t.length)for(let r=t[e+1];e+1<t.length&&r.deleted;r=t[++e+1])l+=r.length;r.push(new y(i,l))}}r.length>0&&i.clients.set(e,r)}),i))})(r,t,j(e));let n=[r.toUint8Array()];if(t.store.pendingDs&&n.push(t.store.pendingDs),t.store.pendingStructs&&n.push(tE(t.store.pendingStructs.update,e)),n.length>1){if(r.constructor===U)return tD(n.map((t,e)=>0===e?t:tI(t)));else if(r.constructor===W)return tC(n)}return n[0]})(t,e,new U),j=t=>(t=>{let e=new Map,r=c.cw(t.restDecoder);for(let n=0;n<r;n++){let r=c.cw(t.restDecoder),n=c.cw(t.restDecoder);e.set(r,n)}return e})(new N(c.$C(t))),q=(t,e)=>(o.zd(t.restEncoder,e.size),i.HT(e.entries()).sort((t,e)=>e[0]-t[0]).forEach(([e,r])=>{o.zd(t.restEncoder,e),o.zd(t.restEncoder,r)}),t),P=t=>((t,e=new V)=>(t instanceof Map?q(e,t):q(e,tl(t.store)),e.toUint8Array()))(t,new J);class Q{constructor(){this.l=[]}}let G=()=>new Q,B=(t,e)=>{let r=t.l,n=r.length;t.l=r.filter(t=>e!==t),n===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},Y=(t,e,r)=>f.OK(t.l,[e,r]);class X{constructor(t,e){this.client=t,this.clock=e}}let Z=(t,e)=>t===e||null!==t&&null!==e&&t.client===e.client&&t.clock===e.clock,tt=(t,e)=>new X(t,e);class te{constructor(t,e){this.ds=t,this.sv=e}}new te(A(),new Map);let tr=(t,e)=>void 0===e?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!C(e.ds,t.id),tn=(t,e)=>{let r=s._4(t.meta,tn,p.vt),n=t.doc.store;r.has(e)||(e.sv.forEach((e,r)=>{e<ts(n,r)&&ta(t,tt(r,e))}),S(t,e.ds,t=>{}),r.add(e))};class ti{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}let tl=t=>{let e=new Map;return t.clients.forEach((t,r)=>{let n=t[t.length-1];e.set(r,n.id.clock+n.length)}),e},ts=(t,e)=>{let r=t.clients.get(e);if(void 0===r)return 0;let n=r[r.length-1];return n.id.clock+n.length},to=(t,e)=>{let r=t.clients.get(e.id.client);if(void 0===r)r=[],t.clients.set(e.id.client,r);else{let t=r[r.length-1];if(t.id.clock+t.length!==e.id.clock)throw u.Mq()}r.push(e)},tc=(t,e)=>{let r=0,n=t.length-1,i=t[n],s=i.id.clock;if(s===e)return n;let o=l.RI(e/(s+i.length-1)*n);for(;r<=n;){if((s=(i=t[o]).id.clock)<=e){if(e<s+i.length)return o;r=o+1}else n=o-1;o=l.RI((r+n)/2)}throw u.Mq()},th=(t,e)=>{let r=t.clients.get(e.client);return r[tc(r,e.clock)]},td=(t,e,r)=>{let n=tc(e,r),i=e[n];return i.id.clock<r&&i instanceof eH?(e.splice(n+1,0,eV(t,i,r-i.id.clock)),n+1):n},ta=(t,e)=>{let r=t.doc.store.clients.get(e.client);return r[td(t,r,e.clock)]},tu=(t,e,r)=>{let n=e.clients.get(r.client),i=tc(n,r.clock),l=n[i];return r.clock!==l.id.clock+l.length-1&&l.constructor!==ek&&n.splice(i+1,0,eV(t,l,r.clock-l.id.clock+1)),l},tg=(t,e,r,n,i)=>{let l;if(0===n)return;let s=r+n,o=td(t,e,r);do s<(l=e[o++]).id.clock+l.length&&td(t,e,s),i(l);while(o<e.length&&e[o].id.clock<s)};class tf{constructor(t,e,r){this.doc=t,this.deleteSet=new D,this.beforeState=tl(t.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=e,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}let tp=(t,e)=>(0!==e.deleteSet.clients.size||!!s.bz(e.afterState,(t,r)=>e.beforeState.get(r)!==t))&&(E(e.deleteSet),F(t,e.doc.store,e.beforeState),x(t,e.deleteSet),!0),tw=(t,e,r)=>{let n=e._item;(null===n||n.id.clock<(t.beforeState.get(n.id.client)||0)&&!n.deleted)&&s._4(t.changed,e,p.vt).add(r)},t_=(t,e)=>{let r=t[e],n=t[e-1],i=e;for(;i>0;r=n,n=t[--i-1]){if(n.deleted===r.deleted&&n.constructor===r.constructor&&n.mergeWith(r)){r instanceof eH&&null!==r.parentSub&&r.parent._map.get(r.parentSub)===r&&r.parent._map.set(r.parentSub,n);continue}break}let l=e-i;return l&&t.splice(e+1-l,l),l},tk=(t,e)=>{if(e<t.length){let r=t[e],n=r.doc,i=n.store,s=r.deleteSet,o=r._mergeStructs;try{E(s),r.afterState=tl(r.doc.store),n.emit("beforeObserverCalls",[r,n]);let t=[];r.changed.forEach((e,n)=>t.push(()=>{null!==n._item&&n._item.deleted||n._callObserver(r,e)})),t.push(()=>{r.changedParentTypes.forEach((e,n)=>{n._dEH.l.length>0&&(null===n._item||!n._item.deleted)&&((e=e.filter(t=>null===t.target._item||!t.target._item.deleted)).forEach(t=>{t.currentTarget=n,t._path=null}),e.sort((t,e)=>t.path.length-e.path.length),t.push(()=>{Y(n._dEH,e,r)}))}),t.push(()=>n.emit("afterTransaction",[r,n])),t.push(()=>{r._needFormattingCleanup&&eo(r)})}),(0,f.OK)(t,[])}finally{n.gc&&((t,e,r)=>{for(let[n,i]of t.clients.entries()){let t=e.clients.get(n);for(let n=i.length-1;n>=0;n--){let l=i[n],s=l.clock+l.len;for(let n=tc(t,l.clock),i=t[n];n<t.length&&i.id.clock<s;i=t[++n]){let i=t[n];if(l.clock+l.len<=i.id.clock)break;i instanceof eH&&i.deleted&&!i.keep&&r(i)&&i.gc(e,!1)}}}})(s,i,n.gcFilter),s.clients.forEach((t,e)=>{let r=i.clients.get(e);for(let e=t.length-1;e>=0;e--){let n=t[e],i=l.jk(r.length-1,1+tc(r,n.clock+n.len-1));for(let t=i,e=r[t];t>0&&e.id.clock>=n.clock;e=r[t])t-=1+t_(r,t)}}),r.afterState.forEach((t,e)=>{let n=r.beforeState.get(e)||0;if(n!==t){let t=i.clients.get(e),r=l.T9(tc(t,n),1);for(let e=t.length-1;e>=r;)e-=1+t_(t,e)}});for(let t=o.length-1;t>=0;t--){let{client:e,clock:r}=o[t].id,n=i.clients.get(e),l=tc(n,r);!(l+1<n.length&&t_(n,l+1)>1)&&l>0&&t_(n,l)}if(r.local||r.afterState.get(n.clientID)===r.beforeState.get(n.clientID)||(w.yy(_.hN,_.Y,"[yjs] ",_.Ny,_.UH,"Changed the client-id because another client seems to be using it."),n.clientID=L()),n.emit("afterTransactionCleanup",[r,n]),n._observers.has("update")){let t=new U;tp(t,r)&&n.emit("update",[t.toUint8Array(),r.origin,n,r])}if(n._observers.has("updateV2")){let t=new W;tp(t,r)&&n.emit("updateV2",[t.toUint8Array(),r.origin,n,r])}let{subdocsAdded:c,subdocsLoaded:h,subdocsRemoved:d}=r;(c.size>0||d.size>0||h.size>0)&&(c.forEach(t=>{t.clientID=n.clientID,null==t.collectionid&&(t.collectionid=n.collectionid),n.subdocs.add(t)}),d.forEach(t=>n.subdocs.delete(t)),n.emit("subdocs",[{loaded:h,added:c,removed:d},n,r]),d.forEach(t=>t.destroy())),t.length<=e+1?(n._transactionCleanups=[],n.emit("afterAllTransactions",[n,t])):tk(t,e+1)}}},tm=(t,e,r=null,n=!0)=>{let i=t._transactionCleanups,l=!1,s=null;null===t._transaction&&(l=!0,t._transaction=new tf(t,r,n),i.push(t._transaction),1===i.length&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(l){let e=t._transaction===i[0];t._transaction=null,e&&tk(i,0)}}return s};n.W;class tb{constructor(t,e){this.gen=function*(t){let e=c.cw(t.restDecoder);for(let r=0;r<e;r++){let e=c.cw(t.restDecoder),r=t.readClient(),n=c.cw(t.restDecoder);for(let i=0;i<e;i++){let e=t.readInfo();if(10===e){let e=c.cw(t.restDecoder);yield new ej(tt(r,n),e),n+=e}else if((g.WY&e)!=0){let i=(e&(g.D7|g.wt))==0,l=new eH(tt(r,n),null,(e&g.wt)===g.wt?t.readLeftID():null,null,(e&g.D7)===g.D7?t.readRightID():null,i?t.readParentInfo()?t.readString():t.readLeftID():null,i&&(e&g.KJ)===g.KJ?t.readString():null,eK(t,e));yield l,n+=l.length}else{let e=t.readLen();yield new ek(tt(r,n),e),n+=e}}}}(t),this.curr=null,this.done=!1,this.filterSkips=e,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&null!==this.curr&&this.curr.constructor===ej);return this.curr}}class ty{constructor(t){this.currClient=0,this.startClock=0,this.written=0,this.encoder=t,this.clientStructs=[]}}let tD=t=>tC(t,R,U),tS=(t,e)=>{if(t.constructor===ek){let{client:r,clock:n}=t.id;return new ek(tt(r,n+e),t.length-e)}if(t.constructor===ej){let{client:r,clock:n}=t.id;return new ej(tt(r,n+e),t.length-e)}{let{client:r,clock:n}=t.id;return new eH(tt(r,n+e),null,tt(r,n+e-1),null,t.rightOrigin,t.parent,t.parentSub,t.content.splice(e))}},tC=(t,e=z,r=W)=>{if(1===t.length)return t[0];let n=t.map(t=>new e(c.$C(t))),l=n.map(t=>new tb(t,!0)),s=null,o=new r,h=new ty(o);for(;(l=l.filter(t=>null!==t.curr)).sort((t,e)=>{if(t.curr.id.client!==e.curr.id.client)return e.curr.id.client-t.curr.id.client;{let r=t.curr.id.clock-e.curr.id.clock;return 0===r?t.curr.constructor===e.curr.constructor?0:t.curr.constructor===ej?1:-1:r}}),0!==l.length;){let t=l[0],e=t.curr.id.client;if(null!==s){let r=t.curr,n=!1;for(;null!==r&&r.id.clock+r.length<=s.struct.id.clock+s.struct.length&&r.id.client>=s.struct.id.client;)r=t.next(),n=!0;if(null===r||r.id.client!==e||n&&r.id.clock>s.struct.id.clock+s.struct.length)continue;if(e!==s.struct.id.client)tA(h,s.struct,s.offset),s={struct:r,offset:0},t.next();else if(s.struct.id.clock+s.struct.length<r.id.clock)if(s.struct.constructor===ej)s.struct.length=r.id.clock+r.length-s.struct.id.clock;else{tA(h,s.struct,s.offset);let t=r.id.clock-s.struct.id.clock-s.struct.length;s={struct:new ej(tt(e,s.struct.id.clock+s.struct.length),t),offset:0}}else{let e=s.struct.id.clock+s.struct.length-r.id.clock;e>0&&(s.struct.constructor===ej?s.struct.length-=e:r=tS(r,e)),s.struct.mergeWith(r)||(tA(h,s.struct,s.offset),s={struct:r,offset:0},t.next())}}else s={struct:t.curr,offset:0},t.next();for(let r=t.curr;null!==r&&r.id.client===e&&r.id.clock===s.struct.id.clock+s.struct.length&&r.constructor!==ej;r=t.next())tA(h,s.struct,s.offset),s={struct:r,offset:0}}return null!==s&&(tA(h,s.struct,s.offset),s=null),tx(h),x(o,(t=>{let e=new D;for(let r=0;r<t.length;r++)t[r].clients.forEach((n,l)=>{if(!e.clients.has(l)){let s=n.slice();for(let e=r+1;e<t.length;e++)i.S2(s,t[e].clients.get(l)||[]);e.clients.set(l,s)}});return E(e),e})(n.map(t=>I(t)))),o.toUint8Array()},tE=(t,e,r=z,n=W)=>{let i=j(e),s=new n,o=new ty(s),h=new r(c.$C(t)),d=new tb(h,!1);for(;d.curr;){let t=d.curr,e=t.id.client,r=i.get(e)||0;if(d.curr.constructor===ej){d.next();continue}if(t.id.clock+t.length>r)for(tA(o,t,l.T9(r-t.id.clock,0)),d.next();d.curr&&d.curr.id.client===e;)tA(o,d.curr,0),d.next();else for(;d.curr&&d.curr.id.client===e&&d.curr.id.clock+d.curr.length<=r;)d.next()}return tx(o),x(s,I(h)),s.toUint8Array()},tv=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:o.Fo(t.encoder.restEncoder)}),t.encoder.restEncoder=o.xv(),t.written=0)},tA=(t,e,r)=>{t.written>0&&t.currClient!==e.id.client&&tv(t),0===t.written&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),o.zd(t.encoder.restEncoder,e.id.clock+r)),e.write(t.encoder,r),t.written++},tx=t=>{tv(t);let e=t.encoder.restEncoder;o.zd(e,t.clientStructs.length);for(let r=0;r<t.clientStructs.length;r++){let n=t.clientStructs[r];o.zd(e,n.written),o.LH(e,n.restEncoder)}},tI=t=>((t,e,r,n)=>{let i=new r(c.$C(t)),l=new tb(i,!1),s=new n,o=new ty(s);for(let t=l.curr;null!==t;t=l.next())tA(o,e(t),0);return tx(o),x(s,I(i)),s.toUint8Array()})(t,f.id,z,U),tM="You must not compute changes after the event-handler fired.";class tL{constructor(t,e){this.target=t,this.currentTarget=t,this.transaction=e,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=tO(this.currentTarget,this.target))}deletes(t){return C(this.transaction.deleteSet,t.id)}get keys(){if(null===this._keys){if(0===this.transaction.doc._transactionCleanups.length)throw u.vt(tM);let t=new Map,e=this.target;this.transaction.changed.get(e).forEach(r=>{if(null!==r){let n,l,s=e._map.get(r);if(this.adds(s)){let t=s.left;for(;null!==t&&this.adds(t);)t=t.left;if(this.deletes(s))if(!(null!==t&&this.deletes(t)))return;else n="delete",l=i.HV(t.content.getContent());else null!==t&&this.deletes(t)?(n="update",l=i.HV(t.content.getContent())):(n="add",l=void 0)}else{if(!this.deletes(s))return;n="delete",l=i.HV(s.content.getContent())}t.set(r,{action:n,oldValue:l})}}),this._keys=t}return this._keys}get delta(){return this.changes.delta}adds(t){return t.id.clock>=(this.transaction.beforeState.get(t.id.client)||0)}get changes(){let t=this._changes;if(null===t){if(0===this.transaction.doc._transactionCleanups.length)throw u.vt(tM);let e=this.target,r=p.vt(),n=p.vt(),i=[];if(t={added:r,deleted:n,delta:i,keys:this.keys},this.transaction.changed.get(e).has(null)){let t=null,l=()=>{t&&i.push(t)};for(let i=e._start;null!==i;i=i.right)i.deleted?this.deletes(i)&&!this.adds(i)&&((null===t||void 0===t.delete)&&(l(),t={delete:0}),t.delete+=i.length,n.add(i)):this.adds(i)?((null===t||void 0===t.insert)&&(l(),t={insert:[]}),t.insert=t.insert.concat(i.content.getContent()),r.add(i)):((null===t||void 0===t.retain)&&(l(),t={retain:0}),t.retain+=i.length);null!==t&&void 0===t.retain&&l()}this._changes=t}return t}}let tO=(t,e)=>{let r=[];for(;null!==e._item&&e!==t;){if(null!==e._item.parentSub)r.unshift(e._item.parentSub);else{let t=0,n=e._item.parent._start;for(;n!==e._item&&null!==n;)!n.deleted&&n.countable&&(t+=n.length),n=n.right;r.unshift(t)}e=e._item.parent}return r},tN=()=>{w.R8("Invalid access: Add Yjs type to a document before reading data.")},tR=0;class tT{constructor(t,e){t.marker=!0,this.p=t,this.index=e,this.timestamp=tR++}}let tz=(t,e,r)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=r,t.timestamp=tR++},tJ=(t,e)=>{if(null===t._start||0===e||null===t._searchMarker)return null;let r=0===t._searchMarker.length?null:t._searchMarker.reduce((t,r)=>l.tn(e-t.index)<l.tn(e-r.index)?t:r),n=t._start,i=0;for(null!==r&&(n=r.p,i=r.index,r.timestamp=tR++);null!==n.right&&i<e;){if(!n.deleted&&n.countable){if(e<i+n.length)break;i+=n.length}n=n.right}for(;null!==n.left&&i>e;)!(n=n.left).deleted&&n.countable&&(i-=n.length);for(;null!==n.left&&n.left.id.client===n.id.client&&n.left.id.clock+n.left.length===n.id.clock;)!(n=n.left).deleted&&n.countable&&(i-=n.length);if(null!==r&&l.tn(r.index-i)<n.parent.length/80)return tz(r,n,i),r;var s=t._searchMarker,o=n,c=i;if(s.length>=80){let t=s.reduce((t,e)=>t.timestamp<e.timestamp?t:e);return tz(t,o,c),t}{let t=new tT(o,c);return s.push(t),t}},tU=(t,e,r)=>{for(let n=t.length-1;n>=0;n--){let i=t[n];if(r>0){let e=i.p;for(e.marker=!1;e&&(e.deleted||!e.countable);)(e=e.left)&&!e.deleted&&e.countable&&(i.index-=e.length);if(null===e||!0===e.marker){t.splice(n,1);continue}i.p=e,e.marker=!0}(e<i.index||r>0&&e===i.index)&&(i.index=l.T9(e,i.index+r))}},tV=(t,e,r)=>{let n=t,i=e.changedParentTypes;for(;s._4(i,t,()=>[]).push(r),null!==t._item;)t=t._item.parent;Y(n._eH,r,e)};class tW{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=G(),this._dEH=G(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(t,e){this.doc=t,this._item=e}_copy(){throw u.bD()}clone(){throw u.bD()}_write(t){}get _first(){let t=this._start;for(;null!==t&&t.deleted;)t=t.right;return t}_callObserver(t,e){!t.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(t){let e;e=this._eH,e.l.push(t)}observeDeep(t){let e;e=this._dEH,e.l.push(t)}unobserve(t){B(this._eH,t)}unobserveDeep(t){B(this._dEH,t)}toJSON(){}}let tF=(t,e,r)=>{t.doc??tN(),e<0&&(e=t._length+e),r<0&&(r=t._length+r);let n=r-e,i=[],l=t._start;for(;null!==l&&n>0;){if(l.countable&&!l.deleted){let t=l.content.getContent();if(t.length<=e)e-=t.length;else{for(let r=e;r<t.length&&n>0;r++)i.push(t[r]),n--;e=0}}l=l.right}return i},tH=t=>{t.doc??tN();let e=[],r=t._start;for(;null!==r;){if(r.countable&&!r.deleted){let t=r.content.getContent();for(let r=0;r<t.length;r++)e.push(t[r])}r=r.right}return e},tK=(t,e)=>{let r=0,n=t._start;for(t.doc??tN();null!==n;){if(n.countable&&!n.deleted){let i=n.content.getContent();for(let n=0;n<i.length;n++)e(i[n],r++,t)}n=n.right}},t$=(t,e)=>{let r=[];return tK(t,(n,i)=>{r.push(e(n,i,t))}),r},tj=(t,e)=>{t.doc??tN();let r=tJ(t,e),n=t._start;for(null!==r&&(n=r.p,e-=r.index);null!==n;n=n.right)if(!n.deleted&&n.countable){if(e<n.length)return n.content.getContent()[e];e-=n.length}},tq=(t,e,r,n)=>{let i=r,l=t.doc,s=l.clientID,o=l.store,c=null===r?e._start:r.right,h=[],d=()=>{h.length>0&&((i=new eH(tt(s,ts(o,s)),i,i&&i.lastId,c,c&&c.id,e,null,new eA(h))).integrate(t,0),h=[])};n.forEach(r=>{if(null===r)h.push(r);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:h.push(r);break;default:switch(d(),r.constructor){case Uint8Array:case ArrayBuffer:(i=new eH(tt(s,ts(o,s)),i,i&&i.lastId,c,c&&c.id,e,null,new em(new Uint8Array(r)))).integrate(t,0);break;case O:(i=new eH(tt(s,ts(o,s)),i,i&&i.lastId,c,c&&c.id,e,null,new eD(r))).integrate(t,0);break;default:if(r instanceof tW)(i=new eH(tt(s,ts(o,s)),i,i&&i.lastId,c,c&&c.id,e,null,new eJ(r))).integrate(t,0);else throw Error("Unexpected content type in insert operation")}}}),d()},tP=(t,e,r,n)=>{if(r>e._length)throw u.vt("Length exceeded!");if(0===r)return e._searchMarker&&tU(e._searchMarker,r,n.length),tq(t,e,null,n);let i=r,l=tJ(e,r),s=e._start;for(null!==l&&(s=l.p,0==(r-=l.index)&&(r+=(s=s.prev)&&s.countable&&!s.deleted?s.length:0));null!==s;s=s.right)if(!s.deleted&&s.countable){if(r<=s.length){r<s.length&&ta(t,tt(s.id.client,s.id.clock+r));break}r-=s.length}return e._searchMarker&&tU(e._searchMarker,i,n.length),tq(t,e,s,n)},tQ=(t,e,r,n)=>{if(0===n)return;let i=r,l=n,s=tJ(e,r),o=e._start;for(null!==s&&(o=s.p,r-=s.index);null!==o&&r>0;o=o.right)!o.deleted&&o.countable&&(r<o.length&&ta(t,tt(o.id.client,o.id.clock+r)),r-=o.length);for(;n>0&&null!==o;)o.deleted||(n<o.length&&ta(t,tt(o.id.client,o.id.clock+n)),o.delete(t),n-=o.length),o=o.right;if(n>0)throw u.vt("Length exceeded!");e._searchMarker&&tU(e._searchMarker,i,-l+n)},tG=(t,e,r)=>{let n=e._map.get(r);void 0!==n&&n.delete(t)},tB=(t,e,r,n)=>{let i,l=e._map.get(r)||null,s=t.doc,o=s.clientID;if(null==n)i=new eA([n]);else switch(n.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:i=new eA([n]);break;case Uint8Array:i=new em(n);break;case O:i=new eD(n);break;default:if(n instanceof tW)i=new eJ(n);else throw Error("Unexpected content type")}new eH(tt(o,ts(s.store,o)),l,l&&l.lastId,null,null,e,r,i).integrate(t,0)},tY=(t,e)=>{t.doc??tN();let r=t._map.get(e);return void 0===r||r.deleted?void 0:r.content.getContent()[r.length-1]},tX=t=>{let e={};return t.doc??tN(),t._map.forEach((t,r)=>{t.deleted||(e[r]=t.content.getContent()[t.length-1])}),e},tZ=(t,e)=>{t.doc??tN();let r=t._map.get(e);return void 0!==r&&!r.deleted},t0=t=>(t.doc??tN(),k.$5(t._map.entries(),t=>!t[1].deleted));class t1 extends tL{}class t8 extends tW{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){let e=new t8;return e.push(t),e}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t8}clone(){let t=new t8;return t.insert(0,this.toArray().map(t=>t instanceof tW?t.clone():t)),t}get length(){return this.doc??tN(),this._length}_callObserver(t,e){super._callObserver(t,e),tV(this,t,new t1(this,t))}insert(t,e){null!==this.doc?tm(this.doc,r=>{tP(r,this,t,e)}):this._prelimContent.splice(t,0,...e)}push(t){null!==this.doc?tm(this.doc,e=>{((t,e,r)=>{let n=(e._searchMarker||[]).reduce((t,e)=>e.index>t.index?e:t,{index:0,p:e._start}).p;if(n)for(;n.right;)n=n.right;return tq(t,e,n,r)})(e,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,e=1){null!==this.doc?tm(this.doc,r=>{tQ(r,this,t,e)}):this._prelimContent.splice(t,e)}get(t){return tj(this,t)}toArray(){return tH(this)}slice(t=0,e=this.length){return tF(this,t,e)}toJSON(){return this.map(t=>t instanceof tW?t.toJSON():t)}map(t){return t$(this,t)}forEach(t){tK(this,t)}[Symbol.iterator](){let t,e,r;return t=this._start,e=null,r=0,{[Symbol.iterator](){return this},next:()=>{if(null===e){for(;null!==t&&t.deleted;)t=t.right;if(null===t)return{done:!0,value:void 0};e=t.content.getContent(),r=0,t=t.right}let n=e[r++];return e.length<=r&&(e=null),{done:!1,value:n}}}}_write(t){t.writeTypeRef(eM)}}class t4 extends tL{constructor(t,e,r){super(t,e),this.keysChanged=r}}class t7 extends tW{constructor(t){super(),this._prelimContent=null,void 0===t?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,e){super._integrate(t,e),this._prelimContent.forEach((t,e)=>{this.set(e,t)}),this._prelimContent=null}_copy(){return new t7}clone(){let t=new t7;return this.forEach((e,r)=>{t.set(r,e instanceof tW?e.clone():e)}),t}_callObserver(t,e){tV(this,t,new t4(this,t,e))}toJSON(){this.doc??tN();let t={};return this._map.forEach((e,r)=>{if(!e.deleted){let n=e.content.getContent()[e.length-1];t[r]=n instanceof tW?n.toJSON():n}}),t}get size(){return[...t0(this)].length}keys(){return k.n(t0(this),t=>t[0])}values(){return k.n(t0(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return k.n(t0(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??tN(),this._map.forEach((e,r)=>{e.deleted||t(e.content.getContent()[e.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){null!==this.doc?tm(this.doc,e=>{tG(e,this,t)}):this._prelimContent.delete(t)}set(t,e){return null!==this.doc?tm(this.doc,r=>{tB(r,this,t,e)}):this._prelimContent.set(t,e),e}get(t){return tY(this,t)}has(t){return tZ(this,t)}clear(){null!==this.doc?tm(this.doc,t=>{this.forEach(function(e,r,n){tG(t,n,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(eL)}}let t2=(t,e)=>t===e||"object"==typeof t&&"object"==typeof e&&t&&e&&m.SQ(t,e);class t3{constructor(t,e,r,n){this.left=t,this.right=e,this.index=r,this.currentAttributes=n}forward(){null===this.right&&u.Mq(),this.right.content.constructor===eC?this.right.deleted||et(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}let t6=(t,e,r)=>{for(;null!==e.right&&r>0;)e.right.content.constructor===eC?e.right.deleted||et(e.currentAttributes,e.right.content):e.right.deleted||(r<e.right.length&&ta(t,tt(e.right.id.client,e.right.id.clock+r)),e.index+=e.right.length,r-=e.right.length),e.left=e.right,e.right=e.right.right;return e},t9=(t,e,r,n)=>{let i=new Map,l=n?tJ(e,r):null;return l?t6(t,new t3(l.p.left,l.p,l.index,i),r-l.index):t6(t,new t3(null,e._start,0,i),r)},t5=(t,e,r,n)=>{for(;null!==r.right&&(!0===r.right.deleted||r.right.content.constructor===eC&&t2(n.get(r.right.content.key),r.right.content.value));)r.right.deleted||n.delete(r.right.content.key),r.forward();let i=t.doc,l=i.clientID;n.forEach((n,s)=>{let o=r.left,c=r.right,h=new eH(tt(l,ts(i.store,l)),o,o&&o.lastId,c,c&&c.id,e,null,new eC(s,n));h.integrate(t,0),r.right=h,r.forward()})},et=(t,e)=>{let{key:r,value:n}=e;null===n?t.delete(r):t.set(r,n)},ee=(t,e)=>{for(;null!==t.right&&(t.right.deleted||t.right.content.constructor===eC&&t2(e[t.right.content.key]??null,t.right.content.value));){;t.forward()}},er=(t,e,r,n)=>{let i=t.doc,l=i.clientID,s=new Map;for(let o in n){let c=n[o],h=r.currentAttributes.get(o)??null;if(!t2(h,c)){s.set(o,h);let{left:n,right:d}=r;r.right=new eH(tt(l,ts(i.store,l)),n,n&&n.lastId,d,d&&d.id,e,null,new eC(o,c)),r.right.integrate(t,0),r.forward()}}return s},en=(t,e,r,n,i)=>{r.currentAttributes.forEach((t,e)=>{void 0===i[e]&&(i[e]=null)});let l=t.doc,s=l.clientID;ee(r,i);let o=er(t,e,r,i),c=n.constructor===String?new ex(n):n instanceof tW?new eJ(n):new eS(n),{left:h,right:d,index:a}=r;e._searchMarker&&tU(e._searchMarker,r.index,c.getLength()),(d=new eH(tt(s,ts(l.store,s)),h,h&&h.lastId,d,d&&d.id,e,null,c)).integrate(t,0),r.right=d,r.index=a,r.forward(),t5(t,e,r,o)},ei=(t,e,r,n,i)=>{let l=t.doc,s=l.clientID;ee(r,i);let o=er(t,e,r,i);for(;null!==r.right&&(n>0||o.size>0&&(r.right.deleted||r.right.content.constructor===eC));){if(!r.right.deleted)if(r.right.content.constructor===eC){let{key:e,value:l}=r.right.content,s=i[e];if(void 0!==s){if(t2(s,l))o.delete(e);else{if(0===n)break;o.set(e,l)}r.right.delete(t)}else r.currentAttributes.set(e,l)}else n<r.right.length&&ta(t,tt(r.right.id.client,r.right.id.clock+n)),n-=r.right.length;r.forward()}if(n>0){let i="";for(;n>0;n--)i+="\n";r.right=new eH(tt(s,ts(l.store,s)),r.left,r.left&&r.left.lastId,r.right,r.right&&r.right.id,e,null,new ex(i)),r.right.integrate(t,0),r.forward()}t5(t,e,r,o)},el=(t,e,r,n,i)=>{let l=e,o=s.vt();for(;l&&(!l.countable||l.deleted);){if(!l.deleted&&l.content.constructor===eC){let t=l.content;o.set(t.key,t)}l=l.right}let c=0,h=!1;for(;e!==l;){if(r===e&&(h=!0),!e.deleted){let r=e.content;if(r.constructor===eC){let{key:l,value:s}=r,d=n.get(l)??null;(o.get(l)!==r||d===s)&&(e.delete(t),c++,h||(i.get(l)??null)!==s||d===s||(null===d?i.delete(l):i.set(l,d))),h||e.deleted||et(i,r)}}e=e.right}return c},es=t=>{let e=0;return tm(t.doc,r=>{let n=t._start,i=t._start,l=s.vt(),o=s.C(l);for(;i;)!1===i.deleted&&(i.content.constructor===eC?et(o,i.content):(e+=el(r,n,i,l,o),l=s.C(o),n=i)),i=i.right}),e},eo=t=>{let e=new Set,r=t.doc;for(let[n,i]of t.afterState.entries()){let l=t.beforeState.get(n)||0;i!==l&&tg(t,r.store.clients.get(n),l,i,t=>{t.deleted||t.content.constructor!==eC||t.constructor===ek||e.add(t.parent)})}tm(r,r=>{for(let n of(S(t,t.deleteSet,t=>{if(t instanceof ek||!t.parent._hasFormatting||e.has(t.parent))return;let n=t.parent;if(t.content.constructor===eC)e.add(n);else{for(var i=t;i&&i.right&&(i.right.deleted||!i.right.countable);)i=i.right;let e=new Set;for(;i&&(i.deleted||!i.countable);){if(!i.deleted&&i.content.constructor===eC){let t=i.content.key;e.has(t)?i.delete(r):e.add(t)}i=i.left}}}),e))es(n)})},ec=(t,e,r)=>{let n=r,i=s.C(e.currentAttributes),l=e.right;for(;r>0&&null!==e.right;){if(!1===e.right.deleted)switch(e.right.content.constructor){case eJ:case eS:case ex:r<e.right.length&&ta(t,tt(e.right.id.client,e.right.id.clock+r)),r-=e.right.length,e.right.delete(t)}e.forward()}l&&el(t,l,e.right,i,e.currentAttributes);let o=(e.left||e.right).parent;return o._searchMarker&&tU(o._searchMarker,e.index,-n+r),e};class eh extends tL{constructor(t,e,r){super(t,e),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(t=>{null===t?this.childListChanged=!0:this.keysChanged.add(t)})}get changes(){if(null===this._changes){let t={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=t}return this._changes}get delta(){if(null===this._delta){let t=this.target.doc,e=[];tm(t,t=>{let r=new Map,n=new Map,i=this.target._start,l=null,s={},o="",c=0,h=0,d=()=>{if(null!==l){let t=null;switch(l){case"delete":h>0&&(t={delete:h}),h=0;break;case"insert":("object"==typeof o||o.length>0)&&(t={insert:o},r.size>0&&(t.attributes={},r.forEach((e,r)=>{null!==e&&(t.attributes[r]=e)}))),o="";break;case"retain":c>0&&(t={retain:c},m.Im(s)||(t.attributes=m.kp({},s))),c=0}t&&e.push(t),l=null}};for(;null!==i;){switch(i.content.constructor){case eJ:case eS:this.adds(i)?this.deletes(i)||(d(),l="insert",o=i.content.getContent()[0],d()):this.deletes(i)?("delete"!==l&&(d(),l="delete"),h+=1):i.deleted||("retain"!==l&&(d(),l="retain"),c+=1);break;case ex:this.adds(i)?this.deletes(i)||("insert"!==l&&(d(),l="insert"),o+=i.content.str):this.deletes(i)?("delete"!==l&&(d(),l="delete"),h+=i.length):i.deleted||("retain"!==l&&(d(),l="retain"),c+=i.length);break;case eC:{let{key:e,value:o}=i.content;if(this.adds(i))this.deletes(i)||(t2(r.get(e)??null,o)?null!==o&&i.delete(t):("retain"===l&&d(),t2(o,n.get(e)??null)?delete s[e]:s[e]=o));else if(this.deletes(i)){n.set(e,o);let t=r.get(e)??null;t2(t,o)||("retain"===l&&d(),s[e]=t)}else if(!i.deleted){n.set(e,o);let r=s[e];void 0!==r&&(t2(r,o)?null!==r&&i.delete(t):("retain"===l&&d(),null===o?delete s[e]:s[e]=o))}i.deleted||("insert"===l&&d(),et(r,i.content))}}i=i.right}for(d();e.length>0;){let t=e[e.length-1];if(void 0!==t.retain&&void 0===t.attributes)e.pop();else break}}),this._delta=e}return this._delta}}class ed extends tW{constructor(t){super(),this._pending=void 0!==t?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??tN(),this._length}_integrate(t,e){super._integrate(t,e);try{this._pending.forEach(t=>t())}catch(t){console.error(t)}this._pending=null}_copy(){return new ed}clone(){let t=new ed;return t.applyDelta(this.toDelta()),t}_callObserver(t,e){super._callObserver(t,e);let r=new eh(this,t,e);tV(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??tN();let t="",e=this._start;for(;null!==e;)!e.deleted&&e.countable&&e.content.constructor===ex&&(t+=e.content.str),e=e.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:e=!0}={}){null!==this.doc?tm(this.doc,r=>{let n=new t3(null,this._start,0,new Map);for(let i=0;i<t.length;i++){let l=t[i];if(void 0!==l.insert){let s=e||"string"!=typeof l.insert||i!==t.length-1||null!==n.right||"\n"!==l.insert.slice(-1)?l.insert:l.insert.slice(0,-1);("string"!=typeof s||s.length>0)&&en(r,this,n,s,l.attributes||{})}else void 0!==l.retain?ei(r,this,n,l.retain,l.attributes||{}):void 0!==l.delete&&ec(r,n,l.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,e,r){this.doc??tN();let n=[],i=new Map,l=this.doc,s="",o=this._start;function c(){if(s.length>0){let t={},e=!1;i.forEach((r,n)=>{e=!0,t[n]=r});let r={insert:s};e&&(r.attributes=t),n.push(r),s=""}}let h=()=>{for(;null!==o;){if(tr(o,t)||void 0!==e&&tr(o,e))switch(o.content.constructor){case ex:{let n=i.get("ychange");void 0===t||tr(o,t)?void 0===e||tr(o,e)?void 0!==n&&(c(),i.delete("ychange")):(void 0===n||n.user!==o.id.client||"added"!==n.type)&&(c(),i.set("ychange",r?r("added",o.id):{type:"added"})):(void 0===n||n.user!==o.id.client||"removed"!==n.type)&&(c(),i.set("ychange",r?r("removed",o.id):{type:"removed"})),s+=o.content.str;break}case eJ:case eS:{c();let t={insert:o.content.getContent()[0]};if(i.size>0){let e={};t.attributes=e,i.forEach((t,r)=>{e[r]=t})}n.push(t);break}case eC:tr(o,t)&&(c(),et(i,o.content))}o=o.right}c()};return t||e?tm(l,r=>{t&&tn(r,t),e&&tn(r,e),h()},"cleanup"):h(),n}insert(t,e,r){if(e.length<=0)return;let n=this.doc;null!==n?tm(n,n=>{let i=t9(n,this,t,!r);r||(r={},i.currentAttributes.forEach((t,e)=>{r[e]=t})),en(n,this,i,e,r)}):this._pending.push(()=>this.insert(t,e,r))}insertEmbed(t,e,r){let n=this.doc;null!==n?tm(n,n=>{let i=t9(n,this,t,!r);en(n,this,i,e,r||{})}):this._pending.push(()=>this.insertEmbed(t,e,r||{}))}delete(t,e){if(0===e)return;let r=this.doc;null!==r?tm(r,r=>{ec(r,t9(r,this,t,!0),e)}):this._pending.push(()=>this.delete(t,e))}format(t,e,r){if(0===e)return;let n=this.doc;null!==n?tm(n,n=>{let i=t9(n,this,t,!1);null!==i.right&&ei(n,this,i,e,r)}):this._pending.push(()=>this.format(t,e,r))}removeAttribute(t){null!==this.doc?tm(this.doc,e=>{tG(e,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,e){null!==this.doc?tm(this.doc,r=>{tB(r,this,t,e)}):this._pending.push(()=>this.setAttribute(t,e))}getAttribute(t){return tY(this,t)}getAttributes(){return tX(this)}_write(t){t.writeTypeRef(eO)}}class ea{constructor(t,e=()=>!0){this._filter=e,this._root=t,this._currentNode=t._start,this._firstCall=!0,t.doc??tN()}[Symbol.iterator](){return this}next(){let t=this._currentNode,e=t&&t.content&&t.content.type;if(null!==t&&(!this._firstCall||t.deleted||!this._filter(e)))do if(e=t.content.type,t.deleted||e.constructor!==eg&&e.constructor!==eu||null===e._start)for(;null!==t;){let e=t.next;if(null!==e){t=e;break}t=t.parent===this._root?null:t.parent._item}else t=e._start;while(null!==t&&(t.deleted||!this._filter(t.content.type)));return(this._firstCall=!1,null===t)?{value:void 0,done:!0}:(this._currentNode=t,{value:t.content.type,done:!1})}}class eu extends tW{constructor(){super(),this._prelimContent=[]}get firstChild(){let t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,e){super._integrate(t,e),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new eu}clone(){let t=new eu;return t.insert(0,this.toArray().map(t=>t instanceof tW?t.clone():t)),t}get length(){return this.doc??tN(),null===this._prelimContent?this._length:this._prelimContent.length}createTreeWalker(t){return new ea(this,t)}querySelector(t){t=t.toUpperCase();let e=new ea(this,e=>e.nodeName&&e.nodeName.toUpperCase()===t).next();return e.done?null:e.value}querySelectorAll(t){return t=t.toUpperCase(),i.HT(new ea(this,e=>e.nodeName&&e.nodeName.toUpperCase()===t))}_callObserver(t,e){tV(this,t,new ef(this,e,t))}toString(){return t$(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,e={},r){let n=t.createDocumentFragment();return void 0!==r&&r._createAssociation(n,this),tK(this,i=>{n.insertBefore(i.toDOM(t,e,r),null)}),n}insert(t,e){null!==this.doc?tm(this.doc,r=>{tP(r,this,t,e)}):this._prelimContent.splice(t,0,...e)}insertAfter(t,e){if(null!==this.doc)tm(this.doc,r=>{tq(r,this,t&&t instanceof tW?t._item:t,e)});else{let r=this._prelimContent,n=null===t?0:r.findIndex(e=>e===t)+1;if(0===n&&null!==t)throw u.vt("Reference item not found");r.splice(n,0,...e)}}delete(t,e=1){null!==this.doc?tm(this.doc,r=>{tQ(r,this,t,e)}):this._prelimContent.splice(t,e)}toArray(){return tH(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return tj(this,t)}slice(t=0,e=this.length){return tF(this,t,e)}forEach(t){tK(this,t)}_write(t){t.writeTypeRef(eR)}}class eg extends eu{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,e){super._integrate(t,e),this._prelimAttrs.forEach((t,e)=>{this.setAttribute(e,t)}),this._prelimAttrs=null}_copy(){return new eg(this.nodeName)}clone(){let t=new eg(this.nodeName),e=this.getAttributes();return m.jJ(e,(e,r)=>{t.setAttribute(r,e)}),t.insert(0,this.toArray().map(t=>t instanceof tW?t.clone():t)),t}toString(){let t=this.getAttributes(),e=[],r=[];for(let e in t)r.push(e);r.sort();let n=r.length;for(let i=0;i<n;i++){let n=r[i];e.push(n+'="'+t[n]+'"')}let i=this.nodeName.toLocaleLowerCase(),l=e.length>0?" "+e.join(" "):"";return`<${i}${l}>${super.toString()}</${i}>`}removeAttribute(t){null!==this.doc?tm(this.doc,e=>{tG(e,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,e){null!==this.doc?tm(this.doc,r=>{tB(r,this,t,e)}):this._prelimAttrs.set(t,e)}getAttribute(t){return tY(this,t)}hasAttribute(t){return tZ(this,t)}getAttributes(t){let e;return t?(e={},this._map.forEach((r,n)=>{let i=r;for(;null!==i&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;null!==i&&tr(i,t)&&(e[n]=i.content.getContent()[i.length-1])}),e):tX(this)}toDOM(t=document,e={},r){let n=t.createElement(this.nodeName),i=this.getAttributes();for(let t in i){let e=i[t];"string"==typeof e&&n.setAttribute(t,e)}return tK(this,i=>{n.appendChild(i.toDOM(t,e,r))}),void 0!==r&&r._createAssociation(n,this),n}_write(t){t.writeTypeRef(eN),t.writeKey(this.nodeName)}}class ef extends tL{constructor(t,e,r){super(t,r),this.childListChanged=!1,this.attributesChanged=new Set,e.forEach(t=>{null===t?this.childListChanged=!0:this.attributesChanged.add(t)})}}class ep extends t7{constructor(t){super(),this.hookName=t}_copy(){return new ep(this.hookName)}clone(){let t=new ep(this.hookName);return this.forEach((e,r)=>{t.set(r,e)}),t}toDOM(t=document,e={},r){let n,i=e[this.hookName];return(n=void 0!==i?i.createDom(this):document.createElement(this.hookName)).setAttribute("data-yjs-hook",this.hookName),void 0!==r&&r._createAssociation(n,this),n}_write(t){t.writeTypeRef(eT),t.writeKey(this.hookName)}}class ew extends ed{get nextSibling(){let t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){let t=this._item?this._item.prev:null;return t?t.content.type:null}_copy(){return new ew}clone(){let t=new ew;return t.applyDelta(this.toDelta()),t}toDOM(t=document,e,r){let n=t.createTextNode(this.toString());return void 0!==r&&r._createAssociation(n,this),n}toString(){return this.toDelta().map(t=>{let e=[];for(let r in t.attributes){let n=[];for(let e in t.attributes[r])n.push({key:e,value:t.attributes[r][e]});n.sort((t,e)=>t.key<e.key?-1:1),e.push({nodeName:r,attrs:n})}e.sort((t,e)=>t.nodeName<e.nodeName?-1:1);let r="";for(let t=0;t<e.length;t++){let n=e[t];r+=`<${n.nodeName}`;for(let t=0;t<n.attrs.length;t++){let e=n.attrs[t];r+=` ${e.key}="${e.value}"`}r+=">"}r+=t.insert;for(let t=e.length-1;t>=0;t--)r+=`</${e[t].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(t){t.writeTypeRef(ez)}}class e_{constructor(t,e){this.id=t,this.length=e}get deleted(){throw u.bD()}mergeWith(t){return!1}write(t,e,r){throw u.bD()}integrate(t,e){throw u.bD()}}class ek extends e_{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){e>0&&(this.id.clock+=e,this.length-=e),to(t.doc.store,this)}write(t,e){t.writeInfo(0),t.writeLen(this.length-e)}getMissing(t,e){return null}}class em{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new em(this.content)}splice(t){throw u.bD()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeBuf(this.content)}getRef(){return 3}}class eb{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new eb(this.len)}splice(t){let e=new eb(this.len-t);return this.len=t,e}mergeWith(t){return this.len+=t.len,!0}integrate(t,e){v(t.deleteSet,e.id.client,e.id.clock,this.len),e.markDeleted()}delete(t){}gc(t){}write(t,e){t.writeLen(this.len-e)}getRef(){return 1}}let ey=(t,e)=>new O({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class eD{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const e={};this.opts=e,t.gc||(e.gc=!1),t.autoLoad&&(e.autoLoad=!0),null!==t.meta&&(e.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new eD(ey(this.doc.guid,this.opts))}splice(t){throw u.bD()}mergeWith(t){return!1}integrate(t,e){this.doc._item=e,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,e){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}}class eS{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new eS(this.embed)}splice(t){throw u.bD()}mergeWith(t){return!1}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeJSON(this.embed)}getRef(){return 5}}class eC{constructor(t,e){this.key=t,this.value=e}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new eC(this.key,this.value)}splice(t){throw u.bD()}mergeWith(t){return!1}integrate(t,e){let r=e.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,e){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}}class eE{constructor(t){this.arr=t}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new eE(this.arr)}splice(t){let e=new eE(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let n=e;n<r;n++){let e=this.arr[n];t.writeString(void 0===e?"undefined":JSON.stringify(e))}}getRef(){return 2}}let ev="development"===b.dn("node_env");class eA{constructor(t){this.arr=t,ev&&m.ol(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new eA(this.arr)}splice(t){let e=new eA(this.arr.slice(t));return this.arr=this.arr.slice(0,t),e}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){let r=this.arr.length;t.writeLen(r-e);for(let n=e;n<r;n++){let e=this.arr[n];t.writeAny(e)}}getRef(){return 8}}class ex{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new ex(this.str)}splice(t){let e=new ex(this.str.slice(t));this.str=this.str.slice(0,t);let r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",e.str="�"+e.str.slice(1)),e}mergeWith(t){return this.str+=t.str,!0}integrate(t,e){}delete(t){}gc(t){}write(t,e){t.writeString(0===e?this.str:this.str.slice(e))}getRef(){return 4}}let eI=[t=>new t8,t=>new t7,t=>new ed,t=>new eg(t.readKey()),t=>new eu,t=>new ep(t.readKey()),t=>new ew],eM=0,eL=1,eO=2,eN=3,eR=4,eT=5,ez=6;class eJ{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new eJ(this.type._copy())}splice(t){throw u.bD()}mergeWith(t){return!1}integrate(t,e){this.type._integrate(t.doc,e)}delete(t){let e=this.type._start;for(;null!==e;)e.deleted?e.id.clock<(t.beforeState.get(e.id.client)||0)&&t._mergeStructs.push(e):e.delete(t),e=e.right;this.type._map.forEach(e=>{e.deleted?e.id.clock<(t.beforeState.get(e.id.client)||0)&&t._mergeStructs.push(e):e.delete(t)}),t.changed.delete(this.type)}gc(t){let e=this.type._start;for(;null!==e;)e.gc(t,!0),e=e.right;this.type._start=null,this.type._map.forEach(e=>{for(;null!==e;)e.gc(t,!0),e=e.left}),this.type._map=new Map}write(t,e){this.type._write(t)}getRef(){return 7}}let eU=(t,e)=>{for(;null!==t&&t.keep!==e;)t.keep=e,t=t.parent._item},eV=(t,e,r)=>{let{client:n,clock:i}=e.id,l=new eH(tt(n,i+r),e,tt(n,i+r-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(r));return e.deleted&&l.markDeleted(),e.keep&&(l.keep=!0),null!==e.redone&&(l.redone=tt(e.redone.client,e.redone.clock+r)),e.right=l,null!==l.right&&(l.right.left=l),t._mergeStructs.push(l),null!==l.parentSub&&null===l.right&&l.parent._map.set(l.parentSub,l),e.length=r,l},eW=(t,e)=>i.zN(t,t=>C(t.deletions,e)),eF=(t,e,r,n,i,l)=>{let s,o=t.doc,c=o.store,h=o.clientID,d=e.redone;if(null!==d)return ta(t,d);let a=e.parent._item,u=null;if(null!==a&&!0===a.deleted){if(null===a.redone&&(!r.has(a)||null===eF(t,a,r,n,i,l)))return null;for(;null!==a.redone;)a=ta(t,a.redone)}let g=null===a?e.parent:a.content.type;if(null===e.parentSub){for(u=e.left,s=e;null!==u;){let e=u;for(;null!==e&&e.parent._item!==a;)e=null===e.redone?null:ta(t,e.redone);if(null!==e&&e.parent._item===a){u=e;break}u=u.left}for(;null!==s;){let e=s;for(;null!==e&&e.parent._item!==a;)e=null===e.redone?null:ta(t,e.redone);if(null!==e&&e.parent._item===a){s=e;break}s=s.right}}else{if(s=null,e.right&&!i){for(u=e;null!==u&&null!==u.right&&(u.right.redone||C(n,u.right.id)||eW(l.undoStack,u.right.id)||eW(l.redoStack,u.right.id));)for(u=u.right;u.redone;)u=ta(t,u.redone);if(u&&null!==u.right)return null}else u=g._map.get(e.parentSub)||null;null!==u&&u.parent._item!==a&&(u=g._map.get(e.parentSub)||null)}let f=ts(c,h),p=tt(h,f),w=new eH(p,u,u&&u.lastId,s,s&&s.id,g,e.parentSub,e.content.copy());return e.redone=p,eU(w,!0),w.integrate(t,0),w};class eH extends e_{constructor(t,e,r,n,i,l,s,o){super(t,o.getLength()),this.origin=r,this.left=e,this.right=n,this.rightOrigin=i,this.parent=l,this.parentSub=s,this.redone=null,this.content=o,this.info=this.content.isCountable()?g.KD:0}set marker(t){(this.info&g.wn)>0!==t&&(this.info^=g.wn)}get marker(){return(this.info&g.wn)>0}get keep(){return(this.info&g.Dk)>0}set keep(t){this.keep!==t&&(this.info^=g.Dk)}get countable(){return(this.info&g.KD)>0}get deleted(){return(this.info&g.D1)>0}set deleted(t){this.deleted!==t&&(this.info^=g.D1)}markDeleted(){this.info|=g.D1}getMissing(t,e){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=ts(e,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=ts(e,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===X&&this.id.client!==this.parent.client&&this.parent.clock>=ts(e,this.parent.client))return this.parent.client;if(this.origin&&(this.left=tu(t,e,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=ta(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===ek||this.right&&this.right.constructor===ek)this.parent=null;else if(this.parent){if(this.parent.constructor===X){let t=th(e,this.parent);t.constructor===ek?this.parent=null:this.parent=t.content.type}}else this.left&&this.left.constructor===eH?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===eH&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);return null}integrate(t,e){if(e>0&&(this.id.clock+=e,this.left=tu(t,t.doc.store,tt(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(e),this.length-=e),this.parent){if(!this.left&&(!this.right||null!==this.right.left)||this.left&&this.left.right!==this.right){let e,r=this.left;if(null!==r)e=r.right;else if(null!==this.parentSub)for(e=this.parent._map.get(this.parentSub)||null;null!==e&&null!==e.left;)e=e.left;else e=this.parent._start;let n=new Set,i=new Set;for(;null!==e&&e!==this.right;){if(i.add(e),n.add(e),Z(this.origin,e.origin)){if(e.id.client<this.id.client)r=e,n.clear();else if(Z(this.rightOrigin,e.rightOrigin))break}else if(null!==e.origin&&i.has(th(t.doc.store,e.origin)))n.has(th(t.doc.store,e.origin))||(r=e,n.clear());else break;e=e.right}this.left=r}if(null!==this.left){let t=this.left.right;this.right=t,this.left.right=this}else{let t;if(null!==this.parentSub)for(t=this.parent._map.get(this.parentSub)||null;null!==t&&null!==t.left;)t=t.left;else t=this.parent._start,this.parent._start=this;this.right=t}null!==this.right?this.right.left=this:null!==this.parentSub&&(this.parent._map.set(this.parentSub,this),null!==this.left&&this.left.delete(t)),null===this.parentSub&&this.countable&&!this.deleted&&(this.parent._length+=this.length),to(t.doc.store,this),this.content.integrate(t,this),tw(t,this.parent,this.parentSub),(null!==this.parent._item&&this.parent._item.deleted||null!==this.parentSub&&null!==this.right)&&this.delete(t)}else new ek(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;null!==t&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;null!==t&&t.deleted;)t=t.left;return t}get lastId(){return 1===this.length?this.id:tt(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Z(t.origin,this.lastId)&&this.right===t&&Z(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&null===this.redone&&null===t.redone&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){let e=this.parent._searchMarker;return e&&e.forEach(e=>{e.p===t&&(e.p=this,!this.deleted&&this.countable&&(e.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,null!==this.right&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){let e=this.parent;this.countable&&null===this.parentSub&&(e._length-=this.length),this.markDeleted(),v(t.deleteSet,this.id.client,this.id.clock,this.length),tw(t,e,this.parentSub),this.content.delete(t)}}gc(t,e){if(!this.deleted)throw u.Mq();if(this.content.gc(t),e){var r;let e;r=new ek(this.id,this.length),(e=t.clients.get(this.id.client))[tc(e,this.id.clock)]=r}else this.content=new eb(this.length)}write(t,e){let r=e>0?tt(this.id.client,this.id.clock+e-1):this.origin,n=this.rightOrigin,i=this.parentSub,l=this.content.getRef()&g.WY|(null===r?0:g.wt)|(null===n?0:g.D7)|(null===i?0:g.KJ);if(t.writeInfo(l),null!==r&&t.writeLeftID(r),null!==n&&t.writeRightID(n),null===r&&null===n){let e=this.parent;if(void 0!==e._item){let r=e._item;if(null===r){let r=(t=>{for(let[e,r]of t.doc.share.entries())if(r===t)return e;throw u.Mq()})(e);t.writeParentInfo(!0),t.writeString(r)}else t.writeParentInfo(!1),t.writeLeftID(r.id)}else e.constructor===String?(t.writeParentInfo(!0),t.writeString(e)):e.constructor===X?(t.writeParentInfo(!1),t.writeLeftID(e)):u.Mq();null!==i&&t.writeString(i)}this.content.write(t,e)}}let eK=(t,e)=>e$[e&g.WY](t),e$=[()=>{u.Mq()},t=>new eb(t.readLen()),t=>{let e=t.readLen(),r=[];for(let n=0;n<e;n++){let e=t.readString();"undefined"===e?r.push(void 0):r.push(JSON.parse(e))}return new eE(r)},t=>new em(t.readBuf()),t=>new ex(t.readString()),t=>new eS(t.readJSON()),t=>new eC(t.readKey(),t.readJSON()),t=>new eJ(eI[t.readTypeRef()](t)),t=>{let e=t.readLen(),r=[];for(let n=0;n<e;n++)r.push(t.readAny());return new eA(r)},t=>new eD(ey(t.readString(),t.readAny())),()=>{u.Mq()}];class ej extends e_{get deleted(){return!0}delete(){}mergeWith(t){return this.constructor===t.constructor&&(this.length+=t.length,!0)}integrate(t,e){u.Mq()}write(t,e){t.writeInfo(10),o.zd(t.restEncoder,this.length-e)}getMissing(t,e){return null}}let eq="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:{},eP="__ $YJS$ __";!0===eq[eP]&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),eq[eP]=!0}}]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7331],{7331:(t,e,r)=>{r.d(e,{diagram:()=>tM});var o=r(94434),a=r(80650),i=r(86305),n=r(37325),s=r(56037),c=r(89851),d=r(88863),l=r(33948),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},$=n.UI.gitGraph,m=(0,c.K)(()=>(0,i.$t)({...$,...(0,n.zj)().gitGraph}),"getConfig"),g=new o.m(()=>{let t=m(),e=t.mainBranchName,r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}});function p(){return(0,i.yT)({length:7})}function y(t,e){let r=Object.create(null);return t.reduce((t,o)=>{let a=e(o);return r[a]||(r[a]=!0,t.push(o)),t},[])}(0,c.K)(p,"getID"),(0,c.K)(y,"uniqBy");var f=(0,c.K)(function(t){g.records.direction=t},"setDirection"),x=(0,c.K)(function(t){s.R.debug("options str",t),t=(t=t?.trim())||"{}";try{g.records.options=JSON.parse(t)}catch(t){s.R.error("error while parsing gitGraph options",t.message)}},"setOptions"),u=(0,c.K)(function(){return g.records.options},"getOptions"),b=(0,c.K)(function(t){let e=t.msg,r=t.id,o=t.type,a=t.tags;s.R.info("commit",e,r,o,a),s.R.debug("Entering commit:",e,r,o,a);let i=m();r=n.Y2.sanitizeText(r,i),e=n.Y2.sanitizeText(e,i),a=a?.map(t=>n.Y2.sanitizeText(t,i));let c={id:r||g.records.seq+"-"+p(),message:e,seq:g.records.seq++,type:o??h.NORMAL,tags:a??[],parents:null==g.records.head?[]:[g.records.head.id],branch:g.records.currBranch};g.records.head=c,s.R.info("main branch",i.mainBranchName),g.records.commits.has(c.id)&&s.R.warn(`Commit ID ${c.id} already exists`),g.records.commits.set(c.id,c),g.records.branches.set(g.records.currBranch,c.id),s.R.debug("in pushCommit "+c.id)},"commit"),k=(0,c.K)(function(t){let e=t.name,r=t.order;if(e=n.Y2.sanitizeText(e,m()),g.records.branches.has(e))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`);g.records.branches.set(e,null!=g.records.head?g.records.head.id:null),g.records.branchConfig.set(e,{name:e,order:r}),E(e),s.R.debug("in createBranch")},"branch"),B=(0,c.K)(t=>{let e=t.branch,r=t.id,o=t.type,a=t.tags,i=m();e=n.Y2.sanitizeText(e,i),r&&(r=n.Y2.sanitizeText(r,i));let c=g.records.branches.get(g.records.currBranch),d=g.records.branches.get(e),l=c?g.records.commits.get(c):void 0,$=d?g.records.commits.get(d):void 0;if(l&&$&&l.branch===e)throw Error(`Cannot merge branch '${e}' into itself.`);if(g.records.currBranch===e){let t=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(void 0===l||!l){let t=Error(`Incorrect usage of "merge". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},t}if(!g.records.branches.has(e)){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]},t}if(void 0===$||!$){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']},t}if(l===$){let t=Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(r&&g.records.commits.has(r)){let t=Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw t.hash={text:`merge ${e} ${r} ${o} ${a?.join(" ")}`,token:`merge ${e} ${r} ${o} ${a?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${o} ${a?.join(" ")}`]},t}let y={id:r||`${g.records.seq}-${p()}`,message:`merged branch ${e} into ${g.records.currBranch}`,seq:g.records.seq++,parents:null==g.records.head?[]:[g.records.head.id,d||""],branch:g.records.currBranch,type:h.MERGE,customType:o,customId:!!r,tags:a??[]};g.records.head=y,g.records.commits.set(y.id,y),g.records.branches.set(g.records.currBranch,y.id),s.R.debug(g.records.branches),s.R.debug("in mergeBranch")},"merge"),w=(0,c.K)(function(t){let e=t.id,r=t.targetId,o=t.tags,a=t.parent;s.R.debug("Entering cherryPick:",e,r,o);let i=m();if(e=n.Y2.sanitizeText(e,i),r=n.Y2.sanitizeText(r,i),o=o?.map(t=>n.Y2.sanitizeText(t,i)),a=n.Y2.sanitizeText(a,i),!e||!g.records.commits.has(e)){let t=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let c=g.records.commits.get(e);if(void 0===c||!c)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(a&&!(Array.isArray(c.parents)&&c.parents.includes(a)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let d=c.branch;if(c.type===h.MERGE&&!a)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!g.records.commits.has(r)){if(d===g.records.currBranch){let t=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let t=g.records.branches.get(g.records.currBranch);if(void 0===t||!t){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let i=g.records.commits.get(t);if(void 0===i||!i){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let n={id:g.records.seq+"-"+p(),message:`cherry-picked ${c?.message} into ${g.records.currBranch}`,seq:g.records.seq++,parents:null==g.records.head?[]:[g.records.head.id,c.id],branch:g.records.currBranch,type:h.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${c.id}${c.type===h.MERGE?`|parent:${a}`:""}`]};g.records.head=n,g.records.commits.set(n.id,n),g.records.branches.set(g.records.currBranch,n.id),s.R.debug(g.records.branches),s.R.debug("in cherryPick")}},"cherryPick"),E=(0,c.K)(function(t){if(t=n.Y2.sanitizeText(t,m()),g.records.branches.has(t)){g.records.currBranch=t;let e=g.records.branches.get(g.records.currBranch);void 0!==e&&e?g.records.head=g.records.commits.get(e)??null:g.records.head=null}else{let e=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},e}},"checkout");function T(t,e,r){let o=t.indexOf(e);-1===o?t.push(r):t.splice(o,1,r)}function C(t){let e=t.reduce((t,e)=>t.seq>e.seq?t:e,t[0]),r="";t.forEach(function(t){t===e?r+=" *":r+=" |"});let o=[r,e.id,e.seq];for(let t in g.records.branches)g.records.branches.get(t)===e.id&&o.push(t);if(s.R.debug(o.join(" ")),e.parents&&2==e.parents.length&&e.parents[0]&&e.parents[1]){let r=g.records.commits.get(e.parents[0]);T(t,e,r),e.parents[1]&&t.push(g.records.commits.get(e.parents[1]))}else if(0==e.parents.length)return;else if(e.parents[0]){let r=g.records.commits.get(e.parents[0]);T(t,e,r)}C(t=y(t,t=>t.id))}(0,c.K)(T,"upsert"),(0,c.K)(C,"prettyPrintCommitHistory");var L=(0,c.K)(function(){s.R.debug(g.records.commits),C([I()[0]])},"prettyPrint"),K=(0,c.K)(function(){g.reset(),(0,n.IU)()},"clear"),M=(0,c.K)(function(){return[...g.records.branchConfig.values()].map((t,e)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${e}`)}).sort((t,e)=>(t.order??0)-(e.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),R=(0,c.K)(function(){return g.records.branches},"getBranches"),v=(0,c.K)(function(){return g.records.commits},"getCommits"),I=(0,c.K)(function(){let t=[...g.records.commits.values()];return t.forEach(function(t){s.R.debug(t.id)}),t.sort((t,e)=>t.seq-e.seq),t},"getCommitsArray"),P={commitType:h,getConfig:m,setDirection:f,setOptions:x,getOptions:u,commit:b,branch:k,merge:B,cherryPick:w,checkout:E,prettyPrint:L,clear:K,getBranchesAsObjArray:M,getBranches:R,getCommits:v,getCommitsArray:I,getCurrentBranch:(0,c.K)(function(){return g.records.currBranch},"getCurrentBranch"),getDirection:(0,c.K)(function(){return g.records.direction},"getDirection"),getHead:(0,c.K)(function(){return g.records.head},"getHead"),setAccTitle:n.SV,getAccTitle:n.iN,getAccDescription:n.m7,setAccDescription:n.EI,setDiagramTitle:n.ke,getDiagramTitle:n.ab},O=(0,c.K)((t,e)=>{for(let r of((0,a.S)(t,e),t.dir&&e.setDirection(t.dir),t.statements))A(r,e)},"populate"),A=(0,c.K)((t,e)=>{let r={Commit:(0,c.K)(t=>e.commit(G(t)),"Commit"),Branch:(0,c.K)(t=>e.branch(S(t)),"Branch"),Merge:(0,c.K)(t=>e.merge(H(t)),"Merge"),Checkout:(0,c.K)(t=>e.checkout(D(t)),"Checkout"),CherryPicking:(0,c.K)(t=>e.cherryPick(W(t)),"CherryPicking")}[t.$type];r?r(t):s.R.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),G=(0,c.K)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0}),"parseCommit"),S=(0,c.K)(t=>({name:t.name,order:t.order??0}),"parseBranch"),H=(0,c.K)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),D=(0,c.K)(t=>t.branch,"parseCheckout"),W=(0,c.K)(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),q={parse:(0,c.K)(async t=>{let e=await (0,d.qg)("gitGraph",t);s.R.debug(e),O(e,P)},"parse")},_=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),z=new Set(["redux-color","redux-dark-color"]),Y=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N=(0,c.K)((t,e,r=!1)=>r&&t>0?(t-1)%(e-1)+1:t%e,"calcColorIndex"),j=new Map,F=new Map,U=new Map,V=[],J=0,Q="LR",X=(0,c.K)(()=>{j.clear(),F.clear(),U.clear(),J=0,V=[],Q="LR"},"clear"),Z=(0,c.K)(t=>{let e=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(t=>{let r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),r.setAttribute("class","row"),r.textContent=t.trim(),e.appendChild(r)}),e},"drawText"),tt=(0,c.K)(t=>{let e,r,o;return"BT"===Q?(r=(0,c.K)((t,e)=>t<=e,"comparisonFunc"),o=1/0):(r=(0,c.K)((t,e)=>t>=e,"comparisonFunc"),o=0),t.forEach(t=>{let a="TB"===Q||"BT"==Q?F.get(t)?.y:F.get(t)?.x;void 0!==a&&r(a,o)&&(e=t,o=a)}),e},"findClosestParent"),te=(0,c.K)(t=>{let e="",r=1/0;return t.forEach(t=>{let o=F.get(t).y;o<=r&&(e=t,r=o)}),e||void 0},"findClosestParentBT"),tr=(0,c.K)((t,e,r)=>{let o=r,a=r,i=[];t.forEach(t=>{let r=e.get(t);if(!r)throw Error(`Commit not found for key ${t}`);r.parents.length?a=Math.max(o=ta(r),a):i.push(r),ti(r,o)}),o=a,i.forEach(t=>{tn(t,o,r)}),t.forEach(t=>{let r=e.get(t);if(r?.parents.length){let t=te(r.parents);(o=F.get(t).y-40)<=a&&(a=o);let e=j.get(r.branch).pos,i=o-10;F.set(r.id,{x:e,y:i})}})},"setParallelBTPos"),to=(0,c.K)(t=>{let e=tt(t.parents.filter(t=>null!==t));if(!e)throw Error(`Closest parent not found for commit ${t.id}`);let r=F.get(e)?.y;if(void 0===r)throw Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),ta=(0,c.K)(t=>to(t)+40,"calculateCommitPosition"),ti=(0,c.K)((t,e)=>{let r=j.get(t.branch);if(!r)throw Error(`Branch not found for commit ${t.id}`);let o=r.pos,a=e+10;return F.set(t.id,{x:o,y:a}),{x:o,y:a}},"setCommitPosition"),tn=(0,c.K)((t,e,r)=>{let o=j.get(t.branch);if(!o)throw Error(`Branch not found for commit ${t.id}`);let a=o.pos;F.set(t.id,{x:a,y:e+r})},"setRootPosition"),ts=(0,c.K)((t,e,r,o,a,i)=>{let{theme:s}=(0,n.D7)(),c=_.has(s??""),d=z.has(s??""),l=Y.has(s??"");if(i===h.HIGHLIGHT)t.append("rect").attr("x",r.x-10+3*!!c).attr("y",r.y-10+3*!!c).attr("width",c?14:20).attr("height",c?14:20).attr("class",`commit ${e.id} commit-highlight${N(a,8,d)} ${o}-outer`),t.append("rect").attr("x",r.x-6+2*!!c).attr("y",r.y-6+2*!!c).attr("width",c?8:12).attr("height",c?8:12).attr("class",`commit ${e.id} commit${N(a,8,d)} ${o}-inner`);else if(i===h.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",c?7:10).attr("class",`commit ${e.id} ${o}`),t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",c?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",c?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`);else{let n=t.append("circle");if(n.attr("cx",r.x),n.attr("cy",r.y),n.attr("r",c?7:10),n.attr("class",`commit ${e.id} commit${N(a,8,d)}`),i===h.MERGE){let i=t.append("circle");i.attr("cx",r.x),i.attr("cy",r.y),i.attr("r",c?5:6),i.attr("class",`commit ${o} ${e.id} commit${N(a,8,d)}`)}if(i===h.REVERSE){let i=t.append("path"),n=c?4:5;i.attr("d",`M ${r.x-n},${r.y-n}L${r.x+n},${r.y+n}M${r.x-n},${r.y+n}L${r.x+n},${r.y-n}`).attr("class",`commit ${o} ${e.id} commit${N(a,8,d)}`)}}},"drawCommitBullet"),tc=(0,c.K)((t,e,r,o,a)=>{if(e.type!==h.CHERRY_PICK&&(e.customId&&e.type===h.MERGE||e.type!==h.MERGE)&&a.showCommitLabel){let i=t.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),s=i.append("text").attr("x",o).attr("y",r.y+25).attr("class","commit-label").text(e.id),c=s.node()?.getBBox();if(c&&(n.attr("x",r.posWithOffset-c.width/2-2).attr("y",r.y+13.5).attr("width",c.width+4).attr("height",c.height+4),"TB"===Q||"BT"===Q?(n.attr("x",r.x-(c.width+16+5)).attr("y",r.y-12),s.attr("x",r.x-(c.width+16)).attr("y",r.y+c.height-12)):s.attr("x",r.posWithOffset-c.width/2),a.rotateCommitLabel))if("TB"===Q||"BT"===Q)s.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),n.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let t=-7.5-(c.width+10)/25*9.5,e=10+c.width/25*8.5;i.attr("transform","translate("+t+", "+e+") rotate(-45, "+o+", "+r.y+")")}}},"drawCommitLabel"),td=(0,c.K)((t,e,r,o)=>{if(e.tags.length>0){let a=0,i=0,n=0,s=[];for(let o of e.tags.reverse()){let e=t.insert("polygon"),c=t.append("circle"),d=t.append("text").attr("y",r.y-16-a).attr("class","tag-label").text(o),l=d.node()?.getBBox();if(!l)throw Error("Tag bbox not found");i=Math.max(i,l.width),n=Math.max(n,l.height),d.attr("x",r.posWithOffset-l.width/2),s.push({tag:d,hole:c,rect:e,yOffset:a}),a+=20}for(let{tag:t,hole:e,rect:a,yOffset:c}of s){let s=n/2,d=r.y-19.2-c;if(a.attr("class","tag-label-bkg").attr("points",`
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7331],{7331:(t,e,r)=>{r.d(e,{diagram:()=>tM});var o=r(94434),a=r(80650),i=r(86305),n=r(37325),s=r(56037),c=r(89851),d=r(88863),l=r(32054),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},$=n.UI.gitGraph,m=(0,c.K)(()=>(0,i.$t)({...$,...(0,n.zj)().gitGraph}),"getConfig"),g=new o.m(()=>{let t=m(),e=t.mainBranchName,r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}});function p(){return(0,i.yT)({length:7})}function y(t,e){let r=Object.create(null);return t.reduce((t,o)=>{let a=e(o);return r[a]||(r[a]=!0,t.push(o)),t},[])}(0,c.K)(p,"getID"),(0,c.K)(y,"uniqBy");var f=(0,c.K)(function(t){g.records.direction=t},"setDirection"),x=(0,c.K)(function(t){s.R.debug("options str",t),t=(t=t?.trim())||"{}";try{g.records.options=JSON.parse(t)}catch(t){s.R.error("error while parsing gitGraph options",t.message)}},"setOptions"),u=(0,c.K)(function(){return g.records.options},"getOptions"),b=(0,c.K)(function(t){let e=t.msg,r=t.id,o=t.type,a=t.tags;s.R.info("commit",e,r,o,a),s.R.debug("Entering commit:",e,r,o,a);let i=m();r=n.Y2.sanitizeText(r,i),e=n.Y2.sanitizeText(e,i),a=a?.map(t=>n.Y2.sanitizeText(t,i));let c={id:r||g.records.seq+"-"+p(),message:e,seq:g.records.seq++,type:o??h.NORMAL,tags:a??[],parents:null==g.records.head?[]:[g.records.head.id],branch:g.records.currBranch};g.records.head=c,s.R.info("main branch",i.mainBranchName),g.records.commits.has(c.id)&&s.R.warn(`Commit ID ${c.id} already exists`),g.records.commits.set(c.id,c),g.records.branches.set(g.records.currBranch,c.id),s.R.debug("in pushCommit "+c.id)},"commit"),k=(0,c.K)(function(t){let e=t.name,r=t.order;if(e=n.Y2.sanitizeText(e,m()),g.records.branches.has(e))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`);g.records.branches.set(e,null!=g.records.head?g.records.head.id:null),g.records.branchConfig.set(e,{name:e,order:r}),E(e),s.R.debug("in createBranch")},"branch"),B=(0,c.K)(t=>{let e=t.branch,r=t.id,o=t.type,a=t.tags,i=m();e=n.Y2.sanitizeText(e,i),r&&(r=n.Y2.sanitizeText(r,i));let c=g.records.branches.get(g.records.currBranch),d=g.records.branches.get(e),l=c?g.records.commits.get(c):void 0,$=d?g.records.commits.get(d):void 0;if(l&&$&&l.branch===e)throw Error(`Cannot merge branch '${e}' into itself.`);if(g.records.currBranch===e){let t=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(void 0===l||!l){let t=Error(`Incorrect usage of "merge". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},t}if(!g.records.branches.has(e)){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]},t}if(void 0===$||!$){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']},t}if(l===$){let t=Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(r&&g.records.commits.has(r)){let t=Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw t.hash={text:`merge ${e} ${r} ${o} ${a?.join(" ")}`,token:`merge ${e} ${r} ${o} ${a?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${o} ${a?.join(" ")}`]},t}let y={id:r||`${g.records.seq}-${p()}`,message:`merged branch ${e} into ${g.records.currBranch}`,seq:g.records.seq++,parents:null==g.records.head?[]:[g.records.head.id,d||""],branch:g.records.currBranch,type:h.MERGE,customType:o,customId:!!r,tags:a??[]};g.records.head=y,g.records.commits.set(y.id,y),g.records.branches.set(g.records.currBranch,y.id),s.R.debug(g.records.branches),s.R.debug("in mergeBranch")},"merge"),w=(0,c.K)(function(t){let e=t.id,r=t.targetId,o=t.tags,a=t.parent;s.R.debug("Entering cherryPick:",e,r,o);let i=m();if(e=n.Y2.sanitizeText(e,i),r=n.Y2.sanitizeText(r,i),o=o?.map(t=>n.Y2.sanitizeText(t,i)),a=n.Y2.sanitizeText(a,i),!e||!g.records.commits.has(e)){let t=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let c=g.records.commits.get(e);if(void 0===c||!c)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(a&&!(Array.isArray(c.parents)&&c.parents.includes(a)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let d=c.branch;if(c.type===h.MERGE&&!a)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!g.records.commits.has(r)){if(d===g.records.currBranch){let t=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let t=g.records.branches.get(g.records.currBranch);if(void 0===t||!t){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let i=g.records.commits.get(t);if(void 0===i||!i){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let n={id:g.records.seq+"-"+p(),message:`cherry-picked ${c?.message} into ${g.records.currBranch}`,seq:g.records.seq++,parents:null==g.records.head?[]:[g.records.head.id,c.id],branch:g.records.currBranch,type:h.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${c.id}${c.type===h.MERGE?`|parent:${a}`:""}`]};g.records.head=n,g.records.commits.set(n.id,n),g.records.branches.set(g.records.currBranch,n.id),s.R.debug(g.records.branches),s.R.debug("in cherryPick")}},"cherryPick"),E=(0,c.K)(function(t){if(t=n.Y2.sanitizeText(t,m()),g.records.branches.has(t)){g.records.currBranch=t;let e=g.records.branches.get(g.records.currBranch);void 0!==e&&e?g.records.head=g.records.commits.get(e)??null:g.records.head=null}else{let e=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},e}},"checkout");function T(t,e,r){let o=t.indexOf(e);-1===o?t.push(r):t.splice(o,1,r)}function C(t){let e=t.reduce((t,e)=>t.seq>e.seq?t:e,t[0]),r="";t.forEach(function(t){t===e?r+=" *":r+=" |"});let o=[r,e.id,e.seq];for(let t in g.records.branches)g.records.branches.get(t)===e.id&&o.push(t);if(s.R.debug(o.join(" ")),e.parents&&2==e.parents.length&&e.parents[0]&&e.parents[1]){let r=g.records.commits.get(e.parents[0]);T(t,e,r),e.parents[1]&&t.push(g.records.commits.get(e.parents[1]))}else if(0==e.parents.length)return;else if(e.parents[0]){let r=g.records.commits.get(e.parents[0]);T(t,e,r)}C(t=y(t,t=>t.id))}(0,c.K)(T,"upsert"),(0,c.K)(C,"prettyPrintCommitHistory");var L=(0,c.K)(function(){s.R.debug(g.records.commits),C([I()[0]])},"prettyPrint"),K=(0,c.K)(function(){g.reset(),(0,n.IU)()},"clear"),M=(0,c.K)(function(){return[...g.records.branchConfig.values()].map((t,e)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${e}`)}).sort((t,e)=>(t.order??0)-(e.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),R=(0,c.K)(function(){return g.records.branches},"getBranches"),v=(0,c.K)(function(){return g.records.commits},"getCommits"),I=(0,c.K)(function(){let t=[...g.records.commits.values()];return t.forEach(function(t){s.R.debug(t.id)}),t.sort((t,e)=>t.seq-e.seq),t},"getCommitsArray"),P={commitType:h,getConfig:m,setDirection:f,setOptions:x,getOptions:u,commit:b,branch:k,merge:B,cherryPick:w,checkout:E,prettyPrint:L,clear:K,getBranchesAsObjArray:M,getBranches:R,getCommits:v,getCommitsArray:I,getCurrentBranch:(0,c.K)(function(){return g.records.currBranch},"getCurrentBranch"),getDirection:(0,c.K)(function(){return g.records.direction},"getDirection"),getHead:(0,c.K)(function(){return g.records.head},"getHead"),setAccTitle:n.SV,getAccTitle:n.iN,getAccDescription:n.m7,setAccDescription:n.EI,setDiagramTitle:n.ke,getDiagramTitle:n.ab},O=(0,c.K)((t,e)=>{for(let r of((0,a.S)(t,e),t.dir&&e.setDirection(t.dir),t.statements))A(r,e)},"populate"),A=(0,c.K)((t,e)=>{let r={Commit:(0,c.K)(t=>e.commit(G(t)),"Commit"),Branch:(0,c.K)(t=>e.branch(S(t)),"Branch"),Merge:(0,c.K)(t=>e.merge(H(t)),"Merge"),Checkout:(0,c.K)(t=>e.checkout(D(t)),"Checkout"),CherryPicking:(0,c.K)(t=>e.cherryPick(W(t)),"CherryPicking")}[t.$type];r?r(t):s.R.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),G=(0,c.K)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0}),"parseCommit"),S=(0,c.K)(t=>({name:t.name,order:t.order??0}),"parseBranch"),H=(0,c.K)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),D=(0,c.K)(t=>t.branch,"parseCheckout"),W=(0,c.K)(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),q={parse:(0,c.K)(async t=>{let e=await (0,d.qg)("gitGraph",t);s.R.debug(e),O(e,P)},"parse")},_=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),z=new Set(["redux-color","redux-dark-color"]),Y=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N=(0,c.K)((t,e,r=!1)=>r&&t>0?(t-1)%(e-1)+1:t%e,"calcColorIndex"),j=new Map,F=new Map,U=new Map,V=[],J=0,Q="LR",X=(0,c.K)(()=>{j.clear(),F.clear(),U.clear(),J=0,V=[],Q="LR"},"clear"),Z=(0,c.K)(t=>{let e=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(t=>{let r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),r.setAttribute("class","row"),r.textContent=t.trim(),e.appendChild(r)}),e},"drawText"),tt=(0,c.K)(t=>{let e,r,o;return"BT"===Q?(r=(0,c.K)((t,e)=>t<=e,"comparisonFunc"),o=1/0):(r=(0,c.K)((t,e)=>t>=e,"comparisonFunc"),o=0),t.forEach(t=>{let a="TB"===Q||"BT"==Q?F.get(t)?.y:F.get(t)?.x;void 0!==a&&r(a,o)&&(e=t,o=a)}),e},"findClosestParent"),te=(0,c.K)(t=>{let e="",r=1/0;return t.forEach(t=>{let o=F.get(t).y;o<=r&&(e=t,r=o)}),e||void 0},"findClosestParentBT"),tr=(0,c.K)((t,e,r)=>{let o=r,a=r,i=[];t.forEach(t=>{let r=e.get(t);if(!r)throw Error(`Commit not found for key ${t}`);r.parents.length?a=Math.max(o=ta(r),a):i.push(r),ti(r,o)}),o=a,i.forEach(t=>{tn(t,o,r)}),t.forEach(t=>{let r=e.get(t);if(r?.parents.length){let t=te(r.parents);(o=F.get(t).y-40)<=a&&(a=o);let e=j.get(r.branch).pos,i=o-10;F.set(r.id,{x:e,y:i})}})},"setParallelBTPos"),to=(0,c.K)(t=>{let e=tt(t.parents.filter(t=>null!==t));if(!e)throw Error(`Closest parent not found for commit ${t.id}`);let r=F.get(e)?.y;if(void 0===r)throw Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),ta=(0,c.K)(t=>to(t)+40,"calculateCommitPosition"),ti=(0,c.K)((t,e)=>{let r=j.get(t.branch);if(!r)throw Error(`Branch not found for commit ${t.id}`);let o=r.pos,a=e+10;return F.set(t.id,{x:o,y:a}),{x:o,y:a}},"setCommitPosition"),tn=(0,c.K)((t,e,r)=>{let o=j.get(t.branch);if(!o)throw Error(`Branch not found for commit ${t.id}`);let a=o.pos;F.set(t.id,{x:a,y:e+r})},"setRootPosition"),ts=(0,c.K)((t,e,r,o,a,i)=>{let{theme:s}=(0,n.D7)(),c=_.has(s??""),d=z.has(s??""),l=Y.has(s??"");if(i===h.HIGHLIGHT)t.append("rect").attr("x",r.x-10+3*!!c).attr("y",r.y-10+3*!!c).attr("width",c?14:20).attr("height",c?14:20).attr("class",`commit ${e.id} commit-highlight${N(a,8,d)} ${o}-outer`),t.append("rect").attr("x",r.x-6+2*!!c).attr("y",r.y-6+2*!!c).attr("width",c?8:12).attr("height",c?8:12).attr("class",`commit ${e.id} commit${N(a,8,d)} ${o}-inner`);else if(i===h.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",c?7:10).attr("class",`commit ${e.id} ${o}`),t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",c?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",c?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`),t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${e.id} ${o}`);else{let n=t.append("circle");if(n.attr("cx",r.x),n.attr("cy",r.y),n.attr("r",c?7:10),n.attr("class",`commit ${e.id} commit${N(a,8,d)}`),i===h.MERGE){let i=t.append("circle");i.attr("cx",r.x),i.attr("cy",r.y),i.attr("r",c?5:6),i.attr("class",`commit ${o} ${e.id} commit${N(a,8,d)}`)}if(i===h.REVERSE){let i=t.append("path"),n=c?4:5;i.attr("d",`M ${r.x-n},${r.y-n}L${r.x+n},${r.y+n}M${r.x-n},${r.y+n}L${r.x+n},${r.y-n}`).attr("class",`commit ${o} ${e.id} commit${N(a,8,d)}`)}}},"drawCommitBullet"),tc=(0,c.K)((t,e,r,o,a)=>{if(e.type!==h.CHERRY_PICK&&(e.customId&&e.type===h.MERGE||e.type!==h.MERGE)&&a.showCommitLabel){let i=t.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),s=i.append("text").attr("x",o).attr("y",r.y+25).attr("class","commit-label").text(e.id),c=s.node()?.getBBox();if(c&&(n.attr("x",r.posWithOffset-c.width/2-2).attr("y",r.y+13.5).attr("width",c.width+4).attr("height",c.height+4),"TB"===Q||"BT"===Q?(n.attr("x",r.x-(c.width+16+5)).attr("y",r.y-12),s.attr("x",r.x-(c.width+16)).attr("y",r.y+c.height-12)):s.attr("x",r.posWithOffset-c.width/2),a.rotateCommitLabel))if("TB"===Q||"BT"===Q)s.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),n.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let t=-7.5-(c.width+10)/25*9.5,e=10+c.width/25*8.5;i.attr("transform","translate("+t+", "+e+") rotate(-45, "+o+", "+r.y+")")}}},"drawCommitLabel"),td=(0,c.K)((t,e,r,o)=>{if(e.tags.length>0){let a=0,i=0,n=0,s=[];for(let o of e.tags.reverse()){let e=t.insert("polygon"),c=t.append("circle"),d=t.append("text").attr("y",r.y-16-a).attr("class","tag-label").text(o),l=d.node()?.getBBox();if(!l)throw Error("Tag bbox not found");i=Math.max(i,l.width),n=Math.max(n,l.height),d.attr("x",r.posWithOffset-l.width/2),s.push({tag:d,hole:c,rect:e,yOffset:a}),a+=20}for(let{tag:t,hole:e,rect:a,yOffset:c}of s){let s=n/2,d=r.y-19.2-c;if(a.attr("class","tag-label-bkg").attr("points",`
|
|
2
2
|
${o-i/2-2},${d+2}
|
|
3
3
|
${o-i/2-2},${d-2}
|
|
4
4
|
${r.posWithOffset-i/2-4},${d-s-2}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[752],{24456:(e,t,r)=>{r.d(t,{l:()=>c});var n=r(95155),i=r(12115),a=r(12669);let s=null,o=null,l=null;function d(e){s?.(e),s=null,l?.unmount(),o?.remove(),l=null,o=null}function c(e){return new Promise(t=>{s&&d(!1),s=t;let r=o;r||(r=document.createElement("div"),document.body.appendChild(r),o=r);let i=l;i||(l=i=(0,a.createRoot)(r)),i.render((0,n.jsx)(u,{opts:e,onClose:d}))})}function u({opts:e,onClose:t}){let[r]=(0,i.useState)(!1);return(0,n.jsx)("div",{role:"alertdialog","aria-modal":"true",onPointerDown:()=>t(!1),style:{position:"fixed",inset:0,zIndex:2e3,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.35)"},children:(0,n.jsxs)("div",{onPointerDown:e=>e.stopPropagation(),style:{width:360,maxWidth:"calc(100vw - 48px)",borderRadius:"var(--bubble-radius, 14px)",background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 10px 40px -12px rgba(0,0,0,0.4)",color:"var(--text)",padding:"16px 18px",display:"flex",flexDirection:"column",gap:10},children:[e.title&&(0,n.jsx)("div",{style:{fontSize:14,fontWeight:600},children:e.title}),(0,n.jsx)("div",{style:{fontSize:12.5,lineHeight:1.6,color:"var(--text-muted)",whiteSpace:"pre-wrap"},children:e.message}),(0,n.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:6},children:[(0,n.jsx)("button",{type:"button",onClick:()=>t(!1),style:{border:"none",background:"color-mix(in srgb, var(--border) 30%, transparent)",color:"var(--text-muted)",borderRadius:6,padding:"5px 14px",fontSize:12,cursor:"pointer"},children:e.cancelText??"取消"}),(0,n.jsx)("button",{type:"button",disabled:r,onClick:()=>t(!0),style:{border:"none",background:!1===e.danger?"var(--accent)":"color-mix(in srgb, #ef4444 85%, transparent)",color:"#fff",borderRadius:6,padding:"5px 14px",fontSize:12,fontWeight:600,cursor:"pointer"},children:e.confirmText??"删除"})]})]})})}},56314:(e,t,r)=>{r.d(t,{Lv:()=>a,Nc:()=>i,ZY:()=>s});var n=r(12115);let i=(0,n.createContext)(null);function a(){return(0,n.useContext)(i)?.boardId??null}function s(){return(0,n.useContext)(i)?.defaultCwd??null}},60752:(e,t,r)=>{r.r(t),r.d(t,{SessionCanvas:()=>I});var n=r(95155),i=r(12115),a=r(37206),s=r(81750),o=r(96793),l=r(39247),d=r(64536),c=r(71309),u=r(34229),p=r(84876),h=r(56314),x=r(24456);function g({editor:e,inputRef:t,nodes:r}){let{t:a}=(0,l.s)(),{setHighlight:o}=(0,c.kz)(),{setViewport:d,getViewport:u,getNodes:p}=(0,s.VH)(),[h,x]=(0,i.useState)(""),[f,b]=(0,i.useState)(!1),[v,y]=(0,i.useState)(-1),m=(0,i.useRef)(null),k=t??m,w=(0,i.useMemo)(()=>{let e=r??p(),t=[];for(let r of e)if("session-card"===r.type){let e=String(r.data.title??"").trim();e&&t.push({nodeId:r.id,kind:"session-card",text:e})}else if("sticky-note"===r.type||"text"===r.type){let e=String(r.data.text??"").trim();e&&t.push({nodeId:r.id,kind:"sticky-note",text:e})}return t},[r,p]),j=(0,i.useMemo)(()=>{let e=h.trim().toLowerCase().split(/\s+/).filter(Boolean);return 0===e.length?[]:w.filter(t=>{let r=t.text.toLowerCase();return e.every(e=>r.includes(e))}).map(t=>({item:t,snippet:function(e,t,r=44){let n=t.trim().toLowerCase(),i=e.toLowerCase().indexOf(n);if(i<0)return e.length>r?`${e.slice(0,r)}…`:e;let a=Math.max(0,i-Math.floor((r-n.length)/2)),s=Math.min(e.length,a+r),o=a>0?"…":"",l=s<e.length?"…":"";return`${o}${e.slice(a,s)}${l}`}(t.text,e[0])}))},[w,h]),S=(0,i.useCallback)(e=>{let t=j[e];if(!t)return;let r=p().find(e=>e.id===t.item.nodeId);if(!r)return;let n=r.measured?.width??340,i=r.measured?.height??160,a=r.position.x+n/2,s=r.position.y+i/2,l=u();d({x:-a*l.zoom+window.innerWidth/2,y:-s*l.zoom+window.innerHeight/2,zoom:l.zoom},{duration:300}),o(t.item.nodeId),y(e)},[j,p,u,d,o]),C=(0,i.useCallback)(()=>{0!==j.length&&S((v+1)%j.length)},[j,v,S]),I=(0,i.useCallback)(()=>{0!==j.length&&S((v-1+j.length)%j.length)},[j,v,S]),z=(0,i.useCallback)(e=>{"Enter"===e.key||"ArrowDown"===e.key?(e.preventDefault(),C()):"ArrowUp"===e.key?(e.preventDefault(),I()):"Escape"===e.key&&(e.preventDefault(),f?b(!1):(x(""),y(-1),k.current?.blur()))},[f,C,I,k]),R=f&&h.trim().length>0;return(0,n.jsxs)("div",{style:{position:"relative",width:280},"data-testid":"board-search",children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,height:34,padding:"0 8px 0 10px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)"},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--text-dim)",flexShrink:0},children:[(0,n.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,n.jsx)("path",{d:"m21 21-4.35-4.35"})]}),(0,n.jsx)("input",{ref:k,value:h,onChange:e=>{x(e.target.value),y(-1),b(!0)},onKeyDown:z,onFocus:()=>{h.trim()&&b(!0)},onBlur:()=>b(!1),onPointerDown:e=>e.stopPropagation(),placeholder:a("boards.searchPlaceholder"),spellCheck:!1,"aria-label":a("boards.searchPlaceholder"),style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text)",fontSize:12.5,fontFamily:"inherit"}}),h&&(0,n.jsx)("button",{type:"button",title:a("common.close"),onPointerDown:e=>e.stopPropagation(),onClick:()=>{x(""),y(-1),k.current?.focus()},style:{flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",width:18,height:18,padding:0,border:"none",borderRadius:"50%",background:"color-mix(in srgb, var(--border) 35%, transparent)",color:"var(--text-muted)",cursor:"pointer",fontSize:11,lineHeight:1},children:"\xd7"})]}),R&&(0,n.jsx)("div",{"data-testid":"board-search-dropdown",onPointerDown:e=>e.stopPropagation(),style:{position:"absolute",top:40,left:0,right:0,zIndex:60,maxHeight:320,overflowY:"auto",borderRadius:12,padding:4,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 4px 18px -6px rgba(0,0,0,0.28)"},children:0===j.length?(0,n.jsx)("div",{style:{padding:"8px 12px",fontSize:12,color:"var(--text-muted)"},children:a("boards.searchNoResults")}):j.map((e,t)=>{let r=t===v;return(0,n.jsxs)("button",{type:"button",onMouseDown:e=>e.preventDefault(),onClick:()=>S(t),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",border:"none",borderRadius:8,background:r?"color-mix(in srgb, var(--accent) 14%, transparent)":"transparent",color:"var(--text)",fontSize:12.5,textAlign:"left",cursor:"pointer"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,display:"inline-flex",color:r?"var(--accent)":"var(--text-dim)"},children:"session-card"===e.item.kind?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3z"}),(0,n.jsx)("path",{d:"M15 3v6h6"})]})}),(0,n.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.snippet}),(0,n.jsx)("span",{style:{flexShrink:0,fontSize:10,color:"var(--text-dim)"},children:"session-card"===e.item.kind?a("boards.searchSession"):a("boards.searchNote")})]},e.item.nodeId)})})]})}let f=new Set(["waiting_model","running_tools","running_command"]);function b({boardName:e,isTaskBoard:t,reloading:r,onReload:a,onClear:o,onAddSessionCard:l,wallSettings:d,updateWallSettings:u,nodes:p,taskCardStatus:h}){let{setViewport:x,getViewport:g,getNodes:k,screenToFlowPosition:w}=(0,s.VH)(),{setHighlight:j}=(0,c.kz)(),[S,C]=(0,i.useState)(!1),[I,z]=(0,i.useState)(!1),R=(0,i.useMemo)(()=>{let e=[];for(let t of p)if("session-card"===t.type){let r=t.data;if(!(void 0!==r.phase&&f.has(r.phase))||!r.sessionId)continue;let n=(r.title??"").trim();if(!n)continue;e.push({nodeId:t.id,label:n,kind:"session"})}else if("task-card"===t.type){let r=t.data;if(!r.cardId)continue;let n=h[r.cardId];if(!n||"running"!==n.execStatus)continue;let i=(r.name??"").trim();if(!i)continue;let a="number"==typeof r.number&&r.number>0?`#${r.number} `:"";e.push({nodeId:t.id,label:`${a}${i}`,kind:"task"})}return e},[p,h]);return(0,n.jsxs)("div",{style:{position:"absolute",top:12,left:12,zIndex:40,display:"flex",flexDirection:"column",alignItems:"flex-start",gap:6,maxWidth:"min(420px, calc(100% - 320px))"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,height:36,padding:"0 6px 0 12px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)"},children:[(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0,opacity:.7},children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),(0,n.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1.5"})]}),(0,n.jsx)("span",{title:e,style:{fontSize:12.5,fontWeight:600,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:150},children:e||"看板"}),(0,n.jsx)("button",{type:"button",onClick:a,title:"刷新画布","aria-label":"刷新画布",style:{...v,cursor:r?"default":"pointer"},...r?{}:y(),children:(0,n.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{animation:r?"spin 0.8s linear infinite":void 0},children:[(0,n.jsx)("path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}),(0,n.jsx)("path",{d:"M21 3v5h-5"})]})}),(0,n.jsx)("span",{style:{flexShrink:0,width:1,height:18,background:"color-mix(in srgb, var(--border) 70%, transparent)",margin:"0 2px"}}),(0,n.jsx)("button",{type:"button",onClick:()=>{let e=document.querySelector(".react-flow__pane"),t=e?.getBoundingClientRect();t&&l(w({x:t.left+t.width/2,y:t.top+t.height/2}))},title:"新建会话","aria-label":"新建会话",style:v,...y(),children:(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),(0,n.jsx)("button",{type:"button",onClick:()=>C(e=>!e),title:"磨砂调节","aria-label":"磨砂调节","aria-expanded":S,style:{...v,color:S?"var(--accent)":"var(--text-muted)",background:S?"color-mix(in srgb, var(--accent) 12%, transparent)":void 0},...S?{}:y(),children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M12 3v2"}),(0,n.jsx)("path",{d:"M12 19v2"}),(0,n.jsx)("path",{d:"M5 7l1.5 1.5"}),(0,n.jsx)("path",{d:"M17.5 15.5L19 17"}),(0,n.jsx)("path",{d:"M3 12h2"}),(0,n.jsx)("path",{d:"M19 12h2"}),(0,n.jsx)("path",{d:"M5 17l1.5-1.5"}),(0,n.jsx)("path",{d:"M17.5 8.5L19 7"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})}),(0,n.jsx)("button",{type:"button",onClick:o,title:t?"清空画布(任务卡片保留)":"清空画布","aria-label":"清空画布",style:v,...y(),children:(0,n.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("path",{d:"M18 6 6 18"}),(0,n.jsx)("path",{d:"m6 6 12 12"})]})}),(0,n.jsxs)("button",{type:"button",onClick:()=>z(e=>!e),title:I?"收起执行队列":"展开执行队列","aria-label":I?"收起执行队列":"展开执行队列","aria-expanded":I,style:{...v,color:I?"var(--accent)":"var(--text-muted)",background:I?"color-mix(in srgb, var(--accent) 12%, transparent)":void 0},...I?{}:y(),children:[(0,n.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:I?"rotate(180deg)":"none",transition:"transform 0.15s"},children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})}),R.length>0&&(0,n.jsx)("span",{style:{minWidth:14,height:14,padding:"0 4px",boxSizing:"border-box",display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:999,fontSize:9.5,fontWeight:700,lineHeight:1,background:"color-mix(in srgb, var(--accent) 18%, transparent)",color:"var(--accent)"},children:R.length})]})]}),S&&(0,n.jsx)("div",{style:m,children:(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,n.jsx)("span",{style:{width:14,flexShrink:0,textAlign:"center",fontSize:12},children:"❄"}),(0,n.jsx)("span",{style:{flexShrink:0,fontSize:12.5},children:"磨砂"}),(0,n.jsx)("input",{type:"range",min:0,max:30,value:d.scrimBlur,onChange:e=>u({scrimBlur:Number(e.target.value)}),style:{flex:1,minWidth:120,accentColor:"var(--accent)",cursor:"pointer"},"aria-label":"磨砂强度"}),(0,n.jsxs)("span",{style:{width:30,flexShrink:0,textAlign:"right",fontSize:11,color:"var(--text)"},children:[d.scrimBlur,"px"]})]})}),I&&(0,n.jsxs)("div",{style:{...m,maxHeight:320,overflowY:"auto",padding:6,width:300},children:[(0,n.jsxs)("div",{style:{padding:"6px 10px 4px",fontSize:11,fontWeight:700,color:"var(--text)",letterSpacing:.2},children:["执行队列",(0,n.jsxs)("span",{style:{marginLeft:8,fontSize:10,fontWeight:500,color:"var(--text-meta)"},children:[R.length," 个运行中"]})]}),0===R.length?(0,n.jsx)("div",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-muted)"},children:"画面中没有运行中的卡片"}):R.map(e=>(0,n.jsxs)("button",{type:"button",onClick:()=>(e=>{let t=k().find(t=>t.id===e);if(!t)return;let r=t.measured?.width??t.style?.width??340,n=t.measured?.height??t.style?.height??160,i=t.position.x+r/2,a=t.position.y+n/2,s=g();x({x:-i*s.zoom+window.innerWidth/2,y:-a*s.zoom+window.innerHeight/2,zoom:s.zoom},{duration:300}),j(e)})(e.nodeId),title:"点击定位到卡片",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",border:"none",borderRadius:8,background:"transparent",color:"var(--text)",fontSize:12.5,textAlign:"left",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.background="color-mix(in srgb, var(--accent) 10%, transparent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{flexShrink:0,color:"var(--accent)",display:"inline-flex"},children:"session"===e.kind?(0,n.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}):(0,n.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("path",{d:"M9 11l3 3L22 4"}),(0,n.jsx)("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),(0,n.jsx)("span",{style:{flexShrink:0,width:6,height:6,borderRadius:"50%",background:"#10b981",boxShadow:"0 0 6px 1px rgba(16,185,129,0.6)",animation:"pulse 1.6s ease-in-out infinite"}}),(0,n.jsx)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),(0,n.jsx)("span",{style:{flexShrink:0,fontSize:10,color:"var(--text-dim)"},children:"session"===e.kind?"会话":"任务"})]},e.nodeId))]})]})}let v={display:"flex",alignItems:"center",justifyContent:"center",gap:2,width:30,height:30,padding:0,flexShrink:0,border:"none",background:"transparent",color:"var(--text-muted)",cursor:"pointer",borderRadius:999,transition:"background 0.12s, color 0.12s"};function y(){return{onMouseEnter:e=>{e.currentTarget.style.background="color-mix(in srgb, var(--text) 8%, transparent)"},onMouseLeave:e=>{e.currentTarget.style.background="transparent"}}}let m={display:"flex",flexDirection:"column",gap:6,padding:"8px 10px",borderRadius:12,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)",whiteSpace:"nowrap"},k={dispatch:"正在派发",resume:"续会话",review:"AI 审核中",blockcheck:"阻塞巡检"};function w({nodes:e}){let{setViewport:t,getViewport:r,getNodes:a}=(0,s.VH)(),{setHighlight:o}=(0,c.kz)(),[l,d]=(0,i.useState)(null),[u,p]=(0,i.useState)(!1),h=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/task-scheduler/status",{cache:"no-store"});if(!t.ok)return;let r=await t.json();e||d(r.status)}catch{}};t();let r=setInterval(t,2500);return()=>{e=!0,clearInterval(r)}},[]),(0,i.useEffect)(()=>{if(!u)return;let e=e=>{h.current&&!h.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let x=(0,i.useMemo)(()=>{let t=new Map;for(let r of e){let e=r.data;e.cardId&&t.set(e.cardId,r.id)}return t},[e]),g=!!l?.activity,f=l?l.activity?k[l.activity.kind]??"工作中":l.running.length>0?`运行中 ${l.running.length}`:l.queue.review.length>0?`待审核 ${l.queue.review.length}`:null:null;return(0,n.jsxs)("div",{ref:h,style:{position:"absolute",top:12,right:12,zIndex:40,display:"flex",flexDirection:"column",alignItems:"flex-end"},children:[(0,n.jsxs)("button",{type:"button",onClick:()=>p(e=>!e),"aria-expanded":u,"aria-label":"调度器状态",title:"调度器状态",style:{display:"flex",alignItems:"center",gap:7,height:36,padding:"0 6px 0 14px",borderRadius:999,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 2px 12px -6px rgba(0,0,0,0.18)",color:"var(--text)",cursor:"pointer",whiteSpace:"nowrap"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,background:g?"#f59e0b":(l?.running.length??0)>0?"#10b981":"var(--text-dim)",boxShadow:g?"0 0 6px 1px rgba(245,158,11,0.6)":(l?.running.length??0)>0?"0 0 6px 1px rgba(16,185,129,0.5)":"none",animation:g?"pulse 1.6s ease-in-out infinite":void 0}}),(0,n.jsx)("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text)"},children:"调度器"}),l?.started===!1&&(0,n.jsx)("span",{style:{fontSize:10.5,color:"var(--text-muted)"},children:"未启动"}),f&&(0,n.jsx)("span",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)"},children:f}),(0,n.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{color:"var(--text-muted)",transform:u?"rotate(180deg)":"none",transition:"transform 0.15s",flexShrink:0},children:(0,n.jsx)("polyline",{points:"6 9 12 15 18 9"})})]}),u&&(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",marginTop:6,padding:"8px 0",width:340,borderRadius:14,background:"var(--board-card-glass)",backdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",WebkitBackdropFilter:"blur(var(--board-blur)) saturate(var(--glass-saturate))",border:"1px solid color-mix(in srgb, var(--border) 60%, transparent)",boxShadow:"0 8px 30px -8px rgba(0,0,0,0.3)",color:"var(--text)"},children:[(0,n.jsxs)("div",{style:{padding:"2px 14px 8px",borderBottom:"1px solid color-mix(in srgb, var(--border) 50%, transparent)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("span",{style:{fontSize:13,fontWeight:700,color:"var(--text)"},children:"调度器"}),(0,n.jsx)("span",{style:{fontSize:10.5,color:"var(--text-muted)"},children:l?.started===!1?"未启动":g?"工作中":"休眠"})]}),(0,n.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:6,padding:"10px 12px 8px"},children:[(0,n.jsx)(j,{label:"派发",active:l?.activity?.kind==="dispatch"||l?.activity?.kind==="resume",activityLabel:l?.activity&&("dispatch"===l.activity.kind||"resume"===l.activity.kind)?k[l.activity.kind]:void 0}),(0,n.jsx)(j,{label:"审查",active:l?.activity?.kind==="review"||l?.activity?.kind==="blockcheck",activityLabel:l?.activity&&("review"===l.activity.kind||"blockcheck"===l.activity.kind)?k[l.activity.kind]:void 0})]}),l&&(0,n.jsx)(S,{title:"任务队列",groups:[{label:"运行中",color:"#10b981",cards:l.running},{label:"待审核",color:"#f59e0b",cards:l.queue.review},{label:"待派发",color:"var(--accent)",cards:l.queue.dispatchable},{label:"等回复",color:"var(--text-muted)",cards:l.queue.waitingReply},{label:"失败",color:"#ef4444",cards:l.queue.failed}],nodeIdByCardId:x,onLocate:e=>{let n=a().find(t=>t.id===e);if(!n)return;let i=n.measured?.width??n.style?.width??380,s=n.measured?.height??n.style?.height??270,l=n.position.x+i/2,d=n.position.y+s/2,c=r();t({x:-l*c.zoom+window.innerWidth/2,y:-d*c.zoom+window.innerHeight/2,zoom:c.zoom},{duration:300}),o(e)}}),!l&&(0,n.jsx)("div",{style:{padding:"10px 14px",fontSize:12,color:"var(--text-muted)"},children:"加载中…"})]})]})}function j({label:e,active:t,activityLabel:r}){return(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"7px 8px",borderRadius:8,border:"1px solid color-mix(in srgb, var(--border) 55%, transparent)",background:t?"color-mix(in srgb, var(--accent) 8%, transparent)":"transparent"},children:[(0,n.jsx)("span",{"aria-hidden":!0,style:{width:7,height:7,borderRadius:"50%",flexShrink:0,background:t?"#f59e0b":"var(--text-dim)",boxShadow:t?"0 0 6px 1px rgba(245,158,11,0.6)":"none",animation:t?"pulse 1.6s ease-in-out infinite":void 0}}),(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",minWidth:0},children:[(0,n.jsx)("span",{style:{fontSize:12,fontWeight:700,color:"var(--text)",lineHeight:1.2},children:e}),(0,n.jsx)("span",{style:{fontSize:10,fontWeight:600,color:"var(--text-muted)",whiteSpace:"nowrap"},children:r??"休眠"})]})]})}function S({title:e,groups:t,nodeIdByCardId:r,onLocate:i}){let a=t.filter(e=>e.cards.length>0),s=t.reduce((e,t)=>e+t.cards.length,0);return(0,n.jsxs)("div",{style:{padding:"8px 12px 4px"},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 2px 4px"},children:[(0,n.jsx)("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)",letterSpacing:.3},children:e}),(0,n.jsxs)("span",{style:{fontSize:10.5,fontWeight:600,color:"var(--text-dim)"},children:["共 ",s]})]}),0===a.length?(0,n.jsx)("div",{style:{fontSize:12,color:"var(--text-dim)",padding:"2px 2px 6px"},children:"队列空闲"}):a.map(e=>(0,n.jsxs)("div",{style:{marginBottom:6},children:[(0,n.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:5,padding:"0 2px 3px"},children:[(0,n.jsx)("span",{style:{width:6,height:6,borderRadius:"50%",background:e.color,flexShrink:0}}),(0,n.jsx)("span",{style:{fontSize:10.5,fontWeight:700,color:"var(--text-muted)"},children:e.label}),(0,n.jsx)("span",{style:{fontSize:10,color:"var(--text-dim)"},children:e.cards.length})]}),(0,n.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[e.cards.slice(0,4).map(e=>{let t=r.get(e.id);return(0,n.jsxs)("button",{type:"button",onClick:()=>{t&&i(t)},disabled:!t,title:t?"点击定位到本看板任务卡":"该任务不在当前看板",style:{display:"flex",alignItems:"center",gap:6,width:"100%",padding:"4px 6px",border:"none",borderRadius:6,background:"transparent",color:"var(--text)",fontSize:12,textAlign:"left",cursor:t?"pointer":"default",opacity:t?1:.55},children:[(0,n.jsxs)("span",{style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[(0,n.jsxs)("span",{style:{color:"var(--text-muted)",fontWeight:600},children:["#",e.number]})," ",e.name]}),!t&&(0,n.jsx)("span",{style:{flexShrink:0,fontSize:9.5,color:"var(--text-dim)"},children:"其它看板"})]},e.id)}),e.cards.length>4&&(0,n.jsxs)("div",{style:{padding:"2px 6px",fontSize:10,color:"var(--text-dim)"},children:["…共 ",e.cards.length," 个"]})]})]},e.label))]})}let C=(0,a.default)(()=>Promise.all([r.e(6126),r.e(5004),r.e(277),r.e(6380),r.e(6582)]).then(r.bind(r,86582)).then(e=>e.CanvasStage),{loadableGenerated:{webpack:()=>[86582]},ssr:!1,loading:()=>(0,n.jsx)(p.N,{label:"正在加载画布…"})});function I({boardId:e,taskId:t,newSessionCwd:r,onRunningSessionIdsChange:a,wallSettings:p,updateWallSettings:f}){let{t:v}=(0,l.s)(),{isDark:y}=(0,o.D)(),m=(0,d.C6)({boardId:e,taskId:t,newSessionCwd:r}),k=!!(m.board?.taskId??t),j=(0,i.useMemo)(()=>({getStatus:e=>m.taskCardStatus[e],register:m.registerVisibleTaskCard,unregister:m.unregisterVisibleTaskCard}),[m.taskCardStatus,m.registerVisibleTaskCard,m.unregisterVisibleTaskCard]),S=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey)||"f"!==e.key.toLowerCase())return;let t=document.activeElement;if(t&&t!==S.current){let e=t.tagName;if("INPUT"===e||"TEXTAREA"===e||t.isContentEditable)return}e.preventDefault(),S.current?.focus(),S.current?.select()};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[]);let[z,R]=(0,i.useState)(!1),W=(0,i.useCallback)(async()=>{if(!z){R(!0);try{m.loadSessionSummaries(),await m.reloadCanvas()}finally{setTimeout(()=>R(!1),800)}}},[m,z]);return(0,i.useEffect)(()=>{a?.(new Set(m.running?.runningSessionIds??[]))},[m.running,a]),(0,n.jsx)("div",{"data-glass-scope":"board",style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:(0,n.jsx)(u.I,{value:"board",children:(0,n.jsx)(h.Nc.Provider,{value:{boardId:m.board?.id??null,defaultCwd:r??null},children:(0,n.jsx)(c.eR,{children:(0,n.jsx)(s.Ln,{children:(0,n.jsxs)(d.x_,{value:j,children:[!m.loading&&(0,n.jsx)(b,{boardName:m.board?.name??"",isTaskBoard:k,reloading:z,onReload:()=>void W(),onClear:()=>{(0,x.l)({message:k?v("boards.clearTaskConfirm"):v("boards.clearConfirm"),confirmText:v("boards.clear")}).then(e=>{e&&m.clearBoard()})},onAddSessionCard:e=>m.addNewSessionCard(e),wallSettings:p,updateWallSettings:f,nodes:m.nodes,taskCardStatus:m.taskCardStatus}),(0,n.jsx)(w,{nodes:m.nodes}),!m.loading&&(0,n.jsx)("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",zIndex:40},children:(0,n.jsx)(g,{inputRef:S,nodes:m.nodes})}),(0,n.jsx)(C,{board:m,isDark:y})]})})})})})})}},64536:(e,t,r)=>{r.d(t,{C6:()=>p,VX:()=>f,ZI:()=>d,eo:()=>c,rD:()=>g,x_:()=>x});var n=r(12115),i=r(67816),a=r(81750),s=r(15934),o=r(24456),l=r(41463);let d=340,c=160,u=l.env.NEXT_PUBLIC_SYNC_WS??`${"https:"===window.location.protocol?"wss":"ws"}://${window.location.host}`;function p({boardId:e,taskId:t,newSessionCwd:r}){let[l,h]=(0,n.useState)(null),[x,g]=(0,n.useState)(null),[f,b]=(0,n.useState)(!1),[v,y]=(0,n.useState)([]),[m,k]=(0,n.useState)([]),[w,j]=(0,n.useState)(null),S=(0,n.useRef)(null),C=(0,n.useRef)(null),I=(0,n.useRef)(null),z=(0,n.useRef)(!1);z.current=f;let R=(0,n.useRef)(e);R.current=e;let W=(0,n.useRef)(null);W.current=l;let L=(0,n.useRef)(t??null);L.current=t??null;let A=(0,n.useRef)(r);A.current=r;let M=(0,n.useMemo)(()=>`${u}/connect`,[]);(0,n.useEffect)(()=>{let t=new i.m({url:M,name:e,forceSyncInterval:!1});S.current=t,j(t);let r=t.document.getMap("nodes"),n=t.document.getMap("edges");C.current=r,I.current=n;let a=e=>{let t=e?new Set(Array.from(e.keys.keys())):null;y(e=>{let n=new Set(e.filter(e=>e.selected).map(e=>e.id)),i=new Set(e.filter(e=>e.dragging).map(e=>e.id)),a=new Map(e.map(e=>[e.id,e]));return Array.from(r.values()).map(e=>{if(t&&!t.has(e.id)){let t=a.get(e.id);if(t)return t}let r={...e};return delete r.selected,delete r.dragging,n.has(e.id)&&(r.selected=!0),i.has(e.id)&&(r.dragging=!0),r})})},s=()=>k(Array.from(n.values())),o=()=>b(!0);return r.observe(a),n.observe(s),t.on("synced",o),a(),s(),()=>{r.unobserve(a),n.unobserve(s),t.off("synced",o),t.destroy(),S.current=null,C.current=null,I.current=null,b(!1)}},[M,e]);let E=(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/boards/${encodeURIComponent(e)}`,{cache:"no-store"});if(!t.ok)return void g(`HTTP ${t.status}`);let r=await t.json();h(r.board)}catch(e){g(e instanceof Error?e.message:String(e))}},[e]);(0,n.useEffect)(()=>{E()},[E]);let T=(0,n.useCallback)(async()=>{try{await fetch(`/api/boards/${encodeURIComponent(e)}/reconcile`,{method:"POST"})}catch{}await E()},[e,E]),[B,D]=(0,n.useState)(()=>globalThis.__piRunningSnapshot??null),$=(0,n.useCallback)(e=>{globalThis.__piRunningSnapshot=e,D(e)},[]),H=(0,n.useRef)(!1),P=(0,n.useRef)(new Set),[_,N]=(0,n.useState)({}),F=(0,n.useCallback)(e=>{P.current.add(e)},[]),U=(0,n.useCallback)(e=>{P.current.delete(e)},[]);(0,n.useEffect)(()=>{let e=!1,t=null,r=async()=>{if(!e&&!H.current&&"visible"===document.visibilityState){H.current=!0;try{let t=Array.from(P.current),r=t.length>0&&R.current?`?boardId=${encodeURIComponent(R.current)}&cardIds=${encodeURIComponent(t.join(","))}`:"",n=await fetch(`/api/agent/running${r}`,{cache:"no-store"});if(!n.ok)return;let i=await n.json();if(e)return;$(i);let a=e=>{N(t=>{let r=e(t);if(r===t)return t;let n=Object.keys(t),i=Object.keys(r);return n.length===i.length&&n.every(e=>r[e]===t[e])?t:r})};i.taskCards.length>0?a(e=>{let t=!1,r={...e};for(let e of i.taskCards)r[e.cardId]!==e&&(r[e.cardId]=e,t=!0);return t?r:e}):t.length>0&&a(e=>{let r=!1,n={...e};for(let e of t)n[e]&&(delete n[e],r=!0);return r?n:e});let s=C.current;if(!s)return;for(let e of Array.from(s.values())){if("session-card"!==e.type)continue;let t=e.data;if(!t.sessionId)continue;let r=i.states[t.sessionId],n=i.runningSessionIds.includes(t.sessionId);if(n&&r){let n=r.phase??"waiting_model",i=r.startedAt?Date.now()-r.startedAt:0;(t.phase!==n||t.runningMs!==i||0!==t.endedAt)&&s.set(e.id,{...e,data:{...t,phase:n,runningMs:i,endedAt:0}})}else n||"idle"===t.phase||s.set(e.id,{...e,data:{...t,phase:"idle",runningMs:0,endedAt:0}})}}catch{}finally{H.current=!1}}},n=()=>{e||(t=setTimeout(async()=>{await r(),n()},2500))};r(),n();let i=()=>{"visible"===document.visibilityState&&r()};return document.addEventListener("visibilitychange",i),()=>{e=!0,t&&clearTimeout(t),document.removeEventListener("visibilitychange",i)}},[$]);let[V,O]=(0,n.useState)({}),q=(0,n.useRef)({});q.current=V;let K=(0,n.useRef)(!1),X=(0,n.useCallback)(async()=>{if(!K.current){K.current=!0;try{let e=await fetch("/api/sessions",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),r={};for(let e of t.sessions)r[e.id]={title:e.name??e.firstMessage??"Untitled",messageCount:e.messageCount??0,projectName:e.projectKey??e.projectRoot??"",lastReply:e.lastReply??"",lastActivityAt:e.modified?Date.parse(e.modified):0};O(r)}catch{}finally{K.current=!1}}},[]);(0,n.useEffect)(()=>{let e,t=!1,r=async()=>{await X(),t||(e=setTimeout(r,1e4))};r();let n=()=>{"visible"===document.visibilityState&&(e&&clearTimeout(e),r())};return document.addEventListener("visibilitychange",n),()=>{t=!0,e&&clearTimeout(e),document.removeEventListener("visibilitychange",n)}},[X]),(0,n.useEffect)(()=>{let e=C.current;if(e&&z.current&&0!==Object.keys(V).length)for(let t of Array.from(e.values())){if("session-card"!==t.type)continue;let r=t.data,n=V[r.sessionId];n&&(r.title!==n.title||r.lastReply!==n.lastReply||r.messageCount!==n.messageCount||r.lastActivityAt!==n.lastActivityAt)&&e.set(t.id,{...t,data:{...r,title:n.title,lastReply:n.lastReply,messageCount:n.messageCount,lastActivityAt:n.lastActivityAt}})}},[V,f]);let Y=(0,n.useCallback)(e=>{let t=C.current;if(!t)return;let r=e.filter(e=>"select"===e.type);r.length&&y(e=>(0,a._0)(r,e));let n=e.filter(e=>"select"!==e.type);if(0===n.length)return;let i=Array.from(t.values()),s=(0,a._0)(n,i);for(let e of n)if("add"===e.type||"replace"===e.type)t.set(e.item.id,e.item);else if("remove"===e.type&&t.has(e.id)){t.delete(e.id);let r=I.current;if(r)for(let t of Array.from(r.values()))(t.source===e.id||t.target===e.id)&&r.delete(t.id)}else if("position"===e.type||"dimensions"===e.type){let r=s.find(t=>t.id===e.id);if(r){let{dragging:n,...i}=r;t.set(e.id,i)}}},[]),Z=(0,n.useCallback)(e=>{let t=I.current;if(!t)return;let r=Array.from(t.values()),n=(0,a.zW)(e,r);for(let r of e)if("add"===r.type||"replace"===r.type)t.set(r.item.id,r.item);else if("remove"===r.type&&t.has(r.id)){let e=t.get(r.id);if(e&&e.data?.execLink||e&&e.data?.taskLink)continue;t.delete(r.id)}else{let e=n.find(e=>e.id===r.id);e&&t.set(r.id,e)}},[]),G=(0,n.useCallback)(e=>{let t=I.current;if(!t)return;let r=`edge-${e.source}-${e.target}-${Date.now()}`;t.set(r,{id:r,source:e.source,target:e.target,type:"default",markerEnd:{type:"arrowclosed"},style:{strokeWidth:1.5,stroke:"#8b8fa3"}})},[]),J=(0,n.useCallback)(e=>{let t=C.current;if(!t)return;let r=crypto.randomUUID(),n=crypto.randomUUID(),i=e?.x??60,a=e?.y??60,s=i-420+t.size%3*24,o=a-300+t.size%3*24;t.set(n,{id:n,type:"session-card",position:{x:s,y:o},style:{width:840,height:600},data:{sessionId:r,title:"",projectName:"",messageCount:0,lastReply:"",phase:"idle",runningMs:0,endedAt:0,lastActivityAt:0,stale:!1,expanded:!0,cwd:A.current??"",taskId:L.current??"",w:840,h:600,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}})},[]),Q=(0,n.useCallback)((e,t,r)=>{let n=C.current;if(!n)return;let i=q.current[e],a=`session-${e}`,o=L.current??W.current?.taskId??null;n.set(a,{id:a,type:"session-card",position:{x:t,y:r},style:{width:d,height:c},data:{sessionId:e,title:i?.title??"Untitled",projectName:i?.projectName??"",messageCount:i?.messageCount??0,lastReply:i?.lastReply??"",lastActivityAt:i?.lastActivityAt??0,phase:"idle",runningMs:0,endedAt:0,stale:!1,expanded:!1,taskId:o??"",w:d,h:c,expandedW:0,expandedH:0,collapsedW:0,collapsedH:0}}),o&&(async()=>{try{let t=await fetch(`/api/tasks/${encodeURIComponent(o)}`,{cache:"no-store"}),r=await t.json(),n=r.task?.sessionIds??[];n.includes(e)||(await fetch(`/api/tasks/${encodeURIComponent(o)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:[...n,e]})}),(0,s.PH)(e))}catch(t){console.warn(`[board] 拖入会话归属任务失败 ${e}:`,t instanceof Error?t.message:t)}finally{let e=C.current;if(e?.has(a)){let t=e.get(a);t&&t.data?.taskId&&e.set(a,{...t,data:{...t.data,taskId:""}})}}})()},[]),ee=(0,n.useCallback)(async e=>{let t=C.current,r=I.current;if(t&&r)if("session-card"===e.type){let n=e.data;if(!n.sessionId||n.cwd){for(let n of(t.delete(e.id),Array.from(r.values())))(n.source===e.id||n.target===e.id)&&r.delete(n.id);return}if(!await (0,o.l)({message:"移除该会话卡片?\n会话本身将保留在会话列表中,可随时重新拖入。"}))return;for(let n of(t.delete(e.id),Array.from(r.values())))(n.source===e.id||n.target===e.id)&&r.delete(n.id)}else if("task-card"===e.type){let n=e.data;if(!n.cardId)return void t.delete(e.id);if(!await (0,o.l)({message:"删除该任务卡?\n将删除任务卡、依赖线与执行会话连线;关联的执行会话保留。此操作不可撤销。"}))return;for(let n of(t.delete(e.id),Array.from(r.values())))(n.source===e.id||n.target===e.id)&&r.delete(n.id);fetch(`/api/task-cards/${encodeURIComponent(n.cardId)}`,{method:"DELETE"}).catch(e=>console.warn(`[board] 删除任务卡 ${n.cardId} 异常`,e))}else t.delete(e.id)},[]),et=(0,n.useCallback)((e,t)=>{let r=C.current;if(!r)return;let n=r.get(e);n&&r.set(e,{...n,...t})},[]),er=(0,n.useCallback)((e,t)=>{let r=C.current;if(!r||!e||e===t)return;let n=r.get(e);if(!n)return;r.delete(e),r.set(t,{...n,id:t});let i=I.current;if(i)for(let r of Array.from(i.values()))(r.source===e||r.target===e)&&i.set(r.id,{...r,source:r.source===e?t:r.source,target:r.target===e?t:r.target})},[]),en=(0,n.useCallback)(e=>{let t=I.current;t&&t.set(e.id,e)},[]),ei=(0,n.useCallback)(e=>{let t=C.current;t&&t.set(e.id,e)},[]),ea=(0,n.useCallback)(async()=>{let e=C.current,t=I.current;if(!e||!t)return;let r=!!(L.current??W.current?.taskId);for(let n of Array.from(e.values()).filter(e=>!r||"session-card"!==e.type))for(let r of(e.delete(n.id),Array.from(t.values())))(r.source===n.id||r.target===n.id)&&t.delete(r.id)},[]),es=!f;return(0,n.useMemo)(()=>({board:l,loading:es,error:x,running:B,runningCount:B?.runningSessionIds.length??0,taskCardStatus:_,registerVisibleTaskCard:F,unregisterVisibleTaskCard:U,nodes:v,edges:m,onNodesChange:Y,onEdgesChange:Z,onConnect:G,provider:w,ready:f,addSessionNode:Q,addNewSessionCard:J,deleteNodeWithConfirm:ee,updateNode:et,normalizeNodeId:er,addEdge:en,addNode:ei,clearBoard:ea,sessionTitles:V,loadSessionSummaries:X,reloadCanvas:T}),[l,es,x,B,v,m,Y,Z,G,w,f,Q,J,ee,et,er,en,ei,ea,V,X,T,E,_,F,U])}let h=(0,n.createContext)(null);function x({value:e,children:t}){return(0,n.createElement)(h.Provider,{value:e},t)}function g(e){let t=(0,n.useContext)(h);return e&&t?t.getStatus(e):void 0}function f(){let e=(0,n.useContext)(h);return{register:e?.register??(()=>{}),unregister:e?.unregister??(()=>{})}}},71309:(e,t,r)=>{r.d(t,{eR:()=>o,kz:()=>l,u:()=>a});var n=r(95155),i=r(12115);let a="0 0 0 3px var(--accent), 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent)",s=(0,i.createContext)(null);function o({children:e}){let[t,r]=(0,i.useState)(null),a=(0,i.useRef)(null),l=(0,i.useCallback)(e=>{a.current&&clearTimeout(a.current),a.current=null,r(e),e&&(a.current=setTimeout(()=>r(null),1800))},[]);return(0,i.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,n.jsx)(s.Provider,{value:{highlightId:t,setHighlight:l},children:e})}function l(){let e=(0,i.useContext)(s);return e||{highlightId:null,setHighlight:()=>{}}}}}]);
|