cezarion 0.19.0-dev.8781 → 0.19.0-dev.8794
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/web/dist/assets/{accounts-section-CtHm7aRy.js → accounts-section-B3XlbE9-.js} +1 -1
- package/web/dist/assets/{activity-motion-BaeTCM_z.js → activity-motion-DtSeos5G.js} +1 -1
- package/web/dist/assets/{activity-route-OUFX_s9l.js → activity-route-DwLbg5TU.js} +1 -1
- package/web/dist/assets/agent-config-section-TV__fszM.js +7 -0
- package/web/dist/assets/{agent-defaults-section-BQMOQmFU.js → agent-defaults-section-CoaKPbd7.js} +1 -1
- package/web/dist/assets/{appearance-CpY4Ep5N.js → appearance-BSogGq4y.js} +1 -1
- package/web/dist/assets/{automations-route-N-ItAcCe.js → automations-route-BO4qUbj8.js} +1 -1
- package/web/dist/assets/{commit-list-jX22pZgi.js → commit-list-CPCMhqsH.js} +1 -1
- package/web/dist/assets/diff-controls-DT8_nQ2J.js +1 -0
- package/web/dist/assets/{diff-DkNv9F1S.js → diff-eTwHyNBm.js} +2 -2
- package/web/dist/assets/{diff-view-BwxZBohC.js → diff-view-BnO_U5xn.js} +2 -2
- package/web/dist/assets/{file-preview-Df_sAIjc.js → file-preview-L0_fbkUZ.js} +1 -1
- package/web/dist/assets/git-toolbar-ywLSmnxR.js +1 -0
- package/web/dist/assets/{github-liGukS1-.js → github-Bd3i_-h6.js} +1 -1
- package/web/dist/assets/{global-activity-route-Bx7CI7oe.js → global-activity-route-BbgDC3wz.js} +1 -1
- package/web/dist/assets/{html-report-frame-uuqkBC0u.js → html-report-frame-DkHr39E2.js} +1 -1
- package/web/dist/assets/index-8eoz1i7-.js +21 -0
- package/web/dist/assets/index-nVjwJYl4.css +1 -0
- package/web/dist/assets/{markdown-W3RfjqPg.js → markdown-Dn1C5VnY.js} +1 -1
- package/web/dist/assets/{notifications-section-DipeEy3a.js → notifications-section-3xWRDUrB.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-QfVkylO-.js → preview-pane-connected-BdxTm5Ky.js} +1 -1
- package/web/dist/assets/projects-section-Brds9YmD.js +1 -0
- package/web/dist/assets/{prompt-templates-section-DWExDpat.js → prompt-templates-section-CAuTp8gl.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CQYY_wTf.js → remote-settings-notice-CxRBhjoN.js} +1 -1
- package/web/dist/assets/repo-git-CGdMJ36u.js +1 -0
- package/web/dist/assets/report-reader-BQyJblDp.js +1 -0
- package/web/dist/assets/reports-CPpFm0jn.js +1 -0
- package/web/dist/assets/{resources-section-X0D70OJ1.js → resources-section-Cbtu9i_k.js} +1 -1
- package/web/dist/assets/{review-panel-BtYgaHND.js → review-panel-DuvFn5VX.js} +1 -1
- package/web/dist/assets/{run-header-NMRiSpOB.js → run-header-CP_2QY0H.js} +1 -1
- package/web/dist/assets/{select-CPyYQxk3.js → select-D5UnnIUL.js} +1 -1
- package/web/dist/assets/{session-context-section-LvsmL5LU.js → session-context-section-CFw0aFoC.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-SyqQsuM0.js → settings-agent-picker-DIEyNQVg.js} +1 -1
- package/web/dist/assets/{settings-shell-Dr2BCcBa.js → settings-shell-DUvwIPgV.js} +1 -1
- package/web/dist/assets/{sidebar-section-Bz64etDf.js → sidebar-section-CET3Eico.js} +1 -1
- package/web/dist/assets/{skills-DY2sd1wD.js → skills-oxTqCu3h.js} +1 -1
- package/web/dist/assets/{task-changes-CN-sIbZk.js → task-changes-TvjFctCc.js} +1 -1
- package/web/dist/assets/{task-commits-Q9EcYjRS.js → task-commits-DEsRCchM.js} +1 -1
- package/web/dist/assets/{task-file-scope-DVxMmRVI.js → task-file-scope-CkPO86PU.js} +1 -1
- package/web/dist/assets/task-files-BuMkWb7X.js +1 -0
- package/web/dist/assets/{task-github-item-Bytt1MNs.js → task-github-item-wUJ6pMdV.js} +1 -1
- package/web/dist/assets/{task-thread-By_9-_HE.js → task-thread-CS88T_7I.js} +1 -1
- package/web/dist/assets/{thread-state-pamPyZ6x.js → thread-state-DulSg7h8.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DaNhEdb7.js → use-hand-to-agent-state-8ZF3Wr1m.js} +1 -1
- package/web/dist/assets/{workflows-KH_rcJQB.js → workflows-D0HHVBzP.js} +1 -1
- package/web/dist/assets/{workspace-tools-qK6jT4xL.js → workspace-tools-C8GYSy1Y.js} +1 -1
- package/web/dist/assets/{worktrees-section-BzIqVORt.js → worktrees-section-Ba0hS8Ls.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/agent-config-section-BI6HuRmA.js +0 -7
- package/web/dist/assets/diff-controls-MH41LnIp.js +0 -1
- package/web/dist/assets/git-toolbar-C2UV0e-7.js +0 -1
- package/web/dist/assets/index-Btrz6_Zd.css +0 -1
- package/web/dist/assets/index-vn8Qvze5.js +0 -21
- package/web/dist/assets/projects-section-Aai9XzBg.js +0 -1
- package/web/dist/assets/repo-git-ABKIdSD5.js +0 -1
- package/web/dist/assets/report-reader-qAYwt6Q6.js +0 -1
- package/web/dist/assets/reports-CFBAn6T8.js +0 -1
- package/web/dist/assets/task-files-BmW6_Seh.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{Bt as a,Gt as o,It as s,Ot as c,Pt as l,St as u,dn as d,zt as f}from"./queries-EvENG6TN.js";import{hi as p,n as m,sn as h}from"./toaster-Cer2NOxt.js";import{n as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{O as _,ft as v}from"./design-icons-CzEoMH9c.js";import{t as y}from"./button-B7MKxYjT.js";import{n as b,r as x,t as S}from"./popover-CZV6tz9i.js";import{t as C}from"./centered-state-V15AR_qo.js";import{Gt as w,Ht as T,Jt as E,Kt as D,Ut as O,Vt as k,Wt as A,Zn as j,qt as M}from"./index-vn8Qvze5.js";import{t as N}from"./settings-select-CCIMGnyA.js";import{t as P}from"./save-cue-Cd3ZAPBS.js";import{n as F,t as I}from"./settings-field-DP9sYv5a.js";var L=t(n(),1),R=r();function z(){let e=c();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{m(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>m(e.message,{tone:`danger`})})}}function B({project:e,onOpenChange:t,onConfirm:n}){return(0,R.jsx)(k,{open:e!==null,onOpenChange:t,children:(0,R.jsxs)(A,{children:[(0,R.jsxs)(M,{children:[(0,R.jsxs)(E,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,R.jsxs)(w,{children:[`This only unregisters the project — `,(0,R.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,R.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-foreground`,title:e?.root,children:e?.root})]})]}),(0,R.jsxs)(D,{children:[(0,R.jsx)(O,{children:`Keep it`}),(0,R.jsx)(T,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var V=e({MaxParallelSelect:()=>Z,ProjectTagsEditor:()=>X,ProjectsSection:()=>G,STATUS_LABEL:()=>U}),H=1,U={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function W(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function G(){let e=s(),t=u();return e.isPending||t.isPending?(0,R.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,R.jsx)(C,{icon:(0,R.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,R.jsx)(K,{config:e.data,registry:t.data})}function K({config:e,registry:t}){let[n,r]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{"data-slot":`projects-section`,className:`flex w-full flex-col gap-7`,children:[(0,R.jsx)(q,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,R.jsx)(q,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/cezar/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,R.jsx)(J,{registry:t,workspaceMax:e.resources.maxParallel}),(0,R.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,R.jsx)(j,{open:!0,onOpenChange:r}):null]})}function q({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:s,footer:c,refreshProjects:l=!1}){let u=p(),f=d({mutationFn:t=>h(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{u.setQueryData(o.config,t),e===`browseRoot`?u.invalidateQueries({queryKey:o.fsBrowseRoot}):l&&u.invalidateQueries({queryKey:o.projects})}}),[g,_]=(0,L.useState)(t),v=g.trim(),b=v===t,x=f.isError?f.error.message:null;return(0,R.jsxs)(F,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":x!==null,"data-slot":`projects-${a}-root`,value:g,disabled:f.isPending,placeholder:i,onChange:e=>{_(e.target.value),f.isError&&f.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,R.jsx)(P,{show:b&&v!==``&&!f.isPending,children:(0,R.jsx)(y,{type:`button`,variant:`primary`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:b||v===``||f.isPending,onClick:()=>f.mutate(v,{onSuccess:()=>m(`${s} set to ${v}`)}),children:`Save`})})]}),x===null?(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:c}):(0,R.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-xs text-danger`,children:[x,` — setting unchanged`]})]})}function J({registry:e,workspaceMax:t}){let[n,r]=(0,L.useState)(null),i=z(),a=(0,L.useMemo)(()=>f(e.projects),[e.projects]);return(0,R.jsxs)(F,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,R.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,R.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,R.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,R.jsxs)(`colgroup`,{children:[(0,R.jsx)(`col`,{}),(0,R.jsx)(`col`,{style:{width:`104px`}}),(0,R.jsx)(`col`,{style:{width:`260px`}}),(0,R.jsx)(`col`,{style:{width:`150px`}}),(0,R.jsx)(`col`,{style:{width:`72px`}}),(0,R.jsx)(`col`,{style:{width:`92px`}})]}),(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,R.jsx)(`tbody`,{children:e.projects.map(n=>(0,R.jsx)(Y,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,R.jsx)(B,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function Y({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,R.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,R.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,R.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-xs text-soft-foreground`,title:e.root,children:e.root})]}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsxs)(`span`,{"data-slot":`project-status-pill`,className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-0.5 text-[12px] leading-5`,children:[(0,R.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:U[e.status]}),e.status===`missing`?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:`·`}),(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.source})]})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsx)(X,{project:e,vocabulary:r})}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsxs)(`label`,{"data-slot":`project-max-parallel-field`,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`span`,{className:I,children:`Max parallel tasks`}),(0,R.jsx)(Z,{project:e,workspaceMax:n})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:W(e.addedAt)}),(0,R.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,R.jsx)(y,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,R.jsx)(g,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,R.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function X({project:e,vocabulary:t}){let n=l(),[r,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(!1),[u,d]=(0,L.useState)(-1),f=(0,L.useRef)(null),p=e.tags??[],h=a(t,p,r),g=s&&h.length>0,_=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>m(r),onError:e=>m(e.message,{tone:`danger`})})},y=t=>{let n=t.trim().slice(0,32);if(d(-1),n){if(p.some(e=>e.toLowerCase()===n.toLowerCase())){o(``);return}if(p.length>=20){m(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}o(``),_([...p,n],`${e.name} tagged \u201c${n}\u201d`)}},C=t=>{_(p.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},w=`project-tag-suggestions-${e.id}`;return(0,R.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[p.map(t=>(0,R.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-xs font-medium whitespace-nowrap text-accent-text`,children:[t,(0,R.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>C(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,R.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,R.jsxs)(S,{open:g,onOpenChange:c,children:[(0,R.jsx)(b,{asChild:!0,children:(0,R.jsx)(`input`,{ref:f,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":g,"aria-controls":g?w:void 0,"aria-autocomplete":`list`,"aria-activedescendant":g&&u>=0?`${w}-${u}`:void 0,placeholder:p.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:e=>{if(c(!0),d(-1),e.target.value.includes(`,`)){o(e.target.value.replace(/,/g,``));return}o(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(h.length===0)return;e.preventDefault(),c(!0);let t=e.key===`ArrowDown`?1:-1,n=u+t;d(n>=h.length?-1:n<-1?h.length-1:n);return}if(e.key===`Escape`&&g){e.preventDefault(),c(!1),d(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),y(u>=0?h[u]??r:r);return}if(e.key===`Tab`){c(!1);return}if(e.key===`Backspace`&&r===``&&p.length>0){e.preventDefault();let t=p[p.length-1];t!==void 0&&C(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,R.jsxs)(x,{align:`start`,sideOffset:4,id:w,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,R.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-xs text-soft-foreground`,children:`Tags used in this workspace`}),h.map((e,t)=>(0,R.jsx)(`button`,{type:`button`,id:`${w}-${t}`,role:`option`,"aria-selected":t===u,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{y(e),f.current?.focus()},onMouseEnter:()=>d(t),className:i(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===u&&`bg-muted`),children:e},e))]})]})]})}function Z({project:e,workspaceMax:t}){let n=l(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,R.jsxs)(N,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>m(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>m(e.message,{tone:`danger`})})},className:`block w-full rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,R.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+H).map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})}export{z as a,B as i,U as n,V as r,Z 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{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{C as o,E as s,T as c,W as l,Wt as u,dn as d,j as f,n as p,qt as m,rt as h,w as g,xt as _,yt as ee}from"./queries-EvENG6TN.js";import{Fn as v,It as te,L as y,R as ne,ct as b,f as x,hi as S,l as C,n as w}from"./toaster-Cer2NOxt.js";import{Z as T}from"./live-protocol-DMhTnCmf.js";import{g as E,h as re}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as D}from"./tasks-table-DGBiE6ux.js";import{A as ie,C as O,E as ae,F as k,J as A,M as oe,X as se,Y as ce,at as le,j as ue,n as de,ot as j,s as fe,u as pe,v as me,x as he}from"./design-icons-CzEoMH9c.js";import{t as ge}from"./createLucideIcon-BHp8sXmF.js";import{n as _e,t as ve}from"./circle-x-7nTlobAF.js";import{_ as ye}from"./nav-row-styles-D5HpOmDZ.js";import{i as be,r as xe,t as Se}from"./git-toolbar-C2UV0e-7.js";import{t as M}from"./info-DA1x_4bz.js";import{t as Ce}from"./loader-circle-CPBhhDbB.js";import{n as we,r as Te}from"./diff-controls-MH41LnIp.js";import{c as Ee,i as De,t as Oe}from"./reference-chip-BLHAGMsc.js";import{t as N}from"./button-B7MKxYjT.js";import{i as P,l as ke,p as Ae,r as je,t as Me}from"./dropdown-menu-4e2iKSMT.js";import{t as F}from"./project-router-BypHPat0.js";import{t as Ne}from"./status-dot-BRzVlF2X.js";import{a as Pe,o as Fe}from"./format-BU7D3IfE.js";import{d as Ie,n as Le,o as Re,s as ze,t as Be,u as Ve}from"./page-shell-7pLJMOgh.js";import{t as I}from"./centered-state-V15AR_qo.js";import{An as He,At as Ue,Bt as We,Dt as Ge,E as Ke,En as qe,Ft as L,Gt as R,Ht as z,It as Je,Jt as B,Kt as V,Lt as Ye,Mn as Xe,Mt as Ze,Nt as Qe,Ot as $e,Pt as et,Rt as tt,T as nt,Ut as H,Vt as U,Wt as W,Xn as G,Xt as K,dn as rt,fr as q,jn as it,jt as at,kt as ot,qt as J,rr as st,ur as ct,zt as lt}from"./index-vn8Qvze5.js";import{t as ut}from"./markdown-BBDDg-4t.js";import{t as dt}from"./diff-DkNv9F1S.js";import{t as ft}from"./change-counts-npLATh-3.js";import{n as pt,r as mt}from"./commit-list-jX22pZgi.js";var Y=e(t(),1);function ht(e,t){let n=S(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(T.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var gt=ge(`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`}]]),_t=ge(`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`}]]),X=n();function vt(){let e=r(),t=o(),n=S(),i=ht({queryKey:u.repo})>0,s=t.data?.info?t.data:null,c=Ge(e,s,`screen`);return(0,X.jsx)(Ve,{route:`repo-git`,density:s?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,X.jsx)(ze,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:u.repo}),n.invalidateQueries({queryKey:u.worktrees})},children:(0,X.jsx)(ce,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,X.jsxs)(`div`,{"data-slot":`git-screen`,children:[s?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(Ue,{scope:e,repo:s,info:s.info,variant:`screen`},e)}):t.isPending?(0,X.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,X.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,X.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,X.jsx)($e,{branch:s?.info?.branch??null,counts:c,variant:`screen`})]})})}function yt({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function bt({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=ee(),c=g(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=S(),f=d({mutationFn:e=>C({name:e},n),onSuccess:async e=>{w(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=>Ze(t,n,e.branch))},onError:e=>w(e.message,{tone:`danger`})}),[p,m]=(0,Y.useState)(``),[h,_]=(0,Y.useState)(``),v=h.trim().toLowerCase(),te=Z(e,c.data?.branches),y=v?te.filter(e=>e.toLowerCase().includes(v)):te;return(0,X.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,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(se,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,X.jsx)(G,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,X.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:[y.map(e=>{let n=e===t.branch,r=l.get(e);return(0,X.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,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,X.jsx)(Tt,{entry:r}):null]}),r?(0,X.jsx)(yt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.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,X.jsxs)(N,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:f.isPending,onClick:()=>f.mutate(e),children:[(0,X.jsx)(ie,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),y.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,X.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=p.trim();t&&f.mutate(t,{onSuccess:()=>m(``)})},children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t.branch}),`.`]}),(0,X.jsx)(G,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-soft-foreground`,value:p,onChange:e=>m(e.target.value)}),(0,X.jsxs)(N,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!p.trim()||f.isPending,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,X.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,X.jsx)(xt,{}):null]})}function xt(){let e=p({limit:20});return(0,X.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,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,X.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,X.jsx)(St,{pr:e},e.number))}):(0,X.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 St({pr:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,X.jsx)(Ct,{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,X.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,X.jsx)(`span`,{className:n,children:t})})}function Ct({checks:e}){let t=e===`passing`?_e:e===`failing`?ve:ct;return(0,X.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,X.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var wt={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function Tt({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs 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:wt[e.class]})}function Z(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 Et(){let e=c(),t=K(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!0),[o,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),d=(0,Y.useRef)(null),f=e.isError&&e.error instanceof v&&e.error.status===409,p=e.data?.files??[],m=(0,Y.useMemo)(()=>xe(p),[p]),h=(0,Y.useMemo)(()=>p.some(ut),[p]),g=t?n:`unified`;return(0,X.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,X.jsx)(I,{icon:f?(0,X.jsx)(O,{size:16}):(0,X.jsx)(j,{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,X.jsx)(I,{icon:(0,X.jsx)(O,{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,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsx)(Se,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,X.jsx)(Te,{preview:o,onPreviewChange:s}):null,(0,X.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,X.jsx)(we,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,X.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,X.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,X.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(be,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,X.jsx)(dt,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function Dt({repo:e,info:t}){let{sha:n}=re(),r=e.log,i=(0,Y.useMemo)(()=>We(r),[r]);if(n)return(0,X.jsx)(At,{sha:n});let a=Je(e,t),o=a&&a.behind>0?(0,X.jsx)(kt,{info:t,tracking:a}):null;return r.length===0?(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsx)(`div`,{children:o}):null,(0,X.jsx)(I,{icon:(0,X.jsx)(ue,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,X.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,X.jsxs)(F,{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,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(pt,{sha:e.hash}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,X.jsx)(`span`,{title:lt(e.when,e.at),children:tt(e.when,e.at)})]})]})]}),(0,X.jsx)(Ot,{source:e.source})]},e.hash))})]},e.label))]})}function Ot({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-xs text-muted-foreground md:flex`;return e?(0,X.jsxs)(F,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(oe,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function kt({info:e,tracking:t}){let n=Qe(r(),e),i=(0,Y.useRef)(null);return(0,X.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,X.jsx)(gt,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.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,X.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,X.jsx)(Ce,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(de,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(at,{checkout:n,returnFocus:i})]})}function At({sha:e}){return(0,X.jsx)(mt,{commit:s(e),sha:e,backTo:K()?`/git`:et,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 jt=`Squash-merged branches may show as not landed without GitHub`;function Mt(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 Nt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function Pt(){let e=g(),t=h(),n=r(),i=_(),[a,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.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,X.jsx)(I,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Mt(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=Nt(e.data.branches),u=l>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,X.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,X.jsx)(F,{to:L.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,X.jsxs)(De,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.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,X.jsx)(Ft,{}),u,s.length===0?(0,X.jsx)(Be,{icon:(0,X.jsx)(st,{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,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(F,{to:L.cleanup,children:`Check cleanup`})}),(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(F,{to:`/`,children:`View tasks`})})]})}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{children:e.note})]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,X.jsx)(It,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,X.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,X.jsx)(M,{"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,X.jsx)(Le,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,X.jsx)(N,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,X.jsx)(F,{to:L.cleanup,children:`Open cleanup`})})}):null]})]}),(0,X.jsx)(Vt,{entry:a,onClose:()=>o(null)})]})}function Ft({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,X.jsx)(M,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),jt,`.`]})}function It({entry:e,finishedAt:t,onDelete:n}){return(0,X.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,X.jsx)(zt,{entry:e,finishedAt:t}),(0,X.jsx)(Lt,{entry:e}),(0,X.jsx)(Rt,{entry:e,onDelete:n})]})}function Lt({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.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,X.jsx)(Oe,{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,X.jsx)(Bt,{entry:e})]}):null})}function Rt({entry:e,onDelete:t}){let n=S(),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=d({mutationFn:()=>b(e.runId),onSuccess:e=>{w(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:u.repoBranches}),n.invalidateQueries({queryKey:u.runs.all})},onError:e=>w(e instanceof v&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),c=()=>void navigator.clipboard.writeText(e.name).then(()=>w(`Copied ${e.name}`),()=>w(`Could not copy the branch name`,{tone:`danger`})),l=`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,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(F,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(_t,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:c,className:a(l,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(me,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(Me,{children:[(0,X.jsx)(Ae,{"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,X.jsx)(he,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(je,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(P,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(F,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,X.jsx)(P,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,X.jsx)(P,{className:a(!r&&`md:hidden`),onSelect:c,children:`Copy branch`}),(0,X.jsx)(ke,{className:`md:hidden`}),(0,X.jsx)(P,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function zt({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=Pe(i),o=e.runStatus?qe(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(ye,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,X.jsx)(Ne,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(ft,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,X.jsx)(F,{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,X.jsx)(yt,{entry:e})]})]})}function Q(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Bt({entry:e}){let t=m(Ee(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{}),(0,X.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Vt({entry:e,onClose:t}){let n=S(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=d({mutationFn:e=>x({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;w(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:u.repo}),s()},onError:e=>w(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,X.jsx)(U,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(W,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(J,{children:[(0,X.jsxs)(B,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.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,X.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,`”`,e?.lastCommit.sha?(0,X.jsxs)(X.Fragment,{children:[` (`,(0,X.jsx)(Xe,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(G,{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,X.jsxs)(V,{children:[(0,X.jsx)(H,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(z,{"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 Ht({base:e}){let t=g(),n=S(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],f=d({mutationFn:e=>x({names:e}),onSuccess:e=>{let t=e.refused.length;w(`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:u.repo})},onError:e=>{n.invalidateQueries({queryKey:u.repo}),w(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,X.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||f.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,X.jsx)(le,{"aria-hidden":`true`,className:`size-[12px]`}),f.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,X.jsx)(Ut,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:jt.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(Ut,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(U,{open:a,onOpenChange:o,children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(J,{children:[(0,X.jsxs)(B,{children:[`Delete `,p,` `,m,`?`]}),(0,X.jsxs)(R,{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,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep them`}),(0,X.jsxs)(z,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{f.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function Ut({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.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,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(pe,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.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-xs`,children:[(0,X.jsx)(He,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,X.jsx)(F,{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,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(it,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function $(e){return e.some(e=>e.sizeBytes===null)?null:e.reduce((e,t)=>e+(t.sizeBytes??0),0)}function Wt(e){return e.kind===`dirty`?`${e.uncommittedFiles} uncommitted`:e.kind===`detached-head`?`detached HEAD`:e.kind===`submodules`?`has submodules`:`broken worktree`}function Gt(e){if(e.kind===`dirty`){let t=`${e.uncommittedFiles} uncommitted file${e.uncommittedFiles===1?``:`s`}`;return e.detachedHead?`${t} and a detached HEAD on no branch`:t}return e.kind===`detached-head`?`a detached HEAD whose commit is on no branch`:e.kind===`submodules`?`initialized submodules that Git will not remove without force`:`an unregistered or broken Git worktree directory`}function Kt(e){let t=e.some(e=>e.reclaimBlocker?.kind===`dirty`),n=e.some(e=>e.reclaimBlocker?.kind===`detached-head`||e.reclaimBlocker?.kind===`dirty`&&e.reclaimBlocker.detachedHead),r=e.some(e=>e.reclaimBlocker?.kind===`submodules`),i=e.some(e=>e.reclaimBlocker?.kind===`invalid`),a=[...t?[`uncommitted work`]:[],...n?[`a detached HEAD`]:[],...r?[`initialized submodules`]:[],...i?[`a broken checkout`]:[]];return a.length<=1?a[0]??`uncommitted work`:`${a.slice(0,-1).join(`, `)} or ${a.at(-1)}`}function qt(e,t,n){let r=Math.max(0,t-e);return e===0?r===0?`Nothing to reclaim — no finished worktrees exceed the keep limit`:n?`Nothing was reclaimed — the worktrees past the keep limit are in use or could not be removed`:`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Reclaimed ${e} worktree${e===1?``:`s`} (branch kept)${r>0?` · ${r} kept: ${n?`in use or could not be removed`:`uncommitted work or in use`}`:``}`}function Jt(e,t){return e===0?`Reclaim now`:t?`Reclaim ${D(t)} now`:`Reclaim ${e} now`}function Yt(e,t,n){let r=t?D(t):String(e);return n?`Discard & reclaim all ${r}`:`Discard & reclaim ${r}`}function Xt(e,t){if(!e)return t>0?`No clean worktrees past the keep limit — use Discard & reclaim for blocked worktrees`:`Nothing past the keep limit to reclaim`}function Zt(e){return e===0?{prefix:`Retention is unlimited (`,suffix:`), so nothing is reclaimed on its own.`}:{prefix:`Retention keeps the newest ${e} finished checkout${e===1?``:`s`} (`,suffix:`) and reclaims the rest.`}}function Qt({blocked:e,discardLabel:t,disabled:n,onDiscard:r}){let i=$(e),a=e.length===1?``:`s`,o=e.length===1?`it has`:`they have`;return(0,X.jsxs)(`div`,{"data-slot":`worktrees-blocked-banner`,className:`flex flex-col gap-[10px] border-b border-border bg-muted/40 px-[14px] py-[10px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-[17px] text-foreground`,children:[e.length,` worktree`,a,` past the keep limit`,i?` (${D(i)})`:``,` `,`cannot be reclaimed automatically because `,o,` `,Kt(e),`.`]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-discard-reclaim`,disabled:n,onClick:r,className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] border border-danger/40 px-[10px] text-[12px] font-medium text-danger hover:bg-danger/10 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 md:self-center`,children:[(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[12px]`}),t]})]})}function $t({confirmClean:e,onCloseClean:t,cleanCount:n,cleanBytes:r,reclaimLabel:i,onConfirmClean:a,discardBatch:o,onCloseDiscardBatch:s,onConfirmDiscardBatch:c,discardRow:l,onCloseRow:u,onConfirmRow:d}){let f=o?$(o):null,p=o?o.filter(e=>e.reclaimBlocker!==null).length:0,m=o?o.some(e=>!e.reclaimBlocker):!1,h=o?Yt(o.length,f,m):``;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(U,{open:e,onOpenChange:e=>{e||t()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(J,{children:[(0,X.jsx)(B,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(R,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${D(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep them`}),(0,X.jsx)(z,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,X.jsx)(U,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(J,{children:[(0,X.jsx)(B,{children:`Discard changes and reclaim worktrees?`}),(0,X.jsx)(R,{children:o?(0,X.jsxs)(X.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${D(f)})`:``,` will be reclaimed now.`,` `,`Uncommitted files and detached-HEAD commits in `,p,` blocked checkout`,p===1?``:`s`,` will be permanently discarded. Each task’s branch is kept.`]}):null})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep them`}),(0,X.jsx)(z,{"data-action":`worktrees-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{o&&c(o),s()},children:h})]})]})}),(0,X.jsx)(U,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,X.jsxs)(W,{children:[(0,X.jsxs)(J,{children:[(0,X.jsx)(B,{children:`Discard changes and reclaim worktree?`}),(0,X.jsx)(R,{children:l?.reclaimBlocker?(0,X.jsxs)(X.Fragment,{children:[l.title,` has `,Gt(l.reclaimBlocker),`. Reclaiming removes the directory and permanently discards uncommitted or unbranched changes in it. The branch (`,l.branch??l.runId.slice(0,8),`) is kept.`]}):null})]}),(0,X.jsxs)(V,{children:[(0,X.jsx)(H,{children:`Keep it`}),(0,X.jsx)(z,{"data-action":`worktree-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{l&&d(l),u()},children:`Discard & reclaim`})]})]})})]})}function en(){let e=f(),t=l().data?.targets.find(e=>e.id===`finder`),n=d({mutationFn:e=>te(e,t.id),onError:e=>w(e.message,{tone:`danger`})}),r=S(),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),[c,p]=(0,Y.useState)(null),m=()=>Promise.all([r.invalidateQueries({queryKey:u.worktrees}),r.invalidateQueries({queryKey:u.repoBranches})]),h=d({mutationFn:({runIds:e})=>ne(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{m(),w(qt(e.reclaimed.length,t,!!n))},onError:e=>w(e.message,{tone:`danger`})}),g=d({mutationFn:({worktree:e,discardWork:t})=>y(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{m(),w(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{m(),w(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:_,totalBytes:ee,keep:v}=e.data,b=h.isPending||g.isPending,x=_.filter(e=>e.pastKeep),C=x.filter(e=>!e.reclaimBlocker),T=x.filter(e=>e.reclaimBlocker!==null),E=C.length>0,re=$(C),ie=$(x),O=Jt(C.length,re),ae=Yt(x.length,ie,E),k=ee?D(ee):null,A=Zt(v);return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,k?` · ${k}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[A.prefix,(0,X.jsx)(F,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:rt(`worktrees`,` › `)}),A.suffix,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:b||!E,title:Xt(E,T.length),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,X.jsx)(q,{"aria-hidden":`true`,className:`size-[12px]`}),O]})]}),T.length>0?(0,X.jsx)(Qt,{blocked:T,discardLabel:ae,disabled:b,onDiscard:()=>s(x)}):null,_.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:_.map(e=>(0,X.jsx)(rn,{worktree:e,keep:v,disabled:b,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?p(e):g.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,X.jsx)($t,{confirmClean:i,onCloseClean:()=>a(!1),cleanCount:C.length,cleanBytes:re,reclaimLabel:O,onConfirmClean:()=>{h.mutate({expected:C.length}),a(!1)},discardBatch:o,onCloseDiscardBatch:()=>s(null),onConfirmDiscardBatch:e=>{h.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:c,onCloseRow:()=>p(null),onConfirmRow:e=>g.mutate({worktree:e,discardWork:!0})})]})}var tn=new Set([`queued`,`running`,`waiting`,`review`]);function nn(e,t){return tn.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`,state:`in-use`}:e.reclaimBlocker?{label:Wt(e.reclaimBlocker),tone:`blocked`,state:`blocked`}:e.pastKeep?{label:`reclaimable`,tone:`plain`,state:`reclaimable`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`,state:`kept`}}function rn({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=nn(e,t),c=Pe(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Fe(c)}`:e.status,u=s.tone===`in-use`?`text-status-running`:s.tone===`blocked`?`text-danger`:`text-soft-foreground`,d=e.reclaimBlocker?`Cannot auto-reclaim: ${Gt(e.reclaimBlocker)}`:void 0,f=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.state,title:d,className:a(`text-xs`,u),children:s.label}),p=`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`,m=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,h=e.reclaimBlocker?`Discard changes and reclaim the directory (branch kept)`:`Reclaim the directory (branch kept)`;return(0,X.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,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:D(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:f}),r?(0,X.jsx)(`button`,{type:`button`,className:p,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(ae,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":m,title:h,disabled:n,onClick:o,className:a(p,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function an(e){return e===`main`||e===`changes`?`Split`:`Table`}function on({section:e,index:t=!1}){let n=o(),r=K(),[i]=E(),a=an(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(vt,{});if(n.isPending)return(0,X.jsx)(nt,{});if(n.isError)return(0,X.jsx)(Re,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(Ke,{}),children:(0,X.jsx)(I,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,X.jsx)(sn,{repo:n.data,info:s,section:e}):(0,X.jsx)(Re,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,X.jsx)(Ke,{}),children:(0,X.jsx)(I,{icon:(0,X.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 sn({repo:e,info:t,section:n}){let r=an(n),i=g(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Z(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,X.jsx)(Re,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:Ie(a),rootProps:{"data-git-section":n},beforeHeader:(0,X.jsx)(Ke,{}),header:{title:ot(n,t.branch),headerSlot:`repo-header`,subtitle:(0,X.jsx)(cn,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,X.jsx)(Dt,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(Pt,{}):n===`cleanup`?(0,X.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,X.jsx)(en,{}),(0,X.jsx)(Ht,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(bt,{repo:e,info:t}):(0,X.jsx)(Et,{})})}function cn({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.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?` · ${Ye(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(ln,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function ln({repo:e,info:t}){let n=Z(e,g().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{on 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{B as r,N as i}from"./queries-EvENG6TN.js";import{Fn as a,nt as o}from"./toaster-Cer2NOxt.js";import{f as s,g as c,h as l,i as u,n as d,p as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as p,r as m}from"./design-icons-CzEoMH9c.js";import{a as h,c as g,l as _,s as v,t as y}from"./file-preview-Df_sAIjc.js";import{t as b}from"./button-B7MKxYjT.js";import{t as x}from"./centered-state-V15AR_qo.js";import{_ as S,g as C,v as w}from"./index-vn8Qvze5.js";import{r as T}from"./html-report-BX3msvci.js";import{t as E}from"./html-report-frame-uuqkBC0u.js";var D=e(t(),1),O=n();function k(){let e=s(),t=f();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=A(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function A(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function j(e){return e?.type===`file`?e:null}function M(){let[e]=c(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function N(){let{id:e=``}=l(),t=M(),n=s(),r=k();return(0,O.jsx)(P,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function P({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:c,selected:l,result:d}=I(e,t,a),f=w(C,!0),p=w(S,!1),m=s(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(i===`route`&&L(_))return(0,O.jsx)(u,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,o),y=i===`pane`&&!p&&!f?`Conversation`:`Back`,b=i===`pane`&&!h&&R(_),x=F(m.pathname,e,t);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,O.jsx)(B,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,O.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,O.jsx)(V,{conflict:c,selected:l,result:d,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function F(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function I(e,t,n){let{path:a=null,artifactId:o=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=r(e,o||s||c?null:a),u=i(e,s||c?null:o),d=c&&n?{...n,data:void 0}:o?u:l;return{path:a,conflict:s,selected:a!==null||o!==null,result:d}}function L(e){return e!==null&&(!T(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function R(e){return e!==null&&!e.tooLarge&&!e.binary}function z(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function B({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,O.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,O.jsxs)(b,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":s,children:[(0,O.jsx)(m,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,O.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?`Published snapshot · ${new Date(d.createdAt).toLocaleString()}`:`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(b,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,d&&!c?(0,O.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:o(e,d.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,O.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,O.jsx)(H,{result:n});let c=n.data;return c.type===`file`?o&&!T(c.path)?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,O.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(_,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,O.jsx)(`div`,{className:`bg-card`,children:(0,O.jsx)(y,{path:c.path,text:c.content??``})}):(0,O.jsx)(E,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function H({result:e}){let t=e.error instanceof a&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(v,{}):(0,O.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,O.jsx)(b,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function U({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,O.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,O.jsx)(x,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
|
|
@@ -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{N as a,Rt as o,ct as s}from"./queries-EvENG6TN.js";import{Hr as c,In as l,Ln as u,Wr as d,br as f,hi as p,pi as m,ri as h,zn as g}from"./toaster-Cer2NOxt.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-DMhTnCmf.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as D}from"./design-icons-CzEoMH9c.js";import{t as O}from"./arrow-up-right-DKGzsMqY.js";import{t as k}from"./chevron-right-BENZ-1ZN.js";import{t as A}from"./eye-B8okNWXU.js";import{t as j}from"./button-B7MKxYjT.js";import{t as M}from"./project-router-BypHPat0.js";import{a as ee}from"./format-BU7D3IfE.js";import{d as te,l as ne,n as re,r as N,t as P}from"./page-shell-7pLJMOgh.js";import{t as F}from"./use-search-params-writer-ClMScnNe.js";import{Xn as I,Xt as L,ar as R,pn as z}from"./index-vn8Qvze5.js";import{t as B}from"./report-title-D4Mbu2Er.js";import{t as V}from"./html-report-frame-uuqkBC0u.js";var H=e(t(),1),U=1e3,W=S().min(1).max(1024);_({q:S().max(U).optional(),before:W.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var G=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:f}).strict()),nextCursor:W.nullable(),total:w().int().nonnegative()}).strict(),K=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),q=_({runId:b(),taskTitle:S(),taskStatus:f}).strict(),J=v(`type`,[K.extend({type:y(`snapshot`)}),K.extend({type:y(`content`)}),K.extend({type:y(`metadata`),runs:x(q)})]),Y=new WeakMap;function ie(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 ae=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=ie(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 oe(e,t){let n=Y.get(e);n||(n=new Map,Y.set(e,n));let r=n.get(t);return r||(r=new ae(e,t),n.set(t,r)),r}async function se(e,t){let n=await l.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},u({signal:t}));return K.parse(await g(n,`/reports/state`))}function ce(e){let t=oe(p(),e);return(0,H.useEffect)(()=>{let n=o(`reports:project:${e}`,e=>{let n=J.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(c()===`finite`&&!r){i=new AbortController;let n=i.signal;se(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=s({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=K.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else c()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let l=d(a);return()=>{l(),i?.abort(),r?.(),n()}},[t,e]),t}async function le(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,U),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return G.parse(await g(i,`/reports`))}function X(e){let t=r(),n=ce(t);return h({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>le(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=L(),[n,r]=(0,H.useState)(!1);return(0,H.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]=F(),a=(n.get(`q`)??``).slice(0,U),o=X(a),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.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,H.useState)(null),h=de(s);(0,H.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,U)):n.delete(`q`),Q.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:te(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)(D,{"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)(I,{maxLength:U,"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)(j,{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)(P,{icon:(0,Z.jsx)(R,{}),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:[z(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Z.jsx)(j,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Z.jsx)(j,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Z.jsx)(M,{to:`/new`,children:`Start a task`})})})}):(0,Z.jsx)(N,{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)(R,{"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:B(e),children:(0,Z.jsx)(M,{"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:B(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)(M,{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 ${B(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)(A,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Z.jsx)(k,{"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)(j,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Z.jsx)(re,{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,H.useContext)(m)!==void 0;return(0,Z.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${B(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:B(e)}),(0,Z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,$(e.createdAt)]})]}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Z.jsxs)(M,{"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)(O,{"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=a(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)(j,{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:B(e),className:`min-h-0 flex-1`})}function $(e){let t=ee(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{fe as ReportsRoute};
|
|
@@ -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{B as i,F as a,N as o,Y as s,et as c}from"./queries-EvENG6TN.js";import{Fn as l,ft as u,nt as d}from"./toaster-Cer2NOxt.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-NMRiSpOB.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-Df_sAIjc.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,S as N,Xn as P,ar as F}from"./index-vn8Qvze5.js";import{r as I}from"./markdown-W3RfjqPg.js";import{t as L}from"./task-file-scope-DVxMmRVI.js";var R=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),z=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),B=e(t(),1),V=n();function H({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,B.useContext)(I),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,B.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,V.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,V.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:`Could not load this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,V.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,V.jsx)(I.Provider,{value:g,children:(0,V.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:new Date(v.createdAt).toLocaleString()}:{}},v?.id??h.path)})}var U=new Map;function W(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var G=(0,B.createContext)(null);function K(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,B.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var q=()=>document.querySelector(`[data-slot="main"]`);function J(e,t){let n=(0,B.useRef)(null),r=f(),i=h()===`POP`?r.key:W(r.state),[a]=(0,B.useState)(()=>{let t=i?U.get(i):void 0;return t?.runId===e?t:null}),o=(0,B.useRef)(new Set(a?.folders??[])),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),u=(0,B.useRef)(a===null),d=(0,B.useCallback)(()=>{u.current&&U.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:q()?.scrollTop??0})},[r.key,e]),p=(0,B.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,B.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=q();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,B.useEffect)(()=>{d();let e=[n.current,q()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function Y({runId:e,selected:t,onSelect:n}){return(0,V.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function X({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,B.useContext)(G);return(0,B.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,V.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,V.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,V.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,V.jsx)(V.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,V.jsx)(Z,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,V.jsx)(Q,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Z({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,B.useContext)(G),[c,l]=(0,B.useState)(()=>s?.isOpen(n)??!1);return(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,V.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function Q({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?z:g;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,V.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function $(){let{id:e}=m(),t=s(e),n=K();return t.isPending?(0,V.jsx)(M,{tab:`files`}):t.isError?(0,V.jsx)(N,{tab:`files`,error:t.error}):(0,V.jsx)(L,{runId:t.data.id,children:(0,V.jsx)(te,{run:t.data},`${t.data.id}:${n}`)})}function ee(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function te({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,B.useState)(o??``);(0,B.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=ee(e.id,o,s,u),_=J(e.id,!t.isPending&&g);return(0,V.jsxs)(A,{route:`task-files`,density:ne(t.isError),flushPadding:!0,children:[(0,V.jsx)(C,{run:e,tab:`files`}),(0,V.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,V.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,V.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,V.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,V.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,V.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,V.jsx)(j,{icon:h?(0,V.jsx)(R,{}):(0,V.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,V.jsx)(G.Provider,{value:_.folders,children:(0,V.jsx)(Y,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,V.jsx)(re,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,V.jsx)(H,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,V.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ne(e){return e?`empty`:`full`}function re({artifacts:e,artifactId:t,onSelect:n}){return(0,V.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,V.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,V.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,V.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,V.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,V.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,V.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,V.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
|