cezarion 0.19.0-dev.8696 → 0.19.0-dev.8704

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 (79) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-RDVTJfi7.js → accounts-section-CzFhdKWy.js} +1 -1
  3. package/web/dist/assets/activity-motion-D0Fch0mc.js +2 -0
  4. package/web/dist/assets/{activity-route-CjE0yxn0.js → activity-route-Cvw0jXpy.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-DQ1RaVK2.js → agent-config-section-BCzxsvys.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-Dzm7jIza.js → agent-defaults-section-DMRK-Qlp.js} +1 -1
  7. package/web/dist/assets/{appearance-DQLHHfI4.js → appearance-Ew3vb_-K.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-C7_Fwy2A.js → archive-on-merge-field-g87CG6RL.js} +1 -1
  9. package/web/dist/assets/attention-80jX8HhC.js +1 -0
  10. package/web/dist/assets/automations-route-CRBtWEo1.js +2 -0
  11. package/web/dist/assets/commit-list-Cd14tNSj.js +1 -0
  12. package/web/dist/assets/diff-D55N_7Ul.js +3 -0
  13. package/web/dist/assets/{diff-controls-BRa3141W.js → diff-controls-CmYvdEGt.js} +1 -1
  14. package/web/dist/assets/diff-stat-U7DT4Ilj.js +1 -0
  15. package/web/dist/assets/{diff-view-CwlKCj5V.js → diff-view-DV6muJdZ.js} +1 -1
  16. package/web/dist/assets/{file-preview-VvCzp02k.js → file-preview-CTPfK-oR.js} +1 -1
  17. package/web/dist/assets/{folder-browser-B7IbnF0d.js → folder-browser-DnSFycbU.js} +1 -1
  18. package/web/dist/assets/git-toolbar-Dc_o1nrh.js +1 -0
  19. package/web/dist/assets/github-WYk7bQID.js +1 -0
  20. package/web/dist/assets/{global-activity-route-C4-bmfh_.js → global-activity-route-Dvx2uk8w.js} +1 -1
  21. package/web/dist/assets/image-preview-2S3PEy8S.js +1 -0
  22. package/web/dist/assets/index-CGdnowj-.js +21 -0
  23. package/web/dist/assets/index-DAxuDJAo.css +1 -0
  24. package/web/dist/assets/{label-Bt8n7Spq.js → label-o_DsEmPt.js} +1 -1
  25. package/web/dist/assets/{live-reads-Crd6fVGH.js → live-reads-Cgk2XbiP.js} +1 -1
  26. package/web/dist/assets/{markdown-9L65ixU6.js → markdown-CJzxFk0P.js} +1 -1
  27. package/web/dist/assets/{notifications-section-QWmuj2j2.js → notifications-section-DNYO4sd4.js} +1 -1
  28. package/web/dist/assets/{open-in-menu-BPp88ouw.js → open-in-menu-Bzae69TK.js} +1 -1
  29. package/web/dist/assets/{preview-pane-connected-DAM2Snwh.js → preview-pane-connected-CRooCkyb.js} +2 -2
  30. package/web/dist/assets/{project-location-BRxXN249.js → project-location-D6riKh0Z.js} +1 -1
  31. package/web/dist/assets/{project-router-CLJTc7gv.js → project-router-CZ89wg-5.js} +1 -1
  32. package/web/dist/assets/{project-scope-context-Rv6S_BXt.js → project-scope-context-DIcqj4jJ.js} +2 -2
  33. package/web/dist/assets/{projects-section-DxubjpZI.js → projects-section-4rsb8E52.js} +1 -1
  34. package/web/dist/assets/{prompt-templates-section-CkQneT1G.js → prompt-templates-section-G3dlAOXt.js} +1 -1
  35. package/web/dist/assets/{queries-qCF-eOqZ.js → queries-DZhNVAD_.js} +1 -1
  36. package/web/dist/assets/{reference-chip-D0v0keVC.js → reference-chip-DSJSqjmO.js} +1 -1
  37. package/web/dist/assets/{remote-settings-notice-COojb6XK.js → remote-settings-notice-GNs7i0kP.js} +1 -1
  38. package/web/dist/assets/repo-git-CvZTTKFl.js +1 -0
  39. package/web/dist/assets/{report-reader-zWwalJDN.js → report-reader-CLlNdsZG.js} +1 -1
  40. package/web/dist/assets/reports-sl2SMDG1.js +1 -0
  41. package/web/dist/assets/{resources-section-Cb2WIqNv.js → resources-section-DhEoaA0K.js} +1 -1
  42. package/web/dist/assets/run-header-DZoOLIBZ.js +2 -0
  43. package/web/dist/assets/{select-y3oRuA2s.js → select-D3snxxoD.js} +1 -1
  44. package/web/dist/assets/{session-context-section-CiPNMiL7.js → session-context-section-esqZfONg.js} +2 -2
  45. package/web/dist/assets/{settings-agent-picker-CJJJncuA.js → settings-agent-picker-Dso2TmRM.js} +1 -1
  46. package/web/dist/assets/{settings-shell-CLToW28f.js → settings-shell-UO_0dSGl.js} +1 -1
  47. package/web/dist/assets/{sidebar-section-VOYJarPd.js → sidebar-section-pp7e3AZa.js} +1 -1
  48. package/web/dist/assets/{skills-BySF3yBA.js → skills-B99glme7.js} +1 -1
  49. package/web/dist/assets/{tab-link-Bu1g-ArE.js → tab-link-BGXFZZ_Z.js} +1 -1
  50. package/web/dist/assets/task-changes-Tn9M2OPH.js +1 -0
  51. package/web/dist/assets/task-commits-BHDMp1sO.js +1 -0
  52. package/web/dist/assets/{task-files-Bu-L_NRW.js → task-files-Csx1Bonx.js} +1 -1
  53. package/web/dist/assets/{task-github-item-DhiTqCjk.js → task-github-item-D0kQ0K4S.js} +1 -1
  54. package/web/dist/assets/{task-groups-4tzKGROI.js → task-groups-DK0I9p71.js} +1 -1
  55. package/web/dist/assets/{task-thread-CKkTeQdi.js → task-thread-DsMuGSug.js} +9 -9
  56. package/web/dist/assets/{tasks-table-C5uoZMFs.js → tasks-table-BNFYIwtc.js} +1 -1
  57. package/web/dist/assets/{thread-state-B_ZqjjRr.js → thread-state-DMWi6eLk.js} +1 -1
  58. package/web/dist/assets/{toaster-BXnLIU3z.js → toaster-0sM0sfWx.js} +1 -1
  59. package/web/dist/assets/use-hand-to-agent-state-DqCW8Giu.js +1 -0
  60. package/web/dist/assets/{workflows-DlTkuM0J.js → workflows-CxJvAn6z.js} +3 -3
  61. package/web/dist/assets/{workspace-tools-BRK7f1Hk.js → workspace-tools-DqJ8akIy.js} +1 -1
  62. package/web/dist/assets/{worktrees-section-BXI0-7HH.js → worktrees-section-DBZZlAe0.js} +4 -4
  63. package/web/dist/index.html +16 -15
  64. package/web/dist/assets/activity-motion-B7km8QVK.js +0 -2
  65. package/web/dist/assets/attention-CBCeJN5w.js +0 -1
  66. package/web/dist/assets/automations-route-BcdL5f0K.js +0 -2
  67. package/web/dist/assets/commit-list-CN1zX-0X.js +0 -1
  68. package/web/dist/assets/diff-hxqBOfZH.js +0 -3
  69. package/web/dist/assets/git-toolbar-BulcGzsv.js +0 -1
  70. package/web/dist/assets/github-By3yOcFH.js +0 -1
  71. package/web/dist/assets/image-preview-Pgf8bnzY.js +0 -1
  72. package/web/dist/assets/index-C69_Sk06.css +0 -1
  73. package/web/dist/assets/index-DNQcTHxV.js +0 -21
  74. package/web/dist/assets/repo-git-Mgk4Qcmo.js +0 -1
  75. package/web/dist/assets/reports-BCHWt3zy.js +0 -1
  76. package/web/dist/assets/run-header-DeprqSP7.js +0 -2
  77. package/web/dist/assets/task-changes-NUwvUglx.js +0 -1
  78. package/web/dist/assets/task-commits-CpV1Hz9L.js +0 -1
  79. package/web/dist/assets/use-hand-to-agent-state-K864D69i.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{F as o,I as s,Nn as c,Pt as l,ot as u,pi as d,s as f,u as p}from"./project-scope-context-Rv6S_BXt.js";import{Z as m}from"./live-protocol-DMhTnCmf.js";import{n as h}from"./toaster-BXnLIU3z.js";import{Bt as g,C as _,E as v,Qt as y,T as b,Ut as x,W as S,bt as C,j as ee,n as w,rt as T,vt as te,w as E}from"./queries-qCF-eOqZ.js";import{g as ne,h as re}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as D}from"./tasks-table-C5uoZMFs.js";import{A as ie,C as ae,E as oe,F as se,J as ce,M as le,X as ue,Y as de,at as fe,j as pe,n as me,ot as O,s as he,u as ge,v as _e,x as ve}from"./design-icons-CzEoMH9c.js";import{t as ye}from"./createLucideIcon-BHp8sXmF.js";import{n as be,t as xe}from"./circle-x-7nTlobAF.js";import{_ as Se}from"./nav-row-styles-DKeXbc4N.js";import{i as Ce,r as we,t as Te}from"./git-toolbar-BulcGzsv.js";import{t as k}from"./info-DA1x_4bz.js";import{t as Ee}from"./loader-circle-CPBhhDbB.js";import{n as De,r as Oe}from"./diff-controls-BRa3141W.js";import{c as ke,i as Ae,l as je,t as Me}from"./reference-chip-D0v0keVC.js";import{t as A}from"./button-B7MKxYjT.js";import{i as j,l as Ne,p as Pe,r as Fe,t as Ie}from"./dropdown-menu-4e2iKSMT.js";import{t as M}from"./project-router-CLJTc7gv.js";import{t as Le}from"./status-dot-BRzVlF2X.js";import{a as N,o as Re}from"./format-BU7D3IfE.js";import{d as ze,n as Be,o as P,s as Ve,t as He,u as Ue}from"./page-shell-7pLJMOgh.js";import{t as F}from"./centered-state-V15AR_qo.js";import{At as We,Bt as Ge,D as I,E as Ke,Ft as qe,Gt as L,Ht as R,It as z,Jt as B,Kt as V,Lt as Je,Mt as Ye,Nt as Xe,Ot as Ze,Pt as Qe,Rt as $e,Ut as H,Vt as et,Wn as U,Wt as W,Yt as G,Zn as tt,en as K,ir as nt,jt as rt,kt as it,or as at,qt as q,zt as ot}from"./index-DNQcTHxV.js";import{t as st}from"./markdown-BBDDg-4t.js";import{t as ct}from"./diff-hxqBOfZH.js";import{t as lt}from"./change-counts-CW7O8g5Y.js";import{n as ut,r as dt}from"./commit-list-CN1zX-0X.js";var J=e(t(),1);function ft(e,t){let n=d(t),r=n.getQueryCache();return J.useSyncExternalStore(J.useCallback(e=>r.subscribe(m.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var pt=ye(`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`}]]),mt=ye(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),Y=n();function ht(){let e=r(),t=_(),n=d(),i=ft({queryKey:g.repo})>0,o=t.data?.info?t.data:null,s=Ze(e,o,`screen`);return(0,Y.jsx)(Ue,{route:`repo-git`,density:o?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Y.jsx)(Ve,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:g.repo}),n.invalidateQueries({queryKey:g.worktrees})},children:(0,Y.jsx)(de,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,Y.jsxs)(`div`,{"data-slot":`git-screen`,children:[o?.info?(0,Y.jsx)(`div`,{className:`mb-[16px]`,children:(0,Y.jsx)(rt,{scope:e,repo:o,info:o.info,variant:`screen`},e)}):t.isPending?(0,Y.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,Y.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,Y.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,Y.jsx)(it,{branch:o?.info?.branch??null,counts:s,variant:`screen`})]})})}function gt({entry:e}){return e.keptReason?(0,Y.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function _t({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=te(),c=E(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=d(),p=y({mutationFn:e=>f({name:e},n),onSuccess:async e=>{h(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([u.invalidateQueries({queryKey:i}),u.invalidateQueries({queryKey:o})]),u.setQueryData(i,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),u.setQueryData(o,t=>Xe(t,n,e.branch))},onError:e=>h(e.message,{tone:`danger`})}),[m,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),b=_.trim().toLowerCase(),x=X(e,c.data?.branches),S=b?x.filter(e=>e.toLowerCase().includes(b)):x;return(0,Y.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_290px]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Y.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Y.jsxs)(`label`,{className:`relative block`,children:[(0,Y.jsx)(ue,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Y.jsx)(U,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Y.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[S.map(e=>{let n=e===t.branch,r=l.get(e);return(0,Y.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Y.jsx)(M,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Y.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,Y.jsx)(St,{entry:r}):null]}),r?(0,Y.jsx)(gt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Y.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,Y.jsxs)(A,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:p.isPending,onClick:()=>p.mutate(e),children:[(0,Y.jsx)(ie,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),S.length===0?(0,Y.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Y.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&p.mutate(t,{onSuccess:()=>g(``)})},children:[(0,Y.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Y.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Y.jsx)(`span`,{className:`font-mono text-[11px] text-foreground`,children:t.branch}),`.`]}),(0,Y.jsx)(U,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-muted-foreground/70`,value:m,onChange:e=>g(e.target.value)}),(0,Y.jsxs)(A,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!m.trim()||p.isPending,children:[(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Y.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,Y.jsx)(vt,{}):null]})}function vt(){let e=w({limit:20});return(0,Y.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Y.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Y.jsx)(yt,{pr:e},e.number))}):(0,Y.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function yt({pr:e}){let t=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(se,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Y.jsx)(bt,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Y.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,Y.jsx)(`span`,{className:n,children:t})})}function bt({checks:e}){let t=e===`passing`?be:e===`failing`?xe:nt;return(0,Y.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:a(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,Y.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var xt={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function St({entry:e}){return(0,Y.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-[11px] leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:xt[e.class]})}function X(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function Ct(){let e=b(),t=K(),[n,r]=(0,J.useState)(`unified`),[i,a]=(0,J.useState)(!0),[o,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),f=e.isError&&e.error instanceof c&&e.error.status===409,p=e.data?.files??[],m=(0,J.useMemo)(()=>we(p),[p]),h=(0,J.useMemo)(()=>p.some(st),[p]),g=t?n:`unified`;return(0,Y.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Y.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Y.jsx)(F,{icon:f?(0,Y.jsx)(ae,{size:16}):(0,Y.jsx)(O,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,Y.jsx)(F,{icon:(0,Y.jsx)(ae,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button]:min-h-11`,children:[e.data?(0,Y.jsx)(Te,{stat:e.data.stat}):null,(0,Y.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,Y.jsx)(Oe,{preview:o,onPreviewChange:s}):null,(0,Y.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Y.jsx)(De,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 [--diff-sticky-top:1rem] md:flex-row md:items-start`,children:[(0,Y.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,Y.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Y.jsx)(Ce,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Y.jsx)(ct,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function wt({repo:e,info:t}){let{sha:n}=re(),r=e.log,i=(0,J.useMemo)(()=>et(r),[r]);if(n)return(0,Y.jsx)(Dt,{sha:n});let a=Je(e,t),o=a&&a.behind>0?(0,Y.jsx)(Et,{info:t,tracking:a}):null;return r.length===0?(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsx)(`div`,{children:o}):null,(0,Y.jsx)(F,{icon:(0,Y.jsx)(pe,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Y.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Y.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Y.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Y.jsxs)(M,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Y.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Y.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(ut,{sha:e.hash}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Y.jsx)(`span`,{title:Ge(e.when,e.at),children:ot(e.when,e.at)})]})]})]}),(0,Y.jsx)(Tt,{source:e.source})]},e.hash))})]},e.label))]})}function Tt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-[11.5px] text-muted-foreground md:flex`;return e?(0,Y.jsxs)(M,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:a(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(le,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Y.jsx)(he,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Y.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Et({info:e,tracking:t}){let n=Qe(r(),e),i=(0,J.useRef)(null);return(0,Y.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,Y.jsx)(pt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,Y.jsxs)(`button`,{ref:i,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,Y.jsx)(Ee,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Y.jsx)(me,{"aria-hidden":`true`}),`Pull`]}),(0,Y.jsx)(Ye,{checkout:n,returnFocus:i})]})}function Dt({sha:e}){return(0,Y.jsx)(dt,{commit:v(e),sha:e,backTo:K()?`/git`:qe,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-9`})}var Z=`Squash-merged branches may show as not landed without GitHub`;function Ot(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function kt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var At={done:`success`,failed:`danger`,cancelled:`neutral`};function jt(){let e=E(),t=T(),n=r(),i=C(),[a,o]=(0,J.useState)(null);if(e.isPending)return(0,Y.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,Y.jsx)(F,{icon:(0,Y.jsx)(O,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Ot(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=kt(e.data.branches),u=l>0?(0,Y.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Y.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,Y.jsx)(M,{to:z.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,d=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,Y.jsxs)(Ae,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Y.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,Y.jsx)(Mt,{}),u,s.length===0?(0,Y.jsx)(He,{icon:(0,Y.jsx)(tt,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:z.cleanup,children:`Check cleanup`})}),(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:`/`,children:`View tasks`})})]})}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Y.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Y.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{children:e.note})]}):null]}),(0,Y.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Y.jsx)(Nt,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Y.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,Y.jsx)(Be,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Y.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Y.jsx)(M,{to:z.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Y.jsx)(Rt,{entry:a,onClose:()=>o(null)})]})}function Mt({className:e}){return(0,Y.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),Z,`.`]})}function Nt({entry:e,finishedAt:t,onDelete:n}){return(0,Y.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Y.jsx)(It,{entry:e,finishedAt:t}),(0,Y.jsx)(Pt,{entry:e}),(0,Y.jsx)(Ft,{entry:e,onDelete:n})]})}function Pt({entry:e}){return(0,Y.jsx)(Y.Fragment,{children:e.pr?(0,Y.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,Y.jsx)(Me,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,Y.jsx)(Lt,{entry:e})]}):null})}function Ft({entry:e,onDelete:t}){let n=d(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!r&&e.runId!==null&&!i,s=y({mutationFn:()=>u(e.runId),onSuccess:e=>{h(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:g.repoBranches}),n.invalidateQueries({queryKey:g.runs.all})},onError:e=>h(e instanceof c&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),l=()=>void navigator.clipboard.writeText(e.name).then(()=>h(`Copied ${e.name}`),()=>h(`Could not copy the branch name`,{tone:`danger`})),f=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,Y.jsxs)(Y.Fragment,{children:[e.runId?(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Y.jsx)(mt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,Y.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:l,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Y.jsx)(_e,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,Y.jsxs)(Ie,{children:[(0,Y.jsx)(Pe,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,Y.jsx)(ve,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Y.jsxs)(Fe,{align:`end`,className:`w-52`,children:[e.runId?(0,Y.jsx)(j,{asChild:!0,className:`md:hidden`,children:(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Y.jsx)(j,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Y.jsx)(j,{className:a(!r&&`md:hidden`),onSelect:l,children:`Copy branch`}),(0,Y.jsx)(Ne,{className:`md:hidden`}),(0,Y.jsx)(j,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function It({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=N(i),o=n||!e.runStatus?a:`${e.runStatus}${a?` ${a}`:``}`,s=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Y.jsx)(Se,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Y.jsx)(Le,{tone:e.runStatus&&At[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,Y.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Y.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Y.jsx)(Q,{}),(0,Y.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(lt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,o?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{className:`truncate`,title:s,children:o})]}):null]}),e.parentRunId?(0,Y.jsx)(M,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,Y.jsx)(gt,{entry:e})]})]})}function Q(){return(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Lt({entry:e}){let t=x(ke(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Q,{}),(0,Y.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Rt({entry:e,onClose:t}){let n=d(),[r,i]=(0,J.useState)(``),a=(0,J.useId)(),o=y({mutationFn:e=>p({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;h(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:g.repo}),s()},onError:e=>h(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,Y.jsx)(R,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Y.jsxs)(L,{"data-slot":`delete-branch-dialog`,children:[(0,Y.jsxs)(B,{children:[(0,Y.jsxs)(G,{children:[`Delete `,e?.name,`?`]}),(0,Y.jsx)(V,{asChild:!0,children:(0,Y.jsxs)(`div`,{className:`space-y-2`,children:[(0,Y.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Y.jsxs)(Y.Fragment,{children:[`This drops the work of `,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,Y.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,Y.jsx)(`span`,{className:`font-mono`,title:e?.lastCommit.sha,children:e?.lastCommit.sha.slice(0,8)}),`).`]})]})})]}),(0,Y.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Y.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Y.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Y.jsx)(U,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Y.jsx)(H,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function zt({base:e}){let t=E(),n=d(),[r,i]=(0,J.useState)({merged:!1,empty:!1}),[a,o]=(0,J.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=y({mutationFn:e=>p({names:e}),onSuccess:e=>{let t=e.refused.length;h(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:g.repo})},onError:e=>{n.invalidateQueries({queryKey:g.repo}),h(e.message,{tone:`danger`})}});if(t.isPending)return(0,Y.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Y.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let f=l.length,m=`branch${f===1?``:`es`}`;return(0,Y.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,f]}),(0,Y.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Y.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:f===0||u.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Y.jsx)(fe,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${f} ${m}`]})]}),(0,Y.jsx)(Bt,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:Z.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Y.jsx)(Bt,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Y.jsx)(R,{open:a,onOpenChange:o,children:(0,Y.jsxs)(L,{children:[(0,Y.jsxs)(B,{children:[(0,Y.jsxs)(G,{children:[`Delete `,f,` `,m,`?`]}),(0,Y.jsxs)(V,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{children:`Keep them`}),(0,Y.jsxs)(H,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,f,` `,m]})]})]})})]})}function Bt({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Y.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,Y.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,Y.jsx)(ge,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,Y.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,Y.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,Y.jsx)(M,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Y.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Y.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:N(e.lastCommit.at)})]},e.name))}):null]})}function Vt(){let e=ee(),t=S().data?.targets.find(e=>e.id===`finder`),n=y({mutationFn:e=>l(e,t.id),onError:e=>h(e.message,{tone:`danger`})}),r=d(),[i,a]=(0,J.useState)(!1),c=()=>Promise.all([r.invalidateQueries({queryKey:g.worktrees}),r.invalidateQueries({queryKey:g.repoBranches})]),u=y({mutationFn:e=>s(),onSuccess:(e,t)=>{c();let n=e.reclaimed.length,r=Math.max(0,t-n);h(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>h(e.message,{tone:`danger`})}),f=y({mutationFn:e=>o(e.runId),onSuccess:(e,t)=>{c(),h(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{c(),h(e.message,{tone:`danger`})}});if(e.isPending)return(0,Y.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Y.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:p,totalBytes:m,keep:_}=e.data,v=u.isPending||f.isPending,b=p.filter(e=>e.pastKeep),x=b.length>0,C=b.some(e=>e.sizeBytes===null)?null:b.reduce((e,t)=>e+(t.sizeBytes??0),0),w=x?C?`Reclaim ${D(C)} now`:`Reclaim ${b.length} now`:`Reclaim now`,T=m?D(m):null;return(0,Y.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,T?` · ${T}`:``]}),(0,Y.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[_===0?`Retention is unlimited (`:`Retention keeps the newest ${_} finished checkout${_===1?``:`s`} (`,(0,Y.jsx)(M,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:je(`worktrees`,` › `)}),_===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,Y.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:v||!x,title:x?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Y.jsx)(at,{"aria-hidden":`true`,className:`size-[12px]`}),w]})]}),p.length===0?(0,Y.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Y.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:p.map(e=>(0,Y.jsx)(Wt,{worktree:e,keep:_,disabled:v,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>f.mutate(e)},e.runId))}),(0,Y.jsx)(R,{open:i,onOpenChange:a,children:(0,Y.jsxs)(L,{children:[(0,Y.jsxs)(B,{children:[(0,Y.jsx)(G,{children:`Reclaim old worktrees?`}),(0,Y.jsxs)(V,{children:[b.length,` finished worktree`,b.length===1?``:`s`,` beyond the keep limit`,C?` (${D(C)})`:``,` `,b.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{children:`Keep them`}),(0,Y.jsx)(H,{"data-action":`worktrees-confirm`,onClick:()=>{u.mutate(b.length),a(!1)},children:w})]})]})})]})}var Ht=new Set([`queued`,`running`,`waiting`,`review`]);function Ut(e,t){return Ht.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function Wt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=Ut(e,t),c=N(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Re(c)}`:e.status,u=(0,Y.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:a(`text-[11.5px]`,s.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:s.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,Y.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Y.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Y.jsxs)(`span`,{className:`truncate font-mono text-[11px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Y.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Y.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:D(e.sizeBytes)||`0 kB`}),(0,Y.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,Y.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Y.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:o,className:d,children:(0,Y.jsx)(at,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function $(e){return e===`main`||e===`changes`?`Split`:`Table`}function Gt({section:e,index:t=!1}){let n=_(),r=K(),[i]=ne(),a=$(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Y.jsx)(ht,{});if(n.isPending)return(0,Y.jsx)(Ke,{});if(n.isError)return(0,Y.jsx)(P,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Y.jsx)(I,{}),children:(0,Y.jsx)(F,{icon:(0,Y.jsx)(O,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let o=n.data.info;return o?(0,Y.jsx)(Kt,{repo:n.data,info:o,section:e}):(0,Y.jsx)(P,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Y.jsx)(I,{}),children:(0,Y.jsx)(F,{icon:(0,Y.jsx)(ie,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Kt({repo:e,info:t,section:n}){let r=$(n),i=E(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?X(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,Y.jsx)(P,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:ze(a),rootProps:{"data-git-section":n},beforeHeader:(0,Y.jsx)(I,{}),header:{title:We(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Y.jsx)(qt,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Y.jsx)(wt,{repo:e,info:t}):n===`not-landed`?(0,Y.jsx)(jt,{}):n===`cleanup`?(0,Y.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,Y.jsx)(Vt,{}),(0,Y.jsx)(zt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Y.jsx)(_t,{repo:e,info:t}):(0,Y.jsx)(Ct,{})})}function qt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Y.jsxs)(Y.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${$e(e.tracking)}`:``]});case`not-landed`:return(0,Y.jsxs)(Y.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Y.jsx)(Jt,{repo:e,info:t});case`changes`:return(0,Y.jsxs)(Y.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Y.jsxs)(Y.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Jt({repo:e,info:t}){let n=X(e,E().data?.branches).length;return(0,Y.jsxs)(Y.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Gt as RepoGitRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{r as a,t as o}from"./live-reads-Crd6fVGH.js";import{Br as s,Fn as c,Hr as l,Ln as u,Pn as d,di as f,pi as p,vr as m}from"./project-scope-context-Rv6S_BXt.js";import{B as h,F as g,I as _,J as v,N as y,W as b,Y as x,z as S}from"./live-protocol-DMhTnCmf.js";import{r as C}from"./toaster-BXnLIU3z.js";import{N as w}from"./queries-qCF-eOqZ.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as ee}from"./design-icons-CzEoMH9c.js";import{t as te}from"./arrow-up-right-DKGzsMqY.js";import{t as D}from"./chevron-right-BENZ-1ZN.js";import{t as O}from"./eye-B8okNWXU.js";import{t as k}from"./button-B7MKxYjT.js";import{t as A}from"./project-router-CLJTc7gv.js";import{a as j}from"./format-BU7D3IfE.js";import{d as M,l as ne,n as N,r as P,t as F}from"./page-shell-7pLJMOgh.js";import{$n as I,Wn as L,_n as R,b as z,en as B}from"./index-DNQcTHxV.js";import{t as V}from"./html-report-frame-uuqkBC0u.js";import{t as H}from"./report-title-D4Mbu2Er.js";var U=e(t(),1),W=1e3,G=b().min(1).max(1024);h({q:b().max(W).optional(),before:G.optional(),limit:b().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var K=h({reports:y(h({id:v(),runId:v(),name:b(),title:b(),createdAt:x(),size:S().int().nonnegative(),taskTitle:b(),taskStatus:m}).strict()),nextCursor:G.nullable(),total:S().int().nonnegative()}).strict(),q=h({epoch:v(),generation:S().int().nonnegative(),metadataGeneration:S().int().nonnegative()}).strict(),re=h({runId:v(),taskTitle:b(),taskStatus:m}).strict(),J=g(`type`,[q.extend({type:_(`snapshot`)}),q.extend({type:_(`content`)}),q.extend({type:_(`metadata`),runs:y(re)})]),Y=new WeakMap;function X(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var ie=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=X(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ae(e,t){let n=Y.get(e);n||(n=new Map,Y.set(e,n));let r=n.get(t);return r||(r=new ie(e,t),n.set(t,r)),r}async function oe(e,t){let n=await d.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},c({signal:t}));return q.parse(await u(n,`/reports/state`))}function se(e){let t=ae(p(),e);return(0,U.useEffect)(()=>{let n=a(`reports:project:${e}`,e=>{let n=J.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,c=()=>{if(s()===`finite`&&!r){i=new AbortController;let n=i.signal;oe(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=o({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=q.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else s()!==`finite`&&(i?.abort(),r?.(),r=void 0)};c();let u=l(c);return()=>{u(),i?.abort(),r?.(),n()}},[t,e]),t}async function ce(e,t,n,r){let i=await d.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,W),...n?{before:n}:{}}},c(r?{signal:r}:void 0));return K.parse(await u(i,`/reports`))}function le(e){let t=r(),n=se(t);return C({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>ce(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Z=n(),Q=new Map;function ue(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function de(e){let t=B(),[n,r]=(0,U.useState)(!1);return(0,U.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function fe(){let e=T(),t=E(),[n,r]=z(),a=(n.get(`q`)??``).slice(0,W),o=le(a),s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{Q.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,U.useState)(null),h=de(s);(0,U.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=Q.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,W)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:M(d.length);return(0,Z.jsx)(ne,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Z.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Z.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Z.jsx)(L,{maxLength:W,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Z.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Z.jsx)(F,{icon:(0,Z.jsx)(I,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Z.jsxs)(Z.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Z.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[R(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Z.jsx)(k,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Z.jsx)(A,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(P,{list:(0,Z.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Z.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Z.jsx)(I,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Z.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:H(e),children:(0,Z.jsx)(A,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:H(e)})})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Z.jsx)(A,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:e.createdAt,title:ue(e.createdAt),children:$(e.createdAt)})]})]}),h?(0,Z.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${H(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Z.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(D,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(k,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Z.jsx)(N,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Z.jsx)(pe,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function pe({report:e,restoreKey:t,onOpenReader:n}){let r=(0,U.useContext)(f)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${H(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:H(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,$(e.createdAt)]})]}),(0,Z.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Z.jsxs)(A,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Z.jsx)(te,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Z.jsx)(me,{report:e}):(0,Z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function me({report:e}){let t=w(e.runId,e.id);if(t.isPending)return(0,Z.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Z.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Z.jsx)(`p`,{children:t.error.message}),(0,Z.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Z.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Z.jsx)(V,{html:n.content,title:H(e),className:`min-h-0 flex-1`})}function $(e){let t=j(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{fe as ReportsRoute};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{m as a}from"./live-reads-Crd6fVGH.js";import{$ as o,Ft as s,Nn as c,On as l,Pt as u,_r as d,ct as f,ir as p,or as m,pi as h}from"./project-scope-context-Rv6S_BXt.js";import{n as g}from"./toaster-BXnLIU3z.js";import{Bt as _,G as v,H as y,K as b,Qt as x,St as S,U as C,W as w,Xt as T,Y as E,Zt as D,bt as O,ct as k,f as ee,rt as te,tt as ne,vt as re,xt as ie}from"./queries-qCF-eOqZ.js";import{d as ae,h as oe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as se,d as ce,f as le,g as ue,m as de,o as fe,p as pe,s as me}from"./tasks-table-C5uoZMFs.js";import{F as he,at as ge,ft as A,i as j,l as _e,p as ve,q as ye,t as be,v as M,x as xe}from"./design-icons-CzEoMH9c.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as Se}from"./app-window-CSHwDX9N.js";import{n as Ce,r as we,t as Te}from"./open-in-menu-BPp88ouw.js";import{t as Ee}from"./info-DA1x_4bz.js";import{t as De}from"./message-square-B-MD-8rD.js";import{i as Oe,n as ke,t as P}from"./reference-chip-D0v0keVC.js";import{t as F}from"./square-terminal-B6RYYieR.js";import{t as I}from"./button-B7MKxYjT.js";import{a as L,i as R,l as z,n as B,p as V,r as H,t as U}from"./dropdown-menu-4e2iKSMT.js";import{i as Ae,r as je,t as Me}from"./popover-BPgUYFyu.js";import{a as Ne,i as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-B531GGAo.js";import{c as ze,s as Be,t as W}from"./project-router-CLJTc7gv.js";import"./attention-CBCeJN5w.js";import{T as Ve,f as G,u as He}from"./task-groups-4tzKGROI.js";import{t as Ue}from"./status-dot-BRzVlF2X.js";import{t as We}from"./format-BU7D3IfE.js";import{$n as Ge,B as Ke,Gt as qe,Ht as Je,Jn as Ye,Jt as K,Kt as Xe,Mn as Ze,Nn as Qe,R as $e,Ut as et,Wt as tt,Yn as nt,Yt as rt,a as it,dn as q,fn as J,jn as at,m as ot,o as st,qt as ct,r as lt,rn as ut,sn as dt,sr as ft,tn as pt,xn as mt,z as ht}from"./index-DNQcTHxV.js";import{r as gt,t as _t}from"./markdown-9L65ixU6.js";import{t as vt}from"./textarea-vJt9undk.js";import{t as Y}from"./tab-link-Bu1g-ArE.js";var yt=N(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),bt=N(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),xt=N(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),X=e(t(),1),Z=n();function St(e){let t=k();return x({mutationFn:t=>o(D(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>T()),onError:e=>g(e.message,{tone:`danger`})})}function Ct(e){return e.archived?`Unarchive`:`Archive task`}function wt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Z.jsx)(Je,{open:t,onOpenChange:n,children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{children:`Archive task?`}),(0,Z.jsxs)(Xe,{children:[`Move “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Tt({run:e,className:t}){let[n,r]=(0,X.useState)(!1),a=St(e.id),o=Ct(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,Z.jsx)(ft,{"aria-hidden":`true`}):(0,Z.jsx)(be,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:o})]}),(0,Z.jsx)(wt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Et({run:e,action:t,prUrl:n,patch:i}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Z.jsx)(I,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>g(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Dt({run:e,blocker:t,flags:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Z.jsx)(Tt,{run:e}):null]})]})}function Ot({run:e}){let t=v(e.id),n=J(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Z.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Z.jsx)(Et,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Z.jsx)(Dt,{run:e,blocker:i,flags:n}):null]})}var kt=[`running`,`queued`,`waiting`];function At(e,{queuePosition:t,now:n=new Date}){let r=l(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=kt.includes(e.status)?Mt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Mt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:We(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),g(t)}catch{g(`Run manually: ${e}`)}}function Nt(e){let t=O(),n=ee(),r=(0,X.useMemo)(()=>ue(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,X.useMemo)(()=>n===void 0?[]:r.filter(e=>se(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Pt(e){return x({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof c&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}g(e.message,{tone:`danger`})}})}function $(e,t){let n=w(),r=S(),i=a(),o=x({mutationFn:t=>u(e.id,t),onError:e=>g(e.message,{tone:`danger`})}),s=mt(),c=Ve(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,d=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&d(dt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Ce(e.id);return t===void 0||i.isSuccess&&d(t)}).map(t=>({target:t,...ut(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Ft({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=a().data,c=q(e);return!r&&i.length===0&&!c?null:(0,Z.jsxs)(Z.Fragment,{children:[r||i.length>0?(0,Z.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Z.jsxs)(I,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Z.jsx)(F,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=we(e,s);return(0,Z.jsxs)(I,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>g(`Worktree path copied`)).catch(()=>g(`Path: ${t}`))},children:[(0,Z.jsx)(M,{}),`Copy worktree path`]}):null]}):null,c?(0,Z.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Z.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Z.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:c}),(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>void Q(c,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{}),`Copy resume command`]})]}):null]})}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=$(e,t),o=q(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Z.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Z.jsx)(Te,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Z.jsxs)(R,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Q(s,`Worktree path copied`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Q(o,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Lt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=$(e,t);return!a&&o.length===0?null:r?(0,Z.jsx)(R,{onSelect:r,children:`Open in…`}):(0,Z.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Z.jsx)(A,{})})]}),e.worktreePath?(0,Z.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(Ft,{run:e,canResume:t,onResume:n})})]})}function Rt({branch:e}){let[t,n]=(0,X.useState)(null),r=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{g(`Could not copy branch. Select and copy: ${e}`)}};return(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Z.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function zt({run:e}){let t=O(),n=ee(),i=r=>n===void 0?void 0:le(n,e.id,r,t),a=(0,X.useMemo)(()=>ue(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Z.jsx)(pt,{run:e,prNumber:t.number})},me(t)));let l=de(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Z.jsx)(P,{reference:{kind:`PR`,url:l},taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},me(t)));let d=ce(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=fe(d);s.push((0,Z.jsx)(P,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Z.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Bt(){let e=Be(),t=ie();return $e(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Vt=e=>e.map(e=>`${e.name}: ${ht(e.url)}`).join(`
2
- `);function Ht(e){return Bt().length>0||e.notify===!0}function Ut({run:e}){let t=Bt(),n=t.length>0,r=C(e.id),[i,a]=(0,X.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${Ke(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Vt(t):void 0,children:[(0,Z.jsx)(Ue,{tone:`success`}),(0,Z.jsx)(`span`,{children:`Notifying`}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Z.jsx)(L,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Z.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ht(e.url),children:e.name},e.id))}):null,n?(0,Z.jsxs)(R,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Z.jsx)(De,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Z.jsxs)(R,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>g(`Stopped notifying the webhook`),onError:e=>g(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Z.jsx)(yt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Z.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),g(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>g(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,X.useId)(),o=(0,X.useId)(),[s,c]=(0,X.useState)(``);(0,X.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=Ke(t);return(0,Z.jsx)(Re,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Z.jsx)(Ie,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Z.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Z.jsxs)(Fe,{className:`text-left`,children:[(0,Z.jsx)(Le,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Z.jsx)(Pe,{children:(0,Z.jsx)(`span`,{"data-webhook-destination":``,title:Vt(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Z.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Z.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Z.jsxs)(Ne,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Z.jsx)(I,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsxs)(I,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({runId:e,children:t}){let n=ae(),r=(0,X.useMemo)(()=>({runId:e}),[e]);return n?(0,Z.jsx)(Kt,{runId:e,children:t}):(0,Z.jsx)(gt.Provider,{value:r,children:t})}function Kt({runId:e,children:t}){let{projectId:n}=oe(),r=(0,X.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Z.jsx)(gt.Provider,{value:r,children:t})}function qt({id:e}){return(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Jt({id:e}){let t=E(e),n=t.data?G(t.data):e;return(0,Z.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Z.jsx)(I,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Yt=3,Xt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Zt(e,t,n=Yt){let r=t?e.findIndex(e=>Xt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Qt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function $t({tab:e}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(e.kind===`pr`?he:ve,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Z.jsx)(ke,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function en(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function tn({servers:e}){let t=ot();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Z.jsx)(Se,{"aria-hidden":`true`}),en(e,n),t.live?(0,Z.jsx)(Ue,{tone:`success`,"aria-label":`Preview is live`}):null]})}function nn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function rn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Z.jsx)(qt,{id:n}):(0,Z.jsx)(Jt,{id:n})}function an(e,t){return!e.archiveBlocker&&t.archive?(0,Z.jsx)(Tt,{run:e}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Z.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ht(t);return e&&(n||r)?(0,Z.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,Z.jsx)(Ut,{run:t})]}):null}function cn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,X.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,X.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Z.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Z.jsx)(Y,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Z.jsx)(Y,{to:Qt(e.id,t),active:n!==null&&Xt(t,n),replace:a,children:(0,Z.jsx)($t,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Z.jsxs)(U,{children:[(0,Z.jsxs)(V,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,Z.jsx)(H,{align:`end`,children:i.map(t=>(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(W,{to:Qt(e.id,t),replace:a,children:(0,Z.jsx)($t,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function ln({run:e,tab:t=`session`,onMarkedUnread:n}){let r=l(e),a=J(e),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(!1),d=un(e,n),f=te(),p=re(),m=At(e,{queuePosition:e.status===`queued`?He(f.data??[]).get(e.id):void 0}),h=Qe(),g=Ze(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:b,requests:x}=Nt(e),S=(0,X.useMemo)(()=>pe(e,b),[e,b]),C=typeof t==`object`?t:null,{inline:w,overflow:T}=Zt(S,C),E=p.data?.capabilities?.preview===!0,D=e.worktreePath&&E?(0,Z.jsx)(tn,{servers:e.previewServers??[]}):null,O=(0,Z.jsx)(mn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>s(e=>!e)}),k=an(e,a);return(0,Z.jsx)(Oe,{projectId:y,repoBase:b,requests:x,children:(0,Z.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 bg-background px-4 md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`sticky [inset-block-start:0]`),children:[(0,Z.jsx)(on,{run:e}),(0,Z.jsx)(Ot,{run:e}),(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsx)(rn,{run:e}),_?(0,Z.jsxs)(at,{slot:_,children:[(0,Z.jsx)(pn,{run:e,status:(0,Z.jsx)(lt,{"data-slot":`mobile-run-status`,dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-w-full self-start truncate px-2 py-px text-[11px] leading-4`,children:m.label})}),(0,Z.jsx)(rn,{run:e,compact:!0}),O]}):(0,Z.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Z.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:nn(e.delegation)}),(0,Z.jsx)(fn,{run:e}),(0,Z.jsx)(lt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:jt(m)}),(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[g?k:null,D,(0,Z.jsx)(Ut,{run:e}),O]})]}),(0,Z.jsx)(sn,{shown:_!==null,run:e,previewToggle:D}),(0,Z.jsx)(cn,{run:e,tab:t,activeItem:C,inlineItemTabs:w,overflowItemTabs:T,phoneBar:v,isDesktop:g}),o?(0,Z.jsx)(_n,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,Z.jsx)(Lt,{run:e,canResume:J(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Z.jsx)(gn,{run:e,actions:d})]})})}function un(e,t){let n=h(),r=ze(),[i,a]=(0,X.useState)(null),o=()=>n.invalidateQueries({queryKey:_.runs.all}),s=e=>g(e.message,{tone:`danger`}),c=b(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=y();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:x({mutationFn:()=>f(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Pt(e),confirming:i,setConfirming:a}}function dn(e){let t=v(e.id),n=G(e);return{title:n,editor:st(n,e=>t.mutate({title:e},{onError:e=>g(e.message,{tone:`danger`})}))}}function fn({run:e}){let{title:t,editor:n}=dn(e);return n.editing?(0,Z.jsx)(it,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Z.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function pn({run:e,status:t}){let{title:n,editor:r}=dn(e);return(0,Z.jsxs)(Me,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Z.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Z.jsx)(Ae,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)(je,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Z.jsx)(it,{editor:r,className:`text-[16px] font-semibold`})})]})}function mn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=J(e),a=q(e),o=Ze(),s=St(e.id),[c,l]=(0,X.useState)(!1),u=v(e.id),d=(0,X.useId)();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{run:e,open:c,onOpenChange:l,onConfirm:()=>{s.mutate(!0),l(!1)}}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsx)(I,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Z.jsx)(xe,{"aria-hidden":`true`})})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Z.jsx)(L,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!o&&i.archive&&!e.archiveBlocker?(0,Z.jsx)(R,{disabled:s.isPending,onSelect:()=>e.archived?s.mutate(!1):l(!0),children:Ct(e)}):null,(0,Z.jsxs)(R,{onSelect:n,children:[(0,Z.jsx)(Ge,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Z.jsx)(Lt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Z.jsxs)(R,{onSelect:()=>void Q(a,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Z.jsxs)(R,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Z.jsx)(bt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Z.jsxs)(B,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Z.jsx)(xt,{"aria-hidden":`true`}):(0,Z.jsx)(ye,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Z.jsx)(B,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:u.isPending,onCheckedChange:e=>u.mutate({archiveWhenDone:e},{onError:e=>g(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Z.jsx)(B,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:u.isPending,"aria-describedby":d,onCheckedChange:e=>u.mutate({autoMergePr:e},{onError:e=>g(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Z.jsx)(`p`,{id:d,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Z.jsx)(hn,{run:e,patch:u}),i.deleteRun?(0,Z.jsx)(z,{}):null,i.deleteRun?(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Z.jsx)(ge,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function hn({run:e,patch:t}){let n=(0,X.useId)(),r=(0,X.useId)(),i=(0,X.useId)(),a=e=>g(e.message,{tone:`danger`});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Z.jsx)(B,{"data-slot":`allow-workers`,className:`min-h-11`,checked:m(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Z.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,Z.jsx)(B,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:p(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Z.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Z.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function gn({run:e,actions:t}){let n=t.confirming;return(0,Z.jsx)(Je,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(Z.Fragment,{children:[`Delete “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!d(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function _n({runId:e,onClose:t}){let n=ne(e);return(0,Z.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Z.jsx)(A,{})})]}),n.isPending?(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Z.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Z.jsx)(Gt,{runId:e,children:(0,Z.jsx)(_t,{children:n.data})}):(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Z.jsx)(I,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Z.jsx)(I,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{It as a,At as c,zt as i,Gt as n,Pt as o,Rt as r,Nt as s,ln as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Bt as i,Ct as a,Ft as o,Nn as s,Nt as c,Qn as l,Rt as u,ot as d,pi as f,rt as p}from"./project-scope-context-Rv6S_BXt.js";import{n as m}from"./toaster-BXnLIU3z.js";import{Bt as h,C as g,Qt as _,X as v,Y as y,vt as b}from"./queries-qCF-eOqZ.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-DeprqSP7.js";import{i as E,n as D,r as ee}from"./git-toolbar-BulcGzsv.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,o as j,r as M,s as N,t as P}from"./dialog-B531GGAo.js";import{b as F,f as I}from"./task-groups-4tzKGROI.js";import{c as L,d as R}from"./page-shell-7pLJMOgh.js";import{t as z}from"./centered-state-V15AR_qo.js";import{C as B,X as V,cn as H,en as U,w as W}from"./index-DNQcTHxV.js";import{t as G}from"./markdown-BBDDg-4t.js";import{t as K}from"./textarea-vJt9undk.js";import{t as q}from"./diff-hxqBOfZH.js";var J=e(t(),1),Y=`no worktree — this task ran directly in the repo working tree`;function X(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${Y}`)}function Z(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${Y}`)}function Q(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${Y}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?l(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):F(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function te(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:X(e),n=e.prUrl?[X(e),Z(e)]:[Z(e),Q(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?F(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var $=n();function ne({run:e,open:t,onOpenChange:n}){let r=f(),[i,a]=(0,J.useState)(``),o=I(e),s=(0,J.useRef)(o);s.current=o,(0,J.useEffect)(()=>{t&&a(s.current)},[t]);let c=_({mutationFn:t=>p(e.id,t),onSuccess:t=>{m(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:h.runs.changes(e.id)}),r.invalidateQueries({queryKey:h.runs.all})},onError:e=>m(e.message,{tone:`danger`})}),l=()=>{let e=i.trim();e.length===0||c.isPending||c.mutate(e)};return(0,$.jsx)(P,{open:t,onOpenChange:n,children:(0,$.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(N,{children:`Commit changes`}),(0,$.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,$.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,$.jsx)(K,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{V({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),l())}}),(0,$.jsxs)(k,{children:[(0,$.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,$.jsx)(O,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||c.isPending,onClick:l,children:c.isPending?`Committing…`:`Commit`})]})]})})}function re(){let{id:e}=x(),t=y(e);return t.isPending?(0,$.jsx)(W,{tab:`changes`}):t.isError?(0,$.jsx)(B,{tab:`changes`,error:t.error}):(0,$.jsx)(ie,{run:t.data})}function ie({run:e}){let t=b(),n=g(),r=v(e.id,F(e)),i=U(),[a,l]=(0,J.useState)(`unified`),[p,y]=(0,J.useState)(!0),[x,S]=(0,J.useState)(!1),[C,w]=(0,J.useState)(null),[E,O]=(0,J.useState)(!1),k=(0,J.useRef)(null),A=f(),j=()=>A.invalidateQueries({queryKey:h.runs.all}),M=e=>m(e.message,{tone:`danger`}),N=_({mutationFn:()=>u(e.id),onSuccess:e=>m(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:M}),P=_({mutationFn:()=>d(e.id),onSuccess:e=>{m(`Draft PR created — ${e.url}`),j()},onError:M}),I=_({mutationFn:()=>o(e.id),onError:e=>{if(e instanceof s&&e.command){navigator.clipboard.writeText(e.command).then(()=>m(`No terminal found — command copied to clipboard.`)).catch(()=>m(`Run manually: ${e.command}`));return}M(e)}}),z=_({mutationFn:t=>c(e.id,t),onError:M}),B=r.isError&&r.error instanceof s&&r.error.status===409,V=te({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!B,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:H(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:O(!0);break;case`push`:N.mutate();break;case`create-pr`:P.mutate();break;case`open-terminal`:I.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,J.useMemo)(()=>ee(K),[K]),Y=(0,J.useMemo)(()=>K.some(G),[K]),X=i?a:`unified`;return(0,$.jsxs)(L,{route:`task-changes`,density:R(K.length),flushPadding:!0,children:[(0,$.jsx)(T,{run:e,tab:`changes`}),(0,$.jsx)(D,{bar:V,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:X,wrap:p,preview:x,onModeChange:l,onWrapChange:y,onPreviewChange:Y?S:void 0,onAction:W}),r.data?.repointedHead?(0,$.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,$.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,$.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,$.jsx)(ae,{changes:r,changesRefused:B,fileCount:K.length,children:(0,$.jsx)(oe,{runId:e.id,files:K,tree:q,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:X,effectiveWrap:p,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,$.jsx)(ne,{run:e,open:E,onOpenChange:O})]})}function ae({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,$.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,$.jsx)(z,{icon:t?(0,$.jsx)(S,{size:16}):(0,$.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,$.jsx)(z,{icon:(0,$.jsx)(S,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function oe({runId:e,files:t,tree:n,selected:a,selectFile:o,diffRef:s,effectiveMode:c,effectiveWrap:l,preview:u,localHandoff:d,onOpenInApp:f}){let[p,m]=(0,J.useState)(!1);return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9 md:[--diff-sticky-top:1rem]`,children:[(0,$.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,$.jsxs)(`span`,{children:[`Changed files`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,$.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,p&&`rotate-180`)})]}),(0,$.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,$.jsx)(`div`,{className:r(p?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,$.jsx)(E,{root:n,selected:a,onSelect:e=>{o(e),m(!1)}})})]}),(0,$.jsx)(q,{files:t,viewRef:s,mode:c,wrap:l,preview:u,loadFileText:t=>se(e,t),imageSrc:t=>i(e,t),onOpenInApp:d?e=>f(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function se(e,t){try{let n=await a(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{re as TaskChangesRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Nn as r,bt as i}from"./project-scope-context-Rv6S_BXt.js";import{$t as a,Bt as o,Q as s,Y as c,Z as l}from"./queries-qCF-eOqZ.js";import{h as u}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as d,j as f,ot as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-DeprqSP7.js";import{n as h}from"./diff-controls-BRa3141W.js";import{t as g}from"./project-router-CLJTc7gv.js";import{b as _}from"./task-groups-4tzKGROI.js";import{c as v,d as y}from"./page-shell-7pLJMOgh.js";import{t as b}from"./centered-state-V15AR_qo.js";import{C as x,en as S,hn as C,w,zt as T}from"./index-DNQcTHxV.js";import{t as E}from"./diff-hxqBOfZH.js";import{t as D}from"./change-counts-CW7O8g5Y.js";import{r as O,t as k}from"./commit-list-CN1zX-0X.js";var A=e(t(),1),j=n();function M(){let{id:e}=u(),t=c(e);return t.isPending?(0,j.jsx)(w,{tab:`changes`}):t.isError?(0,j.jsx)(x,{tab:`changes`,error:t.error}):(0,j.jsx)(N,{run:t.data})}function N({run:e}){let{sha:t}=u(),n=s(e.id,_(e)),i=n.data?.commits[0]?.sha;return(0,j.jsxs)(v,{route:`task-commits`,density:y(n.data?.commits.length??0),flushPadding:!0,children:[(0,j.jsx)(m,{run:e,tab:`commits`}),t?(0,j.jsx)(F,{runId:e.id,sha:t}):n.isPending?(0,j.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading commits…`}):n.isError?(0,j.jsx)(b,{icon:(0,j.jsx)(f,{size:16}),tone:n.error instanceof r&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof r&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,j.jsx)(b,{icon:(0,j.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,j.jsx)(P,{run:e,commits:n.data.commits,selectedSha:i})]})}function P({run:e,commits:t,selectedSha:n}){let r=l(e.id,n),i=L(e.id,t),a=(0,A.useRef)(null),o=S(),[s,c]=(0,A.useState)(`unified`),[u,d]=(0,A.useState)(!0),m=o?s:`unified`;return(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 px-4 py-5 md:px-9 lg:flex-row lg:items-start`,children:[(0,j.jsxs)(`div`,{className:`w-full shrink-0 lg:w-[380px] xl:w-[420px]`,children:[(0,j.jsx)(k,{slot:`task-commits`,selectedSha:n,heading:(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[t.length,` `,t.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:t.map(t=>({...t,href:`/tasks/${e.id}/commits/${t.sha}`,stat:i.get(t.sha)}))}),n&&r.data&&r.data.files.length>0?(0,j.jsx)(R,{runId:e.id,sha:n,files:r.data.files,onPick:e=>a.current?.scrollToPath(e)}):null]}),n?(0,j.jsx)(`section`,{"data-slot":`task-commit-preview`,"data-sha":n,className:`min-w-0 flex-1 overflow-hidden rounded-xl border border-border bg-card`,children:r.isPending?(0,j.jsx)(`p`,{className:`px-4 py-8 text-center text-xs text-muted-foreground`,children:`Loading commit diff…`}):r.isError?(0,j.jsx)(b,{icon:(0,j.jsx)(p,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load commit diff`,subtitle:r.error.message}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2 border-b border-border px-4 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`h3`,{className:`break-words text-sm leading-snug font-semibold text-foreground`,children:r.data.subject}),(0,j.jsxs)(`p`,{className:`mt-0.5 flex flex-wrap items-center gap-x-1.5 text-xs text-muted-foreground`,children:[(0,j.jsx)(`span`,{children:r.data.author}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsx)(`span`,{title:r.data.when,children:T(r.data.when)}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsx)(`span`,{className:`font-mono select-all`,title:r.data.sha??n,children:(r.data.sha??n).slice(0,8)}),r.data.stat?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsx)(C,{stat:r.data.stat})]}):null]})]}),(0,j.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:(0,j.jsx)(h,{mode:s,wrap:u,onModeChange:c,onWrapChange:d})})]}),!r.data.files||r.data.files.length===0?(0,j.jsx)(b,{icon:(0,j.jsx)(f,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,j.jsx)(`div`,{className:`p-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem]`,children:(0,j.jsx)(E,{viewRef:a,files:r.data.files,mode:m,wrap:u,totals:!1,className:`min-w-0`})})]})}):null]})}function F({runId:e,sha:t}){return(0,j.jsx)(O,{commit:l(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`})}var I=12;function L(e,t){let n=t.length<=I,r=a({queries:t.map(t=>({queryKey:o.runs.commit(e,t.sha),queryFn:({signal:n})=>i(e,t.sha,{signal:n}),enabled:n,retry:!1}))}),s=new Map;return r.forEach((e,n)=>{let r=t[n]?.sha;r&&e.data?.stat&&s.set(r,e.data.stat)}),s}function R({runId:e,sha:t,files:n,onPick:r}){return(0,j.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-4 rounded-xl border border-border bg-card p-4`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1`,children:[(0,j.jsxs)(`h2`,{className:`text-sm font-semibold text-foreground`,children:[n.length,` `,n.length===1?`file`:`files`,` in`,` `,(0,j.jsx)(`span`,{className:`font-mono text-[13px] font-medium`,title:t,children:t.slice(0,8)})]}),(0,j.jsx)(g,{to:`/tasks/${e}/changes`,className:`text-xs text-muted-foreground hover:text-foreground`,children:`All task changes ›`})]}),(0,j.jsx)(`ul`,{className:`space-y-1`,children:n.map(e=>(0,j.jsx)(`li`,{children:(0,j.jsxs)(`button`,{type:`button`,"data-slot":`task-commit-file`,title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,onClick:()=>r(e.path),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left text-xs text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,j.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 break-all`,children:e.path}),(0,j.jsx)(D,{adds:e.adds,dels:e.dels,className:`font-mono text-xs`})]})},e.path))})]})}export{M as TaskCommitsRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{m as a}from"./live-reads-Crd6fVGH.js";import{K as o,Mr as s,P as c,Z as l,at as u,pi as d,q as f,r as p,ti as m}from"./project-scope-context-Rv6S_BXt.js";import{n as h}from"./toaster-BXnLIU3z.js";import{A as g,Bt as _,Jt as v,Qt as y,St as b,Wt as x,_ as S,a as C,c as w,f as T,k as E}from"./queries-qCF-eOqZ.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as P,m as ee,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as re}from"./chevron-down-CHGyCDBH.js";import{t as z}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{t as ae}from"./loader-circle-CPBhhDbB.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-B7MKxYjT.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-B531GGAo.js";import{t as V}from"./project-router-CLJTc7gv.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-KdW7aO0N.js";import{a as W}from"./format-BU7D3IfE.js";import{d as xe,f as G,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,Hn as K,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,U as ze,W as q,X as Be,Z as Ve,ar as He,et as Ue,it as We,j as Ge,nt as Ke,rt as qe,vn as Je,xn as Ye,xt as J}from"./index-DNQcTHxV.js";import{t as Xe}from"./markdown-9L65ixU6.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-hxqBOfZH.js";import{t as Y}from"./change-counts-CW7O8g5Y.js";import{t as $e}from"./tab-link-Bu1g-ArE.js";var X=e(t(),1),Z=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function tt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function nt(e){return e?.available?e.mergeState:null}function rt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function it(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function at(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function ot(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function st(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ct(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function lt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ut(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function dt(e){return e?et[e]:`Merge`}function ft(e){return e===`conflicting`?`true`:void 0}function pt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(tt,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ct(e.required)]})]}),e.url&&r(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function mt({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function ht({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=it(e),f=at(e.reviewDecision),p=ot(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(tt,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,st(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(pt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Z.jsx)(B,{disabled:!r,onClick:c,children:dt(t)})]}):null]})]})}function gt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(ge,{open:r,onOpenChange:s,children:(0,Z.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(he,{children:[dt(n),` pull request #`,e,`?`]}),(0,Z.jsx)(fe,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(de,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:dt(n)})]})]})})}function _t({number:e,onRunAgent:t}){let n=d(),r=T(),i=m({queryKey:_.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),a=nt(i.data),[o,s]=(0,X.useState)(null),[c,u]=(0,X.useState)(!1),[p,g]=(0,X.useState)(!1),v=y({mutationFn:t=>f(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),b=rt(o,a),x=()=>({mergeState:_.githubMergeState(e),list:_.githubPages(50),comments:_.githubComments(`pr`,e),item:_.githubItem(`pr`,e),refStatus:r===void 0?void 0:_.githubRefStatusOf(r)}),S=y({mutationFn:t=>{if(!a||!b)throw Error(`No merge method is available.`);return l(e,{method:b,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),h(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{h(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(K,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ft(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(ht,{state:a,selectedMethod:b,overrideRules:p,mergeEnabled:ut(b,a,p),refreshPending:v.isPending,onRefresh:()=>v.mutate(_.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:g}),(0,Z.jsx)(gt,{number:e,state:a,selectedMethod:b,confirming:c,overrideRules:p,mergePending:S.isPending,mergeError:S.error,onOpenChange:u,onMerge:()=>S.mutate(x())})]}):(0,Z.jsx)(mt,{reason:lt(i.data)})}function vt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function yt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function bt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function xt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function St({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:xt(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function Ct(e){return e===`pr`?`pull request`:`issue`}function wt(e,t,n){return e===`pr`&&!!(t||n)}function Tt({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Et=i(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-[11px]`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Dt(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function Ot({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(`time`,{dateTime:e.createdAt,title:Dt(e.createdAt),children:W(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)($t,{count:n})]}):null,i?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,r(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function kt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)($e,{to:J(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:J(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function At({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(St,{label:e,color:t[e]},e)),n?(0,Z.jsx)(en,{checks:n,url:e.url}):null]}):null}function jt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:i(`mt-5`,Et),children:n?(0,Z.jsx)(Xe,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(Ft,{item:e,colors:t})]})}function Mt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let u=a?.changes??!1,d=Ct(e.kind),f=C(e.kind,e.number,!u).data?.detail,p=f?.body??e.body,m=f?.additions??e.additions,h=f?.deletions??e.deletions,g=wt(e.kind,m,h),_=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Tt,{backLink:i}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsx)(Nt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Nt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(Ot,{item:e,kindWord:d,commentCount:_,hasDiffStat:g,additions:m,deletions:h})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(kt,{item:e,subNav:a,changes:u}),(0,Z.jsx)(At,{item:e,colors:t,checks:n}),u&&e.kind===`pr`?(0,Z.jsx)(Pt,{item:e}):(0,Z.jsx)(jt,{item:e,colors:t,body:p})]}),e.kind===`pr`?(0,Z.jsx)(_t,{number:e.number,onRunAgent:o}):null,l]})}function Nt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:i(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Pt({item:e}){let t=d(),n=w(e.number),[a,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===c)?c:p[0]?.path??null,g=p.findIndex(e=>e.path===m),v=e=>{s(e);let t=f(e),n=m??c,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==c&&l(r)},y=async()=>{let n=u?.available?u.headSha:null,r=_.githubPrChanges(e.number),i=await o(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),h(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let b=p.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),x=r(e.url)?`${e.url}/files`:null,S=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:u.headSha,children:[`head `,u.headSha.slice(0,8)]}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void y(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,x?(0,Z.jsx)(`a`,{href:x,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>v(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsxs)(`div`,{className:`relative mt-2 lg:hidden`,children:[(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:m??``,onChange:e=>l(e.target.value),className:`min-h-11 w-full appearance-none rounded-md border border-input bg-background py-2 pr-8 pl-3 text-sm`,children:p.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(re,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground`})]}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<=0,onClick:()=>l(p[g-1]?.path??null),children:(0,Z.jsx)(He,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:g<0||g>=p.length-1,onClick:()=>l(p[g+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Qe,{files:b.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),S&&!S.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,S.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Ft({item:e,colors:t}){let n=C(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(It(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(K,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(K,{className:`h-14 w-full`}),(0,Z.jsx)(K,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Lt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Rt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Yt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Bt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var It=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Lt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Rt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Bt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e[e.length-1].createdAt)})]})})}var zt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Bt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:zt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Kt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:W(e.createdAt)}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Vt({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(qt,{checks:e.checks})]})}function Ht({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:xt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Ut({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Gt={committed:e=>(0,Z.jsx)(Vt,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ht,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Ut,{event:e}),unassigned:e=>(0,Z.jsx)(Ut,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Wt,{event:e})};function Kt({event:e,colors:t}){return Gt[e.kind]?.(e,t)??null}function qt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Qt[e]),children:Zt[e]}):null}var Jt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Yt({comment:e}){let t=e.reviewState?Jt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Xt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:W(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Et,children:e.body?(0,Z.jsx)(Xe,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Xt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Zt={passing:`✓`,failing:`✗`,pending:`○`},Qt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function $t({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function en({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Qt[e],t&&`hover:underline`),r=`${Zt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function tn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Qt[e]),children:Zt[e]})}function Q(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function nn(e,t=[]){let n=Q(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=rn(t)),n}function rn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function an(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function on(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function sn(e,t,n){let r=(n??``).trim();if(!r)return nn(e,t);let i=Q(e),a=r.startsWith(i)?i+an(r.slice(i.length),e):an(r,e),o=on(a,e)?a:`${i}\n\n${a}`;return t.length?o+rn(t):o}function cn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function ln(e,t,n,r,i={}){return t?{...i,workflow:t,task:sn(e,n.map(e=>e.id),r)}:n.length?{...i,steps:cn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:sn(e,[],r)}:{...i,workflow:`quick-task`,task:sn(e,[],r)}}function un(e){let t=b(),n=S(),r=a(),{runners:i,uninstalled:o,signedOut:s,accounts:c,repoAccount:l,accountFor:u}=Ye(),d=n.data?.defaultRunner,f=Me(e.runner,i,d??i[0]??`claude`),p=n.data?.modelsLocked===!0,m=u(f,e.account),h=v(f,!0,m??l?.[f]),g=ke(p?null:e.model,f,r.data,n.data?.defaultModels,h.data),_=Ie(g,h.data);return{runner:f,runnerExplicit:e.runner!==null,model:g,effort:p?``:Re(e.effort,_),effortOptions:_,runners:i,uninstalled:o,signedOut:s,defaultRunner:d,canRun:t.isSuccess&&i.length>0,modelsLocked:p,providerPending:t.isPending,providerError:t.isError,accounts:c,account:m,repoAccount:l}}function dn(e){return{runner:Fe(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function fn(e){return{...dn(e),...e.account?{agentProfile:e.account}:{}}}function pn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Je(t,e))}function mn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let o=(0,X.useRef)(null),s=(0,X.useRef)(null),[c,l]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=o.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;s.current=n instanceof HTMLElement&&e.contains(n)?n:null,l(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=s.current;s.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[c]);let u=un(e),{runner:d,model:f,effort:p,effortOptions:m,runners:h,canRun:g,modelsLocked:_}=u,y=S(),b=a(),x=v(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,b.data,x.data,[e.model,y.data?.defaultModels?.[d]]),w=n||!g,T=r?u.accounts:[],E=pn(u,T)?(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(q,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:f===``?`Default`:C.find(e=>e.id===f).label,value:f,disabled:w,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ge(d,b.data,x)},`model`),O=(0,Z.jsx)(q,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`auto`,value:p,disabled:w,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:o,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ae,{fill:`model-pill`,children:c?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ae,{children:[E,D,O]})}var hn={workflow:null,skills:[]},gn=`cez-followup-selection`;function _n(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function vn(){try{let e=localStorage.getItem(gn);return e?_n(JSON.parse(e)):{...hn}}catch{return{...hn}}}function yn(e){try{localStorage.setItem(gn,JSON.stringify(e))}catch{}}var $=`cez-followup-prompt:`;function bn(e){try{return localStorage.getItem($+e)??``}catch{return``}}function xn(e,t){try{t===``?localStorage.removeItem($+e):localStorage.setItem($+e,t)}catch{}}function Sn({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=d(),v=E(),b=e.kind===`pr`?`PR`:`issue`,S=un(l),C=x(S.runner,S.account),w=o.filter(e=>C.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=w.length!==o.length,[D]=(0,X.useState)(()=>Q(e)),[k,A]=(0,X.useState)(()=>bn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{xn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ke(v.data?.promptTemplates),[v.data?.promptTemplates]),P=e=>{let t=j.current,n=We({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},ee=Oe(N,w.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=qe(F.current,I.current,ee,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[ee,D]);let L=y({mutationFn:async()=>!S.canRun||T?null:u(ln(e,i,w,k,fn(S))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),h(`Added to the queue — ${b} #${e.number}`),w.length>0&&v.data!==void 0&&c({skillUsage:w.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:_.uiState})).catch(()=>{}),xn(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:_.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),te=e=>{Be({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&S.canRun&&L.mutate())},R=e=>s(o.some(t=>G(t)===G(e))?o.filter(t=>G(t)!==G(e)):[...o,Te(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(ze,{templates:N,onInsert:P}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(wn,{workflows:t,value:i,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(En,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(Cn,{skill:e,skills:n,unchecked:C.unchecked,onRemove:()=>R(e)},G(e)))}):null,T?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(mn,{layout:`row`,pick:l,onChange:f,disabled:L.isPending||!S.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(Tn,{resolved:S,disabled:L.isPending||!S.canRun,onPick:e=>f({...l,account:e})})]}),!S.providerPending&&!S.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!S.canRun||T,onClick:()=>L.mutate(),children:[(0,Z.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,b]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:Ve()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function Cn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function wn({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=xe(e,o);return(0,Z.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function Tn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:s,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(q,{icon:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function En({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>G(t)===G(e));return(0,Z.jsxs)(U,{value:G(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Z.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},G(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(ce,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(be,{shouldFilter:!1,children:[(0,Z.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Z.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Dn=new WeakMap;function On(){let e=vn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&yn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function kn(){let e=d(),{projectId:t}=p(),n=Dn.get(e);n||Dn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=On());let{snapshot:i,subscribe:a,update:o}=r,s=(0,X.useSyncExternalStore)(a,i,i),c=g(),l=un(s.engine),u=x(l.runner,l.account),f=E(),m=c.data?.workflows;(0,X.useEffect)(()=>{m&&s.workflow!==null&&!m.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,m,s.workflow]);let h=(0,X.useMemo)(()=>Ce(u.data??[],f.data?.skillUsage),[u.data,f.data?.skillUsage]);return{...s,workflows:c,skillList:h,skillsUnchecked:u.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{$t as a,Lt as c,xt as d,bt as f,tn as i,vt as l,Sn as n,Mt as o,nn as r,St as s,kn as t,yt as u};