commandmate 0.1.5 → 0.1.6
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 -0
- package/.next/app-build-manifest.json +72 -0
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +32 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/cache/config.json +7 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +249 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/app/_not-found/page.js +1 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +6 -0
- package/.next/server/app/_not-found.rsc +10 -0
- package/.next/server/app/api/external-apps/[id]/health/route.js +45 -0
- package/.next/server/app/api/external-apps/[id]/health/route.js.nft.json +1 -0
- package/.next/server/app/api/external-apps/[id]/route.js +45 -0
- package/.next/server/app/api/external-apps/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/external-apps/route.js +45 -0
- package/.next/server/app/api/external-apps/route.js.nft.json +1 -0
- package/.next/server/app/api/hooks/claude-done/route.js +19 -0
- package/.next/server/app/api/hooks/claude-done/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -0
- package/.next/server/app/api/repositories/clone/[jobId]/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/clone/route.js +1 -0
- package/.next/server/app/api/repositories/clone/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/route.js +1 -0
- package/.next/server/app/api/repositories/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/scan/route.js +1 -0
- package/.next/server/app/api/repositories/scan/route.js.nft.json +1 -0
- package/.next/server/app/api/repositories/sync/route.js +1 -0
- package/.next/server/app/api/repositories/sync/route.js.nft.json +1 -0
- package/.next/server/app/api/slash-commands/route.js +1 -0
- package/.next/server/app/api/slash-commands/route.js.nft.json +1 -0
- package/.next/server/app/api/slash-commands.body +1 -0
- package/.next/server/app/api/slash-commands.meta +1 -0
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/capture/route.js +2 -0
- package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/cli-tool/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/cli-tool/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/interrupt/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/kill-session/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/logs/route.js +19 -0
- package/.next/server/app/api/worktrees/[id]/logs/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/memos/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/memos/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/messages/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/messages/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/prompt-response/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/respond/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/search/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/search/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/send/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/send/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/slash-commands/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/start-polling/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/tree/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/tree/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/[id]/viewed/route.js +1 -0
- package/.next/server/app/api/worktrees/[id]/viewed/route.js.nft.json +1 -0
- package/.next/server/app/api/worktrees/route.js +1 -0
- package/.next/server/app/api/worktrees/route.js.nft.json +1 -0
- package/.next/server/app/apple-icon.png/route.js +1 -0
- package/.next/server/app/apple-icon.png/route.js.nft.json +1 -0
- package/.next/server/app/apple-icon.png.body +0 -0
- package/.next/server/app/apple-icon.png.meta +1 -0
- package/.next/server/app/icon.png/route.js +1 -0
- package/.next/server/app/icon.png/route.js.nft.json +1 -0
- package/.next/server/app/icon.png.body +0 -0
- package/.next/server/app/icon.png.meta +1 -0
- package/.next/server/app/index.html +9 -0
- package/.next/server/app/index.meta +5 -0
- package/.next/server/app/index.rsc +8 -0
- package/.next/server/app/page.js +16 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app/proxy/[...path]/route.js +45 -0
- package/.next/server/app/proxy/[...path]/route.js.nft.json +1 -0
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -0
- package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -0
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/worktrees/[id]/page.js +21 -0
- package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -0
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -0
- package/.next/server/app/worktrees/[id]/simple-terminal/page.js +4 -0
- package/.next/server/app/worktrees/[id]/simple-terminal/page.js.nft.json +1 -0
- package/.next/server/app/worktrees/[id]/simple-terminal/page_client-reference-manifest.js +1 -0
- package/.next/server/app/worktrees/[id]/terminal/page.js +6 -0
- package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -0
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +46 -0
- package/.next/server/chunks/1318.js +29 -0
- package/.next/server/chunks/1528.js +1 -0
- package/.next/server/chunks/1682.js +6 -0
- package/.next/server/chunks/2518.js +12 -0
- package/.next/server/chunks/3053.js +1 -0
- package/.next/server/chunks/3673.js +1 -0
- package/.next/server/chunks/3853.js +1 -0
- package/.next/server/chunks/434.js +1 -0
- package/.next/server/chunks/4471.js +2 -0
- package/.next/server/chunks/4893.js +2 -0
- package/.next/server/chunks/5972.js +12 -0
- package/.next/server/chunks/6550.js +1 -0
- package/.next/server/chunks/6621.js +1 -0
- package/.next/server/chunks/7213.js +1 -0
- package/.next/server/chunks/7425.js +500 -0
- package/.next/server/chunks/8585.js +1 -0
- package/.next/server/chunks/8887.js +1 -0
- package/.next/server/chunks/8948.js +2 -0
- package/.next/server/chunks/9703.js +31 -0
- package/.next/server/chunks/9723.js +19 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/edge-runtime-webpack.js +2 -0
- package/.next/server/edge-runtime-webpack.js.map +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/functions-config-manifest.json +1 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +32 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +1 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/src/middleware.js +14 -0
- package/.next/server/src/middleware.js.map +1 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/0dbeb660.3e800dfbd28be3bd.js +53 -0
- package/.next/static/chunks/1015.0eaa4da7f61149bc.js +59 -0
- package/.next/static/chunks/1098.49268c9fe1b028fa.js +1 -0
- package/.next/static/chunks/13.feeafc7cc620f8c4.js +1 -0
- package/.next/static/chunks/1423.7b1e8bf760d28078.js +1 -0
- package/.next/static/chunks/1582.9f8590f71ff798ca.js +55 -0
- package/.next/static/chunks/1817.a66d96cedb761daa.js +262 -0
- package/.next/static/chunks/2117-d845c2cd62e344a6.js +2 -0
- package/.next/static/chunks/2398.0b21e4eb7006a230.js +93 -0
- package/.next/static/chunks/2526.8ac62b527c9ab703.js +43 -0
- package/.next/static/chunks/2626.2125083a1ff3b80a.js +29 -0
- package/.next/static/chunks/2689.720a4874b02d4211.js +174 -0
- package/.next/static/chunks/2853-d11a80b03c9a1640.js +1 -0
- package/.next/static/chunks/2957-327e43ef4c12808f.js +1 -0
- package/.next/static/chunks/2cdb6380.35626fc6e41bbba4.js +136 -0
- package/.next/static/chunks/30d07d85-393352a92199f695.js +3 -0
- package/.next/static/chunks/3559.f073f72c4466ce0e.js +1 -0
- package/.next/static/chunks/3574.7a94c27e6a496a56.js +63 -0
- package/.next/static/chunks/383.20683891c9a5f2c4.js +4 -0
- package/.next/static/chunks/3843.3fdda732987f7bb8.js +1 -0
- package/.next/static/chunks/3852.822389f445c9b427.js +1 -0
- package/.next/static/chunks/3991.4bc063cb5be3a86c.js +1 -0
- package/.next/static/chunks/4212.52c1bb34fc97d0d0.js +131 -0
- package/.next/static/chunks/4327.3b84aa049900fdeb.js +60 -0
- package/.next/static/chunks/4362.7bd6f0282e49d79b.js +1 -0
- package/.next/static/chunks/4721.40615a5f4f32b5fb.js +1 -0
- package/.next/static/chunks/4851-45df4d388db5623f.js +1 -0
- package/.next/static/chunks/5112.17318d1c6b28044b.js +1 -0
- package/.next/static/chunks/5126.93fa4e797d609286.js +56 -0
- package/.next/static/chunks/5387.47590ac4ef66c864.js +5 -0
- package/.next/static/chunks/5813.4483664ba482beb1.js +1 -0
- package/.next/static/chunks/6143.1450875bd03a2366.js +36 -0
- package/.next/static/chunks/6406.9653f0d41ab85059.js +1 -0
- package/.next/static/chunks/656.d72f25ce819bd77e.js +149 -0
- package/.next/static/chunks/6678.492e73ca42b2a273.js +62 -0
- package/.next/static/chunks/6725-f7607851b7d57eb1.js +1 -0
- package/.next/static/chunks/6792.3c01ac4dda4b5c6d.js +1 -0
- package/.next/static/chunks/7004.808cbf327ef5955e.js +1 -0
- package/.next/static/chunks/7290.09ef84cf94f90c4d.js +1 -0
- package/.next/static/chunks/7415.6b481c2baf363262.js +148 -0
- package/.next/static/chunks/7648-325564a6e12a3257.js +1 -0
- package/.next/static/chunks/7665.47fccad04449a8f9.js +215 -0
- package/.next/static/chunks/7753.6bdce86b7fde3d10.js +166 -0
- package/.next/static/chunks/8125.245a9df052d274fb.js +1 -0
- package/.next/static/chunks/816-7e340dad784be28c.js +1 -0
- package/.next/static/chunks/8288.4883743fa40672e2.js +24 -0
- package/.next/static/chunks/8522.1607e96011c66877.js +1 -0
- package/.next/static/chunks/8772.863c564498d88487.js +1 -0
- package/.next/static/chunks/8841.dadeb1ece8e46004.js +1 -0
- package/.next/static/chunks/8885.f8d9912b40d74811.js +1 -0
- package/.next/static/chunks/90542734.c1553d0fe7fc14fc.js +1 -0
- package/.next/static/chunks/9365-733d8c05712d2888.js +1 -0
- package/.next/static/chunks/9552.b7dfb7903ead934b.js +1 -0
- package/.next/static/chunks/9834.295b45635ce04f5e.js +24 -0
- package/.next/static/chunks/app/_not-found/page-a9d04e58c81115ec.js +1 -0
- package/.next/static/chunks/app/layout-37e55f11dcc8b1bf.js +1 -0
- package/.next/static/chunks/app/page-9cd00de9cc0abc43.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-9e5adf57cbbbdf05.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-8c6676303b63fdaf.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/simple-terminal/page-16feb3e86e42f4d1.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/terminal/page-be802baffc84dbd2.js +1 -0
- package/.next/static/chunks/d3ac728e.6c9c508274d4d2d5.js +1 -0
- package/.next/static/chunks/fd9d1056-bbe86e4ae099d5cd.js +1 -0
- package/.next/static/chunks/framework-8e0e0f4a6b83a956.js +1 -0
- package/.next/static/chunks/main-a960f4a5e1a2f598.js +1 -0
- package/.next/static/chunks/main-app-420d93e43682fee5.js +1 -0
- package/.next/static/chunks/pages/_app-3c9ca398d360b709.js +1 -0
- package/.next/static/chunks/pages/_error-cf5ca766ac8f493f.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-3fc79fab9bb738d7.js +1 -0
- package/.next/static/css/5eacd01f773eed7f.css +11 -0
- package/.next/static/css/85fa6dafca566008.css +1 -0
- package/.next/static/css/e174aa24f94ce607.css +3 -0
- package/.next/static/pQTquVjewvoJa7BML07ip/_buildManifest.js +1 -0
- package/.next/static/pQTquVjewvoJa7BML07ip/_ssgManifest.js +1 -0
- package/.next/trace +5 -0
- package/.next/types/app/api/external-apps/[id]/health/route.ts +343 -0
- package/.next/types/app/api/external-apps/[id]/route.ts +343 -0
- package/.next/types/app/api/external-apps/route.ts +343 -0
- package/.next/types/app/api/hooks/claude-done/route.ts +343 -0
- package/.next/types/app/api/repositories/clone/[jobId]/route.ts +343 -0
- package/.next/types/app/api/repositories/clone/route.ts +343 -0
- package/.next/types/app/api/repositories/route.ts +343 -0
- package/.next/types/app/api/repositories/scan/route.ts +343 -0
- package/.next/types/app/api/repositories/sync/route.ts +343 -0
- package/.next/types/app/api/slash-commands/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/auto-yes/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/capture/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/cli-tool/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/current-output/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/files/[...path]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/interrupt/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/kill-session/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/logs/[filename]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/logs/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/memos/[memoId]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/memos/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/messages/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/prompt-response/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/respond/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/search/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/send/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/slash-commands/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/start-polling/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/terminal/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/tree/[...path]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/tree/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/upload/[...path]/route.ts +343 -0
- package/.next/types/app/api/worktrees/[id]/viewed/route.ts +343 -0
- package/.next/types/app/api/worktrees/route.ts +343 -0
- package/.next/types/app/page.ts +79 -0
- package/.next/types/app/proxy/[...path]/route.ts +343 -0
- package/.next/types/app/worktrees/[id]/files/[...path]/page.ts +79 -0
- package/.next/types/app/worktrees/[id]/page.ts +79 -0
- package/.next/types/app/worktrees/[id]/simple-terminal/page.ts +79 -0
- package/.next/types/app/worktrees/[id]/terminal/page.ts +79 -0
- package/.next/types/package.json +1 -0
- package/README.md +39 -8
- package/dist/server/server.js +123 -0
- package/dist/server/src/lib/claude-output.js +33 -0
- package/dist/server/src/lib/claude-session.js +312 -0
- package/dist/server/src/lib/cli-patterns.js +137 -0
- package/dist/server/src/lib/cli-session.js +73 -0
- package/dist/server/src/lib/cli-tools/base.js +51 -0
- package/dist/server/src/lib/cli-tools/claude.js +65 -0
- package/dist/server/src/lib/cli-tools/codex.js +132 -0
- package/dist/server/src/lib/cli-tools/gemini.js +122 -0
- package/dist/server/src/lib/cli-tools/index.js +22 -0
- package/dist/server/src/lib/cli-tools/manager.js +143 -0
- package/dist/server/src/lib/cli-tools/types.js +5 -0
- package/dist/server/src/lib/conversation-logger.js +25 -0
- package/dist/server/src/lib/db-instance.js +51 -0
- package/dist/server/src/lib/db-migrations.js +777 -0
- package/dist/server/src/lib/db.js +835 -0
- package/dist/server/src/lib/env.js +179 -0
- package/dist/server/src/lib/log-manager.js +234 -0
- package/dist/server/src/lib/logger.js +232 -0
- package/dist/server/src/lib/prompt-detector.js +285 -0
- package/dist/server/src/lib/response-poller.js +638 -0
- package/dist/server/src/lib/tmux.js +299 -0
- package/dist/server/src/lib/worktrees.js +231 -0
- package/dist/server/src/lib/ws-server.js +323 -0
- package/dist/server/src/types/clone.js +39 -0
- package/dist/server/src/types/conversation.js +9 -0
- package/dist/server/src/types/external-apps.js +6 -0
- package/dist/server/src/types/infinite-messages.js +65 -0
- package/dist/server/src/types/markdown-editor.js +94 -0
- package/dist/server/src/types/models.js +5 -0
- package/dist/server/src/types/sidebar.js +89 -0
- package/dist/server/src/types/slash-commands.js +47 -0
- package/dist/server/src/types/ui-actions.js +8 -0
- package/dist/server/src/types/ui-state.js +62 -0
- package/package.json +8 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[130],{5635:function(e,t,r){Promise.resolve().then(r.bind(r,53282))},53282:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return tF}});var a=r(57437),n=r(99376),s=r(63671),l=r(2265);let o={output:"",realtimeSnippet:"",isActive:!1,isThinking:!1,autoScroll:!0,lastUpdated:null},i={data:null,messageId:null,visible:!1,answering:!1},c={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5},d={type:null,message:null,retryable:!1,retryCount:0};function u(){return{phase:"idle",terminal:{...o},prompt:{...i},layout:{...c},error:{...d},messages:[],wsConnected:!1}}function m(e,t){switch(t.type){case"SET_PHASE":return{...e,phase:t.phase};case"SET_TERMINAL_OUTPUT":return{...e,terminal:{...e.terminal,output:t.output,realtimeSnippet:t.realtimeSnippet,lastUpdated:new Date}};case"SET_TERMINAL_ACTIVE":return{...e,terminal:{...e.terminal,isActive:t.isActive}};case"SET_TERMINAL_THINKING":return{...e,terminal:{...e.terminal,isThinking:t.isThinking}};case"SET_AUTO_SCROLL":return{...e,terminal:{...e.terminal,autoScroll:t.enabled}};case"SHOW_PROMPT":return{...e,phase:"prompt",prompt:{data:t.data,messageId:t.messageId,visible:!0,answering:!1}};case"CLEAR_PROMPT":return{...e,prompt:{...i}};case"SET_PROMPT_ANSWERING":return{...e,prompt:{...e.prompt,answering:t.answering}};case"SET_LAYOUT_MODE":return{...e,layout:{...e.layout,mode:t.mode}};case"SET_MOBILE_ACTIVE_PANE":return{...e,layout:{...e.layout,mobileActivePane:t.pane}};case"SET_SPLIT_RATIO":return{...e,layout:{...e.layout,splitRatio:t.ratio}};case"SET_LEFT_PANE_TAB":return{...e,layout:{...e.layout,leftPaneTab:t.tab}};case"SET_ERROR":return{...e,error:t.error};case"CLEAR_ERROR":return{...e,error:{...d}};case"INCREMENT_RETRY_COUNT":return{...e,error:{...e.error,retryCount:e.error.retryCount+1}};case"SET_MESSAGES":return{...e,messages:t.messages};case"ADD_MESSAGE":return{...e,messages:[...e.messages,t.message]};case"UPDATE_MESSAGE":return{...e,messages:e.messages.map(e=>e.id===t.id?{...e,...t.updates}:e)};case"CLEAR_MESSAGES":return{...e,messages:[]};case"SET_WS_CONNECTED":return{...e,wsConnected:t.connected};case"START_WAITING_FOR_RESPONSE":return{...e,phase:"waiting",terminal:{...e.terminal,isActive:!0,output:"",realtimeSnippet:""},prompt:{...i}};case"RESPONSE_RECEIVED":return{...e,phase:"complete",messages:[...e.messages,t.message],terminal:{...e.terminal,isActive:!1,isThinking:!1}};case"SESSION_ENDED":return{...e,phase:"idle",terminal:{...o},prompt:{...i}};default:return e}}var x=r(58819),h=r(43241);class p extends l.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){var r,a;console.error("[ErrorBoundary:".concat(this.props.componentName||"unknown","]"),e,t),null===(r=(a=this.props).onError)||void 0===r||r.call(a,e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:(0,a.jsx)(f,{componentName:this.props.componentName,error:this.state.error,onRetry:this.handleRetry}):this.props.children}constructor(e){super(e),this.handleRetry=()=>{this.setState({hasError:!1,error:null})},this.state={hasError:!1,error:null}}}function f(e){let{componentName:t,error:r,onRetry:n}=e;return(0,a.jsxs)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-red-800 mb-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,a.jsx)("span",{className:"font-medium",children:t?"".concat(t,"でエラーが発生しました"):"エラーが発生しました"})]}),r&&(0,a.jsx)("p",{className:"text-sm text-red-600 mb-3",children:r.message}),n&&(0,a.jsx)("button",{onClick:n,className:"px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition-colors text-sm",children:"再試行"})]})}let g=["flex-shrink-0","bg-gray-700","transition-colors","duration-150","hover:bg-blue-500","focus:outline-none","focus:ring-2","focus:ring-blue-500","focus:ring-offset-2","focus:ring-offset-gray-900"],b=["w-1","h-full","cursor-col-resize","hover:w-2"],y=["h-1","w-full","cursor-row-resize","hover:h-2"];function v(e,t){return"touches"in e&&e.touches.length>0?t?e.touches[0].clientX:e.touches[0].clientY:"clientX"in e?t?e.clientX:e.clientY:0}let w=(0,l.memo)(function(e){let{onResize:t,orientation:r="horizontal",ariaValueNow:n=50,onDoubleClick:s,minRatio:o=.1}=e,[i,c]=(0,l.useState)(!1),d=(0,l.useRef)(0),u=(0,l.useRef)(null),m="horizontal"===r,x=(0,l.useCallback)(e=>{e.preventDefault(),c(!0),d.current=v(e,m)},[m]),h=(0,l.useCallback)(e=>{1===e.touches.length&&(c(!0),d.current=v(e,m))},[m]),p=(0,l.useCallback)(e=>{if(!i)return;let r=v(e,m);t(r-d.current),d.current=r},[i,m,t]),f=(0,l.useCallback)(e=>{if(!i||1!==e.touches.length)return;let r=v(e,m);t(r-d.current),d.current=r},[i,m,t]),w=(0,l.useCallback)(()=>{c(!1)},[]),j=(0,l.useCallback)(()=>{s&&s()},[s]),N=(0,l.useCallback)(e=>{let r=0;m?"ArrowRight"===e.key?r=10:"ArrowLeft"===e.key&&(r=-10):"ArrowDown"===e.key?r=10:"ArrowUp"===e.key&&(r=-10),0!==r&&(e.preventDefault(),t(r))},[m,t]);(0,l.useEffect)(()=>(i&&(document.addEventListener("mousemove",p),document.addEventListener("mouseup",w),document.addEventListener("touchmove",f),document.addEventListener("touchend",w),document.body.style.userSelect="none",document.body.style.cursor=m?"col-resize":"row-resize"),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",w),document.removeEventListener("touchmove",f),document.removeEventListener("touchend",w),document.body.style.userSelect="",document.body.style.cursor=""}),[i,p,w,f,m]);let k=(0,l.useMemo)(()=>[...g,...m?b:y,...i?["bg-blue-500","dragging",m?"w-2":"h-2"]:[]].join(" "),[m,i]);return(0,a.jsx)("div",{ref:u,role:"separator","aria-orientation":r,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Resize panes. Use ".concat(m?"left and right":"up and down"," arrow keys to adjust."),tabIndex:0,className:k,onMouseDown:x,onTouchStart:h,onKeyDown:N,onDoubleClick:j})}),j={left:"History",right:"Terminal"},N={left:"HistoryPane",right:"TerminalPane"},k=(0,l.memo)(function(e){let{pane:t,isActive:r,onClick:n}=e;return(0,a.jsx)("button",{type:"button",role:"tab","aria-selected":r,"aria-controls":"".concat(t,"-panel"),onClick:n,className:"".concat("flex-1 py-2 px-4 text-sm font-medium transition-colors"," ").concat(r?"text-blue-400 border-b-2 border-blue-400 bg-gray-900":"text-gray-400 hover:text-gray-300"),children:j[t]})}),C=(0,l.memo)(function(e){let{leftPane:t,rightPane:r}=e,[n,s]=(0,l.useState)("right"),o=(0,l.useCallback)(()=>s("left"),[]),i=(0,l.useCallback)(()=>s("right"),[]);return(0,a.jsxs)("div",{"data-testid":"mobile-layout",className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex border-b border-gray-700 bg-gray-800",role:"tablist",children:[(0,a.jsx)(k,{pane:"left",isActive:"left"===n,onClick:o}),(0,a.jsx)(k,{pane:"right",isActive:"right"===n,onClick:i})]}),(0,a.jsx)("div",{id:"".concat(n,"-panel"),role:"tabpanel",className:"flex-1 overflow-hidden",children:(0,a.jsx)(p,{componentName:N[n],children:"left"===n?t:r})})]})}),S=(0,l.memo)(function(e){let{leftPane:t,rightPane:r,leftWidth:n,onResize:s,className:o}=e,i=(0,l.useMemo)(()=>({width:"".concat(n,"%")}),[n]),c=(0,l.useMemo)(()=>({width:"".concat(100-n,"%")}),[n]),d=(0,l.useMemo)(()=>"flex h-full min-h-0 ".concat(o).trim(),[o]);return(0,a.jsxs)("div",{"data-testid":"desktop-layout",role:"main",className:d,children:[(0,a.jsx)("div",{"data-testid":"left-pane","aria-label":"History pane",style:i,className:"flex-shrink-0 overflow-hidden",children:(0,a.jsx)(p,{componentName:N.left,children:t})}),(0,a.jsx)(w,{onResize:s,orientation:"horizontal",ariaValueNow:n}),(0,a.jsx)("div",{"data-testid":"right-pane","aria-label":"Terminal pane",style:c,className:"flex-grow overflow-hidden",children:(0,a.jsx)(p,{componentName:N.right,children:r})})]})}),E=(0,l.memo)(function(e){let{leftPane:t,rightPane:r,initialLeftWidth:n=50,minLeftWidth:s=20,maxLeftWidth:o=80,className:i=""}=e,c=(0,x.d)(),d=(0,l.useRef)(null),[u,m]=(0,l.useState)(n),h=(0,l.useCallback)(e=>{let t=d.current;if(!t)return;let r=t.offsetWidth;if(0===r)return;let a=e/r*100;m(e=>Math.min(o,Math.max(s,e+a)))},[s,o]);return c?(0,a.jsx)(C,{leftPane:t,rightPane:r}):(0,a.jsx)("div",{ref:d,className:"h-full",children:(0,a.jsx)(S,{leftPane:t,rightPane:r,leftWidth:u,onResize:h,className:i})})});var T=r(47835),M=r.n(T),L=r(34343);let R=new(r.n(L)())({fg:"#d1d5db",bg:"#1f2937",newline:!0,escapeXML:!0});function A(){return(0,a.jsxs)("div",{"data-testid":"thinking-indicator",className:"flex items-center gap-2 py-2 px-1 text-gray-400",children:[(0,a.jsxs)("span",{className:"flex gap-1",children:[(0,a.jsx)("span",{className:"animate-pulse delay-0",children:"."}),(0,a.jsx)("span",{className:"animate-pulse delay-150",children:"."}),(0,a.jsx)("span",{className:"animate-pulse delay-300",children:"."})]}),(0,a.jsx)("span",{className:"text-sm",children:"Thinking"})]})}let F=(0,l.memo)(function(e){let{output:t,isActive:r,isThinking:n=!1,autoScroll:s=!0,onScrollChange:o,className:i=""}=e,{scrollRef:c,autoScroll:d,handleScroll:u,scrollToBottom:m}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{initialAutoScroll:t=!0,onAutoScrollChange:r}=e,a=(0,l.useRef)(null),[n,s]=(0,l.useState)(t),o=(0,l.useCallback)(e=>{s(e),null==r||r(e)},[r]),i=(0,l.useCallback)(()=>{let e=a.current;if(!e)return!0;let{scrollTop:t,scrollHeight:r,clientHeight:n}=e;return r-n-t<=50},[]),c=(0,l.useCallback)(()=>{let e=i();e&&!n?o(!0):!e&&n&&o(!1)},[n,i,o]),d=(0,l.useCallback)(()=>{let e=a.current;e&&(e.scrollTo({top:e.scrollHeight,behavior:"smooth"}),n||o(!0))},[n,o]);return{scrollRef:a,autoScroll:n,setAutoScroll:o,scrollToBottom:d,handleScroll:c}}({initialAutoScroll:s,onAutoScrollChange:o}),x=function(e){let t=R.toHtml(e);return M().sanitize(t,{ALLOWED_TAGS:["span","br"],ALLOWED_ATTR:["style"],ALLOW_DATA_ATTR:!1})}(t||"");(0,l.useEffect)(()=>{d&&c.current&&c.current.scrollTo({top:c.current.scrollHeight,behavior:"smooth"})},[x,d,c]);let h=(0,l.useMemo)(()=>["terminal","font-mono","text-sm","p-4","rounded-lg","overflow-y-auto","overflow-x-hidden","bg-gray-900","text-gray-300","border","border-gray-700","h-full",r?"active":"",r?"border-blue-500":"",i].filter(Boolean).join(" "),[r,i]);return(0,a.jsxs)("div",{className:"relative h-full flex flex-col",children:[(0,a.jsxs)("div",{ref:c,role:"log","aria-live":"polite","aria-label":"Terminal output",className:h,onScroll:u,children:[(0,a.jsx)("div",{className:"whitespace-pre-wrap break-words",dangerouslySetInnerHTML:{__html:x}}),r&&n&&(0,a.jsx)(A,{})]}),!d&&(0,a.jsx)("button",{onClick:m,className:"absolute bottom-4 right-4 bg-blue-600 hover:bg-blue-700 text-white px-3 py-1 rounded-md text-sm shadow-lg transition-colors","aria-label":"Scroll to bottom",children:"Scroll to bottom"})]})}),P=/(\/[^\s\n<>"']+\.[a-zA-Z0-9]+)/g;function D(e){let t=e.split("\n");if(t.length<=5&&e.length<=300)return{text:e,isTruncated:!1};let r=t.slice(0,5).join("\n");return r.length>300&&(r=r.slice(0,300)),{text:r,isTruncated:!0}}let I=(0,l.memo)(function(e){let{content:t,onFilePathClick:r}=e,n=(0,l.useMemo)(()=>(function(e){let t=e.match(P);if(!t||0===t.length)return[{type:"text",content:e}];let r=[],a=0;return t.forEach(t=>{let n=e.indexOf(t,a);n>a&&r.push({type:"text",content:e.slice(a,n)}),r.push({type:"path",content:t}),a=n+t.length}),a<e.length&&r.push({type:"text",content:e.slice(a)}),r})(t),[t]),s=(0,l.useCallback)(e=>()=>r(e),[r]);return(0,a.jsx)("span",{children:n.map((e,t)=>"path"===e.type?(0,a.jsx)("button",{type:"button",onClick:s(e.content),className:"text-blue-400 hover:text-blue-300 hover:underline cursor-pointer font-mono text-sm","aria-label":"Open file: ".concat(e.content),children:e.content},t):(0,a.jsx)("span",{children:e.content},t))})});function _(){return(0,a.jsxs)("div",{"data-testid":"pending-indicator",className:"flex items-center gap-2 text-gray-400 py-2",children:[(0,a.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse"}),(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"150ms"}}),(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),(0,a.jsx)("span",{className:"text-sm",children:"Waiting for response..."})]})}let z=(0,l.memo)(function(e){let{message:t,onFilePathClick:r}=e,n=(0,l.useMemo)(()=>t.timestamp.toLocaleTimeString(),[t.timestamp]);return(0,a.jsxs)("div",{className:"bg-blue-900/30 border-l-4 border-blue-500 p-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-blue-400",children:"You"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:n})]}),(0,a.jsx)("div",{className:"text-sm text-gray-200 whitespace-pre-wrap break-words",children:(0,a.jsx)(I,{content:t.content,onFilePathClick:r})})]})}),O=(0,l.memo)(function(e){let{message:t,index:r,total:n,isExpanded:s,onFilePathClick:o}=e,i=(0,l.useMemo)(()=>t.timestamp.toLocaleTimeString(),[t.timestamp]),{text:c,isTruncated:d}=(0,l.useMemo)(()=>D(t.content),[t.content]),u=s||!d?t.content:c;return(0,a.jsxs)("div",{className:"assistant-message-item",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-gray-400",children:"Assistant"}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:i}),n>1&&(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",r+1,"/",n,")"]})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-200 whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:[(0,a.jsx)(I,{content:u,onFilePathClick:o}),!s&&d&&(0,a.jsx)("span",{className:"text-gray-500",children:"..."})]})]})}),W=(0,l.memo)(function(e){let{messages:t,isExpanded:r,onFilePathClick:n}=e;return(0,a.jsx)("div",{className:"bg-gray-800/50 border-l-4 border-gray-600 p-3 border-t border-gray-700 space-y-3",children:t.map((e,s)=>(0,a.jsxs)(l.Fragment,{children:[s>0&&(0,a.jsx)("div",{"data-testid":"assistant-message-divider",className:"border-t border-dashed border-gray-600"}),(0,a.jsx)(O,{message:e,index:s,total:t.length,isExpanded:r,onFilePathClick:n})]},e.id))})});function B(){return(0,a.jsxs)("div",{"data-testid":"orphan-indicator",className:"bg-yellow-900/20 text-yellow-400 text-xs px-3 py-1 flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("span",{children:"System Message"})]})}let U=(0,l.memo)(function(e){let{pair:t,onFilePathClick:r,isExpanded:n=!1,onToggleExpand:s}=e,o=(0,l.useMemo)(()=>t.assistantMessages.some(e=>{let{isTruncated:t}=D(e.content);return t}),[t.assistantMessages]),i=(0,l.useCallback)(()=>{s&&s()},[s]),c=(0,l.useMemo)(()=>{let e="pending"===t.status?"pending":"orphan"===t.status?"orphan border-l-4 border-yellow-600":"";return"".concat("border border-gray-700 rounded-lg overflow-hidden mb-4 transition-colors"," ").concat(e).trim()},[t.status]),d=(0,l.useMemo)(()=>{if(t.userMessage){let e=t.userMessage.content.substring(0,50);return"Conversation: ".concat(e).concat(t.userMessage.content.length>50?"...":"")}return"System message"},[t.userMessage]);return(0,a.jsxs)("div",{"data-testid":"conversation-pair-card",role:"article","aria-label":d,className:c,children:["orphan"===t.status&&(0,a.jsx)(B,{}),t.userMessage&&(0,a.jsx)(z,{message:t.userMessage,onFilePathClick:r}),"pending"===t.status?(0,a.jsx)("div",{className:"bg-gray-800/30 border-l-4 border-gray-600 p-3 border-t border-gray-700",children:(0,a.jsx)(_,{})}):t.assistantMessages.length>0?(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(W,{messages:t.assistantMessages,isExpanded:n,onFilePathClick:r}),o&&(0,a.jsx)("div",{className:"absolute top-2 right-2",children:(0,a.jsxs)("button",{type:"button",onClick:i,className:"text-xs text-blue-400 hover:text-blue-300 flex items-center gap-1 transition-colors bg-gray-800/80 px-2 py-1 rounded","aria-expanded":n,"aria-label":n?"Collapse message":"Expand message",children:[(0,a.jsx)("svg",{className:"w-3 h-3 transition-transform ".concat(n?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})}),n?"Collapse":"Expand"]})})]}):null]})});function V(){return(0,a.jsxs)("div",{"data-testid":"loading-indicator",className:"flex items-center justify-center py-4",role:"status","aria-label":"Loading messages",children:[(0,a.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse"}),(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse delay-100"}),(0,a.jsx)("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-pulse delay-200"})]}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-400",children:"Loading..."})]})}function H(){return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-gray-500",children:[(0,a.jsx)("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,a.jsx)("p",{className:"text-sm",children:"No messages yet"})]})}let Y=["h-full","flex","flex-col","overflow-y-auto","overflow-x-hidden","bg-gray-900","rounded-lg","border","border-gray-700"],Z=(0,l.memo)(function(e){let{messages:t,worktreeId:r,onFilePathClick:n,isLoading:s=!1,className:o=""}=e,i=(0,l.useRef)(null),c=(0,l.useRef)(0),d=(0,l.useRef)(t.length);(0,l.useLayoutEffect)(()=>{let e=i.current;e&&(c.current=e.scrollTop)}),(0,l.useLayoutEffect)(()=>{let e=i.current,r=d.current;e&&t.length===r&&requestAnimationFrame(()=>{e.scrollTop=c.current}),d.current=t.length},[t.length]);let{pairs:u,isExpanded:m,toggleExpand:x}=function(e){let t=(0,l.useMemo)(()=>(function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.timestamp.getTime()-t.timestamp.getTime()),r=[],a=null;for(let e of t)if("user"===e.role)a={id:e.id,userMessage:e,assistantMessages:[],status:"pending"},r.push(a);else if("assistant"===e.role){if(a&&null!==a.userMessage)a.assistantMessages.push(e),a.status="completed";else if(a&&null===a.userMessage)a.assistantMessages.push(e);else{let t={id:"orphan-".concat(e.id),userMessage:null,assistantMessages:[e],status:"orphan"};r.push(t),a=t}}return r})(e),[e]),[r,a]=(0,l.useState)(new Set),n=(0,l.useCallback)(e=>{a(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),s=(0,l.useCallback)(e=>r.has(e),[r]),o=(0,l.useCallback)(()=>{a(new Set(t.map(e=>e.id)))},[t]);return{pairs:t,expandedPairs:r,toggleExpand:n,isExpanded:s,expandAll:o,collapseAll:(0,l.useCallback)(()=>{a(new Set)},[])}}(t),h=(0,l.useMemo)(()=>[...Y,o].filter(Boolean).join(" "),[o]),p=(0,l.useCallback)(e=>n(e),[n]),f=(0,l.useCallback)(e=>()=>x(e),[x]);return(0,a.jsxs)("div",{ref:i,role:"region","aria-label":"Message history",className:h,children:[(0,a.jsx)("div",{className:"sticky top-0 bg-gray-900 border-b border-gray-700 px-4 py-2 z-10",children:(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:"Message History"})}),(0,a.jsx)("div",{className:"flex-1 p-4 min-h-0",children:s?(0,a.jsx)(V,{}):0===t.length?(0,a.jsx)(H,{}):u.map(e=>(0,a.jsx)(U,{pair:e,onFilePathClick:p,isExpanded:m(e.id),onToggleExpand:f(e.id)},e.id))})]})}),q={fadeIn:"animate-fade-in",fadeOut:"animate-fade-out",none:""};function G(e){let{visible:t,duration:r=200}=e,[a,n]=(0,l.useState)(t?"visible":"hidden"),s=(0,l.useRef)(null),o=(0,l.useRef)(t);(0,l.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,l.useEffect)(()=>{let e=o.current;o.current=t,s.current&&(clearTimeout(s.current),s.current=null);let a=e=>{s.current=setTimeout(()=>{n(e),s.current=null},r)};t&&!e?(n("fade-in"),a("visible")):!t&&e?(n("fade-out"),a("hidden")):t?n(e=>"fade-out"===e?(a("visible"),"fade-in"):e):n(e=>"fade-in"===e?(a("hidden"),"fade-out"):e)},[t,r]);let i="hidden"!==a,c="fade-in"===a||"fade-out"===a;return{shouldRender:i,animationClass:(0,l.useMemo)(()=>{switch(a){case"fade-in":return q.fadeIn;case"fade-out":return q.fadeOut;default:return q.none}},[a]),isAnimating:c}}let K="\n px-6 py-2 rounded-lg font-medium transition-all\n disabled:opacity-50 disabled:cursor-not-allowed\n focus:outline-none focus:ring-2 focus:ring-offset-2\n".trim(),J="bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500";function X(e){let{promptData:t,answering:r,onRespond:n,onDismiss:s,labelId:o}=e,[i,c]=(0,l.useState)(()=>{if("multiple_choice"===t.type){var e;let r=t.options.find(e=>e.isDefault);return null!==(e=null==r?void 0:r.number)&&void 0!==e?e:null}return null}),[d,u]=(0,l.useState)(""),[m,x]=(0,l.useState)(!1),h=(0,l.useMemo)(()=>{var e;return"multiple_choice"!==t.type?null:null!==(e=t.options.find(e=>e.number===i))&&void 0!==e?e:null},[t,i]),p=(null==h?void 0:h.requiresTextInput)===!0,f=r||m,g=(0,l.useCallback)(async e=>{if(!f){x(!0);try{await n(e)}catch(e){}finally{x(!1)}}},[f,n]),b=(0,l.useCallback)(async()=>{if(!f&&null!==i){x(!0);try{let e=p&&d.trim()?d.trim():i.toString();await n(e)}catch(e){}finally{x(!1)}}},[f,n,i,p,d]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("h3",{id:o,className:"text-lg font-semibold text-yellow-800 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xl","aria-hidden":"true",children:"?"}),"Claudeからの確認"]}),s&&(0,a.jsx)("button",{type:"button",onClick:s,"aria-label":"close",className:"p-1 rounded hover:bg-yellow-200 transition-colors",children:(0,a.jsx)("svg",{className:"w-5 h-5 text-yellow-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsx)("p",{className:"text-gray-800 leading-relaxed",children:t.question}),f&&(0,a.jsxs)("div",{"data-testid":"answering-indicator",className:"flex items-center gap-2 text-sm text-gray-500",role:"status","aria-live":"polite",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-blue-600","aria-hidden":"true"}),(0,a.jsx)("span",{children:"送信中..."})]}),"yes_no"===t.type&&(0,a.jsx)(Q,{promptData:t,disabled:f,onYes:()=>g("yes"),onNo:()=>g("no")}),"multiple_choice"===t.type&&(0,a.jsx)($,{promptData:t,disabled:f,selectedOption:i,onSelectOption:c,textInputValue:d,onTextInputChange:u,showTextInput:p,onSubmit:b})]})}function Q(e){let{promptData:t,disabled:r,onYes:n,onNo:s}=e,l="yes"===t.defaultOption,o="no"===t.defaultOption,i="".concat(K," ").concat(J," ").concat(l?"primary default highlighted":""),c="".concat(K," ").concat(o?"bg-gray-600 text-white hover:bg-gray-700 primary default highlighted":"bg-white border-2 border-gray-300 hover:bg-gray-50 text-gray-800 focus:ring-gray-500");return(0,a.jsxs)("div",{className:"flex items-center gap-3",role:"group","aria-label":"Yes or No options",children:[(0,a.jsx)("button",{type:"button",onClick:n,disabled:r,className:i,children:"Yes"}),(0,a.jsx)("button",{type:"button",onClick:s,disabled:r,className:c,children:"No"})]})}function $(e){let{promptData:t,disabled:r,selectedOption:n,onSelectOption:s,textInputValue:o,onTextInputChange:i,showTextInput:c,onSubmit:d}=e,u=(0,l.useId)(),m=(0,l.useCallback)(e=>{let t=n===e,a=r?"opacity-50 cursor-not-allowed":"";return"".concat("flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all"," ").concat(t?"bg-blue-50 border-2 border-blue-500":"bg-white border-2 border-gray-200 hover:border-gray-300"," ").concat(a)},[n,r]);return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("fieldset",{children:[(0,a.jsx)("legend",{className:"sr-only",children:"Select an option"}),(0,a.jsx)("div",{className:"space-y-2",children:t.options.map(e=>(0,a.jsxs)("label",{className:m(e.number),children:[(0,a.jsx)("input",{type:"radio",name:u,value:e.number,checked:n===e.number,onChange:()=>s(e.number),disabled:r,className:"mt-1","aria-describedby":e.isDefault?"default-".concat(e.number):void 0}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("span",{className:"font-medium",children:[e.number,". ",e.label]}),e.isDefault&&(0,a.jsx)("span",{id:"default-".concat(e.number),className:"ml-2 text-xs text-blue-600 bg-blue-100 px-2 py-0.5 rounded",children:"デフォルト"})]})]},e.number))})]}),c&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("label",{htmlFor:"text-input-".concat(u),className:"sr-only",children:"Custom value input"}),(0,a.jsx)("input",{id:"text-input-".concat(u),type:"text",value:o,onChange:e=>i(e.target.value),disabled:r,placeholder:"値を入力してください...",className:"w-full px-4 py-2 border-2 border-gray-300 rounded-lg focus:outline-none focus:border-blue-500 disabled:opacity-50"})]}),(0,a.jsx)("button",{type:"button",onClick:d,disabled:r||null===n,className:"w-full ".concat(K," ").concat(J),children:"Submit"})]})}function ee(e){let t,{promptData:r,messageId:n,visible:s,answering:o,onRespond:i,onDismiss:c}=e,{shouldRender:d,animationClass:u}=G({visible:s&&null!==r,duration:200}),m=(0,l.useId)();if(!d||!r)return null;let x=(t="opacity-100","animate-fade-in"===u?t="opacity-100 transform translate-y-0":"animate-fade-out"===u&&(t="opacity-0 transform translate-y-2"),"".concat("bg-yellow-50 border-2 border-yellow-300 rounded-lg p-4 shadow-lg transition-all duration-200 ease-in-out"," ").concat(u," ").concat(t));return(0,a.jsx)(p,{componentName:"PromptPanel",children:(0,a.jsx)("div",{"data-testid":"prompt-panel",role:"dialog","aria-labelledby":m,"aria-modal":"true",className:x,children:(0,a.jsx)(X,{promptData:r,answering:o,onRespond:i,onDismiss:c,labelId:m})})})}var et=r(8672);let er=(0,l.memo)(function(e){let{path:t,className:r="w-6 h-6"}=e;return(0,a.jsx)("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:t})})}),ea={back:"M15 19l-7-7 7-7",menu:"M4 6h16M4 12h16M4 18h16"};function en(e){let{worktreeName:t,repositoryName:r,status:n,onBackClick:s,onMenuClick:o}=e,i=(0,l.useMemo)(()=>et.xh[n],[n]);return(0,a.jsx)("header",{"data-testid":"mobile-header",role:"banner",className:"fixed top-0 inset-x-0 bg-white border-b border-gray-200 shadow-sm pt-safe z-40",children:(0,a.jsxs)("div",{className:"flex items-center justify-between h-14 px-4",children:[(0,a.jsx)("div",{className:"w-10 flex-shrink-0",children:s&&(0,a.jsx)("button",{type:"button",onClick:s,"aria-label":"Back",className:"p-2 -ml-2 rounded-full hover:bg-gray-100 transition-colors",children:(0,a.jsx)(er,{path:ea.back})})}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center min-w-0 px-2",children:["spinner"===i.type?(0,a.jsx)("span",{"data-testid":"status-indicator","aria-label":i.label,className:"w-2.5 h-2.5 rounded-full mr-2 flex-shrink-0 border-2 border-t-transparent animate-spin ".concat(i.className)}):(0,a.jsx)("span",{"data-testid":"status-indicator","aria-label":i.label,className:"w-2.5 h-2.5 rounded-full mr-2 flex-shrink-0 ".concat(i.className)}),(0,a.jsxs)("div",{className:"flex flex-col items-center min-w-0",children:[(0,a.jsx)("h1",{role:"heading","data-testid":"worktree-name",title:t,className:"text-sm font-medium text-gray-900 truncate text-center leading-tight",children:t}),r&&(0,a.jsx)("span",{className:"text-xs text-gray-500 truncate text-center",children:r})]})]}),(0,a.jsx)("div",{className:"w-10 flex-shrink-0 flex justify-end",children:o&&(0,a.jsx)("button",{type:"button",onClick:o,"aria-label":"Menu",className:"p-2 -mr-2 rounded-full hover:bg-gray-100 transition-colors",children:(0,a.jsx)(er,{path:ea.menu})})})]})})}let es=(0,l.memo)(function(e){let{path:t,className:r="w-5 h-5"}=e;return(0,a.jsx)("svg",{className:r,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:t})})}),el=[{id:"terminal",label:"Terminal",icon:(0,a.jsx)(es,{path:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})},{id:"history",label:"History",icon:(0,a.jsx)(es,{path:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})},{id:"files",label:"Files",icon:(0,a.jsx)(es,{path:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})},{id:"memo",label:"Memo",icon:(0,a.jsx)(es,{path:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})},{id:"info",label:"Info",icon:(0,a.jsx)(es,{path:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}];function eo(e){let{activeTab:t,onTabChange:r,hasNewOutput:n=!1,hasPrompt:s=!1}=e,o=(0,l.useCallback)(e=>{r(e)},[r]),i=(0,l.useCallback)(e=>{let r=e===t;return"".concat("flex flex-col items-center justify-center flex-1 py-2 px-1 transition-colors relative"," ").concat(r?"text-blue-600 bg-blue-50":"text-gray-500 hover:text-gray-700 hover:bg-gray-50")},[t]),c=(0,l.useMemo)(()=>(0,a.jsxs)(a.Fragment,{children:[n&&(0,a.jsx)("span",{"data-testid":"new-output-badge",className:"absolute top-1 right-1 w-2 h-2 bg-green-500 rounded-full","aria-label":"New output available"}),s&&(0,a.jsx)("span",{"data-testid":"prompt-badge",className:"absolute top-1 right-3 w-2 h-2 bg-yellow-500 rounded-full","aria-label":"Prompt waiting"})]}),[n,s]);return(0,a.jsx)("nav",{"data-testid":"mobile-tab-bar",role:"tablist","aria-label":"Mobile navigation",className:"fixed bottom-0 inset-x-0 bg-white border-t border-gray-200 flex pb-safe z-40",children:el.map(e=>(0,a.jsxs)("button",{type:"button",role:"tab","aria-selected":t===e.id,"aria-label":e.label,onClick:()=>o(e.id),className:i(e.id),children:[e.icon,(0,a.jsx)("span",{className:"text-xs mt-1",children:e.label}),"terminal"===e.id&&c]},e.id))})}let ei={base:"px-6 py-3 rounded-lg font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none focus:ring-2 focus:ring-offset-2",primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-white border-2 border-gray-300 hover:bg-gray-50 text-gray-800 focus:ring-gray-500",defaultSelected:"bg-gray-600 text-white hover:bg-gray-700"};function ec(e){let{promptData:t,visible:r,answering:n,onRespond:s,onDismiss:o}=e,{shouldRender:i,animationClass:c}=G({visible:r&&null!==t,duration:300}),d=(0,l.useId)(),[u,m]=(0,l.useState)(null),[x,h]=(0,l.useState)(0),f=(0,l.useRef)(null);(0,l.useEffect)(()=>{r||h(0)},[r]);let g=(0,l.useCallback)(e=>{m(e.touches[0].clientY)},[]),b=(0,l.useCallback)(e=>{if(null===u)return;let t=e.touches[0].clientY-u;t>0&&h(t)},[u]),y=(0,l.useCallback)(()=>{x>100&&o&&o(),h(0),m(null)},[x,o]),v=(0,l.useCallback)(()=>{o&&o()},[o]),w=(0,l.useCallback)(e=>{e.stopPropagation()},[]);if(!i||!t)return null;let j="animate-fade-out"===c,N=x>0?"translateY(".concat(x,"px)"):void 0;return(0,a.jsxs)(p,{componentName:"MobilePromptSheet",children:[(0,a.jsx)("div",{"data-testid":"prompt-overlay",onClick:v,className:"fixed inset-0 bg-black/50 z-50 transition-opacity duration-300 ".concat(j?"opacity-0":"opacity-100"," ").concat(j?"pointer-events-none":""),"aria-hidden":"true"}),(0,a.jsxs)("div",{ref:f,"data-testid":"mobile-prompt-sheet",role:"dialog","aria-modal":"true","aria-labelledby":d,onClick:w,onTouchStart:g,onTouchMove:b,onTouchEnd:y,style:{transform:N},className:"fixed bottom-0 inset-x-0 bg-white rounded-t-2xl z-50 pb-safe transform transition-transform duration-300 ".concat(j?"translate-y-full":"translate-y-0"),children:[(0,a.jsx)("div",{className:"flex justify-center pt-3 pb-2",children:(0,a.jsx)("div",{"data-testid":"drag-handle",className:"w-10 h-1 bg-gray-300 rounded-full","aria-hidden":"true"})}),(0,a.jsx)("div",{className:"px-4 pb-6",children:(0,a.jsx)(ed,{promptData:t,answering:n,onRespond:s,labelId:d})})]})]})}function ed(e){let{promptData:t,answering:r,onRespond:n,labelId:s}=e,[o,i]=(0,l.useState)(()=>{if("multiple_choice"===t.type){var e;let r=t.options.find(e=>e.isDefault);return null!==(e=null==r?void 0:r.number)&&void 0!==e?e:null}return null}),[c,d]=(0,l.useState)(""),[u,m]=(0,l.useState)(!1),x=(0,l.useMemo)(()=>{var e;return"multiple_choice"!==t.type?null:null!==(e=t.options.find(e=>e.number===o))&&void 0!==e?e:null},[t,o]),h=(null==x?void 0:x.requiresTextInput)===!0,p=r||u,f=(0,l.useCallback)(async e=>{if(!p){m(!0);try{await n(e)}catch(e){}finally{m(!1)}}},[p,n]),g=(0,l.useCallback)(async()=>{if(!p&&null!==o){m(!0);try{let e=h&&c.trim()?c.trim():o.toString();await n(e)}catch(e){}finally{m(!1)}}},[p,n,o,h,c]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{id:s,className:"text-lg font-semibold text-gray-900",children:"Claudeからの確認"}),(0,a.jsx)("p",{className:"text-gray-700 leading-relaxed",children:t.question}),p&&(0,a.jsxs)("div",{"data-testid":"answering-indicator",className:"flex items-center gap-2 text-sm text-gray-500",role:"status","aria-live":"polite",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-gray-300 border-t-blue-600","aria-hidden":"true"}),(0,a.jsx)("span",{children:"送信中..."})]}),"yes_no"===t.type&&(0,a.jsx)(eu,{promptData:t,disabled:p,onYes:()=>f("yes"),onNo:()=>f("no")}),"multiple_choice"===t.type&&(0,a.jsx)(em,{promptData:t,disabled:p,selectedOption:o,onSelectOption:i,textInputValue:c,onTextInputChange:d,showTextInput:h,onSubmit:g})]})}let eu=(0,l.memo)(function(e){let{promptData:t,disabled:r,onYes:n,onNo:s}=e,l="yes"===t.defaultOption,o="no"===t.defaultOption;return(0,a.jsxs)("div",{className:"flex gap-3",role:"group","aria-label":"Yes or No options",children:[(0,a.jsx)("button",{type:"button",onClick:n,disabled:r,className:"flex-1 ".concat(ei.base," ").concat(ei.primary," ").concat(l?"ring-2 ring-blue-300":""),children:"Yes"}),(0,a.jsx)("button",{type:"button",onClick:s,disabled:r,className:"flex-1 ".concat(ei.base," ").concat(o?ei.defaultSelected:ei.secondary),children:"No"})]})}),em=(0,l.memo)(function(e){let{promptData:t,disabled:r,selectedOption:n,onSelectOption:s,textInputValue:o,onTextInputChange:i,showTextInput:c,onSubmit:d}=e,u=(0,l.useId)();return(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("fieldset",{children:[(0,a.jsx)("legend",{className:"sr-only",children:"Select an option"}),(0,a.jsx)("div",{className:"space-y-2",children:t.options.map(e=>{let t=n===e.number;return(0,a.jsxs)("label",{className:"flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all ".concat(t?"bg-blue-50 border-2 border-blue-500":"bg-white border-2 border-gray-200 hover:border-gray-300"," ").concat(r?"opacity-50 cursor-not-allowed":""),children:[(0,a.jsx)("input",{type:"radio",name:u,value:e.number,checked:t,onChange:()=>s(e.number),disabled:r,className:"mt-1"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("span",{className:"font-medium",children:[e.number,". ",e.label]}),e.isDefault&&(0,a.jsx)("span",{className:"ml-2 text-xs text-blue-600 bg-blue-100 px-2 py-0.5 rounded",children:"デフォルト"})]})]},e.number)})})]}),c&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("label",{htmlFor:"text-input-".concat(u),className:"sr-only",children:"Custom value input"}),(0,a.jsx)("input",{id:"text-input-".concat(u),type:"text",value:o,onChange:e=>i(e.target.value),disabled:r,placeholder:"値を入力してください...",className:"w-full px-4 py-3 border-2 border-gray-300 rounded-lg focus:outline-none focus:border-blue-500 disabled:opacity-50"})]}),(0,a.jsx)("button",{type:"button",onClick:d,disabled:r||null===n,className:"w-full ".concat(ei.base," ").concat(ei.primary),children:"Submit"})]})});var ex=r(6940);let eh={isOpen:!1,position:{x:0,y:0},targetPath:null,targetType:null};var ep=r(88964),ef=r(49465),eg=r(17689),eb=r(45675),ey=r(18930);let ev=(0,l.memo)(function(e){let{isOpen:t,position:r,targetPath:n,targetType:s,onClose:o,onNewFile:i,onNewDirectory:c,onRename:d,onDelete:u,onUpload:m}=e,x=(0,l.useRef)(null),h=(0,l.useCallback)(e=>{e&&n&&e(n),o()},[n,o]),p=[{id:"new-file",label:"New File",icon:(0,a.jsx)(ep.Z,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>h(i),showFor:["directory"]},{id:"new-directory",label:"New Directory",icon:(0,a.jsx)(ef.Z,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>h(c),showFor:["directory"]},{id:"upload",label:"Upload File",icon:(0,a.jsx)(eg.Z,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>h(m),showFor:["directory"],showDividerAfter:!0},{id:"rename",label:"Rename",icon:(0,a.jsx)(eb.Z,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>h(d),showDividerAfter:"file"===s},{id:"delete",label:"Delete",icon:(0,a.jsx)(ey.Z,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>h(u),variant:"danger"}].filter(e=>!e.showFor||s&&e.showFor.includes(s));return((0,l.useEffect)(()=>{if(!t)return;let e=e=>{if("Escape"===e.key){o();return}if("ArrowDown"===e.key||"ArrowUp"===e.key){var t;let r;e.preventDefault();let a=null===(t=x.current)||void 0===t?void 0:t.querySelectorAll('[role="menuitem"]');if(!(null==a?void 0:a.length))return;let n=Array.from(a).findIndex(e=>e===document.activeElement);r="ArrowDown"===e.key?n<a.length-1?n+1:0:n>0?n-1:a.length-1,a[r].focus()}};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,o]),(0,l.useEffect)(()=>{if(t&&x.current){let e=x.current.querySelector('[role="menuitem"]');e&&e.focus()}},[t]),t)?(0,a.jsx)("div",{ref:x,"data-testid":"context-menu",role:"menu","aria-label":"File actions",className:"fixed z-50 min-w-[160px] py-1 bg-white rounded-lg shadow-lg border border-gray-200 animate-in fade-in-0 zoom-in-95 duration-100",style:{left:"".concat(r.x,"px"),top:"".concat(r.y,"px")},children:p.map((e,t)=>(0,a.jsxs)(l.Fragment,{children:[(0,a.jsxs)("button",{role:"menuitem",onClick:e.onClick,disabled:!n,className:"w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors focus:outline-none focus:bg-gray-100 ".concat("danger"===e.variant?"text-red-600 hover:bg-red-50 focus:bg-red-50":"text-gray-700 hover:bg-gray-100"," ").concat(n?"":"opacity-50 cursor-not-allowed"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]}),e.showDividerAfter&&t<p.length-1&&(0,a.jsx)("div",{"data-testid":"context-menu-divider",className:"my-1 border-t border-gray-200"})]},e.id))}):null});function ew(e,t){let r=null;return function(){for(var a=arguments.length,n=Array(a),s=0;s<a;s++)n[s]=arguments[s];r&&clearTimeout(r),r=setTimeout(()=>{e(...n),r=null},t)}}function ej(e){let t=new Set;for(let r of e){t.add(r);let e=r.split("/"),a="";for(let r=0;r<e.length-1;r++)a=a?"".concat(a,"/").concat(e[r]):e[r],t.add(a)}return t}let eN=(0,l.memo)(function(e){let{expanded:t}=e;return(0,a.jsx)("svg",{"data-testid":"chevron-icon",className:"w-4 h-4 text-gray-500 transition-transform ".concat(t?"rotate-90":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),ek=(0,l.memo)(function(e){let{open:t}=e;return(0,a.jsx)("svg",{"data-testid":"folder-icon",className:"w-5 h-5 text-yellow-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:t?(0,a.jsx)("path",{d:"M19 20H5c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h6l2 2h6c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2zM5 6v12h14V8h-7l-2-2H5z"}):(0,a.jsx)("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}),eC=(0,l.memo)(function(e){let{text:t,query:r}=e;if(!r||!r.trim())return(0,a.jsx)(a.Fragment,{children:t});let n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=t.split(RegExp("(".concat(n,")"),"gi"));return(0,a.jsx)(a.Fragment,{children:s.map((e,t)=>e.toLowerCase()===r.toLowerCase()?(0,a.jsx)("mark",{className:"bg-yellow-200 text-gray-900 px-0.5 rounded",children:e},t):(0,a.jsx)("span",{children:e},t))})}),eS=(0,l.memo)(function(e){let{extension:t}=e,r=(0,l.useMemo)(()=>t&&({ts:"text-blue-500",tsx:"text-blue-500",js:"text-yellow-400",jsx:"text-yellow-400",json:"text-yellow-600",md:"text-gray-500",css:"text-pink-500",scss:"text-pink-500",html:"text-orange-500",py:"text-green-500"})[t]||"text-gray-400",[t]);return(0,a.jsx)("svg",{"data-testid":"file-icon",className:"w-5 h-5 ".concat(r),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),eE=(0,l.memo)(function e(t){var r;let{item:n,path:s,depth:o,worktreeId:i,expanded:c,cache:d,onToggle:u,onFileSelect:m,onLoadChildren:x,onContextMenu:h,searchQuery:p,searchMode:f,matchedPaths:g}=t,[b,y]=(0,l.useState)(!1),v=s?"".concat(s,"/").concat(n.name):n.name,w=c.has(v),j="directory"===n.type,N=d.get(v),k=(0,l.useCallback)(async()=>{j?(w||N||(y(!0),await x(v),y(!1)),u(v)):null==m||m(v)},[j,w,N,v,x,u,m]),C=(0,l.useCallback)(e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),k())},[k]),S=(0,l.useCallback)(e=>{null==h||h(e,v,j?"directory":"file")},[v,j,h]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{"data-testid":"tree-item-".concat(n.name),role:"treeitem","aria-selected":!1,"aria-expanded":j?w:void 0,tabIndex:0,className:"flex items-center gap-2 py-1.5 pr-2 cursor-pointer hover:bg-gray-100 rounded transition-colors",style:{paddingLeft:"".concat(.5+1*Math.min(o,20),"rem")},onClick:k,onKeyDown:C,onContextMenu:S,children:[j?(0,a.jsx)("span",{className:"w-4 h-4 flex items-center justify-center",children:b?(0,a.jsx)("span",{className:"w-3 h-3 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}):(0,a.jsx)(eN,{expanded:w})}):(0,a.jsx)("span",{className:"w-4 h-4"}),j?(0,a.jsx)(ek,{open:w}):(0,a.jsx)(eS,{extension:n.extension}),(0,a.jsx)("span",{className:"flex-1 truncate text-sm text-gray-700",children:"name"===f&&p?(0,a.jsx)(eC,{text:n.name,query:p}):n.name}),(0,a.jsx)("span",{className:"text-xs text-gray-400 flex-shrink-0",children:j?void 0!==n.itemCount&&"".concat(n.itemCount," items"):void 0===(r=n.size)?"":r<1024?"".concat(r," B"):r<1048576?"".concat((r/1024).toFixed(1)," KB"):"".concat((r/1048576).toFixed(1)," MB")})]}),j&&w&&N&&(0,a.jsx)("div",{role:"group",children:N.filter(e=>{let t=v?"".concat(v,"/").concat(e.name):e.name;if(!(null==p?void 0:p.trim()))return!0;if("name"===f){let t=p.toLowerCase();return!!e.name.toLowerCase().includes(t)||"directory"===e.type}if("content"===f&&g&&g.size>0){if(g.has(t))return!0;if("directory"===e.type){for(let e of g)if(e.startsWith(t+"/"))return!0}return!1}return!0}).map(t=>(0,a.jsx)(e,{item:t,path:v,depth:o+1,worktreeId:i,expanded:c,cache:d,onToggle:u,onFileSelect:m,onLoadChildren:x,onContextMenu:h,searchQuery:p,searchMode:f,matchedPaths:g},t.name))})]})}),eT=(0,l.memo)(function(e){let{worktreeId:t,onFileSelect:r,onNewFile:n,onNewDirectory:s,onRename:o,onDelete:i,onUpload:c,className:d="",refreshTrigger:u=0,searchQuery:m,searchMode:x,searchResults:h,onSearchResultSelect:p}=e,[f,g]=(0,l.useState)(!0),[b,y]=(0,l.useState)(null),[v,w]=(0,l.useState)([]),[j,N]=(0,l.useState)(new Set),[k,C]=(0,l.useState)(()=>new Map),{menuState:S,openMenu:E,closeMenu:T}=function(){let[e,t]=(0,l.useState)(eh),r=(0,l.useCallback)((e,r,a)=>{e.preventDefault(),t({isOpen:!0,position:{x:e.clientX,y:e.clientY},targetPath:r,targetType:a})},[]),a=(0,l.useCallback)(()=>{t(e=>({...e,isOpen:!1}))},[]),n=(0,l.useCallback)(()=>{t(eh)},[]);return(0,l.useEffect)(()=>{if(!e.isOpen)return;let t=()=>{a()},r=setTimeout(()=>{document.addEventListener("click",t)},0);return()=>{clearTimeout(r),document.removeEventListener("click",t)}},[e.isOpen,a]),(0,l.useEffect)(()=>{if(!e.isOpen)return;let t=e=>{"Escape"===e.key&&a()};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e.isOpen,a]),{menuState:e,openMenu:r,closeMenu:a,resetMenu:n}}(),M=(0,l.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{let r=e?"/api/worktrees/".concat(t,"/tree/").concat(e):"/api/worktrees/".concat(t,"/tree"),a=await fetch(r);if(!a.ok)throw Error("Failed to load directory: ".concat(a.status));return await a.json()}catch(e){throw console.error("[FileTreeView] Error fetching directory:",e),e}},[t]);(0,l.useEffect)(()=>{let e=!0;return(async()=>{g(!0),y(null),C(new Map);try{let t=await M();e&&t&&w(t.items)}catch(t){e&&y(t instanceof Error?t.message:"Failed to load files")}finally{e&&g(!1)}})(),()=>{e=!1}},[M,u]);let L=(0,l.useCallback)(async e=>{if(!k.has(e))try{let t=await M(e);t&&k.set(e,t.items)}catch(e){console.error("[FileTreeView] Error loading children:",e)}},[k,M]),R=(0,l.useCallback)(e=>{N(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),A=(0,l.useMemo)(()=>"content"===x&&h&&0!==h.length?ej(h.map(e=>e.filePath)):new Set,[x,h]);(0,l.useEffect)(()=>{A.size>0&&N(e=>{let t=new Set(e);for(let e of A)(k.has(e)||(null==h?void 0:h.some(t=>t.filePath.startsWith(e+"/"))))&&t.add(e);return t})},[A,k,h]);let F=(0,l.useMemo)(()=>{if(!(null==m?void 0:m.trim()))return v;if("name"===x){let e=m.toLowerCase(),t=(r,a)=>r.filter(r=>{let n=a?"".concat(a,"/").concat(r.name):r.name,s=r.name.toLowerCase().includes(e);if("directory"===r.type){let e=k.get(n);if(e&&t(e,n).length>0)return!0}return s});return t(v,"")}return"content"===x&&A.size>0?v.filter(e=>{if(A.has(e.name))return!0;if("directory"===e.type){for(let t of A)if(t.startsWith(e.name+"/")||t===e.name)return!0}return!1}):v},[v,m,x,A,k]);return f?(0,a.jsxs)("div",{"data-testid":"file-tree-loading",className:"flex items-center justify-center p-4 ".concat(d),children:[(0,a.jsx)("span",{className:"w-5 h-5 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}),(0,a.jsx)("span",{className:"ml-2 text-sm text-gray-500",children:"Loading files..."})]}):b?(0,a.jsx)("div",{"data-testid":"file-tree-error",className:"p-4 bg-red-50 border border-red-200 rounded-lg ".concat(d),children:(0,a.jsx)("p",{className:"text-sm text-red-600",children:b})}):0===v.length?(0,a.jsx)("div",{"data-testid":"file-tree-empty",className:"p-4 text-center text-gray-500 ".concat(d),children:(0,a.jsx)("p",{className:"text-sm",children:"No files found"})}):(null==m?void 0:m.trim())&&0===F.length?(0,a.jsx)("div",{"data-testid":"file-tree-no-results",className:"p-4 text-center text-gray-500 ".concat(d),children:(0,a.jsxs)("p",{className:"text-sm",children:["No ","content"===x?"files containing":"files matching",' "',m,'"']})}):(0,a.jsxs)("div",{"data-testid":"file-tree-view",role:"tree","aria-label":"File tree",className:"overflow-auto bg-white ".concat(d),children:[F.map(e=>(0,a.jsx)(eE,{item:e,path:"",depth:0,worktreeId:t,expanded:j,cache:k,onToggle:R,onFileSelect:p||r,onLoadChildren:L,onContextMenu:E,searchQuery:m,searchMode:x,matchedPaths:A},e.name)),(0,a.jsx)(ev,{isOpen:S.isOpen,position:S.position,targetPath:S.targetPath,targetType:S.targetType,onClose:T,onNewFile:n,onNewDirectory:s,onRename:o,onDelete:i,onUpload:c})]})}),eM=(0,l.memo)(function(){return(0,a.jsx)("svg",{className:"w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),eL=(0,l.memo)(function(){return(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),eR=(0,l.memo)(function(){return(0,a.jsx)("div",{"data-testid":"search-loading",className:"w-4 h-4 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin","aria-label":"Searching..."})}),eA=(0,l.memo)(function(e){let{query:t,mode:r,isSearching:n,error:s,onQueryChange:o,onModeChange:i,onClear:c,placeholder:d="Search files...",className:u=""}=e,m=(0,l.useRef)(null),x=(0,l.useCallback)(e=>{o(e.target.value)},[o]),h=(0,l.useCallback)(()=>{var e;c(),null===(e=m.current)||void 0===e||e.focus()},[c]),p=(0,l.useCallback)(e=>{if("Escape"===e.key){if(t)h();else{var r;null===(r=m.current)||void 0===r||r.blur()}}},[t,h]);return(0,l.useEffect)(()=>{if(!(window.innerWidth<768)){let e=setTimeout(()=>{var e;null===(e=m.current)||void 0===e||e.focus()},100);return()=>clearTimeout(e)}},[]),(0,a.jsxs)("div",{"data-testid":"search-bar",className:"flex flex-col gap-2 p-2 bg-white border-b border-gray-200 ".concat(u),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)(eM,{})}),(0,a.jsx)("input",{ref:m,type:"text","data-testid":"search-input",value:t,onChange:x,onKeyDown:p,placeholder:d,className:"flex-1 min-w-0 px-2 py-1 text-sm bg-gray-50 border border-gray-200 rounded focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500","aria-label":"Search files","aria-busy":n}),(0,a.jsx)("div",{className:"flex-shrink-0 w-6 h-6 flex items-center justify-center",children:n?(0,a.jsx)(eR,{}):t?(0,a.jsx)("button",{type:"button","data-testid":"search-clear",onClick:h,className:"p-1 text-gray-400 hover:text-gray-600 rounded transition-colors","aria-label":"Clear search",children:(0,a.jsx)(eL,{})}):null})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("span",{className:"text-xs text-gray-500 mr-1",children:"Mode:"}),(0,a.jsx)("button",{type:"button","data-testid":"mode-name",onClick:()=>i("name"),className:"px-2 py-0.5 text-xs rounded transition-colors ".concat("name"===r?"bg-blue-100 text-blue-700 font-medium":"bg-gray-100 text-gray-600 hover:bg-gray-200"),"aria-pressed":"name"===r,children:"Name"}),(0,a.jsx)("button",{type:"button","data-testid":"mode-content",onClick:()=>i("content"),className:"px-2 py-0.5 text-xs rounded transition-colors ".concat("content"===r?"bg-blue-100 text-blue-700 font-medium":"bg-gray-100 text-gray-600 hover:bg-gray-200"),"aria-pressed":"content"===r,children:"Content"})]}),s&&(0,a.jsx)("div",{"data-testid":"search-error",className:"text-xs text-red-600 bg-red-50 px-2 py-1 rounded",role:"alert",children:s})]})}),eF=(0,l.memo)(function(){return(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})})}),eP=(0,l.memo)(function(){return(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}),eD=(0,l.memo)(function(){return(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),eI=[{id:"history",label:"History",icon:(0,a.jsx)(eF,{})},{id:"files",label:"Files",icon:(0,a.jsx)(eP,{})},{id:"memo",label:"Memo",icon:(0,a.jsx)(eD,{})}],e_=(0,l.memo)(function(e){let{activeTab:t,onTabChange:r,className:n=""}=e,s=(0,l.useCallback)(e=>{r(e)},[r]),o=(0,l.useCallback)((e,t)=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),r(e))},[r]),i=(0,l.useCallback)(e=>{let r=e===t;return"".concat("flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-inset"," ").concat(r?"bg-blue-50 text-blue-600 border-b-2 border-blue-600":"text-gray-500 hover:text-gray-700 hover:bg-gray-50")},[t]);return(0,a.jsx)("div",{role:"tablist","aria-label":"Left pane view switcher",className:"flex border-b border-gray-200 bg-white ".concat(n),children:eI.map(e=>(0,a.jsxs)("button",{type:"button",role:"tab","aria-selected":t===e.id,"aria-label":e.label,tabIndex:0,onClick:()=>s(e.id),onKeyDown:t=>o(e.id,t),className:i(e.id),children:[e.icon,(0,a.jsx)("span",{children:e.label})]},e.id))})});var ez=r(10789);function eO(e){let{src:t,alt:r,onError:n}=e,[s,o]=(0,l.useState)(!1);return s?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-gray-500",children:[(0,a.jsx)("svg",{className:"w-16 h-16 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,a.jsx)("p",{className:"text-sm",children:"Failed to load image"}),(0,a.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:r})]}):(0,a.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,a.jsx)("img",{src:t,alt:r,onError:()=>{o(!0),null==n||n()},style:{maxWidth:"100%",maxHeight:"500px",objectFit:"contain"},className:"rounded-lg shadow-sm"})})}function eW(e){let{isOpen:t,onClose:r,worktreeId:n,filePath:s}=e,[o,i]=(0,l.useState)(null),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!t||!s){i(null),m(null);return}(async()=>{d(!0),m(null);try{let e=await fetch("/api/worktrees/".concat(n,"/files/").concat(s));if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to load file")}let t=await e.json();i(t)}catch(e){m(e instanceof Error?e.message:"Failed to load file")}finally{d(!1)}})()},[t,n,s]),(0,a.jsx)(ez.u_,{isOpen:t,onClose:r,title:s,size:"xl",children:(0,a.jsxs)("div",{className:"max-h-[60vh] sm:max-h-[70vh] overflow-y-auto",children:[c&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),(0,a.jsx)("p",{className:"ml-3 text-gray-600",children:"Loading file..."})]}),u&&(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("svg",{className:"w-5 h-5 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("p",{className:"text-sm text-red-800",children:u})]})}),o&&!c&&!u&&(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"bg-gray-100 px-4 py-2 border-b border-gray-200",children:(0,a.jsxs)("p",{className:"text-xs text-gray-600 font-mono",children:[o.worktreePath,"/",o.path]})}),o.isImage?(0,a.jsx)(eO,{src:o.content,alt:o.path,mimeType:o.mimeType}):(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("pre",{className:"text-sm overflow-x-auto",children:(0,a.jsx)("code",{className:"language-".concat(o.extension),children:o.content})})})]})]})})}var eB=r(54887),eU=r(53012),eV=r(23260),eH=r(57934),eY=r(12158);r(57792);var eZ=r(76865),eq=r(48736),eG=r(93807),eK=r(42208),eJ=r(74440),eX=r(47416),eQ=r(83229),e$=r(32489),e0=r(41671),e1=r(99388),e2=r(33245);function e4(e){let{type:t,iconColor:r}=e,n="h-5 w-5 ".concat(r);switch(t){case"success":return(0,a.jsx)(e0.Z,{className:n,"data-testid":"toast-icon-success"});case"error":return(0,a.jsx)(e1.Z,{className:n,"data-testid":"toast-icon-error"});default:return(0,a.jsx)(e2.Z,{className:n,"data-testid":"toast-icon-info"})}}function e5(e){let{id:t,message:r,type:n,onClose:s,duration:o=3e3}=e,i=(0,l.useRef)(null),c=function(e){switch(e){case"success":return{bgColor:"bg-green-50",borderColor:"border-green-200",textColor:"text-green-800",iconColor:"text-green-500"};case"error":return{bgColor:"bg-red-50",borderColor:"border-red-200",textColor:"text-red-800",iconColor:"text-red-500"};default:return{bgColor:"bg-blue-50",borderColor:"border-blue-200",textColor:"text-blue-800",iconColor:"text-blue-500"}}}(n);(0,l.useEffect)(()=>(o>0&&(i.current=setTimeout(()=>{s(t)},o)),()=>{i.current&&clearTimeout(i.current)}),[t,o,s]);let d=(0,l.useCallback)(()=>{i.current&&clearTimeout(i.current),s(t)},[t,s]);return(0,a.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(c.bgColor,"\n ").concat(c.borderColor,"\n ").concat(c.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n animate-slide-in\n "),children:[(0,a.jsx)(e4,{type:n,iconColor:c.iconColor}),(0,a.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,a.jsx)("button",{"data-testid":"toast-close-button",onClick:d,"aria-label":"Close notification",className:"\n ".concat(c.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,a.jsx)(e$.Z,{className:"h-4 w-4"})})]})}function e3(e){let{toasts:t,onClose:r}=e;return(0,a.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:t.map(e=>(0,a.jsx)(e5,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))})}function e6(){let[e,t]=(0,l.useState)([]),r=(0,l.useRef)(0);return{toasts:e,showToast:(0,l.useCallback)(function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,s="toast-".concat(++r.current,"-").concat(Date.now()),l={id:s,message:e,type:a,duration:n};return t(e=>[...e,l]),s},[]),removeToast:(0,l.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),clearToasts:(0,l.useCallback)(()=>{t([])},[])}}var e8=r(30166),e7=r(51817);let e9=(0,e8.default)(()=>Promise.all([r.e(2714),r.e(656),r.e(13)]).then(r.bind(r,70013)).then(e=>({default:e.MermaidDiagram})),{loadableGenerated:{webpack:()=>[70013]},ssr:!1,loading:()=>(0,a.jsxs)("div",{className:"mermaid-loading flex items-center gap-2 text-gray-500 p-4",children:[(0,a.jsx)(e7.Z,{className:"animate-spin h-4 w-4"}),(0,a.jsx)("span",{children:"Loading diagram..."})]})});function te(e){let{className:t,children:r,inline:n}=e;if(n)return(0,a.jsx)("code",{className:t,children:r});if(t&&t.split(" ").includes("language-mermaid")){let e=null==r?"":"string"==typeof r?r:Array.isArray(r)?r.map(e=>"string"==typeof e?e:"").join(""):String(r);return(0,a.jsx)(e9,{code:e})}return(0,a.jsx)("code",{className:t,children:r})}function tt(){return"undefined"==typeof document?null:document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null}async function tr(e){if(e.requestFullscreen)return e.requestFullscreen();if(e.webkitRequestFullscreen)return e.webkitRequestFullscreen();if(e.mozRequestFullScreen)return e.mozRequestFullScreen();if(e.msRequestFullscreen)return e.msRequestFullscreen();throw Error("Fullscreen API not supported")}async function ta(){if("undefined"!=typeof document){if(document.exitFullscreen)return document.exitFullscreen();if(document.webkitExitFullscreen)return document.webkitExitFullscreen();if(document.mozCancelFullScreen)return document.mozCancelFullScreen();if(document.msExitFullscreen)return document.msExitFullscreen()}}function tn(){try{let e="__localStorage_test__";return window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e),!0}catch(e){return!1}}function ts(e){let{key:t,defaultValue:r,validate:a,serialize:n=JSON.stringify,deserialize:s=JSON.parse}=e,[o,i]=(0,l.useState)(!1),[c,d]=(0,l.useState)(r),u=(0,l.useCallback)(()=>{if(!tn())return r;try{let e=window.localStorage.getItem(t);if(null===e)return r;let n=s(e);if(a)return a(n)?n:r;return n}catch(e){return r}},[t,r,a,s]),m=(0,l.useCallback)(e=>{if(tn())try{let r=n(e);window.localStorage.setItem(t,r)}catch(e){}},[t,n]),x=(0,l.useCallback)(e=>{d(t=>{let r="function"==typeof e?e(t):e;return m(r),r})},[m]),h=(0,l.useCallback)(()=>{if(tn())try{window.localStorage.removeItem(t)}catch(e){}d(r)},[t,r]);return(0,l.useEffect)(()=>{i(tn()),d(u())},[u]),{value:c,setValue:x,removeValue:h,isAvailable:o}}let tl=()=>null!=window.visualViewport;var to=r(3468);let ti={split:{showEditor:!0,showPreview:!0,editorWidth:"w-1/2",previewWidth:"w-1/2"},editor:{showEditor:!0,showPreview:!1,editorWidth:"w-full",previewWidth:"w-0"},preview:{showEditor:!1,showPreview:!0,editorWidth:"w-0",previewWidth:"w-full"}},tc="commandmate:md-editor-view-mode",td={WARNING_THRESHOLD:512e3};function tu(e){return"number"==typeof e&&e>=.1&&e<=.9}function tm(e){return"boolean"==typeof e}function tx(e){return"split"===e||"editor"===e||"preview"===e}function th(e){let{worktreeId:t,filePath:r,onClose:n,onSave:s,initialViewMode:o,onMaximizedChange:i}=e,[c,d]=(0,l.useState)(""),[u,m]=(0,l.useState)(""),[h,p]=(0,l.useState)(""),[f,g]=(0,l.useState)(()=>(function(e){if(e&&tx(e))return e;{let e=localStorage.getItem(tc);if(e&&tx(e))return e}return"split"})(o)),[b,y]=(0,l.useState)(!0),[v,j]=(0,l.useState)(!1),[N,k]=(0,l.useState)(null),[C,S]=(0,l.useState)(!1),[E,T]=(0,l.useState)("editor"),[M,L]=(0,l.useState)(null),{toasts:R,showToast:A,removeToast:F}=e6(),P=(0,l.useRef)(null),D=(0,l.useRef)(null),I=(0,l.useRef)(null),_=(0,l.useRef)(null),z=(0,x.d)(),{isKeyboardVisible:O,keyboardHeight:W}=function(){let[e,t]=(0,l.useState)(!1),[r,a]=(0,l.useState)(0),n=(0,l.useCallback)(()=>{if(!tl())return;let e=window.visualViewport,r=window.innerHeight-e.height,n=r>100;t(n),a(n?r:0)},[]);return(0,l.useEffect)(()=>{if(!tl())return;let e=window.visualViewport;return n(),e.addEventListener("resize",n),()=>{e.removeEventListener("resize",n)}},[n]),{isKeyboardVisible:e,keyboardHeight:r}}(),{value:B,setValue:U}=ts({key:"commandmate:md-editor-maximized",defaultValue:!1,validate:tm}),{isFullscreen:V,isFallbackMode:H,enterFullscreen:Y,exitFullscreen:Z,toggleFullscreen:q}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elementRef:t,onEnter:r,onExit:a,onError:n}=e,[s,o]=(0,l.useState)(!1),[i,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(null),m=(0,l.useCallback)(()=>{let e=null!=tt();o(e),!e&&i&&c(!1)},[i]),x=(0,l.useCallback)(async()=>{if(u(null),"undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)){o(!0),c(!0),null==r||r();return}if("undefined"!=typeof document&&(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)&&(null==t?void 0:t.current))try{await tr(t.current),o(!0),c(!1),null==r||r()}catch(t){let e=t instanceof Error?t.message:"Failed to enter fullscreen";u(e),null==n||n(t instanceof Error?t:Error(e)),o(!0),c(!0),null==r||r()}else o(!0),c(!0),null==r||r()},[t,r,n]),h=(0,l.useCallback)(async()=>{if(u(null),i){o(!1),c(!1),null==a||a();return}if(tt())try{await ta(),o(!1),null==a||a()}catch(t){let e=t instanceof Error?t.message:"Failed to exit fullscreen";u(e),null==n||n(t instanceof Error?t:Error(e)),o(!1),c(!1),null==a||a()}else o(!1),c(!1),null==a||a()},[i,a,n]),p=(0,l.useCallback)(async()=>{s?await h():await x()},[s,x,h]);return(0,l.useEffect)(()=>{if("undefined"!=typeof document)return document.addEventListener("fullscreenchange",m),document.addEventListener("webkitfullscreenchange",m),document.addEventListener("mozfullscreenchange",m),document.addEventListener("MSFullscreenChange",m),()=>{document.removeEventListener("fullscreenchange",m),document.removeEventListener("webkitfullscreenchange",m),document.removeEventListener("mozfullscreenchange",m),document.removeEventListener("MSFullscreenChange",m)}},[m]),{isFullscreen:s,isFallbackMode:i,enterFullscreen:x,exitFullscreen:h,toggleFullscreen:p,error:d}}({elementRef:I,onEnter:()=>U(!0),onExit:()=>U(!1)}),{value:G,setValue:K}=ts({key:"commandmate:md-editor-split-ratio",defaultValue:.5,validate:tu}),{ref:J}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onSwipeLeft:t,onSwipeRight:r,onSwipeUp:a,onSwipeDown:n,threshold:s=50,enabled:o=!0}=e,i=(0,l.useRef)(null),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(null),x=(0,l.useRef)(null),h=(0,l.useCallback)(()=>{m(null)},[]),p=(0,l.useCallback)(e=>{if(!o)return;let t=e.touches[0];x.current={x:t.clientX,y:t.clientY},d(!0)},[o]),f=(0,l.useCallback)(e=>{if(!o||!x.current)return;let t=e.touches[0],r=t.clientX-x.current.x,a=t.clientY-x.current.y,n=Math.abs(r),l=Math.abs(a);n>l&&n>=s?m(r<0?"left":"right"):l>=s&&m(a<0?"up":"down")},[o,s]),g=(0,l.useCallback)(e=>{if(!o||!x.current){d(!1);return}let l=e.changedTouches[0],i=l.clientX-x.current.x,c=l.clientY-x.current.y,u=Math.abs(i),h=Math.abs(c);u>h?u>=s&&(i<0?(m("left"),null==t||t()):(m("right"),null==r||r())):h>=s&&(c<0?(m("up"),null==a||a()):(m("down"),null==n||n())),x.current=null,d(!1)},[o,s,t,r,a,n]);return(0,l.useEffect)(()=>{let e=i.current;if(e)return e.addEventListener("touchstart",p),e.addEventListener("touchmove",f),e.addEventListener("touchend",g),()=>{e.removeEventListener("touchstart",p),e.removeEventListener("touchmove",f),e.removeEventListener("touchend",g)}},[p,f,g]),{ref:i,isSwiping:c,swipeDirection:u,resetSwipeDirection:h}}({onSwipeDown:()=>{V&&Z()},threshold:100,enabled:V&&z}),X=c!==u,Q=ti[f],$=z&&window.innerHeight>window.innerWidth&&"split"===f,ee=(0,l.useMemo)(()=>ew(e=>{p(e)},300),[]),et=(0,l.useCallback)(async()=>{y(!0),k(null);try{let a=await fetch("/api/worktrees/".concat(t,"/files/").concat(r)),n=await a.json();if(!a.ok||!n.success){var e;throw Error((null===(e=n.error)||void 0===e?void 0:e.message)||"Failed to load file")}let s=n.content||"";d(s),m(s),p(s),new Blob([s]).size>td.WARNING_THRESHOLD&&S(!0)}catch(e){k(e instanceof Error?e.message:"Failed to load file")}finally{y(!1)}},[t,r]),er=(0,l.useCallback)(async()=>{if(X&&!v){j(!0);try{let a=await fetch("/api/worktrees/".concat(t,"/files/").concat(r),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:c})}),n=await a.json();if(!a.ok||!n.success){var e;throw Error((null===(e=n.error)||void 0===e?void 0:e.message)||"Failed to save file")}m(c),A("File saved successfully","success"),s&&s(r)}catch(e){A(e instanceof Error?e.message:"Failed to save file","error")}finally{j(!1)}}},[t,r,c,X,v,s,A]),ea=(0,l.useCallback)(e=>{let t=e.target.value;d(t),ee(t)},[ee]),en=(0,l.useCallback)(e=>{g(e),localStorage.setItem(tc,e)},[]),es=(0,l.useCallback)(()=>{(!X||window.confirm("You have unsaved changes. Are you sure you want to close?"))&&n&&n()},[X,n]),el=(0,l.useCallback)(e=>{if(!_.current)return;let t=_.current.offsetWidth;if(0===t)return;let r=e/t;K(e=>Math.max(.1,Math.min(.9,e+r)))},[K]),eo=(0,l.useCallback)(()=>{K(.5)},[K]),ei=(0,l.useCallback)(e=>{if((e.ctrlKey||e.metaKey)&&"s"===e.key){e.preventDefault(),er();return}if((e.ctrlKey||e.metaKey)&&e.shiftKey&&"F"===e.key){e.preventDefault(),q();return}if("Escape"===e.key&&V){e.preventDefault(),Z();return}},[er,q,Z,V]);(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&V&&(e.preventDefault(),Z())};return V&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[V,Z]),(0,l.useEffect)(()=>{B&&!V&&Y()},[]),(0,l.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.getElementById("markdown-editor-portal");return e||((e=document.createElement("div")).id="markdown-editor-portal",document.body.appendChild(e)),L(e),()=>{let e=document.getElementById("markdown-editor-portal");e&&0===e.childNodes.length&&e.remove()}},[]),(0,l.useEffect)(()=>{null==i||i(V)},[V,i]),(0,l.useEffect)(()=>{et()},[et]),(0,l.useEffect)(()=>{let e=e=>{X&&(e.preventDefault(),e.returnValue="")};return X?(D.current=e,window.addEventListener("beforeunload",e)):D.current&&(window.removeEventListener("beforeunload",D.current),D.current=null),()=>{D.current&&window.removeEventListener("beforeunload",D.current)}},[X]);let ec=(0,l.useMemo)(()=>{let e="flex flex-col bg-white";return V&&H?"".concat(e," fixed inset-0"):"".concat(e," h-full")},[V,H]),ed=(0,l.useMemo)(()=>{if(V)return{zIndex:to.k.MAXIMIZED_EDITOR}},[V]),eu=(0,l.useMemo)(()=>{if("split"===f&&!$)return{width:"".concat(100*G,"%"),flexShrink:0}},[f,G,$]),em=(0,l.useMemo)(()=>{if("split"===f&&!$)return{width:"".concat((1-G)*100,"%"),flexShrink:0}},[f,G,$]),ex=(0,l.useMemo)(()=>{if(O&&W>0)return{paddingBottom:W}},[O,W]),eh=(0,l.useMemo)(()=>({code:te}),[]),ep=(0,l.useMemo)(()=>(0,a.jsx)(eU.UG,{remarkPlugins:[eV.Z],rehypePlugins:[eH.Z,eY.Z],components:eh,children:h}),[h,eh]);if(b)return(0,a.jsx)("div",{"data-testid":"markdown-editor",className:"flex items-center justify-center h-full bg-white",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),(0,a.jsx)("p",{className:"mt-4 text-gray-600",children:"Loading..."})]})});if(N)return(0,a.jsx)("div",{"data-testid":"markdown-editor-error",className:"flex items-center justify-center h-full bg-white",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(eZ.Z,{className:"h-12 w-12 text-red-500 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-red-600",children:N}),n&&(0,a.jsx)("button",{onClick:n,className:"mt-4 px-4 py-2 bg-gray-100 hover:bg-gray-200 rounded-lg",children:"Close"})]})});let ef=(0,a.jsxs)("div",{ref:e=>{I.current=e,J.current=e},"data-testid":"markdown-editor",className:ec,style:ed,onKeyDown:ei,role:V&&H?"dialog":void 0,"aria-modal":V&&H?"true":void 0,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 bg-gray-50",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-shrink",children:[(0,a.jsx)(eq.Z,{className:"h-4 w-4 text-gray-500 flex-shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700 truncate",children:r}),X&&(0,a.jsx)("span",{"data-testid":"dirty-indicator",className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 flex-shrink-0",children:"Unsaved"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!$&&(0,a.jsxs)("div",{className:"flex items-center gap-1 bg-gray-100 rounded-lg p-1",children:[(0,a.jsx)("button",{"data-testid":"view-mode-split","aria-pressed":"split"===f,onClick:()=>en("split"),className:"p-1.5 rounded ".concat("split"===f?"bg-white shadow-sm text-blue-600":"text-gray-500 hover:text-gray-700"),title:"Split view",children:(0,a.jsx)(eG.Z,{className:"h-4 w-4"})}),(0,a.jsx)("button",{"data-testid":"view-mode-editor","aria-pressed":"editor"===f,onClick:()=>en("editor"),className:"p-1.5 rounded ".concat("editor"===f?"bg-white shadow-sm text-blue-600":"text-gray-500 hover:text-gray-700"),title:"Editor only",children:(0,a.jsx)(eq.Z,{className:"h-4 w-4"})}),(0,a.jsx)("button",{"data-testid":"view-mode-preview","aria-pressed":"preview"===f,onClick:()=>en("preview"),className:"p-1.5 rounded ".concat("preview"===f?"bg-white shadow-sm text-blue-600":"text-gray-500 hover:text-gray-700"),title:"Preview only",children:(0,a.jsx)(eK.Z,{className:"h-4 w-4"})})]}),(0,a.jsx)("button",{"data-testid":"maximize-button",onClick:q,className:"p-1.5 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded",title:V?"Exit fullscreen (ESC)":"Enter fullscreen (Ctrl+Shift+F)","aria-pressed":V,children:V?(0,a.jsx)(eJ.Z,{className:"h-4 w-4"}):(0,a.jsx)(eX.Z,{className:"h-4 w-4"})}),(0,a.jsxs)("button",{"data-testid":"save-button",onClick:er,disabled:!X||v,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ".concat(X&&!v?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:[(0,a.jsx)(eQ.Z,{className:"h-4 w-4"}),v?"Saving...":"Save"]}),n&&(0,a.jsx)("button",{"data-testid":"close-button",onClick:es,className:"p-1.5 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded",title:"Close",children:(0,a.jsx)(e$.Z,{className:"h-4 w-4"})})]})]}),V&&(0,a.jsxs)("div",{"data-testid":"maximize-hint",className:"flex items-center justify-center px-4 py-1 bg-gray-800 text-gray-300 text-xs",children:["Press ESC to exit fullscreen ",z&&"(or swipe down)"]}),C&&(0,a.jsxs)("div",{"data-testid":"large-file-warning",className:"flex items-center gap-2 px-4 py-2 bg-yellow-50 border-b border-yellow-200 text-yellow-800 text-sm",children:[(0,a.jsx)(eZ.Z,{className:"h-4 w-4"}),"Large file: Performance may be affected.",(0,a.jsx)("button",{onClick:()=>S(!1),className:"ml-auto text-yellow-600 hover:text-yellow-800",children:(0,a.jsx)(e$.Z,{className:"h-4 w-4"})})]}),$&&(0,a.jsxs)("div",{className:"flex border-b border-gray-200",children:[(0,a.jsxs)("button",{"data-testid":"mobile-tab-editor",onClick:()=>T("editor"),className:"flex-1 py-2 text-sm font-medium ".concat("editor"===E?"text-blue-600 border-b-2 border-blue-600":"text-gray-500"),children:[(0,a.jsx)(eq.Z,{className:"h-4 w-4 inline-block mr-1"}),"Editor"]}),(0,a.jsxs)("button",{"data-testid":"mobile-tab-preview",onClick:()=>T("preview"),className:"flex-1 py-2 text-sm font-medium ".concat("preview"===E?"text-blue-600 border-b-2 border-blue-600":"text-gray-500"),children:[(0,a.jsx)(eK.Z,{className:"h-4 w-4 inline-block mr-1"}),"Preview"]})]}),(0,a.jsxs)("div",{ref:_,className:"flex flex-1 overflow-hidden",style:ex,children:[$?"editor"===E&&(0,a.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex flex-col overflow-hidden w-full",children:(0,a.jsx)("textarea",{ref:P,"data-testid":"markdown-editor-textarea",value:c,onChange:ea,onKeyDown:ei,className:"flex-1 p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-inset",placeholder:"Start typing markdown...",spellCheck:!1})}):(0,a.jsx)("div",{"data-testid":"markdown-editor-container",className:"flex flex-col overflow-hidden transition-all duration-200 ".concat(Q.showEditor?"":"hidden"),style:"split"===f?eu:{width:Q.showEditor?"100%":"0%"},children:(0,a.jsx)("textarea",{ref:P,"data-testid":"markdown-editor-textarea",value:c,onChange:ea,onKeyDown:ei,className:"flex-1 p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-inset",placeholder:"Start typing markdown...",spellCheck:!1})}),"split"===f&&Q.showEditor&&Q.showPreview&&!$&&(0,a.jsx)(w,{onResize:el,onDoubleClick:eo,orientation:"horizontal",ariaValueNow:Math.round(100*G),minRatio:.1}),$?"preview"===E&&(0,a.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden w-full",children:(0,a.jsx)("div",{"data-testid":"markdown-preview",className:"flex-1 p-4 overflow-y-auto prose prose-sm max-w-none",children:ep})}):(0,a.jsx)("div",{"data-testid":"markdown-preview-container",className:"flex flex-col overflow-hidden transition-all duration-200 ".concat(Q.showPreview?"":"hidden"),style:"split"===f?em:{width:Q.showPreview?"100%":"0%"},children:(0,a.jsx)("div",{"data-testid":"markdown-preview",className:"flex-1 p-4 overflow-y-auto prose prose-sm max-w-none",children:ep})})]}),(0,a.jsx)(e3,{toasts:R,onClose:F})]});return V&&H&&M?(0,eB.createPortal)(ef,M):ef}let tp=[".md"],tf=[{extension:".png",maxFileSize:5242880,allowedMimeTypes:["image/png"],magicBytes:[{bytes:[137,80,78,71,13,10,26,10]}]},{extension:".jpg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".jpeg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".gif",maxFileSize:5242880,allowedMimeTypes:["image/gif"],magicBytes:[{bytes:[71,73,70,56,55,97]},{bytes:[71,73,70,56,57,97]}]},{extension:".webp",maxFileSize:5242880,allowedMimeTypes:["image/webp"],magicBytes:[{bytes:[82,73,70,70],offset:0}]},{extension:".txt",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".log",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".md",maxFileSize:5242880,allowedMimeTypes:["text/markdown","text/plain"]},{extension:".csv",maxFileSize:5242880,allowedMimeTypes:["text/csv"]},{extension:".json",maxFileSize:5242880,allowedMimeTypes:["application/json"]},{extension:".yaml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]},{extension:".yml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]}],tg=tf.map(e=>e.extension);var tb=r(3227);function ty(e){let{value:t,saveFn:r,debounceMs:a=300,disabled:n=!1,maxRetries:s=3,onSaveComplete:o}=e,[i,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(null),m=(0,l.useRef)(t),x=(0,l.useRef)(r),h=(0,l.useRef)(o),p=(0,l.useRef)(null),f=(0,l.useRef)(!0),g=(0,l.useRef)(t);(0,l.useEffect)(()=>{m.current=t},[t]),(0,l.useEffect)(()=>{x.current=r},[r]),(0,l.useEffect)(()=>{h.current=o},[o]),(0,l.useEffect)(()=>(f.current=!0,()=>{f.current=!1,p.current&&clearTimeout(p.current)}),[]);let b=(0,l.useCallback)(async e=>{if(!f.current)return;c(!0),u(null);let t=null,r=0;for(;r<=s;)try{if(await x.current(e),f.current){var a;c(!1),u(null),null===(a=h.current)||void 0===a||a.call(h)}return}catch(e){if(t=e instanceof Error?e:Error(String(e)),++r<=s){let e=1e3*Math.pow(2,r-1);await new Promise(t=>setTimeout(t,e))}}f.current&&(c(!1),u(t))},[s]),y=(0,l.useCallback)(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]),v=(0,l.useCallback)(async()=>{n||(y(),await b(m.current))},[n,y,b]);return(0,l.useEffect)(()=>{if(t!==g.current&&!n)return y(),p.current=setTimeout(()=>{b(m.current)},a),()=>{y()}},[t,n,a,y,b]),{isSaving:i,error:d,saveNow:v}}let tv=(0,l.memo)(function(e){var t,r;let{memo:n,onUpdate:s,onDelete:o,isSaving:i,error:c,className:d=""}=e,[u,m]=(0,l.useState)(n.title),[x,h]=(0,l.useState)(n.content),{isSaving:p,error:f,saveNow:g}=ty({value:u,saveFn:async e=>{await s(n.id,{title:e})}}),{isSaving:b,error:y,saveNow:v}=ty({value:x,saveFn:async e=>{await s(n.id,{content:e})}}),w=null!==(r=null!==(t=null!=c?c:null==f?void 0:f.message)&&void 0!==t?t:null==y?void 0:y.message)&&void 0!==r?r:null,j=(0,l.useCallback)(e=>{m(e.target.value)},[]),N=(0,l.useCallback)(e=>{h(e.target.value)},[]),k=(0,l.useCallback)(()=>{g()},[g]),C=(0,l.useCallback)(()=>{v()},[v]),S=(0,l.useCallback)(()=>{o(n.id)},[n.id,o]);return(0,a.jsxs)("div",{"data-testid":"memo-card",className:"bg-white border border-gray-200 rounded-lg p-4 space-y-3 ".concat(d),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:u,onChange:j,onBlur:k,placeholder:"Memo title",className:"flex-1 text-sm font-medium text-gray-900 bg-transparent border-none focus:outline-none focus:ring-0 p-0"}),(null!=i?i:p||b)&&(0,a.jsx)("span",{"data-testid":"saving-indicator",className:"text-xs text-gray-400",children:"Saving..."}),(0,a.jsx)("button",{type:"button",onClick:S,"aria-label":"Delete memo",className:"p-1 text-gray-400 hover:text-red-500 transition-colors rounded",children:(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),(0,a.jsx)("textarea",{value:x,onChange:N,onBlur:C,placeholder:"Enter memo content...",rows:4,className:"w-full text-sm text-gray-700 bg-gray-50 border border-gray-200 rounded-md p-2 resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),w&&(0,a.jsx)("div",{className:"text-xs text-red-500",children:w})]})}),tw=(0,l.memo)(function(e){let{currentCount:t,maxCount:r,onAdd:n,isLoading:s=!1,className:l=""}=e,o=t>=r||s;return(0,a.jsxs)("div",{"data-testid":"memo-add-button",className:"flex flex-col items-center gap-2 ".concat(l),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{o||n()},disabled:o,"aria-label":"Add Memo","aria-disabled":o,className:"\n flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed\n transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500\n ".concat(o?"border-gray-200 text-gray-400 cursor-not-allowed opacity-50":"border-gray-300 text-gray-600 hover:border-blue-400 hover:text-blue-600 hover:bg-blue-50","\n "),children:[s?(0,a.jsx)("span",{"data-testid":"loading-indicator",className:"w-5 h-5 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"}):(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Add Memo"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:[Math.max(0,r-t)," remaining"]})]})}),tj=(0,l.memo)(function(e){let{worktreeId:t,className:r=""}=e,[n,s]=(0,l.useState)([]),[o,i]=(0,l.useState)(!0),[c,d]=(0,l.useState)(!1),[u,m]=(0,l.useState)(null),[x,h]=(0,l.useState)(null),p=(0,l.useCallback)(async()=>{i(!0),m(null);try{let e=await tb.nE.getAll(t);s(e.sort((e,t)=>e.position-t.position))}catch(e){m((0,tb.zG)(e))}finally{i(!1)}},[t]);(0,l.useEffect)(()=>{p()},[p]);let f=(0,l.useCallback)(async()=>{d(!0),h(null);try{let e=await tb.nE.create(t,{title:"Memo",content:""});s(t=>[...t,e])}catch(e){h((0,tb.zG)(e))}finally{d(!1)}},[t]),g=(0,l.useCallback)(async(e,r)=>{await tb.nE.update(t,e,r),s(t=>t.map(t=>t.id===e?{...t,...r}:t))},[t]),b=(0,l.useCallback)(async e=>{try{await tb.nE.delete(t,e),s(t=>t.filter(t=>t.id!==e))}catch(e){console.error("Failed to delete memo:",e)}},[t]),y=(0,l.useCallback)(()=>{p()},[p]);return o?(0,a.jsx)("div",{"data-testid":"memo-pane",className:"flex flex-col items-center justify-center h-full p-4 ".concat(r),children:(0,a.jsxs)("div",{"data-testid":"memo-loading",className:"flex flex-col items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 border-4 border-gray-200 border-t-blue-500 rounded-full animate-spin"}),(0,a.jsx)("span",{className:"text-sm text-gray-500",children:"Loading memos..."})]})}):u?(0,a.jsx)("div",{"data-testid":"memo-pane",className:"flex flex-col items-center justify-center h-full p-4 ".concat(r),children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,a.jsx)("svg",{className:"w-12 h-12 text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("span",{className:"text-sm text-red-600",children:u}),(0,a.jsx)("button",{type:"button",onClick:y,"aria-label":"Retry",className:"px-4 py-2 text-sm font-medium text-white bg-blue-500 rounded-lg hover:bg-blue-600 transition-colors",children:"Retry"})]})}):(0,a.jsxs)("div",{"data-testid":"memo-pane",className:"flex flex-col gap-4 p-4 overflow-y-auto ".concat(r),children:[0===n.length&&!x&&(0,a.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,a.jsx)("p",{children:"No memos yet."}),(0,a.jsx)("p",{className:"text-sm",children:"Click the button below to add one."})]}),n.map(e=>(0,a.jsx)(tv,{memo:e,onUpdate:g,onDelete:b},e.id)),x&&(0,a.jsx)("div",{className:"text-center py-2 text-sm text-red-500",children:x}),(0,a.jsx)(tw,{currentCount:n.length,maxCount:5,onAdd:f,isLoading:c,className:"mt-2"})]})});var tN=r(98702);function tk(e){let{isOpen:t,onConfirm:r,onCancel:n}=e;return(0,a.jsx)(tN.u,{isOpen:t,onClose:n,title:"Auto Yesモードを有効にしますか?",size:"sm",showCloseButton:!0,children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"機能説明"}),(0,a.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,a.jsx)("li",{children:"yes/no確認 → 自動で「yes」を送信"}),(0,a.jsx)("li",{children:"複数選択肢 → デフォルトまたは先頭の選択肢を自動選択"})]}),(0,a.jsx)("p",{className:"mt-1",children:"1時間後に自動でOFFになります。"})]}),(0,a.jsxs)("div",{className:"text-sm text-gray-700",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"リスクについて"}),(0,a.jsx)("p",{children:"自動応答により、意図しない操作(ファイルの削除・上書き等)が 実行される可能性があります。内容を十分に理解した上でご利用ください。"})]}),(0,a.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-3",children:(0,a.jsxs)("p",{className:"text-sm text-yellow-800",children:[(0,a.jsx)("span",{className:"font-medium",children:"免責事項:"}),"Auto Yesモードの使用により発生した問題について、 開発者は一切の責任を負いません。自己責任でご利用ください。"]})}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,a.jsx)("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-200 hover:bg-gray-300 text-gray-700",children:"キャンセル"}),(0,a.jsx)("button",{type:"button",onClick:r,className:"px-4 py-2 text-sm font-medium rounded-md bg-yellow-600 hover:bg-yellow-700 text-white",children:"同意して有効化"})]})]})})}let tC=(0,l.memo)(function(e){let{enabled:t,expiresAt:r,onToggle:n,lastAutoResponse:s}=e,[o,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(null),[u,m]=(0,l.useState)(!1),[x,h]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if(!t||!r){i("");return}let e=()=>{i(function(e){let t=Math.max(0,e-Date.now());return"".concat(Math.floor(t/6e4).toString().padStart(2,"0"),":").concat(Math.floor(t%6e4/1e3).toString().padStart(2,"0"))}(r))};e();let a=setInterval(e,1e3);return()=>clearInterval(a)},[t,r]),(0,l.useEffect)(()=>{if(!s)return;d('Auto responded: "'.concat(s,'"'));let e=setTimeout(()=>d(null),2e3);return()=>clearTimeout(e)},[s]);let p=(0,l.useCallback)(()=>{t?(m(!0),n(!1).finally(()=>m(!1))):h(!0)},[t,n]),f=(0,l.useCallback)(()=>{h(!1),m(!0),n(!0).finally(()=>m(!1))},[n]),g=(0,l.useCallback)(()=>{h(!1)},[]);return(0,a.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 bg-gray-50 border-b border-gray-200",children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":t,"aria-label":"Auto Yes mode",disabled:u,onClick:p,className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(t?"bg-blue-600":"bg-gray-300"," ").concat(u?"opacity-50":""),children:(0,a.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(t?"translate-x-6":"translate-x-1")})}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Auto Yes"}),t&&o&&(0,a.jsx)("span",{className:"text-sm text-gray-500","aria-label":"Time remaining",children:o}),c&&(0,a.jsx)("span",{className:"text-sm text-green-600 animate-pulse",children:c}),(0,a.jsx)(tk,{isOpen:x,onConfirm:f,onCancel:g})]})}),tS=(0,l.memo)(function(e){let{worktreeName:t,repositoryName:r,description:n,status:s,onBackClick:l,onInfoClick:o,onMenuClick:i}=e,c=et.Ie[s],d=n?n.length>50?"".concat(n.substring(0,50),"..."):n:null;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-white border-b border-gray-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("button",{type:"button",onClick:i,className:"p-2 -ml-2 rounded-lg text-gray-600 hover:text-gray-900 hover:bg-gray-100 transition-colors","aria-label":"Toggle sidebar",children:(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})}),(0,a.jsx)("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),(0,a.jsxs)("button",{type:"button",onClick:l,className:"flex items-center gap-1 text-gray-600 hover:text-gray-900 transition-colors","aria-label":"Go back to worktree list",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Back"})]}),(0,a.jsx)("div",{className:"w-px h-6 bg-gray-300","aria-hidden":"true"}),"spinner"===c.type?(0,a.jsx)("span",{"data-testid":"desktop-status-indicator",title:c.label,"aria-label":c.label,className:"w-3 h-3 rounded-full flex-shrink-0 border-2 border-t-transparent animate-spin ".concat(c.className)}):(0,a.jsx)("span",{"data-testid":"desktop-status-indicator",title:c.label,"aria-label":c.label,className:"w-3 h-3 rounded-full flex-shrink-0 ".concat(c.className)}),(0,a.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h1",{className:"text-lg font-semibold text-gray-900 truncate max-w-[200px] leading-tight",children:t}),d&&(0,a.jsx)("span",{className:"text-sm text-gray-500 truncate max-w-md",title:n,children:d})]}),(0,a.jsx)("span",{className:"text-xs text-gray-500 truncate max-w-md",children:r})]})]}),(0,a.jsxs)("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 px-3 py-1.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 rounded-lg transition-colors","aria-label":"View worktree information",children:[(0,a.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Info"})]})]})}),tE=(0,l.memo)(function(e){let{worktree:t,isOpen:r,onClose:n,onWorktreeUpdate:s}=e,[o,i]=(0,l.useState)(!1),[c,d]=(0,l.useState)(""),[u,m]=(0,l.useState)(!1),x=(0,l.useRef)(r);(0,l.useEffect)(()=>{let e=r&&!x.current;x.current=r,e&&t&&(d(t.description||""),i(!1))},[t,r]);let h=(0,l.useCallback)(async()=>{if(t){m(!0);try{let e=await tb.Iv.updateDescription(t.id,c);s(e),i(!1)}catch(e){console.error("Failed to save description:",e)}finally{m(!1)}}},[t,c,s]),p=(0,l.useCallback)(()=>{d((null==t?void 0:t.description)||""),i(!1)},[t]);return t?(0,a.jsx)(tN.u,{isOpen:r,onClose:n,title:"Worktree Information",size:"md",children:(0,a.jsxs)("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto",children:[(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Worktree"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:t.name})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Repository"}),(0,a.jsx)("p",{className:"text-base text-gray-900",children:t.repositoryName}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1 break-all",children:t.repositoryPath})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Path"}),(0,a.jsx)("p",{className:"text-sm text-gray-700 break-all font-mono",children:t.path})]}),t.status&&(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Status"}),(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat("done"===t.status?"bg-green-100 text-green-800":"doing"===t.status?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"),children:t.status.toUpperCase()})]}),(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500",children:"Description"}),!o&&(0,a.jsx)("button",{type:"button",onClick:()=>i(!0),className:"text-sm text-blue-600 hover:text-blue-800",children:"Edit"})]}),o?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),placeholder:"Add notes about this branch...",className:"w-full min-h-[150px] p-3 border border-gray-300 rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:h,disabled:u,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 text-sm font-medium",children:u?"Saving...":"Save"}),(0,a.jsx)("button",{type:"button",onClick:p,disabled:u,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 disabled:opacity-50 text-sm font-medium",children:"Cancel"})]})]}):(0,a.jsx)("div",{className:"min-h-[50px]",children:t.description?(0,a.jsx)("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:t.description}):(0,a.jsx)("p",{className:"text-sm text-gray-400 italic",children:"No description added yet"})})]}),t.link&&(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Link"}),(0,a.jsx)("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline break-all",children:t.link})]}),t.updatedAt&&(0,a.jsxs)("div",{className:"bg-gray-50 rounded-lg p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Last Updated"}),(0,a.jsx)("p",{className:"text-sm text-gray-700",children:new Date(t.updatedAt).toLocaleString()})]})]})}):null}),tT=(0,l.memo)(function(){return(0,a.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"status","aria-live":"polite",children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600","aria-hidden":"true"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Loading worktree..."})]})})}),tM=(0,l.memo)(function(e){let{message:t,onRetry:r}=e;return(0,a.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"alert","aria-live":"assertive",children:(0,a.jsxs)("div",{className:"text-center p-6 bg-red-50 rounded-lg border border-red-200 max-w-md",children:[(0,a.jsx)("svg",{className:"mx-auto h-12 w-12 text-red-400 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsx)("p",{className:"text-red-600 font-medium",children:"Error loading worktree"}),(0,a.jsx)("p",{className:"text-red-500 text-sm mt-2",children:t}),r&&(0,a.jsx)("button",{type:"button",onClick:r,className:"mt-4 px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",children:"Retry"})]})})}),tL=(0,l.memo)(function(e){let{worktree:t,onWorktreeUpdate:r}=e,[n,s]=(0,l.useState)(!1),[o,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(!1),u=(0,l.useRef)(null==t?void 0:t.id);(0,l.useEffect)(()=>{let e=(null==t?void 0:t.id)!==u.current;u.current=null==t?void 0:t.id,e&&t&&!n&&i(t.description||"")},[t,n]);let m=(0,l.useCallback)(async()=>{if(t){d(!0);try{let e=await tb.Iv.updateDescription(t.id,o);r(e),s(!1)}catch(e){console.error("Failed to save description:",e)}finally{d(!1)}}},[t,o,r]),x=(0,l.useCallback)(()=>{i((null==t?void 0:t.description)||""),s(!1)},[t]);return t?(0,a.jsxs)("div",{className:"p-4 space-y-4 overflow-y-auto h-full",children:[(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Worktree"}),(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:t.name})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Repository"}),(0,a.jsx)("p",{className:"text-base text-gray-900",children:t.repositoryName}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1 break-all",children:t.repositoryPath})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Path"}),(0,a.jsx)("p",{className:"text-sm text-gray-700 break-all font-mono",children:t.path})]}),t.status&&(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Status"}),(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat("done"===t.status?"bg-green-100 text-green-800":"doing"===t.status?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"),children:t.status.toUpperCase()})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500",children:"Description"}),!n&&(0,a.jsx)("button",{type:"button",onClick:()=>s(!0),className:"text-sm text-blue-600 hover:text-blue-800",children:"Edit"})]}),n?(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsx)("textarea",{value:o,onChange:e=>i(e.target.value),placeholder:"Add notes about this branch...",className:"w-full min-h-[150px] p-3 border border-gray-300 rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:m,disabled:c,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 text-sm font-medium",children:c?"Saving...":"Save"}),(0,a.jsx)("button",{type:"button",onClick:x,disabled:c,className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 disabled:opacity-50 text-sm font-medium",children:"Cancel"})]})]}):(0,a.jsx)("div",{className:"min-h-[50px]",children:t.description?(0,a.jsx)("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:t.description}):(0,a.jsx)("p",{className:"text-sm text-gray-400 italic",children:"No description added yet"})})]}),t.link&&(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Link"}),(0,a.jsx)("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline break-all",children:t.link})]}),t.updatedAt&&(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-4",children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-gray-500 mb-1",children:"Last Updated"}),(0,a.jsx)("p",{className:"text-sm text-gray-700",children:new Date(t.updatedAt).toLocaleString()})]})]}):(0,a.jsx)("div",{className:"text-gray-500 text-center py-8",children:"Loading worktree info..."})}),tR=(0,l.memo)(function(e){let{activeTab:t,worktreeId:r,worktree:n,messages:s,terminalOutput:l,isTerminalActive:o,isThinking:i,onFilePathClick:c,onFileSelect:d,onWorktreeUpdate:u,onNewFile:m,onNewDirectory:x,onRename:h,onDelete:f,onUpload:g,refreshTrigger:b,fileSearch:y}=e;switch(t){case"terminal":return(0,a.jsx)(p,{componentName:"TerminalDisplay",children:(0,a.jsx)(F,{output:l,isActive:o,isThinking:i,className:"h-full"})});case"history":return(0,a.jsx)(p,{componentName:"HistoryPane",children:(0,a.jsx)(Z,{messages:s,worktreeId:r,onFilePathClick:c,className:"h-full"})});case"files":var v;return(0,a.jsx)(p,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)(eA,{query:y.query,mode:y.mode,isSearching:y.isSearching,error:y.error,onQueryChange:y.setQuery,onModeChange:y.setMode,onClear:y.clearSearch}),(0,a.jsx)(eT,{worktreeId:r,onFileSelect:d,onNewFile:m,onNewDirectory:x,onRename:h,onDelete:f,onUpload:g,refreshTrigger:b,searchQuery:y.query,searchMode:y.mode,searchResults:null===(v=y.results)||void 0===v?void 0:v.results,className:"flex-1 min-h-0"})]})});case"memo":return(0,a.jsx)(p,{componentName:"MemoPane",children:(0,a.jsx)(tj,{worktreeId:r,className:"h-full"})});case"info":return(0,a.jsx)(tL,{worktree:n,onWorktreeUpdate:u});default:return null}}),tA=(0,l.memo)(function(e){var t,r,s;let{worktreeId:o}=e,i=(0,n.useRouter)(),c=(0,x.d)(),{toggle:d,openMobileDrawer:f}=(0,h.Sz)(),{state:g,actions:b}=function(){let[e,t]=(0,l.useReducer)(m,void 0,u),r=(0,l.useMemo)(()=>({setPhase:e=>t({type:"SET_PHASE",phase:e}),setTerminalOutput:(e,r)=>t({type:"SET_TERMINAL_OUTPUT",output:e,realtimeSnippet:r}),setTerminalActive:e=>t({type:"SET_TERMINAL_ACTIVE",isActive:e}),setTerminalThinking:e=>t({type:"SET_TERMINAL_THINKING",isThinking:e}),showPrompt:(e,r)=>t({type:"SHOW_PROMPT",data:e,messageId:r}),clearPrompt:()=>t({type:"CLEAR_PROMPT"}),setPromptAnswering:e=>t({type:"SET_PROMPT_ANSWERING",answering:e}),setError:e=>t({type:"SET_ERROR",error:e}),clearError:()=>t({type:"CLEAR_ERROR"}),setMessages:e=>t({type:"SET_MESSAGES",messages:e}),addMessage:e=>t({type:"ADD_MESSAGE",message:e}),updateMessage:(e,r)=>t({type:"UPDATE_MESSAGE",id:e,updates:r}),clearMessages:()=>t({type:"CLEAR_MESSAGES"}),startWaitingForResponse:e=>t({type:"START_WAITING_FOR_RESPONSE",cliToolId:e}),responseReceived:e=>t({type:"RESPONSE_RECEIVED",message:e}),sessionEnded:()=>t({type:"SESSION_ENDED"}),setAutoScroll:e=>t({type:"SET_AUTO_SCROLL",enabled:e}),setMobileActivePane:e=>t({type:"SET_MOBILE_ACTIVE_PANE",pane:e}),setLeftPaneTab:e=>t({type:"SET_LEFT_PANE_TAB",tab:e}),setLayoutMode:e=>t({type:"SET_LAYOUT_MODE",mode:e}),setSplitRatio:e=>t({type:"SET_SPLIT_RATIO",ratio:e}),setWsConnected:e=>t({type:"SET_WS_CONNECTED",connected:e})}),[]);return{state:e,dispatch:t,actions:r}}(),[y,v]=(0,l.useState)(null),[w,j]=(0,l.useState)(!0),[N,k]=(0,l.useState)(null),[C,S]=(0,l.useState)(!1),[T,M]=(0,l.useState)(null),[L,R]=(0,l.useState)(null),[A,P]=(0,l.useState)(!1),[D,I]=(0,l.useState)(!1),[_,z]=(0,l.useState)(null),[O,W]=(0,l.useState)(0),B=function(e){let{worktreeId:t,initialMode:r="name",debounceMs:a=300}=e,[n,s]=(0,l.useState)(""),[o,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(r),[u,m]=(0,l.useState)(!1),[x,h]=(0,l.useState)(null),[p,f]=(0,l.useState)(null),g=(0,l.useRef)(null),b=(0,l.useMemo)(()=>ew(e=>{i(e)},a),[a]),y=(0,l.useCallback)(e=>{s(e),b(e),f(null)},[b]),v=(0,l.useCallback)(()=>{s(""),i(""),h(null),f(null),m(!1),g.current&&(g.current.abort(),g.current=null)},[]),w=(0,l.useCallback)(e=>{if(!o.trim())return e;let t=o.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t))},[o]),j=(0,l.useCallback)(()=>x&&0!==x.results.length?ej(x.results.map(e=>e.filePath)):new Set,[x]);return(0,l.useEffect)(()=>{if("content"!==c||!o.trim()){h(null);return}g.current&&g.current.abort();let e=new AbortController;return g.current=e,(async()=>{m(!0),f(null);try{var r,a;let n=await fetch("/api/worktrees/".concat(encodeURIComponent(t),"/search?q=").concat(encodeURIComponent(o),"&mode=content"),{signal:e.signal});if(!n.ok){let e=await n.json();throw Error((null===(r=e.error)||void 0===r?void 0:r.message)||"Search failed: ".concat(n.status))}let s=await n.json();if(s.success)h({mode:"content",query:o,results:s.results,totalMatches:s.totalMatches,truncated:s.truncated,executionTimeMs:s.executionTimeMs});else throw Error((null===(a=s.error)||void 0===a?void 0:a.message)||"Search failed")}catch(e){if(e instanceof Error&&"AbortError"===e.name)return;f(e instanceof Error?e.message:"An error occurred while searching"),h(null)}finally{m(!1)}})(),()=>{e.abort()}},[c,o,t]),(0,l.useEffect)(()=>{"name"===c&&(h(null),m(!1),f(null))},[c]),{query:n,mode:c,isSearching:u,results:x,error:p,setQuery:y,setMode:d,clearSearch:v,filterByName:w,getMatchedPaths:j}}({worktreeId:o}),U=(0,l.useRef)(!1),V=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/worktrees/".concat(o));if(!e.ok)throw Error("Failed to fetch worktree: ".concat(e.status));let t=await e.json();return v(t),t}catch(e){return k(e instanceof Error?e.message:"Unknown error"),null}},[o]),H=(0,l.useCallback)(async()=>{try{let e=await fetch("/api/worktrees/".concat(o,"/messages?cliTool=claude"));if(!e.ok)throw Error("Failed to fetch messages: ".concat(e.status));let t=await e.json();b.setMessages(t.map(e=>({...e,timestamp:new Date(e.timestamp)})))}catch(e){console.error("[WorktreeDetailRefactored] Error fetching messages:",e)}},[o,b]),Y=(0,l.useCallback)(async()=>{try{var e,t,r,a,n;let s=await fetch("/api/worktrees/".concat(o,"/current-output?cliTool=claude"));if(!s.ok)return;let l=await s.json(),i=null!==(t=null!==(e=l.fullOutput)&&void 0!==e?e:l.realtimeSnippet)&&void 0!==t?t:"";(i||l.isRunning)&&b.setTerminalOutput(i,null!==(r=l.realtimeSnippet)&&void 0!==r?r:""),b.setTerminalActive(null!==(a=l.isRunning)&&void 0!==a&&a),b.setTerminalThinking(null!==(n=l.thinking)&&void 0!==n&&n),l.isPromptWaiting&&l.promptData?b.showPrompt(l.promptData,"prompt-".concat(Date.now())):!l.isPromptWaiting&&g.prompt.visible&&b.clearPrompt(),l.autoYes&&(I(l.autoYes.enabled),z(l.autoYes.expiresAt))}catch(e){console.error("[WorktreeDetailRefactored] Error fetching current output:",e)}},[o,b,g.prompt.visible]),q=(0,l.useCallback)(e=>{M(e)},[]),G=(0,l.useCallback)(e=>{var t;let r=null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase();tp.includes(r?".".concat(r):"")?R(e):M(e)},[]),K=(0,l.useCallback)(()=>{M(null)},[]),J=(0,l.useCallback)(()=>{R(null)},[]),X=(0,l.useCallback)(e=>{console.log("[WorktreeDetailRefactored] File saved:",e)},[]),Q=(0,l.useCallback)(e=>{b.setLeftPaneTab(e)},[b]),$=(0,l.useCallback)(()=>{i.push("/")},[i]),et=(0,l.useCallback)(()=>{S(!0)},[]),er=(0,l.useCallback)(()=>{S(!1)},[]),ea=(0,l.useCallback)(async e=>{b.setPromptAnswering(!0);try{let t=await fetch("/api/worktrees/".concat(o,"/prompt-response"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:e,cliTool:"claude"})});if(!t.ok)throw Error("Failed to send prompt response: ".concat(t.status));b.clearPrompt(),await Y()}catch(e){console.error("[WorktreeDetailRefactored] Error sending prompt response:",e)}finally{b.setPromptAnswering(!1)}},[o,b,Y]),es=(0,l.useCallback)(()=>{b.clearPrompt()},[b]),el=(0,l.useCallback)(e=>{b.setMobileActivePane(e)},[b]),ei=(0,l.useCallback)(e=>{b.setAutoScroll(e)},[b]),ed=(0,l.useCallback)(()=>{H(),Y()},[H,Y]),eu=(0,l.useCallback)(async e=>{try{let t=await fetch("/api/worktrees/".concat(o,"/auto-yes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e})});if(t.ok){let e=await t.json();I(e.enabled),z(e.expiresAt)}}catch(e){console.error("[WorktreeDetailRefactored] Error toggling auto-yes:",e)}},[o]),em=(0,l.useCallback)(async e=>{let t=window.prompt("Enter file name (e.g., document.md):");if(!t)return;let r=t.endsWith(".md")?t:"".concat(t,".md"),a=e?"".concat(e,"/").concat(r):r;try{if(!(await fetch("/api/worktrees/".concat(o,"/files/").concat(encodeURIComponent(a)),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"file",content:""})})).ok)throw Error("Failed to create file");W(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create file:",e),window.alert("ファイルの作成に失敗しました")}},[o]),eh=(0,l.useCallback)(async e=>{let t=window.prompt("Enter directory name:");if(!t)return;let r=e?"".concat(e,"/").concat(t):t;try{if(!(await fetch("/api/worktrees/".concat(o,"/files/").concat(encodeURIComponent(r)),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"directory"})})).ok)throw Error("Failed to create directory");W(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to create directory:",e),window.alert("ディレクトリの作成に失敗しました")}},[o]),ep=(0,l.useCallback)(async e=>{let t=e.split("/").pop()||"",r=window.prompt("Enter new name:",t);if(r&&r!==t)try{if(!(await fetch("/api/worktrees/".concat(o,"/files/").concat(encodeURIComponent(e)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",newName:r})})).ok)throw Error("Failed to rename");W(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to rename:",e),window.alert("リネームに失敗しました")}},[o]),ef=(0,l.useCallback)(async e=>{let t=e.split("/").pop()||e;if(window.confirm('"'.concat(t,'" を削除しますか?')))try{if(!(await fetch("/api/worktrees/".concat(o,"/files/").concat(encodeURIComponent(e),"?recursive=true"),{method:"DELETE"})).ok)throw Error("Failed to delete");(L===e||(null==L?void 0:L.startsWith("".concat(e,"/"))))&&R(null),W(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to delete:",e),window.alert("削除に失敗しました")}},[o,L]),{toasts:eg,showToast:eb,removeToast:ey}=e6(),ev=(0,l.useRef)(null),eN=(0,l.useRef)(""),ek=(0,l.useCallback)(e=>{var t;eN.current=e,null===(t=ev.current)||void 0===t||t.click()},[]),eC=(0,l.useCallback)(async e=>{var t,r,a;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!n)return;e.target.value="";let s=eN.current,l=".".concat(null===(r=n.name.split(".").pop())||void 0===r?void 0:r.toLowerCase());if(!function(e){if(!e)return!1;let t=e.toLowerCase();return tg.includes(t)}(l)){eb("Unsupported file type: ".concat(l,". Allowed: ").concat(tg.join(", ")),"error");return}let i=function(e){var t;let r=function(e){let t=e.toLowerCase();return tf.find(e=>e.extension===t)}(e);return null!==(t=null==r?void 0:r.maxFileSize)&&void 0!==t?t:5242880}(l);if(n.size>i){eb("File too large. Maximum size: ".concat((i/1024/1024).toFixed(1),"MB"),"error");return}let c=new FormData;c.append("file",n);try{let e=await fetch("/api/worktrees/".concat(o,"/upload/").concat(encodeURIComponent(s||".")),{method:"POST",body:c});if(!e.ok){let t=await e.json().catch(()=>({})),r=(null==t?void 0:null===(a=t.error)||void 0===a?void 0:a.message)||"Failed to upload file";eb(r,"error");return}let t=await e.json();eb("Uploaded: ".concat(t.filename),"success"),W(e=>e+1)}catch(e){console.error("[WorktreeDetailRefactored] Failed to upload:",e),eb("Upload failed. Please try again.","error")}},[o,eb]),{lastAutoResponse:eS}=function(e){let{worktreeId:t,cliTool:r,isPromptWaiting:a,promptData:n,autoYesEnabled:s}=e,o=(0,l.useRef)(null),[i,c]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!a){o.current=null;return}if(!n||!s)return;let e="".concat(n.type,":").concat(n.question);if(o.current===e)return;let l=function(e){if("yes_no"===e.type)return"y";if("multiple_choice"===e.type){let t=e.options.find(e=>e.isDefault),r=null!=t?t:e.options[0];return!r||r.requiresTextInput?null:r.number.toString()}return null}(n);null!==l&&(o.current=e,c(l),fetch("/api/worktrees/".concat(t,"/prompt-response"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answer:l,cliTool:r})}).catch(e=>{console.error("[useAutoYes] Failed to send auto-response:",e)}))},[a,n,s,t,r]),{lastAutoResponse:i}}({worktreeId:o,cliTool:"claude",isPromptWaiting:g.prompt.visible,promptData:g.prompt.data,autoYesEnabled:D}),eE=(0,l.useCallback)(async()=>{k(null),j(!0),await V()&&await Promise.all([H(),Y()]),j(!1)},[V,H,Y]);(0,l.useEffect)(()=>{if(U.current)return;let e=!0;return(async()=>{j(!0);let t=await V();e&&(t&&await Promise.all([H(),Y()]),e&&(j(!1),U.current=!0))})(),()=>{e=!1}},[V,H,Y]),(0,l.useEffect)(()=>{if(w||N)return;let e=setInterval(async()=>{await Promise.all([Y(),V(),H()])},g.terminal.isActive?2e3:5e3);return()=>clearInterval(e)},[w,N,Y,V,H,g.terminal.isActive]),(0,l.useEffect)(()=>{b.setLayoutMode(c?"tabs":"split")},[c,b]);let eM=(0,l.useMemo)(()=>(function(e,t){var r;if(t)return"error";if(!e)return"idle";let a=null===(r=e.sessionStatusByCli)||void 0===r?void 0:r.claude;if(a){if(a.isWaitingForResponse)return"waiting";if(a.isProcessing)return"running";if(a.isRunning)return"ready"}return e.isWaitingForResponse?"waiting":e.isProcessing?"running":e.isSessionRunning?"ready":"idle"})(y,null!==g.error.type),[y,g.error.type]),eL=(0,l.useMemo)(()=>g.layout.mobileActivePane,[g.layout.mobileActivePane]),eR=(0,l.useMemo)(()=>g.layout.leftPaneTab,[g.layout.leftPaneTab]),eF=null!==(t=null==y?void 0:y.name)&&void 0!==t?t:"Unknown";return w?(0,a.jsx)(tT,{}):N?(0,a.jsx)(tM,{message:N,onRetry:eE}):c?(0,a.jsx)(p,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)(en,{worktreeName:eF,repositoryName:null==y?void 0:y.repositoryName,status:eM,onBackClick:$,onMenuClick:f}),(0,a.jsx)("div",{className:"fixed top-14 inset-x-0 z-30",children:(0,a.jsx)(tC,{enabled:D,expiresAt:_,onToggle:eu,lastAutoResponse:eS})}),(0,a.jsx)("main",{className:"flex-1 pt-[6.25rem] pb-32 overflow-hidden",style:{paddingBottom:"calc(8rem + env(safe-area-inset-bottom, 0px))"},children:(0,a.jsx)(tR,{activeTab:eL,worktreeId:o,worktree:y,messages:g.messages,terminalOutput:g.terminal.output,isTerminalActive:g.terminal.isActive,isThinking:g.terminal.isThinking,onFilePathClick:q,onFileSelect:G,onWorktreeUpdate:v,onNewFile:em,onNewDirectory:eh,onRename:ep,onDelete:ef,onUpload:ek,refreshTrigger:O,fileSearch:B})}),(0,a.jsx)("div",{className:"fixed left-0 right-0 border-t border-gray-200 bg-white p-2 z-30",style:{bottom:"calc(4rem + env(safe-area-inset-bottom, 0px))"},children:(0,a.jsx)(ex.R,{worktreeId:o,onMessageSent:ed,cliToolId:"claude",isSessionRunning:g.terminal.isActive})}),(0,a.jsx)(eo,{activeTab:eL,onTabChange:el,hasNewOutput:!1,hasPrompt:g.prompt.visible}),!D&&(0,a.jsx)(ec,{promptData:g.prompt.data,visible:g.prompt.visible,answering:g.prompt.answering,onRespond:ea,onDismiss:es}),(0,a.jsx)(eW,{isOpen:null!==T,onClose:K,worktreeId:o,filePath:null!=T?T:""}),L&&(0,a.jsx)(tN.u,{isOpen:!0,onClose:J,title:L.split("/").pop()||"Editor",size:"full",disableClose:A,children:(0,a.jsx)("div",{className:"h-[80vh]",children:(0,a.jsx)(th,{worktreeId:o,filePath:L,onClose:J,onSave:X,onMaximizedChange:P})})}),(0,a.jsx)("input",{ref:ev,type:"file",accept:tg.join(","),onChange:eC,className:"hidden","aria-label":"Upload file"}),(0,a.jsx)(e3,{toasts:eg,onClose:ey})]})}):(0,a.jsx)(p,{componentName:"WorktreeDetailRefactored",children:(0,a.jsxs)("div",{className:"h-full flex flex-col relative",children:[(0,a.jsx)(tS,{worktreeName:eF,repositoryName:null!==(s=null==y?void 0:y.repositoryName)&&void 0!==s?s:"Unknown",description:null==y?void 0:y.description,status:eM,onBackClick:$,onInfoClick:et,onMenuClick:d}),(0,a.jsx)("div",{className:"flex-1 min-h-0",children:(0,a.jsx)(E,{leftPane:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)(e_,{activeTab:eR,onTabChange:Q}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 overflow-hidden",children:["history"===eR&&(0,a.jsx)(Z,{messages:g.messages,worktreeId:o,onFilePathClick:q,className:"h-full"}),"files"===eR&&(0,a.jsx)(p,{componentName:"FileTreeView",children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsx)(eA,{query:B.query,mode:B.mode,isSearching:B.isSearching,error:B.error,onQueryChange:B.setQuery,onModeChange:B.setMode,onClear:B.clearSearch}),(0,a.jsx)(eT,{worktreeId:o,onFileSelect:G,onNewFile:em,onNewDirectory:eh,onRename:ep,onDelete:ef,onUpload:ek,refreshTrigger:O,searchQuery:B.query,searchMode:B.mode,searchResults:null===(r=B.results)||void 0===r?void 0:r.results,className:"flex-1 min-h-0"})]})}),"memo"===eR&&(0,a.jsx)(p,{componentName:"MemoPane",children:(0,a.jsx)(tj,{worktreeId:o,className:"h-full"})})]})]}),rightPane:(0,a.jsx)(F,{output:g.terminal.output,isActive:g.terminal.isActive,isThinking:g.terminal.isThinking,autoScroll:g.terminal.autoScroll,onScrollChange:ei}),initialLeftWidth:40,minLeftWidth:20,maxLeftWidth:60})}),(0,a.jsx)("div",{className:"flex-shrink-0 border-t border-gray-200 p-4 bg-gray-50",children:(0,a.jsx)(ex.R,{worktreeId:o,onMessageSent:ed,cliToolId:"claude",isSessionRunning:g.terminal.isActive})}),(0,a.jsx)(tC,{enabled:D,expiresAt:_,onToggle:eu,lastAutoResponse:eS}),g.prompt.visible&&!D&&(0,a.jsx)("div",{className:"fixed bottom-20 left-1/2 transform -translate-x-1/2 z-50 w-full max-w-2xl px-4",children:(0,a.jsx)(ee,{promptData:g.prompt.data,messageId:g.prompt.messageId,visible:g.prompt.visible,answering:g.prompt.answering,onRespond:ea,onDismiss:es})}),(0,a.jsx)(tE,{worktree:y,isOpen:C,onClose:er,onWorktreeUpdate:v}),(0,a.jsx)(eW,{isOpen:null!==T,onClose:K,worktreeId:o,filePath:null!=T?T:""}),L&&(0,a.jsx)(tN.u,{isOpen:!0,onClose:J,title:L.split("/").pop()||"Editor",size:"full",disableClose:A,children:(0,a.jsx)("div",{className:"h-[80vh]",children:(0,a.jsx)(th,{worktreeId:o,filePath:L,onClose:J,onSave:X,onMaximizedChange:P})})}),(0,a.jsx)("input",{ref:ev,type:"file",accept:tg.join(","),onChange:eC,className:"hidden","aria-label":"Upload file"}),(0,a.jsx)(e3,{toasts:eg,onClose:ey})]})})});function tF(){let e=(0,n.useParams)().id;return(0,a.jsx)(s.Vw,{children:(0,a.jsx)(tA,{worktreeId:e})})}}},function(e){e.O(0,[7851,7648,4851,9365,2957,816,2853,2971,2117,1744],function(){return e(e.s=5635)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3791],{89837:function(e,t,r){Promise.resolve().then(r.bind(r,74622))},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return h}});var a=r(2265);let n=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),l=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},i=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},o=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,a.forwardRef)((e,t)=>{let{color:r="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:d="",children:h,iconNode:u,...x}=e;return(0,a.createElement)("svg",{ref:t,...c,width:n,height:n,stroke:r,strokeWidth:l?24*Number(s)/Number(n):s,className:i("lucide",d),...!h&&!o(x)&&{"aria-hidden":"true"},...x},[...u.map(e=>{let[t,r]=e;return(0,a.createElement)(t,r)}),...Array.isArray(h)?h:[h]])}),h=(e,t)=>{let r=(0,a.forwardRef)((r,s)=>{let{className:o,...c}=r;return(0,a.createElement)(d,{ref:s,iconNode:t,className:i("lucide-".concat(n(l(e))),"lucide-".concat(e),o),...c})});return r.displayName=l(e),r}},32660:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(79205).Z)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},80221:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},18930:function(e,t,r){"use strict";r.d(t,{Z:function(){return a}});let a=(0,r(79205).Z)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},74622:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return x}});var a=r(57437),n=r(2265),s=r(80221),l=r(79205);let i=(0,l.Z)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),o=(0,l.Z)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);var c=r(18930);function d(e){let{worktreeId:t,cliToolId:r}=e,[l,d]=(0,n.useState)(""),[h,u]=(0,n.useState)(""),[x,m]=(0,n.useState)([]),[g,p]=(0,n.useState)(-1),[y,f]=(0,n.useState)(!1),b=(0,n.useRef)(null),w=async()=>{try{let e=await fetch("/api/worktrees/".concat(t,"/capture"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:r})});if(e.ok){let t=await e.json();d(t.output||""),b.current&&(b.current.scrollTop=b.current.scrollHeight)}}catch(e){console.error("Failed to capture output:",e)}},v=async e=>{if(e.trim()){f(!0),m(t=>[...t,e]),p(-1);try{(await fetch("/api/worktrees/".concat(t,"/terminal"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:r,command:e})})).ok?(u(""),setTimeout(async()=>{await w(),f(!1)},500)):(f(!1),console.error("Failed to send command"))}catch(e){f(!1),console.error("Error sending command:",e)}}},j=async()=>{try{await fetch("/api/worktrees/".concat(t,"/terminal"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cliToolId:r,command:"\x03"})}),setTimeout(w,500)}catch(e){console.error("Failed to send interrupt:",e)}};return(0,n.useEffect)(()=>{w();let e=setInterval(w,3e3);return()=>clearInterval(e)},[t,r]),(0,a.jsxs)("div",{className:"h-full flex flex-col bg-gray-900 text-gray-100",children:[(0,a.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,a.jsx)("pre",{ref:b,className:"h-full p-4 font-mono text-sm overflow-auto whitespace-pre-wrap bg-black text-green-400",style:{fontFamily:'Menlo, Monaco, "Courier New", monospace',lineHeight:"1.5"},children:l||"Terminal output will appear here..."})}),(0,a.jsxs)("div",{className:"border-t border-gray-700 bg-gray-800 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(s.Z,{className:"text-gray-400",size:20}),(0,a.jsx)("input",{type:"text",value:h,onChange:e=>u(e.target.value),onKeyDown:e=>{if("Enter"===e.key)v(h);else if("ArrowUp"===e.key){if(x.length>0){let e=-1===g?x.length-1:Math.max(0,g-1);p(e),u(x[e])}}else if("ArrowDown"===e.key&&-1!==g){let e=Math.min(x.length-1,g+1);e===x.length-1?(p(-1),u("")):(p(e),u(x[e]))}},placeholder:"Enter command...",disabled:y,className:"flex-1 bg-gray-900 text-white px-3 py-2 rounded border border-gray-600 focus:border-blue-500 focus:outline-none font-mono text-sm"}),(0,a.jsxs)("button",{onClick:()=>v(h),disabled:y||!h.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-600 text-white rounded flex items-center gap-2",children:[(0,a.jsx)(i,{size:16}),"Send"]}),(0,a.jsx)("button",{onClick:w,className:"px-3 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded",title:"Refresh output",children:(0,a.jsx)(o,{size:16})}),(0,a.jsx)("button",{onClick:j,className:"px-3 py-2 bg-red-600 hover:bg-red-700 text-white rounded",title:"Send Ctrl+C",children:"^C"}),(0,a.jsx)("button",{onClick:()=>{d("")},className:"px-3 py-2 bg-gray-700 hover:bg-gray-600 text-white rounded",title:"Clear output",children:(0,a.jsx)(c.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"mt-2 flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>v("ls -la"),className:"px-3 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-white rounded",children:"ls -la"}),(0,a.jsx)("button",{onClick:()=>v("pwd"),className:"px-3 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-white rounded",children:"pwd"}),(0,a.jsx)("button",{onClick:()=>v("git status"),className:"px-3 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-white rounded",children:"git status"}),(0,a.jsx)("button",{onClick:()=>v("clear"),className:"px-3 py-1 text-xs bg-gray-700 hover:bg-gray-600 text-white rounded",children:"clear"})]}),y&&(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-400",children:"Executing command..."}),x.length>0&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-gray-500",children:["History: ",x.length," commands • Use ↑/↓ to navigate"]})]})]})}var h=r(32660),u=r(27648);function x(e){let{params:t}=e,[r,l]=(0,n.useState)("claude");return(0,a.jsxs)("div",{className:"min-h-screen bg-gray-900",children:[(0,a.jsx)("div",{className:"bg-gray-800 border-b border-gray-700 px-6 py-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)(u.default,{href:"/worktrees/".concat(t.id),className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors",children:[(0,a.jsx)(h.Z,{size:20}),(0,a.jsx)("span",{children:"戻る"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,a.jsx)(s.Z,{size:24}),(0,a.jsxs)("h1",{className:"text-xl font-bold",children:["ターミナル: ",t.id]})]})]}),(0,a.jsx)("div",{className:"flex gap-2",children:[{id:"claude",name:"Claude",color:"bg-purple-600"},{id:"codex",name:"Codex",color:"bg-blue-600"},{id:"gemini",name:"Gemini",color:"bg-green-600"}].map(e=>(0,a.jsx)("button",{onClick:()=>l(e.id),className:"\n px-4 py-2 rounded-lg transition-all font-medium\n ".concat(r===e.id?"".concat(e.color," text-white shadow-lg"):"bg-gray-700 text-gray-300 hover:bg-gray-600","\n "),children:e.name},e.id))})]})}),(0,a.jsxs)("div",{className:"container mx-auto p-6",children:[(0,a.jsx)("div",{className:"bg-gray-800 rounded-lg shadow-2xl overflow-hidden",style:{height:"70vh"},children:(0,a.jsx)(d,{worktreeId:t.id,cliToolId:r})}),(0,a.jsxs)("div",{className:"mt-4 p-4 bg-gray-800 rounded-lg text-gray-300 text-sm",children:[(0,a.jsx)("h3",{className:"font-semibold mb-2 text-white",children:"使い方:"}),(0,a.jsxs)("ul",{className:"space-y-1",children:[(0,a.jsx)("li",{children:"• コマンドを入力して Enter キーで実行"}),(0,a.jsx)("li",{children:"• ↑/↓ キーでコマンド履歴を表示"}),(0,a.jsx)("li",{children:"• ^C ボタンで実行中のコマンドを中断"}),(0,a.jsx)("li",{children:"• 自動的に3秒ごとに出力が更新されます"}),(0,a.jsx)("li",{children:"• クイックコマンドボタンで頻繁に使うコマンドを実行"})]})]})]})]})}}},function(e){e.O(0,[7648,2971,2117,1744],function(){return e(e.s=89837)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1224],{22706:function(e,t,r){Promise.resolve().then(r.bind(r,55434))},79205:function(e,t,r){"use strict";r.d(t,{Z:function(){return h}});var n=r(2265);let i=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),l=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},o=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var c={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let d=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:d="",children:h,iconNode:u,...p}=e;return(0,n.createElement)("svg",{ref:t,...c,width:i,height:i,stroke:r,strokeWidth:l?24*Number(s)/Number(i):s,className:a("lucide",d),...!h&&!o(p)&&{"aria-hidden":"true"},...p},[...u.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(h)?h:[h]])}),h=(e,t)=>{let r=(0,n.forwardRef)((r,s)=>{let{className:o,...c}=r;return(0,n.createElement)(d,{ref:s,iconNode:t,className:a("lucide-".concat(i(l(e))),"lucide-".concat(e),o),...c})});return r.displayName=l(e),r}},32660:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},80221:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n=(0,r(79205).Z)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]])},35896:function(e){var t;self,t=()=>{var e;return Object.defineProperty(e={},"__esModule",{value:!0}),e.FitAddon=void 0,e.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;let r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),a=i-(parseInt(l.getPropertyValue("padding-top"))+parseInt(l.getPropertyValue("padding-bottom")));return{cols:Math.max(2,Math.floor((s-(parseInt(l.getPropertyValue("padding-right"))+parseInt(l.getPropertyValue("padding-left")))-r)/t.css.cell.width)),rows:Math.max(1,Math.floor(a/t.css.cell.height))}}},e},e.exports=t()},51447:function(e){var t;self,t=()=>{var e,t,r;return e={6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){let n=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){let{range:n}=e;this._options.hover(t,r,n)}},e))}};class r{static computeLink(e,t,n,i){let s;let l=RegExp(t.source,(t.flags||"")+"g"),[a,o]=r._getWindowedLineStrings(e-1,n),c=a.join(""),d=[];for(;s=l.exec(c);){let e=s[0];try{let t=new URL(e),r=decodeURI(t.toString());if(e!==r&&e+"/"!==r)continue}catch(e){continue}let[t,l]=r._mapStrIdx(n,o,0,s.index),[a,c]=r._mapStrIdx(n,t,l,e.length);if(-1===t||-1===l||-1===a||-1===c)continue;let h={start:{x:l+1,y:t+1},end:{x:c,y:a+1}};d.push({range:h,text:e,activate:i})}return d}static _getWindowedLineStrings(e,t){let r,n=e,i=e,s=0,l="",a=[];if(r=t.buffer.active.getLine(e)){let e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(s=0;(r=t.buffer.active.getLine(--n))&&s<2048&&(s+=(l=r.translateToString(!0)).length,a.push(l),r.isWrapped&&-1===l.indexOf(" ")););a.reverse()}for(a.push(e),s=0;(r=t.buffer.active.getLine(++i))&&r.isWrapped&&s<2048&&(s+=(l=r.translateToString(!0)).length,a.push(l),-1===l.indexOf(" ")););}return[a,n]}static _mapStrIdx(e,t,r,n){let i=e.buffer.active,s=i.getNullCell(),l=r;for(;n;){let e=i.getLine(t);if(!e)return[-1,-1];for(let r=l;r<e.length;++r){e.getCell(r,s);let l=s.getChars();if(s.getWidth()&&(n-=l.length||1,r===e.length-1&&""===l)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,s),2===s.getWidth()&&(n+=1))}if(n<0)return[t,r]}t++,l=0}return[t,l]}}t.LinkComputer=r}},t={},r={},(()=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WebLinksAddon=void 0;let n=function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}(6),i=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function s(e,t){let r=window.open();if(r){try{r.opener=null}catch(e){}r.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}r.WebLinksAddon=class{constructor(e=s,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,r=t.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new n.WebLinkProvider(this._terminal,r,this._handler,t))}dispose(){var e;null===(e=this._linkProvider)||void 0===e||e.dispose()}}})(),r},e.exports=t()},55434:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return m}});var n=r(57437),i=r(2265),s=r(89486),l=r(35896),a=r(51447);function o(e){let{worktreeId:t,cliToolId:r,className:o=""}=e,c=(0,i.useRef)(null),[d,h]=(0,i.useState)(null),[u,p]=(0,i.useState)(null),[g,m]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!c.current)return;let e=new s.Terminal({theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78",black:"#1e1e1e",red:"#f48771",green:"#89d185",yellow:"#f4bf75",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#d4d4d4",brightBlack:"#5a5a5a",brightRed:"#f07178",brightGreen:"#c3e88d",brightYellow:"#f78c6c",brightBlue:"#82aaff",brightMagenta:"#c792ea",brightCyan:"#89ddff",brightWhite:"#ffffff"},fontFamily:'Menlo, Monaco, "Courier New", monospace',fontSize:14,cursorBlink:!0,convertEol:!0}),n=new l.FitAddon;e.loadAddon(n),e.loadAddon(new a.WebLinksAddon),e.open(c.current),n.fit();let i=()=>{n.fit()};window.addEventListener("resize",i),h(e);let o=new WebSocket("ws://localhost:3000/terminal/".concat(t,"/").concat(r));return o.onopen=()=>{console.log("Terminal WebSocket connected"),m(!0),e.write("\x1b[32m✓ Connected to terminal\x1b[0m\r\n")},o.onmessage=t=>{e.write(t.data)},o.onerror=t=>{console.error("WebSocket error:",t),e.write("\x1b[31m✗ Connection error\x1b[0m\r\n")},o.onclose=()=>{console.log("Terminal WebSocket disconnected"),m(!1),e.write("\x1b[33m⚠ Disconnected from terminal\x1b[0m\r\n")},p(o),e.onData(e=>{o.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"input",data:e}))}),()=>{window.removeEventListener("resize",i),o.close(),e.dispose()}},[t,r]);let x=e=>{u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"command",data:e+"\n"}))};return(0,n.jsxs)("div",{className:"flex flex-col h-full ".concat(o),children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800 text-white",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:"w-3 h-3 rounded-full ".concat(g?"bg-green-500":"bg-red-500")}),(0,n.jsxs)("span",{className:"text-sm font-mono",children:[r," - ",t]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("button",{onClick:()=>{d&&d.clear()},className:"px-2 py-1 text-xs bg-gray-700 hover:bg-gray-600 rounded",children:"Clear"}),(0,n.jsx)("button",{onClick:()=>x("clear"),className:"px-2 py-1 text-xs bg-gray-700 hover:bg-gray-600 rounded",children:"Clear Screen"})]})]}),(0,n.jsx)("div",{ref:c,className:"flex-1 bg-gray-900 p-2"}),(0,n.jsx)("div",{className:"px-4 py-2 bg-gray-800 border-t border-gray-700",children:(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsx)("button",{onClick:()=>x("ls -la"),className:"px-3 py-1 text-xs bg-blue-600 hover:bg-blue-700 text-white rounded",children:"ls -la"}),(0,n.jsx)("button",{onClick:()=>x("git status"),className:"px-3 py-1 text-xs bg-green-600 hover:bg-green-700 text-white rounded",children:"git status"}),(0,n.jsx)("button",{onClick:()=>x("pwd"),className:"px-3 py-1 text-xs bg-purple-600 hover:bg-purple-700 text-white rounded",children:"pwd"})]})})]})}r(77489);var c=r(32660),d=r(80221),h=r(79205);let u=(0,h.Z)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),p=(0,h.Z)("code",[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]);var g=r(27648);function m(e){let{params:t}=e,[r,s]=(0,i.useState)("claude");return(0,n.jsxs)("div",{className:"h-screen flex flex-col bg-gray-900",children:[(0,n.jsx)("div",{className:"bg-gray-800 border-b border-gray-700 px-4 py-3",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)(g.default,{href:"/worktrees/".concat(t.id),className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors",children:[(0,n.jsx)(c.Z,{size:20}),(0,n.jsx)("span",{children:"Back"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,n.jsx)(d.Z,{size:20}),(0,n.jsxs)("h1",{className:"text-lg font-semibold",children:["Terminal: ",t.id]})]})]}),(0,n.jsx)("div",{className:"flex items-center gap-2",children:[{id:"claude",name:"Claude",icon:"\uD83E\uDD16",color:"bg-purple-600"},{id:"codex",name:"Codex",icon:"⚡",color:"bg-blue-600"},{id:"gemini",name:"Gemini",icon:"✦",color:"bg-green-600"},{id:"bash",name:"Bash",icon:"\uD83D\uDCBB",color:"bg-gray-600"}].map(e=>(0,n.jsxs)("button",{onClick:()=>s(e.id),className:"\n px-4 py-2 rounded-lg flex items-center gap-2 transition-all\n ".concat(r===e.id?"".concat(e.color," text-white shadow-lg"):"bg-gray-700 text-gray-300 hover:bg-gray-600","\n "),children:[(0,n.jsx)("span",{className:"text-lg",children:e.icon}),(0,n.jsx)("span",{className:"text-sm font-medium",children:e.name})]},e.id))})]})}),(0,n.jsx)("div",{className:"flex-1 p-4",children:(0,n.jsx)("div",{className:"h-full bg-gray-800 rounded-lg overflow-hidden shadow-2xl",children:(0,n.jsx)(o,{worktreeId:t.id,cliToolId:r,className:"h-full"})})}),(0,n.jsx)("div",{className:"bg-gray-800 border-t border-gray-700 px-4 py-2",children:(0,n.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-400",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(u,{size:14}),"Terminal Mode"]}),(0,n.jsxs)("span",{className:"flex items-center gap-1",children:[(0,n.jsx)(p,{size:14}),r.toUpperCase()," Session"]})]}),(0,n.jsx)("div",{children:(0,n.jsx)("span",{className:"text-gray-500",children:"Press Ctrl+C to interrupt • Ctrl+D to exit"})})]})})]})}},77489:function(){}},function(e){e.O(0,[6741,9838,7648,2971,2117,1744],function(){return e(e.s=22706)}),_N_E=e.O()}]);
|