agent-log-viewer 0.2.0 → 0.3.0

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.
Files changed (123) hide show
  1. package/dist/standalone/.next/BUILD_ID +1 -1
  2. package/dist/standalone/.next/app-path-routes-manifest.json +10 -6
  3. package/dist/standalone/.next/build-manifest.json +2 -2
  4. package/dist/standalone/.next/routes-manifest.json +30 -0
  5. package/dist/standalone/.next/server/app/_global-error/page.js +3 -3
  6. package/dist/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/dist/standalone/.next/server/app/_global-error.html +1 -1
  8. package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
  9. package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/dist/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/dist/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  12. package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/dist/standalone/.next/server/app/_not-found/page.js +2 -2
  16. package/dist/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/dist/standalone/.next/server/app/_not-found.html +1 -1
  18. package/dist/standalone/.next/server/app/_not-found.rsc +2 -2
  19. package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/dist/standalone/.next/server/app/api/access/route.js +1 -1
  26. package/dist/standalone/.next/server/app/api/answer/route.js +1 -1
  27. package/dist/standalone/.next/server/app/api/files/route.js +1 -1
  28. package/dist/standalone/.next/server/app/api/flows/[id]/route.js +1 -1
  29. package/dist/standalone/.next/server/app/api/flows/route.js +1 -1
  30. package/dist/standalone/.next/server/app/api/inbox/route.js +1 -1
  31. package/dist/standalone/.next/server/app/api/limits/route.js +1 -1
  32. package/dist/standalone/.next/server/app/api/log/route.js +1 -1
  33. package/dist/standalone/.next/server/app/api/proc/route.js +1 -1
  34. package/dist/standalone/.next/server/app/api/push/route.js +1 -1
  35. package/dist/standalone/.next/server/app/api/spawn/route.js +1 -1
  36. package/dist/standalone/.next/server/app/api/tasks/[id]/route.js +1 -0
  37. package/dist/standalone/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -0
  38. package/dist/standalone/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -0
  39. package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js +2 -0
  40. package/dist/standalone/.next/server/app/api/tasks/[id]/send/route.js.nft.json +1 -0
  41. package/dist/standalone/.next/server/app/api/tasks/[id]/send/route_client-reference-manifest.js +1 -0
  42. package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js +1 -0
  43. package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route.js.nft.json +1 -0
  44. package/dist/standalone/.next/server/app/api/tasks/[id]/spawn/route_client-reference-manifest.js +1 -0
  45. package/dist/standalone/.next/server/app/api/tasks/route.js +1 -0
  46. package/dist/standalone/.next/server/app/api/tasks/route.js.nft.json +1 -0
  47. package/dist/standalone/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -0
  48. package/dist/standalone/.next/server/app/api/timeline/route.js +1 -1
  49. package/dist/standalone/.next/server/app/api/tmux/route.js +1 -1
  50. package/dist/standalone/.next/server/app/api/transcribe/route.js +1 -1
  51. package/dist/standalone/.next/server/app/api/transcribe/token/route.js +1 -1
  52. package/dist/standalone/.next/server/app/favicon.ico/route.js +1 -1
  53. package/dist/standalone/.next/server/app/index.html +1 -1
  54. package/dist/standalone/.next/server/app/index.rsc +3 -3
  55. package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  56. package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  57. package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  58. package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  59. package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  60. package/dist/standalone/.next/server/app/page.js +3 -3
  61. package/dist/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  62. package/dist/standalone/.next/server/app-paths-manifest.json +10 -6
  63. package/dist/standalone/.next/server/chunks/871.js +1 -1
  64. package/dist/standalone/.next/server/functions-config-manifest.json +4 -0
  65. package/dist/standalone/.next/server/middleware-build-manifest.js +1 -1
  66. package/dist/standalone/.next/server/middleware.js +3 -3
  67. package/dist/standalone/.next/server/pages/404.html +1 -1
  68. package/dist/standalone/.next/server/pages/500.html +1 -1
  69. package/dist/standalone/.next/static/chunks/258-a0398b569708ffc3.js +1 -0
  70. package/dist/standalone/.next/static/chunks/app/_global-error/page-f4e3cd62c5cbfd22.js +1 -0
  71. package/dist/standalone/.next/static/chunks/app/api/access/route-f4e3cd62c5cbfd22.js +1 -0
  72. package/dist/standalone/.next/static/chunks/app/api/answer/route-f4e3cd62c5cbfd22.js +1 -0
  73. package/dist/standalone/.next/static/chunks/app/api/files/route-f4e3cd62c5cbfd22.js +1 -0
  74. package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-f4e3cd62c5cbfd22.js +1 -0
  75. package/dist/standalone/.next/static/chunks/app/api/flows/route-f4e3cd62c5cbfd22.js +1 -0
  76. package/dist/standalone/.next/static/chunks/app/api/inbox/route-f4e3cd62c5cbfd22.js +1 -0
  77. package/dist/standalone/.next/static/chunks/app/api/limits/route-f4e3cd62c5cbfd22.js +1 -0
  78. package/dist/standalone/.next/static/chunks/app/api/log/route-f4e3cd62c5cbfd22.js +1 -0
  79. package/dist/standalone/.next/static/chunks/app/api/proc/route-f4e3cd62c5cbfd22.js +1 -0
  80. package/dist/standalone/.next/static/chunks/app/api/push/route-f4e3cd62c5cbfd22.js +1 -0
  81. package/dist/standalone/.next/static/chunks/app/api/spawn/route-f4e3cd62c5cbfd22.js +1 -0
  82. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/route-f4e3cd62c5cbfd22.js +1 -0
  83. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/send/route-f4e3cd62c5cbfd22.js +1 -0
  84. package/dist/standalone/.next/static/chunks/app/api/tasks/[id]/spawn/route-f4e3cd62c5cbfd22.js +1 -0
  85. package/dist/standalone/.next/static/chunks/app/api/tasks/route-f4e3cd62c5cbfd22.js +1 -0
  86. package/dist/standalone/.next/static/chunks/app/api/timeline/route-f4e3cd62c5cbfd22.js +1 -0
  87. package/dist/standalone/.next/static/chunks/app/api/tmux/route-f4e3cd62c5cbfd22.js +1 -0
  88. package/dist/standalone/.next/static/chunks/app/api/transcribe/route-f4e3cd62c5cbfd22.js +1 -0
  89. package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-f4e3cd62c5cbfd22.js +1 -0
  90. package/dist/standalone/.next/static/chunks/app/page-cd0f70a472e144bd.js +2 -0
  91. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-f4e3cd62c5cbfd22.js +1 -0
  92. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-f4e3cd62c5cbfd22.js +1 -0
  93. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-f4e3cd62c5cbfd22.js +1 -0
  94. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f4e3cd62c5cbfd22.js +1 -0
  95. package/dist/standalone/.next/static/css/3f6c482d54e91e64.css +1 -0
  96. package/dist/standalone/.next/static/dxjlPz3fKtXT-7BfdVO_q/_buildManifest.js +1 -0
  97. package/dist/standalone/package.json +1 -1
  98. package/package.json +1 -1
  99. package/dist/standalone/.next/static/chunks/159-d2dbe811eeab290f.js +0 -1
  100. package/dist/standalone/.next/static/chunks/app/_global-error/page-81fecd9eba007478.js +0 -1
  101. package/dist/standalone/.next/static/chunks/app/api/access/route-81fecd9eba007478.js +0 -1
  102. package/dist/standalone/.next/static/chunks/app/api/answer/route-81fecd9eba007478.js +0 -1
  103. package/dist/standalone/.next/static/chunks/app/api/files/route-81fecd9eba007478.js +0 -1
  104. package/dist/standalone/.next/static/chunks/app/api/flows/[id]/route-81fecd9eba007478.js +0 -1
  105. package/dist/standalone/.next/static/chunks/app/api/flows/route-81fecd9eba007478.js +0 -1
  106. package/dist/standalone/.next/static/chunks/app/api/inbox/route-81fecd9eba007478.js +0 -1
  107. package/dist/standalone/.next/static/chunks/app/api/limits/route-81fecd9eba007478.js +0 -1
  108. package/dist/standalone/.next/static/chunks/app/api/log/route-81fecd9eba007478.js +0 -1
  109. package/dist/standalone/.next/static/chunks/app/api/proc/route-81fecd9eba007478.js +0 -1
  110. package/dist/standalone/.next/static/chunks/app/api/push/route-81fecd9eba007478.js +0 -1
  111. package/dist/standalone/.next/static/chunks/app/api/spawn/route-81fecd9eba007478.js +0 -1
  112. package/dist/standalone/.next/static/chunks/app/api/timeline/route-81fecd9eba007478.js +0 -1
  113. package/dist/standalone/.next/static/chunks/app/api/tmux/route-81fecd9eba007478.js +0 -1
  114. package/dist/standalone/.next/static/chunks/app/api/transcribe/route-81fecd9eba007478.js +0 -1
  115. package/dist/standalone/.next/static/chunks/app/api/transcribe/token/route-81fecd9eba007478.js +0 -1
  116. package/dist/standalone/.next/static/chunks/app/page-39971eba742f6b2e.js +0 -2
  117. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-81fecd9eba007478.js +0 -1
  118. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-81fecd9eba007478.js +0 -1
  119. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-81fecd9eba007478.js +0 -1
  120. package/dist/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-81fecd9eba007478.js +0 -1
  121. package/dist/standalone/.next/static/css/331d03725ce2ef2f.css +0 -1
  122. package/dist/standalone/.next/static/eVZqd0xcmD_g_vTrSrlTL/_buildManifest.js +0 -1
  123. /package/dist/standalone/.next/static/{eVZqd0xcmD_g_vTrSrlTL → dxjlPz3fKtXT-7BfdVO_q}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- (()=>{var a={};a.id=974,a.ids=[974],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(27074);function f(){return(0,d.jsx)(e.Viewer,{})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},17891:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/get-segment-param")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25880:()=>{},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26896:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23)),Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},27074:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Viewer() from the server but Viewer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/latand/.agents/tools/live-log-viewer-next/src/components/Viewer.tsx","Viewer")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},48056:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))},55096:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>dS});var d=c(48249),e=c(67484);let f=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),g=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var h={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 i=(0,e.createContext)({}),j=(0,e.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:g="",children:j,iconNode:k,...l},m)=>{let{size:n=24,strokeWidth:o=2,absoluteStrokeWidth:p=!1,color:q="currentColor",className:r=""}=(0,e.useContext)(i)??{},s=d??p?24*Number(c??o)/Number(b??n):c??o;return(0,e.createElement)("svg",{ref:m,...h,width:b??n??h.width,height:b??n??h.height,stroke:a??q,strokeWidth:s,className:f("lucide",r,g),...!j&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(l)&&{"aria-hidden":"true"},...l},[...k.map(([a,b])=>(0,e.createElement)(a,b)),...Array.isArray(j)?j:[j]])}),k=(a,b)=>{let c=(0,e.forwardRef)(({className:c,...d},h)=>(0,e.createElement)(j,{ref:h,iconNode:b,className:f(`lucide-${g(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=g(a),c},l=k("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),m={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min)","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.jobLogHint":"This is a short job log (service events only). Codex's real work is in the full session:","task.openCodexSession":"Open Codex session ({size} kB{activity})","task.rolloutMissing":"This is a short job log. The full Codex rollout session hasn't appeared in the list yet","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв)","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту"}},n="en",o=new Set;function p(){return n}function q(a){if(a!==n){n=a;try{window.localStorage.setItem("llv_lang",a)}catch{}for(let b of("u">typeof document&&(document.documentElement.lang=a),o))b()}}function r(a){return o.add(a),()=>o.delete(a)}function s(a,b,c){var d;let e,f=m[a][b]??m.en[b]??b;if("string"==typeof f)e=f;else{let b="number"==typeof c?.count?c.count:0;e=f[new Intl.PluralRules("uk"===a?"uk-UA":"en-US").select(b)]??f.other??f.one??""}return d=e,c?d.replace(/\{(\w+)\}/g,(a,b)=>b in c?String(c[b]):a):d}function t(){let a=(0,e.useSyncExternalStore)(r,p,()=>"en");return{locale:a,t:(b,c)=>s(a,b,c),setLocale:q}}function u(a,b=160){let c=a.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,a=>{if(a.length<=40)return a;let b=a.split("/").filter(Boolean);return b.length>=2?".../"+b.slice(-2).join("/"):a}).replace(/\s+/g," ").trim();return c.length>b?c.slice(0,b-1).trimEnd()+"…":c}let v="__overview__",w=a=>Math.floor(a/300);function x(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function y(a){return"claude-projects"===a.root?"сесія"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function z(a){return"claude-projects"===a.root&&"субагент"===a.kind}function A(a){return!!z(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function B(a){return"shell"===a.engine||"codex-jobs"===a.root}function C(a){return a.project||"інше"}function D(a){let b=new Map;for(let c of a){let a=C(c),d=b.get(a);d||(d={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},b.set(a,d)),"live"===c.activity&&(d.liveCount+=1),(c.pendingQuestion||c.waitingInput)&&(d.attentionCount+=1),y(c)&&(d.conversations+=1),d.smt=Math.max(d.smt,c.mtime)}return[...b.values()].sort((a,b)=>{let c=a.attentionCount>0;return c!==b.attentionCount>0?c?-1:1:a.liveCount!==b.liveCount?b.liveCount-a.liveCount:w(b.smt)-w(a.smt)||a.project.localeCompare(b.project)})}function E(a){let b=new Map;for(let c of a){if(!c.parent)continue;let a=b.get(c.parent);a?a.push(c):b.set(c.parent,[c])}return b}function F(a,b){let c=[],d=[...b.get(a.path)??[]],e=new Set([a.path]);for(;d.length;){let a=d.pop();e.has(a.path)||(e.add(a.path),c.push(a),d.push(...b.get(a.path)??[]))}return c}function G(a){return!B(a)&&("live"===a.activity||"recent"===a.activity&&A(a))}function H(a,b){let c=new Map(a.map(a=>[a.path,a])),d=E(a),e=new Map,f=new Map;for(let d of a)if(C(d)===b){if("live"===d.activity||"recent"===d.activity&&A(d)){let a=function(a,b){let c=new Set,d=a;for(;d.parent&&!c.has(d.path);){c.add(d.path);let a=b.get(d.parent);if(!a)break;d=a}return d}(d,c);B(a)?f.set(a.path,a):e.set(a.path,a);continue}"recent"===d.activity&&y(d)&&e.set(d.path,d)}let g=[...e.values()].map(a=>(function(a,b,c){let d=F(a,b),e=d.filter(G).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||w(b.mtime)-w(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>B(a)&&"live"===a.activity).sort((a,b)=>w(b.mtime)-w(a.mtime)||a.path.localeCompare(b.path)),g=[a,...e].map(a=>({file:a,tasks:[]})),h=new Map(g.map(a=>[a.file.path,a]));for(let a of f)(a.parent&&h.get(a.parent)||g[0]).tasks.push(a);let i=new Set([...h.keys(),...f.map(a=>a.path)]),j=d.filter(a=>!i.has(a.path)).sort((a,b)=>b.mtime-a.mtime),k=j.filter(a=>A(a)&&function(a,b){let c=new Set([a.path]),d=a;for(;d.parent&&!c.has(d.parent);){let a=b.get(d.parent);if(!a)break;if(c.add(a.path),"сесія"===a.kind)return"live"===a.activity||"recent"===a.activity;d=a}return!1}(a,c)),l=new Set(k.map(a=>a.path)),m=j.filter(a=>!l.has(a.path)),n=Math.max(...g.map(a=>a.file.mtime),...f.map(a=>a.mtime));return{key:a.path,columns:g,returnable:k,finished:m,smt:n,orphanTask:!1}})(a,d,c));for(let a of f.values())g.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return g.sort((a,b)=>a.orphanTask!==b.orphanTask?a.orphanTask?1:-1:w(b.smt)-w(a.smt)||a.key.localeCompare(b.key))}let I=new Set,J=I,K=new Set;function L(a){return K.add(a),()=>K.delete(a)}let M=new Set;function N(a){let b=new Map;for(let c of a){if("closed"===c.state)continue;let a=b.get(c.implementerPath);(!a||c.createdAt>a.createdAt)&&b.set(c.implementerPath,c)}return b}function O(a){let b=new Set;for(let c of a)for(let a of c.rounds)a.reviewerPath&&b.add(a.reviewerPath);return b}function P(a,b){return a(`flowState.${b}`)}let Q=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),R=new Set(["spawning","reviewing","relaying","fixing"]);function S(a){return"spawning"===a.state||"reviewing"===a.state?"reviewer":"waiting_ready"===a.state||"relaying"===a.state||"fixing"===a.state?"implementer":null}let T={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function U(a){return"APPROVE"===a?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===a?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===a?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function V(a,b){try{let c=await fetch(`/api/flows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return"close"===b.action&&function(a){if(!I.has(a))for(let b of(I.add(a),J=new Set(I),K))b()}(a),window.dispatchEvent(new Event("llv:flows-changed")),null;let d=await c.json().catch(()=>null);return d?.error??s(p(),"flowModel.failed",{status:c.status})}catch{return s(p(),"common.serverUnavailable")}}function W(a){let b=p(),c=Date.now()/1e3-a;return c<90?s(b,"time.agoSec",{n:Math.round(c)}):c<5400?s(b,"time.agoMin",{n:Math.round(c/60)}):c<129600?s(b,"time.agoHour",{n:Math.round(c/3600)}):s(b,"time.agoDay",{n:Math.round(c/86400)})}function X(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a),c="uk"===p()?"uk-UA":"en-US";return Number.isNaN(b.getTime())?"":b.toLocaleTimeString(c,{hour12:!1})}function Y(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let Z={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},$={color:"#9a9aa4",soft:"#ececf1"},_=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],aa=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function ab(a){let b=Z[a.engine];if(!b)return $;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?aa:_)if(b.test(c))return d;return b}let ac={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30}};function ad(a,b,c){let[d,e,f]=function(a){let b=parseInt(a.slice(1),16),c=(b>>16&255)/255,d=(b>>8&255)/255,e=(255&b)/255,f=Math.max(c,d,e),g=Math.min(c,d,e),h=(f+g)/2,i=f-g;if(0===i)return[0,0,100*h];let j=i/(1-Math.abs(2*h-1));return[60*(f===c?((d-e)/i+6)%6:f===d?(e-c)/i+2:(c-d)/i+4),100*j,100*h]}(a),g=a=>Math.min(100,Math.max(0,a));return`hsl(${Math.round(d)} ${Math.round(g(e+c))}% ${Math.round(g(f+b))}%)`}function ae(a){let b=ab(a),c=ac[a.effort??""];return c?{color:ad(b.color,c.dl,c.ds),soft:ad(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function af(a){return a.effort?s(p(),"util.effortTitle",{effort:a.effort}):void 0}function ag(a){return ab(a).color}function ah(a){return{borderTopColor:ab(a).color}}function ai(a){let b={codex:"Codex",claude:"Claude",shell:"Bash"}[a.engine]??a.engine,c=Z[a.engine]??$;return{label:b,style:{backgroundColor:c.soft,color:c.color}}}function aj(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function ak(a){return z(a)&&"running"!==a.proc}function al(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?!ak(a)&&b-a.mtime<=7200:"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&y(a)&&!z(a))}function am(a,b,c,d,f=an,g=ao){let{locale:h}=t();return(0,e.useMemo)(()=>{let e=(a,b)=>s(h,a,b),i=function(a){let b=E(a),c=new Map;for(let d of a)c.set(d.path,F(d,b).length);return c}(a),j=new Map;for(let a of b){let b=j.get(a.file);(!b||a.ts>b.ts)&&j.set(a.file,a)}let k=N(g),l=O(g),m=c.trim().toLowerCase(),n=a.filter(a=>!f.has(a.path)&&!l.has(a.path)&&(y(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!B(a))).map(a=>{let b=C(a),c=u(a.title),f=d-a.mtime,g=k.get(a.path),h=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":al(a,d)?"waiting":f<=86400?"recent":"older",l=function(a,b,c){if(b.pendingQuestion)return a("plan"===b.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(b.waitingInput)return a("status.awaitingTerminal");if("live"===b.activity&&b.plan?.current)return`${b.plan.done}/${b.plan.total} \xb7 ${b.plan.current}`;let d=c.get(b.path);return d?`${d.label} \xb7 ${W(d.ts)}`:"live"===b.activity?a("status.working"):ak(b)?a("status.returnedResult"):"stalled"===b.activity?a("status.stalled"):al(b)?a("status.finishedTurn"):""}(e,a,j);return g&&(Q.has(g.state)?h="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(h="working"),l=`${e("status.flow",{label:P(e,g.state)})}${g.stateDetail?` — ${g.stateDetail}`:""}`),{file:a,project:b,title:c,descendants:i.get(a.path)??0,smt:a.mtime,kind:h,statusLine:l}}).filter(a=>!m||`${a.title} ${a.project}`.toLowerCase().includes(m)),o=(a,b)=>b.smt-a.smt||a.file.path.localeCompare(b.file.path),p=n.filter(a=>"waiting"===a.kind).sort(o),q=n.filter(a=>"working"===a.kind).sort(o);return{waiting:p,working:q,recent:n.filter(a=>"recent"===a.kind).sort(aj),older:n.filter(a=>"older"===a.kind).sort(aj),livePreview:q.slice(0,3)}},[a,b,c,d,f,g,h])}let an=new Set,ao=[];function ap(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&A(a)&&"running"!==a.proc?"returned":al(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}let aq="llvSound";function ar(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}let as={files:[],flows:[]},at="(max-width: 767px)";function au(a){let b=window.matchMedia(at);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}function av(){return(0,e.useSyncExternalStore)(au,()=>window.matchMedia(at).matches,()=>!1)}let aw=k("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function ax({files:a,archivedProjects:b,onSelectProject:c,onSelectFile:f,onMenu:g}){let{t:h}=t(),i=function(){let[a,b]=(0,e.useState)(3);return a}(),j=(0,e.useMemo)(()=>D(a),[a]),k=(0,e.useMemo)(()=>j.filter(a=>!b.has(a.project)),[j,b]),l=j.length-k.length,m=(0,e.useMemo)(()=>k.reduce((a,b)=>a+b.liveCount,0),[k]),n=k.filter(a=>a.liveCount>0).length,o=(0,e.useMemo)(()=>k.map(b=>{let c=H(a,b.project).flatMap(a=>a.columns.flatMap(a=>[a.file,...a.tasks])).filter(a=>"live"===a.activity),d=c.slice(0,4),e=a.filter(a=>C(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,k]);return(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[g?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("dash.openProjects"),onClick:g,children:(0,d.jsx)(aw,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:h("rail.overview")}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[m?h("overview.branchesLiveIn",{count:m,projects:h("overview.projects",{count:n})}):h("common.nothingRunning"),l?` ${h("overview.archived",{count:l})}`:""]})]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:[o.map(({summary:a,liveBranches:b,moreLive:e,latest:g})=>(0,d.jsxs)("button",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-3 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>c(a.project),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${a.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:a.project}),a.liveCount?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:a.liveCount}):null,(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:a.conversations})]}),b.length?(0,d.jsxs)("span",{className:"flex flex-col gap-1",children:[b.map(a=>{let b=ai(a);return(0,d.jsxs)("span",{className:"flex cursor-pointer items-center gap-1.5 rounded-[8px] px-1 py-0.5 text-[11.5px] hover:bg-bg",role:"link",tabIndex:0,title:u(a.title),onClick:b=>{b.stopPropagation(),f(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),f(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"truncate font-semibold",children:u(a.title,70)})]},a.path)}),e>0?(0,d.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:h("overview.moreLive",{count:e})}):null]}):(0,d.jsx)("span",{className:"text-[11px] text-dim",children:h("overview.quiet",{age:g?W(g.mtime):"—"})})]},a.project)),k.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:h("overview.empty")})]})]})}let ay=k("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]),az=k("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),aA=k("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),aB=k("archive-restore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),aC=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),aD=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),aE=k("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),aF=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),aG=k("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),aH=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),aI=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),aJ=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),aK=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),aL=k("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),aM=k("fold-vertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]),aN=k("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),aO=k("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),aP=k("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),aQ=k("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),aR=k("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),aS=k("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),aT=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),aU=k("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),aV=k("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"}]]),aW=k("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),aX=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),aY=k("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),aZ=k("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),a$=k("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),a_=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),a0=k("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),a1=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),a2={shell:aI,tool:aW,"cmd-group":aX,codex:aL,claude:aS,image:aN,blob:aY,note:aZ,citation:a$,message:aO,shutdown:a_,plan:a0,compact:aM};function a3({name:a,className:b}){let c=a2[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}let a4=k("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var a5=c(74429);function a6({label:a,side:b="top",children:c}){return(0,d.jsxs)("span",{className:"group/hint relative inline-flex",children:[c,(0,d.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute left-1/2 z-[60] -translate-x-1/2 whitespace-nowrap rounded-[7px] bg-ink px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-card transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"top"===b?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:a})]})}let a7={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function a8(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error(s(p(),"img.readFailed"))):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error(s(p(),"img.readFailed"))),d.onabort=()=>c(Error(s(p(),"img.readAborted"))),d.readAsDataURL(a)})}function a9({images:a,onRemove:b}){let{t:c}=t();return a.length?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map((a,e)=>(0,d.jsxs)("div",{className:"group/img relative",children:[(0,d.jsx)("img",{src:a.preview,alt:c("img.previewAlt",{n:e+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(e),"aria-label":c("img.removeAria",{n:e+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-line bg-panel text-dim shadow-card hover:text-err group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,d.jsx)(l,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},e)),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[c("composer.imagesCount",{count:a.length})," ",(0,d.jsx)(aD,{className:"h-3 w-3","aria-hidden":!0})," ",c("img.toFilePaths")]})]}):null}function ba({onFiles:a,ariaLabel:b,className:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:f,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:b=>{a(Array.from(b.target.files??[])),b.target.value=""}}),(0,d.jsx)("button",{type:"button","aria-label":b,onClick:()=>f.current?.click(),className:c,children:(0,d.jsx)(aN,{className:"h-4 w-4","aria-hidden":!0})})]})}function bb({initialText:a,persistText:b,submit:c,disabled:d=!1}){let[f,g]=(0,e.useState)(a),h=(0,e.useRef)(f),i=a=>{let c="function"==typeof a?a(h.current):a;h.current=c,g(c),b(c)},[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),q=(0,e.useRef)(null),r=function(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(a7[c.type]??null)){a.onError(s(p(),"img.unsupported",{name:c.name||c.type||s(p(),"img.unknownFile")}));continue}if(c.size>0xa00000){a.onError(s(p(),"img.tooLarge",{name:c.name||s(p(),"img.image")}));continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(a8)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:s(p(),"img.error"))})};return{images:b,addFiles:d,handlePaste:a=>{let b=Array.from(a.clipboardData.items).filter(a=>a.type.startsWith("image/")).map(a=>a.getAsFile()).filter(a=>null!==a);b.length&&(a.preventDefault(),d(b))},removeAt:a=>c(b=>b.filter((b,c)=>c!==a)),clear:()=>c([])}}({onError:a=>o({kind:"err",text:a}),onAdded:()=>o(null)}),u=a=>{i(b=>b?b.trimEnd()+" "+a:a),o(null),q.current?.focus()},v=function({onError:a,onUnclaimedText:b,onLiveCommit:c}){let{t:d}=t(),[f,g]=(0,e.useState)("idle"),[h,i]=(0,e.useState)(0),[j,k]=(0,e.useState)(""),l=(0,e.useRef)(null),m=(0,e.useRef)([]),n=(0,e.useRef)(null),o=(0,e.useRef)(!1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null),u=(0,e.useRef)(!1),v=(0,e.useRef)(!0),w=()=>{null!==p.current&&(clearInterval(p.current),p.current=null)},x=()=>{let a=r.current;r.current=null,a&&(cancelAnimationFrame(a.raf),a.ctx.close().catch(()=>void 0))},y=a=>{w(),x();let c=n.current;if(n.current=null,c){try{c.processor.disconnect()}catch{}try{c.ws.close()}catch{}c.stream.getTracks().forEach(a=>a.stop()),c.ctx.close().catch(()=>void 0)}k(""),g("idle");let d=s.current;if(s.current=null,o.current)return void d?.(null);let e=a.partial.trim();d?d(e):e&&b(e)},z=async()=>{w(),x();let c=l.current;l.current=null,c?.stream.getTracks().forEach(a=>a.stop());let e=new Blob(m.current,{type:"audio/webm"});m.current=[];let f=s.current;if(s.current=null,o.current||e.size<2e3){g("idle"),f?.(null);return}g("busy");try{let c=new FormData;c.append("file",e,"dictation.webm");let g=await fetch("/api/transcribe",{method:"POST",body:c}),h=await g.json();if(!g.ok||"string"!=typeof h.text){a(h.error??d("dictation.failed")),f?.(null);return}let i=h.text.trim();i?f?f(i):b(i):(a(d("dictation.silence")),f?.(null))}catch{a(d("common.serverUnavailable")),f?.(null)}finally{g("idle")}},A=async()=>{try{let a=await fetch("/api/transcribe/token",{method:"POST"});if(!a.ok)return null;let b=await a.json();return"string"==typeof b.token&&b.token?b.token:null}catch{return null}},B=async()=>{if(u.current||l.current||n.current)return;u.current=!0;let b=null,e=!0;try{if(b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),!v.current)return;o.current=!1,k("");let f=await A();if(!v.current||o.current)return;if(!(null!==f&&((b,e)=>{let f;try{f=new AudioContext({sampleRate:16e3})}catch{return!1}let g=new URLSearchParams({model_id:"scribe_v2_realtime",token:e,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),h=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${g.toString()}`),i=f.createScriptProcessor(4096,1,1),j={ws:h,ctx:f,processor:i,stream:b,preOpenQueue:[],partial:""};n.current=j;let l=f.createMediaStreamSource(b);return i.onaudioprocess=a=>{if(n.current!==j)return;let b=function(a){let b=new Int16Array(a.length);for(let c=0;c<a.length;c+=1){let d=Math.max(-1,Math.min(1,a[c]??0));b[c]=d<0?32768*d:32767*d}let c=new Uint8Array(b.buffer),d="";for(let a=0;a<c.length;a+=1)d+=String.fromCharCode(c[a]??0);return btoa(d)}(a.inputBuffer.getChannelData(0));h.readyState===WebSocket.OPEN?h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:b})):h.readyState===WebSocket.CONNECTING&&j.preOpenQueue.push(b)},l.connect(i),i.connect(f.destination),h.addEventListener("open",()=>{if(n.current===j){for(let a of j.preOpenQueue)h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:a}));j.preOpenQueue=[]}}),h.addEventListener("message",b=>{if(n.current===j)try{let e=JSON.parse(b.data);if("partial_transcript"===e.message_type)j.partial=e.text??"";else if(("committed_transcript"===e.message_type||"committed_transcript_with_timestamps"===e.message_type)&&e.text)j.partial="",c(e.text);else if("auth_error"===e.message_type||"error"===e.message_type||"invalid_request"===e.message_type||"quota_exceeded"===e.message_type){a(e.error||d("dictation.liveError")),y(j);return}k(j.partial)}catch{}}),h.addEventListener("close",()=>{n.current!==j||s.current||(a(d("dictation.connectionLost")),y(j))}),!0})(b,f))){let a=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",c=a?new MediaRecorder(b,{mimeType:a}):new MediaRecorder(b);m.current=[],c.ondataavailable=a=>{a.data.size&&m.current.push(a.data)},c.onstop=()=>{z()},c.start(250),l.current=c}e=!1,(a=>{let b;try{b=new AudioContext}catch{return}let c=b.createAnalyser();c.fftSize=128,c.smoothingTimeConstant=.7,b.createMediaStreamSource(a).connect(c);let d=new Uint8Array(c.frequencyBinCount),e=()=>{if(!r.current)return;r.current.raf=requestAnimationFrame(e),c.getByteFrequencyData(d);let a=q.current;a&&function(a,b){let c=window.devicePixelRatio||1;(a.width!==56*c||a.height!==16*c)&&(a.width=56*c,a.height=16*c);let d=a.getContext("2d");if(!d)return;d.setTransform(c,0,0,c,0,0),d.clearRect(0,0,56,16);let e=Math.max(13,Math.floor(.65*b.length))/13;for(let a=0;a<13;a+=1){let c=Math.floor(a*e),f=Math.max(c+1,Math.floor((a+1)*e)),g=0;for(let a=c;a<f;a+=1)g+=b[a]??0;let h=g/(f-c)/255,i=Math.max(1.5,16*h);d.fillStyle=`rgba(198, 40, 40, ${(.35+.65*h).toFixed(3)})`,d.fillRect(4.3076923076923075*a+1,(16-i)/2,2.3076923076923075,i)}}(a,d)};r.current={ctx:b,raf:requestAnimationFrame(e)}})(b),i(0),g("rec"),p.current=window.setInterval(()=>{i(a=>{let b=a+1;return b>=120&&(l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)),b})},1e3)}catch{v.current&&a(b?d("dictation.unsupported"):d("dictation.noMic"))}finally{var f;e&&(f=b,f?.getTracks().forEach(a=>a.stop())),u.current=!1}};return{phase:f,elapsed:h,liveText:j,canvasRef:q,start:B,stop:()=>new Promise(a=>{let b=n.current;if(b){s.current=a,y(b);return}let c=l.current;c&&"recording"===c.state?(s.current=a,c.stop()):a(null)}),discard:()=>{o.current=!0,l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)}}}({onError:a=>o({kind:"err",text:a}),onUnclaimedText:u,onLiveCommit:u}),w=v.liveText?(f?f.trimEnd()+" ":"")+v.liveText:f,x=async()=>{if(!j&&!l){m(!0);try{let a=await v.stop();if(null===a)return;let b=a?h.current?h.current.trimEnd()+" "+a:a:h.current;i(b),await c(b)}finally{m(!1)}}},y="rec"===v.phase,z="busy"===v.phase,A=j||l||d,B=!A&&!z&&(y||!!f.trim()||r.images.length>0);return{text:f,textRef:h,setText:i,setTextState:g,displayText:w,inputRef:q,status:n,setStatus:o,busy:j,setBusy:k,voiceSending:l,dictation:v,attachments:r,insertSpoken:u,stopAndSend:x,submit:c,dictationRecording:y,dictationBusy:z,fieldsDisabled:A,canSend:B}}function bc({phase:a,elapsed:b,canvasRef:c,start:e,stop:f,discard:g,onText:h,busy:i=!1}){let{t:j}=t(),k=()=>{i||("idle"===a?e():"rec"===a&&f().then(a=>{a&&h(a)}))};if("rec"===a)return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,d.jsxs)("button",{type:"button","aria-label":j("mic.stopRecognize"),onClick:k,className:"flex items-center gap-1.5 rounded-[8px] border border-err/50 bg-[#fff2f2] px-2 py-2 text-[11px] font-bold text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[(0,d.jsx)("canvas",{ref:c,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(b/60)}:${String(b%60).padStart(2,"0")}`]}),(0,d.jsx)("button",{type:"button","aria-label":j("mic.cancel"),onClick:g,className:"inline-flex items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsx)("button",{type:"button","aria-label":j("busy"===a?"mic.recognizing":"mic.dictate"),title:j("busy"===a?"mic.recognizing":"mic.dictateHint"),disabled:"busy"===a||i,onClick:k,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:"busy"===a?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aQ,{className:"h-4 w-4","aria-hidden":!0})})}function bd({composer:a,placeholder:b,textareaAriaLabel:c,imageAriaLabel:e,leftSlot:f,sendLabelIdle:g,sendLabelRecording:h,sendTitleRecording:i,sendIdleClassName:j,sendIdleStyle:k}){let{displayText:l,inputRef:m,dictation:n,setText:o,attachments:p,voiceSending:q,insertSpoken:r,stopAndSend:s,submit:t,fieldsDisabled:u,canSend:v,dictationRecording:w,busy:x,status:y}=a;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{ref:m,value:l,rows:1,readOnly:!!n.liveText,onChange:a=>o(a.target.value),onPaste:p.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===n.phase?s():t())},placeholder:b,"aria-label":c,disabled:u,className:"w-full resize-none overflow-y-auto rounded-[10px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] placeholder:text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[f,(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(bc,{...n,busy:q,onText:r}),(0,d.jsx)(a6,{label:e,children:(0,d.jsx)(ba,{ariaLabel:e,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:p.addFiles})}),(0,d.jsx)(a6,{label:w?i??h:g,children:(0,d.jsx)("button",{type:w?"button":"submit",onClick:w?()=>void s():void 0,disabled:!v,"aria-label":w?h:g,style:w?void 0:k,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 ${w?"border-err bg-err hover:opacity-90":j}`,children:x||q?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aR,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,d.jsx)(a9,{images:p.images,onRemove:p.removeAt}),y?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===y.kind?"text-ok":"text-err"}`,children:y.text}):null]})}function be(a){return"claude-projects"===a.root?"сесія"===a.kind||"субагент"===a.kind:"codex-sessions"===a.root}function bf({file:a}){let{t:b}=t(),c=function(a,b){let[c,d]=(0,e.useState)(null);return null!==a||b?c:null}(a.pid,be(a)?a.path:void 0),f=bb({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvDraft:"+a.path,b):sessionStorage.removeItem("llvDraft:"+a.path)},submit:a=>F(a)}),{text:g,textRef:h,setText:i,setTextState:j,inputRef:k,setStatus:m,busy:n,setBusy:o,voiceSending:q,attachments:r}=f,[s,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)([]),B=be(a);if(null===c&&!B)return null;let C=null===c,D=C&&"claude-projects"===a.root&&"субагент"===a.kind,E=b=>{A(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},F=async c=>{let d=c??g;if(!n&&!q&&(d.trim()||r.images.length)){o(!0),m(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:d,images:r.images.map(a=>({base64:a.base64,mime:a.mime}))})}),e=await c.json();if(!c.ok||!e.ok)return void m({kind:"err",text:e.error??b("common.failedSend")});let f=r.images.length,g={id:Date.now(),text:d.trim()||(f?b("composer.imagesCount",{count:f}):""),at:Date.now(),via:e.spawned?"spawn":"pane"};E([...z,g].slice(-8)),i(""),r.clear(),m({kind:"ok",text:e.spawned?b("composer.spawned",{target:e.target??""}):e.imagePaths?.length?b("composer.sentPaths",{count:e.imagePaths.length}):b("common.sent")}),k.current?.focus()}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{o(!1)}}},G=async()=>{if(!s){u(!0),m(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void m({kind:"err",text:d.error??b("composer.failedInterrupt")});m({kind:"ok",text:b("composer.escapeSent")})}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{u(!1)}}},H=async()=>{if(!v){w(!0),m(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void m({kind:"err",text:d.error??b("composer.failedCompact")});m({kind:"ok",text:b("composer.compactSent")})}catch{m({kind:"err",text:b("common.serverUnavailable")})}finally{w(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),F()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":C?b("composer.spawnAria"):b("composer.sendAria",{target:c??""}),children:[z.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":b("composer.queueAria"),children:z.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] truncate rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2 py-0.5 text-[11px] text-[#333]",title:a.text,children:a.text}),(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===a.via?(0,d.jsx)(aR,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(aD,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk"===p()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":b("composer.removeFromQueue"),className:"inline-flex shrink-0 items-center rounded px-0.5 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>E(z.filter(b=>b.id!==a.id)),children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)(bd,{composer:f,placeholder:D?b("composer.placeholderRelay"):C?b("composer.placeholderSpawn"):b("composer.placeholderSend"),textareaAriaLabel:b("composer.textAria"),imageAriaLabel:b("composer.addImages"),sendLabelIdle:C?b("composer.launchAgent"):b("composer.sendToAgent"),sendLabelRecording:b("composer.stopAndSend"),sendTitleRecording:b("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:D?b("composer.titleRelay"):C?b("composer.titleSpawnResumed"):`tmux ${c}`,children:D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aE,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",b("composer.root")]}):C?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aR,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aU,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:c})]})}),C?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6,{label:b("composer.interruptTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":b("composer.interruptAria"),disabled:s,onClick:()=>void G(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:s?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(aT,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,d.jsx)(a6,{label:x?b("composer.compactConfirmTitle"):b("composer.compactTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":x?b("composer.compactConfirmTitle"):b("composer.compactAria"),disabled:v,onClick:()=>{x?(y(!1),H()):y(!0)},className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${x?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:v?(0,d.jsx)(a1,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{className:"h-4 w-4","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-[10.5px] font-bold",children:b("composer.compactConfirm")})]}):(0,d.jsx)(aM,{className:"h-4 w-4","aria-hidden":!0})})})]})]})})]})}let bg="#0d9488",bh=new Map;function bi(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function bj(a,b,c,d){let e=Math.max(48,.45*Math.abs(c-a));return`M ${a} ${b} C ${a+e} ${b}, ${c-e} ${d}, ${c} ${d}`}function bk({drop:a}){let{t:b}=t(),c=Math.max(8,Math.min(a.to.x+14,window.innerWidth-288)),e=Math.max(8,Math.min(a.to.y+12,window.innerHeight-44));return(0,d.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-card",style:{left:c,top:e,backgroundColor:bg},children:[(0,d.jsx)(a4,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"truncate",children:b("link.dropped",{title:u(a.file.title,48)})})]})}function bl({file:a,onDeleted:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");if("running"===a.proc)return null;let l=async()=>{i(!0),k("");try{let d=await fetch(`/api/log?path=${encodeURIComponent(a.path)}`,{method:"DELETE"}),e=await d.json();if(!d.ok||!e.ok)return void k(e.error??c("common.failedDelete"));g(!1),b?.()}catch{k(c("common.serverUnavailable"))}finally{i(!1)}};return f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:c("delFile.confirm")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:l,children:h?"…":c("common.yes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:c("common.no")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("delFile.aria"),title:c("delFile.aria"),onClick:()=>g(!0),children:(0,d.jsx)(aV,{className:"h-3 w-3","aria-hidden":!0})}),j?(0,d.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:j,children:j}):null]})}function bm({className:a,style:b,enter:c="scale",children:f}){let g=(0,e.useRef)(null);return!function(a="scale"){(0,e.useRef)(new Map),(0,e.useRef)(new WeakMap),(0,e.useRef)(!0)}(c),(0,d.jsx)("div",{ref:g,className:a,style:b,children:f})}let bn=k("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),bo=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,bp=/^\s*(\d+)[.)]\s+(.*)$/,bq=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,br=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,bs=/\[([^\]]+)\]\(([^)\s]+)\)/,bt=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function bu(a){return a.replace(bt,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function bv(a){let b=bu(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function bw(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function bx(a,b){let c=a.match(bo)?.[1];if(!c)return null;let d=[],e=[],f=null,g=()=>{let a,b,c,e=f?.trim();e&&d.push((a=function(a){let b=a.toUpperCase();if("P0"===b||"P1"===b||"P2"===b||"P3"===b)return b;let c=a.toLowerCase();return"critical"===c?"Critical":"high"===c?"High":"medium"===c?"Medium":"low"===c?"Low":"Info"}(e.match(bq)?.[1]??e.match(bq)?.[2]??"Info"),b=function(a){let b=a.match(bs);if(b){let a=bw((b[2]??"").replace(/^file:\/\//,"")),c=a.line?Number(a.line.split("-",1)[0]):void 0;return{file:a.target||b[1],line:Number.isFinite(c)?c:void 0}}let c=a.match(br);if(!c)return{};let d=c[2]?Number(c[2]):void 0;return{file:c[1],line:Number.isFinite(d)?d:void 0}}(e),c=function(a){let b=a,c=b.match(bq);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(bs,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(e)||e.slice(0,200)||"Finding",{severity:a,file:b.file,line:b.line,title:c,body:bv(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(bp);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
2
- ${h}`:g();continue}!(!h||bo.test(a)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(h))&&0===d.length&&e.length<3&&h.length<=240&&e.push(h)}g();let h=d.filter(a=>bq.test(a.body)).length;return c||/^findings?\s*:?$/im.test(a)||h>=2||h>=1&&/\b(review|request_changes|approve|comment)\b/i.test(a)?{kind:"review",ts:b,verdict:c,findings:d,summary:e,raw:bv(a).raw}:null}let by=(a,b)=>s(p(),a,b),bz=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function bA(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let bB=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,bC=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function bD(a){if(!a.includes("/.claude/viewer-inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(bC,(a,d)=>(c.has(a)||(c.add(a),b.push({name:d,path:a})),"")).trim()&&d.push(e);return{cleaned:d.join("\n").trim(),images:b}}let bE=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function bF(a,b){let c=a.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return c||(/^\s*# AGENTS\.md/.test(a)?"AGENTS.md":/^\s*Caveat:/.test(a)?"caveat":b||by("render.system"))}function bG(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function bH(a){return"string"==typeof a?a:""}function bI(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function bJ(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}function bK(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=bw(a.replace(/\|note=\[.*\]$/,""));return{target:c.target,line:c.line,note:b,raw:a}}),e=c.split(/\s+/).map(a=>a.trim()).filter(a=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a)),f=bv(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}function bL(a,b,c){if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],e=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),f=!0===c||void 0!==d&&"0"!==d;return a.status=f?"err":"ok",a.label=f?d&&"0"!==d?"exit "+d:by("render.error"):"ok",a.open||=f,e&&(a.output=(a.output+"\n"+bu(e)).trim().slice(-(f?6e4:12e3))),a}let bM=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),bN=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function bO({src:a,alt:b,caption:c,onClose:f}){let{t:g}=t(),[h,i]=(0,e.useState)(1),[j,k]=(0,e.useState)(0),[m,n]=(0,e.useState)(0),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(a,b=0,c=0)=>{let d=Math.min(8,Math.max(.25,h*a)),e=d/h;i(d),k(b-(b-j)*e),n(c-(c-m)*e)},s=()=>{i(1),k(0),n(0)};return(0,a5.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":b,onClick:f,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:c??b}),(0,d.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomOut"),onClick:()=>r(1/1.4),children:(0,d.jsx)(bM,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.resetZoom"),onClick:s,children:[Math.round(100*h),"%"]}),(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomIn"),onClick:()=>r(1.4),children:(0,d.jsx)(bN,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("common.close"),onClick:f,children:(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:a=>a.stopPropagation(),onWheel:a=>{let b=a.currentTarget.getBoundingClientRect(),c=a.clientX-b.left-b.width/2,d=a.clientY-b.top-b.height/2;r(a.deltaY<0?1.18:1/1.18,c,d)},onPointerDown:a=>{a.currentTarget.setPointerCapture(a.pointerId),q.current={x:a.clientX,y:a.clientY,tx:j,ty:m},p(!0)},onPointerMove:a=>{q.current&&(k(q.current.tx+(a.clientX-q.current.x)),n(q.current.ty+(a.clientY-q.current.y)))},onPointerUp:()=>{q.current=null,p(!1)},onPointerCancel:()=>{q.current=null,p(!1)},onDoubleClick:()=>1===h?r(2):s(),children:(0,d.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,d.jsx)("img",{src:a,alt:b,draggable:!1,className:`max-h-full max-w-full select-none ${o?"":"transition-transform duration-75"} ${h>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${j}px, ${m}px) scale(${h})`}})})})]}),document.body)}function bP({name:a,path:b}){let{t:c}=t(),[f,g]=(0,e.useState)("thumb"),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),p=`/api/inbox?name=${encodeURIComponent(a)}`,q=async()=>{m(!0),o("");try{let a=await fetch(p,{method:"DELETE"}),b=await a.json();if(!a.ok||!b.ok)return void o(b.error??c("common.failedDelete"));i("deleted")}catch{o(c("common.serverUnavailable"))}finally{m(!1),k(!1)}};return h?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-line bg-chip px-2.5 py-1 text-[11.5px] font-semibold text-dim",title:b,children:[(0,d.jsx)(a3,{name:"image",className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"truncate",children:a}),(0,d.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===h?c("inbox.deleted"):c("inbox.fileGone")]})]})}):"chip"===f?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("button",{type:"button",onClick:()=>g("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",title:b,children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"truncate font-mono text-[12px]",children:a}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:c("common.show")})]})}):(0,d.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,d.jsxs)("div",{className:"max-w-[75%]",children:[(0,d.jsx)("img",{src:p,alt:c("inbox.attachedAlt",{name:a}),onClick:()=>g("full"),onError:()=>i("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:b,children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>g("chip"),className:"shrink-0 text-dim hover:text-ink",children:c("common.collapse")}),j?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[(0,d.jsx)("span",{className:"px-1 font-semibold text-err",children:c("inbox.confirmDelete")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:l,onClick:q,children:l?c("trash.deleting"):c("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(!1),children:c("common.cancel")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>k(!0),"aria-label":c("inbox.deleteAria",{name:a}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-panel px-2 py-0.5 font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(aV,{className:"h-3 w-3","aria-hidden":!0})," ",c("inbox.deleteFromDisk")]}),n?(0,d.jsx)("span",{className:"shrink-0 font-semibold text-err",children:n}):null]})]}),"full"===f?(0,d.jsx)(bO,{src:p,alt:c("inbox.attachedAlt",{name:a}),caption:b,onClose:()=>g("thumb")}):null]})}let bQ=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function bR({href:a,label:b}){return(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function bS(a){return a.split(bQ).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:a.slice(1,-1)},b);if(a.startsWith("**")&&a.endsWith("**"))return(0,d.jsx)("b",{children:a.slice(2,-2)},b);let c=a.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(c){let a=c[2].replace(/\\([()])/g,"$1");return/^https?:\/\//.test(a)?(0,d.jsx)(bR,{href:a,label:c[1]},b):(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:c[1]},b)}if(/^https?:\/\//.test(a)){let c=a.replace(/[.,;:!?…»)]+$/,""),e=a.slice(c.length),f=c.length>72?c.slice(0,69)+"…":c;return(0,d.jsxs)("span",{children:[(0,d.jsx)(bR,{href:c,label:f}),e]},b)}return a})}let bT=/^\s*\|.*\|\s*$/,bU=/^:?-{1,}:?$/;function bV({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>bU.test(a)),e=c?b[0]:null,f=c?b.slice(2):b;return(0,d.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,d.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[e?(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.map((a,b)=>(0,d.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:bS(a)},b))})}):null,(0,d.jsx)("tbody",{children:f.map((a,b)=>(0,d.jsx)("tr",{children:a.map((a,b)=>(0,d.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:bS(a)},b))},b))})]})})}function bW(a){let b=a.split("\n"),c=[],f=0;for(;f<b.length;){if(/^\s*```/.test(b[f])){let a=f;for(f++;f<b.length&&!/^\s*```\s*$/.test(b[f]);)f++;let e=b.slice(a+1,f).join("\n");f<b.length&&f++,"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)("pre",{className:"my-1.5 max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:e},`c${a}`));continue}if(bT.test(b[f])){let a=f;for(;f<b.length&&bT.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(bV,{rows:b.slice(a,f)},`t${a}`));continue}let a=b[f],g=a.match(/^#{1,6}\s+(.*)$/),h=a.match(/^>\s?(.*)$/);g?c.push((0,d.jsx)("span",{className:"text-[14px] font-bold",children:bS(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:bS(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:bS(a)},f)),++f<b.length&&c.push("\n")}return c}function bX({bytes:a,text:b}){let[c,f]=(0,e.useState)(!1),g=Math.round(a/1024);return c?(0,d.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-[#fafafc] px-3.5 py-2.5 font-mono text-[11.5px]",children:b}),(0,d.jsx)("button",{type:"button",onClick:()=>f(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:by("common.collapse")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"blob",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:by("render.dataKb",{n:g})}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:by("common.show")})]})}let bY=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function bZ({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(aH,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(l,{className:c,"aria-hidden":!0}):(0,d.jsx)(a1,{className:`${c} animate-spin`,"aria-hidden":!0})}function b$({file:a,line:b}){let c=b?`${a}:${b}`:a,e="inline-block min-w-0 max-w-full truncate rounded-md bg-chip px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return bY.test(a)?(0,d.jsx)("a",{href:`#f=${encodeURIComponent(a)}`,className:`${e} text-accent underline decoration-dotted`,title:c,children:c}):(0,d.jsx)("code",{className:e,title:c,children:c})}function b_({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=X(a.t0),e=X(a.t1),f=c&&e&&c!==e?`${c}–${e}`:c||e;return(0,d.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${a.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:a.hasErr,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"cmd-group",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[by("render.commands",{count:a.calls.length}),b?" \xb7 "+b:""," \xb7",(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,d.jsx)(aH,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.okCount]}),a.errCount?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.errCount]}):null]}),f?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:f}):null]}),(0,d.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:a.calls.map((b,c)=>{let e="ok"===b.status?"text-ok":"err"===b.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:b.open,children:[(0,d.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(a3,{name:b.icon,className:"h-3 w-3"})}),(0,d.jsx)("code",{className:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-1.5 py-0.5 font-mono text-[11px]",children:b.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${e}`,children:[(0,d.jsx)(bZ,{status:b.status,className:"h-3 w-3"}),b.label]})]}),(0,d.jsx)("pre",{className:"max-h-[280px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3 py-2 font-mono text-[11.5px]",children:"$ "+b.cmd+(b.output?"\n"+b.output:"")})]},a.ids[c])})})]})}function b0({item:a}){let b=[a.trigger?by("auto"===a.trigger?"render.compactAuto":"render.compactManual"):"",a.preTokens?by("render.compactPre",{n:Math.round(a.preTokens/1e3)}):"",X(a.ts)||""].filter(Boolean).join(" \xb7 ");return(0,d.jsxs)("div",{className:"my-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#0d9488]/30 bg-[#e7f6f4] px-2.5 py-1 text-[11px] font-bold text-[#0b7c72]",children:[(0,d.jsx)(a3,{name:"compact",className:"h-3.5 w-3.5"}),by("render.compacted"),b?(0,d.jsx)("span",{className:"font-semibold opacity-75",children:b}):null]}),(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),a.summary?(0,d.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/cmp:hidden",children:[by("render.compactSummary")," \xb7 ",by("common.show")]}),(0,d.jsx)("span",{className:"hidden group-open/cmp:inline",children:by("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11px] text-[#555]",children:a.summary})]}):null]})}function b1({media:a,data:b,w:c,h:f,bytes:g}){let[h,i]=(0,e.useState)("thumb"),j=Math.round((g??3*b.length/4)/1024),k=c&&f?`${c}\xd7${f}`:by("render.image");if("chip"===h)return(0,d.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:k}),(0,d.jsxs)("span",{className:"text-dim",children:["\xb7 ",j," ",by("common.kb")]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:by("common.show")})]});let l=`data:${a};base64,${b}`;return(0,d.jsxs)("div",{className:"my-2 ml-9",children:[(0,d.jsx)("img",{src:l,alt:`${by("render.image")} ${k}`,onClick:()=>i("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"mt-1 block text-[12px] text-dim",children:by("common.collapse")}),"full"===h?(0,d.jsx)(bO,{src:l,alt:`${by("render.image")} ${k}`,caption:`${k} \xb7 ${j} ${by("common.kb")}`,onClose:()=>i("thumb")}):null]})}function b2({item:a}){let b=a.entries.slice(0,8),c=a.rolloutIds.slice(0,6);return(0,d.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"citation",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"text-[13px] font-semibold",children:by("render.memoryCitations",{count:a.entries.length})}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:by("common.show")}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:by("common.collapse")})]}),(0,d.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[b.length?(0,d.jsx)("div",{className:"space-y-1.5",children:b.map((a,b)=>(0,d.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)(b$,{file:a.target,line:a.line?Number(a.line.split("-",1)[0]):void 0}),a.note?(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:a.note}):null]},b))}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:by("render.noCitations")}),a.entries.length>b.length?(0,d.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:by("render.moreEntries",{count:a.entries.length-b.length})}):null,c.length?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),c.map(a=>(0,d.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:a,children:a.slice(0,8)},a)),a.rolloutIds.length>c.length?(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:["+",a.rolloutIds.length-c.length]}):null]}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",a.truncated?" \xb7 "+by("render.truncated"):""]}),(0,d.jsx)("pre",{className:"max-h-[260px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}let b3={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function b4(a){return"string"==typeof a&&a.length?a:void 0}function b5({approve:a}){return(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${a?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:a?by("render.approved"):by("render.rejected")})}function b6({payload:a}){let b=b4(a.from),c=b4(a.requestId),e=X(a.timestamp);return b||c||e?(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[b?(0,d.jsx)("span",{children:by("render.from",{from:b})}):null,c?(0,d.jsx)("span",{className:"truncate font-mono",title:c,children:c.length>40?c.slice(0,40)+"…":c}):null,e?(0,d.jsx)("span",{children:e}):null]}):null}function b7({payload:a}){let b=b4(a.type),c=b?b3[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:by("render.structured")}),(0,d.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:by("render.showJson")}),(0,d.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-chip px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(a,null,2)})]})]});let e="boolean"==typeof a.approve?a.approve:void 0,f=b4(a.reason)??b4(a.feedback);return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===c.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,d.jsx)(a3,{name:c.icon,className:"h-3.5 w-3.5"}),by(c.labelKey)]}),void 0!==e?(0,d.jsx)(b5,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:bW(f)}):null,(0,d.jsx)(b6,{payload:a})]})}function b8({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?aF:"APPROVE"===a?aK:aP,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function b9({item:a}){var b;let c=a.findings.length,e=a.findings.slice(0,12);return(0,d.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,d.jsx)(aL,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),a.verdict?(0,d.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(b=a.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===b?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,d.jsx)(b8,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:by("render.noFindings")}),X(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:X(a.ts)}):null]}),(0,d.jsxs)("div",{className:"px-3.5 py-2.5",children:[a.summary.length?(0,d.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:bW(a.summary.join("\n"))}):null,e.length?(0,d.jsx)("div",{className:"space-y-2",children:e.map((a,b)=>{var c;return(0,d.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(c=a.severity)||"High"===c||"P0"===c||"P1"===c?"border-err/30 bg-[#fff4f4] text-err":"Medium"===c||"P2"===c?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===c||"P3"===c?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:a.severity}),a.file?(0,d.jsx)(b$,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:bS(a.title)}),a.body&&a.body!==a.title?(0,d.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:bW(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:by("render.moreFindings",{count:a.findings.length-e.length})}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,d.jsx)("pre",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}function ca({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} ${by("common.kb")}`:by("common.chars",{n:b.length});return(0,d.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[11px] font-semibold text-dim hover:text-ink [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(a3,{name:"cmd-group",className:"h-3 w-3"})}),(0,d.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:a}),(0,d.jsxs)("span",{children:[by("render.system")," \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:by("common.show")}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:by("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11px] text-[#555]",children:b})]})}let cb=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(b1,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(bP,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(bX,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(ca,{label:a.label,text:a.text});if("compact"===a.kind)return(0,d.jsx)(b0,{item:a});if("review"===a.kind)return(0,d.jsx)(b9,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(b2,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?aL:aS;return(0,d.jsxs)("div",{className:"my-3.5 flex gap-2.5",children:[(0,d.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${b}`,children:(0,d.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[X(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:X(a.ts)}):null,bW(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsx)("div",{className:"my-3.5 flex justify-end",children:(0,d.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:b?(0,d.jsxs)("details",{className:"group/usr",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/usr:hidden",children:[a.text.slice(0,180),"… ",(0,d.jsxs)("span",{className:"font-semibold text-accent",children:["(",by("common.chars",{n:a.text.length}),")"]})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[by("common.collapse")," ",(0,d.jsx)(aJ,{className:"h-3 w-3","aria-hidden":!0})]})]}),bW(a.text)]}):bW(a.text)})})}if("cmd"===a.kind){let b="ok"===a.call.status?"text-ok":"err"===a.call.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:a.call.open,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:a.call.icon,className:"h-4 w-4"})}),(0,d.jsx)("code",{className:"max-w-[70%] overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-2 py-0.5 font-mono text-[12.5px]",children:a.call.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${b}`,children:[(0,d.jsx)(bZ,{status:a.call.status}),a.call.label]})]}),(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3.5 py-2.5 font-mono text-[12.5px]",children:"$ "+a.call.cmd+(a.call.output?"\n"+a.call.output:"\n"+by("render.noOutputInLog"))})]})}if("cmd-group"===a.kind)return(0,d.jsx)(b_,{item:a});if("edit"===a.kind)return(0,d.jsxs)("div",{className:"my-2.5 ml-9 flex items-center gap-3 rounded-[14px] border border-line bg-panel px-3.5 py-2.5 shadow-card",children:[(0,d.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(a3,{name:"note",className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold",children:a.files}),(0,d.jsx)("div",{className:"text-xs text-dim",children:by("render.filesChanged")})]})]});if("tmsg"===a.kind){let b=function(a){let b=a.trim();if((b.startsWith('"')&&b.endsWith('"')||b.startsWith("'")&&b.endsWith("'"))&&(b=b.slice(1,-1).trim()),!b.startsWith("{"))return null;try{let a=JSON.parse(b);if(null!==a&&"object"==typeof a&&!Array.isArray(a))return a}catch{}return null}(a.text),c=a.text.length>420||a.text.split("\n").length>6;return(0,d.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,d.jsx)(aO,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===a.dir?by("render.toDir"):by("render.fromDir")}),(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:a.peer}),a.delivery?(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===a.delivery?"text-ok":"text-err"}`,title:a.msgId?`msg_id: ${a.msgId}`:void 0,children:["ok"===a.delivery?(0,d.jsx)(aH,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?by("render.delivered"):by("render.notDelivered")]}):null,X(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:X(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(b7,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:bS(a.summary)}):null,c?(0,d.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/tmsg:hidden",children:[a.text.slice(0,260).trimEnd(),"… ",(0,d.jsx)("span",{className:"font-semibold text-accent",children:by("common.showAll")})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[by("common.collapse")," ",(0,d.jsx)(aJ,{className:"h-3 w-3","aria-hidden":!0})]})]}),bW(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:bW(a.text)})]})})]})}if("tnote"===a.kind)return(0,d.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)(aO,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.text]});if("think"===a.kind){let b=a.text.length>150;return(0,d.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,d.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${b?"cursor-pointer":""}`,title:by("render.reasoning"),children:[(0,d.jsx)(aG,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsxs)("span",{className:"truncate",children:[a.text.slice(0,150),b?"…":""]})]}),b?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:bW(a.text)}):null]})}return"svc"===a.kind?(0,d.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:a.text}):"note"===a.kind?(0,d.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:bS(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),cc=k("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),cd=k("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"}]]);function ce({file:a}){let{t:b}=t(),c=a.pendingQuestion,[f,g]=(0,e.useState)("pending"),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)({}),[m,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),s=c?null!==c.paneTarget:null!==a.pid&&"running"===a.proc,u=(0,e.useMemo)(()=>c?.questions?c.questions.map((a,b)=>(j[b]??[]).map(b=>a.options[b]?.label??String(b+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[j,c]);if(!c){if(!a.waitingInput)return null;let c=a.waitingInput.menu,e="delivering"===f,j=async(d,e)=>{g("delivering"),i("");try{let f=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:a.path,key:d,...c?{question:c.question}:{},.../^[1-9]$/.test(d)?{label:e}:{}})}),h=await f.json();if(!f.ok||!h.ok){g("failed"),i(h.error??b("common.failedSend"));return}g("answered"),i(e)}catch{g("failed"),i(b("common.serverUnavailable"))}};return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.sentToPane",{text:h})}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cc,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[b("question.pane",{target:a.waitingInput.target})," \xb7 ",function(a,b){let c=Math.max(0,Math.floor(Date.now()/1e3-b));if(c<60)return a("question.sec",{n:c});let d=Math.floor(c/60);return d<60?a("question.min",{n:d}):a("question.hour",{n:Math.floor(d/60)})}(b,a.waitingInput.since)]}),c?(0,d.jsxs)(d.Fragment,{children:[c.tabs.length?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:c.tabs.map((a,b)=>(0,d.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${a.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[a.done?"✓ ":"",a.label]},b))}):null,(0,d.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:c.question}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:c.options.map(a=>(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${a.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:e||a.value>9,onClick:()=>void j(String(a.value),a.label),children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:a.value}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:a.description}):null]})]},a.value))})]}):(0,d.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[12px] text-dim",children:a.waitingInput.screenTail}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(a=>(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-dim disabled:opacity-60",disabled:e,onClick:()=>void j(a,"Escape"===a?"Esc":a),children:"Escape"===a?"Esc":a},a)),(0,d.jsx)("span",{className:"text-[12px] text-dim",children:b("question.keysHint")})]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(a1,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:h}):null]})}let v=async(a,d)=>{g("delivering"),i("");try{let e=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:c.transcriptPath,toolUseId:c.toolUseId,kind:c.kind,...a})}),f=await e.json();if(!e.ok||!f.ok){if(409===e.status&&(f.superseded||f.answer)){g("superseded"),i(f.answer??f.error??b("question.alreadyAnswered"));return}g("failed"),i(f.error??b("common.failedSend"));return}g("answered"),i(f.answer??d)}catch{g("failed"),i(b("common.serverUnavailable"))}},w=(a=j)=>c.questions?.map((b,c)=>a[c]??[])??[],x=c.questions?.length??0,y=x>1||(c.questions?.some(a=>a.multiSelect)??!1),z=c.questions?.every((a,b)=>(j[b]??[]).length>0)??!1,A=async()=>{r(!0),i("");try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void i(d.error??b("question.openFailed"));i(b("question.opened",{target:d.target??"tmux"}))}catch{i(b("common.serverUnavailable"))}finally{r(!1)}},B="delivering"===f||!s;return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.answered",{text:h||u})}):"superseded"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:b("question.answeredElsewhere",{text:h})}):c&&!s?(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cc,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-err",children:b("question.noPane")}),"plan"===c.kind?(0,d.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}):c.questions?.map((a,b)=>(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("div",{className:"text-[12px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:a.question})]},b)),(0,d.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:q,onClick:A,children:b("question.openSession")}),h?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:h}):null]}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cc,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),s?null:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:b("question.noPane")})]}),"plan"===c.kind?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}),(0,d.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.rejectComment"),value:o,onChange:a=>p(a.target.value)}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-ok px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>v({approve:!0},b("question.approved")),children:[(0,d.jsx)(aH,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.approve")]}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-err px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>v({approve:!1,text:o},b("question.rejected")),children:[(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.reject")]})]})]}):(0,d.jsxs)(d.Fragment,{children:[c.questions?.map((a,b)=>(0,d.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,d.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:a.question}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.options.map((c,e)=>{let f=(j[b]??[]).includes(e);return(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${f?"border-accent/45 bg-accent/10":c.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:B,onClick:()=>{var d;let f={...j,[b]:[e]};d=a.multiSelect,k(a=>{let c=a[b]??[],f=d?c.includes(e)?c.filter(a=>a!==e):[...c,e]:[e];return{...a,[b]:f}}),a.multiSelect||1!==x||v({answers:w(f)},c.label)},children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:f?"✓":e+1}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:c.label}),c.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:c.description}):null]})]},e)})})]},b)),x<=1?(0,d.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,d.jsx)("input",{className:"min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.ownAnswer"),value:m,onChange:a=>n(a.target.value)}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!m.trim(),onClick:()=>v({text:m},m),children:[(0,d.jsx)(cd,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]})]}):null,y?(0,d.jsxs)("button",{className:"mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!z,onClick:()=>v({answers:w()},u),children:[(0,d.jsx)(cd,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]}):null]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(a1,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:h}):null]})}function cf({file:a}){let{t:b}=t();return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold text-ok",children:[(0,d.jsx)(aR,{className:"h-3 w-3","aria-hidden":!0})," PID ",a.pid]}):"killed"===a.proc||"stalled"===a.activity?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#f7e8e8] px-2 py-0.5 text-[11px] font-bold text-err",children:b("task.interruptedBadge")}):"done"===a.proc?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-chip px-2 py-0.5 text-[11px] font-bold text-dim",children:b("task.finishedBadge")}):null}function cg({file:a,compact:b=!1}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(!1),n=(0,d.jsx)(cf,{file:a}),o=async()=>{i(!0),k("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:l})}),d=await b.json();if(!b.ok||!d.ok){k(d.error??c("task.stopFailed")),m(!0);return}k(c("task.signalSent",{signal:l?"SIGKILL":"SIGTERM",pid:d.pid??""})),g(!1)}catch{k(c("common.serverUnavailable")),m(!0)}finally{i(!1)}};return(0,d.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${b?"text-[10.5px]":"text-xs"}`,children:[n,"running"===a.proc?f?(0,d.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[b?null:(0,d.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:c("task.confirmKill",{pid:a.pid??""})}),(0,d.jsx)("button",{className:"rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:o,children:l?"SIGKILL":b?c("task.killPid",{pid:a.pid??""}):c("task.confirmKillYes")}),(0,d.jsx)("button",{className:"rounded-lg border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:b?c("common.no"):c("common.cancel")})]}):(0,d.jsx)("button",{className:"rounded-full border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("task.stopAria",{pid:a.pid??""}),onClick:()=>g(!0),children:c("task.kill")}):null,j?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:j}):null]})}function ch({file:a,files:b,onSelect:c}){let{t:e}=t();if("codex-jobs"===a.root){let f=b.find(b=>"codex-sessions"===b.root&&b.parent===a.path);return(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(cf,{file:a})}),f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:e("task.jobLogHint")}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[10px] border border-line bg-bg px-3 py-1.5 text-[13px] font-semibold text-codex hover:bg-codex-soft",onClick:()=>c(f),children:[(0,d.jsx)(aL,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("task.openCodexSession",{size:(f.size/1024).toFixed(0),activity:"live"===f.activity?e("task.working"):"stalled"===f.activity?e("task.interrupted"):"recent"===f.activity?e("task.finished"):""})]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:e("task.rolloutMissing")})]})}return"claude-tasks"!==a.root?null:(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(cf,{file:a})}),a.cmd?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:a.cmdDesc||e("task.backgroundCommand")}),(0,d.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-line bg-[#fafafc] px-2.5 py-2 font-mono text-[12.5px]",children:["$ ",a.cmd]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:e("task.commandNotFound")})]})}let ci=new Map;function cj(a,b,c){ci.size>300&&!ci.has(a)&&ci.clear(),ci.set(a,{magnet:b,fromBottom:c})}function ck({icon:a,label:b}){return(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,d.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,d.jsx)(a,{className:"h-3.5 w-3.5","aria-hidden":!0}),b]})}function cl({file:a,files:b,onSelect:c,showSvc:f,lineFilter:g,onStatus:h,paused:i,follow:j,setFollow:k,compact:l=!1}){let{locale:m,t:n}=t(),[o,p]=(0,e.useState)(()=>a?ci.get(a.path)?.magnet??j:j),q=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(0),x=(0,e.useRef)(0),y=(0,e.useRef)(""),z=(0,e.useRef)(!0),A=(0,e.useRef)(0);(0,e.useRef)(!1);let B=(0,e.useRef)(!1);return{lines:d,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:(0,e.useCallback)(()=>{f([]),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),hasMore:q,loadingOlder:s,loadOlder:(0,e.useCallback)(async()=>{if(!a||B.current||x.current<=0)return 0;B.current=!0,t(!0);let b=A.current;try{let c="",d=x.current;for(let e=0;e<4;e+=1){let e=await fetch(`/api/log?path=${encodeURIComponent(a.path)}&before=${d}`),f=await e.json();if(b!==A.current||"error"in f&&f.error)return 0;if(c=f.data+c,d=f.start,0===d||c.slice(0,-1).includes("\n"))break}let e=d;if(d>0){let a,b=c.indexOf("\n");if(b<0||b===c.length-1)return 0;e=d+(a=c.slice(0,b+1),new TextEncoder().encode(a).length),c=c.slice(b+1)}let g=c.split("\n");""===g.at(-1)&&g.pop();let h=g.map(a=>a.trim()).filter(Boolean);return x.current=e,r(e>0),h.length&&(f(a=>h.concat(a)),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]),prependGen:u}}(a,i,o&&l?2500:0),r=(0,e.useRef)(null),s=(0,e.useRef)(null),u=(0,e.useRef)(null),v=l?500:1500,[w,x]=(0,e.useState)(l?300:1500),[y,A]=(0,e.useState)(0),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(null);(0,e.useRef)(!1);let F=(0,e.useRef)(o);(0,e.useRef)(0),(0,e.useRef)(0);let G=(0,e.useRef)(null),H=(0,e.useRef)(0);(0,e.useRef)(null);let I=(b,c=!1)=>{F.current=b,p(b),k(b),b&&A(0),a&&cj(a.path,b,ci.get(a.path)?.fromBottom??0),c&&(C(!0),G.current&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>C(!1),450))},J=()=>{let a=r.current;a&&(H.current=Date.now(),a.scrollTop=a.scrollHeight)},K=(0,e.useMemo)(()=>a?function(a,b,c,d){let e=new Map,f=new Map,g=[],h=0,i="",j=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(g.push({kind:"blob",bytes:a.length,text:bu(a).slice(0,2e5)}),!0),k=(a,b)=>{let c=bI(a.source),d=bH(c.data)||bH(b.base64);if(!d)return;let e=bH(c.media_type)||bH(b.type),f=e.startsWith("image/")?e:"image/png",h=bI(b.dimensions);g.push({kind:"image",media:f,data:d,w:bA(h.originalWidth),h:bA(h.originalHeight),bytes:bA(b.originalSize)})},l=(a,b,c)=>{bz.lastIndex=0;let d=bz.test(b);if(bz.lastIndex=0,!d){let c=bx(b.trim(),a);return!!c&&(g.push(c),!0)}let e=!1,f=0,h=b=>{let d=b.trim();if(!d)return;let f=bx(d,a);f?(g.push(f),e=!0):c(d)};for(let a of b.matchAll(bz)){let c=a[0],d=a.index??0;h(b.slice(f,d)),g.push(bK(c,a[1]??"",a[2]??"")),e=!0,f=d+c.length}return h(b.slice(f)),e},m=a=>{let b=[];return bz.lastIndex=0,{cleaned:a.replace(bz,(a,c,d)=>(b.push(bK(a,c,d)),"")).trim(),cites:b}},n=(b,c)=>{if(!c.trim()||c===i||(i=c,j(c)))return;let d="codex"===a.engine?"codex":"claude";l(b,c,a=>g.push({kind:"prose",ts:b,text:a,engine:d}))||g.push({kind:"prose",ts:b,text:c,engine:d})},o=(a,b,c,d)=>{let f=c||"plain-"+g.length+"-"+String(a??""),h=function(a,b="shell"){let c=bu(a);return{cmd:c,display:function(a){let b,c=a.match(/^([A-Za-z][\w.]*): /),d=c?c[0]:"",e=d?a.slice(d.length):a;do b=e,e=(e=(e=(e=e.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(a,b,c)=>RegExp(`(?<!\\\\)${b}`).test(c)?a:c);while(e!==b);let f=e.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return f&&(e=`${f[1].trim()} \xabheredoc\xbb`),(d+(e=e.replace(/\s+/g," ").trim())).slice(0,160)}(c),icon:b,output:"",status:"run",label:by("render.executing"),open:!1}}(b,d);return e.set(f,h),g.push({kind:"cmd",id:f,call:h,ts:a}),h},p=(a,b,d)=>{if(!a)return;let h=f.get(a);if(h){h.delivery=d||/"success"\s*:\s*false/.test(b)?"err":"ok",h.msgId=b.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];return}!bL(e.get(a),b,d)&&b&&c&&g.push({kind:"svc",text:"output: "+bu(b).slice(0,200)})},q=a=>{c?g.push({kind:"svc",text:a.slice(0,300)}):h+=1},r=a=>{g.push({kind:"note",text:a})},s=(a,b)=>{let c=b.replace(bB,(b,c,d,e)=>{let f=bG(d,"teammate_id")||bG(d,"from")||by("render.teammate"),h=bG(d,"summary"),i=e.trim();if(i.startsWith("{"))try{let a=JSON.parse(i);if("idle_notification"===a.type){let b=X(a.timestamp);return g.push({kind:"tnote",text:by("render.left",{peer:f,at:b?" \xb7 "+b:""})}),""}}catch{}let{cleaned:j,cites:k}=m(i),l=bo.test(j)?bx(j,a):null;for(let b of(g.push({kind:"tmsg",ts:a,dir:"in",peer:f,summary:h,text:l?"":j}),l&&g.push(l),k))g.push(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||j(c))return;if(bE.test(c))return void g.push({kind:"sysmsg",label:bF(c),text:c});let{cleaned:d,images:e}=bD(c);for(let b of(d&&!l(a,d,b=>g.push({kind:"user",ts:a,text:b}))&&g.push({kind:"user",ts:a,text:d}),e))g.push({kind:"inbox-image",name:b.name,path:b.path})},t=null,u=(a,b)=>{if(t&&t.text===b&&t.at===g.length)return;let{cleaned:c,images:d}=bD(b);for(let b of(c&&g.push({kind:"user",ts:a,text:c}),d))g.push({kind:"inbox-image",name:b.name,path:b.path});t={text:b,at:g.length}},v=(a,b)=>{t&&t.text===a&&t.at===g.length||(g.push({kind:"sysmsg",label:bF(a,b),text:a}),t={text:a,at:g.length})},w=!1,x=(a,b)=>{g.push({kind:"compact",ts:a,trigger:b?.trigger,preTokens:b?.preTokens})},y=a=>{let b=bI(a.payload),c=a.timestamp;if("session_meta"===a.type)return r(`${by("render.codexSessionCreated")} \xb7 ${bH(b.model)} \xb7 ${bH(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return n(c,bH(b.message));if("user_message"===b.type&&b.message){let a=bH(b.message);return bE.test(a)?v(a):u(c,a)}return"task_started"===b.type?r(by("render.taskStarted")+(c?" \xb7 "+X(c):"")):"task_complete"===b.type?r(by("render.taskComplete")+(c?" \xb7 "+X(c):"")):"context_compacted"===b.type?w?void(w=!1):x(c):q(bH(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=bJ(b.content).map(a=>bH(a.text)||bH(a.input_text)).join(" ").trim();return a?"assistant"===b.role?n(c,a):"user"!==b.role||bE.test(a)?v(a,bH(b.role)):u(c,a):q("message "+bH(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(bH(b.arguments)||"{}")}catch{a={}}let d=bH(b.name);if("exec_command"===d||"shell"===d)return o(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),bH(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):by("render.patch")});return}return"write_stdin"===d?q(by("render.stdinSession",{id:String(a.session_id??"")})):o(c,d+" "+JSON.stringify(a).slice(0,120),bH(b.call_id),"tool")}if("function_call_output"===b.type)return p(bH(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===bH(b.name)){let a=bH(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):by("render.patch")});return}return"custom_tool_call_output"===b.type?p(bH(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?q("reasoning"):q(bH(b.type)||"item")}if("compacted"===a.type)return w=!0,x(c);q(bH(a.type)||by("render.record"))},z=a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=bI(a.message).content,d=bI(bI(a.toolUseResult).file);if(!0===a.isCompactSummary){let a="string"==typeof c?c:bJ(c).filter(a=>"text"===a.type).map(a=>bH(a.text)).join(" ");a.trim()&&((a,b)=>{for(let a=g.length-1;a>=0;a-=1){let c=g[a];if("compact"===c.kind){c.summary=b;return}if("svc"!==c.kind&&"note"!==c.kind)break}g.push({kind:"compact",ts:a,summary:b})})(b,a.trim());return}if("string"==typeof c)s(b,c);else for(let a of bJ(c))if("text"===a.type)s(b,bH(a.text));else if("image"===a.type)k(a,d);else if("tool_result"===a.type){let b=bJ(a.content);for(let a of b)"image"===a.type&&k(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>bH(a.text)).join(" ");p(bH(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of bJ(bI(a.message).content))if("text"===c.type&&bH(c.text).trim())n(b,bH(c.text));else if("thinking"===c.type&&bH(c.thinking).trim())g.push({kind:"think",text:bH(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===bH(c.name)){let a=bI(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:h}=m(d),i=bo.test(e)?bx(e,b):null,j={kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e};for(let a of(g.push(j),i&&g.push(i),h))g.push(a);bH(c.id)&&f.set(bH(c.id),j)}else q(`SendMessage → ${String(a.to??"")} \xb7 ${bH(bI(d).type)||by("render.protocol")}`)}else if("tool_use"===c.type){let a=bI(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));o(b,bH(c.name)+": "+d.slice(0,160),bH(c.id),"tool")}return}if("system"===a.type&&"compact_boundary"===a.subtype){let c=bI(a.compactMetadata);return x(b,{trigger:bH(c.trigger)||void 0,preTokens:bA(c.preTokens)})}q(bH(a.type)||by("render.record"))},A=null,B=()=>{if(!A)return;let a=A.join("\n").trim();if(A=null,!a)return;let b=a=>{for(let b of a.split("\n"))b.trim()&&g.push({kind:"raw",text:bu(b),err:/error|failed|traceback|exception/i.test(b)})};l(null,a,b)||b(a)},C=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(A)if(!/^\[codex\]/.test(b))return void A.push(b);else B();if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,f=c?.[2]??b;if(!(!f||/^Assistant message captured/.test(f))){if(!c&&(bo.test(b)||b.startsWith("<oai-mem-citation>"))){A=[b];return}if(/^Running command: /.test(f))return o(d,f.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(f)){let a=[...e.values()].at(-1);a&&bL(a,/^Command failed/.test(f)?f+"\n"+by("render.jobLogNote"):f,/^Command failed/.test(f));return}return/^Applying \d+ file/.test(f)?g.push({kind:"edit",files:f}):c&&!/^(Running|Command|Applying)/.test(f)?n(d,f):void(!j(b)&&g.push({kind:"raw",text:bu(b),err:/error|failed|traceback|exception/i.test(b)}))}};for(let c of b)if(!d||c.toLowerCase().includes(d))if("claude"===a.fmt||"codex"===a.fmt)try{let b=JSON.parse(c);b&&"object"==typeof b&&!Array.isArray(b)&&("claude"===a.fmt?z(b):y(b))}catch{C(c)}else C(c);return B(),{items:function(a,b){let c=[],d=0;for(;d<a.length;){if("cmd"!==a[d].kind){c.push(a[d]),d+=1;continue}let f=d,g=[];for(;f<a.length;){let b=a[f];if("cmd"===b.kind)g.push(b);else if("think"!==b.kind)break;f+=1}let h=f===a.length;if(g.length>=4&&!(b&&h)){let a={},b=0,h=0;for(let c of g){var e;let d=(e=c.call.cmd,e.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");a[d]=(a[d]??0)+1,"ok"===c.call.status?b+=1:"err"===c.call.status&&(h+=1)}c.push({kind:"cmd-group",ids:g.map(a=>a.id),calls:g.map(a=>a.call),t0:g[0]?.ts,t1:g.at(-1)?.ts,byTool:a,okCount:b,errCount:h,hasErr:h>0}),d=f}else c.push(a[d]),d+=1}return c}(g,"live"===a.activity),hiddenServiceCount:h}}(a,q.lines,f,g.toLowerCase()):{items:[],hiddenServiceCount:0},[a?.path,a?.engine,a?.fmt,a?.activity,q.lines,f,g,m]),L=Math.max(0,K.items.length-w),M=L?K.items.slice(-w):K.items,N=()=>{let a=r.current;a&&(u.current={top:a.scrollTop,height:a.scrollHeight}),L?x(a=>a+v):q.hasMore&&q.loadOlder().then(()=>x(a=>a+v))},O=L>0||q.hasMore,P=K.items.at(-1),Q=P?.kind==="cmd"&&"run"===P.call.status?{icon:aW,label:n("feed.running",{tool:P.call.cmd.split(/[\s:]/,1)[0]||n("feed.tool")})}:P?.kind==="think"?{icon:aS,label:n("feed.thinking")}:{icon:aS,label:n("feed.working")},R=l?"left-1/2 -translate-x-1/2":"right-3";return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a&&K.items.length?o?"live"===a.activity?(0,d.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 rounded-full bg-ok px-2 py-0.5 text-[10px] font-bold text-white shadow-card transition-transform duration-200 ${B?"scale-125":"scale-100"}`,children:[(0,d.jsx)(bn,{className:"h-3 w-3","aria-hidden":!0})," ",n("feed.liveTail")]}):null:(0,d.jsxs)("button",{className:`absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 py-1 text-[11px] font-semibold text-ink shadow-card hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n("feed.backToLive"),onClick:()=>{J(),I(!0,!0)},children:[(0,d.jsx)(aC,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",y?n("feed.newCount",{count:y}):n("feed.down")]}):null,(0,d.jsx)("div",{ref:r,className:l?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:b=>{let c=b.currentTarget,d=c.scrollTop+c.clientHeight>=c.scrollHeight-50,e=Date.now()-H.current<300;d&&!F.current?I(!0,!0):!d&&F.current&&(e?J():I(!1)),a&&!e&&cj(a.path,F.current,Math.max(0,c.scrollHeight-c.clientHeight-c.scrollTop)),c.scrollTop<120&&O&&!q.loadingOlder&&!q.loading&&N()},children:(0,d.jsx)("div",{ref:s,className:l?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:a?(0,d.jsxs)(d.Fragment,{children:[l&&O?(0,d.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-[8px] border border-dashed border-line bg-bg px-2 py-1 text-[11px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aJ,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.showEarlier")]})}):null,!l&&O&&K.items.length?(0,d.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-[10px] border border-dashed border-line bg-panel px-3 py-1.5 text-[12px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):L?n("feed.showEarlierHidden",{count:L}):n("feed.loadEarlier")}):null,l||O||!K.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:n("feed.startOfConvo")}),l?null:(0,d.jsx)(ch,{file:a,files:b,onSelect:c}),K.items.length?(0,d.jsxs)(d.Fragment,{children:[M.map((a,b)=>{let c=b+K.items.length-M.length;return l?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(cb,{item:a})},c):(0,d.jsx)(cb,{item:a},c)}),a.pendingQuestion||a.waitingInput?(0,d.jsx)(ce,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null,a.pendingQuestion||a.waitingInput||!D?null:(0,d.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:D}),"live"===a.activity?(0,d.jsx)(ck,{icon:Q.icon,label:Q.label}):null,"recent"===a.activity&&al(a)?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",n("feed.finishedTurn")]}):"recent"===a.activity&&z(a)&&"running"!==a.proc?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,d.jsx)(az,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.returnedResult")]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[q.loading?n("common.loadingCap"):0===q.size?n("feed.noOutput"):K.hiddenServiceCount?n("feed.onlyService",{count:K.hiddenServiceCount}):n("feed.empty"),!q.loading&&(a.cmdDesc||a.cmd)?(0,d.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[a.cmdDesc?(0,d.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:a.cmdDesc}):null,a.cmd?(0,d.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11.5px] text-ink",children:a.cmd}):null]}):null]}),K.items.length?null:a.pendingQuestion||a.waitingInput?(0,d.jsx)(ce,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:n("feed.pickLog")})})})]})}let cm=()=>"uk"===p()?"uk-UA":"en-US",cn={completed:"✓",in_progress:"▸",pending:"○"};function co({plan:a}){let b,{t:c}=t(),e=a.total?Math.round(a.done/a.total*100):0;return(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-[#f1f0fc] px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(b=a.steps.map(a=>`${cn[a.status]} ${a.text}`),[s(p(),"plan.agentPlan"),...b].join("\n")),"aria-label":c("plan.stepsAria",{done:a.done,total:a.total})+(a.current?c("plan.nowSuffix",{current:a.current}):""),children:[a.done,"/",a.total,(0,d.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,d.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${e}%`}})})]})}let cp={active:{labelKey:"plan.goal",className:"bg-[#f1f0fc] text-accent"},complete:{labelKey:"plan.goalDone",className:"bg-[#e7f4ea] text-ok"},blocked:{labelKey:"plan.goalBlocked",className:"bg-[#fbeaea] text-err"}};function cq({ctx:a}){var b;let{t:c}=t();return(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(b=a.pct)>=90?"bg-[#fbeaea] text-err":b>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:c("plan.ctxTitle",{pct:a.pct,used:a.usedTokens.toLocaleString(cm()),window:a.windowTokens.toLocaleString(cm())}),"aria-label":c("plan.ctxAria",{pct:a.pct}),children:["ctx ",a.pct,"%"]})}function cr({goal:a}){let b,c,{t:e}=t(),f=cp[a.status];return(0,d.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${f.className}`,title:(b=p(),c=[a.objective??s(b,"plan.noObjective")],null!==a.tokensUsed&&c.push(s(b,"plan.tokens",{n:a.tokensUsed.toLocaleString(cm())})),null!==a.timeUsedSeconds&&c.push(s(b,"plan.time",{n:Math.round(a.timeUsedSeconds/60)})),c.join("\n")),"aria-label":e("plan.goalAria",{status:e(f.labelKey)})+(a.objective?` — ${a.objective.slice(0,120)}`:""),children:e(f.labelKey)})}let cs=()=>void 0,ct={live:{section:"border-ok/60 shadow-[0_0_0_3px_rgba(47,158,68,0.16)]",header:"bg-[#eef8f0]"},waiting:{section:"border-[#e0ae45]/60 shadow-[0_0_0_3px_rgba(224,174,69,0.2)]",header:"bg-[#fff7e6]",glow:"#e0ae45"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_rgba(90,81,224,0.15)]",header:"bg-[#f1f0fc]",glow:"#7a6ff0"},stalled:{section:"border-err/50 shadow-[0_0_0_3px_rgba(198,40,40,0.13)]",header:"bg-[#fdf0f0]",glow:"#d76a6a"},done:{section:"border-line",header:"bg-[#f4f4f6] text-dim opacity-80 saturate-50"}};function cu(a,b){return"сесія"===b?a("kind.session"):"субагент"===b?a("kind.subagent"):"джоба"===b?a("kind.job"):"фон"===b?a("kind.background"):b}function cv({file:a}){let{t:b}=t(),[c,f]=(0,e.useState)(()=>Date.now()),g=c/1e3-a.mtime,h=("live"===a.activity||"recent"===a.activity)&&g>180;return(0,d.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${h?"font-semibold text-[#b3831d]":"text-dim"}`,title:b(h?"branch.lastActivityQuiet":"branch.lastActivity",{age:W(a.mtime)}),children:W(a.mtime)})}function cw({file:a,files:b,tasks:c,onSelect:f,isRoot:g,onClose:h,dragHandle:i,noComposer:j,banner:k}){let{t:m}=t(),n=(0,e.useRef)(null),o=ai(a),p=ap(a),q=ct[p];return(0,d.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${q.glow?"pane-attention":""}`,style:q.glow?{"--pane-glow":q.glow}:void 0,children:(0,d.jsxs)("section",{ref:n,"data-pan-ignore":!0,"data-link-path":a.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${g?"border-t-4":"border-t-2"} ${q.section}`,style:"done"===p?{borderTopColor:"#c9c9d1"}:ah(a),children:[(0,d.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${q.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${Y(a.activity)}`,title:m(`branch.${p}`)}),(0,d.jsx)(cv,{file:a}),a.model?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:ae(a).soft,color:ae(a).color},title:[o.label,af(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:o.style,children:o.label}),a.ctx?(0,d.jsx)(cq,{ctx:a.ctx}):null,a.worktree?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-line/80 px-1.5 py-0.5 font-mono text-[9.5px] text-dim",title:m("branch.worktree",{name:a.worktree}),children:[(0,d.jsx)(ay,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(co,{plan:a.plan}):null,a.goal?(0,d.jsx)(cr,{goal:a.goal}):null,g?null:(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:m(a.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,d.jsx)(az,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?m("kind.handoff"):cu(m,a.kind)]}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:u(a.title),children:u(a.title,90)}),(0,d.jsx)(cg,{file:a,compact:!0}),(0,d.jsx)(bl,{file:a,onDeleted:h}),h?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":m("branch.removeColumn",{title:u(a.title,60)}),onClick:h,children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})}):null]}),k??null,c.length?(0,d.jsx)(bm,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:c.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(cx,{file:a,files:b,onSelect:f})},a.path))}):null,(0,d.jsx)(cl,{file:a,files:b,onSelect:f,showSvc:!1,lineFilter:"",onStatus:cs,paused:!1,follow:!0,setFollow:cs,compact:!0}),j?null:(0,d.jsx)(bf,{file:a})]})})}function cx({file:a,files:b,onSelect:c}){let{t:f}=t(),[g,h]=(0,e.useState)(!1),i=u(a.cmdDesc||a.title,80);return(0,d.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,d.jsxs)("div",{className:"flex h-7 items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":g,"aria-label":f("branch.toggleBackground",{action:f(g?"branch.collapse":"branch.expand"),title:i}),onClick:()=>h(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${g?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:u(a.title),children:i})]}),(0,d.jsx)(cg,{file:a,compact:!0})]}),g?(0,d.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,d.jsx)(cl,{file:a,files:b,onSelect:c,showSvc:!1,lineFilter:"",onStatus:cs,paused:!1,follow:!0,setFollow:cs,compact:!0})}):null]})}let cy=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],cz=(a,b)=>`llvDraftPane:${a}:${b}`;function cA(a,b,c){c?sessionStorage.setItem(cz(a,b),c):sessionStorage.removeItem(cz(a,b))}function cB({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let{t:h}=t(),[i]=(0,e.useState)(()=>""),j=i?c.find(a=>a.path===i)??null:null,[k,m]=(0,e.useState)(()=>j?.engine==="codex"?"codex":"claude"),[n,o]=(0,e.useState)(()=>""),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(()=>(function(){try{let a=JSON.parse("null");return a&&"number"==typeof a.at&&"string"==typeof a.prompt?a:null}catch{return null}})()),[v,w]=(0,e.useState)(!1),x=(0,e.useRef)(null),y=bb({initialText:()=>i?h("draft.readPrompt",{src:i}):"",persistText:b=>cA(a,"text",b),submit:a=>G(a),disabled:!!r}),{text:z,setText:A,setStatus:B,busy:C,setBusy:D,voiceSending:E,attachments:F}=y,G=async b=>{let d=b??z;if(!C&&!E&&!r){if(!n.trim())return void B({kind:"err",text:h("draft.needDir")});if(d.trim()||F.images.length){D(!0),B(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:k,cwd:n.trim(),prompt:d,images:F.images.map(a=>({base64:a.base64,mime:a.mime})),...i?{src:i}:{}})}),f=await b.json();if(!b.ok||!f.ok)return void B({kind:"err",text:f.error??h("draft.launchFailed")});x.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},s(e),cA(a,"boot",e?JSON.stringify(e):""),A(""),F.clear()}catch{B({kind:"err",text:h("common.serverUnavailable")})}finally{D(!1)}}}},H=Z[k]??$,I=y.fieldsDisabled,J="draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-t-4 border-line bg-panel shadow-card",style:{borderTopColor:H.color},"aria-label":h("draft.paneAria"),children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:H.soft},children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:h("draft.notStarted")}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":h("draft.engineAria"),children:cy.map(({key:b,label:c})=>{let e=k===b,f=Z[b]??$;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:I,onClick:()=>{m(b),cA(a,"engine",b)},style:e?{backgroundColor:"#fff",color:f.color,borderColor:f.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${e?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:c},b)})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:j?u(j.title):void 0,children:i?h("draft.handoffLabel",{title:j?u(j.title,60):h("draft.conversation")}):h("draft.newConvo")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("draft.dismiss"),onClick:f,children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.directory")}),(0,d.jsx)("input",{value:n,disabled:I,onChange:b=>{var c;o(c=b.target.value),cA(a,"cwd",c)},list:J,placeholder:"/home/…/Projects/…","aria-label":h("draft.dirAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:J,children:p.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:r?(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2.5 py-1.5 text-[12px] text-[#333]",children:r.prompt||h("draft.imagesOnly")})}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(a1,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{children:h("draft.launched",{target:r.target})})]}),v?(0,d.jsx)("div",{className:"text-[11px] text-dim",children:h("draft.slow",{target:r.target})}):null]}):(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,d.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:H.soft,color:H.color},children:"claude"===k?"Claude":"Codex"}),(0,d.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:i?h("draft.hintRelay"):h("draft.hintNew")}),i?(0,d.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:i,children:i}):null]})}),(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),G()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":h("draft.promptAria"),children:(0,d.jsx)(bd,{composer:y,placeholder:h("draft.placeholder"),textareaAriaLabel:h("draft.promptTextAria"),imageAriaLabel:h("draft.addImages"),sendLabelIdle:h("composer.launchAgent"),sendLabelRecording:h("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:H.color,borderColor:H.color},leftSlot:(0,d.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:h("draft.newWindowTitle"),children:[(0,d.jsx)(aR,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",h("draft.newAgent")]})})})]})}let cC=k("diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]),cD=k("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),cE=k("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);function cF({verdict:a,error:b,className:c="h-3 w-3"}){return"APPROVE"===a?(0,d.jsx)(aH,{className:c,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===a?(0,d.jsx)(l,{className:c,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===a?(0,d.jsx)(cC,{className:c,strokeWidth:2.5,"aria-hidden":!0}):b?(0,d.jsx)(cD,{className:c,"aria-hidden":!0}):(0,d.jsx)(cE,{className:c,"aria-hidden":!0})}function cG(a,b){return b.error?a("roundDeck.roundAborted",{n:b.n}):b.verdict?a("roundDeck.roundVerdict",{n:b.n,verdict:`${T[b.verdict]} ${b.verdict}`}):a("roundDeck.roundInProgress",{n:b.n})}function cH({round:a,depth:b,pulse:c,onPull:e}){let{t:f}=t(),g=U(a.verdict);return(0,d.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-panel px-2.5 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*b)-10,zIndex:10-b,transform:`scale(${1-.035*b}) translateZ(${-(34*b)}px)`},title:a.error?`${cG(f,a)}: ${a.error}`:cG(f,a),onClick:e,children:[(0,d.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:g.soft,color:g.color},children:["R",a.n," ",(0,d.jsx)(cF,{verdict:a.verdict,error:!!a.error,className:"h-2.5 w-2.5"})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[a.error?f("roundDeck.aborted"):a.verdict?a.verdict:f("roundDeck.reviewInProgress"),null!=a.findingsCount&&a.findingsCount>0?` \xb7 ${f("roundDeck.findings",{count:a.findingsCount})}`:""]}),c?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function cI({flow:a,rounds:b,files:c,onSelect:f,focusRound:g}){let{t:h}=t(),i=b.length?b[b.length-1]:null,[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null);null!=g&&g!==l&&(m(g),k(Math.round(g)));let[n,o]=(0,e.useState)(null);i&&i.round.n!==n&&(o(i.round.n),null!=j&&i.round.n>j&&null===i.round.verdict&&k(null));let p=(0,e.useMemo)(()=>b.find(a=>a.round.n===j)??i,[b,j,i]);if(!p)return(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:h("roundDeck.waitingFirst")})});let q=b.filter(a=>a.round.n!==p.round.n).reverse(),r=q.slice(0,5),s=q.length-r.length,u=U(p.round.verdict),v=null!==p.round.verdict||!!p.round.error,w=i&&p.round.n!==i.round.n&&null===i.round.verdict&&!i.round.error?i:null;return(0,d.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(q.length,5+ +!!s)},children:[(0,d.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:p.file?(0,d.jsx)(cw,{file:p.file,files:c,tasks:[],onSelect:f,isRoot:!1,noComposer:"headless"===a.reviewerMode||v,banner:(0,d.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-line px-2.5 text-[10.5px] font-bold",style:{backgroundColor:u.soft,color:u.color},children:[cG(h,p.round),null!=p.round.findingsCount&&p.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",h("roundDeck.findings",{count:p.round.findingsCount})]}):null,p.round.readyNote?(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:p.round.readyNote,children:["\xb7 ",p.round.readyNote]}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:cG(h,p.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:p.round.error?p.round.error:h("roundDeck.spawningReviewer")})]})},p.round.n),r.map((a,b)=>(0,d.jsx)(cH,{round:a.round,depth:b,pulse:w?.round.n===a.round.n,onPull:()=>k(a.round.n)},a.round.n)),s>0?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-line bg-panel/70 text-[10px] font-semibold text-dim shadow-card",style:{height:26,bottom:-(30*r.length)-8,zIndex:10-r.length},"aria-hidden":!0,children:h("roundDeck.moreRounds",{count:s})}):null]})}let cJ=k("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);function cK(a){return("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")}function cL({file:a,onHandoff:b}){let{t:c}=t(),f=function(a){let{t:b}=t(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=(0,e.useRef)(null),l=(0,e.useRef)(!1),m=(0,e.useRef)(!1),n=(0,e.useRef)(null),o="link-arrow-"+(0,e.useId)().replace(/[^a-zA-Z0-9-]/g,"");return{onPillPointerDown:c=>{if("mouse"===c.pointerType&&0!==c.button||k.current)return;let d=c.currentTarget.getBoundingClientRect(),e=b=>{let c=k.current;if(!c)return;if(c.lastX=b.clientX,c.lastY=b.clientY,!c.active){if(7>Math.hypot(b.clientX-c.startX,b.clientY-c.startY))return;c.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",bi(),j(null),h({x:c.anchorX,y:c.anchorY}),f(!0)}n.current?.setAttribute("d",bj(c.anchorX,c.anchorY,b.clientX,b.clientY));let d=function(a,b,c){let d=document.elementFromPoint(a,b)?.closest("[data-link-path]"),e=d?.getAttribute("data-link-path");if(!d||!e||e===c)return null;let f=bh.get(e);return f&&f.el===d?f:null}(b.clientX,b.clientY,a.path);d?.el!==c.hover?.el&&(c.hover?.el.removeAttribute("data-link-hover"),d?.el.setAttribute("data-link-hover","1"),c.hover=d)},g=c=>{var d,e;let g,h,i=k.current;k.current=null,i?.detach(),l.current=!1,document.body.style.cursor="",i?.active&&(f(!1),i.hover?(d=i.hover.file.path,e=b("link.handoffContext",{title:u(a.title,80),path:a.path,ask:""}).trimEnd()+"\n\n",g="llvDraft:"+d,h=sessionStorage.getItem(g)??"",sessionStorage.setItem(g,h.trim()?h.replace(/\s*$/,"")+"\n\n"+e:e),window.dispatchEvent(new CustomEvent("llv-compose-draft",{detail:{path:d}})),j({file:i.hover.file,from:{x:i.anchorX,y:i.anchorY},to:{x:c.clientX,y:c.clientY}})):bi())};k.current={startX:c.clientX,startY:c.clientY,anchorX:d.right,anchorY:d.top+d.height/2,lastX:c.clientX,lastY:c.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g)}},window.addEventListener("pointermove",e),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:c||i?(0,a5.createPortal)((0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,d.jsxs)("svg",{className:"block h-full w-full",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:o,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:bg})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",bj(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?bj(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:bg,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${o})`}),(0,d.jsx)("circle",{cx:i?i.from.x:g?.x??0,cy:i?i.from.y:g?.y??0,r:4,fill:bg})]}),i?(0,d.jsx)(bk,{drop:i}):null]}),document.body):null}}(a);return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,d.jsxs)("button",{type:"button","aria-label":c("handoff.aria"),title:c("handoff.title"),onPointerDown:f.onPillPointerDown,onClick:()=>{f.consumeClick()||b()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-line bg-panel px-2 text-dim shadow-card transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(cJ,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:c("handoff.label")}),(0,d.jsx)(aC,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),f.overlay]})}function cM(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=E(c),h=[],i=[],j=[],k=[],l=[],m=N(d),n=O(d),o=100,p=[],q=new Map;for(let a of e){let b="";if(!b)continue;let c=q.get(b);c?c.push(a):q.set(b,[a])}let r=new Set,s=a=>({file:a,branches:g.get(a.path)?.length??0}),t=(a,b,c,d,e)=>{let g=(a,o,t,u)=>{let v=0===u?780:680;h.push({file:a.file,tasks:a.tasks,under:d.get(a.file.path)??[],x:o,y:t,w:600,h:v,isRoot:a.file.path===e});let w=m.get(a.file.path),x=v;if(w){var y;let a,b,c=(y=o+600+170,a=w.rounds.map(a=>({round:a,file:a.reviewerPath?f.get(a.reviewerPath)??null:null})),b={key:"deck::"+w.id,flow:w,rounds:a,x:y,y:t,w:600,h:v+30*Math.min(Math.max(w.rounds.length-1,0),6)},k.push(b),b);l.push({key:"loop::"+w.id,flow:w,x1:o+600,x2:c.x,y:t}),x=Math.max(x,c.h)}let z=t+x+130,A=b.get(a.file.path)??[],B=o+64;for(let a of A)i.push({to:a.file.path,x1:o+40,y1:t+v,x2:B+300,y2:z,color:ag(a.file),live:"live"===a.file.activity}),B+=g(a,B,z,u+1)+48;let C=c.get(a.file.path)?.filter(a=>!n.has(a.path));for(let b of(C?.length&&(j.push({key:a.file.path+"::stack",parent:a.file.path,items:C.map(s),x:B,y:z,w:360,h:16+58*Math.min(C.length,8)-6}),i.push({to:a.file.path+"::stack",x1:o+40,y1:t+v,x2:B+180,y2:z,color:"#9a9aa4",live:!1,dashed:!0}),B+=408),q.get(a.file.path)??[]))r.add(b),p.push({key:"draft::"+b,id:b,src:a.file.path,x:B,y:z,w:600,h:680}),i.push({to:"draft::"+b,x1:o+40,y1:t+v,x2:B+300,y2:z,color:"#5a51e0",live:!1,dashed:!0}),B+=648;let D=B-48-(o+64);return Math.max(D>0?Math.max(600,64+D):600,w?1370:600)};return g(a,o,100,0)};for(let b of a){let a=b.columns;if(!a.length)continue;let c=a[0].file.path,d=new Set(a.map(a=>a.file.path)),e=a=>{let b=a.parent,e=new Set([a.path]);for(;b&&!e.has(b)&&!d.has(b);)e.add(b),b=f.get(b)?.parent??null;return b&&d.has(b)&&b!==a.path?b:c},g=new Map;for(let b of a){if(b.file.path===c)continue;let a=e(b.file),d=g.get(a);d?d.push(b):g.set(a,[b])}let h=new Map,i=[];for(let a of[...b.returnable,...b.finished])if(!n.has(a.path))if(A(a)){let b=e(a),c=h.get(b);c?c.push(a):h.set(b,[a])}else i.push(a);let j=new Map([[c,i]]);o+=t(a[0],g,h,j,b.key)+150}for(let a of b){let b=(function(a,b){if(!a)return[];let c=E(b),d=[],e=new Set([a.path]),f=(a,b)=>{for(let g of(c.get(a.path)??[]).filter(a=>!e.has(a.path)).sort((a,b)=>x(a)-x(b)||b.mtime-a.mtime))e.add(g.path),d.push({file:g,depth:b}),f(g,b+1)};return f(a,1),d})(a,c).map(a=>a.file).filter(a=>!n.has(a.path)),d=b.filter(a=>A(a)),e=b.filter(a=>!A(a));o+=t({file:a,tasks:[]},new Map,new Map(d.length?[[a.path,d]]:[]),new Map([[a.path,e]]),a.parent?"":a.path)+150}for(let a of e)r.has(a)||(p.push({key:"draft::"+a,id:a,x:o,y:100,w:600,h:780}),o+=750);let u=0;for(let a of h)u=Math.max(u,a.y+a.h);for(let a of j)u=Math.max(u,a.y+a.h);for(let a of k)u=Math.max(u,a.y+a.h);for(let a of p)u=Math.max(u,a.y+a.h);return{nodes:h,edges:i,stacks:j,decks:k,loops:l,drafts:p,byPath:new Map([...h.map(a=>[a.file.path,a]),...p.map(a=>[a.key,a])]),width:Math.max(o-150+100,800),height:u+100+140}}let cN=k("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]),cO=k("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]),cP=k("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);function cQ({layout:a,cam:b,vp:c,onJump:f}){let{t:g}=t(),h=(0,e.useRef)(null),i=(0,e.useRef)(!1),j=Math.min(216/a.width,148/a.height),k=(216-a.width*j)/2,l=(148-a.height*j)/2,m=a=>{let b=h.current?.getBoundingClientRect();b&&f((a.clientX-b.left-k)/j,(a.clientY-b.top-l)/j)};return(0,d.jsx)("div",{ref:h,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card",style:{width:216,height:148},title:g("minimap.title"),onPointerDown:a=>{a.stopPropagation(),i.current=!0,m(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{i.current&&m(a)},onPointerUp:a=>{i.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{i.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${k} ${l}) scale(${j})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#9a9aa4",opacity:.3},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#5a51e0",opacity:.3},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:ag(a.file),opacity:"live"===a.file.activity?.85:.35},a.file.path)),(0,d.jsx)("rect",{x:-b.x/b.z,y:-b.y/b.z,width:c.w/b.z,height:c.h/b.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/j})]})})})}let cR=k("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),cS=["low","medium","high","xhigh"],cT={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function cU({label:a,role:b,onChange:c}){let{t:e}=t();return(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:a}),(0,d.jsxs)("select",{value:b.engine,"aria-label":e("flowDialog.engine",{label:a}),className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,engine:a.target.value,effort:null}),children:[(0,d.jsx)("option",{value:"claude",children:"Claude"}),(0,d.jsx)("option",{value:"codex",children:"Codex"})]}),(0,d.jsx)("input",{value:b.model??"",placeholder:e("flowDialog.modelPlaceholder"),"aria-label":e("flowDialog.model",{label:a}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,model:a.target.value.trim()||null})}),"codex"===b.engine?(0,d.jsxs)("select",{value:b.effort??"","aria-label":`Reasoning effort: ${a}`,className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,effort:a.target.value||null}),children:[(0,d.jsx)("option",{value:"",children:e("flowDialog.effortDefault")}),cS.map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}):null]})}function cV({file:a,onClose:b}){let{t:c}=t(),[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(cT),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)("head"),[p,q]=(0,e.useState)("auto"),[r,s]=(0,e.useState)("headless"),[u,v]=(0,e.useState)(5),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=async()=>{if(!w){x(!0),z(null);try{let d=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:a.path,...l||!h?{roles:j}:{preset:h},baseMode:n,mode:p,reviewerMode:r,roundLimit:u})});if(!d.ok){let a=await d.json().catch(()=>null);z(a?.error??c("flowDialog.createFailed",{status:d.status}));return}b()}catch{z(c("common.serverUnavailable"))}finally{x(!1)}}};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&b()},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:c("flowDialog.title")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:c("flowDialog.subtitle")})]}),f.length?(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.preset"),(0,d.jsx)("select",{value:h??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>{var b;let c;return i(b=a.target.value),void((c=f.find(a=>a.name===b))&&k({implementer:c.implementer,reviewer:c.reviewer}))},children:f.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}):null,(0,d.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":l,onClick:()=>m(a=>!a),children:l?c("flowDialog.rolesManualOpen"):c("flowDialog.rolesManual")}),l?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,d.jsx)(cU,{label:c("flowDialog.implementer"),role:j.implementer,onChange:a=>k(b=>({...b,implementer:a}))}),(0,d.jsx)(cU,{label:c("flowDialog.reviewer"),role:j.reviewer,onChange:a=>k(b=>({...b,reviewer:a}))})]}):null,(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.diffBase"),(0,d.jsxs)("select",{value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(a.target.value),children:[(0,d.jsx)("option",{value:"head",children:c("flowDialog.fromHead")}),(0,d.jsx)("option",{value:"merge-base",children:c("flowDialog.fromMergeBase")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.reviewer"),(0,d.jsxs)("select",{value:r,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>s(a.target.value),children:[(0,d.jsx)("option",{value:"headless",children:c("flowDialog.headless")}),(0,d.jsx)("option",{value:"pane",children:c("flowDialog.tmuxPane")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.transitions"),(0,d.jsxs)("select",{value:p,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>q(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:c("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:c("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:u,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>v(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[y?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:y}):(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1.5 text-[11.5px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:w,onClick:()=>void A(),children:w?c("flowDialog.creating"):c("flowDialog.start")})]})]})}let cW=k("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"}]]),cX=k("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),cY={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}},cZ=new Set(["spawning","reviewing","relaying","fixing"]),c$=[1,2,3,4,5,0];function c_({flow:a,onFocusRound:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(""),m=async(b,c)=>{if(f)return;g(!0),i(null);let d=await V(a.id,{action:b,...c});d?i(d):c?.note!==void 0&&k(""),g(!1)},n=cY[a.state],o=Q.has(a.state),p="closed"===a.state||"approved"===a.state,q="waiting_ready"===a.state||"needs_decision"===a.state;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${o?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":cZ.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("flowStrip.flow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:P(c,a.state)}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("flowStrip.roundsAria"),children:a.rounds.map((a,e)=>{let f=U(a.verdict),g=null===a.verdict&&!a.error;return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[e>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${g?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:a.error?c("flowStrip.roundError",{n:a.n,error:a.error}):a.verdict?c("flowStrip.roundVerdict",{n:a.n,verdict:a.verdict})+(null!=a.findingsCount?` \xb7 ${c("roundDeck.findings",{count:a.findingsCount})}`:""):c("flowStrip.roundInProgress",{n:a.n}),onClick:()=>b?.(a.n),children:["R",a.n,(0,d.jsx)(cF,{verdict:a.verdict,error:!!a.error}),null!=a.findingsCount&&a.findingsCount>0?(0,d.jsx)("span",{children:a.findingsCount}):null]})]},a.n)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(cW,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,q?(0,d.jsx)(a6,{label:c("flowStrip.noteTitle"),children:(0,d.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-medium text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:j,placeholder:c("flowStrip.notePlaceholder"),onChange:a=>k(a.target.value),onKeyDown:a=>{"Enter"===a.key&&n&&m(n.action,{note:j})}})}):null,"reviewing"===a.state?(0,d.jsx)(a6,{label:c("flowStrip.stopReviewerTitle"),children:(0,d.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-err/40 bg-[#fbeaea] px-2.5 text-[10.5px] font-bold text-err hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void m("cancel-round"),children:[(0,d.jsx)(aT,{className:"h-3 w-3","aria-hidden":!0})," ",c("flowStrip.stopReviewer")]})}):null,n?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void m(n.action,q?{note:j}:void 0),children:c(n.labelKey)}):null,p?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6,{label:c("flowStrip.limitTitle"),children:(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[c$.map(b=>{let e=a.roundLimit===b,g=0!==b&&b<a.rounds.length;return(0,d.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${e?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:f||g,"aria-label":0===b?c("flowStrip.limitUnlimitedAria"):c("flowStrip.limitAria",{count:b}),"aria-pressed":e,onClick:()=>void m("set-round-limit",{rounds:b}),children:0===b?(0,d.jsx)(cX,{className:"h-3 w-3","aria-hidden":!0}):b},b)}),c$.includes(a.roundLimit)?null:(0,d.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,d.jsx)(a6,{label:"auto"===a.mode?c("flowStrip.autoTitle"):c("flowStrip.manualTitle"),children:(0,d.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:f,onClick:()=>void m("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?c("flowDialog.auto"):c("flowStrip.manualShort")})}),"paused"===a.state?(0,d.jsx)(a6,{label:c("flowStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.resume"),onClick:()=>void m("resume"),children:(0,d.jsx)(aR,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(a6,{label:c("flowStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.pause"),onClick:()=>void m("pause"),children:(0,d.jsx)(cc,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,d.jsx)(a6,{label:c("flowStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.close"),onClick:()=>void m("close"),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function c0({role:a,active:b}){let{t:c}=t();return(0,d.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-card ${b?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${b?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${b?"text-ok":"text-ink"}`,children:c("implementer"===a?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,d.jsx)("span",{className:`text-[10px] font-semibold ${b?"text-ok":"text-dim"}`,children:c(b?"scheme.roleWorking":"scheme.roleWaiting")})]})}let c1="cubic-bezier(.22,.8,.36,1)",c2=`transform 380ms ${c1}`,c3=(0,e.memo)(function({edges:a,width:b,height:c}){return(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{let b=Math.max(36,(a.y2-a.y1)*.5),c=`M ${a.x1} ${a.y1} C ${a.x1} ${a.y1+b}, ${a.x2} ${a.y2-b}, ${a.x2} ${a.y2-7}`,e=`M ${a.x2-5} ${a.y2-9} L ${a.x2+5} ${a.y2-9} L ${a.x2} ${a.y2-1} Z`;return(0,d.jsxs)("g",{opacity:a.live?.9:.5,children:[(0,d.jsx)("path",{d:c,style:{d:`path("${c}")`,transition:`d 380ms ${c1}`},fill:"none",stroke:a.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a.dashed?"5 7":void 0}),(0,d.jsx)("circle",{cx:a.x1,cy:a.y1,r:3.5,fill:a.color,style:{cx:`${a.x1}px`,cy:`${a.y1}px`,transition:`cx 380ms ${c1}, cy 380ms ${c1}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${c1}`},fill:a.color})]},a.to)})})}),c4=(0,e.memo)(function({loops:a,width:b,height:c}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{var b,c;let e="spawn_pending"===(b=a.flow).state||"spawning"===b.state||"reviewing"===b.state?"forward":"relay_pending"===b.state||"relaying"===b.state||"fixing"===b.state||"waiting_ready"===b.state&&b.rounds.length?"back":null,f="approved"===(c=a.flow).state?"#1a8a3e":R.has(c.state)?"#5a51e0":Q.has(c.state)?"#e0ae45":"#9a9aa4",g=a.y+150,h=a.y+330,i=(a.x1+a.x2)/2,j=(g+h)/2,k=`M ${a.x1} ${g} C ${a.x1+52} ${g-56}, ${a.x2-52} ${g-56}, ${a.x2-7} ${g}`,l=`M ${a.x2} ${h} C ${a.x2-52} ${h+56}, ${a.x1+52} ${h+56}, ${a.x1+7} ${h}`,m=`M ${a.x2-9} ${g-5} L ${a.x2-9} ${g+5} L ${a.x2-1} ${g} Z`,n=`M ${a.x1+9} ${h-5} L ${a.x1+9} ${h+5} L ${a.x1+1} ${h} Z`,o=(a,b)=>({d:a,fill:"none",stroke:b?"#5a51e0":"#c9c9d1",strokeWidth:b?3:2.5,strokeLinecap:"round",className:b?"loop-arc-live":void 0,style:{d:`path("${a}")`,transition:`d 380ms ${c1}`}}),p=a=>({d:`path("${a}")`,transition:`d 380ms ${c1}`});return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{...o(k,"forward"===e)}),(0,d.jsx)("path",{d:m,style:p(m),fill:"forward"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("path",{...o(l,"back"===e)}),(0,d.jsx)("path",{d:n,style:p(n),fill:"back"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("circle",{cx:i,cy:j,r:17,fill:"#ffffff",stroke:f,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${c1}, cy 380ms ${c1}`}}),(0,d.jsx)("text",{x:i,y:j+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:f,style:{x:`${i}px`,y:`${j+6}px`,transition:`x 380ms ${c1}, y 380ms ${c1}`},children:"⟳"})]},a.key)})}):null});function c5({file:a,onSelect:b}){let c=ai(a);return(0,d.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:u(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:u(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:W(a.mtime)})]})}function c6({file:a}){let b=ai(a);return(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,d.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-line bg-panel/95 px-[0.75em] py-[0.45em] shadow-[0_2px_14px_rgb(20_20_30/0.14)]",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,d.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...b.style,fontSize:"0.72em"},children:b.label}),(0,d.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:u(a.title,70)})]})})}let c7=()=>void 0;function c8({node:a,ringed:b,flow:c}){let{t:e}=t(),f=ai(a.file);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[c?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(c_,{flow:c,onFocusRound:c7})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-t-4 bg-panel shadow-card ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,style:ah(a.file),children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${Y(a.file.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:f.style,children:f.label}),a.file.model?(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:a.file.model}):null,(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:W(a.file.mtime)})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-5",children:u(a.file.title,180)})}),a.under.length?(0,d.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[a.under.length," ",e("scheme.underneath")]}):null]}),c?(0,d.jsx)(c0,{role:"implementer",active:"implementer"===S(c)}):null,(0,d.jsx)(c6,{file:a.file})]})}function c9({draft:a,ringed:b}){let{t:c}=t();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:(0,d.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",c("mobile.agent")]})})})}function da({deck:a}){let{t:b}=t(),c=a.rounds.at(-1)??null,e=c?.round??null,f=U(e?.verdict??null);return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[(0,d.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:e?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:f.soft,color:f.color},children:[(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",e.n," ",(0,d.jsx)(cF,{verdict:e.verdict,error:!!e.error,className:"h-3.5 w-3.5"})]}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:e.error?b("roundDeck.aborted"):e.verdict??b("roundDeck.reviewInProgress")})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-4",children:c?.file?u(c.file.title,140):b("roundDeck.spawningReviewer")})}),a.rounds.length>1?(0,d.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:b("roundDeck.moreRounds",{count:a.rounds.length-1})}):null]}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:b("roundDeck.waitingFirst")})}),(0,d.jsx)(c0,{role:"reviewer",active:"reviewer"===S(a.flow)})]})}function db({stack:a,onSelect:b}){let{t:c}=t();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:(0,d.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60 p-2",children:a.items.map(({file:a,branches:e})=>{let f=ai(a);return(0,d.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:u(a.title),onClick:()=>b(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:f.style,children:f.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:u(a.title,70)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,d.jsx)("span",{children:cu(c,a.kind)}),(0,d.jsx)("span",{children:W(a.mtime)}),e?(0,d.jsxs)("span",{children:["⤷ ",e]}):null]})]},a.path)})})})}function dc({node:a,files:b,ringed:c,flow:f,canFlow:g,onSelect:h,onClose:i,onFocusRound:j,onHandoff:k}){let{t:l}=t(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute ${m||o?"z-20":""}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[f?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(c_,{flow:f,onFocusRound:a=>j(f.id,a)})}):g?(0,d.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,d.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":o,title:l("scheme.flowTitle"),onClick:()=>p(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",l("scheme.flow")]})}):null,o?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(cV,{file:a.file,onClose:()=>p(!1)})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsx)("div",{className:`relative z-[1] flex h-full ${c?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cw,{file:a.file,tasks:a.tasks,files:b,onSelect:h,isRoot:a.isRoot,onClose:()=>i(a.file.path)})}),f?(0,d.jsx)(c0,{role:"implementer",active:"implementer"===S(f)}):null,(0,d.jsx)(c6,{file:a.file}),k&&cK(a.file)?(0,d.jsx)(cL,{file:a.file,onHandoff:()=>k(a.file)}):null,a.under.length?(0,d.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,title:l("scheme.collapsedTitle"),onClick:()=>n(a=>!a),children:[(0,d.jsx)(cR,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," ",l("scheme.underneath"),(0,d.jsx)(aI,{className:`h-3 w-3 transition-transform ${m?"rotate-90":""}`,"aria-hidden":!0})]}):null,m?(0,d.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:a.under.map(a=>(0,d.jsx)(c5,{file:a,onSelect:h},a.path))}):null]})}function dd({draft:a,project:b,files:c,ringed:e,onDraftClose:f,onDraftSpawned:g}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cB,{draftId:a.id,project:b,files:c,onClose:()=>f(a.id),onSpawned:b=>g(a.id,b)})})})}function de({deck:a,files:b,focus:c,onSelect:e}){let f=c&&c.flowId===a.flow.id?c.round+c.nonce/1e3:null;return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:"scheme-enter absolute",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:c2},children:[(0,d.jsx)(cI,{flow:a.flow,rounds:a.rounds,files:b,onSelect:e,focusRound:f}),(0,d.jsx)(c0,{role:"reviewer",active:"reviewer"===S(a.flow)})]})}let df=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,lite:f,selected:g,focus:h,flowsByImpl:i,deckFocus:j,onSelect:k,onClose:l,onFocusRound:m,onDraftClose:n,onDraftSpawned:o,onHandoff:p}){return(0,d.jsxs)("div",{className:e?void 0:"pointer-events-none select-none",children:[a.stacks.map(a=>(0,d.jsx)(db,{stack:a,onSelect:k},a.key)),a.decks.map(a=>f?(0,d.jsx)(da,{deck:a},a.key):(0,d.jsx)(de,{deck:a,files:c,focus:j,onSelect:k},a.key)),a.drafts.map(a=>f?(0,d.jsx)(c9,{draft:a,ringed:g===a.key||h===a.key},a.key):(0,d.jsx)(dd,{draft:a,project:b,files:c,ringed:g===a.key||h===a.key,onDraftClose:n,onDraftSpawned:o},a.key)),a.nodes.map(a=>{var b;return f?(0,d.jsx)(c8,{node:a,ringed:g===a.file.path||h===a.file.path,flow:i.get(a.file.path)??null},a.file.path):(0,d.jsx)(dc,{node:a,files:c,ringed:g===a.file.path||h===a.file.path,flow:i.get(a.file.path)??null,canFlow:(b=a.file,!i.has(b.path)&&("claude"===b.engine||"codex"===b.engine)&&y(b)),onSelect:k,onClose:l,onFocusRound:m,onHandoff:p},a.file.path)})]})}),dg=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y);function dh({active:a,title:b,onClick:c,children:e}){return(0,d.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:b,"aria-label":b,"aria-pressed":a,onClick:c,children:e})}function di({project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:i,ring:j,onSelect:k,onNodePick:l,onClose:m,onDraftClose:n,onDraftSpawned:o,onHandoff:p}){let{t:q}=t(),r=!!l,[s,u]=(0,e.useState)(null),v=(0,e.useMemo)(()=>cM(b,c,f,g,h),[b,c,f,g,h]),w=(0,e.useMemo)(()=>N(g),[g]),[x,y]=(0,e.useState)(null),z=(0,e.useCallback)((a,b)=>{y(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),A=j??i,B=(0,e.useRef)(k),C=(0,e.useRef)(l),D=(0,e.useRef)(m),E=(0,e.useRef)(n),F=(0,e.useRef)(o),G=(0,e.useRef)(p),H=(0,e.useCallback)(a=>{let b=C.current;b?b(a.path):B.current(a)},[]),I=(0,e.useCallback)(a=>D.current(a),[]),J=(0,e.useCallback)(a=>E.current(a),[]),K=(0,e.useCallback)((a,b)=>F.current(a,b),[]),L=(0,e.useCallback)(a=>G.current?.(a),[]),{cam:M,vp:O,viewportRef:P,handLike:Q,panning:R,glide:S,setMode:T,onPointerDown:U,onPointerMove:V,onDoubleClick:W,onClick:X,zoomCenter:Y,zoomTo:Z,fit:$,jump:_}=function({project:a,layout:b,mapMode:c,focus:d,onNodePick:f,setSelected:g}){let h=(0,e.useRef)(null),i=(0,e.useRef)(null),[j,k]=(0,e.useState)({x:0,y:0,z:.5}),[l,m]=(0,e.useState)("select"),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)({w:1,h:1}),v=(0,e.useRef)(null),w=(0,e.useRef)(new Map),x=(0,e.useRef)(null);(0,e.useRef)(l),(0,e.useRef)(n);let y=(0,e.useRef)(null);(0,e.useRef)(null);let z=(0,e.useCallback)(a=>{m(a),localStorage.setItem("llvSchemeMode",a)},[]),A=(0,e.useCallback)(a=>{let c=Math.min(Math.max(a.x,120-b.width*a.z),t.w-120),d=Math.min(Math.max(a.y,120-b.height*a.z),t.h-120);return c===a.x&&d===a.y?a:{...a,x:c,y:d}},[b.width,b.height,t]),B=(0,e.useRef)([]),C=(0,e.useRef)(null),D=(0,e.useCallback)(a=>{B.current.push(a),null==C.current&&(C.current=requestAnimationFrame(()=>{C.current=null;let a=B.current;B.current=[],k(b=>a.reduce((a,b)=>b(a),b))}))},[]),E=(0,e.useCallback)((a,b,c)=>{D(d=>{let e=Math.min(1.6,Math.max(.12,d.z*c));if(e===d.z)return d;let f=e/d.z;return A({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[A,D]),F=(0,e.useCallback)(a=>{let b=h.current?.getBoundingClientRect();b&&E(b.width/2,b.height/2,a)},[E]),G=(0,e.useCallback)(a=>{let b=h.current?.getBoundingClientRect();b&&k(c=>{let d=Math.min(1.6,Math.max(.12,a));if(d===c.z)return c;let e=d/c.z,f=b.width/2,g=b.height/2;return A({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[A]),H=(0,e.useCallback)(()=>{let a=h.current?.getBoundingClientRect();if(!a||!b.nodes.length&&!b.drafts.length)return null;let c=Math.min(1.6,Math.max(.12,Math.min((a.width-48)/b.width,(a.height-48)/b.height,1)));return{z:c,x:(a.width-b.width*c)/2,y:(a.height-b.height*c)/2}},[b]),I=(0,e.useCallback)(a=>{s(!0),k(a),y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>s(!1),500)},[]),J=(0,e.useCallback)(()=>{let a=H();a&&I(a)},[H,I]),K=(0,e.useCallback)((a,b)=>{let c=h.current?.getBoundingClientRect();c&&I(d=>{let e=Math.min(1.6,Math.max(d.z,b));return{z:e,x:c.width/2-(a.x+a.w/2)*e,y:Math.min(c.height/2-a.y*e,.08*c.height-(a.y-40)*e)}})},[I]);(0,e.useRef)(null);let L=a=>{let b=h.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},M=a=>{v.current={sx:a.clientX,sy:a.clientY,cx:j.x,cy:j.y},q(!0);try{h.current?.setPointerCapture(a.pointerId)}catch{}},N=c||"hand"===l||n,O=(0,e.useCallback)((a,b)=>k(c=>A({...c,x:t.w/2-a*c.z,y:t.h/2-b*c.z})),[t,A]);return{cam:j,vp:t,viewportRef:h,mode:l,setMode:z,handLike:N,panning:p,glide:r,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if(c&&a.isPrimary&&(i.current={x:a.clientX,y:a.clientY}),"touch"===a.pointerType&&(w.current.set(a.pointerId,L(a)),2===w.current.size)){let[a,b]=[...w.current.values()];x.current={d:dg(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},v.current=null,q(!1);return}if(1===a.button){a.preventDefault(),M(a);return}if(0===a.button){if(!(c||"hand"===l||n)){let a=b.closest("[data-scheme-node]");if(a)return void g(a.getAttribute("data-scheme-node"));if(g(null),b.closest("button, a, input, textarea, select"))return}M(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&w.current.has(a.pointerId)){w.current.set(a.pointerId,L(a));let b=x.current;if(b&&w.current.size>=2){let[a,c]=[...w.current.values()],d=dg(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;D(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return A({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),x.current={d,cx:e,cy:f};return}}let b=v.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;D(a=>A({...a,x:b.cx+c,y:b.cy+d}))},onDoubleClick:a=>{let c=a.target;if(c.closest("[data-scheme-ui]"))return;let d=c.closest("[data-scheme-node]");if(!d)return void J();if("hand"!==l&&!n)return;let e=b.byPath.get(d.getAttribute("data-scheme-node")??"");e&&K(e,.9)},onClick:a=>{if(!f)return;let c=i.current;if(i.current=null,!c||Math.hypot(a.clientX-c.x,a.clientY-c.y)>9||a.target.closest("[data-scheme-ui]"))return;let d=h.current?.getBoundingClientRect();if(!d)return;let e=((a,c)=>{let d=b=>a>=b.x&&a<=b.x+b.w&&c>=b.y&&c<=b.y+b.h;for(let a of b.nodes)if(d(a))return a.file.path;for(let a of b.drafts)if(d(a))return a.key;for(let a of b.stacks)if(d(a))return function(a,b){let c=Math.floor((b-a.y-8)/58);return a.items[Math.max(0,Math.min(c,a.items.length-1))]?.file??null}(a,c)?.path??null;for(let a of b.decks)if(d(a))return a.key;return null})((a.clientX-d.left-j.x)/j.z,(a.clientY-d.top-j.y)/j.z);e&&f(e)},zoomCenter:F,zoomTo:G,fit:J,jump:O}}({project:a,layout:v,mapMode:r,focus:i,onNodePick:l,setSelected:u}),aa=24*M.z;return(0,d.jsxs)("div",{ref:P,className:`relative min-h-0 flex-1 overflow-hidden ${R?"cursor-grabbing select-none":Q?"cursor-grab":""} ${Q?"touch-none":""}`,onPointerDown:U,onPointerMove:V,onDoubleClick:W,onClick:X,children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-aa,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${aa}px ${aa}px`,transform:`translate(${(M.x%aa+aa)%aa}px, ${(M.y%aa+aa)%aa}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${R?"scheme-panning":""}`,style:{width:v.width,height:v.height,transform:`translate(${M.x}px, ${M.y}px) scale(${M.z})`,transformOrigin:"0 0",transition:S?`transform .45s ${c1}`:void 0,willChange:"transform","--inv-z":String(1/M.z),"--label-o":M.z<.45?"1":"0"},children:[(0,d.jsx)(c3,{edges:v.edges,width:v.width,height:v.height}),(0,d.jsx)(c4,{loops:v.loops,width:v.width,height:v.height}),(0,d.jsx)(df,{layout:v,project:a,files:f,interactive:!Q,lite:r,selected:s,focus:A,flowsByImpl:w,deckFocus:x,onSelect:H,onClose:I,onFocusRound:z,onDraftClose:J,onDraftSpawned:K,onHandoff:p?L:void 0})]},a),(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-line bg-panel/95 p-1 shadow-card",children:[r?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dh,{active:Q,title:q("scheme.handTool"),onClick:()=>T("hand"),children:(0,d.jsx)(cN,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(dh,{active:!Q,title:q("scheme.selectTool"),onClick:()=>T("select"),children:(0,d.jsx)(cO,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,d.jsx)(dh,{title:q("scheme.zoomOut"),onClick:()=>Y(.8),children:(0,d.jsx)(bM,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:q("scheme.zoom100"),onClick:()=>Z(1),children:[Math.round(100*M.z),"%"]}),(0,d.jsx)(dh,{title:q("scheme.zoomIn"),onClick:()=>Y(1.25),children:(0,d.jsx)(bN,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(dh,{title:q("scheme.fit"),onClick:$,children:(0,d.jsx)(cP,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(cQ,{layout:v,cam:M,vp:O,onJump:_})]})}let dj={waiting:5,stalled:4,live:3,returned:2,done:1};function dk({project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:i,onSelect:j,onClose:k,onDraftClose:m,onDraftSpawned:n,onHandoff:o}){let{t:p}=t(),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(!1),v=(0,e.useRef)(null),w=(0,e.useRef)(null),x=(0,e.useMemo)(()=>cM(b,c,f,g,h),[b,c,f,g,h]),y=(0,e.useMemo)(()=>[...x.nodes.map(a=>({key:a.file.path,file:a.file,isRoot:a.isRoot,kind:"node"})),...x.decks.map(a=>({key:a.key,file:null,isRoot:!1,kind:"deck"})),...x.drafts.map(a=>({key:a.key,file:null,isRoot:!0,kind:"draft"}))],[x]),z=(0,e.useMemo)(()=>new Map(y.map(a=>[a.key,a])),[y]),A=(0,e.useMemo)(()=>{if(q&&z.has(q))return q;let a=null,b=-1;for(let c of y){if(!c.file)continue;let d=1e12*dj[ap(c.file)]+c.file.mtime;d>b&&(b=d,a=c)}return(a??y[0])?.key??null},[q,z,y]),B=(0,e.useMemo)(()=>x.nodes.find(a=>a.file.path===A)??null,[x,A]),C=(0,e.useMemo)(()=>x.decks.find(a=>a.key===A)??null,[x,A]),D=(0,e.useMemo)(()=>x.drafts.find(a=>a.key===A)??null,[x,A]),E=(0,e.useCallback)(a=>{if(!y.length)return;let b=y.findIndex(a=>a.key===A),c=y[Math.min(y.length-1,Math.max(0,(-1===b?0:b)+a))];c&&c.key!==A&&r(c.key)},[y,A]),F=(0,e.useCallback)(a=>{if(u(!1),z.has(a))return void r(a);let b=f.find(b=>b.path===a);b&&j(b)},[z,f,j]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[y.length>1?(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-b border-line bg-panel px-2 py-1.5",children:y.map(a=>(0,d.jsx)(dl,{entry:a,active:a.key===A,chipRef:a.key===A?w:void 0,onClick:()=>r(a.key)},a.key))}):null,(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col p-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[B?(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,d.jsx)(cw,{file:B.file,tasks:B.tasks,files:f,onSelect:j,isRoot:B.isRoot,onClose:()=>k(B.file.path),dragHandle:{onTouchStart:a=>{let b=a.touches[0];b&&(v.current={x:b.clientX,y:b.clientY})},onTouchEnd:a=>{let b=v.current;v.current=null;let c=a.changedTouches[0];if(!b||!c)return;let d=c.clientX-b.x,e=c.clientY-b.y;56>Math.abs(d)||Math.abs(d)<2*Math.abs(e)||E(d<0?1:-1)}}}),o&&cK(B.file)?(0,d.jsx)(cL,{file:B.file,onHandoff:()=>o(B.file)}):null]},B.file.path):C?(0,d.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,d.jsx)(cI,{flow:C.flow,rounds:C.rounds,files:f,onSelect:j,focusRound:null})},C.key):D?(0,d.jsx)(cB,{draftId:D.id,project:a,files:f,onClose:()=>m(D.id),onSpawned:a=>n(D.id,a)},D.key):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:p("mobile.noConvos")}),(0,d.jsx)(dm,{layout:x,current:A,onOpen:()=>u(!0)})]}),s?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:p("mobile.map")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":p("mobile.closeMap"),onClick:()=>u(!1),children:(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(di,{project:a,groups:b,manual:c,files:f,flows:g,drafts:h,focus:null,ring:A,onSelect:j,onClose:k,onDraftClose:m,onDraftSpawned:n,onNodePick:F}),(0,d.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:p("mobile.tapNode")})]}):null]})}function dl({entry:a,active:b,chipRef:c,onClick:e}){let{t:f}=t();if(!a.file){let g="deck"===a.kind;return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:e,children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:g?"R":"+"})," ",f(g?"scheme.flow":"mobile.agent")]})}let g=a.file,h=ap(g),i="waiting"===h||"stalled"===h,j=ai(g),k=u(g.title,60);return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":i?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:k,onClick:e,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(g.activity)}`}),a.isRoot?null:(0,d.jsx)("span",{"aria-hidden":!0,children:"⤷"}),b?(0,d.jsx)("span",{className:"max-w-[52vw] truncate",children:k}):(0,d.jsxs)("span",{children:[i?"⏸ ":"",j.label]})]})}function dm({layout:a,current:b,onOpen:c}){let{t:e}=t(),f=Math.min(96/a.width,64/a.height),g=(96-a.width*f)/2,h=(64-a.height*f)/2;return(0,d.jsx)("button",{type:"button",className:"absolute bottom-[92px] right-4 z-30 overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{width:96,height:64},"aria-label":e("mobile.openMap"),onClick:c,children:(0,d.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${g} ${h}) scale(${f})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:a.key===b?"#5a51e0":void 0,strokeWidth:a.key===b?5/f:void 0},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:a.key===b?"#5a51e0":void 0,strokeWidth:a.key===b?5/f:void 0},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:ag(a.file),opacity:"live"===a.file.activity?.85:.35,stroke:a.file.path===b?"#5a51e0":void 0,strokeWidth:a.file.path===b?5/f:void 0},a.file.path))]})})})}function dn(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function dp({data:a,onOpen:b}){let{t:c}=t(),f=a.waiting.length;(0,e.useRef)(f);let[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[a.livePreview.length?(0,d.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-line bg-panel/95 px-3 py-2 shadow-card backdrop-blur group-focus-within:block group-hover:block",children:a.livePreview.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:a.title}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:a.statusLine||c("status.working")})]},a.file.path))}):null,(0,d.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-line bg-panel/95 px-2.5 py-1 text-[11.5px] font-bold shadow-card backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${g?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":c("corner.openSwitchboard"),onClick:b,children:[(0,d.jsx)("span",{className:`h-2 w-2 rounded-full ${a.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,d.jsx)("span",{children:a.working.length}),(0,d.jsx)("span",{className:f?"text-[#b8860b]":"text-dim",children:c("corner.waitingCount",{count:f})})]})]})}function dq({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let{t:m}=t(),n=ai(a),o="large"===h;return(0,d.jsxs)("article",{className:`group relative flex ${o?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-card transition-colors hover:border-accent/45 ${"working"===i?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===i?"border-err/35 bg-[#fff5f5]":"waiting"===i?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":m("switchCard.openColumn",{title:u(b,80)}),onClick:()=>j(a),onKeyDown:b=>{"Enter"===b.key&&j(a)},children:["live"===a.activity?null:(0,d.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-line bg-bg text-dim hover:border-err/50 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":m("switchCard.remove"),onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(l,{className:"h-3 w-3","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${Y(a.activity)}`}),a.model?(0,d.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:ae(a).soft,color:ae(a).color},title:[n.label,af(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:n.style,children:n.label}),(0,d.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-line bg-bg px-1.5 py-0.5 text-[9.5px] font-semibold ${c===e?"text-dim":"text-ink"}`,title:c,children:c})]}),(0,d.jsx)("div",{className:`relative mt-2 min-w-0 ${o?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:b,children:(0,d.jsx)("span",{className:"line-clamp-2",children:b})}),(0,d.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"shrink-0",children:W(a.mtime)}),a.ctx?(0,d.jsx)(cq,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(az,{className:"h-3 w-3","aria-hidden":!0})," ",f]}):null]}),g?(0,d.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${o?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:g}):null,a.pid&&"running"===a.proc?(0,d.jsx)("div",{className:"relative mt-2",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(cg,{file:a,compact:!0})}):null]})}function dr({title:a,items:b,size:c,currentProject:e,onOpenFile:f,onArchive:g}){return b.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,d.jsx)("h2",{className:"text-[13px] font-bold",children:a}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:b.length})]}),(0,d.jsx)(bm,{className:"flex flex-wrap gap-2.5",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.file.path,children:(0,d.jsx)(dq,{file:a.file,title:a.title,project:a.project,currentProject:e,descendants:a.descendants,statusLine:a.statusLine,size:c,tone:"working"===a.kind?"working":"waiting"===a.kind&&"stalled"===a.file.activity?"stalled":"waiting"===a.kind?"waiting":"quiet",onOpen:f,onArchive:g})},a.file.path))})]}):null}function ds({files:a,flows:b,project:c,onOpenFile:f}){let{t:g}=t(),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(0),s=(0,e.useRef)(null),v=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:w,archive:x,unarchive:y}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedPaths:a,archive:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,dn(d),d})},[]),unarchive:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,dn(d),d})},[])}}(),z=am(a,v.events,j,q,w,b),A=am(a,[],"",q,w,b),B=(0,e.useMemo)(()=>a.filter(a=>w.has(a.path)).map(a=>({file:a,title:u(a.title),project:C(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,w]),D=a=>{f(a),i(!1)},E=a=>x(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(dp,{data:A,onOpen:()=>i(!0)}),h?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>i(!1),children:(0,d.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-line bg-bg shadow-[0_18px_70px_rgb(20_20_30/0.28)]",role:"dialog","aria-modal":"true","aria-label":g("switch.aria"),onMouseDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,d.jsx)("div",{className:"text-[15px] font-bold",children:g("switch.title")}),(0,d.jsx)("input",{ref:s,value:j,onChange:a=>k(a.target.value),placeholder:g("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),v.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:g("switch.updating")}):null,(0,d.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("switch.close"),onClick:()=>i(!1),children:(0,d.jsx)(l,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,d.jsx)(dr,{title:g("switch.waiting"),items:z.waiting,size:"large",currentProject:c,onOpenFile:D,onArchive:E}),(0,d.jsx)(dr,{title:g("switch.working"),items:z.working,size:"large",currentProject:c,onOpenFile:D,onArchive:E}),(0,d.jsx)(dr,{title:g("switch.recent"),items:z.recent,size:"small",currentProject:c,onOpenFile:D,onArchive:E}),(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":m,onClick:()=>n(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.older")}),(0,d.jsx)("span",{className:"text-dim",children:z.older.length})]}),m?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(dr,{title:"",items:z.older,size:"small",currentProject:c,onOpenFile:D,onArchive:E})}):null]}),z.waiting.length||z.working.length||z.recent.length||z.older.length?null:(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:g("common.nothingFound")}),B.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12px] font-bold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":o,onClick:()=>p(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.hidden",{count:B.length})}),(0,d.jsx)("span",{children:o?g("switch.hide"):g("common.show")})]}),o?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:B.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel/60 px-3 py-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.title}),(0,d.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:a.project}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2 py-0.5 text-[10.5px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(a.file.path),children:g("switch.restore")})]},a.file.path))}):null]}):null]})]})}):null]})}function dt(){location.hash="#p="+encodeURIComponent(v)}function du({files:a,onOpen:b}){let{t:c}=t();return(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:c("trash.title")}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:c("trash.hint")}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(dv,{file:a,onOpen:b},a.path))})]})})}function dv({file:a,onOpen:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1),h=ai(a);return f?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-line bg-chip/60 px-3 py-1.5 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(aV,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:u(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:c("trash.deletedFromDisk")})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel px-3 py-1.5 shadow-card",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("trash.open",{title:u(a.title,60)}),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:h.style,children:h.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:u(a.title,90)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:W(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," ",c("common.kb")]})]}),(0,d.jsx)(bl,{file:a,onDeleted:()=>g(!0)})]})}function dw({files:a,onArchive:b}){let{t:c}=t();return!a.length||a.some(a=>"running"===a.proc||"live"===a.activity)?null:(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{b(),dt()},children:[(0,d.jsx)(aA,{className:"h-3 w-3","aria-hidden":!0})," ",c("trash.toArchive")]})}function dx({files:a}){let{t:b}=t(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)("");if(!a.length||a.some(a=>"running"===a.proc||"live"===a.activity))return null;let k=async()=>{h(!0),j("");let c=0;for(let b of a)try{let a=await fetch(`/api/log?path=${encodeURIComponent(b.path)}`,{method:"DELETE"}),d=await a.json();a.ok&&d.ok||(c+=1)}catch{c+=1}(h(!1),f(!1),c)?j(b("trash.notDeleted",{failed:c,total:a.length})):dt()};return c?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:b("trash.confirmDelete",{count:a.length})}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:g,onClick:k,children:g?b("trash.deleting"):b("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(!1),children:b("common.cancel")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line bg-bg p-1 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("trash.deleteProject"),title:b("trash.deleteProject"),onClick:()=>f(!0),children:(0,d.jsx)(aV,{className:"h-3 w-3","aria-hidden":!0})}),i?(0,d.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:i}):null]})}let dy=k("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),dz=k("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function dA(){let{t:a}=t(),[b,c]=(0,e.useState)(!0);return(0,d.jsx)("button",{className:"ml-auto inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(b?"sound.on":"sound.off"),"aria-label":a(b?"sound.mute":"sound.unmute"),"aria-pressed":b,onClick:()=>{let a=!b;c(a);try{localStorage.setItem(aq,a?"on":"off")}catch{}a&&function(a=0){(function(){try{localStorage.getItem(aq)}catch{return!0}})()}()},children:b?(0,d.jsx)(dy,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dz,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function dB({items:a,onSelect:b}){let{t:c}=t(),[f,g]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,d.jsxs)("button",{className:"flex h-8 items-center gap-2 px-4 text-[10px] font-bold uppercase tracking-[.6px] text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,onClick:()=>g(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3.5 w-3.5 transition-transform ${f?"rotate-90":""}`,"aria-hidden":!0}),c("tree.quiet"),(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),f?(0,d.jsx)(bm,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:a.map(a=>{let c=ai(a),e=u(a.cmdDesc||a.title,70);return(0,d.jsxs)("button",{"data-flip-key":a.path,className:"inline-flex h-7 max-w-[360px] items-center gap-1.5 rounded-full border border-line bg-bg px-2 text-[11px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:u(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${Y(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"truncate",children:e}),(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:W(a.mtime)})]},a.path)})}):null]})}let dC=a=>`llvCols:${a}`;function dD(a,b){let c=function(a){try{let b=JSON.parse(localStorage.getItem(dC(a))??"{}");return{manual:b.manual??[],hidden:b.hidden??[]}}catch{return{manual:[],hidden:[]}}}(a);c.manual.includes(b)||c.manual.push(b),c.hidden=c.hidden.filter(a=>a!==b),localStorage.setItem(dC(a),JSON.stringify(c))}function dE({files:a,flows:b,project:c,openNonce:f,archived:g,onArchive:h,onUnarchive:i,onMenu:j}){let{t:k}=t(),l=av(),m=(0,e.useRef)(null),n=(0,e.useRef)(null),[o,p]=(0,e.useState)({manual:[],hidden:[]}),[q,r]=(0,e.useState)([]),[s,u]=(0,e.useState)(null),v=(0,e.useRef)(o),w=a=>{v.current=a,p(a),localStorage.setItem(dC(c),JSON.stringify(a))},z=(0,e.useMemo)(()=>{let c=O(b);return c.size?a.filter(a=>!c.has(a.path)):a},[a,b]),A=(0,e.useMemo)(()=>H(z,c),[z,c]),B=(0,e.useMemo)(()=>new Set(A.map(a=>a.key)),[A]),D=(0,e.useMemo)(()=>(function(a,b,c){let d=E(a),e=[];for(let f of a){if(C(f)!==b||!y(f)||c.has(f.path))continue;let a=F(f,d);if(!a.length)continue;let g=f.mtime,h=x(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,x(b));e.push({root:f,branchCount:a.length,smt:g,band:h})}return e.sort((a,b)=>a.band-b.band||b.smt-a.smt)})(z,c,B),[z,c,B]),G=(0,e.useMemo)(()=>{let a;return a=E(z),z.filter(b=>!(C(b)!==c||b.parent||B.has(b.path)||a.get(b.path)?.length)&&"live"!==b.activity).sort((a,b)=>x(a)-x(b)||b.mtime-a.mtime)},[z,c,B]),I=(0,e.useMemo)(()=>new Set(A.flatMap(a=>a.columns.map(a=>a.file.path))),[A]),J=(0,e.useMemo)(()=>new Set(o.hidden),[o.hidden]),K=(0,e.useMemo)(()=>{let a=new Map(z.map(a=>[a.path,a]));return o.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&C(a)===c&&!I.has(a.path)&&!J.has(a.path))},[o.manual,z,c,I,J]),L=(0,e.useMemo)(()=>A.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[A]),M=A.filter(a=>!a.orphanTask).length,N=a=>{u(a),m.current&&window.clearTimeout(m.current),m.current=window.setTimeout(()=>u(null),1800)},P=a=>{r(a),sessionStorage.setItem(`llvDrafts:${c}`,JSON.stringify(a))},Q=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),R=a=>{let b=q.find(b=>""===a.path);if(b)return void N("draft::"+b);let c=Q();cA(c,"src",a.path),P([...q,c]),n.current="draft::"+c},S=a=>{for(let b of["engine","cwd","text","boot","src"])sessionStorage.removeItem(cz(a,b));P(q.filter(b=>b!==a))},T=(a,b)=>{S(a),V(b)},U=a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{}),w({manual:o.manual.filter(b=>b!==a),hidden:I.has(a)?[...new Set([...o.hidden,a])]:o.hidden})},V=a=>{let b=C(a);if(b!==c){dD(b,a.path),location.hash="#p="+encodeURIComponent(b);return}if(I.has(a.path)&&!J.has(a.path)||K.some(b=>b.path===a.path))return void N(a.path);let d=o.hidden.filter(b=>b!==a.path);w({manual:I.has(a.path)?o.manual:[...new Set([...o.manual,a.path])],hidden:d}),n.current=a.path},W=[];L?W.push(`${k("dash.branchesLive",{count:L})} \xb7 ${k("dash.trees",{count:M})}`):M&&W.push(k("dash.recentConvos",{count:M})),D.length&&W.push(k("dash.quietTrees",{count:D.length}));let X=A.map(a=>({...a,columns:a.columns.filter(a=>!J.has(a.file.path))})).filter(a=>a.columns.length),Y=X.filter(a=>a.orphanTask).map(a=>a.columns[0].file),Z=X.filter(a=>!a.orphanTask),$=Z.length>0||K.length>0||q.length>0,_=(0,e.useMemo)(()=>a.filter(a=>C(a)===c).sort((a,b)=>b.mtime-a.mtime),[a,c]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[j?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":k("dash.openProjects"),onClick:j,children:(0,d.jsx)(aw,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:c}),(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:W.length?W.join(" \xb7 "):k("common.nothingRunning")}),(0,d.jsx)(dA,{}),g?(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>i(c),children:[(0,d.jsx)(aB,{className:"h-3 w-3","aria-hidden":!0})," ",k("dash.unarchive")]}):(0,d.jsx)(dw,{files:_,onArchive:()=>h(c)}),(0,d.jsx)(dx,{files:_}),(0,d.jsxs)("button",{type:"button",onClick:()=>{let a=Q();P([...q,a]),n.current="draft::"+a},"aria-label":k("dash.newConvo"),className:"ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",k("dash.agent")]})]}),Y.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:Y.map(b=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===b.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(cx,{file:b,files:a,onSelect:V})},b.path))}):null,$?l?(0,d.jsx)(dk,{project:c,groups:Z,manual:K,files:a,flows:b,drafts:q,focus:s,onSelect:V,onClose:U,onDraftClose:S,onDraftSpawned:T,onHandoff:R}):(0,d.jsx)(di,{project:c,groups:Z,manual:K,files:a,flows:b,drafts:q,focus:s,onSelect:V,onClose:U,onDraftClose:S,onDraftSpawned:T,onHandoff:R}):_.length?(0,d.jsx)(du,{files:_,onOpen:V}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:k("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:k("dash.emptyHint")})]})}),l?null:(0,d.jsx)(ds,{files:a,flows:b,project:c,onOpenFile:V}),G.length?(0,d.jsx)(dB,{items:G,onSelect:V}):null]})}let dF=k("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),dG=k("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function dH(){let{t:a}=t(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)({status:"idle"}),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useRef)(null),m="ready"===f.status&&h&&h.url===f.url?h.dataUrl:null,n=(0,e.useCallback)(()=>{"ready"===f.status&&navigator.clipboard.writeText(f.url).then(()=>{k(!0),window.setTimeout(()=>k(!1),2e3)}).catch(()=>{})},[f]);return(0,d.jsxs)("div",{ref:l,className:"relative ml-auto shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-expanded":b,"aria-label":a("qr.showAria"),onClick:()=>{b||g({status:"idle"}),c(!b)},className:"flex items-center justify-center rounded-[8px] border border-line bg-panel p-1.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(dF,{className:"h-4 w-4","aria-hidden":!0})}),b?(0,d.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===f.status?(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("common.loading")}):"error"===f.status?(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:a("qr.failed")}):"unavailable"===f.status?(0,d.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[a("qr.startHint"),(0,d.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,d.jsxs)(d.Fragment,{children:[m?(0,d.jsx)("img",{src:m,alt:a("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("qr.generating")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{readOnly:!0,value:f.url,"aria-label":a("qr.linkAria"),onFocus:a=>a.currentTarget.select(),className:"min-w-0 flex-1 truncate rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[10.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("button",{type:"button","aria-label":a("qr.copy"),onClick:n,className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-[11px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:j?(0,d.jsx)(aH,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dG,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:a("qr.scanHint")})]})}):null]})}function dI(){let{locale:a,t:b,setLocale:c}=t(),e="en"===a?"uk":"en";return(0,d.jsx)("button",{className:"inline-flex h-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel px-2 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:b("lang.aria"),"aria-label":b("lang.aria"),onClick:()=>c(e),children:a.toUpperCase()})}let dJ=(a=p())=>"uk"===a?"uk-UA":"en-US";function dK({label:a,window:b,engineColor:c,now:e}){var f,g;let h,i,j,k,{t:l}=t();if(!b)return null;let m=Math.max(0,Math.min(100,100-b.usedPercent)),n=m<=10?"#c62828":m<=30?"#d29a2f":c;return(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:[l("limits.left")," ",(0,d.jsxs)("span",{className:`font-bold tabular-nums ${m<=30?"":"text-ink"}`,style:m<=30?{color:n}:void 0,children:[Math.round(m),"%"]})]})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(m,1.5)+"%",backgroundColor:n}})}),b.resetsAt?(0,d.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:l("limits.reset",{eta:(f=b.resetsAt,h=p(),(i=f-e)<=60?s(h,"limits.now"):i<5400?s(h,"limits.inMin",{n:Math.round(i/60)}):i<129600?s(h,"limits.inHour",{n:Math.round(i/3600)}):s(h,"limits.inDay",{n:Math.round(i/86400)})),at:(g=b.resetsAt,k=(j=new Date(1e3*g)).toLocaleTimeString(dJ(),{hour:"2-digit",minute:"2-digit",hour12:!1}),g-e<86400?k:j.toLocaleDateString(dJ(),{day:"numeric",month:"short"})+" "+k)})}):null]})}function dL({label:a,engine:b,limits:c,now:e,staleHint:f}){let{t:g}=t();if(!c||!c.session&&!c.weekly)return null;let h=Z[b]??$,i=c.capturedAt&&e-c.capturedAt>1200?W(c.capturedAt):null;return(0,d.jsxs)("div",{className:`mt-2.5 first:mt-0 ${f?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:h.color},children:a}),c.plan?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:c.plan}):null,f?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:f}):null,i?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:g("limits.stale",{stale:i})}):null]}),(0,d.jsx)(dK,{label:g("limits.5h"),window:c.session,engineColor:h.color,now:e}),(0,d.jsx)(dK,{label:g("limits.week"),window:c.weekly,engineColor:h.color,now:e})]})}function dM(){let{locale:a}=t(),[b,c]=(0,e.useState)(null);if(!b||!b.data.claude&&!b.data.codex)return null;let f=function(a,b){if(!a)return null;let c=new Date(a);return Number.isNaN(c.getTime())?null:s(b,"limits.asOf",{time:c.toLocaleTimeString(dJ(b),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(b.data.staleSince,a);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,d.jsx)(dL,{label:"Claude",engine:"claude",limits:b.data.claude,now:b.at,staleHint:f}),(0,d.jsx)(dL,{label:"Codex",engine:"codex",limits:b.data.codex,now:b.at,staleHint:f})]})}let dN=k("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),dO=k("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function dP(){let{t:a}=t(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),h=async()=>{if(!f||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let a=await navigator.serviceWorker.register("/question-push-sw.js"),b=await a.pushManager.getSubscription();if(b){await b.unsubscribe(),c(!1);return}let d=await (await fetch("/api/push")).json(),e=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(a){let b=atob((a+"=".repeat((4-a.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),c=new Uint8Array(b.length);for(let a=0;a<b.length;a+=1)c[a]=b.charCodeAt(a);return c.buffer.slice(0)}(d.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),c(!0)};return(0,d.jsx)("button",{className:"inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(f?b?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":a(f?b?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":b,disabled:!f,onClick:h,children:b?(0,d.jsx)(dN,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(dO,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function dQ({files:a,archivedProjects:b,selected:c,onSelect:f}){let{t:g}=t(),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),l=(0,e.useMemo)(()=>D(a),[a]),m=(0,e.useMemo)(()=>{let a=h.trim().toLowerCase();return a?l.filter(b=>b.project.toLowerCase().includes(a)):l},[l,h]),n=(0,e.useMemo)(()=>m.filter(a=>!b.has(a.project)),[m,b]),o=(0,e.useMemo)(()=>m.filter(a=>b.has(a.project)),[m,b]),p=(0,e.useMemo)(()=>l.reduce((a,b)=>a+b.liveCount,0),[l]),q=(0,e.useMemo)(()=>l.reduce((a,b)=>a+b.attentionCount,0),[l]);return(0,d.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[g("rail.title"),p?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[10.5px] font-bold text-ok",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),p]}):null,q?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#fff1ca] px-2 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",q]}):null,(0,d.jsx)(dI,{}),(0,d.jsx)(dH,{}),(0,d.jsx)(dP,{})]}),(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,d.jsx)("input",{className:"w-full rounded-[9px] border border-line bg-bg px-2.5 py-1.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40",placeholder:g("rail.filter"),value:h,onChange:a=>i(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":g("rail.projects"),children:[(0,d.jsx)(dR,{label:g("rail.overview"),live:0,attention:0,total:null,age:"",active:c===v,hasLive:!1,onClick:()=>f(v)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(bm,{children:n.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(dR,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:W(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)})},a.project))}),o.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsxs)("button",{type:"button",className:"mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 py-1.5 text-left text-[11.5px] font-bold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":j,onClick:()=>k(a=>!a),children:[(0,d.jsx)(aI,{className:`h-3 w-3 shrink-0 transition-transform ${j?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(aA,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),g("rail.archive"),(0,d.jsx)("span",{className:"font-semibold",children:o.length})]}),j?o.map(a=>(0,d.jsx)(dR,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:W(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>f(a.project)},a.project)):null]}):null,n.length||o.length?null:(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:g("common.nothingFound")})]}),(0,d.jsx)(dM,{})]})}function dR({label:a,live:b,attention:c,total:e,age:f,active:g,hasLive:h,onClick:i}){return(0,d.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",g?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":g?"page":void 0,onClick:i,children:[(0,d.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",h?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:`block truncate text-[13px] ${g?"font-bold":"font-semibold"}`,children:a}),f?(0,d.jsx)("span",{className:"block text-[10.5px] text-dim",children:f}):null]}),b>0?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:b}):null,c>0?(0,d.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",c]}):null,null!==e?(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e}):null]})}function dS(){let a,{t:b}=t(),{files:c,flows:f}=function(){let[a,b]=(0,e.useState)(as);return a}(),g=(a=(0,e.useSyncExternalStore)(L,()=>J,()=>M),(0,e.useMemo)(()=>f.some(b=>a.has(b.id)&&"closed"!==b.state)?f.map(b=>a.has(b.id)&&"closed"!==b.state?{...b,state:"closed",closedAt:b.closedAt??new Date().toISOString()}:b):f,[f,a]));(0,e.useRef)(null);let{archivedProjects:h,archiveProject:i,unarchiveProject:j}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedProjects:a,archiveProject:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,ar(d),d})},[]),unarchiveProject:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,ar(d),d})},[])}}(),k=av(),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(v),[q,r]=(0,e.useState)(null),[s,u]=(0,e.useState)(null);(0,e.useRef)(null);let[w,x]=(0,e.useState)(0),y=(0,e.useCallback)(a=>{p(a),localStorage.setItem("llvProject",a),a!==v?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname),n(!1)},[]),z=(0,e.useCallback)(a=>{let b=C(a);dD(b,a.path),y(b),x(a=>a+1)},[y]),A=s?c.find(a=>a.path===s):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[k?null:(0,d.jsx)(dQ,{files:c,archivedProjects:h,selected:o,onSelect:y}),k&&m?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,d.jsx)(dQ,{files:c,archivedProjects:h,selected:o,onSelect:y}),(0,d.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":b("viewer.closeProjects"),onClick:()=>n(!1)})]}):null,(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[A?(0,d.jsxs)("div",{className:"fixed right-4 top-4 z-50 flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,d.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{z(A),u(null)},children:[(0,d.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:b("viewer.agentWaiting")}),(0,d.jsx)("span",{className:"line-clamp-2",children:A.title})]}),(0,d.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("viewer.closeNotification"),onClick:()=>u(null),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null,o===v?(0,d.jsx)(ax,{files:c,archivedProjects:h,onSelectProject:y,onSelectFile:z,onMenu:k?()=>n(!0):void 0}):(0,d.jsx)(dE,{files:c,flows:g,project:o,openNonce:w,archived:h.has(o),onArchive:i,onUnarchive:j,onMenu:k?()=>n(!0):void 0})]})]})}},57784:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},60728:()=>{},61135:()=>{},61744:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68673:(a,b,c)=>{Promise.resolve().then(c.bind(c,27074))},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},74075:a=>{"use strict";a.exports=require("zlib")},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g,metadata:()=>e,viewport:()=>f});var d=c(5735);c(61135);let e={title:"Live logs",description:"Live viewer for Codex/Claude agent logs"},f={width:"device-width",initialScale:1,viewportFit:"cover",interactiveWidget:"resizes-content"};function g({children:a}){return(0,d.jsx)("html",{lang:"en",className:"h-full antialiased",children:(0,d.jsx)("body",{className:"h-dvh overflow-hidden font-sans text-[15px]",children:a})})}},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},78335:()=>{},78464:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>O,handler:()=>Q,routeModule:()=>P});var d=c(7553),e=c(84006),f=c(67798),g=c(34775),h=c(99373),i=c(73461),j=c(1020),k=c(26349),l=c(54365),m=c(16023),n=c(14965),o=c(63747),p=c(24235),q=c(23938),r=c(261),s=c(66758),t=c(77243),u=c(26713),v=c(37527),w=c(22820),x=c(88216),y=c(47929),z=c(79551),A=c(71797),B=c(89125),C=c(86439),D=c(77068),E=c(27269),F=c(37525),G=c(61287),H=c(81494),I=c(70722),J=c(70753),K=c(43954),L=c(17891),M={};for(let a in G)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(M[a]=()=>G[a]);c.d(b,M);let N={children:["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,4494)),"/home/latand/.agents/tools/live-log-viewer-next/src/app/page.tsx"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,76537)),"/home/latand/.agents/tools/live-log-viewer-next/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,O={require:c,loadChunk:()=>Promise.resolve()},P=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:N},distDir:".next",relativeProjectDir:""});async function Q(a,b,d){var M,R,S,T,U;d.requestMeta&&(0,h.setRequestMeta)(a,d.requestMeta),P.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let V=!!(0,h.getRequestMeta)(a,"minimalMode"),W="/page";"/index"===W&&(W="/");let X=await P.prepare(a,b,{srcPage:W,multiZoneDraftMode:!1});if(!X)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Y,query:Z,params:$,pageIsDynamic:_,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,serverActionsManifest:ad,clientReferenceManifest:ae,subresourceIntegrityManifest:af,prerenderManifest:ag,isDraftMode:ah,resolvedPathname:ai,revalidateOnlyGenerated:aj,routerServerContext:ak,nextConfig:al,parsedUrl:am,interceptionRoutePatterns:an,deploymentId:ao,clientAssetToken:ap}=X,aq=(0,r.normalizeAppPath)(W),{isOnDemandRevalidate:ar}=X,as=al.experimental.ppr&&!al.cacheComponents&&(0,K.isInterceptionRouteAppPath)(ai)?null:P.match(ai,ag),at=(null==as?void 0:as.route)??null,au=!!ag.routes[ai],av=a.headers["user-agent"]||"",aw=(0,u.getBotType)(av),ax=(0,q.isHtmlBotRequest)(a),ay=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],az=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[t.RSC_HEADER]),aA=(0,s.getIsPossibleServerAction)(a),aB=(0,m.checkIsAppPPREnabled)(al.experimental.ppr),aC=a.headers[y.NEXT_RESUME_STATE_LENGTH_HEADER];if(!(0,h.getRequestMeta)(a,"postponed")&&V&&aB&&aA&&aC&&"string"==typeof aC){let e=parseInt(aC,10),{maxPostponedStateSize:f,maxPostponedStateSizeBytes:g}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize);if(!isNaN(e)&&e>0){if(e>g)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(f)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let i="1 MB",j=(null==(U=al.experimental.serverActions)?void 0:U.bodySizeLimit)??i,k=e+(j!==i?c(95726).parse(j):1048576),l=await (0,E.readBodyWithSizeLimit)(a,k);if(null===l)return b.statusCode=413,b.end("Request body exceeded limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;if(l.length>=e){let b=l.subarray(0,e).toString("utf8");(0,h.addRequestMeta)(a,"postponed",b);let c=l.subarray(e);(0,h.addRequestMeta)(a,"actionBody",c)}else throw Object.defineProperty(Error(`invariant: expected ${e} bytes of postponed state but only received ${l.length} bytes`),"__NEXT_ERROR_CODE",{value:"E979",enumerable:!1,configurable:!0})}}if(!(0,h.getRequestMeta)(a,"postponed")&&aB&&"1"===a.headers[y.NEXT_RESUME_HEADER]&&"POST"===a.method){let{maxPostponedStateSize:c,maxPostponedStateSizeBytes:e}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize),f=await (0,E.readBodyWithSizeLimit)(a,e);if(null===f)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(c)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let g=f.toString("utf8");(0,h.addRequestMeta)(a,"postponed",g)}let aD=!0===P.isDev||!0===al.experimental.exposeTestingApiInProductionBuild,aE=aD&&("1"===a.headers[t.NEXT_INSTANT_PREFETCH_HEADER]||!(0,n.f)(a.headers[t.RSC_HEADER])&&"string"==typeof a.headers.cookie&&a.headers.cookie.includes(t.NEXT_INSTANT_TEST_COOKIE+"=")),aF=(aB||aE)&&((null==(M=ag.routes[aq]??ag.dynamicRoutes[aq])?void 0:M.renderingMode)==="PARTIALLY_STATIC"||aE&&(aD||(null==ak?void 0:ak.experimentalTestProxy)===!0)),aG=aE&&aF,aH=aG&&!0===P.isDev,aI=!1,aJ=aF?(0,h.getRequestMeta)(a,"postponed"):void 0,aK=null==(R=ag.routes[ai])?void 0:R.prefetchDataRoute,aL=aF&&az&&!ay&&!aK;V&&(aL=aL&&!!aJ);let aM=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),aN=(!aw||!aF)&&(!av||(0,q.shouldServeStreamingMetadata)(av,al.htmlLimitedBots)),aO=!!((at||au||ag.routes[aq])&&!(aw&&aF)),aP=aF&&!0===al.cacheComponents,aQ=!0===P.isDev||!aO||"string"==typeof aJ||(aP&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aL&&!V:aL),aR=!!aw&&aF,aS=(null==at?void 0:at.remainingPrerenderableParams)??[],aT=(null==at?void 0:at.fallback)===null&&((null==(S=at.fallbackRootParams)?void 0:S.length)??0)>0,aU=null;if(!ah&&aO&&!aQ&&!aA&&!aJ&&!aL){let a=as?"string"==typeof(null==at?void 0:at.fallback)?at.fallback:as.source:null;if(!0===al.experimental.partialFallbacks&&a&&(null==at?void 0:at.fallbackRouteParams)&&!aT){if(aS.length>0){let b,c=(b=new Map(aS.map(a=>[a.paramName,a])),a.split("/").map(a=>{let c=(0,L.getSegmentParam)(a);if(!c)return a;let d=b.get(c.paramName);if(!d)return a;let e=null==$?void 0:$[d.paramName];if(!e)return a;let f=Array.isArray(e)?e.map(a=>encodeURIComponent(a)).join("/"):encodeURIComponent(e);return a.replace((0,o.buildDynamicSegmentPlaceholder)(d),f)}).join("/")||"/");aU=c!==a?c:null}}else aU=ai}let aV=aU;!aV&&(P.isDev||aO&&_&&(null==at?void 0:at.fallbackRouteParams)&&!aA)&&(aV=ai),P.isDev||ah||!aO||!az||aL||(0,k.d)(a.headers);let aW={...G,tree:N,handler:Q,routeModule:P,__next_app__:O};ad&&ae&&(0,p.setManifestsSingleton)({page:W,clientReferenceManifest:ae,serverActionsManifest:ad});let aX=a.method||"GET",aY=(0,g.getTracer)(),aZ=aY.getActiveScopeSpan(),a$=!!(null==ak?void 0:ak.isWrappedByNextServer),a_=!0===al.experimental.partialFallbacks&&aS.length>0?(null==at||null==(T=at.fallbackRouteParams)?void 0:T.filter(a=>!aS.some(b=>b.paramName===a.paramName)))??[]:[],a0=async()=>((null==ak?void 0:ak.render404)?await ak.render404(a,b,am,!1):b.end("This page could not be found"),null);try{let k,m=P.getVaryHeader(ai,an);b.setHeader("Vary",m);let n=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return P.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aY.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aX} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a),k&&k!==c&&(k.setAttribute("http.route",d),k.updateName(a))}else c.updateName(`${aX} ${W}`)})},p=(0,h.getRequestMeta)(a,"incrementalCache")||await P.getIncrementalCache(a,al,ag,V);null==p||p.resetRequestCache(),globalThis.__incrementalCache=p;let q=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let k={query:Z,params:$,page:aq,sharedContext:{buildId:Y,deploymentId:ao,clientAssetToken:ap},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aW,Component:(0,j.T)(aW),params:$,routeModule:P,page:W,postponed:f,shouldWaitOnAllReady:aR,serveStreamingMetadata:aN,supportsDynamicResponse:"string"==typeof f||aQ,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,subresourceIntegrityManifest:af,setCacheStatus:null==ak?void 0:ak.setCacheStatus,setIsrStatus:null==ak?void 0:ak.setIsrStatus,setReactDebugChannel:null==ak?void 0:ak.setReactDebugChannel,sendErrorsToBrowser:null==ak?void 0:ak.sendErrorsToBrowser,dir:c(33873).join(process.cwd(),P.relativeProjectDir),isDraftMode:ah,botType:aw,isOnDemandRevalidate:ar,isPossibleServerAction:aA,assetPrefix:al.assetPrefix,nextConfigOutput:al.output,crossOrigin:al.crossOrigin,trailingSlash:al.trailingSlash,images:al.images,previewProps:ag.preview,enableTainting:al.experimental.taint,htmlLimitedBots:al.htmlLimitedBots,reactMaxHeadersLength:al.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:p,cacheLifeProfiles:al.cacheLife,basePath:al.basePath,serverActions:al.experimental.serverActions,logServerFunctions:"object"==typeof al.logging&&!!al.logging.serverFunctions,...aG||aH||aI?{isBuildTimePrerendering:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:aH}:{},cacheComponents:!!al.cacheComponents,experimental:{isRoutePPREnabled:aF,expireTime:al.expireTime,staleTimes:al.experimental.staleTimes,dynamicOnHover:!!al.experimental.dynamicOnHover,optimisticRouting:!!al.experimental.optimisticRouting,inlineCss:!!al.experimental.inlineCss,prefetchInlining:al.experimental.prefetchInlining??!1,authInterrupts:!!al.experimental.authInterrupts,cachedNavigations:!!al.experimental.cachedNavigations,clientTraceMetadata:al.experimental.clientTraceMetadata||[],clientParamParsingOrigins:al.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,D.parseMaxPostponedStateSize)(al.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>P.onRequestError(a,b,d,e,ak),err:(0,h.getRequestMeta)(a,"invokeError")}};i&&(k.renderOpts.supportsDynamicResponse=!1);let l=await n(e,k),{metadata:m}=l,{cacheControl:o,headers:q={},fetchTags:r,fetchMetrics:s}=m;if(r&&(q[y.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,aO&&(null==o?void 0:o.revalidate)===0&&!P.isDev&&!aF){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ai}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
3
- see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},79428:a=>{"use strict";a.exports=require("buffer")},81825:(a,b,c)=>{Promise.resolve().then(c.bind(c,55096))},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[445,319,918],()=>b(b.s=78464));module.exports=c})();
1
+ (()=>{var a={};a.id=974,a.ids=[974],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>f});var d=c(5735),e=c(27074);function f(){return(0,d.jsx)(e.Viewer,{})}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},17891:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/get-segment-param")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},25880:()=>{},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26896:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23)),Promise.resolve().then(c.t.bind(c,15098,23)),Promise.resolve().then(c.t.bind(c,47644,23)),Promise.resolve().then(c.t.bind(c,33859,23)),Promise.resolve().then(c.t.bind(c,98099,23)),Promise.resolve().then(c.t.bind(c,16237,23)),Promise.resolve().then(c.t.bind(c,98562,23)),Promise.resolve().then(c.t.bind(c,36675,23))},27074:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call Viewer() from the server but Viewer is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/latand/.agents/tools/live-log-viewer-next/src/components/Viewer.tsx","Viewer")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},43954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},48056:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,95547,23))},57784:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23))},59215:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>O,handler:()=>Q,routeModule:()=>P});var d=c(7553),e=c(84006),f=c(67798),g=c(34775),h=c(99373),i=c(73461),j=c(1020),k=c(26349),l=c(54365),m=c(16023),n=c(14965),o=c(63747),p=c(24235),q=c(23938),r=c(261),s=c(66758),t=c(77243),u=c(26713),v=c(37527),w=c(22820),x=c(88216),y=c(47929),z=c(79551),A=c(71797),B=c(89125),C=c(86439),D=c(77068),E=c(27269),F=c(37525),G=c(61287),H=c(81494),I=c(70722),J=c(70753),K=c(43954),L=c(17891),M={};for(let a in G)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(M[a]=()=>G[a]);c.d(b,M);let N={children:["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,4494)),"/home/latand/.agents/tools/live-log-viewer-next/src/app/page.tsx"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,76537)),"/home/latand/.agents/tools/live-log-viewer-next/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,95547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,55091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,45270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,28193,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,70440))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}},[]]}.children,O={require:c,loadChunk:()=>Promise.resolve()},P=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:N},distDir:".next",relativeProjectDir:""});async function Q(a,b,d){var M,R,S,T,U;d.requestMeta&&(0,h.setRequestMeta)(a,d.requestMeta),P.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let V=!!(0,h.getRequestMeta)(a,"minimalMode"),W="/page";"/index"===W&&(W="/");let X=await P.prepare(a,b,{srcPage:W,multiZoneDraftMode:!1});if(!X)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Y,query:Z,params:$,pageIsDynamic:_,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,serverActionsManifest:ad,clientReferenceManifest:ae,subresourceIntegrityManifest:af,prerenderManifest:ag,isDraftMode:ah,resolvedPathname:ai,revalidateOnlyGenerated:aj,routerServerContext:ak,nextConfig:al,parsedUrl:am,interceptionRoutePatterns:an,deploymentId:ao,clientAssetToken:ap}=X,aq=(0,r.normalizeAppPath)(W),{isOnDemandRevalidate:ar}=X,as=al.experimental.ppr&&!al.cacheComponents&&(0,K.isInterceptionRouteAppPath)(ai)?null:P.match(ai,ag),at=(null==as?void 0:as.route)??null,au=!!ag.routes[ai],av=a.headers["user-agent"]||"",aw=(0,u.getBotType)(av),ax=(0,q.isHtmlBotRequest)(a),ay=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],az=(0,h.getRequestMeta)(a,"isRSCRequest")??(0,n.f)(a.headers[t.RSC_HEADER]),aA=(0,s.getIsPossibleServerAction)(a),aB=(0,m.checkIsAppPPREnabled)(al.experimental.ppr),aC=a.headers[y.NEXT_RESUME_STATE_LENGTH_HEADER];if(!(0,h.getRequestMeta)(a,"postponed")&&V&&aB&&aA&&aC&&"string"==typeof aC){let e=parseInt(aC,10),{maxPostponedStateSize:f,maxPostponedStateSizeBytes:g}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize);if(!isNaN(e)&&e>0){if(e>g)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(f)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let i="1 MB",j=(null==(U=al.experimental.serverActions)?void 0:U.bodySizeLimit)??i,k=e+(j!==i?c(95726).parse(j):1048576),l=await (0,E.readBodyWithSizeLimit)(a,k);if(null===l)return b.statusCode=413,b.end("Request body exceeded limit. To configure the body size limit for Server Actions, see: https://nextjs.org/docs/app/api-reference/next-config-js/serverActions#bodysizelimit"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;if(l.length>=e){let b=l.subarray(0,e).toString("utf8");(0,h.addRequestMeta)(a,"postponed",b);let c=l.subarray(e);(0,h.addRequestMeta)(a,"actionBody",c)}else throw Object.defineProperty(Error(`invariant: expected ${e} bytes of postponed state but only received ${l.length} bytes`),"__NEXT_ERROR_CODE",{value:"E979",enumerable:!1,configurable:!0})}}if(!(0,h.getRequestMeta)(a,"postponed")&&aB&&"1"===a.headers[y.NEXT_RESUME_HEADER]&&"POST"===a.method){let{maxPostponedStateSize:c,maxPostponedStateSizeBytes:e}=(0,E.getMaxPostponedStateSize)(al.experimental.maxPostponedStateSize),f=await (0,E.readBodyWithSizeLimit)(a,e);if(null===f)return b.statusCode=413,b.end((0,E.getPostponedStateExceededErrorMessage)(c)),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let g=f.toString("utf8");(0,h.addRequestMeta)(a,"postponed",g)}let aD=!0===P.isDev||!0===al.experimental.exposeTestingApiInProductionBuild,aE=aD&&("1"===a.headers[t.NEXT_INSTANT_PREFETCH_HEADER]||!(0,n.f)(a.headers[t.RSC_HEADER])&&"string"==typeof a.headers.cookie&&a.headers.cookie.includes(t.NEXT_INSTANT_TEST_COOKIE+"=")),aF=(aB||aE)&&((null==(M=ag.routes[aq]??ag.dynamicRoutes[aq])?void 0:M.renderingMode)==="PARTIALLY_STATIC"||aE&&(aD||(null==ak?void 0:ak.experimentalTestProxy)===!0)),aG=aE&&aF,aH=aG&&!0===P.isDev,aI=!1,aJ=aF?(0,h.getRequestMeta)(a,"postponed"):void 0,aK=null==(R=ag.routes[ai])?void 0:R.prefetchDataRoute,aL=aF&&az&&!ay&&!aK;V&&(aL=aL&&!!aJ);let aM=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),aN=(!aw||!aF)&&(!av||(0,q.shouldServeStreamingMetadata)(av,al.htmlLimitedBots)),aO=!!((at||au||ag.routes[aq])&&!(aw&&aF)),aP=aF&&!0===al.cacheComponents,aQ=!0===P.isDev||!aO||"string"==typeof aJ||(aP&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aL&&!V:aL),aR=!!aw&&aF,aS=(null==at?void 0:at.remainingPrerenderableParams)??[],aT=(null==at?void 0:at.fallback)===null&&((null==(S=at.fallbackRootParams)?void 0:S.length)??0)>0,aU=null;if(!ah&&aO&&!aQ&&!aA&&!aJ&&!aL){let a=as?"string"==typeof(null==at?void 0:at.fallback)?at.fallback:as.source:null;if(!0===al.experimental.partialFallbacks&&a&&(null==at?void 0:at.fallbackRouteParams)&&!aT){if(aS.length>0){let b,c=(b=new Map(aS.map(a=>[a.paramName,a])),a.split("/").map(a=>{let c=(0,L.getSegmentParam)(a);if(!c)return a;let d=b.get(c.paramName);if(!d)return a;let e=null==$?void 0:$[d.paramName];if(!e)return a;let f=Array.isArray(e)?e.map(a=>encodeURIComponent(a)).join("/"):encodeURIComponent(e);return a.replace((0,o.buildDynamicSegmentPlaceholder)(d),f)}).join("/")||"/");aU=c!==a?c:null}}else aU=ai}let aV=aU;!aV&&(P.isDev||aO&&_&&(null==at?void 0:at.fallbackRouteParams)&&!aA)&&(aV=ai),P.isDev||ah||!aO||!az||aL||(0,k.d)(a.headers);let aW={...G,tree:N,handler:Q,routeModule:P,__next_app__:O};ad&&ae&&(0,p.setManifestsSingleton)({page:W,clientReferenceManifest:ae,serverActionsManifest:ad});let aX=a.method||"GET",aY=(0,g.getTracer)(),aZ=aY.getActiveScopeSpan(),a$=!!(null==ak?void 0:ak.isWrappedByNextServer),a_=!0===al.experimental.partialFallbacks&&aS.length>0?(null==at||null==(T=at.fallbackRouteParams)?void 0:T.filter(a=>!aS.some(b=>b.paramName===a.paramName)))??[]:[],a0=async()=>((null==ak?void 0:ak.render404)?await ak.render404(a,b,am,!1):b.end("This page could not be found"),null);try{let k,m=P.getVaryHeader(ai,an);b.setHeader("Vary",m);let n=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return P.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aY.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aX} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a),k&&k!==c&&(k.setAttribute("http.route",d),k.updateName(a))}else c.updateName(`${aX} ${W}`)})},p=(0,h.getRequestMeta)(a,"incrementalCache")||await P.getIncrementalCache(a,al,ag,V);null==p||p.resetRequestCache(),globalThis.__incrementalCache=p;let q=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let k={query:Z,params:$,page:aq,sharedContext:{buildId:Y,deploymentId:ao,clientAssetToken:ap},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aW,Component:(0,j.T)(aW),params:$,routeModule:P,page:W,postponed:f,shouldWaitOnAllReady:aR,serveStreamingMetadata:aN,supportsDynamicResponse:"string"==typeof f||aQ,buildManifest:aa,nextFontManifest:ab,reactLoadableManifest:ac,subresourceIntegrityManifest:af,setCacheStatus:null==ak?void 0:ak.setCacheStatus,setIsrStatus:null==ak?void 0:ak.setIsrStatus,setReactDebugChannel:null==ak?void 0:ak.setReactDebugChannel,sendErrorsToBrowser:null==ak?void 0:ak.sendErrorsToBrowser,dir:c(33873).join(process.cwd(),P.relativeProjectDir),isDraftMode:ah,botType:aw,isOnDemandRevalidate:ar,isPossibleServerAction:aA,assetPrefix:al.assetPrefix,nextConfigOutput:al.output,crossOrigin:al.crossOrigin,trailingSlash:al.trailingSlash,images:al.images,previewProps:ag.preview,enableTainting:al.experimental.taint,htmlLimitedBots:al.htmlLimitedBots,reactMaxHeadersLength:al.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:p,cacheLifeProfiles:al.cacheLife,basePath:al.basePath,serverActions:al.experimental.serverActions,logServerFunctions:"object"==typeof al.logging&&!!al.logging.serverFunctions,...aG||aH||aI?{isBuildTimePrerendering:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:aH}:{},cacheComponents:!!al.cacheComponents,experimental:{isRoutePPREnabled:aF,expireTime:al.expireTime,staleTimes:al.experimental.staleTimes,dynamicOnHover:!!al.experimental.dynamicOnHover,optimisticRouting:!!al.experimental.optimisticRouting,inlineCss:!!al.experimental.inlineCss,prefetchInlining:al.experimental.prefetchInlining??!1,authInterrupts:!!al.experimental.authInterrupts,cachedNavigations:!!al.experimental.cachedNavigations,clientTraceMetadata:al.experimental.clientTraceMetadata||[],clientParamParsingOrigins:al.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,D.parseMaxPostponedStateSize)(al.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>P.onRequestError(a,b,d,e,ak),err:(0,h.getRequestMeta)(a,"invokeError")}};i&&(k.renderOpts.supportsDynamicResponse=!1);let l=await n(e,k),{metadata:m}=l,{cacheControl:o,headers:q={},fetchTags:r,fetchMetrics:s}=m;if(r&&(q[y.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,aO&&(null==o?void 0:o.revalidate)===0&&!P.isDev&&!aF){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${ai}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
2
+ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:v.CachedRouteKind.APP_PAGE,html:l,headers:q,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:o}},r=async({hasResolved:c,previousCacheEntry:g,isRevalidating:i,span:j,forceStaticRender:k=!1})=>{let l=!1===P.isDev,m=c||b.writableEnded;try{var n;let f;if(ar&&aj&&!g&&!V)return(null==ak?void 0:ak.render404)?await ak.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(at&&(f=(0,w.parseFallbackField)(at.fallback)),!0===al.experimental.partialFallbacks&&(null==at?void 0:at.fallback)===null&&!aT&&aS.length>0&&(f=w.FallbackMode.PRERENDER),f===w.FallbackMode.PRERENDER&&(0,u.isBot)(av)&&(!aF||ax)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==g?void 0:g.isStale)===-1&&(ar=!0),ar&&(f!==w.FallbackMode.NOT_FOUND||g)&&(f=w.FallbackMode.BLOCKING_STATIC_RENDER),!V&&f!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aV&&!m&&!ah&&_&&(l||!au)){if((l||at)&&f===w.FallbackMode.NOT_FOUND){if(al.adapterPath)return await a0();throw new C.NoFallbackError}if(aF&&(al.cacheComponents?!aL:!az)){let b=l&&"string"==typeof(null==at?void 0:at.fallback)?at.fallback:aq,f=(l||aG)&&(null==at?void 0:at.fallbackRouteParams)?(0,o.createOpaqueFallbackRouteParams)(at.fallbackRouteParams):aI?(0,o.getFallbackRouteParams)(aq,P):null;aG&&f&&(0,h.addRequestMeta)(a,"fallbackParams",f);let g=await P.handleResponse({cacheKey:b,req:a,nextConfig:al,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:ag,isRoutePPREnabled:aF,responseGenerator:async()=>q({span:j,postponed:void 0,fallbackRouteParams:f,forceStaticRender:!0}),waitUntil:d.waitUntil,isMinimalMode:V});if(null===g)return null;if(g)return V||!aF||!(aS.length>0)||!0!==al.experimental.partialFallbacks||!aU||!p||ar||aI||aD||aE||ay||(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(aU,p,aF,!1,a=>q({span:a.span,postponed:void 0,fallbackRouteParams:a_.length>0?(0,o.createOpaqueFallbackRouteParams)(a_):null,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}),delete g.cacheControl,g}}let s=ar||i||!aJ?void 0:aJ;if(aP&&!V&&p&&(aL||aA)&&!k){let b=await p.get(ai,{kind:v.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===v.CachedRouteKind.APP_PAGE&&(s=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,J.scheduleOnNextTick)(async()=>{let b=P.getResponseCache(a);try{await b.revalidate(ai,p,aF,!1,a=>r({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if((aG||aH)&&void 0!==s)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let t=!P.isDev&&_&&(null==at?void 0:at.fallbackRouteParams)?(0,o.getPlaceholderFallbackRouteParams)($,at.fallbackRouteParams):null,y=t&&t.length>0?t:null==at?void 0:at.fallbackRouteParams,z=null!=t&&t.length>0,A=null;if(al.cacheComponents&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,h.getRequestMeta)(a,"resolvedRouteParamKeys");b&&b.size>0&&(A=at.fallbackRouteParams.filter(a=>!b.has(a.paramName)))}let B=(l&&(0,h.getRequestMeta)(a,"renderFallbackShell")||z||aG&&!au)&&y?(0,o.createOpaqueFallbackRouteParams)(y):A&&A.length>0&&A.length<((null==at||null==(n=at.fallbackRouteParams)?void 0:n.length)??0)?(0,o.createOpaqueFallbackRouteParams)(A):aI?(0,o.getFallbackRouteParams)(aq,P):null;if((l||aG)&&al.cacheComponents&&!au&&(null==at?void 0:at.fallbackRouteParams)){let b=(0,o.createOpaqueFallbackRouteParams)(y??at.fallbackRouteParams);b&&(0,h.addRequestMeta)(a,"fallbackParams",b)}return q({span:j,postponed:s,fallbackRouteParams:B,forceStaticRender:k})}catch(b){throw(null==g?void 0:g.isStale)&&await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}},s=async c=>{var f,g,i,j,k,l;let m,n=await P.handleResponse({cacheKey:aU,responseGenerator:a=>r({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ar,isRoutePPREnabled:aF,req:a,nextConfig:al,prerenderManifest:ag,waitUntil:d.waitUntil,isMinimalMode:V});if(ah&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),P.isDev&&b.setHeader("Cache-Control","no-cache, must-revalidate"),!n){if(aU)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let o="string"==typeof n.value.postponed;az&&!aA&&ao&&b.setHeader(y.NEXT_NAV_DEPLOYMENT_ID_HEADER,ao),aO&&!aL&&(!o||ay)&&(V||b.setHeader("x-nextjs-cache",ar?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:p}=n;if(aJ)m={revalidate:0,expire:void 0};else if(aL)m={revalidate:0,expire:void 0};else if(!P.isDev)if(ah)m={revalidate:0,expire:void 0};else if(aO){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});m={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??al.expireTime}}else m={revalidate:y.CACHE_ONE_YEAR_SECONDS,expire:void 0}}else b.getHeader("Cache-Control")||(m={revalidate:0,expire:void 0});if(n.cacheControl=m,"string"==typeof aM&&(null==p?void 0:p.kind)===v.CachedRouteKind.APP_PAGE&&p.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=p.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];V&&aO&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=p.segmentData.get(aM);return void 0!==d?(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let s=aP?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(s){let b=(0,h.getRequestMeta)(a,"initURL")??a.url,c=b?(null==(l=(0,F.parseUrl)(b))?void 0:l.pathname)??b:void 0;if(await s(n,{url:c}))return null}if(p.headers){let a={...p.headers};for(let[c,d]of(V&&aO||delete a[y.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let u=null==(g=p.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(V&&aO&&u&&"string"==typeof u&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,u),!p.status||az&&aF||(b.statusCode=p.status),!V&&p.status&&H.RedirectStatusCode[p.status]&&az&&(b.statusCode=200),o&&!aL&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),az&&!ah){if(void 0===p.rscData){if(p.html.contentType!==t.RSC_CONTENT_TYPE_HEADER)if(al.cacheComponents)return b.statusCode=404,(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl});else throw Object.defineProperty(new I.InvariantError(`Expected RSC response, got ${p.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:p.html,cacheControl:n.cacheControl})}return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:x.default.fromStatic(p.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let w=p.html;if(aE&&aG){let c=!0===P.isDev?crypto.randomUUID():null;return w.pipeThrough(await (0,A.createInstantTestScriptInsertionTransformStream)(c)),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})}if(!o||V||az)return(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:n.cacheControl});if(aG||aH)return w.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}});let C=new TransformStream;return w.push(C.readable),q({span:c,postponed:p.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(C.writable)}).catch(a=>{C.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,B.sendRenderResult)({req:a,res:b,generateEtags:al.generateEtags,poweredByHeader:al.poweredByHeader,result:w,cacheControl:{revalidate:0,expire:void 0}})};if(!a$||!aZ)return k=aY.getActiveScopeSpan(),await aY.withPropagatedContext(a.headers,()=>aY.trace(i.BaseServerSpan.handleRequest,{spanName:`${aX} ${W}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aX,"http.target":a.url}},s),void 0,!a$);await s(aZ)}catch(b){throw b instanceof C.NoFallbackError||await P.onRequestError(a,b,{routerKind:"App Router",routePath:W,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:aO,isOnDemandRevalidate:ar})},!1,ak),b}}},60073:(a,b,c)=>{"use strict";c.d(b,{Viewer:()=>eR});var d=c(48249),e=c(67484);let f=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim(),g=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)};var h={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 i=(0,e.createContext)({}),j=(0,e.forwardRef)(({color:a,size:b,strokeWidth:c,absoluteStrokeWidth:d,className:g="",children:j,iconNode:k,...l},m)=>{let{size:n=24,strokeWidth:o=2,absoluteStrokeWidth:p=!1,color:q="currentColor",className:r=""}=(0,e.useContext)(i)??{},s=d??p?24*Number(c??o)/Number(b??n):c??o;return(0,e.createElement)("svg",{ref:m,...h,width:b??n??h.width,height:b??n??h.height,stroke:a??q,strokeWidth:s,className:f("lucide",r,g),...!j&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0;return!1})(l)&&{"aria-hidden":"true"},...l},[...k.map(([a,b])=>(0,e.createElement)(a,b)),...Array.isArray(j)?j:[j]])}),k=(a,b)=>{let c=(0,e.forwardRef)(({className:c,...d},h)=>(0,e.createElement)(j,{ref:h,iconNode:b,className:f(`lucide-${g(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=g(a),c},l=k("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),m=k("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),n={en:{"common.serverUnavailable":"server unavailable","common.loading":"loading…","common.loadingCap":"Loading…","common.cancel":"Cancel","common.show":"show","common.showAll":"show all","common.collapse":"collapse","common.yes":"Yes","common.no":"No","common.send":"Send","common.sending":"sending…","common.sent":"sent","common.close":"Close","common.failedSend":"couldn't send","common.failedDelete":"couldn't delete","common.nothingFound":"Nothing found","common.nothingRunning":"nothing is running right now","common.kb":"kB","common.chars":"{n} chars","lang.aria":"Interface language","util.effortTitle":"Reasoning effort: {effort}","time.agoSec":"{n}s ago","time.agoMin":"{n}m ago","time.agoHour":"{n}h ago","time.agoDay":"{n}d ago","kind.session":"session","kind.subagent":"subagent","kind.job":"job","kind.background":"background","kind.handoff":"handoff","rail.title":"Agent logs","rail.filter":"Filter projects…","rail.projects":"Projects","rail.overview":"Overview","rail.archive":"Archive","dash.branchesLive":{one:"{count} branch running",other:"{count} branches running"},"dash.trees":{one:"{count} tree",other:"{count} trees"},"dash.recentConvos":{one:"{count} recent conversation",other:"{count} recent conversations"},"dash.quietTrees":{one:"{count} quiet tree",other:"{count} quiet trees"},"dash.openProjects":"Open project list","dash.unarchive":"Restore from archive","dash.newConvo":"New conversation with an agent","dash.agent":"Agent","dash.emptyTitle":"The scheme is empty for now","dash.emptyHint":"Open the switchboard in the bottom-right corner and click a conversation — it will appear here","trash.title":"The scheme is empty, but the project has records","trash.hint":"Clicking a row opens the conversation as a node; the trash icon deletes its file from disk permanently.","trash.deletedFromDisk":"\xb7 deleted from disk","trash.open":"Open {title}","trash.toArchive":"Archive","trash.notDeleted":"{failed} of {total} not deleted","trash.confirmDelete":{one:"Delete {count} project file from disk?",other:"Delete {count} project files from disk?"},"trash.deleting":"deleting…","trash.confirmYes":"Yes, delete","trash.deleteProject":"Delete project from disk","switch.aria":"Agent switchboard","switch.title":"Switchboard","switch.search":"Search by name or project","switch.updating":"updating…","switch.close":"Close switchboard","switch.waiting":"Waiting for you","switch.working":"Working","switch.recent":"Recent","switch.older":"Older","switch.hidden":"Hidden ({count})","switch.hide":"hide","switch.restore":"restore","switchCard.openColumn":"Open {title} as a column","switchCard.remove":"Remove from switchboard","composer.imagesCount":{one:"{count} image",other:"{count} images"},"composer.spawned":"launched agent in tmux {target}","composer.sentPaths":"sent {count} path(s)","composer.failedInterrupt":"couldn't interrupt","composer.escapeSent":"sent Escape — agent interrupted","composer.spawnAria":"Launch an agent with a prompt in tmux","composer.sendAria":"Send a message to the agent in tmux {target}","composer.queueAria":"Queue of sent messages","composer.removeFromQueue":"Remove from queue","composer.placeholderRelay":"type — I'll relay through the root session…","composer.placeholderSpawn":"prompt — the agent will start in tmux…","composer.placeholderSend":"message the agent…","composer.textAria":"Text for the agent","composer.titleRelay":"relayed through the branch's root session","composer.titleSpawnResumed":"new tmux window with the resumed agent","composer.root":"root","composer.interruptAria":"Interrupt the agent (Escape)","composer.interruptTitle":"send Escape to the agent pane","composer.compactAria":"Compact the agent's context (/compact)","composer.compactTitle":"send /compact — the agent condenses its context; a band appears in the feed when done","composer.compactConfirm":"Compact?","composer.compactConfirmTitle":"Click again to send /compact","composer.compactSent":"compaction started — the band will appear in the feed once it's done","composer.failedCompact":"couldn't start compaction","composer.addImages":"Add images","composer.stopAndSend":"Stop recording and send","composer.launchAgent":"Launch the agent","composer.sendToAgent":"Send to the agent","composer.stopAndSendTitle":"stop recording and send","draft.readPrompt":"Read the agent conversation in file {src} and continue from there: ","draft.needDir":"specify a working directory","draft.launchFailed":"couldn't launch","draft.paneAria":"Draft of a new agent conversation","draft.notStarted":"agent not started yet","draft.engineAria":"Agent engine","draft.handoffLabel":"handoff: {title}","draft.newConvo":"new conversation","draft.conversation":"conversation","draft.dismiss":"Dismiss the draft conversation","draft.directory":"directory","draft.dirAria":"Agent working directory","draft.imagesOnly":"(images)","draft.launched":"agent launched in tmux {target} — waiting for the conversation to appear here…","draft.slow":"Taking a while. Check tmux window {target} — the panel will pick up the transcript as soon as it appears.","draft.hintRelay":"The new agent will first read the parent conversation's transcript and pick up from there. Add to the prompt what to do next — the branch will appear on the scheme alongside.","draft.hintNew":"Choose an engine and a directory, write the first prompt — the agent will start in tmux, and the conversation will continue in this same panel.","draft.promptAria":"First prompt for the new agent","draft.placeholder":"first prompt — the agent will start in tmux…","draft.promptTextAria":"First prompt text","draft.newWindowTitle":"new tmux window with a fresh agent","draft.newAgent":"new agent","draft.addImages":"Add images to the prompt","draft.stopAndLaunch":"Stop recording and launch the agent","link.handoffContext":"You've been handed another agent's context — the conversation \xab{title}\xbb. Its transcript: {path} — read that file first for full context, then carry out the request below.\n\n{ask}","link.dropped":"context is in the composer of \xab{title}\xbb — type the ask and send","handoff.aria":"Hand the conversation to a new agent — a draft appears below","handoff.title":"click — draft a new agent with this context \xb7 drag — link to an existing one","handoff.label":"hand off to agent","qr.showAria":"Show a QR code for phone login","qr.failed":"couldn't get the link","qr.startHint":"Start the viewer with Tailscale access: ","qr.alt":"QR code for phone login","qr.generating":"generating QR…","qr.linkAria":"Phone login link","qr.copy":"Copy link","qr.scanHint":"scan from a phone on the same tailnet","push.enabled":"Push notifications enabled","push.enable":"Enable push notifications","push.disable":"Disable push notifications","push.needsHttps":"Push requires HTTPS","sound.on":"Sound notifications on","sound.off":"Sound notifications off","sound.mute":"Mute sound notifications","sound.unmute":"Enable sound notifications","mic.stopRecognize":"Stop recording and transcribe","mic.cancel":"Cancel recording","mic.recognizing":"Transcribing…","mic.dictate":"Dictate","mic.dictateHint":"dictate (up to 2 min)","delFile.confirm":"Delete from disk?","delFile.aria":"Delete the conversation from disk","img.readFailed":"couldn't read the image","img.readAborted":"image reading aborted","img.unsupported":"unsupported image format: {name}","img.unknownFile":"unknown file","img.tooLarge":"{name}: too large (10 MB limit)","img.image":"image","img.error":"image error","img.previewAlt":"image preview {n}","img.removeAria":"Remove image {n}","img.toFilePaths":"as file paths","question.sec":"{n} s","question.min":"{n} min","question.hour":"{n} h","question.waiting":"waiting for a reply","question.sentToPane":"Sent to the pane: {text}","question.keysHint":"keys into the pane \xb7 or the composer below","question.pane":"Pane {target}","question.alreadyAnswered":"answer already recorded","question.openFailed":"couldn't open the session","question.opened":"opened {target}","question.answered":"Answered: {text}","question.answeredElsewhere":"Answered elsewhere: {text}","question.noPane":"tmux pane unavailable","question.openSession":"open session","question.rejectComment":"Rejection comment…","question.approved":"approved","question.rejected":"rejected","question.approve":"Approve","question.reject":"Reject","question.ownAnswer":"Your own answer…","inbox.deleted":"deleted from disk","inbox.fileGone":"the file is no longer on disk","inbox.confirmDelete":"Delete the file from disk?","inbox.deleteAria":"Delete {name} from disk","inbox.deleteFromDisk":"delete from disk","inbox.attachedAlt":"attached image {name}","lightbox.zoomOut":"Zoom out","lightbox.resetZoom":"Reset zoom","lightbox.zoomIn":"Zoom in","feed.agentEnded":"agent finished","feed.running":"running {tool}…","feed.tool":"tool","feed.thinking":"thinking…","feed.working":"working…","feed.liveTail":"live tail","feed.backToLive":"Back to the live tail","feed.newCount":"{count} new","feed.down":"down","feed.pickLog":"Pick a log on the left — the feed updates itself","feed.showEarlier":"show earlier","feed.showEarlierHidden":"show earlier (hidden {count})","feed.loadEarlier":"load earlier from the file","feed.startOfConvo":"start of the conversation","feed.finishedTurn":"finished the turn — waiting for a reply","feed.returnedResult":"returned with a result","feed.noOutput":"No output yet — the file is empty for now","feed.onlyService":"Only service records are present ({count}).","feed.empty":"Empty (no rows to show)","render.system":"system","render.executing":"executing…","render.error":"error","render.teammate":"teammate","render.left":"{peer}: left{at}","render.codexSessionCreated":"Codex session created","render.taskStarted":"Task started","render.taskComplete":"Task completed","render.compacted":"context compacted","render.compactAuto":"auto","render.compactManual":"manual","render.compactPre":"{n}k tokens before","render.compactSummary":"conversation summary","render.patch":"patch","render.stdinSession":"stdin → session {id}","render.record":"record","render.protocol":"protocol","render.jobLogNote":"(this is a job log: it has no command stdout; the full output is in the Codex rollout session in the left list)","render.image":"image","render.dataKb":"{n} kB of data","render.commands":{one:"{count} command",other:"{count} commands"},"render.noFindings":"no findings","render.moreFindings":"{count} more findings in raw","render.memoryCitations":"memory citations ({count})","render.noCitations":"no citation entries","render.moreEntries":"{count} more entries in raw","render.truncated":"truncated","render.shutdownRequest":"shutdown request","render.shutdownResponse":"shutdown response","render.planRequest":"plan approval request","render.planVerdict":"plan verdict","render.approved":"approved","render.rejected":"rejected","render.from":"from {from}","render.structured":"structured message","render.showJson":"show JSON","render.noOutputInLog":"(output is absent from this log file — the full output is in the Codex rollout session)","render.filesChanged":"files changed","render.toDir":"to","render.fromDir":"from","render.delivered":"delivered","render.notDelivered":"not delivered","render.reasoning":"agent reasoning","flowDialog.engine":"Engine: {label}","flowDialog.modelPlaceholder":"model (default)","flowDialog.model":"Model: {label}","flowDialog.effortDefault":"effort: default","flowDialog.createFailed":"couldn't create the flow ({status})","flowDialog.title":"Start a flow","flowDialog.subtitle":"implement → review \xb7 this conversation becomes the implementer","flowDialog.preset":"preset","flowDialog.rolesManualOpen":"▾ roles manually","flowDialog.rolesManual":"▸ roles manually (model / effort)","flowDialog.implementer":"implementer","flowDialog.reviewer":"reviewer","flowDialog.diffBase":"diff base","flowDialog.fromHead":"from current HEAD","flowDialog.fromMergeBase":"from merge-base with main","flowDialog.headless":"headless (no pane)","flowDialog.tmuxPane":"tmux pane","flowDialog.transitions":"transitions","flowDialog.auto":"auto","flowDialog.manual":"manual (gate every step)","flowDialog.roundLimit":"round limit","flowDialog.creating":"creating…","flowDialog.start":"▶ Start","flowStrip.startReview":"Start review","flowStrip.spawnReviewer":"Spawn reviewer","flowStrip.relayNotes":"Relay notes","flowStrip.retryRound":"Retry round","flowStrip.anotherRound":"Another round","flowStrip.flow":"FLOW","flowStrip.roundsAria":"Review rounds","flowStrip.roundError":"Round {n}: {error}","flowStrip.roundVerdict":"Round {n}: {verdict}","flowStrip.roundInProgress":"Round {n}: in progress","flowStrip.addRoundsTitle":"Add more rounds to the limit","flowStrip.plus2":"+2 rounds","flowStrip.limitTitle":"Round limit: reviews before the loop parks (∞ — unlimited)","flowStrip.limitAria":"Set the round limit to {count}","flowStrip.limitUnlimitedAria":"Unlimited rounds","flowStrip.stopReviewer":"Stop","flowStrip.stopReviewerTitle":"Stop the running reviewer; the round lands in “needs decision”","flowStrip.notePlaceholder":"note for the reviewer…","flowStrip.noteTitle":"Sent to the next reviewer as the round's ready note","flowStrip.autoTitle":"Auto: transitions run themselves. Click — manual.","flowStrip.manualTitle":"Manual: every transition waits for a click. Click — auto.","flowStrip.manualShort":"manual","flowStrip.resume":"Resume flow","flowStrip.pause":"Pause","flowStrip.close":"Close flow","roundDeck.roundAborted":"Round {n} \xb7 aborted","roundDeck.roundVerdict":"Round {n} \xb7 {verdict}","roundDeck.roundInProgress":"Round {n} \xb7 in progress","roundDeck.aborted":"aborted","roundDeck.reviewInProgress":"review in progress","roundDeck.waitingFirst":"waiting for the first review round…","roundDeck.spawningReviewer":"launching the reviewer — the transcript will appear shortly…","roundDeck.moreRounds":"{count} more round(s) — click the chips on the flow strip","roundDeck.findings":{one:"{count} finding",other:"{count} findings"},"flowState.waiting_ready":"waiting for READY","flowState.spawn_pending":"ready to spawn the reviewer","flowState.spawning":"spawning the reviewer","flowState.reviewing":"reviewing","flowState.relay_pending":"verdict ready — relay?","flowState.relaying":"relaying notes","flowState.fixing":"fixing","flowState.approved":"approved","flowState.done_comment":"done with comments","flowState.needs_decision":"needs a decision","flowState.paused":"paused","flowState.closed":"closed","flowModel.failed":"failed ({status})","scheme.flowTitle":"Run the implement → review cycle for this conversation","scheme.flow":"Flow","scheme.collapsedTitle":"Collapsed branches and tasks of this conversation","scheme.underneath":"underneath","scheme.handTool":"Hand — drag the canvas (H, or hold Space)","scheme.selectTool":"Select — click and work with conversations (V)","scheme.zoomOut":"Zoom out (−)","scheme.zoom100":"Zoom 100% (1)","scheme.zoomIn":"Zoom in (+)","scheme.fit":"Fit all (0, or double-click the background)","scheme.roleImplementer":"Implementer","scheme.roleReviewer":"Reviewer","scheme.roleWorking":"working","scheme.roleWaiting":"waiting","scheme.lassoTool":"Multi-select — draw a box around agents, click cards to toggle","bulk.selectedCount":{one:"{count} selected",other:"{count} selected"},"bulk.placeholder":"one message to every selected agent…","bulk.textAria":"Broadcast text for the selected agents","bulk.sendAll":"Send to {count} agents","bulk.interrupt":"Interrupt","bulk.stop":"Stop","bulk.stopConfirm":"Stop {count} agents?","bulk.remove":"Clear from board","bulk.removeConfirm":"Close {count} cards?","bulk.flow":"Flow","bulk.fit":"Show selection","bulk.exit":"Exit selection (Esc)","bulk.retryFailed":"Retry failed ({count})","bulk.nodeGone":"node left the board","bulk.flowTitle":"Start a review flow on {count} agents","bulk.flowStart":"Start {count} flows","minimap.title":"Minimap — click or drag to navigate","plan.agentPlan":"Agent plan:","plan.stepsAria":"Plan: {done} of {total} steps","plan.nowSuffix":", now: {current}","plan.goal":"goal","plan.goalDone":"goal ✓","plan.goalBlocked":"goal ✖","plan.noObjective":"(objective not recorded in the transcript tail)","plan.tokens":"tokens: {n}","plan.time":"time: {n} min","plan.ctxTitle":"Context window: {pct}% used\n{used} of {window} tokens","plan.ctxAria":"Context: {pct} percent of the window used","plan.goalAria":"Session goal: {status}","limits.now":"now","limits.inMin":"in {n}m","limits.inHour":"in {n}h","limits.inDay":"in {n}d","limits.asOf":"as of {time}","limits.left":"left","limits.reset":"reset {eta} \xb7 {at}","limits.stale":"data is stale: {stale}","limits.5h":"5h","limits.week":"Week","status.awaitingPlan":"awaiting plan approval","status.awaitingAnswer":"awaiting an answer to a question","status.awaitingTerminal":"awaiting a reply in the terminal","status.working":"working…","status.returnedResult":"returned with a result","status.stalled":"interrupted or awaiting permission","status.finishedTurn":"finished the turn — waiting for a reply","status.flow":"flow: {label}","dictation.failed":"couldn't transcribe","dictation.silence":"silence — nothing recognized","dictation.unsupported":"recording is not supported in this browser","dictation.liveError":"live transcription error","dictation.connectionLost":"transcription connection dropped","dictation.noMic":"no microphone access","overview.branchesLiveIn":{one:"{count} branch running in {projects}",other:"{count} branches running in {projects}"},"overview.projects":{one:"{count} project",other:"{count} projects"},"overview.archived":"\xb7 {count} archived","overview.moreLive":"{count} more live","overview.quiet":"quiet \xb7 last activity {age}","overview.empty":"No logs yet","branch.live":"working","branch.waiting":"finished the turn — waiting for a reply","branch.returned":"returned with a result","branch.stalled":"interrupted or awaiting permission","branch.done":"done — safe to remove","branch.worktree":"Worktree {name}","branch.lastActivity":"Last activity: {age}","branch.lastActivityQuiet":"Marked active, but the transcript is quiet: last activity {age}","branch.handoffTitle":"agent spawned by this conversation's handoff","branch.branchTitle":"branch of this conversation","branch.removeColumn":"Remove column {title}","branch.toggleBackground":"{action} background task {title}","branch.collapse":"Collapse","branch.expand":"Expand","branch.expandFull":"Expand conversation {title} to the full window","branch.collapseFull":"Back to the canvas (Esc)","tree.quiet":"Quiet conversations and tasks","corner.waitingCount":"\xb7 {count} waiting","corner.openSwitchboard":"Open the agent switchboard","task.working":", working","task.interrupted":", interrupted","task.finished":", finished","task.interruptedBadge":"interrupted","task.finishedBadge":"finished","task.stopFailed":"couldn't stop","task.signalSent":"sent {signal} to PID {pid}","task.confirmKill":"Really kill PID {pid}?","task.killPid":"Kill {pid}","task.confirmKillYes":"Yes, kill","task.stopAria":"Stop process PID {pid}","task.kill":"Kill","task.jobLogHint":"This is a short job log (service events only). Codex's real work is in the full session:","task.openCodexSession":"Open Codex session ({size} kB{activity})","task.rolloutMissing":"This is a short job log. The full Codex rollout session hasn't appeared in the list yet","task.backgroundCommand":"Background command","task.commandNotFound":"The command that started this background task wasn't found in the session transcripts","viewer.closeProjects":"Close the project list","viewer.agentWaiting":"Agent is waiting for a reply","viewer.closeNotification":"Close the notification","attention.badge":{one:"{count} waiting",other:"{count} waiting"},"attention.openQueue":"Attention queue — who is blocked on you (N — next)","attention.popoverTitle":"Waiting on you","attention.filterOn":"Show only those waiting on you (F)","attention.filterOff":"Show all nodes (F)","mobile.noConvos":"No conversations yet","mobile.map":"Map","mobile.closeMap":"Close the map","mobile.tapNode":"Tap a node — the conversation opens full-screen","mobile.agent":"agent","mobile.openMap":"Open the project map","tasks.failed":"failed ({status})","tasks.tool":"Task — the next click drops a card on the canvas (T)","tasks.untitled":"untitled","tasks.newPlaceholder":"task text… (the first line is the title)","tasks.editAria":"Task text","tasks.spawning":"starting…","tasks.deadChip":"the conversation is gone from the list","tasks.retry":"retry delivery","tasks.chipFailedTitle":"not delivered: {error}","tasks.send":"send","tasks.sendTitle":"Send the task to agents","tasks.spawn":"agent","tasks.spawnTitle":"Spawn a fresh agent with this task as the brief","tasks.spawnGo":"Launch","tasks.statusTitle":"Status: {label} — click cycles","tasks.status.inbox":"inbox","tasks.status.assigned":"assigned","tasks.status.blocked":"blocked","tasks.status.done":"done","tasks.delete":"delete","tasks.deleteConfirm":"sure?","tasks.deleteAria":"Delete task {title}","tasks.pickerTitle":"Send to","tasks.pickerAllChildren":"⤷ all children","tasks.pickerEmpty":"no conversations in the project","tasks.pickerSend":"Send ({count})","tasks.sendOk":"Delivered {delivered} of {total}","tasks.sendFailPart":"✗ “{title}”: {error}","tasks.spawnOk":"agent started in tmux {target}","tasks.composerToggle":"create a task","tasks.composerToggleTitle":"On — the text becomes a tracked task card assigned to the selection; off — a plain broadcast with no trace","tasks.composerNeedsText":"a task needs text","tasks.panelTitle":"Tasks","tasks.panelToggleAria":"Toggle the task panel","tasks.panelThisProject":"this project","tasks.panelAll":"all","tasks.panelEmpty":"no tasks yet — drop one with the board's task tool (T)","tasks.panelClose":"Close the task panel","tasks.sheetNew":"new task","tasks.sheetCreate":"Create the task","tasks.sheetBack":"Back to the task list","tasks.sheetTargets":{one:"{count} target",other:"{count} targets"},"tasks.sheetAssignments":"assignments","tasks.sheetEmpty":"no tasks yet","tasks.sheetGone":"the task is gone","tasks.textNotSaved":"the text didn't save — delivery aborted, try again","tasks.emptyTextBlocked":"empty text isn't saved — restore the task text before sending"},uk:{"common.serverUnavailable":"сервер недоступний","common.loading":"завантаження…","common.loadingCap":"Завантаження…","common.cancel":"Скасувати","common.show":"показати","common.showAll":"показати все","common.collapse":"згорнути","common.yes":"Так","common.no":"Ні","common.send":"Надіслати","common.sending":"надсилаю…","common.sent":"надіслано","common.close":"Закрити","common.failedSend":"не вдалося надіслати","common.failedDelete":"не вдалося видалити","common.nothingFound":"Нічого не знайдено","common.nothingRunning":"зараз нічого не працює","common.kb":"кБ","common.chars":"{n} симв.","lang.aria":"Мова інтерфейсу","util.effortTitle":"Зусилля міркування: {effort}","time.agoSec":"{n} с тому","time.agoMin":"{n} хв тому","time.agoHour":"{n} год тому","time.agoDay":"{n} д тому","kind.session":"сесія","kind.subagent":"субагент","kind.job":"джоба","kind.background":"фон","kind.handoff":"хендофф","rail.title":"Логи агентів","rail.filter":"Фільтр проєктів…","rail.projects":"Проєкти","rail.overview":"Огляд","rail.archive":"Архів","dash.branchesLive":{one:"{count} гілка працює",few:"{count} гілки працюють",many:"{count} гілок працюють",other:"{count} гілок працюють"},"dash.trees":{one:"{count} дерево",few:"{count} дерева",many:"{count} дерев",other:"{count} дерев"},"dash.recentConvos":{one:"{count} нещодавня розмова",few:"{count} нещодавні розмови",many:"{count} нещодавніх розмов",other:"{count} нещодавніх розмов"},"dash.quietTrees":{one:"{count} тихе дерево",few:"{count} тихі дерева",many:"{count} тихих дерев",other:"{count} тихих дерев"},"dash.openProjects":"Відкрити список проєктів","dash.unarchive":"Повернути з архіву","dash.newConvo":"Нова розмова з агентом","dash.agent":"Агент","dash.emptyTitle":"На схемі поки порожньо","dash.emptyHint":"Відкрий пульт у правому нижньому куті і клікни розмову — вона з'явиться тут","trash.title":"На схемі порожньо, але в проєкті є записи","trash.hint":"Клік по рядку відкриває розмову нодою; смітник видаляє її файл з диска назавжди.","trash.deletedFromDisk":"\xb7 видалено з диска","trash.open":"Відкрити {title}","trash.toArchive":"В архів","trash.notDeleted":"не видалено {failed} з {total}","trash.confirmDelete":{one:"Видалити з диска {count} файл проєкту?",few:"Видалити з диска {count} файли проєкту?",many:"Видалити з диска {count} файлів проєкту?",other:"Видалити з диска {count} файлів проєкту?"},"trash.deleting":"видаляю…","trash.confirmYes":"Так, видалити","trash.deleteProject":"Видалити проєкт з диска","switch.aria":"Пульт агентів","switch.title":"Пульт","switch.search":"Пошук за назвою або проєктом","switch.updating":"оновлення…","switch.close":"Закрити пульт","switch.waiting":"Чекає тебе","switch.working":"Працюють","switch.recent":"Нещодавні","switch.older":"Старіше","switch.hidden":"Приховані ({count})","switch.hide":"сховати","switch.restore":"повернути","switchCard.openColumn":"Відкрити колонкою {title}","switchCard.remove":"Прибрати з пульта","composer.imagesCount":{one:"{count} картинка",few:"{count} картинки",many:"{count} картинок",other:"{count} картинок"},"composer.spawned":"запущено агента в tmux {target}","composer.sentPaths":"надіслано {count} шлях(и)","composer.failedInterrupt":"не вдалося перервати","composer.escapeSent":"надіслано Escape — агент перервано","composer.spawnAria":"Запустити агента з промптом у tmux","composer.sendAria":"Надіслати повідомлення агенту в tmux {target}","composer.queueAria":"Черга надісланих повідомлень","composer.removeFromQueue":"Прибрати з черги","composer.placeholderRelay":"написати — передам через кореневу сесію…","composer.placeholderSpawn":"промпт — агент запуститься в tmux…","composer.placeholderSend":"написати агенту…","composer.textAria":"Текст для агента","composer.titleRelay":"передасться через кореневу сесію гілки","composer.titleSpawnResumed":"нове tmux-вікно з відновленим агентом","composer.root":"корінь","composer.interruptAria":"Перервати агента (Escape)","composer.interruptTitle":"надіслати Escape у пейн агента","composer.compactAria":"Стиснути контекст агента (/compact)","composer.compactTitle":"надіслати /compact — агент стисне контекст; після завершення у стрічці з'явиться позначка","composer.compactConfirm":"Точно?","composer.compactConfirmTitle":"Натисни ще раз, щоб надіслати /compact","composer.compactSent":"стискання почалось — позначка з'явиться у стрічці, щойно завершиться","composer.failedCompact":"не вдалося запустити стискання","composer.addImages":"Додати картинки","composer.stopAndSend":"Зупинити запис і надіслати","composer.launchAgent":"Запустити агента","composer.sendToAgent":"Надіслати агенту","composer.stopAndSendTitle":"зупинити запис і надіслати","draft.readPrompt":"Прочитай розмову агента у файлі {src} і продовж роботу звідти: ","draft.needDir":"вкажи робочу директорію","draft.launchFailed":"не вдалося запустити","draft.paneAria":"Чернетка нової розмови з агентом","draft.notStarted":"агент ще не запущений","draft.engineAria":"Двигун агента","draft.handoffLabel":"хендофф: {title}","draft.newConvo":"нова розмова","draft.conversation":"розмова","draft.dismiss":"Прибрати чернетку розмови","draft.directory":"директорія","draft.dirAria":"Робоча директорія агента","draft.imagesOnly":"(картинки)","draft.launched":"агент запущений у tmux {target} — чекаю, поки розмова з'явиться тут…","draft.slow":"Щось довго. Перевір вікно tmux {target} — щойно транскрипт з'явиться, панель підхопить його сама.","draft.hintRelay":"Новий агент спершу прочитає транскрипт батьківської розмови і продовжить з того місця. Допиши в промпт, що зробити далі, — гілка з'явиться на схемі поруч.","draft.hintNew":"Обери двигун і директорію, напиши перший промпт — агент запуститься в tmux, і розмова продовжиться в цій самій панелі.","draft.promptAria":"Перший промпт для нового агента","draft.placeholder":"перший промпт — агент запуститься в tmux…","draft.promptTextAria":"Текст першого промпта","draft.newWindowTitle":"нове tmux-вікно зі свіжим агентом","draft.newAgent":"новий агент","draft.addImages":"Додати картинки до промпта","draft.stopAndLaunch":"Зупинити запис і запустити агента","link.handoffContext":"Тобі передали контекст іншого агента — розмову \xab{title}\xbb. Її транскрипт: {path} — спочатку прочитай цей файл, щоб мати повний контекст, а тоді виконай прохання нижче.\n\n{ask}","link.dropped":"контекст у промпті \xab{title}\xbb — допиши прохання і надішли","handoff.aria":"Перекинути розмову новому агентові — чернетка з'явиться нижче","handoff.title":"клік — чернетка нового агента з цим контекстом \xb7 потягни — звʼязати з наявним","handoff.label":"перекинути агенту","qr.showAria":"Показати QR для входу з телефона","qr.failed":"не вдалося отримати посилання","qr.startHint":"Запустіть viewer з доступом через Tailscale: ","qr.alt":"QR код для входу з телефона","qr.generating":"генерую QR…","qr.linkAria":"Посилання для входу з телефона","qr.copy":"Копіювати посилання","qr.scanHint":"скануй з телефона в тому ж tailnet","push.enabled":"Push-сповіщення увімкнено","push.enable":"Увімкнути push-сповіщення","push.disable":"Вимкнути push-сповіщення","push.needsHttps":"Push потребує HTTPS","sound.on":"Звукові сповіщення увімкнено","sound.off":"Звукові сповіщення вимкнено","sound.mute":"Вимкнути звукові сповіщення","sound.unmute":"Увімкнути звукові сповіщення","mic.stopRecognize":"Зупинити запис і розпізнати","mic.cancel":"Скасувати запис","mic.recognizing":"Розпізнаю…","mic.dictate":"Надиктувати","mic.dictateHint":"надиктувати (до 2 хв)","delFile.confirm":"Видалити з диска?","delFile.aria":"Видалити розмову з диска","img.readFailed":"не вдалося прочитати картинку","img.readAborted":"читання картинки перервано","img.unsupported":"непідтримуваний формат картинки: {name}","img.unknownFile":"невідомий файл","img.tooLarge":"{name}: завелика (ліміт 10 МБ)","img.image":"картинка","img.error":"помилка картинки","img.previewAlt":"прев'ю картинки {n}","img.removeAria":"Прибрати картинку {n}","img.toFilePaths":"шляхами до файлів","question.sec":"{n} с","question.min":"{n} хв","question.hour":"{n} год","question.waiting":"чекає на відповідь","question.sentToPane":"Надіслано в пейн: {text}","question.keysHint":"клавіші в пейн \xb7 або композер нижче","question.pane":"Пейн {target}","question.alreadyAnswered":"відповідь уже записана","question.openFailed":"не вдалося відкрити сесію","question.opened":"відкрито {target}","question.answered":"Відповідено: {text}","question.answeredElsewhere":"Відповідено в іншому місці: {text}","question.noPane":"tmux-пейн недоступний","question.openSession":"відкрити сесію","question.rejectComment":"Коментар до відхилення…","question.approved":"затверджено","question.rejected":"відхилено","question.approve":"Затвердити","question.reject":"Відхилити","question.ownAnswer":"Своя відповідь…","inbox.deleted":"видалено з диска","inbox.fileGone":"файла вже немає на диску","inbox.confirmDelete":"Видалити файл з диска?","inbox.deleteAria":"Видалити {name} з диска","inbox.deleteFromDisk":"видалити з диска","inbox.attachedAlt":"вкладена картинка {name}","lightbox.zoomOut":"Зменшити","lightbox.resetZoom":"Скинути масштаб","lightbox.zoomIn":"Збільшити","feed.agentEnded":"агент завершився","feed.running":"виконує {tool}…","feed.tool":"інструмент","feed.thinking":"думає…","feed.working":"працює…","feed.liveTail":"живий хвіст","feed.backToLive":"Повернутись до живого хвоста","feed.newCount":"{count} нових","feed.down":"вниз","feed.pickLog":"Вибери лог зліва — стрічка оновлюється сама","feed.showEarlier":"показати раніше","feed.showEarlierHidden":"показати раніше (сховано {count})","feed.loadEarlier":"завантажити раніше з файлу","feed.startOfConvo":"початок розмови","feed.finishedTurn":"закінчив хід — чекає відповіді","feed.returnedResult":"повернувся з результатом","feed.noOutput":"Ще без виводу — файл поки порожній","feed.onlyService":"Є лише службові записи ({count}).","feed.empty":"Порожньо (немає рядків для показу)","render.system":"системне","render.executing":"виконується…","render.error":"помилка","render.teammate":"тімейт","render.left":"{peer}: звільнився{at}","render.codexSessionCreated":"Сесія Codex створена","render.taskStarted":"Задача стартувала","render.taskComplete":"Задачу завершено","render.compacted":"контекст стиснуто","render.compactAuto":"авто","render.compactManual":"вручну","render.compactPre":"{n}k токенів до","render.compactSummary":"підсумок розмови","render.patch":"патч","render.stdinSession":"stdin → сесія {id}","render.record":"запис","render.protocol":"протокол","render.jobLogNote":"(це джоб-лог: він не містить stdout команд; повний вивід — у rollout-сесії Codex у списку зліва)","render.image":"зображення","render.dataKb":"даних {n} КБ","render.commands":{one:"{count} команда",few:"{count} команди",many:"{count} команд",other:"{count} команд"},"render.noFindings":"без findings","render.moreFindings":"ще {count} findings у raw","render.memoryCitations":"цитати пам'яті ({count})","render.noCitations":"без citation entries","render.moreEntries":"ще {count} entries у raw","render.truncated":"обрізано","render.shutdownRequest":"запит на завершення","render.shutdownResponse":"відповідь на завершення","render.planRequest":"запит на затвердження плану","render.planVerdict":"вердикт по плану","render.approved":"схвалено","render.rejected":"відхилено","render.from":"від {from}","render.structured":"структуроване повідомлення","render.showJson":"показати JSON","render.noOutputInLog":"(вивід у цьому лог-файлі відсутній — повний є в rollout-сесії Codex)","render.filesChanged":"файли змінені","render.toDir":"до","render.fromDir":"від","render.delivered":"доставлено","render.notDelivered":"не доставлено","render.reasoning":"міркування агента","flowDialog.engine":"Двигун: {label}","flowDialog.modelPlaceholder":"модель (дефолт)","flowDialog.model":"Модель: {label}","flowDialog.effortDefault":"effort: дефолт","flowDialog.createFailed":"не вдалося створити флоу ({status})","flowDialog.title":"Запустити флоу","flowDialog.subtitle":"implement → review \xb7 ця розмова стає виконавцем","flowDialog.preset":"пресет","flowDialog.rolesManualOpen":"▾ ролі вручну","flowDialog.rolesManual":"▸ ролі вручну (модель / effort)","flowDialog.implementer":"виконавець","flowDialog.reviewer":"ревʼюер","flowDialog.diffBase":"база діфу","flowDialog.fromHead":"від поточного HEAD","flowDialog.fromMergeBase":"від merge-base з main","flowDialog.headless":"headless (без панелі)","flowDialog.tmuxPane":"tmux-панель","flowDialog.transitions":"переходи","flowDialog.auto":"авто","flowDialog.manual":"вручну (гейт на кожен крок)","flowDialog.roundLimit":"ліміт раундів","flowDialog.creating":"створюю…","flowDialog.start":"▶ Запустити","flowStrip.startReview":"Почати ревью","flowStrip.spawnReviewer":"Заспавнити ревʼюера","flowStrip.relayNotes":"Передати зауваження","flowStrip.retryRound":"Повторити раунд","flowStrip.anotherRound":"Ще коло","flowStrip.flow":"ФЛОУ","flowStrip.roundsAria":"Раунди ревью","flowStrip.roundError":"Раунд {n}: {error}","flowStrip.roundVerdict":"Раунд {n}: {verdict}","flowStrip.roundInProgress":"Раунд {n}: триває","flowStrip.addRoundsTitle":"Додати ще раунди до ліміту","flowStrip.plus2":"+2 раунди","flowStrip.limitTitle":"Ліміт раундів: скільки ревью до зупинки (∞ — без ліміту)","flowStrip.limitAria":"Встановити ліміт раундів: {count}","flowStrip.limitUnlimitedAria":"Без ліміту раундів","flowStrip.stopReviewer":"Стоп","flowStrip.stopReviewerTitle":"Зупинити поточного ревʼюера; раунд перейде в \xabпотрібне рішення\xbb","flowStrip.notePlaceholder":"нотатка ревʼюеру…","flowStrip.noteTitle":"Піде наступному ревʼюеру як ready-нотатка раунду","flowStrip.autoTitle":"Авто: переходи самі. Клік — вручну.","flowStrip.manualTitle":"Вручну: кожен перехід чекає кліку. Клік — авто.","flowStrip.manualShort":"вручну","flowStrip.resume":"Продовжити флоу","flowStrip.pause":"Пауза","flowStrip.close":"Закрити флоу","roundDeck.roundAborted":"Раунд {n} \xb7 перервано","roundDeck.roundVerdict":"Раунд {n} \xb7 {verdict}","roundDeck.roundInProgress":"Раунд {n} \xb7 триває","roundDeck.aborted":"перервано","roundDeck.reviewInProgress":"ревью триває","roundDeck.waitingFirst":"чекаю на перший раунд ревью…","roundDeck.spawningReviewer":"запускаю ревʼюера — транскрипт зʼявиться за мить…","roundDeck.moreRounds":"ще {count} раунд(и) — клікни чипи на стрічці флоу","roundDeck.findings":{one:"{count} знахідка",few:"{count} знахідки",many:"{count} знахідок",other:"{count} знахідок"},"flowState.waiting_ready":"чекає READY","flowState.spawn_pending":"готовий спавнити ревʼюера","flowState.spawning":"запускаю ревʼюера","flowState.reviewing":"ревью","flowState.relay_pending":"вердикт є — передати?","flowState.relaying":"передаю зауваження","flowState.fixing":"фікси","flowState.approved":"затверджено","flowState.done_comment":"готово із зауваженнями","flowState.needs_decision":"потребує рішення","flowState.paused":"пауза","flowState.closed":"закрито","flowModel.failed":"не вдалося ({status})","scheme.flowTitle":"Запустити цикл implement → review для цієї розмови","scheme.flow":"Флоу","scheme.collapsedTitle":"Згорнуті гілки й задачі цієї розмови","scheme.underneath":"під сподом","scheme.handTool":"Рука — тягнути полотно (H, або тримай Space)","scheme.selectTool":"Виділення — клік і робота з розмовами (V)","scheme.zoomOut":"Віддалити (−)","scheme.zoom100":"Масштаб 100% (1)","scheme.zoomIn":"Наблизити (+)","scheme.fit":"Вписати все (0, або подвійний клік по фону)","scheme.roleImplementer":"Імплементер","scheme.roleReviewer":"Ревʼюер","scheme.roleWorking":"працює","scheme.roleWaiting":"чекає","scheme.lassoTool":"Вибірка — обведи агентів рамкою, кліком додавай чи знімай","bulk.selectedCount":{one:"Вибрано {count}",few:"Вибрано {count}",many:"Вибрано {count}",other:"Вибрано {count}"},"bulk.placeholder":"одне повідомлення кожному вибраному агенту…","bulk.textAria":"Текст розсилки вибраним агентам","bulk.sendAll":"Надіслати {count} агентам","bulk.interrupt":"Перервати","bulk.stop":"Зупинити","bulk.stopConfirm":"Точно зупинити {count}?","bulk.remove":"Прибрати зі схеми","bulk.removeConfirm":"Закрити {count} карток?","bulk.flow":"Флоу","bulk.fit":"Показати вибірку","bulk.exit":"Вийти з вибірки (Esc)","bulk.retryFailed":"Повторити невдалі ({count})","bulk.nodeGone":"вузол зник зі схеми","bulk.flowTitle":"Запустити ревʼю-флоу для {count} агентів","bulk.flowStart":"Запустити {count} флоу","minimap.title":"Мінімапа — клікни або тягни, щоб перейти","plan.agentPlan":"План агента:","plan.stepsAria":"План: {done} з {total} кроків","plan.nowSuffix":", зараз: {current}","plan.goal":"ціль","plan.goalDone":"ціль ✓","plan.goalBlocked":"ціль ✖","plan.noObjective":"(objective не записаний у хвості транскрипта)","plan.tokens":"токенів: {n}","plan.time":"часу: {n} хв","plan.ctxTitle":"Контекстне вікно: використано {pct}%\n{used} з {window} токенів","plan.ctxAria":"Контекст: використано {pct} відсотків вікна","plan.goalAria":"Ціль сесії: {status}","limits.now":"зараз","limits.inMin":"через {n} хв","limits.inHour":"через {n} год","limits.inDay":"через {n} д","limits.asOf":"станом на {time}","limits.left":"лишилось","limits.reset":"скид {eta} \xb7 {at}","limits.stale":"дані застарілі: {stale}","limits.5h":"5 год","limits.week":"Тиждень","status.awaitingPlan":"чекає затвердження плану","status.awaitingAnswer":"чекає відповіді на питання","status.awaitingTerminal":"чекає на відповідь у терміналі","status.working":"працює…","status.returnedResult":"повернувся з результатом","status.stalled":"перервано або чекає дозволу","status.finishedTurn":"закінчив хід — чекає відповіді","status.flow":"флоу: {label}","dictation.failed":"не вдалося розпізнати","dictation.silence":"тиша — нічого не розпізналось","dictation.unsupported":"запис не підтримується в цьому браузері","dictation.liveError":"помилка live-транскрипції","dictation.connectionLost":"зʼєднання з транскрипцією обірвалось","dictation.noMic":"немає доступу до мікрофона","overview.branchesLiveIn":{one:"{count} гілка працює у {projects}",few:"{count} гілки працюють у {projects}",many:"{count} гілок працюють у {projects}",other:"{count} гілок працюють у {projects}"},"overview.projects":{one:"{count} проєкті",few:"{count} проєктах",many:"{count} проєктах",other:"{count} проєктах"},"overview.archived":"\xb7 {count} в архіві","overview.moreLive":"ще {count} live","overview.quiet":"тихо \xb7 остання активність {age}","overview.empty":"Логів поки нема","branch.live":"працює","branch.waiting":"закінчив хід — чекає відповіді","branch.returned":"повернувся з результатом","branch.stalled":"перервано або чекає дозволу","branch.done":"завершено — можна прибрати","branch.worktree":"Ворк-дерево {name}","branch.lastActivity":"Остання активність: {age}","branch.lastActivityQuiet":"Позначений активним, але транскрипт мовчить: остання активність {age}","branch.handoffTitle":"агент, породжений хендоффом цієї розмови","branch.branchTitle":"гілка цієї розмови","branch.removeColumn":"Прибрати колонку {title}","branch.toggleBackground":"{action} фонову задачу {title}","branch.collapse":"Згорнути","branch.expand":"Розгорнути","branch.expandFull":"Розгорнути розмову {title} на все вікно","branch.collapseFull":"Повернутися до полотна (Esc)","tree.quiet":"Тихі розмови й задачі","corner.waitingCount":"\xb7 {count} чекають","corner.openSwitchboard":"Відкрити пульт агентів","task.working":", працює","task.interrupted":", перервано","task.finished":", закінчив","task.interruptedBadge":"перервано","task.finishedBadge":"завершено","task.stopFailed":"помилка зупинки","task.signalSent":"надіслано {signal} PID {pid}","task.confirmKill":"Точно вбити PID {pid}?","task.killPid":"Вбити {pid}","task.confirmKillYes":"Так, вбити","task.stopAria":"Зупинити процес PID {pid}","task.kill":"Вбити","task.jobLogHint":"Це короткий джоб-лог (лише службові події). Реальна робота Codex — у повній сесії:","task.openCodexSession":"Відкрити сесію Codex ({size} kB{activity})","task.rolloutMissing":"Це короткий джоб-лог. Повна rollout-сесія Codex ще не з'явилась у списку","task.backgroundCommand":"Фонова команда","task.commandNotFound":"Команду, що запустила цю фонову задачу, не знайдено у транскриптах сесії","viewer.closeProjects":"Закрити список проєктів","viewer.agentWaiting":"Агент чекає відповіді","viewer.closeNotification":"Закрити сповіщення","attention.badge":{one:"{count} чекає",few:"{count} чекають",many:"{count} чекають",other:"{count} чекають"},"attention.openQueue":"Черга уваги — хто заблокований на тобі (N — наступний)","attention.popoverTitle":"Чекають на тебе","attention.filterOn":"Показати лише тих, хто чекає на тебе (F)","attention.filterOff":"Показати всі вузли (F)","mobile.noConvos":"Розмов поки нема","mobile.map":"Карта","mobile.closeMap":"Закрити карту","mobile.tapNode":"Тапни вузол — розмова відкриється на весь екран","mobile.agent":"агент","mobile.openMap":"Відкрити карту проєкту","tasks.failed":"не вдалося ({status})","tasks.tool":"Задача — наступний клік кладе картку на полотно (T)","tasks.untitled":"без назви","tasks.newPlaceholder":"текст задачі… (перший рядок — назва)","tasks.editAria":"Текст задачі","tasks.spawning":"запускається…","tasks.deadChip":"розмови вже немає у списку","tasks.retry":"повторити доставку","tasks.chipFailedTitle":"не доставлено: {error}","tasks.send":"надіслати","tasks.sendTitle":"Надіслати задачу агентам","tasks.spawn":"агент","tasks.spawnTitle":"Запустити нового агента з цією задачею як брифом","tasks.spawnGo":"Запустити","tasks.statusTitle":"Статус: {label} — клік перемикає","tasks.status.inbox":"інбокс","tasks.status.assigned":"призначено","tasks.status.blocked":"заблоковано","tasks.status.done":"готово","tasks.delete":"видалити","tasks.deleteConfirm":"точно?","tasks.deleteAria":"Видалити задачу {title}","tasks.pickerTitle":"Кому надіслати","tasks.pickerAllChildren":"⤷ всім дітям","tasks.pickerEmpty":"у проєкті немає розмов","tasks.pickerSend":"Надіслати ({count})","tasks.sendOk":"Доставлено {delivered} з {total}","tasks.sendFailPart":"✗ „{title}“: {error}","tasks.spawnOk":"агента запущено в tmux {target}","tasks.composerToggle":"створити задачу","tasks.composerToggleTitle":"Увімкнено — текст стає задачею-карткою з призначеннями на вибір; вимкнено — проста розсилка без сліду","tasks.composerNeedsText":"для задачі потрібен текст","tasks.panelTitle":"Задачі","tasks.panelToggleAria":"Показати або сховати панель задач","tasks.panelThisProject":"цей проєкт","tasks.panelAll":"всі","tasks.panelEmpty":"задач поки нема — кинь картку інструментом \xabзадача\xbb (T)","tasks.panelClose":"Закрити панель задач","tasks.sheetNew":"нова задача","tasks.sheetCreate":"Створити задачу","tasks.sheetBack":"Назад до списку задач","tasks.sheetTargets":{one:"{count} адресат",few:"{count} адресати",many:"{count} адресатів",other:"{count} адресатів"},"tasks.sheetAssignments":"призначення","tasks.sheetEmpty":"задач поки нема","tasks.sheetGone":"задачі вже немає","tasks.textNotSaved":"текст не зберігся — надсилання скасовано, спробуй ще раз","tasks.emptyTextBlocked":"порожній текст не зберігається — віднови текст задачі перед надсиланням"}},o="en",p=new Set;function q(){return o}function r(a){if(a!==o){o=a;try{window.localStorage.setItem("llv_lang",a)}catch{}for(let b of("u">typeof document&&(document.documentElement.lang=a),p))b()}}function s(a){return p.add(a),()=>p.delete(a)}function t(a,b,c){var d;let e,f=n[a][b]??n.en[b]??b;if("string"==typeof f)e=f;else{let b="number"==typeof c?.count?c.count:0;e=f[new Intl.PluralRules("uk"===a?"uk-UA":"en-US").select(b)]??f.other??f.one??""}return d=e,c?d.replace(/\{(\w+)\}/g,(a,b)=>b in c?String(c[b]):a):d}function u(){let a=(0,e.useSyncExternalStore)(s,q,()=>"en");return{locale:a,t:(b,c)=>t(a,b,c),setLocale:r}}function v(a,b=160){let c=a.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~#>]+/g,"").replace(/\s+/g," ").trim().replace(/(?:\/[^\s)]+){3,}/g,a=>{if(a.length<=40)return a;let b=a.split("/").filter(Boolean);return b.length>=2?".../"+b.slice(-2).join("/"):a}).replace(/\s+/g," ").trim();return c.length>b?c.slice(0,b-1).trimEnd()+"…":c}let w="__overview__",x=a=>Math.floor(a/300);function y(a){return"live"===a.activity?0:"recent"===a.activity?1:"stalled"===a.activity?2:3}function z(a){return"claude-projects"===a.root?"сесія"===a.kind&&!a.parent:"codex-sessions"===a.root&&!a.parent}function A(a){return"claude-projects"===a.root&&"субагент"===a.kind}function B(a){return!!A(a)||!!a.handoff&&!!a.parent||"codex-sessions"===a.root&&!!a.parent}function C(a){return"shell"===a.engine||"codex-jobs"===a.root}function D(a){return a.project||"інше"}function E(a,b=Date.now()/1e3){let c=new Map;for(let d of a){let a=D(d),e=c.get(a);e||(e={project:a,liveCount:0,attentionCount:0,conversations:0,smt:0},c.set(a,e)),"live"===d.activity&&(e.liveCount+=1),null!==J(d,b)&&(e.attentionCount+=1),z(d)&&(e.conversations+=1),e.smt=Math.max(e.smt,d.mtime)}return[...c.values()].sort((a,b)=>{let c=a.attentionCount>0;return c!==b.attentionCount>0?c?-1:1:a.liveCount!==b.liveCount?b.liveCount-a.liveCount:x(b.smt)-x(a.smt)||a.project.localeCompare(b.project)})}function F(a){let b=new Map;for(let c of a){if(!c.parent)continue;let a=b.get(c.parent);a?a.push(c):b.set(c.parent,[c])}return b}function G(a,b){let c=[],d=[...b.get(a.path)??[]],e=new Set([a.path]);for(;d.length;){let a=d.pop();e.has(a.path)||(e.add(a.path),c.push(a),d.push(...b.get(a.path)??[]))}return c}function H(a){return!C(a)&&("live"===a.activity||"recent"===a.activity&&B(a))}function I(a,b){let c=new Map(a.map(a=>[a.path,a])),d=F(a),e=new Map,f=new Map;for(let d of a)if(D(d)===b){if("live"===d.activity||"recent"===d.activity&&B(d)){let a=function(a,b){let c=new Set,d=a;for(;d.parent&&!c.has(d.path);){c.add(d.path);let a=b.get(d.parent);if(!a)break;d=a}return d}(d,c);C(a)?f.set(a.path,a):e.set(a.path,a);continue}"recent"===d.activity&&z(d)&&e.set(d.path,d)}let g=[...e.values()].map(a=>(function(a,b,c){let d=G(a,b),e=d.filter(H).sort((a,b)=>("live"!==a.activity)-("live"!==b.activity)||x(b.mtime)-x(a.mtime)||a.path.localeCompare(b.path)),f=d.filter(a=>C(a)&&"live"===a.activity).sort((a,b)=>x(b.mtime)-x(a.mtime)||a.path.localeCompare(b.path)),g=[a,...e].map(a=>({file:a,tasks:[]})),h=new Map(g.map(a=>[a.file.path,a]));for(let a of f)(a.parent&&h.get(a.parent)||g[0]).tasks.push(a);let i=new Set([...h.keys(),...f.map(a=>a.path)]),j=d.filter(a=>!i.has(a.path)).sort((a,b)=>b.mtime-a.mtime),k=j.filter(a=>B(a)&&function(a,b){let c=new Set([a.path]),d=a;for(;d.parent&&!c.has(d.parent);){let a=b.get(d.parent);if(!a)break;if(c.add(a.path),"сесія"===a.kind)return"live"===a.activity||"recent"===a.activity;d=a}return!1}(a,c)),l=new Set(k.map(a=>a.path)),m=j.filter(a=>!l.has(a.path)),n=Math.max(...g.map(a=>a.file.mtime),...f.map(a=>a.mtime));return{key:a.path,columns:g,returnable:k,finished:m,smt:n,orphanTask:!1}})(a,d,c));for(let a of f.values())g.push({key:a.path,columns:[{file:a,tasks:[]}],returnable:[],finished:[],smt:a.mtime,orphanTask:!0});return g.sort((a,b)=>a.orphanTask!==b.orphanTask?a.orphanTask?1:-1:x(b.smt)-x(a.smt)||a.key.localeCompare(b.key))}function J(a,b=Date.now()/1e3){return a.pendingQuestion?a.pendingQuestion.toolUseId:a.waitingInput?`${a.path}:waiting:${Math.floor(a.waitingInput.since)}`:"stalled"===a.activity&&"running"===a.proc&&b-a.mtime<=7200?`${a.path}:stalled:${Math.floor(a.mtime)}`:null}let K=new Set,L=K,M=new Set;function N(a){return M.add(a),()=>M.delete(a)}let O=new Set;function P(a){let b=new Map;for(let c of a){if("closed"===c.state)continue;let a=b.get(c.implementerPath);(!a||c.createdAt>a.createdAt)&&b.set(c.implementerPath,c)}return b}function Q(a){let b=new Set;for(let c of a)for(let a of c.rounds)a.reviewerPath&&b.add(a.reviewerPath);return b}function R(a,b){return!b.has(a.path)&&("claude"===a.engine||"codex"===a.engine)&&z(a)}function S(a,b){return a(`flowState.${b}`)}let T=new Set(["spawn_pending","relay_pending","needs_decision","paused","approved"]),U=new Set(["spawning","reviewing","relaying","fixing"]);function V(a){return"spawning"===a.state||"reviewing"===a.state?"reviewer":"waiting_ready"===a.state||"relaying"===a.state||"fixing"===a.state?"implementer":null}let W={APPROVE:"✓",REQUEST_CHANGES:"✖",COMMENT:"◆"};function X(a){return"APPROVE"===a?{color:"#1a8a3e",soft:"#e7f4ea"}:"REQUEST_CHANGES"===a?{color:"#c62828",soft:"#fbeaea"}:"COMMENT"===a?{color:"#b07d1f",soft:"#fdf3dd"}:{color:"#8b8b95",soft:"#efeff3"}}async function Y(a,b){try{let c=await fetch(`/api/flows/${encodeURIComponent(a)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return"close"===b.action&&function(a){if(!K.has(a))for(let b of(K.add(a),L=new Set(K),M))b()}(a),window.dispatchEvent(new Event("llv:flows-changed")),null;let d=await c.json().catch(()=>null);return d?.error??t(q(),"flowModel.failed",{status:c.status})}catch{return t(q(),"common.serverUnavailable")}}function Z(a){let b=q(),c=Date.now()/1e3-a;return c<90?t(b,"time.agoSec",{n:Math.round(c)}):c<5400?t(b,"time.agoMin",{n:Math.round(c/60)}):c<129600?t(b,"time.agoHour",{n:Math.round(c/3600)}):t(b,"time.agoDay",{n:Math.round(c/86400)})}function $(a){if("string"!=typeof a&&"number"!=typeof a)return"";let b=new Date(a),c="uk"===q()?"uk-UA":"en-US";return Number.isNaN(b.getTime())?"":b.toLocaleTimeString(c,{hour12:!1})}function _(a){return"live"===a?"animate-pulse bg-ok":"recent"===a?"bg-[#d29a2f]":"stalled"===a?"bg-err":"bg-[#c9c9d1]"}let aa={codex:{color:"#2f6fd0",soft:"#e8f0fb"},claude:{color:"#d97757",soft:"#faeee9"}},ab={color:"#9a9aa4",soft:"#ececf1"},ac=[[/fable|mythos/,{color:"#c2410c",soft:"#fbeade"}],[/opus/,{color:"#8a5ad6",soft:"#f1ebfb"}],[/sonnet/,{color:"#e0913f",soft:"#fbf1e4"}],[/haiku/,{color:"#d9a58c",soft:"#f9f1ec"}]],ad=[[/spark/,{color:"#5ea3e4",soft:"#ecf4fd"}],[/mini|nano/,{color:"#7fb1e8",soft:"#eff6fd"}],[/codex/,{color:"#1d55ab",soft:"#e4edfa"}]];function ae(a){let b=aa[a.engine];if(!b)return ab;let c=(a.model??"").toLowerCase();for(let[b,d]of"codex"===a.engine?ad:ac)if(b.test(c))return d;return b}let af={minimal:{dl:20,ds:-32},low:{dl:12,ds:-20},medium:{dl:0,ds:0},high:{dl:-8,ds:12},xhigh:{dl:-14,ds:22},max:{dl:-19,ds:30}};function ag(a,b,c){let[d,e,f]=function(a){let b=parseInt(a.slice(1),16),c=(b>>16&255)/255,d=(b>>8&255)/255,e=(255&b)/255,f=Math.max(c,d,e),g=Math.min(c,d,e),h=(f+g)/2,i=f-g;if(0===i)return[0,0,100*h];let j=i/(1-Math.abs(2*h-1));return[60*(f===c?((d-e)/i+6)%6:f===d?(e-c)/i+2:(c-d)/i+4),100*j,100*h]}(a),g=a=>Math.min(100,Math.max(0,a));return`hsl(${Math.round(d)} ${Math.round(g(e+c))}% ${Math.round(g(f+b))}%)`}function ah(a){let b=ae(a),c=af[a.effort??""];return c?{color:ag(b.color,c.dl,c.ds),soft:ag(b.soft,Math.round(c.dl/3),Math.round(c.ds/2))}:b}function ai(a){return a.effort?t(q(),"util.effortTitle",{effort:a.effort}):void 0}function aj(a){return ae(a).color}function ak(a){return{borderTopColor:ae(a).color}}function al(a){let b={codex:"Codex",claude:"Claude",shell:"Bash"}[a.engine]??a.engine,c=aa[a.engine]??ab;return{label:b,style:{backgroundColor:c.soft,color:c.color}}}function am(a,b){return Math.floor(b.smt/300)-Math.floor(a.smt/300)||a.file.path.localeCompare(b.file.path)}function an(a,b=Date.now()/1e3){return!!a.pendingQuestion||!!a.waitingInput||("stalled"===a.activity?null!==J(a,b):"recent"===a.activity&&("claude"===a.engine||"codex"===a.engine)&&z(a)&&!A(a))}function ao(a,b,c,d,f=ap,g=aq){let{locale:h}=u();return(0,e.useMemo)(()=>{let e=(a,b)=>t(h,a,b),i=function(a){let b=F(a),c=new Map;for(let d of a)c.set(d.path,G(d,b).length);return c}(a),j=new Map;for(let a of b){let b=j.get(a.file);(!b||a.ts>b.ts)&&j.set(a.file,a)}let k=P(g),l=Q(g),m=c.trim().toLowerCase(),n=a.filter(a=>!f.has(a.path)&&!l.has(a.path)&&(z(a)||"live"===a.activity||"stalled"===a.activity||"recent"===a.activity&&!C(a))).map(a=>{let b=D(a),c=v(a.title),f=d-a.mtime,g=k.get(a.path),h=a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"working":an(a,d)?"waiting":f<=86400?"recent":"older",l=function(a,b,c){var d;if(b.pendingQuestion)return a("plan"===b.pendingQuestion.kind?"status.awaitingPlan":"status.awaitingAnswer");if(b.waitingInput)return a("status.awaitingTerminal");if("live"===b.activity&&b.plan?.current)return`${b.plan.done}/${b.plan.total} \xb7 ${b.plan.current}`;let e=c.get(b.path);return e?`${e.label} \xb7 ${Z(e.ts)}`:"live"===b.activity?a("status.working"):A(d=b)&&"running"!==d.proc?a("status.returnedResult"):"stalled"===b.activity?a("status.stalled"):an(b)?a("status.finishedTurn"):""}(e,a,j);return g&&(T.has(g.state)?h="waiting":("reviewing"===g.state||"relaying"===g.state||"spawning"===g.state)&&(h="working"),l=`${e("status.flow",{label:S(e,g.state)})}${g.stateDetail?` — ${g.stateDetail}`:""}`),{file:a,project:b,title:c,descendants:i.get(a.path)??0,smt:a.mtime,kind:h,statusLine:l}}).filter(a=>!m||`${a.title} ${a.project}`.toLowerCase().includes(m)),o=(a,b)=>b.smt-a.smt||a.file.path.localeCompare(b.file.path),p=n.filter(a=>"waiting"===a.kind).sort(o),q=n.filter(a=>"working"===a.kind).sort(o);return{waiting:p,working:q,recent:n.filter(a=>"recent"===a.kind).sort(am),older:n.filter(a=>"older"===a.kind).sort(am),livePreview:q.slice(0,3)}},[a,b,c,d,f,g,h])}let ap=new Set,aq=[];function ar(a,b=Date.now()/1e3){return a.pendingQuestion||a.waitingInput?"waiting":"live"===a.activity?"live":"recent"===a.activity&&B(a)&&"running"!==a.proc?"returned":an(a,b)?"stalled"===a.activity?"stalled":"waiting":"done"}let as="llvSound";function at(a){try{window.localStorage.setItem("llvArchivedProjects",JSON.stringify([...a]))}catch{}}function au(){window.dispatchEvent(new Event("llv:tasks-changed"))}async function av(a,b,c){try{let d=await fetch(a,{method:b,...void 0===c?{}:{headers:{"content-type":"application/json"},body:JSON.stringify(c)}}),e=await d.json().catch(()=>null);if(!d.ok||!e)return{ok:!1,status:d.status,error:e?.error??t(q(),"tasks.failed",{status:d.status})};return au(),{ok:!0,data:e}}catch{return{ok:!1,status:0,error:t(q(),"common.serverUnavailable")}}}async function aw(a){let b=await av("/api/tasks","POST",a);return b.ok?{task:b.data.task}:{error:b.error}}let ax=new Map;async function ay(a){let b=ax.get(a);return b&&await b!==null?t(q(),"tasks.textNotSaved"):null}function az(a,b){let c=void 0!==b.text?ax.get(a):void 0,d=(async()=>{c&&await c;let d=await av(`/api/tasks/${encodeURIComponent(a)}`,"PATCH",b);return d.ok||404!==d.status?d.ok?null:d.error:(au(),null)})();return void 0!==b.text&&(ax.set(a,d),d.finally(()=>{ax.get(a)===d&&ax.delete(a)})),d}async function aA(a){let b=await av(`/api/tasks/${encodeURIComponent(a)}`,"DELETE");return b.ok||404!==b.status?b.ok?null:b.error:(au(),null)}async function aB(a,b){let c=await ay(a);if(c)return{error:c};let d=await av(`/api/tasks/${encodeURIComponent(a)}/send`,"POST",{paths:b});return d.ok?d.data:{error:d.error}}async function aC(a,b){let c=await ay(a);if(c)return{error:c};let d=await av(`/api/tasks/${encodeURIComponent(a)}/spawn`,"POST",b);return d.ok?d.data:{error:d.error}}let aD={files:[],flows:[],tasks:[]},aE="(max-width: 767px)";function aF(a){let b=window.matchMedia(aE);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}function aG(){return(0,e.useSyncExternalStore)(aF,()=>window.matchMedia(aE).matches,()=>!1)}let aH=k("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);function aI({files:a,archivedProjects:b,now:c,onSelectProject:f,onSelectFile:g,onMenu:h}){let{t:i}=u(),j=function(){let[a,b]=(0,e.useState)(3);return a}(),k=(0,e.useMemo)(()=>E(a,c),[a,c]),l=(0,e.useMemo)(()=>k.filter(a=>!b.has(a.project)),[k,b]),m=k.length-l.length,n=(0,e.useMemo)(()=>l.reduce((a,b)=>a+b.liveCount,0),[l]),o=l.filter(a=>a.liveCount>0).length,p=(0,e.useMemo)(()=>l.map(b=>{let c=I(a,b.project).flatMap(a=>a.columns.flatMap(a=>[a.file,...a.tasks])).filter(a=>"live"===a.activity),d=c.slice(0,4),e=a.filter(a=>D(a)===b.project).sort((a,b)=>b.mtime-a.mtime)[0];return{summary:b,liveBranches:d,moreLive:c.length-d.length,latest:e}}),[a,l]);return(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[h?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("dash.openProjects"),onClick:h,children:(0,d.jsx)(aH,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"text-[13.5px] font-bold",children:i("rail.overview")}),(0,d.jsxs)("span",{className:"text-[11.5px] text-dim",children:[n?i("overview.branchesLiveIn",{count:n,projects:i("overview.projects",{count:o})}):i("common.nothingRunning"),m?` ${i("overview.archived",{count:m})}`:""]})]}),(0,d.jsxs)("div",{className:"grid flex-1 auto-rows-min gap-2.5 overflow-y-auto p-3",style:{gridTemplateColumns:`repeat(${j}, minmax(0, 1fr))`},children:[p.map(({summary:a,liveBranches:b,moreLive:c,latest:e})=>(0,d.jsxs)("button",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-3 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(a.project),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${a.liveCount?"animate-pulse bg-ok":"bg-[#d6d6dd]"}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-bold",children:a.project}),a.liveCount?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:a.liveCount}):null,(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:a.conversations})]}),b.length?(0,d.jsxs)("span",{className:"flex flex-col gap-1",children:[b.map(a=>{let b=al(a);return(0,d.jsxs)("span",{className:"flex cursor-pointer items-center gap-1.5 rounded-[8px] px-1 py-0.5 text-[11.5px] hover:bg-bg",role:"link",tabIndex:0,title:v(a.title),onClick:b=>{b.stopPropagation(),g(a)},onKeyDown:b=>{"Enter"===b.key&&(b.stopPropagation(),g(a))},children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"truncate font-semibold",children:v(a.title,70)})]},a.path)}),c>0?(0,d.jsx)("span",{className:"px-1 text-[10.5px] font-semibold text-dim",children:i("overview.moreLive",{count:c})}):null]}):(0,d.jsx)("span",{className:"text-[11px] text-dim",children:i("overview.quiet",{age:e?Z(e.mtime):"—"})})]},a.project)),l.length?null:(0,d.jsx)("div",{className:"col-span-full mt-[20vh] text-center text-dim",children:i("overview.empty")})]})]})}let aJ=k("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),aK=k("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]),aL=k("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),aM=k("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),aN=k("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),aO=k("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]),aP=k("archive-restore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]),aQ=k("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),aR=k("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),aS=k("arrow-up-to-line",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]),aT=k("ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]),aU=k("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),aV=k("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),aW=k("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),aX=k("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),aY=k("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),aZ=k("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),a$=k("fold-vertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]),a_=k("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),a0=k("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]),a1=k("message-circle",[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]),a2=k("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),a3=k("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),a4=k("sparkle",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]]),a5=k("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),a6=k("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),a7=k("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"}]]),a8=k("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]),a9=k("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]),ba=k("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),bb=k("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),bc=k("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),bd=k("power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),be=k("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]),bf=k("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bg={shell:aW,tool:a8,"cmd-group":a9,codex:aZ,claude:a4,image:a_,blob:ba,note:bb,citation:bc,message:a0,shutdown:bd,plan:be,compact:a$};function bh({name:a,className:b}){let c=bg[a];return(0,d.jsx)(c,{className:b??"h-3.5 w-3.5","aria-hidden":!0})}let bi=k("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var bj=c(74429);function bk({label:a,side:b="top",children:c}){return(0,d.jsxs)("span",{className:"group/hint relative inline-flex",children:[c,(0,d.jsx)("span",{role:"tooltip",className:`pointer-events-none absolute left-1/2 z-[60] -translate-x-1/2 whitespace-nowrap rounded-[7px] bg-ink px-2 py-1 text-[10.5px] font-semibold text-white opacity-0 shadow-card transition-opacity delay-150 duration-100 group-focus-within/hint:opacity-100 group-hover/hint:opacity-100 ${"top"===b?"bottom-full mb-1.5":"top-full mt-1.5"}`,children:a})]})}let bl={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/webp":"webp"};function bm(a){return new Promise((b,c)=>{let d=new FileReader;d.onload=()=>{let e=String(d.result),f=e.indexOf(",");f<0?c(Error(t(q(),"img.readFailed"))):b({base64:e.slice(f+1),mime:a.type||"image/png",preview:e})},d.onerror=()=>c(d.error??Error(t(q(),"img.readFailed"))),d.onabort=()=>c(Error(t(q(),"img.readAborted"))),d.readAsDataURL(a)})}function bn({images:a,onRemove:b}){let{t:c}=u();return a.length?(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.map((a,e)=>(0,d.jsxs)("div",{className:"group/img relative",children:[(0,d.jsx)("img",{src:a.preview,alt:c("img.previewAlt",{n:e+1}),className:"h-10 w-10 rounded border border-line object-cover"}),(0,d.jsx)("button",{type:"button",onClick:()=>b(e),"aria-label":c("img.removeAria",{n:e+1}),className:"absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full border border-line bg-panel text-dim shadow-card hover:text-err group-hover/img:flex focus-visible:flex focus-visible:outline-none",children:(0,d.jsx)(m,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},e)),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 text-[10.5px] font-semibold text-dim",children:[c("composer.imagesCount",{count:a.length})," ",(0,d.jsx)(aR,{className:"h-3 w-3","aria-hidden":!0})," ",c("img.toFilePaths")]})]}):null}function bo({onFiles:a,ariaLabel:b,className:c}){let f=(0,e.useRef)(null);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{ref:f,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:b=>{a(Array.from(b.target.files??[])),b.target.value=""}}),(0,d.jsx)("button",{type:"button","aria-label":b,onClick:()=>f.current?.click(),className:c,children:(0,d.jsx)(a_,{className:"h-4 w-4","aria-hidden":!0})})]})}function bp({onError:a,onUnclaimedText:b,onLiveCommit:c}){let{t:d}=u(),[f,g]=(0,e.useState)("idle"),[h,i]=(0,e.useState)(0),[j,k]=(0,e.useState)(""),l=(0,e.useRef)(null),m=(0,e.useRef)([]),n=(0,e.useRef)(null),o=(0,e.useRef)(!1),p=(0,e.useRef)(null),q=(0,e.useRef)(null),r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(!1),v=(0,e.useRef)(!0),w=()=>{null!==p.current&&(clearInterval(p.current),p.current=null)},x=()=>{let a=r.current;r.current=null,a&&(cancelAnimationFrame(a.raf),a.ctx.close().catch(()=>void 0))},y=a=>{w(),x();let c=n.current;if(n.current=null,c){try{c.processor.disconnect()}catch{}try{c.ws.close()}catch{}c.stream.getTracks().forEach(a=>a.stop()),c.ctx.close().catch(()=>void 0)}k(""),g("idle");let d=s.current;if(s.current=null,o.current)return void d?.(null);let e=a.partial.trim();d?d(e):e&&b(e)},z=async()=>{w(),x();let c=l.current;l.current=null,c?.stream.getTracks().forEach(a=>a.stop());let e=new Blob(m.current,{type:"audio/webm"});m.current=[];let f=s.current;if(s.current=null,o.current||e.size<2e3){g("idle"),f?.(null);return}g("busy");try{let c=new FormData;c.append("file",e,"dictation.webm");let g=await fetch("/api/transcribe",{method:"POST",body:c}),h=await g.json();if(!g.ok||"string"!=typeof h.text){a(h.error??d("dictation.failed")),f?.(null);return}let i=h.text.trim();i?f?f(i):b(i):(a(d("dictation.silence")),f?.(null))}catch{a(d("common.serverUnavailable")),f?.(null)}finally{g("idle")}},A=async()=>{try{let a=await fetch("/api/transcribe/token",{method:"POST"});if(!a.ok)return null;let b=await a.json();return"string"==typeof b.token&&b.token?b.token:null}catch{return null}},B=async()=>{if(t.current||l.current||n.current)return;t.current=!0;let b=null,e=!0;try{if(b=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),!v.current)return;o.current=!1,k("");let f=await A();if(!v.current||o.current)return;if(!(null!==f&&((b,e)=>{let f;try{f=new AudioContext({sampleRate:16e3})}catch{return!1}let g=new URLSearchParams({model_id:"scribe_v2_realtime",token:e,audio_format:"pcm_16000",commit_strategy:"vad",vad_silence_threshold_secs:"1.2"}),h=new WebSocket(`wss://api.elevenlabs.io/v1/speech-to-text/realtime?${g.toString()}`),i=f.createScriptProcessor(4096,1,1),j={ws:h,ctx:f,processor:i,stream:b,preOpenQueue:[],partial:""};n.current=j;let l=f.createMediaStreamSource(b);return i.onaudioprocess=a=>{if(n.current!==j)return;let b=function(a){let b=new Int16Array(a.length);for(let c=0;c<a.length;c+=1){let d=Math.max(-1,Math.min(1,a[c]??0));b[c]=d<0?32768*d:32767*d}let c=new Uint8Array(b.buffer),d="";for(let a=0;a<c.length;a+=1)d+=String.fromCharCode(c[a]??0);return btoa(d)}(a.inputBuffer.getChannelData(0));h.readyState===WebSocket.OPEN?h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:b})):h.readyState===WebSocket.CONNECTING&&j.preOpenQueue.push(b)},l.connect(i),i.connect(f.destination),h.addEventListener("open",()=>{if(n.current===j){for(let a of j.preOpenQueue)h.send(JSON.stringify({message_type:"input_audio_chunk",audio_base_64:a}));j.preOpenQueue=[]}}),h.addEventListener("message",b=>{if(n.current===j)try{let e=JSON.parse(b.data);if("partial_transcript"===e.message_type)j.partial=e.text??"";else if(("committed_transcript"===e.message_type||"committed_transcript_with_timestamps"===e.message_type)&&e.text)j.partial="",c(e.text);else if("auth_error"===e.message_type||"error"===e.message_type||"invalid_request"===e.message_type||"quota_exceeded"===e.message_type){a(e.error||d("dictation.liveError")),y(j);return}k(j.partial)}catch{}}),h.addEventListener("close",()=>{n.current!==j||s.current||(a(d("dictation.connectionLost")),y(j))}),!0})(b,f))){let a=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"",c=a?new MediaRecorder(b,{mimeType:a}):new MediaRecorder(b);m.current=[],c.ondataavailable=a=>{a.data.size&&m.current.push(a.data)},c.onstop=()=>{z()},c.start(250),l.current=c}e=!1,(a=>{let b;try{b=new AudioContext}catch{return}let c=b.createAnalyser();c.fftSize=128,c.smoothingTimeConstant=.7,b.createMediaStreamSource(a).connect(c);let d=new Uint8Array(c.frequencyBinCount),e=()=>{if(!r.current)return;r.current.raf=requestAnimationFrame(e),c.getByteFrequencyData(d);let a=q.current;a&&function(a,b){let c=window.devicePixelRatio||1;(a.width!==56*c||a.height!==16*c)&&(a.width=56*c,a.height=16*c);let d=a.getContext("2d");if(!d)return;d.setTransform(c,0,0,c,0,0),d.clearRect(0,0,56,16);let e=Math.max(13,Math.floor(.65*b.length))/13;for(let a=0;a<13;a+=1){let c=Math.floor(a*e),f=Math.max(c+1,Math.floor((a+1)*e)),g=0;for(let a=c;a<f;a+=1)g+=b[a]??0;let h=g/(f-c)/255,i=Math.max(1.5,16*h);d.fillStyle=`rgba(198, 40, 40, ${(.35+.65*h).toFixed(3)})`,d.fillRect(4.3076923076923075*a+1,(16-i)/2,2.3076923076923075,i)}}(a,d)};r.current={ctx:b,raf:requestAnimationFrame(e)}})(b),i(0),g("rec"),p.current=window.setInterval(()=>{i(a=>{let b=a+1;return b>=120&&(l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)),b})},1e3)}catch{v.current&&a(b?d("dictation.unsupported"):d("dictation.noMic"))}finally{var f;e&&(f=b,f?.getTracks().forEach(a=>a.stop())),t.current=!1}};return{phase:f,elapsed:h,liveText:j,canvasRef:q,start:B,stop:()=>new Promise(a=>{let b=n.current;if(b){s.current=a,y(b);return}let c=l.current;c&&"recording"===c.state?(s.current=a,c.stop()):a(null)}),discard:()=>{o.current=!0,l.current?.state==="recording"?l.current.stop():n.current&&y(n.current)}}}function bq({initialText:a,persistText:b,submit:c,disabled:d=!1}){let[f,g]=(0,e.useState)(a),h=(0,e.useRef)(f),i=a=>{let c="function"==typeof a?a(h.current):a;h.current=c,g(c),b(c)},[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(null),p=(0,e.useRef)(null),r=function(a){let[b,c]=(0,e.useState)([]),d=b=>{if(!b.length)return;let d=[];for(let c of b){if(null===(bl[c.type]??null)){a.onError(t(q(),"img.unsupported",{name:c.name||c.type||t(q(),"img.unknownFile")}));continue}if(c.size>0xa00000){a.onError(t(q(),"img.tooLarge",{name:c.name||t(q(),"img.image")}));continue}d.push(c)}if(!d.length)return;let e=d.length<b.length;Promise.all(d.map(bm)).then(b=>{c(a=>[...a,...b]),e||a.onAdded?.()}).catch(b=>{a.onError(b instanceof Error?b.message:t(q(),"img.error"))})};return{images:b,addFiles:d,handlePaste:a=>{let b=Array.from(a.clipboardData.items).filter(a=>a.type.startsWith("image/")).map(a=>a.getAsFile()).filter(a=>null!==a);b.length&&(a.preventDefault(),d(b))},removeAt:a=>c(b=>b.filter((b,c)=>c!==a)),clear:()=>c([])}}({onError:a=>o({kind:"err",text:a}),onAdded:()=>o(null)}),s=a=>{i(b=>b?b.trimEnd()+" "+a:a),o(null),p.current?.focus()},u=bp({onError:a=>o({kind:"err",text:a}),onUnclaimedText:s,onLiveCommit:s}),v=u.liveText?(f?f.trimEnd()+" ":"")+u.liveText:f,w=async()=>{if(!j&&!l){m(!0);try{let a=await u.stop();if(null===a)return;let b=a?h.current?h.current.trimEnd()+" "+a:a:h.current;i(b),await c(b)}finally{m(!1)}}},x="rec"===u.phase,y="busy"===u.phase,z=j||l||d,A=!z&&!y&&(x||!!f.trim()||r.images.length>0);return{text:f,textRef:h,setText:i,setTextState:g,displayText:v,inputRef:p,status:n,setStatus:o,busy:j,setBusy:k,voiceSending:l,dictation:u,attachments:r,insertSpoken:s,stopAndSend:w,submit:c,dictationRecording:x,dictationBusy:y,fieldsDisabled:z,canSend:A}}function br({phase:a,elapsed:b,canvasRef:c,start:e,stop:f,discard:g,onText:h,busy:i=!1}){let{t:j}=u(),k=()=>{i||("idle"===a?e():"rec"===a&&f().then(a=>{a&&h(a)}))};if("rec"===a)return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[(0,d.jsxs)("button",{type:"button","aria-label":j("mic.stopRecognize"),onClick:k,className:"flex items-center gap-1.5 rounded-[8px] border border-err/50 bg-[#fff2f2] px-2 py-2 text-[11px] font-bold text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/40",children:[(0,d.jsx)("canvas",{ref:c,width:56,height:16,className:"h-4 w-14","aria-hidden":!0}),`${Math.floor(b/60)}:${String(b%60).padStart(2,"0")}`]}),(0,d.jsx)("button",{type:"button","aria-label":j("mic.cancel"),onClick:g,className:"inline-flex items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0})})]});return(0,d.jsx)("button",{type:"button","aria-label":j("busy"===a?"mic.recognizing":"mic.dictate"),title:j("busy"===a?"mic.recognizing":"mic.dictateHint"),disabled:"busy"===a||i,onClick:k,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60",children:"busy"===a?(0,d.jsx)(bf,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(a2,{className:"h-4 w-4","aria-hidden":!0})})}function bs({composer:a,placeholder:b,textareaAriaLabel:c,imageAriaLabel:e,leftSlot:f,sendLabelIdle:g,sendLabelRecording:h,sendTitleRecording:i,sendIdleClassName:j,sendIdleStyle:k}){let{displayText:l,inputRef:m,dictation:n,setText:o,attachments:p,voiceSending:q,insertSpoken:r,stopAndSend:s,submit:t,fieldsDisabled:u,canSend:v,dictationRecording:w,busy:x,status:y}=a;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{ref:m,value:l,rows:1,readOnly:!!n.liveText,onChange:a=>o(a.target.value),onPaste:p.handlePaste,onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),"rec"===n.phase?s():t())},placeholder:b,"aria-label":c,disabled:u,className:"w-full resize-none overflow-y-auto rounded-[10px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] placeholder:text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[f,(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)(br,{...n,busy:q,onText:r}),(0,d.jsx)(bk,{label:e,children:(0,d.jsx)(bo,{ariaLabel:e,className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onFiles:p.addFiles})}),(0,d.jsx)(bk,{label:w?i??h:g,children:(0,d.jsx)("button",{type:w?"button":"submit",onClick:w?()=>void s():void 0,disabled:!v,"aria-label":w?h:g,style:w?void 0:k,className:`inline-flex shrink-0 items-center justify-center rounded-[8px] border p-2 text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 ${w?"border-err bg-err hover:opacity-90":j}`,children:x||q?(0,d.jsx)(bf,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(a3,{className:"h-4 w-4","aria-hidden":!0})})})]})]}),(0,d.jsx)(bn,{images:p.images,onRemove:p.removeAt}),y?(0,d.jsx)("span",{className:`truncate text-[10.5px] font-semibold ${"ok"===y.kind?"text-ok":"text-err"}`,children:y.text}):null]})}function bt(a){return"claude-projects"===a.root?"сесія"===a.kind||"субагент"===a.kind:"codex-sessions"===a.root}function bu({file:a}){let{t:b}=u(),c=function(a,b){let[c,d]=(0,e.useState)(null);return null!==a||b?c:null}(a.pid,bt(a)?a.path:void 0),f=bq({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvDraft:"+a.path,b):sessionStorage.removeItem("llvDraft:"+a.path)},submit:a=>F(a)}),{text:g,textRef:h,setText:i,setTextState:j,inputRef:k,setStatus:l,busy:n,setBusy:o,voiceSending:p,attachments:r}=f,[s,t]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)([]),B=bt(a);if(null===c&&!B)return null;let C=null===c,D=C&&"claude-projects"===a.root&&"субагент"===a.kind,E=b=>{A(b),sessionStorage.setItem("llvSent:"+a.path,JSON.stringify(b))},F=async c=>{let d=c??g;if(!n&&!p&&(d.trim()||r.images.length)){o(!0),l(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:d,images:r.images.map(a=>({base64:a.base64,mime:a.mime}))})}),e=await c.json();if(!c.ok||!e.ok)return void l({kind:"err",text:e.error??b("common.failedSend")});let f=r.images.length,g={id:Date.now(),text:d.trim()||(f?b("composer.imagesCount",{count:f}):""),at:Date.now(),via:e.spawned?"spawn":"pane"};E([...z,g].slice(-8)),i(""),r.clear(),l({kind:"ok",text:e.spawned?b("composer.spawned",{target:e.target??""}):e.imagePaths?.length?b("composer.sentPaths",{count:e.imagePaths.length}):b("common.sent")}),k.current?.focus()}catch{l({kind:"err",text:b("common.serverUnavailable")})}finally{o(!1)}}},G=async()=>{if(!s){t(!0),l(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"interrupt",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void l({kind:"err",text:d.error??b("composer.failedInterrupt")});l({kind:"ok",text:b("composer.escapeSent")})}catch{l({kind:"err",text:b("common.serverUnavailable")})}finally{t(!1)}}},H=async()=>{if(!v){w(!0),l(null);try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"compact",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void l({kind:"err",text:d.error??b("composer.failedCompact")});l({kind:"ok",text:b("composer.compactSent")})}catch{l({kind:"err",text:b("common.serverUnavailable")})}finally{w(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),F()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":C?b("composer.spawnAria"):b("composer.sendAria",{target:c??""}),children:[z.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5","aria-label":b("composer.queueAria"),children:z.map(a=>(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] truncate rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2 py-0.5 text-[11px] text-[#333]",title:a.text,children:a.text}),(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[9.5px] text-dim",children:["spawn"===a.via?(0,d.jsx)(a3,{className:"h-2.5 w-2.5","aria-hidden":!0}):(0,d.jsx)(aR,{className:"h-2.5 w-2.5","aria-hidden":!0}),new Date(a.at).toLocaleTimeString("uk"===q()?"uk-UA":"en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"})]}),(0,d.jsx)("button",{type:"button","aria-label":b("composer.removeFromQueue"),className:"inline-flex shrink-0 items-center rounded px-0.5 text-dim hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>E(z.filter(b=>b.id!==a.id)),children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null,(0,d.jsx)(bs,{composer:f,placeholder:D?b("composer.placeholderRelay"):C?b("composer.placeholderSpawn"):b("composer.placeholderSend"),textareaAriaLabel:b("composer.textAria"),imageAriaLabel:b("composer.addImages"),sendLabelIdle:C?b("composer.launchAgent"):b("composer.sendToAgent"),sendLabelRecording:b("composer.stopAndSend"),sendTitleRecording:b("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:D?b("composer.titleRelay"):C?b("composer.titleSpawnResumed"):`tmux ${c}`,children:D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aS,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",b("composer.root")]}):C?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a3,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," resume"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a6,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",(0,d.jsx)("span",{className:"truncate",children:c})]})}),C?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bk,{label:b("composer.interruptTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":b("composer.interruptAria"),disabled:s,onClick:()=>void G(),className:"inline-flex shrink-0 items-center justify-center rounded-[8px] border border-line bg-panel p-2 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50",children:s?(0,d.jsx)(bf,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):(0,d.jsx)(a5,{className:"h-4 w-4",fill:"currentColor","aria-hidden":!0})})}),(0,d.jsx)(bk,{label:x?b("composer.compactConfirmTitle"):b("composer.compactTitle"),children:(0,d.jsx)("button",{type:"button","aria-label":x?b("composer.compactConfirmTitle"):b("composer.compactAria"),disabled:v,onClick:()=>{x?(y(!1),H()):y(!0)},className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-[8px] border p-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 ${x?"border-[#0d9488] bg-[#e3f4f0] text-[#0b7c72]":"border-line bg-panel text-dim hover:border-[#0d9488]/50 hover:text-[#0b7c72]"}`,children:v?(0,d.jsx)(bf,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):x?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aV,{className:"h-4 w-4","aria-hidden":!0}),(0,d.jsx)("span",{className:"text-[10.5px] font-bold",children:b("composer.compactConfirm")})]}):(0,d.jsx)(a$,{className:"h-4 w-4","aria-hidden":!0})})})]})]})})]})}let bv="#0d9488",bw=new Map;function bx(){for(let a of document.querySelectorAll("[data-link-hover]"))a.removeAttribute("data-link-hover")}function by(a,b,c,d){let e=Math.max(48,.45*Math.abs(c-a));return`M ${a} ${b} C ${a+e} ${b}, ${c-e} ${d}, ${c} ${d}`}function bz({drop:a}){let{t:b}=u(),c=Math.max(8,Math.min(a.to.x+14,window.innerWidth-288)),e=Math.max(8,Math.min(a.to.y+12,window.innerHeight-44));return(0,d.jsxs)("div",{className:"fixed flex max-w-[280px] items-center gap-1.5 rounded-full px-3 py-1.5 text-[11.5px] font-semibold text-white shadow-card",style:{left:c,top:e,backgroundColor:bv},children:[(0,d.jsx)(bi,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"truncate",children:b("link.dropped",{title:v(a.file.title,48)})})]})}function bA({file:a,onDeleted:b}){let{t:c}=u(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)("");if("running"===a.proc)return null;let l=async()=>{i(!0),k("");try{let d=await fetch(`/api/log?path=${encodeURIComponent(a.path)}`,{method:"DELETE"}),e=await d.json();if(!d.ok||!e.ok)return void k(e.error??c("common.failedDelete"));g(!1),b?.()}catch{k(c("common.serverUnavailable"))}finally{i(!1)}};return f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:c("delFile.confirm")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:l,children:h?"…":c("common.yes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:c("common.no")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("delFile.aria"),title:c("delFile.aria"),onClick:()=>g(!0),children:(0,d.jsx)(a7,{className:"h-3 w-3","aria-hidden":!0})}),j?(0,d.jsx)("span",{className:"max-w-[160px] truncate text-[10.5px] font-semibold text-err",title:j,children:j}):null]})}function bB({className:a,style:b,enter:c="scale",children:f}){let g=(0,e.useRef)(null);return!function(a="scale"){(0,e.useRef)(new Map),(0,e.useRef)(new WeakMap),(0,e.useRef)(!0)}(c),(0,d.jsx)("div",{ref:g,className:a,style:b,children:f})}let bC=k("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]),bD=/^\s*(?:VERDICT:\s*)?(REQUEST_CHANGES|APPROVE|COMMENT)\b/m,bE=/^\s*(\d+)[.)]\s+(.*)$/,bF=/(?:\[(P[0-3])\]|\b(Critical|High|Medium|Low|Info|P[0-3])\b)/i,bG=/((?:\.{1,2}\/|\/|~\/)?[\w@.+-][\w@.+\-/]*\.(?:tsx?|jsx?|mjs|cjs|mts|cts|py|go|rs|md|json|ya?ml|toml|css|scss|html|sql|sh|env|ftl|txt))(?::(\d+))?/i,bH=/\[([^\]]+)\]\(([^)\s]+)\)/,bI=/([\w.-]*(?:api[_-]?key|access[_-]?token|refresh[_-]?token|authorization|bearer|secret|password|passwd|pwd|token))\b(\s*[:=]\s*)(["']?)[^\s"',}]+/gi;function bJ(a){return a.replace(bI,(a,b,c,d)=>`${b}${c}${d}[redacted]`)}function bK(a){let b=bJ(a);return{raw:b.slice(0,24e3),truncated:b.length>24e3}}function bL(a){let b=a.match(/^(.*?):(\d+(?:-\d+)?)$/);return b?{target:b[1]??a,line:b[2]}:{target:a}}function bM(a,b){let c=a.match(bD)?.[1];if(!c)return null;let d=[],e=[],f=null,g=()=>{let a,b,c,e=f?.trim();e&&d.push((a=function(a){let b=a.toUpperCase();if("P0"===b||"P1"===b||"P2"===b||"P3"===b)return b;let c=a.toLowerCase();return"critical"===c?"Critical":"high"===c?"High":"medium"===c?"Medium":"low"===c?"Low":"Info"}(e.match(bF)?.[1]??e.match(bF)?.[2]??"Info"),b=function(a){let b=a.match(bH);if(b){let a=bL((b[2]??"").replace(/^file:\/\//,"")),c=a.line?Number(a.line.split("-",1)[0]):void 0;return{file:a.target||b[1],line:Number.isFinite(c)?c:void 0}}let c=a.match(bG);if(!c)return{};let d=c[2]?Number(c[2]):void 0;return{file:c[1],line:Number.isFinite(d)?d:void 0}}(e),c=function(a){let b=a,c=b.match(bF);if(c&&void 0!==c.index){let a=b.slice(c.index+c[0].length).replace(/^[\s.:–—-]+/,"");a&&(b=a)}return b.replace(bH,"$1").replace(/`([^`]*)`/g,"$1").replace(/\s+/g," ").trim().slice(0,200)}(e)||e.slice(0,200)||"Finding",{severity:a,file:b.file,line:b.line,title:c,body:bK(e).raw})),f=null};for(let b of a.split("\n")){let a=b.trimEnd(),c=a.match(bE);if(c){g(),f=c[2]??"";continue}let h=a.trim();if(null!==f){h?f=`${f}
3
+ ${h}`:g();continue}!(!h||bD.test(a)||/^(findings?|summary|open questions?|tests?|residual risk)\s*:?\s*$/i.test(h))&&0===d.length&&e.length<3&&h.length<=240&&e.push(h)}g();let h=d.filter(a=>bF.test(a.body)).length;return c||/^findings?\s*:?$/im.test(a)||h>=2||h>=1&&/\b(review|request_changes|approve|comment)\b/i.test(a)?{kind:"review",ts:b,verdict:c,findings:d,summary:e,raw:bK(a).raw}:null}let bN=(a,b)=>t(q(),a,b),bO=/<oai-mem-citation>\s*<citation_entries>([\s\S]*?)<\/citation_entries>\s*<rollout_ids>([\s\S]*?)<\/rollout_ids>\s*<\/oai-mem-citation>/g;function bP(a){return"number"==typeof a&&Number.isFinite(a)?a:void 0}let bQ=/<(teammate-message|agent-message)\b([^>]*)>([\s\S]*?)<\/\1>/g,bR=/\S*\/\.claude\/viewer-inbox\/([A-Za-z0-9._-]+\.(?:png|jpe?g|gif|webp))/gi;function bS(a){if(!a.includes("/.claude/viewer-inbox/"))return{cleaned:a,images:[]};let b=[],c=new Set,d=[];for(let e of a.split("\n"))e.replace(bR,(a,d)=>(c.has(a)||(c.add(a),b.push({name:d,path:a})),"")).trim()&&d.push(e);return{cleaned:d.join("\n").trim(),images:b}}let bT=/^\s*(?:<[a-zA-Z][\w:-]*|Caveat: The messages below|\[Request interrupted|This came from another Claude session|# AGENTS\.md instructions)/;function bU(a,b){let c=a.match(/^\s*<([a-zA-Z][\w:-]*)/)?.[1];return c||(/^\s*# AGENTS\.md/.test(a)?"AGENTS.md":/^\s*Caveat:/.test(a)?"caveat":b||bN("render.system"))}function bV(a,b){return a.match(RegExp(`${b}="([^"]*)"`))?.[1]??""}function bW(a){return"string"==typeof a?a:""}function bX(a){return a&&"object"==typeof a&&!Array.isArray(a)?a:{}}function bY(a){return Array.isArray(a)?a.filter(a=>a&&"object"==typeof a&&!Array.isArray(a)):[]}function bZ(a,b,c){let d=b.split("\n").map(a=>a.trim()).filter(Boolean).map(a=>{let b=a.match(/\|note=\[(.*)\]$/)?.[1],c=bL(a.replace(/\|note=\[.*\]$/,""));return{target:c.target,line:c.line,note:b,raw:a}}),e=c.split(/\s+/).map(a=>a.trim()).filter(a=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a)),f=bK(a);return{kind:"mem-citation",entries:d,rolloutIds:e,raw:f.raw,truncated:f.truncated}}function b$(a,b,c){if(!a)return null;let d=b.match(/exited with code (\d+)/)?.[1],e=b.replace(/^Chunk ID:[^\n]*\n/,"").replace(/Wall time:[^\n]*\n/,"").replace(/Original token count:[^\n]*\n?/,"").trim(),f=!0===c||void 0!==d&&"0"!==d;return a.status=f?"err":"ok",a.label=f?d&&"0"!==d?"exit "+d:bN("render.error"):"ok",a.open||=f,e&&(a.output=(a.output+"\n"+bJ(e)).trim().slice(-(f?6e4:12e3))),a}let b_=k("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]),b0=k("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);function b1({src:a,alt:b,caption:c,onClose:f}){let{t:g}=u(),[h,i]=(0,e.useState)(1),[j,k]=(0,e.useState)(0),[l,n]=(0,e.useState)(0),[o,p]=(0,e.useState)(!1),q=(0,e.useRef)(null),r=(a,b=0,c=0)=>{let d=Math.min(8,Math.max(.25,h*a)),e=d/h;i(d),k(b-(b-j)*e),n(c-(c-l)*e)},s=()=>{i(1),k(0),n(0)};return(0,bj.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-label":b,onClick:f,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5",onClick:a=>a.stopPropagation(),children:[(0,d.jsx)("span",{className:"min-w-0 truncate text-[12.5px] font-semibold text-white/85",children:c??b}),(0,d.jsxs)("span",{className:"ml-auto flex items-center gap-1.5",children:[(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomOut"),onClick:()=>r(1/1.4),children:(0,d.jsx)(b_,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"rounded-lg border border-white/25 bg-white/10 px-2 py-1 text-[11.5px] font-semibold text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.resetZoom"),onClick:s,children:[Math.round(100*h),"%"]}),(0,d.jsx)("button",{className:"inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("lightbox.zoomIn"),onClick:()=>r(1.4),children:(0,d.jsx)(b0,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("button",{className:"ml-1 inline-flex items-center rounded-lg border border-white/25 bg-white/10 px-2.5 py-1 text-white hover:bg-white/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60","aria-label":g("common.close"),onClick:f,children:(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 touch-none overflow-hidden",onClick:a=>a.stopPropagation(),onWheel:a=>{let b=a.currentTarget.getBoundingClientRect(),c=a.clientX-b.left-b.width/2,d=a.clientY-b.top-b.height/2;r(a.deltaY<0?1.18:1/1.18,c,d)},onPointerDown:a=>{a.currentTarget.setPointerCapture(a.pointerId),q.current={x:a.clientX,y:a.clientY,tx:j,ty:l},p(!0)},onPointerMove:a=>{q.current&&(k(q.current.tx+(a.clientX-q.current.x)),n(q.current.ty+(a.clientY-q.current.y)))},onPointerUp:()=>{q.current=null,p(!1)},onPointerCancel:()=>{q.current=null,p(!1)},onDoubleClick:()=>1===h?r(2):s(),children:(0,d.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,d.jsx)("img",{src:a,alt:b,draggable:!1,className:`max-h-full max-w-full select-none ${o?"":"transition-transform duration-75"} ${h>1?"cursor-grab active:cursor-grabbing":"cursor-zoom-in"}`,style:{transform:`translate(${j}px, ${l}px) scale(${h})`}})})})]}),document.body)}function b2({name:a,path:b}){let{t:c}=u(),[f,g]=(0,e.useState)("thumb"),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(""),p=`/api/inbox?name=${encodeURIComponent(a)}`,q=async()=>{m(!0),o("");try{let a=await fetch(p,{method:"DELETE"}),b=await a.json();if(!a.ok||!b.ok)return void o(b.error??c("common.failedDelete"));i("deleted")}catch{o(c("common.serverUnavailable"))}finally{m(!1),k(!1)}};return h?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("span",{className:"inline-flex max-w-[75%] items-center gap-1.5 rounded-full border border-line bg-chip px-2.5 py-1 text-[11.5px] font-semibold text-dim",title:b,children:[(0,d.jsx)(bh,{name:"image",className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{className:"truncate",children:a}),(0,d.jsxs)("span",{className:"shrink-0",children:["\xb7 ","deleted"===h?c("inbox.deleted"):c("inbox.fileGone")]})]})}):"chip"===f?(0,d.jsx)("div",{className:"my-2 flex justify-end",children:(0,d.jsxs)("button",{type:"button",onClick:()=>g("thumb"),className:"inline-flex max-w-[75%] items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",title:b,children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"truncate font-mono text-[12px]",children:a}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-semibold text-accent",children:c("common.show")})]})}):(0,d.jsxs)("div",{className:"my-2 flex justify-end",children:[(0,d.jsxs)("div",{className:"max-w-[75%]",children:[(0,d.jsx)("img",{src:p,alt:c("inbox.attachedAlt",{name:a}),onClick:()=>g("full"),onError:()=>i("missing"),className:"ml-auto block max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap items-center justify-end gap-1.5 text-[11px]",children:[(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-dim",title:b,children:a}),(0,d.jsx)("button",{type:"button",onClick:()=>g("chip"),className:"shrink-0 text-dim hover:text-ink",children:c("common.collapse")}),j?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[(0,d.jsx)("span",{className:"px-1 font-semibold text-err",children:c("inbox.confirmDelete")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:l,onClick:q,children:l?c("trash.deleting"):c("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>k(!1),children:c("common.cancel")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>k(!0),"aria-label":c("inbox.deleteAria",{name:a}),className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-panel px-2 py-0.5 font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(a7,{className:"h-3 w-3","aria-hidden":!0})," ",c("inbox.deleteFromDisk")]}),n?(0,d.jsx)("span",{className:"shrink-0 font-semibold text-err",children:n}):null]})]}),"full"===f?(0,d.jsx)(b1,{src:p,alt:c("inbox.attachedAlt",{name:a}),caption:b,onClose:()=>g("thumb")}):null]})}let b3=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\([^)\s]+\)|https?:\/\/[^\s<>"')\]]+)/g;function b4({href:a,label:b}){return(0,d.jsx)("a",{href:a,target:"_blank",rel:"noreferrer",title:a,className:"break-all text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:b})}function b5(a){return a.split(b3).map((a,b)=>{if(!a)return null;if(a.startsWith("`")&&a.endsWith("`"))return(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:a.slice(1,-1)},b);if(a.startsWith("**")&&a.endsWith("**"))return(0,d.jsx)("b",{children:a.slice(2,-2)},b);let c=a.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/);if(c){let a=c[2].replace(/\\([()])/g,"$1");return/^https?:\/\//.test(a)?(0,d.jsx)(b4,{href:a,label:c[1]},b):(0,d.jsx)("span",{className:"rounded-md bg-chip px-1.5 py-0.5 font-mono",children:c[1]},b)}if(/^https?:\/\//.test(a)){let c=a.replace(/[.,;:!?…»)]+$/,""),e=a.slice(c.length),f=c.length>72?c.slice(0,69)+"…":c;return(0,d.jsxs)("span",{children:[(0,d.jsx)(b4,{href:c,label:f}),e]},b)}return a})}let b6=/^\s*\|.*\|\s*$/,b7=/^:?-{1,}:?$/;function b8({rows:a}){let b=a.map(a=>a.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(a=>a.trim())),c=b.length>1&&b[1].every(a=>b7.test(a)),e=c?b[0]:null,f=c?b.slice(2):b;return(0,d.jsx)("div",{className:"my-1.5 max-w-full overflow-x-auto",children:(0,d.jsxs)("table",{className:"border-collapse text-[12.5px]",children:[e?(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:e.map((a,b)=>(0,d.jsx)("th",{className:"border border-line bg-chip px-2.5 py-1 text-left font-semibold",children:b5(a)},b))})}):null,(0,d.jsx)("tbody",{children:f.map((a,b)=>(0,d.jsx)("tr",{children:a.map((a,b)=>(0,d.jsx)("td",{className:"border border-line px-2.5 py-1 align-top",children:b5(a)},b))},b))})]})})}function b9(a){let b=a.split("\n"),c=[],f=0;for(;f<b.length;){if(/^\s*```/.test(b[f])){let a=f;for(f++;f<b.length&&!/^\s*```\s*$/.test(b[f]);)f++;let e=b.slice(a+1,f).join("\n");f<b.length&&f++,"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)("pre",{className:"my-1.5 max-w-full overflow-x-auto rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11.5px]",children:e},`c${a}`));continue}if(b6.test(b[f])){let a=f;for(;f<b.length&&b6.test(b[f]);)f++;"\n"===c[c.length-1]&&c.pop(),c.push((0,d.jsx)(b8,{rows:b.slice(a,f)},`t${a}`));continue}let a=b[f],g=a.match(/^#{1,6}\s+(.*)$/),h=a.match(/^>\s?(.*)$/);g?c.push((0,d.jsx)("span",{className:"text-[14px] font-bold",children:b5(g[1])},f)):h?c.push((0,d.jsx)("span",{className:"border-l-2 border-line pl-2 text-dim",children:b5(h[1])},f)):c.push((0,d.jsx)(e.Fragment,{children:b5(a)},f)),++f<b.length&&c.push("\n")}return c}function ca({bytes:a,text:b}){let[c,f]=(0,e.useState)(!1),g=Math.round(a/1024);return c?(0,d.jsxs)("div",{className:"my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap break-all bg-[#fafafc] px-3.5 py-2.5 font-mono text-[11.5px]",children:b}),(0,d.jsx)("button",{type:"button",onClick:()=>f(!1),className:"block w-full border-t border-line px-3.5 py-1.5 text-[12px] text-dim",children:bN("common.collapse")})]}):(0,d.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"blob",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:bN("render.dataKb",{n:g})}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:bN("common.show")})]})}let cb=/(?:\/\.codex\/sessions\/|\/\.claude\/projects\/|\/\.claude\/plugins\/data\/codex-openai-codex\/state\/|^\/tmp\/claude-\d+\/)/;function cc({status:a,className:b}){let c=b??"h-3.5 w-3.5";return"ok"===a?(0,d.jsx)(aV,{className:c,"aria-hidden":!0}):"err"===a?(0,d.jsx)(m,{className:c,"aria-hidden":!0}):(0,d.jsx)(bf,{className:`${c} animate-spin`,"aria-hidden":!0})}function cd({file:a,line:b}){let c=b?`${a}:${b}`:a,e="inline-block min-w-0 max-w-full truncate rounded-md bg-chip px-1.5 py-0.5 align-bottom font-mono text-[11.5px]";return cb.test(a)?(0,d.jsx)("a",{href:`#f=${encodeURIComponent(a)}`,className:`${e} text-accent underline decoration-dotted`,title:c,children:c}):(0,d.jsx)("code",{className:e,title:c,children:c})}function ce({item:a}){let b=Object.entries(a.byTool).map(([a,b])=>`${a} \xd7${b}`).join(" \xb7 "),c=$(a.t0),e=$(a.t1),f=c&&e&&c!==e?`${c}–${e}`:c||e;return(0,d.jsxs)("details",{className:`my-2.5 ml-9 overflow-hidden rounded-[14px] border shadow-card ${a.hasErr?"border-err/35 bg-[#fff4f4]":"border-line bg-panel"}`,open:a.hasErr,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"cmd-group",className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1 truncate text-[12.5px]",children:[bN("render.commands",{count:a.calls.length}),b?" \xb7 "+b:""," \xb7",(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-ok",children:[(0,d.jsx)(aV,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.okCount]}),a.errCount?(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-err",children:[(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.errCount]}):null]}),f?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:f}):null]}),(0,d.jsx)("div",{className:"space-y-1 border-t border-line bg-[#fafafc] px-2 py-1.5",children:a.calls.map((b,c)=>{let e="ok"===b.status?"text-ok":"err"===b.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"overflow-hidden rounded-[10px] border border-line bg-panel",open:b.open,children:[(0,d.jsxs)("summary",{className:"flex h-6 cursor-pointer list-none items-center gap-2 px-2.5 text-[11.5px]",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(bh,{name:b.icon,className:"h-3 w-3"})}),(0,d.jsx)("code",{className:"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-1.5 py-0.5 font-mono text-[11px]",children:b.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${e}`,children:[(0,d.jsx)(cc,{status:b.status,className:"h-3 w-3"}),b.label]})]}),(0,d.jsx)("pre",{className:"max-h-[280px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3 py-2 font-mono text-[11.5px]",children:"$ "+b.cmd+(b.output?"\n"+b.output:"")})]},a.ids[c])})})]})}function cf({item:a}){let b=[a.trigger?bN("auto"===a.trigger?"render.compactAuto":"render.compactManual"):"",a.preTokens?bN("render.compactPre",{n:Math.round(a.preTokens/1e3)}):"",$(a.ts)||""].filter(Boolean).join(" \xb7 ");return(0,d.jsxs)("div",{className:"my-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0}),(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-[#0d9488]/30 bg-[#e7f6f4] px-2.5 py-1 text-[11px] font-bold text-[#0b7c72]",children:[(0,d.jsx)(bh,{name:"compact",className:"h-3.5 w-3.5"}),bN("render.compacted"),b?(0,d.jsx)("span",{className:"font-semibold opacity-75",children:b}):null]}),(0,d.jsx)("span",{className:"h-px flex-1 bg-[#0d9488]/30","aria-hidden":!0})]}),a.summary?(0,d.jsxs)("details",{className:"group/cmp mt-1.5 text-center",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[11px] font-semibold text-[#0b7c72] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/cmp:hidden",children:[bN("render.compactSummary")," \xb7 ",bN("common.show")]}),(0,d.jsx)("span",{className:"hidden group-open/cmp:inline",children:bN("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11px] text-[#555]",children:a.summary})]}):null]})}function cg({media:a,data:b,w:c,h:f,bytes:g}){let[h,i]=(0,e.useState)("thumb"),j=Math.round((g??3*b.length/4)/1024),k=c&&f?`${c}\xd7${f}`:bN("render.image");if("chip"===h)return(0,d.jsxs)("button",{type:"button",onClick:()=>i("thumb"),className:"my-2 ml-9 flex items-center gap-2 rounded-[14px] border border-line bg-panel px-3.5 py-2 text-[13px] shadow-card",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"image",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"font-semibold",children:k}),(0,d.jsxs)("span",{className:"text-dim",children:["\xb7 ",j," ",bN("common.kb")]}),(0,d.jsx)("span",{className:"ml-1 text-[12px] font-semibold text-accent",children:bN("common.show")})]});let l=`data:${a};base64,${b}`;return(0,d.jsxs)("div",{className:"my-2 ml-9",children:[(0,d.jsx)("img",{src:l,alt:`${bN("render.image")} ${k}`,onClick:()=>i("full"),className:"max-h-[240px] cursor-zoom-in rounded-[14px] border border-line"}),(0,d.jsx)("button",{type:"button",onClick:()=>i("chip"),className:"mt-1 block text-[12px] text-dim",children:bN("common.collapse")}),"full"===h?(0,d.jsx)(b1,{src:l,alt:`${bN("render.image")} ${k}`,caption:`${k} \xb7 ${j} ${bN("common.kb")}`,onClose:()=>i("thumb")}):null]})}function ch({item:a}){let b=a.entries.slice(0,8),c=a.rolloutIds.slice(0,6);return(0,d.jsxs)("details",{className:"group my-2 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel text-[12px] shadow-card",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"citation",className:"h-4 w-4"})}),(0,d.jsx)("span",{className:"text-[13px] font-semibold",children:bN("render.memoryCitations",{count:a.entries.length})}),(0,d.jsx)("span",{className:"ml-auto text-[11px] font-semibold text-accent group-open:hidden",children:bN("common.show")}),(0,d.jsx)("span",{className:"ml-auto hidden text-[11px] font-semibold text-accent group-open:inline",children:bN("common.collapse")})]}),(0,d.jsxs)("div",{className:"border-t border-line px-3.5 py-2.5",children:[b.length?(0,d.jsx)("div",{className:"space-y-1.5",children:b.map((a,b)=>(0,d.jsxs)("div",{className:"min-w-0 rounded-[9px] bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)(cd,{file:a.target,line:a.line?Number(a.line.split("-",1)[0]):void 0}),a.note?(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words text-[12px] text-[#555]",children:a.note}):null]},b))}):(0,d.jsx)("div",{className:"text-[12px] text-dim",children:bN("render.noCitations")}),a.entries.length>b.length?(0,d.jsx)("div",{className:"mt-1.5 text-[12px] text-dim",children:bN("render.moreEntries",{count:a.entries.length-b.length})}):null,c.length?(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11px] text-dim",children:"rollout:"}),c.map(a=>(0,d.jsx)("code",{className:"rounded-full bg-chip px-2 py-0.5 font-mono text-[10.5px] text-dim",title:a,children:a.slice(0,8)},a)),a.rolloutIds.length>c.length?(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:["+",a.rolloutIds.length-c.length]}):null]}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:["raw citation block",a.truncated?" \xb7 "+bN("render.truncated"):""]}),(0,d.jsx)("pre",{className:"max-h-[260px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}let ci={shutdown_request:{icon:"shutdown",labelKey:"render.shutdownRequest",tone:"amber"},shutdown_response:{icon:"shutdown",labelKey:"render.shutdownResponse",tone:"amber"},plan_approval_request:{icon:"plan",labelKey:"render.planRequest",tone:"accent"},plan_approval_response:{icon:"plan",labelKey:"render.planVerdict",tone:"accent"}};function cj(a){return"string"==typeof a&&a.length?a:void 0}function ck({approve:a}){return(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${a?"border-ok/25 bg-[#eefaf1] text-ok":"border-err/25 bg-[#fff0f0] text-err"}`,children:a?bN("render.approved"):bN("render.rejected")})}function cl({payload:a}){let b=cj(a.from),c=cj(a.requestId),e=$(a.timestamp);return b||c||e?(0,d.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[11px] text-dim",children:[b?(0,d.jsx)("span",{children:bN("render.from",{from:b})}):null,c?(0,d.jsx)("span",{className:"truncate font-mono",title:c,children:c.length>40?c.slice(0,40)+"…":c}):null,e?(0,d.jsx)("span",{children:e}):null]}):null}function cm({payload:a}){let b=cj(a.type),c=b?ci[b]:void 0;if(!c)return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsx)("div",{className:"text-dim",children:bN("render.structured")}),(0,d.jsxs)("details",{className:"mt-1 text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:bN("render.showJson")}),(0,d.jsx)("pre",{className:"mt-1 max-h-[280px] overflow-auto whitespace-pre-wrap rounded-md bg-chip px-2.5 py-2 font-mono text-[11.5px]",children:JSON.stringify(a,null,2)})]})]});let e="boolean"==typeof a.approve?a.approve:void 0,f=cj(a.reason)??cj(a.feedback);return(0,d.jsxs)("div",{className:"text-[13px]",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:`inline-flex items-center gap-1 rounded-full border px-2.5 py-0.5 text-[11.5px] font-bold ${"amber"===c.tone?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"border-accent/25 bg-accent/10 text-accent"}`,children:[(0,d.jsx)(bh,{name:c.icon,className:"h-3.5 w-3.5"}),bN(c.labelKey)]}),void 0!==e?(0,d.jsx)(ck,{approve:e}):null]}),f?(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words",children:b9(f)}):null,(0,d.jsx)(cl,{payload:a})]})}function cn({verdict:a}){return(0,d.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,d.jsx)("REQUEST_CHANGES"===a?aT:"APPROVE"===a?aY:a1,{className:"h-3.5 w-3.5","aria-hidden":!0}),"REQUEST_CHANGES"===a?"REQUEST_CHANGES":"APPROVE"===a?"APPROVE":"COMMENT"]})}function co({item:a}){var b;let c=a.findings.length,e=a.findings.slice(0,12);return(0,d.jsxs)("div",{className:"my-3.5 ml-9 overflow-hidden rounded-[14px] border border-codex/20 bg-panel shadow-card",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line px-3.5 py-2.5",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-codex-soft text-codex",children:(0,d.jsx)(aZ,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[13.5px] font-bold",children:"Codex review"}),a.verdict?(0,d.jsx)("span",{className:`rounded-full border px-2.5 py-0.5 text-[11.5px] font-extrabold ${"REQUEST_CHANGES"===(b=a.verdict)?"bg-[#fff0f0] text-err border-err/25":"APPROVE"===b?"bg-[#eefaf1] text-ok border-ok/25":"bg-chip text-[#555] border-line"}`,children:(0,d.jsx)(cn,{verdict:a.verdict})}):null,(0,d.jsx)("span",{className:"text-[11px] text-dim",children:c?`${c} finding${1===c?"":"s"}`:bN("render.noFindings")}),$(a.ts)?(0,d.jsx)("span",{className:"ml-auto text-[11px] text-dim",children:$(a.ts)}):null]}),(0,d.jsxs)("div",{className:"px-3.5 py-2.5",children:[a.summary.length?(0,d.jsx)("div",{className:"mb-2 whitespace-pre-wrap break-words text-[13px] text-[#444]",children:b9(a.summary.join("\n"))}):null,e.length?(0,d.jsx)("div",{className:"space-y-2",children:e.map((a,b)=>{var c;return(0,d.jsxs)("div",{className:"rounded-[10px] border border-line bg-[#fbfbfd] px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("span",{className:`rounded-full border px-2 py-0.5 text-[10.5px] font-extrabold ${"Critical"===(c=a.severity)||"High"===c||"P0"===c||"P1"===c?"border-err/30 bg-[#fff4f4] text-err":"Medium"===c||"P2"===c?"border-[#d89b21]/35 bg-[#fff9ea] text-[#9a6500]":"Low"===c||"P3"===c?"border-line bg-chip text-[#555]":"border-line bg-panel text-dim"}`,children:a.severity}),a.file?(0,d.jsx)(cd,{file:a.file,line:a.line}):null]}),(0,d.jsx)("div",{className:"mt-1.5 whitespace-pre-wrap break-words text-[13px]",children:b5(a.title)}),a.body&&a.body!==a.title?(0,d.jsxs)("details",{className:"mt-1 text-[12px] text-dim",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none font-semibold text-accent",children:"details"}),(0,d.jsx)("div",{className:"mt-1 whitespace-pre-wrap break-words",children:b9(a.body)})]}):null]},b)})}):null,a.findings.length>e.length?(0,d.jsx)("div",{className:"mt-2 text-[12px] text-dim",children:bN("render.moreFindings",{count:a.findings.length-e.length})}):null,(0,d.jsxs)("details",{className:"mt-2 rounded-[10px] border border-line bg-[#fafafc] text-[12px]",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none px-3 py-1.5 font-semibold text-dim",children:"raw review text"}),(0,d.jsx)("pre",{className:"max-h-[320px] overflow-auto whitespace-pre-wrap border-t border-line px-3 py-2 font-mono text-[11.5px] text-[#555]",children:a.raw})]})]})]})}function cp({label:a,text:b}){let c=b.length>=2048?`${(b.length/1024).toFixed(1)} ${bN("common.kb")}`:bN("common.chars",{n:b.length});return(0,d.jsxs)("details",{className:"group my-1.5 ml-9",children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[11px] font-semibold text-dim hover:text-ink [&::-webkit-details-marker]:hidden",children:[(0,d.jsx)("span",{className:"flex h-4.5 w-4.5 items-center justify-center rounded-md bg-chip",children:(0,d.jsx)(bh,{name:"cmd-group",className:"h-3 w-3"})}),(0,d.jsx)("span",{className:"rounded-full bg-chip px-1.5 py-0.5 font-mono text-[9.5px]",children:a}),(0,d.jsxs)("span",{children:[bN("render.system")," \xb7 ",c]}),(0,d.jsx)("span",{className:"text-accent group-open:hidden",children:bN("common.show")}),(0,d.jsx)("span",{className:"hidden text-dim group-open:inline",children:bN("common.collapse")})]}),(0,d.jsx)("pre",{className:"mt-1 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 font-mono text-[11px] text-[#555]",children:b})]})}let cq=(0,e.memo)(function({item:a}){if("image"===a.kind)return(0,d.jsx)(cg,{media:a.media,data:a.data,w:a.w,h:a.h,bytes:a.bytes});if("inbox-image"===a.kind)return(0,d.jsx)(b2,{name:a.name,path:a.path});if("blob"===a.kind)return(0,d.jsx)(ca,{bytes:a.bytes,text:a.text});if("sysmsg"===a.kind)return(0,d.jsx)(cp,{label:a.label,text:a.text});if("compact"===a.kind)return(0,d.jsx)(cf,{item:a});if("review"===a.kind)return(0,d.jsx)(co,{item:a});if("mem-citation"===a.kind)return(0,d.jsx)(ch,{item:a});if("prose"===a.kind){let b="codex"===a.engine?"bg-codex":"bg-claude",c="codex"===a.engine?aZ:a4;return(0,d.jsxs)("div",{className:"my-3.5 flex gap-2.5",children:[(0,d.jsx)("div",{className:`mt-1 flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-full text-white ${b}`,children:(0,d.jsx)(c,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:[$(a.ts)?(0,d.jsx)("div",{className:"mb-0.5 text-[11px] text-dim",children:$(a.ts)}):null,b9(a.text)]})]})}if("user"===a.kind){let b=a.text.length>500;return(0,d.jsx)("div",{className:"my-3.5 flex justify-end",children:(0,d.jsx)("div",{className:"max-w-[75%] whitespace-pre-wrap break-words rounded-2xl bg-user px-4 py-2.5",children:b?(0,d.jsxs)("details",{className:"group/usr",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/usr:hidden",children:[a.text.slice(0,180),"… ",(0,d.jsxs)("span",{className:"font-semibold text-accent",children:["(",bN("common.chars",{n:a.text.length}),")"]})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/usr:inline-flex",children:[bN("common.collapse")," ",(0,d.jsx)(aX,{className:"h-3 w-3","aria-hidden":!0})]})]}),b9(a.text)]}):b9(a.text)})})}if("cmd"===a.kind){let b="ok"===a.call.status?"text-ok":"err"===a.call.status?"text-err":"text-dim";return(0,d.jsxs)("details",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-line bg-panel shadow-card",open:a.call.open,children:[(0,d.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 px-3.5 py-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:a.call.icon,className:"h-4 w-4"})}),(0,d.jsx)("code",{className:"max-w-[70%] overflow-hidden text-ellipsis whitespace-nowrap rounded-md bg-chip px-2 py-0.5 font-mono text-[12.5px]",children:a.call.display}),(0,d.jsxs)("span",{className:`ml-auto inline-flex shrink-0 items-center gap-1 text-xs font-semibold ${b}`,children:[(0,d.jsx)(cc,{status:a.call.status}),a.call.label]})]}),(0,d.jsx)("pre",{className:"max-h-[340px] overflow-auto whitespace-pre-wrap border-t border-line bg-[#fafafc] px-3.5 py-2.5 font-mono text-[12.5px]",children:"$ "+a.call.cmd+(a.call.output?"\n"+a.call.output:"\n"+bN("render.noOutputInLog"))})]})}if("cmd-group"===a.kind)return(0,d.jsx)(ce,{item:a});if("edit"===a.kind)return(0,d.jsxs)("div",{className:"my-2.5 ml-9 flex items-center gap-3 rounded-[14px] border border-line bg-panel px-3.5 py-2.5 shadow-card",children:[(0,d.jsx)("span",{className:"flex h-7.5 w-7.5 items-center justify-center rounded-lg bg-chip",children:(0,d.jsx)(bh,{name:"note",className:"h-4 w-4"})}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold",children:a.files}),(0,d.jsx)("div",{className:"text-xs text-dim",children:bN("render.filesChanged")})]})]});if("tmsg"===a.kind){let b=function(a){let b=a.trim();if((b.startsWith('"')&&b.endsWith('"')||b.startsWith("'")&&b.endsWith("'"))&&(b=b.slice(1,-1).trim()),!b.startsWith("{"))return null;try{let a=JSON.parse(b);if(null!==a&&"object"==typeof a&&!Array.isArray(a))return a}catch{}return null}(a.text),c=a.text.length>420||a.text.split("\n").length>6;return(0,d.jsxs)("div",{className:"my-2.5 ml-9 overflow-hidden rounded-[14px] border border-accent/25 bg-[#f8f8fd] shadow-card",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2",children:[(0,d.jsx)("span",{className:"flex h-6.5 w-6.5 shrink-0 items-center justify-center rounded-lg bg-[#ecebfb] text-accent",children:(0,d.jsx)(a0,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:"out"===a.dir?bN("render.toDir"):bN("render.fromDir")}),(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-bold text-accent",children:a.peer}),a.delivery?(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 text-[10.5px] font-semibold ${"ok"===a.delivery?"text-ok":"text-err"}`,title:a.msgId?`msg_id: ${a.msgId}`:void 0,children:["ok"===a.delivery?(0,d.jsx)(aV,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0}),"ok"===a.delivery?bN("render.delivered"):bN("render.notDelivered")]}):null,$(a.ts)?(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:$(a.ts)}):null]}),(0,d.jsx)("div",{className:"px-3.5 pb-2.5 pt-1",children:b?(0,d.jsx)(cm,{payload:b}):(0,d.jsxs)(d.Fragment,{children:[a.summary?(0,d.jsx)("div",{className:"text-[13px] font-bold",children:b5(a.summary)}):null,c?(0,d.jsxs)("details",{className:"group/tmsg mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:[(0,d.jsxs)("summary",{className:"cursor-pointer list-none text-[12.5px] text-[#555] [&::-webkit-details-marker]:hidden",children:[(0,d.jsxs)("span",{className:"group-open/tmsg:hidden",children:[a.text.slice(0,260).trimEnd(),"… ",(0,d.jsx)("span",{className:"font-semibold text-accent",children:bN("common.showAll")})]}),(0,d.jsxs)("span",{className:"hidden items-center gap-1 text-[11px] font-semibold text-dim group-open/tmsg:inline-flex",children:[bN("common.collapse")," ",(0,d.jsx)(aX,{className:"h-3 w-3","aria-hidden":!0})]})]}),b9(a.text)]}):(0,d.jsx)("div",{className:"mt-0.5 whitespace-pre-wrap break-words text-[13px]",children:b9(a.text)})]})})]})}if("tnote"===a.kind)return(0,d.jsxs)("div",{className:"my-1 ml-9 flex items-center gap-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)(a0,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.text]});if("think"===a.kind){let b=a.text.length>150;return(0,d.jsxs)("details",{className:"my-1 ml-9 text-[11.5px] italic text-dim",children:[(0,d.jsxs)("summary",{className:`flex list-none items-center gap-1.5 truncate ${b?"cursor-pointer":""}`,title:bN("render.reasoning"),children:[(0,d.jsx)(aU,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsxs)("span",{className:"truncate",children:[a.text.slice(0,150),b?"…":""]})]}),b?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words pt-1 not-italic",children:b9(a.text)}):null]})}return"svc"===a.kind?(0,d.jsx)("div",{className:"my-1 break-words text-[11.5px] text-dim",children:a.text}):"note"===a.kind?(0,d.jsx)("div",{className:"my-2 break-words text-[12.5px] text-dim",children:b5(a.text)}):(0,d.jsx)("div",{className:`my-0.5 break-words text-[12.5px] ${a.err?"text-err":"text-[#555]"}`,children:a.text})}),cr=k("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),cs=k("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"}]]);function ct({file:a}){let{t:b}=u(),c=a.pendingQuestion,[f,g]=(0,e.useState)("pending"),[h,i]=(0,e.useState)(""),[j,k]=(0,e.useState)({}),[l,n]=(0,e.useState)(""),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),s=c?null!==c.paneTarget:null!==a.pid&&"running"===a.proc,t=(0,e.useMemo)(()=>c?.questions?c.questions.map((a,b)=>(j[b]??[]).map(b=>a.options[b]?.label??String(b+1)).join(", ")).filter(Boolean).join(" \xb7 "):"",[j,c]);if(!c){if(!a.waitingInput)return null;let c=a.waitingInput.menu,e="delivering"===f,j=async(d,e)=>{g("delivering"),i("");try{let f=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"dialog-key",path:a.path,key:d,...c?{question:c.question}:{},.../^[1-9]$/.test(d)?{label:e}:{}})}),h=await f.json();if(!f.ok||!h.ok){g("failed"),i(h.error??b("common.failedSend"));return}g("answered"),i(e)}catch{g("failed"),i(b("common.serverUnavailable"))}};return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.sentToPane",{text:h})}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cr,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsxs)("div",{className:"text-[13px] font-semibold text-ink",children:[b("question.pane",{target:a.waitingInput.target})," \xb7 ",function(a,b){let c=Math.max(0,Math.floor(Date.now()/1e3-b));if(c<60)return a("question.sec",{n:c});let d=Math.floor(c/60);return d<60?a("question.min",{n:d}):a("question.hour",{n:Math.floor(d/60)})}(b,a.waitingInput.since)]}),c?(0,d.jsxs)(d.Fragment,{children:[c.tabs.length?(0,d.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:c.tabs.map((a,b)=>(0,d.jsxs)("span",{className:`rounded-full px-2 py-0.5 text-[11px] font-bold ${a.done?"bg-ok/15 text-ok":"bg-bg text-dim"}`,children:[a.done?"✓ ":"",a.label]},b))}):null,(0,d.jsx)("div",{className:"mt-2 text-[14px] font-bold text-ink",children:c.question}),(0,d.jsx)("div",{className:"mt-2 space-y-1.5",children:c.options.map(a=>(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 disabled:opacity-60 ${a.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:e||a.value>9,onClick:()=>void j(String(a.value),a.label),children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:a.value}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:a.label}),a.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:a.description}):null]})]},a.value))})]}):(0,d.jsx)("pre",{className:"mt-2 max-h-[240px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[12px] text-dim",children:a.waitingInput.screenTail}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[["Tab","Enter","Escape"].map(a=>(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1 text-[12px] font-semibold text-dim disabled:opacity-60",disabled:e,onClick:()=>void j(a,"Escape"===a?"Esc":a),children:"Escape"===a?"Esc":a},a)),(0,d.jsx)("span",{className:"text-[12px] text-dim",children:b("question.keysHint")})]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-2 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bf,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-err",children:h}):null]})}let v=async(a,d)=>{g("delivering"),i("");try{let e=await fetch("/api/answer",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({transcriptPath:c.transcriptPath,toolUseId:c.toolUseId,kind:c.kind,...a})}),f=await e.json();if(!e.ok||!f.ok){if(409===e.status&&(f.superseded||f.answer)){g("superseded"),i(f.answer??f.error??b("question.alreadyAnswered"));return}g("failed"),i(f.error??b("common.failedSend"));return}g("answered"),i(f.answer??d)}catch{g("failed"),i(b("common.serverUnavailable"))}},w=(a=j)=>c.questions?.map((b,c)=>a[c]??[])??[],x=c.questions?.length??0,y=x>1||(c.questions?.some(a=>a.multiSelect)??!1),z=c.questions?.every((a,b)=>(j[b]??[]).length>0)??!1,A=async()=>{r(!0),i("");try{let c=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"resume",path:a.path})}),d=await c.json();if(!c.ok||!d.ok)return void i(d.error??b("question.openFailed"));i(b("question.opened",{target:d.target??"tmux"}))}catch{i(b("common.serverUnavailable"))}finally{r(!1)}},B="delivering"===f||!s;return"answered"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-ok/25 bg-[#eefaf1] px-4 py-3 text-[13px] font-semibold text-ok",children:b("question.answered",{text:h||t})}):"superseded"===f?(0,d.jsx)("div",{id:"question",className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:b("question.answeredElsewhere",{text:h})}):c&&!s?(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cr,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-err",children:b("question.noPane")}),"plan"===c.kind?(0,d.jsx)("pre",{className:"mt-2 max-h-[320px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}):c.questions?.map((a,b)=>(0,d.jsxs)("div",{className:"mt-2",children:[(0,d.jsx)("div",{className:"text-[12px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"text-[13px] font-semibold text-ink",children:a.question})]},b)),(0,d.jsx)("button",{className:"mt-3 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:q,onClick:A,children:b("question.openSession")}),h?(0,d.jsx)("div",{className:"mt-2 text-[12px] font-semibold text-dim",children:h}):null]}):(0,d.jsxs)("div",{id:"question",className:"my-4 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] p-4 shadow-card",children:[(0,d.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[(0,d.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#f5dfae] px-2 py-0.5 text-[11px] font-bold text-[#8a5a00]",children:[(0,d.jsx)(cr,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",b("question.waiting")]}),s?null:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:b("question.noPane")})]}),"plan"===c.kind?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("pre",{className:"max-h-[420px] overflow-auto whitespace-pre-wrap break-words rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px]",children:c.plan}),(0,d.jsx)("textarea",{className:"mt-3 min-h-20 w-full resize-y rounded-[8px] border border-line bg-bg px-3 py-2 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.rejectComment"),value:o,onChange:a=>p(a.target.value)}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-ok px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>v({approve:!0},b("question.approved")),children:[(0,d.jsx)(aV,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.approve")]}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-err px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B,onClick:()=>v({approve:!1,text:o},b("question.rejected")),children:[(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})," ",b("question.reject")]})]})]}):(0,d.jsxs)(d.Fragment,{children:[c.questions?.map((a,b)=>(0,d.jsxs)("section",{className:"mt-3 first:mt-0",children:[(0,d.jsx)("div",{className:"mb-1 inline-flex rounded-full bg-bg px-2 py-0.5 text-[11px] font-bold text-dim",children:a.header}),(0,d.jsx)("div",{className:"mb-2 text-[14px] font-bold text-ink",children:a.question}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.options.map((c,e)=>{let f=(j[b]??[]).includes(e);return(0,d.jsxs)("button",{className:`flex w-full items-start gap-2 rounded-[8px] border px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/35 ${f?"border-accent/45 bg-accent/10":c.recommended?"border-[#e0ae45]/45 bg-[#fff5dc]":"border-line bg-bg"}`,disabled:B,onClick:()=>{var d;let f={...j,[b]:[e]};d=a.multiSelect,k(a=>{let c=a[b]??[],f=d?c.includes(e)?c.filter(a=>a!==e):[...c,e]:[e];return{...a,[b]:f}}),a.multiSelect||1!==x||v({answers:w(f)},c.label)},children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border border-line bg-panel text-[10px] font-bold",children:f?"✓":e+1}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block text-[13px] font-bold",children:c.label}),c.description?(0,d.jsx)("span",{className:"block text-[12px] text-dim",children:c.description}):null]})]},e)})})]},b)),x<=1?(0,d.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,d.jsx)("input",{className:"min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 py-1.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/35",placeholder:b("question.ownAnswer"),value:l,onChange:a=>n(a.target.value)}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!l.trim(),onClick:()=>v({text:l},l),children:[(0,d.jsx)(cs,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]})]}):null,y?(0,d.jsxs)("button",{className:"mt-3 inline-flex items-center gap-1.5 rounded-[8px] bg-accent px-3 py-1.5 text-[13px] font-bold text-white disabled:opacity-60",disabled:B||!z,onClick:()=>v({answers:w()},t),children:[(0,d.jsx)(cs,{className:"h-4 w-4","aria-hidden":!0})," ",b("common.send")]}):null]}),"delivering"===f?(0,d.jsxs)("div",{className:"mt-3 inline-flex items-center gap-1.5 text-[12px] font-semibold text-dim",children:[(0,d.jsx)(bf,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," ",b("common.sending")]}):null,"failed"===f?(0,d.jsx)("div",{className:"mt-3 text-[12px] font-semibold text-err",children:h}):null]})}function cu({file:a}){let{t:b}=u();return"running"===a.proc?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[11px] font-bold text-ok",children:[(0,d.jsx)(a3,{className:"h-3 w-3","aria-hidden":!0})," PID ",a.pid]}):"killed"===a.proc||"stalled"===a.activity?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#f7e8e8] px-2 py-0.5 text-[11px] font-bold text-err",children:b("task.interruptedBadge")}):"done"===a.proc?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full bg-chip px-2 py-0.5 text-[11px] font-bold text-dim",children:b("task.finishedBadge")}):null}function cv({file:a,compact:b=!1}){let{t:c}=u(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,m]=(0,e.useState)(!1),n=(0,d.jsx)(cu,{file:a}),o=async()=>{i(!0),k("");try{let b=await fetch("/api/proc",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:a.path,force:l})}),d=await b.json();if(!b.ok||!d.ok){k(d.error??c("task.stopFailed")),m(!0);return}k(c("task.signalSent",{signal:l?"SIGKILL":"SIGTERM",pid:d.pid??""})),g(!1)}catch{k(c("common.serverUnavailable")),m(!0)}finally{i(!1)}};return(0,d.jsxs)("span",{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5 ${b?"text-[10.5px]":"text-xs"}`,children:[n,"running"===a.proc?f?(0,d.jsxs)("span",{className:"inline-flex max-w-full items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5",children:[b?null:(0,d.jsx)("span",{className:"truncate px-1 text-[11px] font-semibold text-err",children:c("task.confirmKill",{pid:a.pid??""})}),(0,d.jsx)("button",{className:"rounded-lg bg-err px-2 py-0.5 text-[11px] font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:h,onClick:o,children:l?"SIGKILL":b?c("task.killPid",{pid:a.pid??""}):c("task.confirmKillYes")}),(0,d.jsx)("button",{className:"rounded-lg border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>g(!1),children:b?c("common.no"):c("common.cancel")})]}):(0,d.jsx)("button",{className:"rounded-full border border-line bg-panel px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("task.stopAria",{pid:a.pid??""}),onClick:()=>g(!0),children:c("task.kill")}):null,j?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[11px] font-semibold text-dim",children:j}):null]})}function cw({file:a,files:b,onSelect:c}){let{t:e}=u();if("codex-jobs"===a.root){let f=b.find(b=>"codex-sessions"===b.root&&b.parent===a.path);return(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(cu,{file:a})}),f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-2 whitespace-pre-line text-[13.5px] font-semibold",children:e("task.jobLogHint")}),(0,d.jsxs)("button",{className:"inline-flex items-center gap-1.5 rounded-[10px] border border-line bg-bg px-3 py-1.5 text-[13px] font-semibold text-codex hover:bg-codex-soft",onClick:()=>c(f),children:[(0,d.jsx)(aZ,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",e("task.openCodexSession",{size:(f.size/1024).toFixed(0),activity:"live"===f.activity?e("task.working"):"stalled"===f.activity?e("task.interrupted"):"recent"===f.activity?e("task.finished"):""})]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:e("task.rolloutMissing")})]})}return"claude-tasks"!==a.root?null:(0,d.jsxs)("div",{className:"mb-4 mt-1 rounded-[14px] border border-line bg-panel px-4 py-3 shadow-card",children:[(0,d.jsx)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:(0,d.jsx)(cu,{file:a})}),a.cmd?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mb-1 text-[13.5px] font-semibold",children:a.cmdDesc||e("task.backgroundCommand")}),(0,d.jsxs)("code",{className:"block whitespace-pre-wrap break-words rounded-lg border border-line bg-[#fafafc] px-2.5 py-2 font-mono text-[12.5px]",children:["$ ",a.cmd]})]}):(0,d.jsx)("div",{className:"text-[13.5px] text-dim",children:e("task.commandNotFound")})]})}let cx=new Map;function cy(a,b,c){cx.size>300&&!cx.has(a)&&cx.clear(),cx.set(a,{magnet:b,fromBottom:c})}function cz({icon:a,label:b}){return(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-[12px] font-semibold text-ok",children:[(0,d.jsxs)("span",{className:"flex items-center gap-0.5","aria-hidden":!0,children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:150ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-ok [animation-delay:300ms]"})]}),(0,d.jsx)(a,{className:"h-3.5 w-3.5","aria-hidden":!0}),b]})}function cA({file:a,files:b,onSelect:c,showSvc:f,lineFilter:g,onStatus:h,paused:i,follow:j,setFollow:k,compact:l=!1}){let{locale:m,t:n}=u(),[o,p]=(0,e.useState)(()=>a?cx.get(a.path)?.magnet??j:j),q=function(a,b=!1,c=2500){(0,e.useRef)(c);let[d,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(0),[i,j]=(0,e.useState)(!1),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(0),x=(0,e.useRef)(0),y=(0,e.useRef)(""),z=(0,e.useRef)(!0),A=(0,e.useRef)(0);(0,e.useRef)(!1);let B=(0,e.useRef)(!1);return{lines:d,size:g,loading:i,error:k,tickTime:m,paused:o,setPaused:p,clear:(0,e.useCallback)(()=>{f([]),w.current=0,x.current=0,y.current="",z.current=!0,r(!1)},[]),hasMore:q,loadingOlder:s,loadOlder:(0,e.useCallback)(async()=>{if(!a||B.current||x.current<=0)return 0;B.current=!0,t(!0);let b=A.current;try{let c="",d=x.current;for(let e=0;e<4;e+=1){let e=await fetch(`/api/log?path=${encodeURIComponent(a.path)}&before=${d}`),f=await e.json();if(b!==A.current||"error"in f&&f.error)return 0;if(c=f.data+c,d=f.start,0===d||c.slice(0,-1).includes("\n"))break}let e=d;if(d>0){let a,b=c.indexOf("\n");if(b<0||b===c.length-1)return 0;e=d+(a=c.slice(0,b+1),new TextEncoder().encode(a).length),c=c.slice(b+1)}let g=c.split("\n");""===g.at(-1)&&g.pop();let h=g.map(a=>a.trim()).filter(Boolean);return x.current=e,r(e>0),h.length&&(f(a=>h.concat(a)),v(a=>a+1)),h.length}catch{return 0}finally{B.current=!1,t(!1)}},[a?.path]),prependGen:u}}(a,i,o&&l?2500:0),r=(0,e.useRef)(null),s=(0,e.useRef)(null),t=(0,e.useRef)(null),v=l?500:1500,[w,x]=(0,e.useState)(l?300:1500),[y,z]=(0,e.useState)(0),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(null);(0,e.useRef)(!1);let F=(0,e.useRef)(o);(0,e.useRef)(0),(0,e.useRef)(0);let G=(0,e.useRef)(null),H=(0,e.useRef)(0);(0,e.useRef)(null);let I=(b,c=!1)=>{F.current=b,p(b),k(b),b&&z(0),a&&cy(a.path,b,cx.get(a.path)?.fromBottom??0),c&&(C(!0),G.current&&window.clearTimeout(G.current),G.current=window.setTimeout(()=>C(!1),450))},J=()=>{let a=r.current;a&&(H.current=Date.now(),a.scrollTop=a.scrollHeight)},K=(0,e.useMemo)(()=>a?function(a,b,c,d){let e=new Map,f=new Map,g=[],h=0,i="",j=a=>!!(!(a.length<=2e4)&&(a.match(/\s/g)?.length??0)/a.length<.02)&&(g.push({kind:"blob",bytes:a.length,text:bJ(a).slice(0,2e5)}),!0),k=(a,b)=>{let c=bX(a.source),d=bW(c.data)||bW(b.base64);if(!d)return;let e=bW(c.media_type)||bW(b.type),f=e.startsWith("image/")?e:"image/png",h=bX(b.dimensions);g.push({kind:"image",media:f,data:d,w:bP(h.originalWidth),h:bP(h.originalHeight),bytes:bP(b.originalSize)})},l=(a,b,c)=>{bO.lastIndex=0;let d=bO.test(b);if(bO.lastIndex=0,!d){let c=bM(b.trim(),a);return!!c&&(g.push(c),!0)}let e=!1,f=0,h=b=>{let d=b.trim();if(!d)return;let f=bM(d,a);f?(g.push(f),e=!0):c(d)};for(let a of b.matchAll(bO)){let c=a[0],d=a.index??0;h(b.slice(f,d)),g.push(bZ(c,a[1]??"",a[2]??"")),e=!0,f=d+c.length}return h(b.slice(f)),e},m=a=>{let b=[];return bO.lastIndex=0,{cleaned:a.replace(bO,(a,c,d)=>(b.push(bZ(a,c,d)),"")).trim(),cites:b}},n=(b,c)=>{if(!c.trim()||c===i||(i=c,j(c)))return;let d="codex"===a.engine?"codex":"claude";l(b,c,a=>g.push({kind:"prose",ts:b,text:a,engine:d}))||g.push({kind:"prose",ts:b,text:c,engine:d})},o=(a,b,c,d)=>{let f=c||"plain-"+g.length+"-"+String(a??""),h=function(a,b="shell"){let c=bJ(a);return{cmd:c,display:function(a){let b,c=a.match(/^([A-Za-z][\w.]*): /),d=c?c[0]:"",e=d?a.slice(d.length):a;do b=e,e=(e=(e=(e=e.replace(/^export PATH=[^;]+;\s*/,"")).replace(/^cd\s+\S+\s*&&\s*/,"")).replace(/^\/usr\/bin\/zsh -lc\s+/,"")).replace(/^(["'])([\s\S]*)\1$/,(a,b,c)=>RegExp(`(?<!\\\\)${b}`).test(c)?a:c);while(e!==b);let f=e.match(/^([\w./-]+(?:\s+-)?)\s*<<\s*['"]?(\w+)['"]?/);return f&&(e=`${f[1].trim()} \xabheredoc\xbb`),(d+(e=e.replace(/\s+/g," ").trim())).slice(0,160)}(c),icon:b,output:"",status:"run",label:bN("render.executing"),open:!1}}(b,d);return e.set(f,h),g.push({kind:"cmd",id:f,call:h,ts:a}),h},p=(a,b,d)=>{if(!a)return;let h=f.get(a);if(h){h.delivery=d||/"success"\s*:\s*false/.test(b)?"err":"ok",h.msgId=b.match(/"msg_id"\s*:\s*"([^"]+)"/)?.[1];return}!b$(e.get(a),b,d)&&b&&c&&g.push({kind:"svc",text:"output: "+bJ(b).slice(0,200)})},q=a=>{c?g.push({kind:"svc",text:a.slice(0,300)}):h+=1},r=a=>{g.push({kind:"note",text:a})},s=(a,b)=>{let c=b.replace(bQ,(b,c,d,e)=>{let f=bV(d,"teammate_id")||bV(d,"from")||bN("render.teammate"),h=bV(d,"summary"),i=e.trim();if(i.startsWith("{"))try{let a=JSON.parse(i);if("idle_notification"===a.type){let b=$(a.timestamp);return g.push({kind:"tnote",text:bN("render.left",{peer:f,at:b?" \xb7 "+b:""})}),""}}catch{}let{cleaned:j,cites:k}=m(i),l=bD.test(j)?bM(j,a):null;for(let b of(g.push({kind:"tmsg",ts:a,dir:"in",peer:f,summary:h,text:l?"":j}),l&&g.push(l),k))g.push(b);return""}).replace(/Another Claude session sent a message:\s*/g,"").trim();if(!c||j(c))return;if(bT.test(c))return void g.push({kind:"sysmsg",label:bU(c),text:c});let{cleaned:d,images:e}=bS(c);for(let b of(d&&!l(a,d,b=>g.push({kind:"user",ts:a,text:b}))&&g.push({kind:"user",ts:a,text:d}),e))g.push({kind:"inbox-image",name:b.name,path:b.path})},t=null,u=(a,b)=>{if(t&&t.text===b&&t.at===g.length)return;let{cleaned:c,images:d}=bS(b);for(let b of(c&&g.push({kind:"user",ts:a,text:c}),d))g.push({kind:"inbox-image",name:b.name,path:b.path});t={text:b,at:g.length}},v=(a,b)=>{t&&t.text===a&&t.at===g.length||(g.push({kind:"sysmsg",label:bU(a,b),text:a}),t={text:a,at:g.length})},w=!1,x=(a,b)=>{g.push({kind:"compact",ts:a,trigger:b?.trigger,preTokens:b?.preTokens})},y=a=>{let b=bX(a.payload),c=a.timestamp;if("session_meta"===a.type)return r(`${bN("render.codexSessionCreated")} \xb7 ${bW(b.model)} \xb7 ${bW(b.cwd)}`);if("event_msg"===a.type){if("agent_message"===b.type&&b.message)return n(c,bW(b.message));if("user_message"===b.type&&b.message){let a=bW(b.message);return bT.test(a)?v(a):u(c,a)}return"task_started"===b.type?r(bN("render.taskStarted")+(c?" \xb7 "+$(c):"")):"task_complete"===b.type?r(bN("render.taskComplete")+(c?" \xb7 "+$(c):"")):"context_compacted"===b.type?w?void(w=!1):x(c):q(bW(b.type)||"event")}if("response_item"===a.type){if("message"===b.type){let a=bY(b.content).map(a=>bW(a.text)||bW(a.input_text)).join(" ").trim();return a?"assistant"===b.role?n(c,a):"user"!==b.role||bT.test(a)?v(a,bW(b.role)):u(c,a):q("message "+bW(b.role))}if("function_call"===b.type){let a={};try{a=JSON.parse(bW(b.arguments)||"{}")}catch{a={}}let d=bW(b.name);if("exec_command"===d||"shell"===d)return o(c,String(a.cmd??a.command??"").replace(/^\/usr\/bin\/zsh -lc /,""),bW(b.call_id));if("apply_patch"===d){let b=String(a.input??"").match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:b?b.join(", ").replace(/(Add|Update|Delete) File: /g,""):bN("render.patch")});return}return"write_stdin"===d?q(bN("render.stdinSession",{id:String(a.session_id??"")})):o(c,d+" "+JSON.stringify(a).slice(0,120),bW(b.call_id),"tool")}if("function_call_output"===b.type)return p(bW(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??""));if("custom_tool_call"===b.type&&"apply_patch"===bW(b.name)){let a=bW(b.input).match(/(Add|Update|Delete) File: [^\n]+/g);g.push({kind:"edit",files:a?a.join(", ").replace(/(Add|Update|Delete) File: /g,""):bN("render.patch")});return}return"custom_tool_call_output"===b.type?p(bW(b.call_id),"string"==typeof b.output?b.output:JSON.stringify(b.output??"")):"reasoning"===b.type?q("reasoning"):q(bW(b.type)||"item")}if("compacted"===a.type)return w=!0,x(c);q(bW(a.type)||bN("render.record"))},z=a=>{let b=a.timestamp;if("user"===a.type&&a.message){let c=bX(a.message).content,d=bX(bX(a.toolUseResult).file);if(!0===a.isCompactSummary){let a="string"==typeof c?c:bY(c).filter(a=>"text"===a.type).map(a=>bW(a.text)).join(" ");a.trim()&&((a,b)=>{for(let a=g.length-1;a>=0;a-=1){let c=g[a];if("compact"===c.kind){c.summary=b;return}if("svc"!==c.kind&&"note"!==c.kind)break}g.push({kind:"compact",ts:a,summary:b})})(b,a.trim());return}if("string"==typeof c)s(b,c);else for(let a of bY(c))if("text"===a.type)s(b,bW(a.text));else if("image"===a.type)k(a,d);else if("tool_result"===a.type){let b=bY(a.content);for(let a of b)"image"===a.type&&k(a,d);let c="string"==typeof a.content?a.content:b.filter(a=>"image"!==a.type).map(a=>bW(a.text)).join(" ");p(bW(a.tool_use_id),c,!0===a.is_error)}return}if("assistant"===a.type&&a.message){for(let c of bY(bX(a.message).content))if("text"===c.type&&bW(c.text).trim())n(b,bW(c.text));else if("thinking"===c.type&&bW(c.thinking).trim())g.push({kind:"think",text:bW(c.thinking).replace(/\s+/g," ").trim()});else if("tool_use"===c.type&&"SendMessage"===bW(c.name)){let a=bX(c.input),d=a.message;if("string"==typeof d){let{cleaned:e,cites:h}=m(d),i=bD.test(e)?bM(e,b):null,j={kind:"tmsg",ts:b,dir:"out",peer:String(a.to??""),summary:String(a.summary??""),text:i?"":e};for(let a of(g.push(j),i&&g.push(i),h))g.push(a);bW(c.id)&&f.set(bW(c.id),j)}else q(`SendMessage → ${String(a.to??"")} \xb7 ${bW(bX(d).type)||bN("render.protocol")}`)}else if("tool_use"===c.type){let a=bX(c.input),d=String(a.command??a.file_path??a.prompt??JSON.stringify(a));o(b,bW(c.name)+": "+d.slice(0,160),bW(c.id),"tool")}return}if("system"===a.type&&"compact_boundary"===a.subtype){let c=bX(a.compactMetadata);return x(b,{trigger:bW(c.trigger)||void 0,preTokens:bP(c.preTokens)})}q(bW(a.type)||bN("render.record"))},A=null,B=()=>{if(!A)return;let a=A.join("\n").trim();if(A=null,!a)return;let b=a=>{for(let b of a.split("\n"))b.trim()&&g.push({kind:"raw",text:bJ(b),err:/error|failed|traceback|exception/i.test(b)})};l(null,a,b)||b(a)},C=a=>{let b=a.replace(/\x1b\][^\x07]*(\x07|\x1b\\)/g,"").replace(/\x1b\[[0-9;?]*[A-Za-z]/g,"");if(A)if(!/^\[codex\]/.test(b))return void A.push(b);else B();if(/Assistant message$/.test(b))return;let c=b.match(/^\[([^\]]+)\]\s*(.*)$/),d=c?.[1]??null,f=c?.[2]??b;if(!(!f||/^Assistant message captured/.test(f))){if(!c&&(bD.test(b)||b.startsWith("<oai-mem-citation>"))){A=[b];return}if(/^Running command: /.test(f))return o(d,f.replace(/^Running command: /,"").replace(/^\/usr\/bin\/zsh -lc /,""));if(/^Command (completed|failed)/.test(f)){let a=[...e.values()].at(-1);a&&b$(a,/^Command failed/.test(f)?f+"\n"+bN("render.jobLogNote"):f,/^Command failed/.test(f));return}return/^Applying \d+ file/.test(f)?g.push({kind:"edit",files:f}):c&&!/^(Running|Command|Applying)/.test(f)?n(d,f):void(!j(b)&&g.push({kind:"raw",text:bJ(b),err:/error|failed|traceback|exception/i.test(b)}))}};for(let c of b)if(!d||c.toLowerCase().includes(d))if("claude"===a.fmt||"codex"===a.fmt)try{let b=JSON.parse(c);b&&"object"==typeof b&&!Array.isArray(b)&&("claude"===a.fmt?z(b):y(b))}catch{C(c)}else C(c);return B(),{items:function(a,b){let c=[],d=0;for(;d<a.length;){if("cmd"!==a[d].kind){c.push(a[d]),d+=1;continue}let f=d,g=[];for(;f<a.length;){let b=a[f];if("cmd"===b.kind)g.push(b);else if("think"!==b.kind)break;f+=1}let h=f===a.length;if(g.length>=4&&!(b&&h)){let a={},b=0,h=0;for(let c of g){var e;let d=(e=c.call.cmd,e.match(/^([A-Za-z][\w.]*): /)?.[1]??"cmd");a[d]=(a[d]??0)+1,"ok"===c.call.status?b+=1:"err"===c.call.status&&(h+=1)}c.push({kind:"cmd-group",ids:g.map(a=>a.id),calls:g.map(a=>a.call),t0:g[0]?.ts,t1:g.at(-1)?.ts,byTool:a,okCount:b,errCount:h,hasErr:h>0}),d=f}else c.push(a[d]),d+=1}return c}(g,"live"===a.activity),hiddenServiceCount:h}}(a,q.lines,f,g.toLowerCase()):{items:[],hiddenServiceCount:0},[a?.path,a?.engine,a?.fmt,a?.activity,q.lines,f,g,m]),L=Math.max(0,K.items.length-w),M=L?K.items.slice(-w):K.items,N=()=>{let a=r.current;a&&(t.current={top:a.scrollTop,height:a.scrollHeight}),L?x(a=>a+v):q.hasMore&&q.loadOlder().then(()=>x(a=>a+v))},O=L>0||q.hasMore,P=K.items.at(-1),Q=P?.kind==="cmd"&&"run"===P.call.status?{icon:a8,label:n("feed.running",{tool:P.call.cmd.split(/[\s:]/,1)[0]||n("feed.tool")})}:P?.kind==="think"?{icon:a4,label:n("feed.thinking")}:{icon:a4,label:n("feed.working")},R=l?"left-1/2 -translate-x-1/2":"right-3";return(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[a&&K.items.length?o?"live"===a.activity?(0,d.jsxs)("div",{className:`pointer-events-none absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 rounded-full bg-ok px-2 py-0.5 text-[10px] font-bold text-white shadow-card transition-transform duration-200 ${B?"scale-125":"scale-100"}`,children:[(0,d.jsx)(bC,{className:"h-3 w-3","aria-hidden":!0})," ",n("feed.liveTail")]}):null:(0,d.jsxs)("button",{className:`absolute bottom-2 ${R} z-10 inline-flex items-center gap-1 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 py-1 text-[11px] font-semibold text-ink shadow-card hover:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n("feed.backToLive"),onClick:()=>{J(),I(!0,!0)},children:[(0,d.jsx)(aQ,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",y?n("feed.newCount",{count:y}):n("feed.down")]}):null,(0,d.jsx)("div",{ref:r,className:l?"min-h-0 flex-1 overflow-y-auto py-3":"min-h-0 flex-1 overflow-y-auto py-6",onScroll:b=>{let c=b.currentTarget,d=c.scrollTop+c.clientHeight>=c.scrollHeight-50,e=Date.now()-H.current<300;d&&!F.current?I(!0,!0):!d&&F.current&&(e?J():I(!1)),a&&!e&&cy(a.path,F.current,Math.max(0,c.scrollHeight-c.clientHeight-c.scrollTop)),c.scrollTop<120&&O&&!q.loadingOlder&&!q.loading&&N()},children:(0,d.jsx)("div",{ref:s,className:l?"px-3 pb-4 text-[13px]":"mx-auto w-full max-w-[1060px] px-6 pb-16",children:a?(0,d.jsxs)(d.Fragment,{children:[l&&O?(0,d.jsx)("button",{className:"mb-2 flex w-full items-center justify-center gap-1.5 rounded-[8px] border border-dashed border-line bg-bg px-2 py-1 text-[11px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aX,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.showEarlier")]})}):null,!l&&O&&K.items.length?(0,d.jsx)("button",{className:"mb-3 flex w-full items-center justify-center gap-1.5 rounded-[10px] border border-dashed border-line bg-panel px-3 py-1.5 text-[12px] font-semibold text-dim hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",disabled:q.loadingOlder,onClick:N,children:q.loadingOlder?n("common.loading"):L?n("feed.showEarlierHidden",{count:L}):n("feed.loadEarlier")}):null,l||O||!K.items.length?null:(0,d.jsx)("div",{className:"mb-3 text-center text-[11px] text-dim",children:n("feed.startOfConvo")}),l?null:(0,d.jsx)(cw,{file:a,files:b,onSelect:c}),K.items.length?(0,d.jsxs)(d.Fragment,{children:[M.map((a,b)=>{let c=b+K.items.length-M.length;return l?(0,d.jsx)("div",{className:"feed-cv",children:(0,d.jsx)(cq,{item:a})},c):(0,d.jsx)(cq,{item:a},c)}),a.pendingQuestion||a.waitingInput?(0,d.jsx)(ct,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null,a.pendingQuestion||a.waitingInput||!D?null:(0,d.jsx)("div",{className:"my-4 rounded-[8px] border border-line bg-chip px-4 py-3 text-[13px] font-semibold text-dim",children:D}),"live"===a.activity?(0,d.jsx)(cz,{icon:Q.icon,label:Q.label}):null,"recent"===a.activity&&an(a)?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-[#b8860b]",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-[#d29a2f]","aria-hidden":!0})," ",n("feed.finishedTurn")]}):"recent"===a.activity&&A(a)&&"running"!==a.proc?(0,d.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11.5px] font-semibold text-accent",children:[(0,d.jsx)(aL,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("feed.returnedResult")]}):null]}):(0,d.jsxs)("div",{className:"mt-[14vh] text-center text-dim",children:[q.loading?n("common.loadingCap"):0===q.size?n("feed.noOutput"):K.hiddenServiceCount?n("feed.onlyService",{count:K.hiddenServiceCount}):n("feed.empty"),!q.loading&&(a.cmdDesc||a.cmd)?(0,d.jsxs)("div",{className:"mx-auto mt-3 max-w-[560px]",children:[a.cmdDesc?(0,d.jsx)("div",{className:"text-[12.5px] font-semibold text-ink",children:a.cmdDesc}):null,a.cmd?(0,d.jsx)("pre",{className:"mt-1.5 overflow-x-auto whitespace-pre-wrap break-words rounded-[10px] border border-line bg-bg px-3 py-2 text-left font-mono text-[11.5px] text-ink",children:a.cmd}):null]}):null]}),K.items.length?null:a.pendingQuestion||a.waitingInput?(0,d.jsx)(ct,{file:a},a.pendingQuestion?.toolUseId??"waiting"):null]}):(0,d.jsx)("div",{className:"mt-[20vh] text-center text-dim",children:n("feed.pickLog")})})})]})}let cB=()=>"uk"===q()?"uk-UA":"en-US",cC={completed:"✓",in_progress:"▸",pending:"○"};function cD({plan:a}){let b,{t:c}=u(),e=a.total?Math.round(a.done/a.total*100):0;return(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-[#f1f0fc] px-1.5 py-0.5 font-mono text-[9.5px] font-semibold text-accent",title:(b=a.steps.map(a=>`${cC[a.status]} ${a.text}`),[t(q(),"plan.agentPlan"),...b].join("\n")),"aria-label":c("plan.stepsAria",{done:a.done,total:a.total})+(a.current?c("plan.nowSuffix",{current:a.current}):""),children:[a.done,"/",a.total,(0,d.jsx)("span",{className:"h-1 w-6 overflow-hidden rounded-full bg-accent/20","aria-hidden":!0,children:(0,d.jsx)("span",{className:"block h-full rounded-full bg-accent",style:{width:`${e}%`}})})]})}let cE={active:{labelKey:"plan.goal",className:"bg-[#f1f0fc] text-accent"},complete:{labelKey:"plan.goalDone",className:"bg-[#e7f4ea] text-ok"},blocked:{labelKey:"plan.goalBlocked",className:"bg-[#fbeaea] text-err"}};function cF({ctx:a}){var b;let{t:c}=u();return(0,d.jsxs)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold ${(b=a.pct)>=90?"bg-[#fbeaea] text-err":b>=70?"bg-[#fff7e6] text-[#b07d18]":"bg-chip text-dim"}`,title:c("plan.ctxTitle",{pct:a.pct,used:a.usedTokens.toLocaleString(cB()),window:a.windowTokens.toLocaleString(cB())}),"aria-label":c("plan.ctxAria",{pct:a.pct}),children:["ctx ",a.pct,"%"]})}function cG({goal:a}){let b,c,{t:e}=u(),f=cE[a.status];return(0,d.jsx)("span",{className:`inline-flex shrink-0 items-center rounded-full px-1.5 py-0.5 text-[9.5px] font-semibold ${f.className}`,title:(b=q(),c=[a.objective??t(b,"plan.noObjective")],null!==a.tokensUsed&&c.push(t(b,"plan.tokens",{n:a.tokensUsed.toLocaleString(cB())})),null!==a.timeUsedSeconds&&c.push(t(b,"plan.time",{n:Math.round(a.timeUsedSeconds/60)})),c.join("\n")),"aria-label":e("plan.goalAria",{status:e(f.labelKey)})+(a.objective?` — ${a.objective.slice(0,120)}`:""),children:e(f.labelKey)})}let cH=()=>void 0,cI={live:{section:"border-ok/60 shadow-[0_0_0_3px_rgba(47,158,68,0.16)]",header:"bg-[#eef8f0]"},waiting:{section:"border-[#e0ae45]/60 shadow-[0_0_0_3px_rgba(224,174,69,0.2)]",header:"bg-[#fff7e6]",glow:"#e0ae45"},returned:{section:"border-accent/50 shadow-[0_0_0_3px_rgba(90,81,224,0.15)]",header:"bg-[#f1f0fc]",glow:"#7a6ff0"},stalled:{section:"border-err/50 shadow-[0_0_0_3px_rgba(198,40,40,0.13)]",header:"bg-[#fdf0f0]",glow:"#d76a6a"},done:{section:"border-line",header:"bg-[#f4f4f6] text-dim opacity-80 saturate-50"}};function cJ(a,b){return"сесія"===b?a("kind.session"):"субагент"===b?a("kind.subagent"):"джоба"===b?a("kind.job"):"фон"===b?a("kind.background"):b}function cK({file:a}){let{t:b}=u(),[c,f]=(0,e.useState)(()=>Date.now()),g=c/1e3-a.mtime,h=("live"===a.activity||"recent"===a.activity)&&g>180;return(0,d.jsx)("span",{className:`shrink-0 font-mono text-[9.5px] tabular-nums ${h?"font-semibold text-[#b3831d]":"text-dim"}`,title:b(h?"branch.lastActivityQuiet":"branch.lastActivity",{age:Z(a.mtime)}),children:Z(a.mtime)})}function cL({file:a,files:b,tasks:c,onSelect:f,isRoot:g,onClose:h,dragHandle:i,noComposer:j,banner:k,onToggleExpand:l,expanded:n}){let{t:o}=u(),p=(0,e.useRef)(null),q=al(a),r=ar(a),s=cI[r];return(0,d.jsx)("div",{className:`relative flex min-h-0 min-w-0 flex-1 ${s.glow?"pane-attention":""}`,style:s.glow?{"--pane-glow":s.glow}:void 0,children:(0,d.jsxs)("section",{ref:p,"data-pan-ignore":!0,"data-link-path":a.path,className:`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border bg-panel shadow-card ${g?"border-t-4":"border-t-2"} ${s.section}`,style:"done"===r?{borderTopColor:"#c9c9d1"}:ak(a),children:[(0,d.jsxs)("header",{className:`flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5 ${s.header} ${i?"cursor-grab active:cursor-grabbing":""}`,...i,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${_(a.activity)}`,title:o(`branch.${r}`)}),(0,d.jsx)(cK,{file:a}),a.model?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 font-mono text-[9.5px] font-semibold",style:{backgroundColor:ah(a).soft,color:ah(a).color},title:[q.label,ai(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-bold",style:q.style,children:q.label}),a.ctx?(0,d.jsx)(cF,{ctx:a.ctx}):null,a.worktree?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 rounded-full border border-line/80 px-1.5 py-0.5 font-mono text-[9.5px] text-dim",title:o("branch.worktree",{name:a.worktree}),children:[(0,d.jsx)(aK,{className:"h-2.5 w-2.5","aria-hidden":!0})," ",a.worktree]}):null,a.plan?(0,d.jsx)(cD,{plan:a.plan}):null,a.goal?(0,d.jsx)(cG,{goal:a.goal}):null,g?null:(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-dim",title:o(a.handoff?"branch.handoffTitle":"branch.branchTitle"),children:[(0,d.jsx)(aL,{className:"h-3 w-3","aria-hidden":!0})," ",a.handoff?o("kind.handoff"):cJ(o,a.kind)]}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold",title:v(a.title),children:v(a.title,90)}),(0,d.jsx)(cv,{file:a,compact:!0}),l?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n?o("branch.collapseFull"):o("branch.expandFull",{title:v(a.title,60)}),title:n?o("branch.collapseFull"):o("branch.expandFull",{title:v(a.title,60)}),onClick:l,children:n?(0,d.jsx)(aM,{className:"h-3 w-3","aria-hidden":!0}):(0,d.jsx)(aN,{className:"h-3 w-3","aria-hidden":!0})}):null,(0,d.jsx)(bA,{file:a,onDeleted:h}),h?(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":o("branch.removeColumn",{title:v(a.title,60)}),onClick:h,children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})}):null]}),k??null,c.length?(0,d.jsx)(bB,{className:"shrink-0 border-b border-line bg-[#fbfbfd]",enter:"fade",children:c.map(a=>(0,d.jsx)("div",{"data-flip-key":a.path,children:(0,d.jsx)(cM,{file:a,files:b,onSelect:f})},a.path))}):null,(0,d.jsx)(cA,{file:a,files:b,onSelect:f,showSvc:!1,lineFilter:"",onStatus:cH,paused:!1,follow:!0,setFollow:cH,compact:!0}),j?null:(0,d.jsx)(bu,{file:a})]})})}function cM({file:a,files:b,onSelect:c}){let{t:f}=u(),[g,h]=(0,e.useState)(!1),i=v(a.cmdDesc||a.title,80);return(0,d.jsxs)("div",{className:"border-t border-line first:border-t-0",children:[(0,d.jsxs)("div",{className:"flex h-7 items-center gap-1.5 pl-2 pr-2.5",children:[(0,d.jsxs)("button",{className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":g,"aria-label":f("branch.toggleBackground",{action:f(g?"branch.collapse":"branch.expand"),title:i}),onClick:()=>h(a=>!a),children:[(0,d.jsx)(aW,{className:`h-3.5 w-3.5 shrink-0 text-dim transition-transform ${g?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",title:v(a.title),children:i})]}),(0,d.jsx)(cv,{file:a,compact:!0})]}),g?(0,d.jsx)("div",{className:"flex h-[220px] flex-col border-t border-dashed border-line bg-bg/60",children:(0,d.jsx)(cA,{file:a,files:b,onSelect:c,showSvc:!1,lineFilter:"",onStatus:cH,paused:!1,follow:!0,setFollow:cH,compact:!0})}):null]})}let cN=[{key:"claude",label:"Claude"},{key:"codex",label:"Codex"}],cO=(a,b)=>`llvDraftPane:${a}:${b}`;function cP(a,b,c){c?sessionStorage.setItem(cO(a,b),c):sessionStorage.removeItem(cO(a,b))}function cQ({draftId:a,project:b,files:c,onClose:f,onSpawned:g}){let{t:h}=u(),[i]=(0,e.useState)(()=>""),j=i?c.find(a=>a.path===i)??null:null,[k,l]=(0,e.useState)(()=>j?.engine==="codex"?"codex":"claude"),[n,o]=(0,e.useState)(()=>""),[p,q]=(0,e.useState)([]),[r,s]=(0,e.useState)(()=>(function(){try{let a=JSON.parse("null");return a&&"number"==typeof a.at&&"string"==typeof a.prompt?a:null}catch{return null}})()),[t,w]=(0,e.useState)(!1),x=(0,e.useRef)(null),y=bq({initialText:()=>i?h("draft.readPrompt",{src:i}):"",persistText:b=>cP(a,"text",b),submit:a=>G(a),disabled:!!r}),{text:z,setText:A,setStatus:B,busy:C,setBusy:D,voiceSending:E,attachments:F}=y,G=async b=>{let d=b??z;if(!C&&!E&&!r){if(!n.trim())return void B({kind:"err",text:h("draft.needDir")});if(d.trim()||F.images.length){D(!0),B(null);try{var e;let b=await fetch("/api/spawn",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({engine:k,cwd:n.trim(),prompt:d,images:F.images.map(a=>({base64:a.base64,mime:a.mime})),...i?{src:i}:{}})}),f=await b.json();if(!b.ok||!f.ok)return void B({kind:"err",text:f.error??h("draft.launchFailed")});x.current=new Set(c.map(a=>a.path)),e={at:Date.now(),target:f.target??"",path:f.path??null,prompt:d.trim()},s(e),cP(a,"boot",e?JSON.stringify(e):""),A(""),F.clear()}catch{B({kind:"err",text:h("common.serverUnavailable")})}finally{D(!1)}}}},H=aa[k]??ab,I=y.fieldsDisabled,J="draft-dirs-"+a;return(0,d.jsxs)("section",{"data-pan-ignore":!0,className:"relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-t-4 border-line bg-panel shadow-card",style:{borderTopColor:H.color},"aria-label":h("draft.paneAria"),children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-line px-2.5",style:{backgroundColor:H.soft},children:[(0,d.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[#c9c9d1]",title:h("draft.notStarted")}),(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1",role:"radiogroup","aria-label":h("draft.engineAria"),children:cN.map(({key:b,label:c})=>{let e=k===b,f=aa[b]??ab;return(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":e,disabled:I,onClick:()=>{l(b),cP(a,"engine",b)},style:e?{backgroundColor:"#fff",color:f.color,borderColor:f.color}:void 0,className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${e?"":"border-transparent bg-transparent text-dim hover:text-ink"}`,children:c},b)})}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-dim",title:j?v(j.title):void 0,children:i?h("draft.handoffLabel",{title:j?v(j.title,60):h("draft.conversation")}):h("draft.newConvo")}),(0,d.jsx)("button",{className:"inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("draft.dismiss"),onClick:f,children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line bg-[#fbfbfd] px-2.5 py-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 text-[10px] font-semibold text-dim",children:h("draft.directory")}),(0,d.jsx)("input",{value:n,disabled:I,onChange:b=>{var c;o(c=b.target.value),cP(a,"cwd",c)},list:J,placeholder:"/home/…/Projects/…","aria-label":h("draft.dirAria"),className:"min-w-0 flex-1 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:J,children:p.map(a=>(0,d.jsx)("option",{value:a},a))})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto px-4 py-4",children:r?(0,d.jsxs)("div",{className:"flex flex-1 flex-col justify-end gap-3",children:[(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsx)("span",{className:"min-w-0 max-w-[85%] whitespace-pre-wrap rounded-[10px] rounded-br-[3px] bg-[#ecebfb] px-2.5 py-1.5 text-[12px] text-[#333]",children:r.prompt||h("draft.imagesOnly")})}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(bf,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{children:h("draft.launched",{target:r.target})})]}),t?(0,d.jsx)("div",{className:"text-[11px] text-dim",children:h("draft.slow",{target:r.target})}):null]}):(0,d.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-center",children:[(0,d.jsx)("span",{className:"rounded-full px-3 py-1 text-[13px] font-bold",style:{backgroundColor:H.soft,color:H.color},children:"claude"===k?"Claude":"Codex"}),(0,d.jsx)("div",{className:"max-w-[360px] text-[12px] text-dim",children:i?h("draft.hintRelay"):h("draft.hintNew")}),i?(0,d.jsx)("div",{className:"max-w-[420px] truncate font-mono text-[10px] text-dim",title:i,children:i}):null]})}),(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),G()},className:"flex shrink-0 flex-col gap-1.5 border-t border-line bg-[#fbfbfd] px-2.5 py-2","aria-label":h("draft.promptAria"),children:(0,d.jsx)(bs,{composer:y,placeholder:h("draft.placeholder"),textareaAriaLabel:h("draft.promptTextAria"),imageAriaLabel:h("draft.addImages"),sendLabelIdle:h("composer.launchAgent"),sendLabelRecording:h("draft.stopAndLaunch"),sendIdleClassName:"hover:opacity-90",sendIdleStyle:{backgroundColor:H.color,borderColor:H.color},leftSlot:(0,d.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 font-mono text-[9.5px] font-semibold text-[#555]",title:h("draft.newWindowTitle"),children:[(0,d.jsx)(a3,{className:"h-3 w-3 shrink-0","aria-hidden":!0})," ",h("draft.newAgent")]})})})]})}let cR={inbox:{color:"#e0ae45",soft:"#fdf3dd"},assigned:{color:"#5a51e0",soft:"#efeefc"},blocked:{color:"#d97757",soft:"#faeee9"},done:{color:"#1a8a3e",soft:"#e7f4ea"}},cS=["inbox","assigned","blocked","done"];function cT(a){return a.split(/\r?\n/,1)[0]?.trim()??""}function cU(a,b){return("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)}function cV({tasks:a,project:b,onOpenTask:c,onClose:f}){let{t:g}=u(),[h,i]=(0,e.useState)("project"),j=(0,e.useMemo)(()=>("project"===h?a.filter(a=>a.project===b):[...a]).sort(cU),[a,b,h]);return(0,d.jsxs)("aside",{className:"flex w-[280px] shrink-0 flex-col border-l border-line bg-panel","aria-label":g("tasks.panelTitle"),children:[(0,d.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1.5 border-b border-line px-2.5",children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("tasks.panelTitle")}),(0,d.jsx)("div",{className:"ml-1 flex items-center rounded-full border border-line p-0.5",children:["project","all"].map(a=>(0,d.jsx)("button",{type:"button","aria-pressed":h===a,className:`rounded-full px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h===a?"bg-accent/10 text-accent":"text-dim hover:text-ink"}`,onClick:()=>i(a),children:"project"===a?g("tasks.panelThisProject"):g("tasks.panelAll")},a))}),(0,d.jsx)("button",{type:"button",className:"ml-auto inline-flex shrink-0 items-center rounded-[8px] border border-line bg-bg px-1.5 py-0.5 text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("tasks.panelClose"),onClick:f,children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})})]}),(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5",children:j.length?j.map(a=>{let b=cR[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,title:a.text,onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:g(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:cT(a.text)||g("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10px] text-dim",children:["all"===h?(0,d.jsx)("span",{className:"min-w-0 max-w-[110px] truncate",children:a.project}):null,a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:Z(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}):(0,d.jsx)("div",{className:"px-2 py-3 text-center text-[11px] text-dim",children:g("tasks.panelEmpty")})})]})}let cW=0,cX=new Set;function cY(a,b){let c={id:++cW,kind:a,text:b};for(let a of cX)a(c)}function cZ(a,b){let c=q(),d=a.results.length,e=t(c,"tasks.sendOk",{delivered:a.delivered,total:d});if(!a.failed)return{kind:"ok",text:e};let f=new Map(b.map(a=>[a.path,a])),g=a.results.filter(a=>!a.ok).map(a=>{let b=f.get(a.path);return t(c,"tasks.sendFailPart",{title:b?v(b.title,40):a.path.split("/").pop()??a.path,error:a.error??""})});return{kind:"err",text:`${e}; ${g.join("; ")}`}}function c$(){let[a,b]=(0,e.useState)([]);return a.length?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-14 z-50 flex flex-col items-center gap-1.5 px-3",children:a.map(a=>(0,d.jsxs)("div",{className:`pointer-events-auto flex max-w-[560px] items-start gap-2 rounded-[10px] border px-3 py-2 text-[11.5px] font-semibold shadow-[0_10px_36px_rgb(20_20_30/0.18)] ${"ok"===a.kind?"border-ok/40 bg-[#eef8f0] text-[#1c6b30]":"border-err/40 bg-[#fdf0f0] text-[#8f2525]"}`,children:[(0,d.jsx)("span",{className:"min-w-0 break-words",children:a.text}),(0,d.jsx)("button",{type:"button",className:"mt-0.5 shrink-0 rounded p-0.5 opacity-60 hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":t(q(),"viewer.closeNotification"),onClick:()=>b(b=>b.filter(b=>b.id!==a.id)),children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})})]},a.id))}):null}let c_=k("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);async function c0(a,b,c){try{let d=await fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pid:a.pid??void 0,path:a.path,text:b,images:c})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.ok)return e?.error??t(q(),"common.failedSend");return null}catch{return t(q(),"common.serverUnavailable")}}function c1({files:a,project:b,checked:c,onChange:f,maxHeight:g=240}){let{t:h}=u(),i=(0,e.useMemo)(()=>a.filter(a=>D(a)===b&&(z(a)||B(a))).sort((a,b)=>b.mtime-a.mtime),[a,b]),j=(0,e.useMemo)(()=>F(a),[a]),k=(0,e.useMemo)(()=>new Set(i.map(a=>a.path)),[i]);return i.length?(0,d.jsx)("div",{className:"flex flex-col gap-0.5 overflow-y-auto",style:{maxHeight:g},children:i.map(a=>{let b=al(a),e=G(a,j).filter(a=>k.has(a.path)).length;return(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsxs)("label",{className:"flex h-7 min-w-0 flex-1 cursor-pointer items-center gap-1.5 rounded-[6px] px-1.5 hover:bg-bg",children:[(0,d.jsx)("input",{type:"checkbox",checked:c.has(a.path),onChange:()=>{var b;let d;return b=a.path,void((d=new Set(c)).has(b)?d.delete(b):d.add(b),f(d))},className:"accent-accent"}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:b.style,children:b.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",title:v(a.title),children:v(a.title,46)})]}),e?(0,d.jsxs)("button",{type:"button",className:"inline-flex h-6 shrink-0 items-center gap-0.5 rounded-[6px] px-1 text-[10px] font-semibold text-dim hover:bg-bg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:h("tasks.pickerAllChildren"),onClick:()=>(a=>{let b=new Set(c);for(let c of(b.add(a.path),G(a,j)))k.has(c.path)&&b.add(c.path);f(b)})(a),children:[(0,d.jsx)(aL,{className:"h-3 w-3","aria-hidden":!0})," ",e]}):null]},a.path)})}):(0,d.jsx)("div",{className:"px-1.5 py-2 text-[11px] text-dim",children:h("tasks.pickerEmpty")})}function c2({value:a,onPick:b}){let{t:c}=u();return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-1",children:cS.map(e=>{let f=cR[e],g=e===a;return(0,d.jsx)("button",{type:"button","aria-pressed":g,className:"rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:g?{backgroundColor:f.soft,color:f.color,borderColor:f.color}:{borderColor:"transparent",color:"#8b8b95"},onClick:()=>b(e),children:c(`tasks.status.${e}`)},e)})})}function c3({project:a,files:b,onCreated:c}){let{t:f}=u(),[g,h]=(0,e.useState)(()=>new Set),i=bq({initialText:()=>"",persistText:b=>{b?sessionStorage.setItem("llvTaskSheetDraft:"+a,b):sessionStorage.removeItem("llvTaskSheetDraft:"+a)},submit:a=>r(a)}),{text:j,setText:k,setStatus:l,busy:m,setBusy:n,voiceSending:o,attachments:p}=i,r=async d=>{let e=d??j;if(!m&&!o){if(!e.trim())return void l({kind:"err",text:f("tasks.composerNeedsText")});n(!0),l(null);try{let d=await aw({project:a,text:e,pos:{x:120,y:120}});if("error"in d)return void l({kind:"err",text:d.error});let f=[...g];if(f.length){let a=await aB(d.task.id,f);if("error"in a)cY("err",a.error);else{let c=cZ(a,b);cY(c.kind,c.text);let d=p.images.map(a=>({base64:a.base64,mime:a.mime}));if(d.length){let c=new Map(b.map(a=>[a.path,a])),e=a.results.filter(a=>a.ok).map(a=>{var b;let d,e,f;return c.get(a.path)??(d=(b=a.path).includes("/.codex/sessions/")?"codex-sessions":b.includes("/.claude/projects/")?"claude-projects":/\/tmp\/claude-\d+\//.test(b)?"claude-tasks":"codex-jobs",e=b.endsWith(".jsonl")?"claude-projects"===d?"claude":"codex":"plain",f=d.startsWith("codex")?"codex":"claude-tasks"===d?"shell":"claude",{path:b,root:d,fmt:e,engine:f,kind:"",title:v(b.split("/").pop()||b,120),project:"",worktree:void 0,mtime:Date.now()/1e3,size:0,activity:"idle",proc:null,pid:null,model:null,pendingQuestion:null,waitingInput:null,parent:null,name:b})}),f=[];for(let a of e)f.push(await c0(a,"",d));if(f.some(a=>null!==a)){let a=function(a,b){let c=q(),d=b.filter(a=>null===a).length,e=t(c,"tasks.sendOk",{delivered:d,total:a.length});if(d===a.length)return{kind:"ok",text:e};let f=a.map((a,c)=>({file:a,error:b[c]})).filter(a=>a.error).map(a=>t(c,"tasks.sendFailPart",{title:v(a.file.title,40),error:a.error??""}));return{kind:"err",text:`${e}; ${f.join("; ")}`}}(e,f);cY(a.kind,a.text)}}}}k(""),p.clear(),c(d.task)}finally{n(!1)}}};return(0,d.jsxs)("form",{onSubmit:a=>{a.preventDefault(),r()},className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:(0,d.jsx)(bs,{composer:i,placeholder:f("tasks.newPlaceholder"),textareaAriaLabel:f("tasks.editAria"),imageAriaLabel:f("composer.addImages"),sendLabelIdle:f("tasks.sheetCreate"),sendLabelRecording:f("composer.stopAndSend"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-1.5 py-1 text-[9.5px] font-semibold text-[#555]",children:f("tasks.sheetTargets",{count:g.size})})})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(c1,{files:b,project:a,checked:g,onChange:h,maxHeight:9999})]})]})}function c4({task:a,files:b,onDeleted:c}){let{t:f}=u(),[g,h]=(0,e.useState)(a.text),[i,j]=(0,e.useState)(()=>new Set),[k,l]=(0,e.useState)(!1),[m,n]=(0,e.useState)(!1),o=bp({onError:a=>cY("err",a),onUnclaimedText:a=>h(b=>b?b.trimEnd()+" "+a:a),onLiveCommit:a=>h(b=>b?b.trimEnd()+" "+a:a)}),p=async()=>{if(g===a.text)return null;if(!g.trim())return f("tasks.emptyTextBlocked");let b=await az(a.id,{text:g});return b&&cY("err",b),b},q=async()=>{let c=[...i];if(c.length&&!k){if(!g.trim())return void cY("err",f("tasks.emptyTextBlocked"));l(!0);try{if(await p()!==null)return;let d=await aB(a.id,c);if("error"in d)cY("err",d.error);else{let a=cZ(d,b);cY(a.kind,a.text),j(new Set)}}finally{l(!1)}}},r=new Map(b.map(a=>[a.path,a]));return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("textarea",{value:o.liveText?(g?g.trimEnd()+" ":"")+o.liveText:g,readOnly:!!o.liveText,onChange:a=>h(a.target.value),onBlur:()=>void p(),rows:Math.min(14,Math.max(4,g.split("\n").length+1)),"aria-label":f("tasks.editAria"),maxLength:6e3,className:"w-full resize-none rounded-[8px] border border-line bg-panel px-2.5 py-1.5 text-[12.5px] leading-[18px] text-[#222] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-1.5",children:[(0,d.jsx)(c2,{value:a.status,onPick:b=>{b!==a.status&&az(a.id,{status:b}).then(a=>{a&&cY("err",a)})}}),(0,d.jsx)(br,{...o,onText:a=>h(b=>b?b.trimEnd()+" "+a:a)})]})]}),a.assignments.length?(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-2",children:[(0,d.jsx)("div",{className:"text-[10.5px] font-bold text-dim",children:f("tasks.sheetAssignments")}),a.assignments.map((c,e)=>{let h=c.path?r.get(c.path)??null:null,i="failed"===c.state,j=h?al(h):null,k=c.path?h?v(h.title,44):c.path.split("/").pop()??c.path:f("tasks.spawning");return(0,d.jsxs)("div",{className:`flex h-7 items-center gap-1.5 rounded-[6px] px-1.5 ${i?"bg-[#faeee9] text-[#a04a2e]":h?"bg-bg":"bg-bg opacity-60"}`,title:i?f("tasks.chipFailedTitle",{error:c.error??""}):void 0,children:[h?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(h.activity)}`}):null,j?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:j.style,children:j.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11px] font-semibold",children:k}),i?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null,c.path&&(i||!h)?(0,d.jsx)("button",{type:"button",className:"shrink-0 rounded px-1 text-[10px] font-bold text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{(async()=>{if(!g.trim())return cY("err",f("tasks.emptyTextBlocked"));if(await p()!==null)return;let d=await aB(a.id,[c.path]);if("error"in d)cY("err",d.error);else{let a=cZ(d,b);cY(a.kind,a.text)}})()},children:f("tasks.retry")}):null]},(c.path??"spawning")+e)})]}):null,(0,d.jsxs)("div",{className:"flex flex-col gap-1 rounded-[10px] border border-line bg-panel p-1.5",children:[(0,d.jsx)("div",{className:"px-1 text-[10.5px] font-bold text-dim",children:f("tasks.pickerTitle")}),(0,d.jsx)(c1,{files:b,project:a.project,checked:i,onChange:j,maxHeight:9999}),(0,d.jsxs)("button",{type:"button",disabled:!i.size||k,className:"mt-1 inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-accent bg-accent text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void q(),children:[k?(0,d.jsx)(bf,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):(0,d.jsx)(cs,{className:"h-3.5 w-3.5","aria-hidden":!0}),f("tasks.pickerSend",{count:i.size})]})]}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border text-[11.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${m?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,onClick:()=>{m?aA(a.id).then(a=>{a?cY("err",a):c()}):n(!0)},children:[(0,d.jsx)(a7,{className:"h-3.5 w-3.5","aria-hidden":!0}),m?f("tasks.deleteConfirm"):f("tasks.delete")]})]})}function c5({project:a,tasks:b,files:c,initialView:f,onClose:g}){let{t:h}=u(),[i,j]=(0,e.useState)(f),k=(0,e.useMemo)(()=>[...b].sort((a,b)=>("done"===a.status)-("done"===b.status)||b.updatedAt.localeCompare(a.updatedAt)),[b]),l="object"==typeof i?b.find(a=>a.id===i.taskId)??null:null;return(0,d.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:["list"!==i?(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("tasks.sheetBack"),onClick:()=>j("list"),children:(0,d.jsx)(c_,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:"new"===i?h("tasks.sheetNew"):l?cT(l.text)||h("tasks.untitled"):h("tasks.panelTitle")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":h("common.close"),onClick:g,children:(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})})]}),"list"===i?(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto p-2",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-9 shrink-0 items-center justify-center gap-1 rounded-[10px] border border-dashed border-accent/50 text-[12px] font-bold text-accent hover:bg-accent/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>j("new"),children:["+ ",h("tasks.sheetNew")]}),k.map(a=>{let b=cR[a.status];return(0,d.jsxs)("button",{type:"button",className:`flex w-full min-w-0 flex-col gap-0.5 rounded-[10px] border border-line bg-panel px-2.5 py-2 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${"done"===a.status?"opacity-60":""}`,onClick:()=>j({taskId:a.id}),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9px] font-bold",style:{backgroundColor:b.soft,color:b.color},children:h(`tasks.status.${a.status}`)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",children:cT(a.text)||h("tasks.untitled")})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-0.5 text-[10.5px] text-dim",children:[a.assignments.length?(0,d.jsxs)("span",{children:["⤷ ",a.assignments.length]}):null,(0,d.jsx)("span",{children:Z(new Date(a.updatedAt).getTime()/1e3)})]})]},a.id)}),k.length?null:(0,d.jsx)("div",{className:"px-2 py-4 text-center text-[11.5px] text-dim",children:h("tasks.sheetEmpty")})]}):"new"===i?(0,d.jsx)(c3,{project:a,files:c,onCreated:a=>j({taskId:a.id})}):l?(0,d.jsx)(c4,{task:l,files:c,onDeleted:()=>j("list")},l.id):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] text-dim",children:h("tasks.sheetGone")})]})}let c6=k("diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]),c7=k("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),c8=k("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);function c9({verdict:a,error:b,className:c="h-3 w-3"}){return"APPROVE"===a?(0,d.jsx)(aV,{className:c,strokeWidth:3,"aria-hidden":!0}):"REQUEST_CHANGES"===a?(0,d.jsx)(m,{className:c,strokeWidth:3,"aria-hidden":!0}):"COMMENT"===a?(0,d.jsx)(c6,{className:c,strokeWidth:2.5,"aria-hidden":!0}):b?(0,d.jsx)(c7,{className:c,"aria-hidden":!0}):(0,d.jsx)(c8,{className:c,"aria-hidden":!0})}function da(a,b){return b.error?a("roundDeck.roundAborted",{n:b.n}):b.verdict?a("roundDeck.roundVerdict",{n:b.n,verdict:`${W[b.verdict]} ${b.verdict}`}):a("roundDeck.roundInProgress",{n:b.n})}function db({round:a,depth:b,pulse:c,onPull:e}){let{t:f}=u(),g=X(a.verdict);return(0,d.jsxs)("button",{className:`deck-tab absolute inset-x-0 flex items-center gap-1.5 rounded-[9px] border bg-panel px-2.5 text-left shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${c?"deck-tab-live border-ok/50":"border-line hover:border-accent/45"}`,style:{height:36,bottom:-(30*b)-10,zIndex:10-b,transform:`scale(${1-.035*b}) translateZ(${-(34*b)}px)`},title:a.error?`${da(f,a)}: ${a.error}`:da(f,a),onClick:e,children:[(0,d.jsxs)("span",{className:"inline-flex h-4 shrink-0 items-center gap-1 rounded-full px-1.5 text-[9.5px] font-bold",style:{backgroundColor:g.soft,color:g.color},children:["R",a.n," ",(0,d.jsx)(c9,{verdict:a.verdict,error:!!a.error,className:"h-2.5 w-2.5"})]}),(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-dim",children:[a.error?f("roundDeck.aborted"):a.verdict?a.verdict:f("roundDeck.reviewInProgress"),null!=a.findingsCount&&a.findingsCount>0?` \xb7 ${f("roundDeck.findings",{count:a.findingsCount})}`:""]}),c?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-ok","aria-hidden":!0}):null]})}function dc({flow:a,rounds:b,files:c,onSelect:f,focusRound:g}){let{t:h}=u(),i=b.length?b[b.length-1]:null,[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)(null);null!=g&&g!==l&&(m(g),k(Math.round(g)));let[n,o]=(0,e.useState)(null);i&&i.round.n!==n&&(o(i.round.n),null!=j&&i.round.n>j&&null===i.round.verdict&&k(null));let p=(0,e.useMemo)(()=>b.find(a=>a.round.n===j)??i,[b,j,i]);if(!p)return(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60",children:(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:h("roundDeck.waitingFirst")})});let q=b.filter(a=>a.round.n!==p.round.n).reverse(),r=q.slice(0,5),s=q.length-r.length,t=X(p.round.verdict),v=null!==p.round.verdict||!!p.round.error,w=i&&p.round.n!==i.round.n&&null===i.round.verdict&&!i.round.error?i:null;return(0,d.jsxs)("div",{className:"deck-3d relative h-full",style:{paddingBottom:30*Math.min(q.length,5+ +!!s)},children:[(0,d.jsx)("div",{className:"scheme-enter relative z-[11] flex h-full flex-col",children:p.file?(0,d.jsx)(cL,{file:p.file,files:c,tasks:[],onSelect:f,isRoot:!1,noComposer:"headless"===a.reviewerMode||v,banner:(0,d.jsxs)("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-b border-line px-2.5 text-[10.5px] font-bold",style:{backgroundColor:t.soft,color:t.color},children:[da(h,p.round),null!=p.round.findingsCount&&p.round.findingsCount>0?(0,d.jsxs)("span",{className:"font-semibold opacity-80",children:["\xb7 ",h("roundDeck.findings",{count:p.round.findingsCount})]}):null,p.round.readyNote?(0,d.jsxs)("span",{className:"min-w-0 flex-1 truncate font-semibold opacity-70",title:p.round.readyNote,children:["\xb7 ",p.round.readyNote]}):null]})}):(0,d.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-1 rounded-[10px] border border-line bg-panel shadow-card",children:[(0,d.jsx)("span",{className:"text-[12px] font-semibold text-dim",children:da(h,p.round)}),(0,d.jsx)("span",{className:"text-[11px] text-dim",children:p.round.error?p.round.error:h("roundDeck.spawningReviewer")})]})},p.round.n),r.map((a,b)=>(0,d.jsx)(db,{round:a.round,depth:b,pulse:w?.round.n===a.round.n,onPull:()=>k(a.round.n)},a.round.n)),s>0?(0,d.jsx)("div",{className:"pointer-events-none absolute inset-x-6 flex items-center justify-center rounded-[9px] border border-line bg-panel/70 text-[10px] font-semibold text-dim shadow-card",style:{height:26,bottom:-(30*r.length)-8,zIndex:10-r.length},"aria-hidden":!0,children:h("roundDeck.moreRounds",{count:s})}):null]})}let dd=k("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);function de(a){return("claude-projects"===a.root||"codex-sessions"===a.root)&&a.path.endsWith(".jsonl")}function df({file:a,onHandoff:b}){let{t:c}=u(),f=function(a){let{t:b}=u(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(null),[i,j]=(0,e.useState)(null),k=(0,e.useRef)(null),l=(0,e.useRef)(!1),m=(0,e.useRef)(!1),n=(0,e.useRef)(null),o="link-arrow-"+(0,e.useId)().replace(/[^a-zA-Z0-9-]/g,"");return{onPillPointerDown:c=>{if("mouse"===c.pointerType&&0!==c.button||k.current)return;let d=c.currentTarget.getBoundingClientRect(),e=b=>{let c=k.current;if(!c)return;if(c.lastX=b.clientX,c.lastY=b.clientY,!c.active){if(7>Math.hypot(b.clientX-c.startX,b.clientY-c.startY))return;c.active=!0,l.current=!0,m.current=!0,document.body.style.cursor="crosshair",bx(),j(null),h({x:c.anchorX,y:c.anchorY}),f(!0)}n.current?.setAttribute("d",by(c.anchorX,c.anchorY,b.clientX,b.clientY));let d=function(a,b,c){let d=document.elementFromPoint(a,b)?.closest("[data-link-path]"),e=d?.getAttribute("data-link-path");if(!d||!e||e===c)return null;let f=bw.get(e);return f&&f.el===d?f:null}(b.clientX,b.clientY,a.path);d?.el!==c.hover?.el&&(c.hover?.el.removeAttribute("data-link-hover"),d?.el.setAttribute("data-link-hover","1"),c.hover=d)},g=c=>{var d,e;let g,h,i=k.current;k.current=null,i?.detach(),l.current=!1,document.body.style.cursor="",i?.active&&(f(!1),i.hover?(d=i.hover.file.path,e=b("link.handoffContext",{title:v(a.title,80),path:a.path,ask:""}).trimEnd()+"\n\n",g="llvDraft:"+d,h=sessionStorage.getItem(g)??"",sessionStorage.setItem(g,h.trim()?h.replace(/\s*$/,"")+"\n\n"+e:e),window.dispatchEvent(new CustomEvent("llv-compose-draft",{detail:{path:d}})),j({file:i.hover.file,from:{x:i.anchorX,y:i.anchorY},to:{x:c.clientX,y:c.clientY}})):bx())};k.current={startX:c.clientX,startY:c.clientY,anchorX:d.right,anchorY:d.top+d.height/2,lastX:c.clientX,lastY:c.clientY,active:!1,hover:null,detach:()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g)}},window.addEventListener("pointermove",e),window.addEventListener("pointerup",g),window.addEventListener("pointercancel",g)},consumeClick:()=>{let a=m.current;return m.current=!1,a},draggingRef:l,overlay:c||i?(0,bj.createPortal)((0,d.jsxs)("div",{className:"pointer-events-none fixed inset-0 z-[95]",children:[(0,d.jsxs)("svg",{className:"block h-full w-full",children:[(0,d.jsx)("defs",{children:(0,d.jsx)("marker",{id:o,markerWidth:"9",markerHeight:"9",refX:"7",refY:"4.5",orient:"auto",children:(0,d.jsx)("path",{d:"M0,0 L8,4.5 L0,9 Z",fill:bv})})}),(0,d.jsx)("path",{ref:a=>{n.current=a;let b=k.current;a&&b?.active&&a.setAttribute("d",by(b.anchorX,b.anchorY,b.lastX,b.lastY))},d:i?by(i.from.x,i.from.y,i.to.x,i.to.y):void 0,fill:"none",stroke:bv,strokeWidth:2.5,strokeLinecap:"round",markerEnd:`url(#${o})`}),(0,d.jsx)("circle",{cx:i?i.from.x:g?.x??0,cy:i?i.from.y:g?.y??0,r:4,fill:bv})]}),i?(0,d.jsx)(bz,{drop:i}):null]}),document.body):null}}(a);return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"group absolute -bottom-11 left-2 z-[2]",children:[(0,d.jsxs)("button",{type:"button","aria-label":c("handoff.aria"),title:c("handoff.title"),onPointerDown:f.onPillPointerDown,onClick:()=>{f.consumeClick()||b()},className:"flex h-7 touch-none items-center gap-1.5 rounded-full border border-line bg-panel px-2 text-dim shadow-card transition-[border-color,color] duration-150 hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)(dd,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"max-w-[0px] overflow-hidden whitespace-nowrap text-[11px] font-semibold transition-[max-width] duration-200 group-hover:max-w-[180px] group-focus-within:max-w-[180px]",children:c("handoff.label")}),(0,d.jsx)(aQ,{className:"hidden h-3.5 w-3.5 shrink-0 group-hover:block group-focus-within:block","aria-hidden":!0})]}),f.overlay]})}function dg(a,b,c,d=[],e=[]){let f=new Map(c.map(a=>[a.path,a])),g=F(c),h=[],i=[],j=[],k=[],l=[],m=P(d),n=Q(d),o=100,p=[],q=new Map;for(let a of e){let b="";if(!b)continue;let c=q.get(b);c?c.push(a):q.set(b,[a])}let r=new Set,s=a=>({file:a,branches:g.get(a.path)?.length??0}),t=(a,b,c,d,e)=>{let g=(a,o,t,u)=>{let v=0===u?780:680;h.push({file:a.file,tasks:a.tasks,under:d.get(a.file.path)??[],x:o,y:t,w:600,h:v,isRoot:a.file.path===e});let w=m.get(a.file.path),x=v;if(w){var y;let a,b,c=(y=o+600+170,a=w.rounds.map(a=>({round:a,file:a.reviewerPath?f.get(a.reviewerPath)??null:null})),b={key:"deck::"+w.id,flow:w,rounds:a,x:y,y:t,w:600,h:v+30*Math.min(Math.max(w.rounds.length-1,0),6)},k.push(b),b);l.push({key:"loop::"+w.id,flow:w,x1:o+600,x2:c.x,y:t}),x=Math.max(x,c.h)}let z=t+x+130,A=b.get(a.file.path)??[],B=o+64;for(let a of A)i.push({to:a.file.path,x1:o+40,y1:t+v,x2:B+300,y2:z,color:aj(a.file),live:"live"===a.file.activity}),B+=g(a,B,z,u+1)+48;let C=c.get(a.file.path)?.filter(a=>!n.has(a.path));for(let b of(C?.length&&(j.push({key:a.file.path+"::stack",parent:a.file.path,items:C.map(s),x:B,y:z,w:360,h:16+58*Math.min(C.length,8)-6}),i.push({to:a.file.path+"::stack",x1:o+40,y1:t+v,x2:B+180,y2:z,color:"#9a9aa4",live:!1,dashed:!0}),B+=408),q.get(a.file.path)??[]))r.add(b),p.push({key:"draft::"+b,id:b,src:a.file.path,x:B,y:z,w:600,h:680}),i.push({to:"draft::"+b,x1:o+40,y1:t+v,x2:B+300,y2:z,color:"#5a51e0",live:!1,dashed:!0}),B+=648;let D=B-48-(o+64);return Math.max(D>0?Math.max(600,64+D):600,w?1370:600)};return g(a,o,100,0)};for(let b of a){let a=b.columns;if(!a.length)continue;let c=a[0].file.path,d=new Set(a.map(a=>a.file.path)),e=a=>{let b=a.parent,e=new Set([a.path]);for(;b&&!e.has(b)&&!d.has(b);)e.add(b),b=f.get(b)?.parent??null;return b&&d.has(b)&&b!==a.path?b:c},g=new Map;for(let b of a){if(b.file.path===c)continue;let a=e(b.file),d=g.get(a);d?d.push(b):g.set(a,[b])}let h=new Map,i=[];for(let a of[...b.returnable,...b.finished])if(!n.has(a.path))if(B(a)){let b=e(a),c=h.get(b);c?c.push(a):h.set(b,[a])}else i.push(a);let j=new Map([[c,i]]);o+=t(a[0],g,h,j,b.key)+150}for(let a of b){let b=(function(a,b){if(!a)return[];let c=F(b),d=[],e=new Set([a.path]),f=(a,b)=>{for(let g of(c.get(a.path)??[]).filter(a=>!e.has(a.path)).sort((a,b)=>y(a)-y(b)||b.mtime-a.mtime))e.add(g.path),d.push({file:g,depth:b}),f(g,b+1)};return f(a,1),d})(a,c).map(a=>a.file).filter(a=>!n.has(a.path)),d=b.filter(a=>B(a)),e=b.filter(a=>!B(a));o+=t({file:a,tasks:[]},new Map,new Map(d.length?[[a.path,d]]:[]),new Map([[a.path,e]]),a.parent?"":a.path)+150}for(let a of e)r.has(a)||(p.push({key:"draft::"+a,id:a,x:o,y:100,w:600,h:780}),o+=750);let u=0;for(let a of h)u=Math.max(u,a.y+a.h);for(let a of j)u=Math.max(u,a.y+a.h);for(let a of k)u=Math.max(u,a.y+a.h);for(let a of p)u=Math.max(u,a.y+a.h);return{nodes:h,edges:i,stacks:j,decks:k,loops:l,drafts:p,byPath:new Map([...h.map(a=>[a.file.path,a]),...p.map(a=>[a.key,a]),...j.map(a=>[a.key,a]),...k.map(a=>[a.key,a])]),width:Math.max(o-150+100,800),height:u+100+140}}let dh=k("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]),di=k("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]),dj=k("square-dashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]),dk=k("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]),dl=k("octagon-minus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),dm=k("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]),dn=k("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),dp=k("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),dq=k("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);async function dr(a,b,c){let d=[];for(let e of a){try{let a=await b(e);d.push(a.ok?{path:e,ok:!0}:{path:e,ok:!1,error:a.error})}catch(a){d.push({path:e,ok:!1,error:a instanceof Error?a.message:String(a)})}c?.(d,a[d.length]??null)}return d}function ds(a){return null!==a.file.pid}function dt(a){return a.isRoot}function du(a){let b=0;for(let c of a.text.split(/\r?\n/))b+=Math.max(1,Math.ceil(c.length/34));return Math.max(64,6+(Math.min(17*b,340)+20)+(a.assignments.length?26*a.assignments.length+6:0))}function dv(a){return{x:a.pos.x,y:a.pos.y,w:260,h:du(a)}}function dw(a){return{x:a.x+a.w/2,y:a.y+a.h/2}}function dx(a,b){let{x:c,y:d}=dw(a),e=b.x-c,f=b.y-d;if(!e&&!f)return{x:c,y:d};let g=Math.min(e?a.w/2/Math.abs(e):1/0,f?a.h/2/Math.abs(f):1/0,1);return{x:c+e*g,y:d+f*g}}let dy={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};async function dz(a,b){let c=await fetch(a,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b)});if(c.ok)return{ok:!0};let d=await c.json().catch(()=>null);return{ok:!1,error:d?.error??`HTTP ${c.status}`}}function dA({icon:a,label:b,disabled:c,confirming:e,confirmLabel:f,onClick:g}){return(0,d.jsxs)("button",{className:`inline-flex h-7 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-[11px] font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${e?"border-err bg-err text-white":"border-line bg-bg text-dim hover:border-accent/45 hover:text-accent"}`,disabled:c,onClick:g,children:[a,e?f:b]})}let dB=(0,e.memo)(function({project:a,nodes:b,flowsByImpl:c,onRemove:f,onFit:g,onExit:h}){let{t:i}=u(),[j,k]=(0,e.useState)(null),[l,n]=(0,e.useState)(!0),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),w=(0,e.useRef)(null),x=(0,e.useRef)(b);(0,e.useLayoutEffect)(()=>{x.current=b},[b]),(0,e.useEffect)(()=>{if(!q)return;let a=window.setTimeout(()=>r(null),4e3);return()=>window.clearTimeout(a)},[q]);let y=async(a,c,d)=>{var e,f;if(j||!c.length)return[];k(a),r(null);let g=new Map(o?.titles??[]);for(let a of b)g.set(a.file.path,v(a.file.title,60));let h=(e=()=>new Set(x.current.map(a=>a.file.path)),f=i("bulk.nodeGone"),a=>e().has(a)?d(a):Promise.resolve({ok:!1,error:f}));w.current={action:a,runner:h},p({action:a,items:[],current:c[0]??null,titles:g});try{return await dr(c,h,(b,c)=>p({action:a,items:[...b],current:c,titles:g}))}finally{k(null)}},z=bq({initialText:()=>"",persistText:()=>{},submit:async c=>{let d=(c??z.textRef.current).trim(),e=z.attachments.images.map(a=>({base64:a.base64,mime:a.mime}));if((d||e.length)&&!j){z.setBusy(!0);try{let c=new Map(b.map(a=>[a.file.path,a]));if(l){if(!d)return void z.setStatus({kind:"err",text:i("tasks.composerNeedsText")});let b=await aw({project:a,text:d,pos:(()=>{let a=x.current;if(!a.length)return{x:120,y:120};let b=0,c=0;for(let d of a)b+=d.x+d.w/2,c+=d.y+d.h/2;return{x:Math.round(b/a.length-130),y:Math.round(c/a.length-60)}})()});if("error"in b)return void z.setStatus({kind:"err",text:b.error});let f=b.task.id,g=await y("message",[...c.keys()],async a=>{let b=await aB(f,[a]);if("error"in b)return{ok:!1,error:b.error};let d=b.results[0];if(!d?.ok)return{ok:!1,error:d?.error??i("common.failedSend")};if(e.length){let b=c.get(a);return dz("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:"",images:e})}return{ok:!0}});(!c.size||g.length&&g.every(a=>a.ok))&&(z.setText(""),z.attachments.clear());return}let f=await y("message",[...c.keys()],a=>{let b=c.get(a);return dz("/api/tmux",{pid:b?.file.pid??void 0,path:a,text:d,images:e})});f.length&&f.every(a=>a.ok)&&(z.setText(""),z.attachments.clear())}finally{z.setBusy(!1)}}},disabled:null!==j}),A=b.filter(ds),B=b.filter(dt),C=b.filter(a=>R(a.file,c)),D=o?.items.filter(a=>!a.ok).length??0;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute bottom-3 left-1/2 z-40 flex w-[640px] max-w-[94%] -translate-x-1/2 flex-col gap-1.5 rounded-[12px] border border-line bg-panel/95 p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[s?(0,d.jsx)(dC,{count:C.length,disabled:null!==j,onStart:a=>{t(!1),y("flow",C.map(a=>a.file.path),b=>dz("/api/flows",{implementerPath:b,...a}))},onClose:()=>t(!1)}):null,(0,d.jsx)("form",{onSubmit:a=>{a.preventDefault(),z.submit()},className:"flex flex-col gap-1.5",children:(0,d.jsx)(bs,{composer:z,placeholder:i("bulk.placeholder"),textareaAriaLabel:i("bulk.textAria"),imageAriaLabel:i("composer.addImages"),sendLabelIdle:i("bulk.sendAll",{count:b.length}),sendLabelRecording:i("composer.stopAndSend"),sendTitleRecording:i("composer.stopAndSendTitle"),sendIdleClassName:"border-accent bg-accent hover:opacity-90",leftSlot:(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-chip px-2 py-1 text-[10px] font-bold text-[#555]",children:i("bulk.selectedCount",{count:b.length})}),(0,d.jsxs)("button",{type:"button",role:"switch","aria-checked":l,title:i("tasks.composerToggleTitle"),onClick:()=>n(a=>!a),className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-full border px-2 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${l?"border-accent bg-accent/10 text-accent":"border-line bg-panel text-dim hover:text-ink"}`,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${l?"bg-accent":"bg-[#c9c9d1]"}`,"aria-hidden":!0}),i("tasks.composerToggle")]})]})})}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,d.jsx)(dA,{icon:(0,d.jsx)(dl,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.interrupt")} ${A.length}/${b.length}`,disabled:null!==j||!A.length,onClick:()=>void y("interrupt",A.map(a=>a.file.path),a=>dz("/api/tmux",{action:"interrupt",path:a}))}),(0,d.jsx)(dA,{icon:(0,d.jsx)(a5,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.stop")} ${B.length}/${b.length}`,confirming:"kill"===q,confirmLabel:i("bulk.stopConfirm",{count:B.length}),disabled:null!==j||!B.length,onClick:()=>{"kill"!==q?r("kill"):y("kill",B.map(a=>a.file.path),a=>dz("/api/tmux",{action:"kill",path:a}))}}),(0,d.jsx)(dA,{icon:(0,d.jsx)(a7,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.remove")} ${b.length}`,confirming:"remove"===q,confirmLabel:i("bulk.removeConfirm",{count:b.length}),disabled:null!==j||!b.length,onClick:()=>{if("remove"!==q)return void r("remove");for(let a of b)f(a.file.path);r(null)}}),(0,d.jsx)(dA,{icon:(0,d.jsx)(dm,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:`${i("bulk.flow")} ${C.length}/${b.length}`,disabled:null!==j||!C.length,onClick:()=>t(a=>!a)}),(0,d.jsx)(dA,{icon:(0,d.jsx)(dn,{className:"h-3.5 w-3.5","aria-hidden":!0}),label:i("bulk.fit"),disabled:!b.length,onClick:g}),(0,d.jsx)("button",{className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":i("bulk.exit"),title:i("bulk.exit"),onClick:h,children:(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})})]}),o?(0,d.jsxs)("div",{className:"flex max-h-[140px] flex-col gap-0.5 overflow-y-auto rounded-[8px] border border-line bg-bg/60 p-1.5",children:[o.items.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px]",children:[a.ok?(0,d.jsx)(aY,{className:"h-3.5 w-3.5 shrink-0 text-ok","aria-hidden":!0}):(0,d.jsx)(dp,{className:"h-3.5 w-3.5 shrink-0 text-err","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 shrink-0 truncate font-semibold",style:{maxWidth:"40%"},children:o.titles.get(a.path)??a.path}),a.error?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-err",children:a.error}):null]},a.path)),o.current?(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 text-[11px] text-dim",children:[(0,d.jsx)(bf,{className:"h-3.5 w-3.5 shrink-0 animate-spin","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate font-semibold",children:o.titles.get(o.current)??o.current})]}):null,!j&&D?(0,d.jsxs)("button",{className:"mt-1 inline-flex h-6 items-center gap-1 self-start rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{let a=o?.items.filter(a=>!a.ok).map(a=>a.path)??[],b=w.current;a.length&&b&&y(b.action,a,b.runner)},children:[(0,d.jsx)(dq,{className:"h-3 w-3","aria-hidden":!0}),i("bulk.retryFailed",{count:D})]}):null]}):null]})});function dC({count:a,disabled:b,onStart:c,onClose:f}){let{t:g}=u(),[h,i]=(0,e.useState)([]),[j,k]=(0,e.useState)(null),[l,m]=(0,e.useState)("auto"),[n,o]=(0,e.useState)(5);return(0,d.jsxs)("div",{className:"absolute bottom-[calc(100%+8px)] left-1/2 flex w-[420px] max-w-[94%] -translate-x-1/2 flex-col gap-2 rounded-[12px] border border-line bg-panel p-2.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&f()},children:[(0,d.jsx)("span",{className:"text-[12px] font-bold",children:g("bulk.flowTitle",{count:a})}),(0,d.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,d.jsxs)("label",{className:"col-span-3 flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.preset"),(0,d.jsx)("select",{value:j??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>k(a.target.value||null),children:h.length?h.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name)):(0,d.jsx)("option",{value:"",children:g("flowDialog.effortDefault")})})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.transitions"),(0,d.jsxs)("select",{value:l,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>m(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:g("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:g("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[g("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]}),(0,d.jsxs)("div",{className:"flex items-end justify-end gap-1.5",children:[(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:f,children:g("common.cancel")}),(0,d.jsx)("button",{className:"h-8 rounded-[8px] border border-accent bg-accent px-2.5 text-[11.5px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:b||!a,onClick:()=>c({...j?{preset:j}:{roles:dy},baseMode:"head",mode:l,reviewerMode:"headless",roundLimit:n}),children:g("bulk.flowStart",{count:a})})]})]})]})}function dD({layout:a,tasks:b=[],cam:c,vp:f,onJump:g}){let{t:h}=u(),i=(0,e.useRef)(null),j=(0,e.useRef)(!1),k=Math.min(216/a.width,148/a.height),l=(216-a.width*k)/2,m=(148-a.height*k)/2,n=a=>{let b=i.current?.getBoundingClientRect();b&&g((a.clientX-b.left-l)/k,(a.clientY-b.top-m)/k)};return(0,d.jsx)("div",{ref:i,"data-scheme-ui":!0,className:"absolute bottom-3 right-3 z-40 cursor-pointer overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card",style:{width:216,height:148},title:h("minimap.title"),onPointerDown:a=>{a.stopPropagation(),j.current=!0,n(a);try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}},onPointerMove:a=>{j.current&&n(a)},onPointerUp:a=>{j.current=!1;try{a.currentTarget.releasePointerCapture(a.pointerId)}catch{}},onPointerCancel:()=>{j.current=!1},children:(0,d.jsx)("svg",{width:216,height:148,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${l} ${m}) scale(${k})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#9a9aa4",opacity:.3},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:"#5a51e0",opacity:.3},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:18,fill:aj(a.file),opacity:"live"===a.file.activity?.85:.35},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+du(a)/2,r:3/k,fill:cR[a.status].color,opacity:"done"===a.status?.5:.95},a.id)),(0,d.jsx)("rect",{x:-c.x/c.z,y:-c.y/c.z,width:f.w/c.z,height:f.h/c.z,fill:"rgba(90,81,224,0.08)",stroke:"#5a51e0",strokeWidth:2.5/k})]})})})}let dE=k("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),dF=["low","medium","high","xhigh"],dG={implementer:{engine:"claude",model:null,effort:null},reviewer:{engine:"codex",model:null,effort:"xhigh"}};function dH({label:a,role:b,onChange:c}){let{t:e}=u();return(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"w-[86px] shrink-0 text-[10.5px] font-semibold text-dim",children:a}),(0,d.jsxs)("select",{value:b.engine,"aria-label":e("flowDialog.engine",{label:a}),className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,engine:a.target.value,effort:null}),children:[(0,d.jsx)("option",{value:"claude",children:"Claude"}),(0,d.jsx)("option",{value:"codex",children:"Codex"})]}),(0,d.jsx)("input",{value:b.model??"",placeholder:e("flowDialog.modelPlaceholder"),"aria-label":e("flowDialog.model",{label:a}),className:"h-7 w-0 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-1.5 font-mono text-[11px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,model:a.target.value.trim()||null})}),"codex"===b.engine?(0,d.jsxs)("select",{value:b.effort??"","aria-label":`Reasoning effort: ${a}`,className:"h-7 rounded-[8px] border border-line bg-bg px-1.5 text-[11.5px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>c({...b,effort:a.target.value||null}),children:[(0,d.jsx)("option",{value:"",children:e("flowDialog.effortDefault")}),dF.map(a=>(0,d.jsx)("option",{value:a,children:a},a))]}):null]})}function dI({file:a,onClose:b}){let{t:c}=u(),[f,g]=(0,e.useState)([]),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(dG),[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)("head"),[p,q]=(0,e.useState)("auto"),[r,s]=(0,e.useState)("headless"),[t,v]=(0,e.useState)(5),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),A=async()=>{if(!w){x(!0),z(null);try{let d=await fetch("/api/flows",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({implementerPath:a.path,...l||!h?{roles:j}:{preset:h},baseMode:n,mode:p,reviewerMode:r,roundLimit:t})});if(!d.ok){let a=await d.json().catch(()=>null);z(a?.error??c("flowDialog.createFailed",{status:d.status}));return}b()}catch{z(c("common.serverUnavailable"))}finally{x(!1)}}};return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"flex w-[420px] flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",onKeyDown:a=>{"Escape"===a.key&&b()},children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-[12.5px] font-bold",children:c("flowDialog.title")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] text-dim",children:c("flowDialog.subtitle")})]}),f.length?(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.preset"),(0,d.jsx)("select",{value:h??"",className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[12px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>{var b;let c;return i(b=a.target.value),void((c=f.find(a=>a.name===b))&&k({implementer:c.implementer,reviewer:c.reviewer}))},children:f.map(a=>(0,d.jsx)("option",{value:a.name,children:a.name},a.name))})]}):null,(0,d.jsx)("button",{className:"self-start text-[10.5px] font-semibold text-dim hover:text-accent focus-visible:outline-none","aria-expanded":l,onClick:()=>m(a=>!a),children:l?c("flowDialog.rolesManualOpen"):c("flowDialog.rolesManual")}),l?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[10px] border border-dashed border-line bg-bg/50 p-2",children:[(0,d.jsx)(dH,{label:c("flowDialog.implementer"),role:j.implementer,onChange:a=>k(b=>({...b,implementer:a}))}),(0,d.jsx)(dH,{label:c("flowDialog.reviewer"),role:j.reviewer,onChange:a=>k(b=>({...b,reviewer:a}))})]}):null,(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.diffBase"),(0,d.jsxs)("select",{value:n,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>o(a.target.value),children:[(0,d.jsx)("option",{value:"head",children:c("flowDialog.fromHead")}),(0,d.jsx)("option",{value:"merge-base",children:c("flowDialog.fromMergeBase")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.reviewer"),(0,d.jsxs)("select",{value:r,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>s(a.target.value),children:[(0,d.jsx)("option",{value:"headless",children:c("flowDialog.headless")}),(0,d.jsx)("option",{value:"pane",children:c("flowDialog.tmuxPane")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.transitions"),(0,d.jsxs)("select",{value:p,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>q(a.target.value),children:[(0,d.jsx)("option",{value:"auto",children:c("flowDialog.auto")}),(0,d.jsx)("option",{value:"manual",children:c("flowDialog.manual")})]})]}),(0,d.jsxs)("label",{className:"flex flex-col gap-1 text-[10.5px] font-semibold text-dim",children:[c("flowDialog.roundLimit"),(0,d.jsx)("input",{type:"number",min:1,max:20,value:t,className:"h-8 rounded-[8px] border border-line bg-bg px-2 text-[11.5px] font-normal text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onChange:a=>v(Math.max(1,Math.min(20,Number(a.target.value)||5)))})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[y?(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold text-err",children:y}):(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("button",{className:"rounded-[8px] border border-line bg-bg px-2.5 py-1.5 text-[11.5px] font-semibold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:b,children:c("common.cancel")}),(0,d.jsx)("button",{className:"rounded-[8px] border border-accent bg-accent px-3 py-1.5 text-[12px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:w,onClick:()=>void A(),children:w?c("flowDialog.creating"):c("flowDialog.start")})]})]})}let dJ=k("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"}]]),dK=k("infinity",[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]),dL={waiting_ready:{labelKey:"flowStrip.startReview",action:"advance"},spawn_pending:{labelKey:"flowStrip.spawnReviewer",action:"advance"},relay_pending:{labelKey:"flowStrip.relayNotes",action:"advance"},needs_decision:{labelKey:"flowStrip.retryRound",action:"retry-round"},done_comment:{labelKey:"flowStrip.anotherRound",action:"another-round"}},dM=new Set(["spawning","reviewing","relaying","fixing"]),dN=[1,2,3,4,5,0];function dO({flow:a,onFocusRound:b}){let{t:c}=u(),[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(""),l=async(b,c)=>{if(f)return;g(!0),i(null);let d=await Y(a.id,{action:b,...c});d?i(d):c?.note!==void 0&&k(""),g(!1)},n=dL[a.state],o=T.has(a.state),p="closed"===a.state||"approved"===a.state,q="waiting_ready"===a.state||"needs_decision"===a.state;return(0,d.jsxs)("div",{"data-scheme-ui":!0,className:`pointer-events-auto flex h-11 w-full items-center gap-3 rounded-[14px] border bg-panel/95 px-4 shadow-[0_2px_10px_rgb(20_20_30/0.08)] ${o?"border-[#e0ae45]/70":"border-line"}`,children:[(0,d.jsxs)("span",{className:"flex min-w-0 max-w-[38%] shrink-0 items-center gap-2",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${"approved"===a.state?"bg-ok":"needs_decision"===a.state?"bg-err":"paused"===a.state?"bg-[#e0ae45]":dM.has(a.state)?"bg-ok animate-pulse":"bg-[#9a9aa4]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-bold tracking-[0.08em] text-dim",children:c("flowStrip.flow")}),(0,d.jsx)("span",{className:"shrink-0 text-[12px] font-bold",children:S(c,a.state)}),a.stateDetail?(0,d.jsx)("span",{className:"min-w-0 truncate text-[11.5px] font-semibold text-dim",title:a.stateDetail,children:a.stateDetail}):null]}),(0,d.jsx)("span",{className:"no-scrollbar flex min-w-0 flex-1 items-center justify-center gap-1.5 overflow-x-auto","aria-label":c("flowStrip.roundsAria"),children:a.rounds.map((a,e)=>{let f=X(a.verdict),g=null===a.verdict&&!a.error;return(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[e>0?(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#c9c9d1]","aria-hidden":!0,children:"→"}):null,(0,d.jsxs)("button",{className:`inline-flex h-6 items-center gap-1 rounded-full px-2 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${g?"animate-pulse":""}`,style:{backgroundColor:f.soft,color:f.color},title:a.error?c("flowStrip.roundError",{n:a.n,error:a.error}):a.verdict?c("flowStrip.roundVerdict",{n:a.n,verdict:a.verdict})+(null!=a.findingsCount?` \xb7 ${c("roundDeck.findings",{count:a.findingsCount})}`:""):c("flowStrip.roundInProgress",{n:a.n}),onClick:()=>b?.(a.n),children:["R",a.n,(0,d.jsx)(c9,{verdict:a.verdict,error:!!a.error}),null!=a.findingsCount&&a.findingsCount>0?(0,d.jsx)("span",{children:a.findingsCount}):null]})]},a.n)})}),(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",children:[h?(0,d.jsx)("span",{className:"max-w-[220px] truncate text-[10.5px] font-semibold text-err",title:h,children:h}):null,f?(0,d.jsx)(dJ,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-dim","aria-hidden":!0}):null,q?(0,d.jsx)(bk,{label:c("flowStrip.noteTitle"),children:(0,d.jsx)("input",{className:"w-40 shrink-0 rounded-full border border-line bg-bg px-2.5 py-1 text-[10.5px] font-medium text-ink placeholder:text-dim/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",value:j,placeholder:c("flowStrip.notePlaceholder"),onChange:a=>k(a.target.value),onKeyDown:a=>{"Enter"===a.key&&n&&l(n.action,{note:j})}})}):null,"reviewing"===a.state?(0,d.jsx)(bk,{label:c("flowStrip.stopReviewerTitle"),children:(0,d.jsxs)("button",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-full border border-err/40 bg-[#fbeaea] px-2.5 text-[10.5px] font-bold text-err hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,onClick:()=>void l("cancel-round"),children:[(0,d.jsx)(a5,{className:"h-3 w-3","aria-hidden":!0})," ",c("flowStrip.stopReviewer")]})}):null,n?(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-accent bg-accent px-3 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",disabled:f,onClick:()=>void l(n.action,q?{note:j}:void 0),children:c(n.labelKey)}):null,p?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(bk,{label:c("flowStrip.limitTitle"),children:(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded-full border border-line bg-bg p-0.5",children:[dN.map(b=>{let e=a.roundLimit===b,g=0!==b&&b<a.rounds.length;return(0,d.jsx)("button",{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-30 ${e?"bg-accent text-white":"text-dim hover:bg-panel hover:text-ink"}`,disabled:f||g,"aria-label":0===b?c("flowStrip.limitUnlimitedAria"):c("flowStrip.limitAria",{count:b}),"aria-pressed":e,onClick:()=>void l("set-round-limit",{rounds:b}),children:0===b?(0,d.jsx)(dK,{className:"h-3 w-3","aria-hidden":!0}):b},b)}),dN.includes(a.roundLimit)?null:(0,d.jsx)("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1 text-[10px] font-bold text-white",children:a.roundLimit})]})}),(0,d.jsx)(bk,{label:"auto"===a.mode?c("flowStrip.autoTitle"):c("flowStrip.manualTitle"),children:(0,d.jsx)("button",{className:`shrink-0 rounded-full border px-2.5 py-1 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40 ${"auto"===a.mode?"border-ok/40 bg-[#eef8f0] text-ok":"border-line bg-bg text-dim hover:text-ink"}`,disabled:f,onClick:()=>void l("set-mode",{mode:"auto"===a.mode?"manual":"auto"}),children:"auto"===a.mode?c("flowDialog.auto"):c("flowStrip.manualShort")})}),"paused"===a.state?(0,d.jsx)(bk,{label:c("flowStrip.resume"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-ok hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.resume"),onClick:()=>void l("resume"),children:(0,d.jsx)(a3,{className:"h-3.5 w-3.5","aria-hidden":!0})})}):(0,d.jsx)(bk,{label:c("flowStrip.pause"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.pause"),onClick:()=>void l("pause"),children:(0,d.jsx)(cr,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]}),(0,d.jsx)(bk,{label:c("flowStrip.close"),children:(0,d.jsx)("button",{className:"inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-dim hover:bg-bg hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-40",disabled:f,"aria-label":c("flowStrip.close"),onClick:()=>void l("close"),children:(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0})})})]})]})}function dP({role:a,active:b}){let{t:c}=u();return(0,d.jsxs)("div",{className:`pointer-events-none absolute -top-3 left-4 z-[12] flex h-6 items-center gap-1.5 rounded-full border px-2.5 shadow-card ${b?"border-ok/50 bg-[#eef8f0]":"border-line bg-panel"}`,children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${b?"animate-pulse bg-ok":"bg-[#c2c2cb]"}`,"aria-hidden":!0}),(0,d.jsx)("span",{className:`text-[10px] font-bold tracking-[0.06em] ${b?"text-ok":"text-ink"}`,children:c("implementer"===a?"scheme.roleImplementer":"scheme.roleReviewer")}),(0,d.jsx)("span",{className:`text-[10px] font-semibold ${b?"text-ok":"text-dim"}`,children:c(b?"scheme.roleWorking":"scheme.roleWaiting")})]})}let dQ="cubic-bezier(.22,.8,.36,1)",dR=`transform 380ms ${dQ}`,dS=(0,e.memo)(function({edges:a,width:b,height:c}){return(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{let b=Math.max(36,(a.y2-a.y1)*.5),c=`M ${a.x1} ${a.y1} C ${a.x1} ${a.y1+b}, ${a.x2} ${a.y2-b}, ${a.x2} ${a.y2-7}`,e=`M ${a.x2-5} ${a.y2-9} L ${a.x2+5} ${a.y2-9} L ${a.x2} ${a.y2-1} Z`;return(0,d.jsxs)("g",{opacity:a.live?.9:.5,children:[(0,d.jsx)("path",{d:c,style:{d:`path("${c}")`,transition:`d 380ms ${dQ}`},fill:"none",stroke:a.color,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:a.dashed?"5 7":void 0}),(0,d.jsx)("circle",{cx:a.x1,cy:a.y1,r:3.5,fill:a.color,style:{cx:`${a.x1}px`,cy:`${a.y1}px`,transition:`cx 380ms ${dQ}, cy 380ms ${dQ}`}}),(0,d.jsx)("path",{d:e,style:{d:`path("${e}")`,transition:`d 380ms ${dQ}`},fill:a.color})]},a.to)})})}),dT=(0,e.memo)(function({loops:a,width:b,height:c}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"absolute left-0 top-0","aria-hidden":!0,children:a.map(a=>{var b,c;let e="spawn_pending"===(b=a.flow).state||"spawning"===b.state||"reviewing"===b.state?"forward":"relay_pending"===b.state||"relaying"===b.state||"fixing"===b.state||"waiting_ready"===b.state&&b.rounds.length?"back":null,f="approved"===(c=a.flow).state?"#1a8a3e":U.has(c.state)?"#5a51e0":T.has(c.state)?"#e0ae45":"#9a9aa4",g=a.y+150,h=a.y+330,i=(a.x1+a.x2)/2,j=(g+h)/2,k=`M ${a.x1} ${g} C ${a.x1+52} ${g-56}, ${a.x2-52} ${g-56}, ${a.x2-7} ${g}`,l=`M ${a.x2} ${h} C ${a.x2-52} ${h+56}, ${a.x1+52} ${h+56}, ${a.x1+7} ${h}`,m=`M ${a.x2-9} ${g-5} L ${a.x2-9} ${g+5} L ${a.x2-1} ${g} Z`,n=`M ${a.x1+9} ${h-5} L ${a.x1+9} ${h+5} L ${a.x1+1} ${h} Z`,o=(a,b)=>({d:a,fill:"none",stroke:b?"#5a51e0":"#c9c9d1",strokeWidth:b?3:2.5,strokeLinecap:"round",className:b?"loop-arc-live":void 0,style:{d:`path("${a}")`,transition:`d 380ms ${dQ}`}}),p=a=>({d:`path("${a}")`,transition:`d 380ms ${dQ}`});return(0,d.jsxs)("g",{children:[(0,d.jsx)("path",{...o(k,"forward"===e)}),(0,d.jsx)("path",{d:m,style:p(m),fill:"forward"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("path",{...o(l,"back"===e)}),(0,d.jsx)("path",{d:n,style:p(n),fill:"back"===e?"#5a51e0":"#c9c9d1"}),(0,d.jsx)("circle",{cx:i,cy:j,r:17,fill:"#ffffff",stroke:f,strokeWidth:2,style:{cx:`${i}px`,cy:`${j}px`,transition:`cx 380ms ${dQ}, cy 380ms ${dQ}`}}),(0,d.jsx)("text",{x:i,y:j+6,textAnchor:"middle",fontSize:17,fontWeight:700,fill:f,style:{x:`${i}px`,y:`${j+6}px`,transition:`x 380ms ${dQ}, y 380ms ${dQ}`},children:"⟳"})]},a.key)})}):null});function dU({file:a,onSelect:b}){let c=al(a);return(0,d.jsxs)("button",{className:"flex h-8 w-full min-w-0 items-center gap-1.5 rounded-[8px] px-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:v(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:v(a.cmdDesc||a.title,80)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:Z(a.mtime)})]})}function dV({file:a}){let b=al(a);return(0,d.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[3] flex items-center justify-center",style:{opacity:"var(--label-o, 0)",transition:"opacity .25s"},"aria-hidden":!0,children:(0,d.jsxs)("div",{className:"flex max-w-[94%] items-center gap-[0.5em] rounded-[0.55em] border border-line bg-panel/95 px-[0.75em] py-[0.45em] shadow-[0_2px_14px_rgb(20_20_30/0.14)]",style:{fontSize:"calc(13px * min(var(--inv-z, 1), 2.6))"},children:[(0,d.jsx)("span",{className:`h-[0.6em] w-[0.6em] shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-[0.45em] font-bold",style:{...b.style,fontSize:"0.72em"},children:b.label}),(0,d.jsx)("span",{className:"line-clamp-2 min-w-0 font-bold",children:v(a.title,70)})]})})}let dW=()=>void 0,dX=a=>a?" opacity-35":"";function dY({node:a,ringed:b,dimmed:c,flow:e}){let{t:f}=u(),g=al(a.file);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,className:`scheme-enter absolute${dX(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:[e?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(dO,{flow:e,onFocusRound:dW})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsxs)("div",{className:`relative z-[1] flex h-full min-w-0 flex-col overflow-hidden rounded-[10px] border border-t-4 bg-panel shadow-card ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,style:ak(a.file),children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2.5",children:[(0,d.jsx)("span",{className:`h-2.5 w-2.5 shrink-0 rounded-full ${_(a.file.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-2 py-0.5 text-[11px] font-bold",style:g.style,children:g.label}),a.file.model?(0,d.jsx)("span",{className:"min-w-0 truncate font-mono text-[11px] text-dim",children:a.file.model}):null,(0,d.jsx)("span",{className:"ml-auto shrink-0 text-[11px] text-dim",children:Z(a.file.mtime)})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[14px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-5",children:v(a.file.title,180)})}),a.under.length?(0,d.jsxs)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:[a.under.length," ",f("scheme.underneath")]}):null]}),e?(0,d.jsx)(dP,{role:"implementer",active:"implementer"===V(e)}):null,(0,d.jsx)(dV,{file:a.file})]})}function dZ({draft:a,ringed:b,dimmed:c}){let{t:e}=u();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${dX(c)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:(0,d.jsx)("div",{className:`flex h-full items-center justify-center rounded-[10px] border border-dashed border-line bg-panel/70 ${b?"ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"text-[15px] leading-none text-accent",children:"+"})," ",e("mobile.agent")]})})})}function d$({deck:a,dimmed:b}){let{t:c}=u(),e=a.rounds.at(-1)??null,f=e?.round??null,g=X(f?.verdict??null);return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${dX(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:[(0,d.jsx)("div",{className:"flex h-full flex-col overflow-hidden rounded-[10px] border border-line bg-panel shadow-card",children:f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 border-b border-line px-3 py-2.5",style:{backgroundColor:g.soft,color:g.color},children:[(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[12px] font-bold",children:["R",f.n," ",(0,d.jsx)(c9,{verdict:f.verdict,error:!!f.error,className:"h-3.5 w-3.5"})]}),(0,d.jsx)("span",{className:"min-w-0 truncate text-[11px] font-semibold",children:f.error?c("roundDeck.aborted"):f.verdict??c("roundDeck.reviewInProgress")})]}),(0,d.jsx)("div",{className:"min-w-0 flex-1 px-3 py-2.5 text-[13px] font-semibold leading-snug",children:(0,d.jsx)("span",{className:"line-clamp-4",children:e?.file?v(e.file.title,140):c("roundDeck.spawningReviewer")})}),a.rounds.length>1?(0,d.jsx)("div",{className:"shrink-0 px-3 pb-2.5 text-[11px] font-semibold text-dim",children:c("roundDeck.moreRounds",{count:a.rounds.length-1})}):null]}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-[12px] font-semibold text-dim",children:c("roundDeck.waitingFirst")})}),(0,d.jsx)(dP,{role:"reviewer",active:"reviewer"===V(a.flow)})]})}function d_({stack:a,dimmed:b,onSelect:c}){let{t:e}=u();return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${dX(b)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:(0,d.jsx)("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto rounded-[10px] border border-dashed border-[#c9c9d1] bg-panel/60 p-2",children:a.items.map(({file:a,branches:b})=>{let f=al(a);return(0,d.jsxs)("button",{className:"flex min-h-[52px] w-full min-w-0 flex-col justify-center gap-0.5 rounded-[8px] border border-line bg-panel px-2 py-1 text-left shadow-card hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:v(a.title),onClick:()=>c(a),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:f.style,children:f.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-semibold",children:v(a.title,70)})]}),(0,d.jsxs)("span",{className:"flex items-center gap-2 pl-3 text-[10.5px] text-dim",children:[(0,d.jsx)("span",{children:cJ(e,a.kind)}),(0,d.jsx)("span",{children:Z(a.mtime)}),b?(0,d.jsxs)("span",{children:["⤷ ",b]}):null]})]},a.path)})})})}function d0({node:a,files:b,ringed:c,marked:f,dimmed:g,flow:h,canFlow:i,onSelect:j,onClose:k,onFocusRound:l,onHandoff:m,onExpand:n}){let{t:o}=u(),[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(!1);return(0,d.jsxs)("div",{"data-scheme-node":a.file.path,"data-lasso-selected":f?"true":void 0,className:`scheme-enter absolute ${p||r?"z-20":""}${dX(g)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:[f?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"absolute -right-2.5 -top-2.5 z-[5] flex h-6 w-6 items-center justify-center rounded-full border-2 border-bg bg-accent text-white shadow-card",children:(0,d.jsx)(aV,{className:"h-3.5 w-3.5","aria-hidden":!0})}),(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-[4] rounded-[10px] bg-accent/[0.06]"})]}):null,h?(0,d.jsx)("div",{className:"absolute -top-[60px] left-0 z-[4]",style:{width:1370},children:(0,d.jsx)(dO,{flow:h,onFocusRound:a=>l(h.id,a)})}):i?(0,d.jsx)("div",{className:"absolute -top-11 left-0 z-[4]",children:(0,d.jsxs)("button",{"data-scheme-ui":!0,className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":r,title:o("scheme.flowTitle"),onClick:()=>s(a=>!a),children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"⟳"})," ",o("scheme.flow")]})}):null,r?(0,d.jsx)("div",{className:"absolute left-0 top-[-8px] z-40 -translate-y-full",children:(0,d.jsx)(dI,{file:a.file,onClose:()=>s(!1)})}):null,a.under.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"absolute inset-x-4 -bottom-4 h-5 rounded-[10px] border border-line bg-panel/70 shadow-card","aria-hidden":!0}),(0,d.jsx)("div",{className:"absolute inset-x-2 -bottom-2 h-5 rounded-[10px] border border-line bg-panel/90 shadow-card","aria-hidden":!0})]}):null,(0,d.jsx)("div",{className:`relative z-[1] flex h-full ${c?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cL,{file:a.file,tasks:a.tasks,files:b,onSelect:j,isRoot:a.isRoot,onClose:()=>k(a.file.path),onToggleExpand:()=>n(a.file.path)})}),h?(0,d.jsx)(dP,{role:"implementer",active:"implementer"===V(h)}):null,(0,d.jsx)(dV,{file:a.file}),m&&de(a.file)?(0,d.jsx)(df,{file:a.file,onHandoff:()=>m(a.file)}):null,a.under.length?(0,d.jsxs)("button",{className:"absolute -bottom-11 left-1/2 z-[2] inline-flex h-7 -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full border border-line bg-panel px-2.5 text-[11px] font-semibold text-dim shadow-card hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":p,title:o("scheme.collapsedTitle"),onClick:()=>q(a=>!a),children:[(0,d.jsx)(dE,{className:"h-3.5 w-3.5","aria-hidden":!0}),a.under.length," ",o("scheme.underneath"),(0,d.jsx)(aW,{className:`h-3 w-3 transition-transform ${p?"rotate-90":""}`,"aria-hidden":!0})]}):null,p?(0,d.jsx)("div",{className:"absolute left-0 top-[calc(100%+52px)] z-30 max-h-[280px] w-full overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:a.under.map(a=>(0,d.jsx)(dU,{file:a,onSelect:j},a.path))}):null]})}function d1({draft:a,project:b,files:c,ringed:e,dimmed:f,onDraftClose:g,onDraftSpawned:h}){return(0,d.jsx)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${dX(f)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:(0,d.jsx)("div",{className:`flex h-full ${e?"rounded-[10px] ring-2 ring-accent/60 ring-offset-2 ring-offset-bg":""}`,children:(0,d.jsx)(cQ,{draftId:a.id,project:b,files:c,onClose:()=>g(a.id),onSpawned:b=>h(a.id,b)})})})}function d2({deck:a,files:b,focus:c,dimmed:e,onSelect:f}){let g=c&&c.flowId===a.flow.id?c.round+c.nonce/1e3:null;return(0,d.jsxs)("div",{"data-scheme-node":a.key,className:`scheme-enter absolute${dX(e)}`,style:{transform:`translate(${a.x}px, ${a.y}px)`,width:a.w,height:a.h,transition:dR},children:[(0,d.jsx)(dc,{flow:a.flow,rounds:a.rounds,files:b,onSelect:f,focusRound:g}),(0,d.jsx)(dP,{role:"reviewer",active:"reviewer"===V(a.flow)})]})}let d3=(0,e.memo)(function({layout:a,project:b,files:c,interactive:e,lite:f,selected:g,multi:h,session:i,focus:j,attentionPaths:k,flowsByImpl:l,deckFocus:m,onSelect:n,onClose:o,onFocusRound:p,onDraftClose:q,onDraftSpawned:r,onHandoff:s,onExpand:t}){let u=a=>null!==k&&!a.rounds.some(a=>a.file&&k.has(a.file.path));return(0,d.jsxs)("div",{className:`${e?"":"pointer-events-none select-none"} ${i?"scheme-session":""}`.trim()||void 0,children:[a.stacks.map(a=>(0,d.jsx)(d_,{stack:a,dimmed:null!==k&&!a.items.some(a=>k.has(a.file.path)),onSelect:n},a.key)),a.decks.map(a=>f?(0,d.jsx)(d$,{deck:a,dimmed:u(a)},a.key):(0,d.jsx)(d2,{deck:a,files:c,focus:m,dimmed:u(a),onSelect:n},a.key)),a.drafts.map(a=>f?(0,d.jsx)(dZ,{draft:a,ringed:g===a.key||j===a.key,dimmed:null!==k},a.key):(0,d.jsx)(d1,{draft:a,project:b,files:c,ringed:g===a.key||j===a.key,dimmed:null!==k,onDraftClose:q,onDraftSpawned:r},a.key)),a.nodes.map(a=>f?(0,d.jsx)(dY,{node:a,ringed:g===a.file.path||j===a.file.path,dimmed:null!==k&&!k.has(a.file.path),flow:l.get(a.file.path)??null},a.file.path):(0,d.jsx)(d0,{node:a,files:c,ringed:i?h.has(a.file.path):g===a.file.path||j===a.file.path,marked:i&&h.has(a.file.path),dimmed:null!==k&&!k.has(a.file.path),flow:l.get(a.file.path)??null,canFlow:R(a.file,l),onSelect:n,onClose:o,onFocusRound:p,onHandoff:s,onExpand:t},a.file.path))]})}),d4="#d97757",d5=(0,e.memo)(function({edges:a,width:b,height:c,onRetry:e}){return a.length?(0,d.jsx)("svg",{width:b,height:c,className:"pointer-events-none absolute left-0 top-0 z-[2]",children:a.map(a=>{let b=a.failed?d4:cR[a.status].color,c=(a.x1+a.x2)/2,f=`M ${a.x1} ${a.y1} C ${c} ${a.y1}, ${c} ${a.y2}, ${a.x2} ${a.y2}`,g=(a.x1+a.x2)/2,h=(a.y1+a.y2)/2;return(0,d.jsxs)("g",{opacity:a.failed?.95:.65,children:[(0,d.jsx)("path",{d:f,style:{d:`path("${f}")`,transition:`d 380ms ${dQ}`},fill:"none",stroke:b,strokeWidth:2.5,strokeLinecap:"round",strokeDasharray:"5 7"}),(0,d.jsx)("circle",{cx:a.x2,cy:a.y2,r:4,fill:b,style:{cx:`${a.x2}px`,cy:`${a.y2}px`,transition:`cx 380ms ${dQ}, cy 380ms ${dQ}`}}),a.failed?(0,d.jsxs)("g",{className:"pointer-events-auto cursor-pointer",role:"button","aria-label":`retry ${a.path}`,onClick:()=>e(a.taskId,a.path),children:[(0,d.jsx)("title",{children:a.error??""}),(0,d.jsx)("path",{d:f,fill:"none",stroke:"transparent",strokeWidth:22,style:{pointerEvents:"stroke"}}),(0,d.jsx)("circle",{cx:g,cy:h,r:11,fill:"#fff",stroke:d4,strokeWidth:2,style:{cx:`${g}px`,cy:`${h}px`,transition:`cx 380ms ${dQ}, cy 380ms ${dQ}`}}),(0,d.jsx)("text",{x:g,y:h+4.5,textAnchor:"middle",fontSize:13,fontWeight:700,fill:d4,style:{x:`${g}px`,y:`${h+4.5}px`,transition:`x 380ms ${dQ}, y 380ms ${dQ}`},children:"⚠"})]}):null]},a.key)})}):null}),d6=k("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function d7({task:a,assignment:b,file:c,onRetry:e}){let{t:f}=u();if(!b.path)return(0,d.jsxs)("span",{className:"flex h-6 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)(bf,{className:"h-3 w-3 shrink-0 animate-spin","aria-hidden":!0}),f("tasks.spawning")]});let g=!c,h="failed"===b.state,i=c?al(c):null,j=c?v(c.title,40):b.path.split("/").pop()??b.path,k=(0,d.jsxs)(d.Fragment,{children:[c?(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(c.activity)}`}):null,i?(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px] font-bold",style:i.style,children:i.label}):null,(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[10.5px] font-semibold",children:j}),h?(0,d.jsx)("span",{"aria-hidden":!0,children:"⚠"}):null]});return h||g?(0,d.jsx)("button",{type:"button",className:`flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] px-1.5 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${h?"bg-[#faeee9] text-[#a04a2e] hover:bg-[#f6ded2]":"bg-white/45 text-dim opacity-70 hover:opacity-100"}`,title:h?f("tasks.chipFailedTitle",{error:b.error??""}):`${f("tasks.deadChip")} \xb7 ${f("tasks.retry")}`,onClick:()=>e(a,b.path),children:k}):(0,d.jsx)("span",{className:"flex h-6 w-full min-w-0 items-center gap-1.5 rounded-[6px] bg-white/55 px-1.5",title:c?v(c.title):void 0,children:k})}function d8({task:a,files:b,project:c,onSend:f,onClose:g}){let{t:h}=u(),[i,j]=(0,e.useState)(()=>new Set);return(0,d.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col rounded-[10px] border border-line bg-panel p-1.5 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,d.jsx)("div",{className:"px-1 pb-1 text-[10.5px] font-bold text-dim",children:h("tasks.pickerTitle")}),(0,d.jsx)(c1,{files:b,project:c,checked:i,onChange:j}),(0,d.jsxs)("div",{className:"mt-1 flex items-center justify-end gap-1 border-t border-line pt-1.5",children:[(0,d.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:g,children:h("common.cancel")}),(0,d.jsx)("button",{type:"button",disabled:!i.size,className:"rounded-[8px] border border-accent bg-accent px-2.5 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>{f(a,[...i]),g()},children:h("tasks.pickerSend",{count:i.size})})]})]})}function d9({task:a,onSpawn:b,onClose:c}){let{t:f}=u(),[g,h]=(0,e.useState)("claude"),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),q=async()=>{if(m||!i.trim())return;n(!0),p(null);let d=await b(a,g,i.trim());n(!1),d?p(d):c()},r="task-spawn-dirs-"+a.id;return(0,d.jsxs)("div",{"data-task-pop":!0,className:"absolute left-0 top-full z-30 mt-1 flex w-[280px] flex-col gap-1.5 rounded-[10px] border border-line bg-panel p-2 shadow-[0_10px_36px_rgb(20_20_30/0.18)]",children:[(0,d.jsx)("div",{className:"flex items-center gap-1",role:"radiogroup","aria-label":f("draft.engineAria"),children:["claude","codex"].map(a=>(0,d.jsx)("button",{type:"button",role:"radio","aria-checked":g===a,disabled:m,onClick:()=>h(a),className:`rounded-full border px-2 py-0.5 text-[10.5px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60 ${g===a?"border-accent bg-accent/10 text-accent":"border-transparent text-dim hover:text-ink"}`,children:"claude"===a?"Claude":"Codex"},a))}),(0,d.jsx)("input",{value:i,disabled:m,onChange:a=>j(a.target.value),list:r,placeholder:"/home/…/Projects/…","aria-label":f("draft.dirAria"),className:"min-w-0 rounded-[6px] border border-line bg-panel px-2 py-1 font-mono text-[11px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-60"}),(0,d.jsx)("datalist",{id:r,children:k.map(a=>(0,d.jsx)("option",{value:a},a))}),o?(0,d.jsx)("span",{className:"text-[10.5px] font-semibold text-err",children:o}):null,(0,d.jsxs)("div",{className:"flex items-center justify-end gap-1",children:[(0,d.jsx)("button",{type:"button",className:"rounded-[8px] px-2 py-1 text-[11px] font-semibold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:c,children:f("common.cancel")}),(0,d.jsxs)("button",{type:"button",disabled:m||!i.trim(),className:"inline-flex items-center gap-1 rounded-[8px] border border-accent bg-accent px-2.5 py-1 text-[11px] font-bold text-white hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40",onClick:()=>void q(),children:[m?(0,d.jsx)(bf,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):(0,d.jsx)(d6,{className:"h-3 w-3","aria-hidden":!0}),f("tasks.spawnGo")]})]})]})}let ea=(0,e.memo)(function({task:a,files:b,camRef:c,handlers:f}){let{t:g}=u(),[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null),[k,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),[v,w]=(0,e.useState)(!1),x=(0,e.useRef)(null);(0,e.useEffect)(()=>{if(!v)return;let a=window.setTimeout(()=>w(!1),4e3);return()=>window.clearTimeout(a)},[v]),(0,e.useEffect)(()=>{if(!m)return;let b=window.setTimeout(()=>{o.trim()&&o!==a.text&&f.patch(a.id,{text:o})},900);return()=>window.clearTimeout(b)},[m,o,a.id,a.text,f]);let y=()=>{if(n(!1),!o.trim()){o!==a.text&&(r(!0),cY("err",g("tasks.emptyTextBlocked")));return}r(!1),o!==a.text&&f.patch(a.id,{text:o})},z=()=>(m?!o.trim():!!q)&&(cY("err",g("tasks.emptyTextBlocked")),!0),A=(a,b)=>{z()||f.send(a,b)},B=async(a,b,c)=>z()?g("tasks.emptyTextBlocked"):f.spawn(a,b,c),C=h??(k&&k.seen===a.updatedAt?k:a.pos),D=cR[a.status],E=cT(a.text)||g("tasks.untitled"),F=a.text.includes("\n")?a.text.slice(a.text.indexOf("\n")+1):"",G=new Map(b.map(a=>[a.path,a])),H=m||null!==h||null!==s;return(0,d.jsxs)("div",{"data-scheme-task":a.id,className:`group absolute pb-9 ${H?"z-30":"z-[4]"}`,style:{transform:`translate(${C.x}px, ${C.y}px)`,width:260,transition:h?void 0:`transform 380ms ${dQ}`},onPointerDown:a=>{if(0===a.button&&!m&&!a.target.closest("button, a, input, textarea, select, [data-task-pop]")){j.current={sx:a.clientX,sy:a.clientY,ox:C.x,oy:C.y,moved:!1};try{a.currentTarget.setPointerCapture(a.pointerId)}catch{}}},onPointerMove:a=>{let b=j.current;if(!b)return;let d=a.clientX-b.sx,e=a.clientY-b.sy;if(!b.moved&&4>Math.hypot(d,e))return;b.moved=!0;let f=c.current?.z??1;i({x:b.ox+d/f,y:b.oy+e/f})},onPointerUp:b=>{let d=j.current;if(j.current=null,d){if(d.moved){let e=c.current?.z??1,g={x:Math.round(d.ox+(b.clientX-d.sx)/e),y:Math.round(d.oy+(b.clientY-d.sy)/e)};i(null),l({...g,seen:a.updatedAt}),f.patch(a.id,{pos:g}).then(a=>{a&&l(null)});return}b.target.closest("[data-task-body]")&&(m||((c.current?.z??1)<.55&&f.center(dv(a)),p(a.text),n(!0),requestAnimationFrame(()=>{let a=x.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length))})))}},children:[(0,d.jsxs)("div",{className:`flex flex-col overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ${"done"===a.status?"opacity-60 saturate-50":""} ${m?"ring-2 ring-accent/50":""}`,style:{borderTopColor:D.color,backgroundColor:D.soft},children:[m?(0,d.jsx)("textarea",{ref:x,value:o,onChange:a=>p(a.target.value),onBlur:y,onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),y())},"aria-label":g("tasks.editAria"),rows:Math.min(16,Math.max(3,o.split("\n").length+1)),className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3}):(0,d.jsxs)("div",{"data-task-body":!0,className:"cursor-text overflow-y-auto px-3 py-2",style:{maxHeight:340},children:[(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:E}),F.trim()?(0,d.jsx)("div",{className:"whitespace-pre-wrap break-words text-[12.5px] leading-[17px] text-[#3a3a42]",children:F}):null]}),a.assignments.length?(0,d.jsx)("div",{className:"flex flex-col gap-1 px-2 pb-2",children:a.assignments.map((b,c)=>(0,d.jsx)(d7,{task:a,assignment:b,file:b.path?G.get(b.path)??null:null,onRetry:(a,b)=>A(a,[b])},(b.path??"spawning")+"::"+c))}):null]}),(0,d.jsxs)("div",{className:`absolute left-0 top-full flex -translate-y-8 items-center gap-1 ${H?"":"pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100"} transition-opacity`,children:[(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("tasks.sendTitle"),onClick:()=>{let b=f.selectionPaths();b.length?A(a,b):t(a=>"send"===a?null:"send")},children:[(0,d.jsx)(cs,{className:"h-3 w-3","aria-hidden":!0})," ",g("tasks.send")]}),(0,d.jsxs)("button",{type:"button",className:"inline-flex h-7 items-center gap-1 rounded-full border border-line bg-panel px-2 text-[10.5px] font-semibold text-dim shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:g("tasks.spawnTitle"),onClick:()=>t(a=>"spawn"===a?null:"spawn"),children:[(0,d.jsx)(d6,{className:"h-3 w-3","aria-hidden":!0})," ",g("tasks.spawn")]}),(0,d.jsx)("button",{type:"button",className:"inline-flex h-7 items-center rounded-full border px-2 text-[10.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{backgroundColor:"#fff",color:D.color,borderColor:D.color},title:g("tasks.statusTitle",{label:g(`tasks.status.${a.status}`)}),onClick:()=>{var b;let c;f.patch(a.id,{status:(b=a.status,c=cS.indexOf(b),cS[(c+1)%cS.length])})},children:g(`tasks.status.${a.status}`)}),(0,d.jsxs)("button",{type:"button",className:`inline-flex h-7 items-center gap-1 rounded-full border px-2 text-[10.5px] font-semibold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${v?"border-err bg-err text-white":"border-line bg-panel text-dim hover:border-err/40 hover:text-err"}`,"aria-label":g("tasks.deleteAria",{title:E}),title:v?g("tasks.deleteConfirm"):g("tasks.delete"),onClick:()=>{v?(w(!1),f.remove(a.id)):w(!0)},children:[(0,d.jsx)(a7,{className:"h-3 w-3","aria-hidden":!0}),v?g("tasks.deleteConfirm"):null]})]}),"send"===s?(0,d.jsx)(d8,{task:a,files:b,project:a.project,onSend:A,onClose:()=>t(null)}):null,"spawn"===s?(0,d.jsx)(d9,{task:a,onSpawn:B,onClose:()=>t(null)}):null]})});function eb({pos:a,onCommit:b,onCancel:c}){let{t:f}=u(),[g,h]=(0,e.useState)(""),i=(0,e.useRef)(null),j=()=>{g.trim()?b(g):c()};return(0,d.jsx)("div",{"data-scheme-task":"new",className:"absolute z-30",style:{transform:`translate(${a.x}px, ${a.y}px)`,width:260},children:(0,d.jsx)("div",{className:"flex flex-col overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ring-2 ring-accent/50",style:{borderTopColor:cR.inbox.color,backgroundColor:cR.inbox.soft},children:(0,d.jsx)("textarea",{ref:i,value:g,onChange:a=>h(a.target.value),onBlur:j,onKeyDown:a=>{"Escape"===a.key&&(a.preventDefault(),j())},placeholder:f("tasks.newPlaceholder"),"aria-label":f("tasks.editAria"),rows:4,className:"w-full resize-none bg-transparent px-3 py-2 text-[12.5px] leading-[17px] text-[#26262c] placeholder:text-dim focus-visible:outline-none",maxLength:6e3})})})}function ec({task:a}){let{t:b}=u(),c=cR[a.status];return(0,d.jsx)("div",{"data-scheme-task":a.id,className:`absolute overflow-hidden rounded-[8px] border border-line border-t-4 shadow-card ${"done"===a.status?"opacity-60 saturate-50":""}`,style:{transform:`translate(${a.pos.x}px, ${a.pos.y}px)`,width:260,height:du(a),borderTopColor:c.color,backgroundColor:c.soft},children:(0,d.jsx)("div",{className:"px-3 py-2 text-[12.5px] font-bold leading-[17px] text-[#26262c]",children:(0,d.jsx)("span",{className:"line-clamp-4 whitespace-pre-wrap break-words",children:cT(a.text)||b("tasks.untitled")})})})}let ed=(0,e.memo)(function({tasks:a,files:b,interactive:c,lite:e,camRef:f,handlers:g,pending:h,onCreate:i,onCreateCancel:j}){return(0,d.jsxs)("div",{className:c?void 0:"pointer-events-none select-none",children:[a.map(a=>e?(0,d.jsx)(ec,{task:a},a.id):(0,d.jsx)(ea,{task:a,files:b,camRef:f,handlers:g},a.id)),h&&!e?(0,d.jsx)(eb,{pos:h,onCommit:i,onCancel:j}):null]})}),ee=(a,b)=>Math.hypot(a.x-b.x,a.y-b.y),ef=new Set;function eg({active:a,title:b,onClick:c,children:e}){return(0,d.jsx)("button",{className:`inline-flex h-7 w-7 items-center justify-center rounded-[8px] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${a?"bg-accent/10 text-accent":"text-dim hover:bg-bg hover:text-ink"}`,title:b,"aria-label":b,"aria-pressed":a,onClick:c,children:e})}function eh({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:j,ring:k,attentionPaths:l,onSelect:m,onNodePick:n,onClose:o,onDraftClose:p,onDraftSpawned:r,onHandoff:s}){let{t:w}=u(),x=!!n,[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(ef),[C,D]=(0,e.useState)(!1),E=(0,e.useMemo)(()=>dg(b,c,f,g,i),[b,c,f,g,i]),F=!x&&(C||A.size>0),G=(0,e.useCallback)(()=>{B(ef),D(!1)},[]),H=(0,e.useCallback)(a=>{B(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),I=(0,e.useRef)(y),J=(0,e.useCallback)((a,b)=>{if(null===a){z(null),G();return}if(b&&E.byPath.has(a)&&E.nodes.some(b=>b.file.path===a)){z(null),B(b=>{let c=new Set(b),d=I.current;return d&&d!==a&&E.nodes.some(a=>a.file.path===d)&&c.add(d),c.has(a)?c.delete(a):c.add(a),c});return}z(a)},[E,G]),K=(0,e.useMemo)(()=>P(g),[g]),[L,M]=(0,e.useState)(null),N=L?E.nodes.find(a=>a.file.path===L)??null:null,[O,Q]=(0,e.useState)(null),R=(0,e.useCallback)((a,b)=>{Q(c=>({flowId:a,round:b,nonce:(c?.nonce??0)+1}))},[]),S=k??j,T=(0,e.useRef)(m),U=(0,e.useRef)(n),V=(0,e.useRef)(o),W=(0,e.useRef)(p),X=(0,e.useRef)(r),Y=(0,e.useRef)(s),Z=(0,e.useCallback)(a=>{let b=U.current;b?b(a.path):T.current(a)},[]),$=(0,e.useCallback)(a=>V.current(a),[]),_=(0,e.useCallback)(a=>W.current(a),[]),aa=(0,e.useCallback)((a,b)=>X.current(a,b),[]),ab=(0,e.useCallback)(a=>Y.current?.(a),[]),ac=(0,e.useCallback)(a=>M(a),[]),ad=(0,e.useCallback)(a=>{M(null),T.current(a)},[]),ae=(0,e.useRef)(F),af=(0,e.useRef)(!1),ag=(0,e.useCallback)((a,b)=>{var c,d;if(af.current)return af.current=!1,!0;if(!ae.current)return z(null),!0;let e=(c=E.nodes,d={x:a,y:b,w:0,h:0},c.filter(a=>a.x<=d.x+d.w&&a.x+a.w>=d.x&&a.y<=d.y+d.h&&a.y+a.h>=d.y).map(a=>a.file.path));return e.length?H(e[0]):G(),!0},[E,H,G]),ah=(0,e.useRef)(()=>!1),[ai,aj]=(0,e.useState)([]),[ak,al]=(0,e.useState)(null),am=(0,e.useMemo)(()=>{let b=new Set(h.map(a=>a.id)),c=ai.filter(c=>!b.has(c.id)&&c.project===a);return c.length?[...h,...c]:h},[h,ai,a]),an=(0,e.useMemo)(()=>new Map(am.map(a=>["task::"+a.id,dv(a)])),[am]),ao=(0,e.useMemo)(()=>(function(a,b){let c=[];for(let d of a){let a=dv(d),e=dw(a);for(let f of d.assignments){if(!f.path)continue;let g=b.get(f.path);if(!g)continue;let h=dx(a,dw(g)),i=dx(g,e);c.push({key:d.id+"::"+f.path,taskId:d.id,path:f.path,x1:h.x,y1:h.y,x2:i.x,y2:i.y,status:d.status,failed:"failed"===f.state,error:f.error})}}return c})(am,function(a){let b=new Map,c=({x:a,y:b,w:c,h:d})=>({x:a,y:b,w:c,h:d});for(let d of a.stacks)for(let a of d.items)b.set(a.file.path,c(d));for(let d of a.decks)for(let a of d.rounds){let e=a.file?.path??a.round.reviewerPath;e&&b.set(e,c(d))}for(let d of a.nodes)for(let a of d.under)b.set(a.path,c(d));for(let d of a.nodes)b.set(d.file.path,c(d));return b}(E)),[am,E]),ap=(0,e.useCallback)((a,b)=>{al({x:Math.round(a-130),y:Math.round(b-14)})},[]),{cam:aq,vp:ar,viewportRef:as,handLike:at,taskTool:au,setTaskTool:av,centerOn:ax,panning:ay,glide:aD,setMode:aE,onPointerDown:aF,onPointerMove:aG,onDoubleClick:aH,onClick:aI,zoomCenter:aJ,zoomTo:aK,fit:aL,fitRect:aM,jump:aO}=function({project:a,layout:b,mapMode:c,focus:d,onNodePick:f,setSelected:g,onBackgroundDown:h,onWorldTap:i,taskRects:j,onPlaceTask:k}){let l=(0,e.useRef)(null),m=(0,e.useRef)(null),[n,o]=(0,e.useState)({x:0,y:0,z:.5}),[p,q]=(0,e.useState)("select"),[r,s]=(0,e.useState)(!1),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!1),[x,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)({w:1,h:1}),B=(0,e.useRef)(null),C=(0,e.useRef)(new Map),D=(0,e.useRef)(null);(0,e.useRef)(p),(0,e.useRef)(t),(0,e.useRef)(r);let E=(0,e.useRef)(k),F=(0,e.useRef)(null);(0,e.useRef)(null);let G=(0,e.useCallback)(a=>{s(!1),q(a),localStorage.setItem("llvSchemeMode",a)},[]),H=(0,e.useCallback)(a=>{let c=Math.min(Math.max(a.x,120-b.width*a.z),z.w-120),d=Math.min(Math.max(a.y,120-b.height*a.z),z.h-120);return c===a.x&&d===a.y?a:{...a,x:c,y:d}},[b.width,b.height,z]),I=(0,e.useRef)([]),J=(0,e.useRef)(null),K=(0,e.useCallback)(a=>{I.current.push(a),null==J.current&&(J.current=requestAnimationFrame(()=>{J.current=null;let a=I.current;I.current=[],o(b=>a.reduce((a,b)=>b(a),b))}))},[]),L=(0,e.useCallback)((a,b,c)=>{K(d=>{let e=Math.min(1.6,Math.max(.12,d.z*c));if(e===d.z)return d;let f=e/d.z;return H({z:e,x:a-(a-d.x)*f,y:b-(b-d.y)*f})})},[H,K]),M=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&L(b.width/2,b.height/2,a)},[L]),N=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();b&&o(c=>{let d=Math.min(1.6,Math.max(.12,a));if(d===c.z)return c;let e=d/c.z,f=b.width/2,g=b.height/2;return H({z:d,x:f-(f-c.x)*e,y:g-(g-c.y)*e})})},[H]),O=(0,e.useCallback)(()=>{let a=l.current?.getBoundingClientRect();if(!a||!b.nodes.length&&!b.drafts.length)return null;let c=Math.min(1.6,Math.max(.12,Math.min((a.width-48)/b.width,(a.height-48)/b.height,1)));return{z:c,x:(a.width-b.width*c)/2,y:(a.height-b.height*c)/2}},[b]),P=(0,e.useCallback)(a=>{y(!0),o(a),F.current&&window.clearTimeout(F.current),F.current=window.setTimeout(()=>y(!1),500)},[]),Q=(0,e.useCallback)(()=>{let a=O();a&&P(a)},[O,P]),R=(0,e.useCallback)(a=>{let b=l.current?.getBoundingClientRect();if(!b||a.w<=0||a.h<=0)return;let c=Math.min(1.6,Math.max(.12,Math.min((b.width-48)/a.w,(b.height-48)/a.h,1)));P(H({z:c,x:(b.width-a.w*c)/2-a.x*c,y:(b.height-a.h*c)/2-a.y*c}))},[P,H]),S=(0,e.useCallback)((a,b)=>{let c=l.current?.getBoundingClientRect();c&&P(d=>{let e=Math.min(1.6,Math.max(d.z,b));return{z:e,x:c.width/2-(a.x+a.w/2)*e,y:Math.min(c.height/2-a.y*e,.08*c.height-(a.y-40)*e)}})},[P]);(0,e.useRef)(null);let T=a=>{let b=l.current?.getBoundingClientRect();return b?{x:a.clientX-b.left,y:a.clientY-b.top}:{x:a.clientX,y:a.clientY}},U=a=>{B.current={sx:a.clientX,sy:a.clientY,cx:n.x,cy:n.y},w(!0);try{l.current?.setPointerCapture(a.pointerId)}catch{}},V=c||"hand"===p||t,W=(0,e.useCallback)((a,b)=>o(c=>H({...c,x:z.w/2-a*c.z,y:z.h/2-b*c.z})),[z,H]);return{cam:n,vp:z,viewportRef:l,mode:p,setMode:G,handLike:V,taskTool:r,setTaskTool:s,centerOn:S,panning:v,glide:x,onPointerDown:a=>{let b=a.target;if(!b.closest("[data-scheme-ui]")){if(c&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY}),"touch"===a.pointerType&&(C.current.set(a.pointerId,T(a)),2===C.current.size)){let[a,b]=[...C.current.values()];D.current={d:ee(a,b),cx:(a.x+b.x)/2,cy:(a.y+b.y)/2},B.current=null,w(!1);return}if(1===a.button){a.preventDefault(),U(a);return}if(0===a.button){if(r&&!c&&E.current){let b=l.current?.getBoundingClientRect();if(b){E.current((a.clientX-b.left-n.x)/n.z,(a.clientY-b.top-n.y)/n.z),s(!1),G("select");return}}if(!(c||"hand"===p||t)){if(b.closest("[data-scheme-task]"))return;let c=b.closest("[data-scheme-node]");if(c)return void g(c.getAttribute("data-scheme-node"),a.shiftKey||a.ctrlKey||a.metaKey);i&&a.isPrimary&&(m.current={x:a.clientX,y:a.clientY});let d=h?.(a)??!1;if(d&&"touch"!==a.pointerType||!d&&(g(null),b.closest("button, a, input, textarea, select")))return}U(a)}}},onPointerMove:a=>{if("touch"===a.pointerType&&C.current.has(a.pointerId)){C.current.set(a.pointerId,T(a));let b=D.current;if(b&&C.current.size>=2){let[a,c]=[...C.current.values()],d=ee(a,c),e=(a.x+c.x)/2,f=(a.y+c.y)/2,g=b.d>0?d/b.d:1;K(a=>{let c=Math.min(1.6,Math.max(.12,a.z*g)),d=c/a.z;return H({z:c,x:e-(b.cx-a.x)*d,y:f-(b.cy-a.y)*d})}),D.current={d,cx:e,cy:f};return}}let b=B.current;if(!b)return;let c=a.clientX-b.sx,d=a.clientY-b.sy;K(a=>H({...a,x:b.cx+c,y:b.cy+d}))},onDoubleClick:a=>{let c=a.target;if(c.closest("[data-scheme-ui]"))return;let d=c.closest("[data-scheme-node]");if(!d)return void Q();if("hand"!==p&&!t)return;let e=b.byPath.get(d.getAttribute("data-scheme-node")??"");e&&S(e,.9)},onClick:a=>{if(!f&&!i)return;let c=m.current;if(m.current=null,!c||Math.hypot(a.clientX-c.x,a.clientY-c.y)>9||a.target.closest("[data-scheme-ui]"))return;let d=l.current?.getBoundingClientRect();if(!d)return;let e=(a.clientX-d.left-n.x)/n.z,g=(a.clientY-d.top-n.y)/n.z;if(i?.(e,g)||!f)return;let h=((a,c)=>{let d=b=>a>=b.x&&a<=b.x+b.w&&c>=b.y&&c<=b.y+b.h;if(j){for(let[a,b]of j)if(d(b))return a}for(let a of b.nodes)if(d(a))return a.file.path;for(let a of b.drafts)if(d(a))return a.key;for(let a of b.stacks)if(d(a))return function(a,b){let c=Math.floor((b-a.y-8)/58);return a.items[Math.max(0,Math.min(c,a.items.length-1))]?.file??null}(a,c)?.path??null;for(let a of b.decks)if(d(a))return a.key;return null})(e,g);h&&f(h)},zoomCenter:M,zoomTo:N,fit:Q,fitRect:R,jump:W}}({project:a,layout:E,mapMode:x,focus:j,onNodePick:n,setSelected:J,onBackgroundDown:x?void 0:a=>(af.current=!1,ah.current(a)),onWorldTap:x?void 0:ag,taskRects:an,onPlaceTask:x?void 0:ap}),{marquee:aP,onBackgroundDown:aQ}=function({viewportRef:a,cam:b,layout:c,enabled:d,session:f,onCommit:g}){let[h,i]=(0,e.useState)(null),j=(0,e.useRef)(null);(0,e.useRef)(b),(0,e.useRef)(c),(0,e.useRef)(g);let k=(0,e.useCallback)(b=>{let c=a.current?.getBoundingClientRect();return c?{x:b.clientX-c.left,y:b.clientY-c.top}:{x:b.clientX,y:b.clientY}},[a]);return{marquee:h,onBackgroundDown:(0,e.useCallback)(a=>{if(!d)return!1;if("touch"===a.pointerType)return f;if(!a.isPrimary||0!==a.button)return!1;let b=k(a);return j.current={sx:b.x,sy:b.y,additive:a.shiftKey,active:!1},!0},[d,f,k])}}({viewportRef:as,cam:aq,layout:E,enabled:!x,session:F,onCommit:(0,e.useCallback)((a,b)=>{af.current=!0,z(null),B(c=>{if(!b)return a.length?new Set(a):ef;if(!a.length)return c;let d=new Set(c);for(let b of a)d.add(b);return d})},[])}),aR=(0,e.useMemo)(()=>E.nodes.filter(a=>A.has(a.file.path)),[E,A]),aS=(0,e.useMemo)(()=>(function(a,b){let c=1/0,d=1/0,e=-1/0,f=-1/0,g=!1;for(let h of a)b.has(h.file.path)&&(g=!0,c=Math.min(c,h.x),d=Math.min(d,h.y),e=Math.max(e,h.x+h.w),f=Math.max(f,h.y+h.h));return g?{x:c,y:d,w:e-c,h:f-d}:null})(E.nodes,A),[E,A]),aT=(0,e.useRef)(aS),aU=(0,e.useCallback)(()=>{aT.current&&aM(aT.current)},[aM]),aV=(0,e.useRef)(aq),aW=(0,e.useRef)(f),aX=(0,e.useRef)(A),aY=(0,e.useRef)(E),aZ=(0,e.useCallback)(async(a,b)=>{let c=await aB(a,b);if("error"in c)return void cY("err",c.error);let d=cZ(c,aW.current);cY(d.kind,d.text)},[]),a$=(0,e.useCallback)((a,b)=>void aZ(a,[b]),[aZ]),a_=(0,e.useMemo)(()=>({patch:async(a,b)=>{let c=await az(a,b);return c&&cY("err",c),c},remove:a=>{aj(b=>b.some(b=>b.id===a)?b.filter(b=>b.id!==a):b),aA(a).then(a=>{a&&cY("err",a)})},send:(a,b)=>void aZ(a.id,b),spawn:async(a,b,c)=>{let d=await aC(a.id,{engine:b,cwd:c});return"error"in d?d.error:(cY("ok",t(q(),"tasks.spawnOk",{target:d.target})),null)},center:a=>ax(a,.75),selectionPaths:()=>{let a=new Set(aY.current.nodes.map(a=>a.file.path)),b=[...aX.current].filter(b=>a.has(b));if(b.length)return b;let c=I.current;return c&&a.has(c)?[c]:[]}}),[aZ,ax]),a0=(0,e.useCallback)(b=>{ak&&aw({project:a,text:b,pos:ak}).then(a=>{"error"in a?cY("err",a.error):(aj(b=>[...b,a.task]),al(null))})},[a,ak]),a1=(0,e.useCallback)(()=>al(null),[]),a2=24*aq.z;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{ref:as,className:`relative min-h-0 flex-1 overflow-hidden ${ay?"cursor-grabbing select-none":au?"cursor-crosshair":at?"cursor-grab":""} ${at?"touch-none":""}`,onPointerDown:aF,onPointerMove:aG,onDoubleClick:aH,onClick:aI,children:[(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute",style:{inset:-a2,backgroundImage:"radial-gradient(rgba(28,28,34,0.09) 1px, transparent 1px)",backgroundSize:`${a2}px ${a2}px`,transform:`translate(${(aq.x%a2+a2)%a2}px, ${(aq.y%a2+a2)%a2}px)`,willChange:"transform"}}),(0,d.jsxs)("div",{className:`absolute left-0 top-0 ${ay?"scheme-panning":""}`,style:{width:E.width,height:E.height,transform:`translate(${aq.x}px, ${aq.y}px) scale(${aq.z})`,transformOrigin:"0 0",transition:aD?`transform .45s ${dQ}`:void 0,willChange:"transform","--inv-z":String(1/aq.z),"--label-o":aq.z<.45?"1":"0"},children:[(0,d.jsx)(dS,{edges:E.edges,width:E.width,height:E.height}),(0,d.jsx)(dT,{loops:E.loops,width:E.width,height:E.height}),(0,d.jsx)(d3,{layout:E,project:a,files:f,interactive:!at&&!F,lite:x,selected:y,multi:A,session:F,focus:S,attentionPaths:l??null,flowsByImpl:K,deckFocus:O,onSelect:Z,onClose:$,onFocusRound:R,onDraftClose:_,onDraftSpawned:aa,onHandoff:s?ab:void 0,onExpand:ac}),(0,d.jsx)(d5,{edges:ao,width:E.width,height:E.height,onRetry:a$}),(0,d.jsx)(ed,{tasks:am,files:f,interactive:!at&&!F,lite:x,camRef:aV,handlers:a_,pending:ak,onCreate:a0,onCreateCancel:a1}),F&&aS?(0,d.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-[6] rounded-[14px] border-2 border-dashed border-accent/60",style:{left:aS.x-14,top:aS.y-14,width:aS.w+28,height:aS.h+28},children:(0,d.jsx)("span",{className:"absolute -top-3 left-4 rounded-full border border-accent/50 bg-panel px-2 py-0.5 font-bold text-accent",style:{fontSize:"calc(11px * min(var(--inv-z, 1), 2.6))"},children:w("bulk.selectedCount",{count:A.size})})}):null]},a),aP?(0,d.jsxs)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 z-30",children:[(0,d.jsx)("div",{className:"absolute rounded-[4px] border border-accent/70 bg-accent/10",style:{left:aP.rect.x,top:aP.rect.y,width:aP.rect.w,height:aP.rect.h}}),aP.candidates.map(a=>{let b=E.byPath.get(a);return b?(0,d.jsx)("div",{className:"absolute rounded-[10px] border-2 border-accent/70",style:{left:b.x*aq.z+aq.x,top:b.y*aq.z+aq.y,width:b.w*aq.z,height:b.h*aq.z}},a):null})]}):null,(0,d.jsxs)("div",{"data-scheme-ui":!0,className:"absolute left-3 top-3 z-40 flex items-center gap-1 rounded-[10px] border border-line bg-panel/95 p-1 shadow-card",children:[x?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eg,{active:at&&!au,title:w("scheme.handTool"),onClick:()=>aE("hand"),children:(0,d.jsx)(dh,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eg,{active:!at&&!F&&!au,title:w("scheme.selectTool"),onClick:()=>aE("select"),children:(0,d.jsx)(di,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eg,{active:F,title:w("scheme.lassoTool"),onClick:()=>{F?G():(aE("select"),D(!0))},children:(0,d.jsx)(dj,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eg,{active:au,title:w("tasks.tool"),onClick:()=>av(!au),children:(0,d.jsx)(dk,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)("div",{className:"mx-0.5 h-5 w-px bg-line","aria-hidden":!0})]}),(0,d.jsx)(eg,{title:w("scheme.zoomOut"),onClick:()=>aJ(.8),children:(0,d.jsx)(b_,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsxs)("button",{className:"min-w-[46px] rounded-[8px] px-1 text-center text-[11px] font-semibold text-dim hover:bg-bg hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:w("scheme.zoom100"),onClick:()=>aK(1),children:[Math.round(100*aq.z),"%"]}),(0,d.jsx)(eg,{title:w("scheme.zoomIn"),onClick:()=>aJ(1.25),children:(0,d.jsx)(b0,{className:"h-4 w-4","aria-hidden":!0})}),(0,d.jsx)(eg,{title:w("scheme.fit"),onClick:aL,children:(0,d.jsx)(aN,{className:"h-4 w-4","aria-hidden":!0})})]}),F?(0,d.jsx)(dB,{project:a,nodes:aR,flowsByImpl:K,onRemove:$,onFit:aU,onExit:G}):null,(0,d.jsx)(dD,{layout:E,tasks:am,cam:aq,vp:ar,onJump:aO})]}),N?(0,d.jsx)("div",{className:"fixed inset-0 z-40 flex flex-col bg-bg p-3",role:"dialog","aria-modal":"true","aria-label":v(N.file.title,90),children:(0,d.jsx)(cL,{file:N.file,files:f,tasks:N.tasks,onSelect:ad,isRoot:N.isRoot,expanded:!0,onToggleExpand:()=>M(null)})}):null]})}let ei={waiting:5,stalled:4,live:3,returned:2,done:1};function ej({project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:j,onSelect:k,onClose:l,onDraftClose:n,onDraftSpawned:o,onHandoff:p}){let{t:q}=u(),[r,s]=(0,e.useState)(null),[t,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),y=(0,e.useRef)(null),z=(0,e.useRef)(null),A=(0,e.useMemo)(()=>dg(b,c,f,g,i),[b,c,f,g,i]),B=(0,e.useMemo)(()=>[...A.nodes.map(a=>({key:a.file.path,file:a.file,isRoot:a.isRoot,kind:"node"})),...A.decks.map(a=>({key:a.key,file:null,isRoot:!1,kind:"deck"})),...A.drafts.map(a=>({key:a.key,file:null,isRoot:!0,kind:"draft"}))],[A]),C=(0,e.useMemo)(()=>new Map(B.map(a=>[a.key,a])),[B]),D=(0,e.useMemo)(()=>{if(r&&C.has(r))return r;let a=null,b=-1;for(let c of B){if(!c.file)continue;let d=1e12*ei[ar(c.file)]+c.file.mtime;d>b&&(b=d,a=c)}return(a??B[0])?.key??null},[r,C,B]),E=(0,e.useMemo)(()=>A.nodes.find(a=>a.file.path===D)??null,[A,D]),F=(0,e.useMemo)(()=>A.decks.find(a=>a.key===D)??null,[A,D]),G=(0,e.useMemo)(()=>A.drafts.find(a=>a.key===D)??null,[A,D]),H=(0,e.useCallback)(a=>{if(!B.length)return;let b=B.findIndex(a=>a.key===D),c=B[Math.min(B.length-1,Math.max(0,(-1===b?0:b)+a))];c&&c.key!==D&&s(c.key)},[B,D]),I=(0,e.useCallback)(a=>{if(v(!1),a.startsWith("task::"))return void x({taskId:a.slice(6)});if(C.has(a))return void s(a);let b=f.find(b=>b.path===a);b&&k(b)},[C,f,k]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[B.length>1?(0,d.jsx)("div",{className:"flex shrink-0 items-center gap-1.5 overflow-x-auto border-b border-line bg-panel px-2 py-1.5",children:B.map(a=>(0,d.jsx)(ek,{entry:a,active:a.key===D,chipRef:a.key===D?z:void 0,onClick:()=>s(a.key)},a.key))}):null,(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1 flex-col p-1.5 pb-[max(0.375rem,env(safe-area-inset-bottom))]",children:[E?(0,d.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,d.jsx)(cL,{file:E.file,tasks:E.tasks,files:f,onSelect:k,isRoot:E.isRoot,onClose:()=>l(E.file.path),dragHandle:{onTouchStart:a=>{let b=a.touches[0];b&&(y.current={x:b.clientX,y:b.clientY})},onTouchEnd:a=>{let b=y.current;y.current=null;let c=a.changedTouches[0];if(!b||!c)return;let d=c.clientX-b.x,e=c.clientY-b.y;56>Math.abs(d)||Math.abs(d)<2*Math.abs(e)||H(d<0?1:-1)}}}),p&&de(E.file)?(0,d.jsx)(df,{file:E.file,onHandoff:()=>p(E.file)}):null]},E.file.path):F?(0,d.jsx)("div",{className:"relative min-h-0 flex-1",children:(0,d.jsx)(dc,{flow:F.flow,rounds:F.rounds,files:f,onSelect:k,focusRound:null})},F.key):G?(0,d.jsx)(cQ,{draftId:G.id,project:a,files:f,onClose:()=>n(G.id),onSpawned:a=>o(G.id,a)},G.key):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center text-center text-[13px] text-dim",children:q("mobile.noConvos")}),(0,d.jsx)(el,{layout:A,tasks:h,current:D,onOpen:()=>v(!0)}),(0,d.jsxs)("button",{type:"button",className:"absolute bottom-[168px] right-4 z-30 inline-flex h-9 items-center gap-1 rounded-full border border-line bg-panel/95 px-2.5 text-[11px] font-bold text-ink shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":q("tasks.panelToggleAria"),onClick:()=>x("list"),children:[(0,d.jsx)(aJ,{className:"h-4 w-4 text-accent","aria-hidden":!0}),h.filter(a=>"done"!==a.status).length||null]})]}),t?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-bg pb-[env(safe-area-inset-bottom)]",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line bg-panel px-3",children:[(0,d.jsx)("span",{className:"shrink-0 text-[13px] font-bold",children:q("mobile.map")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-dim",children:a}),(0,d.jsx)("button",{type:"button",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":q("mobile.closeMap"),onClick:()=>v(!1),children:(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsx)(eh,{project:a,groups:b,manual:c,files:f,flows:g,tasks:h,drafts:i,focus:null,ring:D,onSelect:k,onClose:l,onDraftClose:n,onDraftSpawned:o,onNodePick:I}),(0,d.jsx)("div",{className:"shrink-0 border-t border-line bg-panel px-3 py-1.5 text-center text-[11px] text-dim",children:q("mobile.tapNode")})]}):null,w?(0,d.jsx)(c5,{project:a,tasks:h,files:f,initialView:w,onClose:()=>x(null)}):null]})}function ek({entry:a,active:b,chipRef:c,onClick:e}){let{t:f}=u();if(!a.file){let g="deck"===a.kind;return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":"border-dashed border-line bg-bg text-dim"}`,onClick:e,children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:g?"R":"+"})," ",f(g?"scheme.flow":"mobile.agent")]})}let g=a.file,h=ar(g),i="waiting"===h||"stalled"===h,j=al(g),k=v(g.title,60);return(0,d.jsxs)("button",{ref:c,type:"button",className:`flex h-7 shrink-0 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-semibold ${b?"border-accent/60 bg-accent/10 text-ink":i?"border-[#e0ae45]/60 bg-[#fff7e6] text-[#8a5a00]":"border-line bg-bg text-dim"}`,title:k,onClick:e,children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(g.activity)}`}),a.isRoot?null:(0,d.jsx)("span",{"aria-hidden":!0,children:"⤷"}),b?(0,d.jsx)("span",{className:"max-w-[52vw] truncate",children:k}):(0,d.jsxs)("span",{children:[i?"⏸ ":"",j.label]})]})}function el({layout:a,tasks:b,current:c,onOpen:e}){let{t:f}=u(),g=Math.min(96/a.width,64/a.height),h=(96-a.width*g)/2,i=(64-a.height*g)/2;return(0,d.jsx)("button",{type:"button",className:"absolute bottom-[92px] right-4 z-30 overflow-hidden rounded-[10px] border border-line bg-panel/95 shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",style:{width:96,height:64},"aria-label":f("mobile.openMap"),onClick:e,children:(0,d.jsx)("svg",{width:96,height:64,"aria-hidden":!0,children:(0,d.jsxs)("g",{transform:`translate(${h} ${i}) scale(${g})`,children:[a.stacks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#c9c9d1",opacity:.45},a.key)),a.drafts.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#9a9aa4",opacity:.3,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.decks.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:"#5a51e0",opacity:.35,stroke:a.key===c?"#5a51e0":void 0,strokeWidth:a.key===c?5/g:void 0},a.key)),a.nodes.map(a=>(0,d.jsx)("rect",{x:a.x,y:a.y,width:a.w,height:a.h,rx:24,fill:aj(a.file),opacity:"live"===a.file.activity?.85:.35,stroke:a.file.path===c?"#5a51e0":void 0,strokeWidth:a.file.path===c?5/g:void 0},a.file.path)),b.map(a=>(0,d.jsx)("circle",{cx:a.pos.x+130,cy:a.pos.y+du(a)/2,r:3/g,fill:cR[a.status].color,opacity:"done"===a.status?.5:.95},a.id))]})})})}function em(a){try{window.localStorage.setItem("llvArchived",JSON.stringify([...a]))}catch{}}function en({data:a,onOpen:b}){let{t:c}=u(),f=a.waiting.length;(0,e.useRef)(f);let[g,h]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"group absolute bottom-3 right-3 z-20",children:[a.livePreview.length?(0,d.jsx)("div",{className:"pointer-events-none mb-1.5 hidden w-[300px] rounded-[8px] border border-line bg-panel/95 px-3 py-2 shadow-card backdrop-blur group-focus-within:block group-hover:block",children:a.livePreview.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 gap-1.5 py-0.5 text-[10.5px]",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate font-semibold",children:a.title}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-dim",children:a.statusLine||c("status.working")})]},a.file.path))}):null,(0,d.jsxs)("button",{className:`ml-auto flex items-center gap-1.5 rounded-full border border-line bg-panel/95 px-2.5 py-1 text-[11.5px] font-bold shadow-card backdrop-blur transition-transform hover:border-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 ${g?"scale-110 border-[#e0ae45]/70":""} motion-reduce:transition-none`,"aria-label":c("corner.openSwitchboard"),onClick:b,children:[(0,d.jsx)("span",{className:`h-2 w-2 rounded-full ${a.working.length?"animate-pulse bg-ok":"bg-dim"}`}),(0,d.jsx)("span",{children:a.working.length}),(0,d.jsx)("span",{className:f?"text-[#b8860b]":"text-dim",children:c("corner.waitingCount",{count:f})})]})]})}function eo({file:a,title:b,project:c,currentProject:e,descendants:f,statusLine:g,size:h,tone:i,onOpen:j,onArchive:k}){let{t:l}=u(),n=al(a),o="large"===h;return(0,d.jsxs)("article",{className:`group relative flex ${o?"h-[150px] w-[300px]":"h-[108px] w-[220px]"} shrink-0 flex-col rounded-[8px] border p-3 shadow-card transition-colors hover:border-accent/45 ${"working"===i?"border-ok/40 bg-[#f3fbf5] shadow-[0_0_0_3px_rgba(26,138,62,0.12)]":"stalled"===i?"border-err/35 bg-[#fff5f5]":"waiting"===i?"border-[#e0ae45]/45 bg-[#fff9ed]":"border-line bg-panel"}`,role:"button",tabIndex:0,"aria-label":l("switchCard.openColumn",{title:v(b,80)}),onClick:()=>j(a),onKeyDown:b=>{"Enter"===b.key&&j(a)},children:["live"===a.activity?null:(0,d.jsx)("button",{type:"button",className:"absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-full border border-line bg-bg text-dim hover:border-err/50 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 group-hover:flex group-focus-within:flex","aria-label":l("switchCard.remove"),onClick:b=>{b.stopPropagation(),k(a)},onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(m,{className:"h-3 w-3","aria-hidden":!0})}),(0,d.jsxs)("div",{className:"relative flex min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${_(a.activity)}`}),a.model?(0,d.jsx)("span",{className:"min-w-0 truncate rounded-full px-1.5 py-0.5 font-mono text-[9px] font-semibold",style:{backgroundColor:ah(a).soft,color:ah(a).color},title:[n.label,ai(a)].filter(Boolean).join(" \xb7 "),children:a.model}):(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:n.style,children:n.label}),(0,d.jsx)("span",{className:`ml-auto min-w-0 truncate rounded-full border border-line bg-bg px-1.5 py-0.5 text-[9.5px] font-semibold ${c===e?"text-dim":"text-ink"}`,title:c,children:c})]}),(0,d.jsx)("div",{className:`relative mt-2 min-w-0 ${o?"text-[14px]":"text-[12.5px]"} font-bold leading-snug`,title:b,children:(0,d.jsx)("span",{className:"line-clamp-2",children:b})}),(0,d.jsxs)("div",{className:"relative mt-auto flex min-w-0 items-center gap-2 text-[10.5px] font-semibold text-dim",children:[(0,d.jsx)("span",{className:"shrink-0",children:Z(a.mtime)}),a.ctx?(0,d.jsx)(cF,{ctx:a.ctx}):null,f?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)(aL,{className:"h-3 w-3","aria-hidden":!0})," ",f]}):null]}),g?(0,d.jsx)("div",{className:`relative mt-1 min-w-0 truncate ${o?"text-[11.5px]":"text-[10.5px]"} font-semibold text-ink/75`,children:g}):null,a.pid&&"running"===a.proc?(0,d.jsx)("div",{className:"relative mt-2",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),children:(0,d.jsx)(cv,{file:a,compact:!0})}):null]})}function ep({title:a,items:b,size:c,currentProject:e,onOpenFile:f,onArchive:g}){return b.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("div",{className:"mb-2 flex items-baseline gap-2",children:[(0,d.jsx)("h2",{className:"text-[13px] font-bold",children:a}),(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:b.length})]}),(0,d.jsx)(bB,{className:"flex flex-wrap gap-2.5",enter:"fade",children:b.map(a=>(0,d.jsx)("div",{"data-flip-key":a.file.path,children:(0,d.jsx)(eo,{file:a.file,title:a.title,project:a.project,currentProject:e,descendants:a.descendants,statusLine:a.statusLine,size:c,tone:"working"===a.kind?"working":"waiting"===a.kind&&"stalled"===a.file.activity?"stalled":"waiting"===a.kind?"waiting":"quiet",onOpen:f,onArchive:g})},a.file.path))})]}):null}function eq({files:a,flows:b,project:c,onOpenFile:f}){let{t:g}=u(),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(0),s=(0,e.useRef)(null),t=function(){let[a,b]=(0,e.useState)([]),[c,d]=(0,e.useState)(!1);return{events:a,loading:c}}(),{archivedPaths:w,archive:x,unarchive:y}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedPaths:a,archive:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,em(d),d})},[]),unarchive:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,em(d),d})},[])}}(),z=ao(a,t.events,j,q,w,b),A=ao(a,[],"",q,w,b),B=(0,e.useMemo)(()=>a.filter(a=>w.has(a.path)).map(a=>({file:a,title:v(a.title),project:D(a)})).sort((a,b)=>b.file.mtime-a.file.mtime),[a,w]),C=a=>{f(a),i(!1)},E=a=>x(a.path);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(en,{data:A,onOpen:()=>i(!0)}),h?(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/28 p-[2.5vh]",onMouseDown:()=>i(!1),children:(0,d.jsxs)("div",{className:"flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-[8px] border border-line bg-bg shadow-[0_18px_70px_rgb(20_20_30/0.28)]",role:"dialog","aria-modal":"true","aria-label":g("switch.aria"),onMouseDown:a=>a.stopPropagation(),children:[(0,d.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-line bg-panel px-4",children:[(0,d.jsx)("div",{className:"text-[15px] font-bold",children:g("switch.title")}),(0,d.jsx)("input",{ref:s,value:j,onChange:a=>k(a.target.value),placeholder:g("switch.search"),className:"h-9 min-w-0 flex-1 rounded-[8px] border border-line bg-bg px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),t.loading?(0,d.jsx)("span",{className:"text-[11px] font-semibold text-dim",children:g("switch.updating")}):null,(0,d.jsx)("button",{className:"inline-flex h-8 w-8 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":g("switch.close"),onClick:()=>i(!1),children:(0,d.jsx)(m,{className:"h-4 w-4","aria-hidden":!0})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto px-4 py-4",children:[(0,d.jsx)(ep,{title:g("switch.waiting"),items:z.waiting,size:"large",currentProject:c,onOpenFile:C,onArchive:E}),(0,d.jsx)(ep,{title:g("switch.working"),items:z.working,size:"large",currentProject:c,onOpenFile:C,onArchive:E}),(0,d.jsx)(ep,{title:g("switch.recent"),items:z.recent,size:"small",currentProject:c,onOpenFile:C,onArchive:E}),(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-10 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12.5px] font-bold hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":l,onClick:()=>n(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.older")}),(0,d.jsx)("span",{className:"text-dim",children:z.older.length})]}),l?(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsx)(ep,{title:"",items:z.older,size:"small",currentProject:c,onOpenFile:C,onArchive:E})}):null]}),z.waiting.length||z.working.length||z.recent.length||z.older.length?null:(0,d.jsx)("div",{className:"pt-[18vh] text-center text-[13px] font-semibold text-dim",children:g("common.nothingFound")}),B.length?(0,d.jsxs)("section",{className:"shrink-0",children:[(0,d.jsxs)("button",{className:"flex h-9 w-full items-center justify-between rounded-[8px] border border-line bg-panel px-3 text-left text-[12px] font-bold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":o,onClick:()=>p(a=>!a),children:[(0,d.jsx)("span",{children:g("switch.hidden",{count:B.length})}),(0,d.jsx)("span",{children:o?g("switch.hide"):g("common.show")})]}),o?(0,d.jsx)("div",{className:"mt-2 space-y-1",children:B.map(a=>(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel/60 px-3 py-1.5 text-[11.5px] text-dim",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.title}),(0,d.jsx)("span",{className:"shrink-0 truncate text-[10.5px]",children:a.project}),(0,d.jsx)("button",{className:"shrink-0 rounded-full border border-line bg-bg px-2 py-0.5 text-[10.5px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>y(a.file.path),children:g("switch.restore")})]},a.file.path))}):null]}):null]})]})}):null]})}function er(){location.hash="#p="+encodeURIComponent(w)}function es({files:a,onOpen:b}){let{t:c}=u();return(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5",children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-[760px]",children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:c("trash.title")}),(0,d.jsx)("div",{className:"mb-3 mt-0.5 text-[12px] text-dim",children:c("trash.hint")}),(0,d.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,d.jsx)(et,{file:a,onOpen:b},a.path))})]})})}function et({file:a,onOpen:b}){let{t:c}=u(),[f,g]=(0,e.useState)(!1),h=al(a);return f?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-[8px] border border-line bg-chip/60 px-3 py-1.5 text-[11.5px] font-semibold text-dim",children:[(0,d.jsx)(a7,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:v(a.title,80)}),(0,d.jsx)("span",{className:"shrink-0",children:c("trash.deletedFromDisk")})]}):(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2 rounded-[8px] border border-line bg-panel px-3 py-1.5 shadow-card",children:[(0,d.jsxs)("button",{type:"button",className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-[6px] text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":c("trash.open",{title:v(a.title,60)}),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0.5 text-[9.5px] font-bold",style:h.style,children:h.label}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-semibold",title:a.path,children:v(a.title,90)}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] font-semibold text-dim",children:Z(a.mtime)}),(0,d.jsxs)("span",{className:"shrink-0 text-[10.5px] text-dim",children:[(a.size/1024).toFixed(0)," ",c("common.kb")]})]}),(0,d.jsx)(bA,{file:a,onDeleted:()=>g(!0)})]})}function eu({files:a,onArchive:b}){let{t:c}=u();return!a.length||a.some(a=>"running"===a.proc||"live"===a.activity)?null:(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{b(),er()},children:[(0,d.jsx)(aO,{className:"h-3 w-3","aria-hidden":!0})," ",c("trash.toArchive")]})}function ev({files:a}){let{t:b}=u(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)("");if(!a.length||a.some(a=>"running"===a.proc||"live"===a.activity))return null;let k=async()=>{h(!0),j("");let c=0;for(let b of a)try{let a=await fetch(`/api/log?path=${encodeURIComponent(b.path)}`,{method:"DELETE"}),d=await a.json();a.ok&&d.ok||(c+=1)}catch{c+=1}(h(!1),f(!1),c)?j(b("trash.notDeleted",{failed:c,total:a.length})):er()};return c?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-[10px] border border-err/30 bg-[#fff5f5] px-1.5 py-0.5 text-[11px]",children:[(0,d.jsx)("span",{className:"px-0.5 font-semibold text-err",children:b("trash.confirmDelete",{count:a.length})}),(0,d.jsx)("button",{type:"button",className:"rounded-lg bg-err px-2 py-0.5 font-bold text-white disabled:opacity-60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-err/50",disabled:g,onClick:k,children:g?b("trash.deleting"):b("trash.confirmYes")}),(0,d.jsx)("button",{type:"button",className:"rounded-lg border border-line bg-panel px-2 py-0.5 font-semibold text-dim focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>f(!1),children:b("common.cancel")})]}):(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line bg-bg p-1 text-dim hover:border-err/40 hover:text-err focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("trash.deleteProject"),title:b("trash.deleteProject"),onClick:()=>f(!0),children:(0,d.jsx)(a7,{className:"h-3 w-3","aria-hidden":!0})}),i?(0,d.jsx)("span",{className:"max-w-[180px] truncate text-[10.5px] font-semibold text-err",children:i}):null]})}let ew=k("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),ex=k("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);function ey(){let{t:a}=u(),[b,c]=(0,e.useState)(!0);return(0,d.jsx)("button",{className:"ml-auto inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(b?"sound.on":"sound.off"),"aria-label":a(b?"sound.mute":"sound.unmute"),"aria-pressed":b,onClick:()=>{let a=!b;c(a);try{localStorage.setItem(as,a?"on":"off")}catch{}a&&function(a=0){(function(){try{localStorage.getItem(as)}catch{return!0}})()}()},children:b?(0,d.jsx)(ew,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(ex,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function ez({items:a,onSelect:b}){let{t:c}=u(),[f,g]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line bg-panel",children:[(0,d.jsxs)("button",{className:"flex h-8 items-center gap-2 px-4 text-[10px] font-bold uppercase tracking-[.6px] text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":f,onClick:()=>g(a=>!a),children:[(0,d.jsx)(aW,{className:`h-3.5 w-3.5 transition-transform ${f?"rotate-90":""}`,"aria-hidden":!0}),c("tree.quiet"),(0,d.jsx)("span",{className:"font-semibold normal-case tracking-normal",children:a.length})]}),f?(0,d.jsx)(bB,{className:"flex max-h-44 flex-wrap items-start gap-1.5 overflow-y-auto px-3 pb-2.5",children:a.map(a=>{let c=al(a),e=v(a.cmdDesc||a.title,70);return(0,d.jsxs)("button",{"data-flip-key":a.path,className:"inline-flex h-7 max-w-[360px] items-center gap-1.5 rounded-full border border-line bg-bg px-2 text-[11px] font-semibold text-ink hover:border-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:v(a.title),onClick:()=>b(a),children:[(0,d.jsx)("span",{className:`h-1.5 w-1.5 shrink-0 rounded-full ${_(a.activity)}`}),(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 text-[9px]",style:c.style,children:c.label}),(0,d.jsx)("span",{className:"truncate",children:e}),(0,d.jsx)("span",{className:"shrink-0 font-normal text-dim",children:Z(a.mtime)})]},a.path)})}):null]})}let eA=a=>`llvCols:${a}`;function eB(a,b){let c=function(a){try{let b=JSON.parse(localStorage.getItem(eA(a))??"{}");return{manual:b.manual??[],hidden:b.hidden??[]}}catch{return{manual:[],hidden:[]}}}(a);c.manual.includes(b)||c.manual.push(b),c.hidden=c.hidden.filter(a=>a!==b),localStorage.setItem(eA(a),JSON.stringify(c))}function eC(a){location.hash="#p="+encodeURIComponent(a)}function eD({files:a,flows:b,tasks:c,project:f,openNonce:g,focusRequest:h,attentionPaths:i,archived:j,onArchive:k,onUnarchive:l,onMenu:m}){let{t:n}=u(),o=aG(),p=(0,e.useRef)(null),q=(0,e.useRef)(null),[r,s]=(0,e.useState)({manual:[],hidden:[]}),[t,v]=(0,e.useState)([]),[w,x]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,E]=(0,e.useState)([]),H=(0,e.useRef)(r),J=()=>{B(a=>(localStorage.setItem("llvTaskPanel",a?"0":"1"),!a))},K=a=>{H.current=a,s(a),localStorage.setItem(eA(f),JSON.stringify(a))},L=(0,e.useMemo)(()=>{let c=Q(b);return c.size?a.filter(a=>!c.has(a.path)):a},[a,b]),M=(0,e.useMemo)(()=>I(L,f),[L,f]),N=(0,e.useMemo)(()=>new Set(M.map(a=>a.key)),[M]),O=(0,e.useMemo)(()=>(function(a,b,c){let d=F(a),e=[];for(let f of a){if(D(f)!==b||!z(f)||c.has(f.path))continue;let a=G(f,d);if(!a.length)continue;let g=f.mtime,h=y(f);for(let b of a)g=Math.max(g,b.mtime),h=Math.min(h,y(b));e.push({root:f,branchCount:a.length,smt:g,band:h})}return e.sort((a,b)=>a.band-b.band||b.smt-a.smt)})(L,f,N),[L,f,N]),P=(0,e.useMemo)(()=>{let a;return a=F(L),L.filter(b=>!(D(b)!==f||b.parent||N.has(b.path)||a.get(b.path)?.length)&&"live"!==b.activity).sort((a,b)=>y(a)-y(b)||b.mtime-a.mtime)},[L,f,N]),R=(0,e.useMemo)(()=>new Set(M.flatMap(a=>a.columns.map(a=>a.file.path))),[M]),S=(0,e.useMemo)(()=>new Set(r.hidden),[r.hidden]),T=(0,e.useMemo)(()=>c.filter(a=>a.project===f),[c,f]),U=(0,e.useMemo)(()=>{let a=new Map(L.map(a=>[a.path,a]));return r.manual.map(b=>a.get(b)).filter(a=>void 0!==a&&D(a)===f&&!R.has(a.path)&&!S.has(a.path))},[r.manual,L,f,R,S]),V=(0,e.useMemo)(()=>{let a=new Map(L.map(a=>[a.path,a])),b=new Set(U.map(a=>a.path)),c=C.map(b=>a.get(b)).filter(a=>void 0!==a&&D(a)===f&&!b.has(a.path)&&(!R.has(a.path)||S.has(a.path)));return c.length?[...U,...c]:U},[C,L,f,R,S,U]),W=(0,e.useMemo)(()=>M.reduce((a,b)=>a+b.columns.reduce((a,b)=>a+ +("live"===b.file.activity)+b.tasks.filter(a=>"live"===a.activity).length,0),0),[M]),X=M.filter(a=>!a.orphanTask).length,Y=a=>{x(a),p.current&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>x(null),1800)},Z=a=>{v(a),sessionStorage.setItem(`llvDrafts:${f}`,JSON.stringify(a))},$=()=>"function"==typeof crypto.randomUUID?crypto.randomUUID():Date.now().toString(36)+Math.random().toString(36).slice(2,10),_=()=>{let a=$();Z([...t,a]),q.current="draft::"+a},aa=a=>{let b=t.find(b=>""===a.path);if(b)return void Y("draft::"+b);let c=$();cP(c,"src",a.path),Z([...t,c]),q.current="draft::"+c},ab=a=>{for(let b of["engine","cwd","text","boot","src"])sessionStorage.removeItem(cO(a,b));Z(t.filter(b=>b!==a))},ac=(a,b)=>{ab(a),ae(b)},ad=a=>{fetch("/api/tmux",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"kill",path:a})}).catch(()=>{}),K({manual:r.manual.filter(b=>b!==a),hidden:R.has(a)?[...new Set([...r.hidden,a])]:r.hidden}),E(b=>b.includes(a)?b.filter(b=>b!==a):b)},ae=a=>{let b=D(a);if(b!==f){eB(b,a.path),eC(b);return}if(R.has(a.path)&&!S.has(a.path)||U.some(b=>b.path===a.path))return void Y(a.path);let c=r.hidden.filter(b=>b!==a.path);K({manual:R.has(a.path)?r.manual:[...new Set([...r.manual,a.path])],hidden:c}),q.current=a.path},af=[];W?af.push(`${n("dash.branchesLive",{count:W})} \xb7 ${n("dash.trees",{count:X})}`):X&&af.push(n("dash.recentConvos",{count:X})),O.length&&af.push(n("dash.quietTrees",{count:O.length}));let ag=M.map(a=>({...a,columns:a.columns.filter(a=>!S.has(a.file.path))})).filter(a=>a.columns.length),ah=ag.filter(a=>a.orphanTask).map(a=>a.columns[0].file),ai=ag.filter(a=>!a.orphanTask),aj=ai.length>0||V.length>0||t.length>0||T.length>0,ak=(0,e.useMemo)(()=>a.filter(a=>D(a)===f).sort((a,b)=>b.mtime-a.mtime),[a,f]);return(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"flex h-10 shrink-0 items-center gap-2.5 border-b border-line bg-panel px-4",children:[m?(0,d.jsx)("button",{type:"button",className:"-ml-1.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-[8px] border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":n("dash.openProjects"),onClick:m,children:(0,d.jsx)(aH,{className:"h-4 w-4","aria-hidden":!0})}):null,(0,d.jsx)("h1",{className:"truncate text-[13.5px] font-bold",children:f}),(0,d.jsx)("span",{className:"truncate text-[11.5px] text-dim",children:af.length?af.join(" \xb7 "):n("common.nothingRunning")}),(0,d.jsx)(ey,{}),j?(0,d.jsxs)("button",{type:"button",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-line bg-bg px-2 py-0.5 text-[11px] font-semibold text-dim hover:border-accent/40 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>l(f),children:[(0,d.jsx)(aP,{className:"h-3 w-3","aria-hidden":!0})," ",n("dash.unarchive")]}):(0,d.jsx)(eu,{files:ak,onArchive:()=>k(f)}),(0,d.jsx)(ev,{files:ak}),o?(0,d.jsxs)("button",{type:"button",onClick:_,"aria-label":n("dash.newConvo"),className:"ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2.5 py-1 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",n("dash.agent")]}):(0,d.jsxs)("button",{type:"button",onClick:J,"aria-pressed":A,"aria-label":n("tasks.panelToggleAria"),className:`ml-auto flex shrink-0 items-center gap-1 rounded-[8px] border px-2.5 py-1 text-[11.5px] font-bold shadow-card focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 ${A?"border-accent/45 bg-accent/10 text-accent":"border-line bg-panel text-ink hover:border-accent/45 hover:text-accent"}`,children:[(0,d.jsx)(aJ,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",n("tasks.panelTitle"),T.filter(a=>"done"!==a.status).length?(0,d.jsx)("span",{className:"rounded-full bg-accent/10 px-1.5 text-[10px] font-bold text-accent",children:T.filter(a=>"done"!==a.status).length}):null]})]}),ah.length?(0,d.jsx)("div",{className:"shrink-0 border-b border-line bg-[#fbfbfd]",children:ah.map(b=>(0,d.jsx)("div",{className:`border-l-4 ${"live"===b.activity?"border-l-ok bg-[#f2faf4]":"border-l-[#9a9aa4]"}`,children:(0,d.jsx)(cM,{file:b,files:a,onSelect:ae})},b.path))}):null,o?aj?(0,d.jsx)(ej,{project:f,groups:ai,manual:V,files:a,flows:b,tasks:T,drafts:t,focus:w,onSelect:ae,onClose:ad,onDraftClose:ab,onDraftSpawned:ac,onHandoff:aa}):ak.length?(0,d.jsx)(es,{files:ak,onOpen:ae}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:n("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:n("dash.emptyHint")})]})}):(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[aj?(0,d.jsx)(eh,{project:f,groups:ai,manual:V,files:a,flows:b,tasks:T,drafts:t,focus:w,attentionPaths:i,onSelect:ae,onClose:ad,onDraftClose:ab,onDraftSpawned:ac,onHandoff:aa}):ak.length?(0,d.jsx)(es,{files:ak,onOpen:ae}):(0,d.jsx)("div",{className:"flex flex-1 items-center justify-center px-4 py-5 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"text-[13.5px] font-semibold text-dim",children:n("dash.emptyTitle")}),(0,d.jsx)("div",{className:"mt-0.5 text-[12px] text-dim",children:n("dash.emptyHint")})]})}),(0,d.jsx)("div",{className:"pointer-events-none absolute bottom-4 left-4 z-30 flex items-center gap-2",children:(0,d.jsxs)("button",{type:"button",onClick:_,"aria-label":n("dash.newConvo"),className:"pointer-events-auto flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-3 py-1.5 text-[11.5px] font-bold text-ink shadow-card hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:[(0,d.jsx)("span",{className:"text-[13px] leading-none text-accent",children:"+"})," ",n("dash.agent")]})})]}),A?(0,d.jsx)(cV,{tasks:c,project:f,onOpenTask:a=>{if(a.project!==f){sessionStorage.setItem("llvTaskFocus",a.id),eC(a.project);return}Y("task::"+a.id)},onClose:J}):null]}),o?null:(0,d.jsx)(eq,{files:a,flows:b,project:f,onOpenFile:ae}),P.length?(0,d.jsx)(ez,{items:P,onSelect:ae}):null,(0,d.jsx)(c$,{})]})}let eE=k("qr-code",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]),eF=k("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function eG(){let{t:a}=u(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)({status:"idle"}),[h,i]=(0,e.useState)(null),[j,k]=(0,e.useState)(!1),l=(0,e.useRef)(null),m="ready"===f.status&&h&&h.url===f.url?h.dataUrl:null,n=(0,e.useCallback)(()=>{"ready"===f.status&&navigator.clipboard.writeText(f.url).then(()=>{k(!0),window.setTimeout(()=>k(!1),2e3)}).catch(()=>{})},[f]);return(0,d.jsxs)("div",{ref:l,className:"relative ml-auto shrink-0",children:[(0,d.jsx)("button",{type:"button","aria-expanded":b,"aria-label":a("qr.showAria"),onClick:()=>{b||g({status:"idle"}),c(!b)},className:"flex items-center justify-center rounded-[8px] border border-line bg-panel p-1.5 text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:(0,d.jsx)(eE,{className:"h-4 w-4","aria-hidden":!0})}),b?(0,d.jsx)("div",{className:"fixed left-1/2 top-12 z-50 flex w-[260px] -translate-x-1/2 flex-col gap-2.5 rounded-[12px] border border-line bg-panel p-3 shadow-[0_8px_28px_rgba(20,20,30,0.14)] sm:absolute sm:left-0 sm:right-auto sm:top-full sm:mt-1.5 sm:translate-x-0",children:"idle"===f.status?(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("common.loading")}):"error"===f.status?(0,d.jsx)("span",{className:"text-[12px] font-semibold text-err",children:a("qr.failed")}):"unavailable"===f.status?(0,d.jsxs)("span",{className:"text-[12px] leading-relaxed text-ink",children:[a("qr.startHint"),(0,d.jsx)("code",{className:"break-all rounded bg-chip px-1 py-0.5 font-mono text-[11px]",children:"bunx agent-log-viewer --tailscale"})]}):(0,d.jsxs)(d.Fragment,{children:[m?(0,d.jsx)("img",{src:m,alt:a("qr.alt"),className:"mx-auto h-[220px] w-[220px]"}):(0,d.jsx)("span",{className:"text-[12px] text-ink",children:a("qr.generating")}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("input",{readOnly:!0,value:f.url,"aria-label":a("qr.linkAria"),onFocus:a=>a.currentTarget.select(),className:"min-w-0 flex-1 truncate rounded-[8px] border border-line bg-bg px-2 py-1.5 font-mono text-[10.5px] text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"}),(0,d.jsx)("button",{type:"button","aria-label":a("qr.copy"),onClick:n,className:"flex shrink-0 items-center gap-1 rounded-[8px] border border-line bg-panel px-2 py-1.5 text-[11px] font-semibold text-dim hover:border-accent/45 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",children:j?(0,d.jsx)(aV,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(eF,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),(0,d.jsx)("span",{className:"text-[10.5px] text-dim",children:a("qr.scanHint")})]})}):null]})}function eH(){let{locale:a,t:b,setLocale:c}=u(),e="en"===a?"uk":"en";return(0,d.jsx)("button",{className:"inline-flex h-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel px-2 text-[10.5px] font-bold text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:b("lang.aria"),"aria-label":b("lang.aria"),onClick:()=>c(e),children:a.toUpperCase()})}let eI=(a=q())=>"uk"===a?"uk-UA":"en-US";function eJ({label:a,window:b,engineColor:c,now:e}){var f,g;let h,i,j,k,{t:l}=u();if(!b)return null;let m=Math.max(0,Math.min(100,100-b.usedPercent)),n=m<=10?"#c62828":m<=30?"#d29a2f":c;return(0,d.jsxs)("div",{className:"mt-1.5",children:[(0,d.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold text-ink",children:a}),(0,d.jsxs)("span",{className:"text-[11px] text-dim",children:[l("limits.left")," ",(0,d.jsxs)("span",{className:`font-bold tabular-nums ${m<=30?"":"text-ink"}`,style:m<=30?{color:n}:void 0,children:[Math.round(m),"%"]})]})]}),(0,d.jsx)("div",{className:"mt-1 h-[4px] overflow-hidden rounded-full bg-chip",children:(0,d.jsx)("div",{className:"h-full rounded-full transition-[width] duration-700 ease-out",style:{width:Math.max(m,1.5)+"%",backgroundColor:n}})}),b.resetsAt?(0,d.jsx)("div",{className:"mt-[3px] text-[10px] leading-none text-dim",children:l("limits.reset",{eta:(f=b.resetsAt,h=q(),(i=f-e)<=60?t(h,"limits.now"):i<5400?t(h,"limits.inMin",{n:Math.round(i/60)}):i<129600?t(h,"limits.inHour",{n:Math.round(i/3600)}):t(h,"limits.inDay",{n:Math.round(i/86400)})),at:(g=b.resetsAt,k=(j=new Date(1e3*g)).toLocaleTimeString(eI(),{hour:"2-digit",minute:"2-digit",hour12:!1}),g-e<86400?k:j.toLocaleDateString(eI(),{day:"numeric",month:"short"})+" "+k)})}):null]})}function eK({label:a,engine:b,limits:c,now:e,staleHint:f}){let{t:g}=u();if(!c||!c.session&&!c.weekly)return null;let h=aa[b]??ab,i=c.capturedAt&&e-c.capturedAt>1200?Z(c.capturedAt):null;return(0,d.jsxs)("div",{className:`mt-2.5 first:mt-0 ${f?"opacity-60":""}`,children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,d.jsx)("span",{className:"text-[11.5px] font-bold",style:{color:h.color},children:a}),c.plan?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:c.plan}):null,f?(0,d.jsx)("span",{className:"truncate text-[10px] text-dim",children:f}):null,i?(0,d.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 self-center rounded-full bg-[#d29a2f]",title:g("limits.stale",{stale:i})}):null]}),(0,d.jsx)(eJ,{label:g("limits.5h"),window:c.session,engineColor:h.color,now:e}),(0,d.jsx)(eJ,{label:g("limits.week"),window:c.weekly,engineColor:h.color,now:e})]})}function eL(){let{locale:a}=u(),[b,c]=(0,e.useState)(null);if(!b||!b.data.claude&&!b.data.codex)return null;let f=function(a,b){if(!a)return null;let c=new Date(a);return Number.isNaN(c.getTime())?null:t(b,"limits.asOf",{time:c.toLocaleTimeString(eI(b),{hour:"2-digit",minute:"2-digit",hour12:!1})})}(b.data.staleSince,a);return(0,d.jsxs)("div",{className:"shrink-0 border-t border-line px-3.5 pb-3 pt-2.5",children:[(0,d.jsx)(eK,{label:"Claude",engine:"claude",limits:b.data.claude,now:b.at,staleHint:f}),(0,d.jsx)(eK,{label:"Codex",engine:"codex",limits:b.data.codex,now:b.at,staleHint:f})]})}let eM=k("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),eN=k("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);function eO(){let{t:a}=u(),[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),h=async()=>{if(!f||"default"===Notification.permission&&"granted"!==await Notification.requestPermission()||"granted"!==Notification.permission)return;let a=await navigator.serviceWorker.register("/question-push-sw.js"),b=await a.pushManager.getSubscription();if(b){await b.unsubscribe(),c(!1);return}let d=await (await fetch("/api/push")).json(),e=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(a){let b=atob((a+"=".repeat((4-a.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/")),c=new Uint8Array(b.length);for(let a=0;a<b.length;a+=1)c[a]=b.charCodeAt(a);return c.buffer.slice(0)}(d.publicKey)});await fetch("/api/push",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),c(!0)};return(0,d.jsx)("button",{className:"inline-flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full border border-line bg-panel text-dim hover:text-ink disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",title:a(f?b?"push.enabled":"push.enable":"push.needsHttps"),"aria-label":a(f?b?"push.disable":"push.enable":"push.needsHttps"),"aria-pressed":b,disabled:!f,onClick:h,children:b?(0,d.jsx)(eM,{className:"h-3.5 w-3.5","aria-hidden":!0}):(0,d.jsx)(eN,{className:"h-3.5 w-3.5","aria-hidden":!0})})}function eP({files:a,archivedProjects:b,selected:c,now:f,onSelect:g}){let{t:h}=u(),[i,j]=(0,e.useState)(""),[k,l]=(0,e.useState)(!1),m=(0,e.useMemo)(()=>E(a,f),[a,f]),n=(0,e.useMemo)(()=>{let a=i.trim().toLowerCase();return a?m.filter(b=>b.project.toLowerCase().includes(a)):m},[m,i]),o=(0,e.useMemo)(()=>n.filter(a=>!b.has(a.project)),[n,b]),p=(0,e.useMemo)(()=>n.filter(a=>b.has(a.project)),[n,b]),q=(0,e.useMemo)(()=>m.reduce((a,b)=>a+b.liveCount,0),[m]),r=(0,e.useMemo)(()=>m.reduce((a,b)=>a+b.attentionCount,0),[m]);return(0,d.jsxs)("aside",{className:"flex w-[248px] shrink-0 flex-col border-r border-line bg-panel",children:[(0,d.jsxs)("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-line px-4 text-[13.5px] font-bold",children:[h("rail.title"),q?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#e5f6ea] px-2 py-0.5 text-[10.5px] font-bold text-ok",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-ok"}),q]}):null,r?(0,d.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-[#fff1ca] px-2 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",r]}):null,(0,d.jsx)(eH,{}),(0,d.jsx)(eG,{}),(0,d.jsx)(eO,{})]}),(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-2.5",children:(0,d.jsx)("input",{className:"w-full rounded-[9px] border border-line bg-bg px-2.5 py-1.5 text-[12px] outline-none focus-visible:ring-2 focus-visible:ring-accent/40",placeholder:h("rail.filter"),value:i,onChange:a=>j(a.target.value)})}),(0,d.jsxs)("nav",{className:"flex-1 overflow-y-auto px-2 pb-3 pt-1","aria-label":h("rail.projects"),children:[(0,d.jsx)(eQ,{label:h("rail.overview"),live:0,attention:0,total:null,age:"",active:c===w,hasLive:!1,onClick:()=>g(w)}),(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsx)(bB,{children:o.map(a=>(0,d.jsx)("div",{"data-flip-key":a.project,children:(0,d.jsx)(eQ,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:Z(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>g(a.project)})},a.project))}),p.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"mx-2.5 my-1.5 border-t border-line"}),(0,d.jsxs)("button",{type:"button",className:"mb-0.5 flex w-full items-center gap-1.5 rounded-[10px] px-2.5 py-1.5 text-left text-[11.5px] font-bold text-dim hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-expanded":k,onClick:()=>l(a=>!a),children:[(0,d.jsx)(aW,{className:`h-3 w-3 shrink-0 transition-transform ${k?"rotate-90":""}`,"aria-hidden":!0}),(0,d.jsx)(aO,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),h("rail.archive"),(0,d.jsx)("span",{className:"font-semibold",children:p.length})]}),k?p.map(a=>(0,d.jsx)(eQ,{label:a.project,live:a.liveCount,attention:a.attentionCount,total:a.conversations,age:Z(a.smt),active:c===a.project,hasLive:a.liveCount>0,onClick:()=>g(a.project)},a.project)):null]}):null,o.length||p.length?null:(0,d.jsx)("div",{className:"px-3 py-4 text-center text-[12px] text-dim",children:h("common.nothingFound")})]}),(0,d.jsx)(eL,{})]})}function eQ({label:a,live:b,attention:c,total:e,age:f,active:g,hasLive:h,onClick:i}){return(0,d.jsxs)("button",{className:["mb-0.5 flex w-full items-center gap-2 rounded-[10px] border px-2.5 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",g?"border-line bg-bg shadow-card":"border-transparent hover:bg-bg"].join(" "),"aria-current":g?"page":void 0,onClick:i,children:[(0,d.jsx)("span",{className:["h-2 w-2 shrink-0 rounded-full",h?"animate-pulse bg-ok":"bg-[#d6d6dd]"].join(" ")}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:`block truncate text-[13px] ${g?"font-bold":"font-semibold"}`,children:a}),f?(0,d.jsx)("span",{className:"block text-[10.5px] text-dim",children:f}):null]}),b>0?(0,d.jsx)("span",{className:"shrink-0 rounded-full bg-[#e5f6ea] px-1.5 py-0.5 text-[10.5px] font-bold text-ok",children:b}):null,c>0?(0,d.jsxs)("span",{className:"shrink-0 rounded-full bg-[#fff1ca] px-1.5 py-0.5 text-[10.5px] font-bold text-[#8a5a00]",children:["⏸ ",c]}):null,null!==e?(0,d.jsx)("span",{className:"shrink-0 text-[11px] font-semibold text-dim",children:e}):null]})}function eR(){let a,{t:b}=u(),{files:c,flows:f,tasks:g}=function(){let[a,b]=(0,e.useState)(aD);return a}(),h=(a=(0,e.useSyncExternalStore)(N,()=>L,()=>O),(0,e.useMemo)(()=>f.some(b=>a.has(b.id)&&"closed"!==b.state)?f.map(b=>a.has(b.id)&&"closed"!==b.state?{...b,state:"closed",closedAt:b.closedAt??new Date().toISOString()}:b):f,[f,a]));(0,e.useRef)(null);let{archivedProjects:i,archiveProject:j,unarchiveProject:k}=function(){let[a,b]=(0,e.useState)(()=>new Set),c=(0,e.useRef)(a);return{archivedProjects:a,archiveProject:(0,e.useCallback)(a=>{b(b=>{if(b.has(a))return b;let d=new Set(b);return d.add(a),c.current=d,at(d),d})},[]),unarchiveProject:(0,e.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let d=new Set(b);return d.delete(a),c.current=d,at(d),d})},[])}}(),n=aG(),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(w),[s,t]=(0,e.useState)(null),[x,y]=(0,e.useState)(null);(0,e.useRef)(null);let[z,A]=(0,e.useState)(0),B=(0,e.useCallback)(a=>{r(a),localStorage.setItem("llvProject",a),a!==w?history.replaceState(null,"","#p="+encodeURIComponent(a)):history.replaceState(null,"",location.pathname),p(!1)},[]),C=(0,e.useCallback)(a=>{let b=D(a);eB(b,a.path),B(b),A(a=>a+1)},[B]),[E,F]=(0,e.useState)(()=>Date.now()/1e3),G=(0,e.useMemo)(()=>(function(a,b=Date.now()/1e3){let c=[];for(let d of a){let a=J(d,b);if(null===a)continue;let e=d.pendingQuestion||d.waitingInput?"blocked":"stalled",f=d.pendingQuestion?function(a){let b=Date.parse(a);return Number.isFinite(b)?b/1e3:null}(d.pendingQuestion.askedAt)??d.mtime:d.waitingInput?d.waitingInput.since:d.mtime;c.push({id:a,file:d,project:D(d),tier:e,since:f})}return c.sort((a,b)=>(a.tier===b.tier?0:"blocked"===a.tier?-1:1)||a.since-b.since||a.id.localeCompare(b.id))})(c,E),[c,E]),[H,I]=(0,e.useState)(!1),K=(0,e.useRef)(null),[M,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(null),S=(0,e.useCallback)(a=>{R(b=>({path:a,nonce:(b?.nonce??0)+1}))},[]),T=(0,e.useRef)(null),U=(0,e.useMemo)(()=>G.map(a=>a.file.path).sort().join("\n"),[G]),V=(0,e.useMemo)(()=>M?new Set(U.split("\n").filter(Boolean)):null,[M,U]);(0,e.useMemo)(()=>q===w?[]:G.filter(a=>a.project===q),[G,q]);let W=(0,e.useCallback)(a=>{I(!1),a.project!==q&&B(a.project),T.current=a.id,S(a.file.path)},[q,B,S]),X=x?c.find(a=>a.path===x):null;return(0,d.jsxs)("div",{className:"flex h-full",children:[n?null:(0,d.jsx)(eP,{files:c,archivedProjects:i,selected:q,now:E,onSelect:B}),n&&o?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,d.jsx)(eP,{files:c,archivedProjects:i,selected:q,now:E,onSelect:B}),(0,d.jsx)("button",{type:"button",className:"min-w-0 flex-1 bg-ink/35","aria-label":b("viewer.closeProjects"),onClick:()=>p(!1)})]}):null,(0,d.jsxs)("main",{className:"flex min-w-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:"pointer-events-none fixed right-4 top-4 z-50 flex flex-col items-end gap-2",children:[G.length?(0,d.jsxs)("div",{ref:K,className:"pointer-events-auto relative",children:[(0,d.jsxs)("div",{className:"flex items-center overflow-hidden rounded-full border border-[#e0ae45]/45 bg-[#fff9ed] shadow-card",children:[(0,d.jsx)("button",{type:"button",className:"px-3 py-1 text-[12px] font-bold text-[#8a5a00] hover:bg-[#e0ae45]/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40","aria-expanded":H,title:b("attention.openQueue"),onClick:()=>I(a=>!a),children:b("attention.badge",{count:G.length})}),n?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"h-4 w-px shrink-0 bg-[#e0ae45]/45","aria-hidden":!0}),(0,d.jsx)("button",{type:"button",className:`px-2 py-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 ${M?"bg-[#e0ae45]/30 text-[#8a5a00]":"text-[#b8860b]/70 hover:bg-[#e0ae45]/15 hover:text-[#8a5a00]"}`,"aria-pressed":M,title:M?b("attention.filterOff"):b("attention.filterOn"),"aria-label":M?b("attention.filterOff"):b("attention.filterOn"),onClick:()=>P(a=>!a),children:(0,d.jsx)(l,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]}),H?(0,d.jsxs)("div",{className:"absolute right-0 top-[calc(100%+6px)] max-h-[60vh] w-[340px] max-w-[calc(100vw-2rem)] overflow-y-auto rounded-[10px] border border-line bg-panel p-1.5 shadow-card",children:[(0,d.jsx)("div",{className:"px-2.5 pb-1 pt-1.5 text-[10.5px] font-bold uppercase tracking-wide text-dim",children:b("attention.popoverTitle")}),G.map(a=>(0,d.jsxs)("button",{type:"button",className:"flex w-full min-w-0 flex-col gap-0.5 rounded-[8px] px-2.5 py-2 text-left hover:bg-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>W(a),children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-semibold text-ink",children:v(a.file.title,90)}),(0,d.jsx)("span",{className:"shrink-0 rounded-full border border-line bg-bg px-1.5 text-[10px] font-semibold text-dim",children:a.project}),(0,d.jsx)("span",{className:"shrink-0 text-[10.5px] text-dim",children:Z(a.since)})]}),(0,d.jsx)("span",{className:`w-full truncate text-[11px] ${"stalled"===a.tier?"text-[#b8860b]":"text-dim"}`,children:function(a,b){let c=b.file.pendingQuestion;if(c){if("plan"===c.kind)return a("status.awaitingPlan");let b=c.questions?.[0];return b?.header||b?.question.split("\n")[0]||a("status.awaitingAnswer")}let d=b.file.waitingInput;return d?d.menu?.question.split("\n")[0]||d.screenTail||a("status.awaitingTerminal"):a("status.stalled")}(b,a)})]},a.id))]}):null]}):null,X?(0,d.jsxs)("div",{className:"pointer-events-auto flex max-w-[360px] gap-2 rounded-[8px] border border-[#e0ae45]/45 bg-[#fff9ed] px-4 py-3 text-[13px] font-semibold text-ink shadow-card",children:[(0,d.jsxs)("button",{className:"min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40",onClick:()=>{C(X),y(null)},children:[(0,d.jsx)("span",{className:"block text-[11px] font-bold text-[#8a5a00]",children:b("viewer.agentWaiting")}),(0,d.jsx)("span",{className:"line-clamp-2",children:X.title})]}),(0,d.jsx)("button",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-line bg-bg text-dim hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","aria-label":b("viewer.closeNotification"),onClick:()=>y(null),children:(0,d.jsx)(m,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}):null]}),q===w?(0,d.jsx)(aI,{files:c,archivedProjects:i,now:E,onSelectProject:B,onSelectFile:C,onMenu:n?()=>p(!0):void 0}):(0,d.jsx)(eD,{files:c,flows:h,tasks:g,project:q,openNonce:z,focusRequest:Q,attentionPaths:V,archived:i.has(q),onArchive:j,onUnarchive:k,onMenu:n?()=>p(!0):void 0})]})]})}},60728:()=>{},61135:()=>{},61744:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,81921,23)),Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},68673:(a,b,c)=>{Promise.resolve().then(c.bind(c,27074))},70440:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(88868);let e=async a=>[{type:"image/x-icon",sizes:"16x16",url:(0,d.fillMetadataSegment)(".",await a.params,"favicon.ico",!0)+"?603d046c9a6fdfbb"}]},70722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},74075:a=>{"use strict";a.exports=require("zlib")},76537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>g,metadata:()=>e,viewport:()=>f});var d=c(5735);c(61135);let e={title:"Live logs",description:"Live viewer for Codex/Claude agent logs"},f={width:"device-width",initialScale:1,viewportFit:"cover",interactiveWidget:"resizes-content"};function g({children:a}){return(0,d.jsx)("html",{lang:"en",className:"h-full antialiased",children:(0,d.jsx)("body",{className:"h-dvh overflow-hidden font-sans text-[15px]",children:a})})}},77068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},78335:()=>{},79428:a=>{"use strict";a.exports=require("buffer")},81825:(a,b,c)=>{Promise.resolve().then(c.bind(c,60073))},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[445,319,918],()=>b(b.s=59215));module.exports=c})();