commandmate 0.11.0 → 0.11.1

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 (177) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +265 -265
  3. package/.next/app-path-routes-manifest.json +26 -26
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +15 -15
  6. package/.next/react-loadable-manifest.json +4 -4
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/server/app/_not-found/page.js +1 -1
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
  12. package/.next/server/app/api/app/update-check/route.js +1 -1
  13. package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
  18. package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
  49. package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
  99. package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
  101. package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
  107. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/chat/page.js +1 -1
  109. package/.next/server/app/chat/page.js.nft.json +1 -1
  110. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  111. package/.next/server/app/login/page.js +1 -1
  112. package/.next/server/app/login/page.js.nft.json +1 -1
  113. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/more/page.js +2 -2
  116. package/.next/server/app/more/page.js.nft.json +1 -1
  117. package/.next/server/app/more/page_client-reference-manifest.js +1 -1
  118. package/.next/server/app/offline/page.js +1 -1
  119. package/.next/server/app/offline/page.js.nft.json +1 -1
  120. package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
  121. package/.next/server/app/page.js +1 -1
  122. package/.next/server/app/page.js.nft.json +1 -1
  123. package/.next/server/app/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
  125. package/.next/server/app/repositories/page.js +1 -1
  126. package/.next/server/app/repositories/page.js.nft.json +1 -1
  127. package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/review/page.js +1 -1
  129. package/.next/server/app/review/page.js.nft.json +1 -1
  130. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app/sessions/page.js +1 -1
  132. package/.next/server/app/sessions/page.js.nft.json +1 -1
  133. package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  135. package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
  136. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/worktrees/[id]/page.js +3 -3
  138. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  139. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/worktrees/[id]/terminal/page.js +1 -1
  141. package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
  142. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  143. package/.next/server/app-paths-manifest.json +26 -26
  144. package/.next/server/chunks/3644.js +13 -0
  145. package/.next/server/chunks/5959.js +1 -1
  146. package/.next/server/chunks/646.js +2 -14
  147. package/.next/server/chunks/9355.js +13 -1
  148. package/.next/server/chunks/{9992.js → 9968.js} +1 -1
  149. package/.next/server/middleware-build-manifest.js +1 -1
  150. package/.next/server/middleware-manifest.json +5 -5
  151. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  152. package/.next/server/pages/500.html +1 -1
  153. package/.next/server/server-reference-manifest.json +1 -1
  154. package/.next/static/chunks/4560-64b1461fd996127a.js +1 -0
  155. package/.next/static/chunks/{7347-7ee39e14be89e508.js → 6488-d6e53d8da584e644.js} +1 -1
  156. package/.next/static/chunks/{8566-b8bbcfd837cc338b.js → 8566-9da32e46c9d3fd54.js} +1 -1
  157. package/.next/static/chunks/8676.c1ef7e2aac5f05a0.js +1 -0
  158. package/.next/static/chunks/{8965-872d8de254196cec.js → 8965-5ff40db68775eb01.js} +1 -1
  159. package/.next/static/chunks/app/chat/{page-5d20240f98c07cee.js → page-6f714339e12c3a16.js} +1 -1
  160. package/.next/static/chunks/app/layout-86574192bd3c0e6b.js +1 -0
  161. package/.next/static/chunks/app/more/{page-af1d2af13ea901d2.js → page-a496425bba427b48.js} +1 -1
  162. package/.next/static/chunks/app/{page-3bbe737ec910d1fb.js → page-15bfd76bcf65842d.js} +1 -1
  163. package/.next/static/chunks/app/repositories/{page-ace9134ac165a6de.js → page-d214522ab8792ce7.js} +1 -1
  164. package/.next/static/chunks/app/review/{page-331b80f4f58582bc.js → page-1dadf0b5d7129598.js} +1 -1
  165. package/.next/static/chunks/app/sessions/{page-d694149a7e8649b6.js → page-96f007d986c5f327.js} +1 -1
  166. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/{page-9ff4d065483cdfe9.js → page-6a45f3744da50d95.js} +1 -1
  167. package/.next/static/chunks/app/worktrees/[id]/page-3b07e3be354aae57.js +1 -0
  168. package/.next/static/chunks/{webpack-4fbc38b2e3abb013.js → webpack-25d4697671930f37.js} +1 -1
  169. package/.next/trace +10 -10
  170. package/package.json +1 -1
  171. package/.next/server/chunks/1104.js +0 -13
  172. package/.next/static/chunks/4560-2bf9cb6504cc4425.js +0 -1
  173. package/.next/static/chunks/8676.cc638529497c5a1e.js +0 -1
  174. package/.next/static/chunks/app/layout-fe5857360dfba2b9.js +0 -1
  175. package/.next/static/chunks/app/worktrees/[id]/page-1c311aaa0950db1e.js +0 -1
  176. /package/.next/static/{8yp8SRJ9h3Uj75SpHLYpl → WzRCDS2PLtMvg0Sjwlf0S}/_buildManifest.js +0 -0
  177. /package/.next/static/{8yp8SRJ9h3Uj75SpHLYpl → WzRCDS2PLtMvg0Sjwlf0S}/_ssgManifest.js +0 -0
@@ -18,7 +18,7 @@ document.addEventListener('click', function(e) {
18
18
  }, '*');
19
19
  }
20
20
  });
21
- </script>`;function aO({htmlContent:a,filePath:b}){let[c,d]=(0,h.useState)("preview"),[f,g]=(0,h.useState)("safe"),i=(0,h.useRef)(new Set),j=(0,k.c)("worktree"),l=(0,am.SC)(),m=(0,h.useCallback)(async a=>{if("interactive"===a&&!i.current.has(b)){if(!await l({description:j("htmlPreview.interactiveModeConfirm")}))return;i.current.add(b)}g(a)},[b,l,j]),n=(0,h.useMemo)(()=>"interactive"!==f?a:a.includes("</body>")?a.replace("</body>",`${aN}</body>`):a+aN,[a,f]),o=(0,h.useMemo)(()=>{try{return aK.highlight(a,{language:"html",ignoreIllegals:!0}).value}catch{return aK.highlightAuto(a).value}},[a]),p=(0,h.useMemo)(()=>Array.from({length:a.split("\n").length},(a,b)=>b+1),[a]),q=(0,h.useMemo)(()=>o.split("\n"),[o]);return(0,e.jsxs)("div",{className:"flex flex-col h-full","data-testid":"html-preview-mobile",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border bg-muted",children:[(0,e.jsx)("div",{className:"flex gap-1",children:["source","preview"].map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>d(a),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${c===a?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:"source"===a?j("fileViewer.tabSource"):j("fileViewer.tabPreview")},a))}),(0,e.jsx)("div",{className:"flex gap-1",children:["safe","interactive"].map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>m(a),className:`px-2 py-1 text-xs font-medium rounded-md transition-colors ${f===a?"safe"===a?"bg-success-subtle text-success-foreground":"bg-warning-subtle text-warning-foreground":"text-muted-foreground hover:bg-muted"}`,children:"safe"===a?j("fileViewer.sandboxSafe"):j("fileViewer.sandboxInteractive")},a))})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto min-h-0",children:"source"===c?(0,e.jsx)("table",{className:"text-sm w-full border-collapse",children:(0,e.jsx)("tbody",{children:p.map(a=>{let b=a-1;return(0,e.jsxs)("tr",{children:[(0,e.jsx)("td",{className:"pl-3 pr-2 text-right select-none font-mono border-r border-border bg-muted dark:bg-muted/50 sticky left-0 align-top whitespace-nowrap text-muted-foreground",children:a}),(0,e.jsx)("td",{className:"px-4 text-foreground align-top",children:(0,e.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono",children:(0,e.jsx)("code",{className:"hljs",dangerouslySetInnerHTML:{__html:q[b]??""}})})})]},a)})})}):(0,e.jsx)("iframe",{srcDoc:n,sandbox:aq[f],title:j("htmlPreview.title",{path:b}),className:"w-full h-full border-0 bg-white"},`${b}-${f}`)})]})}let aP=(0,h.memo)(function({isOpen:a,onClose:b,worktreeId:c,filePath:d,onEditMarkdown:f}){let[g,i]=(0,h.useState)(null),[j,l]=(0,h.useState)(!1),[m,o]=(0,h.useState)(null),[p,q]=(0,h.useState)(!1),[r,s]=(0,h.useState)(!1),[t,u]=(0,h.useState)(null),[v,w]=(0,h.useState)(0),[x,y]=(0,h.useState)(!1),z=(0,h.useRef)(null),A=(0,k.c)("worktree"),{searchOpen:B,searchQuery:C,searchMatches:D,searchCurrentIdx:E,searchInputRef:F,openSearch:G,closeSearch:H,nextMatch:I,prevMatch:J,setSearchQuery:K}=aJ(g?.content),L=(0,h.useMemo)(()=>!!(g?.content&&!g.isImage&&!g.isVideo&&!g.isPdf),[g]),M=(0,h.useCallback)(async()=>{if(L&&g?.content)try{await (0,ar.l)(g.content),q(!0),setTimeout(()=>q(!1),ah.pX)}catch{}},[L,g]),N=(0,h.useCallback)(async()=>{try{await (0,ar.l)(d),s(!0),setTimeout(()=>s(!1),ah.pX)}catch{}},[d]),O=(0,h.useCallback)(()=>{y(a=>!a)},[]);(0,h.useEffect)(()=>{if(0===D.length||!z.current)return;let a=D[E],b=z.current.querySelector(`[data-line="${a}"]`);b&&"function"==typeof b.scrollIntoView&&b.scrollIntoView({block:"center",behavior:"smooth"})},[E,D]),(0,h.useEffect)(()=>{if(!x)return;let a=a=>{"Escape"===a.key&&y(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[x]),(0,h.useEffect)(()=>{if(!a||!d){i(null),o(null),q(!1),H();return}(async()=>{l(!0),o(null);try{let a=await fetch(`/api/worktrees/${c}/files/${aB(d)}`);if(!a.ok){let b=await a.json(),c="string"==typeof b.error?b.error:b.error?.message||A("fileViewer.loadError");throw Error(c)}let b=await a.json();i(b)}catch(a){o(a instanceof Error?a.message:A("fileViewer.loadError"))}finally{l(!1)}})()},[a,c,d]),(0,h.useEffect)(()=>{u(null),w(0),g&&"md"===g.extension&&aL.test(g.content)&&!(g.content.length>1e6)&&(async()=>{try{let a=await fetch(`/api/worktrees/${c}/marp-render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdownContent:g.content})});if(a.ok){let b=await a.json();u(b.slides)}}catch{}})()},[g,c]);let P=!!(t&&t.length>0),R=g?.extension==="md",S=(0,h.useCallback)(()=>{f&&d&&(b(),f(d))},[f,d,b]),T=(0,h.useMemo)(()=>{if(!g||g.isImage||g.isVideo||g.isHtml||g.isPdf||P&&t)return null;let a=Array.from({length:g.content.split("\n").length},(a,b)=>b+1);try{return{lineNumbers:a,highlightedHtml:aK.highlight(g.content,{language:g.extension,ignoreIllegals:!0}).value}}catch{return{lineNumbers:a,highlightedHtml:aK.highlightAuto(g.content).value}}},[g,P,t]),U=()=>{if(!g)return null;if(g.isImage)return(0,e.jsx)(an.a,{src:g.content,alt:g.path,mimeType:g.mimeType});if(g.isVideo)return(0,e.jsx)(ao.u,{src:g.content,mimeType:g.mimeType});if(g.isPdf)return(0,e.jsx)("div",{className:"h-full min-h-[40vh]",children:(0,e.jsx)(ap.n,{dataUri:g.content,filePath:d,variant:"download"})});if(g.isHtml)return(0,e.jsx)(aO,{htmlContent:g.content,filePath:d});if(P&&t)return(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-2 bg-muted border-b border-border",children:[(0,e.jsx)("button",{type:"button",onClick:()=>w(a=>Math.max(0,a-1)),disabled:0===v,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:A("actions.prev")}),(0,e.jsxs)("span",{className:"text-sm text-muted-foreground",children:[v+1," / ",t.length]}),(0,e.jsx)("button",{type:"button",onClick:()=>w(a=>Math.min(t.length-1,a+1)),disabled:v===t.length-1,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:A("actions.next")})]}),(0,e.jsx)("iframe",{srcDoc:t[v],sandbox:"",title:A("fileViewer.slideTitle",{name:d,number:v+1}),className:"w-full border-0",style:{height:x?"calc(100vh - 100px)":"50vh"}})]});if(!T)return null;let a=new Set(D),b=D.length>0?D[E]:-1,c=T.highlightedHtml.split("\n");return(0,e.jsx)("div",{ref:z,children:(0,e.jsx)("table",{className:"text-sm w-full border-collapse",children:(0,e.jsx)("tbody",{children:T.lineNumbers.map(d=>{let f=d-1,g=d===b,h=a.has(d);return(0,e.jsxs)("tr",{"data-line":d,className:g?"bg-warning/30":h?"bg-warning/15":"",children:[(0,e.jsx)("td",{className:`pl-3 pr-2 text-right select-none font-mono border-r border-border bg-muted dark:bg-muted/50 sticky left-0 align-top whitespace-nowrap ${g||h?"text-warning-foreground":"text-muted-foreground"}`,children:d}),(0,e.jsx)("td",{className:"px-4 text-foreground align-top",children:(0,e.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono",children:(0,e.jsx)("code",{className:"hljs",dangerouslySetInnerHTML:{__html:c[f]??""}})})})]},d)})})})})},V=`/api/worktrees/${c}/files/${aB(d)}?download=1`,W=d?d.split("/").pop()||d:"",X=(a,b=!1)=>(0,e.jsxs)("a",{"data-testid":"download-file-button",href:V,download:W,className:a,"aria-label":A("actions.downloadFile"),title:A("actions.download"),children:[(0,e.jsx)(at,{className:"w-3.5 h-3.5"}),b&&(0,e.jsx)("span",{children:A("actions.download")})]}),Y=()=>(0,e.jsxs)("div",{className:"bg-muted px-3 py-1.5 border-b border-border flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("button",{onClick:N,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.copyFilePath"),title:A("actions.copyPath"),children:r?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:d})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[L&&(0,e.jsx)("button",{onClick:G,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.searchInFile"),title:A("actions.search"),children:(0,e.jsx)(Q.A,{className:"w-3.5 h-3.5"})}),R&&f&&(0,e.jsx)("button",{onClick:S,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.editFile"),title:A("actions.edit"),children:(0,e.jsx)(aw.A,{className:"w-3.5 h-3.5"})}),L&&(0,e.jsx)("button",{"data-testid":"copy-content-button",onClick:M,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.copyFileContent"),title:A("actions.copyContent"),children:p?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(ax,{className:"w-3.5 h-3.5"})}),X("p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground"),(0,e.jsx)("button",{onClick:O,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":x?A("actions.exitFullscreen"):A("actions.fullscreen"),title:x?A("actions.exitFullscreen"):A("actions.fullscreen"),children:x?(0,e.jsx)(ay,{className:"w-3.5 h-3.5"}):(0,e.jsx)(az,{className:"w-3.5 h-3.5"})})]})]});return x&&g&&!j&&!m?(0,e.jsxs)("div",{className:"fixed inset-0 bg-surface flex flex-col",style:{zIndex:aA.M.MAXIMIZED_EDITOR},children:[Y(),B&&(0,e.jsx)(aM,{searchInputRef:F,searchQuery:C,searchMatches:D,searchCurrentIdx:E,onQueryChange:K,onPrev:J,onNext:I,onClose:H}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:U()})]}):(0,e.jsx)(n.Jh,{isOpen:a,onClose:b,title:d,size:"xl",children:(0,e.jsxs)("div",{className:"max-h-[60vh] sm:max-h-[70vh] flex flex-col",children:[j&&(0,e.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,e.jsx)(n.y$,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"ml-3 text-muted-foreground",children:A("fileViewer.loading")})]}),m&&(0,e.jsxs)("div",{className:"bg-danger-subtle border border-danger-border rounded-lg p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-danger-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-sm text-danger-foreground",children:m})]}),(0,e.jsx)("div",{className:"mt-3",children:X("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium bg-surface border border-border text-foreground hover:bg-muted transition-colors",!0)})]}),g&&!j&&!m&&(0,e.jsxs)("div",{className:"bg-muted rounded-lg overflow-hidden flex flex-col min-h-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex-shrink-0",children:[Y(),B&&(0,e.jsx)(aM,{searchInputRef:F,searchQuery:C,searchMatches:D,searchCurrentIdx:E,onQueryChange:K,onPrev:J,onNext:I,onClose:H})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:U()})]})]})})});var aQ=c(52120),aR=c(1102),aS=c(10290),aT=c(59581),aU=c(63474);function aV({worktreeId:a}){let[b,c]=(0,h.useState)([]),[d,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(null),[j,l]=(0,h.useState)(!0),[m,o]=(0,h.useState)(null),[q,r]=(0,h.useState)(""),[t,u]=(0,h.useState)(0),[v,w]=(0,h.useState)("all"),[x,y]=(0,h.useState)(!1),{toasts:z,showToast:A,removeToast:B}=(0,aU.dj)(),C=(0,k.c)("worktree"),D=(0,h.useMemo)(()=>"all"===v?b:b.filter(a=>a.toLowerCase().includes(v)),[b,v]),E=async b=>{try{l(!0),o(null);let c=await T.y.getLogFile(a,b);i(c.content),f(b),r(""),u(0)}catch(a){o((0,T.hS)(a))}finally{l(!1)}},F=(0,h.useCallback)(async()=>{if(d)try{y(!0);let b=await T.y.getLogFile(a,d,{sanitize:!0});await (0,ar.l)(b.content),A(C("logViewer.copied"),"success")}catch(a){A(C("logViewer.exportError",{error:(0,T.hS)(a)}),"error")}finally{y(!1)}},[a,d,A,C]),G=(0,h.useMemo)(()=>{let a;if(!q||!g)return[];let b=RegExp(p(q),"gi"),c=[];for(;null!==(a=b.exec(g));)c.push({index:a.index,length:a[0].length});return c},[q,g]),H=()=>{G.length>0&&u(a=>(a+1)%G.length)},I=()=>{G.length>0&&u(a=>(a-1+G.length)%G.length)},J=(0,h.useMemo)(()=>{if(!g||!q||0===G.length)return g;let a="",b=0;return G.forEach((c,d)=>{a+=s(g.substring(b,c.index));let e=g.substring(c.index,c.index+c.length),f=d===t;a+=`<mark class="${f?"bg-warning text-black":"bg-warning-border text-black"}" data-match-index="${d}">${s(e)}</mark>`,b=c.index+c.length}),a+=s(g.substring(b))},[g,q,G,t]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(n.Zp,{padding:"md",children:[(0,e.jsx)(n.aR,{children:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(n.ZB,{children:C("logViewer.title")}),(0,e.jsx)(n.Ex,{variant:"gray",children:D.length})]}),(0,e.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,e.jsx)(n.$n,{variant:"all"===v?"primary":"ghost",size:"sm",onClick:()=>w("all"),children:C("logViewer.all",{count:b.length})}),(0,e.jsx)(n.$n,{variant:"claude"===v?"primary":"ghost",size:"sm",onClick:()=>w("claude"),children:C("logViewer.toolCount",{tool:"Claude",count:b.filter(a=>a.toLowerCase().includes("claude")).length})}),(0,e.jsx)(n.$n,{variant:"codex"===v?"primary":"ghost",size:"sm",onClick:()=>w("codex"),children:C("logViewer.toolCount",{tool:"Codex",count:b.filter(a=>a.toLowerCase().includes("codex")).length})}),(0,e.jsx)(n.$n,{variant:"gemini"===v?"primary":"ghost",size:"sm",onClick:()=>w("gemini"),children:C("logViewer.toolCount",{tool:"Gemini",count:b.filter(a=>a.toLowerCase().includes("gemini")).length})}),(0,e.jsx)(n.$n,{variant:"antigravity"===v?"primary":"ghost",size:"sm",onClick:()=>w("antigravity"),children:C("logViewer.toolCount",{tool:"Antigravity",count:b.filter(a=>a.toLowerCase().includes("antigravity")).length})})]})]})}),(0,e.jsxs)(n.Wu,{children:[j&&0===b.length&&(0,e.jsx)("div",{className:"text-center py-4",children:(0,e.jsx)(n.y$,{size:"lg",variant:"accent",className:"inline-block"})}),m&&(0,e.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:m}),!j&&0===D.length&&!m&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:"all"===v?C("logViewer.empty"):C("logViewer.emptyFiltered",{tool:v})}),D.length>0&&(0,e.jsx)("div",{className:"space-y-2",children:D.map(a=>(0,e.jsx)("button",{onClick:()=>E(a),className:`w-full text-left px-3 py-2 rounded text-sm font-mono transition-colors ${d===a?"bg-accent-50 text-accent-700 border border-accent-200":"hover:bg-muted border border-transparent"}`,children:a},a))})]})]}),d&&(0,e.jsxs)(n.Zp,{padding:"md",children:[(0,e.jsx)(n.aR,{children:(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(n.ZB,{className:"font-mono text-base",children:d}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:F,disabled:!d||x,title:C("logViewer.copyTitle"),children:x?C("logViewer.exporting"):C("logViewer.export")}),(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:()=>{f(null),i(null),r(""),u(0)},children:C("actions.close")})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"relative flex-1",children:[(0,e.jsx)(n.pd,{type:"text",value:q,onChange:a=>r(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?I():H())},placeholder:C("logViewer.searchPlaceholder"),className:"w-full pr-20"}),G.length>0&&(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground",children:[t+1," / ",G.length]})]}),G.length>0&&(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:I,disabled:0===G.length,title:C("logViewer.prevMatch"),children:"↑"}),(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:H,disabled:0===G.length,title:C("logViewer.nextMatch"),children:"↓"})]})]})]})}),(0,e.jsxs)(n.Wu,{children:[j&&(0,e.jsx)("div",{className:"text-center py-8",children:(0,e.jsx)(n.y$,{size:"xl",variant:"accent",className:"inline-block"})}),!j&&g&&(0,e.jsx)("div",{className:"bg-[#111827] text-[#f3f4f6] rounded p-4 overflow-x-auto max-h-[500px] scrollbar-thin",children:q&&G.length>0?(0,e.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:J||""}}):(0,e.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",children:g})}),!j&&q&&0===G.length&&g&&(0,e.jsx)("div",{className:"text-center py-4 text-sm text-muted-foreground",children:C("logViewer.noMatches",{query:q})})]})]}),(0,e.jsx)(aU.N9,{toasts:z,onClose:B})]})}function aW(){let[a,b]=(0,h.useState)(null),[c,d]=(0,h.useState)(!0),[e,f]=(0,h.useState)(null);return{data:a,loading:c,error:e}}var aX=c(94260);function aY({hasUpdate:a,latestVersion:b,releaseUrl:c,updateCommand:d,installType:f}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)("idle"),[l,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(null);(0,h.useRef)(!1);let q="global"===f,r="npx"===f,s=q||r,t=r?"npx commandmate@latest":"commandmate update",u=(0,h.useCallback)(async()=>{j("starting");try{let a=await T.GQ.startUpdate();n(a.logPath),j(a.willRestart?"updating":"no-restart")}catch(a){a instanceof T.hD&&400===a.status?p(g("update.errorNotGlobal")):a instanceof T.hD&&409===a.status?p(g("update.errorInProgress")):p(g("update.errorGeneric")),j("error")}},[g]);return a?(0,e.jsxs)("div",{className:"bg-accent-50 border border-accent-200 rounded-lg p-3 mt-2",role:"status","aria-label":g("update.available"),"data-testid":"update-notification-banner",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800 mb-1",children:g("update.available")}),b&&(0,e.jsx)("p",{className:"text-sm text-accent-700 mb-2",children:g("update.latestVersion",{version:b})}),s&&"idle"===i&&(0,e.jsx)(aX.$,{variant:"primary",size:"sm",className:"mb-2",onClick:()=>j("confirming"),"data-testid":"update-now-button",children:g("update.updateNow")}),r&&"idle"===i&&(0,e.jsx)("p",{className:"text-xs text-accent-600 mb-2","data-testid":"update-npx-notice",children:g("update.npxRestartNotice")}),("starting"===i||"updating"===i)&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-progress",children:[(0,e.jsxs)("p",{className:"flex items-center text-sm text-accent-800",children:[(0,e.jsx)(m.y,{size:"sm",className:"mr-2"}),"starting"===i?g("update.starting"):g("update.updating")]}),"updating"===i&&(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.updatingHint")})]}),"no-restart"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-no-restart",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.noRestartTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.noRestartDescription")})]}),"timeout"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-timeout",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.timeoutTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.timeoutDescription")}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 mt-1 text-xs text-accent-900 font-mono",children:t})]}),"error"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-error",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.errorTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:o}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 mt-1 text-xs text-accent-900 font-mono",children:t})]}),l&&("no-restart"===i||"timeout"===i)&&(0,e.jsx)("p",{className:"text-xs text-accent-500 mb-2","data-testid":"update-log-hint",children:g("update.logHint",{path:l})}),d&&q&&"idle"===i&&(0,e.jsxs)("div",{className:"mb-2",children:[(0,e.jsx)("p",{className:"text-xs text-accent-600 mb-1",children:g("update.updateCommand")}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 text-xs text-accent-900 font-mono",children:d})]}),c&&(0,e.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-accent-600 hover:text-accent-800 underline",children:[g("update.viewRelease"),(0,e.jsx)("span",{className:"ml-1","aria-hidden":"true",children:"→"})]}),(0,e.jsx)("p",{className:"text-xs text-accent-500 mt-2",children:g("update.dataPreserved")}),(0,e.jsx)(am.TM,{isOpen:"confirming"===i,title:g("update.confirmTitle"),description:g("update.confirmDescription",{version:b??""}),confirmLabel:g("update.confirmButton"),onConfirm:u,onCancel:()=>j("idle")})]}):null}function aZ({version:a,className:b}){let c=(0,k.c)("worktree"),{data:d,loading:f}=aW(),g=(0,h.useMemo)(()=>d&&d.hasUpdate?{hasUpdate:d.hasUpdate,latestVersion:d.latestVersion,releaseUrl:d.releaseUrl,updateCommand:d.updateCommand,installType:d.installType}:null,[d]);return(0,e.jsxs)("div",{className:b,"data-testid":"version-section",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:c("update.version")}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:a}),f&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1","data-testid":"version-loading",children:"..."}),g&&(0,e.jsx)(aY,{...g})]})}let a$="https://github.com/Kewton/CommandMate",a_=`${a$}/issues`,a0=`${a$}/issues/new`,a1=`${a0}?template=bug_report.md`,a2=`${a0}?template=feature_request.md`,a3=`${a0}?template=question.md`;function a4({className:a}){let b=(0,k.c)("worktree"),c=[{href:a1,label:b("feedback.bugReport")},{href:a2,label:b("feedback.featureRequest")},{href:a3,label:b("feedback.question")},{href:a_,label:b("feedback.viewIssues")}];return(0,e.jsxs)("div",{className:a,"data-testid":"feedback-section",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-2",children:b("feedback.title")}),(0,e.jsx)("div",{className:"flex flex-col gap-1",children:c.map(({href:a,label:b})=>(0,e.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-accent-600 hover:text-accent-800 underline",children:[b,(0,e.jsx)("span",{className:"ml-1","aria-hidden":"true",children:"→"})]},a))})]})}var a5=c(98033),a6=c(67016),a7=c(17252),a8=c(85351);let a9="application/x-commandmate-agent-instance",ba=(0,h.memo)(function({splitIndex:a,cliToolId:b,instanceId:c,instance:d,availableInstances:f,onInstanceChange:g,status:i="idle",onFocus:j,attaching:l=!1,headerExtras:m,terminal:n,footer:p,style:q,onDropInstance:r,draggedInstanceId:s}){let t=(0,k.c)("worktree"),[u,v]=(0,h.useState)(null),w=null!=r,x=(0,h.useCallback)(()=>null==s||f.some(a=>a.id===s)?"allowed":"forbidden",[s,f]),y=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault();let b=x();a.dataTransfer.dropEffect="forbidden"===b?"none":"move",v(a=>a===b?a:b)},[w,x]),z=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault();let b=x();v(a=>a===b?a:b)},[w,x]),A=(0,h.useCallback)(()=>{w&&v(null)},[w]),B=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault(),v(null);let b=a.dataTransfer.getData(a9);b&&r?.(b)},[w,r]),C=(0,h.useCallback)(()=>{window.dispatchEvent(new CustomEvent("terminal-search-open"))},[]),D=(0,h.useCallback)(()=>{j()},[j]),E=`Terminal split ${a+1}`,F=(0,a7.sw)(d??{cliTool:b}),G=t("terminal.selectInstance",{split:E});return(0,e.jsxs)("div",{role:"region","aria-label":E,"data-testid":`terminal-split-pane-${a}`,"data-split-index":a,style:q,className:`flex flex-col min-w-0 h-full rounded-lg overflow-hidden border border-border bg-surface${null===u?" focus-within:ring-1 focus-within:ring-accent-500/30":""}${"allowed"===u?" ring-2 ring-accent-400":"forbidden"===u?" ring-2 ring-red-300 cursor-not-allowed":""}`,onFocusCapture:D,onMouseDown:j,onDragOver:y,onDragEnter:z,onDragLeave:A,onDrop:B,children:[(0,e.jsxs)("div",{className:"px-2 py-1 flex items-center gap-2 bg-surface-2 border-b border-border flex-shrink-0",children:[(0,e.jsxs)(aS.rI,{children:[(0,e.jsxs)(aS.ty,{"data-testid":`cli-selector-${a}`,"aria-label":G,className:"flex items-center gap-1.5 min-w-0 max-w-[12rem] rounded px-1.5 py-0.5 text-xs border border-border bg-surface text-surface-foreground hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:ring-2 data-[state=open]:ring-ring transition-colors",children:[(0,e.jsx)(o.m,{status:i,size:"sm","aria-hidden":!0,"data-testid":`split-status-indicator-${a}`}),(0,e.jsx)("span",{className:"truncate",children:F}),(0,e.jsx)(a8.A,{size:14,"aria-hidden":"true",className:"flex-shrink-0 opacity-70"})]}),(0,e.jsx)(aS.SQ,{align:"start",className:"min-w-[10rem]",children:(0,e.jsx)(aS.Hr,{value:c,onValueChange:g,children:f.map(a=>(0,e.jsx)(aS.Ht,{value:a.id,children:(0,a7.sw)(a)},a.id))})})]}),m,(0,e.jsx)("button",{type:"button",onClick:C,"aria-label":`Search terminal output for ${E}`,"data-testid":`terminal-search-button-${a}`,className:"ml-auto flex items-center gap-1 px-1.5 py-0.5 text-xs text-muted-foreground hover:text-surface-foreground hover:bg-muted-foreground/10 rounded transition-colors",children:(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[l?(0,e.jsxs)("div",{"data-testid":`terminal-attach-skeleton-${a}`,className:"absolute inset-0 flex items-center justify-center text-xs text-muted-foreground bg-surface-2/80",role:"status","aria-live":"polite",children:["Attaching ",F," session..."]}):null,n]}),(0,e.jsx)("div",{className:"flex-shrink-0 border-t border-border p-2 bg-surface-2",children:p})]})});var bb=c(8509),bc=c(70584),bd=c(24417),be=c(3350),bf=c.n(be),bg=c(19331);let bh=new(c.n(bg)())({fg:"#d1d5db",bg:"#1f2937",newline:!0,escapeXML:!0});function bi(a){let b=a.replace(/\0/g,"");b.length>1048576&&(b=b.slice(0,1048576));let c=bh.toHtml(b);return bf().sanitize(c,{ALLOWED_TAGS:["span","br"],ALLOWED_ATTR:["style"],ALLOW_DATA_ATTR:!1})}let bj=/\x1b(?:\[[0-9;?]*)?$/,bk=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;function bl(a){return""===a.replace(bk,"").trim()}function bm({query:a,onQueryChange:b,matchCount:c,currentIndex:d,onNext:f,onPrev:g,onClose:i,isAtMaxMatches:j=!1}){let k=(0,h.useRef)(null),l=(0,h.useCallback)(a=>{"Escape"===a.key&&i()},[i]),m=(0,h.useCallback)(a=>{b(a.target.value)},[b]),n=0===c?"0/0":j?`${d+1}/500以上`:`${d+1}/${c}`;return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-gray-800 border border-gray-600 rounded shadow-lg",role:"search","aria-label":"ターミナル内テキスト検索",children:[(0,e.jsx)("input",{ref:k,type:"text",value:a,onChange:m,onKeyDown:l,placeholder:"検索...",className:"bg-transparent text-gray-200 text-sm outline-none w-32 sm:w-40 placeholder-gray-500","aria-label":"検索キーワード",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-gray-400 text-xs min-w-[3rem] text-right",children:n}),(0,e.jsx)("button",{onClick:g,disabled:0===c,"aria-label":"前の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,e.jsx)("button",{onClick:f,disabled:0===c,"aria-label":"次の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,e.jsx)("button",{onClick:i,"aria-label":"検索を閉じる",className:"text-gray-400 hover:text-white min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}function bn(){return(0,e.jsxs)("div",{"data-testid":"thinking-indicator",className:"flex items-center gap-2 py-2 px-1 text-gray-400",children:[(0,e.jsxs)("span",{className:"flex gap-1",children:[(0,e.jsx)("span",{className:"animate-pulse delay-0",children:"."}),(0,e.jsx)("span",{className:"animate-pulse delay-150",children:"."}),(0,e.jsx)("span",{className:"animate-pulse delay-300",children:"."})]}),(0,e.jsx)("span",{className:"text-sm",children:"Thinking"})]})}let bo=(0,h.memo)(function({output:a,isActive:b,attaching:c=!1,isThinking:d=!1,autoScroll:f=!0,onScrollChange:g,disableAutoFollow:i=!1,compactTuiLayoutPadding:j=!1,className:k=""}){let{scrollRef:l,autoScroll:m,handleScroll:n,scrollToBottom:o,scrollToTop:p}=function(a={}){let{initialAutoScroll:b=!0,onAutoScrollChange:c}=a,d=(0,h.useRef)(null),[e,f]=(0,h.useState)(b),g=(0,h.useRef)(!1),i=(0,h.useRef)(null),j=(0,h.useCallback)(a=>{f(a),c?.(a)},[c]),k=(0,h.useCallback)(()=>{let a=d.current;if(!a)return!0;let{scrollTop:b,scrollHeight:c,clientHeight:e}=a;return c-e-b<=50},[]),l=(0,h.useCallback)(()=>{if(g.current)return;let a=k();a&&!e?j(!0):!a&&e&&j(!1)},[e,k,j]),m=(0,h.useCallback)(()=>{let a=d.current;a&&(g.current=!0,a.scrollTo({top:a.scrollHeight,behavior:"smooth"}),e||j(!0),i.current=setTimeout(()=>{g.current=!1,i.current=null},500))},[e,j]),n=(0,h.useCallback)(()=>{let a=d.current;a&&(g.current=!0,a.scrollTo({top:0,behavior:"smooth"}),e&&j(!1),i.current=setTimeout(()=>{g.current=!1,i.current=null},500))},[e,j]);return{scrollRef:d,autoScroll:e,setAutoScroll:j,scrollToBottom:m,scrollToTop:n,handleScroll:l}}({initialAutoScroll:f,onAutoScrollChange:g}),q=a??"",r=(0,h.useMemo)(()=>j?function(a){if(""===a)return"";let b=a.split("\n"),c=[],d=!1,e=0;for(;e<b.length;){if(!bl(b[e])){c.push(b[e]),d=!0,e++;continue}let a=e;for(;a<b.length&&bl(b[a]);)a++;let f=a-e,g=!d,h=a>=b.length;if(!g&&!h)if(f<=2)for(let d=e;d<a;d++)c.push(b[d]);else c.push(function(a){let b=a.match(bk);return b?b.join(""):""}(b.slice(e,a).join("")));e=a}return c.join("\n")}(q):q,[j,q]),{isOpen:s,query:t,matchCount:u,currentIndex:v,isAtMaxMatches:w,openSearch:x,closeSearch:y,setQuery:z,nextMatch:A,prevMatch:B}=function({output:a,containerRef:b}){let[c,d]=(0,h.useState)(!1),[e,f]=(0,h.useState)(""),[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(0),[l,m]=(0,h.useState)(!1),n=(0,h.useRef)(null),o=(0,h.useRef)(""),p=g.length,q=(0,h.useCallback)(a=>{if(a.length<2||!b.current)return{positions:[],capped:!1};let c=(b.current.textContent??"").toLowerCase(),d=a.toLowerCase(),e=[],f=0;for(;e.length<500;){let b=c.indexOf(d,f);if(-1===b)break;e.push({start:b,end:b+a.length}),f=b+1}let g=e.length>=500&&-1!==c.indexOf(d,f);return{positions:e,capped:g}},[b]),r=(0,h.useCallback)(a=>{let{positions:c,capped:d}=q(a);if(i(c),k(0),m(d),b.current)if(c.length>0){var e;e=b.current,aH(e,c,0,aC)}else aG(aC)},[q,b]),s=(0,h.useCallback)(a=>{f(a),n.current&&clearTimeout(n.current),o.current=a,n.current=setTimeout(()=>{r(a)},300)},[r]),t=(0,h.useCallback)(()=>{d(!0)},[]),u=(0,h.useCallback)(()=>{d(!1),f(""),o.current="",i([]),k(0),m(!1),n.current&&clearTimeout(n.current),aG(aC)},[]),v=(0,h.useCallback)(()=>{0!==p&&k(a=>{let c=(a+1)%p;return b.current&&g.length>0&&aH(b.current,g,c,aC),c})},[p,g,b]),w=(0,h.useCallback)(()=>{0!==p&&k(a=>{let c=(a-1+p)%p;return b.current&&g.length>0&&aH(b.current,g,c,aC),c})},[p,g,b]);return{isOpen:c,query:e,matchCount:p,currentIndex:j,isAtMaxMatches:l,openSearch:t,closeSearch:u,setQuery:s,nextMatch:v,prevMatch:w}}({output:r,containerRef:l}),C=(0,h.useCallback)(a=>{(a.ctrlKey||a.metaKey)&&"f"===a.key&&(a.preventDefault(),x())},[x]);(0,h.useEffect)(()=>{let a=()=>x();return window.addEventListener("terminal-search-open",a),()=>window.removeEventListener("terminal-search-open",a)},[x]);let[D,E]=(0,h.useState)(()=>r?[{key:0,html:bi(r)}]:[]),F=(0,h.useRef)(r),G=(0,h.useRef)(0);(0,h.useEffect)(()=>{let a=function(a,b){if(a===b)return{mode:"noop",text:b,appended:"",retainedLength:a.length};if(0===a.length||b.length<=a.length||!b.startsWith(a))return{mode:"replace",text:b,appended:"",retainedLength:0};let c=a.match(bj),d=c?a.length-c[0].length:a.length;return{mode:"append",text:b,appended:b.slice(d),retainedLength:d}}(F.current,r);if(F.current=r,"noop"!==a.mode){if("append"===a.mode)return void E(b=>(G.current+=1,b.length>=400)?[{key:G.current,html:bi(r)}]:[...b,{key:G.current,html:bi(a.appended)}]);G.current+=1,E(r?[{key:G.current,html:bi(r)}]:[])}},[r]);let[H,I]=(0,h.useState)(!1);(0,h.useEffect)(()=>{c?I(!1):b&&I(!0)},[c,b]);let J=!a,K=J&&c,L=J&&!c&&!b&&H,M=(0,h.useRef)(!1);(0,h.useEffect)(()=>{i&&(M.current=!0)},[i]),(0,h.useEffect)(()=>{if(l.current){if(M.current&&i&&r){l.current.scrollTo({top:0,behavior:"instant"}),M.current=!1;return}!i&&m&&l.current.scrollTo({top:l.current.scrollHeight,behavior:"instant"})}},[D,r,m,i,l]);let N=(0,h.useMemo)(()=>["terminal","font-mono","text-sm","p-4","rounded-lg","overflow-y-auto","overflow-x-hidden","bg-gray-900","text-gray-300","border","border-gray-700","h-full",b?"active":"",k].filter(Boolean).join(" "),[b,k]),[O,P]=(0,h.useState)(!1),Q=(0,h.useRef)(null),R=(0,h.useCallback)(()=>{P(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>P(!1),1500)},[]);(0,h.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current)},[]);let S=(0,h.useCallback)(()=>{n(),R()},[n,R]),T=["absolute bottom-4 right-4 flex items-center justify-center h-9 w-9 rounded-full bg-surface/80 backdrop-blur border border-border text-muted-foreground shadow-lg transition-opacity hover:text-surface-foreground hover:opacity-100 focus-visible:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",O?"opacity-100":"opacity-60"].join(" ");return(0,e.jsxs)("div",{className:"relative h-full flex flex-col",children:[s&&(0,e.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,e.jsx)(bm,{query:t,onQueryChange:z,matchCount:u,currentIndex:v,onNext:A,onPrev:B,onClose:y,isAtMaxMatches:w})}),(0,e.jsxs)("div",{ref:l,role:"log","aria-live":"polite","aria-label":"Terminal output",className:N,onScroll:S,onKeyDown:C,tabIndex:0,children:[(0,e.jsx)("div",{className:"whitespace-pre-wrap break-words",children:D.map(a=>(0,e.jsx)("span",{dangerouslySetInnerHTML:{__html:a.html}},a.key))}),K&&(0,e.jsx)("div",{"data-testid":"terminal-loading-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:"読込中..."}),L&&(0,e.jsx)("div",{"data-testid":"terminal-ended-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:"セッションは終了しました(メッセージ送信で再開できます)"}),b&&d&&(0,e.jsx)(bn,{})]}),m?(0,e.jsx)("button",{type:"button",onClick:p,className:T,"aria-label":"Scroll to top",children:(0,e.jsx)(bc.A,{size:16,"aria-hidden":"true"})}):(0,e.jsx)("button",{type:"button",onClick:o,className:T,"aria-label":"Scroll to bottom",children:(0,e.jsx)(bd.A,{size:16,"aria-hidden":"true"})})]})});var bp=c(67619);function bq({worktreeId:a,cliToolId:b,instanceId:c,enabled:d=!0}){let e=c??b,[f,g]=(0,h.useState)(()=>({output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,isSelectionListActive:!1,isPagerActive:!1,isUnclassifiedActive:!1,attaching:!0,autoScroll:!0})),[i,j]=(0,h.useState)(()=>({visible:!1,data:null,messageId:null,answering:!1})),k=(0,h.useRef)(0),l=(0,h.useRef)(b);l.current=b;let m=(0,h.useRef)(e);m.current=e;let n=(0,h.useRef)(i.visible);n.current=i.visible;let{connected:o,subscribe:p,unsubscribe:q,addListener:r}=(0,bp.xM)();(0,h.useRef)(0);let s=(0,h.useRef)(0),t=(0,h.useRef)(null),u=(0,h.useRef)(null),[v,w]=(0,h.useState)(!1);(0,h.useCallback)(()=>{w(!0),null!==u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,w(!1)},5e3)},[]);let x=(0,h.useCallback)(a=>{let b=a.fullOutput??a.realtimeSnippet??"";!0===a.isUnclassifiedActive&&!0!==a.isPromptWaiting&&!0!==a.isSelectionListActive&&!0!==a.isPagerActive?(s.current+=1,t.current??=Date.now()):(s.current=0,t.current=null);let c=s.current>=2&&null!==t.current&&Date.now()-t.current>=500;g(d=>{let e=!1===a.isRunning,f=!!b||!!a.isRunning||e;return{...d,output:f?b:d.output,realtimeSnippet:a.realtimeSnippet??"",isRunning:a.isRunning??!1,isThinking:a.thinking??!1,isSelectionListActive:a.isSelectionListActive??!1,isPagerActive:a.isPagerActive??!1,isUnclassifiedActive:c,attaching:!1}}),a.isPromptWaiting&&a.promptData?j(b=>({...b,visible:!0,data:a.promptData??b.data,messageId:b.messageId??`prompt-${Date.now()}`})):!a.isPromptWaiting&&n.current&&j({visible:!1,data:null,messageId:null,answering:!1})},[]),y=(0,h.useCallback)(async()=>{let c=++k.current;try{let d=await fetch(`/api/worktrees/${a}/current-output?cliTool=${b}&instance=${encodeURIComponent(e)}`);if(!d.ok)return;let f=await d.json();if(k.current!==c||l.current!==b||m.current!==e||f.cliToolId&&f.cliToolId!==b)return;x(f)}catch(a){if(k.current!==c||l.current!==b||m.current!==e)return;console.error("[useTerminalPanePolling] fetch error:",a)}},[a,b,e,x]),z=`${a}::${b}::${e}`;(0,h.useRef)(z);let A=(0,h.useCallback)(a=>{g(b=>b.autoScroll===a?b:{...b,autoScroll:a})},[]),B=(0,h.useCallback)(a=>{j(b=>({...b,answering:a}))},[]);return{terminal:f,prompt:i,setAutoScroll:A,setPromptAnswering:B,clearPrompt:(0,h.useCallback)(()=>{j({visible:!1,data:null,messageId:null,answering:!1})},[]),refresh:(0,h.useCallback)(()=>y(),[y])}}var br=c(23312);function bs(a,b,c){let d,e=c.initialDeps??[],f=!0;function g(){let g=a();return g.length!==e.length||g.some((a,b)=>e[b]!==a)?(e=g,d=b(...g),(null==c?void 0:c.onChange)&&!(f&&c.skipInitialOnChange)&&c.onChange(d),f=!1,d):d}return g.updateDeps=a=>{e=a},g}function bt(a,b){if(void 0!==a)return a;throw Error(`Unexpected undefined${b?`: ${b}`:""}`)}let bu=(a,b)=>1.01>Math.abs(a-b),bv=()=>{if(void 0!==d)return d;if("undefined"==typeof navigator)return d=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return d=!0;let a=navigator.maxTouchPoints;return d="MacIntel"===navigator.platform&&void 0!==a&&a>0},bw=a=>{let{offsetWidth:b,offsetHeight:c}=a;return{width:b,height:c}},bx=a=>a,by=a=>{let b=Math.max(a.startIndex-a.overscan,0),c=Math.min(a.endIndex+a.overscan,a.count-1)-b+1,d=Array(c);for(let a=0;a<c;a++)d[a]=b+a;return d},bz=(a,b)=>{let c=a.scrollElement;if(!c)return;let d=a.targetWindow;if(!d)return;let e=a=>{let{width:c,height:d}=a;b({width:Math.round(c),height:Math.round(d)})};if(e(bw(c)),!d.ResizeObserver)return()=>{};let f=new d.ResizeObserver(b=>{let d=()=>{let a=b[0];if(null==a?void 0:a.borderBoxSize){let b=a.borderBoxSize[0];if(b)return void e({width:b.inlineSize,height:b.blockSize})}e(bw(c))};a.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return f.observe(c,{box:"border-box"}),()=>{f.unobserve(c)}},bA={passive:!0},bB="undefined"==typeof window||"onscrollend"in window,bC=(a,b)=>((a,b,c)=>{let d=a.scrollElement;if(!d)return;let e=a.targetWindow;if(!e)return;let f=a.options.useScrollendEvent&&bB,g=0,h=f?null:((a,b,c)=>{let d;return function(...e){a.clearTimeout(d),d=a.setTimeout(()=>b.apply(this,e),c)}})(e,()=>b(g,!1),a.options.isScrollingResetDelay),i=a=>()=>{g=c(d),null==h||h(),b(g,a)},j=i(!0),k=i(!1);return d.addEventListener("scroll",j,bA),f&&d.addEventListener("scrollend",k,bA),()=>{d.removeEventListener("scroll",j),f&&d.removeEventListener("scrollend",k)}})(a,b,b=>{let{horizontal:c,isRtl:d}=a.options;return c?b.scrollLeft*(d&&-1||1):b.scrollTop}),bD=(a,b,c)=>{if(null==b?void 0:b.borderBoxSize){let a=b.borderBoxSize[0];if(a)return Math.round(a[c.options.horizontal?"inlineSize":"blockSize"])}return a[c.options.horizontal?"offsetWidth":"offsetHeight"]},bE=(a,{adjustments:b=0,behavior:c},d)=>{var e,f;null==(f=null==(e=d.scrollElement)?void 0:e.scrollTo)||f.call(e,{[d.options.horizontal?"left":"top"]:a+b,behavior:c})};class bF{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var a,b,c;return(null==(c=null==(b=null==(a=this.targetWindow)?void 0:a.performance)?void 0:b.now)?void 0:c.call(b))??Date.now()},this.observer=(()=>{let a=null,b=()=>a||(this.targetWindow&&this.targetWindow.ResizeObserver?a=new this.targetWindow.ResizeObserver(a=>{a.forEach(a=>{let b=()=>{let b=a.target,c=this.indexFromElement(b);if(!b.isConnected){for(let[a,c]of(this.observer.unobserve(b),this.elementsCache))if(c===b){this.elementsCache.delete(a);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(b,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(b):b()})}):null);return{disconnect:()=>{var c;null==(c=b())||c.disconnect(),a=null},observe:a=>{var c;return null==(c=b())?void 0:c.observe(a,{box:"border-box"})},unobserve:a=>{var c;return null==(c=b())?void 0:c.unobserve(a)}}})(),this.range=null,this.setOptions=a=>{var b,c;let d={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:bx,rangeExtractor:by,onChange:()=>{},measureElement:bD,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(let b in a){let c=a[b];void 0!==c&&(d[b]=c)}let e=this.options,f=null,g=null;if(void 0!==e&&e.enabled&&d.enabled&&"end"===d.anchorTo&&null!==this.scrollElement){let a=e.count,h=d.count,i=this.getMeasurements(),j=a>0?(null==(b=i[0])?void 0:b.key)??e.getItemKey(0):null,k=a>0?(null==(c=i[a-1])?void 0:c.key)??e.getItemKey(a-1):null;if(h!==a||a>0&&h>0&&(d.getItemKey(0)!==j||d.getItemKey(h-1)!==k)){let b=a>0?this.getVirtualItemForOffset(this.getScrollOffset())??i[0]:null;b&&(f=[b.key,this.getScrollOffset()-b.start]);let c=!0===d.followOnAppend?"auto":d.followOnAppend||null;c&&h>a&&this.isAtEnd(e.scrollEndThreshold)&&(0===a||d.getItemKey(h-1)!==k)&&(g=c)}}this.options=d,(f||g)&&(this.pendingScrollAnchor=[(null==f?void 0:f[0])??null,(null==f?void 0:f[1])??0,g])},this.notify=a=>{var b,c;null==(c=(b=this.options).onChange)||c.call(b,this,a)},this.maybeNotify=bs(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),a=>{this.notify(a)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(a=>a()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var a;let b=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==b){if(this.cleanup(),!b)return void this.maybeNotify();if(this.scrollElement=b,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(a=this.scrollElement)?void 0:a.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,b)=>{null!==this._intendedScrollOffset&&1.5>Math.abs(a-this._intendedScrollOffset)&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=b?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=b,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let a=this.scrollElement,b=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},c=()=>{this._iosTouching=!1,bv()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",b,bA),a.addEventListener("touchend",c,bA),this.unsubs.push(()=>{a.removeEventListener("touchstart",b),a.removeEventListener("touchend",c),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let c=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,c&&this.scrollElement&&this.options.enabled){let[a,b,d]=c;if(null!==a){let{count:c,getItemKey:d}=this.options,e=0;for(;e<c&&d(e)!==a;)e++;let f=e<c?this.getMeasurements()[e]:void 0;if(f){let a=f.start+b-this.getScrollOffset();bu(a,0)||this.applyScrollAdjustment(a)}}d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let a=this.getScrollOffset(),b=this.getMaxScrollOffset();if(a<0||a>b)return;let c=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(a,{adjustments:this.scrollAdjustments+=c,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(a,b)=>{let c=new Map,d=new Map;for(let e=b-1;e>=0;e--){let b=a[e];if(c.has(b.lane))continue;let f=d.get(b.lane);if(null==f||b.end>f.end?d.set(b.lane,b):b.end<f.end&&c.set(b.lane,!0),c.size===this.options.lanes)break}return d.size===this.options.lanes?Array.from(d.values()).sort((a,b)=>a.end===b.end?a.index-b.index:a.end-b.end)[0]:void 0},this.getMeasurementOptions=bs(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(a,b,c,d,e,f,g)=>(void 0!==this.prevLanes&&this.prevLanes!==f&&(this.lanesChangedFlag=!0),this.prevLanes=f,this.pendingMin=null,{count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f,laneAssignmentMode:g}),{key:!1}),this.getMeasurements=bs(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f,laneAssignmentMode:g},h)=>{let i=this.itemSizeCache;if(!e)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>a)for(let b of this.laneAssignments.keys())b>=a&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));let j=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===a&&(this.lanesSettling=!1),1===f){let e,f=this.options.gap,g=2*a,h=this._flatMeasurements;if(!h||h.length<g){let a=new Float64Array(g);h&&j>0&&a.set(h.subarray(0,2*j)),h=a,this._flatMeasurements=h}if(0===j)e=b+c;else{let a=j-1;e=h[2*a]+h[2*a+1]+f}for(let b=j;b<a;b++){let a=d(b),c=i.get(a),g="number"==typeof c?c:this.options.estimateSize(b);h[2*b]=e,h[2*b+1]=g,e+=g+f}let k=function(a,b,c){return new Proxy(Array(a),{get(d,e,f){if("string"==typeof e){let f=e.charCodeAt(0);if(f>=48&&f<=57){let f=+e;if(Number.isInteger(f)&&f>=0&&f<a){let a=d[f];if(!a){let e=b[2*f];a=d[f]={index:f,key:c(f),start:e,size:b[2*f+1],end:e+b[2*f+1],lane:0}}return a}}if("length"===e)return a}return Reflect.get(d,e,f)}})}(a,h,d);return this.measurementsCache=k,k}let k=this.measurementsCache.slice(0,j),l=Array(f).fill(void 0);for(let a=0;a<j;a++){let b=k[a];b&&(l[b.lane]=a)}for(let e=j;e<a;e++){let a,f,h=d(e),j=this.laneAssignments.get(e),m="estimate"===g||i.has(h);if(void 0!==j&&this.options.lanes>1){let d=l[a=j],e=void 0!==d?k[d]:void 0;f=e?e.end+this.options.gap:b+c}else{let d=1===this.options.lanes?k[e-1]:this.getFurthestMeasurement(k,e);f=d?d.end+this.options.gap:b+c,a=d?d.lane:e%this.options.lanes,this.options.lanes>1&&m&&this.laneAssignments.set(e,a)}let n=i.get(h),o="number"==typeof n?n:this.options.estimateSize(e),p=f+o;k[e]={index:e,start:f,size:o,end:p,key:h,lane:a},l[a]=e}return this.measurementsCache=k,k},{key:!1,debug:()=>this.options.debug}),this.calculateRange=bs(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(a,b,c,d)=>this.range=a.length>0&&b>0?function({measurements:a,outerSize:b,scrollOffset:c,lanes:d,flat:e}){let f=a.length-1,g=e?a=>e[2*a]:b=>a[b].start,h=e?a=>e[2*a]+e[2*a+1]:b=>a[b].end;if(a.length<=d)return{startIndex:0,endIndex:f};let i=bG(0,f,g,c),j=i;if(1===d)for(;j<f&&h(j)<c+b;)j++;else if(d>1){let e=Array(d).fill(0);for(;j<f&&e.some(a=>a<c+b);){let b=a[j];e[b.lane]=b.end,j++}let g=Array(d).fill(c+b);for(;i>=0&&g.some(a=>a>=c);){let b=a[i];g[b.lane]=b.start,i--}i=Math.max(0,i-i%d),j=Math.min(f,j+(d-1-j%d))}return{startIndex:i,endIndex:j}}({measurements:a,outerSize:b,scrollOffset:c,lanes:d,flat:1===d&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=bs(()=>{let a=null,b=null,c=this.calculateRange();return c&&(a=c.startIndex,b=c.endIndex),this.maybeNotify.updateDeps([this.isScrolling,a,b]),[this.options.rangeExtractor,this.options.overscan,this.options.count,a,b]},(a,b,c,d,e)=>null===d||null===e?[]:a({startIndex:d,endIndex:e,overscan:b,count:c}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=a=>{let b=this.options.indexAttribute,c=a.getAttribute(b);return c?parseInt(c,10):(console.warn(`Missing attribute name '${b}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=a=>{var b;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let c=this.scrollState.index??(null==(b=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:b.index);if(void 0!==c&&this.range){let b=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),d=Math.max(0,c-b),e=Math.min(this.options.count-1,c+b);return a>=d&&a<=e}return!0},this.measureElement=a=>{if(!a)return void this.elementsCache.forEach((a,b)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(b))});let b=this.indexFromElement(a),c=this.options.getItemKey(b),d=this.elementsCache.get(c);d!==a&&(d&&this.observer.unobserve(d),this.observer.observe(a),this.elementsCache.set(c,a)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(b)&&this.resizeItem(b,this.options.measureElement(a,void 0,this))},this.resizeItem=(a,b)=>{var c,d;let e,f,g;if(a<0||a>=this.options.count)return;let h=this._flatMeasurements;if(1===this.options.lanes&&null!==h)g=this.options.getItemKey(a),f=h[2*a],e=h[2*a+1];else{let b=this.measurementsCache[a];if(!b)return;g=b.key,f=b.start,e=b.size}let i=b-(this.itemSizeCache.get(g)??e);if(0!==i){let h="end"===this.options.anchorTo&&(null==(c=this.scrollState)?void 0:c.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,j=h?this.getTotalSize():0,k=(null==(d=this.scrollState)?void 0:d.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[a]??{index:a,key:g,start:f,size:e,end:f+e,lane:0},i,this):f<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection);(null===this.pendingMin||a<this.pendingMin)&&(this.pendingMin=a),this.itemSizeCache.set(g,b),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-j):k&&this.applyScrollAdjustment(i),this.notify(!1)}},this.getVirtualItems=bs(()=>[this.getVirtualIndexes(),this.getMeasurements()],(a,b)=>{let c=[];for(let d=0,e=a.length;d<e;d++){let e=b[a[d]];c.push(e)}return c},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=a=>{let b=this.getMeasurements();if(0===b.length)return;let c=this._flatMeasurements,d=1===this.options.lanes&&null!=c,e=bG(0,b.length-1,d?a=>c[2*a]:a=>bt(b[a]).start,a);return bt(b[e])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let a=this.scrollElement.document.documentElement;return this.options.horizontal?a.scrollWidth-this.scrollElement.innerWidth:a.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(a=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=a,this.getOffsetForAlignment=(a,b,c=0)=>{if(!this.scrollElement)return 0;let d=this.getSize(),e=this.getScrollOffset();return"auto"===b&&(b=a>=e+d?"end":"start"),"center"===b?a+=(c-d)/2:"end"===b&&(a-=d),Math.max(Math.min(this.getMaxScrollOffset(),a),0)},this.getOffsetForIndex=(a,b="auto")=>{a=Math.max(0,Math.min(a,this.options.count-1));let c=this.getSize(),d=this.getScrollOffset(),e=this.measurementsCache[a];if(!e)return;if("auto"===b)if(e.end>=d+c-this.options.scrollPaddingEnd)b="end";else{if(!(e.start<=d+this.options.scrollPaddingStart))return[d,b];b="start"}if("end"===b&&a===this.options.count-1)return[this.getMaxScrollOffset(),b];let f="end"===b?e.end+this.options.scrollPaddingEnd:e.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(f,b,e.size),b]},this.scrollToOffset=(a,{align:b="start",behavior:c="auto"}={})=>{let d=this.getOffsetForAlignment(a,b),e=this.now();this.scrollState={index:null,align:b,behavior:c,startedAt:e,lastTargetOffset:d,stableFrames:0},this._scrollToOffset(d,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollToIndex=(a,{align:b="auto",behavior:c="auto"}={})=>{a=Math.max(0,Math.min(a,this.options.count-1));let d=this.getOffsetForIndex(a,b);if(!d)return;let[e,f]=d,g=this.now();this.scrollState={index:a,align:f,behavior:c,startedAt:g,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollBy=(a,{behavior:b="auto"}={})=>{let c=this.getScrollOffset()+a,d=this.now();this.scrollState={index:null,align:"start",behavior:b,startedAt:d,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:b}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:a="auto"}={})=>{if(this.options.count>0)return void this.scrollToIndex(this.options.count-1,{align:"end",behavior:a});this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:a})},this.getTotalSize=()=>{var a;let b,c=this.getMeasurements();if(0===c.length)b=this.options.paddingStart;else if(1===this.options.lanes){let d=c.length-1,e=this._flatMeasurements;b=null!=e?e[2*d]+e[2*d+1]:(null==(a=c[d])?void 0:a.end)??0}else{let a=Array(this.options.lanes).fill(null),d=c.length-1;for(;d>=0&&a.some(a=>null===a);){let b=c[d];null===a[b.lane]&&(a[b.lane]=b.end),d--}b=Math.max(...a.filter(a=>null!==a))}return Math.max(b-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let a=[];if(0===this.itemSizeCache.size)return a;for(let b of this.getMeasurements())b&&this.itemSizeCache.has(b.key)&&a.push({index:b.index,key:b.key,start:b.start,size:b.size,end:b.end,lane:b.lane});return a},this._scrollToOffset=(a,{adjustments:b,behavior:c})=>{this._intendedScrollOffset=a+(b??0),this.options.scrollToFn(a,{behavior:c,adjustments:b},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,b){0!==a&&(bv()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=a:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:b}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let a=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,b=a?a[0]:this.scrollState.lastTargetOffset,c=b!==this.scrollState.lastTargetOffset;if(!c&&bu(b,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==b&&this._scrollToOffset(b,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){let a=this.getSize()||600,c=Math.abs(b-this.getScrollOffset()),d="smooth"===this.scrollState.behavior&&c>a;this.scrollState.lastTargetOffset=b,d||(this.scrollState.behavior="auto"),this._scrollToOffset(b,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}let bG=(a,b,c,d)=>{for(;a<=b;){let e=(a+b)/2|0,f=c(e);if(f<d)a=e+1;else{if(!(f>d))return e;b=e-1}}return a>0?a-1:0},bH="undefined"!=typeof document?h.useLayoutEffect:h.useEffect;function bI(a){return function({useFlushSync:a=!0,...b}){let c=h.useReducer(a=>a+1,0)[1],d={...b,onChange:(d,e)=>{var f;a&&e?(0,br.flushSync)(c):c(),null==(f=b.onChange)||f.call(b,d,e)}},[e]=h.useState(()=>new bF(d));return e.setOptions(d),bH(()=>e._didMount(),[]),bH(()=>e._willUpdate()),e}({observeElementRect:bz,observeElementOffset:bC,scrollToFn:bE,...a})}let bJ=(0,x.A)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),bK=(0,x.A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),bL=(0,x.A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),bM=(0,x.A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bN=(0,x.A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),bO=(0,x.A)("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"}]]),bP=(0,x.A)("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"}]]);var bQ=c(55992);let bR={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}};var bS=c(82734);let bT={date:(0,bS.k)({formats:{full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},defaultWidth:"full"}),time:(0,bS.k)({formats:{full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:(0,bS.k)({formats:{full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},defaultWidth:"full"})},bU={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"};var bV=c(78116);let bW={ordinalNumber:(a,b)=>{let c=Number(a);switch(String(b?.unit)){case"year":return`${c}年`;case"quarter":return`第${c}四半期`;case"month":return`${c}月`;case"week":return`第${c}週`;case"date":return`${c}日`;case"hour":return`${c}時`;case"minute":return`${c}分`;case"second":return`${c}秒`;default:return`${c}`}},era:(0,bV.o)({values:{narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},defaultWidth:"wide"}),quarter:(0,bV.o)({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},defaultWidth:"wide",argumentCallback:a=>Number(a)-1}),month:(0,bV.o)({values:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},defaultWidth:"wide"}),day:(0,bV.o)({values:{narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},defaultWidth:"wide"}),dayPeriod:(0,bV.o)({values:{narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},defaultWidth:"wide",formattingValues:{narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},defaultFormattingWidth:"wide"})};var bX=c(53854),bY=c(98882);let bZ={code:"ja",formatDistance:(a,b,c)=>{let d;c=c||{};let e=bR[a];if(d="string"==typeof e?e:1===b?c.addSuffix&&e.oneWithSuffix?e.oneWithSuffix:e.one:c.addSuffix&&e.otherWithSuffix?e.otherWithSuffix.replace("{{count}}",String(b)):e.other.replace("{{count}}",String(b)),c.addSuffix)if(c.comparison&&c.comparison>0)return d+"後";else return d+"前";return d},formatLong:bT,formatRelative:(a,b,c,d)=>bU[a],localize:bW,match:{ordinalNumber:(0,bX.K)({matchPattern:/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,parsePattern:/\d+/i,valueCallback:function(a){return parseInt(a,10)}}),era:(0,bY.A)({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},defaultParseWidth:"any"}),quarter:(0,bY.A)({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},defaultMatchWidth:"wide",parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:"any",valueCallback:a=>a+1}),month:(0,bY.A)({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:"any"}),day:(0,bY.A)({matchPatterns:{narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},defaultMatchWidth:"wide",parsePatterns:{any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},defaultParseWidth:"any"}),dayPeriod:(0,bY.A)({matchPatterns:{any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};var b$=c(16620);let b_={en:b$.c,ja:bZ};function b0(a){return b_[a]??b$.c}var b1=c(54228);let b2=/(\/[^\s\n<>"']+\.[a-zA-Z0-9]+)/g;function b3(a){let b=a.split("\n");if(b.length<=2&&a.length<=100)return{text:a,isTruncated:!1};let c=b.slice(0,2).join("\n");return c.length>100&&(c=c.slice(0,100)),{text:c,isTruncated:!0}}let b4=(0,h.memo)(function({content:a,onFilePathClick:b}){let c=(0,k.c)("worktree"),d=(0,h.useMemo)(()=>(function(a){let b=a.match(b2);if(!b||0===b.length)return[{type:"text",content:a}];let c=[],d=0;return b.forEach(b=>{let e=a.indexOf(b,d);e>d&&c.push({type:"text",content:a.slice(d,e)}),c.push({type:"path",content:b}),d=e+b.length}),d<a.length&&c.push({type:"text",content:a.slice(d)}),c})(a),[a]),f=(0,h.useCallback)(a=>()=>b(a),[b]);return(0,e.jsx)("span",{children:d.map((a,b)=>"path"===a.type?(0,e.jsx)("button",{type:"button",onClick:f(a.content),className:"text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:underline cursor-pointer font-mono text-sm","aria-label":c("conversation.openFile",{path:a.content}),children:a.content},b):(0,e.jsx)("span",{children:a.content},b))})});function b5(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{"data-testid":"pending-indicator",className:"flex items-center gap-2 text-muted-foreground py-2",children:[(0,e.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse"}),(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"150ms"}}),(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),(0,e.jsx)("span",{className:"text-sm",children:a("conversation.waitingForResponse")})]})}let b6=(0,h.memo)(function({message:a,onFilePathClick:b,onCopy:c,onInsertToMessage:d,onRetryPending:f,onDiscardPending:g}){let h=(0,bQ.Ym)(),i=(0,k.c)("worktree"),j=(0,k.c)("common"),l=b0(h),m=(0,b1.bg)(a.timestamp,l),n=a.optimisticState,o=["group relative border-l-2 p-3 transition-opacity","error"===n?"border-danger-border bg-danger-subtle":"border-accent-500 bg-accent-500/10","sending"===n?"opacity-70":""].filter(Boolean).join(" ");return(0,e.jsxs)("div",{className:o,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-accent-700 dark:text-accent-400",children:i("conversation.you")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),"sending"===n&&(0,e.jsxs)("span",{"data-testid":"optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)(bM,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,e.jsx)("span",{children:i("conversation.sending")})]}),"error"===n&&(0,e.jsxs)("span",{"data-testid":"optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,e.jsx)(bN,{size:12,"aria-hidden":"true"}),(0,e.jsx)("span",{children:i("conversation.failedToSend")})]}),"error"===n?(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[f&&(0,e.jsxs)("button",{type:"button","data-testid":"pending-retry",onClick:()=>f(a.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:bg-muted transition-colors","aria-label":i("conversation.retrySending"),title:j("retry"),children:[(0,e.jsx)(bO,{size:12,"aria-hidden":"true"}),j("retry")]}),g&&(0,e.jsxs)("button",{type:"button","data-testid":"pending-discard",onClick:()=>g(a.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:text-danger-foreground hover:bg-muted transition-colors","aria-label":i("conversation.discardMessage"),title:i("conversation.discard"),children:[(0,e.jsx)(as.A,{size:12,"aria-hidden":"true"}),i("conversation.discard")]})]}):(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[d&&(0,e.jsx)("button",{type:"button","data-testid":"insert-user-message",onClick:()=>d(a.content),className:"p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 hover:bg-muted rounded transition-colors","aria-label":i("conversation.insertToMessage"),title:i("conversation.insertToMessage"),children:(0,e.jsx)(bP,{size:14,"aria-hidden":"true"})}),c&&(0,e.jsx)("button",{type:"button","data-testid":"copy-user-message",onClick:()=>c(a.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":i("conversation.copyMessage"),title:i("conversation.copy"),children:(0,e.jsx)(ax,{size:14,"aria-hidden":"true"})})]})]}),(0,e.jsx)("div",{"data-message-id":a.id,className:"text-sm text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:(0,e.jsx)(b4,{content:a.content,onFilePathClick:b})})]})}),b7=(0,h.memo)(function({message:a,index:b,total:c,isExpanded:d,onFilePathClick:f,onCopy:g,hasLongContent:i=!1,onToggleExpand:j}){let l=(0,bQ.Ym)(),m=(0,k.c)("worktree"),n=b0(l),o=(0,b1.bg)(a.timestamp,n),{text:p,isTruncated:q}=(0,h.useMemo)(()=>b3(a.content),[a.content]),r=d||!q?a.content:p;return(0,e.jsxs)("div",{className:"assistant-message-item group relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:m("conversation.assistant")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),c>1&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",b+1,"/",c,")"]}),(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[0===b&&i&&!!j&&(0,e.jsxs)("button",{type:"button",onClick:j,className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:bg-muted transition-colors","aria-expanded":d,"aria-label":m(d?"conversation.collapseMessage":"conversation.expandMessage"),children:[(0,e.jsx)(a8.A,{size:12,className:`transition-transform ${d?"rotate-180":""}`,"aria-hidden":"true"}),m(d?"conversation.collapse":"conversation.expand")]}),g&&(0,e.jsx)("button",{type:"button","data-testid":"copy-assistant-message",onClick:()=>g(a.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":m("conversation.copyMessage"),title:m("conversation.copy"),children:(0,e.jsx)(ax,{size:14,"aria-hidden":"true"})})]})]}),(0,e.jsxs)("div",{"data-message-id":a.id,className:"text-xs text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:[(0,e.jsx)(b4,{content:r,onFilePathClick:f}),!d&&q&&(0,e.jsx)("span",{className:"text-muted-foreground",children:"..."})]})]})}),b8=(0,h.memo)(function({messages:a,isExpanded:b,onFilePathClick:c,onCopy:d,hasLongContent:f=!1,onToggleExpand:g}){return(0,e.jsx)("div",{className:"bg-surface-2/50 border-l-2 border-border p-2 border-t border-border space-y-2",children:a.map((h,j)=>(0,e.jsxs)(i().Fragment,{children:[j>0&&(0,e.jsx)("div",{"data-testid":"assistant-message-divider",className:"border-t border-dashed border-border"}),(0,e.jsx)(b7,{message:h,index:j,total:a.length,isExpanded:b,onFilePathClick:c,onCopy:d,hasLongContent:f,onToggleExpand:g})]},h.id))})});function b9(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{"data-testid":"orphan-indicator",className:"bg-warning/10 text-warning-foreground text-xs px-3 py-1 flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("span",{children:a("conversation.systemMessage")})]})}let ca=(0,h.memo)(function({pair:a,onFilePathClick:b,isExpanded:c=!1,onToggleExpand:d,onCopy:f,onInsertToMessage:g,showAssistant:i=!0,onRetryPending:j,onDiscardPending:l}){let m=(0,k.c)("worktree"),n=a.userMessage?.optimisticState!==void 0,o=(0,h.useMemo)(()=>a.assistantMessages.some(a=>{let{isTruncated:b}=b3(a.content);return b}),[a.assistantMessages]),p=(0,h.useCallback)(()=>{d&&d()},[d]),q=(0,h.useMemo)(()=>{let b="pending"===a.status?"pending":"orphan"===a.status?"orphan border-l-4 border-warning":"";return`border border-border rounded-lg overflow-hidden mb-4 transition-colors ${b}`.trim()},[a.status]),r=a.userMessage?m("conversation.conversationLabel",{preview:`${a.userMessage.content.substring(0,50)}${a.userMessage.content.length>50?"...":""}`}):m("conversation.systemMessageLabel");return(0,e.jsxs)("div",{"data-testid":"conversation-pair-card",role:"article","aria-label":r,className:q,children:["orphan"===a.status&&(0,e.jsx)(b9,{}),a.userMessage&&(0,e.jsx)(b6,{message:a.userMessage,onFilePathClick:b,onCopy:f,onInsertToMessage:g,onRetryPending:j,onDiscardPending:l}),"pending"!==a.status||n?i&&a.assistantMessages.length>0?(0,e.jsx)(b8,{messages:a.assistantMessages,isExpanded:c,onFilePathClick:b,onCopy:f,hasLongContent:o,onToggleExpand:p}):null:(0,e.jsx)("div",{className:"bg-muted/40 border-l-2 border-border p-3 border-t border-border",children:(0,e.jsx)(b5,{})})]})});function cb({query:a,onQueryChange:b,matchCount:c,currentIndex:d,onNext:f,onPrev:g,onClose:i,isAtMaxMatches:j,onCompositionStart:l,onCompositionEnd:m}){let n=(0,h.useRef)(null),o=(0,k.c)("worktree"),p=(0,h.useCallback)(a=>{"Escape"===a.key&&i()},[i]),q=(0,h.useCallback)(a=>{b(a.target.value)},[b]),r=0===c?"0/0":j?o("history.search.countAtMax",{current:d+1,max:500}):`${d+1}/${c}`;return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border border-border rounded shadow-lg",role:"search","aria-label":o("history.search.regionLabel"),children:[(0,e.jsx)("input",{ref:n,type:"text",value:a,onChange:q,onKeyDown:p,onCompositionStart:l,onCompositionEnd:m,placeholder:o("history.search.placeholder"),className:"bg-transparent text-foreground text-sm outline-none w-32 sm:w-40 placeholder-muted-foreground","aria-label":o("history.search.keywordLabel"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-muted-foreground text-xs min-w-[3rem] text-right",children:r}),(0,e.jsx)("button",{type:"button",onClick:g,disabled:0===c,"aria-label":o("history.search.prev"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,e.jsx)("button",{type:"button",onClick:f,disabled:0===c,"aria-label":o("history.search.next"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,e.jsx)("button",{type:"button",onClick:i,"aria-label":o("history.search.close"),className:"text-muted-foreground hover:text-foreground min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}function cc(){let[a,b]=(0,h.useState)(!0),[c,d]=(0,h.useState)(40),e=(0,h.useRef)(a);e.current=a;let f=(0,h.useRef)(c);return f.current=c,{visible:a,width:c,toggle:(0,h.useCallback)(()=>{let a=!e.current;b(a),f.current},[]),setWidth:(0,h.useCallback)(a=>{let b=Number.isFinite(a)?Math.min(60,Math.max(10,a)):40;d(b),e.current},[])}}let cd=["relative","flex-shrink-0","bg-border","transition-colors","duration-150","hover:bg-accent-500","dark:hover:bg-accent-500","focus:outline-none","focus:ring-2","focus:ring-ring","focus:ring-offset-2","focus:ring-offset-background"],ce=["w-1","h-full","cursor-col-resize","before:content-['']","before:absolute","before:inset-y-0","before:-inset-x-1"],cf=["h-1","w-full","cursor-row-resize","before:content-['']","before:absolute","before:inset-x-0","before:-inset-y-1"];function cg(a,b){return"touches"in a&&a.touches.length>0?b?a.touches[0].clientX:a.touches[0].clientY:"clientX"in a?b?a.clientX:a.clientY:0}let ch=(0,h.memo)(function({onResize:a,orientation:b="horizontal",ariaValueNow:c=50,onDoubleClick:d,minRatio:f=.1}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)(!1),l=(0,h.useRef)(0),m=(0,h.useRef)(null),n="horizontal"===b,o=(0,h.useCallback)(a=>{a.preventDefault(),j(!0),l.current=cg(a,n)},[n]),p=(0,h.useCallback)(a=>{1===a.touches.length&&(j(!0),l.current=cg(a,n))},[n]),q=(0,h.useCallback)(b=>{if(!i)return;let c=cg(b,n);a(c-l.current),l.current=c},[i,n,a]),r=(0,h.useCallback)(b=>{if(!i||1!==b.touches.length)return;let c=cg(b,n);a(c-l.current),l.current=c},[i,n,a]),s=(0,h.useCallback)(()=>{j(!1)},[]),t=(0,h.useCallback)(()=>{d&&d()},[d]),u=(0,h.useCallback)(b=>{let c=0;n?"ArrowRight"===b.key?c=10:"ArrowLeft"===b.key&&(c=-10):"ArrowDown"===b.key?c=10:"ArrowUp"===b.key&&(c=-10),0!==c&&(b.preventDefault(),a(c))},[n,a]);(0,h.useEffect)(()=>(i&&(document.addEventListener("mousemove",q),document.addEventListener("mouseup",s),document.addEventListener("touchmove",r),document.addEventListener("touchend",s),document.body.style.userSelect="none",document.body.style.cursor=n?"col-resize":"row-resize"),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",s),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),document.body.style.userSelect="",document.body.style.cursor=""}),[i,q,s,r,n]);let v=(0,h.useMemo)(()=>[...cd,...n?ce:cf,...i?["bg-accent-500","dark:bg-accent-500","dragging",n?"w-2":"h-2"]:[]].join(" "),[n,i]);return(0,e.jsx)("div",{ref:m,role:"separator","aria-orientation":b,"aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":g("paneResizer.label",{arrows:g(n?"paneResizer.arrowsHorizontal":"paneResizer.arrowsVertical")}),tabIndex:0,className:v,onMouseDown:o,onTouchStart:p,onKeyDown:u,onDoubleClick:t})}),ci="worktree-history-pane",cj=(0,h.memo)(function({onToggle:a}){let b=(0,k.c)("worktree");return(0,e.jsx)("div",{"data-testid":"terminal-container-expand-bar",style:{width:"36px"},className:"flex-shrink-0 flex items-start justify-center bg-gray-100 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",children:(0,e.jsxs)("button",{type:"button","data-testid":"history-pane-expand","aria-label":b("terminal.showHistory"),title:b("terminal.showHistory"),"aria-expanded":"false","aria-controls":ci,onClick:a,className:"flex flex-col items-center gap-2 w-full pt-2 text-gray-500 dark:text-gray-400 hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:b("terminal.historyLabel")})]})})}),ck=(0,h.memo)(function({history:a,terminal:b}){let{visible:c,width:d,toggle:f,setWidth:g}=cc(),i=(0,h.useRef)(null),j=(0,h.useCallback)(a=>{let b=i.current;if(!b)return;let c=b.offsetWidth;0!==c&&g(d+a/c*100)},[d,g]);return(0,e.jsxs)("div",{ref:i,className:"flex h-full min-h-0 w-full",children:[null!=a&&(c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:ci,"data-testid":"terminal-container-history-slot","aria-label":"History pane",style:{width:`${d}%`},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,e.jsx)(F,{componentName:"HistoryPane",children:a})}),(0,e.jsx)(ch,{onResize:j,orientation:"horizontal",ariaValueNow:d})]}):(0,e.jsx)(cj,{onToggle:f})),(0,e.jsx)("div",{"data-testid":"terminal-container-terminal-slot","aria-label":"Terminal pane",className:"flex-grow overflow-hidden min-w-0",children:(0,e.jsx)(F,{componentName:"TerminalAndFilePanel",children:b})})]})}),cl=[50,100,150,200,250,500,1e3];function cm(a){return`split-history-slot-${a}`}function cn(){let a=(0,k.c)("worktree");return(0,e.jsx)("div",{"data-testid":"loading-indicator",role:"status","aria-label":a("history.loading"),children:[0,1,2].map(a=>(0,e.jsxs)("div",{className:"mb-4 overflow-hidden rounded-lg border border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 p-3",children:[(0,e.jsx)(n.EA,{className:"h-4 w-4 rounded-full"}),(0,e.jsx)(n.EA,{className:"h-4 w-1/3"})]}),(0,e.jsxs)("div",{className:"space-y-2 px-3 pb-3",children:[(0,e.jsx)(n.EA,{className:"h-3 w-full"}),(0,e.jsx)(n.EA,{className:"h-3 w-5/6"}),(0,e.jsx)(n.EA,{className:"h-3 w-2/3"})]})]},a))})}function co(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[(0,e.jsx)("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,e.jsx)("p",{className:"text-sm",children:a("history.empty")})]})}let cp=["h-full","flex","flex-col","overflow-hidden","bg-surface-2","rounded-lg","border","border-border"],cq=(0,h.memo)(function({messages:a,worktreeId:b,onFilePathClick:c,isLoading:d=!1,className:f="",showToast:g,onInsertToMessage:i,onRetryPending:j,onDiscardPending:l,showArchived:m=!1,onShowArchivedChange:o,historyDisplayLimit:p,onHistoryDisplayLimitChange:q,historyUserOnly:r=!1,onHistoryUserOnlyChange:s,onCollapse:t,splitIndex:u,cliToolId:v}){let w=(0,k.c)("worktree"),x=(0,h.useRef)(null),y=(0,h.useMemo)(()=>void 0===u?aD:{highlightName:`history-search-${u}`,currentHighlightName:`history-search-current-${u}`,fallbackOverlayId:`history-search-fallback-overlay-${u}`,fallbackOverlayBgColor:aD.fallbackOverlayBgColor},[u]),z=void 0===u?"history-pane-collapse-button":`history-pane-collapse-button-${u}`,A=void 0===u?ci:cm(u),B=(0,h.useRef)(!0),C=(0,h.useRef)(-1),D=(0,h.useRef)(null),{pairs:E,isExpanded:F,toggleExpand:G}=function(a){let b=(0,h.useMemo)(()=>(function(a){if(0===a.length)return[];let b=[...a].sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime()),c=[],d=null;for(let a of b)if("user"===a.role)d={id:a.id,userMessage:a,assistantMessages:[],status:"pending"},c.push(d);else if("assistant"===a.role)if(d&&null!==d.userMessage)d.assistantMessages.push(a),d.status="completed";else if(d&&null===d.userMessage)d.assistantMessages.push(a);else{let b={id:`orphan-${a.id}`,userMessage:null,assistantMessages:[a],status:"orphan"};c.push(b),d=b}return c})(a),[a]),[c,d]=(0,h.useState)(new Set),e=(0,h.useCallback)(a=>{d(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),f=(0,h.useCallback)(a=>c.has(a),[c]),g=(0,h.useCallback)(()=>{d(new Set(b.map(a=>a.id)))},[b]);return{pairs:b,expandedPairs:c,toggleExpand:e,isExpanded:f,expandAll:g,collapseAll:(0,h.useCallback)(()=>{d(new Set)},[])}}(a),{isOpen:H,query:I,matchCount:J,currentIndex:K,isAtMaxMatches:L,matchPositions:M,currentMatch:N,openSearch:O,closeSearch:P,setQuery:R,onCompositionStart:S,onCompositionEnd:T,nextMatch:U,prevMatch:V}=function({messages:a}){let[b,c]=(0,h.useState)(!1),[d,e]=(0,h.useState)(""),[f,g]=(0,h.useState)([]),[i,j]=(0,h.useState)(0),[k,l]=(0,h.useState)(!1),m=(0,h.useRef)(null),n=(0,h.useRef)(""),o=(0,h.useRef)(!1);(0,h.useRef)(function(a){if(0===a.length)return"0";let b=a[a.length-1],c=b.timestamp instanceof Date?b.timestamp.getTime():String(b.timestamp);return`${a.length}|${b.id}|${c}`}(a));let p=(0,h.useRef)(a);p.current=a;let q=f.reduce((a,b)=>a+b.ranges.length,0),r=(0,h.useMemo)(()=>(function(a,b){if(0===a.length||b<0)return null;let c=0;for(let d of a){if(b<c+d.ranges.length)return{messageId:d.messageId,localIndex:b-c};c+=d.ranges.length}return null})(f,i),[f,i]),s=(0,h.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),t=(0,h.useCallback)(a=>{let{positions:b,capped:c}=function(a,b){if(b.length<2||0===a.length)return{positions:[],capped:!1};let c=b.toLowerCase(),d=b.length,e=[],f=0,g=!1;for(let b of a){if(g)break;let h=b.content;if(!h)continue;let i=h.toLowerCase(),j=[],k=0;for(;;){let e=i.indexOf(c,k);if(-1===e)break;if(j.push({start:e,end:e+d}),k=e+1,(f+=1)>=500){if(-1!==i.indexOf(c,k))g=!0;else{let d=a.indexOf(b)+1;for(let b=d;b<a.length;b++){let d=a[b].content;if(d&&-1!==d.toLowerCase().indexOf(c)){g=!0;break}}}break}}j.length>0&&e.push({messageId:b.id,ranges:j})}return{positions:e,capped:g}}(p.current,a);g(b),j(0),l(c)},[]),u=(0,h.useCallback)(a=>{s(),n.current=a,o.current||(m.current=setTimeout(()=>{t(a)},300))},[s,t]),v=(0,h.useCallback)(a=>{e(a),u(a)},[u]),w=(0,h.useCallback)(()=>{c(!0)},[]),x=(0,h.useCallback)(()=>{c(!1),e(""),n.current="",g([]),j(0),l(!1),s()},[s]),y=(0,h.useCallback)(()=>{j(a=>0===q?0:(a+1)%q)},[q]),z=(0,h.useCallback)(()=>{j(a=>0===q?0:(a-1+q)%q)},[q]);return{isOpen:b,query:d,matchCount:q,currentIndex:i,isAtMaxMatches:k,matchPositions:f,currentMatch:r,openSearch:w,closeSearch:x,setQuery:v,onCompositionStart:(0,h.useCallback)(()=>{o.current=!0,s()},[s]),onCompositionEnd:(0,h.useCallback)(()=>{o.current=!1;let a=n.current;a.length>=2&&(s(),m.current=setTimeout(()=>{t(a)},300))},[s,t]),nextMatch:y,prevMatch:z}}({messages:(0,h.useMemo)(()=>a.filter(a=>!a.archived&&"string"==typeof a.content&&a.content.length>0&&(!r||"user"===a.role)),[a,r])}),W=H&&M.length>0,[X,Y]=(0,h.useState)(new Set);(0,h.useEffect)(()=>{P()},[b]);let Z=(0,h.useMemo)(()=>r?E.filter(a=>a.userMessage):E,[E,r]),$=(0,h.useMemo)(()=>{let a=new Map;for(let b of Z)for(let c of(b.userMessage&&a.set(b.userMessage.id,b.id),b.assistantMessages))a.set(c.id,b.id);return a},[Z]),_=(0,h.useMemo)(()=>{let a=new Map;return Z.forEach((b,c)=>a.set(b.id,c)),a},[Z]),aa=bI({count:Z.length,getScrollElement:()=>x.current,estimateSize:()=>160,overscan:6,getItemKey:a=>Z[a]?.id??a}),ab=aa.getVirtualItems(),ac=ab.length>0?`${ab[0].index}-${ab[ab.length-1].index}`:"",ad=(0,h.useCallback)(()=>{let a=x.current;a&&(B.current=function({scrollTop:a,scrollHeight:b,clientHeight:c},d=80){let e=b-a-c;return!!Number.isFinite(e)&&e<=d}({scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}))},[]);(0,h.useLayoutEffect)(()=>{let a=C.current,b=Z.length;C.current=b,-1!==a&&b>a&&b>0&&B.current&&!W&&aa.scrollToIndex(b-1,{align:"end"})},[Z.length,W,aa]),(0,h.useLayoutEffect)(()=>{if(!H||0===M.length)return void Y(a=>0===a.size?a:new Set);Y(function(a,b){let c=new Map;for(let a of b)for(let b of(a.userMessage&&c.set(a.userMessage.id,a.id),a.assistantMessages))c.set(b.id,a.id);let d=new Set;for(let b of a){let a=c.get(b.messageId);a&&d.add(a)}return d}(M,E))},[H,M,E]),(0,h.useEffect)(()=>{if(!H||!N)return;let a=$.get(N.messageId);if(void 0===a)return;let b=_.get(a);void 0!==b&&aa.scrollToIndex(b,{align:"center"})},[H,N,$,_,aa]),(0,h.useLayoutEffect)(()=>{let a=x.current;if(!a)return;if(!H||0===M.length)return void aI(y);let b=null;for(let d of M){var c;let e=(c=d.messageId,a.querySelector(`[data-message-id="${CSS.escape(c)}"]`));if(!e)continue;let f=N?.messageId===d.messageId,g=f?N.localIndex:-1;!function(a,b,c,d=aD){aH(a,b,c,d)}(e,d.ranges,g,y),f&&e instanceof HTMLElement&&(b=e)}return b&&"function"==typeof b.scrollIntoView&&b.scrollIntoView({block:"center",behavior:"smooth"}),()=>{aI(y)}},[H,M,N,X,y,ac]),(0,h.useEffect)(()=>{let a=x.current;if(H)null===D.current&&a&&(D.current=a.scrollTop);else{if(null!==D.current&&a){let b=D.current;requestAnimationFrame(()=>{a.scrollTop=b})}D.current=null}},[H]);let ae=(0,h.useMemo)(()=>[...cp,f].filter(Boolean).join(" "),[f]),af=(0,h.useCallback)(a=>c(a),[c]),ag=(0,h.useCallback)(a=>()=>G(a),[G]),ah=(0,h.useRef)(w);ah.current=w;let ai=(0,h.useCallback)(async a=>{try{await (0,ar.l)(a),g?.(ah.current("history.copied"),"success")}catch{console.error("[HistoryPane] Failed to copy to clipboard"),g?.(ah.current("history.copyFailed"),"error")}},[g]),aj=a=>{let b=a.userMessage?.archived===!0||a.assistantMessages?.some(a=>!0===a.archived),c=F(a.id)||X.has(a.id);return(0,e.jsx)("div",{className:b?"opacity-60":"",children:(0,e.jsx)(ca,{pair:a,onFilePathClick:af,isExpanded:c,onToggleExpand:ag(a.id),onCopy:ai,onInsertToMessage:i,onRetryPending:j,onDiscardPending:l,showAssistant:!r})})},ak=(0,h.useCallback)(a=>{let b=parseInt(a.target.value,10);cl.includes(b)&&q?.(b)},[q]),al=(0,h.useCallback)(()=>{H?P():O()},[H,O,P]);return(0,e.jsxs)("div",{role:"region","aria-label":w("history.regionLabel"),className:ae,children:[(0,e.jsxs)("div",{className:"flex-shrink-0 bg-surface-2 border-b border-border px-4 py-2 flex items-center justify-between flex-wrap gap-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:w("history.title")}),(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[q&&void 0!==p&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,e.jsx)("span",{children:w("history.show")}),(0,e.jsx)("select",{value:p,onChange:ak,"aria-label":w("history.displayLimit"),className:"rounded border border-input bg-surface text-foreground text-xs px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring",children:cl.map(a=>(0,e.jsx)("option",{value:a,children:a},a))})]}),o&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,e.jsx)(n.Sc,{checked:m,onCheckedChange:a=>o(!0===a),className:"h-3.5 w-3.5"}),w("history.showArchived")]}),s&&(0,e.jsx)("button",{type:"button",onClick:()=>s(!r),"aria-label":w("history.showUserOnly"),"aria-pressed":r,className:`p-1 rounded transition-colors ${r?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"}`,title:w(r?"history.showAllMessages":"history.showUserOnly"),children:r?(0,e.jsx)(bJ,{size:14,"aria-hidden":"true"}):(0,e.jsx)(bK,{size:14,"aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:al,"aria-label":w(H?"history.closeSearch":"history.openSearch"),"aria-pressed":H,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:w(H?"history.closeSearch":"history.openSearch"),children:(0,e.jsx)(Q.A,{size:14,"aria-hidden":"true"})}),t&&(0,e.jsx)("button",{type:"button",onClick:t,"aria-label":w("terminal.hideHistory"),"aria-expanded":"true","aria-controls":A,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:w("terminal.hideHistory"),"data-testid":z,children:(0,e.jsx)(bL,{size:14,"aria-hidden":"true"})})]})]}),H&&(0,e.jsx)("div",{className:"flex-shrink-0 px-3 py-2 bg-surface-2 border-b border-border",children:(0,e.jsx)(cb,{query:I,onQueryChange:R,matchCount:J,currentIndex:K,onNext:U,onPrev:V,onClose:P,isAtMaxMatches:L,onCompositionStart:S,onCompositionEnd:T})}),(0,e.jsx)("div",{ref:x,"data-testid":"history-scroll-container",onScroll:ad,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-4",children:d?(0,e.jsx)(cn,{}):0===Z.length?(0,e.jsx)(co,{}):0===ab.length?(0,e.jsx)("div",{"data-testid":"history-fallback-list",children:Z.slice(0,30).map(a=>(0,e.jsx)("div",{children:aj(a)},a.id))}):(0,e.jsx)("div",{style:{height:aa.getTotalSize(),width:"100%",position:"relative"},children:ab.map(a=>{let b=Z[a.index];return b?(0,e.jsx)("div",{"data-index":a.index,ref:aa.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${a.start}px)`},children:aj(b)},a.key):null})})})]})}),cr={isOpen:!1,position:{x:0,y:0},targetPath:null,targetType:null},cs=(0,x.A)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),ct=(0,x.A)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),cu=(0,x.A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),cv=(0,x.A)("folder-input",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);var cw=c(40284),cx=c(6074);function cy(a,b,c){let d=c-b-8;return d<8?8:Math.min(Math.max(a,8),d)}let cz=(0,h.memo)(function({isOpen:a,position:b,targetPath:c,targetType:d,onClose:f,onNewFile:g,onNewDirectory:j,onRename:l,onDelete:m,onUpload:n,onMove:o}){let p=(0,k.c)("worktree"),q=(0,h.useRef)(null),{shouldRender:r,isExiting:s}=(0,cx.O)(a,ah.$B),t=`${b.x}:${b.y}:${d}`,[u,v]=(0,h.useState)(null),w=u?.key===t?u:null;(0,h.useLayoutEffect)(()=>{if(!a)return;let c=q.current;if(!c)return;let d=c.getBoundingClientRect();v({key:t,left:cy(b.x,d.width,window.innerWidth),top:cy(b.y,d.height,window.innerHeight)})},[a,t,b.x,b.y]);let x=(0,h.useCallback)(a=>{a&&c&&a(c),f()},[c,f]),y=[{id:"new-file",label:p("fileTree.newFile"),icon:(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(g),showFor:["directory"]},{id:"new-directory",label:p("fileTree.newDirectory"),icon:(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(j),showFor:["directory"]},{id:"upload",label:p("contextMenu.uploadFile"),icon:(0,e.jsx)(cu,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(n),showFor:["directory"],showDividerAfter:!0},{id:"rename",label:p("contextMenu.rename"),icon:(0,e.jsx)(aw.A,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(l)},{id:"move",label:p("contextMenu.move"),icon:(0,e.jsx)(cv,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>{o&&c&&d&&o(c,d),f()},showDividerAfter:!0},{id:"delete",label:p("contextMenu.delete"),icon:(0,e.jsx)(cw.A,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(m),variant:"danger"}].filter(a=>!a.showFor||d&&a.showFor.includes(d));return((0,h.useEffect)(()=>{if(!a)return;let b=a=>{if("Escape"===a.key)return void f();if("ArrowDown"===a.key||"ArrowUp"===a.key){let b;a.preventDefault();let c=q.current?.querySelectorAll('[role="menuitem"]');if(!c?.length)return;let d=Array.from(c).findIndex(a=>a===document.activeElement);b="ArrowDown"===a.key?d<c.length-1?d+1:0:d>0?d-1:c.length-1,c[b].focus()}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a,f]),(0,h.useEffect)(()=>{if(a&&q.current){let a=q.current.querySelector('[role="menuitem"]');a&&a.focus()}},[a]),r)?(0,e.jsx)("div",{ref:q,"data-testid":"context-menu",role:"menu","aria-label":p("contextMenu.label"),className:`fixed min-w-[160px] py-1 bg-surface rounded-lg shadow-lg border border-border ${s?"animate-out fade-out-0 zoom-out-95 duration-100 fill-mode-forwards pointer-events-none":"animate-in fade-in-0 zoom-in-95 duration-100"}`,style:{zIndex:aA.M.CONTEXT_MENU,left:`${w?w.left:0}px`,top:`${w?w.top:0}px`},children:y.map((a,b)=>(0,e.jsxs)(i().Fragment,{children:[(0,e.jsxs)("button",{role:"menuitem","data-testid":`context-menu-${a.id}`,onClick:a.onClick,disabled:!c,className:`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors focus:outline-none focus:bg-muted ${"danger"===a.variant?"text-danger hover:bg-danger-subtle focus:bg-danger-subtle":"text-foreground hover:bg-muted"} ${!c?"opacity-50 cursor-not-allowed":""}`,children:[a.icon,(0,e.jsx)("span",{children:a.label})]}),a.showDividerAfter&&b<y.length-1&&(0,e.jsx)("div",{"data-testid":"context-menu-divider",className:"my-1 border-t border-border"})]},a.id))}):null});var cA=c(81497);let cB={showSize:!0,showCreated:!1,showModified:!1};function cC(a){return void 0===a?"":a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}let cD=(0,h.memo)(function({expanded:a}){return(0,e.jsx)("svg",{"data-testid":"chevron-icon",className:`w-4 h-4 text-muted-foreground transition-transform ${a?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),cE=(0,h.memo)(function({open:a}){return(0,e.jsx)("svg",{"data-testid":"folder-icon",className:"w-5 h-5 text-warning",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a?(0,e.jsx)("path",{d:"M19 20H5c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h6l2 2h6c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2zM5 6v12h14V8h-7l-2-2H5z"}):(0,e.jsx)("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}),cF=(0,h.memo)(function({text:a,query:b}){if(!b||!b.trim())return(0,e.jsx)(e.Fragment,{children:a});let c=p(b),d=a.split(RegExp(`(${c})`,"gi"));return(0,e.jsx)(e.Fragment,{children:d.map((a,c)=>a.toLowerCase()===b.toLowerCase()?(0,e.jsx)("mark",{className:"bg-warning-border text-foreground px-0.5 rounded",children:a},c):(0,e.jsx)("span",{children:a},c))})}),cG=(0,h.memo)(function({extension:a}){let b=(0,h.useMemo)(()=>a&&({ts:"text-info",tsx:"text-info",js:"text-warning",jsx:"text-warning",json:"text-warning",md:"text-muted-foreground",css:"text-pink-500",scss:"text-pink-500",html:"text-warning",py:"text-success"})[a]||"text-muted-foreground",[a]);return(0,e.jsx)("svg",{"data-testid":"file-icon",className:`w-5 h-5 ${b}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),cH=(0,h.memo)(function a({item:b,path:c,depth:d,worktreeId:f,expanded:g,cache:i,onToggle:j,onFileSelect:l,onLoadChildren:n,onContextMenu:o,searchQuery:p,searchMode:q,matchedPaths:r,dateFnsLocaleStr:s,metadataDisplay:t=cB}){let u=(0,k.c)("worktree"),[v,w]=(0,h.useState)(!1),x=c?`${c}/${b.name}`:b.name,y=g.has(x),z="directory"===b.type,A=i.get(x),B=(0,h.useMemo)(()=>s?b0(s):void 0,[s]),C=(0,h.useMemo)(()=>{if(z)return;let a=[];if(void 0!==b.size&&a.push(`${u("fileTree.metadata.size")}: ${cC(b.size)}`),b.birthtime){let c=(0,b1.bg)(new Date(b.birthtime),B);c&&a.push(`${u("fileTree.metadata.created")}: ${c}`)}if(b.mtime){let c=(0,b1.bg)(new Date(b.mtime),B);c&&a.push(`${u("fileTree.metadata.modified")}: ${c}`)}return a.length>0?a.join("\n"):void 0},[z,b.size,b.birthtime,b.mtime,B,u]),D=(0,h.useCallback)(async()=>{z?(y||A||(w(!0),await n(x),w(!1)),j(x)):l?.(x)},[z,y,A,x,n,j,l]),E=(0,h.useCallback)(a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),D())},[D]),F=(0,h.useCallback)(a=>{a.preventDefault(),o?.(a,x,z?"directory":"file")},[x,z,o]),G=function({delay:a=500,moveThreshold:b=10,onLongPress:c}){let d=(0,h.useRef)(null),e=(0,h.useRef)(null),f=(0,h.useRef)(null),g=(0,h.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),e.current=null,f.current=null},[]),i=(0,h.useCallback)(b=>{if(1!==b.touches.length)return;let h=b.touches[0];e.current={x:h.clientX,y:h.clientY},f.current=b,d.current=setTimeout(()=>{f.current&&c(f.current),g()},a)},[a,c,g]),j=(0,h.useCallback)(a=>{if(!e.current||1!==a.touches.length)return;let c=a.touches[0],d=c.clientX-e.current.x,f=c.clientY-e.current.y;Math.sqrt(d*d+f*f)>b&&g()},[b,g]);return{onTouchStart:i,onTouchMove:j,onTouchEnd:(0,h.useCallback)(()=>{g()},[g]),onTouchCancel:(0,h.useCallback)(()=>{g()},[g])}}({onLongPress:(0,h.useCallback)(a=>{o?.(a,x,z?"directory":"file")},[x,z,o])}),H={...function(a){let b=Math.min(a,20);return{paddingLeft:`${.5+ +b}rem`}}(d),touchAction:"manipulation",WebkitTouchCallout:"none"};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{"data-testid":`tree-item-${b.name}`,role:"treeitem","aria-selected":!1,"aria-expanded":z?y:void 0,tabIndex:0,className:"flex items-center gap-2 py-1.5 pr-2 cursor-pointer hover:bg-muted rounded transition-colors",style:H,onClick:D,onKeyDown:E,onContextMenu:F,onTouchStart:G.onTouchStart,onTouchMove:G.onTouchMove,onTouchEnd:G.onTouchEnd,onTouchCancel:G.onTouchCancel,children:[z?(0,e.jsx)("span",{className:"w-4 h-4 flex items-center justify-center",children:v?(0,e.jsx)(m.y,{size:"xs",variant:"accent"}):(0,e.jsx)(cD,{expanded:y})}):(0,e.jsx)("span",{className:"w-4 h-4"}),z?(0,e.jsx)(cE,{open:y}):(0,e.jsx)(cG,{extension:b.extension}),(0,e.jsx)(cA.nR,{content:b.name,metadata:C,className:"flex-1 truncate text-sm text-foreground",children:"name"===q&&p?(0,e.jsx)(cF,{text:b.name,query:p}):b.name}),t.showSize&&(0,e.jsx)("span",{"data-testid":"tree-item-size",className:"text-xs text-muted-foreground flex-shrink-0",children:z?void 0!==b.itemCount&&u("fileTree.itemCount",{count:b.itemCount}):cC(b.size)}),!z&&t.showCreated&&b.birthtime&&(0,e.jsx)("span",{"data-testid":"tree-item-created",className:"text-xs text-muted-foreground flex-shrink-0",children:(0,b1.fw)(b.birthtime,B)}),!z&&t.showModified&&b.mtime&&(0,e.jsx)("span",{"data-testid":"tree-item-modified",className:"text-xs text-muted-foreground flex-shrink-0",children:(0,b1.fw)(b.mtime,B)})]}),z&&y&&A&&(0,e.jsx)("div",{role:"group",children:A.filter(a=>{let b=x?`${x}/${a.name}`:a.name;if(!p?.trim())return!0;if("name"===q){let b=p.toLowerCase();return!!a.name.toLowerCase().includes(b)||"directory"===a.type}if("content"===q&&r&&r.size>0){if(r.has(b))return!0;if("directory"===a.type){for(let a of r)if(a.startsWith(b+"/"))return!0}return!1}return!0}).map(b=>(0,e.jsx)(a,{item:b,path:x,depth:d+1,worktreeId:f,expanded:g,cache:i,onToggle:j,onFileSelect:l,onLoadChildren:n,onContextMenu:o,searchQuery:p,searchMode:q,matchedPaths:r,dateFnsLocaleStr:s,metadataDisplay:t},b.name))})]})}),cI=(0,x.A)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),cJ=[{key:"showSize",labelKey:"fileTree.metadata.showSize"},{key:"showCreated",labelKey:"fileTree.metadata.showCreated"},{key:"showModified",labelKey:"fileTree.metadata.showModified"}];function cK(a,b,c){if(b<=0||c<=0)return 0;let d=a+b+8-c;return d>0?-Math.min(d,Math.max(0,a-8)):a<8?8-a:0}let cL=(0,h.memo)(function({settings:a,onToggle:b}){let c=(0,k.c)("worktree"),[d,f]=(0,h.useState)(!1),g=(0,h.useRef)(null),i=(0,h.useRef)(null),j=(0,h.useRef)({x:0,y:0}),[l,m]=(0,h.useState)({x:0,y:0});(0,h.useEffect)(()=>{if(!d)return;let a=a=>{g.current&&!g.current.contains(a.target)&&f(!1)},b=a=>{"Escape"===a.key&&f(!1)};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[d]),(0,h.useLayoutEffect)(()=>{let a=a=>{j.current=a,m(b=>b.x===a.x&&b.y===a.y?b:a)};if(!d)return void a({x:0,y:0});let b=i.current;if(!b)return;let c=b.getBoundingClientRect();a({x:cK(c.left-j.current.x,c.width,window.innerWidth),y:cK(c.top-j.current.y,c.height,window.innerHeight)})},[d]);let o=(0,h.useCallback)(a=>{b(a)},[b]);return(0,e.jsxs)("div",{className:"relative",ref:g,"data-testid":"file-metadata-toggle",children:[(0,e.jsx)("button",{type:"button","data-testid":"file-metadata-toggle-button",onClick:()=>f(a=>!a),"aria-haspopup":"menu","aria-expanded":d,"aria-label":c("fileTree.metadata.settingsLabel"),title:c("fileTree.metadata.settingsLabel"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:(0,e.jsx)(cI,{className:"w-4 h-4","aria-hidden":"true"})}),d&&(0,e.jsxs)("div",{ref:i,role:"menu","data-testid":"file-metadata-toggle-menu",className:"absolute right-0 top-full z-20 mt-1 min-w-[12rem] rounded border border-border bg-surface shadow-lg p-1",style:0!==l.x||0!==l.y?{transform:`translate(${l.x}px, ${l.y}px)`}:void 0,children:[(0,e.jsx)("div",{className:"px-2 py-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:c("fileTree.metadata.settingsTitle")}),cJ.map(b=>(0,e.jsxs)("label",{className:"flex items-center gap-2 px-2 py-1.5 text-xs text-foreground hover:bg-muted rounded cursor-pointer",children:[(0,e.jsx)(n.Sc,{"data-testid":`file-metadata-toggle-${b.key}`,checked:a[b.key],onCheckedChange:()=>o(b.key),className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{children:c(b.labelKey)})]},b.key))]})]})});function cM({intervalMs:a,enabled:b,onPoll:c}){(0,h.useRef)(c).current=c,(0,h.useRef)(b).current=b,(0,h.useRef)(null)}var cN=c(25345);let cO=(0,h.memo)(function({worktreeId:a,onFileSelect:b,onNewFile:c,onNewDirectory:d,onRename:f,onDelete:g,onUpload:i,onMove:j,className:l="",refreshTrigger:m=0,pollingEnabled:o=!1,searchQuery:p,searchMode:r,searchResults:s,onSearchResultSelect:t,onResetView:u}){let v=(0,bQ.Ym)(),w=(0,k.c)("worktree"),{settings:x,toggle:y}=function(){let[a,b]=(0,h.useState)(cB),c=(0,h.useRef)(a);c.current=a;let d=(0,h.useCallback)(a=>{c.current=a,b(a)},[]);return{settings:a,toggle:(0,h.useCallback)(a=>{d({...c.current,[a]:!c.current[a]})},[d]),setSettings:d}}(),[z,A]=(0,h.useState)(!0),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)([]),{expanded:F,setExpanded:G,resetExpanded:H}=function(a){let[b,c]=(0,h.useState)(()=>new Set);(0,h.useRef)(a);let d=(0,h.useCallback)(()=>{c(new Set)},[]);return{expanded:b,setExpanded:c,resetExpanded:d}}(a),[I,J]=(0,h.useState)(()=>new Map),K=(0,h.useRef)(null),L=(0,h.useRef)(F);L.current=F;let M=(0,h.useRef)(w);M.current=w;let N=(0,h.useRef)(new Set),{menuState:O,openMenu:P,closeMenu:Q}=function(){let[a,b]=(0,h.useState)(cr),c=(0,h.useCallback)((a,c,d)=>{let e,f;if(a.preventDefault(),"touches"in a&&a.touches.length>0)e=a.touches[0].clientX,f=a.touches[0].clientY;else{if(!("clientX"in a))return;e=a.clientX,f=a.clientY}b({isOpen:!0,position:{x:e,y:f},targetPath:c,targetType:d})},[]);return{menuState:a,openMenu:c,closeMenu:(0,h.useCallback)(()=>{b(a=>({...a,isOpen:!1}))},[]),resetMenu:(0,h.useCallback)(()=>{b(cr)},[])}}(),R=(0,h.useCallback)(async(b="")=>{try{let c=b?`/api/worktrees/${a}/tree/${b}`:`/api/worktrees/${a}/tree`,d=await fetch(c);if(!d.ok)throw Error(M.current("fileTree.loadDirectoryError",{status:d.status}));return await d.json()}catch(a){throw console.error("[FileTreeView] Error fetching directory:",a),a}},[a]),S=(0,h.useRef)(!0);(0,h.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let T=(0,h.useCallback)(async()=>{if(S.current){A(!0),C(null);try{let a=await R();if(!S.current||!a)return;let b=Array.from(L.current),c=new Map,d=[];for(let a=0;a<b.length;a+=5){if(!S.current)return;let e=b.slice(a,a+5);for(let[a,b]of(await Promise.allSettled(e.map(async a=>{let b=await R(a);return{dirPath:a,data:b}}))).entries())"fulfilled"===b.status&&b.value.data?c.set(b.value.dirPath,b.value.data.items):d.push(e[a])}if(!S.current)return;E(a.items),J(c),d.length>0&&G(a=>{let b=new Set(a);for(let a of d)a&&b.delete(a);return b})}catch(a){S.current&&C(a instanceof Error?a.message:M.current("fileTree.loadError"))}finally{S.current&&A(!1)}}},[R,G]);(0,h.useEffect)(()=>{T()},[T,m]);let U=(0,h.useRef)(null),V=(0,h.useRef)(!1);(0,h.useEffect)(()=>{U.current=null},[a]),cM({intervalMs:5e3,enabled:o,onPoll:(0,h.useCallback)(async()=>{if(S.current&&!V.current){V.current=!0;try{let a=["",...Array.from(L.current)],b=new Map;for(let c=0;c<a.length;c+=5){if(!S.current)return;let d=a.slice(c,c+5);for(let{dirPath:a,hash:c}of(await Promise.all(d.map(async a=>{try{let b=await R(a);return{dirPath:a,hash:JSON.stringify(b?.items??null)}}catch{return{dirPath:a,hash:"unavailable"}}}))))b.set(a,c)}if(!S.current)return;let c=U.current;if(U.current=b,null===c)return;let d=!1;for(let[a,e]of b){let b=c.get(a);if(void 0!==b&&b!==e){d=!0;break}}d&&T()}finally{V.current=!1}}},[R,T])});let W=(0,h.useCallback)(async a=>{if(!(I.has(a)||N.current.has(a))){N.current.add(a);try{let b=await R(a);b&&J(c=>{let d=new Map(c);return d.set(a,b.items),d})}catch(a){console.error("[FileTreeView] Error loading children:",a)}finally{N.current.delete(a)}}},[I,R]),X=(0,h.useCallback)(a=>{G(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[G]),Y=(0,h.useCallback)(()=>{H(),J(new Map),K.current?.scrollTo({top:0}),u?.()},[H,u]),Z=(0,h.useMemo)(()=>"content"===r&&s&&0!==s.length?q(s.map(a=>a.filePath)):new Set,[r,s]);(0,h.useEffect)(()=>{Z.size>0&&G(a=>{let b=new Set(a);for(let a of Z)(I.has(a)||s?.some(b=>b.filePath.startsWith(a+"/")))&&b.add(a);return b})},[Z,I,s,G]);let $=(0,h.useMemo)(()=>{if(!p?.trim())return D;if("name"===r){let a=p.toLowerCase(),b=(c,d)=>c.filter(c=>{let e=d?`${d}/${c.name}`:c.name,f=c.name.toLowerCase().includes(a);if("directory"===c.type){let a=I.get(e);if(a&&b(a,e).length>0)return!0}return f});return b(D,"")}return"content"===r&&Z.size>0?D.filter(a=>{if(Z.has(a.name))return!0;if("directory"===a.type){for(let b of Z)if(b.startsWith(a.name+"/")||b===a.name)return!0}return!1}):D},[D,p,r,Z,I]);if(z&&0===D.length)return(0,e.jsx)("div",{"data-testid":"file-tree-loading",className:`p-2 ${l}`,role:"status","aria-label":w("fileTree.loading"),children:[0,8,16,8,0,8].map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1.5 pr-2",style:{paddingLeft:`${8+a}px`},children:[(0,e.jsx)(n.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,e.jsx)(n.EA,{className:`h-4 ${b%3==0?"w-32":b%3==1?"w-24":"w-40"} max-w-full`})]},b))});if(B&&0===D.length)return(0,e.jsx)("div",{"data-testid":"file-tree-error",className:`p-4 bg-danger-subtle border border-danger-border rounded-lg ${l}`,children:(0,e.jsx)("p",{className:"text-sm text-danger",children:B})});let _=z&&D.length>0,aa=!!B&&D.length>0;return 0===D.length?(0,e.jsxs)("div",{"data-testid":"file-tree-empty",className:`p-4 text-center text-muted-foreground ${l}`,children:[(0,e.jsx)("p",{className:"text-sm",children:w("fileTree.empty")}),(c||d)&&(0,e.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[c&&(0,e.jsxs)(n.$n,{variant:"ghost","data-testid":"empty-new-file-button",onClick:()=>c(""),className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-foreground bg-surface border border-input rounded-md hover:bg-muted transition-colors",children:[(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newFile")})]}),d&&(0,e.jsxs)(n.$n,{variant:"ghost","data-testid":"empty-new-directory-button",onClick:()=>d(""),className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-foreground bg-surface border border-input rounded-md hover:bg-muted transition-colors",children:[(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newDirectory")})]})]})]}):p?.trim()&&0===$.length?(0,e.jsx)("div",{"data-testid":"file-tree-no-results",className:`p-4 text-center text-muted-foreground ${l}`,children:(0,e.jsx)("p",{className:"text-sm",children:w("content"===r?"fileTree.noResultsContaining":"fileTree.noResultsMatching",{query:p})})}):(0,e.jsxs)("div",{ref:K,"data-testid":"file-tree-view",role:"tree","aria-label":w("fileTree.label"),className:`overflow-auto bg-surface ${l}`,children:[(0,e.jsxs)("div",{"data-testid":"file-tree-toolbar",className:"flex items-center gap-1 p-1 border-b border-border",children:[c&&(0,e.jsxs)("button",{"data-testid":"toolbar-new-file-button",onClick:()=>c(""),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:[(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newFile")})]}),d&&(0,e.jsxs)("button",{"data-testid":"toolbar-new-directory-button",onClick:()=>d(""),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:[(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newDirectory")})]}),(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,e.jsx)(cL,{settings:x,onToggle:y}),_&&(0,e.jsxs)("div",{"data-testid":"file-tree-refetch-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:"w-3 h-3 border-2 border-input border-t-cyan-500 rounded-full animate-spin"}),(0,e.jsx)("span",{className:"sr-only",children:w("fileTree.refreshing")})]}),(0,e.jsx)("button",{"data-testid":"file-tree-refresh-button",type:"button",onClick:()=>{T()},disabled:_,"aria-label":w("fileTree.refreshLabel"),title:w("actions.refresh"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,e.jsx)(cN.A,{className:`w-4 h-4 ${_?"animate-spin":""}`,"aria-hidden":"true"})}),(0,e.jsx)("button",{"data-testid":"file-tree-reset-button",type:"button",onClick:Y,"aria-label":w("fileTree.resetViewLabel"),title:w("actions.resetView"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:(0,e.jsx)(bO,{className:"w-4 h-4","aria-hidden":"true"})})]})]}),aa&&(0,e.jsxs)("div",{"data-testid":"file-tree-refetch-error",role:"alert",className:"flex items-center gap-2 px-2 py-1 text-xs bg-danger-subtle border-b border-danger-border text-danger-foreground",children:[(0,e.jsx)(bN,{className:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{className:"flex-1 truncate",children:B}),(0,e.jsx)(n.$n,{variant:"ghost","data-testid":"file-tree-refetch-retry-button",onClick:()=>{T()},className:"px-2 py-0.5 text-xs rounded border border-danger-border hover:bg-danger-subtle transition-colors",children:w("actions.retry")})]}),$.map(c=>(0,e.jsx)(cH,{item:c,path:"",depth:0,worktreeId:a,expanded:F,cache:I,onToggle:X,onFileSelect:t||b,onLoadChildren:W,onContextMenu:P,searchQuery:p,searchMode:r,matchedPaths:Z,dateFnsLocaleStr:v,metadataDisplay:x},c.name)),(0,e.jsx)(cz,{isOpen:O.isOpen,position:O.position,targetPath:O.targetPath,targetType:O.targetType,onClose:Q,onNewFile:c,onNewDirectory:d,onRename:f,onDelete:g,onUpload:i,onMove:j})]})}),cP=(0,h.memo)(function(){return(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),cQ=(0,h.memo)(function(){return(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),cR=(0,h.memo)(function(){let a=(0,k.c)("worktree");return(0,e.jsx)(m.y,{size:"sm",variant:"accent","data-testid":"search-loading",role:"status","aria-hidden":!1,"aria-label":a("search.searching")})}),cS=(0,h.memo)(function({query:a,mode:b,isSearching:c,error:d,onQueryChange:f,onModeChange:g,onClear:i,placeholder:j,className:l=""}){let m=(0,h.useRef)(null),n=(0,k.c)("worktree"),o=(0,h.useCallback)(a=>{f(a.target.value)},[f]),p=(0,h.useCallback)(()=>{i(),m.current?.focus()},[i]),q=(0,h.useCallback)(b=>{"Escape"===b.key&&(a?p():m.current?.blur())},[a,p]);return(0,h.useEffect)(()=>{if(!(window.innerWidth<ab.D)){let a=setTimeout(()=>{m.current?.focus()},100);return()=>clearTimeout(a)}},[]),(0,e.jsxs)("div",{"data-testid":"search-bar",className:`flex flex-col gap-2 p-2 bg-surface dark:bg-surface-2 border-b border-border ${l}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-shrink-0",children:(0,e.jsx)(cP,{})}),(0,e.jsx)("input",{ref:m,type:"text","data-testid":"search-input",value:a,onChange:o,onKeyDown:q,placeholder:j??n("search.placeholder"),className:"flex-1 min-w-0 px-2 py-1 text-sm bg-muted text-foreground border border-input rounded focus:outline-none focus:ring-1 focus:ring-ring focus:border-accent-500","aria-label":n("search.label"),"aria-busy":c}),(0,e.jsx)("div",{className:"flex-shrink-0 w-6 h-6 flex items-center justify-center",children:c?(0,e.jsx)(cR,{}):a?(0,e.jsx)("button",{type:"button","data-testid":"search-clear",onClick:p,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors","aria-label":n("search.clear"),children:(0,e.jsx)(cQ,{})}):null})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground mr-1",children:n("search.mode")}),(0,e.jsx)("button",{type:"button","data-testid":"mode-name",onClick:()=>g("name"),className:`px-2 py-0.5 text-xs rounded transition-colors ${"name"===b?"bg-accent-100 dark:bg-accent-900 text-accent-700 dark:text-accent-300 font-medium":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-pressed":"name"===b,children:n("search.modeName")}),(0,e.jsx)("button",{type:"button","data-testid":"mode-content",onClick:()=>g("content"),className:`px-2 py-0.5 text-xs rounded transition-colors ${"content"===b?"bg-accent-100 dark:bg-accent-900 text-accent-700 dark:text-accent-300 font-medium":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-pressed":"content"===b,children:n("search.modeContent")})]}),d&&(0,e.jsx)("div",{"data-testid":"search-error",className:"text-xs text-danger bg-danger-subtle px-2 py-1 rounded",role:"alert",children:d})]})});var cT=c(82042);function cU({value:a,saveFn:b,debounceMs:c=300,disabled:d=!1,maxRetries:e=3,onSaveComplete:f}){let[g,i]=(0,h.useState)(!1),[j,k]=(0,h.useState)(null),l=(0,h.useRef)(a),m=(0,h.useRef)(b),n=(0,h.useRef)(f),o=(0,h.useRef)(null),p=(0,h.useRef)(!0);(0,h.useRef)(a);let q=(0,h.useCallback)(async a=>{if(!p.current)return;i(!0),k(null);let b=null,c=0;for(;c<=e;)try{await m.current(a),p.current&&(i(!1),k(null),n.current?.());return}catch(a){if(b=a instanceof Error?a:Error(String(a)),++c<=e){let a=1e3*Math.pow(2,c-1);await new Promise(b=>setTimeout(b,a))}}p.current&&(i(!1),k(b))},[e]),r=(0,h.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);return{isSaving:g,error:j,saveNow:(0,h.useCallback)(async()=>{d||(r(),await q(l.current))},[d,r,q])}}let cV=(0,h.memo)(function({memo:a,onUpdate:b,onDelete:c,isSaving:d,error:f,className:g="",onInsertToMessage:i,onMoveUp:j,onMoveDown:l,canMoveUp:m=!0,canMoveDown:n=!0}){let o=(0,k.c)("schedule"),p=(0,k.c)("worktree"),q=!!(j||l),[r,s]=(0,h.useState)(a.title),[t,u]=(0,h.useState)(a.content),[v,w]=(0,h.useState)(!1),x=(0,h.useRef)(void 0);(0,h.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let{isSaving:y,error:z,saveNow:A}=cU({value:r,saveFn:async c=>{await b(a.id,{title:c})}}),{isSaving:B,error:C,saveNow:D}=cU({value:t,saveFn:async c=>{await b(a.id,{content:c})}}),E=f??z?.message??C?.message??null,F=(0,h.useCallback)(a=>{s(a.target.value)},[]),G=(0,h.useCallback)(a=>{u(a.target.value)},[]),H=(0,h.useCallback)(()=>{A()},[A]),I=(0,h.useCallback)(()=>{D()},[D]),J=(0,h.useCallback)(()=>{c(a.id)},[a.id,c]),K=(0,h.useCallback)(()=>{t.trim()&&i?.(t)},[t,i]),L=(0,h.useCallback)(async()=>{if(t.trim())try{await (0,ar.l)(t),w(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>w(!1),2e3)}catch{}},[t]);return(0,e.jsxs)("div",{"data-testid":"memo-card","data-memo-id":a.id,tabIndex:-1,className:`bg-surface dark:bg-surface-2 border border-border rounded-lg p-4 space-y-3 focus:outline-none ${g}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("input",{type:"text",value:r,onChange:F,onBlur:H,placeholder:o("memoTitlePlaceholder"),className:"flex-1 min-w-0 text-sm font-medium text-foreground bg-transparent border-none focus:outline-none focus:ring-0 p-0"}),(d??(y||B))&&(0,e.jsx)("span",{"data-testid":"saving-indicator",className:"text-xs text-muted-foreground",children:p("actions.saving")}),q&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button","data-testid":`memo-move-up-${a.id}`,onClick:j,disabled:!m,"aria-label":o("memoMoveUp"),title:o("memoMoveUp"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded disabled:opacity-30 disabled:cursor-not-allowed",children:(0,e.jsx)(cT.A,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button","data-testid":`memo-move-down-${a.id}`,onClick:l,disabled:!n,"aria-label":o("memoMoveDown"),title:o("memoMoveDown"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded disabled:opacity-30 disabled:cursor-not-allowed",children:(0,e.jsx)(a8.A,{className:"w-4 h-4","aria-hidden":"true"})})]}),i&&(0,e.jsx)("button",{type:"button","data-testid":"insert-memo-content",onClick:K,"aria-label":o("memoInsertToMessage"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 transition-colors rounded",title:o("memoInsertToMessage"),children:(0,e.jsx)(bP,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:L,"aria-label":o("memoCopyContent"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded",children:v?(0,e.jsx)(au.A,{className:"w-4 h-4 text-success"}):(0,e.jsx)(ax,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:J,"aria-label":o("memoDelete"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-danger transition-colors rounded",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),(0,e.jsx)("textarea",{value:t,onChange:G,onBlur:I,placeholder:o("memoContentPlaceholder"),rows:4,className:"w-full text-sm text-foreground bg-muted border border-border rounded-md p-2 resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),E&&(0,e.jsx)("div",{className:"text-xs text-danger",children:E})]})}),cW=(0,h.memo)(function({currentCount:a,maxCount:b,onAdd:c,isLoading:d=!1,className:f=""}){let g=(0,k.c)("schedule"),h=Math.max(0,b-a),i=a>=b||d;return(0,e.jsxs)("div",{"data-testid":"memo-add-button",className:`flex flex-col items-center gap-2 ${f}`,children:[(0,e.jsxs)("button",{type:"button",onClick:()=>{i||c()},disabled:i,"aria-label":g("memoAdd"),"aria-disabled":i,className:`
21
+ </script>`;function aO({htmlContent:a,filePath:b}){let[c,d]=(0,h.useState)("preview"),[f,g]=(0,h.useState)("safe"),i=(0,h.useRef)(new Set),j=(0,k.c)("worktree"),l=(0,am.SC)(),m=(0,h.useCallback)(async a=>{if("interactive"===a&&!i.current.has(b)){if(!await l({description:j("htmlPreview.interactiveModeConfirm")}))return;i.current.add(b)}g(a)},[b,l,j]),n=(0,h.useMemo)(()=>"interactive"!==f?a:a.includes("</body>")?a.replace("</body>",`${aN}</body>`):a+aN,[a,f]),o=(0,h.useMemo)(()=>{try{return aK.highlight(a,{language:"html",ignoreIllegals:!0}).value}catch{return aK.highlightAuto(a).value}},[a]),p=(0,h.useMemo)(()=>Array.from({length:a.split("\n").length},(a,b)=>b+1),[a]),q=(0,h.useMemo)(()=>o.split("\n"),[o]);return(0,e.jsxs)("div",{className:"flex flex-col h-full","data-testid":"html-preview-mobile",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border bg-muted",children:[(0,e.jsx)("div",{className:"flex gap-1",children:["source","preview"].map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>d(a),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${c===a?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:"source"===a?j("fileViewer.tabSource"):j("fileViewer.tabPreview")},a))}),(0,e.jsx)("div",{className:"flex gap-1",children:["safe","interactive"].map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>m(a),className:`px-2 py-1 text-xs font-medium rounded-md transition-colors ${f===a?"safe"===a?"bg-success-subtle text-success-foreground":"bg-warning-subtle text-warning-foreground":"text-muted-foreground hover:bg-muted"}`,children:"safe"===a?j("fileViewer.sandboxSafe"):j("fileViewer.sandboxInteractive")},a))})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto min-h-0",children:"source"===c?(0,e.jsx)("table",{className:"text-sm w-full border-collapse",children:(0,e.jsx)("tbody",{children:p.map(a=>{let b=a-1;return(0,e.jsxs)("tr",{children:[(0,e.jsx)("td",{className:"pl-3 pr-2 text-right select-none font-mono border-r border-border bg-muted dark:bg-muted/50 sticky left-0 align-top whitespace-nowrap text-muted-foreground",children:a}),(0,e.jsx)("td",{className:"px-4 text-foreground align-top",children:(0,e.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono",children:(0,e.jsx)("code",{className:"hljs",dangerouslySetInnerHTML:{__html:q[b]??""}})})})]},a)})})}):(0,e.jsx)("iframe",{srcDoc:n,sandbox:aq[f],title:j("htmlPreview.title",{path:b}),className:"w-full h-full border-0 bg-white"},`${b}-${f}`)})]})}let aP=(0,h.memo)(function({isOpen:a,onClose:b,worktreeId:c,filePath:d,onEditMarkdown:f}){let[g,i]=(0,h.useState)(null),[j,l]=(0,h.useState)(!1),[m,o]=(0,h.useState)(null),[p,q]=(0,h.useState)(!1),[r,s]=(0,h.useState)(!1),[t,u]=(0,h.useState)(null),[v,w]=(0,h.useState)(0),[x,y]=(0,h.useState)(!1),z=(0,h.useRef)(null),A=(0,k.c)("worktree"),{searchOpen:B,searchQuery:C,searchMatches:D,searchCurrentIdx:E,searchInputRef:F,openSearch:G,closeSearch:H,nextMatch:I,prevMatch:J,setSearchQuery:K}=aJ(g?.content),L=(0,h.useMemo)(()=>!!(g?.content&&!g.isImage&&!g.isVideo&&!g.isPdf),[g]),M=(0,h.useCallback)(async()=>{if(L&&g?.content)try{await (0,ar.l)(g.content),q(!0),setTimeout(()=>q(!1),ah.pX)}catch{}},[L,g]),N=(0,h.useCallback)(async()=>{try{await (0,ar.l)(d),s(!0),setTimeout(()=>s(!1),ah.pX)}catch{}},[d]),O=(0,h.useCallback)(()=>{y(a=>!a)},[]);(0,h.useEffect)(()=>{if(0===D.length||!z.current)return;let a=D[E],b=z.current.querySelector(`[data-line="${a}"]`);b&&"function"==typeof b.scrollIntoView&&b.scrollIntoView({block:"center",behavior:"smooth"})},[E,D]),(0,h.useEffect)(()=>{if(!x)return;let a=a=>{"Escape"===a.key&&y(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[x]),(0,h.useEffect)(()=>{if(!a||!d){i(null),o(null),q(!1),H();return}(async()=>{l(!0),o(null);try{let a=await fetch(`/api/worktrees/${c}/files/${aB(d)}`);if(!a.ok){let b=await a.json(),c="string"==typeof b.error?b.error:b.error?.message||A("fileViewer.loadError");throw Error(c)}let b=await a.json();i(b)}catch(a){o(a instanceof Error?a.message:A("fileViewer.loadError"))}finally{l(!1)}})()},[a,c,d]),(0,h.useEffect)(()=>{u(null),w(0),g&&"md"===g.extension&&aL.test(g.content)&&!(g.content.length>1e6)&&(async()=>{try{let a=await fetch(`/api/worktrees/${c}/marp-render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdownContent:g.content})});if(a.ok){let b=await a.json();u(b.slides)}}catch{}})()},[g,c]);let P=!!(t&&t.length>0),R=g?.extension==="md",S=(0,h.useCallback)(()=>{f&&d&&(b(),f(d))},[f,d,b]),T=(0,h.useMemo)(()=>{if(!g||g.isImage||g.isVideo||g.isHtml||g.isPdf||P&&t)return null;let a=Array.from({length:g.content.split("\n").length},(a,b)=>b+1);try{return{lineNumbers:a,highlightedHtml:aK.highlight(g.content,{language:g.extension,ignoreIllegals:!0}).value}}catch{return{lineNumbers:a,highlightedHtml:aK.highlightAuto(g.content).value}}},[g,P,t]),U=()=>{if(!g)return null;if(g.isImage)return(0,e.jsx)(an.a,{src:g.content,alt:g.path,mimeType:g.mimeType});if(g.isVideo)return(0,e.jsx)(ao.u,{src:g.content,mimeType:g.mimeType});if(g.isPdf)return(0,e.jsx)("div",{className:"h-full min-h-[40vh]",children:(0,e.jsx)(ap.n,{dataUri:g.content,filePath:d,variant:"download"})});if(g.isHtml)return(0,e.jsx)(aO,{htmlContent:g.content,filePath:d});if(P&&t)return(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-2 bg-muted border-b border-border",children:[(0,e.jsx)("button",{type:"button",onClick:()=>w(a=>Math.max(0,a-1)),disabled:0===v,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:A("actions.prev")}),(0,e.jsxs)("span",{className:"text-sm text-muted-foreground",children:[v+1," / ",t.length]}),(0,e.jsx)("button",{type:"button",onClick:()=>w(a=>Math.min(t.length-1,a+1)),disabled:v===t.length-1,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:A("actions.next")})]}),(0,e.jsx)("iframe",{srcDoc:t[v],sandbox:"",title:A("fileViewer.slideTitle",{name:d,number:v+1}),className:"w-full border-0",style:{height:x?"calc(100vh - 100px)":"50vh"}})]});if(!T)return null;let a=new Set(D),b=D.length>0?D[E]:-1,c=T.highlightedHtml.split("\n");return(0,e.jsx)("div",{ref:z,children:(0,e.jsx)("table",{className:"text-sm w-full border-collapse",children:(0,e.jsx)("tbody",{children:T.lineNumbers.map(d=>{let f=d-1,g=d===b,h=a.has(d);return(0,e.jsxs)("tr",{"data-line":d,className:g?"bg-warning/30":h?"bg-warning/15":"",children:[(0,e.jsx)("td",{className:`pl-3 pr-2 text-right select-none font-mono border-r border-border bg-muted dark:bg-muted/50 sticky left-0 align-top whitespace-nowrap ${g||h?"text-warning-foreground":"text-muted-foreground"}`,children:d}),(0,e.jsx)("td",{className:"px-4 text-foreground align-top",children:(0,e.jsx)("pre",{className:"m-0 whitespace-pre-wrap break-words font-mono",children:(0,e.jsx)("code",{className:"hljs",dangerouslySetInnerHTML:{__html:c[f]??""}})})})]},d)})})})})},V=`/api/worktrees/${c}/files/${aB(d)}?download=1`,W=d?d.split("/").pop()||d:"",X=(a,b=!1)=>(0,e.jsxs)("a",{"data-testid":"download-file-button",href:V,download:W,className:a,"aria-label":A("actions.downloadFile"),title:A("actions.download"),children:[(0,e.jsx)(at,{className:"w-3.5 h-3.5"}),b&&(0,e.jsx)("span",{children:A("actions.download")})]}),Y=()=>(0,e.jsxs)("div",{className:"bg-muted px-3 py-1.5 border-b border-border flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("button",{onClick:N,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.copyFilePath"),title:A("actions.copyPath"),children:r?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:d})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[L&&(0,e.jsx)("button",{onClick:G,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.searchInFile"),title:A("actions.search"),children:(0,e.jsx)(Q.A,{className:"w-3.5 h-3.5"})}),R&&f&&(0,e.jsx)("button",{onClick:S,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.editFile"),title:A("actions.edit"),children:(0,e.jsx)(aw.A,{className:"w-3.5 h-3.5"})}),L&&(0,e.jsx)("button",{"data-testid":"copy-content-button",onClick:M,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":A("actions.copyFileContent"),title:A("actions.copyContent"),children:p?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(ax,{className:"w-3.5 h-3.5"})}),X("p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground"),(0,e.jsx)("button",{onClick:O,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":x?A("actions.exitFullscreen"):A("actions.fullscreen"),title:x?A("actions.exitFullscreen"):A("actions.fullscreen"),children:x?(0,e.jsx)(ay,{className:"w-3.5 h-3.5"}):(0,e.jsx)(az,{className:"w-3.5 h-3.5"})})]})]});return x&&g&&!j&&!m?(0,e.jsxs)("div",{className:"fixed inset-0 bg-surface flex flex-col",style:{zIndex:aA.M.MAXIMIZED_EDITOR},children:[Y(),B&&(0,e.jsx)(aM,{searchInputRef:F,searchQuery:C,searchMatches:D,searchCurrentIdx:E,onQueryChange:K,onPrev:J,onNext:I,onClose:H}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:U()})]}):(0,e.jsx)(n.Jh,{isOpen:a,onClose:b,title:d,size:"xl",children:(0,e.jsxs)("div",{className:"max-h-[60vh] sm:max-h-[70vh] flex flex-col",children:[j&&(0,e.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,e.jsx)(n.y$,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"ml-3 text-muted-foreground",children:A("fileViewer.loading")})]}),m&&(0,e.jsxs)("div",{className:"bg-danger-subtle border border-danger-border rounded-lg p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-danger-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-sm text-danger-foreground",children:m})]}),(0,e.jsx)("div",{className:"mt-3",children:X("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-sm font-medium bg-surface border border-border text-foreground hover:bg-muted transition-colors",!0)})]}),g&&!j&&!m&&(0,e.jsxs)("div",{className:"bg-muted rounded-lg overflow-hidden flex flex-col min-h-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex-shrink-0",children:[Y(),B&&(0,e.jsx)(aM,{searchInputRef:F,searchQuery:C,searchMatches:D,searchCurrentIdx:E,onQueryChange:K,onPrev:J,onNext:I,onClose:H})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:U()})]})]})})});var aQ=c(52120),aR=c(1102),aS=c(10290),aT=c(59581),aU=c(63474);function aV({worktreeId:a}){let[b,c]=(0,h.useState)([]),[d,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(null),[j,l]=(0,h.useState)(!0),[m,o]=(0,h.useState)(null),[q,r]=(0,h.useState)(""),[t,u]=(0,h.useState)(0),[v,w]=(0,h.useState)("all"),[x,y]=(0,h.useState)(!1),{showToast:z}=(0,aU.dj)(),A=(0,k.c)("worktree"),B=(0,h.useMemo)(()=>"all"===v?b:b.filter(a=>a.toLowerCase().includes(v)),[b,v]),C=async b=>{try{l(!0),o(null);let c=await T.y.getLogFile(a,b);i(c.content),f(b),r(""),u(0)}catch(a){o((0,T.hS)(a))}finally{l(!1)}},D=(0,h.useCallback)(async()=>{if(d)try{y(!0);let b=await T.y.getLogFile(a,d,{sanitize:!0});await (0,ar.l)(b.content),z(A("logViewer.copied"),"success")}catch(a){z(A("logViewer.exportError",{error:(0,T.hS)(a)}),"error")}finally{y(!1)}},[a,d,z,A]),E=(0,h.useMemo)(()=>{let a;if(!q||!g)return[];let b=RegExp(p(q),"gi"),c=[];for(;null!==(a=b.exec(g));)c.push({index:a.index,length:a[0].length});return c},[q,g]),F=()=>{E.length>0&&u(a=>(a+1)%E.length)},G=()=>{E.length>0&&u(a=>(a-1+E.length)%E.length)},H=(0,h.useMemo)(()=>{if(!g||!q||0===E.length)return g;let a="",b=0;return E.forEach((c,d)=>{a+=s(g.substring(b,c.index));let e=g.substring(c.index,c.index+c.length),f=d===t;a+=`<mark class="${f?"bg-warning text-black":"bg-warning-border text-black"}" data-match-index="${d}">${s(e)}</mark>`,b=c.index+c.length}),a+=s(g.substring(b))},[g,q,E,t]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)(n.Zp,{padding:"md",children:[(0,e.jsx)(n.aR,{children:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(n.ZB,{children:A("logViewer.title")}),(0,e.jsx)(n.Ex,{variant:"gray",children:B.length})]}),(0,e.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,e.jsx)(n.$n,{variant:"all"===v?"primary":"ghost",size:"sm",onClick:()=>w("all"),children:A("logViewer.all",{count:b.length})}),(0,e.jsx)(n.$n,{variant:"claude"===v?"primary":"ghost",size:"sm",onClick:()=>w("claude"),children:A("logViewer.toolCount",{tool:"Claude",count:b.filter(a=>a.toLowerCase().includes("claude")).length})}),(0,e.jsx)(n.$n,{variant:"codex"===v?"primary":"ghost",size:"sm",onClick:()=>w("codex"),children:A("logViewer.toolCount",{tool:"Codex",count:b.filter(a=>a.toLowerCase().includes("codex")).length})}),(0,e.jsx)(n.$n,{variant:"gemini"===v?"primary":"ghost",size:"sm",onClick:()=>w("gemini"),children:A("logViewer.toolCount",{tool:"Gemini",count:b.filter(a=>a.toLowerCase().includes("gemini")).length})}),(0,e.jsx)(n.$n,{variant:"antigravity"===v?"primary":"ghost",size:"sm",onClick:()=>w("antigravity"),children:A("logViewer.toolCount",{tool:"Antigravity",count:b.filter(a=>a.toLowerCase().includes("antigravity")).length})})]})]})}),(0,e.jsxs)(n.Wu,{children:[j&&0===b.length&&(0,e.jsx)("div",{className:"text-center py-4",children:(0,e.jsx)(n.y$,{size:"lg",variant:"accent",className:"inline-block"})}),m&&(0,e.jsx)("div",{className:"p-3 bg-danger-subtle border border-danger-border rounded text-sm text-danger-foreground",children:m}),!j&&0===B.length&&!m&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:"all"===v?A("logViewer.empty"):A("logViewer.emptyFiltered",{tool:v})}),B.length>0&&(0,e.jsx)("div",{className:"space-y-2",children:B.map(a=>(0,e.jsx)("button",{onClick:()=>C(a),className:`w-full text-left px-3 py-2 rounded text-sm font-mono transition-colors ${d===a?"bg-accent-50 text-accent-700 border border-accent-200":"hover:bg-muted border border-transparent"}`,children:a},a))})]})]}),d&&(0,e.jsxs)(n.Zp,{padding:"md",children:[(0,e.jsx)(n.aR,{children:(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(n.ZB,{className:"font-mono text-base",children:d}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:D,disabled:!d||x,title:A("logViewer.copyTitle"),children:x?A("logViewer.exporting"):A("logViewer.export")}),(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:()=>{f(null),i(null),r(""),u(0)},children:A("actions.close")})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("div",{className:"relative flex-1",children:[(0,e.jsx)(n.pd,{type:"text",value:q,onChange:a=>r(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),a.shiftKey?G():F())},placeholder:A("logViewer.searchPlaceholder"),className:"w-full pr-20"}),E.length>0&&(0,e.jsxs)("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs text-muted-foreground",children:[t+1," / ",E.length]})]}),E.length>0&&(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:G,disabled:0===E.length,title:A("logViewer.prevMatch"),children:"↑"}),(0,e.jsx)(n.$n,{variant:"ghost",size:"sm",onClick:F,disabled:0===E.length,title:A("logViewer.nextMatch"),children:"↓"})]})]})]})}),(0,e.jsxs)(n.Wu,{children:[j&&(0,e.jsx)("div",{className:"text-center py-8",children:(0,e.jsx)(n.y$,{size:"xl",variant:"accent",className:"inline-block"})}),!j&&g&&(0,e.jsx)("div",{className:"bg-[#111827] text-[#f3f4f6] rounded p-4 overflow-x-auto max-h-[500px] scrollbar-thin",children:q&&E.length>0?(0,e.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",dangerouslySetInnerHTML:{__html:H||""}}):(0,e.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap",children:g})}),!j&&q&&0===E.length&&g&&(0,e.jsx)("div",{className:"text-center py-4 text-sm text-muted-foreground",children:A("logViewer.noMatches",{query:q})})]})]})]})}function aW(){let[a,b]=(0,h.useState)(null),[c,d]=(0,h.useState)(!0),[e,f]=(0,h.useState)(null);return{data:a,loading:c,error:e}}var aX=c(94260);function aY({hasUpdate:a,latestVersion:b,releaseUrl:c,updateCommand:d,installType:f}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)("idle"),[l,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(null);(0,h.useRef)(!1);let q="global"===f,r="npx"===f,s=q||r,t=r?"npx commandmate@latest":"commandmate update",u=(0,h.useCallback)(async()=>{j("starting");try{let a=await T.GQ.startUpdate();n(a.logPath),j(a.willRestart?"updating":"no-restart")}catch(a){a instanceof T.hD&&400===a.status?p(g("update.errorNotGlobal")):a instanceof T.hD&&409===a.status?p(g("update.errorInProgress")):p(g("update.errorGeneric")),j("error")}},[g]);return a?(0,e.jsxs)("div",{className:"bg-accent-50 border border-accent-200 rounded-lg p-3 mt-2",role:"status","aria-label":g("update.available"),"data-testid":"update-notification-banner",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800 mb-1",children:g("update.available")}),b&&(0,e.jsx)("p",{className:"text-sm text-accent-700 mb-2",children:g("update.latestVersion",{version:b})}),s&&"idle"===i&&(0,e.jsx)(aX.$,{variant:"primary",size:"sm",className:"mb-2",onClick:()=>j("confirming"),"data-testid":"update-now-button",children:g("update.updateNow")}),r&&"idle"===i&&(0,e.jsx)("p",{className:"text-xs text-accent-600 mb-2","data-testid":"update-npx-notice",children:g("update.npxRestartNotice")}),("starting"===i||"updating"===i)&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-progress",children:[(0,e.jsxs)("p",{className:"flex items-center text-sm text-accent-800",children:[(0,e.jsx)(m.y,{size:"sm",className:"mr-2"}),"starting"===i?g("update.starting"):g("update.updating")]}),"updating"===i&&(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.updatingHint")})]}),"no-restart"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-no-restart",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.noRestartTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.noRestartDescription")})]}),"timeout"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-timeout",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.timeoutTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:g("update.timeoutDescription")}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 mt-1 text-xs text-accent-900 font-mono",children:t})]}),"error"===i&&(0,e.jsxs)("div",{className:"mb-2","data-testid":"update-error",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-accent-800",children:g("update.errorTitle")}),(0,e.jsx)("p",{className:"text-xs text-accent-600 mt-1",children:o}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 mt-1 text-xs text-accent-900 font-mono",children:t})]}),l&&("no-restart"===i||"timeout"===i)&&(0,e.jsx)("p",{className:"text-xs text-accent-500 mb-2","data-testid":"update-log-hint",children:g("update.logHint",{path:l})}),d&&q&&"idle"===i&&(0,e.jsxs)("div",{className:"mb-2",children:[(0,e.jsx)("p",{className:"text-xs text-accent-600 mb-1",children:g("update.updateCommand")}),(0,e.jsx)("code",{className:"block bg-accent-100 rounded px-2 py-1 text-xs text-accent-900 font-mono",children:d})]}),c&&(0,e.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-accent-600 hover:text-accent-800 underline",children:[g("update.viewRelease"),(0,e.jsx)("span",{className:"ml-1","aria-hidden":"true",children:"→"})]}),(0,e.jsx)("p",{className:"text-xs text-accent-500 mt-2",children:g("update.dataPreserved")}),(0,e.jsx)(am.TM,{isOpen:"confirming"===i,title:g("update.confirmTitle"),description:g("update.confirmDescription",{version:b??""}),confirmLabel:g("update.confirmButton"),onConfirm:u,onCancel:()=>j("idle")})]}):null}function aZ({version:a,className:b}){let c=(0,k.c)("worktree"),{data:d,loading:f}=aW(),g=(0,h.useMemo)(()=>d&&d.hasUpdate?{hasUpdate:d.hasUpdate,latestVersion:d.latestVersion,releaseUrl:d.releaseUrl,updateCommand:d.updateCommand,installType:d.installType}:null,[d]);return(0,e.jsxs)("div",{className:b,"data-testid":"version-section",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:c("update.version")}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:a}),f&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1","data-testid":"version-loading",children:"..."}),g&&(0,e.jsx)(aY,{...g})]})}let a$="https://github.com/Kewton/CommandMate",a_=`${a$}/issues`,a0=`${a$}/issues/new`,a1=`${a0}?template=bug_report.md`,a2=`${a0}?template=feature_request.md`,a3=`${a0}?template=question.md`;function a4({className:a}){let b=(0,k.c)("worktree"),c=[{href:a1,label:b("feedback.bugReport")},{href:a2,label:b("feedback.featureRequest")},{href:a3,label:b("feedback.question")},{href:a_,label:b("feedback.viewIssues")}];return(0,e.jsxs)("div",{className:a,"data-testid":"feedback-section",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-2",children:b("feedback.title")}),(0,e.jsx)("div",{className:"flex flex-col gap-1",children:c.map(({href:a,label:b})=>(0,e.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center text-sm text-accent-600 hover:text-accent-800 underline",children:[b,(0,e.jsx)("span",{className:"ml-1","aria-hidden":"true",children:"→"})]},a))})]})}var a5=c(98033),a6=c(67016),a7=c(17252),a8=c(85351);let a9="application/x-commandmate-agent-instance",ba=(0,h.memo)(function({splitIndex:a,cliToolId:b,instanceId:c,instance:d,availableInstances:f,onInstanceChange:g,status:i="idle",onFocus:j,attaching:l=!1,headerExtras:m,terminal:n,footer:p,style:q,onDropInstance:r,draggedInstanceId:s}){let t=(0,k.c)("worktree"),[u,v]=(0,h.useState)(null),w=null!=r,x=(0,h.useCallback)(()=>null==s||f.some(a=>a.id===s)?"allowed":"forbidden",[s,f]),y=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault();let b=x();a.dataTransfer.dropEffect="forbidden"===b?"none":"move",v(a=>a===b?a:b)},[w,x]),z=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault();let b=x();v(a=>a===b?a:b)},[w,x]),A=(0,h.useCallback)(()=>{w&&v(null)},[w]),B=(0,h.useCallback)(a=>{if(!w)return;a.preventDefault(),v(null);let b=a.dataTransfer.getData(a9);b&&r?.(b)},[w,r]),C=(0,h.useCallback)(()=>{window.dispatchEvent(new CustomEvent("terminal-search-open"))},[]),D=(0,h.useCallback)(()=>{j()},[j]),E=`Terminal split ${a+1}`,F=(0,a7.sw)(d??{cliTool:b}),G=t("terminal.selectInstance",{split:E});return(0,e.jsxs)("div",{role:"region","aria-label":E,"data-testid":`terminal-split-pane-${a}`,"data-split-index":a,style:q,className:`flex flex-col min-w-0 h-full rounded-lg overflow-hidden border border-border bg-surface${null===u?" focus-within:ring-1 focus-within:ring-accent-500/30":""}${"allowed"===u?" ring-2 ring-accent-400":"forbidden"===u?" ring-2 ring-red-300 cursor-not-allowed":""}`,onFocusCapture:D,onMouseDown:j,onDragOver:y,onDragEnter:z,onDragLeave:A,onDrop:B,children:[(0,e.jsxs)("div",{className:"px-2 py-1 flex items-center gap-2 bg-surface-2 border-b border-border flex-shrink-0",children:[(0,e.jsxs)(aS.rI,{children:[(0,e.jsxs)(aS.ty,{"data-testid":`cli-selector-${a}`,"aria-label":G,className:"flex items-center gap-1.5 min-w-0 max-w-[12rem] rounded px-1.5 py-0.5 text-xs border border-border bg-surface text-surface-foreground hover:bg-muted focus:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:ring-2 data-[state=open]:ring-ring transition-colors",children:[(0,e.jsx)(o.m,{status:i,size:"sm","aria-hidden":!0,"data-testid":`split-status-indicator-${a}`}),(0,e.jsx)("span",{className:"truncate",children:F}),(0,e.jsx)(a8.A,{size:14,"aria-hidden":"true",className:"flex-shrink-0 opacity-70"})]}),(0,e.jsx)(aS.SQ,{align:"start",className:"min-w-[10rem]",children:(0,e.jsx)(aS.Hr,{value:c,onValueChange:g,children:f.map(a=>(0,e.jsx)(aS.Ht,{value:a.id,children:(0,a7.sw)(a)},a.id))})})]}),m,(0,e.jsx)("button",{type:"button",onClick:C,"aria-label":`Search terminal output for ${E}`,"data-testid":`terminal-search-button-${a}`,className:"ml-auto flex items-center gap-1 px-1.5 py-0.5 text-xs text-muted-foreground hover:text-surface-foreground hover:bg-muted-foreground/10 rounded transition-colors",children:(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]}),(0,e.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[l?(0,e.jsxs)("div",{"data-testid":`terminal-attach-skeleton-${a}`,className:"absolute inset-0 flex items-center justify-center text-xs text-muted-foreground bg-surface-2/80",role:"status","aria-live":"polite",children:["Attaching ",F," session..."]}):null,n]}),(0,e.jsx)("div",{className:"flex-shrink-0 border-t border-border p-2 bg-surface-2",children:p})]})});var bb=c(8509),bc=c(70584),bd=c(24417),be=c(3350),bf=c.n(be),bg=c(19331);let bh=new(c.n(bg)())({fg:"#d1d5db",bg:"#1f2937",newline:!0,escapeXML:!0});function bi(a){let b=a.replace(/\0/g,"");b.length>1048576&&(b=b.slice(0,1048576));let c=bh.toHtml(b);return bf().sanitize(c,{ALLOWED_TAGS:["span","br"],ALLOWED_ATTR:["style"],ALLOW_DATA_ATTR:!1})}let bj=/\x1b(?:\[[0-9;?]*)?$/,bk=/\x1b\[[0-9;]*[a-zA-Z]|\x1b\][^\x07]*\x07|\[[0-9;]*m/g;function bl(a){return""===a.replace(bk,"").trim()}function bm({query:a,onQueryChange:b,matchCount:c,currentIndex:d,onNext:f,onPrev:g,onClose:i,isAtMaxMatches:j=!1}){let k=(0,h.useRef)(null),l=(0,h.useCallback)(a=>{"Escape"===a.key&&i()},[i]),m=(0,h.useCallback)(a=>{b(a.target.value)},[b]),n=0===c?"0/0":j?`${d+1}/500以上`:`${d+1}/${c}`;return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-gray-800 border border-gray-600 rounded shadow-lg",role:"search","aria-label":"ターミナル内テキスト検索",children:[(0,e.jsx)("input",{ref:k,type:"text",value:a,onChange:m,onKeyDown:l,placeholder:"検索...",className:"bg-transparent text-gray-200 text-sm outline-none w-32 sm:w-40 placeholder-gray-500","aria-label":"検索キーワード",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-gray-400 text-xs min-w-[3rem] text-right",children:n}),(0,e.jsx)("button",{onClick:g,disabled:0===c,"aria-label":"前の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,e.jsx)("button",{onClick:f,disabled:0===c,"aria-label":"次の結果",className:"text-gray-300 hover:text-white disabled:text-gray-600 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,e.jsx)("button",{onClick:i,"aria-label":"検索を閉じる",className:"text-gray-400 hover:text-white min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}function bn(){return(0,e.jsxs)("div",{"data-testid":"thinking-indicator",className:"flex items-center gap-2 py-2 px-1 text-gray-400",children:[(0,e.jsxs)("span",{className:"flex gap-1",children:[(0,e.jsx)("span",{className:"animate-pulse delay-0",children:"."}),(0,e.jsx)("span",{className:"animate-pulse delay-150",children:"."}),(0,e.jsx)("span",{className:"animate-pulse delay-300",children:"."})]}),(0,e.jsx)("span",{className:"text-sm",children:"Thinking"})]})}let bo=(0,h.memo)(function({output:a,isActive:b,attaching:c=!1,isThinking:d=!1,autoScroll:f=!0,onScrollChange:g,disableAutoFollow:i=!1,compactTuiLayoutPadding:j=!1,className:k=""}){let{scrollRef:l,autoScroll:m,handleScroll:n,scrollToBottom:o,scrollToTop:p}=function(a={}){let{initialAutoScroll:b=!0,onAutoScrollChange:c}=a,d=(0,h.useRef)(null),[e,f]=(0,h.useState)(b),g=(0,h.useRef)(!1),i=(0,h.useRef)(null),j=(0,h.useCallback)(a=>{f(a),c?.(a)},[c]),k=(0,h.useCallback)(()=>{let a=d.current;if(!a)return!0;let{scrollTop:b,scrollHeight:c,clientHeight:e}=a;return c-e-b<=50},[]),l=(0,h.useCallback)(()=>{if(g.current)return;let a=k();a&&!e?j(!0):!a&&e&&j(!1)},[e,k,j]),m=(0,h.useCallback)(()=>{let a=d.current;a&&(g.current=!0,a.scrollTo({top:a.scrollHeight,behavior:"smooth"}),e||j(!0),i.current=setTimeout(()=>{g.current=!1,i.current=null},500))},[e,j]),n=(0,h.useCallback)(()=>{let a=d.current;a&&(g.current=!0,a.scrollTo({top:0,behavior:"smooth"}),e&&j(!1),i.current=setTimeout(()=>{g.current=!1,i.current=null},500))},[e,j]);return{scrollRef:d,autoScroll:e,setAutoScroll:j,scrollToBottom:m,scrollToTop:n,handleScroll:l}}({initialAutoScroll:f,onAutoScrollChange:g}),q=a??"",r=(0,h.useMemo)(()=>j?function(a){if(""===a)return"";let b=a.split("\n"),c=[],d=!1,e=0;for(;e<b.length;){if(!bl(b[e])){c.push(b[e]),d=!0,e++;continue}let a=e;for(;a<b.length&&bl(b[a]);)a++;let f=a-e,g=!d,h=a>=b.length;if(!g&&!h)if(f<=2)for(let d=e;d<a;d++)c.push(b[d]);else c.push(function(a){let b=a.match(bk);return b?b.join(""):""}(b.slice(e,a).join("")));e=a}return c.join("\n")}(q):q,[j,q]),{isOpen:s,query:t,matchCount:u,currentIndex:v,isAtMaxMatches:w,openSearch:x,closeSearch:y,setQuery:z,nextMatch:A,prevMatch:B}=function({output:a,containerRef:b}){let[c,d]=(0,h.useState)(!1),[e,f]=(0,h.useState)(""),[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(0),[l,m]=(0,h.useState)(!1),n=(0,h.useRef)(null),o=(0,h.useRef)(""),p=g.length,q=(0,h.useCallback)(a=>{if(a.length<2||!b.current)return{positions:[],capped:!1};let c=(b.current.textContent??"").toLowerCase(),d=a.toLowerCase(),e=[],f=0;for(;e.length<500;){let b=c.indexOf(d,f);if(-1===b)break;e.push({start:b,end:b+a.length}),f=b+1}let g=e.length>=500&&-1!==c.indexOf(d,f);return{positions:e,capped:g}},[b]),r=(0,h.useCallback)(a=>{let{positions:c,capped:d}=q(a);if(i(c),k(0),m(d),b.current)if(c.length>0){var e;e=b.current,aH(e,c,0,aC)}else aG(aC)},[q,b]),s=(0,h.useCallback)(a=>{f(a),n.current&&clearTimeout(n.current),o.current=a,n.current=setTimeout(()=>{r(a)},300)},[r]),t=(0,h.useCallback)(()=>{d(!0)},[]),u=(0,h.useCallback)(()=>{d(!1),f(""),o.current="",i([]),k(0),m(!1),n.current&&clearTimeout(n.current),aG(aC)},[]),v=(0,h.useCallback)(()=>{0!==p&&k(a=>{let c=(a+1)%p;return b.current&&g.length>0&&aH(b.current,g,c,aC),c})},[p,g,b]),w=(0,h.useCallback)(()=>{0!==p&&k(a=>{let c=(a-1+p)%p;return b.current&&g.length>0&&aH(b.current,g,c,aC),c})},[p,g,b]);return{isOpen:c,query:e,matchCount:p,currentIndex:j,isAtMaxMatches:l,openSearch:t,closeSearch:u,setQuery:s,nextMatch:v,prevMatch:w}}({output:r,containerRef:l}),C=(0,h.useCallback)(a=>{(a.ctrlKey||a.metaKey)&&"f"===a.key&&(a.preventDefault(),x())},[x]);(0,h.useEffect)(()=>{let a=()=>x();return window.addEventListener("terminal-search-open",a),()=>window.removeEventListener("terminal-search-open",a)},[x]);let[D,E]=(0,h.useState)(()=>r?[{key:0,html:bi(r)}]:[]),F=(0,h.useRef)(r),G=(0,h.useRef)(0);(0,h.useEffect)(()=>{let a=function(a,b){if(a===b)return{mode:"noop",text:b,appended:"",retainedLength:a.length};if(0===a.length||b.length<=a.length||!b.startsWith(a))return{mode:"replace",text:b,appended:"",retainedLength:0};let c=a.match(bj),d=c?a.length-c[0].length:a.length;return{mode:"append",text:b,appended:b.slice(d),retainedLength:d}}(F.current,r);if(F.current=r,"noop"!==a.mode){if("append"===a.mode)return void E(b=>(G.current+=1,b.length>=400)?[{key:G.current,html:bi(r)}]:[...b,{key:G.current,html:bi(a.appended)}]);G.current+=1,E(r?[{key:G.current,html:bi(r)}]:[])}},[r]);let[H,I]=(0,h.useState)(!1);(0,h.useEffect)(()=>{c?I(!1):b&&I(!0)},[c,b]);let J=!a,K=J&&c,L=J&&!c&&!b&&H,M=(0,h.useRef)(!1);(0,h.useEffect)(()=>{i&&(M.current=!0)},[i]),(0,h.useEffect)(()=>{if(l.current){if(M.current&&i&&r){l.current.scrollTo({top:0,behavior:"instant"}),M.current=!1;return}!i&&m&&l.current.scrollTo({top:l.current.scrollHeight,behavior:"instant"})}},[D,r,m,i,l]);let N=(0,h.useMemo)(()=>["terminal","font-mono","text-sm","p-4","rounded-lg","overflow-y-auto","overflow-x-hidden","bg-gray-900","text-gray-300","border","border-gray-700","h-full",b?"active":"",k].filter(Boolean).join(" "),[b,k]),[O,P]=(0,h.useState)(!1),Q=(0,h.useRef)(null),R=(0,h.useCallback)(()=>{P(!0),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>P(!1),1500)},[]);(0,h.useEffect)(()=>()=>{Q.current&&clearTimeout(Q.current)},[]);let S=(0,h.useCallback)(()=>{n(),R()},[n,R]),T=["absolute bottom-4 right-4 flex items-center justify-center h-9 w-9 rounded-full bg-surface/80 backdrop-blur border border-border text-muted-foreground shadow-lg transition-opacity hover:text-surface-foreground hover:opacity-100 focus-visible:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",O?"opacity-100":"opacity-60"].join(" ");return(0,e.jsxs)("div",{className:"relative h-full flex flex-col",children:[s&&(0,e.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,e.jsx)(bm,{query:t,onQueryChange:z,matchCount:u,currentIndex:v,onNext:A,onPrev:B,onClose:y,isAtMaxMatches:w})}),(0,e.jsxs)("div",{ref:l,role:"log","aria-live":"polite","aria-label":"Terminal output",className:N,onScroll:S,onKeyDown:C,tabIndex:0,children:[(0,e.jsx)("div",{className:"whitespace-pre-wrap break-words",children:D.map(a=>(0,e.jsx)("span",{dangerouslySetInnerHTML:{__html:a.html}},a.key))}),K&&(0,e.jsx)("div",{"data-testid":"terminal-loading-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:"読込中..."}),L&&(0,e.jsx)("div",{"data-testid":"terminal-ended-placeholder",className:"flex h-full items-center justify-center px-4 text-center text-sm text-gray-500 select-none",children:"セッションは終了しました(メッセージ送信で再開できます)"}),b&&d&&(0,e.jsx)(bn,{})]}),m?(0,e.jsx)("button",{type:"button",onClick:p,className:T,"aria-label":"Scroll to top",children:(0,e.jsx)(bc.A,{size:16,"aria-hidden":"true"})}):(0,e.jsx)("button",{type:"button",onClick:o,className:T,"aria-label":"Scroll to bottom",children:(0,e.jsx)(bd.A,{size:16,"aria-hidden":"true"})})]})});var bp=c(67619);function bq({worktreeId:a,cliToolId:b,instanceId:c,enabled:d=!0}){let e=c??b,[f,g]=(0,h.useState)(()=>({output:"",realtimeSnippet:"",isRunning:!1,isThinking:!1,isSelectionListActive:!1,isPagerActive:!1,isUnclassifiedActive:!1,attaching:!0,autoScroll:!0})),[i,j]=(0,h.useState)(()=>({visible:!1,data:null,messageId:null,answering:!1})),k=(0,h.useRef)(0),l=(0,h.useRef)(b);l.current=b;let m=(0,h.useRef)(e);m.current=e;let n=(0,h.useRef)(i.visible);n.current=i.visible;let{connected:o,subscribe:p,unsubscribe:q,addListener:r}=(0,bp.xM)();(0,h.useRef)(0);let s=(0,h.useRef)(0),t=(0,h.useRef)(null),u=(0,h.useRef)(null),[v,w]=(0,h.useState)(!1);(0,h.useCallback)(()=>{w(!0),null!==u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{u.current=null,w(!1)},5e3)},[]);let x=(0,h.useCallback)(a=>{let b=a.fullOutput??a.realtimeSnippet??"";!0===a.isUnclassifiedActive&&!0!==a.isPromptWaiting&&!0!==a.isSelectionListActive&&!0!==a.isPagerActive?(s.current+=1,t.current??=Date.now()):(s.current=0,t.current=null);let c=s.current>=2&&null!==t.current&&Date.now()-t.current>=500;g(d=>{let e=!1===a.isRunning,f=!!b||!!a.isRunning||e;return{...d,output:f?b:d.output,realtimeSnippet:a.realtimeSnippet??"",isRunning:a.isRunning??!1,isThinking:a.thinking??!1,isSelectionListActive:a.isSelectionListActive??!1,isPagerActive:a.isPagerActive??!1,isUnclassifiedActive:c,attaching:!1}}),a.isPromptWaiting&&a.promptData?j(b=>({...b,visible:!0,data:a.promptData??b.data,messageId:b.messageId??`prompt-${Date.now()}`})):!a.isPromptWaiting&&n.current&&j({visible:!1,data:null,messageId:null,answering:!1})},[]),y=(0,h.useCallback)(async()=>{let c=++k.current;try{let d=await fetch(`/api/worktrees/${a}/current-output?cliTool=${b}&instance=${encodeURIComponent(e)}`);if(!d.ok)return;let f=await d.json();if(k.current!==c||l.current!==b||m.current!==e||f.cliToolId&&f.cliToolId!==b)return;x(f)}catch(a){if(k.current!==c||l.current!==b||m.current!==e)return;console.error("[useTerminalPanePolling] fetch error:",a)}},[a,b,e,x]),z=`${a}::${b}::${e}`;(0,h.useRef)(z);let A=(0,h.useCallback)(a=>{g(b=>b.autoScroll===a?b:{...b,autoScroll:a})},[]),B=(0,h.useCallback)(a=>{j(b=>({...b,answering:a}))},[]);return{terminal:f,prompt:i,setAutoScroll:A,setPromptAnswering:B,clearPrompt:(0,h.useCallback)(()=>{j({visible:!1,data:null,messageId:null,answering:!1})},[]),refresh:(0,h.useCallback)(()=>y(),[y])}}var br=c(23312);function bs(a,b,c){let d,e=c.initialDeps??[],f=!0;function g(){let g=a();return g.length!==e.length||g.some((a,b)=>e[b]!==a)?(e=g,d=b(...g),(null==c?void 0:c.onChange)&&!(f&&c.skipInitialOnChange)&&c.onChange(d),f=!1,d):d}return g.updateDeps=a=>{e=a},g}function bt(a,b){if(void 0!==a)return a;throw Error(`Unexpected undefined${b?`: ${b}`:""}`)}let bu=(a,b)=>1.01>Math.abs(a-b),bv=()=>{if(void 0!==d)return d;if("undefined"==typeof navigator)return d=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return d=!0;let a=navigator.maxTouchPoints;return d="MacIntel"===navigator.platform&&void 0!==a&&a>0},bw=a=>{let{offsetWidth:b,offsetHeight:c}=a;return{width:b,height:c}},bx=a=>a,by=a=>{let b=Math.max(a.startIndex-a.overscan,0),c=Math.min(a.endIndex+a.overscan,a.count-1)-b+1,d=Array(c);for(let a=0;a<c;a++)d[a]=b+a;return d},bz=(a,b)=>{let c=a.scrollElement;if(!c)return;let d=a.targetWindow;if(!d)return;let e=a=>{let{width:c,height:d}=a;b({width:Math.round(c),height:Math.round(d)})};if(e(bw(c)),!d.ResizeObserver)return()=>{};let f=new d.ResizeObserver(b=>{let d=()=>{let a=b[0];if(null==a?void 0:a.borderBoxSize){let b=a.borderBoxSize[0];if(b)return void e({width:b.inlineSize,height:b.blockSize})}e(bw(c))};a.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return f.observe(c,{box:"border-box"}),()=>{f.unobserve(c)}},bA={passive:!0},bB="undefined"==typeof window||"onscrollend"in window,bC=(a,b)=>((a,b,c)=>{let d=a.scrollElement;if(!d)return;let e=a.targetWindow;if(!e)return;let f=a.options.useScrollendEvent&&bB,g=0,h=f?null:((a,b,c)=>{let d;return function(...e){a.clearTimeout(d),d=a.setTimeout(()=>b.apply(this,e),c)}})(e,()=>b(g,!1),a.options.isScrollingResetDelay),i=a=>()=>{g=c(d),null==h||h(),b(g,a)},j=i(!0),k=i(!1);return d.addEventListener("scroll",j,bA),f&&d.addEventListener("scrollend",k,bA),()=>{d.removeEventListener("scroll",j),f&&d.removeEventListener("scrollend",k)}})(a,b,b=>{let{horizontal:c,isRtl:d}=a.options;return c?b.scrollLeft*(d&&-1||1):b.scrollTop}),bD=(a,b,c)=>{if(null==b?void 0:b.borderBoxSize){let a=b.borderBoxSize[0];if(a)return Math.round(a[c.options.horizontal?"inlineSize":"blockSize"])}return a[c.options.horizontal?"offsetWidth":"offsetHeight"]},bE=(a,{adjustments:b=0,behavior:c},d)=>{var e,f;null==(f=null==(e=d.scrollElement)?void 0:e.scrollTo)||f.call(e,{[d.options.horizontal?"left":"top"]:a+b,behavior:c})};class bF{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var a,b,c;return(null==(c=null==(b=null==(a=this.targetWindow)?void 0:a.performance)?void 0:b.now)?void 0:c.call(b))??Date.now()},this.observer=(()=>{let a=null,b=()=>a||(this.targetWindow&&this.targetWindow.ResizeObserver?a=new this.targetWindow.ResizeObserver(a=>{a.forEach(a=>{let b=()=>{let b=a.target,c=this.indexFromElement(b);if(!b.isConnected){for(let[a,c]of(this.observer.unobserve(b),this.elementsCache))if(c===b){this.elementsCache.delete(a);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(b,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(b):b()})}):null);return{disconnect:()=>{var c;null==(c=b())||c.disconnect(),a=null},observe:a=>{var c;return null==(c=b())?void 0:c.observe(a,{box:"border-box"})},unobserve:a=>{var c;return null==(c=b())?void 0:c.unobserve(a)}}})(),this.range=null,this.setOptions=a=>{var b,c;let d={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:bx,rangeExtractor:by,onChange:()=>{},measureElement:bD,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(let b in a){let c=a[b];void 0!==c&&(d[b]=c)}let e=this.options,f=null,g=null;if(void 0!==e&&e.enabled&&d.enabled&&"end"===d.anchorTo&&null!==this.scrollElement){let a=e.count,h=d.count,i=this.getMeasurements(),j=a>0?(null==(b=i[0])?void 0:b.key)??e.getItemKey(0):null,k=a>0?(null==(c=i[a-1])?void 0:c.key)??e.getItemKey(a-1):null;if(h!==a||a>0&&h>0&&(d.getItemKey(0)!==j||d.getItemKey(h-1)!==k)){let b=a>0?this.getVirtualItemForOffset(this.getScrollOffset())??i[0]:null;b&&(f=[b.key,this.getScrollOffset()-b.start]);let c=!0===d.followOnAppend?"auto":d.followOnAppend||null;c&&h>a&&this.isAtEnd(e.scrollEndThreshold)&&(0===a||d.getItemKey(h-1)!==k)&&(g=c)}}this.options=d,(f||g)&&(this.pendingScrollAnchor=[(null==f?void 0:f[0])??null,(null==f?void 0:f[1])??0,g])},this.notify=a=>{var b,c;null==(c=(b=this.options).onChange)||c.call(b,this,a)},this.maybeNotify=bs(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),a=>{this.notify(a)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(a=>a()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var a;let b=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==b){if(this.cleanup(),!b)return void this.maybeNotify();if(this.scrollElement=b,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(a=this.scrollElement)?void 0:a.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,b)=>{null!==this._intendedScrollOffset&&1.5>Math.abs(a-this._intendedScrollOffset)&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=b?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=b,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let a=this.scrollElement,b=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},c=()=>{this._iosTouching=!1,bv()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",b,bA),a.addEventListener("touchend",c,bA),this.unsubs.push(()=>{a.removeEventListener("touchstart",b),a.removeEventListener("touchend",c),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let c=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,c&&this.scrollElement&&this.options.enabled){let[a,b,d]=c;if(null!==a){let{count:c,getItemKey:d}=this.options,e=0;for(;e<c&&d(e)!==a;)e++;let f=e<c?this.getMeasurements()[e]:void 0;if(f){let a=f.start+b-this.getScrollOffset();bu(a,0)||this.applyScrollAdjustment(a)}}d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let a=this.getScrollOffset(),b=this.getMaxScrollOffset();if(a<0||a>b)return;let c=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(a,{adjustments:this.scrollAdjustments+=c,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(a,b)=>{let c=new Map,d=new Map;for(let e=b-1;e>=0;e--){let b=a[e];if(c.has(b.lane))continue;let f=d.get(b.lane);if(null==f||b.end>f.end?d.set(b.lane,b):b.end<f.end&&c.set(b.lane,!0),c.size===this.options.lanes)break}return d.size===this.options.lanes?Array.from(d.values()).sort((a,b)=>a.end===b.end?a.index-b.index:a.end-b.end)[0]:void 0},this.getMeasurementOptions=bs(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(a,b,c,d,e,f,g)=>(void 0!==this.prevLanes&&this.prevLanes!==f&&(this.lanesChangedFlag=!0),this.prevLanes=f,this.pendingMin=null,{count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f,laneAssignmentMode:g}),{key:!1}),this.getMeasurements=bs(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:a,paddingStart:b,scrollMargin:c,getItemKey:d,enabled:e,lanes:f,laneAssignmentMode:g},h)=>{let i=this.itemSizeCache;if(!e)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>a)for(let b of this.laneAssignments.keys())b>=a&&this.laneAssignments.delete(b);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));let j=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===a&&(this.lanesSettling=!1),1===f){let e,f=this.options.gap,g=2*a,h=this._flatMeasurements;if(!h||h.length<g){let a=new Float64Array(g);h&&j>0&&a.set(h.subarray(0,2*j)),h=a,this._flatMeasurements=h}if(0===j)e=b+c;else{let a=j-1;e=h[2*a]+h[2*a+1]+f}for(let b=j;b<a;b++){let a=d(b),c=i.get(a),g="number"==typeof c?c:this.options.estimateSize(b);h[2*b]=e,h[2*b+1]=g,e+=g+f}let k=function(a,b,c){return new Proxy(Array(a),{get(d,e,f){if("string"==typeof e){let f=e.charCodeAt(0);if(f>=48&&f<=57){let f=+e;if(Number.isInteger(f)&&f>=0&&f<a){let a=d[f];if(!a){let e=b[2*f];a=d[f]={index:f,key:c(f),start:e,size:b[2*f+1],end:e+b[2*f+1],lane:0}}return a}}if("length"===e)return a}return Reflect.get(d,e,f)}})}(a,h,d);return this.measurementsCache=k,k}let k=this.measurementsCache.slice(0,j),l=Array(f).fill(void 0);for(let a=0;a<j;a++){let b=k[a];b&&(l[b.lane]=a)}for(let e=j;e<a;e++){let a,f,h=d(e),j=this.laneAssignments.get(e),m="estimate"===g||i.has(h);if(void 0!==j&&this.options.lanes>1){let d=l[a=j],e=void 0!==d?k[d]:void 0;f=e?e.end+this.options.gap:b+c}else{let d=1===this.options.lanes?k[e-1]:this.getFurthestMeasurement(k,e);f=d?d.end+this.options.gap:b+c,a=d?d.lane:e%this.options.lanes,this.options.lanes>1&&m&&this.laneAssignments.set(e,a)}let n=i.get(h),o="number"==typeof n?n:this.options.estimateSize(e),p=f+o;k[e]={index:e,start:f,size:o,end:p,key:h,lane:a},l[a]=e}return this.measurementsCache=k,k},{key:!1,debug:()=>this.options.debug}),this.calculateRange=bs(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(a,b,c,d)=>this.range=a.length>0&&b>0?function({measurements:a,outerSize:b,scrollOffset:c,lanes:d,flat:e}){let f=a.length-1,g=e?a=>e[2*a]:b=>a[b].start,h=e?a=>e[2*a]+e[2*a+1]:b=>a[b].end;if(a.length<=d)return{startIndex:0,endIndex:f};let i=bG(0,f,g,c),j=i;if(1===d)for(;j<f&&h(j)<c+b;)j++;else if(d>1){let e=Array(d).fill(0);for(;j<f&&e.some(a=>a<c+b);){let b=a[j];e[b.lane]=b.end,j++}let g=Array(d).fill(c+b);for(;i>=0&&g.some(a=>a>=c);){let b=a[i];g[b.lane]=b.start,i--}i=Math.max(0,i-i%d),j=Math.min(f,j+(d-1-j%d))}return{startIndex:i,endIndex:j}}({measurements:a,outerSize:b,scrollOffset:c,lanes:d,flat:1===d&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=bs(()=>{let a=null,b=null,c=this.calculateRange();return c&&(a=c.startIndex,b=c.endIndex),this.maybeNotify.updateDeps([this.isScrolling,a,b]),[this.options.rangeExtractor,this.options.overscan,this.options.count,a,b]},(a,b,c,d,e)=>null===d||null===e?[]:a({startIndex:d,endIndex:e,overscan:b,count:c}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=a=>{let b=this.options.indexAttribute,c=a.getAttribute(b);return c?parseInt(c,10):(console.warn(`Missing attribute name '${b}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=a=>{var b;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let c=this.scrollState.index??(null==(b=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:b.index);if(void 0!==c&&this.range){let b=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),d=Math.max(0,c-b),e=Math.min(this.options.count-1,c+b);return a>=d&&a<=e}return!0},this.measureElement=a=>{if(!a)return void this.elementsCache.forEach((a,b)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(b))});let b=this.indexFromElement(a),c=this.options.getItemKey(b),d=this.elementsCache.get(c);d!==a&&(d&&this.observer.unobserve(d),this.observer.observe(a),this.elementsCache.set(c,a)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(b)&&this.resizeItem(b,this.options.measureElement(a,void 0,this))},this.resizeItem=(a,b)=>{var c,d;let e,f,g;if(a<0||a>=this.options.count)return;let h=this._flatMeasurements;if(1===this.options.lanes&&null!==h)g=this.options.getItemKey(a),f=h[2*a],e=h[2*a+1];else{let b=this.measurementsCache[a];if(!b)return;g=b.key,f=b.start,e=b.size}let i=b-(this.itemSizeCache.get(g)??e);if(0!==i){let h="end"===this.options.anchorTo&&(null==(c=this.scrollState)?void 0:c.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,j=h?this.getTotalSize():0,k=(null==(d=this.scrollState)?void 0:d.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[a]??{index:a,key:g,start:f,size:e,end:f+e,lane:0},i,this):f<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection);(null===this.pendingMin||a<this.pendingMin)&&(this.pendingMin=a),this.itemSizeCache.set(g,b),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-j):k&&this.applyScrollAdjustment(i),this.notify(!1)}},this.getVirtualItems=bs(()=>[this.getVirtualIndexes(),this.getMeasurements()],(a,b)=>{let c=[];for(let d=0,e=a.length;d<e;d++){let e=b[a[d]];c.push(e)}return c},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=a=>{let b=this.getMeasurements();if(0===b.length)return;let c=this._flatMeasurements,d=1===this.options.lanes&&null!=c,e=bG(0,b.length-1,d?a=>c[2*a]:a=>bt(b[a]).start,a);return bt(b[e])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let a=this.scrollElement.document.documentElement;return this.options.horizontal?a.scrollWidth-this.scrollElement.innerWidth:a.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(a=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=a,this.getOffsetForAlignment=(a,b,c=0)=>{if(!this.scrollElement)return 0;let d=this.getSize(),e=this.getScrollOffset();return"auto"===b&&(b=a>=e+d?"end":"start"),"center"===b?a+=(c-d)/2:"end"===b&&(a-=d),Math.max(Math.min(this.getMaxScrollOffset(),a),0)},this.getOffsetForIndex=(a,b="auto")=>{a=Math.max(0,Math.min(a,this.options.count-1));let c=this.getSize(),d=this.getScrollOffset(),e=this.measurementsCache[a];if(!e)return;if("auto"===b)if(e.end>=d+c-this.options.scrollPaddingEnd)b="end";else{if(!(e.start<=d+this.options.scrollPaddingStart))return[d,b];b="start"}if("end"===b&&a===this.options.count-1)return[this.getMaxScrollOffset(),b];let f="end"===b?e.end+this.options.scrollPaddingEnd:e.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(f,b,e.size),b]},this.scrollToOffset=(a,{align:b="start",behavior:c="auto"}={})=>{let d=this.getOffsetForAlignment(a,b),e=this.now();this.scrollState={index:null,align:b,behavior:c,startedAt:e,lastTargetOffset:d,stableFrames:0},this._scrollToOffset(d,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollToIndex=(a,{align:b="auto",behavior:c="auto"}={})=>{a=Math.max(0,Math.min(a,this.options.count-1));let d=this.getOffsetForIndex(a,b);if(!d)return;let[e,f]=d,g=this.now();this.scrollState={index:a,align:f,behavior:c,startedAt:g,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:c}),this.scheduleScrollReconcile()},this.scrollBy=(a,{behavior:b="auto"}={})=>{let c=this.getScrollOffset()+a,d=this.now();this.scrollState={index:null,align:"start",behavior:b,startedAt:d,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:b}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:a="auto"}={})=>{if(this.options.count>0)return void this.scrollToIndex(this.options.count-1,{align:"end",behavior:a});this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:a})},this.getTotalSize=()=>{var a;let b,c=this.getMeasurements();if(0===c.length)b=this.options.paddingStart;else if(1===this.options.lanes){let d=c.length-1,e=this._flatMeasurements;b=null!=e?e[2*d]+e[2*d+1]:(null==(a=c[d])?void 0:a.end)??0}else{let a=Array(this.options.lanes).fill(null),d=c.length-1;for(;d>=0&&a.some(a=>null===a);){let b=c[d];null===a[b.lane]&&(a[b.lane]=b.end),d--}b=Math.max(...a.filter(a=>null!==a))}return Math.max(b-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let a=[];if(0===this.itemSizeCache.size)return a;for(let b of this.getMeasurements())b&&this.itemSizeCache.has(b.key)&&a.push({index:b.index,key:b.key,start:b.start,size:b.size,end:b.end,lane:b.lane});return a},this._scrollToOffset=(a,{adjustments:b,behavior:c})=>{this._intendedScrollOffset=a+(b??0),this.options.scrollToFn(a,{behavior:c,adjustments:b},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,b){0!==a&&(bv()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=a:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:b}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let a=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,b=a?a[0]:this.scrollState.lastTargetOffset,c=b!==this.scrollState.lastTargetOffset;if(!c&&bu(b,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==b&&this._scrollToOffset(b,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){let a=this.getSize()||600,c=Math.abs(b-this.getScrollOffset()),d="smooth"===this.scrollState.behavior&&c>a;this.scrollState.lastTargetOffset=b,d||(this.scrollState.behavior="auto"),this._scrollToOffset(b,{adjustments:void 0,behavior:d?"smooth":"auto"})}this.scheduleScrollReconcile()}}let bG=(a,b,c,d)=>{for(;a<=b;){let e=(a+b)/2|0,f=c(e);if(f<d)a=e+1;else{if(!(f>d))return e;b=e-1}}return a>0?a-1:0},bH="undefined"!=typeof document?h.useLayoutEffect:h.useEffect;function bI(a){return function({useFlushSync:a=!0,...b}){let c=h.useReducer(a=>a+1,0)[1],d={...b,onChange:(d,e)=>{var f;a&&e?(0,br.flushSync)(c):c(),null==(f=b.onChange)||f.call(b,d,e)}},[e]=h.useState(()=>new bF(d));return e.setOptions(d),bH(()=>e._didMount(),[]),bH(()=>e._willUpdate()),e}({observeElementRect:bz,observeElementOffset:bC,scrollToFn:bE,...a})}let bJ=(0,x.A)("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),bK=(0,x.A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),bL=(0,x.A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),bM=(0,x.A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),bN=(0,x.A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),bO=(0,x.A)("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"}]]),bP=(0,x.A)("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"}]]);var bQ=c(55992);let bR={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}};var bS=c(82734);let bT={date:(0,bS.k)({formats:{full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},defaultWidth:"full"}),time:(0,bS.k)({formats:{full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},defaultWidth:"full"}),dateTime:(0,bS.k)({formats:{full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},defaultWidth:"full"})},bU={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"};var bV=c(78116);let bW={ordinalNumber:(a,b)=>{let c=Number(a);switch(String(b?.unit)){case"year":return`${c}年`;case"quarter":return`第${c}四半期`;case"month":return`${c}月`;case"week":return`第${c}週`;case"date":return`${c}日`;case"hour":return`${c}時`;case"minute":return`${c}分`;case"second":return`${c}秒`;default:return`${c}`}},era:(0,bV.o)({values:{narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},defaultWidth:"wide"}),quarter:(0,bV.o)({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},defaultWidth:"wide",argumentCallback:a=>Number(a)-1}),month:(0,bV.o)({values:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},defaultWidth:"wide"}),day:(0,bV.o)({values:{narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},defaultWidth:"wide"}),dayPeriod:(0,bV.o)({values:{narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},defaultWidth:"wide",formattingValues:{narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},defaultFormattingWidth:"wide"})};var bX=c(53854),bY=c(98882);let bZ={code:"ja",formatDistance:(a,b,c)=>{let d;c=c||{};let e=bR[a];if(d="string"==typeof e?e:1===b?c.addSuffix&&e.oneWithSuffix?e.oneWithSuffix:e.one:c.addSuffix&&e.otherWithSuffix?e.otherWithSuffix.replace("{{count}}",String(b)):e.other.replace("{{count}}",String(b)),c.addSuffix)if(c.comparison&&c.comparison>0)return d+"後";else return d+"前";return d},formatLong:bT,formatRelative:(a,b,c,d)=>bU[a],localize:bW,match:{ordinalNumber:(0,bX.K)({matchPattern:/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,parsePattern:/\d+/i,valueCallback:function(a){return parseInt(a,10)}}),era:(0,bY.A)({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},defaultParseWidth:"any"}),quarter:(0,bY.A)({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},defaultMatchWidth:"wide",parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:"any",valueCallback:a=>a+1}),month:(0,bY.A)({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:"any"}),day:(0,bY.A)({matchPatterns:{narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},defaultMatchWidth:"wide",parsePatterns:{any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},defaultParseWidth:"any"}),dayPeriod:(0,bY.A)({matchPatterns:{any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};var b$=c(16620);let b_={en:b$.c,ja:bZ};function b0(a){return b_[a]??b$.c}var b1=c(54228);let b2=/(\/[^\s\n<>"']+\.[a-zA-Z0-9]+)/g;function b3(a){let b=a.split("\n");if(b.length<=2&&a.length<=100)return{text:a,isTruncated:!1};let c=b.slice(0,2).join("\n");return c.length>100&&(c=c.slice(0,100)),{text:c,isTruncated:!0}}let b4=(0,h.memo)(function({content:a,onFilePathClick:b}){let c=(0,k.c)("worktree"),d=(0,h.useMemo)(()=>(function(a){let b=a.match(b2);if(!b||0===b.length)return[{type:"text",content:a}];let c=[],d=0;return b.forEach(b=>{let e=a.indexOf(b,d);e>d&&c.push({type:"text",content:a.slice(d,e)}),c.push({type:"path",content:b}),d=e+b.length}),d<a.length&&c.push({type:"text",content:a.slice(d)}),c})(a),[a]),f=(0,h.useCallback)(a=>()=>b(a),[b]);return(0,e.jsx)("span",{children:d.map((a,b)=>"path"===a.type?(0,e.jsx)("button",{type:"button",onClick:f(a.content),className:"text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:underline cursor-pointer font-mono text-sm","aria-label":c("conversation.openFile",{path:a.content}),children:a.content},b):(0,e.jsx)("span",{children:a.content},b))})});function b5(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{"data-testid":"pending-indicator",className:"flex items-center gap-2 text-muted-foreground py-2",children:[(0,e.jsxs)("div",{className:"flex gap-1","aria-hidden":"true",children:[(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse"}),(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"150ms"}}),(0,e.jsx)("span",{className:"w-2 h-2 bg-muted-foreground rounded-full animate-pulse",style:{animationDelay:"300ms"}})]}),(0,e.jsx)("span",{className:"text-sm",children:a("conversation.waitingForResponse")})]})}let b6=(0,h.memo)(function({message:a,onFilePathClick:b,onCopy:c,onInsertToMessage:d,onRetryPending:f,onDiscardPending:g}){let h=(0,bQ.Ym)(),i=(0,k.c)("worktree"),j=(0,k.c)("common"),l=b0(h),m=(0,b1.bg)(a.timestamp,l),n=a.optimisticState,o=["group relative border-l-2 p-3 transition-opacity","error"===n?"border-danger-border bg-danger-subtle":"border-accent-500 bg-accent-500/10","sending"===n?"opacity-70":""].filter(Boolean).join(" ");return(0,e.jsxs)("div",{className:o,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-accent-700 dark:text-accent-400",children:i("conversation.you")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),"sending"===n&&(0,e.jsxs)("span",{"data-testid":"optimistic-sending",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)(bM,{size:12,className:"animate-spin","aria-hidden":"true"}),(0,e.jsx)("span",{children:i("conversation.sending")})]}),"error"===n&&(0,e.jsxs)("span",{"data-testid":"optimistic-error",className:"flex items-center gap-1 text-xs text-danger-foreground",children:[(0,e.jsx)(bN,{size:12,"aria-hidden":"true"}),(0,e.jsx)("span",{children:i("conversation.failedToSend")})]}),"error"===n?(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[f&&(0,e.jsxs)("button",{type:"button","data-testid":"pending-retry",onClick:()=>f(a.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:bg-muted transition-colors","aria-label":i("conversation.retrySending"),title:j("retry"),children:[(0,e.jsx)(bO,{size:12,"aria-hidden":"true"}),j("retry")]}),g&&(0,e.jsxs)("button",{type:"button","data-testid":"pending-discard",onClick:()=>g(a.id),className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:text-danger-foreground hover:bg-muted transition-colors","aria-label":i("conversation.discardMessage"),title:i("conversation.discard"),children:[(0,e.jsx)(as.A,{size:12,"aria-hidden":"true"}),i("conversation.discard")]})]}):(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[d&&(0,e.jsx)("button",{type:"button","data-testid":"insert-user-message",onClick:()=>d(a.content),className:"p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 hover:bg-muted rounded transition-colors","aria-label":i("conversation.insertToMessage"),title:i("conversation.insertToMessage"),children:(0,e.jsx)(bP,{size:14,"aria-hidden":"true"})}),c&&(0,e.jsx)("button",{type:"button","data-testid":"copy-user-message",onClick:()=>c(a.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":i("conversation.copyMessage"),title:i("conversation.copy"),children:(0,e.jsx)(ax,{size:14,"aria-hidden":"true"})})]})]}),(0,e.jsx)("div",{"data-message-id":a.id,className:"text-sm text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:(0,e.jsx)(b4,{content:a.content,onFilePathClick:b})})]})}),b7=(0,h.memo)(function({message:a,index:b,total:c,isExpanded:d,onFilePathClick:f,onCopy:g,hasLongContent:i=!1,onToggleExpand:j}){let l=(0,bQ.Ym)(),m=(0,k.c)("worktree"),n=b0(l),o=(0,b1.bg)(a.timestamp,n),{text:p,isTruncated:q}=(0,h.useMemo)(()=>b3(a.content),[a.content]),r=d||!q?a.content:p;return(0,e.jsxs)("div",{className:"assistant-message-item group relative",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:m("conversation.assistant")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),c>1&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",b+1,"/",c,")"]}),(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 [@media(hover:none)]:opacity-100",children:[0===b&&i&&!!j&&(0,e.jsxs)("button",{type:"button",onClick:j,className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-xs text-accent-700 dark:text-accent-400 hover:text-accent-600 dark:hover:text-accent-300 hover:bg-muted transition-colors","aria-expanded":d,"aria-label":m(d?"conversation.collapseMessage":"conversation.expandMessage"),children:[(0,e.jsx)(a8.A,{size:12,className:`transition-transform ${d?"rotate-180":""}`,"aria-hidden":"true"}),m(d?"conversation.collapse":"conversation.expand")]}),g&&(0,e.jsx)("button",{type:"button","data-testid":"copy-assistant-message",onClick:()=>g(a.content),className:"p-1 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors","aria-label":m("conversation.copyMessage"),title:m("conversation.copy"),children:(0,e.jsx)(ax,{size:14,"aria-hidden":"true"})})]})]}),(0,e.jsxs)("div",{"data-message-id":a.id,className:"text-xs text-foreground whitespace-pre-wrap break-words [word-break:break-word] max-w-full overflow-x-hidden",children:[(0,e.jsx)(b4,{content:r,onFilePathClick:f}),!d&&q&&(0,e.jsx)("span",{className:"text-muted-foreground",children:"..."})]})]})}),b8=(0,h.memo)(function({messages:a,isExpanded:b,onFilePathClick:c,onCopy:d,hasLongContent:f=!1,onToggleExpand:g}){return(0,e.jsx)("div",{className:"bg-surface-2/50 border-l-2 border-border p-2 border-t border-border space-y-2",children:a.map((h,j)=>(0,e.jsxs)(i().Fragment,{children:[j>0&&(0,e.jsx)("div",{"data-testid":"assistant-message-divider",className:"border-t border-dashed border-border"}),(0,e.jsx)(b7,{message:h,index:j,total:a.length,isExpanded:b,onFilePathClick:c,onCopy:d,hasLongContent:f,onToggleExpand:g})]},h.id))})});function b9(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{"data-testid":"orphan-indicator",className:"bg-warning/10 text-warning-foreground text-xs px-3 py-1 flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("span",{children:a("conversation.systemMessage")})]})}let ca=(0,h.memo)(function({pair:a,onFilePathClick:b,isExpanded:c=!1,onToggleExpand:d,onCopy:f,onInsertToMessage:g,showAssistant:i=!0,onRetryPending:j,onDiscardPending:l}){let m=(0,k.c)("worktree"),n=a.userMessage?.optimisticState!==void 0,o=(0,h.useMemo)(()=>a.assistantMessages.some(a=>{let{isTruncated:b}=b3(a.content);return b}),[a.assistantMessages]),p=(0,h.useCallback)(()=>{d&&d()},[d]),q=(0,h.useMemo)(()=>{let b="pending"===a.status?"pending":"orphan"===a.status?"orphan border-l-4 border-warning":"";return`border border-border rounded-lg overflow-hidden mb-4 transition-colors ${b}`.trim()},[a.status]),r=a.userMessage?m("conversation.conversationLabel",{preview:`${a.userMessage.content.substring(0,50)}${a.userMessage.content.length>50?"...":""}`}):m("conversation.systemMessageLabel");return(0,e.jsxs)("div",{"data-testid":"conversation-pair-card",role:"article","aria-label":r,className:q,children:["orphan"===a.status&&(0,e.jsx)(b9,{}),a.userMessage&&(0,e.jsx)(b6,{message:a.userMessage,onFilePathClick:b,onCopy:f,onInsertToMessage:g,onRetryPending:j,onDiscardPending:l}),"pending"!==a.status||n?i&&a.assistantMessages.length>0?(0,e.jsx)(b8,{messages:a.assistantMessages,isExpanded:c,onFilePathClick:b,onCopy:f,hasLongContent:o,onToggleExpand:p}):null:(0,e.jsx)("div",{className:"bg-muted/40 border-l-2 border-border p-3 border-t border-border",children:(0,e.jsx)(b5,{})})]})});function cb({query:a,onQueryChange:b,matchCount:c,currentIndex:d,onNext:f,onPrev:g,onClose:i,isAtMaxMatches:j,onCompositionStart:l,onCompositionEnd:m}){let n=(0,h.useRef)(null),o=(0,k.c)("worktree"),p=(0,h.useCallback)(a=>{"Escape"===a.key&&i()},[i]),q=(0,h.useCallback)(a=>{b(a.target.value)},[b]),r=0===c?"0/0":j?o("history.search.countAtMax",{current:d+1,max:500}):`${d+1}/${c}`;return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border border-border rounded shadow-lg",role:"search","aria-label":o("history.search.regionLabel"),children:[(0,e.jsx)("input",{ref:n,type:"text",value:a,onChange:q,onKeyDown:p,onCompositionStart:l,onCompositionEnd:m,placeholder:o("history.search.placeholder"),className:"bg-transparent text-foreground text-sm outline-none w-32 sm:w-40 placeholder-muted-foreground","aria-label":o("history.search.keywordLabel"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"text-muted-foreground text-xs min-w-[3rem] text-right",children:r}),(0,e.jsx)("button",{type:"button",onClick:g,disabled:0===c,"aria-label":o("history.search.prev"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▲"}),(0,e.jsx)("button",{type:"button",onClick:f,disabled:0===c,"aria-label":o("history.search.next"),className:"text-muted-foreground hover:text-foreground disabled:opacity-40 min-w-[36px] min-h-[36px] flex items-center justify-center text-base",children:"▼"}),(0,e.jsx)("button",{type:"button",onClick:i,"aria-label":o("history.search.close"),className:"text-muted-foreground hover:text-foreground min-w-[36px] min-h-[36px] flex items-center justify-center text-base ml-1",children:"✕"})]})}function cc(){let[a,b]=(0,h.useState)(!0),[c,d]=(0,h.useState)(40),e=(0,h.useRef)(a);e.current=a;let f=(0,h.useRef)(c);return f.current=c,{visible:a,width:c,toggle:(0,h.useCallback)(()=>{let a=!e.current;b(a),f.current},[]),setWidth:(0,h.useCallback)(a=>{let b=Number.isFinite(a)?Math.min(60,Math.max(10,a)):40;d(b),e.current},[])}}let cd=["relative","flex-shrink-0","bg-border","transition-colors","duration-150","hover:bg-accent-500","dark:hover:bg-accent-500","focus:outline-none","focus:ring-2","focus:ring-ring","focus:ring-offset-2","focus:ring-offset-background"],ce=["w-1","h-full","cursor-col-resize","before:content-['']","before:absolute","before:inset-y-0","before:-inset-x-1"],cf=["h-1","w-full","cursor-row-resize","before:content-['']","before:absolute","before:inset-x-0","before:-inset-y-1"];function cg(a,b){return"touches"in a&&a.touches.length>0?b?a.touches[0].clientX:a.touches[0].clientY:"clientX"in a?b?a.clientX:a.clientY:0}let ch=(0,h.memo)(function({onResize:a,orientation:b="horizontal",ariaValueNow:c=50,onDoubleClick:d,minRatio:f=.1}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)(!1),l=(0,h.useRef)(0),m=(0,h.useRef)(null),n="horizontal"===b,o=(0,h.useCallback)(a=>{a.preventDefault(),j(!0),l.current=cg(a,n)},[n]),p=(0,h.useCallback)(a=>{1===a.touches.length&&(j(!0),l.current=cg(a,n))},[n]),q=(0,h.useCallback)(b=>{if(!i)return;let c=cg(b,n);a(c-l.current),l.current=c},[i,n,a]),r=(0,h.useCallback)(b=>{if(!i||1!==b.touches.length)return;let c=cg(b,n);a(c-l.current),l.current=c},[i,n,a]),s=(0,h.useCallback)(()=>{j(!1)},[]),t=(0,h.useCallback)(()=>{d&&d()},[d]),u=(0,h.useCallback)(b=>{let c=0;n?"ArrowRight"===b.key?c=10:"ArrowLeft"===b.key&&(c=-10):"ArrowDown"===b.key?c=10:"ArrowUp"===b.key&&(c=-10),0!==c&&(b.preventDefault(),a(c))},[n,a]);(0,h.useEffect)(()=>(i&&(document.addEventListener("mousemove",q),document.addEventListener("mouseup",s),document.addEventListener("touchmove",r),document.addEventListener("touchend",s),document.body.style.userSelect="none",document.body.style.cursor=n?"col-resize":"row-resize"),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",s),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),document.body.style.userSelect="",document.body.style.cursor=""}),[i,q,s,r,n]);let v=(0,h.useMemo)(()=>[...cd,...n?ce:cf,...i?["bg-accent-500","dark:bg-accent-500","dragging",n?"w-2":"h-2"]:[]].join(" "),[n,i]);return(0,e.jsx)("div",{ref:m,role:"separator","aria-orientation":b,"aria-valuenow":c,"aria-valuemin":0,"aria-valuemax":100,"aria-label":g("paneResizer.label",{arrows:g(n?"paneResizer.arrowsHorizontal":"paneResizer.arrowsVertical")}),tabIndex:0,className:v,onMouseDown:o,onTouchStart:p,onKeyDown:u,onDoubleClick:t})}),ci="worktree-history-pane",cj=(0,h.memo)(function({onToggle:a}){let b=(0,k.c)("worktree");return(0,e.jsx)("div",{"data-testid":"terminal-container-expand-bar",style:{width:"36px"},className:"flex-shrink-0 flex items-start justify-center bg-gray-100 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",children:(0,e.jsxs)("button",{type:"button","data-testid":"history-pane-expand","aria-label":b("terminal.showHistory"),title:b("terminal.showHistory"),"aria-expanded":"false","aria-controls":ci,onClick:a,className:"flex flex-col items-center gap-2 w-full pt-2 text-gray-500 dark:text-gray-400 hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:b("terminal.historyLabel")})]})})}),ck=(0,h.memo)(function({history:a,terminal:b}){let{visible:c,width:d,toggle:f,setWidth:g}=cc(),i=(0,h.useRef)(null),j=(0,h.useCallback)(a=>{let b=i.current;if(!b)return;let c=b.offsetWidth;0!==c&&g(d+a/c*100)},[d,g]);return(0,e.jsxs)("div",{ref:i,className:"flex h-full min-h-0 w-full",children:[null!=a&&(c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:ci,"data-testid":"terminal-container-history-slot","aria-label":"History pane",style:{width:`${d}%`},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,e.jsx)(F,{componentName:"HistoryPane",children:a})}),(0,e.jsx)(ch,{onResize:j,orientation:"horizontal",ariaValueNow:d})]}):(0,e.jsx)(cj,{onToggle:f})),(0,e.jsx)("div",{"data-testid":"terminal-container-terminal-slot","aria-label":"Terminal pane",className:"flex-grow overflow-hidden min-w-0",children:(0,e.jsx)(F,{componentName:"TerminalAndFilePanel",children:b})})]})}),cl=[50,100,150,200,250,500,1e3];function cm(a){return`split-history-slot-${a}`}function cn(){let a=(0,k.c)("worktree");return(0,e.jsx)("div",{"data-testid":"loading-indicator",role:"status","aria-label":a("history.loading"),children:[0,1,2].map(a=>(0,e.jsxs)("div",{className:"mb-4 overflow-hidden rounded-lg border border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 p-3",children:[(0,e.jsx)(n.EA,{className:"h-4 w-4 rounded-full"}),(0,e.jsx)(n.EA,{className:"h-4 w-1/3"})]}),(0,e.jsxs)("div",{className:"space-y-2 px-3 pb-3",children:[(0,e.jsx)(n.EA,{className:"h-3 w-full"}),(0,e.jsx)(n.EA,{className:"h-3 w-5/6"}),(0,e.jsx)(n.EA,{className:"h-3 w-2/3"})]})]},a))})}function co(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[(0,e.jsx)("svg",{className:"w-12 h-12 mb-2 opacity-50",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),(0,e.jsx)("p",{className:"text-sm",children:a("history.empty")})]})}let cp=["h-full","flex","flex-col","overflow-hidden","bg-surface-2","rounded-lg","border","border-border"],cq=(0,h.memo)(function({messages:a,worktreeId:b,onFilePathClick:c,isLoading:d=!1,className:f="",showToast:g,onInsertToMessage:i,onRetryPending:j,onDiscardPending:l,showArchived:m=!1,onShowArchivedChange:o,historyDisplayLimit:p,onHistoryDisplayLimitChange:q,historyUserOnly:r=!1,onHistoryUserOnlyChange:s,onCollapse:t,splitIndex:u,cliToolId:v}){let w=(0,k.c)("worktree"),x=(0,h.useRef)(null),y=(0,h.useMemo)(()=>void 0===u?aD:{highlightName:`history-search-${u}`,currentHighlightName:`history-search-current-${u}`,fallbackOverlayId:`history-search-fallback-overlay-${u}`,fallbackOverlayBgColor:aD.fallbackOverlayBgColor},[u]),z=void 0===u?"history-pane-collapse-button":`history-pane-collapse-button-${u}`,A=void 0===u?ci:cm(u),B=(0,h.useRef)(!0),C=(0,h.useRef)(-1),D=(0,h.useRef)(null),{pairs:E,isExpanded:F,toggleExpand:G}=function(a){let b=(0,h.useMemo)(()=>(function(a){if(0===a.length)return[];let b=[...a].sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime()),c=[],d=null;for(let a of b)if("user"===a.role)d={id:a.id,userMessage:a,assistantMessages:[],status:"pending"},c.push(d);else if("assistant"===a.role)if(d&&null!==d.userMessage)d.assistantMessages.push(a),d.status="completed";else if(d&&null===d.userMessage)d.assistantMessages.push(a);else{let b={id:`orphan-${a.id}`,userMessage:null,assistantMessages:[a],status:"orphan"};c.push(b),d=b}return c})(a),[a]),[c,d]=(0,h.useState)(new Set),e=(0,h.useCallback)(a=>{d(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),f=(0,h.useCallback)(a=>c.has(a),[c]),g=(0,h.useCallback)(()=>{d(new Set(b.map(a=>a.id)))},[b]);return{pairs:b,expandedPairs:c,toggleExpand:e,isExpanded:f,expandAll:g,collapseAll:(0,h.useCallback)(()=>{d(new Set)},[])}}(a),{isOpen:H,query:I,matchCount:J,currentIndex:K,isAtMaxMatches:L,matchPositions:M,currentMatch:N,openSearch:O,closeSearch:P,setQuery:R,onCompositionStart:S,onCompositionEnd:T,nextMatch:U,prevMatch:V}=function({messages:a}){let[b,c]=(0,h.useState)(!1),[d,e]=(0,h.useState)(""),[f,g]=(0,h.useState)([]),[i,j]=(0,h.useState)(0),[k,l]=(0,h.useState)(!1),m=(0,h.useRef)(null),n=(0,h.useRef)(""),o=(0,h.useRef)(!1);(0,h.useRef)(function(a){if(0===a.length)return"0";let b=a[a.length-1],c=b.timestamp instanceof Date?b.timestamp.getTime():String(b.timestamp);return`${a.length}|${b.id}|${c}`}(a));let p=(0,h.useRef)(a);p.current=a;let q=f.reduce((a,b)=>a+b.ranges.length,0),r=(0,h.useMemo)(()=>(function(a,b){if(0===a.length||b<0)return null;let c=0;for(let d of a){if(b<c+d.ranges.length)return{messageId:d.messageId,localIndex:b-c};c+=d.ranges.length}return null})(f,i),[f,i]),s=(0,h.useCallback)(()=>{m.current&&(clearTimeout(m.current),m.current=null)},[]),t=(0,h.useCallback)(a=>{let{positions:b,capped:c}=function(a,b){if(b.length<2||0===a.length)return{positions:[],capped:!1};let c=b.toLowerCase(),d=b.length,e=[],f=0,g=!1;for(let b of a){if(g)break;let h=b.content;if(!h)continue;let i=h.toLowerCase(),j=[],k=0;for(;;){let e=i.indexOf(c,k);if(-1===e)break;if(j.push({start:e,end:e+d}),k=e+1,(f+=1)>=500){if(-1!==i.indexOf(c,k))g=!0;else{let d=a.indexOf(b)+1;for(let b=d;b<a.length;b++){let d=a[b].content;if(d&&-1!==d.toLowerCase().indexOf(c)){g=!0;break}}}break}}j.length>0&&e.push({messageId:b.id,ranges:j})}return{positions:e,capped:g}}(p.current,a);g(b),j(0),l(c)},[]),u=(0,h.useCallback)(a=>{s(),n.current=a,o.current||(m.current=setTimeout(()=>{t(a)},300))},[s,t]),v=(0,h.useCallback)(a=>{e(a),u(a)},[u]),w=(0,h.useCallback)(()=>{c(!0)},[]),x=(0,h.useCallback)(()=>{c(!1),e(""),n.current="",g([]),j(0),l(!1),s()},[s]),y=(0,h.useCallback)(()=>{j(a=>0===q?0:(a+1)%q)},[q]),z=(0,h.useCallback)(()=>{j(a=>0===q?0:(a-1+q)%q)},[q]);return{isOpen:b,query:d,matchCount:q,currentIndex:i,isAtMaxMatches:k,matchPositions:f,currentMatch:r,openSearch:w,closeSearch:x,setQuery:v,onCompositionStart:(0,h.useCallback)(()=>{o.current=!0,s()},[s]),onCompositionEnd:(0,h.useCallback)(()=>{o.current=!1;let a=n.current;a.length>=2&&(s(),m.current=setTimeout(()=>{t(a)},300))},[s,t]),nextMatch:y,prevMatch:z}}({messages:(0,h.useMemo)(()=>a.filter(a=>!a.archived&&"string"==typeof a.content&&a.content.length>0&&(!r||"user"===a.role)),[a,r])}),W=H&&M.length>0,[X,Y]=(0,h.useState)(new Set);(0,h.useEffect)(()=>{P()},[b]);let Z=(0,h.useMemo)(()=>r?E.filter(a=>a.userMessage):E,[E,r]),$=(0,h.useMemo)(()=>{let a=new Map;for(let b of Z)for(let c of(b.userMessage&&a.set(b.userMessage.id,b.id),b.assistantMessages))a.set(c.id,b.id);return a},[Z]),_=(0,h.useMemo)(()=>{let a=new Map;return Z.forEach((b,c)=>a.set(b.id,c)),a},[Z]),aa=bI({count:Z.length,getScrollElement:()=>x.current,estimateSize:()=>160,overscan:6,getItemKey:a=>Z[a]?.id??a}),ab=aa.getVirtualItems(),ac=ab.length>0?`${ab[0].index}-${ab[ab.length-1].index}`:"",ad=(0,h.useCallback)(()=>{let a=x.current;a&&(B.current=function({scrollTop:a,scrollHeight:b,clientHeight:c},d=80){let e=b-a-c;return!!Number.isFinite(e)&&e<=d}({scrollTop:a.scrollTop,scrollHeight:a.scrollHeight,clientHeight:a.clientHeight}))},[]);(0,h.useLayoutEffect)(()=>{let a=C.current,b=Z.length;C.current=b,-1!==a&&b>a&&b>0&&B.current&&!W&&aa.scrollToIndex(b-1,{align:"end"})},[Z.length,W,aa]),(0,h.useLayoutEffect)(()=>{if(!H||0===M.length)return void Y(a=>0===a.size?a:new Set);Y(function(a,b){let c=new Map;for(let a of b)for(let b of(a.userMessage&&c.set(a.userMessage.id,a.id),a.assistantMessages))c.set(b.id,a.id);let d=new Set;for(let b of a){let a=c.get(b.messageId);a&&d.add(a)}return d}(M,E))},[H,M,E]),(0,h.useEffect)(()=>{if(!H||!N)return;let a=$.get(N.messageId);if(void 0===a)return;let b=_.get(a);void 0!==b&&aa.scrollToIndex(b,{align:"center"})},[H,N,$,_,aa]),(0,h.useLayoutEffect)(()=>{let a=x.current;if(!a)return;if(!H||0===M.length)return void aI(y);let b=null;for(let d of M){var c;let e=(c=d.messageId,a.querySelector(`[data-message-id="${CSS.escape(c)}"]`));if(!e)continue;let f=N?.messageId===d.messageId,g=f?N.localIndex:-1;!function(a,b,c,d=aD){aH(a,b,c,d)}(e,d.ranges,g,y),f&&e instanceof HTMLElement&&(b=e)}return b&&"function"==typeof b.scrollIntoView&&b.scrollIntoView({block:"center",behavior:"smooth"}),()=>{aI(y)}},[H,M,N,X,y,ac]),(0,h.useEffect)(()=>{let a=x.current;if(H)null===D.current&&a&&(D.current=a.scrollTop);else{if(null!==D.current&&a){let b=D.current;requestAnimationFrame(()=>{a.scrollTop=b})}D.current=null}},[H]);let ae=(0,h.useMemo)(()=>[...cp,f].filter(Boolean).join(" "),[f]),af=(0,h.useCallback)(a=>c(a),[c]),ag=(0,h.useCallback)(a=>()=>G(a),[G]),ah=(0,h.useRef)(w);ah.current=w;let ai=(0,h.useCallback)(async a=>{try{await (0,ar.l)(a),g?.(ah.current("history.copied"),"success")}catch{console.error("[HistoryPane] Failed to copy to clipboard"),g?.(ah.current("history.copyFailed"),"error")}},[g]),aj=a=>{let b=a.userMessage?.archived===!0||a.assistantMessages?.some(a=>!0===a.archived),c=F(a.id)||X.has(a.id);return(0,e.jsx)("div",{className:b?"opacity-60":"",children:(0,e.jsx)(ca,{pair:a,onFilePathClick:af,isExpanded:c,onToggleExpand:ag(a.id),onCopy:ai,onInsertToMessage:i,onRetryPending:j,onDiscardPending:l,showAssistant:!r})})},ak=(0,h.useCallback)(a=>{let b=parseInt(a.target.value,10);cl.includes(b)&&q?.(b)},[q]),al=(0,h.useCallback)(()=>{H?P():O()},[H,O,P]);return(0,e.jsxs)("div",{role:"region","aria-label":w("history.regionLabel"),className:ae,children:[(0,e.jsxs)("div",{className:"flex-shrink-0 bg-surface-2 border-b border-border px-4 py-2 flex items-center justify-between flex-wrap gap-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-foreground",children:w("history.title")}),(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[q&&void 0!==p&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,e.jsx)("span",{children:w("history.show")}),(0,e.jsx)("select",{value:p,onChange:ak,"aria-label":w("history.displayLimit"),className:"rounded border border-input bg-surface text-foreground text-xs px-1.5 py-0.5 focus:outline-none focus:ring-1 focus:ring-ring",children:cl.map(a=>(0,e.jsx)("option",{value:a,children:a},a))})]}),o&&(0,e.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[(0,e.jsx)(n.Sc,{checked:m,onCheckedChange:a=>o(!0===a),className:"h-3.5 w-3.5"}),w("history.showArchived")]}),s&&(0,e.jsx)("button",{type:"button",onClick:()=>s(!r),"aria-label":w("history.showUserOnly"),"aria-pressed":r,className:`p-1 rounded transition-colors ${r?"bg-accent-500/15 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:text-foreground"}`,title:w(r?"history.showAllMessages":"history.showUserOnly"),children:r?(0,e.jsx)(bJ,{size:14,"aria-hidden":"true"}):(0,e.jsx)(bK,{size:14,"aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:al,"aria-label":w(H?"history.closeSearch":"history.openSearch"),"aria-pressed":H,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:w(H?"history.closeSearch":"history.openSearch"),children:(0,e.jsx)(Q.A,{size:14,"aria-hidden":"true"})}),t&&(0,e.jsx)("button",{type:"button",onClick:t,"aria-label":w("terminal.hideHistory"),"aria-expanded":"true","aria-controls":A,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors",title:w("terminal.hideHistory"),"data-testid":z,children:(0,e.jsx)(bL,{size:14,"aria-hidden":"true"})})]})]}),H&&(0,e.jsx)("div",{className:"flex-shrink-0 px-3 py-2 bg-surface-2 border-b border-border",children:(0,e.jsx)(cb,{query:I,onQueryChange:R,matchCount:J,currentIndex:K,onNext:U,onPrev:V,onClose:P,isAtMaxMatches:L,onCompositionStart:S,onCompositionEnd:T})}),(0,e.jsx)("div",{ref:x,"data-testid":"history-scroll-container",onScroll:ad,className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden p-4",children:d?(0,e.jsx)(cn,{}):0===Z.length?(0,e.jsx)(co,{}):0===ab.length?(0,e.jsx)("div",{"data-testid":"history-fallback-list",children:Z.slice(0,30).map(a=>(0,e.jsx)("div",{children:aj(a)},a.id))}):(0,e.jsx)("div",{style:{height:aa.getTotalSize(),width:"100%",position:"relative"},children:ab.map(a=>{let b=Z[a.index];return b?(0,e.jsx)("div",{"data-index":a.index,ref:aa.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${a.start}px)`},children:aj(b)},a.key):null})})})]})}),cr={isOpen:!1,position:{x:0,y:0},targetPath:null,targetType:null},cs=(0,x.A)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]),ct=(0,x.A)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),cu=(0,x.A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]),cv=(0,x.A)("folder-input",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);var cw=c(40284),cx=c(6074);function cy(a,b,c){let d=c-b-8;return d<8?8:Math.min(Math.max(a,8),d)}let cz=(0,h.memo)(function({isOpen:a,position:b,targetPath:c,targetType:d,onClose:f,onNewFile:g,onNewDirectory:j,onRename:l,onDelete:m,onUpload:n,onMove:o}){let p=(0,k.c)("worktree"),q=(0,h.useRef)(null),{shouldRender:r,isExiting:s}=(0,cx.O)(a,ah.$B),t=`${b.x}:${b.y}:${d}`,[u,v]=(0,h.useState)(null),w=u?.key===t?u:null;(0,h.useLayoutEffect)(()=>{if(!a)return;let c=q.current;if(!c)return;let d=c.getBoundingClientRect();v({key:t,left:cy(b.x,d.width,window.innerWidth),top:cy(b.y,d.height,window.innerHeight)})},[a,t,b.x,b.y]);let x=(0,h.useCallback)(a=>{a&&c&&a(c),f()},[c,f]),y=[{id:"new-file",label:p("fileTree.newFile"),icon:(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(g),showFor:["directory"]},{id:"new-directory",label:p("fileTree.newDirectory"),icon:(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(j),showFor:["directory"]},{id:"upload",label:p("contextMenu.uploadFile"),icon:(0,e.jsx)(cu,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(n),showFor:["directory"],showDividerAfter:!0},{id:"rename",label:p("contextMenu.rename"),icon:(0,e.jsx)(aw.A,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(l)},{id:"move",label:p("contextMenu.move"),icon:(0,e.jsx)(cv,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>{o&&c&&d&&o(c,d),f()},showDividerAfter:!0},{id:"delete",label:p("contextMenu.delete"),icon:(0,e.jsx)(cw.A,{className:"w-4 h-4","aria-hidden":"true",role:"img"}),onClick:()=>x(m),variant:"danger"}].filter(a=>!a.showFor||d&&a.showFor.includes(d));return((0,h.useEffect)(()=>{if(!a)return;let b=a=>{if("Escape"===a.key)return void f();if("ArrowDown"===a.key||"ArrowUp"===a.key){let b;a.preventDefault();let c=q.current?.querySelectorAll('[role="menuitem"]');if(!c?.length)return;let d=Array.from(c).findIndex(a=>a===document.activeElement);b="ArrowDown"===a.key?d<c.length-1?d+1:0:d>0?d-1:c.length-1,c[b].focus()}};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[a,f]),(0,h.useEffect)(()=>{if(a&&q.current){let a=q.current.querySelector('[role="menuitem"]');a&&a.focus()}},[a]),r)?(0,e.jsx)("div",{ref:q,"data-testid":"context-menu",role:"menu","aria-label":p("contextMenu.label"),className:`fixed min-w-[160px] py-1 bg-surface rounded-lg shadow-lg border border-border ${s?"animate-out fade-out-0 zoom-out-95 duration-100 fill-mode-forwards pointer-events-none":"animate-in fade-in-0 zoom-in-95 duration-100"}`,style:{zIndex:aA.M.CONTEXT_MENU,left:`${w?w.left:0}px`,top:`${w?w.top:0}px`},children:y.map((a,b)=>(0,e.jsxs)(i().Fragment,{children:[(0,e.jsxs)("button",{role:"menuitem","data-testid":`context-menu-${a.id}`,onClick:a.onClick,disabled:!c,className:`w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors focus:outline-none focus:bg-muted ${"danger"===a.variant?"text-danger hover:bg-danger-subtle focus:bg-danger-subtle":"text-foreground hover:bg-muted"} ${!c?"opacity-50 cursor-not-allowed":""}`,children:[a.icon,(0,e.jsx)("span",{children:a.label})]}),a.showDividerAfter&&b<y.length-1&&(0,e.jsx)("div",{"data-testid":"context-menu-divider",className:"my-1 border-t border-border"})]},a.id))}):null});var cA=c(81497);let cB={showSize:!0,showCreated:!1,showModified:!1};function cC(a){return void 0===a?"":a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}let cD=(0,h.memo)(function({expanded:a}){return(0,e.jsx)("svg",{"data-testid":"chevron-icon",className:`w-4 h-4 text-muted-foreground transition-transform ${a?"rotate-90":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),cE=(0,h.memo)(function({open:a}){return(0,e.jsx)("svg",{"data-testid":"folder-icon",className:"w-5 h-5 text-warning",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:a?(0,e.jsx)("path",{d:"M19 20H5c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h6l2 2h6c1.1 0 2 .9 2 2v10c0 1.1-.9 2-2 2zM5 6v12h14V8h-7l-2-2H5z"}):(0,e.jsx)("path",{d:"M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"})})}),cF=(0,h.memo)(function({text:a,query:b}){if(!b||!b.trim())return(0,e.jsx)(e.Fragment,{children:a});let c=p(b),d=a.split(RegExp(`(${c})`,"gi"));return(0,e.jsx)(e.Fragment,{children:d.map((a,c)=>a.toLowerCase()===b.toLowerCase()?(0,e.jsx)("mark",{className:"bg-warning-border text-foreground px-0.5 rounded",children:a},c):(0,e.jsx)("span",{children:a},c))})}),cG=(0,h.memo)(function({extension:a}){let b=(0,h.useMemo)(()=>a&&({ts:"text-info",tsx:"text-info",js:"text-warning",jsx:"text-warning",json:"text-warning",md:"text-muted-foreground",css:"text-pink-500",scss:"text-pink-500",html:"text-warning",py:"text-success"})[a]||"text-muted-foreground",[a]);return(0,e.jsx)("svg",{"data-testid":"file-icon",className:`w-5 h-5 ${b}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),cH=(0,h.memo)(function a({item:b,path:c,depth:d,worktreeId:f,expanded:g,cache:i,onToggle:j,onFileSelect:l,onLoadChildren:n,onContextMenu:o,searchQuery:p,searchMode:q,matchedPaths:r,dateFnsLocaleStr:s,metadataDisplay:t=cB}){let u=(0,k.c)("worktree"),[v,w]=(0,h.useState)(!1),x=c?`${c}/${b.name}`:b.name,y=g.has(x),z="directory"===b.type,A=i.get(x),B=(0,h.useMemo)(()=>s?b0(s):void 0,[s]),C=(0,h.useMemo)(()=>{if(z)return;let a=[];if(void 0!==b.size&&a.push(`${u("fileTree.metadata.size")}: ${cC(b.size)}`),b.birthtime){let c=(0,b1.bg)(new Date(b.birthtime),B);c&&a.push(`${u("fileTree.metadata.created")}: ${c}`)}if(b.mtime){let c=(0,b1.bg)(new Date(b.mtime),B);c&&a.push(`${u("fileTree.metadata.modified")}: ${c}`)}return a.length>0?a.join("\n"):void 0},[z,b.size,b.birthtime,b.mtime,B,u]),D=(0,h.useCallback)(async()=>{z?(y||A||(w(!0),await n(x),w(!1)),j(x)):l?.(x)},[z,y,A,x,n,j,l]),E=(0,h.useCallback)(a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),D())},[D]),F=(0,h.useCallback)(a=>{a.preventDefault(),o?.(a,x,z?"directory":"file")},[x,z,o]),G=function({delay:a=500,moveThreshold:b=10,onLongPress:c}){let d=(0,h.useRef)(null),e=(0,h.useRef)(null),f=(0,h.useRef)(null),g=(0,h.useCallback)(()=>{d.current&&(clearTimeout(d.current),d.current=null),e.current=null,f.current=null},[]),i=(0,h.useCallback)(b=>{if(1!==b.touches.length)return;let h=b.touches[0];e.current={x:h.clientX,y:h.clientY},f.current=b,d.current=setTimeout(()=>{f.current&&c(f.current),g()},a)},[a,c,g]),j=(0,h.useCallback)(a=>{if(!e.current||1!==a.touches.length)return;let c=a.touches[0],d=c.clientX-e.current.x,f=c.clientY-e.current.y;Math.sqrt(d*d+f*f)>b&&g()},[b,g]);return{onTouchStart:i,onTouchMove:j,onTouchEnd:(0,h.useCallback)(()=>{g()},[g]),onTouchCancel:(0,h.useCallback)(()=>{g()},[g])}}({onLongPress:(0,h.useCallback)(a=>{o?.(a,x,z?"directory":"file")},[x,z,o])}),H={...function(a){let b=Math.min(a,20);return{paddingLeft:`${.5+ +b}rem`}}(d),touchAction:"manipulation",WebkitTouchCallout:"none"};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{"data-testid":`tree-item-${b.name}`,role:"treeitem","aria-selected":!1,"aria-expanded":z?y:void 0,tabIndex:0,className:"flex items-center gap-2 py-1.5 pr-2 cursor-pointer hover:bg-muted rounded transition-colors",style:H,onClick:D,onKeyDown:E,onContextMenu:F,onTouchStart:G.onTouchStart,onTouchMove:G.onTouchMove,onTouchEnd:G.onTouchEnd,onTouchCancel:G.onTouchCancel,children:[z?(0,e.jsx)("span",{className:"w-4 h-4 flex items-center justify-center",children:v?(0,e.jsx)(m.y,{size:"xs",variant:"accent"}):(0,e.jsx)(cD,{expanded:y})}):(0,e.jsx)("span",{className:"w-4 h-4"}),z?(0,e.jsx)(cE,{open:y}):(0,e.jsx)(cG,{extension:b.extension}),(0,e.jsx)(cA.nR,{content:b.name,metadata:C,className:"flex-1 truncate text-sm text-foreground",children:"name"===q&&p?(0,e.jsx)(cF,{text:b.name,query:p}):b.name}),t.showSize&&(0,e.jsx)("span",{"data-testid":"tree-item-size",className:"text-xs text-muted-foreground flex-shrink-0",children:z?void 0!==b.itemCount&&u("fileTree.itemCount",{count:b.itemCount}):cC(b.size)}),!z&&t.showCreated&&b.birthtime&&(0,e.jsx)("span",{"data-testid":"tree-item-created",className:"text-xs text-muted-foreground flex-shrink-0",children:(0,b1.fw)(b.birthtime,B)}),!z&&t.showModified&&b.mtime&&(0,e.jsx)("span",{"data-testid":"tree-item-modified",className:"text-xs text-muted-foreground flex-shrink-0",children:(0,b1.fw)(b.mtime,B)})]}),z&&y&&A&&(0,e.jsx)("div",{role:"group",children:A.filter(a=>{let b=x?`${x}/${a.name}`:a.name;if(!p?.trim())return!0;if("name"===q){let b=p.toLowerCase();return!!a.name.toLowerCase().includes(b)||"directory"===a.type}if("content"===q&&r&&r.size>0){if(r.has(b))return!0;if("directory"===a.type){for(let a of r)if(a.startsWith(b+"/"))return!0}return!1}return!0}).map(b=>(0,e.jsx)(a,{item:b,path:x,depth:d+1,worktreeId:f,expanded:g,cache:i,onToggle:j,onFileSelect:l,onLoadChildren:n,onContextMenu:o,searchQuery:p,searchMode:q,matchedPaths:r,dateFnsLocaleStr:s,metadataDisplay:t},b.name))})]})}),cI=(0,x.A)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),cJ=[{key:"showSize",labelKey:"fileTree.metadata.showSize"},{key:"showCreated",labelKey:"fileTree.metadata.showCreated"},{key:"showModified",labelKey:"fileTree.metadata.showModified"}];function cK(a,b,c){if(b<=0||c<=0)return 0;let d=a+b+8-c;return d>0?-Math.min(d,Math.max(0,a-8)):a<8?8-a:0}let cL=(0,h.memo)(function({settings:a,onToggle:b}){let c=(0,k.c)("worktree"),[d,f]=(0,h.useState)(!1),g=(0,h.useRef)(null),i=(0,h.useRef)(null),j=(0,h.useRef)({x:0,y:0}),[l,m]=(0,h.useState)({x:0,y:0});(0,h.useEffect)(()=>{if(!d)return;let a=a=>{g.current&&!g.current.contains(a.target)&&f(!1)},b=a=>{"Escape"===a.key&&f(!1)};return document.addEventListener("mousedown",a),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",b)}},[d]),(0,h.useLayoutEffect)(()=>{let a=a=>{j.current=a,m(b=>b.x===a.x&&b.y===a.y?b:a)};if(!d)return void a({x:0,y:0});let b=i.current;if(!b)return;let c=b.getBoundingClientRect();a({x:cK(c.left-j.current.x,c.width,window.innerWidth),y:cK(c.top-j.current.y,c.height,window.innerHeight)})},[d]);let o=(0,h.useCallback)(a=>{b(a)},[b]);return(0,e.jsxs)("div",{className:"relative",ref:g,"data-testid":"file-metadata-toggle",children:[(0,e.jsx)("button",{type:"button","data-testid":"file-metadata-toggle-button",onClick:()=>f(a=>!a),"aria-haspopup":"menu","aria-expanded":d,"aria-label":c("fileTree.metadata.settingsLabel"),title:c("fileTree.metadata.settingsLabel"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:(0,e.jsx)(cI,{className:"w-4 h-4","aria-hidden":"true"})}),d&&(0,e.jsxs)("div",{ref:i,role:"menu","data-testid":"file-metadata-toggle-menu",className:"absolute right-0 top-full z-20 mt-1 min-w-[12rem] rounded border border-border bg-surface shadow-lg p-1",style:0!==l.x||0!==l.y?{transform:`translate(${l.x}px, ${l.y}px)`}:void 0,children:[(0,e.jsx)("div",{className:"px-2 py-1 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:c("fileTree.metadata.settingsTitle")}),cJ.map(b=>(0,e.jsxs)("label",{className:"flex items-center gap-2 px-2 py-1.5 text-xs text-foreground hover:bg-muted rounded cursor-pointer",children:[(0,e.jsx)(n.Sc,{"data-testid":`file-metadata-toggle-${b.key}`,checked:a[b.key],onCheckedChange:()=>o(b.key),className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{children:c(b.labelKey)})]},b.key))]})]})});function cM({intervalMs:a,enabled:b,onPoll:c}){(0,h.useRef)(c).current=c,(0,h.useRef)(b).current=b,(0,h.useRef)(null)}var cN=c(25345);let cO=(0,h.memo)(function({worktreeId:a,onFileSelect:b,onNewFile:c,onNewDirectory:d,onRename:f,onDelete:g,onUpload:i,onMove:j,className:l="",refreshTrigger:m=0,pollingEnabled:o=!1,searchQuery:p,searchMode:r,searchResults:s,onSearchResultSelect:t,onResetView:u}){let v=(0,bQ.Ym)(),w=(0,k.c)("worktree"),{settings:x,toggle:y}=function(){let[a,b]=(0,h.useState)(cB),c=(0,h.useRef)(a);c.current=a;let d=(0,h.useCallback)(a=>{c.current=a,b(a)},[]);return{settings:a,toggle:(0,h.useCallback)(a=>{d({...c.current,[a]:!c.current[a]})},[d]),setSettings:d}}(),[z,A]=(0,h.useState)(!0),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)([]),{expanded:F,setExpanded:G,resetExpanded:H}=function(a){let[b,c]=(0,h.useState)(()=>new Set);(0,h.useRef)(a);let d=(0,h.useCallback)(()=>{c(new Set)},[]);return{expanded:b,setExpanded:c,resetExpanded:d}}(a),[I,J]=(0,h.useState)(()=>new Map),K=(0,h.useRef)(null),L=(0,h.useRef)(F);L.current=F;let M=(0,h.useRef)(w);M.current=w;let N=(0,h.useRef)(new Set),{menuState:O,openMenu:P,closeMenu:Q}=function(){let[a,b]=(0,h.useState)(cr),c=(0,h.useCallback)((a,c,d)=>{let e,f;if(a.preventDefault(),"touches"in a&&a.touches.length>0)e=a.touches[0].clientX,f=a.touches[0].clientY;else{if(!("clientX"in a))return;e=a.clientX,f=a.clientY}b({isOpen:!0,position:{x:e,y:f},targetPath:c,targetType:d})},[]);return{menuState:a,openMenu:c,closeMenu:(0,h.useCallback)(()=>{b(a=>({...a,isOpen:!1}))},[]),resetMenu:(0,h.useCallback)(()=>{b(cr)},[])}}(),R=(0,h.useCallback)(async(b="")=>{try{let c=b?`/api/worktrees/${a}/tree/${b}`:`/api/worktrees/${a}/tree`,d=await fetch(c);if(!d.ok)throw Error(M.current("fileTree.loadDirectoryError",{status:d.status}));return await d.json()}catch(a){throw console.error("[FileTreeView] Error fetching directory:",a),a}},[a]),S=(0,h.useRef)(!0);(0,h.useEffect)(()=>(S.current=!0,()=>{S.current=!1}),[]);let T=(0,h.useCallback)(async()=>{if(S.current){A(!0),C(null);try{let a=await R();if(!S.current||!a)return;let b=Array.from(L.current),c=new Map,d=[];for(let a=0;a<b.length;a+=5){if(!S.current)return;let e=b.slice(a,a+5);for(let[a,b]of(await Promise.allSettled(e.map(async a=>{let b=await R(a);return{dirPath:a,data:b}}))).entries())"fulfilled"===b.status&&b.value.data?c.set(b.value.dirPath,b.value.data.items):d.push(e[a])}if(!S.current)return;E(a.items),J(c),d.length>0&&G(a=>{let b=new Set(a);for(let a of d)a&&b.delete(a);return b})}catch(a){S.current&&C(a instanceof Error?a.message:M.current("fileTree.loadError"))}finally{S.current&&A(!1)}}},[R,G]);(0,h.useEffect)(()=>{T()},[T,m]);let U=(0,h.useRef)(null),V=(0,h.useRef)(!1);(0,h.useEffect)(()=>{U.current=null},[a]),cM({intervalMs:5e3,enabled:o,onPoll:(0,h.useCallback)(async()=>{if(S.current&&!V.current){V.current=!0;try{let a=["",...Array.from(L.current)],b=new Map;for(let c=0;c<a.length;c+=5){if(!S.current)return;let d=a.slice(c,c+5);for(let{dirPath:a,hash:c}of(await Promise.all(d.map(async a=>{try{let b=await R(a);return{dirPath:a,hash:JSON.stringify(b?.items??null)}}catch{return{dirPath:a,hash:"unavailable"}}}))))b.set(a,c)}if(!S.current)return;let c=U.current;if(U.current=b,null===c)return;let d=!1;for(let[a,e]of b){let b=c.get(a);if(void 0!==b&&b!==e){d=!0;break}}d&&T()}finally{V.current=!1}}},[R,T])});let W=(0,h.useCallback)(async a=>{if(!(I.has(a)||N.current.has(a))){N.current.add(a);try{let b=await R(a);b&&J(c=>{let d=new Map(c);return d.set(a,b.items),d})}catch(a){console.error("[FileTreeView] Error loading children:",a)}finally{N.current.delete(a)}}},[I,R]),X=(0,h.useCallback)(a=>{G(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[G]),Y=(0,h.useCallback)(()=>{H(),J(new Map),K.current?.scrollTo({top:0}),u?.()},[H,u]),Z=(0,h.useMemo)(()=>"content"===r&&s&&0!==s.length?q(s.map(a=>a.filePath)):new Set,[r,s]);(0,h.useEffect)(()=>{Z.size>0&&G(a=>{let b=new Set(a);for(let a of Z)(I.has(a)||s?.some(b=>b.filePath.startsWith(a+"/")))&&b.add(a);return b})},[Z,I,s,G]);let $=(0,h.useMemo)(()=>{if(!p?.trim())return D;if("name"===r){let a=p.toLowerCase(),b=(c,d)=>c.filter(c=>{let e=d?`${d}/${c.name}`:c.name,f=c.name.toLowerCase().includes(a);if("directory"===c.type){let a=I.get(e);if(a&&b(a,e).length>0)return!0}return f});return b(D,"")}return"content"===r&&Z.size>0?D.filter(a=>{if(Z.has(a.name))return!0;if("directory"===a.type){for(let b of Z)if(b.startsWith(a.name+"/")||b===a.name)return!0}return!1}):D},[D,p,r,Z,I]);if(z&&0===D.length)return(0,e.jsx)("div",{"data-testid":"file-tree-loading",className:`p-2 ${l}`,role:"status","aria-label":w("fileTree.loading"),children:[0,8,16,8,0,8].map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1.5 pr-2",style:{paddingLeft:`${8+a}px`},children:[(0,e.jsx)(n.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,e.jsx)(n.EA,{className:`h-4 ${b%3==0?"w-32":b%3==1?"w-24":"w-40"} max-w-full`})]},b))});if(B&&0===D.length)return(0,e.jsx)("div",{"data-testid":"file-tree-error",className:`p-4 bg-danger-subtle border border-danger-border rounded-lg ${l}`,children:(0,e.jsx)("p",{className:"text-sm text-danger",children:B})});let _=z&&D.length>0,aa=!!B&&D.length>0;return 0===D.length?(0,e.jsxs)("div",{"data-testid":"file-tree-empty",className:`p-4 text-center text-muted-foreground ${l}`,children:[(0,e.jsx)("p",{className:"text-sm",children:w("fileTree.empty")}),(c||d)&&(0,e.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[c&&(0,e.jsxs)(n.$n,{variant:"ghost","data-testid":"empty-new-file-button",onClick:()=>c(""),className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-foreground bg-surface border border-input rounded-md hover:bg-muted transition-colors",children:[(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newFile")})]}),d&&(0,e.jsxs)(n.$n,{variant:"ghost","data-testid":"empty-new-directory-button",onClick:()=>d(""),className:"flex items-center justify-center gap-2 px-3 py-2 text-sm text-foreground bg-surface border border-input rounded-md hover:bg-muted transition-colors",children:[(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newDirectory")})]})]})]}):p?.trim()&&0===$.length?(0,e.jsx)("div",{"data-testid":"file-tree-no-results",className:`p-4 text-center text-muted-foreground ${l}`,children:(0,e.jsx)("p",{className:"text-sm",children:w("content"===r?"fileTree.noResultsContaining":"fileTree.noResultsMatching",{query:p})})}):(0,e.jsxs)("div",{ref:K,"data-testid":"file-tree-view",role:"tree","aria-label":w("fileTree.label"),className:`overflow-auto bg-surface ${l}`,children:[(0,e.jsxs)("div",{"data-testid":"file-tree-toolbar",className:"flex items-center gap-1 p-1 border-b border-border",children:[c&&(0,e.jsxs)("button",{"data-testid":"toolbar-new-file-button",onClick:()=>c(""),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:[(0,e.jsx)(cs,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newFile")})]}),d&&(0,e.jsxs)("button",{"data-testid":"toolbar-new-directory-button",onClick:()=>d(""),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:[(0,e.jsx)(ct,{className:"w-4 h-4","aria-hidden":"true"}),(0,e.jsx)("span",{children:w("fileTree.newDirectory")})]}),(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,e.jsx)(cL,{settings:x,onToggle:y}),_&&(0,e.jsxs)("div",{"data-testid":"file-tree-refetch-indicator",role:"status","aria-live":"polite",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{"aria-hidden":"true",className:"w-3 h-3 border-2 border-input border-t-cyan-500 rounded-full animate-spin"}),(0,e.jsx)("span",{className:"sr-only",children:w("fileTree.refreshing")})]}),(0,e.jsx)("button",{"data-testid":"file-tree-refresh-button",type:"button",onClick:()=>{T()},disabled:_,"aria-label":w("fileTree.refreshLabel"),title:w("actions.refresh"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,e.jsx)(cN.A,{className:`w-4 h-4 ${_?"animate-spin":""}`,"aria-hidden":"true"})}),(0,e.jsx)("button",{"data-testid":"file-tree-reset-button",type:"button",onClick:Y,"aria-label":w("fileTree.resetViewLabel"),title:w("actions.resetView"),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:bg-muted rounded transition-colors",children:(0,e.jsx)(bO,{className:"w-4 h-4","aria-hidden":"true"})})]})]}),aa&&(0,e.jsxs)("div",{"data-testid":"file-tree-refetch-error",role:"alert",className:"flex items-center gap-2 px-2 py-1 text-xs bg-danger-subtle border-b border-danger-border text-danger-foreground",children:[(0,e.jsx)(bN,{className:"w-4 h-4 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{className:"flex-1 truncate",children:B}),(0,e.jsx)(n.$n,{variant:"ghost","data-testid":"file-tree-refetch-retry-button",onClick:()=>{T()},className:"px-2 py-0.5 text-xs rounded border border-danger-border hover:bg-danger-subtle transition-colors",children:w("actions.retry")})]}),$.map(c=>(0,e.jsx)(cH,{item:c,path:"",depth:0,worktreeId:a,expanded:F,cache:I,onToggle:X,onFileSelect:t||b,onLoadChildren:W,onContextMenu:P,searchQuery:p,searchMode:r,matchedPaths:Z,dateFnsLocaleStr:v,metadataDisplay:x},c.name)),(0,e.jsx)(cz,{isOpen:O.isOpen,position:O.position,targetPath:O.targetPath,targetType:O.targetType,onClose:Q,onNewFile:c,onNewDirectory:d,onRename:f,onDelete:g,onUpload:i,onMove:j})]})}),cP=(0,h.memo)(function(){return(0,e.jsx)("svg",{className:"w-4 h-4 text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})}),cQ=(0,h.memo)(function(){return(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),cR=(0,h.memo)(function(){let a=(0,k.c)("worktree");return(0,e.jsx)(m.y,{size:"sm",variant:"accent","data-testid":"search-loading",role:"status","aria-hidden":!1,"aria-label":a("search.searching")})}),cS=(0,h.memo)(function({query:a,mode:b,isSearching:c,error:d,onQueryChange:f,onModeChange:g,onClear:i,placeholder:j,className:l=""}){let m=(0,h.useRef)(null),n=(0,k.c)("worktree"),o=(0,h.useCallback)(a=>{f(a.target.value)},[f]),p=(0,h.useCallback)(()=>{i(),m.current?.focus()},[i]),q=(0,h.useCallback)(b=>{"Escape"===b.key&&(a?p():m.current?.blur())},[a,p]);return(0,h.useEffect)(()=>{if(!(window.innerWidth<ab.D)){let a=setTimeout(()=>{m.current?.focus()},100);return()=>clearTimeout(a)}},[]),(0,e.jsxs)("div",{"data-testid":"search-bar",className:`flex flex-col gap-2 p-2 bg-surface dark:bg-surface-2 border-b border-border ${l}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"flex-shrink-0",children:(0,e.jsx)(cP,{})}),(0,e.jsx)("input",{ref:m,type:"text","data-testid":"search-input",value:a,onChange:o,onKeyDown:q,placeholder:j??n("search.placeholder"),className:"flex-1 min-w-0 px-2 py-1 text-sm bg-muted text-foreground border border-input rounded focus:outline-none focus:ring-1 focus:ring-ring focus:border-accent-500","aria-label":n("search.label"),"aria-busy":c}),(0,e.jsx)("div",{className:"flex-shrink-0 w-6 h-6 flex items-center justify-center",children:c?(0,e.jsx)(cR,{}):a?(0,e.jsx)("button",{type:"button","data-testid":"search-clear",onClick:p,className:"p-1 text-muted-foreground hover:text-foreground rounded transition-colors","aria-label":n("search.clear"),children:(0,e.jsx)(cQ,{})}):null})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground mr-1",children:n("search.mode")}),(0,e.jsx)("button",{type:"button","data-testid":"mode-name",onClick:()=>g("name"),className:`px-2 py-0.5 text-xs rounded transition-colors ${"name"===b?"bg-accent-100 dark:bg-accent-900 text-accent-700 dark:text-accent-300 font-medium":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-pressed":"name"===b,children:n("search.modeName")}),(0,e.jsx)("button",{type:"button","data-testid":"mode-content",onClick:()=>g("content"),className:`px-2 py-0.5 text-xs rounded transition-colors ${"content"===b?"bg-accent-100 dark:bg-accent-900 text-accent-700 dark:text-accent-300 font-medium":"bg-muted text-muted-foreground hover:bg-muted/80"}`,"aria-pressed":"content"===b,children:n("search.modeContent")})]}),d&&(0,e.jsx)("div",{"data-testid":"search-error",className:"text-xs text-danger bg-danger-subtle px-2 py-1 rounded",role:"alert",children:d})]})});var cT=c(82042);function cU({value:a,saveFn:b,debounceMs:c=300,disabled:d=!1,maxRetries:e=3,onSaveComplete:f}){let[g,i]=(0,h.useState)(!1),[j,k]=(0,h.useState)(null),l=(0,h.useRef)(a),m=(0,h.useRef)(b),n=(0,h.useRef)(f),o=(0,h.useRef)(null),p=(0,h.useRef)(!0);(0,h.useRef)(a);let q=(0,h.useCallback)(async a=>{if(!p.current)return;i(!0),k(null);let b=null,c=0;for(;c<=e;)try{await m.current(a),p.current&&(i(!1),k(null),n.current?.());return}catch(a){if(b=a instanceof Error?a:Error(String(a)),++c<=e){let a=1e3*Math.pow(2,c-1);await new Promise(b=>setTimeout(b,a))}}p.current&&(i(!1),k(b))},[e]),r=(0,h.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);return{isSaving:g,error:j,saveNow:(0,h.useCallback)(async()=>{d||(r(),await q(l.current))},[d,r,q])}}let cV=(0,h.memo)(function({memo:a,onUpdate:b,onDelete:c,isSaving:d,error:f,className:g="",onInsertToMessage:i,onMoveUp:j,onMoveDown:l,canMoveUp:m=!0,canMoveDown:n=!0}){let o=(0,k.c)("schedule"),p=(0,k.c)("worktree"),q=!!(j||l),[r,s]=(0,h.useState)(a.title),[t,u]=(0,h.useState)(a.content),[v,w]=(0,h.useState)(!1),x=(0,h.useRef)(void 0);(0,h.useEffect)(()=>()=>{x.current&&clearTimeout(x.current)},[]);let{isSaving:y,error:z,saveNow:A}=cU({value:r,saveFn:async c=>{await b(a.id,{title:c})}}),{isSaving:B,error:C,saveNow:D}=cU({value:t,saveFn:async c=>{await b(a.id,{content:c})}}),E=f??z?.message??C?.message??null,F=(0,h.useCallback)(a=>{s(a.target.value)},[]),G=(0,h.useCallback)(a=>{u(a.target.value)},[]),H=(0,h.useCallback)(()=>{A()},[A]),I=(0,h.useCallback)(()=>{D()},[D]),J=(0,h.useCallback)(()=>{c(a.id)},[a.id,c]),K=(0,h.useCallback)(()=>{t.trim()&&i?.(t)},[t,i]),L=(0,h.useCallback)(async()=>{if(t.trim())try{await (0,ar.l)(t),w(!0),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>w(!1),2e3)}catch{}},[t]);return(0,e.jsxs)("div",{"data-testid":"memo-card","data-memo-id":a.id,tabIndex:-1,className:`bg-surface dark:bg-surface-2 border border-border rounded-lg p-4 space-y-3 focus:outline-none ${g}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("input",{type:"text",value:r,onChange:F,onBlur:H,placeholder:o("memoTitlePlaceholder"),className:"flex-1 min-w-0 text-sm font-medium text-foreground bg-transparent border-none focus:outline-none focus:ring-0 p-0"}),(d??(y||B))&&(0,e.jsx)("span",{"data-testid":"saving-indicator",className:"text-xs text-muted-foreground",children:p("actions.saving")}),q&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{type:"button","data-testid":`memo-move-up-${a.id}`,onClick:j,disabled:!m,"aria-label":o("memoMoveUp"),title:o("memoMoveUp"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded disabled:opacity-30 disabled:cursor-not-allowed",children:(0,e.jsx)(cT.A,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button","data-testid":`memo-move-down-${a.id}`,onClick:l,disabled:!n,"aria-label":o("memoMoveDown"),title:o("memoMoveDown"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded disabled:opacity-30 disabled:cursor-not-allowed",children:(0,e.jsx)(a8.A,{className:"w-4 h-4","aria-hidden":"true"})})]}),i&&(0,e.jsx)("button",{type:"button","data-testid":"insert-memo-content",onClick:K,"aria-label":o("memoInsertToMessage"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 transition-colors rounded",title:o("memoInsertToMessage"),children:(0,e.jsx)(bP,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:L,"aria-label":o("memoCopyContent"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-foreground transition-colors rounded",children:v?(0,e.jsx)(au.A,{className:"w-4 h-4 text-success"}):(0,e.jsx)(ax,{className:"w-4 h-4"})}),(0,e.jsx)("button",{type:"button",onClick:J,"aria-label":o("memoDelete"),className:"flex-shrink-0 p-1 text-muted-foreground hover:text-danger transition-colors rounded",children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}),(0,e.jsx)("textarea",{value:t,onChange:G,onBlur:I,placeholder:o("memoContentPlaceholder"),rows:4,className:"w-full text-sm text-foreground bg-muted border border-border rounded-md p-2 resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),E&&(0,e.jsx)("div",{className:"text-xs text-danger",children:E})]})}),cW=(0,h.memo)(function({currentCount:a,maxCount:b,onAdd:c,isLoading:d=!1,className:f=""}){let g=(0,k.c)("schedule"),h=Math.max(0,b-a),i=a>=b||d;return(0,e.jsxs)("div",{"data-testid":"memo-add-button",className:`flex flex-col items-center gap-2 ${f}`,children:[(0,e.jsxs)("button",{type:"button",onClick:()=>{i||c()},disabled:i,"aria-label":g("memoAdd"),"aria-disabled":i,className:`
22
22
  flex items-center gap-2 px-4 py-2 rounded-lg border-2 border-dashed
23
23
  transition-colors focus:outline-none focus:ring-2 focus:ring-ring
24
24
  ${i?"border-border text-muted-foreground cursor-not-allowed opacity-50":"border-border text-muted-foreground hover:border-accent-400 dark:hover:border-accent-500 hover:text-accent-600 dark:hover:text-accent-400 hover:bg-accent-50 dark:hover:bg-accent-900/30"}
@@ -27,7 +27,7 @@ document.addEventListener('click', function(e) {
27
27
  ${a("git.aiPrompts.stashCleanupCurrent")}
28
28
  ${d}`}(s,a))}),(0,e.jsx)("button",{type:"button",onClick:j,className:"p-1 text-muted-foreground hover:text-foreground rounded","aria-label":s("git.stash.refresh"),children:(0,e.jsx)(d5,{})})]})]}),u&&(0,e.jsxs)("div",{className:"px-3 pb-3 space-y-2",children:[c&&(0,e.jsx)("div",{className:"text-xs text-danger-foreground",role:"alert","data-testid":"git-stash-error",children:c}),f&&(0,e.jsx)("div",{className:"text-xs text-danger-foreground",role:"alert","data-testid":"git-stash-action-error",children:f}),g&&(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsx)("div",{className:"text-xs text-warning-foreground",role:"status","data-testid":"git-stash-conflict",children:g}),r&&(0,e.jsx)(d6,{className:"shrink-0",testId:"stash-conflict-ask-ai",onClick:()=>r(function(a,b){let c=a("git.aiPrompts.stashConflict");return b&&b.trim().length>0?`${c}
29
29
 
30
- ${b.trim()}`:c}(s,g))})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:s("git.stash.messagePlaceholder"),className:"w-full px-2 py-1 text-xs border border-input rounded bg-surface dark:bg-surface-2 text-foreground","data-testid":"git-stash-push-message"}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)(n.Sc,{checked:y,onCheckedChange:a=>z(!0===a),"data-testid":"git-stash-include-untracked"}),s("git.stash.includeUntracked")]}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>{l(w,y),x(""),z(!1)},className:"px-2 py-1 text-xs rounded bg-accent-600 hover:bg-accent-700 text-white disabled:opacity-50","data-testid":"stash-push-button",children:s("git.stash.push")})]})]}),b?(0,e.jsx)("div",{className:"py-3 text-center text-xs text-muted-foreground",role:"status",children:s("git.stash.loading")}):0===a.length?(0,e.jsx)("div",{className:"py-3 text-center text-xs text-muted-foreground",children:s("git.stash.empty")}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:a.map(a=>(0,e.jsx)("li",{className:"py-1.5","data-testid":"git-stash-row",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("span",{className:"font-mono text-xs text-accent-600 dark:text-accent-400",children:["stash@","{",a.index,"}"]}),(0,e.jsx)("span",{className:"ml-2 text-xs text-foreground truncate",children:a.message})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>o(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-input hover:bg-muted disabled:opacity-50","data-testid":"stash-apply-button",children:s("git.stash.apply")}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>m(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-input hover:bg-muted disabled:opacity-50","data-testid":"stash-pop-button",children:s("git.stash.pop")}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>B(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"stash-drop-button",children:s("git.stash.drop")})]})]})},a.index))})]}),null!==A&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"git-stash-drop-confirm",role:"dialog",children:[(0,e.jsxs)("p",{className:"text-xs text-danger-foreground",children:["stash@","{",A,"}",s("git.stash.dropConfirmSuffix")]}),i&&(0,e.jsx)("p",{className:"mt-1 text-xs text-danger-foreground","data-testid":"git-stash-drop-session-warning",children:s("git.danger.runningSessionWarning")}),(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>{p(A),B(null)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"git-stash-drop-confirm-button",children:s("git.stash.drop")}),(0,e.jsx)("button",{type:"button",onClick:()=>B(null),className:"px-2 py-1 text-xs rounded border border-input hover:bg-muted",children:t("cancel")})]})]})]})}),ei={soft:"git.danger.modeSoft",mixed:"git.danger.modeMixed",hard:"git.danger.modeHard"},ej=(0,h.memo)(function({selectedCommit:a,busy:b,actionError:c,conflictNotice:d,currentBranch:f,aheadCount:g,hasRunningSession:i,onReset:j,onRevert:l,onForcePush:m}){let{isMobile:o,onInsertToMessage:p}=d$(),q=(0,k.c)("worktree"),r=(0,k.c)("common"),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)("mixed"),[w,x]=(0,h.useState)(!0),[y,z]=(0,h.useState)(""),[A,B]=(0,h.useState)(!1),[C,D]=(0,h.useState)(!1),[E,F]=(0,h.useState)(!1),[G,H]=(0,h.useState)(!1),[I,J]=(0,h.useState)(!0),K=w?"HEAD":a,L=!w&&!a;return(0,e.jsxs)("div",{className:"border-t-2 border-danger-border","data-testid":"git-danger-zone-section",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>t(a=>!a),className:"w-full flex items-center gap-1 px-3 py-2 text-sm font-medium text-danger-foreground bg-danger-subtle cursor-pointer hover:bg-danger-subtle","data-testid":"git-danger-zone-toggle",children:[(0,e.jsx)("span",{className:"text-xs w-4 text-center",children:s?"▼":"▶"}),q("git.danger.title")]}),s&&(0,e.jsxs)("div",{className:"px-3 py-3 space-y-2 bg-danger-subtle",children:[c&&(0,e.jsx)("div",{className:"text-xs text-danger-foreground",role:"alert","data-testid":"git-danger-zone-error",children:c}),d&&(0,e.jsx)("div",{className:"text-xs text-warning-foreground",role:"status","data-testid":"git-danger-zone-conflict",children:d}),(0,e.jsxs)("div",{className:`flex ${o?"flex-col":"flex-row"} gap-2`,children:[(0,e.jsx)("button",{type:"button",onClick:()=>B(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle","data-testid":"git-danger-zone-reset-open",children:q("git.danger.resetOpen")}),(0,e.jsx)("button",{type:"button",disabled:!a,onClick:()=>D(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"git-danger-zone-revert-open",children:q("git.danger.revertOpen")}),m&&(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>H(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"git-force-push-open",children:q("git.danger.forcePushOpen")})]}),!a&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:q("git.danger.selectCommitHint")})]}),A&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"reset-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.resetTitle")}),(0,e.jsxs)(n.z6,{value:w?"head":"commit",onValueChange:a=>x("head"===a),name:"reset-target",className:"flex flex-col gap-1 mb-2",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:"head","data-testid":"reset-target-head"}),q("git.danger.resetTargetHead")]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:"commit",disabled:!a,"data-testid":"reset-target-commit"}),q("git.danger.resetTargetSelectedPrefix"),a?q("git.danger.resetTargetSelectedHash",{hash:a.slice(0,7)}):q("git.danger.resetTargetNoneSelected")]})]}),(0,e.jsx)(n.z6,{value:u,onValueChange:a=>v(a),name:"reset-mode",className:"flex flex-col gap-1 mb-2",children:["soft","mixed","hard"].map(a=>(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:a,"data-testid":`reset-mode-${a}`}),q(ei[a])]},a))}),"hard"===u&&(0,e.jsxs)("div",{className:"mb-2 space-y-1",children:[(0,e.jsx)("p",{className:"text-xs text-danger-foreground","data-testid":"reset-hard-history-loss-warning",children:q("git.danger.resetHardWarning")}),i&&(0,e.jsx)("p",{className:"text-xs text-danger-foreground","data-testid":"reset-hard-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsx)("input",{type:"text",value:y,onChange:a=>z(a.target.value),placeholder:q("git.danger.confirmPlaceholder",{branch:f??""}),className:"w-full px-2 py-1 text-xs border border-danger-border rounded bg-surface dark:bg-surface-2 text-foreground","data-testid":"reset-hard-branch-input"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"reset-ask-ai",disabled:L,onClick:()=>{K&&(p("hard"===u?q("git.aiPrompts.resetHard",{target:ee(K)}):q("git.aiPrompts.reset",{target:ee(K),mode:u})),B(!1),z(""))}}),(0,e.jsx)("button",{type:"button",disabled:b||L||"hard"===u&&y!==(f??""),onClick:()=>{K&&(j(K,u,"hard"===u?y:void 0),B(!1),z(""))},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"reset-confirm-button",children:q("git.danger.reset")}),(0,e.jsx)("button",{type:"button",onClick:()=>{B(!1),z("")},className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]}),C&&a&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"revert-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.revertTitle")}),(0,e.jsxs)("p",{className:"text-xs text-foreground mb-2",children:[q("git.danger.revertBodyPrefix"),(0,e.jsx)("span",{className:"font-mono",children:a.slice(0,7)})]}),i&&(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"revert-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground mb-2",children:[(0,e.jsx)(n.Sc,{checked:E,onCheckedChange:a=>F(!0===a),"data-testid":"revert-no-commit"}),q("git.danger.revertNoCommit")]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"revert-ask-ai",onClick:()=>{p(q("git.aiPrompts.revert",{commit:ee(a.slice(0,7))})),D(!1),F(!1)}}),(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>{l(a,E),D(!1),F(!1)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"revert-confirm-button",children:q("git.danger.revert")}),(0,e.jsx)("button",{type:"button",onClick:()=>{D(!1),F(!1)},className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]}),G&&m&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"force-push-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.forcePushTitle")}),(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"force-push-protected-branch-warning",children:q("git.danger.protectedBranchWarning")}),i&&(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"force-push-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground mb-2",children:[(0,e.jsx)(n.Sc,{checked:I,onCheckedChange:a=>J(!0===a),"data-testid":"force-push-with-lease"}),q("git.danger.forceWithLease")]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"force-push-ask-ai",onClick:()=>{p(function(a,{branch:b,ahead:c}){let d=b?ee(b):a("git.aiPrompts.forcePushCurrentBranch");return a("number"==typeof c&&c>0?"git.aiPrompts.forcePushAhead":"git.aiPrompts.forcePush",{branchRef:d,upstream:ee(`origin/${b??"<branch>"}`),ahead:c??0})}(q,{branch:f,ahead:g??null})),H(!1)}}),(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>{m(I),H(!1)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"force-push-confirm-button",children:q("git.danger.forcePush")}),(0,e.jsx)("button",{type:"button",onClick:()=>H(!1),className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]})]})}),ek=(0,h.memo)(function({worktreeId:a,onDiffSelect:b,isMobile:c=!1,worktree:d,onInsertToMessage:f,className:g=""}){let i=(0,k.c)("worktree"),{activeTab:j,setActiveTab:l,historyOpen:m,toggleHistory:o,advancedOpen:p,toggleAdvanced:q}=function(){let{value:a,setValue:b,isAvailable:c}=(0,dP.V)({key:dS.activeTab,defaultValue:"status",validate:dT}),{value:d,setValue:e}=(0,dP.V)({key:dS.historyOpen,defaultValue:!0,validate:dU}),{value:f,setValue:g}=(0,dP.V)({key:dS.advancedOpen,defaultValue:!1,validate:dU}),i=(0,h.useCallback)(a=>b(a),[b]);return{activeTab:a,setActiveTab:i,historyOpen:d,toggleHistory:(0,h.useCallback)(()=>e(a=>!a),[e]),advancedOpen:f,toggleAdvanced:(0,h.useCallback)(()=>g(a=>!a),[g]),isPersistent:c}}(),r=Object.values(d?.sessionStatusByCli??{}).some(a=>a?.isRunning===!0),{gitStatus:s,statusLoading:t,statusError:u,fetchStatus:v}=function(a){let[b,c]=(0,h.useState)(null),[d,e]=(0,h.useState)(!0),[f,g]=(0,h.useState)(null);return{gitStatus:b,statusLoading:d,statusError:f,fetchStatus:(0,h.useCallback)(async()=>{g(null);try{let b=await fetch(`/api/worktrees/${a}/git/status`);if(!b.ok){let a=await b.json().catch(()=>({}));g(a.error||"Failed to fetch git status");return}let d=await b.json();c(d)}catch{g("Failed to fetch git status")}finally{e(!1)}},[a])}}(a),{commits:w,selectedCommit:x,changedFiles:y,inlineDiffCommit:z,inlineFiles:A,inlineFilesLoading:B,inlineFilesError:C,selectedFile:D,diffContent:E,isLoading:F,isLoadingFiles:G,isLoadingDiff:H,commitError:I,detailError:J,setDiffContent:K,fetchCommits:L,handleCommitSelect:M,handleFileSelect:N,handleToggleInlineDiff:O,handleInlineDiffFile:P,handleRefresh:Q}=function(a,b){let[c,d]=(0,h.useState)([]),[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(null),[l,m]=(0,h.useState)([]),[n,o]=(0,h.useState)(!1),[p,q]=(0,h.useState)(null),[r,s]=(0,h.useState)(null),[t,u]=(0,h.useState)(null),[v,w]=(0,h.useState)(!0),[x,y]=(0,h.useState)(!1),[z,A]=(0,h.useState)(!1),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)(null),F=(0,h.useCallback)(async()=>{w(!0),C(null);try{let b=await fetch(`/api/worktrees/${a}/git/log`);if(!b.ok){let a=await b.json();C(a.error||"Failed to fetch commit history");return}let c=await b.json();d(c.commits)}catch{C("Failed to fetch commit history")}finally{w(!1)}},[a]),G=(0,h.useCallback)(async b=>{y(!0),i([]),s(null),u(null),E(null);try{let c=await fetch(`/api/worktrees/${a}/git/show/${b}`);if(!c.ok){let a=await c.json();E(a.error||"Failed to fetch commit details");return}let d=await c.json();i(d.files)}catch{E("Failed to fetch commit details")}finally{y(!1)}},[a]),H=(0,h.useCallback)(async(c,d)=>{A(!0),u(null),E(null);try{let e=await fetch(`/api/worktrees/${a}/git/diff?commit=${c}&file=${encodeURIComponent(d)}`);if(!e.ok){let a=await e.json();E(a.error||"Failed to fetch diff");return}let f=await e.json();u(f.diff),b(f.diff,d)}catch{E("Failed to fetch diff")}finally{A(!1)}},[a,b]),I=(0,h.useCallback)(a=>{f(a),G(a)},[G]),J=(0,h.useCallback)(a=>{e&&(s(a),H(e,a))},[e,H]),K=(0,h.useCallback)(async b=>{if(j===b){k(null),m([]),q(null);return}k(b),m([]),q(null),o(!0);try{let c=await fetch(`/api/worktrees/${a}/git/show/${b}`);if(!c.ok){let a=await c.json().catch(()=>({}));q(a.error||"Failed to fetch commit details");return}let d=await c.json();m(Array.isArray(d.files)?d.files:[])}catch{q("Failed to fetch commit details")}finally{o(!1)}},[a,j]),L=(0,h.useCallback)((a,b)=>{f(a),s(b),i(l),H(a,b)},[l,H]),M=(0,h.useCallback)(()=>{f(null),i([]),s(null),u(null),E(null),F()},[F]);return{commits:c,selectedCommit:e,changedFiles:g,inlineDiffCommit:j,inlineFiles:l,inlineFilesLoading:n,inlineFilesError:p,selectedFile:r,diffContent:t,isLoading:v,isLoadingFiles:x,isLoadingDiff:z,commitError:B,detailError:D,setDiffContent:u,fetchCommits:F,handleCommitSelect:I,handleFileSelect:J,handleToggleInlineDiff:K,handleInlineDiffFile:L,handleRefresh:M}}(a,b),R=(0,h.useCallback)(async()=>{await L(),await v()},[L,v]),{staged:S,stagedLoading:T,stagedError:U,opBusy:V,commitMessage:W,setCommitMessage:X,amend:Y,setAmend:Z,committing:$,changesCommitError:_,fetchStaged:aa,handleStage:ab,handleUnstage:ac,handleChangesDiff:ad,fetchWorkingDiffText:ae,commit:af,commitAndPush:ag}=function(a,b){let{onWorkingDiff:c,onCommitted:d}=b,[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(!0),[j,k]=(0,h.useState)(null),[l,m]=(0,h.useState)(!1),[n,o]=(0,h.useState)(""),[p,q]=(0,h.useState)(!1),[r,s]=(0,h.useState)(!1),[t,u]=(0,h.useState)(null),v=(0,h.useCallback)(async()=>{k(null);try{let b=await fetch(`/api/worktrees/${a}/git/staged`);if(!b.ok){let a=await b.json().catch(()=>({}));k(a.error||"Failed to fetch changes");return}let c=await b.json();f(c)}catch{k("Failed to fetch changes")}finally{i(!1)}},[a]),w=(0,h.useCallback)(async b=>{m(!0),k(null);try{let c=await fetch(`/api/worktrees/${a}/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[b]})});if(!c.ok){let a=await c.json().catch(()=>({}));k(a.error||"Failed to stage file");return}await v()}catch{k("Failed to stage file")}finally{m(!1)}},[a,v]),x=(0,h.useCallback)(async b=>{m(!0),k(null);try{let c=await fetch(`/api/worktrees/${a}/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[b]})});if(!c.ok){let a=await c.json().catch(()=>({}));k(a.error||"Failed to unstage file");return}await v()}catch{k("Failed to unstage file")}finally{m(!1)}},[a,v]),y=(0,h.useCallback)(async()=>{u(null);try{let b=await fetch(`/api/worktrees/${a}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,amend:p})});if(!b.ok){let a=await b.json().catch(()=>({}));return u(a.error||"Failed to commit"),!1}return o(""),q(!1),await v(),await d(),!0}catch{return u("Failed to commit"),!1}},[a,n,p,v,d]),z=(0,h.useCallback)(async()=>{s(!0);try{await y()}finally{s(!1)}},[y]),A=(0,h.useCallback)(async a=>{s(!0);try{await y()&&await a()}finally{s(!1)}},[y]);return{staged:e,stagedLoading:g,stagedError:j,opBusy:l,commitMessage:n,setCommitMessage:o,amend:p,setAmend:q,committing:r,changesCommitError:t,fetchStaged:v,handleStage:w,handleUnstage:x,handleChangesDiff:(0,h.useCallback)(async(b,d)=>{try{let e=await fetch(`/api/worktrees/${a}/git/working-diff?file=${encodeURIComponent(b)}&mode=${d}`);if(!e.ok)return;let f=await e.json();"string"==typeof f.diff&&c(f.diff,b)}catch{}},[a,c]),fetchWorkingDiffText:(0,h.useCallback)(async(b,c)=>{try{let d=await fetch(`/api/worktrees/${a}/git/working-diff?file=${encodeURIComponent(b)}&mode=${c}`);if(!d.ok)return null;let e=await d.json();return"string"==typeof e.diff?e.diff:null}catch{return null}},[a]),commit:z,commitAndPush:A}}(a,{onWorkingDiff:(0,h.useCallback)((a,c)=>{K(a),b(a,c)},[K,b]),onCommitted:R}),{branches:ah,branchInclude:ai,branchesLoading:aj,branchesError:ak,branchBusy:al,branchActionError:am,fetchBranches:an,handleBranchIncludeChange:ao,handleBranchesRefresh:ap,handleCheckout:aq,handleBranchCreate:ar,handleBranchDelete:as}=function(a,b){let{onCheckoutCascade:c}=b,[d,e]=(0,h.useState)([]),[f,g]=(0,h.useState)("local"),[i,j]=(0,h.useState)(!0),[k,l]=(0,h.useState)(null),[m,n]=(0,h.useState)(!1),[o,p]=(0,h.useState)(null),q=(0,h.useCallback)(async b=>{l(null);try{let c=await fetch(`/api/worktrees/${a}/git/branches?include=${b}`);if(!c.ok){let a=await c.json().catch(()=>({}));l(a.error||"Failed to fetch branches");return}let d=await c.json();e(Array.isArray(d.branches)?d.branches:[])}catch{l("Failed to fetch branches")}finally{j(!1)}},[a]),r=(0,h.useCallback)(a=>{g(a)},[]),s=(0,h.useCallback)(()=>{q(f)},[q,f]),t=(0,h.useCallback)(async(b,d)=>{n(!0),p(null);try{let e=await fetch(`/api/worktrees/${a}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:b.name,force:d})});if(!e.ok){let a=await e.json().catch(()=>({}));p(a.error||"Failed to checkout branch");return}await Promise.all([c(),q(f)])}catch{p("Failed to checkout branch")}finally{n(!1)}},[a,f,c,q]),u=(0,h.useCallback)(async(b,c)=>{n(!0),p(null);try{let d=await fetch(`/api/worktrees/${a}/git/branch/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,from:c})});if(!d.ok){let a=await d.json().catch(()=>({}));p(a.error||"Failed to create branch");return}await q(f)}catch{p("Failed to create branch")}finally{n(!1)}},[a,f,q]),v=(0,h.useCallback)(async(b,c)=>{n(!0),p(null);try{let d=await fetch(`/api/worktrees/${a}/git/branch/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,force:c})});if(!d.ok){let a=await d.json().catch(()=>({}));p(a.error||"Failed to delete branch");return}await q(f)}catch{p("Failed to delete branch")}finally{n(!1)}},[a,f,q]);return{branches:d,branchInclude:f,branchesLoading:i,branchesError:k,branchBusy:m,branchActionError:o,fetchBranches:q,handleBranchIncludeChange:r,handleBranchesRefresh:s,handleCheckout:t,handleBranchCreate:u,handleBranchDelete:v}}(a,{onCheckoutCascade:(0,h.useCallback)(async()=>{await Promise.all([v(),aa(),L()])},[v,aa,L])}),{stashes:at,stashLoading:au,stashError:av,stashBusy:aw,stashActionError:ax,stashConflictNotice:ay,fetchStash:az,handleStashPush:aA,handleStashPop:aB,handleStashApply:aC,handleStashDrop:aD}=function(a,b){let{onStashMutated:c}=b,[d,e]=(0,h.useState)([]),[f,g]=(0,h.useState)(!0),[i,j]=(0,h.useState)(null),[k,l]=(0,h.useState)(!1),[m,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(null),q=(0,h.useCallback)(async()=>{j(null);try{let b=await fetch(`/api/worktrees/${a}/git/stash`);if(!b.ok){let a=await b.json().catch(()=>({}));j(a.error||"Failed to fetch stashes");return}let c=await b.json();e(Array.isArray(c.stashes)?c.stashes:[])}catch{j("Failed to fetch stashes")}finally{g(!1)}},[a]),r=(0,h.useCallback)(async()=>{await Promise.all([q(),c()])},[q,c]),s=(0,h.useCallback)(async(a,b,c)=>{l(!0),n(null),p(null);try{let d=await fetch(a,b),e=await d.json().catch(()=>({}));if(!d.ok)return void n(e.error||c);if(e.conflict){let a=Array.isArray(e.conflictFiles)?e.conflictFiles.join(", "):"",b=e.stashRetained?" (stash retained)":"";p(`Stash operation produced conflicts: ${a}${b}`)}await r()}catch{n(c)}finally{l(!1)}},[r]),t=(0,h.useCallback)((b,c)=>{s(`/api/worktrees/${a}/git/stash/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b||void 0,includeUntracked:c})},"Failed to stash changes")},[a,s]),u=(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/pop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({index:b})},"Failed to pop stash")},[a,s]);return{stashes:d,stashLoading:f,stashError:i,stashBusy:k,stashActionError:m,stashConflictNotice:o,fetchStash:q,handleStashPush:t,handleStashPop:u,handleStashApply:(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({index:b})},"Failed to apply stash")},[a,s]),handleStashDrop:(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/${b}`,{method:"DELETE"},"Failed to drop stash")},[a,s])}}(a,{onStashMutated:(0,h.useCallback)(async()=>{await Promise.all([v(),aa()])},[v,aa])}),{dangerBusy:aE,dangerActionError:aF,dangerConflictNotice:aG,handleReset:aH,handleRevert:aI}=function(a,b){let{onHeadMoved:c}=b,[d,e]=(0,h.useState)(!1),[f,g]=(0,h.useState)(null),[i,j]=(0,h.useState)(null);return{dangerBusy:d,dangerActionError:f,dangerConflictNotice:i,handleReset:(0,h.useCallback)(async(b,d,f)=>{e(!0),g(null),j(null);try{let e=await fetch(`/api/worktrees/${a}/git/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:b,mode:d,confirmBranch:f})});if(!e.ok){let a=await e.json().catch(()=>({}));g(a.error||"Failed to reset");return}await c()}catch{g("Failed to reset")}finally{e(!1)}},[a,c]),handleRevert:(0,h.useCallback)(async(b,d)=>{e(!0),g(null),j(null);try{let e=await fetch(`/api/worktrees/${a}/git/revert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:b,noCommit:d})});if(!e.ok){let a=await e.json().catch(()=>({}));g(a.error||"Failed to revert");return}let f=await e.json().catch(()=>({}));if(f.conflict){let a=Array.isArray(f.conflictFiles)?f.conflictFiles.join(", "):"";j(`Revert produced conflicts: ${a}`)}await c()}catch{g("Failed to revert")}finally{e(!1)}},[a,c])}}(a,{onHeadMoved:(0,h.useCallback)(async()=>{await Promise.all([v(),aa(),an(ai),L()])},[v,aa,an,ai,L])}),{operation:aJ,progressState:aK,error:aL,errorReason:aM,conflict:aN,conflictFiles:aO,runFetch:aP,runPull:aQ,runPush:aR,abort:aS}=function(a,b={}){let{onCascade:c}=b,[d,e]=(0,h.useState)(null),[f,g]=(0,h.useState)("idle"),[i,j]=(0,h.useState)(null),[k,l]=(0,h.useState)(null),[m,n]=(0,h.useState)(!1),[o,p]=(0,h.useState)([]),q=(0,h.useRef)(null),r=(0,h.useRef)(c),s=(0,h.useCallback)(async(b,c,d)=>{j(null),l(null),n(!1),p([]),e(b),g("running");let f=new AbortController;q.current=f;try{let e=await fetch(`/api/worktrees/${a}/git/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d),signal:f.signal});if(!e.ok){var h,i;let a=await e.json().catch(()=>({}));l((h=a?.reason,"auth_failed"===h?"auth_failed":"protected_branch"===h?"protected_branch":null)),j((i=a?.error,"string"==typeof i&&i.length>0?i:null)),g("error");return}let k=await e.json().catch(()=>({success:!0}));"pull"===b&&k?.conflict&&(n(!0),p(Array.isArray(k.conflictFiles)?k.conflictFiles:[])),g("idle")}catch(a){a instanceof Error&&"AbortError"===a.name?g("idle"):(j(null),l(null),g("error"))}finally{e(null),q.current=null,r.current?.(b)}},[a]),t=(0,h.useCallback)(a=>{let b={prune:!0===a.prune};return void 0!==a.remote&&(b.remote=a.remote),s("fetch","fetch",b)},[s]),u=(0,h.useCallback)(a=>{let b={rebase:!0===a.rebase,ffOnly:!0===a.ffOnly};return void 0!==a.remote&&(b.remote=a.remote),void 0!==a.branch&&(b.branch=a.branch),s("pull","pull",b)},[s]);return{operation:d,progressState:f,error:i,errorReason:k,conflict:m,conflictFiles:o,runFetch:t,runPull:u,runPush:(0,h.useCallback)(a=>{let b={force:!0===a.force,forceWithLease:!0===a.forceWithLease,setUpstream:!0===a.setUpstream};return void 0!==a.remote&&(b.remote=a.remote),void 0!==a.branch&&(b.branch=a.branch),s("push","push",b)},[s]),abort:(0,h.useCallback)(()=>{q.current?.abort()},[])}}(a,{onCascade:(0,h.useCallback)(a=>{v(),an(ai),"pull"===a&&(aa(),L())},[v,an,ai,aa,L])}),aT="auth_failed"===aM?i("git.network.authFailedGuidance"):"protected_branch"===aM?i("git.danger.protectedBranchWarning"):aL,aU="running"===aK&&("push"===aJ||"pull"===aJ),aV=s?.aheadBehind!=null,aW=(0,h.useCallback)(()=>ag(()=>aR({setUpstream:!aV})),[ag,aR,aV]);cM({intervalMs:5e3,enabled:"running"!==aK,onPoll:v});let aX=(0,h.useMemo)(()=>({isMobile:c,onDiffSelect:b,onInsertToMessage:f}),[c,b,f]),aY=(0,e.jsx)(d9,{gitStatus:s,statusLoading:t,statusError:u,onRefresh:v}),aZ=(0,e.jsx)(ea,{progressState:aK,operation:aJ,error:aT,conflict:aN,conflictFiles:aO,hasUpstream:aV,onPull:()=>aQ({}),onPush:()=>aR({setUpstream:!aV}),onAbort:aS,extraActions:(0,e.jsx)(dW,{branches:ah,busy:al||aU,actionError:am,hasRunningSession:r,isMobile:c,onCheckout:aq})}),a$=(0,e.jsx)(ec,{staged:S,loading:T,error:U,busy:V||aU,commitMessage:W,amend:Y,committing:$,commitError:_,onRefresh:aa,onDiff:ad,onPreview:ae,onStage:ab,onUnstage:ac,onCommitMessageChange:X,onAmendChange:Z,onCommit:af,onCommitAndPush:aW}),a_=(0,e.jsx)(ed,{commits:w,isLoading:F,commitError:I,commitListOpen:m,onToggleCommitList:o,onRefresh:Q,selectedCommit:x,onCommitSelect:M,inlineDiffCommit:z,inlineFiles:A,inlineFilesLoading:B,inlineFilesError:C,onToggleInlineDiff:O,onInlineDiffFile:P,changedFiles:y,isLoadingFiles:G,detailError:J,selectedFile:D,onFileSelect:N,diffContent:E,isLoadingDiff:H}),a0=(0,e.jsxs)(dX,{open:p,onToggle:q,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 px-3 py-2 border-b border-border","data-testid":"git-advanced-fetch",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("git.remote")}),(0,e.jsx)("div",{children:(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:()=>aP({}),disabled:"running"===aK,className:"px-2 py-1 text-xs rounded border border-input text-foreground hover:bg-muted disabled:opacity-50","data-testid":"git-fetch-button",children:i("git.network.fetch")})})]}),(0,e.jsx)(eg,{branches:ah,include:ai,loading:aj,error:ak,busy:al||aU,actionError:am,onIncludeChange:ao,onRefresh:ap,onCreate:ar,onDelete:as}),(0,e.jsx)(eh,{stashes:at,loading:au,error:av,busy:aw||aU,actionError:ax,conflictNotice:ay,hasRunningSession:r,onRefresh:az,onPush:aA,onPop:aB,onApply:aC,onDrop:aD}),(0,e.jsx)(ej,{selectedCommit:x,busy:aE||aU,actionError:aF,conflictNotice:aG,currentBranch:s?.currentBranch??null,aheadCount:s?.aheadBehind?.ahead??null,hasRunningSession:r,onReset:aH,onRevert:aI,onForcePush:a=>aR(a?{forceWithLease:!0}:{force:!0})})]});return(0,e.jsx)(dZ,{value:aX,children:(0,e.jsx)(d3,{activeTab:j,onTabChange:l,className:g,statusSection:aY,quickActionsSection:aZ,changesSection:a$,historySection:a_,advancedSection:a0})})}),el=(0,h.memo)(function({worktreeId:a,worktree:b,onWorktreeUpdate:c}){let[d,f]=(0,h.useState)(!1),g=(0,k.c)("worktree"),i=(0,h.useRef)(b?.id),j=(0,h.useRef)(!1),l=ep(b,c,b?.id,()=>{let a=b?.id!==i.current;return i.current=b?.id,a&&!j.current});return(j.current=l.isEditing,b)?(0,e.jsx)("div",{className:"p-4 space-y-4 overflow-y-auto h-full",children:(0,e.jsx)(eq,{worktreeId:a,worktree:b,cardClassName:"bg-surface rounded-lg border border-border p-4",descriptionEditor:l,showLogs:d,onToggleLogs:()=>f(!d),onWorktreeUpdate:c})}):(0,e.jsx)("div",{className:"text-muted-foreground text-center py-8",children:g("detail.loadingInfo")})}),em=(0,h.memo)(function({worktreeId:a,cliToolId:b,instanceId:c,disableAutoFollow:d}){let{terminal:f,setAutoScroll:g}=bq({worktreeId:a,cliToolId:b,instanceId:c});return(0,e.jsx)(bo,{output:f.output,isActive:f.isRunning,isThinking:f.isThinking,autoScroll:f.autoScroll,onScrollChange:g,disableAutoFollow:d,compactTuiLayoutPadding:"claude"===b||"codex"===b,className:"h-full"})}),en=(0,h.memo)(function({activeTab:a,worktreeId:b,worktree:c,messages:d,cliToolId:f,instanceId:g,onFilePathClick:h,onFileSelect:i,onWorktreeUpdate:j,onNewFile:l,onNewDirectory:m,onRename:n,onDelete:o,onUpload:p,onMove:q,onFileTreeReset:r,refreshTrigger:s,fileSearch:t,showToast:u,selectedAgents:v,onSelectedAgentsChange:w,availableAgents:x,maxAgents:y,persistToServer:z,vibeLocalModel:A,onVibeLocalModelChange:B,vibeLocalContextWindow:C,onVibeLocalContextWindowChange:D,disableAutoFollow:E,historySubTab:G,onHistorySubTabChange:H,onDiffSelect:I,onInsertToMessage:J,showArchived:K,onShowArchivedChange:L,historyDisplayLimit:M,onHistoryDisplayLimitChange:N,historyUserOnly:O,onHistoryUserOnlyChange:P,useInstanceManagement:Q,instances:R,onInstancesChange:S,visibleInstanceIds:T,onToggleInstanceVisible:U}){let V=(0,k.c)("worktree");switch(a){case"terminal":return(0,e.jsx)(F,{componentName:"TerminalDisplay",children:(0,e.jsx)(em,{worktreeId:b,cliToolId:f,instanceId:g,disableAutoFollow:E})});case"history":return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex border-b border-border shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>H("message"),className:`flex-1 min-h-[44px] px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation ${"message"===G?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400 bg-accent-50 dark:bg-accent-900/30":"text-muted-foreground hover:text-foreground"}`,children:V("detail.subTabMessage")}),(0,e.jsx)("button",{type:"button",onClick:()=>H("git"),className:`flex-1 min-h-[44px] px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation ${"git"===G?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400 bg-accent-50 dark:bg-accent-900/30":"text-muted-foreground hover:text-foreground"}`,children:V("detail.subTabGit")})]}),"message"===G?(0,e.jsx)(F,{componentName:"HistoryPane",children:(0,e.jsx)(cq,{messages:d,worktreeId:b,onFilePathClick:h,className:"flex-1 min-h-0",showToast:u,onInsertToMessage:J,showArchived:K,onShowArchivedChange:L,historyDisplayLimit:M,onHistoryDisplayLimitChange:N,historyUserOnly:O,onHistoryUserOnlyChange:P})}):(0,e.jsx)(F,{componentName:"GitPane",children:(0,e.jsx)(ek,{worktreeId:b,onDiffSelect:I,isMobile:!0,worktree:c??void 0,onInsertToMessage:J,className:"flex-1 min-h-0"})})]});case"files":return(0,e.jsx)(F,{componentName:"FileTreeView",children:(0,e.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,e.jsx)(cS,{query:t.query,mode:t.mode,isSearching:t.isSearching,error:t.error,onQueryChange:t.setQuery,onModeChange:t.setMode,onClear:t.clearSearch}),(0,e.jsx)(cO,{worktreeId:b,onFileSelect:i,onNewFile:l,onNewDirectory:m,onRename:n,onDelete:o,onUpload:p,onMove:q,onResetView:r,refreshTrigger:s,pollingEnabled:"files"===a,searchQuery:t.query,searchMode:t.mode,searchResults:t.results?.results,className:"flex-1 min-h-0"})]})});case"memo":return(0,e.jsx)(F,{componentName:"NotesAndLogsPane",children:(0,e.jsx)(dO,{worktreeId:b,className:"h-full",selectedAgents:v,onSelectedAgentsChange:w,availableAgents:x,maxAgents:y,persistToServer:z,vibeLocalModel:A,onVibeLocalModelChange:B,vibeLocalContextWindow:C,onVibeLocalContextWindowChange:D,onInsertToMessage:J,useInstanceManagement:Q,instances:R,onInstancesChange:S,visibleInstanceIds:T,onToggleInstanceVisible:U})});case"info":return(0,e.jsx)(el,{worktreeId:b,worktree:c,onWorktreeUpdate:j});default:return null}}),eo=[{value:null,labelKey:"worktreeStatus.notSet"},{value:"ready",labelKey:"worktreeStatus.ready"},{value:"in_progress",labelKey:"worktreeStatus.inProgress"},{value:"in_review",labelKey:"worktreeStatus.inReview"},{value:"done",labelKey:"worktreeStatus.done"}];function ep(a,b,c,d){let[e,f]=(0,h.useState)(!1),[g,i]=(0,h.useState)(""),[j,k]=(0,h.useState)(!1),l=(0,h.useCallback)(async()=>{if(a){k(!0);try{let c=await T.y.updateDescription(a.id,g);b(c),f(!1)}catch(a){console.error("Failed to save description:",a)}finally{k(!1)}}},[a,g,b]),m=(0,h.useCallback)(()=>{i(a?.description||""),f(!1)},[a]);return{isEditing:e,text:g,setText:i,isSaving:j,handleSave:l,handleCancel:m,startEditing:(0,h.useCallback)(()=>{f(!0)},[])}}let eq=(0,h.memo)(function({worktreeId:a,worktree:b,cardClassName:c,descriptionEditor:d,showLogs:f,onToggleLogs:g,onWorktreeUpdate:i}){let{isEditing:j,text:l,setText:m,isSaving:o,handleSave:p,handleCancel:q,startEditing:r}=d,s=(0,k.c)("worktree"),t=(0,k.c)("common"),[u,v]=(0,h.useState)(!1),[w,x]=(0,h.useState)(!1),y=(0,h.useRef)(void 0),z=(0,h.useRef)(void 0);(0,h.useEffect)(()=>()=>{y.current&&clearTimeout(y.current),z.current&&clearTimeout(z.current)},[]);let A=(0,h.useCallback)(async()=>{try{await (0,ar.l)(b.path),v(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>v(!1),ah.pX)}catch{}},[b.path]),B=(0,h.useCallback)(async()=>{try{await (0,ar.l)(b.repositoryPath),x(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>x(!1),ah.pX)}catch{}},[b.repositoryPath]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.worktree")}),(0,e.jsx)("p",{className:"text-lg font-semibold text-foreground",children:b.name})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.repository")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:B,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":s("detail.copyRepositoryPath"),title:w?s("detail.copied"):s("detail.copyRepositoryPath"),children:w?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("p",{className:"text-base text-foreground",children:b.repositoryDisplayName??b.repositoryName}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:b.repositoryPath})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.path")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:A,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":s("detail.copyWorktreePath"),title:u?s("detail.copied"):s("detail.copyPath"),children:u?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("p",{className:"text-sm text-foreground break-all font-mono",children:b.path})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.status")}),(0,e.jsx)("select",{value:b.status??"",onChange:async a=>{let c=a.target.value;try{let a=await fetch(`/api/worktrees/${b.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:""===c?null:c})});if(a.ok&&i){let b=await a.json();i(b)}}catch{}},className:"text-sm px-3 py-1.5 rounded-lg border border-input bg-surface text-foreground focus:ring-2 focus:ring-ring focus:border-transparent w-full","data-testid":"mobile-status-dropdown","aria-label":s("detail.worktreeStatusLabel"),children:eo.map(a=>(0,e.jsx)("option",{value:a.value??"",children:s(a.labelKey)},a.labelKey))})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.description")}),!j&&(0,e.jsx)("button",{type:"button",onClick:r,className:"text-sm text-accent-600 hover:text-accent-800 dark:text-accent-400 dark:hover:text-accent-300",children:s("actions.edit")})]}),j?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("textarea",{value:l,onChange:a=>m(a.target.value),placeholder:s("detail.addNotesPlaceholder"),className:"w-full min-h-[150px] p-3 border border-input dark:bg-surface dark:text-foreground rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",autoFocus:!0}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:p,disabled:o,className:"px-4 py-2 bg-accent-600 text-white rounded-lg hover:bg-accent-700 disabled:opacity-50 text-sm font-medium",children:o?s("actions.saving"):s("actions.save")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:q,disabled:o,className:"px-4 py-2 bg-muted text-foreground rounded-lg hover:bg-border disabled:opacity-50 text-sm font-medium",children:t("cancel")})]})]}):(0,e.jsx)("div",{className:"min-h-[50px]",children:b.description?(0,e.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:b.description}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground italic",children:s("detail.noDescription")})})]}),b.link&&(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.link")}),(0,e.jsx)("a",{href:b.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-600 hover:underline break-all",children:b.link})]}),b.updatedAt&&(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.lastUpdated")}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:new Date(b.updatedAt).toLocaleString()})]}),(0,e.jsx)(aZ,{version:"v0.11.0",className:c}),(0,e.jsx)(a4,{className:c}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.logs")}),(0,e.jsx)("button",{type:"button",onClick:g,className:"text-sm text-accent-600 hover:text-accent-800",children:f?s("detail.hide"):s("detail.show")})]}),f&&(0,e.jsx)(aV,{worktreeId:a})]})]})}),er=(0,h.memo)(function({worktreeName:a,repositoryName:b,description:c,status:d,gitStatus:f,onBackClick:g,onInfoClick:i,hasUpdate:j,worktreeStatus:l,onWorktreeStatusChange:m,sessionStatusByCli:p,sessionStatusByInstance:q,instances:s,activeInstanceId:t,onActiveInstanceChange:u,onAgentDragStart:v,onAgentDragEnd:w,onKillSession:x}){let y=(0,k.c)("worktree"),z=(0,k.c)("common"),A=aQ.sb[d],B=A?y(A):void 0,[D,E]=(0,h.useState)(null),F=s?.find(a=>a.id===t),G=!!t&&(q?.[t]?.isRunning??(F?p?.[F.cliTool]?.isRunning:void 0)??!1),H=(0,h.useCallback)((a,b)=>{a.dataTransfer.setData(a9,b),a.dataTransfer.effectAllowed="move",E(b),v?.(b)},[v]),I=(0,h.useCallback)(()=>{E(null),w?.()},[w]),J=c?r(c,50):null;return(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-surface border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("button",{type:"button",onClick:g,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":y("detail.goBack"),"data-testid":"worktree-back-button",children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-4 0a1 1 0 01-1-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 01-1 1h-2z"})}),(0,e.jsx)("span",{className:"text-sm font-medium",children:y("detail.home")})]}),(0,e.jsx)("div",{className:"w-px h-6 bg-border","aria-hidden":"true"}),(0,e.jsx)(o.m,{"data-testid":"desktop-status-indicator",status:d,size:"lg",label:B}),(0,e.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground truncate max-w-[200px] leading-tight",children:a}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"truncate max-w-[200px]",children:b}),f&&"(unknown)"!==f.currentBranch&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"/"}),(0,e.jsx)("span",{className:"truncate max-w-[150px] font-mono",title:f.currentBranch,"data-testid":"desktop-branch-name",children:r(f.currentBranch,30)}),f.isDirty&&(0,e.jsx)("span",{className:"text-warning",title:y("git.uncommittedChanges"),children:"*"})]}),J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"—"}),(0,e.jsx)("span",{className:"truncate max-w-[300px] text-muted-foreground",title:c,children:J})]})]})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[s&&s.length>0&&(()=>{let a=(0,aT.Uw)(s.map(a=>({item:a,status:(0,a6.kA)(q?.[a.id]??p?.[a.cliTool]),isActive:a.id===t})),4),b=a.filter(a=>"overflow"===a.slot),c=b.find(a=>"running"===a.status||"generating"===a.status)?.status??b.find(a=>"waiting"===a.status)?.status??null;return(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0","data-testid":"desktop-agent-status-row",children:[a.map(a=>{if("overflow"===a.slot)return null;let b=a.item,c=y("detail.statusPill",{label:(0,a7.sw)(b),status:z(`status.${a.status}`)}),d=a.isActive,f={draggable:!0,onDragStart:a=>H(a,b.id),onDragEnd:I},g=D===b.id?" opacity-50 cursor-grabbing":"";return"pill"===a.slot?(0,e.jsxs)("button",{type:"button","data-testid":`desktop-agent-status-${b.id}`,onClick:()=>u?.(b.id),...f,"aria-label":c,"aria-pressed":d,className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${d?"bg-accent-100 dark:bg-accent-900/30 text-accent-900 dark:text-accent-100":"hover:bg-muted text-foreground"}${g}`,children:[(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0}),(0,e.jsx)("span",{className:"whitespace-nowrap",children:c})]},b.id):(0,e.jsx)(aR.m_,{content:c,placement:"bottom",children:(0,e.jsx)("button",{type:"button","data-testid":`desktop-agent-status-${b.id}`,onClick:()=>u?.(b.id),...f,"aria-label":c,"aria-pressed":d,className:`flex items-center justify-center w-6 h-6 rounded-full transition-colors ${d?"bg-accent-100 dark:bg-accent-900/30":"hover:bg-muted"}${g}`,children:(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0})})},b.id)}),b.length>0&&(0,e.jsxs)(aS.rI,{children:[(0,e.jsx)(aS.ty,{asChild:!0,children:(0,e.jsxs)("button",{type:"button","data-testid":"desktop-agent-status-overflow","aria-label":y("agentStatus.moreAgents",{count:b.length}),className:"flex items-center gap-1 px-2 py-1 rounded text-xs tabular-nums text-muted-foreground hover:bg-muted transition-colors",children:[c&&(0,e.jsx)(o.m,{status:c,size:"sm","aria-hidden":!0,title:void 0}),"+",b.length]})}),(0,e.jsx)(aS.SQ,{align:"end",children:b.map(a=>{let b=a.item,c=y("detail.statusPill",{label:(0,a7.sw)(b),status:z(`status.${a.status}`)});return(0,e.jsxs)(aS._2,{"data-testid":`desktop-agent-overflow-${b.id}`,onSelect:()=>u?.(b.id),children:[(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0}),(0,e.jsx)("span",{className:"whitespace-nowrap",children:c})]},b.id)})})]})]})})(),x&&G&&(0,e.jsxs)(n.$n,{variant:"ghost",type:"button",onClick:x,className:"flex items-center gap-1 px-2 py-1.5 text-xs font-medium rounded-lg text-danger-foreground hover:bg-danger-subtle transition-colors flex-shrink-0","aria-label":y("terminal.endSession"),"data-testid":"desktop-kill-session",children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"✕"}),z("end")]}),m&&(0,e.jsx)("select",{value:l??"",onChange:a=>{let b=a.target.value;m(""===b?null:b)},onClick:a=>a.stopPropagation(),className:"text-xs px-2 py-1.5 rounded-lg border border-input bg-surface text-foreground focus:ring-2 focus:ring-ring focus:border-transparent cursor-pointer","data-testid":"desktop-status-dropdown","aria-label":y("detail.worktreeStatusLabel"),children:eo.map(a=>(0,e.jsx)("option",{value:a.value??"",children:y(a.labelKey)},a.labelKey))}),(0,e.jsx)(bb.g,{}),(0,e.jsxs)(n.$n,{variant:"ghost",type:"button",onClick:i,className:"relative flex items-center gap-1.5 px-3 py-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors","aria-label":y("detail.viewInfo"),children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("span",{className:"text-sm font-medium",children:y("detail.info")}),j&&(0,e.jsx)(C,{"data-testid":"info-update-indicator",className:"absolute top-0 right-0","aria-label":y("tabs.updateAvailable")})]})]})]})}),es=(0,h.memo)(function({worktreeId:a,worktree:b,isOpen:c,onClose:d,onWorktreeUpdate:f}){let[g,i]=(0,h.useState)(!1),j=(0,k.c)("worktree"),l=(0,h.useRef)(c),m=ep(b,f,c,()=>{let a=c&&!l.current;return l.current=c,a});return b?(0,e.jsx)(a5.a,{isOpen:c,onClose:d,title:j("detail.infoModalTitle"),size:"md",children:(0,e.jsx)("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto","data-testid":"worktree-info-modal",children:(0,e.jsx)(eq,{worktreeId:a,worktree:b,cardClassName:"bg-muted rounded-lg p-4",descriptionEditor:m,showLogs:g,onToggleLogs:()=>i(!g),onWorktreeUpdate:f})})}):null}),et=(0,h.memo)(function(){let a=(0,k.c)("worktree");return(0,e.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"status","aria-live":"polite",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,e.jsx)(n.y$,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"text-muted-foreground",children:a("detail.loading")})]})})}),eu=(0,h.memo)(function({message:a,onRetry:b}){let c=(0,k.c)("worktree"),d=(0,k.c)("common");return(0,e.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"alert","aria-live":"assertive",children:(0,e.jsxs)("div",{className:"text-center p-6 bg-danger-subtle rounded-lg border border-danger-border max-w-md",children:[(0,e.jsx)("svg",{className:"mx-auto h-12 w-12 text-danger-foreground/70 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-danger-foreground font-medium",children:c("detail.errorLoading")}),(0,e.jsx)("p",{className:"text-danger-foreground/80 text-sm mt-2",children:a}),b&&(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:b,className:"mt-4 px-4 py-2 bg-danger-foreground text-danger-subtle rounded-lg hover:opacity-90 transition-opacity focus:outline-none focus:ring-2 focus:ring-danger focus:ring-offset-2 ring-offset-background",children:d("retry")})]})})}),ev=(0,h.memo)(function({activityPane:a,rightPane:b,activityPaneWidth:c=18,minPaneWidth:d=10,maxPaneWidth:f=60,onActivityPaneResize:g,className:i=""}){let j=(0,h.useRef)(null),l=(0,k.c)("worktree"),[m,n]=(0,h.useState)(c),o=g?c:m,p=(0,h.useCallback)(a=>{let b=j.current;if(!b)return;let e=b.offsetWidth;if(0===e)return;let h=Math.min(f,Math.max(d,(g?c:m)+a/e*100));g?g(h):n(h)},[c,m,d,f,g]),q=(0,h.useMemo)(()=>`flex h-full min-h-0 ${i}`.trim(),[i]);return(0,e.jsx)("div",{ref:j,className:"h-full",children:(0,e.jsxs)("div",{"data-testid":"desktop-layout",role:"main",className:q,children:[null!==a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:"worktree-activity-pane","data-testid":"activity-pane-slot","aria-label":l("desktopLayout.activityPane"),style:{width:`${o}%`},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,e.jsx)(F,{componentName:"ActivityPane",children:a})}),(0,e.jsx)(ch,{onResize:p,orientation:"horizontal",ariaValueNow:o})]}),(0,e.jsx)("div",{id:"worktree-right-pane","data-testid":"right-pane-slot","aria-label":l("desktopLayout.terminalPane"),className:"flex-grow overflow-hidden min-w-0",children:(0,e.jsx)(F,{componentName:"TerminalPane",children:b})})]})})}),ew=(0,x.A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),ex=(0,x.A)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var ey=c(57898);let ez=(0,x.A)("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"}]]),eA=(0,x.A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);var eB=c(55056);let eC=(0,x.A)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),eD=(0,x.A)("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"}]]),eE=[{id:"files",labelKey:"activityBar.files",icon:ex},{id:"git",labelKey:"activityBar.git",icon:ey.A},{id:"notes",labelKey:"activityBar.notes",icon:ez},{id:"schedules",labelKey:"activityBar.schedules",icon:eA},{id:"agent",labelKey:"activityBar.agent",icon:eB.A},{id:"timer",labelKey:"activityBar.timer",icon:eC},{id:"todo",labelKey:"activityBar.todo",icon:eD}];eE.map(a=>a.id);var eF=c(81092);let eG=(0,h.memo)(function({active:a,onToggle:b,className:c=""}){let d=(0,k.c)("worktree"),f=(0,h.useRef)([]),{isOpen:g,toggle:i}=(0,eF.VF)(),j=(0,h.useCallback)((a,c,d)=>{if("Enter"===a.key||" "===a.key){a.preventDefault(),b(d);return}if("ArrowDown"===a.key){a.preventDefault();let b=(c+1)%eE.length;f.current[b]?.focus();return}if("ArrowUp"===a.key){a.preventDefault();let b=(c-1+eE.length)%eE.length;f.current[b]?.focus();return}if("Home"===a.key){a.preventDefault(),f.current[0]?.focus();return}if("End"===a.key){a.preventDefault(),f.current[eE.length-1]?.focus();return}},[b]);return(0,e.jsxs)("div",{"data-testid":"activity-bar",className:`flex flex-col items-stretch w-12 flex-shrink-0 bg-muted border-r border-border ${c}`.trim(),children:[(0,e.jsx)(aR.m_,{content:d("activityBar.toggleSidebar"),placement:"right",children:(0,e.jsx)("button",{type:"button","data-testid":"activity-bar-toggle-sidebar",onClick:i,"aria-label":d("activityBar.toggleSidebar"),"aria-expanded":g,className:"flex items-center justify-center h-12 w-12 text-muted-foreground transition-colors hover:text-surface-foreground hover:bg-muted-foreground/10 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",children:(0,e.jsx)(ew,{size:20,"aria-hidden":"true"})})}),(0,e.jsx)("div",{className:"mx-2 my-1 border-b border-border","aria-hidden":"true"}),(0,e.jsx)("div",{id:"worktree-activity-bar",role:"tablist","aria-orientation":"vertical","aria-label":d("activityBar.label"),className:"flex flex-col items-stretch",children:eE.map((c,g)=>{let h=c.icon,i=a===c.id,k=d(c.labelKey);return(0,e.jsx)(aR.m_,{content:k,placement:"right",children:(0,e.jsx)("button",{ref:a=>{f.current[g]=a},type:"button",role:"tab","aria-selected":i,"aria-label":k,"aria-controls":"worktree-activity-pane",tabIndex:i||null===a&&0===g?0:-1,onClick:()=>b(c.id),onKeyDown:a=>j(a,g,c.id),"data-testid":`activity-bar-button-${c.id}`,className:"group flex items-center justify-center h-12 w-12 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",children:(0,e.jsx)("span",{"aria-hidden":"true",className:`flex items-center justify-center h-9 w-9 rounded-md transition-colors ${i?"bg-accent-500/10 text-accent-600 dark:text-accent-400":"text-muted-foreground group-hover:text-surface-foreground group-hover:bg-muted-foreground/10"}`,children:(0,e.jsx)(h,{size:20,"aria-hidden":"true"})})})},c.id)})})]})}),eH="worktree-activity-pane",eI={files:"FileTreeView",git:"GitPane",notes:"MemoPane",schedules:"ExecutionLogPane",agent:"AgentSettingsPane",timer:"TimerPane",todo:"TodoPane"},eJ=(0,h.memo)(function({active:a,activities:b,className:c=""}){if(null===a)return(0,e.jsx)("div",{id:eH,"data-testid":"activity-pane","data-active":"none",className:`h-full flex flex-col ${c}`.trim()});let d=b[a],f=eI[a];return(0,e.jsx)("div",{id:eH,"data-testid":"activity-pane","data-active":a,role:"tabpanel","aria-labelledby":`activity-bar-button-${a}`,className:`h-full flex flex-col min-h-0 ${c}`.trim(),children:(0,e.jsx)(F,{componentName:f,children:d??null})})}),eK=(0,h.memo)(function({inputRef:a,searchQuery:b,onQueryChange:c,matchCount:d,currentIdx:f,onNextMatch:g,onPrevMatch:h,onClose:i}){let j=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted border-b border-input flex-shrink-0",children:[(0,e.jsx)("input",{ref:a,type:"text",value:b,onChange:a=>c(a.target.value),onKeyDown:a=>{"Escape"===a.key&&i(),"Enter"===a.key&&(a.shiftKey?h():g())},placeholder:j("fileSearch.placeholder"),className:"flex-1 min-w-0 px-2 py-0.5 text-sm bg-surface dark:text-foreground border border-input rounded outline-none focus:ring-1 focus:ring-ring",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground min-w-[3rem] text-right",children:d>0?`${f+1}/${d}`:"0/0"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:h,disabled:0===d,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white disabled:text-muted-foreground/50","aria-label":j("fileSearch.prevMatch"),children:"▲"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:g,disabled:0===d,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white disabled:text-muted-foreground/50","aria-label":j("fileSearch.nextMatch"),children:"▼"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:i,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white","aria-label":j("fileSearch.close"),children:(0,e.jsx)(as.A,{className:"w-4 h-4"})})]})}),eL=[{extension:".png",maxFileSize:0x1400000,allowedMimeTypes:["image/png"],magicBytes:[{bytes:[137,80,78,71,13,10,26,10]}]},{extension:".jpg",maxFileSize:0x1400000,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".jpeg",maxFileSize:0x1400000,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".gif",maxFileSize:0x1400000,allowedMimeTypes:["image/gif"],magicBytes:[{bytes:[71,73,70,56,55,97]},{bytes:[71,73,70,56,57,97]}]},{extension:".webp",maxFileSize:0x1400000,allowedMimeTypes:["image/webp"],magicBytes:[{bytes:[82,73,70,70],offset:0}]},{extension:".mp4",maxFileSize:0x6400000,allowedMimeTypes:["video/mp4"],magicBytes:[{bytes:[102,116,121,112],offset:4}]},{extension:".txt",maxFileSize:0x1400000,allowedMimeTypes:["text/plain"]},{extension:".log",maxFileSize:0x1400000,allowedMimeTypes:["text/plain"]},{extension:".md",maxFileSize:0x1400000,allowedMimeTypes:["text/markdown","text/plain"]},{extension:".csv",maxFileSize:0x1400000,allowedMimeTypes:["text/csv"]},{extension:".json",maxFileSize:0x1400000,allowedMimeTypes:["application/json"]},{extension:".yaml",maxFileSize:0x1400000,allowedMimeTypes:["text/yaml","application/x-yaml"]},{extension:".yml",maxFileSize:0x1400000,allowedMimeTypes:["text/yaml","application/x-yaml"]}],eM=eL.map(a=>a.extension),eN=[".md",".html",".htm",".yaml",".yml"];var eO=c(79689);function eP(){return(0,e.jsx)("div",{className:"flex items-center justify-center py-12 bg-surface",children:(0,e.jsx)(m.y,{size:"xl",variant:"accent"})})}let eQ=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/HtmlPreview"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eR=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/PdfPreview"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eS=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/MarkdownEditor"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eT=/^---\s*\nmarp:\s*true/;function eU(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,e.jsx)(m.y,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"ml-3 text-muted-foreground",children:a("fileViewer.loading")})]})}function eV({error:a}){return(0,e.jsx)("div",{className:"bg-danger-subtle border border-danger-border rounded-lg p-4 m-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-danger-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-sm text-danger-foreground",children:a})]})})}function eW({filePath:a,isMaximized:b,onToggleMaximize:c,copyableContent:d,onSearch:f}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)(!1),[l,m]=(0,h.useState)(!1),n=(0,h.useRef)(null),o=(0,h.useRef)(null),p=async()=>{try{await (0,ar.l)(a),j(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>j(!1),ah.pX)}catch{}},q=async()=>{if(d)try{await (0,ar.l)(d),m(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>m(!1),ah.pX)}catch{}};return(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("button",{type:"button",onClick:p,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.copyFilePath"),title:g("actions.copyPath"),children:i?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",title:a,children:a})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[f&&(0,e.jsx)("button",{type:"button",onClick:f,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.searchInFile"),title:g("actions.search"),children:(0,e.jsx)(Q.A,{className:"w-3.5 h-3.5"})}),d&&(0,e.jsx)("button",{type:"button",onClick:q,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.copyFileContent"),title:g("actions.copyContent"),children:l?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(ax,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{type:"button",onClick:c,className:"flex-shrink-0 p-1.5 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g(b?"actions.minimize":"actions.maximize"),title:g(b?"actions.minimize":"actions.maximize"),children:b?(0,e.jsx)(ay,{className:"w-4 h-4"}):(0,e.jsx)(az,{className:"w-4 h-4"})})]})]})}function eX({content:a,extension:b,searchMatches:c,searchCurrentIdx:d,totalLines:f,rangeStart:g,worktreeId:i,filePath:j,onLineRangeFetched:k}){let l=(0,h.useRef)(null),m=(0,h.useMemo)(()=>a.split("\n"),[a]),n=Math.max(1,g??1),o=m.length,p=Math.max(f??o,o),q=(0,h.useRef)(new Map),r=(0,h.useCallback)(a=>{let c=Math.floor(a/500),d=q.current,e=d.get(c);if(!e){let a=500*c,f=Math.min(a+500,m.length),g=m.slice(a,f).join("\n"),h="";try{h=aK.highlight(g,{language:b,ignoreIllegals:!0}).value}catch{h=aK.highlightAuto(g).value}e=h.split("\n"),d.set(c,e)}return e[a-500*c]??""},[m,b]),s=(0,h.useMemo)(()=>new Set(c??[]),[c]),t=(c?.length??0)>0?c[d??0]:-1,u=bI({count:p,getScrollElement:()=>l.current,estimateSize:()=>24,overscan:100}),v=u.getVirtualItems();return!function({virtualItems:a,worktreeId:b,filePath:c,onLineRangeFetched:d,loadedStart:e,loadedLineCount:f}){(0,h.useRef)(new Set)}({virtualItems:v,worktreeId:i,filePath:j,onLineRangeFetched:k,loadedStart:n,loadedLineCount:o}),(0,e.jsx)("div",{className:"overflow-auto h-full",ref:l,"data-testid":"file-content-code",children:(0,e.jsx)("div",{style:{height:u.getTotalSize(),width:"100%",position:"relative"},children:v.map(a=>{let b=a.index+1,c=b-n,d=c>=0&&c<o,f=b===t,g=s.has(b),h=d?r(c):"";return(0,e.jsxs)("div",{"data-line":b,"data-index":a.index,ref:u.measureElement,className:`absolute left-0 right-0 flex font-mono text-sm ${f?"bg-warning/30":g?"bg-warning/15":""}`,style:{top:0,transform:`translateY(${a.start}px)`,height:"24px",lineHeight:"24px"},children:[(0,e.jsx)("div",{className:`px-3 text-right select-none border-r border-border bg-muted dark:bg-muted/50 whitespace-nowrap ${f||g?"text-warning-foreground":"text-muted-foreground"}`,style:{minWidth:"4rem"},children:b}),(0,e.jsx)("div",{className:"px-4 text-foreground flex-1 min-w-0 overflow-hidden",children:d?(0,e.jsx)("code",{className:"hljs",style:{padding:0,background:"transparent",whiteSpace:"pre"},dangerouslySetInnerHTML:{__html:h}}):(0,e.jsx)(eO.E,{className:"h-4 w-3/4"})})]},a.key)})})})}function eY({slides:a,fileName:b}){let c=(0,k.c)("worktree"),[d,f]=(0,h.useState)(0);return 0===a.length?(0,e.jsx)("div",{className:"p-4 text-muted-foreground",children:c("fileViewer.noSlides",{fileName:b})}):(0,e.jsxs)("div",{className:"h-full flex flex-col","data-testid":"marp-preview",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border bg-muted",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{f(a=>Math.max(0,a-1))},disabled:0===d,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:c("actions.prev")}),(0,e.jsxs)("span",{className:"text-sm text-muted-foreground",children:[d+1," / ",a.length]}),(0,e.jsx)("button",{type:"button",onClick:()=>{f(b=>Math.min(a.length-1,b+1))},disabled:d===a.length-1,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:c("actions.next")})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,e.jsx)("iframe",{srcDoc:a[d],sandbox:"",title:c("fileViewer.slideTitle",{name:b,number:d+1}),className:"w-full h-full border-0"})})]})}function eZ({marpSlides:a,fileName:b,worktreeId:c,filePath:d,contentText:f,onFileSaved:g,isMaximized:i,onToggleMaximize:j,onDirtyChange:l,onOpenFile:m}){let n=(0,k.c)("worktree"),[o,p]=(0,h.useState)("slides");return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border bg-muted",children:[(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)("button",{type:"button",onClick:()=>p("slides"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"slides"===o?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:n("fileViewer.slides")}),(0,e.jsx)("button",{type:"button",onClick:()=>p("editor"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"editor"===o?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:n("fileViewer.editor")})]}),(0,e.jsx)(eW,{filePath:d,isMaximized:i,onToggleMaximize:j,copyableContent:f})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:"slides"===o?(0,e.jsx)(eY,{slides:a,fileName:b}):(0,e.jsx)(eS,{worktreeId:c,filePath:d,onSave:g,initialViewMode:"split",onDirtyChange:l,onOpenFile:m})})]})}function e$({children:a,isMaximized:b,onToggle:c,filePath:d}){return b?(0,e.jsxs)("div",{className:"fixed inset-0 bg-surface flex flex-col",style:{zIndex:aA.M.MAXIMIZED_EDITOR},children:[(0,e.jsx)(eW,{filePath:d,isMaximized:b,onToggleMaximize:c}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:a})]}):(0,e.jsx)(e.Fragment,{children:a})}function e_({tab:a,content:b,worktreeId:c,isMaximized:d,onToggleMaximize:f,onFileSaved:g,onDirtyChange:h,onOpenFile:i}){let j=aJ(b.content);return(0,e.jsxs)(e.Fragment,{children:[!d&&(0,e.jsx)(eW,{filePath:a.path,isMaximized:d,onToggleMaximize:f,copyableContent:b.content,onSearch:j.openSearch}),j.searchOpen&&(0,e.jsx)(eK,{inputRef:j.searchInputRef,searchQuery:j.searchQuery,onQueryChange:j.setSearchQuery,matchCount:j.searchMatches.length,currentIdx:j.searchCurrentIdx,onNextMatch:j.nextMatch,onPrevMatch:j.prevMatch,onClose:j.closeSearch}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:j.searchOpen&&j.searchQuery.length>=2?(0,e.jsx)(eX,{content:b.content,extension:"md",searchMatches:j.searchMatches,searchCurrentIdx:j.searchCurrentIdx}):(0,e.jsx)(eS,{worktreeId:c,filePath:a.path,onSave:g,initialViewMode:"preview",onDirtyChange:h,onOpenFile:i})})]})}function e0({tab:a,content:b,worktreeId:c,isMaximized:d,onToggleMaximize:f,onLoadContent:g}){let i=aJ(b.content),j=(0,h.useCallback)(c=>{g&&g(a.path,{...b,content:c.content,totalLines:c.totalLines,totalBytes:c.totalBytes??b.totalBytes,range:c.range})},[g,a.path,b]),k=void 0!==b.range&&(b.totalLines??0)>b.range.end-b.range.start+1;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:d,onToggleMaximize:f,copyableContent:b.content,onSearch:i.openSearch}),i.searchOpen&&(0,e.jsx)(eK,{inputRef:i.searchInputRef,searchQuery:i.searchQuery,onQueryChange:i.setSearchQuery,matchCount:i.searchMatches.length,currentIdx:i.searchCurrentIdx,onNextMatch:i.nextMatch,onPrevMatch:i.prevMatch,onClose:i.closeSearch}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eX,{content:b.content,extension:b.extension,searchMatches:i.searchOpen?i.searchMatches:void 0,searchCurrentIdx:i.searchOpen?i.searchCurrentIdx:void 0,totalLines:b.totalLines,rangeStart:b.range?.start,worktreeId:k?c:void 0,filePath:k?a.path:void 0,onLineRangeFetched:k?j:void 0})})]})}let e1=(0,h.memo)(function({tab:a,worktreeId:b,onLoadContent:c,onLoadError:d,onSetLoading:f,onFileSaved:g,onDirtyChange:i,onOpenFile:j}){let l=(0,k.c)("worktree"),m=(0,h.useRef)(l);m.current=l;let n=(0,h.useRef)(!1),[o,p]=(0,h.useState)(null),[q,r]=(0,h.useState)(!1);!function({tab:a,worktreeId:b,onLoadContent:c}){let d=(0,h.useRef)(null),e=(0,h.useRef)(c);e.current=c;let f=(0,h.useRef)(a.path);f.current=a.path,cM({intervalMs:5e3,enabled:function(a){if(null===a.content||a.loading||a.isDirty||a.content.isPdf)return!1;let{totalBytes:b}=a.content;return void 0===b||!(b>=1048576)}(a),onPoll:async()=>{let a=`/api/worktrees/${b}/files/${aB(f.current)}`,c={};d.current&&(c["If-Modified-Since"]=d.current);try{let b=await fetch(a,{headers:c});if(304===b.status||!b.ok)return;d.current=b.headers.get("Last-Modified");let g=await b.json();e.current(f.current,g)}catch{}}})}({tab:a,worktreeId:b,onLoadContent:c});let s=(0,h.useMemo)(()=>i?b=>i(a.path,b):void 0,[i,a.path]),t=(0,h.useCallback)(()=>{r(a=>!a)},[]);(0,h.useEffect)(()=>{if(!q)return;let a=a=>{"Escape"===a.key&&r(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[q]),(0,h.useEffect)(()=>{null!==a.content||a.loading||null!==a.error||n.current||(n.current=!0,f(a.path,!0),(async()=>{try{let e=await fetch(`/api/worktrees/${b}/files/${aB(a.path)}`);if(304===e.status)return;if(!e.ok){let b=await e.json(),c="string"==typeof b.error?b.error:b.error?.message||m.current("fileViewer.loadError");d(a.path,c);return}let f=await e.json();c(a.path,f)}catch(b){d(a.path,b instanceof Error?b.message:m.current("fileViewer.loadError"))}finally{n.current=!1}})())},[a.content,a.loading,a.error,a.path,b,c,d,f]);let u=a.content?.content??null,v=a.content?.extension??null;if((0,h.useEffect)(()=>{if(!u||"md"!==v||!eT.test(u)||u.length>1e6)return void p(null);let a=!1;return(async()=>{try{let c=await fetch(`/api/worktrees/${b}/marp-render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdownContent:u})});if(c.ok){let b=await c.json();a||p(Array.isArray(b.slides)?b.slides:null)}}catch{}})(),()=>{a=!0}},[u,v,b]),a.loading)return(0,e.jsx)(eU,{});if(a.error)return(0,e.jsx)(eV,{error:a.error});if(!a.content)return null;let{content:w}=a;return w.isImage?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsx)(an.a,{src:w.content,alt:w.path,mimeType:w.mimeType})})]})}):w.isVideo?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsx)(ao.u,{src:w.content,mimeType:w.mimeType})})]})}):w.isPdf?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eR,{dataUri:w.content,filePath:a.path})})]})}):w.isHtml?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t,copyableContent:w.content}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eQ,{worktreeId:b,filePath:a.path,htmlContent:w.content,onFileSaved:g,onOpenFile:j})})]})}):"md"===w.extension?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)("div",{className:"h-full flex flex-col",children:o?(0,e.jsx)(eZ,{marpSlides:o,fileName:a.name,worktreeId:b,filePath:a.path,contentText:w.content,onFileSaved:g,isMaximized:q,onToggleMaximize:t,onDirtyChange:s,onOpenFile:j}):(0,e.jsx)(e_,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onFileSaved:g,onDirtyChange:s,onOpenFile:j})})}):!function(a){if(!a)return!1;let b=a.toLowerCase();return eN.includes(b)}("."+w.extension)?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)(e0,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onLoadContent:c})}):(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)("div",{className:"h-full flex flex-col",children:(0,e.jsx)(e_,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onFileSaved:g,onDirtyChange:s,onOpenFile:j})})})});function e2(a,b,c){if(b<=0||c<=0)return 0;let d=a+b+8-c;return d>0?-Math.min(d,Math.max(0,a-8)):a<8?8-a:0}let e3=(0,h.memo)(function({tab:a,isActive:b,onActivate:c,onClose:d}){let f=(0,k.c)("worktree"),g=(0,h.useCallback)(()=>{b||c(a.path)},[b,c,a.path]),i=(0,h.useCallback)(b=>{b.stopPropagation(),d(a.path)},[d,a.path]),j=b?"border-accent-500 text-accent-600 dark:text-accent-400 bg-surface":"border-transparent text-muted-foreground hover:text-foreground";return(0,e.jsxs)("div",{"data-testid":`file-tab-${a.path}`,"data-active":b,onClick:g,className:`flex items-center gap-1 px-3 py-2 text-sm font-medium border-b-2 cursor-pointer flex-shrink-0 ${j}`,children:[(0,e.jsx)("span",{className:"truncate max-w-[120px]",title:a.path,children:a.name}),a.isDirty&&(0,e.jsx)("span",{"data-testid":`file-tab-dirty-${a.path}`,className:"w-2 h-2 rounded-full bg-warning flex-shrink-0",title:f("fileTabs.unsavedChanges")}),(0,e.jsx)("button",{type:"button",onClick:i,className:"ml-1 p-0.5 rounded-sm hover:bg-muted transition-colors","aria-label":f("fileTabs.closeTab",{name:a.name}),children:(0,e.jsx)(as.A,{className:"w-3 h-3"})})]})}),e4=(0,h.memo)(function({tabs:a,activeIndex:b,worktreeId:c,onClose:d,onActivate:f,onLoadContent:g,onLoadError:i,onSetLoading:j,onFileSaved:k,onDirtyChange:l,onMoveToFront:m,onOpenFile:n}){let[o,p]=(0,h.useState)(!1),q=(0,h.useRef)(null),r=(0,h.useRef)(null),s=(0,h.useRef)({x:0,y:0}),[t,u]=(0,h.useState)({x:0,y:0}),v=null!==b&&b>=0&&b<a.length?a[b]:null,w=a.length>5?a.slice(0,5):a,x=a.length>5?a.slice(5):[];(0,h.useEffect)(()=>{if(!o)return;let a=a=>{q.current&&!q.current.contains(a.target)&&p(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[o]),(0,h.useLayoutEffect)(()=>{let a=a=>{s.current=a,u(b=>b.x===a.x&&b.y===a.y?b:a)};if(!o)return void a({x:0,y:0});let b=r.current;if(!b)return;let c=b.getBoundingClientRect();a({x:e2(c.left-s.current.x,c.width,window.innerWidth),y:e2(c.top-s.current.y,c.height,window.innerHeight)})},[o]);let y=(0,h.useCallback)(a=>{p(!1),m?.(a)},[m]),z=(0,h.useCallback)(()=>{p(a=>!a)},[]);return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex border-b border-border bg-surface dark:bg-surface-2 min-w-0",children:[(0,e.jsx)("div",{className:"flex min-w-0 overflow-hidden flex-1",children:w.map((a,c)=>(0,e.jsx)(e3,{tab:a,isActive:c===b,onActivate:f,onClose:d},a.path))}),x.length>0&&(0,e.jsxs)("div",{className:"relative flex-shrink-0",ref:q,children:[(0,e.jsxs)("button",{type:"button","data-testid":"tab-dropdown-button",onClick:z,className:"flex items-center gap-0.5 px-2 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-muted border-b-2 border-transparent transition-colors",children:[(0,e.jsx)(a8.A,{className:`w-3 h-3 transition-transform ${o?"rotate-180":""}`}),(0,e.jsxs)("span",{children:["+",x.length]})]}),o&&(0,e.jsx)("div",{ref:r,"data-testid":"tab-dropdown-menu",className:"absolute right-0 top-full mt-1 bg-surface border border-border rounded-md shadow-lg z-50 min-w-[200px] max-h-[300px] overflow-y-auto",style:0!==t.x||0!==t.y?{transform:`translate(${t.x}px, ${t.y}px)`}:void 0,children:x.map(a=>(0,e.jsxs)("button",{type:"button","data-testid":`tab-dropdown-item-${a.path}`,onClick:()=>y(a.path),className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-muted truncate",title:a.path,children:[a.name,a.isDirty&&(0,e.jsx)("span",{className:"ml-1 w-2 h-2 inline-block rounded-full bg-warning"})]},a.path))})]})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:v&&(0,e.jsx)(e1,{tab:v,worktreeId:c,onLoadContent:g,onLoadError:i,onSetLoading:j,onFileSaved:k,onDirtyChange:l,onOpenFile:n},v.path)})]})}),e5=(0,h.memo)(function({line:a}){let b="whitespace-pre font-mono text-xs leading-5";return a.startsWith("+")&&!a.startsWith("+++")?b+=" text-success-foreground bg-success-subtle":a.startsWith("-")&&!a.startsWith("---")?b+=" text-danger-foreground bg-danger-subtle":a.startsWith("@@")?b+=" text-info bg-info/10":a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++")?b+=" text-muted-foreground":b+=" text-foreground",(0,e.jsx)("div",{className:b,children:a})}),e6=(0,h.memo)(function({diff:a,filePath:b,onClose:c}){let d=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"h-full flex flex-col bg-surface",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border bg-muted shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-accent-600 dark:text-accent-400 shrink-0",children:d("diffViewer.badge")}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:b})]}),(0,e.jsx)("button",{type:"button",onClick:c,className:"p-1 text-muted-foreground hover:text-foreground rounded shrink-0","aria-label":d("diffViewer.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto p-2",children:(0,e.jsx)("pre",{className:"text-xs",children:(0,e.jsx)("code",{children:a.split("\n").map((a,b)=>(0,e.jsx)(e5,{line:a},b))})})})]})});function e7(){let[a,b]=(0,h.useState)(!1),c=(0,h.useRef)(a);c.current=a;let d=(0,h.useCallback)(a=>{b(a)},[]);return{collapsed:a,toggle:(0,h.useCallback)(()=>{d(!c.current)},[d]),setCollapsed:d}}let e8=(0,h.memo)(function({terminal:a,terminalHeader:b,fileTabs:c,worktreeId:d,onCloseTab:f,onActivateTab:g,onLoadContent:i,onLoadError:j,onSetLoading:l,onFileSaved:m,diffContent:n,diffFilePath:o,onCloseDiff:p,onDirtyChange:q,onMoveToFront:r,onOpenFile:s}){let t=(0,k.c)("worktree"),u=(0,h.useRef)(null),[v,w]=(0,h.useState)(50),{collapsed:x,toggle:y}=e7(),z=(0,h.useCallback)(a=>{let b=u.current;if(!b)return;let c=b.offsetWidth;if(0===c)return;let d=a/c*100;w(a=>Math.min(80,Math.max(20,a+d)))},[]),A=(0,h.useMemo)(()=>({width:`${v}%`}),[v]),B=(0,h.useMemo)(()=>({width:`${100-v}%`}),[v]),C=(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[b,(0,e.jsx)("div",{className:"flex-1 min-h-0",children:a})]});return c.tabs.length>0||n&&o?x?(0,e.jsxs)("div",{ref:u,className:"flex h-full min-h-0",children:[(0,e.jsx)("div",{"data-testid":"terminal-pane",style:{width:"calc(100% - 36px)"},className:"flex-shrink-0 overflow-hidden",children:C}),(0,e.jsx)("div",{"data-testid":"file-panel-expand-bar",style:{width:"36px"},className:"flex-shrink-0 flex items-start justify-center bg-muted border-l border-border",children:(0,e.jsxs)("button",{type:"button","aria-label":t("terminal.showFiles"),title:t("terminal.showFiles"),onClick:y,className:"flex flex-col items-center gap-2 w-full pt-2 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:t("terminal.filesLabel")})]})})]}):(0,e.jsxs)("div",{ref:u,className:"flex h-full min-h-0",children:[(0,e.jsx)("div",{"data-testid":"terminal-pane",style:A,className:"flex-shrink-0 overflow-hidden",children:C}),(0,e.jsx)(ch,{onResize:z,orientation:"horizontal",ariaValueNow:v}),(0,e.jsxs)("div",{"data-testid":"file-panel-pane",style:B,className:"flex-grow overflow-hidden flex",children:[(0,e.jsx)("button",{type:"button","aria-label":t("terminal.hideFiles"),title:t("terminal.hideFiles"),onClick:y,className:"flex-shrink-0 flex items-center justify-center w-5 h-full bg-muted border-r border-border text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),(0,e.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:n&&o&&p?(0,e.jsx)(e6,{diff:n,filePath:o,onClose:p}):(0,e.jsx)(e4,{tabs:c.tabs,activeIndex:c.activeIndex,worktreeId:d,onClose:f,onActivate:g,onLoadContent:i,onLoadError:j,onSetLoading:l,onFileSaved:m,onDirtyChange:q,onMoveToFront:r,onOpenFile:s})})]})]}):(0,e.jsx)("div",{className:"h-full",children:C})});var e9=c(51881);let fa=(0,x.A)("align-horizontal-distribute-center",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]),fb=(0,x.A)("history",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),fc=(0,x.A)("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),fd={splits:[{cliToolId:"claude",instanceId:"claude"}],widths:[1]};a7.XH;function fe(a){let b=a.reduce((a,b)=>a+b,0);return b>0?a.map(a=>a/b):a.map(()=>1/a.length)}let ff=(0,h.memo)(function({worktreeId:a,instances:b,rosterReady:c=!0,renderPane:d,onFocusedSplitChange:f,showToast:g,onActiveInstanceChange:j,headerInstanceSelection:l}){let{splits:m,widths:n,addSplit:o,removeSplit:p,setSplitInstance:q,setSplitWidth:r,resetWidths:s,availableInstanceIds:t,focusedSplitIndex:u,setFocusedSplitIndex:v}=function(a,b,c=!0){let[d,e]=(0,h.useState)(()=>(function(a,b,c){let d=function(a,b){let c=b[0];return c?{splits:[{cliToolId:c.cliTool,instanceId:c.id}],widths:[1]}:{splits:fd.splits.map(a=>({...a})),widths:[...fd.widths]}}(0,b);return c?function(a,b){let c;if(0===b.length)return a;let d=new Map(b.map(a=>[a.id,a.cliTool])),e=new Set,f=Math.min(Math.max(a.splits.length,1),b.length,3),g=[];for(let b of a.splits){if(g.length>=f)break;let a=d.get(b.instanceId);a&&!e.has(b.instanceId)&&(e.add(b.instanceId),g.push({cliToolId:a,instanceId:b.instanceId}))}for(let a of b){if(g.length>=f)break;e.has(a.id)||(e.add(a.id),g.push({cliToolId:a.cliTool,instanceId:a.id}))}return(0===g.length&&g.push({cliToolId:b[0].cliTool,instanceId:b[0].id}),g.length===a.splits.length&&g.every((b,c)=>b.instanceId===a.splits[c].instanceId&&b.cliToolId===a.splits[c].cliToolId))?a:(c=g.length===a.widths.length?fe(a.widths):g.length<a.widths.length?fe(a.widths.slice(0,g.length)):Array.from({length:g.length},()=>1/g.length),{splits:g,widths:c})}(d,b):d})(0,b,c)),[f,g]=(0,h.useState)(0),i=(0,h.useRef)(d);i.current=d;let j=(0,h.useRef)(b);j.current=b,(0,h.useRef)(c).current=c,(0,h.useRef)(a),(0,h.useMemo)(()=>b.map(a=>`${a.id}:${a.cliTool}`).join("|"),[b]),(0,h.useRef)(a);let k=(0,h.useCallback)(()=>{e(a=>{if(a.splits.length>=3)return a;let b=new Set(a.splits.map(a=>a.instanceId)),c=function(a,b){for(let c of a)if(!b.has(c.id))return c;return null}(j.current,b);if(!c)return a;let d=a.widths.length-1,e=a.widths[d]/2,f=[...a.widths];return f[d]=e,f.push(e),{splits:[...a.splits,{cliToolId:c.cliTool,instanceId:c.id}],widths:f}})},[]),l=(0,h.useCallback)(()=>{e(a=>a.splits.length<=1?a:{splits:a.splits.slice(0,-1),widths:fe(a.widths.slice(0,-1))})},[]),m=(0,h.useCallback)((a,b)=>{let c=i.current,d=j.current;if(a<0||a>=c.splits.length)return!1;let f=d.find(a=>a.id===b);if(!f||c.splits[a].instanceId===b)return!1;for(let d=0;d<c.splits.length;d++)if(d!==a&&c.splits[d].instanceId===b)return!1;return e(c=>{if(a<0||a>=c.splits.length||c.splits[a].instanceId===b)return c;for(let d=0;d<c.splits.length;d++)if(d!==a&&c.splits[d].instanceId===b)return c;let d=c.splits.map((c,d)=>d===a?{cliToolId:f.cliTool,instanceId:b}:c);return{...c,splits:d}}),!0},[]),n=(0,h.useCallback)(a=>{e(b=>a.length!==b.widths.length||!function(a){if(!Array.isArray(a))return!1;for(let b of a)if("number"!=typeof b||!Number.isFinite(b)||b<=0)return!1;return!0}(a)?b:{...b,widths:[...a]})},[]),o=(0,h.useCallback)(()=>{e(a=>{let b=a.splits.length;return 0===b?a:{...a,widths:Array.from({length:b},()=>1/b)}})},[]),p=(0,h.useCallback)(a=>{let c=new Set;for(let b=0;b<d.splits.length;b++)b!==a&&c.add(d.splits[b].instanceId);return b.filter(a=>!c.has(a.id)).map(a=>a.id)},[d.splits,b]),q=(0,h.useCallback)(a=>{g(a)},[]);return{splits:d.splits,widths:d.widths,addSplit:k,removeSplit:l,setSplitInstance:m,setSplitWidth:n,resetWidths:o,availableInstanceIds:p,focusedSplitIndex:f,setFocusedSplitIndex:q}}(a,b,c),w=(0,h.useMemo)(()=>{let a=new Map;for(let c of b)a.set(c.id,c);return a},[b]),x=(0,k.c)("worktree"),{visible:y,toggle:z,setWidth:A}=cc(),{collapsed:B,toggle:C}=e7(),D=!B,E=(0,h.useRef)(null),[F,G]=(0,h.useState)(!1),H=(0,h.useRef)(m.length),[I,J]=(0,h.useState)(null);(0,h.useEffect)(()=>{m.length>H.current&&J(m.length-1),H.current=m.length},[m.length]),(0,h.useEffect)(()=>{f?.(u)},[u,f]);let K=(0,h.useRef)(0),L=(0,h.useRef)(m);L.current=m,(0,h.useEffect)(()=>{if(!l||l.token===K.current)return;K.current=l.token;let{instanceId:a}=l,b=L.current.findIndex(b=>b.instanceId===a);if(0!==b){if(b>0)return void v(b);q(0,a)&&v(0)}},[l,q,v]),(0,h.useEffect)(()=>{if(null===I)return;let a=E.current;if(!a)return;let b=a.querySelector(`[data-split-index="${I}"]`);if(!b)return;let c=b.querySelector("textarea");c?.focus(),v(I),J(null)},[I,v]);let M=(0,h.useCallback)((a,b)=>{let c=E.current;if(!c)return;let d=c.offsetWidth;if(0===d)return;let e=n.reduce((a,b)=>a+b,0),f=b/d*e,g=[...n],h=g[a]+f,i=g[a+1]-f,j=.05*e;h<j||i<j||(g[a]=h,g[a+1]=i,r(g))},[n,r]),N=(0,h.useCallback)(()=>G(!0),[]),O=(0,h.useCallback)(()=>G(!1),[]),P=(0,h.useCallback)(()=>{s(),A(40)},[s,A]),Q=m.length<3&&!F,R=m.length>1&&!F,S=m.length>1||y,T=(0,h.useMemo)(()=>m.map((a,b)=>()=>v(b)),[m,v]),U=(0,h.useMemo)(()=>m.map((a,b)=>a=>q(b,a)),[m,q]),V=(0,h.useMemo)(()=>m.map((a,b)=>a=>{let c=(0,a7.sw)(w.get(a)??{cliTool:"claude",alias:a});if(m[b]?.instanceId===a)return;let d=m.findIndex((c,d)=>d!==b&&c.instanceId===a);if(-1!==d)return void g?.(`${c} is already in use by split ${d+1}`,"warning");q(b,a)&&(j?.(a),g?.(`Moved ${c} to Split ${b+1}`,"success"))}),[m,q,g,j,w]);return(0,e.jsxs)("div",{role:"group","aria-label":"Terminal splits","data-testid":"terminal-split-container",className:"flex flex-col h-full min-h-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums mr-1",children:[m.length," / ",3," splits"]}),(0,e.jsx)("button",{type:"button",onClick:o,disabled:!Q,"aria-disabled":!Q,"aria-label":x("terminal.addSplit"),title:x("terminal.addSplit"),"data-testid":"add-terminal-split",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(dA,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:p,disabled:!R,"aria-disabled":!R,"aria-label":x("terminal.removeSplit"),title:x("terminal.removeSplit"),"data-testid":"remove-terminal-split",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(e9.A,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:P,disabled:!S,"aria-disabled":!S,"aria-label":x("terminal.equalizeWidthsHint"),title:x("terminal.equalizeWidthsHint"),"data-testid":"equalize-split-widths",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(fa,{className:"w-4 h-4 flex-shrink-0","aria-hidden":"true"})}),(0,e.jsx)("div",{className:"ml-auto h-4 w-px bg-border","aria-hidden":"true"}),(0,e.jsxs)("button",{type:"button",onClick:z,"aria-pressed":y,"aria-label":x(y?"terminal.hideHistory":"terminal.showHistory"),title:x(y?"terminal.hideHistory":"terminal.showHistory"),"data-testid":"toggle-history-pane",className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors ${y?"border-accent-300 dark:border-accent-700 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[(0,e.jsx)(fb,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{children:x("terminal.historyLabel")})]}),(0,e.jsxs)("button",{type:"button",onClick:C,"aria-pressed":D,"aria-label":x(D?"terminal.hideFiles":"terminal.showFiles"),title:x(D?"terminal.hideFiles":"terminal.showFiles"),"data-testid":"toggle-file-panel",className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors ${D?"border-accent-300 dark:border-accent-700 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[(0,e.jsx)(fc,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{children:x("terminal.filesLabel")})]})]}),(0,e.jsx)("div",{ref:E,className:"flex flex-1 min-h-0 w-full",children:m.map((a,b)=>{let c=b===m.length-1;return(0,e.jsxs)(i().Fragment,{children:[(0,e.jsx)("div",{style:{flexGrow:n[b]??1,flexShrink:1,flexBasis:0,minWidth:0},className:"h-full",children:d({splitIndex:b,cliToolId:a.cliToolId,instanceId:a.instanceId,instance:w.get(a.instanceId),availableInstances:t(b).map(a=>w.get(a)).filter(a=>void 0!==a),onInstanceChange:U[b],onFocus:T[b],isFocused:u===b,onDropInstance:V[b]})}),c?null:(0,e.jsx)(fg,{resizerIdx:b,ariaValueNow:n.length?n[b]/n.reduce((a,b)=>a+b,0)*100:50,onResize:M,onStart:N,onEnd:O,onDoubleClick:s})]},`split-${b}`)})})]})});function fg({resizerIdx:a,ariaValueNow:b,onResize:c,onStart:d,onEnd:f,onDoubleClick:g}){let i=(0,h.useCallback)(b=>c(a,b),[a,c]);return(0,e.jsx)("div",{"data-testid":`split-resizer-${a}`,onMouseDownCapture:d,onTouchStartCapture:d,onMouseUpCapture:f,onTouchEndCapture:f,children:(0,e.jsx)(ch,{onResize:i,orientation:"horizontal",ariaValueNow:b,onDoubleClick:g})})}let fh={key:"Escape",label:"Esc",ariaLabel:"Send Escape"},fi=[fh,{key:"q",label:"q",ariaLabel:"Send q (quit)"}];function fj({worktreeId:a,cliToolId:b,instanceId:c,onKeysSent:d}){let[f,g]=(0,h.useState)(null),i=ai(a,b,c,d),j="codex"===b?fi:[fh],k=(0,h.useCallback)(a=>{g(a),setTimeout(()=>g(null),ah.tX),i([a])},[i]);return(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50 rounded-lg",role:"toolbar","aria-label":"Terminal escape keys",children:[(0,e.jsx)("span",{className:"text-xs text-amber-700 dark:text-amber-400 mx-2",title:"Send an escape key when the terminal is stuck in a TUI mode",children:"Escape"}),j.map(({key:a,label:b,ariaLabel:c})=>(0,e.jsx)("button",{type:"button",className:`min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md
30
+ ${b.trim()}`:c}(s,g))})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("input",{type:"text",value:w,onChange:a=>x(a.target.value),placeholder:s("git.stash.messagePlaceholder"),className:"w-full px-2 py-1 text-xs border border-input rounded bg-surface dark:bg-surface-2 text-foreground","data-testid":"git-stash-push-message"}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,e.jsx)(n.Sc,{checked:y,onCheckedChange:a=>z(!0===a),"data-testid":"git-stash-include-untracked"}),s("git.stash.includeUntracked")]}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>{l(w,y),x(""),z(!1)},className:"px-2 py-1 text-xs rounded bg-accent-600 hover:bg-accent-700 text-white disabled:opacity-50","data-testid":"stash-push-button",children:s("git.stash.push")})]})]}),b?(0,e.jsx)("div",{className:"py-3 text-center text-xs text-muted-foreground",role:"status",children:s("git.stash.loading")}):0===a.length?(0,e.jsx)("div",{className:"py-3 text-center text-xs text-muted-foreground",children:s("git.stash.empty")}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:a.map(a=>(0,e.jsx)("li",{className:"py-1.5","data-testid":"git-stash-row",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("span",{className:"font-mono text-xs text-accent-600 dark:text-accent-400",children:["stash@","{",a.index,"}"]}),(0,e.jsx)("span",{className:"ml-2 text-xs text-foreground truncate",children:a.message})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>o(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-input hover:bg-muted disabled:opacity-50","data-testid":"stash-apply-button",children:s("git.stash.apply")}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>m(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-input hover:bg-muted disabled:opacity-50","data-testid":"stash-pop-button",children:s("git.stash.pop")}),(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>B(a.index),className:"px-1.5 py-0.5 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"stash-drop-button",children:s("git.stash.drop")})]})]})},a.index))})]}),null!==A&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"git-stash-drop-confirm",role:"dialog",children:[(0,e.jsxs)("p",{className:"text-xs text-danger-foreground",children:["stash@","{",A,"}",s("git.stash.dropConfirmSuffix")]}),i&&(0,e.jsx)("p",{className:"mt-1 text-xs text-danger-foreground","data-testid":"git-stash-drop-session-warning",children:s("git.danger.runningSessionWarning")}),(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,e.jsx)("button",{type:"button",disabled:d,onClick:()=>{p(A),B(null)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"git-stash-drop-confirm-button",children:s("git.stash.drop")}),(0,e.jsx)("button",{type:"button",onClick:()=>B(null),className:"px-2 py-1 text-xs rounded border border-input hover:bg-muted",children:t("cancel")})]})]})]})}),ei={soft:"git.danger.modeSoft",mixed:"git.danger.modeMixed",hard:"git.danger.modeHard"},ej=(0,h.memo)(function({selectedCommit:a,busy:b,actionError:c,conflictNotice:d,currentBranch:f,aheadCount:g,hasRunningSession:i,onReset:j,onRevert:l,onForcePush:m}){let{isMobile:o,onInsertToMessage:p}=d$(),q=(0,k.c)("worktree"),r=(0,k.c)("common"),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)("mixed"),[w,x]=(0,h.useState)(!0),[y,z]=(0,h.useState)(""),[A,B]=(0,h.useState)(!1),[C,D]=(0,h.useState)(!1),[E,F]=(0,h.useState)(!1),[G,H]=(0,h.useState)(!1),[I,J]=(0,h.useState)(!0),K=w?"HEAD":a,L=!w&&!a;return(0,e.jsxs)("div",{className:"border-t-2 border-danger-border","data-testid":"git-danger-zone-section",children:[(0,e.jsxs)("button",{type:"button",onClick:()=>t(a=>!a),className:"w-full flex items-center gap-1 px-3 py-2 text-sm font-medium text-danger-foreground bg-danger-subtle cursor-pointer hover:bg-danger-subtle","data-testid":"git-danger-zone-toggle",children:[(0,e.jsx)("span",{className:"text-xs w-4 text-center",children:s?"▼":"▶"}),q("git.danger.title")]}),s&&(0,e.jsxs)("div",{className:"px-3 py-3 space-y-2 bg-danger-subtle",children:[c&&(0,e.jsx)("div",{className:"text-xs text-danger-foreground",role:"alert","data-testid":"git-danger-zone-error",children:c}),d&&(0,e.jsx)("div",{className:"text-xs text-warning-foreground",role:"status","data-testid":"git-danger-zone-conflict",children:d}),(0,e.jsxs)("div",{className:`flex ${o?"flex-col":"flex-row"} gap-2`,children:[(0,e.jsx)("button",{type:"button",onClick:()=>B(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle","data-testid":"git-danger-zone-reset-open",children:q("git.danger.resetOpen")}),(0,e.jsx)("button",{type:"button",disabled:!a,onClick:()=>D(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"git-danger-zone-revert-open",children:q("git.danger.revertOpen")}),m&&(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>H(!0),className:"px-2 py-1 text-xs rounded border border-danger-border text-danger-foreground hover:bg-danger-subtle disabled:opacity-50","data-testid":"git-force-push-open",children:q("git.danger.forcePushOpen")})]}),!a&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:q("git.danger.selectCommitHint")})]}),A&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"reset-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.resetTitle")}),(0,e.jsxs)(n.z6,{value:w?"head":"commit",onValueChange:a=>x("head"===a),name:"reset-target",className:"flex flex-col gap-1 mb-2",children:[(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:"head","data-testid":"reset-target-head"}),q("git.danger.resetTargetHead")]}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:"commit",disabled:!a,"data-testid":"reset-target-commit"}),q("git.danger.resetTargetSelectedPrefix"),a?q("git.danger.resetTargetSelectedHash",{hash:a.slice(0,7)}):q("git.danger.resetTargetNoneSelected")]})]}),(0,e.jsx)(n.z6,{value:u,onValueChange:a=>v(a),name:"reset-mode",className:"flex flex-col gap-1 mb-2",children:["soft","mixed","hard"].map(a=>(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground",children:[(0,e.jsx)(n.CU,{value:a,"data-testid":`reset-mode-${a}`}),q(ei[a])]},a))}),"hard"===u&&(0,e.jsxs)("div",{className:"mb-2 space-y-1",children:[(0,e.jsx)("p",{className:"text-xs text-danger-foreground","data-testid":"reset-hard-history-loss-warning",children:q("git.danger.resetHardWarning")}),i&&(0,e.jsx)("p",{className:"text-xs text-danger-foreground","data-testid":"reset-hard-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsx)("input",{type:"text",value:y,onChange:a=>z(a.target.value),placeholder:q("git.danger.confirmPlaceholder",{branch:f??""}),className:"w-full px-2 py-1 text-xs border border-danger-border rounded bg-surface dark:bg-surface-2 text-foreground","data-testid":"reset-hard-branch-input"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"reset-ask-ai",disabled:L,onClick:()=>{K&&(p("hard"===u?q("git.aiPrompts.resetHard",{target:ee(K)}):q("git.aiPrompts.reset",{target:ee(K),mode:u})),B(!1),z(""))}}),(0,e.jsx)("button",{type:"button",disabled:b||L||"hard"===u&&y!==(f??""),onClick:()=>{K&&(j(K,u,"hard"===u?y:void 0),B(!1),z(""))},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"reset-confirm-button",children:q("git.danger.reset")}),(0,e.jsx)("button",{type:"button",onClick:()=>{B(!1),z("")},className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]}),C&&a&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"revert-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.revertTitle")}),(0,e.jsxs)("p",{className:"text-xs text-foreground mb-2",children:[q("git.danger.revertBodyPrefix"),(0,e.jsx)("span",{className:"font-mono",children:a.slice(0,7)})]}),i&&(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"revert-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground mb-2",children:[(0,e.jsx)(n.Sc,{checked:E,onCheckedChange:a=>F(!0===a),"data-testid":"revert-no-commit"}),q("git.danger.revertNoCommit")]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"revert-ask-ai",onClick:()=>{p(q("git.aiPrompts.revert",{commit:ee(a.slice(0,7))})),D(!1),F(!1)}}),(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>{l(a,E),D(!1),F(!1)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"revert-confirm-button",children:q("git.danger.revert")}),(0,e.jsx)("button",{type:"button",onClick:()=>{D(!1),F(!1)},className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]}),G&&m&&(0,e.jsxs)("div",{className:"px-3 py-3 border-t border-danger-border bg-danger-subtle","data-testid":"force-push-confirm",role:"dialog",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-danger-foreground mb-2",children:q("git.danger.forcePushTitle")}),(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"force-push-protected-branch-warning",children:q("git.danger.protectedBranchWarning")}),i&&(0,e.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"force-push-session-warning",children:q("git.danger.runningSessionWarning")}),(0,e.jsxs)("label",{className:"flex items-center gap-1 text-xs text-foreground mb-2",children:[(0,e.jsx)(n.Sc,{checked:I,onCheckedChange:a=>J(!0===a),"data-testid":"force-push-with-lease"}),q("git.danger.forceWithLease")]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[p&&(0,e.jsx)(d6,{className:"mr-auto",testId:"force-push-ask-ai",onClick:()=>{p(function(a,{branch:b,ahead:c}){let d=b?ee(b):a("git.aiPrompts.forcePushCurrentBranch");return a("number"==typeof c&&c>0?"git.aiPrompts.forcePushAhead":"git.aiPrompts.forcePush",{branchRef:d,upstream:ee(`origin/${b??"<branch>"}`),ahead:c??0})}(q,{branch:f,ahead:g??null})),H(!1)}}),(0,e.jsx)("button",{type:"button",disabled:b,onClick:()=>{m(I),H(!1)},className:"px-2 py-1 text-xs rounded bg-danger hover:bg-danger/90 text-white disabled:opacity-50","data-testid":"force-push-confirm-button",children:q("git.danger.forcePush")}),(0,e.jsx)("button",{type:"button",onClick:()=>H(!1),className:"px-2 py-1 text-xs rounded border border-border hover:bg-muted",children:r("cancel")})]})]})]})}),ek=(0,h.memo)(function({worktreeId:a,onDiffSelect:b,isMobile:c=!1,worktree:d,onInsertToMessage:f,className:g=""}){let i=(0,k.c)("worktree"),{activeTab:j,setActiveTab:l,historyOpen:m,toggleHistory:o,advancedOpen:p,toggleAdvanced:q}=function(){let{value:a,setValue:b,isAvailable:c}=(0,dP.V)({key:dS.activeTab,defaultValue:"status",validate:dT}),{value:d,setValue:e}=(0,dP.V)({key:dS.historyOpen,defaultValue:!0,validate:dU}),{value:f,setValue:g}=(0,dP.V)({key:dS.advancedOpen,defaultValue:!1,validate:dU}),i=(0,h.useCallback)(a=>b(a),[b]);return{activeTab:a,setActiveTab:i,historyOpen:d,toggleHistory:(0,h.useCallback)(()=>e(a=>!a),[e]),advancedOpen:f,toggleAdvanced:(0,h.useCallback)(()=>g(a=>!a),[g]),isPersistent:c}}(),r=Object.values(d?.sessionStatusByCli??{}).some(a=>a?.isRunning===!0),{gitStatus:s,statusLoading:t,statusError:u,fetchStatus:v}=function(a){let[b,c]=(0,h.useState)(null),[d,e]=(0,h.useState)(!0),[f,g]=(0,h.useState)(null);return{gitStatus:b,statusLoading:d,statusError:f,fetchStatus:(0,h.useCallback)(async()=>{g(null);try{let b=await fetch(`/api/worktrees/${a}/git/status`);if(!b.ok){let a=await b.json().catch(()=>({}));g(a.error||"Failed to fetch git status");return}let d=await b.json();c(d)}catch{g("Failed to fetch git status")}finally{e(!1)}},[a])}}(a),{commits:w,selectedCommit:x,changedFiles:y,inlineDiffCommit:z,inlineFiles:A,inlineFilesLoading:B,inlineFilesError:C,selectedFile:D,diffContent:E,isLoading:F,isLoadingFiles:G,isLoadingDiff:H,commitError:I,detailError:J,setDiffContent:K,fetchCommits:L,handleCommitSelect:M,handleFileSelect:N,handleToggleInlineDiff:O,handleInlineDiffFile:P,handleRefresh:Q}=function(a,b){let[c,d]=(0,h.useState)([]),[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(null),[l,m]=(0,h.useState)([]),[n,o]=(0,h.useState)(!1),[p,q]=(0,h.useState)(null),[r,s]=(0,h.useState)(null),[t,u]=(0,h.useState)(null),[v,w]=(0,h.useState)(!0),[x,y]=(0,h.useState)(!1),[z,A]=(0,h.useState)(!1),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)(null),F=(0,h.useCallback)(async()=>{w(!0),C(null);try{let b=await fetch(`/api/worktrees/${a}/git/log`);if(!b.ok){let a=await b.json();C(a.error||"Failed to fetch commit history");return}let c=await b.json();d(c.commits)}catch{C("Failed to fetch commit history")}finally{w(!1)}},[a]),G=(0,h.useCallback)(async b=>{y(!0),i([]),s(null),u(null),E(null);try{let c=await fetch(`/api/worktrees/${a}/git/show/${b}`);if(!c.ok){let a=await c.json();E(a.error||"Failed to fetch commit details");return}let d=await c.json();i(d.files)}catch{E("Failed to fetch commit details")}finally{y(!1)}},[a]),H=(0,h.useCallback)(async(c,d)=>{A(!0),u(null),E(null);try{let e=await fetch(`/api/worktrees/${a}/git/diff?commit=${c}&file=${encodeURIComponent(d)}`);if(!e.ok){let a=await e.json();E(a.error||"Failed to fetch diff");return}let f=await e.json();u(f.diff),b(f.diff,d)}catch{E("Failed to fetch diff")}finally{A(!1)}},[a,b]),I=(0,h.useCallback)(a=>{f(a),G(a)},[G]),J=(0,h.useCallback)(a=>{e&&(s(a),H(e,a))},[e,H]),K=(0,h.useCallback)(async b=>{if(j===b){k(null),m([]),q(null);return}k(b),m([]),q(null),o(!0);try{let c=await fetch(`/api/worktrees/${a}/git/show/${b}`);if(!c.ok){let a=await c.json().catch(()=>({}));q(a.error||"Failed to fetch commit details");return}let d=await c.json();m(Array.isArray(d.files)?d.files:[])}catch{q("Failed to fetch commit details")}finally{o(!1)}},[a,j]),L=(0,h.useCallback)((a,b)=>{f(a),s(b),i(l),H(a,b)},[l,H]),M=(0,h.useCallback)(()=>{f(null),i([]),s(null),u(null),E(null),F()},[F]);return{commits:c,selectedCommit:e,changedFiles:g,inlineDiffCommit:j,inlineFiles:l,inlineFilesLoading:n,inlineFilesError:p,selectedFile:r,diffContent:t,isLoading:v,isLoadingFiles:x,isLoadingDiff:z,commitError:B,detailError:D,setDiffContent:u,fetchCommits:F,handleCommitSelect:I,handleFileSelect:J,handleToggleInlineDiff:K,handleInlineDiffFile:L,handleRefresh:M}}(a,b),R=(0,h.useCallback)(async()=>{await L(),await v()},[L,v]),{staged:S,stagedLoading:T,stagedError:U,opBusy:V,commitMessage:W,setCommitMessage:X,amend:Y,setAmend:Z,committing:$,changesCommitError:_,fetchStaged:aa,handleStage:ab,handleUnstage:ac,handleChangesDiff:ad,fetchWorkingDiffText:ae,commit:af,commitAndPush:ag}=function(a,b){let{onWorkingDiff:c,onCommitted:d}=b,[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(!0),[j,k]=(0,h.useState)(null),[l,m]=(0,h.useState)(!1),[n,o]=(0,h.useState)(""),[p,q]=(0,h.useState)(!1),[r,s]=(0,h.useState)(!1),[t,u]=(0,h.useState)(null),v=(0,h.useCallback)(async()=>{k(null);try{let b=await fetch(`/api/worktrees/${a}/git/staged`);if(!b.ok){let a=await b.json().catch(()=>({}));k(a.error||"Failed to fetch changes");return}let c=await b.json();f(c)}catch{k("Failed to fetch changes")}finally{i(!1)}},[a]),w=(0,h.useCallback)(async b=>{m(!0),k(null);try{let c=await fetch(`/api/worktrees/${a}/git/stage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[b]})});if(!c.ok){let a=await c.json().catch(()=>({}));k(a.error||"Failed to stage file");return}await v()}catch{k("Failed to stage file")}finally{m(!1)}},[a,v]),x=(0,h.useCallback)(async b=>{m(!0),k(null);try{let c=await fetch(`/api/worktrees/${a}/git/unstage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({files:[b]})});if(!c.ok){let a=await c.json().catch(()=>({}));k(a.error||"Failed to unstage file");return}await v()}catch{k("Failed to unstage file")}finally{m(!1)}},[a,v]),y=(0,h.useCallback)(async()=>{u(null);try{let b=await fetch(`/api/worktrees/${a}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,amend:p})});if(!b.ok){let a=await b.json().catch(()=>({}));return u(a.error||"Failed to commit"),!1}return o(""),q(!1),await v(),await d(),!0}catch{return u("Failed to commit"),!1}},[a,n,p,v,d]),z=(0,h.useCallback)(async()=>{s(!0);try{await y()}finally{s(!1)}},[y]),A=(0,h.useCallback)(async a=>{s(!0);try{await y()&&await a()}finally{s(!1)}},[y]);return{staged:e,stagedLoading:g,stagedError:j,opBusy:l,commitMessage:n,setCommitMessage:o,amend:p,setAmend:q,committing:r,changesCommitError:t,fetchStaged:v,handleStage:w,handleUnstage:x,handleChangesDiff:(0,h.useCallback)(async(b,d)=>{try{let e=await fetch(`/api/worktrees/${a}/git/working-diff?file=${encodeURIComponent(b)}&mode=${d}`);if(!e.ok)return;let f=await e.json();"string"==typeof f.diff&&c(f.diff,b)}catch{}},[a,c]),fetchWorkingDiffText:(0,h.useCallback)(async(b,c)=>{try{let d=await fetch(`/api/worktrees/${a}/git/working-diff?file=${encodeURIComponent(b)}&mode=${c}`);if(!d.ok)return null;let e=await d.json();return"string"==typeof e.diff?e.diff:null}catch{return null}},[a]),commit:z,commitAndPush:A}}(a,{onWorkingDiff:(0,h.useCallback)((a,c)=>{K(a),b(a,c)},[K,b]),onCommitted:R}),{branches:ah,branchInclude:ai,branchesLoading:aj,branchesError:ak,branchBusy:al,branchActionError:am,fetchBranches:an,handleBranchIncludeChange:ao,handleBranchesRefresh:ap,handleCheckout:aq,handleBranchCreate:ar,handleBranchDelete:as}=function(a,b){let{onCheckoutCascade:c}=b,[d,e]=(0,h.useState)([]),[f,g]=(0,h.useState)("local"),[i,j]=(0,h.useState)(!0),[k,l]=(0,h.useState)(null),[m,n]=(0,h.useState)(!1),[o,p]=(0,h.useState)(null),q=(0,h.useCallback)(async b=>{l(null);try{let c=await fetch(`/api/worktrees/${a}/git/branches?include=${b}`);if(!c.ok){let a=await c.json().catch(()=>({}));l(a.error||"Failed to fetch branches");return}let d=await c.json();e(Array.isArray(d.branches)?d.branches:[])}catch{l("Failed to fetch branches")}finally{j(!1)}},[a]),r=(0,h.useCallback)(a=>{g(a)},[]),s=(0,h.useCallback)(()=>{q(f)},[q,f]),t=(0,h.useCallback)(async(b,d)=>{n(!0),p(null);try{let e=await fetch(`/api/worktrees/${a}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:b.name,force:d})});if(!e.ok){let a=await e.json().catch(()=>({}));p(a.error||"Failed to checkout branch");return}await Promise.all([c(),q(f)])}catch{p("Failed to checkout branch")}finally{n(!1)}},[a,f,c,q]),u=(0,h.useCallback)(async(b,c)=>{n(!0),p(null);try{let d=await fetch(`/api/worktrees/${a}/git/branch/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,from:c})});if(!d.ok){let a=await d.json().catch(()=>({}));p(a.error||"Failed to create branch");return}await q(f)}catch{p("Failed to create branch")}finally{n(!1)}},[a,f,q]),v=(0,h.useCallback)(async(b,c)=>{n(!0),p(null);try{let d=await fetch(`/api/worktrees/${a}/git/branch/delete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b,force:c})});if(!d.ok){let a=await d.json().catch(()=>({}));p(a.error||"Failed to delete branch");return}await q(f)}catch{p("Failed to delete branch")}finally{n(!1)}},[a,f,q]);return{branches:d,branchInclude:f,branchesLoading:i,branchesError:k,branchBusy:m,branchActionError:o,fetchBranches:q,handleBranchIncludeChange:r,handleBranchesRefresh:s,handleCheckout:t,handleBranchCreate:u,handleBranchDelete:v}}(a,{onCheckoutCascade:(0,h.useCallback)(async()=>{await Promise.all([v(),aa(),L()])},[v,aa,L])}),{stashes:at,stashLoading:au,stashError:av,stashBusy:aw,stashActionError:ax,stashConflictNotice:ay,fetchStash:az,handleStashPush:aA,handleStashPop:aB,handleStashApply:aC,handleStashDrop:aD}=function(a,b){let{onStashMutated:c}=b,[d,e]=(0,h.useState)([]),[f,g]=(0,h.useState)(!0),[i,j]=(0,h.useState)(null),[k,l]=(0,h.useState)(!1),[m,n]=(0,h.useState)(null),[o,p]=(0,h.useState)(null),q=(0,h.useCallback)(async()=>{j(null);try{let b=await fetch(`/api/worktrees/${a}/git/stash`);if(!b.ok){let a=await b.json().catch(()=>({}));j(a.error||"Failed to fetch stashes");return}let c=await b.json();e(Array.isArray(c.stashes)?c.stashes:[])}catch{j("Failed to fetch stashes")}finally{g(!1)}},[a]),r=(0,h.useCallback)(async()=>{await Promise.all([q(),c()])},[q,c]),s=(0,h.useCallback)(async(a,b,c)=>{l(!0),n(null),p(null);try{let d=await fetch(a,b),e=await d.json().catch(()=>({}));if(!d.ok)return void n(e.error||c);if(e.conflict){let a=Array.isArray(e.conflictFiles)?e.conflictFiles.join(", "):"",b=e.stashRetained?" (stash retained)":"";p(`Stash operation produced conflicts: ${a}${b}`)}await r()}catch{n(c)}finally{l(!1)}},[r]),t=(0,h.useCallback)((b,c)=>{s(`/api/worktrees/${a}/git/stash/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b||void 0,includeUntracked:c})},"Failed to stash changes")},[a,s]),u=(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/pop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({index:b})},"Failed to pop stash")},[a,s]);return{stashes:d,stashLoading:f,stashError:i,stashBusy:k,stashActionError:m,stashConflictNotice:o,fetchStash:q,handleStashPush:t,handleStashPop:u,handleStashApply:(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({index:b})},"Failed to apply stash")},[a,s]),handleStashDrop:(0,h.useCallback)(b=>{s(`/api/worktrees/${a}/git/stash/${b}`,{method:"DELETE"},"Failed to drop stash")},[a,s])}}(a,{onStashMutated:(0,h.useCallback)(async()=>{await Promise.all([v(),aa()])},[v,aa])}),{dangerBusy:aE,dangerActionError:aF,dangerConflictNotice:aG,handleReset:aH,handleRevert:aI}=function(a,b){let{onHeadMoved:c}=b,[d,e]=(0,h.useState)(!1),[f,g]=(0,h.useState)(null),[i,j]=(0,h.useState)(null);return{dangerBusy:d,dangerActionError:f,dangerConflictNotice:i,handleReset:(0,h.useCallback)(async(b,d,f)=>{e(!0),g(null),j(null);try{let e=await fetch(`/api/worktrees/${a}/git/reset`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:b,mode:d,confirmBranch:f})});if(!e.ok){let a=await e.json().catch(()=>({}));g(a.error||"Failed to reset");return}await c()}catch{g("Failed to reset")}finally{e(!1)}},[a,c]),handleRevert:(0,h.useCallback)(async(b,d)=>{e(!0),g(null),j(null);try{let e=await fetch(`/api/worktrees/${a}/git/revert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:b,noCommit:d})});if(!e.ok){let a=await e.json().catch(()=>({}));g(a.error||"Failed to revert");return}let f=await e.json().catch(()=>({}));if(f.conflict){let a=Array.isArray(f.conflictFiles)?f.conflictFiles.join(", "):"";j(`Revert produced conflicts: ${a}`)}await c()}catch{g("Failed to revert")}finally{e(!1)}},[a,c])}}(a,{onHeadMoved:(0,h.useCallback)(async()=>{await Promise.all([v(),aa(),an(ai),L()])},[v,aa,an,ai,L])}),{operation:aJ,progressState:aK,error:aL,errorReason:aM,conflict:aN,conflictFiles:aO,runFetch:aP,runPull:aQ,runPush:aR,abort:aS}=function(a,b={}){let{onCascade:c}=b,[d,e]=(0,h.useState)(null),[f,g]=(0,h.useState)("idle"),[i,j]=(0,h.useState)(null),[k,l]=(0,h.useState)(null),[m,n]=(0,h.useState)(!1),[o,p]=(0,h.useState)([]),q=(0,h.useRef)(null),r=(0,h.useRef)(c),s=(0,h.useCallback)(async(b,c,d)=>{j(null),l(null),n(!1),p([]),e(b),g("running");let f=new AbortController;q.current=f;try{let e=await fetch(`/api/worktrees/${a}/git/${c}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d),signal:f.signal});if(!e.ok){var h,i;let a=await e.json().catch(()=>({}));l((h=a?.reason,"auth_failed"===h?"auth_failed":"protected_branch"===h?"protected_branch":null)),j((i=a?.error,"string"==typeof i&&i.length>0?i:null)),g("error");return}let k=await e.json().catch(()=>({success:!0}));"pull"===b&&k?.conflict&&(n(!0),p(Array.isArray(k.conflictFiles)?k.conflictFiles:[])),g("idle")}catch(a){a instanceof Error&&"AbortError"===a.name?g("idle"):(j(null),l(null),g("error"))}finally{e(null),q.current=null,r.current?.(b)}},[a]),t=(0,h.useCallback)(a=>{let b={prune:!0===a.prune};return void 0!==a.remote&&(b.remote=a.remote),s("fetch","fetch",b)},[s]),u=(0,h.useCallback)(a=>{let b={rebase:!0===a.rebase,ffOnly:!0===a.ffOnly};return void 0!==a.remote&&(b.remote=a.remote),void 0!==a.branch&&(b.branch=a.branch),s("pull","pull",b)},[s]);return{operation:d,progressState:f,error:i,errorReason:k,conflict:m,conflictFiles:o,runFetch:t,runPull:u,runPush:(0,h.useCallback)(a=>{let b={force:!0===a.force,forceWithLease:!0===a.forceWithLease,setUpstream:!0===a.setUpstream};return void 0!==a.remote&&(b.remote=a.remote),void 0!==a.branch&&(b.branch=a.branch),s("push","push",b)},[s]),abort:(0,h.useCallback)(()=>{q.current?.abort()},[])}}(a,{onCascade:(0,h.useCallback)(a=>{v(),an(ai),"pull"===a&&(aa(),L())},[v,an,ai,aa,L])}),aT="auth_failed"===aM?i("git.network.authFailedGuidance"):"protected_branch"===aM?i("git.danger.protectedBranchWarning"):aL,aU="running"===aK&&("push"===aJ||"pull"===aJ),aV=s?.aheadBehind!=null,aW=(0,h.useCallback)(()=>ag(()=>aR({setUpstream:!aV})),[ag,aR,aV]);cM({intervalMs:5e3,enabled:"running"!==aK,onPoll:v});let aX=(0,h.useMemo)(()=>({isMobile:c,onDiffSelect:b,onInsertToMessage:f}),[c,b,f]),aY=(0,e.jsx)(d9,{gitStatus:s,statusLoading:t,statusError:u,onRefresh:v}),aZ=(0,e.jsx)(ea,{progressState:aK,operation:aJ,error:aT,conflict:aN,conflictFiles:aO,hasUpstream:aV,onPull:()=>aQ({}),onPush:()=>aR({setUpstream:!aV}),onAbort:aS,extraActions:(0,e.jsx)(dW,{branches:ah,busy:al||aU,actionError:am,hasRunningSession:r,isMobile:c,onCheckout:aq})}),a$=(0,e.jsx)(ec,{staged:S,loading:T,error:U,busy:V||aU,commitMessage:W,amend:Y,committing:$,commitError:_,onRefresh:aa,onDiff:ad,onPreview:ae,onStage:ab,onUnstage:ac,onCommitMessageChange:X,onAmendChange:Z,onCommit:af,onCommitAndPush:aW}),a_=(0,e.jsx)(ed,{commits:w,isLoading:F,commitError:I,commitListOpen:m,onToggleCommitList:o,onRefresh:Q,selectedCommit:x,onCommitSelect:M,inlineDiffCommit:z,inlineFiles:A,inlineFilesLoading:B,inlineFilesError:C,onToggleInlineDiff:O,onInlineDiffFile:P,changedFiles:y,isLoadingFiles:G,detailError:J,selectedFile:D,onFileSelect:N,diffContent:E,isLoadingDiff:H}),a0=(0,e.jsxs)(dX,{open:p,onToggle:q,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 px-3 py-2 border-b border-border","data-testid":"git-advanced-fetch",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i("git.remote")}),(0,e.jsx)("div",{children:(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:()=>aP({}),disabled:"running"===aK,className:"px-2 py-1 text-xs rounded border border-input text-foreground hover:bg-muted disabled:opacity-50","data-testid":"git-fetch-button",children:i("git.network.fetch")})})]}),(0,e.jsx)(eg,{branches:ah,include:ai,loading:aj,error:ak,busy:al||aU,actionError:am,onIncludeChange:ao,onRefresh:ap,onCreate:ar,onDelete:as}),(0,e.jsx)(eh,{stashes:at,loading:au,error:av,busy:aw||aU,actionError:ax,conflictNotice:ay,hasRunningSession:r,onRefresh:az,onPush:aA,onPop:aB,onApply:aC,onDrop:aD}),(0,e.jsx)(ej,{selectedCommit:x,busy:aE||aU,actionError:aF,conflictNotice:aG,currentBranch:s?.currentBranch??null,aheadCount:s?.aheadBehind?.ahead??null,hasRunningSession:r,onReset:aH,onRevert:aI,onForcePush:a=>aR(a?{forceWithLease:!0}:{force:!0})})]});return(0,e.jsx)(dZ,{value:aX,children:(0,e.jsx)(d3,{activeTab:j,onTabChange:l,className:g,statusSection:aY,quickActionsSection:aZ,changesSection:a$,historySection:a_,advancedSection:a0})})}),el=(0,h.memo)(function({worktreeId:a,worktree:b,onWorktreeUpdate:c}){let[d,f]=(0,h.useState)(!1),g=(0,k.c)("worktree"),i=(0,h.useRef)(b?.id),j=(0,h.useRef)(!1),l=ep(b,c,b?.id,()=>{let a=b?.id!==i.current;return i.current=b?.id,a&&!j.current});return(j.current=l.isEditing,b)?(0,e.jsx)("div",{className:"p-4 space-y-4 overflow-y-auto h-full",children:(0,e.jsx)(eq,{worktreeId:a,worktree:b,cardClassName:"bg-surface rounded-lg border border-border p-4",descriptionEditor:l,showLogs:d,onToggleLogs:()=>f(!d),onWorktreeUpdate:c})}):(0,e.jsx)("div",{className:"text-muted-foreground text-center py-8",children:g("detail.loadingInfo")})}),em=(0,h.memo)(function({worktreeId:a,cliToolId:b,instanceId:c,disableAutoFollow:d}){let{terminal:f,setAutoScroll:g}=bq({worktreeId:a,cliToolId:b,instanceId:c});return(0,e.jsx)(bo,{output:f.output,isActive:f.isRunning,isThinking:f.isThinking,autoScroll:f.autoScroll,onScrollChange:g,disableAutoFollow:d,compactTuiLayoutPadding:"claude"===b||"codex"===b,className:"h-full"})}),en=(0,h.memo)(function({activeTab:a,worktreeId:b,worktree:c,messages:d,cliToolId:f,instanceId:g,onFilePathClick:h,onFileSelect:i,onWorktreeUpdate:j,onNewFile:l,onNewDirectory:m,onRename:n,onDelete:o,onUpload:p,onMove:q,onFileTreeReset:r,refreshTrigger:s,fileSearch:t,showToast:u,selectedAgents:v,onSelectedAgentsChange:w,availableAgents:x,maxAgents:y,persistToServer:z,vibeLocalModel:A,onVibeLocalModelChange:B,vibeLocalContextWindow:C,onVibeLocalContextWindowChange:D,disableAutoFollow:E,historySubTab:G,onHistorySubTabChange:H,onDiffSelect:I,onInsertToMessage:J,showArchived:K,onShowArchivedChange:L,historyDisplayLimit:M,onHistoryDisplayLimitChange:N,historyUserOnly:O,onHistoryUserOnlyChange:P,useInstanceManagement:Q,instances:R,onInstancesChange:S,visibleInstanceIds:T,onToggleInstanceVisible:U}){let V=(0,k.c)("worktree");switch(a){case"terminal":return(0,e.jsx)(F,{componentName:"TerminalDisplay",children:(0,e.jsx)(em,{worktreeId:b,cliToolId:f,instanceId:g,disableAutoFollow:E})});case"history":return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex border-b border-border shrink-0",children:[(0,e.jsx)("button",{type:"button",onClick:()=>H("message"),className:`flex-1 min-h-[44px] px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation ${"message"===G?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400 bg-accent-50 dark:bg-accent-900/30":"text-muted-foreground hover:text-foreground"}`,children:V("detail.subTabMessage")}),(0,e.jsx)("button",{type:"button",onClick:()=>H("git"),className:`flex-1 min-h-[44px] px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation ${"git"===G?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-600 dark:border-accent-400 bg-accent-50 dark:bg-accent-900/30":"text-muted-foreground hover:text-foreground"}`,children:V("detail.subTabGit")})]}),"message"===G?(0,e.jsx)(F,{componentName:"HistoryPane",children:(0,e.jsx)(cq,{messages:d,worktreeId:b,onFilePathClick:h,className:"flex-1 min-h-0",showToast:u,onInsertToMessage:J,showArchived:K,onShowArchivedChange:L,historyDisplayLimit:M,onHistoryDisplayLimitChange:N,historyUserOnly:O,onHistoryUserOnlyChange:P})}):(0,e.jsx)(F,{componentName:"GitPane",children:(0,e.jsx)(ek,{worktreeId:b,onDiffSelect:I,isMobile:!0,worktree:c??void 0,onInsertToMessage:J,className:"flex-1 min-h-0"})})]});case"files":return(0,e.jsx)(F,{componentName:"FileTreeView",children:(0,e.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,e.jsx)(cS,{query:t.query,mode:t.mode,isSearching:t.isSearching,error:t.error,onQueryChange:t.setQuery,onModeChange:t.setMode,onClear:t.clearSearch}),(0,e.jsx)(cO,{worktreeId:b,onFileSelect:i,onNewFile:l,onNewDirectory:m,onRename:n,onDelete:o,onUpload:p,onMove:q,onResetView:r,refreshTrigger:s,pollingEnabled:"files"===a,searchQuery:t.query,searchMode:t.mode,searchResults:t.results?.results,className:"flex-1 min-h-0"})]})});case"memo":return(0,e.jsx)(F,{componentName:"NotesAndLogsPane",children:(0,e.jsx)(dO,{worktreeId:b,className:"h-full",selectedAgents:v,onSelectedAgentsChange:w,availableAgents:x,maxAgents:y,persistToServer:z,vibeLocalModel:A,onVibeLocalModelChange:B,vibeLocalContextWindow:C,onVibeLocalContextWindowChange:D,onInsertToMessage:J,useInstanceManagement:Q,instances:R,onInstancesChange:S,visibleInstanceIds:T,onToggleInstanceVisible:U})});case"info":return(0,e.jsx)(el,{worktreeId:b,worktree:c,onWorktreeUpdate:j});default:return null}}),eo=[{value:null,labelKey:"worktreeStatus.notSet"},{value:"ready",labelKey:"worktreeStatus.ready"},{value:"in_progress",labelKey:"worktreeStatus.inProgress"},{value:"in_review",labelKey:"worktreeStatus.inReview"},{value:"done",labelKey:"worktreeStatus.done"}];function ep(a,b,c,d){let[e,f]=(0,h.useState)(!1),[g,i]=(0,h.useState)(""),[j,k]=(0,h.useState)(!1),l=(0,h.useCallback)(async()=>{if(a){k(!0);try{let c=await T.y.updateDescription(a.id,g);b(c),f(!1)}catch(a){console.error("Failed to save description:",a)}finally{k(!1)}}},[a,g,b]),m=(0,h.useCallback)(()=>{i(a?.description||""),f(!1)},[a]);return{isEditing:e,text:g,setText:i,isSaving:j,handleSave:l,handleCancel:m,startEditing:(0,h.useCallback)(()=>{f(!0)},[])}}let eq=(0,h.memo)(function({worktreeId:a,worktree:b,cardClassName:c,descriptionEditor:d,showLogs:f,onToggleLogs:g,onWorktreeUpdate:i}){let{isEditing:j,text:l,setText:m,isSaving:o,handleSave:p,handleCancel:q,startEditing:r}=d,s=(0,k.c)("worktree"),t=(0,k.c)("common"),[u,v]=(0,h.useState)(!1),[w,x]=(0,h.useState)(!1),y=(0,h.useRef)(void 0),z=(0,h.useRef)(void 0);(0,h.useEffect)(()=>()=>{y.current&&clearTimeout(y.current),z.current&&clearTimeout(z.current)},[]);let A=(0,h.useCallback)(async()=>{try{await (0,ar.l)(b.path),v(!0),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>v(!1),ah.pX)}catch{}},[b.path]),B=(0,h.useCallback)(async()=>{try{await (0,ar.l)(b.repositoryPath),x(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>x(!1),ah.pX)}catch{}},[b.repositoryPath]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.worktree")}),(0,e.jsx)("p",{className:"text-lg font-semibold text-foreground",children:b.name})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.repository")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:B,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":s("detail.copyRepositoryPath"),title:w?s("detail.copied"):s("detail.copyRepositoryPath"),children:w?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("p",{className:"text-base text-foreground",children:b.repositoryDisplayName??b.repositoryName}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:b.repositoryPath})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.path")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:A,className:"flex-shrink-0 p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":s("detail.copyWorktreePath"),title:u?s("detail.copied"):s("detail.copyPath"),children:u?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})})]}),(0,e.jsx)("p",{className:"text-sm text-foreground break-all font-mono",children:b.path})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.status")}),(0,e.jsx)("select",{value:b.status??"",onChange:async a=>{let c=a.target.value;try{let a=await fetch(`/api/worktrees/${b.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:""===c?null:c})});if(a.ok&&i){let b=await a.json();i(b)}}catch{}},className:"text-sm px-3 py-1.5 rounded-lg border border-input bg-surface text-foreground focus:ring-2 focus:ring-ring focus:border-transparent w-full","data-testid":"mobile-status-dropdown","aria-label":s("detail.worktreeStatusLabel"),children:eo.map(a=>(0,e.jsx)("option",{value:a.value??"",children:s(a.labelKey)},a.labelKey))})]}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.description")}),!j&&(0,e.jsx)("button",{type:"button",onClick:r,className:"text-sm text-accent-600 hover:text-accent-800 dark:text-accent-400 dark:hover:text-accent-300",children:s("actions.edit")})]}),j?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("textarea",{value:l,onChange:a=>m(a.target.value),placeholder:s("detail.addNotesPlaceholder"),className:"w-full min-h-[150px] p-3 border border-input dark:bg-surface dark:text-foreground rounded-lg resize-y focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",autoFocus:!0}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:p,disabled:o,className:"px-4 py-2 bg-accent-600 text-white rounded-lg hover:bg-accent-700 disabled:opacity-50 text-sm font-medium",children:o?s("actions.saving"):s("actions.save")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:q,disabled:o,className:"px-4 py-2 bg-muted text-foreground rounded-lg hover:bg-border disabled:opacity-50 text-sm font-medium",children:t("cancel")})]})]}):(0,e.jsx)("div",{className:"min-h-[50px]",children:b.description?(0,e.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:b.description}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground italic",children:s("detail.noDescription")})})]}),b.link&&(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.link")}),(0,e.jsx)("a",{href:b.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-accent-600 hover:underline break-all",children:b.link})]}),b.updatedAt&&(0,e.jsxs)("div",{className:c,children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground mb-1",children:s("detail.lastUpdated")}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:new Date(b.updatedAt).toLocaleString()})]}),(0,e.jsx)(aZ,{version:"v0.11.1",className:c}),(0,e.jsx)(a4,{className:c}),(0,e.jsxs)("div",{className:c,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("detail.logs")}),(0,e.jsx)("button",{type:"button",onClick:g,className:"text-sm text-accent-600 hover:text-accent-800",children:f?s("detail.hide"):s("detail.show")})]}),f&&(0,e.jsx)(aV,{worktreeId:a})]})]})}),er=(0,h.memo)(function({worktreeName:a,repositoryName:b,description:c,status:d,gitStatus:f,onBackClick:g,onInfoClick:i,hasUpdate:j,worktreeStatus:l,onWorktreeStatusChange:m,sessionStatusByCli:p,sessionStatusByInstance:q,instances:s,activeInstanceId:t,onActiveInstanceChange:u,onAgentDragStart:v,onAgentDragEnd:w,onKillSession:x}){let y=(0,k.c)("worktree"),z=(0,k.c)("common"),A=aQ.sb[d],B=A?y(A):void 0,[D,E]=(0,h.useState)(null),F=s?.find(a=>a.id===t),G=!!t&&(q?.[t]?.isRunning??(F?p?.[F.cliTool]?.isRunning:void 0)??!1),H=(0,h.useCallback)((a,b)=>{a.dataTransfer.setData(a9,b),a.dataTransfer.effectAllowed="move",E(b),v?.(b)},[v]),I=(0,h.useCallback)(()=>{E(null),w?.()},[w]),J=c?r(c,50):null;return(0,e.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 bg-surface border-b border-border",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("button",{type:"button",onClick:g,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":y("detail.goBack"),"data-testid":"worktree-back-button",children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-4 0a1 1 0 01-1-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 01-1 1h-2z"})}),(0,e.jsx)("span",{className:"text-sm font-medium",children:y("detail.home")})]}),(0,e.jsx)("div",{className:"w-px h-6 bg-border","aria-hidden":"true"}),(0,e.jsx)(o.m,{"data-testid":"desktop-status-indicator",status:d,size:"lg",label:B}),(0,e.jsxs)("div",{className:"flex flex-col min-w-0",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground truncate max-w-[200px] leading-tight",children:a}),(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"truncate max-w-[200px]",children:b}),f&&"(unknown)"!==f.currentBranch&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"/"}),(0,e.jsx)("span",{className:"truncate max-w-[150px] font-mono",title:f.currentBranch,"data-testid":"desktop-branch-name",children:r(f.currentBranch,30)}),f.isDirty&&(0,e.jsx)("span",{className:"text-warning",title:y("git.uncommittedChanges"),children:"*"})]}),J&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"—"}),(0,e.jsx)("span",{className:"truncate max-w-[300px] text-muted-foreground",title:c,children:J})]})]})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[s&&s.length>0&&(()=>{let a=(0,aT.Uw)(s.map(a=>({item:a,status:(0,a6.kA)(q?.[a.id]??p?.[a.cliTool]),isActive:a.id===t})),4),b=a.filter(a=>"overflow"===a.slot),c=b.find(a=>"running"===a.status||"generating"===a.status)?.status??b.find(a=>"waiting"===a.status)?.status??null;return(0,e.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0","data-testid":"desktop-agent-status-row",children:[a.map(a=>{if("overflow"===a.slot)return null;let b=a.item,c=y("detail.statusPill",{label:(0,a7.sw)(b),status:z(`status.${a.status}`)}),d=a.isActive,f={draggable:!0,onDragStart:a=>H(a,b.id),onDragEnd:I},g=D===b.id?" opacity-50 cursor-grabbing":"";return"pill"===a.slot?(0,e.jsxs)("button",{type:"button","data-testid":`desktop-agent-status-${b.id}`,onClick:()=>u?.(b.id),...f,"aria-label":c,"aria-pressed":d,className:`flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors ${d?"bg-accent-100 dark:bg-accent-900/30 text-accent-900 dark:text-accent-100":"hover:bg-muted text-foreground"}${g}`,children:[(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0}),(0,e.jsx)("span",{className:"whitespace-nowrap",children:c})]},b.id):(0,e.jsx)(aR.m_,{content:c,placement:"bottom",children:(0,e.jsx)("button",{type:"button","data-testid":`desktop-agent-status-${b.id}`,onClick:()=>u?.(b.id),...f,"aria-label":c,"aria-pressed":d,className:`flex items-center justify-center w-6 h-6 rounded-full transition-colors ${d?"bg-accent-100 dark:bg-accent-900/30":"hover:bg-muted"}${g}`,children:(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0})})},b.id)}),b.length>0&&(0,e.jsxs)(aS.rI,{children:[(0,e.jsx)(aS.ty,{asChild:!0,children:(0,e.jsxs)("button",{type:"button","data-testid":"desktop-agent-status-overflow","aria-label":y("agentStatus.moreAgents",{count:b.length}),className:"flex items-center gap-1 px-2 py-1 rounded text-xs tabular-nums text-muted-foreground hover:bg-muted transition-colors",children:[c&&(0,e.jsx)(o.m,{status:c,size:"sm","aria-hidden":!0,title:void 0}),"+",b.length]})}),(0,e.jsx)(aS.SQ,{align:"end",children:b.map(a=>{let b=a.item,c=y("detail.statusPill",{label:(0,a7.sw)(b),status:z(`status.${a.status}`)});return(0,e.jsxs)(aS._2,{"data-testid":`desktop-agent-overflow-${b.id}`,onSelect:()=>u?.(b.id),children:[(0,e.jsx)(o.m,{status:a.status,size:"sm","aria-hidden":!0,title:void 0}),(0,e.jsx)("span",{className:"whitespace-nowrap",children:c})]},b.id)})})]})]})})(),x&&G&&(0,e.jsxs)(n.$n,{variant:"ghost",type:"button",onClick:x,className:"flex items-center gap-1 px-2 py-1.5 text-xs font-medium rounded-lg text-danger-foreground hover:bg-danger-subtle transition-colors flex-shrink-0","aria-label":y("terminal.endSession"),"data-testid":"desktop-kill-session",children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"✕"}),z("end")]}),m&&(0,e.jsx)("select",{value:l??"",onChange:a=>{let b=a.target.value;m(""===b?null:b)},onClick:a=>a.stopPropagation(),className:"text-xs px-2 py-1.5 rounded-lg border border-input bg-surface text-foreground focus:ring-2 focus:ring-ring focus:border-transparent cursor-pointer","data-testid":"desktop-status-dropdown","aria-label":y("detail.worktreeStatusLabel"),children:eo.map(a=>(0,e.jsx)("option",{value:a.value??"",children:y(a.labelKey)},a.labelKey))}),(0,e.jsx)(bb.g,{}),(0,e.jsxs)(n.$n,{variant:"ghost",type:"button",onClick:i,className:"relative flex items-center gap-1.5 px-3 py-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors","aria-label":y("detail.viewInfo"),children:[(0,e.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("span",{className:"text-sm font-medium",children:y("detail.info")}),j&&(0,e.jsx)(C,{"data-testid":"info-update-indicator",className:"absolute top-0 right-0","aria-label":y("tabs.updateAvailable")})]})]})]})}),es=(0,h.memo)(function({worktreeId:a,worktree:b,isOpen:c,onClose:d,onWorktreeUpdate:f}){let[g,i]=(0,h.useState)(!1),j=(0,k.c)("worktree"),l=(0,h.useRef)(c),m=ep(b,f,c,()=>{let a=c&&!l.current;return l.current=c,a});return b?(0,e.jsx)(a5.a,{isOpen:c,onClose:d,title:j("detail.infoModalTitle"),size:"md",children:(0,e.jsx)("div",{className:"space-y-4 max-h-[70vh] overflow-y-auto","data-testid":"worktree-info-modal",children:(0,e.jsx)(eq,{worktreeId:a,worktree:b,cardClassName:"bg-muted rounded-lg p-4",descriptionEditor:m,showLogs:g,onToggleLogs:()=>i(!g),onWorktreeUpdate:f})})}):null}),et=(0,h.memo)(function(){let a=(0,k.c)("worktree");return(0,e.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"status","aria-live":"polite",children:(0,e.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,e.jsx)(n.y$,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"text-muted-foreground",children:a("detail.loading")})]})})}),eu=(0,h.memo)(function({message:a,onRetry:b}){let c=(0,k.c)("worktree"),d=(0,k.c)("common");return(0,e.jsx)("div",{className:"flex items-center justify-center h-full min-h-[200px]",role:"alert","aria-live":"assertive",children:(0,e.jsxs)("div",{className:"text-center p-6 bg-danger-subtle rounded-lg border border-danger-border max-w-md",children:[(0,e.jsx)("svg",{className:"mx-auto h-12 w-12 text-danger-foreground/70 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-danger-foreground font-medium",children:c("detail.errorLoading")}),(0,e.jsx)("p",{className:"text-danger-foreground/80 text-sm mt-2",children:a}),b&&(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:b,className:"mt-4 px-4 py-2 bg-danger-foreground text-danger-subtle rounded-lg hover:opacity-90 transition-opacity focus:outline-none focus:ring-2 focus:ring-danger focus:ring-offset-2 ring-offset-background",children:d("retry")})]})})}),ev=(0,h.memo)(function({activityPane:a,rightPane:b,activityPaneWidth:c=18,minPaneWidth:d=10,maxPaneWidth:f=60,onActivityPaneResize:g,className:i=""}){let j=(0,h.useRef)(null),l=(0,k.c)("worktree"),[m,n]=(0,h.useState)(c),o=g?c:m,p=(0,h.useCallback)(a=>{let b=j.current;if(!b)return;let e=b.offsetWidth;if(0===e)return;let h=Math.min(f,Math.max(d,(g?c:m)+a/e*100));g?g(h):n(h)},[c,m,d,f,g]),q=(0,h.useMemo)(()=>`flex h-full min-h-0 ${i}`.trim(),[i]);return(0,e.jsx)("div",{ref:j,className:"h-full",children:(0,e.jsxs)("div",{"data-testid":"desktop-layout",role:"main",className:q,children:[null!==a&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:"worktree-activity-pane","data-testid":"activity-pane-slot","aria-label":l("desktopLayout.activityPane"),style:{width:`${o}%`},className:"flex-shrink-0 overflow-hidden transition-[width] duration-200 ease-in-out",children:(0,e.jsx)(F,{componentName:"ActivityPane",children:a})}),(0,e.jsx)(ch,{onResize:p,orientation:"horizontal",ariaValueNow:o})]}),(0,e.jsx)("div",{id:"worktree-right-pane","data-testid":"right-pane-slot","aria-label":l("desktopLayout.terminalPane"),className:"flex-grow overflow-hidden min-w-0",children:(0,e.jsx)(F,{componentName:"TerminalPane",children:b})})]})})}),ew=(0,x.A)("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]),ex=(0,x.A)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]);var ey=c(57898);let ez=(0,x.A)("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"}]]),eA=(0,x.A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);var eB=c(55056);let eC=(0,x.A)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),eD=(0,x.A)("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"}]]),eE=[{id:"files",labelKey:"activityBar.files",icon:ex},{id:"git",labelKey:"activityBar.git",icon:ey.A},{id:"notes",labelKey:"activityBar.notes",icon:ez},{id:"schedules",labelKey:"activityBar.schedules",icon:eA},{id:"agent",labelKey:"activityBar.agent",icon:eB.A},{id:"timer",labelKey:"activityBar.timer",icon:eC},{id:"todo",labelKey:"activityBar.todo",icon:eD}];eE.map(a=>a.id);var eF=c(81092);let eG=(0,h.memo)(function({active:a,onToggle:b,className:c=""}){let d=(0,k.c)("worktree"),f=(0,h.useRef)([]),{isOpen:g,toggle:i}=(0,eF.VF)(),j=(0,h.useCallback)((a,c,d)=>{if("Enter"===a.key||" "===a.key){a.preventDefault(),b(d);return}if("ArrowDown"===a.key){a.preventDefault();let b=(c+1)%eE.length;f.current[b]?.focus();return}if("ArrowUp"===a.key){a.preventDefault();let b=(c-1+eE.length)%eE.length;f.current[b]?.focus();return}if("Home"===a.key){a.preventDefault(),f.current[0]?.focus();return}if("End"===a.key){a.preventDefault(),f.current[eE.length-1]?.focus();return}},[b]);return(0,e.jsxs)("div",{"data-testid":"activity-bar",className:`flex flex-col items-stretch w-12 flex-shrink-0 bg-muted border-r border-border ${c}`.trim(),children:[(0,e.jsx)(aR.m_,{content:d("activityBar.toggleSidebar"),placement:"right",children:(0,e.jsx)("button",{type:"button","data-testid":"activity-bar-toggle-sidebar",onClick:i,"aria-label":d("activityBar.toggleSidebar"),"aria-expanded":g,className:"flex items-center justify-center h-12 w-12 text-muted-foreground transition-colors hover:text-surface-foreground hover:bg-muted-foreground/10 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",children:(0,e.jsx)(ew,{size:20,"aria-hidden":"true"})})}),(0,e.jsx)("div",{className:"mx-2 my-1 border-b border-border","aria-hidden":"true"}),(0,e.jsx)("div",{id:"worktree-activity-bar",role:"tablist","aria-orientation":"vertical","aria-label":d("activityBar.label"),className:"flex flex-col items-stretch",children:eE.map((c,g)=>{let h=c.icon,i=a===c.id,k=d(c.labelKey);return(0,e.jsx)(aR.m_,{content:k,placement:"right",children:(0,e.jsx)("button",{ref:a=>{f.current[g]=a},type:"button",role:"tab","aria-selected":i,"aria-label":k,"aria-controls":"worktree-activity-pane",tabIndex:i||null===a&&0===g?0:-1,onClick:()=>b(c.id),onKeyDown:a=>j(a,g,c.id),"data-testid":`activity-bar-button-${c.id}`,className:"group flex items-center justify-center h-12 w-12 transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-inset",children:(0,e.jsx)("span",{"aria-hidden":"true",className:`flex items-center justify-center h-9 w-9 rounded-md transition-colors ${i?"bg-accent-500/10 text-accent-600 dark:text-accent-400":"text-muted-foreground group-hover:text-surface-foreground group-hover:bg-muted-foreground/10"}`,children:(0,e.jsx)(h,{size:20,"aria-hidden":"true"})})})},c.id)})})]})}),eH="worktree-activity-pane",eI={files:"FileTreeView",git:"GitPane",notes:"MemoPane",schedules:"ExecutionLogPane",agent:"AgentSettingsPane",timer:"TimerPane",todo:"TodoPane"},eJ=(0,h.memo)(function({active:a,activities:b,className:c=""}){if(null===a)return(0,e.jsx)("div",{id:eH,"data-testid":"activity-pane","data-active":"none",className:`h-full flex flex-col ${c}`.trim()});let d=b[a],f=eI[a];return(0,e.jsx)("div",{id:eH,"data-testid":"activity-pane","data-active":a,role:"tabpanel","aria-labelledby":`activity-bar-button-${a}`,className:`h-full flex flex-col min-h-0 ${c}`.trim(),children:(0,e.jsx)(F,{componentName:f,children:d??null})})}),eK=(0,h.memo)(function({inputRef:a,searchQuery:b,onQueryChange:c,matchCount:d,currentIdx:f,onNextMatch:g,onPrevMatch:h,onClose:i}){let j=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted border-b border-input flex-shrink-0",children:[(0,e.jsx)("input",{ref:a,type:"text",value:b,onChange:a=>c(a.target.value),onKeyDown:a=>{"Escape"===a.key&&i(),"Enter"===a.key&&(a.shiftKey?h():g())},placeholder:j("fileSearch.placeholder"),className:"flex-1 min-w-0 px-2 py-0.5 text-sm bg-surface dark:text-foreground border border-input rounded outline-none focus:ring-1 focus:ring-ring",autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground min-w-[3rem] text-right",children:d>0?`${f+1}/${d}`:"0/0"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:h,disabled:0===d,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white disabled:text-muted-foreground/50","aria-label":j("fileSearch.prevMatch"),children:"▲"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:g,disabled:0===d,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white disabled:text-muted-foreground/50","aria-label":j("fileSearch.nextMatch"),children:"▼"}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:i,className:"min-w-[32px] min-h-[32px] flex items-center justify-center text-muted-foreground hover:text-foreground dark:hover:text-white","aria-label":j("fileSearch.close"),children:(0,e.jsx)(as.A,{className:"w-4 h-4"})})]})}),eL=[{extension:".png",maxFileSize:0x1400000,allowedMimeTypes:["image/png"],magicBytes:[{bytes:[137,80,78,71,13,10,26,10]}]},{extension:".jpg",maxFileSize:0x1400000,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".jpeg",maxFileSize:0x1400000,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".gif",maxFileSize:0x1400000,allowedMimeTypes:["image/gif"],magicBytes:[{bytes:[71,73,70,56,55,97]},{bytes:[71,73,70,56,57,97]}]},{extension:".webp",maxFileSize:0x1400000,allowedMimeTypes:["image/webp"],magicBytes:[{bytes:[82,73,70,70],offset:0}]},{extension:".mp4",maxFileSize:0x6400000,allowedMimeTypes:["video/mp4"],magicBytes:[{bytes:[102,116,121,112],offset:4}]},{extension:".txt",maxFileSize:0x1400000,allowedMimeTypes:["text/plain"]},{extension:".log",maxFileSize:0x1400000,allowedMimeTypes:["text/plain"]},{extension:".md",maxFileSize:0x1400000,allowedMimeTypes:["text/markdown","text/plain"]},{extension:".csv",maxFileSize:0x1400000,allowedMimeTypes:["text/csv"]},{extension:".json",maxFileSize:0x1400000,allowedMimeTypes:["application/json"]},{extension:".yaml",maxFileSize:0x1400000,allowedMimeTypes:["text/yaml","application/x-yaml"]},{extension:".yml",maxFileSize:0x1400000,allowedMimeTypes:["text/yaml","application/x-yaml"]}],eM=eL.map(a=>a.extension),eN=[".md",".html",".htm",".yaml",".yml"];var eO=c(79689);function eP(){return(0,e.jsx)("div",{className:"flex items-center justify-center py-12 bg-surface",children:(0,e.jsx)(m.y,{size:"xl",variant:"accent"})})}let eQ=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/HtmlPreview"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eR=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/PdfPreview"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eS=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/FilePanelContent.tsx -> @/components/worktree/MarkdownEditor"]},ssr:!1,loading:()=>(0,e.jsx)(eP,{})}),eT=/^---\s*\nmarp:\s*true/;function eU(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,e.jsx)(m.y,{size:"xl",variant:"accent"}),(0,e.jsx)("p",{className:"ml-3 text-muted-foreground",children:a("fileViewer.loading")})]})}function eV({error:a}){return(0,e.jsx)("div",{className:"bg-danger-subtle border border-danger-border rounded-lg p-4 m-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("svg",{className:"w-5 h-5 text-danger-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,e.jsx)("p",{className:"text-sm text-danger-foreground",children:a})]})})}function eW({filePath:a,isMaximized:b,onToggleMaximize:c,copyableContent:d,onSearch:f}){let g=(0,k.c)("worktree"),[i,j]=(0,h.useState)(!1),[l,m]=(0,h.useState)(!1),n=(0,h.useRef)(null),o=(0,h.useRef)(null),p=async()=>{try{await (0,ar.l)(a),j(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>j(!1),ah.pX)}catch{}},q=async()=>{if(d)try{await (0,ar.l)(d),m(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>m(!1),ah.pX)}catch{}};return(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,e.jsx)("button",{type:"button",onClick:p,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.copyFilePath"),title:g("actions.copyPath"),children:i?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(av,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",title:a,children:a})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[f&&(0,e.jsx)("button",{type:"button",onClick:f,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.searchInFile"),title:g("actions.search"),children:(0,e.jsx)(Q.A,{className:"w-3.5 h-3.5"})}),d&&(0,e.jsx)("button",{type:"button",onClick:q,className:"flex-shrink-0 p-1 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g("actions.copyFileContent"),title:g("actions.copyContent"),children:l?(0,e.jsx)(au.A,{className:"w-3.5 h-3.5 text-success"}):(0,e.jsx)(ax,{className:"w-3.5 h-3.5"})}),(0,e.jsx)("button",{type:"button",onClick:c,className:"flex-shrink-0 p-1.5 rounded-md hover:bg-muted text-muted-foreground transition-colors","aria-label":g(b?"actions.minimize":"actions.maximize"),title:g(b?"actions.minimize":"actions.maximize"),children:b?(0,e.jsx)(ay,{className:"w-4 h-4"}):(0,e.jsx)(az,{className:"w-4 h-4"})})]})]})}function eX({content:a,extension:b,searchMatches:c,searchCurrentIdx:d,totalLines:f,rangeStart:g,worktreeId:i,filePath:j,onLineRangeFetched:k}){let l=(0,h.useRef)(null),m=(0,h.useMemo)(()=>a.split("\n"),[a]),n=Math.max(1,g??1),o=m.length,p=Math.max(f??o,o),q=(0,h.useRef)(new Map),r=(0,h.useCallback)(a=>{let c=Math.floor(a/500),d=q.current,e=d.get(c);if(!e){let a=500*c,f=Math.min(a+500,m.length),g=m.slice(a,f).join("\n"),h="";try{h=aK.highlight(g,{language:b,ignoreIllegals:!0}).value}catch{h=aK.highlightAuto(g).value}e=h.split("\n"),d.set(c,e)}return e[a-500*c]??""},[m,b]),s=(0,h.useMemo)(()=>new Set(c??[]),[c]),t=(c?.length??0)>0?c[d??0]:-1,u=bI({count:p,getScrollElement:()=>l.current,estimateSize:()=>24,overscan:100}),v=u.getVirtualItems();return!function({virtualItems:a,worktreeId:b,filePath:c,onLineRangeFetched:d,loadedStart:e,loadedLineCount:f}){(0,h.useRef)(new Set)}({virtualItems:v,worktreeId:i,filePath:j,onLineRangeFetched:k,loadedStart:n,loadedLineCount:o}),(0,e.jsx)("div",{className:"overflow-auto h-full",ref:l,"data-testid":"file-content-code",children:(0,e.jsx)("div",{style:{height:u.getTotalSize(),width:"100%",position:"relative"},children:v.map(a=>{let b=a.index+1,c=b-n,d=c>=0&&c<o,f=b===t,g=s.has(b),h=d?r(c):"";return(0,e.jsxs)("div",{"data-line":b,"data-index":a.index,ref:u.measureElement,className:`absolute left-0 right-0 flex font-mono text-sm ${f?"bg-warning/30":g?"bg-warning/15":""}`,style:{top:0,transform:`translateY(${a.start}px)`,height:"24px",lineHeight:"24px"},children:[(0,e.jsx)("div",{className:`px-3 text-right select-none border-r border-border bg-muted dark:bg-muted/50 whitespace-nowrap ${f||g?"text-warning-foreground":"text-muted-foreground"}`,style:{minWidth:"4rem"},children:b}),(0,e.jsx)("div",{className:"px-4 text-foreground flex-1 min-w-0 overflow-hidden",children:d?(0,e.jsx)("code",{className:"hljs",style:{padding:0,background:"transparent",whiteSpace:"pre"},dangerouslySetInnerHTML:{__html:h}}):(0,e.jsx)(eO.E,{className:"h-4 w-3/4"})})]},a.key)})})})}function eY({slides:a,fileName:b}){let c=(0,k.c)("worktree"),[d,f]=(0,h.useState)(0);return 0===a.length?(0,e.jsx)("div",{className:"p-4 text-muted-foreground",children:c("fileViewer.noSlides",{fileName:b})}):(0,e.jsxs)("div",{className:"h-full flex flex-col","data-testid":"marp-preview",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border bg-muted",children:[(0,e.jsx)("button",{type:"button",onClick:()=>{f(a=>Math.max(0,a-1))},disabled:0===d,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:c("actions.prev")}),(0,e.jsxs)("span",{className:"text-sm text-muted-foreground",children:[d+1," / ",a.length]}),(0,e.jsx)("button",{type:"button",onClick:()=>{f(b=>Math.min(a.length-1,b+1))},disabled:d===a.length-1,className:"px-3 py-1 text-sm rounded-md bg-muted disabled:opacity-50 hover:bg-muted/80 transition-colors",children:c("actions.next")})]}),(0,e.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,e.jsx)("iframe",{srcDoc:a[d],sandbox:"",title:c("fileViewer.slideTitle",{name:b,number:d+1}),className:"w-full h-full border-0"})})]})}function eZ({marpSlides:a,fileName:b,worktreeId:c,filePath:d,contentText:f,onFileSaved:g,isMaximized:i,onToggleMaximize:j,onDirtyChange:l,onOpenFile:m}){let n=(0,k.c)("worktree"),[o,p]=(0,h.useState)("slides");return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-1 border-b border-border bg-muted",children:[(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)("button",{type:"button",onClick:()=>p("slides"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"slides"===o?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:n("fileViewer.slides")}),(0,e.jsx)("button",{type:"button",onClick:()=>p("editor"),className:`px-3 py-1 text-xs font-medium rounded-md transition-colors ${"editor"===o?"bg-accent-100 dark:bg-accent-900/50 text-accent-700 dark:text-accent-300":"text-muted-foreground hover:bg-muted"}`,children:n("fileViewer.editor")})]}),(0,e.jsx)(eW,{filePath:d,isMaximized:i,onToggleMaximize:j,copyableContent:f})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:"slides"===o?(0,e.jsx)(eY,{slides:a,fileName:b}):(0,e.jsx)(eS,{worktreeId:c,filePath:d,onSave:g,initialViewMode:"split",onDirtyChange:l,onOpenFile:m})})]})}function e$({children:a,isMaximized:b,onToggle:c,filePath:d}){return b?(0,e.jsxs)("div",{className:"fixed inset-0 bg-surface flex flex-col",style:{zIndex:aA.M.MAXIMIZED_EDITOR},children:[(0,e.jsx)(eW,{filePath:d,isMaximized:b,onToggleMaximize:c}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:a})]}):(0,e.jsx)(e.Fragment,{children:a})}function e_({tab:a,content:b,worktreeId:c,isMaximized:d,onToggleMaximize:f,onFileSaved:g,onDirtyChange:h,onOpenFile:i}){let j=aJ(b.content);return(0,e.jsxs)(e.Fragment,{children:[!d&&(0,e.jsx)(eW,{filePath:a.path,isMaximized:d,onToggleMaximize:f,copyableContent:b.content,onSearch:j.openSearch}),j.searchOpen&&(0,e.jsx)(eK,{inputRef:j.searchInputRef,searchQuery:j.searchQuery,onQueryChange:j.setSearchQuery,matchCount:j.searchMatches.length,currentIdx:j.searchCurrentIdx,onNextMatch:j.nextMatch,onPrevMatch:j.prevMatch,onClose:j.closeSearch}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:j.searchOpen&&j.searchQuery.length>=2?(0,e.jsx)(eX,{content:b.content,extension:"md",searchMatches:j.searchMatches,searchCurrentIdx:j.searchCurrentIdx}):(0,e.jsx)(eS,{worktreeId:c,filePath:a.path,onSave:g,initialViewMode:"preview",onDirtyChange:h,onOpenFile:i})})]})}function e0({tab:a,content:b,worktreeId:c,isMaximized:d,onToggleMaximize:f,onLoadContent:g}){let i=aJ(b.content),j=(0,h.useCallback)(c=>{g&&g(a.path,{...b,content:c.content,totalLines:c.totalLines,totalBytes:c.totalBytes??b.totalBytes,range:c.range})},[g,a.path,b]),k=void 0!==b.range&&(b.totalLines??0)>b.range.end-b.range.start+1;return(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:d,onToggleMaximize:f,copyableContent:b.content,onSearch:i.openSearch}),i.searchOpen&&(0,e.jsx)(eK,{inputRef:i.searchInputRef,searchQuery:i.searchQuery,onQueryChange:i.setSearchQuery,matchCount:i.searchMatches.length,currentIdx:i.searchCurrentIdx,onNextMatch:i.nextMatch,onPrevMatch:i.prevMatch,onClose:i.closeSearch}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eX,{content:b.content,extension:b.extension,searchMatches:i.searchOpen?i.searchMatches:void 0,searchCurrentIdx:i.searchOpen?i.searchCurrentIdx:void 0,totalLines:b.totalLines,rangeStart:b.range?.start,worktreeId:k?c:void 0,filePath:k?a.path:void 0,onLineRangeFetched:k?j:void 0})})]})}let e1=(0,h.memo)(function({tab:a,worktreeId:b,onLoadContent:c,onLoadError:d,onSetLoading:f,onFileSaved:g,onDirtyChange:i,onOpenFile:j}){let l=(0,k.c)("worktree"),m=(0,h.useRef)(l);m.current=l;let n=(0,h.useRef)(!1),[o,p]=(0,h.useState)(null),[q,r]=(0,h.useState)(!1);!function({tab:a,worktreeId:b,onLoadContent:c}){let d=(0,h.useRef)(null),e=(0,h.useRef)(c);e.current=c;let f=(0,h.useRef)(a.path);f.current=a.path,cM({intervalMs:5e3,enabled:function(a){if(null===a.content||a.loading||a.isDirty||a.content.isPdf)return!1;let{totalBytes:b}=a.content;return void 0===b||!(b>=1048576)}(a),onPoll:async()=>{let a=`/api/worktrees/${b}/files/${aB(f.current)}`,c={};d.current&&(c["If-Modified-Since"]=d.current);try{let b=await fetch(a,{headers:c});if(304===b.status||!b.ok)return;d.current=b.headers.get("Last-Modified");let g=await b.json();e.current(f.current,g)}catch{}}})}({tab:a,worktreeId:b,onLoadContent:c});let s=(0,h.useMemo)(()=>i?b=>i(a.path,b):void 0,[i,a.path]),t=(0,h.useCallback)(()=>{r(a=>!a)},[]);(0,h.useEffect)(()=>{if(!q)return;let a=a=>{"Escape"===a.key&&r(!1)};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[q]),(0,h.useEffect)(()=>{null!==a.content||a.loading||null!==a.error||n.current||(n.current=!0,f(a.path,!0),(async()=>{try{let e=await fetch(`/api/worktrees/${b}/files/${aB(a.path)}`);if(304===e.status)return;if(!e.ok){let b=await e.json(),c="string"==typeof b.error?b.error:b.error?.message||m.current("fileViewer.loadError");d(a.path,c);return}let f=await e.json();c(a.path,f)}catch(b){d(a.path,b instanceof Error?b.message:m.current("fileViewer.loadError"))}finally{n.current=!1}})())},[a.content,a.loading,a.error,a.path,b,c,d,f]);let u=a.content?.content??null,v=a.content?.extension??null;if((0,h.useEffect)(()=>{if(!u||"md"!==v||!eT.test(u)||u.length>1e6)return void p(null);let a=!1;return(async()=>{try{let c=await fetch(`/api/worktrees/${b}/marp-render`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({markdownContent:u})});if(c.ok){let b=await c.json();a||p(Array.isArray(b.slides)?b.slides:null)}}catch{}})(),()=>{a=!0}},[u,v,b]),a.loading)return(0,e.jsx)(eU,{});if(a.error)return(0,e.jsx)(eV,{error:a.error});if(!a.content)return null;let{content:w}=a;return w.isImage?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsx)(an.a,{src:w.content,alt:w.path,mimeType:w.mimeType})})]})}):w.isVideo?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 overflow-auto",children:(0,e.jsx)(ao.u,{src:w.content,mimeType:w.mimeType})})]})}):w.isPdf?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eR,{dataUri:w.content,filePath:a.path})})]})}):w.isHtml?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(eW,{filePath:a.path,isMaximized:q,onToggleMaximize:t,copyableContent:w.content}),(0,e.jsx)("div",{className:"flex-1 min-h-0",children:(0,e.jsx)(eQ,{worktreeId:b,filePath:a.path,htmlContent:w.content,onFileSaved:g,onOpenFile:j})})]})}):"md"===w.extension?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)("div",{className:"h-full flex flex-col",children:o?(0,e.jsx)(eZ,{marpSlides:o,fileName:a.name,worktreeId:b,filePath:a.path,contentText:w.content,onFileSaved:g,isMaximized:q,onToggleMaximize:t,onDirtyChange:s,onOpenFile:j}):(0,e.jsx)(e_,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onFileSaved:g,onDirtyChange:s,onOpenFile:j})})}):!function(a){if(!a)return!1;let b=a.toLowerCase();return eN.includes(b)}("."+w.extension)?(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)(e0,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onLoadContent:c})}):(0,e.jsx)(e$,{isMaximized:q,onToggle:t,filePath:a.path,children:(0,e.jsx)("div",{className:"h-full flex flex-col",children:(0,e.jsx)(e_,{tab:a,content:w,worktreeId:b,isMaximized:q,onToggleMaximize:t,onFileSaved:g,onDirtyChange:s,onOpenFile:j})})})});function e2(a,b,c){if(b<=0||c<=0)return 0;let d=a+b+8-c;return d>0?-Math.min(d,Math.max(0,a-8)):a<8?8-a:0}let e3=(0,h.memo)(function({tab:a,isActive:b,onActivate:c,onClose:d}){let f=(0,k.c)("worktree"),g=(0,h.useCallback)(()=>{b||c(a.path)},[b,c,a.path]),i=(0,h.useCallback)(b=>{b.stopPropagation(),d(a.path)},[d,a.path]),j=b?"border-accent-500 text-accent-600 dark:text-accent-400 bg-surface":"border-transparent text-muted-foreground hover:text-foreground";return(0,e.jsxs)("div",{"data-testid":`file-tab-${a.path}`,"data-active":b,onClick:g,className:`flex items-center gap-1 px-3 py-2 text-sm font-medium border-b-2 cursor-pointer flex-shrink-0 ${j}`,children:[(0,e.jsx)("span",{className:"truncate max-w-[120px]",title:a.path,children:a.name}),a.isDirty&&(0,e.jsx)("span",{"data-testid":`file-tab-dirty-${a.path}`,className:"w-2 h-2 rounded-full bg-warning flex-shrink-0",title:f("fileTabs.unsavedChanges")}),(0,e.jsx)("button",{type:"button",onClick:i,className:"ml-1 p-0.5 rounded-sm hover:bg-muted transition-colors","aria-label":f("fileTabs.closeTab",{name:a.name}),children:(0,e.jsx)(as.A,{className:"w-3 h-3"})})]})}),e4=(0,h.memo)(function({tabs:a,activeIndex:b,worktreeId:c,onClose:d,onActivate:f,onLoadContent:g,onLoadError:i,onSetLoading:j,onFileSaved:k,onDirtyChange:l,onMoveToFront:m,onOpenFile:n}){let[o,p]=(0,h.useState)(!1),q=(0,h.useRef)(null),r=(0,h.useRef)(null),s=(0,h.useRef)({x:0,y:0}),[t,u]=(0,h.useState)({x:0,y:0}),v=null!==b&&b>=0&&b<a.length?a[b]:null,w=a.length>5?a.slice(0,5):a,x=a.length>5?a.slice(5):[];(0,h.useEffect)(()=>{if(!o)return;let a=a=>{q.current&&!q.current.contains(a.target)&&p(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[o]),(0,h.useLayoutEffect)(()=>{let a=a=>{s.current=a,u(b=>b.x===a.x&&b.y===a.y?b:a)};if(!o)return void a({x:0,y:0});let b=r.current;if(!b)return;let c=b.getBoundingClientRect();a({x:e2(c.left-s.current.x,c.width,window.innerWidth),y:e2(c.top-s.current.y,c.height,window.innerHeight)})},[o]);let y=(0,h.useCallback)(a=>{p(!1),m?.(a)},[m]),z=(0,h.useCallback)(()=>{p(a=>!a)},[]);return(0,e.jsxs)("div",{className:"flex flex-col h-full",children:[(0,e.jsxs)("div",{className:"flex border-b border-border bg-surface dark:bg-surface-2 min-w-0",children:[(0,e.jsx)("div",{className:"flex min-w-0 overflow-hidden flex-1",children:w.map((a,c)=>(0,e.jsx)(e3,{tab:a,isActive:c===b,onActivate:f,onClose:d},a.path))}),x.length>0&&(0,e.jsxs)("div",{className:"relative flex-shrink-0",ref:q,children:[(0,e.jsxs)("button",{type:"button","data-testid":"tab-dropdown-button",onClick:z,className:"flex items-center gap-0.5 px-2 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-muted border-b-2 border-transparent transition-colors",children:[(0,e.jsx)(a8.A,{className:`w-3 h-3 transition-transform ${o?"rotate-180":""}`}),(0,e.jsxs)("span",{children:["+",x.length]})]}),o&&(0,e.jsx)("div",{ref:r,"data-testid":"tab-dropdown-menu",className:"absolute right-0 top-full mt-1 bg-surface border border-border rounded-md shadow-lg z-50 min-w-[200px] max-h-[300px] overflow-y-auto",style:0!==t.x||0!==t.y?{transform:`translate(${t.x}px, ${t.y}px)`}:void 0,children:x.map(a=>(0,e.jsxs)("button",{type:"button","data-testid":`tab-dropdown-item-${a.path}`,onClick:()=>y(a.path),className:"w-full text-left px-3 py-2 text-sm text-foreground hover:bg-muted truncate",title:a.path,children:[a.name,a.isDirty&&(0,e.jsx)("span",{className:"ml-1 w-2 h-2 inline-block rounded-full bg-warning"})]},a.path))})]})]}),(0,e.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden",children:v&&(0,e.jsx)(e1,{tab:v,worktreeId:c,onLoadContent:g,onLoadError:i,onSetLoading:j,onFileSaved:k,onDirtyChange:l,onOpenFile:n},v.path)})]})}),e5=(0,h.memo)(function({line:a}){let b="whitespace-pre font-mono text-xs leading-5";return a.startsWith("+")&&!a.startsWith("+++")?b+=" text-success-foreground bg-success-subtle":a.startsWith("-")&&!a.startsWith("---")?b+=" text-danger-foreground bg-danger-subtle":a.startsWith("@@")?b+=" text-info bg-info/10":a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++")?b+=" text-muted-foreground":b+=" text-foreground",(0,e.jsx)("div",{className:b,children:a})}),e6=(0,h.memo)(function({diff:a,filePath:b,onClose:c}){let d=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"h-full flex flex-col bg-surface",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border bg-muted shrink-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-accent-600 dark:text-accent-400 shrink-0",children:d("diffViewer.badge")}),(0,e.jsx)("span",{className:"text-xs font-mono text-muted-foreground truncate",children:b})]}),(0,e.jsx)("button",{type:"button",onClick:c,className:"p-1 text-muted-foreground hover:text-foreground rounded shrink-0","aria-label":d("diffViewer.close"),children:(0,e.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,e.jsx)("div",{className:"flex-1 overflow-auto p-2",children:(0,e.jsx)("pre",{className:"text-xs",children:(0,e.jsx)("code",{children:a.split("\n").map((a,b)=>(0,e.jsx)(e5,{line:a},b))})})})]})});function e7(){let[a,b]=(0,h.useState)(!1),c=(0,h.useRef)(a);c.current=a;let d=(0,h.useCallback)(a=>{b(a)},[]);return{collapsed:a,toggle:(0,h.useCallback)(()=>{d(!c.current)},[d]),setCollapsed:d}}let e8=(0,h.memo)(function({terminal:a,terminalHeader:b,fileTabs:c,worktreeId:d,onCloseTab:f,onActivateTab:g,onLoadContent:i,onLoadError:j,onSetLoading:l,onFileSaved:m,diffContent:n,diffFilePath:o,onCloseDiff:p,onDirtyChange:q,onMoveToFront:r,onOpenFile:s}){let t=(0,k.c)("worktree"),u=(0,h.useRef)(null),[v,w]=(0,h.useState)(50),{collapsed:x,toggle:y}=e7(),z=(0,h.useCallback)(a=>{let b=u.current;if(!b)return;let c=b.offsetWidth;if(0===c)return;let d=a/c*100;w(a=>Math.min(80,Math.max(20,a+d)))},[]),A=(0,h.useMemo)(()=>({width:`${v}%`}),[v]),B=(0,h.useMemo)(()=>({width:`${100-v}%`}),[v]),C=(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[b,(0,e.jsx)("div",{className:"flex-1 min-h-0",children:a})]});return c.tabs.length>0||n&&o?x?(0,e.jsxs)("div",{ref:u,className:"flex h-full min-h-0",children:[(0,e.jsx)("div",{"data-testid":"terminal-pane",style:{width:"calc(100% - 36px)"},className:"flex-shrink-0 overflow-hidden",children:C}),(0,e.jsx)("div",{"data-testid":"file-panel-expand-bar",style:{width:"36px"},className:"flex-shrink-0 flex items-start justify-center bg-muted border-l border-border",children:(0,e.jsxs)("button",{type:"button","aria-label":t("terminal.showFiles"),title:t("terminal.showFiles"),onClick:y,className:"flex flex-col items-center gap-2 w-full pt-2 text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:t("terminal.filesLabel")})]})})]}):(0,e.jsxs)("div",{ref:u,className:"flex h-full min-h-0",children:[(0,e.jsx)("div",{"data-testid":"terminal-pane",style:A,className:"flex-shrink-0 overflow-hidden",children:C}),(0,e.jsx)(ch,{onResize:z,orientation:"horizontal",ariaValueNow:v}),(0,e.jsxs)("div",{"data-testid":"file-panel-pane",style:B,className:"flex-grow overflow-hidden flex",children:[(0,e.jsx)("button",{type:"button","aria-label":t("terminal.hideFiles"),title:t("terminal.hideFiles"),onClick:y,className:"flex-shrink-0 flex items-center justify-center w-5 h-full bg-muted border-r border-border text-muted-foreground hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:(0,e.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}),(0,e.jsx)("div",{className:"flex-1 min-w-0 overflow-hidden",children:n&&o&&p?(0,e.jsx)(e6,{diff:n,filePath:o,onClose:p}):(0,e.jsx)(e4,{tabs:c.tabs,activeIndex:c.activeIndex,worktreeId:d,onClose:f,onActivate:g,onLoadContent:i,onLoadError:j,onSetLoading:l,onFileSaved:m,onDirtyChange:q,onMoveToFront:r,onOpenFile:s})})]})]}):(0,e.jsx)("div",{className:"h-full",children:C})});var e9=c(51881);let fa=(0,x.A)("align-horizontal-distribute-center",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]),fb=(0,x.A)("history",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),fc=(0,x.A)("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),fd={splits:[{cliToolId:"claude",instanceId:"claude"}],widths:[1]};a7.XH;function fe(a){let b=a.reduce((a,b)=>a+b,0);return b>0?a.map(a=>a/b):a.map(()=>1/a.length)}let ff=(0,h.memo)(function({worktreeId:a,instances:b,rosterReady:c=!0,renderPane:d,onFocusedSplitChange:f,showToast:g,onActiveInstanceChange:j,headerInstanceSelection:l}){let{splits:m,widths:n,addSplit:o,removeSplit:p,setSplitInstance:q,setSplitWidth:r,resetWidths:s,availableInstanceIds:t,focusedSplitIndex:u,setFocusedSplitIndex:v}=function(a,b,c=!0){let[d,e]=(0,h.useState)(()=>(function(a,b,c){let d=function(a,b){let c=b[0];return c?{splits:[{cliToolId:c.cliTool,instanceId:c.id}],widths:[1]}:{splits:fd.splits.map(a=>({...a})),widths:[...fd.widths]}}(0,b);return c?function(a,b){let c;if(0===b.length)return a;let d=new Map(b.map(a=>[a.id,a.cliTool])),e=new Set,f=Math.min(Math.max(a.splits.length,1),b.length,3),g=[];for(let b of a.splits){if(g.length>=f)break;let a=d.get(b.instanceId);a&&!e.has(b.instanceId)&&(e.add(b.instanceId),g.push({cliToolId:a,instanceId:b.instanceId}))}for(let a of b){if(g.length>=f)break;e.has(a.id)||(e.add(a.id),g.push({cliToolId:a.cliTool,instanceId:a.id}))}return(0===g.length&&g.push({cliToolId:b[0].cliTool,instanceId:b[0].id}),g.length===a.splits.length&&g.every((b,c)=>b.instanceId===a.splits[c].instanceId&&b.cliToolId===a.splits[c].cliToolId))?a:(c=g.length===a.widths.length?fe(a.widths):g.length<a.widths.length?fe(a.widths.slice(0,g.length)):Array.from({length:g.length},()=>1/g.length),{splits:g,widths:c})}(d,b):d})(0,b,c)),[f,g]=(0,h.useState)(0),i=(0,h.useRef)(d);i.current=d;let j=(0,h.useRef)(b);j.current=b,(0,h.useRef)(c).current=c,(0,h.useRef)(a),(0,h.useMemo)(()=>b.map(a=>`${a.id}:${a.cliTool}`).join("|"),[b]),(0,h.useRef)(a);let k=(0,h.useCallback)(()=>{e(a=>{if(a.splits.length>=3)return a;let b=new Set(a.splits.map(a=>a.instanceId)),c=function(a,b){for(let c of a)if(!b.has(c.id))return c;return null}(j.current,b);if(!c)return a;let d=a.widths.length-1,e=a.widths[d]/2,f=[...a.widths];return f[d]=e,f.push(e),{splits:[...a.splits,{cliToolId:c.cliTool,instanceId:c.id}],widths:f}})},[]),l=(0,h.useCallback)(()=>{e(a=>a.splits.length<=1?a:{splits:a.splits.slice(0,-1),widths:fe(a.widths.slice(0,-1))})},[]),m=(0,h.useCallback)((a,b)=>{let c=i.current,d=j.current;if(a<0||a>=c.splits.length)return!1;let f=d.find(a=>a.id===b);if(!f||c.splits[a].instanceId===b)return!1;for(let d=0;d<c.splits.length;d++)if(d!==a&&c.splits[d].instanceId===b)return!1;return e(c=>{if(a<0||a>=c.splits.length||c.splits[a].instanceId===b)return c;for(let d=0;d<c.splits.length;d++)if(d!==a&&c.splits[d].instanceId===b)return c;let d=c.splits.map((c,d)=>d===a?{cliToolId:f.cliTool,instanceId:b}:c);return{...c,splits:d}}),!0},[]),n=(0,h.useCallback)(a=>{e(b=>a.length!==b.widths.length||!function(a){if(!Array.isArray(a))return!1;for(let b of a)if("number"!=typeof b||!Number.isFinite(b)||b<=0)return!1;return!0}(a)?b:{...b,widths:[...a]})},[]),o=(0,h.useCallback)(()=>{e(a=>{let b=a.splits.length;return 0===b?a:{...a,widths:Array.from({length:b},()=>1/b)}})},[]),p=(0,h.useCallback)(a=>{let c=new Set;for(let b=0;b<d.splits.length;b++)b!==a&&c.add(d.splits[b].instanceId);return b.filter(a=>!c.has(a.id)).map(a=>a.id)},[d.splits,b]),q=(0,h.useCallback)(a=>{g(a)},[]);return{splits:d.splits,widths:d.widths,addSplit:k,removeSplit:l,setSplitInstance:m,setSplitWidth:n,resetWidths:o,availableInstanceIds:p,focusedSplitIndex:f,setFocusedSplitIndex:q}}(a,b,c),w=(0,h.useMemo)(()=>{let a=new Map;for(let c of b)a.set(c.id,c);return a},[b]),x=(0,k.c)("worktree"),{visible:y,toggle:z,setWidth:A}=cc(),{collapsed:B,toggle:C}=e7(),D=!B,E=(0,h.useRef)(null),[F,G]=(0,h.useState)(!1),H=(0,h.useRef)(m.length),[I,J]=(0,h.useState)(null);(0,h.useEffect)(()=>{m.length>H.current&&J(m.length-1),H.current=m.length},[m.length]),(0,h.useEffect)(()=>{f?.(u)},[u,f]);let K=(0,h.useRef)(0),L=(0,h.useRef)(m);L.current=m,(0,h.useEffect)(()=>{if(!l||l.token===K.current)return;K.current=l.token;let{instanceId:a}=l,b=L.current.findIndex(b=>b.instanceId===a);if(0!==b){if(b>0)return void v(b);q(0,a)&&v(0)}},[l,q,v]),(0,h.useEffect)(()=>{if(null===I)return;let a=E.current;if(!a)return;let b=a.querySelector(`[data-split-index="${I}"]`);if(!b)return;let c=b.querySelector("textarea");c?.focus(),v(I),J(null)},[I,v]);let M=(0,h.useCallback)((a,b)=>{let c=E.current;if(!c)return;let d=c.offsetWidth;if(0===d)return;let e=n.reduce((a,b)=>a+b,0),f=b/d*e,g=[...n],h=g[a]+f,i=g[a+1]-f,j=.05*e;h<j||i<j||(g[a]=h,g[a+1]=i,r(g))},[n,r]),N=(0,h.useCallback)(()=>G(!0),[]),O=(0,h.useCallback)(()=>G(!1),[]),P=(0,h.useCallback)(()=>{s(),A(40)},[s,A]),Q=m.length<3&&!F,R=m.length>1&&!F,S=m.length>1||y,T=(0,h.useMemo)(()=>m.map((a,b)=>()=>v(b)),[m,v]),U=(0,h.useMemo)(()=>m.map((a,b)=>a=>q(b,a)),[m,q]),V=(0,h.useMemo)(()=>m.map((a,b)=>a=>{let c=(0,a7.sw)(w.get(a)??{cliTool:"claude",alias:a});if(m[b]?.instanceId===a)return;let d=m.findIndex((c,d)=>d!==b&&c.instanceId===a);if(-1!==d)return void g?.(`${c} is already in use by split ${d+1}`,"warning");q(b,a)&&(j?.(a),g?.(`Moved ${c} to Split ${b+1}`,"success"))}),[m,q,g,j,w]);return(0,e.jsxs)("div",{role:"group","aria-label":"Terminal splits","data-testid":"terminal-split-container",className:"flex flex-col h-full min-h-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-surface border-b border-border flex-shrink-0",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums mr-1",children:[m.length," / ",3," splits"]}),(0,e.jsx)("button",{type:"button",onClick:o,disabled:!Q,"aria-disabled":!Q,"aria-label":x("terminal.addSplit"),title:x("terminal.addSplit"),"data-testid":"add-terminal-split",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(dA,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:p,disabled:!R,"aria-disabled":!R,"aria-label":x("terminal.removeSplit"),title:x("terminal.removeSplit"),"data-testid":"remove-terminal-split",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(e9.A,{className:"w-4 h-4","aria-hidden":"true"})}),(0,e.jsx)("button",{type:"button",onClick:P,disabled:!S,"aria-disabled":!S,"aria-label":x("terminal.equalizeWidthsHint"),title:x("terminal.equalizeWidthsHint"),"data-testid":"equalize-split-widths",className:"flex items-center justify-center h-7 w-7 rounded text-muted-foreground hover:text-surface-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed focus:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",children:(0,e.jsx)(fa,{className:"w-4 h-4 flex-shrink-0","aria-hidden":"true"})}),(0,e.jsx)("div",{className:"ml-auto h-4 w-px bg-border","aria-hidden":"true"}),(0,e.jsxs)("button",{type:"button",onClick:z,"aria-pressed":y,"aria-label":x(y?"terminal.hideHistory":"terminal.showHistory"),title:x(y?"terminal.hideHistory":"terminal.showHistory"),"data-testid":"toggle-history-pane",className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors ${y?"border-accent-300 dark:border-accent-700 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[(0,e.jsx)(fb,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{children:x("terminal.historyLabel")})]}),(0,e.jsxs)("button",{type:"button",onClick:C,"aria-pressed":D,"aria-label":x(D?"terminal.hideFiles":"terminal.showFiles"),title:x(D?"terminal.hideFiles":"terminal.showFiles"),"data-testid":"toggle-file-panel",className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded border transition-colors ${D?"border-accent-300 dark:border-accent-700 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-300":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[(0,e.jsx)(fc,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{children:x("terminal.filesLabel")})]})]}),(0,e.jsx)("div",{ref:E,className:"flex flex-1 min-h-0 w-full",children:m.map((a,b)=>{let c=b===m.length-1;return(0,e.jsxs)(i().Fragment,{children:[(0,e.jsx)("div",{style:{flexGrow:n[b]??1,flexShrink:1,flexBasis:0,minWidth:0},className:"h-full",children:d({splitIndex:b,cliToolId:a.cliToolId,instanceId:a.instanceId,instance:w.get(a.instanceId),availableInstances:t(b).map(a=>w.get(a)).filter(a=>void 0!==a),onInstanceChange:U[b],onFocus:T[b],isFocused:u===b,onDropInstance:V[b]})}),c?null:(0,e.jsx)(fg,{resizerIdx:b,ariaValueNow:n.length?n[b]/n.reduce((a,b)=>a+b,0)*100:50,onResize:M,onStart:N,onEnd:O,onDoubleClick:s})]},`split-${b}`)})})]})});function fg({resizerIdx:a,ariaValueNow:b,onResize:c,onStart:d,onEnd:f,onDoubleClick:g}){let i=(0,h.useCallback)(b=>c(a,b),[a,c]);return(0,e.jsx)("div",{"data-testid":`split-resizer-${a}`,onMouseDownCapture:d,onTouchStartCapture:d,onMouseUpCapture:f,onTouchEndCapture:f,children:(0,e.jsx)(ch,{onResize:i,orientation:"horizontal",ariaValueNow:b,onDoubleClick:g})})}let fh={key:"Escape",label:"Esc",ariaLabel:"Send Escape"},fi=[fh,{key:"q",label:"q",ariaLabel:"Send q (quit)"}];function fj({worktreeId:a,cliToolId:b,instanceId:c,onKeysSent:d}){let[f,g]=(0,h.useState)(null),i=ai(a,b,c,d),j="codex"===b?fi:[fh],k=(0,h.useCallback)(a=>{g(a),setTimeout(()=>g(null),ah.tX),i([a])},[i]);return(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800/50 rounded-lg",role:"toolbar","aria-label":"Terminal escape keys",children:[(0,e.jsx)("span",{className:"text-xs text-amber-700 dark:text-amber-400 mx-2",title:"Send an escape key when the terminal is stuck in a TUI mode",children:"Escape"}),j.map(({key:a,label:b,ariaLabel:c})=>(0,e.jsx)("button",{type:"button",className:`min-w-[44px] min-h-[44px] px-3 py-2 text-sm font-medium rounded-md
31
31
  border border-amber-300 dark:border-amber-700
32
32
  focus:outline-none focus:ring-2 focus:ring-amber-500
33
33
  transition-colors duration-75
@@ -35,4 +35,4 @@ ${b.trim()}`:c}(s,g))})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",c
35
35
  px-6 py-2 rounded-lg font-medium transition-all
36
36
  disabled:opacity-50 disabled:cursor-not-allowed
37
37
  focus:outline-none focus:ring-2 focus:ring-offset-2
38
- `.trim(),fl="bg-accent-600 text-white hover:bg-accent-700 focus:ring-ring";function fm({promptData:a,answering:b,onRespond:c,onDismiss:d,labelId:f,cliToolName:g}){let i=(0,k.c)("prompt"),[j,l]=(0,h.useState)(()=>{if("multiple_choice"===a.type){let b=a.options.find(a=>a.isDefault);return b?.number??null}return null}),[m,o]=(0,h.useState)(""),[p,q]=(0,h.useState)(!1),r=(0,h.useMemo)(()=>"multiple_choice"!==a.type?null:a.options.find(a=>a.number===j)??null,[a,j]),s=r?.requiresTextInput===!0,t=b||p,u=(0,h.useCallback)(async a=>{if(!t){q(!0);try{await c(a)}catch(a){}finally{q(!1)}}},[t,c]),v=(0,h.useCallback)(async()=>{if(!t&&null!==j){q(!0);try{let a=s&&m.trim()?m.trim():j.toString();await c(a)}catch(a){}finally{q(!1)}}},[t,c,j,s,m]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("h3",{id:f,className:"text-lg font-semibold text-warning-foreground flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xl","aria-hidden":"true",children:"?"}),g?i("confirmationFrom",{toolName:g}):i("confirmationFromClaude")]}),d&&(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:d,"aria-label":"close",className:"p-1 rounded hover:bg-warning-border/50 transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5 text-warning-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.instructionText&&(0,e.jsx)("div",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap text-sm text-muted-foreground bg-muted rounded p-2 border border-border",children:a.instructionText}),(0,e.jsx)("p",{className:"text-foreground leading-relaxed",children:a.question}),t&&(0,e.jsxs)("div",{"data-testid":"answering-indicator",className:"flex items-center gap-2 text-sm text-muted-foreground",role:"status","aria-live":"polite",children:[(0,e.jsx)(n.y$,{size:"sm",variant:"accent"}),(0,e.jsx)("span",{children:i("sending")})]}),"yes_no"===a.type&&(0,e.jsx)(fn,{promptData:a,disabled:t,onYes:()=>u("yes"),onNo:()=>u("no")}),"multiple_choice"===a.type&&(0,e.jsx)(fo,{promptData:a,disabled:t,selectedOption:j,onSelectOption:l,textInputValue:m,onTextInputChange:o,showTextInput:s,onSubmit:v})]})}function fn({promptData:a,disabled:b,onYes:c,onNo:d}){let f=(0,k.c)("prompt"),g="yes"===a.defaultOption,h="no"===a.defaultOption,i=`${fk} ${fl} ${g?"primary default highlighted":""}`,j=`${fk} ${h?"bg-foreground text-background hover:bg-foreground/90 primary default highlighted":"bg-surface border-2 border-input hover:bg-muted text-foreground focus:ring-ring"}`;return(0,e.jsxs)("div",{className:"flex items-center gap-3",role:"group","aria-label":f("yesNoGroupLabel"),children:[(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:c,disabled:b,className:i,children:f("yes")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:d,disabled:b,className:j,children:f("no")})]})}function fo({promptData:a,disabled:b,selectedOption:c,onSelectOption:d,textInputValue:f,onTextInputChange:g,showTextInput:i,onSubmit:j}){let l=(0,h.useId)(),m=(0,k.c)("prompt"),o=(0,h.useCallback)(a=>{let d=c===a,e=b?"opacity-50 cursor-not-allowed":"";return`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all ${d?"bg-accent-50 dark:bg-accent-900/30 border-2 border-accent-500":"bg-surface border-2 border-border hover:border-input"} ${e}`},[c,b]);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("fieldset",{children:[(0,e.jsx)("legend",{className:"sr-only",children:m("selectAnOption")}),(0,e.jsx)(n.z6,{name:l,value:null!=c?String(c):"",onValueChange:a=>d(Number(a)),disabled:b,className:"flex flex-col gap-2",children:a.options.map(a=>(0,e.jsxs)("label",{className:o(a.number),children:[(0,e.jsx)(n.CU,{value:String(a.number),className:"mt-1","aria-describedby":a.isDefault?`default-${a.number}`:void 0}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsxs)("span",{className:"font-medium",children:[a.number,". ",a.label]}),a.isDefault&&(0,e.jsx)("span",{id:`default-${a.number}`,className:"ml-2 text-xs text-accent-600 dark:text-accent-400 bg-accent-100 dark:bg-accent-900/30 px-2 py-0.5 rounded",children:m("default")})]})]},a.number))})]}),i&&(0,e.jsxs)("div",{className:"mt-3",children:[(0,e.jsx)("label",{htmlFor:`text-input-${l}`,className:"sr-only",children:m("customValueInput")}),(0,e.jsx)("input",{id:`text-input-${l}`,type:"text",value:f,onChange:a=>g(a.target.value),disabled:b,placeholder:m("enterValuePlaceholder"),className:"w-full px-4 py-2 border-2 border-input dark:bg-muted dark:text-foreground rounded-lg focus:outline-none focus:border-accent-500 disabled:opacity-50"})]}),(0,e.jsx)("button",{type:"button",onClick:j,disabled:b||null===c,className:`w-full ${fk} ${fl}`,children:m("submit")})]})}let fp=(0,h.memo)(function({promptData:a,messageId:b,visible:c,answering:d,onRespond:f,onDismiss:g,cliToolName:i}){let j,{shouldRender:k,animationClass:l}=I({visible:c&&null!==a,duration:200}),m=(0,h.useId)();if(!k||!a)return null;let n=(j="opacity-100","animate-fade-in"===l?j="opacity-100 transform translate-y-0":"animate-fade-out"===l&&(j="opacity-0 transform translate-y-2"),`bg-warning-subtle border-2 border-warning-border rounded-lg p-4 shadow-lg transition-all duration-200 ease-in-out ${l} ${j}`);return(0,e.jsx)(F,{componentName:"PromptPanel",children:(0,e.jsx)("div",{"data-testid":"prompt-panel",role:"dialog","aria-labelledby":m,"aria-modal":"true",className:n,children:(0,e.jsx)(fm,{promptData:a,answering:d,onRespond:f,onDismiss:g,labelId:m,cliToolName:i})})})});var fq=c(74892);function fr({isOpen:a,onConfirm:b,onCancel:c,cliToolName:d}){let f=(0,k.c)("autoYes"),g=(0,k.c)("common"),[i,j]=(0,h.useState)(36e5),[l,m]=(0,h.useState)(""),[n,o]=(0,h.useState)(null),[p,q]=(0,h.useState)(!1),r=(0,h.useRef)(null),s=a=>f(dF[a].replace("autoYes.",""));return(0,e.jsx)(a5.a,{isOpen:a,onClose:c,title:d?f("enableTitleWithTool",{toolName:d}):f("enableTitle"),size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("featureDescription")}),(0,e.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,e.jsx)("li",{children:f("yesNoAutoResponse")}),(0,e.jsx)("li",{children:f("multipleChoiceAutoSelect")})]}),(0,e.jsx)("p",{className:"mt-1",children:f("autoDisableAfter",{duration:s(i)})}),d&&(0,e.jsx)("p",{className:"mt-2 text-muted-foreground",children:f("appliesOnlyToCurrent",{toolName:d})})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("duration")}),(0,e.jsx)("div",{className:"flex gap-2",children:dE.map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>j(a),className:`flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ${i===a?"border-accent-600 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400":"border-border bg-surface dark:bg-surface-2 text-foreground hover:border-muted-foreground"}`,style:{minHeight:"44px"},children:s(a)},a))})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:f("stopPatternLabel")}),(0,e.jsxs)("div",{className:"relative",ref:r,children:[(0,e.jsx)("button",{type:"button",onClick:()=>q(!p),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-muted text-muted-foreground text-[10px] font-bold hover:bg-muted/80 focus:outline-none","aria-label":f("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),p&&(0,e.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-border bg-surface p-3 shadow-lg text-xs text-foreground","data-testid":"regex-tips-tooltip",children:[(0,e.jsx)("p",{className:"font-medium mb-1.5",children:f("regexTipsTitle")}),(0,e.jsxs)("ul",{className:"space-y-1",children:[(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"\\bcat\\b"})," ",f("regexTipWordBoundary")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"error|fatal"})," ",f("regexTipOr")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"(?i)error"})," ",f("regexTipCaseNote")]})]})]})]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:f("stopPatternDescription")}),(0,e.jsx)("input",{id:"stop-pattern-input",type:"text",value:l,onChange:a=>m(a.target.value),placeholder:f("stopPatternPlaceholder"),className:`w-full px-3 py-2 border rounded-md text-sm font-mono bg-surface dark:bg-surface-2 text-foreground ${n?"border-danger focus:ring-danger focus:border-danger":"border-input focus:ring-ring focus:border-accent-500"} focus:outline-none focus:ring-1`,"data-testid":"stop-pattern-input"}),n&&(0,e.jsx)("p",{className:"mt-1 text-xs text-danger","data-testid":"stop-pattern-error",children:n})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("aboutRisks")}),(0,e.jsx)("p",{children:f("riskWarning")})]}),(0,e.jsx)("div",{className:"bg-warning-subtle border-l-4 border-warning p-3",children:(0,e.jsxs)("p",{className:"text-sm text-warning-foreground",children:[(0,e.jsx)("span",{className:"font-medium",children:f("disclaimer")}),f("disclaimerText")]})}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:g("cancel")}),(0,e.jsx)("button",{type:"button",onClick:()=>{b(i,l.trim()||void 0)},disabled:!!n,className:`px-4 py-2 text-sm font-medium rounded-md text-white ${n?"bg-muted-foreground cursor-not-allowed":"bg-warning hover:bg-warning/90"}`,"data-testid":"confirm-button",children:f("agreeAndEnable")})]})]})})}let fs=(0,h.memo)(function({enabled:a,expiresAt:b,onToggle:c,lastAutoResponse:d,cliToolName:f,inline:g=!1,showToolName:i=!0,onExpire:j}){let l=(0,k.c)("autoYes"),[m,n]=(0,h.useState)(""),[o,p]=(0,h.useState)(null),[q,r]=(0,h.useState)(!1),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!a||!b){n(""),v(!1);return}v(!1);let c=!1,d=()=>(n(dG(b)),b-Date.now()<=0&&!c&&(c=!0,v(!0),j?.(),!0));if(d())return;let e=setInterval(()=>{d()&&clearInterval(e)},1e3);return()=>clearInterval(e)},[a,b,j]),(0,h.useEffect)(()=>{if(!d)return;p(`Auto responded: "${d}"`);let a=setTimeout(()=>p(null),ah.I2);return()=>clearTimeout(a)},[d]);let w=a&&!u,x=(0,h.useCallback)(()=>{w?(r(!0),c({enabled:!1}).finally(()=>r(!1))):t(!0)},[w,c]),y=(0,h.useCallback)((a,b)=>{t(!1),r(!0),c({enabled:!0,duration:a,stopPattern:b}).finally(()=>r(!1))},[c]),z=(0,h.useCallback)(()=>{t(!1)},[]);return(0,e.jsxs)("div",{className:g?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-surface-2 border-b border-border",children:[(0,e.jsx)(fq.d,{checked:w,onCheckedChange:x,disabled:q,"aria-label":l("toggleLabel")}),(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:l("label")}),i&&f&&(0,e.jsxs)("span",{className:"text-xs text-accent-600 dark:text-accent-400 font-medium","aria-label":l("targetLabel"),children:["(",(0,a7.f_)(f,""),")"]}),w&&m&&(0,e.jsx)("span",{className:"text-sm text-muted-foreground","aria-label":l("timeRemaining"),children:m}),o&&(0,e.jsx)("span",{className:"text-sm text-success animate-pulse",children:o}),(0,e.jsx)(fr,{isOpen:s,onConfirm:y,onCancel:z,cliToolName:(0,a7.f_)(f,"")})]})});function ft(a){let b=new Set;for(let c of a)"user"===c.role&&b.add(c.id);return b}function fu(a,b,c,d){let e={answer:a,cliTool:b};if(d&&d!==b&&(e.instanceId=d),c&&(e.promptType=c.type,"multiple_choice"===c.type)){let a=c.options.find(a=>a.isDefault);a&&(e.defaultOptionNumber=a.number),c.submitMode&&(e.submitMode=c.submitMode)}return e}let fv=(0,h.memo)(function({worktreeId:a,splitIndex:b,cliToolId:c,instanceId:d,instance:f,availableInstances:g,onInstanceChange:j,onFocus:l,disabled:m=!1,pendingInsertText:n,onInsertConsumed:o,onMessageSent:p,cliStatus:q="idle",autoYes:r,history:s,onDropInstance:t,draggedInstanceId:u,onRequestSessionEnd:v}){let w=d??c,x=r.enabled??!1,y=r.expiresAt??null,z=r.lastAutoResponse??null,A=r.onToggle,B=s?.showArchived??!1,C=s?.onShowArchivedChange,D=s?.historyDisplayLimit,E=s?.onHistoryDisplayLimitChange,F=s?.historyUserOnly??!1,G=s?.onHistoryUserOnlyChange,H=s?.onInsertToMessage,I=s?.onFilePathClick,J=s?.showToast,K=(0,k.c)("worktree"),{terminal:L,prompt:M,setAutoScroll:N,setPromptAnswering:O,clearPrompt:P,refresh:Q}=bq({worktreeId:a,cliToolId:c,instanceId:w,enabled:!m}),{messages:R,isLoading:S,refresh:U}=function({worktreeId:a,cliToolId:b,instanceId:c,limit:d,includeArchived:e=!1,enabled:f=!0}){let[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(!0),{subscribe:l,unsubscribe:m,addListener:n}=(0,bp.xM)(),o=c??b,p=(0,h.useRef)(0),q=(0,h.useRef)(b);q.current=b;let r=(0,h.useRef)(o);r.current=o;let s=(0,h.useCallback)(async()=>{let c=++p.current;try{let f=new URLSearchParams({cliTool:b,instance:o});void 0!==d&&f.set("limit",String(d)),e&&f.set("includeArchived","true");let g=await fetch(`/api/worktrees/${a}/messages?${f.toString()}`);if(!g.ok)return;let h=await g.json();if(p.current!==c||q.current!==b||r.current!==o)return;i(h.map(a=>({...a,timestamp:new Date(a.timestamp)}))),k(!1)}catch(a){if(p.current!==c||q.current!==b||r.current!==o)return;console.error("[useSplitMessages] fetch error:",a),k(!1)}},[a,b,o,d,e]),t=`${a}::${b}::${o}`;return(0,h.useRef)(t),{messages:g,isLoading:j,refresh:(0,h.useCallback)(()=>s(),[s])}}({worktreeId:a,cliToolId:c,instanceId:w,limit:D,includeArchived:B,enabled:!m}),V=(0,h.useCallback)((b,c)=>T.y.sendMessage(a,b,c),[a]),{messages:W,sendOptimistic:X,retry:Y,discard:Z}=function({worktreeId:a,serverMessages:b,sendFn:c,onSent:d,timeoutMs:e=3e4}){let[f,g]=(0,h.useState)([]),i=(0,h.useRef)(b);i.current=b;let j=(0,h.useRef)(f);j.current=f;let k=(0,h.useRef)(d);k.current=d;let l=(0,h.useRef)(c);l.current=c;let m=(0,h.useRef)(0),n=(0,h.useRef)(new Map),o=(0,h.useRef)(new Set),p=(0,h.useCallback)(a=>{let b=n.current.get(a);void 0!==b&&(clearTimeout(b),n.current.delete(a))},[]),q=(0,h.useCallback)(a=>{p(a);let b=setTimeout(()=>{n.current.delete(a),g(b=>b.map(b=>b.tempId===a&&"sending"===b.status?{...b,status:"error"}:b))},e);n.current.set(a,b)},[p,e]),r=(0,h.useCallback)(async a=>{q(a.tempId);try{await l.current(a.content,a.options),k.current?.()}catch{p(a.tempId),g(b=>b.map(b=>b.tempId===a.tempId?{...b,status:"error"}:b))}},[q,p]),s=(0,h.useCallback)((a,b)=>{let c={tempId:`pending-${m.current++}`,content:a,options:b,timestamp:new Date,status:"sending",baselineUserIds:ft(i.current)};g(a=>[...a,c]),r(c)},[r]),t=(0,h.useCallback)(a=>{let b=j.current.find(b=>b.tempId===a);if(!b)return;let c={...b,status:"sending",timestamp:new Date,baselineUserIds:ft(i.current)};g(b=>b.map(b=>b.tempId===a?c:b)),r(c)},[r]),u=(0,h.useCallback)(a=>{let b=j.current.find(b=>b.tempId===a);return p(a),g(b=>b.filter(b=>b.tempId!==a)),b?.content},[p]);return{messages:(0,h.useMemo)(()=>{if(0===f.length)return b;let{reconciledTempIds:c}=function(a,b,c){let d=new Set,e=new Set,f=a.filter(a=>"sending"===a.status);if(0===f.length)return{reconciledTempIds:d,consumedServerIds:e};let g=b.filter(a=>"user"===a.role&&!c.has(a.id)).sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime()),h=new Set;for(let a of[...f].sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime())){let b=g.find(b=>!h.has(b.id)&&!a.baselineUserIds.has(b.id)&&b.content===a.content);b&&(h.add(b.id),d.add(a.tempId),e.add(b.id))}return{reconciledTempIds:d,consumedServerIds:e}}(f,b,o.current),d=f.filter(a=>!c.has(a.tempId)).map(b=>({id:b.tempId,worktreeId:a,role:"user",content:b.content,timestamp:b.timestamp,messageType:"normal",archived:!1,cliToolId:b.options.cliToolId,instanceId:b.options.instanceId,optimisticState:b.status}));return 0===d.length?b:[...b,...d]},[b,f,a]),pending:f,sendOptimistic:s,retry:t,discard:u}}({worktreeId:a,serverMessages:R,sendFn:V,onSent:U}),{visible:$,width:_,toggle:aa,setWidth:ab}=cc(),ac=i().useRef(null),ad=(0,h.useCallback)(a=>{let b=ac.current;if(!b)return;let c=b.offsetWidth;0!==c&&ab(_+a/c*100)},[_,ab]),ae="opencode"===c||"copilot"===c,af="claude"===c||"codex"===c,ah=(0,h.useCallback)(a=>N(a),[N]),ai=(0,h.useCallback)(a=>{Q(),U(),p?.(a)},[Q,U,p]),aj=(0,h.useCallback)(a=>{let b=Z(a);b&&H?.(b)},[Z,H]),ak=(0,h.useCallback)(async b=>{O(!0);try{let d=fu(b,c,M.data,w),e=await fetch(`/api/worktrees/${a}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!e.ok)throw Error(`Failed to send prompt response: ${e.status}`);P(),await Q()}catch(a){console.error("[TerminalSplitPaneContent] prompt response error:",a)}finally{O(!1)}},[a,c,w,M.data,O,P,Q]),am=(0,h.useCallback)(()=>{P()},[P]),an=L.isSelectionListActive,ao=M.visible&&!x,ap=L.isUnclassifiedActive&&!an&&!M.visible,aq=(0,h.useMemo)(()=>(0,e.jsx)(cq,{messages:W,worktreeId:a,onFilePathClick:I??(()=>{}),isLoading:S,className:"h-full",showToast:J,onInsertToMessage:H,onRetryPending:Y,onDiscardPending:aj,showArchived:B,onShowArchivedChange:C,historyDisplayLimit:D,onHistoryDisplayLimitChange:E,historyUserOnly:F,onHistoryUserOnlyChange:G,onCollapse:aa,splitIndex:b,cliToolId:c}),[W,Y,aj,a,I,S,J,H,B,C,D,E,F,G,aa,b,c]),ar=(0,h.useMemo)(()=>(0,e.jsx)(bo,{output:L.output,isActive:L.isRunning,attaching:L.attaching,isThinking:L.isThinking,autoScroll:L.autoScroll,onScrollChange:ah,disableAutoFollow:ae,compactTuiLayoutPadding:af}),[L.output,L.isRunning,L.attaching,L.isThinking,L.autoScroll,ah,ae,af]),at=(0,h.useMemo)(()=>(0,e.jsxs)("div",{ref:ac,className:"flex h-full min-h-0 w-full",children:[$?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:cm(b),"data-testid":`split-history-slot-${b}`,"aria-label":"History pane",style:{width:`${_}%`},className:"flex-shrink-0 overflow-hidden min-h-0",children:aq}),(0,e.jsx)(ch,{onResize:ad,orientation:"horizontal",ariaValueNow:_})]}):(0,e.jsx)("div",{"data-testid":`split-history-expand-bar-${b}`,className:"flex-shrink-0 flex items-start justify-center w-9 bg-gray-50 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",children:(0,e.jsxs)("button",{type:"button","data-testid":`split-history-expand-${b}`,"aria-label":K("terminal.showHistory"),title:K("terminal.showHistory"),"aria-expanded":"false",onClick:aa,className:"flex flex-col items-center gap-2 w-full pt-2 text-gray-500 dark:text-gray-400 hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:K("terminal.historyLabel")})]})}),(0,e.jsx)("div",{className:"flex-grow overflow-hidden min-w-0 min-h-0 relative",children:ar})]}),[$,_,aq,ad,aa,ar,b,K]),au=(0,h.useMemo)(()=>(0,e.jsxs)("div",{className:"space-y-2",children:[an?(0,e.jsx)(al,{worktreeId:a,cliToolId:c,instanceId:w,onKeysSent:Q,showPagerKeys:L.isPagerActive}):null,ap?(0,e.jsx)(fj,{worktreeId:a,cliToolId:c,instanceId:w,onKeysSent:Q}):null,ao?(0,e.jsx)(fp,{promptData:M.data,messageId:M.messageId,visible:M.visible,answering:M.answering,onRespond:ak,onDismiss:am,cliToolName:(0,a7.oo)(c)}):null,(0,e.jsx)(ag,{worktreeId:a,onMessageSent:ai,onOptimisticSend:X,cliToolId:c,instanceId:w,isSessionRunning:L.isRunning,pendingInsertText:n??null,onInsertConsumed:o,splitIndex:b,onFocus:l,isProcessing:L.isRunning,showToast:J,autoYesSlot:(0,e.jsx)(fs,{enabled:x,expiresAt:y??null,onToggle:A,lastAutoResponse:z??null,cliToolName:c,inline:!0})})]}),[an,ao,ap,L.isPagerActive,a,c,w,Q,M.data,M.messageId,M.visible,M.answering,ak,am,ai,X,L.isRunning,n,o,b,l,x,y,z,A,J]),av=(0,a7.sw)(f??{cliTool:c}),aw=(0,h.useCallback)(()=>{v?.({cliToolId:c,instanceId:w,label:av})},[v,c,w,av]),ax=(0,h.useMemo)(()=>{if(!v||!L.isRunning)return null;let a=K("terminal.endSessionFor",{name:av});return(0,e.jsx)("button",{type:"button",onClick:aw,"aria-label":a,title:a,"data-testid":`terminal-end-session-button-${b}`,className:"flex items-center justify-center p-0.5 rounded text-muted-foreground hover:text-danger focus:text-danger hover:bg-danger/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 transition-colors",children:(0,e.jsx)(as.A,{size:14,"aria-hidden":"true"})})},[v,L.isRunning,K,av,aw,b]);return(0,e.jsx)(ba,{worktreeId:a,splitIndex:b,cliToolId:c,instanceId:w,instance:f,availableInstances:g,onInstanceChange:j,headerExtras:ax,status:q,onFocus:l,attaching:L.attaching,terminal:at,footer:au,onDropInstance:t,draggedInstanceId:u})});var fw=c(16945);let fx=(0,h.memo)(function({isBranchMismatch:a,currentBranch:b,initialBranch:c}){let d=(0,k.c)("worktree"),[f,g]=(0,h.useState)(!1);return((0,h.useEffect)(()=>{g(!1)},[b]),!a||f||null===c)?null:(0,e.jsxs)("div",{"data-testid":"branch-mismatch-alert",role:"alert",className:"flex items-center gap-3 px-4 py-2 bg-warning-subtle border border-warning-border text-warning-foreground rounded-lg",children:[(0,e.jsx)(fw.A,{className:"w-5 h-5 text-warning flex-shrink-0"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsxs)("span",{className:"text-sm",children:[d("branchMismatch.changedFrom")," ",(0,e.jsx)("span",{className:"font-medium",children:c})," ",d("branchMismatch.to")," ",(0,e.jsx)("span",{className:"font-medium",children:b})]})}),(0,e.jsx)("button",{type:"button",onClick:()=>g(!0),className:"p-1 rounded hover:bg-warning-subtle transition-colors","aria-label":d("branchMismatch.dismiss"),children:(0,e.jsx)(as.A,{className:"w-4 h-4"})})]})}),fy=(0,x.A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),fz=(0,h.memo)(function({isOpen:a,onClose:b,onConfirm:c,worktreeId:d,sourcePath:f,sourceType:g}){let i=(0,k.c)("worktree"),j=(0,k.c)("common"),[l,m]=(0,h.useState)(""),[o,p]=(0,h.useState)(new Set([""])),[q,r]=(0,h.useState)([]),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)(new Set),w=f.includes("/")?f.substring(0,f.lastIndexOf("/")):"";(0,h.useEffect)(()=>{a&&(m(w),p(new Set([""])),r([]),x())},[a,d]);let x=(0,h.useCallback)(async()=>{t(!0);try{let a=await fetch(`/api/worktrees/${d}/tree`);if(!a.ok)return;let b=(await a.json()).items.filter(a=>"directory"===a.type).map(a=>({name:a.name,path:a.name,loaded:!1}));r(b)}catch{}finally{t(!1)}},[d]),y=(0,h.useCallback)(async a=>{v(b=>new Set(b).add(a));try{let b=await fetch(`/api/worktrees/${d}/tree/${a}`);if(!b.ok)return;let c=(await b.json()).items.filter(a=>"directory"===a.type).map(b=>({name:b.name,path:`${a}/${b.name}`,loaded:!1}));r(b=>(function a(b,c,d){return b.map(b=>b.path===c?{...b,children:d,loaded:!0}:b.children?{...b,children:a(b.children,c,d)}:b)})(b,a,c))}catch{}finally{v(b=>{let c=new Set(b);return c.delete(a),c})}},[d]),A=(0,h.useCallback)(async a=>{p(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c});let b=function a(b,c){for(let d of b){if(d.path===c)return d;if(d.children){let b=a(d.children,c);if(b)return b}}return null}(q,a);b&&!b.loaded&&await y(a)},[q,y]),B=(0,h.useCallback)(a=>!(a===w||"directory"===g&&(a===f||a.startsWith(f+"/")))&&!0,[w,f,g]),C=(a,b=0)=>{let c=o.has(a.path),d=l===a.path,f=u.has(a.path),g=B(a.path);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${d?"bg-accent-100 text-accent-800":"hover:bg-muted text-foreground"} ${!g?"opacity-40 cursor-not-allowed":""}`,style:{paddingLeft:`${.5+1.25*b}rem`},onClick:()=>{g&&m(a.path)},children:[(0,e.jsx)("button",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",onClick:b=>{b.stopPropagation(),A(a.path)},children:f?(0,e.jsx)(n.y$,{size:"xs",variant:"muted"}):(0,e.jsx)(bL,{className:`w-3 h-3 text-muted-foreground transition-transform ${c?"rotate-90":""}`})}),c?(0,e.jsx)(fy,{className:"w-4 h-4 text-warning flex-shrink-0"}):(0,e.jsx)(z.A,{className:"w-4 h-4 text-warning flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),c&&a.children&&(0,e.jsx)("div",{children:a.children.map(a=>C(a,b+1))})]},a.path)},D=B(l);return(0,e.jsx)(a5.a,{isOpen:a,onClose:b,title:i("fileTree.moveDialogTitle"),size:"md",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"text-sm text-muted-foreground",children:[i("fileTree.moveTo"),": ",(0,e.jsx)("span",{className:"font-mono text-foreground",children:f})]}),(0,e.jsxs)("div",{className:"border border-border rounded-lg max-h-64 overflow-y-auto p-2",children:[(0,e.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${""===l?"bg-accent-100 text-accent-800":"hover:bg-muted text-foreground"} ${!B("")?"opacity-40 cursor-not-allowed":""}`,onClick:()=>{B("")&&m("")},children:[(0,e.jsx)("span",{className:"w-4 h-4"}),(0,e.jsx)(z.A,{className:"w-4 h-4 text-warning flex-shrink-0"}),(0,e.jsx)("span",{children:i("fileTree.rootDirectory")})]}),s?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(n.y$,{size:"md",variant:"muted"})}):q.map(a=>C(a,1))]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",onClick:b,className:"px-4 py-2 text-sm text-foreground bg-white border border-border rounded-md hover:bg-muted transition-colors",children:j("cancel")}),(0,e.jsx)(n.$n,{variant:"ghost",onClick:()=>c(l),disabled:!D,className:"px-4 py-2 text-sm text-white bg-accent-600 rounded-md hover:bg-accent-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:i("fileTree.moveConfirm")})]})]})})});function fA(a,b){let c=a.trim();return c?0>=c.lastIndexOf(".")?c+b:c:""}let fB=(0,h.memo)(function({isOpen:a,parentPath:b,onConfirm:c,onCancel:d}){let f=(0,k.c)("worktree"),g=(0,k.c)("common"),[i,j]=(0,h.useState)(""),[l,m]=(0,h.useState)(".md"),n=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(a){j(""),m(".md");let a=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(a)}},[a]);let o=(0,h.useCallback)(()=>{let a=fA(i,l);a&&c(a)},[i,l,c]),p=(0,h.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),o())},[o]),q=fA(i,l),r=b?`${b}/${q}`:q;return(0,e.jsx)(a5.a,{isOpen:a,onClose:d,title:f("newFileDialog.title"),size:"sm",children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{htmlFor:"new-file-name",className:"block text-sm font-medium text-foreground mb-1",children:f("newFileDialog.fileNameLabel")}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("input",{ref:n,id:"new-file-name","data-testid":"new-file-name-input",type:"text",value:i,onChange:a=>j(a.target.value),onKeyDown:p,placeholder:f("newFileDialog.placeholder"),className:"flex-1 px-3 py-2 border border-input rounded-lg bg-surface text-foreground text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),(0,e.jsx)("select",{"data-testid":"new-file-ext-select",value:l,onChange:a=>m(a.target.value),className:"px-3 py-2 border border-input rounded-lg bg-surface text-foreground text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",children:eN.map(a=>(0,e.jsx)("option",{value:a,children:a},a))})]})]}),q&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground font-mono bg-muted rounded px-2 py-1",children:r}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{type:"button",onClick:d,className:"px-4 py-2 text-sm font-medium text-foreground bg-muted hover:bg-muted/80 rounded-lg transition-colors",children:g("cancel")}),(0,e.jsx)("button",{type:"button","data-testid":"new-file-confirm-button",onClick:o,disabled:!q,className:"px-4 py-2 text-sm font-medium text-white bg-accent-600 hover:bg-accent-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:f("newFileDialog.create")})]})]})})}),fC=(0,h.memo)(function({worktreeId:a,worktree:b,worktreeName:c,worktreeStatus:d,instances:f,rosterReady:g,activeInstanceId:j,setActiveInstanceId:l,hasUpdate:m,lastAutoResponse:n,activeActivity:o,onActivityToggle:p,onBackClick:q,onInfoClick:r,onWorktreeStatusChange:s,pendingInsertTextMap:t,setFocusedSplitIndex:u,handleInsertToSplit:v,handleInsertConsumed:w,handleInsertToMessage:x,autoYesStateMap:y,makeAutoYesToggleHandler:z,showArchived:A,onShowArchivedChange:B,historyDisplayLimit:C,onHistoryDisplayLimitChange:D,historyUserOnly:E,onHistoryUserOnlyChange:G,onMessageSent:H,onFilePathClick:I,showToast:J,tabsState:K,tabsActions:L,onLoadContent:M,onLoadError:N,onSetLoading:O,onFilePanelSave:P,onDirtyChange:Q,onOpenFile:R,diffContent:S,diffFilePath:T,onCloseDiff:U,fileSearch:V,fileTreeRefresh:W,onFileSelect:X,onNewFile:Y,onNewDirectory:Z,onRename:$,onDelete:_,onUpload:aa,onMove:ab,onFileTreeReset:ac,onDiffSelect:ad,onAgentInstancesChange:ae,vibeLocalModel:af,onVibeLocalModelChange:ag,vibeLocalContextWindow:ah,onVibeLocalContextWindowChange:ai,isInfoModalOpen:aj,onInfoModalClose:ak,onWorktreeUpdate:al,fileInputRef:am,onFileInputChange:an,onKillSession:ao,onRequestSessionEnd:ap,killTarget:aq,isKillPending:ar,onKillCancel:as,onKillConfirm:at,moveTarget:au,isMoveDialogOpen:av,onMoveCancel:aw,onMoveConfirm:ax,showNewFileDialog:ay,newFileParentPath:az,onNewFileConfirm:aA,onNewFileCancel:aB,toasts:aC,onToastClose:aD,killDialogTitle:aE,killDialogWarning:aF,cancelLabel:aG,endLabel:aH}){let aI=(0,k.c)("worktree"),[aJ,aK]=i().useState(null),aL=(0,h.useCallback)(a=>aK(a),[]),aM=(0,h.useCallback)(()=>aK(null),[]),[aN,aO]=i().useState(null),aP=i().useRef(0),aQ=(0,h.useCallback)(a=>{l(a),aP.current+=1,aO({instanceId:a,token:aP.current})},[l]),aR=(0,h.useCallback)(({splitIndex:c,cliToolId:d,instanceId:f,instance:g,availableInstances:h,onInstanceChange:i,onFocus:j,onDropInstance:k})=>{let m=t.get(c)??null,o=y.get(f),p=o?.enabled??!1,q=o?.expiresAt??null,r=(0,a6.kA)(b?.sessionStatusByInstance?.[f]??b?.sessionStatusByCli?.[d]);return(0,e.jsx)(fv,{worktreeId:a,splitIndex:c,cliToolId:d,instanceId:f,instance:g,availableInstances:h,onInstanceChange:a=>{i(a),0===c&&l(a)},onFocus:j,pendingInsertText:m,onInsertConsumed:()=>w(c),onMessageSent:H,cliStatus:r,autoYes:{enabled:p,expiresAt:q,lastAutoResponse:n,onToggle:z(d,f)},history:{showArchived:A,onShowArchivedChange:B,historyDisplayLimit:C,onHistoryDisplayLimitChange:D,historyUserOnly:E,onHistoryUserOnlyChange:G,onInsertToMessage:a=>v(c,a),onFilePathClick:I,showToast:J},onDropInstance:k,draggedInstanceId:aJ,onRequestSessionEnd:ap})},[a,t,y,w,H,l,n,z,b?.sessionStatusByCli,b?.sessionStatusByInstance,I,J,v,A,B,C,D,E,G,aJ,ap]),aS=(0,h.useMemo)(()=>(0,e.jsx)(ff,{worktreeId:a,instances:f,rosterReady:g,renderPane:aR,onFocusedSplitChange:u,showToast:J,onActiveInstanceChange:l,headerInstanceSelection:aN}),[a,f,g,aR,u,J,l,aN]),aT=(0,h.useMemo)(()=>(0,e.jsx)(e8,{terminal:aS,terminalHeader:null,fileTabs:K,worktreeId:a,onCloseTab:L.closeTab,onActivateTab:L.activateTab,onLoadContent:M,onLoadError:N,onSetLoading:O,onFileSaved:P,diffContent:S,diffFilePath:T,onCloseDiff:U,onDirtyChange:Q,onMoveToFront:L.moveToFront,onOpenFile:R}),[aS,K,a,L.closeTab,L.activateTab,M,N,O,P,S,T,U,Q,L.moveToFront,R]),aV=(0,h.useMemo)(()=>(0,e.jsx)(eG,{active:o,onToggle:p}),[o,p]),aW=(0,h.useMemo)(()=>({files:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(cS,{query:V.query,mode:V.mode,isSearching:V.isSearching,error:V.error,onQueryChange:V.setQuery,onModeChange:V.setMode,onClear:V.clearSearch}),(0,e.jsx)(cO,{worktreeId:a,onFileSelect:X,onNewFile:Y,onNewDirectory:Z,onRename:$,onDelete:_,onUpload:aa,onMove:ab,onResetView:ac,refreshTrigger:W,pollingEnabled:"files"===o,searchQuery:V.query,searchMode:V.mode,searchResults:V.results?.results,className:"flex-1 min-h-0"})]}),git:(0,e.jsx)(ek,{worktreeId:a,onDiffSelect:ad,isMobile:!1,worktree:b??void 0,onInsertToMessage:x,className:"h-full"}),notes:(0,e.jsx)(cY,{worktreeId:a,className:"h-full",onInsertToMessage:x}),schedules:(0,e.jsx)(du,{worktreeId:a,className:"h-full",onInsertToMessage:x,instances:f}),agent:(0,e.jsx)(dB,{worktreeId:a,instances:f,onInstancesChange:ae,vibeLocalModel:af,onVibeLocalModelChange:ag,vibeLocalContextWindow:ah,onVibeLocalContextWindowChange:ai}),timer:(0,e.jsx)(dM,{worktreeId:a,instances:f}),todo:(0,e.jsx)(c1,{worktreeId:a,className:"h-full"})}),[a,b,o,V.query,V.mode,V.isSearching,V.error,V.setQuery,V.setMode,V.clearSearch,V.results?.results,X,Y,Z,$,_,aa,ab,ac,W,ad,x,f,ae,af,ag,ah,ai]),aX=(0,h.useMemo)(()=>null===o?null:(0,e.jsx)(eJ,{active:o,activities:aW}),[o,aW]);return(0,e.jsx)(F,{componentName:"WorktreeDetailRefactored",children:(0,e.jsxs)("div",{className:"flex h-full overflow-hidden relative",children:[aV,(0,e.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 min-w-0",children:[(0,e.jsx)(er,{worktreeName:c,repositoryName:b?.repositoryDisplayName??b?.repositoryName??aI("detail.unknownRepository"),description:b?.description,status:d,gitStatus:b?.gitStatus,onBackClick:q,onInfoClick:r,hasUpdate:m,worktreeStatus:b?.status??null,onWorktreeStatusChange:s,sessionStatusByCli:b?.sessionStatusByCli,sessionStatusByInstance:b?.sessionStatusByInstance,instances:f,activeInstanceId:j,onActiveInstanceChange:aQ,onAgentDragStart:aL,onAgentDragEnd:aM,onKillSession:ao}),b?.gitStatus&&(0,e.jsx)(fx,{isBranchMismatch:b.gitStatus.isBranchMismatch,currentBranch:b.gitStatus.currentBranch,initialBranch:b.gitStatus.initialBranch}),(0,e.jsx)("div",{className:"flex-1 min-h-0 min-w-0",children:(0,e.jsx)(ev,{activityPane:aX,rightPane:(0,e.jsx)(ck,{terminal:aT})})})]}),(0,e.jsx)(es,{worktreeId:a,worktree:b,isOpen:aj,onClose:ak,onWorktreeUpdate:al}),(0,e.jsx)("input",{ref:am,type:"file",accept:eM.join(","),onChange:an,className:"hidden","aria-label":aI("detail.uploadFile")}),(0,e.jsx)(a5.a,{isOpen:null!==aq,onClose:as,title:aE,size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("p",{className:"text-sm text-foreground",children:aF}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:as,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:aG}),(0,e.jsx)("button",{type:"button",onClick:at,disabled:ar,"data-testid":"kill-session-confirm-button",className:"px-4 py-2 text-sm font-medium rounded-md bg-danger hover:bg-danger/90 text-white disabled:opacity-60 disabled:cursor-not-allowed",children:aH})]})]})}),au&&(0,e.jsx)(fz,{isOpen:av,onClose:aw,onConfirm:ax,worktreeId:a,sourcePath:au.path,sourceType:au.type}),(0,e.jsx)(fB,{isOpen:ay,parentPath:az,onConfirm:aA,onCancel:aB}),(0,e.jsx)(aU.N9,{toasts:aC,onClose:aD})]})})});a7.oo;let fD={data:null,messageId:null,visible:!1,answering:!1},fE={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5,leftPaneCollapsed:!1,activityBar:{active:"files"},historyPane:{visible:!0,width:25,collapsed:!1}},fF={type:null,message:null,retryable:!1,retryCount:0};function fG(){return{phase:"idle",prompt:{...fD},layout:{...fE},error:{...fF},messages:[],wsConnected:!1}}function fH(a,b){switch(b.type){case"SET_PHASE":return{...a,phase:b.phase};case"SHOW_PROMPT":return{...a,phase:"prompt",prompt:{data:b.data,messageId:b.messageId,visible:!0,answering:!1}};case"CLEAR_PROMPT":return{...a,prompt:{...fD}};case"SET_PROMPT_ANSWERING":return{...a,prompt:{...a.prompt,answering:b.answering}};case"SET_LAYOUT_MODE":return{...a,layout:{...a.layout,mode:b.mode}};case"SET_MOBILE_ACTIVE_PANE":return{...a,layout:{...a.layout,mobileActivePane:b.pane}};case"SET_SPLIT_RATIO":return{...a,layout:{...a.layout,splitRatio:b.ratio}};case"SET_LEFT_PANE_TAB":return{...a,layout:{...a.layout,leftPaneTab:b.tab}};case"TOGGLE_LEFT_PANE":return{...a,layout:{...a.layout,leftPaneCollapsed:!a.layout.leftPaneCollapsed}};case"SET_LEFT_PANE_COLLAPSED":return{...a,layout:{...a.layout,leftPaneCollapsed:b.collapsed}};case"SET_ACTIVE_ACTIVITY":return{...a,layout:{...a.layout,activityBar:{...a.layout.activityBar,active:b.activity}}};case"TOGGLE_ACTIVITY":{let c=a.layout.activityBar.active===b.activity?null:b.activity;return{...a,layout:{...a.layout,activityBar:{...a.layout.activityBar,active:c}}}}case"TOGGLE_HISTORY_PANE":{let b=!a.layout.historyPane.visible;return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,visible:b,collapsed:!b}}}}case"SET_HISTORY_PANE_VISIBLE":return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,visible:b.visible,collapsed:!b.visible}}};case"SET_HISTORY_WIDTH":return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,width:b.width}}};case"SET_ERROR":return{...a,error:b.error};case"CLEAR_ERROR":return{...a,error:{...fF}};case"INCREMENT_RETRY_COUNT":return{...a,error:{...a.error,retryCount:a.error.retryCount+1}};case"SET_MESSAGES":return{...a,messages:b.messages};case"ADD_MESSAGE":return{...a,messages:[...a.messages,b.message]};case"UPDATE_MESSAGE":return{...a,messages:a.messages.map(a=>a.id===b.id?{...a,...b.updates}:a)};case"CLEAR_MESSAGES":return{...a,messages:[]};case"SET_WS_CONNECTED":return{...a,wsConnected:b.connected};default:return a}}var fI=c(63157);function fJ(a){let b=a.split("/");return b[b.length-1]||a}function fK(a,b,c){let d=a.findIndex(a=>a.path===b);if(-1===d)return null;let e=[...a];return e[d]=c(e[d]),e}let fL={tabs:[],activeIndex:null};var fM=c(4267);let fN="activeCliTab-",fO="activeInstanceId-";function fP(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center justify-center h-full bg-surface text-muted-foreground",children:[(0,e.jsx)(m.y,{size:"lg",className:"mr-2"}),(0,e.jsx)("span",{children:a("detail.loadingEditor")})]})}let fQ=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/WorktreeDetailRefactored.tsx -> @/components/worktree/MarkdownEditor"]},ssr:!1,loading:()=>(0,e.jsx)(fP,{})}),fR=()=>{},fS=["terminal","history","files","memo","info"],fT=(0,h.memo)(function({worktreeId:a}){let{activeActivity:b,activeCliTab:c,activeInstanceId:d,activeTab:g,agentInstances:i,autoYesEnabled:j,autoYesExpiresAt:m,autoYesStateMap:n,diffContent:p,diffFilePath:r,disableAutoFollow:s,displayedInstances:t,editorFilePath:u,error:w,fetchCurrentOutput:x,fileInputRef:y,fileSearch:z,fileTreeRefresh:A,handleActivityToggle:B,handleAgentInstancesChange:C,handleAutoYesToggle:D,handleBackClick:G,handleCloseDiff:H,handleDelete:I,handleDiffSelect:J,handleDirtyChange:L,handleEditorClose:N,handleEditorSave:O,handleFileInputChange:P,handleFilePanelSave:Q,handleFilePathClick:R,handleFileSelect:U,handleHistoryDisplayLimitChange:V,handleHistoryUserOnlyChange:W,handleInfoClick:X,handleInfoModalClose:Y,handleInsertConsumed:Z,handleInsertConsumedSingle:$,handleInsertToMessage:_,handleInsertToSplit:aa,handleKillCancel:ac,handleKillConfirm:ad,openKillConfirm:ae,openActiveKillConfirm:af,killTarget:ah,isKillPending:ai,handleLoadContent:aj,handleLoadError:ak,handleMessageSent:an,handleMobileFileViewerClose:ao,handleMobileTabChange:ap,handleMove:aq,handleMoveCancel:ar,handleMoveConfirm:as,handleNewDirectory:at,handleNewFile:au,handleNewFileCancel:av,handleNewFileConfirm:aw,handleOpenFile:ax,handlePromptDismiss:ay,handlePromptRespond:az,handleRename:aA,handleRetry:aC,handleSetLoading:aD,handleShowArchivedChange:aE,handleUpload:aF,handleVibeLocalContextWindowChange:aG,handleVibeLocalModelChange:aH,handleWorktreeStatusChange:aI,hasUpdate:aJ,historyDisplayLimit:aK,historySubTab:aL,historyUserOnly:aM,isEditorMaximized:aN,isInfoModalOpen:aO,isMobile:aQ,isMoveDialogOpen:aR,isSelectionListActive:aS,isPagerActive:aT,lastAutoResponse:aV,loading:aX,makeAutoYesToggleHandler:aY,mobileFileViewerPath:aZ,mobileSelectedAgents:a$,moveTarget:a_,newFileParentPath:a0,openMobileDrawer:a1,pendingInsertText:a2,pendingInsertTextMap:a3,removeToast:a4,rosterReady:a8,setActiveInstanceId:a9,setEditorFilePath:ba,setFocusedSplitIndex:bb,setHistorySubTab:bc,setIsEditorMaximized:bd,setWorktree:be,showArchived:bf,showNewFileDialog:bg,showToast:bh,state:bi,tCommon:bj,tWorktree:bk,tabsActions:bl,tabsState:bm,resetFileTreeView:bn,toasts:bo,toggleInstanceVisible:bq,vibeLocalContextWindow:br,vibeLocalModel:bs,visibleInstanceIds:bt,worktree:bu,worktreeName:bv,worktreeStatus:bw}=function({worktreeId:a}){let b=(0,f.useRouter)(),c=(0,ab.a)(),d=(0,h.useRef)(c);d.current=c;let{openMobileDrawer:e}=(0,eF.VF)(),{state:g,actions:i}=function(){let[a,b]=(0,h.useReducer)(fH,void 0,fG),{value:c,setValue:d}=(0,dP.V)({key:"commandmate.worktree.leftPaneCollapsed",defaultValue:!1,validate:a=>"boolean"==typeof a}),e=(0,h.useRef)(a.layout.leftPaneCollapsed);e.current=a.layout.leftPaneCollapsed,(0,h.useRef)(!1);let f=(0,h.useMemo)(()=>({setPhase:a=>b({type:"SET_PHASE",phase:a}),showPrompt:(a,c)=>b({type:"SHOW_PROMPT",data:a,messageId:c}),clearPrompt:()=>b({type:"CLEAR_PROMPT"}),setPromptAnswering:a=>b({type:"SET_PROMPT_ANSWERING",answering:a}),setError:a=>b({type:"SET_ERROR",error:a}),clearError:()=>b({type:"CLEAR_ERROR"}),setMessages:a=>b({type:"SET_MESSAGES",messages:a}),addMessage:a=>b({type:"ADD_MESSAGE",message:a}),updateMessage:(a,c)=>b({type:"UPDATE_MESSAGE",id:a,updates:c}),clearMessages:()=>b({type:"CLEAR_MESSAGES"}),setMobileActivePane:a=>b({type:"SET_MOBILE_ACTIVE_PANE",pane:a}),setLeftPaneTab:a=>b({type:"SET_LEFT_PANE_TAB",tab:a}),setLayoutMode:a=>b({type:"SET_LAYOUT_MODE",mode:a}),setSplitRatio:a=>b({type:"SET_SPLIT_RATIO",ratio:a}),setWsConnected:a=>b({type:"SET_WS_CONNECTED",connected:a}),toggleLeftPane:()=>{let a=!e.current;b({type:"SET_LEFT_PANE_COLLAPSED",collapsed:a}),d(a)},setActiveActivity:a=>b({type:"SET_ACTIVE_ACTIVITY",activity:a}),toggleActivity:a=>b({type:"TOGGLE_ACTIVITY",activity:a}),toggleHistoryPane:()=>b({type:"TOGGLE_HISTORY_PANE"}),setHistoryPaneVisible:a=>b({type:"SET_HISTORY_PANE_VISIBLE",visible:a}),setHistoryWidth:a=>b({type:"SET_HISTORY_WIDTH",width:a})}),[d]);return{state:a,dispatch:b,actions:f}}(),j=(0,k.c)("worktree"),l=(0,k.c)("error"),m=(0,k.c)("common");(0,k.c)("autoYes");let n=(0,am.SC)(),o=(0,fI.rC)(),p=o?.worktrees.find(b=>b.id===a)??null,[r,s]=(0,h.useState)(p),[t,u]=(0,h.useState)(null===p),[v,w]=(0,h.useState)(null);(0,h.useRef)(null!==p);let[x,y]=(0,h.useState)(!1),[z,A]=function(a){let[b,c]=(0,h.useReducer)(function a(b,c){switch(c.type){case"OPEN_FILE":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1!==a){if(b.activeIndex===a)return b;return{...b,activeIndex:a}}if(b.tabs.length>=30)return b;let d={path:c.path,name:fJ(c.path),content:null,loading:!1,error:null,isDirty:!1},e=[...b.tabs,d];return{tabs:e,activeIndex:e.length-1}}case"CLOSE_TAB":{var d,e;let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a)return b;let f=b.tabs.filter((b,c)=>c!==a),g=(d=b.activeIndex,0===(e=f.length)||null===d?null:a<d?d-1:a===d?Math.min(a,e-1):d);return{tabs:f,activeIndex:g}}case"ACTIVATE_TAB":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a||b.activeIndex===a)return b;return{...b,activeIndex:a}}case"SET_CONTENT":{let a=fK(b.tabs,c.path,a=>({...a,content:c.content,loading:!1,error:null,isDirty:!1}));if(!a)return b;return{...b,tabs:a}}case"SET_LOADING":{let a=fK(b.tabs,c.path,a=>({...a,loading:c.loading}));if(!a)return b;return{...b,tabs:a}}case"SET_ERROR":{let a=fK(b.tabs,c.path,a=>({...a,error:c.error,loading:!1}));if(!a)return b;return{...b,tabs:a}}case"RENAME_FILE":{let a=b.tabs.findIndex(a=>a.path===c.oldPath);if(-1===a)return b;let d=[...b.tabs];return d[a]={...d[a],path:c.newPath,name:fJ(c.newPath)},{...b,tabs:d}}case"DELETE_FILE":return a(b,{type:"CLOSE_TAB",path:c.path});case"RESTORE":{let a=c.paths.slice(0,30).map(a=>({path:a,name:fJ(a),content:null,loading:!1,error:null,isDirty:!1}));if(0===a.length)return fL;let b=c.activePath?Math.max(0,a.findIndex(a=>a.path===c.activePath)):0;return{tabs:a,activeIndex:b}}case"SET_DIRTY":{let a=b.tabs.find(a=>a.path===c.path);if(a&&a.isDirty===c.isDirty)return b;let d=fK(b.tabs,c.path,a=>({...a,isDirty:c.isDirty}));if(!d)return b;return{...b,tabs:d}}case"MOVE_TO_FRONT":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a||0===a)return b;return{tabs:[b.tabs[a],...b.tabs.filter((b,c)=>c!==a)],activeIndex:0}}case"CLOSE_ALL":if(0===b.tabs.length)return b;return fL;default:return b}},fL);(0,h.useRef)(!1),(0,h.useRef)(a);let d=(0,h.useRef)(b);d.current=b;let e=(0,h.useCallback)(a=>{let b=d.current.tabs;return -1!==b.findIndex(b=>b.path===a)?(c({type:"OPEN_FILE",path:a}),"activated"):b.length>=30?"limit_reached":(c({type:"OPEN_FILE",path:a}),"opened")},[]),f=(0,h.useCallback)(a=>{c({type:"CLOSE_TAB",path:a})},[]),g=(0,h.useCallback)(a=>{c({type:"ACTIVATE_TAB",path:a})},[]),i=(0,h.useCallback)((a,b)=>{c({type:"RENAME_FILE",oldPath:a,newPath:b})},[]),j=(0,h.useCallback)(a=>{c({type:"DELETE_FILE",path:a})},[]),k=(0,h.useCallback)(a=>{c({type:"MOVE_TO_FRONT",path:a})},[]),l=(0,h.useCallback)(()=>{c({type:"CLOSE_ALL"})},[]),m=(0,h.useMemo)(()=>({dispatch:c,openFile:e,closeTab:f,activateTab:g,onFileRenamed:i,onFileDeleted:j,moveToFront:k,closeAllTabs:l}),[c,e,f,g,i,j,k,l]);return[b,m]}(a),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)(null),[F,G]=(0,h.useState)(!1),[H,I]=(0,h.useState)(new Map),[J,K]=(0,h.useState)(null),[L,M]=(0,h.useState)(!1),[N,O]=(0,h.useState)(!1),[P,Q]=(0,h.useState)(!1),R=(0,h.useRef)(!1),[S,U]=(0,h.useState)(null),[V,W]=(0,h.useState)(fM.fJ),X=(0,h.useRef)(V);X.current=V;let[Y,Z]=(0,h.useState)(()=>(0,a7.lu)(fM.fJ)),$=(0,h.useRef)(Y);$.current=Y;let[_,aa]=(0,h.useState)(null),ac=_===a,[ad,ae]=(0,h.useState)(null),[af,ag]=(0,h.useState)(null),[ah,ai]=(0,h.useState)(()=>{try{let b=window.localStorage.getItem(fN+a);if(b&&(0,a7.hR)(b))return b}catch{}return fM.fJ[0]}),aj=(0,h.useCallback)(b=>{ai(b);try{window.localStorage.setItem(fN+a,b)}catch{}},[a]),ak=(0,h.useRef)(ah);ak.current=ah;let[al,an]=(0,h.useState)(()=>{try{let b=window.localStorage.getItem(fO+a);if(b&&(0,a7.n6)(b))return b;let c=window.localStorage.getItem(fN+a);if(c&&(0,a7.hR)(c))return c}catch{}return fM.fJ[0]}),ao=(0,h.useCallback)(b=>{an(b);try{window.localStorage.setItem(fO+a,b)}catch{}let c=$.current.find(a=>a.id===b);c&&aj(c.cliTool)},[a,aj]),ap=(0,h.useRef)(al);ap.current=al;let aq=(0,h.useRef)(0),ar=(0,h.useRef)(0),as=(0,h.useRef)(0),at=H.get(al)?.enabled??!1,au=H.get(al)?.expiresAt??null,[av,aw]=(0,h.useState)(0),[ax,ay]=(0,h.useState)(!1),[az,aA]=(0,h.useState)(""),{active:aC,toggle:aD}=function(a){let[b,c]=(0,h.useState)("files"),d=(0,h.useRef)(b);d.current=b;let e=(0,h.useRef)(a);return e.current=a,{active:b,setActive:(0,h.useCallback)(a=>{c(a),e.current},[]),toggle:(0,h.useCallback)(a=>{if(d.current===a){c(null),e.current;return}c(a),e.current},[])}}(a),{historySubTab:aE,setHistorySubTab:aF,showArchived:aG,handleShowArchivedChange:aH,historyUserOnly:aI,handleHistoryUserOnlyChange:aJ,historyDisplayLimit:aK,handleHistoryDisplayLimitChange:aL}=function(){let[a,b]=(0,h.useState)("message"),[c,d]=(0,h.useState)(()=>!1),e=(0,h.useCallback)(a=>{d(a),localStorage.setItem("commandmate:showArchived",String(a))},[]),[f,g]=(0,h.useState)(()=>!1),i=(0,h.useCallback)(a=>{g(a);try{localStorage.setItem("commandmate:historyUserOnly",String(a))}catch{}},[]),[j,k]=(0,h.useState)(()=>50);return{historySubTab:a,setHistorySubTab:b,showArchived:c,handleShowArchivedChange:e,historyUserOnly:f,handleHistoryUserOnlyChange:i,historyDisplayLimit:j,handleHistoryDisplayLimitChange:(0,h.useCallback)(a=>{k(a);try{localStorage.setItem("commandmate:historyDisplayLimit",String(a))}catch{}},[])}}(),aM=(0,h.useRef)(aG),aN=(0,h.useRef)(aK),{pendingInsertTextMap:aO,pendingInsertText:aP,setFocusedSplitIndex:aQ,handleInsertToMessage:aR,handleInsertToSplit:aS,handleInsertConsumed:aT,handleInsertConsumedSingle:aV}=function(){let[a,b]=(0,h.useState)(()=>new Map),[c,d]=(0,h.useState)(0),e=(0,h.useCallback)(a=>{b(b=>{let d=new Map(b);return d.set(c,a),d})},[c]),f=(0,h.useCallback)((a,c)=>{b(b=>{let d=new Map(b);return d.set(a,c),d})},[]),g=(0,h.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let c=new Map(b);return c.delete(a),c})},[]),i=a.get(0)??null,j=(0,h.useCallback)(()=>g(0),[g]);return{pendingInsertTextMap:a,pendingInsertText:i,focusedSplitIndex:c,setFocusedSplitIndex:d,handleInsertToMessage:e,handleInsertToSplit:f,handleInsertConsumed:g,handleInsertConsumedSingle:j}}(),{diffContent:aX,diffFilePath:aY,handleDiffSelect:aZ,handleCloseDiff:a$}=function(a){let[b,c]=(0,h.useState)(null),[d,e]=(0,h.useState)(null);return{diffContent:b,diffFilePath:d,handleDiffSelect:(0,h.useCallback)((b,d)=>{a||(c(b),e(d))},[a]),handleCloseDiff:(0,h.useCallback)(()=>{c(null),e(null)},[])}}(c),a_=function(a){let{worktreeId:b,initialMode:c="name",debounceMs:d=300}=a,[e,f]=(0,h.useState)(""),[g,i]=(0,h.useState)(""),[j,k]=(0,h.useState)(c),[l,m]=(0,h.useState)(!1),[n,o]=(0,h.useState)(null),[p,r]=(0,h.useState)(null),s=(0,h.useRef)(null),t=(0,h.useMemo)(()=>{var a;let b;return a=a=>{i(a)},b=null,(...c)=>{b&&clearTimeout(b),b=setTimeout(()=>{a(...c),b=null},d)}},[d]),u=(0,h.useCallback)(a=>{f(a),t(a),r(null)},[t]),v=(0,h.useCallback)(()=>{f(""),i(""),o(null),r(null),m(!1),s.current&&(s.current.abort(),s.current=null)},[]),w=(0,h.useCallback)(a=>{if(!g.trim())return a;let b=g.toLowerCase();return a.filter(a=>a.name.toLowerCase().includes(b))},[g]),x=(0,h.useCallback)(()=>n&&0!==n.results.length?q(n.results.map(a=>a.filePath)):new Set,[n]);return{query:e,mode:j,isSearching:l,results:n,error:p,setQuery:u,setMode:k,clearSearch:v,filterByName:w,getMatchedPaths:x}}({worktreeId:a});(0,h.useRef)(!1),(0,h.useRef)(a);let a0=(0,h.useCallback)(async()=>{try{let b=await fetch(`/api/worktrees/${a}`);if(!b.ok)throw Error(`Failed to fetch worktree: ${b.status}`);let c=await b.json();if(s(c),c.selectedAgents){let a=X.current;c.selectedAgents.length===a.length&&c.selectedAgents.every((b,c)=>b===a[c])||W(c.selectedAgents)}if(c.agentInstances){let b=$.current,d=c.agentInstances;d.length===b.length&&d.every((a,c)=>a.id===b[c].id&&a.cliTool===b[c].cliTool&&a.alias===b[c].alias)||Z(d),aa(a)}return"vibeLocalModel"in c&&ae(c.vibeLocalModel??null),"vibeLocalContextWindow"in c&&ag(c.vibeLocalContextWindow??null),c}catch(a){return w(a instanceof Error?a.message:"Unknown error"),null}},[a]),a1=(0,h.useCallback)(async()=>{let b=ak.current,c=d.current,e=ap.current,f=++aq.current;try{let d=new URLSearchParams({cliTool:b});c&&d.set("instance",e),aM.current&&d.set("includeArchived","true"),d.set("limit",String(aN.current));let g=await fetch(`/api/worktrees/${a}/messages?${d.toString()}`);if(!g.ok)throw Error(`Failed to fetch messages: ${g.status}`);let h=await g.json();if(aq.current!==f||ak.current!==b||c&&ap.current!==e)return;i.setMessages(h.map(a=>({...a,timestamp:new Date(a.timestamp)})))}catch(a){if(aq.current!==f||ak.current!==b||c&&ap.current!==e)return;console.error("[WorktreeDetailRefactored] Error fetching messages:",a)}},[a,i]),a2=(0,h.useCallback)(async()=>{let b=ak.current,c=d.current,e=ap.current,f=++ar.current;try{let d=c?`/api/worktrees/${a}/current-output?cliTool=${b}&instance=${encodeURIComponent(e)}`:`/api/worktrees/${a}/current-output?cliTool=${b}`,h=await fetch(d);if(!h.ok)return;let j=await h.json();if(ar.current!==f||ak.current!==b||c&&ap.current!==e||j.cliToolId&&j.cliToolId!==b)return;if(j.isPromptWaiting&&j.promptData?i.showPrompt(j.promptData,`prompt-${Date.now()}`):!j.isPromptWaiting&&g.prompt.visible&&i.clearPrompt(),O(j.isSelectionListActive??!1),Q(j.isPagerActive??!1),K(j.lastServerResponseTimestamp??null),M(j.serverPollerActive??!1),j.autoYes){let a=R.current,d=j.autoYes,f=c?e:b;I(a=>{let b=new Map(a);return b.set(f,{enabled:d.enabled,expiresAt:d.expiresAt}),b}),R.current=d.enabled,a&&!j.autoYes.enabled&&("stop_pattern_matched"===j.autoYes.stopReason||"consecutive_errors"===j.autoYes.stopReason)&&U(j.autoYes.stopReason)}}catch(a){if(ar.current!==f||ak.current!==b||c&&ap.current!==e)return;console.error("[WorktreeDetailRefactored] Error fetching current output:",a)}},[a,i,g.prompt.visible]);(0,h.useCallback)(async()=>{let b=++as.current;try{let c=await fetch(`/api/worktrees/${a}/auto-yes`);if(!c.ok)return;let d=await c.json();if(as.current!==b)return;let e=d?.instances;if(!e||"object"!=typeof e)return;let f=new Map;for(let[a,b]of Object.entries(e))b&&"object"==typeof b&&f.set(a,{enabled:b.enabled??!1,expiresAt:b.expiresAt??null});I(f)}catch(a){if(as.current!==b)return;console.error("[WorktreeDetailRefactored] Error fetching auto-yes states:",a)}},[a]);let{visibleInstances:a3,visibleInstanceIds:a4,toggleInstanceVisible:a5}=function({worktreeId:a,roster:b}){let[c,d]=(0,h.useState)(null),e=(0,h.useMemo)(()=>dx(c,b),[c,b]),f=(0,h.useMemo)(()=>e.map(a=>a.id),[e]),g=(0,h.useMemo)(()=>null!==c&&b.some(a=>c.includes(a.id)),[c,b]),i=(0,h.useCallback)(a=>{let c=new Set(a),e=b.filter(a=>c.has(a.id)).map(a=>a.id);!(e.length<1)&&d(e)},[b,a]),j=(0,h.useCallback)(a=>i(a),[i]);return{visibleInstances:e,visibleInstanceIds:f,hasStoredPreference:g,toggleInstanceVisible:(0,h.useCallback)(a=>{let d=dx(c,b).map(a=>a.id);if(d.includes(a)){if(d.length<=1)return;i(d.filter(b=>b!==a))}else i([...d,a])},[c,b,i]),setVisibleInstanceIds:j,showInstances:(0,h.useCallback)(a=>{null!==c&&i([...dx(c,b).map(a=>a.id),...a])},[c,b,i])}}({worktreeId:a,roster:Y}),a6=c?a3:Y,a8=(0,h.useMemo)(()=>Array.from(new Set(a3.map(a=>a.cliTool))),[a3]),a9=c?a8:V,ba="opencode"===ah||"copilot"===ah,bb=(0,h.useCallback)(a=>{W(a)},[]),bc=(0,h.useCallback)(b=>{Z(b),aa(a)},[a]),bd=(0,h.useCallback)(a=>{ae(a)},[]),be=(0,h.useCallback)(a=>{ag(a)},[]);(0,h.useRef)(ah);let{toasts:bf,showToast:bg,removeToast:bh}=(0,aU.dj)(),bi=(0,h.useCallback)(()=>{bg("Maximum 30 file tabs. Close a tab first.","info")},[bg]),bj=(0,h.useCallback)(a=>{c?C(a):"limit_reached"===A.openFile(a)&&bi()},[c,A,bi]),bk=(0,h.useCallback)(a=>{c?C(a):"limit_reached"===A.openFile(a)&&bi()},[c,A,bi]),bl=(0,h.useCallback)(a=>{"limit_reached"===A.openFile(a)&&bi()},[A,bi]),bm=(0,h.useCallback)(()=>{C(null)},[]),bn=(0,h.useCallback)(a=>{aw(a=>a+1)},[]),bo=(0,h.useCallback)(()=>{E(null)},[]),bp=(0,h.useCallback)(()=>{a_.clearSearch(),A.closeAllTabs(),C(null),E(null)},[a_,A]),bq=(0,h.useCallback)(a=>{aw(a=>a+1)},[]),br=(0,h.useCallback)(a=>{aD(a)},[aD]),bs=(0,h.useCallback)(()=>{b.push("/")},[b]),bt=(0,h.useCallback)(async b=>{try{let c=await fetch(`/api/worktrees/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:b})});if(c.ok){let a=await c.json();s(a)}}catch{}},[a]),bu=(0,h.useCallback)(()=>{y(!0)},[]),bv=(0,h.useCallback)(()=>{y(!1)},[]),bw=(0,h.useCallback)(async b=>{i.setPromptAnswering(!0);try{let c=fu(b,ah,g.prompt.data,d.current?ap.current:void 0),e=await fetch(`/api/worktrees/${a}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!e.ok)throw Error(`Failed to send prompt response: ${e.status}`);i.clearPrompt(),await a2()}catch(a){console.error("[WorktreeDetailRefactored] Error sending prompt response:",a)}finally{i.setPromptAnswering(!1)}},[a,i,a2,ah,g.prompt.data]),bx=(0,h.useCallback)(()=>{i.clearPrompt()},[i]),by=(0,h.useCallback)(a=>{i.setMobileActivePane(a)},[i]),bz=(0,h.useCallback)(()=>{a1(),a2()},[a1,a2]),bA=(0,h.useCallback)((b,c)=>async d=>{let e=c??b;try{let c=await fetch(`/api/worktrees/${a}/auto-yes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:d.enabled,cliToolId:b,instanceId:e,duration:d.duration,stopPattern:d.stopPattern})});if(c.ok){let a=await c.json();I(b=>{let c=new Map(b);return c.set(e,{enabled:a.enabled,expiresAt:a.expiresAt}),c}),e===ap.current&&(R.current=a.enabled)}}catch(a){console.error("[WorktreeDetailRefactored] Error toggling auto-yes:",a)}},[a]),bB=(0,h.useCallback)(a=>bA(ah,al)(a),[bA,ah,al]),[bC,bD]=(0,h.useState)(null),[bE,bF]=(0,h.useState)(!1),bG=(0,h.useRef)(!1),bH=(0,h.useCallback)(a=>{bD(a)},[]),bI=(0,h.useCallback)(()=>{let a=ap.current,b=ak.current,c=(0,a7.O6)($.current,a,b);bD({cliToolId:b,instanceId:a,label:c})},[]),bJ=(0,h.useCallback)(async()=>{if(!bC||bG.current)return;bG.current=!0,bF(!0);let b=()=>{bC.instanceId===ap.current&&(i.clearMessages(),i.clearPrompt())};try{await T.y.killSession(a,bC.cliToolId,bC.instanceId),b(),await a0(),bD(null)}catch(a){a instanceof T.hD&&404===a.status?(b(),await a0(),bD(null)):bg(j("session.failedToKill"),"error")}finally{bG.current=!1,bF(!1)}},[bC,a,i,a0,bg,j]),bK=(0,h.useCallback)(()=>{bG.current||bD(null)},[]),bL=(0,h.useCallback)(a=>{aA(a),ay(!0)},[]),bM=(0,h.useCallback)(async b=>{ay(!1);let c=az?`${az}/${b}`:b;try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(c)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"file",content:""})})).ok)throw Error("Failed to create file");aw(a=>a+1)}catch{window.alert(l("fileOps.failedToCreateFile"))}},[a,az,l]),bN=(0,h.useCallback)(()=>{ay(!1)},[]),bO=(0,h.useCallback)(async b=>{let c=window.prompt("Enter directory name:");if(!c)return;let d=b?`${b}/${c}`:c;try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(d)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"directory"})})).ok)throw Error("Failed to create directory");aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to create directory:",a),window.alert(l("fileOps.failedToCreateDirectory"))}},[a,l]),bP=(0,h.useCallback)(async b=>{let c=b.split("/").pop()||"",d=window.prompt("Enter new name:",c);if(d&&d!==c)try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(b)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",newName:d})})).ok)throw Error("Failed to rename");let c=b.includes("/")?b.substring(0,b.lastIndexOf("/")+1):"";A.onFileRenamed(b,`${c}${d}`),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to rename:",a),window.alert(l("fileOps.failedToRename"))}},[a,A,l]),bQ=(0,h.useCallback)(async b=>{let c=b.split("/").pop()||b;if(await n({description:m("confirmDelete",{name:c}),variant:"danger"}))try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(b)}?recursive=true`,{method:"DELETE"})).ok)throw Error("Failed to delete");(D===b||D?.startsWith(`${b}/`))&&E(null),A.onFileDeleted(b),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to delete:",a),window.alert(l("fileOps.failedToDelete"))}},[a,D,A,m,l,n]),{moveTarget:bR,isMoveDialogOpen:bS,handleMove:bT,handleMoveConfirm:bU,handleMoveCancel:bV}=function(a,b,c,d){let[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(!1),j=(0,h.useCallback)((a,b)=>{f({path:a,type:b}),i(!0)},[]),k=(0,h.useCallback)(async g=>{if(e)try{let f=await fetch(`/api/worktrees/${a}/files/${e.path}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"move",destination:g})}),h=await f.json();if(!f.ok||!h.success){let a=h.error?.message||"Failed to move";d?.(a);return}c?.("Moved successfully"),b()}catch{d?.("Failed to move")}finally{f(null),i(!1)}},[e,a,b,c,d]);return{moveTarget:e,isMoveDialogOpen:g,handleMove:j,handleMoveConfirm:k,handleMoveCancel:(0,h.useCallback)(()=>{f(null),i(!1)},[])}}(a,()=>aw(a=>a+1),a=>bg(a,"success"),a=>bg(a,"error")),bW=(0,h.useRef)(null),bX=(0,h.useRef)(""),bY=(0,h.useCallback)(a=>{bX.current=a,bW.current?.click()},[]),bZ=(0,h.useCallback)(async b=>{let c=b.target.files?.[0];if(!c)return;b.target.value="";let d=bX.current,e=`.${c.name.split(".").pop()?.toLowerCase()}`;if(!function(a){if(!a)return!1;let b=a.toLowerCase();return eM.includes(b)}(e))return void bg(`Unsupported file type: ${e}. Allowed: ${eM.join(", ")}`,"error");let f=function(a){let b=function(a){let b=a.toLowerCase();return eL.find(a=>a.extension===b)}(a);return b?.maxFileSize??0x1400000}(e);if(c.size>f)return void bg(`File too large. Maximum size: ${(f/1024/1024).toFixed(1)}MB`,"error");let g=new FormData;g.append("file",c);try{let b=await fetch(`/api/worktrees/${a}/upload/${aB(d||".")}`,{method:"POST",body:g});if(!b.ok){let a=await b.json().catch(()=>({})),c=a?.error?.message||"Failed to upload file";bg(c,"error");return}let c=await b.json();bg(`Uploaded: ${c.filename}`,"success"),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to upload:",a),bg("Upload failed. Please try again.","error")}},[a,bg]),{data:b$}=aW(),b_=b$?.hasUpdate??!1,{lastAutoResponse:b0}=function({worktreeId:a,cliTool:b,isPromptWaiting:c,promptData:d,autoYesEnabled:e,lastServerResponseTimestamp:f,serverPollerActive:g}){(0,h.useRef)(null);let[i,j]=(0,h.useState)(null);return{lastAutoResponse:i}}({worktreeId:a,cliTool:ah,isPromptWaiting:g.prompt.visible,promptData:g.prompt.data,autoYesEnabled:at,lastServerResponseTimestamp:J,serverPollerActive:L}),b1=(0,h.useCallback)(async()=>{w(null),u(!0),await a0()&&await Promise.all([a1(),a2()]),u(!1)},[a0,a1,a2]);!function({error:a,handleRetry:b,fetchWorktree:c,fetchMessages:d,fetchCurrentOutput:e,setError:f}){let g=(0,h.useRef)(0);(0,h.useCallback)(async()=>{if("visible"!==document.visibilityState)return;let h=Date.now();if(!(h-g.current<5e3)){if(g.current=h,a)return void b();try{await Promise.all([c(),d(),e()])}finally{f(null)}}},[a,b,c,d,e,f])}({error:v,handleRetry:b1,fetchWorktree:a0,fetchMessages:a1,fetchCurrentOutput:a2,setError:w}),r?.sessionStatusByCli?.[ah]?.isRunning;let b2=(0,h.useMemo)(()=>(function(a,b,c="claude"){if(b)return"error";if(!a)return"idle";let d=a.sessionStatusByCli?.[c];if(d){if(d.isWaitingForResponse)return"waiting";if(d.isProcessing)return"running";if(d.isRunning)return"ready"}if("claude"===c){if(a.isWaitingForResponse)return"waiting";if(a.isProcessing)return"running";if(a.isSessionRunning)return"ready"}return"idle"})(r,null!==g.error.type,ah),[r,g.error.type,ah]),b3=(0,h.useMemo)(()=>g.layout.mobileActivePane,[g.layout.mobileActivePane]),b4=r?.name??"Unknown",b5=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_CONTENT",path:a,content:b})},[A]),b6=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_ERROR",path:a,error:b})},[A]),b7=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_LOADING",path:a,loading:b})},[A]);return{activeActivity:aC,activeCliTab:ah,activeInstanceId:al,activeTab:b3,agentInstances:Y,autoYesEnabled:at,autoYesExpiresAt:au,autoYesStateMap:H,diffContent:aX,diffFilePath:aY,disableAutoFollow:ba,displayedAgents:a9,displayedInstances:a6,editorFilePath:D,error:v,fetchCurrentOutput:a2,fileInputRef:bW,fileSearch:a_,fileTreeRefresh:av,handleActivityToggle:br,handleAgentInstancesChange:bc,handleAutoYesToggle:bB,handleBackClick:bs,handleCloseDiff:a$,handleDelete:bQ,handleDiffSelect:aZ,handleDirtyChange:(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_DIRTY",path:a,isDirty:b})},[A]),handleEditorClose:bo,handleEditorSave:bq,handleFileInputChange:bZ,handleFilePanelSave:bn,handleFilePathClick:bj,handleFileSelect:bk,handleHistoryDisplayLimitChange:aL,handleHistoryUserOnlyChange:aJ,handleInfoClick:bu,handleInfoModalClose:bv,handleInsertConsumed:aT,handleInsertConsumedSingle:aV,handleInsertToMessage:aR,handleInsertToSplit:aS,handleKillCancel:bK,handleKillConfirm:bJ,openKillConfirm:bH,openActiveKillConfirm:bI,killTarget:bC,isKillPending:bE,handleLoadContent:b5,handleLoadError:b6,handleMessageSent:bz,handleMobileFileViewerClose:bm,handleMobileTabChange:by,handleMove:bT,resetFileTreeView:bp,handleMoveCancel:bV,handleMoveConfirm:bU,handleNewDirectory:bO,handleNewFile:bL,handleNewFileCancel:bN,handleNewFileConfirm:bM,handleOpenFile:bl,handlePromptDismiss:bx,handlePromptRespond:bw,handleRename:bP,handleRetry:b1,handleSelectedAgentsChange:bb,handleSetLoading:b7,handleShowArchivedChange:aH,handleUpload:bY,handleVibeLocalContextWindowChange:be,rosterReady:ac,handleVibeLocalModelChange:bd,handleWorktreeStatusChange:bt,hasUpdate:b_,historyDisplayLimit:aK,historySubTab:aE,historyUserOnly:aI,isEditorMaximized:F,isInfoModalOpen:x,isMobile:c,isMoveDialogOpen:bS,isSelectionListActive:N,isPagerActive:P,lastAutoResponse:b0,loading:t,makeAutoYesToggleHandler:bA,mobileFileViewerPath:B,mobileSelectedAgents:a8,moveTarget:bR,newFileParentPath:az,openMobileDrawer:e,pendingInsertText:aP,pendingInsertTextMap:aO,removeToast:bh,selectedAgents:V,setActiveCliTab:aj,setActiveInstanceId:ao,setEditorFilePath:E,setFocusedSplitIndex:aQ,setHistorySubTab:aF,setIsEditorMaximized:G,setWorktree:s,showArchived:aG,showNewFileDialog:ax,showToast:bg,state:g,tCommon:m,tWorktree:j,tabsActions:A,tabsState:z,toasts:bf,toggleInstanceVisible:a5,vibeLocalContextWindow:af,vibeLocalModel:ad,visibleInstanceIds:a4,worktree:r,worktreeName:b4,worktreeStatus:b2}}({worktreeId:a}),[bx,by]=(0,h.useState)(!1),bz=function({worktreeId:a,active:b}){let{addListener:c}=(0,bp.xM)(),[d,e]=(0,h.useState)(!1);return(0,h.useRef)(b).current=b,!b&&d}({worktreeId:a,active:"terminal"===g}),{viewportHeight:bA}=function(){let[a,b]=(0,h.useState)(!1),[c,d]=(0,h.useState)(0),[e,f]=(0,h.useState)(null);return(0,h.useCallback)(()=>{},[]),{isKeyboardVisible:a,keyboardHeight:c,viewportHeight:e}}(),bB=(0,h.useCallback)(a=>{let b=fS.indexOf(g);if(-1===b)return;let c=b+a;c<0||c>=fS.length||ap(fS[c])},[g,ap]),{ref:bC}=K({axis:"horizontal",threshold:60,edgeStartZone:32*("terminal"===g),onSwipeLeft:()=>bB(1),onSwipeRight:()=>bB(-1)});if(aX)return(0,e.jsx)(et,{});if(w)return(0,e.jsx)(eu,{message:w,onRetry:aC});let bD=(0,a7.O6)(i,d,c),bE=ah?.label??bD,bF=(bu?.sessionStatusByInstance?.[d]??bu?.sessionStatusByCli?.[c])?.isRunning??!1;return aQ?(0,e.jsx)(F,{componentName:"WorktreeDetailRefactored",children:(0,e.jsxs)("div",{className:"flex flex-col overflow-hidden",style:{height:null!=bA?`${bA}px`:"100%"},"data-testid":"mobile-worktree-shell",children:[(0,e.jsx)("div",{className:"flex-shrink-0",children:(0,e.jsx)(v,{worktreeName:bv,repositoryName:bu?.repositoryName,status:bw,gitStatus:bu?.gitStatus,onBackClick:G,onMenuClick:a1})}),bu?.gitStatus&&bu.gitStatus.isBranchMismatch&&(0,e.jsx)("div",{className:"z-35 flex-shrink-0",children:(0,e.jsx)(fx,{isBranchMismatch:bu.gitStatus.isBranchMismatch,currentBranch:bu.gitStatus.currentBranch,initialBranch:bu.gitStatus.initialBranch})}),(0,e.jsxs)("div",{className:"flex-shrink-0 z-30 flex items-center gap-2 px-3 py-1.5 bg-surface-2 border-b border-border",children:[(0,e.jsx)("nav",{className:"flex gap-1 flex-1 min-w-0 overflow-x-auto scrollbar-hide","aria-label":bk("detail.agentInstanceSelection"),children:t.map(a=>{let b=(0,a6.kA)(bu?.sessionStatusByInstance?.[a.id]??bu?.sessionStatusByCli?.[a.cliTool]),c=bj(`status.${b}`),f=d===a.id;return(0,e.jsxs)("button",{onClick:()=>a9(a.id),className:`flex-shrink-0 whitespace-nowrap min-h-[44px] px-1.5 py-1 font-medium text-xs transition-colors flex items-center gap-1 border-b-2 touch-manipulation ${f?"text-accent-600 dark:text-accent-400 border-accent-500":"text-muted-foreground hover:text-foreground border-transparent"}`,"aria-current":f?"page":void 0,children:[(0,e.jsx)(o.m,{status:b,size:"sm",label:bk("detail.statusPill",{label:(0,a7.sw)(a),status:c})}),(0,a7.sw)(a)]},a.id)})}),(0,e.jsx)("button",{type:"button",onClick:()=>by(!0),className:"flex-shrink-0 flex items-center justify-center min-h-[44px] min-w-[44px] rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors touch-manipulation","aria-label":bk("terminal.moreActions"),"data-testid":"mobile-more-actions-button",children:(0,e.jsx)(l.A,{size:18,"aria-hidden":"true"})})]}),(0,e.jsx)("main",{className:"flex-1 min-h-0 overflow-y-auto",ref:bC,children:(0,e.jsx)(en,{activeTab:g,worktreeId:a,worktree:bu,messages:bi.messages,cliToolId:c,instanceId:d,onFilePathClick:R,onFileSelect:U,onWorktreeUpdate:be,onNewFile:au,onNewDirectory:at,onRename:aA,onDelete:I,onUpload:aF,onMove:aq,onFileTreeReset:bn,refreshTrigger:A,fileSearch:z,showToast:bh,selectedAgents:a$,onSelectedAgentsChange:fR,useInstanceManagement:!0,instances:i,onInstancesChange:C,visibleInstanceIds:bt,onToggleInstanceVisible:bq,vibeLocalModel:bs,onVibeLocalModelChange:aH,vibeLocalContextWindow:br,onVibeLocalContextWindowChange:aG,disableAutoFollow:s,historySubTab:aL,onHistorySubTabChange:bc,onDiffSelect:J,onInsertToMessage:_,showArchived:bf,onShowArchivedChange:aE,historyDisplayLimit:aK,onHistoryDisplayLimitChange:V,historyUserOnly:aM,onHistoryUserOnlyChange:W})}),(0,e.jsxs)("div",{className:"flex-shrink-0 border-t border-border bg-surface z-30",children:[aS&&(0,e.jsx)("div",{className:"px-2 pt-1 border-b border-border",children:(0,e.jsx)(al,{worktreeId:a,cliToolId:c,instanceId:d,onKeysSent:x,showPagerKeys:aT})}),(0,e.jsx)("div",{className:"p-2",children:(0,e.jsx)(ag,{worktreeId:a,onMessageSent:an,cliToolId:c,instanceId:d,isSessionRunning:bF,pendingInsertText:a2,onInsertConsumed:$,autoYesSlot:(0,e.jsx)(fs,{enabled:j,expiresAt:m,onToggle:D,lastAutoResponse:aV,cliToolName:c,inline:!0,showToolName:!1})})})]}),(0,e.jsx)(E,{activeTab:g,onTabChange:ap,hasNewOutput:bz,hasPrompt:bi.prompt.visible,hasUpdate:aJ,inFlow:!0}),!j&&(0,e.jsx)(M,{promptData:bi.prompt.data,visible:bi.prompt.visible,answering:bi.prompt.answering,onRespond:az,onDismiss:ay,cliToolName:(0,a7.oo)(c)}),(0,e.jsx)(S,{open:bx,onClose:()=>by(!1),onSearch:()=>window.dispatchEvent(new CustomEvent("terminal-search-open")),onEnd:af,endDisabled:!bF}),(0,e.jsx)(aP,{isOpen:null!==aZ,onClose:ao,worktreeId:a,filePath:aZ??"",onEditMarkdown:ba}),u&&(0,e.jsx)(a5.a,{isOpen:!0,onClose:N,title:u.split("/").pop()||bk("fileViewer.editor"),size:"full",disableClose:aN,children:(0,e.jsx)("div",{className:"h-[80vh]",children:(0,e.jsx)(fQ,{worktreeId:a,filePath:u,onClose:N,onSave:O,onMaximizedChange:bd,initialViewMode:"split"})})}),(0,e.jsx)("input",{ref:y,type:"file",accept:eM.join(","),onChange:P,className:"hidden","aria-label":bk("detail.uploadFile")}),(0,e.jsx)(a5.a,{isOpen:null!==ah,onClose:ac,title:bk("session.confirmEnd",{tool:bE}),size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("p",{className:"text-sm text-foreground",children:bk("session.endWarning")}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:ac,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:bj("cancel")}),(0,e.jsx)("button",{type:"button",onClick:ad,disabled:ai,className:"px-4 py-2 text-sm font-medium rounded-md bg-danger hover:bg-danger/90 text-white disabled:opacity-60 disabled:cursor-not-allowed",children:bj("end")})]})]})}),a_&&(0,e.jsx)(fz,{isOpen:aR,onClose:ar,onConfirm:as,worktreeId:a,sourcePath:a_.path,sourceType:a_.type}),(0,e.jsx)(fB,{isOpen:bg,parentPath:a0,onConfirm:aw,onCancel:av}),(0,e.jsx)(aU.N9,{toasts:bo,onClose:a4})]})}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(fC,{worktreeId:a,worktree:bu,worktreeName:bv,worktreeStatus:bw,instances:i,rosterReady:a8,activeInstanceId:d,setActiveInstanceId:a9,hasUpdate:aJ,lastAutoResponse:aV,activeActivity:b,onActivityToggle:B,onBackClick:G,onInfoClick:X,onWorktreeStatusChange:aI,pendingInsertTextMap:a3,setFocusedSplitIndex:bb,handleInsertToSplit:aa,handleInsertConsumed:Z,handleInsertToMessage:_,autoYesStateMap:n,makeAutoYesToggleHandler:aY,showArchived:bf,onShowArchivedChange:aE,historyDisplayLimit:aK,onHistoryDisplayLimitChange:V,historyUserOnly:aM,onHistoryUserOnlyChange:W,onMessageSent:an,onFilePathClick:R,showToast:bh,tabsState:bm,tabsActions:bl,onLoadContent:aj,onLoadError:ak,onSetLoading:aD,onFilePanelSave:Q,onDirtyChange:L,onOpenFile:ax,diffContent:p,diffFilePath:r,onCloseDiff:H,fileSearch:z,fileTreeRefresh:A,onFileSelect:U,onNewFile:au,onNewDirectory:at,onRename:aA,onDelete:I,onUpload:aF,onMove:aq,onFileTreeReset:bn,onDiffSelect:J,onAgentInstancesChange:C,vibeLocalModel:bs,onVibeLocalModelChange:aH,vibeLocalContextWindow:br,onVibeLocalContextWindowChange:aG,isInfoModalOpen:aO,onInfoModalClose:Y,onWorktreeUpdate:be,fileInputRef:y,onFileInputChange:P,onKillSession:af,onRequestSessionEnd:ae,killTarget:ah,isKillPending:ai,onKillCancel:ac,onKillConfirm:ad,moveTarget:a_,isMoveDialogOpen:aR,onMoveCancel:ar,onMoveConfirm:as,showNewFileDialog:bg,newFileParentPath:a0,onNewFileConfirm:aw,onNewFileCancel:av,toasts:bo,onToastClose:a4,killDialogTitle:bk("session.confirmEnd",{tool:bE}),killDialogWarning:bk("session.endWarning"),cancelLabel:bj("cancel"),endLabel:bj("end")}),u&&(0,e.jsx)(a5.a,{isOpen:!0,onClose:N,title:u.split("/").pop()||bk("fileViewer.editor"),size:"full",disableClose:aN,children:(0,e.jsx)("div",{className:"h-[80vh]",children:(0,e.jsx)(fQ,{worktreeId:a,filePath:u,onClose:N,onSave:O,onMaximizedChange:bd})})})]})});function fU(){let a=(0,f.useParams)().id;return(0,e.jsx)(g.GV,{children:(0,e.jsx)(fT,{worktreeId:a})})}},97369:a=>{a.exports=function(a){return{name:"STEP Part 21",aliases:["p21","step","stp"],case_insensitive:!0,keywords:{$pattern:"[A-Z_][A-Z0-9_.]*",keyword:["HEADER","ENDSEC","DATA"]},contains:[{className:"meta",begin:"ISO-10303-21;",relevance:10},{className:"meta",begin:"END-ISO-10303-21;",relevance:10},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.COMMENT("/\\*\\*!","\\*/"),a.C_NUMBER_MODE,a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"symbol",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}]}}},97467:a=>{a.exports=function(a){return{name:"DNS Zone",aliases:["bind","zone"],keywords:["IN","A","AAAA","AFSDB","APL","CAA","CDNSKEY","CDS","CERT","CNAME","DHCID","DLV","DNAME","DNSKEY","DS","HIP","IPSECKEY","KEY","KX","LOC","MX","NAPTR","NS","NSEC","NSEC3","NSEC3PARAM","PTR","RRSIG","RP","SIG","SOA","SRV","SSHFP","TA","TKEY","TLSA","TSIG","TXT"],contains:[a.COMMENT(";","$",{relevance:0}),{className:"meta",begin:/^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/},{className:"number",begin:"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b"},{className:"number",begin:"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b"},a.inherit(a.NUMBER_MODE,{begin:/\b\d+[dhwm]?/})]}}},97694:a=>{a.exports=function(a){let b=a.regex,c={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:a.NUMBER_RE}]},d=a.COMMENT();d.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let e={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},f={className:"literal",begin:/\bon|off|true|false|yes|no\b/},g={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},h=b.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[d,{className:"section",begin:/\[+/,end:/\]+/},{begin:b.concat(h,"(\\s*\\.\\s*",h,")*",b.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[d,{begin:/\[/,end:/\]/,contains:[d,f,e,g,c,"self"],relevance:0},f,e,g,c]}}]}}},98758:a=>{a.exports=function(a){return{name:"Inform 7",aliases:["i7"],case_insensitive:!0,keywords:{keyword:"thing room person man woman animal container supporter backdrop door scenery open closed locked inside gender is are say understand kind of rule"},contains:[{className:"string",begin:'"',end:'"',relevance:0,contains:[{className:"subst",begin:"\\[",end:"\\]"}]},{className:"section",begin:/^(Volume|Book|Part|Chapter|Section|Table)\b/,end:"$"},{begin:/^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,end:":",contains:[{begin:"\\(This",end:"\\)"}]},{className:"comment",begin:"\\[",end:"\\]",contains:["self"]}]}}},98803:a=>{a.exports=function(a){let b=a.regex,c=/[a-zA-Z_][a-zA-Z0-9_]*/,d={className:"number",variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]};return{name:"Tcl",aliases:["tk"],keywords:["after","append","apply","array","auto_execok","auto_import","auto_load","auto_mkindex","auto_mkindex_old","auto_qualify","auto_reset","bgerror","binary","break","catch","cd","chan","clock","close","concat","continue","dde","dict","encoding","eof","error","eval","exec","exit","expr","fblocked","fconfigure","fcopy","file","fileevent","filename","flush","for","foreach","format","gets","glob","global","history","http","if","incr","info","interp","join","lappend|10","lassign|10","lindex|10","linsert|10","list","llength|10","load","lrange|10","lrepeat|10","lreplace|10","lreverse|10","lsearch|10","lset|10","lsort|10","mathfunc","mathop","memory","msgcat","namespace","open","package","parray","pid","pkg::create","pkg_mkIndex","platform","platform::shell","proc","puts","pwd","read","refchan","regexp","registry","regsub|10","rename","return","safe","scan","seek","set","socket","source","split","string","subst","switch","tcl_endOfWord","tcl_findLibrary","tcl_startOfNextWord","tcl_startOfPreviousWord","tcl_wordBreakAfter","tcl_wordBreakBefore","tcltest","tclvars","tell","time","tm","trace","unknown","unload","unset","update","uplevel","upvar","variable","vwait","while"],contains:[a.COMMENT(";[ \\t]*#","$"),a.COMMENT("^[ \\t]*#","$"),{beginKeywords:"proc",end:"[\\{]",excludeEnd:!0,contains:[{className:"title",begin:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"[ \\t\\n\\r]",endsWithParent:!0,excludeEnd:!0}]},{className:"variable",variants:[{begin:b.concat(/\$/,b.optional(/::/),c,"(::",c,")*")},{begin:"\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"\\}",contains:[d]}]},{className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[a.inherit(a.QUOTE_STRING_MODE,{illegal:null})]},d]}}},99134:a=>{a.exports=function(a){let b=a.regex,c=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,d=b.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),e=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,f=b.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:c,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[a.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:b.lookahead(b.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:c},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),a.HASH_COMMENT_MODE,{scope:"string",contains:[a.BACKSLASH_ESCAPE],variants:[a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[e,d]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,d]},{scope:{1:"punctuation",2:"number"},match:[f,d]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,d]}]},{scope:{3:"operator"},match:[c,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:e},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:f},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}},99626:a=>{"use strict";a.exports=JSON.parse('{"Aacute":"\xc1","aacute":"\xe1","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"\xc2","acirc":"\xe2","acute":"\xb4","Acy":"А","acy":"а","AElig":"\xc6","aelig":"\xe6","af":"⁡","Afr":"\uD835\uDD04","afr":"\uD835\uDD1E","Agrave":"\xc0","agrave":"\xe0","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"\xc5","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"\uD835\uDD38","aopf":"\uD835\uDD52","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"\xc5","aring":"\xe5","Ascr":"\uD835\uDC9C","ascr":"\uD835\uDCB6","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"\xc3","atilde":"\xe3","Auml":"\xc4","auml":"\xe4","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"\uD835\uDD05","bfr":"\uD835\uDD1F","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"\uD835\uDD39","bopf":"\uD835\uDD53","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"\xa6","bscr":"\uD835\uDCB7","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"\xc7","ccedil":"\xe7","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"\xb8","Cedilla":"\xb8","cemptyv":"⦲","cent":"\xa2","centerdot":"\xb7","CenterDot":"\xb7","cfr":"\uD835\uDD20","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"\xae","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"\uD835\uDD54","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"\xa9","COPY":"\xa9","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"\uD835\uDC9E","cscr":"\uD835\uDCB8","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"\xa4","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"\xb0","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"\uD835\uDD07","dfr":"\uD835\uDD21","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"\xb4","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"\xa8","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"\xf7","divide":"\xf7","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"\uD835\uDD3B","dopf":"\uD835\uDD55","Dot":"\xa8","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"\xa8","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"\uD835\uDC9F","dscr":"\uD835\uDCB9","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"\xc9","eacute":"\xe9","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"\xca","ecirc":"\xea","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"\uD835\uDD08","efr":"\uD835\uDD22","eg":"⪚","Egrave":"\xc8","egrave":"\xe8","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"\uD835\uDD3C","eopf":"\uD835\uDD56","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"\xd0","eth":"\xf0","Euml":"\xcb","euml":"\xeb","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"\uD835\uDD09","ffr":"\uD835\uDD23","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"\uD835\uDD3D","fopf":"\uD835\uDD57","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"\xbd","frac13":"⅓","frac14":"\xbc","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"\xbe","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"\uD835\uDCBB","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"\uD835\uDD0A","gfr":"\uD835\uDD24","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"\uD835\uDD3E","gopf":"\uD835\uDD58","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"\uD835\uDCA2","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"\xbd","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"\uD835\uDD25","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"\uD835\uDD59","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"\uD835\uDCBD","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"\xcd","iacute":"\xed","ic":"⁣","Icirc":"\xce","icirc":"\xee","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"\xa1","iff":"⇔","ifr":"\uD835\uDD26","Ifr":"ℑ","Igrave":"\xcc","igrave":"\xec","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"\uD835\uDD40","iopf":"\uD835\uDD5A","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"\xbf","iscr":"\uD835\uDCBE","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"\xcf","iuml":"\xef","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"\uD835\uDD0D","jfr":"\uD835\uDD27","jmath":"ȷ","Jopf":"\uD835\uDD41","jopf":"\uD835\uDD5B","Jscr":"\uD835\uDCA5","jscr":"\uD835\uDCBF","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"\uD835\uDD0E","kfr":"\uD835\uDD28","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"\uD835\uDD42","kopf":"\uD835\uDD5C","Kscr":"\uD835\uDCA6","kscr":"\uD835\uDCC0","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"\xab","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"\uD835\uDD0F","lfr":"\uD835\uDD29","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"\uD835\uDD43","lopf":"\uD835\uDD5D","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"\uD835\uDCC1","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"\xaf","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"\uD835\uDD10","mfr":"\uD835\uDD2A","mho":"℧","micro":"\xb5","midast":"*","midcir":"⫰","mid":"∣","middot":"\xb7","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"\uD835\uDD44","mopf":"\uD835\uDD5E","mp":"∓","mscr":"\uD835\uDCC2","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":"\xa0","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"\uD835\uDD11","nfr":"\uD835\uDD2B","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":"\xa0","nopf":"\uD835\uDD5F","Nopf":"ℕ","Not":"⫬","not":"\xac","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"\uD835\uDCA9","nscr":"\uD835\uDCC3","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"\xd1","ntilde":"\xf1","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"\xd3","oacute":"\xf3","oast":"⊛","Ocirc":"\xd4","ocirc":"\xf4","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"\uD835\uDD12","ofr":"\uD835\uDD2C","ogon":"˛","Ograve":"\xd2","ograve":"\xf2","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"\uD835\uDD46","oopf":"\uD835\uDD60","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"\xaa","ordm":"\xba","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"\uD835\uDCAA","oscr":"ℴ","Oslash":"\xd8","oslash":"\xf8","osol":"⊘","Otilde":"\xd5","otilde":"\xf5","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"\xd6","ouml":"\xf6","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"\xb6","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"\uD835\uDD13","pfr":"\uD835\uDD2D","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"\xb1","plusmn":"\xb1","plussim":"⨦","plustwo":"⨧","pm":"\xb1","Poincareplane":"ℌ","pointint":"⨕","popf":"\uD835\uDD61","Popf":"ℙ","pound":"\xa3","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"\uD835\uDCAB","pscr":"\uD835\uDCC5","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"\uD835\uDD14","qfr":"\uD835\uDD2E","qint":"⨌","qopf":"\uD835\uDD62","Qopf":"ℚ","qprime":"⁗","Qscr":"\uD835\uDCAC","qscr":"\uD835\uDCC6","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"\xbb","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"\xae","REG":"\xae","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"\uD835\uDD2F","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"\uD835\uDD63","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"\uD835\uDCC7","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"\xa7","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"\uD835\uDD16","sfr":"\uD835\uDD30","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"\xad","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"\uD835\uDD4A","sopf":"\uD835\uDD64","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"\uD835\uDCAE","sscr":"\uD835\uDCC8","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"\xaf","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"\xdf","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"\uD835\uDD17","tfr":"\uD835\uDD31","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"\xde","thorn":"\xfe","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"\xd7","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"\uD835\uDD4B","topf":"\uD835\uDD65","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"\uD835\uDCAF","tscr":"\uD835\uDCC9","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"\xda","uacute":"\xfa","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"\xdb","ucirc":"\xfb","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"\uD835\uDD18","ufr":"\uD835\uDD32","Ugrave":"\xd9","ugrave":"\xf9","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"\xa8","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"\uD835\uDD4C","uopf":"\uD835\uDD66","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"\uD835\uDCB0","uscr":"\uD835\uDCCA","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"\xdc","uuml":"\xfc","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"\uD835\uDD19","vfr":"\uD835\uDD33","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"\uD835\uDD4D","vopf":"\uD835\uDD67","vprop":"∝","vrtri":"⊳","Vscr":"\uD835\uDCB1","vscr":"\uD835\uDCCB","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"\uD835\uDD1A","wfr":"\uD835\uDD34","Wopf":"\uD835\uDD4E","wopf":"\uD835\uDD68","wp":"℘","wr":"≀","wreath":"≀","Wscr":"\uD835\uDCB2","wscr":"\uD835\uDCCC","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"\uD835\uDD1B","xfr":"\uD835\uDD35","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"\uD835\uDD4F","xopf":"\uD835\uDD69","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"\uD835\uDCB3","xscr":"\uD835\uDCCD","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"\xdd","yacute":"\xfd","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"\xa5","Yfr":"\uD835\uDD1C","yfr":"\uD835\uDD36","YIcy":"Ї","yicy":"ї","Yopf":"\uD835\uDD50","yopf":"\uD835\uDD6A","Yscr":"\uD835\uDCB4","yscr":"\uD835\uDCCE","YUcy":"Ю","yucy":"ю","yuml":"\xff","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"\uD835\uDD37","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"\uD835\uDD6B","Zopf":"ℤ","Zscr":"\uD835\uDCB5","zscr":"\uD835\uDCCF","zwj":"‍","zwnj":"‌"}')},99896:a=>{a.exports=function(a){return{name:"JBoss CLI",aliases:["wildfly-cli"],keywords:{$pattern:"[a-z-]+",keyword:"alias batch cd clear command connect connection-factory connection-info data-source deploy deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias undeploy unset version xa-data-source",literal:"true false"},contains:[a.HASH_COMMENT_MODE,a.QUOTE_STRING_MODE,{className:"params",begin:/--[\w\-=\/]+/},{className:"function",begin:/:[\w\-.]+/,relevance:0},{className:"string",begin:/\B([\/.])[\w\-.\/=]+/},{className:"params",begin:/\(/,end:/\)/,contains:[{begin:/[\w-]+ *=/,returnBegin:!0,relevance:0,contains:[{className:"attr",begin:/[\w-]+/}]}],relevance:0}]}}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1331,1104,6015,129,9992,180,7013,9355,3451,646],()=>b(b.s=31975));module.exports=c})();
38
+ `.trim(),fl="bg-accent-600 text-white hover:bg-accent-700 focus:ring-ring";function fm({promptData:a,answering:b,onRespond:c,onDismiss:d,labelId:f,cliToolName:g}){let i=(0,k.c)("prompt"),[j,l]=(0,h.useState)(()=>{if("multiple_choice"===a.type){let b=a.options.find(a=>a.isDefault);return b?.number??null}return null}),[m,o]=(0,h.useState)(""),[p,q]=(0,h.useState)(!1),r=(0,h.useMemo)(()=>"multiple_choice"!==a.type?null:a.options.find(a=>a.number===j)??null,[a,j]),s=r?.requiresTextInput===!0,t=b||p,u=(0,h.useCallback)(async a=>{if(!t){q(!0);try{await c(a)}catch(a){}finally{q(!1)}}},[t,c]),v=(0,h.useCallback)(async()=>{if(!t&&null!==j){q(!0);try{let a=s&&m.trim()?m.trim():j.toString();await c(a)}catch(a){}finally{q(!1)}}},[t,c,j,s,m]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("h3",{id:f,className:"text-lg font-semibold text-warning-foreground flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xl","aria-hidden":"true",children:"?"}),g?i("confirmationFrom",{toolName:g}):i("confirmationFromClaude")]}),d&&(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:d,"aria-label":"close",className:"p-1 rounded hover:bg-warning-border/50 transition-colors",children:(0,e.jsx)("svg",{className:"w-5 h-5 text-warning-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.instructionText&&(0,e.jsx)("div",{className:"max-h-40 overflow-y-auto whitespace-pre-wrap text-sm text-muted-foreground bg-muted rounded p-2 border border-border",children:a.instructionText}),(0,e.jsx)("p",{className:"text-foreground leading-relaxed",children:a.question}),t&&(0,e.jsxs)("div",{"data-testid":"answering-indicator",className:"flex items-center gap-2 text-sm text-muted-foreground",role:"status","aria-live":"polite",children:[(0,e.jsx)(n.y$,{size:"sm",variant:"accent"}),(0,e.jsx)("span",{children:i("sending")})]}),"yes_no"===a.type&&(0,e.jsx)(fn,{promptData:a,disabled:t,onYes:()=>u("yes"),onNo:()=>u("no")}),"multiple_choice"===a.type&&(0,e.jsx)(fo,{promptData:a,disabled:t,selectedOption:j,onSelectOption:l,textInputValue:m,onTextInputChange:o,showTextInput:s,onSubmit:v})]})}function fn({promptData:a,disabled:b,onYes:c,onNo:d}){let f=(0,k.c)("prompt"),g="yes"===a.defaultOption,h="no"===a.defaultOption,i=`${fk} ${fl} ${g?"primary default highlighted":""}`,j=`${fk} ${h?"bg-foreground text-background hover:bg-foreground/90 primary default highlighted":"bg-surface border-2 border-input hover:bg-muted text-foreground focus:ring-ring"}`;return(0,e.jsxs)("div",{className:"flex items-center gap-3",role:"group","aria-label":f("yesNoGroupLabel"),children:[(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:c,disabled:b,className:i,children:f("yes")}),(0,e.jsx)(n.$n,{variant:"ghost",type:"button",onClick:d,disabled:b,className:j,children:f("no")})]})}function fo({promptData:a,disabled:b,selectedOption:c,onSelectOption:d,textInputValue:f,onTextInputChange:g,showTextInput:i,onSubmit:j}){let l=(0,h.useId)(),m=(0,k.c)("prompt"),o=(0,h.useCallback)(a=>{let d=c===a,e=b?"opacity-50 cursor-not-allowed":"";return`flex items-start gap-3 p-3 rounded-lg cursor-pointer transition-all ${d?"bg-accent-50 dark:bg-accent-900/30 border-2 border-accent-500":"bg-surface border-2 border-border hover:border-input"} ${e}`},[c,b]);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("fieldset",{children:[(0,e.jsx)("legend",{className:"sr-only",children:m("selectAnOption")}),(0,e.jsx)(n.z6,{name:l,value:null!=c?String(c):"",onValueChange:a=>d(Number(a)),disabled:b,className:"flex flex-col gap-2",children:a.options.map(a=>(0,e.jsxs)("label",{className:o(a.number),children:[(0,e.jsx)(n.CU,{value:String(a.number),className:"mt-1","aria-describedby":a.isDefault?`default-${a.number}`:void 0}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsxs)("span",{className:"font-medium",children:[a.number,". ",a.label]}),a.isDefault&&(0,e.jsx)("span",{id:`default-${a.number}`,className:"ml-2 text-xs text-accent-600 dark:text-accent-400 bg-accent-100 dark:bg-accent-900/30 px-2 py-0.5 rounded",children:m("default")})]})]},a.number))})]}),i&&(0,e.jsxs)("div",{className:"mt-3",children:[(0,e.jsx)("label",{htmlFor:`text-input-${l}`,className:"sr-only",children:m("customValueInput")}),(0,e.jsx)("input",{id:`text-input-${l}`,type:"text",value:f,onChange:a=>g(a.target.value),disabled:b,placeholder:m("enterValuePlaceholder"),className:"w-full px-4 py-2 border-2 border-input dark:bg-muted dark:text-foreground rounded-lg focus:outline-none focus:border-accent-500 disabled:opacity-50"})]}),(0,e.jsx)("button",{type:"button",onClick:j,disabled:b||null===c,className:`w-full ${fk} ${fl}`,children:m("submit")})]})}let fp=(0,h.memo)(function({promptData:a,messageId:b,visible:c,answering:d,onRespond:f,onDismiss:g,cliToolName:i}){let j,{shouldRender:k,animationClass:l}=I({visible:c&&null!==a,duration:200}),m=(0,h.useId)();if(!k||!a)return null;let n=(j="opacity-100","animate-fade-in"===l?j="opacity-100 transform translate-y-0":"animate-fade-out"===l&&(j="opacity-0 transform translate-y-2"),`bg-warning-subtle border-2 border-warning-border rounded-lg p-4 shadow-lg transition-all duration-200 ease-in-out ${l} ${j}`);return(0,e.jsx)(F,{componentName:"PromptPanel",children:(0,e.jsx)("div",{"data-testid":"prompt-panel",role:"dialog","aria-labelledby":m,"aria-modal":"true",className:n,children:(0,e.jsx)(fm,{promptData:a,answering:d,onRespond:f,onDismiss:g,labelId:m,cliToolName:i})})})});var fq=c(74892);function fr({isOpen:a,onConfirm:b,onCancel:c,cliToolName:d}){let f=(0,k.c)("autoYes"),g=(0,k.c)("common"),[i,j]=(0,h.useState)(36e5),[l,m]=(0,h.useState)(""),[n,o]=(0,h.useState)(null),[p,q]=(0,h.useState)(!1),r=(0,h.useRef)(null),s=a=>f(dF[a].replace("autoYes.",""));return(0,e.jsx)(a5.a,{isOpen:a,onClose:c,title:d?f("enableTitleWithTool",{toolName:d}):f("enableTitle"),size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("featureDescription")}),(0,e.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,e.jsx)("li",{children:f("yesNoAutoResponse")}),(0,e.jsx)("li",{children:f("multipleChoiceAutoSelect")})]}),(0,e.jsx)("p",{className:"mt-1",children:f("autoDisableAfter",{duration:s(i)})}),d&&(0,e.jsx)("p",{className:"mt-2 text-muted-foreground",children:f("appliesOnlyToCurrent",{toolName:d})})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("duration")}),(0,e.jsx)("div",{className:"flex gap-2",children:dE.map(a=>(0,e.jsx)("button",{type:"button",onClick:()=>j(a),className:`flex-1 py-2 px-3 text-sm font-medium rounded-md border-2 transition-colors ${i===a?"border-accent-600 bg-accent-50 dark:bg-accent-900/30 text-accent-700 dark:text-accent-400":"border-border bg-surface dark:bg-surface-2 text-foreground hover:border-muted-foreground"}`,style:{minHeight:"44px"},children:s(a)},a))})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,e.jsx)("label",{htmlFor:"stop-pattern-input",className:"font-medium",children:f("stopPatternLabel")}),(0,e.jsxs)("div",{className:"relative",ref:r,children:[(0,e.jsx)("button",{type:"button",onClick:()=>q(!p),className:"inline-flex items-center justify-center w-4 h-4 rounded-full bg-muted text-muted-foreground text-[10px] font-bold hover:bg-muted/80 focus:outline-none","aria-label":f("regexTipsLabel"),"data-testid":"regex-tips-button",children:"?"}),p&&(0,e.jsxs)("div",{className:"absolute left-0 top-6 z-50 w-72 rounded-md border border-border bg-surface p-3 shadow-lg text-xs text-foreground","data-testid":"regex-tips-tooltip",children:[(0,e.jsx)("p",{className:"font-medium mb-1.5",children:f("regexTipsTitle")}),(0,e.jsxs)("ul",{className:"space-y-1",children:[(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"\\bcat\\b"})," ",f("regexTipWordBoundary")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"error|fatal"})," ",f("regexTipOr")]}),(0,e.jsxs)("li",{children:[(0,e.jsx)("code",{className:"bg-muted px-1 rounded",children:"(?i)error"})," ",f("regexTipCaseNote")]})]})]})]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:f("stopPatternDescription")}),(0,e.jsx)("input",{id:"stop-pattern-input",type:"text",value:l,onChange:a=>m(a.target.value),placeholder:f("stopPatternPlaceholder"),className:`w-full px-3 py-2 border rounded-md text-sm font-mono bg-surface dark:bg-surface-2 text-foreground ${n?"border-danger focus:ring-danger focus:border-danger":"border-input focus:ring-ring focus:border-accent-500"} focus:outline-none focus:ring-1`,"data-testid":"stop-pattern-input"}),n&&(0,e.jsx)("p",{className:"mt-1 text-xs text-danger","data-testid":"stop-pattern-error",children:n})]}),(0,e.jsxs)("div",{className:"text-sm text-foreground",children:[(0,e.jsx)("p",{className:"font-medium mb-2",children:f("aboutRisks")}),(0,e.jsx)("p",{children:f("riskWarning")})]}),(0,e.jsx)("div",{className:"bg-warning-subtle border-l-4 border-warning p-3",children:(0,e.jsxs)("p",{className:"text-sm text-warning-foreground",children:[(0,e.jsx)("span",{className:"font-medium",children:f("disclaimer")}),f("disclaimerText")]})}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:c,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:g("cancel")}),(0,e.jsx)("button",{type:"button",onClick:()=>{b(i,l.trim()||void 0)},disabled:!!n,className:`px-4 py-2 text-sm font-medium rounded-md text-white ${n?"bg-muted-foreground cursor-not-allowed":"bg-warning hover:bg-warning/90"}`,"data-testid":"confirm-button",children:f("agreeAndEnable")})]})]})})}let fs=(0,h.memo)(function({enabled:a,expiresAt:b,onToggle:c,lastAutoResponse:d,cliToolName:f,inline:g=!1,showToolName:i=!0,onExpire:j}){let l=(0,k.c)("autoYes"),[m,n]=(0,h.useState)(""),[o,p]=(0,h.useState)(null),[q,r]=(0,h.useState)(!1),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(!a||!b){n(""),v(!1);return}v(!1);let c=!1,d=()=>(n(dG(b)),b-Date.now()<=0&&!c&&(c=!0,v(!0),j?.(),!0));if(d())return;let e=setInterval(()=>{d()&&clearInterval(e)},1e3);return()=>clearInterval(e)},[a,b,j]),(0,h.useEffect)(()=>{if(!d)return;p(`Auto responded: "${d}"`);let a=setTimeout(()=>p(null),ah.I2);return()=>clearTimeout(a)},[d]);let w=a&&!u,x=(0,h.useCallback)(()=>{w?(r(!0),c({enabled:!1}).finally(()=>r(!1))):t(!0)},[w,c]),y=(0,h.useCallback)((a,b)=>{t(!1),r(!0),c({enabled:!0,duration:a,stopPattern:b}).finally(()=>r(!1))},[c]),z=(0,h.useCallback)(()=>{t(!1)},[]);return(0,e.jsxs)("div",{className:g?"flex items-center gap-2":"flex items-center gap-3 px-4 py-2 bg-surface-2 border-b border-border",children:[(0,e.jsx)(fq.d,{checked:w,onCheckedChange:x,disabled:q,"aria-label":l("toggleLabel")}),(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:l("label")}),i&&f&&(0,e.jsxs)("span",{className:"text-xs text-accent-600 dark:text-accent-400 font-medium","aria-label":l("targetLabel"),children:["(",(0,a7.f_)(f,""),")"]}),w&&m&&(0,e.jsx)("span",{className:"text-sm text-muted-foreground","aria-label":l("timeRemaining"),children:m}),o&&(0,e.jsx)("span",{className:"text-sm text-success animate-pulse",children:o}),(0,e.jsx)(fr,{isOpen:s,onConfirm:y,onCancel:z,cliToolName:(0,a7.f_)(f,"")})]})});function ft(a){let b=new Set;for(let c of a)"user"===c.role&&b.add(c.id);return b}function fu(a,b,c,d){let e={answer:a,cliTool:b};if(d&&d!==b&&(e.instanceId=d),c&&(e.promptType=c.type,"multiple_choice"===c.type)){let a=c.options.find(a=>a.isDefault);a&&(e.defaultOptionNumber=a.number),c.submitMode&&(e.submitMode=c.submitMode)}return e}let fv=(0,h.memo)(function({worktreeId:a,splitIndex:b,cliToolId:c,instanceId:d,instance:f,availableInstances:g,onInstanceChange:j,onFocus:l,disabled:m=!1,pendingInsertText:n,onInsertConsumed:o,onMessageSent:p,cliStatus:q="idle",autoYes:r,history:s,onDropInstance:t,draggedInstanceId:u,onRequestSessionEnd:v}){let w=d??c,x=r.enabled??!1,y=r.expiresAt??null,z=r.lastAutoResponse??null,A=r.onToggle,B=s?.showArchived??!1,C=s?.onShowArchivedChange,D=s?.historyDisplayLimit,E=s?.onHistoryDisplayLimitChange,F=s?.historyUserOnly??!1,G=s?.onHistoryUserOnlyChange,H=s?.onInsertToMessage,I=s?.onFilePathClick,J=s?.showToast,K=(0,k.c)("worktree"),{terminal:L,prompt:M,setAutoScroll:N,setPromptAnswering:O,clearPrompt:P,refresh:Q}=bq({worktreeId:a,cliToolId:c,instanceId:w,enabled:!m}),{messages:R,isLoading:S,refresh:U}=function({worktreeId:a,cliToolId:b,instanceId:c,limit:d,includeArchived:e=!1,enabled:f=!0}){let[g,i]=(0,h.useState)([]),[j,k]=(0,h.useState)(!0),{subscribe:l,unsubscribe:m,addListener:n}=(0,bp.xM)(),o=c??b,p=(0,h.useRef)(0),q=(0,h.useRef)(b);q.current=b;let r=(0,h.useRef)(o);r.current=o;let s=(0,h.useCallback)(async()=>{let c=++p.current;try{let f=new URLSearchParams({cliTool:b,instance:o});void 0!==d&&f.set("limit",String(d)),e&&f.set("includeArchived","true");let g=await fetch(`/api/worktrees/${a}/messages?${f.toString()}`);if(!g.ok)return;let h=await g.json();if(p.current!==c||q.current!==b||r.current!==o)return;i(h.map(a=>({...a,timestamp:new Date(a.timestamp)}))),k(!1)}catch(a){if(p.current!==c||q.current!==b||r.current!==o)return;console.error("[useSplitMessages] fetch error:",a),k(!1)}},[a,b,o,d,e]),t=`${a}::${b}::${o}`;return(0,h.useRef)(t),{messages:g,isLoading:j,refresh:(0,h.useCallback)(()=>s(),[s])}}({worktreeId:a,cliToolId:c,instanceId:w,limit:D,includeArchived:B,enabled:!m}),V=(0,h.useCallback)((b,c)=>T.y.sendMessage(a,b,c),[a]),{messages:W,sendOptimistic:X,retry:Y,discard:Z}=function({worktreeId:a,serverMessages:b,sendFn:c,onSent:d,timeoutMs:e=3e4}){let[f,g]=(0,h.useState)([]),i=(0,h.useRef)(b);i.current=b;let j=(0,h.useRef)(f);j.current=f;let k=(0,h.useRef)(d);k.current=d;let l=(0,h.useRef)(c);l.current=c;let m=(0,h.useRef)(0),n=(0,h.useRef)(new Map),o=(0,h.useRef)(new Set),p=(0,h.useCallback)(a=>{let b=n.current.get(a);void 0!==b&&(clearTimeout(b),n.current.delete(a))},[]),q=(0,h.useCallback)(a=>{p(a);let b=setTimeout(()=>{n.current.delete(a),g(b=>b.map(b=>b.tempId===a&&"sending"===b.status?{...b,status:"error"}:b))},e);n.current.set(a,b)},[p,e]),r=(0,h.useCallback)(async a=>{q(a.tempId);try{await l.current(a.content,a.options),k.current?.()}catch{p(a.tempId),g(b=>b.map(b=>b.tempId===a.tempId?{...b,status:"error"}:b))}},[q,p]),s=(0,h.useCallback)((a,b)=>{let c={tempId:`pending-${m.current++}`,content:a,options:b,timestamp:new Date,status:"sending",baselineUserIds:ft(i.current)};g(a=>[...a,c]),r(c)},[r]),t=(0,h.useCallback)(a=>{let b=j.current.find(b=>b.tempId===a);if(!b)return;let c={...b,status:"sending",timestamp:new Date,baselineUserIds:ft(i.current)};g(b=>b.map(b=>b.tempId===a?c:b)),r(c)},[r]),u=(0,h.useCallback)(a=>{let b=j.current.find(b=>b.tempId===a);return p(a),g(b=>b.filter(b=>b.tempId!==a)),b?.content},[p]);return{messages:(0,h.useMemo)(()=>{if(0===f.length)return b;let{reconciledTempIds:c}=function(a,b,c){let d=new Set,e=new Set,f=a.filter(a=>"sending"===a.status);if(0===f.length)return{reconciledTempIds:d,consumedServerIds:e};let g=b.filter(a=>"user"===a.role&&!c.has(a.id)).sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime()),h=new Set;for(let a of[...f].sort((a,b)=>a.timestamp.getTime()-b.timestamp.getTime())){let b=g.find(b=>!h.has(b.id)&&!a.baselineUserIds.has(b.id)&&b.content===a.content);b&&(h.add(b.id),d.add(a.tempId),e.add(b.id))}return{reconciledTempIds:d,consumedServerIds:e}}(f,b,o.current),d=f.filter(a=>!c.has(a.tempId)).map(b=>({id:b.tempId,worktreeId:a,role:"user",content:b.content,timestamp:b.timestamp,messageType:"normal",archived:!1,cliToolId:b.options.cliToolId,instanceId:b.options.instanceId,optimisticState:b.status}));return 0===d.length?b:[...b,...d]},[b,f,a]),pending:f,sendOptimistic:s,retry:t,discard:u}}({worktreeId:a,serverMessages:R,sendFn:V,onSent:U}),{visible:$,width:_,toggle:aa,setWidth:ab}=cc(),ac=i().useRef(null),ad=(0,h.useCallback)(a=>{let b=ac.current;if(!b)return;let c=b.offsetWidth;0!==c&&ab(_+a/c*100)},[_,ab]),ae="opencode"===c||"copilot"===c,af="claude"===c||"codex"===c,ah=(0,h.useCallback)(a=>N(a),[N]),ai=(0,h.useCallback)(a=>{Q(),U(),p?.(a)},[Q,U,p]),aj=(0,h.useCallback)(a=>{let b=Z(a);b&&H?.(b)},[Z,H]),ak=(0,h.useCallback)(async b=>{O(!0);try{let d=fu(b,c,M.data,w),e=await fetch(`/api/worktrees/${a}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!e.ok)throw Error(`Failed to send prompt response: ${e.status}`);P(),await Q()}catch(a){console.error("[TerminalSplitPaneContent] prompt response error:",a)}finally{O(!1)}},[a,c,w,M.data,O,P,Q]),am=(0,h.useCallback)(()=>{P()},[P]),an=L.isSelectionListActive,ao=M.visible&&!x,ap=L.isUnclassifiedActive&&!an&&!M.visible,aq=(0,h.useMemo)(()=>(0,e.jsx)(cq,{messages:W,worktreeId:a,onFilePathClick:I??(()=>{}),isLoading:S,className:"h-full",showToast:J,onInsertToMessage:H,onRetryPending:Y,onDiscardPending:aj,showArchived:B,onShowArchivedChange:C,historyDisplayLimit:D,onHistoryDisplayLimitChange:E,historyUserOnly:F,onHistoryUserOnlyChange:G,onCollapse:aa,splitIndex:b,cliToolId:c}),[W,Y,aj,a,I,S,J,H,B,C,D,E,F,G,aa,b,c]),ar=(0,h.useMemo)(()=>(0,e.jsx)(bo,{output:L.output,isActive:L.isRunning,attaching:L.attaching,isThinking:L.isThinking,autoScroll:L.autoScroll,onScrollChange:ah,disableAutoFollow:ae,compactTuiLayoutPadding:af}),[L.output,L.isRunning,L.attaching,L.isThinking,L.autoScroll,ah,ae,af]),at=(0,h.useMemo)(()=>(0,e.jsxs)("div",{ref:ac,className:"flex h-full min-h-0 w-full",children:[$?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{id:cm(b),"data-testid":`split-history-slot-${b}`,"aria-label":"History pane",style:{width:`${_}%`},className:"flex-shrink-0 overflow-hidden min-h-0",children:aq}),(0,e.jsx)(ch,{onResize:ad,orientation:"horizontal",ariaValueNow:_})]}):(0,e.jsx)("div",{"data-testid":`split-history-expand-bar-${b}`,className:"flex-shrink-0 flex items-start justify-center w-9 bg-gray-50 dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700",children:(0,e.jsxs)("button",{type:"button","data-testid":`split-history-expand-${b}`,"aria-label":K("terminal.showHistory"),title:K("terminal.showHistory"),"aria-expanded":"false",onClick:aa,className:"flex flex-col items-center gap-2 w-full pt-2 text-gray-500 dark:text-gray-400 hover:text-accent-600 dark:hover:text-accent-400 focus:outline-none focus:ring-2 focus:ring-ring",children:[(0,e.jsx)("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,e.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),(0,e.jsx)("span",{className:"text-xs font-medium tracking-wide select-none",style:{writingMode:"vertical-rl"},"aria-hidden":"true",children:K("terminal.historyLabel")})]})}),(0,e.jsx)("div",{className:"flex-grow overflow-hidden min-w-0 min-h-0 relative",children:ar})]}),[$,_,aq,ad,aa,ar,b,K]),au=(0,h.useMemo)(()=>(0,e.jsxs)("div",{className:"space-y-2",children:[an?(0,e.jsx)(al,{worktreeId:a,cliToolId:c,instanceId:w,onKeysSent:Q,showPagerKeys:L.isPagerActive}):null,ap?(0,e.jsx)(fj,{worktreeId:a,cliToolId:c,instanceId:w,onKeysSent:Q}):null,ao?(0,e.jsx)(fp,{promptData:M.data,messageId:M.messageId,visible:M.visible,answering:M.answering,onRespond:ak,onDismiss:am,cliToolName:(0,a7.oo)(c)}):null,(0,e.jsx)(ag,{worktreeId:a,onMessageSent:ai,onOptimisticSend:X,cliToolId:c,instanceId:w,isSessionRunning:L.isRunning,pendingInsertText:n??null,onInsertConsumed:o,splitIndex:b,onFocus:l,isProcessing:L.isRunning,showToast:J,autoYesSlot:(0,e.jsx)(fs,{enabled:x,expiresAt:y??null,onToggle:A,lastAutoResponse:z??null,cliToolName:c,inline:!0})})]}),[an,ao,ap,L.isPagerActive,a,c,w,Q,M.data,M.messageId,M.visible,M.answering,ak,am,ai,X,L.isRunning,n,o,b,l,x,y,z,A,J]),av=(0,a7.sw)(f??{cliTool:c}),aw=(0,h.useCallback)(()=>{v?.({cliToolId:c,instanceId:w,label:av})},[v,c,w,av]),ax=(0,h.useMemo)(()=>{if(!v||!L.isRunning)return null;let a=K("terminal.endSessionFor",{name:av});return(0,e.jsx)("button",{type:"button",onClick:aw,"aria-label":a,title:a,"data-testid":`terminal-end-session-button-${b}`,className:"flex items-center justify-center p-0.5 rounded text-muted-foreground hover:text-danger focus:text-danger hover:bg-danger/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-danger/50 transition-colors",children:(0,e.jsx)(as.A,{size:14,"aria-hidden":"true"})})},[v,L.isRunning,K,av,aw,b]);return(0,e.jsx)(ba,{worktreeId:a,splitIndex:b,cliToolId:c,instanceId:w,instance:f,availableInstances:g,onInstanceChange:j,headerExtras:ax,status:q,onFocus:l,attaching:L.attaching,terminal:at,footer:au,onDropInstance:t,draggedInstanceId:u})});var fw=c(16945);let fx=(0,h.memo)(function({isBranchMismatch:a,currentBranch:b,initialBranch:c}){let d=(0,k.c)("worktree"),[f,g]=(0,h.useState)(!1);return((0,h.useEffect)(()=>{g(!1)},[b]),!a||f||null===c)?null:(0,e.jsxs)("div",{"data-testid":"branch-mismatch-alert",role:"alert",className:"flex items-center gap-3 px-4 py-2 bg-warning-subtle border border-warning-border text-warning-foreground rounded-lg",children:[(0,e.jsx)(fw.A,{className:"w-5 h-5 text-warning flex-shrink-0"}),(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsxs)("span",{className:"text-sm",children:[d("branchMismatch.changedFrom")," ",(0,e.jsx)("span",{className:"font-medium",children:c})," ",d("branchMismatch.to")," ",(0,e.jsx)("span",{className:"font-medium",children:b})]})}),(0,e.jsx)("button",{type:"button",onClick:()=>g(!0),className:"p-1 rounded hover:bg-warning-subtle transition-colors","aria-label":d("branchMismatch.dismiss"),children:(0,e.jsx)(as.A,{className:"w-4 h-4"})})]})}),fy=(0,x.A)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]),fz=(0,h.memo)(function({isOpen:a,onClose:b,onConfirm:c,worktreeId:d,sourcePath:f,sourceType:g}){let i=(0,k.c)("worktree"),j=(0,k.c)("common"),[l,m]=(0,h.useState)(""),[o,p]=(0,h.useState)(new Set([""])),[q,r]=(0,h.useState)([]),[s,t]=(0,h.useState)(!1),[u,v]=(0,h.useState)(new Set),w=f.includes("/")?f.substring(0,f.lastIndexOf("/")):"";(0,h.useEffect)(()=>{a&&(m(w),p(new Set([""])),r([]),x())},[a,d]);let x=(0,h.useCallback)(async()=>{t(!0);try{let a=await fetch(`/api/worktrees/${d}/tree`);if(!a.ok)return;let b=(await a.json()).items.filter(a=>"directory"===a.type).map(a=>({name:a.name,path:a.name,loaded:!1}));r(b)}catch{}finally{t(!1)}},[d]),y=(0,h.useCallback)(async a=>{v(b=>new Set(b).add(a));try{let b=await fetch(`/api/worktrees/${d}/tree/${a}`);if(!b.ok)return;let c=(await b.json()).items.filter(a=>"directory"===a.type).map(b=>({name:b.name,path:`${a}/${b.name}`,loaded:!1}));r(b=>(function a(b,c,d){return b.map(b=>b.path===c?{...b,children:d,loaded:!0}:b.children?{...b,children:a(b.children,c,d)}:b)})(b,a,c))}catch{}finally{v(b=>{let c=new Set(b);return c.delete(a),c})}},[d]),A=(0,h.useCallback)(async a=>{p(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c});let b=function a(b,c){for(let d of b){if(d.path===c)return d;if(d.children){let b=a(d.children,c);if(b)return b}}return null}(q,a);b&&!b.loaded&&await y(a)},[q,y]),B=(0,h.useCallback)(a=>!(a===w||"directory"===g&&(a===f||a.startsWith(f+"/")))&&!0,[w,f,g]),C=(a,b=0)=>{let c=o.has(a.path),d=l===a.path,f=u.has(a.path),g=B(a.path);return(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${d?"bg-accent-100 text-accent-800":"hover:bg-muted text-foreground"} ${!g?"opacity-40 cursor-not-allowed":""}`,style:{paddingLeft:`${.5+1.25*b}rem`},onClick:()=>{g&&m(a.path)},children:[(0,e.jsx)("button",{className:"w-4 h-4 flex items-center justify-center flex-shrink-0",onClick:b=>{b.stopPropagation(),A(a.path)},children:f?(0,e.jsx)(n.y$,{size:"xs",variant:"muted"}):(0,e.jsx)(bL,{className:`w-3 h-3 text-muted-foreground transition-transform ${c?"rotate-90":""}`})}),c?(0,e.jsx)(fy,{className:"w-4 h-4 text-warning flex-shrink-0"}):(0,e.jsx)(z.A,{className:"w-4 h-4 text-warning flex-shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:a.name})]}),c&&a.children&&(0,e.jsx)("div",{children:a.children.map(a=>C(a,b+1))})]},a.path)},D=B(l);return(0,e.jsx)(a5.a,{isOpen:a,onClose:b,title:i("fileTree.moveDialogTitle"),size:"md",children:(0,e.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,e.jsxs)("div",{className:"text-sm text-muted-foreground",children:[i("fileTree.moveTo"),": ",(0,e.jsx)("span",{className:"font-mono text-foreground",children:f})]}),(0,e.jsxs)("div",{className:"border border-border rounded-lg max-h-64 overflow-y-auto p-2",children:[(0,e.jsxs)("div",{className:`flex items-center gap-1 py-1.5 px-2 cursor-pointer rounded text-sm transition-colors ${""===l?"bg-accent-100 text-accent-800":"hover:bg-muted text-foreground"} ${!B("")?"opacity-40 cursor-not-allowed":""}`,onClick:()=>{B("")&&m("")},children:[(0,e.jsx)("span",{className:"w-4 h-4"}),(0,e.jsx)(z.A,{className:"w-4 h-4 text-warning flex-shrink-0"}),(0,e.jsx)("span",{children:i("fileTree.rootDirectory")})]}),s?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(n.y$,{size:"md",variant:"muted"})}):q.map(a=>C(a,1))]}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)(n.$n,{variant:"ghost",onClick:b,className:"px-4 py-2 text-sm text-foreground bg-white border border-border rounded-md hover:bg-muted transition-colors",children:j("cancel")}),(0,e.jsx)(n.$n,{variant:"ghost",onClick:()=>c(l),disabled:!D,className:"px-4 py-2 text-sm text-white bg-accent-600 rounded-md hover:bg-accent-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:i("fileTree.moveConfirm")})]})]})})});function fA(a,b){let c=a.trim();return c?0>=c.lastIndexOf(".")?c+b:c:""}let fB=(0,h.memo)(function({isOpen:a,parentPath:b,onConfirm:c,onCancel:d}){let f=(0,k.c)("worktree"),g=(0,k.c)("common"),[i,j]=(0,h.useState)(""),[l,m]=(0,h.useState)(".md"),n=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(a){j(""),m(".md");let a=setTimeout(()=>{n.current?.focus()},100);return()=>clearTimeout(a)}},[a]);let o=(0,h.useCallback)(()=>{let a=fA(i,l);a&&c(a)},[i,l,c]),p=(0,h.useCallback)(a=>{"Enter"===a.key&&(a.preventDefault(),o())},[o]),q=fA(i,l),r=b?`${b}/${q}`:q;return(0,e.jsx)(a5.a,{isOpen:a,onClose:d,title:f("newFileDialog.title"),size:"sm",children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{htmlFor:"new-file-name",className:"block text-sm font-medium text-foreground mb-1",children:f("newFileDialog.fileNameLabel")}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("input",{ref:n,id:"new-file-name","data-testid":"new-file-name-input",type:"text",value:i,onChange:a=>j(a.target.value),onKeyDown:p,placeholder:f("newFileDialog.placeholder"),className:"flex-1 px-3 py-2 border border-input rounded-lg bg-surface text-foreground text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent"}),(0,e.jsx)("select",{"data-testid":"new-file-ext-select",value:l,onChange:a=>m(a.target.value),className:"px-3 py-2 border border-input rounded-lg bg-surface text-foreground text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-transparent",children:eN.map(a=>(0,e.jsx)("option",{value:a,children:a},a))})]})]}),q&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground font-mono bg-muted rounded px-2 py-1",children:r}),(0,e.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,e.jsx)("button",{type:"button",onClick:d,className:"px-4 py-2 text-sm font-medium text-foreground bg-muted hover:bg-muted/80 rounded-lg transition-colors",children:g("cancel")}),(0,e.jsx)("button",{type:"button","data-testid":"new-file-confirm-button",onClick:o,disabled:!q,className:"px-4 py-2 text-sm font-medium text-white bg-accent-600 hover:bg-accent-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:f("newFileDialog.create")})]})]})})}),fC=(0,h.memo)(function({worktreeId:a,worktree:b,worktreeName:c,worktreeStatus:d,instances:f,rosterReady:g,activeInstanceId:j,setActiveInstanceId:l,hasUpdate:m,lastAutoResponse:n,activeActivity:o,onActivityToggle:p,onBackClick:q,onInfoClick:r,onWorktreeStatusChange:s,pendingInsertTextMap:t,setFocusedSplitIndex:u,handleInsertToSplit:v,handleInsertConsumed:w,handleInsertToMessage:x,autoYesStateMap:y,makeAutoYesToggleHandler:z,showArchived:A,onShowArchivedChange:B,historyDisplayLimit:C,onHistoryDisplayLimitChange:D,historyUserOnly:E,onHistoryUserOnlyChange:G,onMessageSent:H,onFilePathClick:I,showToast:J,tabsState:K,tabsActions:L,onLoadContent:M,onLoadError:N,onSetLoading:O,onFilePanelSave:P,onDirtyChange:Q,onOpenFile:R,diffContent:S,diffFilePath:T,onCloseDiff:U,fileSearch:V,fileTreeRefresh:W,onFileSelect:X,onNewFile:Y,onNewDirectory:Z,onRename:$,onDelete:_,onUpload:aa,onMove:ab,onFileTreeReset:ac,onDiffSelect:ad,onAgentInstancesChange:ae,vibeLocalModel:af,onVibeLocalModelChange:ag,vibeLocalContextWindow:ah,onVibeLocalContextWindowChange:ai,isInfoModalOpen:aj,onInfoModalClose:ak,onWorktreeUpdate:al,fileInputRef:am,onFileInputChange:an,onKillSession:ao,onRequestSessionEnd:ap,killTarget:aq,isKillPending:ar,onKillCancel:as,onKillConfirm:at,moveTarget:au,isMoveDialogOpen:av,onMoveCancel:aw,onMoveConfirm:ax,showNewFileDialog:ay,newFileParentPath:az,onNewFileConfirm:aA,onNewFileCancel:aB,killDialogTitle:aC,killDialogWarning:aD,cancelLabel:aE,endLabel:aF}){let aG=(0,k.c)("worktree"),[aH,aI]=i().useState(null),aJ=(0,h.useCallback)(a=>aI(a),[]),aK=(0,h.useCallback)(()=>aI(null),[]),[aL,aM]=i().useState(null),aN=i().useRef(0),aO=(0,h.useCallback)(a=>{l(a),aN.current+=1,aM({instanceId:a,token:aN.current})},[l]),aP=(0,h.useCallback)(({splitIndex:c,cliToolId:d,instanceId:f,instance:g,availableInstances:h,onInstanceChange:i,onFocus:j,onDropInstance:k})=>{let m=t.get(c)??null,o=y.get(f),p=o?.enabled??!1,q=o?.expiresAt??null,r=(0,a6.kA)(b?.sessionStatusByInstance?.[f]??b?.sessionStatusByCli?.[d]);return(0,e.jsx)(fv,{worktreeId:a,splitIndex:c,cliToolId:d,instanceId:f,instance:g,availableInstances:h,onInstanceChange:a=>{i(a),0===c&&l(a)},onFocus:j,pendingInsertText:m,onInsertConsumed:()=>w(c),onMessageSent:H,cliStatus:r,autoYes:{enabled:p,expiresAt:q,lastAutoResponse:n,onToggle:z(d,f)},history:{showArchived:A,onShowArchivedChange:B,historyDisplayLimit:C,onHistoryDisplayLimitChange:D,historyUserOnly:E,onHistoryUserOnlyChange:G,onInsertToMessage:a=>v(c,a),onFilePathClick:I,showToast:J},onDropInstance:k,draggedInstanceId:aH,onRequestSessionEnd:ap})},[a,t,y,w,H,l,n,z,b?.sessionStatusByCli,b?.sessionStatusByInstance,I,J,v,A,B,C,D,E,G,aH,ap]),aQ=(0,h.useMemo)(()=>(0,e.jsx)(ff,{worktreeId:a,instances:f,rosterReady:g,renderPane:aP,onFocusedSplitChange:u,showToast:J,onActiveInstanceChange:l,headerInstanceSelection:aL}),[a,f,g,aP,u,J,l,aL]),aR=(0,h.useMemo)(()=>(0,e.jsx)(e8,{terminal:aQ,terminalHeader:null,fileTabs:K,worktreeId:a,onCloseTab:L.closeTab,onActivateTab:L.activateTab,onLoadContent:M,onLoadError:N,onSetLoading:O,onFileSaved:P,diffContent:S,diffFilePath:T,onCloseDiff:U,onDirtyChange:Q,onMoveToFront:L.moveToFront,onOpenFile:R}),[aQ,K,a,L.closeTab,L.activateTab,M,N,O,P,S,T,U,Q,L.moveToFront,R]),aS=(0,h.useMemo)(()=>(0,e.jsx)(eG,{active:o,onToggle:p}),[o,p]),aT=(0,h.useMemo)(()=>({files:(0,e.jsxs)("div",{className:"h-full flex flex-col",children:[(0,e.jsx)(cS,{query:V.query,mode:V.mode,isSearching:V.isSearching,error:V.error,onQueryChange:V.setQuery,onModeChange:V.setMode,onClear:V.clearSearch}),(0,e.jsx)(cO,{worktreeId:a,onFileSelect:X,onNewFile:Y,onNewDirectory:Z,onRename:$,onDelete:_,onUpload:aa,onMove:ab,onResetView:ac,refreshTrigger:W,pollingEnabled:"files"===o,searchQuery:V.query,searchMode:V.mode,searchResults:V.results?.results,className:"flex-1 min-h-0"})]}),git:(0,e.jsx)(ek,{worktreeId:a,onDiffSelect:ad,isMobile:!1,worktree:b??void 0,onInsertToMessage:x,className:"h-full"}),notes:(0,e.jsx)(cY,{worktreeId:a,className:"h-full",onInsertToMessage:x}),schedules:(0,e.jsx)(du,{worktreeId:a,className:"h-full",onInsertToMessage:x,instances:f}),agent:(0,e.jsx)(dB,{worktreeId:a,instances:f,onInstancesChange:ae,vibeLocalModel:af,onVibeLocalModelChange:ag,vibeLocalContextWindow:ah,onVibeLocalContextWindowChange:ai}),timer:(0,e.jsx)(dM,{worktreeId:a,instances:f}),todo:(0,e.jsx)(c1,{worktreeId:a,className:"h-full"})}),[a,b,o,V.query,V.mode,V.isSearching,V.error,V.setQuery,V.setMode,V.clearSearch,V.results?.results,X,Y,Z,$,_,aa,ab,ac,W,ad,x,f,ae,af,ag,ah,ai]),aU=(0,h.useMemo)(()=>null===o?null:(0,e.jsx)(eJ,{active:o,activities:aT}),[o,aT]);return(0,e.jsx)(F,{componentName:"WorktreeDetailRefactored",children:(0,e.jsxs)("div",{className:"flex h-full overflow-hidden relative",children:[aS,(0,e.jsxs)("div",{className:"flex flex-col flex-1 min-h-0 min-w-0",children:[(0,e.jsx)(er,{worktreeName:c,repositoryName:b?.repositoryDisplayName??b?.repositoryName??aG("detail.unknownRepository"),description:b?.description,status:d,gitStatus:b?.gitStatus,onBackClick:q,onInfoClick:r,hasUpdate:m,worktreeStatus:b?.status??null,onWorktreeStatusChange:s,sessionStatusByCli:b?.sessionStatusByCli,sessionStatusByInstance:b?.sessionStatusByInstance,instances:f,activeInstanceId:j,onActiveInstanceChange:aO,onAgentDragStart:aJ,onAgentDragEnd:aK,onKillSession:ao}),b?.gitStatus&&(0,e.jsx)(fx,{isBranchMismatch:b.gitStatus.isBranchMismatch,currentBranch:b.gitStatus.currentBranch,initialBranch:b.gitStatus.initialBranch}),(0,e.jsx)("div",{className:"flex-1 min-h-0 min-w-0",children:(0,e.jsx)(ev,{activityPane:aU,rightPane:(0,e.jsx)(ck,{terminal:aR})})})]}),(0,e.jsx)(es,{worktreeId:a,worktree:b,isOpen:aj,onClose:ak,onWorktreeUpdate:al}),(0,e.jsx)("input",{ref:am,type:"file",accept:eM.join(","),onChange:an,className:"hidden","aria-label":aG("detail.uploadFile")}),(0,e.jsx)(a5.a,{isOpen:null!==aq,onClose:as,title:aC,size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("p",{className:"text-sm text-foreground",children:aD}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:as,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:aE}),(0,e.jsx)("button",{type:"button",onClick:at,disabled:ar,"data-testid":"kill-session-confirm-button",className:"px-4 py-2 text-sm font-medium rounded-md bg-danger hover:bg-danger/90 text-white disabled:opacity-60 disabled:cursor-not-allowed",children:aF})]})]})}),au&&(0,e.jsx)(fz,{isOpen:av,onClose:aw,onConfirm:ax,worktreeId:a,sourcePath:au.path,sourceType:au.type}),(0,e.jsx)(fB,{isOpen:ay,parentPath:az,onConfirm:aA,onCancel:aB})]})})});a7.oo;let fD={data:null,messageId:null,visible:!1,answering:!1},fE={mode:"split",mobileActivePane:"terminal",leftPaneTab:"history",splitRatio:.5,leftPaneCollapsed:!1,activityBar:{active:"files"},historyPane:{visible:!0,width:25,collapsed:!1}},fF={type:null,message:null,retryable:!1,retryCount:0};function fG(){return{phase:"idle",prompt:{...fD},layout:{...fE},error:{...fF},messages:[],wsConnected:!1}}function fH(a,b){switch(b.type){case"SET_PHASE":return{...a,phase:b.phase};case"SHOW_PROMPT":return{...a,phase:"prompt",prompt:{data:b.data,messageId:b.messageId,visible:!0,answering:!1}};case"CLEAR_PROMPT":return{...a,prompt:{...fD}};case"SET_PROMPT_ANSWERING":return{...a,prompt:{...a.prompt,answering:b.answering}};case"SET_LAYOUT_MODE":return{...a,layout:{...a.layout,mode:b.mode}};case"SET_MOBILE_ACTIVE_PANE":return{...a,layout:{...a.layout,mobileActivePane:b.pane}};case"SET_SPLIT_RATIO":return{...a,layout:{...a.layout,splitRatio:b.ratio}};case"SET_LEFT_PANE_TAB":return{...a,layout:{...a.layout,leftPaneTab:b.tab}};case"TOGGLE_LEFT_PANE":return{...a,layout:{...a.layout,leftPaneCollapsed:!a.layout.leftPaneCollapsed}};case"SET_LEFT_PANE_COLLAPSED":return{...a,layout:{...a.layout,leftPaneCollapsed:b.collapsed}};case"SET_ACTIVE_ACTIVITY":return{...a,layout:{...a.layout,activityBar:{...a.layout.activityBar,active:b.activity}}};case"TOGGLE_ACTIVITY":{let c=a.layout.activityBar.active===b.activity?null:b.activity;return{...a,layout:{...a.layout,activityBar:{...a.layout.activityBar,active:c}}}}case"TOGGLE_HISTORY_PANE":{let b=!a.layout.historyPane.visible;return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,visible:b,collapsed:!b}}}}case"SET_HISTORY_PANE_VISIBLE":return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,visible:b.visible,collapsed:!b.visible}}};case"SET_HISTORY_WIDTH":return{...a,layout:{...a.layout,historyPane:{...a.layout.historyPane,width:b.width}}};case"SET_ERROR":return{...a,error:b.error};case"CLEAR_ERROR":return{...a,error:{...fF}};case"INCREMENT_RETRY_COUNT":return{...a,error:{...a.error,retryCount:a.error.retryCount+1}};case"SET_MESSAGES":return{...a,messages:b.messages};case"ADD_MESSAGE":return{...a,messages:[...a.messages,b.message]};case"UPDATE_MESSAGE":return{...a,messages:a.messages.map(a=>a.id===b.id?{...a,...b.updates}:a)};case"CLEAR_MESSAGES":return{...a,messages:[]};case"SET_WS_CONNECTED":return{...a,wsConnected:b.connected};default:return a}}var fI=c(63157);function fJ(a){let b=a.split("/");return b[b.length-1]||a}function fK(a,b,c){let d=a.findIndex(a=>a.path===b);if(-1===d)return null;let e=[...a];return e[d]=c(e[d]),e}let fL={tabs:[],activeIndex:null};var fM=c(4267);let fN="activeCliTab-",fO="activeInstanceId-";function fP(){let a=(0,k.c)("worktree");return(0,e.jsxs)("div",{className:"flex items-center justify-center h-full bg-surface text-muted-foreground",children:[(0,e.jsx)(m.y,{size:"lg",className:"mr-2"}),(0,e.jsx)("span",{children:a("detail.loadingEditor")})]})}let fQ=(0,j.default)(async()=>{},{loadableGenerated:{modules:["components/worktree/WorktreeDetailRefactored.tsx -> @/components/worktree/MarkdownEditor"]},ssr:!1,loading:()=>(0,e.jsx)(fP,{})}),fR=()=>{},fS=["terminal","history","files","memo","info"],fT=(0,h.memo)(function({worktreeId:a}){let{activeActivity:b,activeCliTab:c,activeInstanceId:d,activeTab:g,agentInstances:i,autoYesEnabled:j,autoYesExpiresAt:m,autoYesStateMap:n,diffContent:p,diffFilePath:r,disableAutoFollow:s,displayedInstances:t,editorFilePath:u,error:w,fetchCurrentOutput:x,fileInputRef:y,fileSearch:z,fileTreeRefresh:A,handleActivityToggle:B,handleAgentInstancesChange:C,handleAutoYesToggle:D,handleBackClick:G,handleCloseDiff:H,handleDelete:I,handleDiffSelect:J,handleDirtyChange:L,handleEditorClose:N,handleEditorSave:O,handleFileInputChange:P,handleFilePanelSave:Q,handleFilePathClick:R,handleFileSelect:U,handleHistoryDisplayLimitChange:V,handleHistoryUserOnlyChange:W,handleInfoClick:X,handleInfoModalClose:Y,handleInsertConsumed:Z,handleInsertConsumedSingle:$,handleInsertToMessage:_,handleInsertToSplit:aa,handleKillCancel:ac,handleKillConfirm:ad,openKillConfirm:ae,openActiveKillConfirm:af,killTarget:ah,isKillPending:ai,handleLoadContent:aj,handleLoadError:ak,handleMessageSent:an,handleMobileFileViewerClose:ao,handleMobileTabChange:ap,handleMove:aq,handleMoveCancel:ar,handleMoveConfirm:as,handleNewDirectory:at,handleNewFile:au,handleNewFileCancel:av,handleNewFileConfirm:aw,handleOpenFile:ax,handlePromptDismiss:ay,handlePromptRespond:az,handleRename:aA,handleRetry:aC,handleSetLoading:aD,handleShowArchivedChange:aE,handleUpload:aF,handleVibeLocalContextWindowChange:aG,handleVibeLocalModelChange:aH,handleWorktreeStatusChange:aI,hasUpdate:aJ,historyDisplayLimit:aK,historySubTab:aL,historyUserOnly:aM,isEditorMaximized:aN,isInfoModalOpen:aO,isMobile:aQ,isMoveDialogOpen:aR,isSelectionListActive:aS,isPagerActive:aT,lastAutoResponse:aV,loading:aX,makeAutoYesToggleHandler:aY,mobileFileViewerPath:aZ,mobileSelectedAgents:a$,moveTarget:a_,newFileParentPath:a0,openMobileDrawer:a1,pendingInsertText:a2,pendingInsertTextMap:a3,rosterReady:a4,setActiveInstanceId:a8,setEditorFilePath:a9,setFocusedSplitIndex:ba,setHistorySubTab:bb,setIsEditorMaximized:bc,setWorktree:bd,showArchived:be,showNewFileDialog:bf,showToast:bg,state:bh,tCommon:bi,tWorktree:bj,tabsActions:bk,tabsState:bl,resetFileTreeView:bm,toggleInstanceVisible:bn,vibeLocalContextWindow:bo,vibeLocalModel:bq,visibleInstanceIds:br,worktree:bs,worktreeName:bt,worktreeStatus:bu}=function({worktreeId:a}){let b=(0,f.useRouter)(),c=(0,ab.a)(),d=(0,h.useRef)(c);d.current=c;let{openMobileDrawer:e}=(0,eF.VF)(),{state:g,actions:i}=function(){let[a,b]=(0,h.useReducer)(fH,void 0,fG),{value:c,setValue:d}=(0,dP.V)({key:"commandmate.worktree.leftPaneCollapsed",defaultValue:!1,validate:a=>"boolean"==typeof a}),e=(0,h.useRef)(a.layout.leftPaneCollapsed);e.current=a.layout.leftPaneCollapsed,(0,h.useRef)(!1);let f=(0,h.useMemo)(()=>({setPhase:a=>b({type:"SET_PHASE",phase:a}),showPrompt:(a,c)=>b({type:"SHOW_PROMPT",data:a,messageId:c}),clearPrompt:()=>b({type:"CLEAR_PROMPT"}),setPromptAnswering:a=>b({type:"SET_PROMPT_ANSWERING",answering:a}),setError:a=>b({type:"SET_ERROR",error:a}),clearError:()=>b({type:"CLEAR_ERROR"}),setMessages:a=>b({type:"SET_MESSAGES",messages:a}),addMessage:a=>b({type:"ADD_MESSAGE",message:a}),updateMessage:(a,c)=>b({type:"UPDATE_MESSAGE",id:a,updates:c}),clearMessages:()=>b({type:"CLEAR_MESSAGES"}),setMobileActivePane:a=>b({type:"SET_MOBILE_ACTIVE_PANE",pane:a}),setLeftPaneTab:a=>b({type:"SET_LEFT_PANE_TAB",tab:a}),setLayoutMode:a=>b({type:"SET_LAYOUT_MODE",mode:a}),setSplitRatio:a=>b({type:"SET_SPLIT_RATIO",ratio:a}),setWsConnected:a=>b({type:"SET_WS_CONNECTED",connected:a}),toggleLeftPane:()=>{let a=!e.current;b({type:"SET_LEFT_PANE_COLLAPSED",collapsed:a}),d(a)},setActiveActivity:a=>b({type:"SET_ACTIVE_ACTIVITY",activity:a}),toggleActivity:a=>b({type:"TOGGLE_ACTIVITY",activity:a}),toggleHistoryPane:()=>b({type:"TOGGLE_HISTORY_PANE"}),setHistoryPaneVisible:a=>b({type:"SET_HISTORY_PANE_VISIBLE",visible:a}),setHistoryWidth:a=>b({type:"SET_HISTORY_WIDTH",width:a})}),[d]);return{state:a,dispatch:b,actions:f}}(),j=(0,k.c)("worktree"),l=(0,k.c)("error"),m=(0,k.c)("common");(0,k.c)("autoYes");let n=(0,am.SC)(),o=(0,fI.rC)(),p=o?.worktrees.find(b=>b.id===a)??null,[r,s]=(0,h.useState)(p),[t,u]=(0,h.useState)(null===p),[v,w]=(0,h.useState)(null);(0,h.useRef)(null!==p);let[x,y]=(0,h.useState)(!1),[z,A]=function(a){let[b,c]=(0,h.useReducer)(function a(b,c){switch(c.type){case"OPEN_FILE":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1!==a){if(b.activeIndex===a)return b;return{...b,activeIndex:a}}if(b.tabs.length>=30)return b;let d={path:c.path,name:fJ(c.path),content:null,loading:!1,error:null,isDirty:!1},e=[...b.tabs,d];return{tabs:e,activeIndex:e.length-1}}case"CLOSE_TAB":{var d,e;let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a)return b;let f=b.tabs.filter((b,c)=>c!==a),g=(d=b.activeIndex,0===(e=f.length)||null===d?null:a<d?d-1:a===d?Math.min(a,e-1):d);return{tabs:f,activeIndex:g}}case"ACTIVATE_TAB":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a||b.activeIndex===a)return b;return{...b,activeIndex:a}}case"SET_CONTENT":{let a=fK(b.tabs,c.path,a=>({...a,content:c.content,loading:!1,error:null,isDirty:!1}));if(!a)return b;return{...b,tabs:a}}case"SET_LOADING":{let a=fK(b.tabs,c.path,a=>({...a,loading:c.loading}));if(!a)return b;return{...b,tabs:a}}case"SET_ERROR":{let a=fK(b.tabs,c.path,a=>({...a,error:c.error,loading:!1}));if(!a)return b;return{...b,tabs:a}}case"RENAME_FILE":{let a=b.tabs.findIndex(a=>a.path===c.oldPath);if(-1===a)return b;let d=[...b.tabs];return d[a]={...d[a],path:c.newPath,name:fJ(c.newPath)},{...b,tabs:d}}case"DELETE_FILE":return a(b,{type:"CLOSE_TAB",path:c.path});case"RESTORE":{let a=c.paths.slice(0,30).map(a=>({path:a,name:fJ(a),content:null,loading:!1,error:null,isDirty:!1}));if(0===a.length)return fL;let b=c.activePath?Math.max(0,a.findIndex(a=>a.path===c.activePath)):0;return{tabs:a,activeIndex:b}}case"SET_DIRTY":{let a=b.tabs.find(a=>a.path===c.path);if(a&&a.isDirty===c.isDirty)return b;let d=fK(b.tabs,c.path,a=>({...a,isDirty:c.isDirty}));if(!d)return b;return{...b,tabs:d}}case"MOVE_TO_FRONT":{let a=b.tabs.findIndex(a=>a.path===c.path);if(-1===a||0===a)return b;return{tabs:[b.tabs[a],...b.tabs.filter((b,c)=>c!==a)],activeIndex:0}}case"CLOSE_ALL":if(0===b.tabs.length)return b;return fL;default:return b}},fL);(0,h.useRef)(!1),(0,h.useRef)(a);let d=(0,h.useRef)(b);d.current=b;let e=(0,h.useCallback)(a=>{let b=d.current.tabs;return -1!==b.findIndex(b=>b.path===a)?(c({type:"OPEN_FILE",path:a}),"activated"):b.length>=30?"limit_reached":(c({type:"OPEN_FILE",path:a}),"opened")},[]),f=(0,h.useCallback)(a=>{c({type:"CLOSE_TAB",path:a})},[]),g=(0,h.useCallback)(a=>{c({type:"ACTIVATE_TAB",path:a})},[]),i=(0,h.useCallback)((a,b)=>{c({type:"RENAME_FILE",oldPath:a,newPath:b})},[]),j=(0,h.useCallback)(a=>{c({type:"DELETE_FILE",path:a})},[]),k=(0,h.useCallback)(a=>{c({type:"MOVE_TO_FRONT",path:a})},[]),l=(0,h.useCallback)(()=>{c({type:"CLOSE_ALL"})},[]),m=(0,h.useMemo)(()=>({dispatch:c,openFile:e,closeTab:f,activateTab:g,onFileRenamed:i,onFileDeleted:j,moveToFront:k,closeAllTabs:l}),[c,e,f,g,i,j,k,l]);return[b,m]}(a),[B,C]=(0,h.useState)(null),[D,E]=(0,h.useState)(null),[F,G]=(0,h.useState)(!1),[H,I]=(0,h.useState)(new Map),[J,K]=(0,h.useState)(null),[L,M]=(0,h.useState)(!1),[N,O]=(0,h.useState)(!1),[P,Q]=(0,h.useState)(!1),R=(0,h.useRef)(!1),[S,U]=(0,h.useState)(null),[V,W]=(0,h.useState)(fM.fJ),X=(0,h.useRef)(V);X.current=V;let[Y,Z]=(0,h.useState)(()=>(0,a7.lu)(fM.fJ)),$=(0,h.useRef)(Y);$.current=Y;let[_,aa]=(0,h.useState)(null),ac=_===a,[ad,ae]=(0,h.useState)(null),[af,ag]=(0,h.useState)(null),[ah,ai]=(0,h.useState)(()=>{try{let b=window.localStorage.getItem(fN+a);if(b&&(0,a7.hR)(b))return b}catch{}return fM.fJ[0]}),aj=(0,h.useCallback)(b=>{ai(b);try{window.localStorage.setItem(fN+a,b)}catch{}},[a]),ak=(0,h.useRef)(ah);ak.current=ah;let[al,an]=(0,h.useState)(()=>{try{let b=window.localStorage.getItem(fO+a);if(b&&(0,a7.n6)(b))return b;let c=window.localStorage.getItem(fN+a);if(c&&(0,a7.hR)(c))return c}catch{}return fM.fJ[0]}),ao=(0,h.useCallback)(b=>{an(b);try{window.localStorage.setItem(fO+a,b)}catch{}let c=$.current.find(a=>a.id===b);c&&aj(c.cliTool)},[a,aj]),ap=(0,h.useRef)(al);ap.current=al;let aq=(0,h.useRef)(0),ar=(0,h.useRef)(0),as=(0,h.useRef)(0),at=H.get(al)?.enabled??!1,au=H.get(al)?.expiresAt??null,[av,aw]=(0,h.useState)(0),[ax,ay]=(0,h.useState)(!1),[az,aA]=(0,h.useState)(""),{active:aC,toggle:aD}=function(a){let[b,c]=(0,h.useState)("files"),d=(0,h.useRef)(b);d.current=b;let e=(0,h.useRef)(a);return e.current=a,{active:b,setActive:(0,h.useCallback)(a=>{c(a),e.current},[]),toggle:(0,h.useCallback)(a=>{if(d.current===a){c(null),e.current;return}c(a),e.current},[])}}(a),{historySubTab:aE,setHistorySubTab:aF,showArchived:aG,handleShowArchivedChange:aH,historyUserOnly:aI,handleHistoryUserOnlyChange:aJ,historyDisplayLimit:aK,handleHistoryDisplayLimitChange:aL}=function(){let[a,b]=(0,h.useState)("message"),[c,d]=(0,h.useState)(()=>!1),e=(0,h.useCallback)(a=>{d(a),localStorage.setItem("commandmate:showArchived",String(a))},[]),[f,g]=(0,h.useState)(()=>!1),i=(0,h.useCallback)(a=>{g(a);try{localStorage.setItem("commandmate:historyUserOnly",String(a))}catch{}},[]),[j,k]=(0,h.useState)(()=>50);return{historySubTab:a,setHistorySubTab:b,showArchived:c,handleShowArchivedChange:e,historyUserOnly:f,handleHistoryUserOnlyChange:i,historyDisplayLimit:j,handleHistoryDisplayLimitChange:(0,h.useCallback)(a=>{k(a);try{localStorage.setItem("commandmate:historyDisplayLimit",String(a))}catch{}},[])}}(),aM=(0,h.useRef)(aG),aN=(0,h.useRef)(aK),{pendingInsertTextMap:aO,pendingInsertText:aP,setFocusedSplitIndex:aQ,handleInsertToMessage:aR,handleInsertToSplit:aS,handleInsertConsumed:aT,handleInsertConsumedSingle:aV}=function(){let[a,b]=(0,h.useState)(()=>new Map),[c,d]=(0,h.useState)(0),e=(0,h.useCallback)(a=>{b(b=>{let d=new Map(b);return d.set(c,a),d})},[c]),f=(0,h.useCallback)((a,c)=>{b(b=>{let d=new Map(b);return d.set(a,c),d})},[]),g=(0,h.useCallback)(a=>{b(b=>{if(!b.has(a))return b;let c=new Map(b);return c.delete(a),c})},[]),i=a.get(0)??null,j=(0,h.useCallback)(()=>g(0),[g]);return{pendingInsertTextMap:a,pendingInsertText:i,focusedSplitIndex:c,setFocusedSplitIndex:d,handleInsertToMessage:e,handleInsertToSplit:f,handleInsertConsumed:g,handleInsertConsumedSingle:j}}(),{diffContent:aX,diffFilePath:aY,handleDiffSelect:aZ,handleCloseDiff:a$}=function(a){let[b,c]=(0,h.useState)(null),[d,e]=(0,h.useState)(null);return{diffContent:b,diffFilePath:d,handleDiffSelect:(0,h.useCallback)((b,d)=>{a||(c(b),e(d))},[a]),handleCloseDiff:(0,h.useCallback)(()=>{c(null),e(null)},[])}}(c),a_=function(a){let{worktreeId:b,initialMode:c="name",debounceMs:d=300}=a,[e,f]=(0,h.useState)(""),[g,i]=(0,h.useState)(""),[j,k]=(0,h.useState)(c),[l,m]=(0,h.useState)(!1),[n,o]=(0,h.useState)(null),[p,r]=(0,h.useState)(null),s=(0,h.useRef)(null),t=(0,h.useMemo)(()=>{var a;let b;return a=a=>{i(a)},b=null,(...c)=>{b&&clearTimeout(b),b=setTimeout(()=>{a(...c),b=null},d)}},[d]),u=(0,h.useCallback)(a=>{f(a),t(a),r(null)},[t]),v=(0,h.useCallback)(()=>{f(""),i(""),o(null),r(null),m(!1),s.current&&(s.current.abort(),s.current=null)},[]),w=(0,h.useCallback)(a=>{if(!g.trim())return a;let b=g.toLowerCase();return a.filter(a=>a.name.toLowerCase().includes(b))},[g]),x=(0,h.useCallback)(()=>n&&0!==n.results.length?q(n.results.map(a=>a.filePath)):new Set,[n]);return{query:e,mode:j,isSearching:l,results:n,error:p,setQuery:u,setMode:k,clearSearch:v,filterByName:w,getMatchedPaths:x}}({worktreeId:a});(0,h.useRef)(!1),(0,h.useRef)(a);let a0=(0,h.useCallback)(async()=>{try{let b=await fetch(`/api/worktrees/${a}`);if(!b.ok)throw Error(`Failed to fetch worktree: ${b.status}`);let c=await b.json();if(s(c),c.selectedAgents){let a=X.current;c.selectedAgents.length===a.length&&c.selectedAgents.every((b,c)=>b===a[c])||W(c.selectedAgents)}if(c.agentInstances){let b=$.current,d=c.agentInstances;d.length===b.length&&d.every((a,c)=>a.id===b[c].id&&a.cliTool===b[c].cliTool&&a.alias===b[c].alias)||Z(d),aa(a)}return"vibeLocalModel"in c&&ae(c.vibeLocalModel??null),"vibeLocalContextWindow"in c&&ag(c.vibeLocalContextWindow??null),c}catch(a){return w(a instanceof Error?a.message:"Unknown error"),null}},[a]),a1=(0,h.useCallback)(async()=>{let b=ak.current,c=d.current,e=ap.current,f=++aq.current;try{let d=new URLSearchParams({cliTool:b});c&&d.set("instance",e),aM.current&&d.set("includeArchived","true"),d.set("limit",String(aN.current));let g=await fetch(`/api/worktrees/${a}/messages?${d.toString()}`);if(!g.ok)throw Error(`Failed to fetch messages: ${g.status}`);let h=await g.json();if(aq.current!==f||ak.current!==b||c&&ap.current!==e)return;i.setMessages(h.map(a=>({...a,timestamp:new Date(a.timestamp)})))}catch(a){if(aq.current!==f||ak.current!==b||c&&ap.current!==e)return;console.error("[WorktreeDetailRefactored] Error fetching messages:",a)}},[a,i]),a2=(0,h.useCallback)(async()=>{let b=ak.current,c=d.current,e=ap.current,f=++ar.current;try{let d=c?`/api/worktrees/${a}/current-output?cliTool=${b}&instance=${encodeURIComponent(e)}`:`/api/worktrees/${a}/current-output?cliTool=${b}`,h=await fetch(d);if(!h.ok)return;let j=await h.json();if(ar.current!==f||ak.current!==b||c&&ap.current!==e||j.cliToolId&&j.cliToolId!==b)return;if(j.isPromptWaiting&&j.promptData?i.showPrompt(j.promptData,`prompt-${Date.now()}`):!j.isPromptWaiting&&g.prompt.visible&&i.clearPrompt(),O(j.isSelectionListActive??!1),Q(j.isPagerActive??!1),K(j.lastServerResponseTimestamp??null),M(j.serverPollerActive??!1),j.autoYes){let a=R.current,d=j.autoYes,f=c?e:b;I(a=>{let b=new Map(a);return b.set(f,{enabled:d.enabled,expiresAt:d.expiresAt}),b}),R.current=d.enabled,a&&!j.autoYes.enabled&&("stop_pattern_matched"===j.autoYes.stopReason||"consecutive_errors"===j.autoYes.stopReason)&&U(j.autoYes.stopReason)}}catch(a){if(ar.current!==f||ak.current!==b||c&&ap.current!==e)return;console.error("[WorktreeDetailRefactored] Error fetching current output:",a)}},[a,i,g.prompt.visible]);(0,h.useCallback)(async()=>{let b=++as.current;try{let c=await fetch(`/api/worktrees/${a}/auto-yes`);if(!c.ok)return;let d=await c.json();if(as.current!==b)return;let e=d?.instances;if(!e||"object"!=typeof e)return;let f=new Map;for(let[a,b]of Object.entries(e))b&&"object"==typeof b&&f.set(a,{enabled:b.enabled??!1,expiresAt:b.expiresAt??null});I(f)}catch(a){if(as.current!==b)return;console.error("[WorktreeDetailRefactored] Error fetching auto-yes states:",a)}},[a]);let{visibleInstances:a3,visibleInstanceIds:a4,toggleInstanceVisible:a5}=function({worktreeId:a,roster:b}){let[c,d]=(0,h.useState)(null),e=(0,h.useMemo)(()=>dx(c,b),[c,b]),f=(0,h.useMemo)(()=>e.map(a=>a.id),[e]),g=(0,h.useMemo)(()=>null!==c&&b.some(a=>c.includes(a.id)),[c,b]),i=(0,h.useCallback)(a=>{let c=new Set(a),e=b.filter(a=>c.has(a.id)).map(a=>a.id);!(e.length<1)&&d(e)},[b,a]),j=(0,h.useCallback)(a=>i(a),[i]);return{visibleInstances:e,visibleInstanceIds:f,hasStoredPreference:g,toggleInstanceVisible:(0,h.useCallback)(a=>{let d=dx(c,b).map(a=>a.id);if(d.includes(a)){if(d.length<=1)return;i(d.filter(b=>b!==a))}else i([...d,a])},[c,b,i]),setVisibleInstanceIds:j,showInstances:(0,h.useCallback)(a=>{null!==c&&i([...dx(c,b).map(a=>a.id),...a])},[c,b,i])}}({worktreeId:a,roster:Y}),a6=c?a3:Y,a8=(0,h.useMemo)(()=>Array.from(new Set(a3.map(a=>a.cliTool))),[a3]),a9=c?a8:V,ba="opencode"===ah||"copilot"===ah,bb=(0,h.useCallback)(a=>{W(a)},[]),bc=(0,h.useCallback)(b=>{Z(b),aa(a)},[a]),bd=(0,h.useCallback)(a=>{ae(a)},[]),be=(0,h.useCallback)(a=>{ag(a)},[]);(0,h.useRef)(ah);let{showToast:bf}=(0,aU.dj)(),bg=(0,h.useCallback)(()=>{bf("Maximum 30 file tabs. Close a tab first.","info")},[bf]),bh=(0,h.useCallback)(a=>{c?C(a):"limit_reached"===A.openFile(a)&&bg()},[c,A,bg]),bi=(0,h.useCallback)(a=>{c?C(a):"limit_reached"===A.openFile(a)&&bg()},[c,A,bg]),bj=(0,h.useCallback)(a=>{"limit_reached"===A.openFile(a)&&bg()},[A,bg]),bk=(0,h.useCallback)(()=>{C(null)},[]),bl=(0,h.useCallback)(a=>{aw(a=>a+1)},[]),bm=(0,h.useCallback)(()=>{E(null)},[]),bn=(0,h.useCallback)(()=>{a_.clearSearch(),A.closeAllTabs(),C(null),E(null)},[a_,A]),bo=(0,h.useCallback)(a=>{aw(a=>a+1)},[]),bp=(0,h.useCallback)(a=>{aD(a)},[aD]),bq=(0,h.useCallback)(()=>{b.push("/")},[b]),br=(0,h.useCallback)(async b=>{try{let c=await fetch(`/api/worktrees/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:b})});if(c.ok){let a=await c.json();s(a)}}catch{}},[a]),bs=(0,h.useCallback)(()=>{y(!0)},[]),bt=(0,h.useCallback)(()=>{y(!1)},[]),bu=(0,h.useCallback)(async b=>{i.setPromptAnswering(!0);try{let c=fu(b,ah,g.prompt.data,d.current?ap.current:void 0),e=await fetch(`/api/worktrees/${a}/prompt-response`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!e.ok)throw Error(`Failed to send prompt response: ${e.status}`);i.clearPrompt(),await a2()}catch(a){console.error("[WorktreeDetailRefactored] Error sending prompt response:",a)}finally{i.setPromptAnswering(!1)}},[a,i,a2,ah,g.prompt.data]),bv=(0,h.useCallback)(()=>{i.clearPrompt()},[i]),bw=(0,h.useCallback)(a=>{i.setMobileActivePane(a)},[i]),bx=(0,h.useCallback)(()=>{a1(),a2()},[a1,a2]),by=(0,h.useCallback)((b,c)=>async d=>{let e=c??b;try{let c=await fetch(`/api/worktrees/${a}/auto-yes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:d.enabled,cliToolId:b,instanceId:e,duration:d.duration,stopPattern:d.stopPattern})});if(c.ok){let a=await c.json();I(b=>{let c=new Map(b);return c.set(e,{enabled:a.enabled,expiresAt:a.expiresAt}),c}),e===ap.current&&(R.current=a.enabled)}}catch(a){console.error("[WorktreeDetailRefactored] Error toggling auto-yes:",a)}},[a]),bz=(0,h.useCallback)(a=>by(ah,al)(a),[by,ah,al]),[bA,bB]=(0,h.useState)(null),[bC,bD]=(0,h.useState)(!1),bE=(0,h.useRef)(!1),bF=(0,h.useCallback)(a=>{bB(a)},[]),bG=(0,h.useCallback)(()=>{let a=ap.current,b=ak.current,c=(0,a7.O6)($.current,a,b);bB({cliToolId:b,instanceId:a,label:c})},[]),bH=(0,h.useCallback)(async()=>{if(!bA||bE.current)return;bE.current=!0,bD(!0);let b=()=>{bA.instanceId===ap.current&&(i.clearMessages(),i.clearPrompt())};try{await T.y.killSession(a,bA.cliToolId,bA.instanceId),b(),await a0(),bB(null)}catch(a){a instanceof T.hD&&404===a.status?(b(),await a0(),bB(null)):bf(j("session.failedToKill"),"error")}finally{bE.current=!1,bD(!1)}},[bA,a,i,a0,bf,j]),bI=(0,h.useCallback)(()=>{bE.current||bB(null)},[]),bJ=(0,h.useCallback)(a=>{aA(a),ay(!0)},[]),bK=(0,h.useCallback)(async b=>{ay(!1);let c=az?`${az}/${b}`:b;try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(c)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"file",content:""})})).ok)throw Error("Failed to create file");aw(a=>a+1)}catch{window.alert(l("fileOps.failedToCreateFile"))}},[a,az,l]),bL=(0,h.useCallback)(()=>{ay(!1)},[]),bM=(0,h.useCallback)(async b=>{let c=window.prompt("Enter directory name:");if(!c)return;let d=b?`${b}/${c}`:c;try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(d)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"directory"})})).ok)throw Error("Failed to create directory");aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to create directory:",a),window.alert(l("fileOps.failedToCreateDirectory"))}},[a,l]),bN=(0,h.useCallback)(async b=>{let c=b.split("/").pop()||"",d=window.prompt("Enter new name:",c);if(d&&d!==c)try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(b)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",newName:d})})).ok)throw Error("Failed to rename");let c=b.includes("/")?b.substring(0,b.lastIndexOf("/")+1):"";A.onFileRenamed(b,`${c}${d}`),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to rename:",a),window.alert(l("fileOps.failedToRename"))}},[a,A,l]),bO=(0,h.useCallback)(async b=>{let c=b.split("/").pop()||b;if(await n({description:m("confirmDelete",{name:c}),variant:"danger"}))try{if(!(await fetch(`/api/worktrees/${a}/files/${aB(b)}?recursive=true`,{method:"DELETE"})).ok)throw Error("Failed to delete");(D===b||D?.startsWith(`${b}/`))&&E(null),A.onFileDeleted(b),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to delete:",a),window.alert(l("fileOps.failedToDelete"))}},[a,D,A,m,l,n]),{moveTarget:bP,isMoveDialogOpen:bQ,handleMove:bR,handleMoveConfirm:bS,handleMoveCancel:bT}=function(a,b,c,d){let[e,f]=(0,h.useState)(null),[g,i]=(0,h.useState)(!1),j=(0,h.useCallback)((a,b)=>{f({path:a,type:b}),i(!0)},[]),k=(0,h.useCallback)(async g=>{if(e)try{let f=await fetch(`/api/worktrees/${a}/files/${e.path}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"move",destination:g})}),h=await f.json();if(!f.ok||!h.success){let a=h.error?.message||"Failed to move";d?.(a);return}c?.("Moved successfully"),b()}catch{d?.("Failed to move")}finally{f(null),i(!1)}},[e,a,b,c,d]);return{moveTarget:e,isMoveDialogOpen:g,handleMove:j,handleMoveConfirm:k,handleMoveCancel:(0,h.useCallback)(()=>{f(null),i(!1)},[])}}(a,()=>aw(a=>a+1),a=>bf(a,"success"),a=>bf(a,"error")),bU=(0,h.useRef)(null),bV=(0,h.useRef)(""),bW=(0,h.useCallback)(a=>{bV.current=a,bU.current?.click()},[]),bX=(0,h.useCallback)(async b=>{let c=b.target.files?.[0];if(!c)return;b.target.value="";let d=bV.current,e=`.${c.name.split(".").pop()?.toLowerCase()}`;if(!function(a){if(!a)return!1;let b=a.toLowerCase();return eM.includes(b)}(e))return void bf(`Unsupported file type: ${e}. Allowed: ${eM.join(", ")}`,"error");let f=function(a){let b=function(a){let b=a.toLowerCase();return eL.find(a=>a.extension===b)}(a);return b?.maxFileSize??0x1400000}(e);if(c.size>f)return void bf(`File too large. Maximum size: ${(f/1024/1024).toFixed(1)}MB`,"error");let g=new FormData;g.append("file",c);try{let b=await fetch(`/api/worktrees/${a}/upload/${aB(d||".")}`,{method:"POST",body:g});if(!b.ok){let a=await b.json().catch(()=>({})),c=a?.error?.message||"Failed to upload file";bf(c,"error");return}let c=await b.json();bf(`Uploaded: ${c.filename}`,"success"),aw(a=>a+1)}catch(a){console.error("[WorktreeDetailRefactored] Failed to upload:",a),bf("Upload failed. Please try again.","error")}},[a,bf]),{data:bY}=aW(),bZ=bY?.hasUpdate??!1,{lastAutoResponse:b$}=function({worktreeId:a,cliTool:b,isPromptWaiting:c,promptData:d,autoYesEnabled:e,lastServerResponseTimestamp:f,serverPollerActive:g}){(0,h.useRef)(null);let[i,j]=(0,h.useState)(null);return{lastAutoResponse:i}}({worktreeId:a,cliTool:ah,isPromptWaiting:g.prompt.visible,promptData:g.prompt.data,autoYesEnabled:at,lastServerResponseTimestamp:J,serverPollerActive:L}),b_=(0,h.useCallback)(async()=>{w(null),u(!0),await a0()&&await Promise.all([a1(),a2()]),u(!1)},[a0,a1,a2]);!function({error:a,handleRetry:b,fetchWorktree:c,fetchMessages:d,fetchCurrentOutput:e,setError:f}){let g=(0,h.useRef)(0);(0,h.useCallback)(async()=>{if("visible"!==document.visibilityState)return;let h=Date.now();if(!(h-g.current<5e3)){if(g.current=h,a)return void b();try{await Promise.all([c(),d(),e()])}finally{f(null)}}},[a,b,c,d,e,f])}({error:v,handleRetry:b_,fetchWorktree:a0,fetchMessages:a1,fetchCurrentOutput:a2,setError:w}),r?.sessionStatusByCli?.[ah]?.isRunning;let b0=(0,h.useMemo)(()=>(function(a,b,c="claude"){if(b)return"error";if(!a)return"idle";let d=a.sessionStatusByCli?.[c];if(d){if(d.isWaitingForResponse)return"waiting";if(d.isProcessing)return"running";if(d.isRunning)return"ready"}if("claude"===c){if(a.isWaitingForResponse)return"waiting";if(a.isProcessing)return"running";if(a.isSessionRunning)return"ready"}return"idle"})(r,null!==g.error.type,ah),[r,g.error.type,ah]),b1=(0,h.useMemo)(()=>g.layout.mobileActivePane,[g.layout.mobileActivePane]),b2=r?.name??"Unknown",b3=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_CONTENT",path:a,content:b})},[A]),b4=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_ERROR",path:a,error:b})},[A]),b5=(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_LOADING",path:a,loading:b})},[A]);return{activeActivity:aC,activeCliTab:ah,activeInstanceId:al,activeTab:b1,agentInstances:Y,autoYesEnabled:at,autoYesExpiresAt:au,autoYesStateMap:H,diffContent:aX,diffFilePath:aY,disableAutoFollow:ba,displayedAgents:a9,displayedInstances:a6,editorFilePath:D,error:v,fetchCurrentOutput:a2,fileInputRef:bU,fileSearch:a_,fileTreeRefresh:av,handleActivityToggle:bp,handleAgentInstancesChange:bc,handleAutoYesToggle:bz,handleBackClick:bq,handleCloseDiff:a$,handleDelete:bO,handleDiffSelect:aZ,handleDirtyChange:(0,h.useCallback)((a,b)=>{A.dispatch({type:"SET_DIRTY",path:a,isDirty:b})},[A]),handleEditorClose:bm,handleEditorSave:bo,handleFileInputChange:bX,handleFilePanelSave:bl,handleFilePathClick:bh,handleFileSelect:bi,handleHistoryDisplayLimitChange:aL,handleHistoryUserOnlyChange:aJ,handleInfoClick:bs,handleInfoModalClose:bt,handleInsertConsumed:aT,handleInsertConsumedSingle:aV,handleInsertToMessage:aR,handleInsertToSplit:aS,handleKillCancel:bI,handleKillConfirm:bH,openKillConfirm:bF,openActiveKillConfirm:bG,killTarget:bA,isKillPending:bC,handleLoadContent:b3,handleLoadError:b4,handleMessageSent:bx,handleMobileFileViewerClose:bk,handleMobileTabChange:bw,handleMove:bR,resetFileTreeView:bn,handleMoveCancel:bT,handleMoveConfirm:bS,handleNewDirectory:bM,handleNewFile:bJ,handleNewFileCancel:bL,handleNewFileConfirm:bK,handleOpenFile:bj,handlePromptDismiss:bv,handlePromptRespond:bu,handleRename:bN,handleRetry:b_,handleSelectedAgentsChange:bb,handleSetLoading:b5,handleShowArchivedChange:aH,handleUpload:bW,handleVibeLocalContextWindowChange:be,rosterReady:ac,handleVibeLocalModelChange:bd,handleWorktreeStatusChange:br,hasUpdate:bZ,historyDisplayLimit:aK,historySubTab:aE,historyUserOnly:aI,isEditorMaximized:F,isInfoModalOpen:x,isMobile:c,isMoveDialogOpen:bQ,isSelectionListActive:N,isPagerActive:P,lastAutoResponse:b$,loading:t,makeAutoYesToggleHandler:by,mobileFileViewerPath:B,mobileSelectedAgents:a8,moveTarget:bP,newFileParentPath:az,openMobileDrawer:e,pendingInsertText:aP,pendingInsertTextMap:aO,selectedAgents:V,setActiveCliTab:aj,setActiveInstanceId:ao,setEditorFilePath:E,setFocusedSplitIndex:aQ,setHistorySubTab:aF,setIsEditorMaximized:G,setWorktree:s,showArchived:aG,showNewFileDialog:ax,showToast:bf,state:g,tCommon:m,tWorktree:j,tabsActions:A,tabsState:z,toggleInstanceVisible:a5,vibeLocalContextWindow:af,vibeLocalModel:ad,visibleInstanceIds:a4,worktree:r,worktreeName:b2,worktreeStatus:b0}}({worktreeId:a}),[bv,bw]=(0,h.useState)(!1),bx=function({worktreeId:a,active:b}){let{addListener:c}=(0,bp.xM)(),[d,e]=(0,h.useState)(!1);return(0,h.useRef)(b).current=b,!b&&d}({worktreeId:a,active:"terminal"===g}),{viewportHeight:by}=function(){let[a,b]=(0,h.useState)(!1),[c,d]=(0,h.useState)(0),[e,f]=(0,h.useState)(null);return(0,h.useCallback)(()=>{},[]),{isKeyboardVisible:a,keyboardHeight:c,viewportHeight:e}}(),bz=(0,h.useCallback)(a=>{let b=fS.indexOf(g);if(-1===b)return;let c=b+a;c<0||c>=fS.length||ap(fS[c])},[g,ap]),{ref:bA}=K({axis:"horizontal",threshold:60,edgeStartZone:32*("terminal"===g),onSwipeLeft:()=>bz(1),onSwipeRight:()=>bz(-1)});if(aX)return(0,e.jsx)(et,{});if(w)return(0,e.jsx)(eu,{message:w,onRetry:aC});let bB=(0,a7.O6)(i,d,c),bC=ah?.label??bB,bD=(bs?.sessionStatusByInstance?.[d]??bs?.sessionStatusByCli?.[c])?.isRunning??!1;return aQ?(0,e.jsx)(F,{componentName:"WorktreeDetailRefactored",children:(0,e.jsxs)("div",{className:"flex flex-col overflow-hidden",style:{height:null!=by?`${by}px`:"100%"},"data-testid":"mobile-worktree-shell",children:[(0,e.jsx)("div",{className:"flex-shrink-0",children:(0,e.jsx)(v,{worktreeName:bt,repositoryName:bs?.repositoryName,status:bu,gitStatus:bs?.gitStatus,onBackClick:G,onMenuClick:a1})}),bs?.gitStatus&&bs.gitStatus.isBranchMismatch&&(0,e.jsx)("div",{className:"z-35 flex-shrink-0",children:(0,e.jsx)(fx,{isBranchMismatch:bs.gitStatus.isBranchMismatch,currentBranch:bs.gitStatus.currentBranch,initialBranch:bs.gitStatus.initialBranch})}),(0,e.jsxs)("div",{className:"flex-shrink-0 z-30 flex items-center gap-2 px-3 py-1.5 bg-surface-2 border-b border-border",children:[(0,e.jsx)("nav",{className:"flex gap-1 flex-1 min-w-0 overflow-x-auto scrollbar-hide","aria-label":bj("detail.agentInstanceSelection"),children:t.map(a=>{let b=(0,a6.kA)(bs?.sessionStatusByInstance?.[a.id]??bs?.sessionStatusByCli?.[a.cliTool]),c=bi(`status.${b}`),f=d===a.id;return(0,e.jsxs)("button",{onClick:()=>a8(a.id),className:`flex-shrink-0 whitespace-nowrap min-h-[44px] px-1.5 py-1 font-medium text-xs transition-colors flex items-center gap-1 border-b-2 touch-manipulation ${f?"text-accent-600 dark:text-accent-400 border-accent-500":"text-muted-foreground hover:text-foreground border-transparent"}`,"aria-current":f?"page":void 0,children:[(0,e.jsx)(o.m,{status:b,size:"sm",label:bj("detail.statusPill",{label:(0,a7.sw)(a),status:c})}),(0,a7.sw)(a)]},a.id)})}),(0,e.jsx)("button",{type:"button",onClick:()=>bw(!0),className:"flex-shrink-0 flex items-center justify-center min-h-[44px] min-w-[44px] rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors touch-manipulation","aria-label":bj("terminal.moreActions"),"data-testid":"mobile-more-actions-button",children:(0,e.jsx)(l.A,{size:18,"aria-hidden":"true"})})]}),(0,e.jsx)("main",{className:"flex-1 min-h-0 overflow-y-auto",ref:bA,children:(0,e.jsx)(en,{activeTab:g,worktreeId:a,worktree:bs,messages:bh.messages,cliToolId:c,instanceId:d,onFilePathClick:R,onFileSelect:U,onWorktreeUpdate:bd,onNewFile:au,onNewDirectory:at,onRename:aA,onDelete:I,onUpload:aF,onMove:aq,onFileTreeReset:bm,refreshTrigger:A,fileSearch:z,showToast:bg,selectedAgents:a$,onSelectedAgentsChange:fR,useInstanceManagement:!0,instances:i,onInstancesChange:C,visibleInstanceIds:br,onToggleInstanceVisible:bn,vibeLocalModel:bq,onVibeLocalModelChange:aH,vibeLocalContextWindow:bo,onVibeLocalContextWindowChange:aG,disableAutoFollow:s,historySubTab:aL,onHistorySubTabChange:bb,onDiffSelect:J,onInsertToMessage:_,showArchived:be,onShowArchivedChange:aE,historyDisplayLimit:aK,onHistoryDisplayLimitChange:V,historyUserOnly:aM,onHistoryUserOnlyChange:W})}),(0,e.jsxs)("div",{className:"flex-shrink-0 border-t border-border bg-surface z-30",children:[aS&&(0,e.jsx)("div",{className:"px-2 pt-1 border-b border-border",children:(0,e.jsx)(al,{worktreeId:a,cliToolId:c,instanceId:d,onKeysSent:x,showPagerKeys:aT})}),(0,e.jsx)("div",{className:"p-2",children:(0,e.jsx)(ag,{worktreeId:a,onMessageSent:an,cliToolId:c,instanceId:d,isSessionRunning:bD,pendingInsertText:a2,onInsertConsumed:$,autoYesSlot:(0,e.jsx)(fs,{enabled:j,expiresAt:m,onToggle:D,lastAutoResponse:aV,cliToolName:c,inline:!0,showToolName:!1})})})]}),(0,e.jsx)(E,{activeTab:g,onTabChange:ap,hasNewOutput:bx,hasPrompt:bh.prompt.visible,hasUpdate:aJ,inFlow:!0}),!j&&(0,e.jsx)(M,{promptData:bh.prompt.data,visible:bh.prompt.visible,answering:bh.prompt.answering,onRespond:az,onDismiss:ay,cliToolName:(0,a7.oo)(c)}),(0,e.jsx)(S,{open:bv,onClose:()=>bw(!1),onSearch:()=>window.dispatchEvent(new CustomEvent("terminal-search-open")),onEnd:af,endDisabled:!bD}),(0,e.jsx)(aP,{isOpen:null!==aZ,onClose:ao,worktreeId:a,filePath:aZ??"",onEditMarkdown:a9}),u&&(0,e.jsx)(a5.a,{isOpen:!0,onClose:N,title:u.split("/").pop()||bj("fileViewer.editor"),size:"full",disableClose:aN,children:(0,e.jsx)("div",{className:"h-[80vh]",children:(0,e.jsx)(fQ,{worktreeId:a,filePath:u,onClose:N,onSave:O,onMaximizedChange:bc,initialViewMode:"split"})})}),(0,e.jsx)("input",{ref:y,type:"file",accept:eM.join(","),onChange:P,className:"hidden","aria-label":bj("detail.uploadFile")}),(0,e.jsx)(a5.a,{isOpen:null!==ah,onClose:ac,title:bj("session.confirmEnd",{tool:bC}),size:"sm",showCloseButton:!0,children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("p",{className:"text-sm text-foreground",children:bj("session.endWarning")}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:ac,className:"px-4 py-2 text-sm font-medium rounded-md bg-muted hover:bg-muted/80 text-foreground",children:bi("cancel")}),(0,e.jsx)("button",{type:"button",onClick:ad,disabled:ai,className:"px-4 py-2 text-sm font-medium rounded-md bg-danger hover:bg-danger/90 text-white disabled:opacity-60 disabled:cursor-not-allowed",children:bi("end")})]})]})}),a_&&(0,e.jsx)(fz,{isOpen:aR,onClose:ar,onConfirm:as,worktreeId:a,sourcePath:a_.path,sourceType:a_.type}),(0,e.jsx)(fB,{isOpen:bf,parentPath:a0,onConfirm:aw,onCancel:av})]})}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(fC,{worktreeId:a,worktree:bs,worktreeName:bt,worktreeStatus:bu,instances:i,rosterReady:a4,activeInstanceId:d,setActiveInstanceId:a8,hasUpdate:aJ,lastAutoResponse:aV,activeActivity:b,onActivityToggle:B,onBackClick:G,onInfoClick:X,onWorktreeStatusChange:aI,pendingInsertTextMap:a3,setFocusedSplitIndex:ba,handleInsertToSplit:aa,handleInsertConsumed:Z,handleInsertToMessage:_,autoYesStateMap:n,makeAutoYesToggleHandler:aY,showArchived:be,onShowArchivedChange:aE,historyDisplayLimit:aK,onHistoryDisplayLimitChange:V,historyUserOnly:aM,onHistoryUserOnlyChange:W,onMessageSent:an,onFilePathClick:R,showToast:bg,tabsState:bl,tabsActions:bk,onLoadContent:aj,onLoadError:ak,onSetLoading:aD,onFilePanelSave:Q,onDirtyChange:L,onOpenFile:ax,diffContent:p,diffFilePath:r,onCloseDiff:H,fileSearch:z,fileTreeRefresh:A,onFileSelect:U,onNewFile:au,onNewDirectory:at,onRename:aA,onDelete:I,onUpload:aF,onMove:aq,onFileTreeReset:bm,onDiffSelect:J,onAgentInstancesChange:C,vibeLocalModel:bq,onVibeLocalModelChange:aH,vibeLocalContextWindow:bo,onVibeLocalContextWindowChange:aG,isInfoModalOpen:aO,onInfoModalClose:Y,onWorktreeUpdate:bd,fileInputRef:y,onFileInputChange:P,onKillSession:af,onRequestSessionEnd:ae,killTarget:ah,isKillPending:ai,onKillCancel:ac,onKillConfirm:ad,moveTarget:a_,isMoveDialogOpen:aR,onMoveCancel:ar,onMoveConfirm:as,showNewFileDialog:bf,newFileParentPath:a0,onNewFileConfirm:aw,onNewFileCancel:av,killDialogTitle:bj("session.confirmEnd",{tool:bC}),killDialogWarning:bj("session.endWarning"),cancelLabel:bi("cancel"),endLabel:bi("end")}),u&&(0,e.jsx)(a5.a,{isOpen:!0,onClose:N,title:u.split("/").pop()||bj("fileViewer.editor"),size:"full",disableClose:aN,children:(0,e.jsx)("div",{className:"h-[80vh]",children:(0,e.jsx)(fQ,{worktreeId:a,filePath:u,onClose:N,onSave:O,onMaximizedChange:bc})})})]})});function fU(){let a=(0,f.useParams)().id;return(0,e.jsx)(g.GV,{children:(0,e.jsx)(fT,{worktreeId:a})})}},97369:a=>{a.exports=function(a){return{name:"STEP Part 21",aliases:["p21","step","stp"],case_insensitive:!0,keywords:{$pattern:"[A-Z_][A-Z0-9_.]*",keyword:["HEADER","ENDSEC","DATA"]},contains:[{className:"meta",begin:"ISO-10303-21;",relevance:10},{className:"meta",begin:"END-ISO-10303-21;",relevance:10},a.C_LINE_COMMENT_MODE,a.C_BLOCK_COMMENT_MODE,a.COMMENT("/\\*\\*!","\\*/"),a.C_NUMBER_MODE,a.inherit(a.APOS_STRING_MODE,{illegal:null}),a.inherit(a.QUOTE_STRING_MODE,{illegal:null}),{className:"string",begin:"'",end:"'"},{className:"symbol",variants:[{begin:"#",end:"\\d+",illegal:"\\W"}]}]}}},97467:a=>{a.exports=function(a){return{name:"DNS Zone",aliases:["bind","zone"],keywords:["IN","A","AAAA","AFSDB","APL","CAA","CDNSKEY","CDS","CERT","CNAME","DHCID","DLV","DNAME","DNSKEY","DS","HIP","IPSECKEY","KEY","KX","LOC","MX","NAPTR","NS","NSEC","NSEC3","NSEC3PARAM","PTR","RRSIG","RP","SIG","SOA","SRV","SSHFP","TA","TKEY","TLSA","TSIG","TXT"],contains:[a.COMMENT(";","$",{relevance:0}),{className:"meta",begin:/^\$(TTL|GENERATE|INCLUDE|ORIGIN)\b/},{className:"number",begin:"((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))\\b"},{className:"number",begin:"((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\b"},a.inherit(a.NUMBER_MODE,{begin:/\b\d+[dhwm]?/})]}}},97694:a=>{a.exports=function(a){let b=a.regex,c={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:a.NUMBER_RE}]},d=a.COMMENT();d.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];let e={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},f={className:"literal",begin:/\bon|off|true|false|yes|no\b/},g={className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},h=b.either(/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/);return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[d,{className:"section",begin:/\[+/,end:/\]+/},{begin:b.concat(h,"(\\s*\\.\\s*",h,")*",b.lookahead(/\s*=\s*[^#\s]/)),className:"attr",starts:{end:/$/,contains:[d,{begin:/\[/,end:/\]/,contains:[d,f,e,g,c,"self"],relevance:0},f,e,g,c]}}]}}},98758:a=>{a.exports=function(a){return{name:"Inform 7",aliases:["i7"],case_insensitive:!0,keywords:{keyword:"thing room person man woman animal container supporter backdrop door scenery open closed locked inside gender is are say understand kind of rule"},contains:[{className:"string",begin:'"',end:'"',relevance:0,contains:[{className:"subst",begin:"\\[",end:"\\]"}]},{className:"section",begin:/^(Volume|Book|Part|Chapter|Section|Table)\b/,end:"$"},{begin:/^(Check|Carry out|Report|Instead of|To|Rule|When|Before|After)\b/,end:":",contains:[{begin:"\\(This",end:"\\)"}]},{className:"comment",begin:"\\[",end:"\\]",contains:["self"]}]}}},98803:a=>{a.exports=function(a){let b=a.regex,c=/[a-zA-Z_][a-zA-Z0-9_]*/,d={className:"number",variants:[a.BINARY_NUMBER_MODE,a.C_NUMBER_MODE]};return{name:"Tcl",aliases:["tk"],keywords:["after","append","apply","array","auto_execok","auto_import","auto_load","auto_mkindex","auto_mkindex_old","auto_qualify","auto_reset","bgerror","binary","break","catch","cd","chan","clock","close","concat","continue","dde","dict","encoding","eof","error","eval","exec","exit","expr","fblocked","fconfigure","fcopy","file","fileevent","filename","flush","for","foreach","format","gets","glob","global","history","http","if","incr","info","interp","join","lappend|10","lassign|10","lindex|10","linsert|10","list","llength|10","load","lrange|10","lrepeat|10","lreplace|10","lreverse|10","lsearch|10","lset|10","lsort|10","mathfunc","mathop","memory","msgcat","namespace","open","package","parray","pid","pkg::create","pkg_mkIndex","platform","platform::shell","proc","puts","pwd","read","refchan","regexp","registry","regsub|10","rename","return","safe","scan","seek","set","socket","source","split","string","subst","switch","tcl_endOfWord","tcl_findLibrary","tcl_startOfNextWord","tcl_startOfPreviousWord","tcl_wordBreakAfter","tcl_wordBreakBefore","tcltest","tclvars","tell","time","tm","trace","unknown","unload","unset","update","uplevel","upvar","variable","vwait","while"],contains:[a.COMMENT(";[ \\t]*#","$"),a.COMMENT("^[ \\t]*#","$"),{beginKeywords:"proc",end:"[\\{]",excludeEnd:!0,contains:[{className:"title",begin:"[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"[ \\t\\n\\r]",endsWithParent:!0,excludeEnd:!0}]},{className:"variable",variants:[{begin:b.concat(/\$/,b.optional(/::/),c,"(::",c,")*")},{begin:"\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*",end:"\\}",contains:[d]}]},{className:"string",contains:[a.BACKSLASH_ESCAPE],variants:[a.inherit(a.QUOTE_STRING_MODE,{illegal:null})]},d]}}},99134:a=>{a.exports=function(a){let b=a.regex,c=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,d=b.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),e=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,f=b.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:c,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[a.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:b.lookahead(b.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:c},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),a.HASH_COMMENT_MODE,{scope:"string",contains:[a.BACKSLASH_ESCAPE],variants:[a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),a.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[e,d]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,d]},{scope:{1:"punctuation",2:"number"},match:[f,d]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,d]}]},{scope:{3:"operator"},match:[c,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:e},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:f},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}},99626:a=>{"use strict";a.exports=JSON.parse('{"Aacute":"\xc1","aacute":"\xe1","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"\xc2","acirc":"\xe2","acute":"\xb4","Acy":"А","acy":"а","AElig":"\xc6","aelig":"\xe6","af":"⁡","Afr":"\uD835\uDD04","afr":"\uD835\uDD1E","Agrave":"\xc0","agrave":"\xe0","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"\xc5","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"\uD835\uDD38","aopf":"\uD835\uDD52","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"\xc5","aring":"\xe5","Ascr":"\uD835\uDC9C","ascr":"\uD835\uDCB6","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"\xc3","atilde":"\xe3","Auml":"\xc4","auml":"\xe4","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"\uD835\uDD05","bfr":"\uD835\uDD1F","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"\uD835\uDD39","bopf":"\uD835\uDD53","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"\xa6","bscr":"\uD835\uDCB7","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"\xc7","ccedil":"\xe7","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"\xb8","Cedilla":"\xb8","cemptyv":"⦲","cent":"\xa2","centerdot":"\xb7","CenterDot":"\xb7","cfr":"\uD835\uDD20","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"\xae","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"\uD835\uDD54","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"\xa9","COPY":"\xa9","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"\uD835\uDC9E","cscr":"\uD835\uDCB8","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"\xa4","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"\xb0","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"\uD835\uDD07","dfr":"\uD835\uDD21","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"\xb4","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"\xa8","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"\xf7","divide":"\xf7","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"\uD835\uDD3B","dopf":"\uD835\uDD55","Dot":"\xa8","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"\xa8","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"\uD835\uDC9F","dscr":"\uD835\uDCB9","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"\xc9","eacute":"\xe9","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"\xca","ecirc":"\xea","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"\uD835\uDD08","efr":"\uD835\uDD22","eg":"⪚","Egrave":"\xc8","egrave":"\xe8","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"\uD835\uDD3C","eopf":"\uD835\uDD56","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"\xd0","eth":"\xf0","Euml":"\xcb","euml":"\xeb","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"\uD835\uDD09","ffr":"\uD835\uDD23","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"\uD835\uDD3D","fopf":"\uD835\uDD57","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"\xbd","frac13":"⅓","frac14":"\xbc","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"\xbe","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"\uD835\uDCBB","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"\uD835\uDD0A","gfr":"\uD835\uDD24","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"\uD835\uDD3E","gopf":"\uD835\uDD58","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"\uD835\uDCA2","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"\xbd","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"\uD835\uDD25","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"\uD835\uDD59","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"\uD835\uDCBD","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"\xcd","iacute":"\xed","ic":"⁣","Icirc":"\xce","icirc":"\xee","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"\xa1","iff":"⇔","ifr":"\uD835\uDD26","Ifr":"ℑ","Igrave":"\xcc","igrave":"\xec","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"\uD835\uDD40","iopf":"\uD835\uDD5A","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"\xbf","iscr":"\uD835\uDCBE","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"\xcf","iuml":"\xef","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"\uD835\uDD0D","jfr":"\uD835\uDD27","jmath":"ȷ","Jopf":"\uD835\uDD41","jopf":"\uD835\uDD5B","Jscr":"\uD835\uDCA5","jscr":"\uD835\uDCBF","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"\uD835\uDD0E","kfr":"\uD835\uDD28","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"\uD835\uDD42","kopf":"\uD835\uDD5C","Kscr":"\uD835\uDCA6","kscr":"\uD835\uDCC0","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"\xab","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"\uD835\uDD0F","lfr":"\uD835\uDD29","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"\uD835\uDD43","lopf":"\uD835\uDD5D","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","lscr":"\uD835\uDCC1","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"\xaf","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"\uD835\uDD10","mfr":"\uD835\uDD2A","mho":"℧","micro":"\xb5","midast":"*","midcir":"⫰","mid":"∣","middot":"\xb7","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"\uD835\uDD44","mopf":"\uD835\uDD5E","mp":"∓","mscr":"\uD835\uDCC2","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":"\xa0","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"\uD835\uDD11","nfr":"\uD835\uDD2B","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":"\xa0","nopf":"\uD835\uDD5F","Nopf":"ℕ","Not":"⫬","not":"\xac","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"\uD835\uDCA9","nscr":"\uD835\uDCC3","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"\xd1","ntilde":"\xf1","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"\xd3","oacute":"\xf3","oast":"⊛","Ocirc":"\xd4","ocirc":"\xf4","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"\uD835\uDD12","ofr":"\uD835\uDD2C","ogon":"˛","Ograve":"\xd2","ograve":"\xf2","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"\uD835\uDD46","oopf":"\uD835\uDD60","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"\xaa","ordm":"\xba","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"\uD835\uDCAA","oscr":"ℴ","Oslash":"\xd8","oslash":"\xf8","osol":"⊘","Otilde":"\xd5","otilde":"\xf5","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"\xd6","ouml":"\xf6","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"\xb6","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"\uD835\uDD13","pfr":"\uD835\uDD2D","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"\xb1","plusmn":"\xb1","plussim":"⨦","plustwo":"⨧","pm":"\xb1","Poincareplane":"ℌ","pointint":"⨕","popf":"\uD835\uDD61","Popf":"ℙ","pound":"\xa3","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"\uD835\uDCAB","pscr":"\uD835\uDCC5","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"\uD835\uDD14","qfr":"\uD835\uDD2E","qint":"⨌","qopf":"\uD835\uDD62","Qopf":"ℚ","qprime":"⁗","Qscr":"\uD835\uDCAC","qscr":"\uD835\uDCC6","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"\xbb","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"\xae","REG":"\xae","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"\uD835\uDD2F","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"\uD835\uDD63","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"\uD835\uDCC7","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"\xa7","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"\uD835\uDD16","sfr":"\uD835\uDD30","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"\xad","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"\uD835\uDD4A","sopf":"\uD835\uDD64","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"\uD835\uDCAE","sscr":"\uD835\uDCC8","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"\xaf","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"\xb9","sup2":"\xb2","sup3":"\xb3","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"\xdf","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"\uD835\uDD17","tfr":"\uD835\uDD31","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"\xde","thorn":"\xfe","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"\xd7","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"\uD835\uDD4B","topf":"\uD835\uDD65","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"\uD835\uDCAF","tscr":"\uD835\uDCC9","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"\xda","uacute":"\xfa","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"\xdb","ucirc":"\xfb","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"\uD835\uDD18","ufr":"\uD835\uDD32","Ugrave":"\xd9","ugrave":"\xf9","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"\xa8","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"\uD835\uDD4C","uopf":"\uD835\uDD66","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"\uD835\uDCB0","uscr":"\uD835\uDCCA","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"\xdc","uuml":"\xfc","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"\uD835\uDD19","vfr":"\uD835\uDD33","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"\uD835\uDD4D","vopf":"\uD835\uDD67","vprop":"∝","vrtri":"⊳","Vscr":"\uD835\uDCB1","vscr":"\uD835\uDCCB","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"\uD835\uDD1A","wfr":"\uD835\uDD34","Wopf":"\uD835\uDD4E","wopf":"\uD835\uDD68","wp":"℘","wr":"≀","wreath":"≀","Wscr":"\uD835\uDCB2","wscr":"\uD835\uDCCC","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"\uD835\uDD1B","xfr":"\uD835\uDD35","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"\uD835\uDD4F","xopf":"\uD835\uDD69","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"\uD835\uDCB3","xscr":"\uD835\uDCCD","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"\xdd","yacute":"\xfd","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"\xa5","Yfr":"\uD835\uDD1C","yfr":"\uD835\uDD36","YIcy":"Ї","yicy":"ї","Yopf":"\uD835\uDD50","yopf":"\uD835\uDD6A","Yscr":"\uD835\uDCB4","yscr":"\uD835\uDCCE","YUcy":"Ю","yucy":"ю","yuml":"\xff","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","zfr":"\uD835\uDD37","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"\uD835\uDD6B","Zopf":"ℤ","Zscr":"\uD835\uDCB5","zscr":"\uD835\uDCCF","zwj":"‍","zwnj":"‌"}')},99896:a=>{a.exports=function(a){return{name:"JBoss CLI",aliases:["wildfly-cli"],keywords:{$pattern:"[a-z-]+",keyword:"alias batch cd clear command connect connection-factory connection-info data-source deploy deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias undeploy unset version xa-data-source",literal:"true false"},contains:[a.HASH_COMMENT_MODE,a.QUOTE_STRING_MODE,{className:"params",begin:/--[\w\-=\/]+/},{className:"function",begin:/:[\w\-.]+/,relevance:0},{className:"string",begin:/\B([\/.])[\w\-.\/=]+/},{className:"params",begin:/\(/,end:/\)/,contains:[{begin:/[\w-]+ *=/,returnBegin:!0,relevance:0,contains:[{className:"attr",begin:/[\w-]+/}]}],relevance:0}]}}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[1331,3644,6015,129,9968,180,7013,9355,3451,646],()=>b(b.s=31975));module.exports=c})();