@wjarka/cezarion 0.18.0-dev.7868 → 0.18.0-dev.7876

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/activity-motion-BNen0Yj8.js +2 -0
  3. package/web/dist/assets/{activity-route-B-A7ZeQX.js → activity-route-BGQMI1Yu.js} +1 -1
  4. package/web/dist/assets/attention-B0IBc2_D.js +1 -0
  5. package/web/dist/assets/commit-diff-panel-Cr-XVbz_.js +1 -0
  6. package/web/dist/assets/{diff-BD8D6wN_.js → diff-DqLaONaB.js} +2 -2
  7. package/web/dist/assets/{diff-view-DVTSV8ww.js → diff-view-CHj5zMlT.js} +1 -1
  8. package/web/dist/assets/{file-preview-dCKWal92.js → file-preview-C9yv3267.js} +1 -1
  9. package/web/dist/assets/{git-toolbar-DUve6NCP.js → git-toolbar-uHPKACQa.js} +1 -1
  10. package/web/dist/assets/github-Fy6-Zf4b.js +1 -0
  11. package/web/dist/assets/{global-activity-route-B1QiK1O4.js → global-activity-route-CpAGVfbb.js} +1 -1
  12. package/web/dist/assets/index-Dn02NPUV.js +14 -0
  13. package/web/dist/assets/{markdown-Dq4ad2_X.js → markdown-9j2EqN9q.js} +1 -1
  14. package/web/dist/assets/{picker-pill-CV8i0S1a.js → picker-pill-D8SyrTxD.js} +1 -1
  15. package/web/dist/assets/{preview-pane-connected-COcr_l_O.js → preview-pane-connected-CBKK0crt.js} +1 -1
  16. package/web/dist/assets/{project-router-CgSlk0dT.js → project-router-CcyPWtFH.js} +1 -1
  17. package/web/dist/assets/{project-scope-context-CjF9fBcW.js → project-scope-context-CX36ze1Q.js} +1 -1
  18. package/web/dist/assets/{prompt-template-menu-DCTzkDjy.js → prompt-template-menu-DT_0Pyd5.js} +1 -1
  19. package/web/dist/assets/queries-Cb76PEoL.js +1 -0
  20. package/web/dist/assets/{reference-chip-D0fgKbcF.js → reference-chip-DwiE3MIR.js} +1 -1
  21. package/web/dist/assets/{repo-git-Lm4AXJZJ.js → repo-git-CjKFvYdb.js} +1 -1
  22. package/web/dist/assets/{report-reader-DhJRV-ep.js → report-reader--BXJs1DJ.js} +1 -1
  23. package/web/dist/assets/{reports-_JWpoOxU.js → reports-CZw5ztdC.js} +1 -1
  24. package/web/dist/assets/run-header-BOEjnB1z.js +2 -0
  25. package/web/dist/assets/{runners-B05nICNv.js → runners-CKrq5tR_.js} +1 -1
  26. package/web/dist/assets/{skills-B9B_uQe8.js → skills-aBp_7vVU.js} +1 -1
  27. package/web/dist/assets/{tab-link-CHCa9yZ_.js → tab-link-Dn7KFNYr.js} +1 -1
  28. package/web/dist/assets/{task-changes-BEIk73oA.js → task-changes-B0u392zf.js} +1 -1
  29. package/web/dist/assets/task-commits-DzWFfo43.js +1 -0
  30. package/web/dist/assets/{task-files-CKVvbzxW.js → task-files-DTWfdMRi.js} +1 -1
  31. package/web/dist/assets/{task-github-item-DUEU1hZk.js → task-github-item-CFWE3MpX.js} +1 -1
  32. package/web/dist/assets/{task-thread-BahatLkP.js → task-thread-vYwAvLtU.js} +6 -6
  33. package/web/dist/assets/{thread-state-BE_9DmK6.js → thread-state-zGEm4Ym4.js} +1 -1
  34. package/web/dist/assets/{use-desktop-DBmPhWpf.js → use-desktop-DN7wbSS7.js} +1 -1
  35. package/web/dist/assets/{use-hand-to-agent-state-A1CYX_Z1.js → use-hand-to-agent-state-C9YTgLEG.js} +1 -1
  36. package/web/dist/assets/{useInfiniteQuery-BDN_oL8i.js → useInfiniteQuery-BdIIhzMI.js} +1 -1
  37. package/web/dist/assets/useQuery-Dg1rzYtR.js +1 -0
  38. package/web/dist/assets/{workflows-ScqK5wu_.js → workflows-C8EnR0NU.js} +2 -2
  39. package/web/dist/assets/{ws-cDmTA0eG.js → ws-DiWUfn_t.js} +1 -1
  40. package/web/dist/index.html +13 -13
  41. package/web/dist/assets/activity-motion-D41kdnUG.js +0 -2
  42. package/web/dist/assets/attention-CczhK23N.js +0 -1
  43. package/web/dist/assets/commit-diff-panel-BQOM47PK.js +0 -1
  44. package/web/dist/assets/github-Dq3IahY3.js +0 -1
  45. package/web/dist/assets/index-30DUDWal.js +0 -14
  46. package/web/dist/assets/queries-CzcxBTP6.js +0 -1
  47. package/web/dist/assets/run-header-CL8kbai6.js +0 -2
  48. package/web/dist/assets/task-commits-BqqhwbOC.js +0 -1
  49. package/web/dist/assets/useQuery-DXuahdZA.js +0 -1
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{Bt as o,E as s,Ut as c,a as l,j as u,ti as d}from"./project-scope-context-CjF9fBcW.js";import{At as f,Et as p,Ft as ee,Yt as m,t as te}from"./queries-CzcxBTP6.js";import{n as h}from"./toaster-Cxgzn9ip.js";import{J as g,S as _,X as v,at as y,b as ne,c as re,ft as ie,i as b,l as x,lt as S,n as ae,ot as oe,st as C,tt as se,v as w,x as T}from"./design-icons-B6-0w7Aw.js";import{i as E,p as ce,r as D,t as O}from"./dropdown-menu-D4zMgwkC.js";import{i as k,o as A,r as j,s as le,t as M}from"./dialog-DSwzMeY3.js";import{_ as ue,a as de,d as fe,g as pe,h as N,i as P,l as me,m as F,o as he,p as ge,r as _e,s as ve,t as ye,v as I}from"./sortable.esm-zp_qkYGV.js";import{i as L,l as be,o as xe}from"./skills-pM_PouEs.js";import{t as Se}from"./centered-state-CiiA8Vgw.js";import{O as Ce,U as R,dt as z,ft as B,gt as V,ht as H,lt as U,mt as W,pt as G,tn as K,ut as we}from"./index-30DUDWal.js";var q=e(t(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Te(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Oe(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i,t as a}from"./button-C1fD-ZFr.js";import{A as o,Ht as s,T as c,i as l,ti as u,zt as d}from"./project-scope-context-CX36ze1Q.js";import{Pt as f,Tt as p,Yt as m,kt as ee,t as te}from"./queries-Cb76PEoL.js";import{n as h}from"./toaster-Cxgzn9ip.js";import{J as g,S as _,X as v,at as y,b as ne,c as re,ft as ie,i as b,l as x,lt as S,n as ae,ot as oe,st as C,tt as se,v as w,x as T}from"./design-icons-B6-0w7Aw.js";import{i as E,p as ce,r as D,t as O}from"./dropdown-menu-D4zMgwkC.js";import{i as k,o as A,r as j,s as le,t as M}from"./dialog-DSwzMeY3.js";import{_ as ue,a as de,d as fe,g as pe,h as N,i as P,l as me,m as F,o as he,p as ge,r as _e,s as ve,t as ye,v as I}from"./sortable.esm-zp_qkYGV.js";import{i as L,l as be,o as xe}from"./skills-pM_PouEs.js";import{t as Se}from"./centered-state-CiiA8Vgw.js";import{O as Ce,U as R,dt as z,ft as B,gt as V,ht as H,lt as U,mt as W,pt as G,tn as K,ut as we}from"./index-Dn02NPUV.js";var q=e(t(),1);function J(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Te(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ee(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function De(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Oe(e,t){return e.filter((e,n)=>n!==t)}function Y(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function X(e,t,n){let r=` `.repeat(n);return t.includes(`
2
2
  `)?[`${r}${e}: |`,...t.split(`
3
3
  `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Y(t)}`]}function ke(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${Y(e.name)}`),e.skill&&t.push(` skill: ${Y(e.skill)}`),t}function Ae(e){let t=[];return e.model&&t.push(` model: ${Y(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${Y(e.effort)}`),e.runner&&t.push(` runner: ${Y(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${Y(e.agentProfile)}`),t}function Z(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(Y).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(Y).join(`, `)}]`),t}function je(e){return e.onFail?[` onFail:`,` retry: ${Y(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function Me(e){return[` - id: ${Y(e.id)}`,...ke(e),...e.prompt?X(`prompt`,e.prompt,4):[],...Ae(e),...Z(e),...e.command?X(`command`,e.command,4):[],...je(e)]}function Ne(e,t,n){let r=[`name: ${Y(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...X(`description`,t.trim(),0));let i=J(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Y(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...Me(e))}else r.push(`skills: []`);return`${r.join(`
4
4
  `)}\n`}function Pe(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function Fe(e){let t=J(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ie(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function Le(e,t,n){let r=J(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var Q=n();function Re({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a}){return(0,Q.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,Q.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,Q.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,Q.jsx)(x,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsxs)(`select`,{id:`workflow-load`,value:e.some(e=>e.name===n)?n:``,onChange:t=>{let n=e.find(e=>e.name===t.target.value);n&&a(n)},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),e.map(e=>(0,Q.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,Q.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,Q.jsx)(K,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,onChange:e=>i({...t,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,Q.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,Q.jsx)(R,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]})}function ze({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,title:`Describe a chain — the agent builds it`,onClick:i,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),e?(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:o,children:[(0,Q.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Be({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,Q.jsx)(R,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsxs)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,Q.jsx)(S,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,Q.jsxs)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,Q.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ve({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:o,onRun:s,onCancel:c}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,Q.jsx)(le,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,Q.jsx)(R,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
5
  skills:
6
6
  - test-conventions
7
- - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function He({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(nt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(it,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function Ue({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(tt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function We({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(A,{children:[(0,Q.jsx)(le,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(K,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:c===e.id,onChange:()=>l(e.id)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,Q.jsxs)(a,{onClick:()=>l(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(a,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(a,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ge({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(B,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(G,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(U,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(B,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(G,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function Ke(e){return e.name??e.skill??e.id}function qe(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Je(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ye(e,t){return qe(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Xe(e,t){return e.command?Je(e):e.skill?Ye(e,t):e.prompt??``}function Ze(e,t){return e.skill&&!t?`unknown`:null}function Qe(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function $e({index:e,title:t,badge:n,onRemove:r,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:i(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,Q.jsxs)(O,{children:[(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(a,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(T,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(D,{align:`end`,children:(0,Q.jsxs)(E,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function et({index:e,onMoveUp:t,onMoveDown:n}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function tt({step:e,index:t,skills:n,onRemove:r,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=Ke(e),d=Xe(e,l),f=Ze(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:i(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)($e,{index:t,title:u,badge:f,onRemove:r,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:Qe(e)}),c?null:(0,Q.jsx)(et,{index:t,onMoveUp:o,onMoveDown:s})]})}function nt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=be(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(rt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function rt({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:a,setNodeRef:o,isDragging:s}=F({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:i(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...r,...a,children:[(0,Q.jsxs)(`span`,{className:i(`min-w-0 flex-1 break-words text-xs`,L(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`})})]})}function it({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var at=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ot(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function st(){let{name:e}=r();return(0,Q.jsx)(ct,{routeName:e},e??``)}function ct({routeName:e}){let t=f(),n=ee(),r=p(),i=d(),[_,v]=(0,q.useState)(null),[y,ne]=(0,q.useState)(``),[ie,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(``),[ae,C]=(0,q.useState)(null),[se,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(``),[ce,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(``),[le,M]=(0,q.useState)(!1),[de,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[ye,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=n.data??[],V=xe(B,r.data?.skillUsage),H=be(V,x,r.data?.skillUsage);(0,q.useEffect)(()=>{if(_!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);v(r?ot(r):$())},[_,t.data,e]);let U=e=>v(t=>t===null?t:{...t,steps:e}),W=m({mutationFn:e=>o(e),onSuccess:e=>{v({name:e.name,description:e.description??``,steps:e.steps}),w(!1),E(``),D(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>D(e.message)}),G=m({mutationFn:e=>c(e),onSuccess:e=>{v(t=>{let n=t??$(),{name:r,steps:i}=Ie(e,n.name);return{...n,name:r,steps:i}}),k(!1),j(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??_?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),K=m({mutationFn:e=>s({...Le(_?.name??``,_?.description??``,_?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{e instanceof l&&e.exists===!0?M(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),we=m({mutationFn:e=>u(e),onSuccess:(e,t)=>{N(!1),h(`Deleted "${t}".`),v($()),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{N(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),J=ue(pe(fe,{activationConstraint:{distance:4}}),pe(me,{coordinateGetter:_e}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Se,{icon:(0,Q.jsx)(oe,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(_===null)return(0,Q.jsx)(Ce,{});let Y=_.steps,X=_.name.trim(),ke=z.find(e=>e.name===X&&e.source===`file`),Ae=Ne(_.name,_.description,Y),Z=(e,t=Y.length)=>{if(Y.length>=8){h(`A workflow holds at most 8 steps.`,{tone:`danger`});return}U(Ee(Y,Te(e,Y),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(a,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>v($()),children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(he,{sensors:J,collisionDetection:ge,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===at?Y.length:Y.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?Y.length:e);return}if(n.id===t.id)return;let i=Y.findIndex(e=>e.id===t.id),a=Y.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&U(De(Y,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(Re,{workflows:z,draft:_,trimmedName:X,nameRef:L,onDraft:v,onLoadWorkflow:e=>v(ot(e))}),(0,Q.jsx)(ze,{savedFile:ke,autoOpen:O,onImportToggle:()=>{D(``),k(!1),w(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Pe(_.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),k(e=>!e)},onDeleteRequest:()=>N(!0)}),O?(0,Q.jsx)(Be,{text:A,onTextChange:j,pending:G.isPending,onRun:()=>{let e=A.trim();e===``||G.isPending||G.mutate(e)},onCancel:()=>{k(!1),j(``)}}):null,(0,Q.jsx)(Ve,{open:se,onOpenChange:w,text:T,onTextChange:E,error:ce,pending:W.isPending,onRun:()=>{let e=T.trim();e!==``&&W.mutate(e)},onCancel:()=>{w(!1),E(``),D(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,Y.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Fe(Y)})]}),(0,Q.jsx)(lt,{steps:Y,skills:B,dragging:P!==null,overId:ye,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>U(Oe(Y,e)),onMove:(e,t)=>U(De(Y,e,t))}),(0,Q.jsxs)(a,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{C(null),S(``),b(!0)},children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(a,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:K.isPending,onClick:()=>{if(X===``){L.current?.focus();return}if(Y.length===0){h(`Add at least one step first.`,{tone:`danger`});return}K.mutate(!1)},children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(He,{paletteSkills:V,query:y,onQueryChange:ne,error:n.isError?n.error.message:null,inFlow:new Set(Y.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(ve,{children:(0,Q.jsx)(dt,{dragging:P,steps:Y,skills:B})})]}),(0,Q.jsx)(We,{open:ie,onOpenChange:b,query:x,onQueryChange:S,matches:H,skillsCount:B.length,error:n.isError?n.error.message:null,selectedSkill:ae,onSelectSkill:C,stepsCount:Y.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)}}),(0,Q.jsx)(Ge,{trimmedName:X,savedFile:ke,overwriteOpen:le,onOverwriteDismiss:()=>M(!1),deleteOpen:de,onDeleteDismiss:()=>N(!1),onOverwrite:()=>K.mutate(!0),onDelete:()=>we.mutate(X)})]})}function lt({steps:e,skills:t,dragging:n,overId:r,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=N({id:at}),u=n&&r===at;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:i(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:i(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(ye,{items:e.map(e=>e.id),strategy:de,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((i,c)=>(0,Q.jsx)(ut,{step:i,index:c,skills:t,dragging:n,insertBefore:n&&r===i.id&&a!==i.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},i.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:i(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function ut({step:e,index:t,insertBefore:n,onRemove:r,onMoveUp:a,onMoveDown:o}){let s=ee(e.runner,e.agentProfile),{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=P({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:I.Transform.toString(d),transition:f},className:i(`relative`,p&&`opacity-40`),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(tt,{step:e,index:t,skills:s.data??[],onRemove:r,onMoveUp:a,onMoveDown:o,gripProps:{...c,...l}})]})}function dt(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=ee(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(Ue,{...e,skills:t?n.data??[]:e.skills})}export{st as WorkflowsRoute};
7
+ - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,Q.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,Q.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,Q.jsx)(a,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:o,onClick:s,children:`Import`}),(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:c,children:`Cancel`})]})]})})}function He({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,Q.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,Q.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,Q.jsx)(v,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,Q.jsx)(K,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,Q.jsx)(nt,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,Q.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,Q.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,Q.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(_,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(it,{yaml:o})}),(0,Q.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11px] leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function Ue({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,Q.jsx)(tt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function We({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:o,error:s,selectedSkill:c,onSelectSkill:l,stepsCount:u,onCloseAutoFocus:d,onCancel:f,onAdd:p}){return(0,Q.jsx)(M,{open:e,onOpenChange:t,children:(0,Q.jsxs)(j,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:d,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,Q.jsxs)(A,{children:[(0,Q.jsx)(le,{className:`text-xl font-normal`,children:`Add step`}),(0,Q.jsx)(k,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,Q.jsx)(K,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),s===null?(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:c===e.id,onChange:()=>l(e.id)}),(0,Q.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,Q.jsx)(`span`,{className:`block`,children:e.name}),(0,Q.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,Q.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,s]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,Q.jsxs)(a,{onClick:()=>l(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,Q.jsx)(a,{variant:`outline`,onClick:f,children:`Cancel`}),(0,Q.jsx)(a,{variant:`primary`,disabled:!c||u>=8,onClick:()=>{c&&p(c)},children:`Add selected skill`})]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),u>=8?(0,Q.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ge({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{open:n,onOpenChange:e=>!e&&r(),children:(0,Q.jsxs)(B,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`“`,e,`” already exists`]}),(0,Q.jsx)(G,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,Q.jsx)(U,{open:i,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(B,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsxs)(V,{children:[`Delete workflow “`,e,`”?`]}),(0,Q.jsxs)(G,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(z,{children:`Keep the file`}),(0,Q.jsx)(we,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function Ke(e){return e.name??e.skill??e.id}function qe(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Je(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ye(e,t){return qe(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Xe(e,t){return e.command?Je(e):e.skill?Ye(e,t):e.prompt??``}function Ze(e,t){return e.skill&&!t?`unknown`:null}function Qe(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function $e({index:e,title:t,badge:n,onRemove:r,gripProps:o}){return(0,Q.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...o,children:(0,Q.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,Q.jsx)(`span`,{"data-slot":`wb-step-badge`,className:i(`shrink-0 rounded-full border px-2 py-px font-mono text-[11px]`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,r?(0,Q.jsxs)(O,{children:[(0,Q.jsx)(ce,{asChild:!0,children:(0,Q.jsx)(a,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${e+1} actions: ${t}`,children:(0,Q.jsx)(T,{"aria-hidden":`true`,className:`size-4`})})}),(0,Q.jsx)(D,{align:`end`,children:(0,Q.jsxs)(E,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${e+1}: ${t}`,onSelect:r,children:[(0,Q.jsx)(y,{"aria-hidden":`true`}),` Remove step`]})})]}):null]})}function et({index:e,onMoveUp:t,onMoveDown:n}){return(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,Q.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,Q.jsxs)(a,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function tt({step:e,index:t,skills:n,onRemove:r,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=Ke(e),d=Xe(e,l),f=Ze(e,l);return(0,Q.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:i(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,Q.jsx)($e,{index:t,title:u,badge:f,onRemove:r,gripProps:a}),d?(0,Q.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,Q.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[12px] text-link-foreground`,children:Qe(e)}),c?null:(0,Q.jsx)(et,{index:t,onMoveUp:o,onMoveDown:s})]})}function nt({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,Q.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=be(e,t);return(0,Q.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,Q.jsx)(rt,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,Q.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function rt({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:a,setNodeRef:o,isDragging:s}=F({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,Q.jsxs)(`div`,{ref:o,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:i(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,s&&`opacity-40`),...r,...a,children:[(0,Q.jsxs)(`span`,{className:i(`min-w-0 flex-1 break-words text-xs`,L(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,Q.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`})})]})}function it({yaml:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}var at=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ot(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function st(){let{name:e}=r();return(0,Q.jsx)(ct,{routeName:e},e??``)}function ct({routeName:e}){let t=ee(),n=f(),r=p(),i=u(),[_,v]=(0,q.useState)(null),[y,ne]=(0,q.useState)(``),[ie,b]=(0,q.useState)(!1),[x,S]=(0,q.useState)(``),[ae,C]=(0,q.useState)(null),[se,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(``),[ce,D]=(0,q.useState)(``),[O,k]=(0,q.useState)(!1),[A,j]=(0,q.useState)(``),[le,M]=(0,q.useState)(!1),[de,N]=(0,q.useState)(!1),[P,F]=(0,q.useState)(null),[ye,I]=(0,q.useState)(null),L=(0,q.useRef)(null),R=(0,q.useRef)(null),z=t.data?.workflows??[],B=n.data??[],V=xe(B,r.data?.skillUsage),H=be(V,x,r.data?.skillUsage);(0,q.useEffect)(()=>{if(_!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);v(r?ot(r):$())},[_,t.data,e]);let U=e=>v(t=>t===null?t:{...t,steps:e}),W=m({mutationFn:e=>d(e),onSuccess:e=>{v({name:e.name,description:e.description??``,steps:e.steps}),w(!1),E(``),D(``),h(`Imported "${e.name}" — review, then Save.`)},onError:e=>D(e.message)}),G=m({mutationFn:e=>s(e),onSuccess:e=>{v(t=>{let n=t??$(),{name:r,steps:i}=Ie(e,n.name);return{...n,name:r,steps:i}}),k(!1),j(``),h(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??_?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>h(e instanceof Error?e.message:String(e),{tone:`danger`})}),K=m({mutationFn:e=>c({...Le(_?.name??``,_?.description??``,_?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{M(!1),h(`Saved — ${e.path.split(`/`).pop()??e.path}`),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{e instanceof l&&e.exists===!0?M(!0):h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),we=m({mutationFn:e=>o(e),onSuccess:(e,t)=>{N(!1),h(`Deleted "${t}".`),v($()),i.invalidateQueries({queryKey:te.workflows})},onError:e=>{N(!1),h(e instanceof Error?e.message:String(e),{tone:`danger`})}}),J=ue(pe(fe,{activationConstraint:{distance:4}}),pe(me,{coordinateGetter:_e}));if(t.isError)return(0,Q.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,Q.jsx)(Se,{icon:(0,Q.jsx)(oe,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(_===null)return(0,Q.jsx)(Ce,{});let Y=_.steps,X=_.name.trim(),ke=z.find(e=>e.name===X&&e.source===`file`),Ae=Ne(_.name,_.description,Y),Z=(e,t=Y.length)=>{if(Y.length>=8){h(`A workflow holds at most 8 steps.`,{tone:`danger`});return}U(Ee(Y,Te(e,Y),t))};return(0,Q.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,Q.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,Q.jsxs)(a,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>v($()),children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,Q.jsxs)(he,{sensors:J,collisionDetection:ge,onDragStart:e=>{let t=e.active.data.current;F(t??null)},onDragOver:e=>{I(e.over?String(e.over.id):null)},onDragEnd:e=>{F(null),I(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===at?Y.length:Y.findIndex(e=>e.id===n.id);Z(r.skill,e===-1?Y.length:e);return}if(n.id===t.id)return;let i=Y.findIndex(e=>e.id===t.id),a=Y.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&U(De(Y,i,a))},onDragCancel:()=>{F(null),I(null)},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,Q.jsx)(Re,{workflows:z,draft:_,trimmedName:X,nameRef:L,onDraft:v,onLoadWorkflow:e=>v(ot(e))}),(0,Q.jsx)(ze,{savedFile:ke,autoOpen:O,onImportToggle:()=>{D(``),k(!1),w(e=>!e)},onExport:()=>{let e=new Blob([Ae],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Pe(_.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{w(!1),k(e=>!e)},onDeleteRequest:()=>N(!0)}),O?(0,Q.jsx)(Be,{text:A,onTextChange:j,pending:G.isPending,onRun:()=>{let e=A.trim();e===``||G.isPending||G.mutate(e)},onCancel:()=>{k(!1),j(``)}}):null,(0,Q.jsx)(Ve,{open:se,onOpenChange:w,text:T,onTextChange:E,error:ce,pending:W.isPending,onRun:()=>{let e=T.trim();e!==``&&W.mutate(e)},onCancel:()=>{w(!1),E(``),D(``)}}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,Q.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,Y.length,` of `,8,(0,Q.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Fe(Y)})]}),(0,Q.jsx)(lt,{steps:Y,skills:B,dragging:P!==null,overId:ye,activeStepId:P?.type===`step`?P.step.id:null,onRemove:e=>U(Oe(Y,e)),onMove:(e,t)=>U(De(Y,e,t))}),(0,Q.jsxs)(a,{ref:R,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{C(null),S(``),b(!0)},children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,Q.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,Q.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,Q.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,Q.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,Q.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,Q.jsxs)(a,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:K.isPending,onClick:()=>{if(X===``){L.current?.focus();return}if(Y.length===0){h(`Add at least one step first.`,{tone:`danger`});return}K.mutate(!1)},children:[(0,Q.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,Q.jsx)(He,{paletteSkills:V,query:y,onQueryChange:ne,error:n.isError?n.error.message:null,inFlow:new Set(Y.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Z(e),yaml:Ae})]})]}),(0,Q.jsx)(ve,{children:(0,Q.jsx)(dt,{dragging:P,steps:Y,skills:B})})]}),(0,Q.jsx)(We,{open:ie,onOpenChange:b,query:x,onQueryChange:S,matches:H,skillsCount:B.length,error:n.isError?n.error.message:null,selectedSkill:ae,onSelectSkill:C,stepsCount:Y.length,onCloseAutoFocus:e=>{e.preventDefault(),R.current?.focus()},onCancel:()=>b(!1),onAdd:e=>{Z(e),b(!1)}}),(0,Q.jsx)(Ge,{trimmedName:X,savedFile:ke,overwriteOpen:le,onOverwriteDismiss:()=>M(!1),deleteOpen:de,onDeleteDismiss:()=>N(!1),onOverwrite:()=>K.mutate(!0),onDelete:()=>we.mutate(X)})]})}function lt({steps:e,skills:t,dragging:n,overId:r,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=N({id:at}),u=n&&r===at;return(0,Q.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:i(`relative mt-4 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,Q.jsx)(`p`,{className:i(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,Q.jsxs)(ye,{items:e.map(e=>e.id),strategy:de,children:[(0,Q.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((i,c)=>(0,Q.jsx)(ut,{step:i,index:c,skills:t,dragging:n,insertBefore:n&&r===i.id&&a!==i.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},i.id))}),(0,Q.jsx)(`div`,{"aria-hidden":`true`,className:i(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function ut({step:e,index:t,insertBefore:n,onRemove:r,onMoveUp:a,onMoveDown:o}){let s=f(e.runner,e.agentProfile),{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:p,isDragging:m}=P({id:e.id,data:{type:`step`,step:e}});return(0,Q.jsxs)(`li`,{ref:u,style:{transform:I.Transform.toString(d),transition:p},className:i(`relative`,m&&`opacity-40`),children:[n?(0,Q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,Q.jsx)(tt,{step:e,index:t,skills:s.data??[],onRemove:r,onMoveUp:a,onMoveDown:o,gripProps:{...c,...l}})]})}function dt(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=f(t?.runner,t?.agentProfile,!!t);return(0,Q.jsx)(Ue,{...e,skills:t?n.data??[]:e.skills})}export{st as WorkflowsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Fr as n,ti as r}from"./project-scope-context-CjF9fBcW.js";import{a as i}from"./live-protocol-D9ji1YCl.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{Fr as n,ti as r}from"./project-scope-context-CX36ze1Q.js";import{a as i}from"./live-protocol-D9ji1YCl.js";var a=e(t(),1);function o(e,t){if(!i(e.path))throw Error(`unsupported shared read`);let r=new URL(e.path,`http://cezar.invalid`);return r.searchParams.sort(),n({kind:`read`,path:`${r.pathname}${r.search}`,intervalMs:e.intervalMs},{value:t})}function s(e,t,n,i){let s=r(),c=JSON.stringify(t),l=(0,a.useMemo)(()=>JSON.parse(c),[c]);(0,a.useEffect)(()=>{if(!e||n===!1)return;let t=!0,r=o({path:e,intervalMs:n},(e,n)=>{n||s.cancelQueries({queryKey:l,exact:!0}).then(()=>{t&&s.setQueryData(l,i?i(e,s):e)})});return()=>{t=!1,r()}},[s,e,l,n,i])}function c(e,t){return n({kind:`topic`,topic:e},{value:t})}export{o as n,s as r,c as t};
@@ -59,38 +59,38 @@
59
59
  }
60
60
  })()
61
61
  </script>
62
- <script type="module" crossorigin src="/assets/index-30DUDWal.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-Dn02NPUV.js"></script>
63
63
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-BT31bpU6.js">
66
66
  <link rel="modulepreload" crossorigin href="/assets/button-C1fD-ZFr.js">
67
67
  <link rel="modulepreload" crossorigin href="/assets/live-refetch-CZb2VOyu.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/live-protocol-D9ji1YCl.js">
69
- <link rel="modulepreload" crossorigin href="/assets/project-scope-context-CjF9fBcW.js">
70
- <link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-BDN_oL8i.js">
71
- <link rel="modulepreload" crossorigin href="/assets/useQuery-DXuahdZA.js">
72
- <link rel="modulepreload" crossorigin href="/assets/ws-cDmTA0eG.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/project-scope-context-CX36ze1Q.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/useInfiniteQuery-BdIIhzMI.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/useQuery-Dg1rzYtR.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/ws-DiWUfn_t.js">
73
73
  <link rel="modulepreload" crossorigin href="/assets/toaster-Cxgzn9ip.js">
74
- <link rel="modulepreload" crossorigin href="/assets/queries-CzcxBTP6.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/queries-Cb76PEoL.js">
75
75
  <link rel="modulepreload" crossorigin href="/assets/cez-idle-BY3rjM_y.js">
76
76
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/es2015-Ch36azR0.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/design-icons-B6-0w7Aw.js">
79
79
  <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-D4zMgwkC.js">
80
- <link rel="modulepreload" crossorigin href="/assets/attention-CczhK23N.js">
81
- <link rel="modulepreload" crossorigin href="/assets/use-desktop-DBmPhWpf.js">
82
- <link rel="modulepreload" crossorigin href="/assets/runners-B05nICNv.js">
80
+ <link rel="modulepreload" crossorigin href="/assets/attention-B0IBc2_D.js">
81
+ <link rel="modulepreload" crossorigin href="/assets/use-desktop-DN7wbSS7.js">
82
+ <link rel="modulepreload" crossorigin href="/assets/runners-CKrq5tR_.js">
83
83
  <link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CFjnD-9J.js">
84
84
  <link rel="modulepreload" crossorigin href="/assets/eye-B8okNWXU.js">
85
85
  <link rel="modulepreload" crossorigin href="/assets/format-BNCkW110.js">
86
86
  <link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
87
- <link rel="modulepreload" crossorigin href="/assets/reference-chip-D0fgKbcF.js">
87
+ <link rel="modulepreload" crossorigin href="/assets/reference-chip-DwiE3MIR.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/dist-Du8mGhoH.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/dialog-DSwzMeY3.js">
90
- <link rel="modulepreload" crossorigin href="/assets/project-router-CgSlk0dT.js">
91
- <link rel="modulepreload" crossorigin href="/assets/picker-pill-CV8i0S1a.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/project-router-CcyPWtFH.js">
91
+ <link rel="modulepreload" crossorigin href="/assets/picker-pill-D8SyrTxD.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/skills-pM_PouEs.js">
93
- <link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-DCTzkDjy.js">
93
+ <link rel="modulepreload" crossorigin href="/assets/prompt-template-menu-DT_0Pyd5.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/sortable.esm-zp_qkYGV.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/centered-state-CiiA8Vgw.js">
96
96
  <link rel="stylesheet" crossorigin href="/assets/index-DXvh46tl.css">
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{l as r,p as i,t as a}from"./button-C1fD-ZFr.js";import{t as o}from"./live-refetch-CZb2VOyu.js";import{Ar as s,Mr as c,Mt as l,On as u,Pn as d,Sn as f,Ur as p,a as m,br as ee,gn as te,jn as h,p as ne,rr as re,ti as ie,zr as ae}from"./project-scope-context-CjF9fBcW.js";import{H as g,K as oe,L as _,M as se,N as ce,P as v,R as y,S as le,T as ue,U as de,j as b,k as x,q as fe}from"./live-protocol-D9ji1YCl.js";import{t as pe}from"./useQuery-DXuahdZA.js";import{n as me,t as he}from"./ws-cDmTA0eG.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{n as ge,r as _e,t as ve}from"./hourglass-B0lPAJvT.js";import{t as ye}from"./eye-B8okNWXU.js";import{t as be}from"./message-square-B-MD-8rD.js";import{t as C}from"./project-router-CgSlk0dT.js";import"./attention-CczhK23N.js";import{Zt as w,_t as xe,bn as Se}from"./index-30DUDWal.js";var Ce=S(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),we=S(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Te=S(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ee=S(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),De=S(`messages-square`,[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]),Oe=S(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),ke=S(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Ae=S(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),je=S(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),T=e(t(),1),E=n(),D=fe(),O=_().int().nonnegative(),k=g().min(1),Me=y({title:g().max(160),toolKind:x([`read`,`edit`,`delete`,`move`,`search`,`execute`,`think`,`fetch`,`task`,`plan`,`other`]),status:x([`pending`,`running`,`completed`,`failed`,`declined`]),startedAt:D,endedAt:D.optional()}).strict(),Ne=x([`pass`,`fail`,`pending`,`skipping`,`cancel`]),Pe=y({checks:b(y({name:g().max(100),bucket:Ne}).strict()).max(100),counts:y({pass:O,fail:O,pending:O,skipping:O,cancel:O}).strict(),truncated:v(!0).optional()}).strict(),Fe=ce(`kind`,[y({kind:v(`human`),since:D,detail:y({question:g().max(500).optional(),reason:x([`question`,`turn-end`,`budget`,`completion`]),queuedMessages:_().int().positive().optional()}).strict()}).strict(),y({kind:v(`usage-limit`),detail:y({resumeAt:g()}).strict()}).strict(),y({kind:v(`workers`),since:D,deadline:D.optional(),detail:y({owed:O,total:O,settled:O,replies:v(!0).optional(),mode:le.optional(),recipientRunIds:b(k)}).strict()}).strict(),y({kind:v(`peers`),since:D,deadline:D,detail:y({peerRunIds:b(k)}).strict()}).strict(),y({kind:v(`subagents`),since:D,deadline:D,detail:y({running:O}).strict()}).strict(),y({kind:v(`pr`),since:D,deadline:D,detail:y({number:_().int().positive(),target:re,checks:Pe.shape.checks.optional(),counts:Pe.shape.counts.optional(),truncated:v(!0).optional()}).strict()}).strict(),y({kind:v(`process`),since:D,deadline:D,detail:y({pid:_().int(),note:g().optional()}).strict()}).strict(),y({kind:v(`timer`),since:D,deadline:D,detail:y({wakeAt:D,note:g().optional()}).strict()}).strict()]),Ie={runId:k,title:g(),status:ee,rung:x(u),runner:p.optional(),model:g().optional(),currentStepId:g().optional(),startedAt:g().optional(),wait:Fe.optional(),tool:Me.optional(),rate:b(O).length(30),error:g().max(200).optional()},Le=y({...Ie,revision:O,collected:se()}).strict(),Re=y({...Ie,workers:b(Le)}).strict(),ze=y({requestId:oe(),relationship:x([`family`,`peer`]),senderRunId:k,recipientRunId:k,text:g().max(500),senderTitle:g().optional(),recipientTitle:g().optional(),createdAt:D,deadline:D.optional()}).strict(),Be=y({requestId:oe(),senderRunId:k,recipientRunId:k,status:ue.shape.status,observedAt:D}).strict(),Ve=y({generatedAt:D,projects:b(y({projectId:g(),name:g(),loaded:se(),unavailable:y({status:de([v(404),v(409),v(503)]),error:g()}).strict().optional(),inReview:O,tasks:b(Re),requests:b(ze),closed:b(Be)}).strict())}).strict();y({project:de([v(`default`),g().regex(f)]).optional()});var He=5e3,Ue=e=>[`workspace`,`activity`,e.kind===`project`?e.projectId:null],We=e=>e.kind===`project`?`activity:project:${e.projectId}`:`activity:workspace`,Ge=e=>e.kind===`project`?`/api/v1/workspace/activity?project=${encodeURIComponent(e.projectId)}`:`/api/v1/workspace/activity`,Ke=`the Squawk server answered /workspace/activity with an unexpected body`;function qe(e){let t=Ve.safeParse(e);if(!t.success)throw new m(200,Ke);return t.data}async function Je(e,t){let n=e.kind===`project`?{project:e.projectId}:{};return qe(await te(await ne.api.v1.workspace.activity.$get({query:n},l(t)),`/workspace/activity`))}function Ye(e,t){return e!==void 0&&Date.parse(t.generatedAt)<Date.parse(e.generatedAt)?e:t}var Xe=new Date(0).toISOString();function Ze(e){return e!==void 0&&e!==Xe&&!Number.isNaN(Date.parse(e))}var Qe=new Set([404,409,503]);function $e(e,t,n,r){let i=e?.projects.find(e=>e.projectId===t)?.name??t;return{generatedAt:e?.generatedAt??Xe,projects:[{projectId:t,name:i,loaded:!0,unavailable:{status:n,error:r},inReview:0,tasks:[],requests:[],closed:[]}]}}function et(e,t){return new m(Number(/^HTTP (\d+)$/.exec(t)?.[1]??0),e&&typeof e==`object`&&typeof e.error==`string`?e.error:t)}var tt=(e,t)=>e.kind===`project`&&Qe.has(t.status)?t.status:void 0;function nt(e){let t=e.kind===`project`?e.projectId:void 0,n=(0,T.useMemo)(()=>t===void 0?{kind:`workspace`}:{kind:`project`,projectId:t},[t]),r=(0,T.useMemo)(()=>Ue(n),[n]),i=ie(),a=pe({queryKey:r,queryFn:async({signal:e})=>{let t=i.getQueryData(r);try{return Ye(t,await Je(n,{signal:e}))}catch(e){let r=e instanceof m?tt(n,e):void 0;if(r===void 0||n.kind!==`project`)throw e;return $e(t,n.projectId,r,e.message)}},staleTime:1/0});return(0,T.useEffect)(()=>{let e=!0,t=t=>{i.cancelQueries({queryKey:r,exact:!0}).then(()=>{if(!e)return;let a=tt(n,t);if(a!==void 0&&n.kind===`project`){i.setQueryData(r,e=>$e(e,n.projectId,a,t.message));return}let o=i.getQueryCache().find({queryKey:r,exact:!0});o?.setState({status:`error`,error:t,errorUpdatedAt:Date.now(),errorUpdateCount:o.state.errorUpdateCount+1,fetchStatus:`idle`})})},a=n=>{let a;try{a=qe(n)}catch(e){t(e);return}i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,e=>Ye(e,a))})},l=he(We(n),a),u=o(He),d,f=()=>{let e=s()===`finite`&&u!==!1;e&&!d?d=me({path:Ge(n),intervalMs:u},(e,n)=>{n===void 0?a(e):t(et(e,n))}):!e&&d&&(d(),d=void 0)};f();let p=c(f);return()=>{e=!1,p(),d?.(),l()}},[i,r,n]),a}var A=e=>String(e).padStart(2,`0`);function j(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t/60)%60,i=t%60;return n>0?`${n}:${A(r)}:${A(i)}`:`${r}:${A(i)}`}function rt(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t} s`;let n=Math.floor(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${A(n%60)} min`}function M(e,t){let n=e===void 0?NaN:Date.parse(e);return Number.isNaN(n)?0:t-n}var it=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function N(e){let t=Date.parse(e);return Number.isNaN(t)?e:it.format(t)}function at(){return Intl.DateTimeFormat().resolvedOptions().timeZone}var ot=new Set([`queued`,`running`,`waiting`]),st={review:`In review`,failed:`Failed`,done:`Done`,cancelled:`Cancelled`},ct={review:`review`,failed:`failed`,done:`done`,cancelled:`cancelled`},P=e=>ot.has(e),F=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,I=e=>h(e.rung).tone,lt=(e,t=`Deadline`)=>e?`${t} ${N(e)}`:void 0;function ut(e,t,n){return t.length===1&&t[0]!==void 0?`${e} ${n.titleOf(t[0])}`:`${e} ${F(t.length,`task`)}`}function dt(e,t){let n=e.tool,r={verb:`Doing`,tone:I(e),icon:`tool`},i=n?.endedAt!==void 0&&M(n.endedAt,t.now)>1e4;if(n===void 0)return{...r,main:`Thinking`,...e.startedAt?{since:e.startedAt}:{}};let a=`Last tool ${rt(M(n.endedAt??n.startedAt,t.now))} ago`;return i?{...r,main:`Thinking`,detail:a,since:n.endedAt??n.startedAt}:{...r,main:n.title,mono:!0,detail:a,since:n.startedAt}}function ft(e,t){let n={verb:`Needs you`,tone:I(e),icon:`user`,...t?{since:t.since}:{}};if(t?.detail.reason===`question`)return t.detail.question?{...n,main:t.detail.question,action:`answer`}:{...n,main:`Your turn`,action:`answer`};if(t?.detail.reason===`budget`){let e=t.detail.queuedMessages;return{...n,main:e?`Automatic wakes used up · ${F(e,`message`)} queued`:`Automatic wakes used up`,action:`open`}}return{...n,main:`Your turn`,action:`open`}}function pt(e){return{verb:`Needs you`,tone:I(e),icon:`user`,main:`Permission`,action:`open`}}function mt(e,t,n){let{owed:r,total:i,settled:a,replies:o,mode:s,recipientRunIds:c}=t.detail,l=i>0?a/i:0,u={tone:I(e),since:t.since};if(o){let e=c.length>0?ut(`From`,c,n):`Waiting for replies`;return{...u,verb:`Waiting for reply`,icon:`reply`,main:e,...L(`detail`,lt(t.deadline,`Reply due`))}}let d=c.length>0?`${r} owed · ${a} settled`:s?`${ht[s]} of ${i} · ${a} settled`:`${r} owed`;return{...u,verb:`Waiting for workers`,icon:`workers`,main:d,bar:l,...L(`detail`,lt(t.deadline))}}var ht={one:`One`,any:`Any`,all:`All`};function gt(e){let t=e.detail.counts;if(t===void 0)return`PR ${e.detail.number} checks`;let n=t.pass+t.fail+t.pending;return`PR ${e.detail.number} checks · ${t.pass} of ${n} passed`}var _t=[`fail`,`pending`,`pass`,`skipping`,`cancel`];function vt(e){let{counts:t,checks:n=[],truncated:r}=e.detail;if(!r||t===void 0)return;let i=e=>Math.max(0,t[e]-n.filter(t=>t.bucket===e).length),a=_t.reduce((e,t)=>e+i(t),0),o=_t.find(e=>i(e)>0);return a>0&&o?{count:a,bucket:o}:void 0}var yt=[[`pass`,`passed`],[`fail`,`failed`],[`pending`,`pending`],[`skipping`,`skipped`],[`cancel`,`cancelled`]];function bt(e){let{counts:t,checks:n}=e.detail,r=e=>t?t[e]:(n??[]).filter(t=>t.bucket===e).length,i=yt.filter(([e])=>r(e)>0).map(([e,t])=>`${r(e)} ${t}`),a=vt(e);return a&&i.push(`+${a.count} more not listed`),i.length>0?i.join(`, `):void 0}function xt(e,t){let n={tone:I(e),since:t.since,...L(`detail`,lt(t.deadline))};if(t.detail.target!==`checks`)return{...n,verb:`Waiting for merge`,icon:`merge`,main:`PR ${t.detail.number}`};let r=t.detail.checks?[...t.detail.checks].sort((e,t)=>e.name.localeCompare(t.name)):void 0;return{...n,verb:`Waiting for CI`,icon:`ci`,main:gt(t),...L(`checks`,r),...L(`overflow`,vt(t)),...L(`checkSummary`,bt(t))}}function L(e,t){return t===void 0?{}:{[e]:t}}function St(e,t,n){let r=I(e);switch(t.kind){case`workers`:return mt(e,t,n);case`peers`:return{verb:`Waiting for a peer`,tone:r,icon:`peer`,since:t.since,main:ut(`For`,t.detail.peerRunIds,n),detail:`Deadline ${N(t.deadline)}`};case`subagents`:return{verb:`Waiting for subagents`,tone:r,icon:`subagents`,since:t.since,main:F(t.detail.running,`native subagent`),detail:`Deadline ${N(t.deadline)}`};case`pr`:return xt(e,t);case`process`:return{verb:`Waiting for command`,tone:r,icon:`command`,since:t.since,main:t.detail.note??`Process ${t.detail.pid}`,detail:`Running ${j(M(t.since,n.now))} · deadline ${N(t.deadline)}`};case`timer`:return{verb:`Waiting for timer`,tone:r,icon:`timer`,since:t.since,main:t.detail.note??`Timer`,detail:`Wakes ${N(t.detail.wakeAt)} · in ${j(-M(t.detail.wakeAt,n.now))}`};case`usage-limit`:return Ct(e,t.detail.resumeAt,n);case`human`:return}}function Ct(e,t,n){let r=Date.parse(t),i=Number.isNaN(r)?`Resumes ${t}`:`Resumes ${N(t)} · in ${j(r-n.now)}`;return{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`,detail:i}}function wt(e,t){let n=e.wait&&`since`in e.wait?e.wait.since:e.startedAt;return{verb:`Queued`,tone:I(e),icon:`queued`,main:`Waiting for a free slot`,...n?{since:n,detail:`Waiting ${rt(M(n,t.now))}`}:{}}}function R(e,t){return{verb:st[e.status]??e.status,tone:I(e),icon:ct[e.status]??`done`,main:t}}function z(e,t){return P(e.status)?Tt(e,t):R(e,F(e.workers.filter(e=>P(e.status)).length,`live worker`))}function Tt(e,t){let n=e.wait;switch(e.rung){case`running`:return dt(e,t);case`needs-permission`:return pt(e);case`needs-you`:return ft(e,n?.kind===`human`?n:void 0);case`usage-limit`:return n?.kind===`usage-limit`?Ct(e,n.detail.resumeAt,t):{verb:`Paused`,tone:I(e),icon:`pause`,main:`Usage limit`};case`queued`:case`waiting-for-capacity`:return wt(e,t);default:return(n&&St(e,n,t))??wt(e,t)}}function Et(e,t,n){if(n!==void 0&&P(e.status))return{verb:`Asks parent`,tone:I(e),main:`“${n}”`,asks:!0};let r=Dt(e,t);return{verb:r.verb,tone:r.tone,main:r.main,...r.mono?{mono:!0}:{}}}function Dt(e,t){switch(e.status){case`done`:return R(e,e.collected?`Collected`:`Ready to collect`);case`review`:return R(e,`Waiting for the parent’s review`);case`failed`:case`cancelled`:return R(e,e.error??st[e.status]??e.status);default:return Tt({...e,workers:[]},t)}}function Ot(e){if(e.unavailable)return e.unavailable.error;if(!e.loaded)return`Not loaded in this cockpit`}function kt(e){let t=new Map;for(let n of e.tasks){t.set(n.runId,{title:n.title,cardId:n.runId,role:`root`});for(let e of n.workers)t.set(e.runId,{title:e.title,cardId:n.runId,role:`worker`})}return t}function B(e,t,n){return e.get(t)?.title??n??`Unreadable task`}var At=(e,t)=>B(e,t.senderRunId,t.senderTitle),V=(e,t)=>B(e,t.recipientRunId,t.recipientTitle),jt=(e,t)=>`wait:${e}:${t}`;function Mt(e){let t=[];for(let n of e){let e=n.wait;if(!(!P(n.status)||e?.kind!==`peers`))for(let r of new Set(e.detail.peerRunIds))r!==n.runId&&t.push({id:jt(n.runId,r),waiterRunId:n.runId,peerRunId:r,since:e.since,deadline:e.deadline})}return t}function Nt(e,t){let n=new Set;for(let r of t)r.waiterRunId===e&&n.add(r.peerRunId),r.peerRunId===e&&n.add(r.waiterRunId);return n}function Pt(e,t){return t.filter(t=>t.waiterRunId===e)}function Ft(e,t,n,r=[]){let i=[];for(let r of t)r.senderRunId===e&&i.push(`Waiting for a reply from ${V(n,r)}`),r.recipientRunId===e&&i.push(`${At(n,r)} waits for your reply`);for(let t of r)t.waiterRunId===e&&i.push(`Waiting for a message from ${B(n,t.peerRunId)}`),t.peerRunId===e&&i.push(`${B(n,t.waiterRunId)} waits for you to write`);return i}function It(e,t,n){return n.find(n=>n.relationship===`family`&&n.senderRunId===e&&n.recipientRunId===t)}function Lt(e,t){let n=-M(e,t);return n>=1e3?`reply due in ${j(n)}`:`reply overdue`}function Rt(e,t){return t.filter(t=>t.relationship===`peer`&&t.senderRunId===e)}function zt(e,t){return e.relationship===`peer`?{kind:`Request`,relation:`Peer`}:{kind:`Question`,relation:Bt[Vt(e,t)]}}var Bt={worker:`Worker → parent`,parent:`Parent → worker`,unknown:`Family`};function Vt(e,t){let n=t.get(e.senderRunId)?.role;if(n)return n===`worker`?`worker`:`parent`;let r=t.get(e.recipientRunId)?.role;return r?r===`root`?`worker`:`parent`:`unknown`}var Ht=new Set([`queued`,`waiting-for-capacity`]);function Ut(e){if(P(e.status))return d(e.rung)?`needsYou`:e.rung===`running`?`working`:Ht.has(e.rung)?`queued`:`waiting`}function Wt(e){let t={needsYou:0,working:0,waiting:0,queued:0,activeWorkers:0,openRequests:0,inReview:0};for(let n of e){t.inReview+=n.inReview,t.openRequests+=n.requests.length;for(let e of n.tasks){let n=Ut(e);n&&(t[n]+=1),t.activeWorkers+=e.workers.filter(e=>P(e.status)).length}}return t}function Gt(e,t=()=>!1){let n=0,r=0;for(let i of e.workers)t(i.runId)||((i.status===`done`||i.status===`cancelled`)&&(n+=1),i.status===`failed`&&(n+=1,r+=1));return{finished:n,failed:r}}function Kt({finished:e,failed:t}){if(e!==0)return t>0?`✓ ${e} finished · ${t} failed`:`✓ ${e} worker${e===1?``:`s`} finished`}var H={flash:1300,cardEnter:700,cardLeave:500,workerEnter:700,workerHold:3e3,workerFold:500,comet:1100,replied:900,fade:800,bump:500,slide:450,check:800},U={flash:{},entering:{},leaving:{},workerEnter:{},workerHold:{},opening:{},closing:{},waitsClosing:{},comets:{},bumps:{},slides:{},checks:{}},qt=(e,t)=>`${e}\n${t}`;function Jt(e,t){let n=qt(t,``);return new Set(Object.keys(e.checks).filter(e=>e.startsWith(n)).map(e=>e.slice(n.length)))}var Yt=class{key;changes=[];timers=[];constructor(e){this.key=e}timed(e,t,n,r){this.changes.push({field:e,id:t,value:{...n,key:this.key}}),this.timers.push({after:r,change:{field:e,id:t,ifKey:this.key}})}later(e,t,n,r){this.timers.push({after:r,change:{field:e,id:t,value:{...n,key:this.key},ifKey:this.key}})}drop(e,t){this.changes.push({field:e,id:t})}},Xt={done:`success`,review:`success`,failed:`danger`,cancelled:`neutral`};function Zt(e,t){let n=Xt[t.status]??`success`;if(t.status===`review`){e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.flash);return}e.timed(`workerHold`,t.runId,{tone:n,phase:`flash`},H.workerHold+H.workerFold),e.later(`workerHold`,t.runId,{tone:n,phase:`fold`},H.workerHold)}function Qt(e,t){e.drop(`closing`,t.requestId),e.timed(`opening`,t.requestId,{},H.fade),e.timed(`comets`,`${t.requestId}:open:${e.key}`,{requestId:t.requestId,reverse:!1,tone:t.relationship},H.comet)}function $t(e,t,n,r){let i=n.requestId;if(e.drop(`opening`,i),!r){e.timed(`closing`,i,{projectId:t,request:n,replied:!1,phase:`fade`},H.fade);return}let a=H.comet+H.replied+H.fade;e.timed(`closing`,i,{projectId:t,request:n,replied:!0,phase:`reply`},a),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`replied`},H.comet),e.later(`closing`,i,{projectId:t,request:n,replied:!0,phase:`fade`},H.comet+H.replied),e.timed(`comets`,`${i}:reply:${e.key}`,{requestId:i,reverse:!0,tone:`success`},H.comet)}function en(e,t){switch(t.kind){case`rung-changed`:return e.timed(`flash`,t.task.runId,{tone:h(t.task.rung).tone},H.flash);case`tool-started`:return e.timed(`slides`,t.runId,{},H.slide);case`worker-started`:return e.timed(`workerEnter`,t.worker.runId,{},H.workerEnter);case`worker-settled`:return Zt(e,t.worker);case`card-entered`:return e.drop(`leaving`,t.task.runId),e.timed(`entering`,t.task.runId,{},H.cardEnter);case`card-left`:return e.timed(`leaving`,t.task.runId,{projectId:t.projectId,task:t.task},H.cardLeave);case`check-passed`:return e.timed(`checks`,qt(t.runId,t.name),{},H.check);case`request-opened`:return Qt(e,t.request);case`request-closed`:return $t(e,t.projectId,t.request,t.status===`replied`);case`chip-changed`:return e.timed(`bumps`,t.chip,{},H.bump);case`wait-opened`:return e.drop(`waitsClosing`,t.wait.id),e.timed(`opening`,t.wait.id,{},H.fade);case`wait-closed`:return e.drop(`opening`,t.wait.id),e.timed(`waitsClosing`,t.wait.id,{projectId:t.projectId,wait:t.wait},H.fade)}}function tn(e,t,n){let r=new Yt(t);if(!n)for(let t of e)en(r,t);return{changes:r.changes,timers:r.timers}}function nn(e,t){let n=e[t.field];if(t.ifKey!==void 0&&n[t.id]?.key!==t.ifKey||t.value===void 0&&!(t.id in n))return e;let r={...n};return t.value===void 0?delete r[t.id]:r[t.id]=t.value,{...e,[t.field]:r}}function rn(e,t){return t.reduce(nn,e)}function an(e,t,n){let r=new Set(t.map(e=>e.id));return Object.values(n.waitsClosing).filter(t=>t.projectId===e&&!r.has(t.wait.id)).map(e=>e.wait)}var on={success:`text-success`,pending:`text-signal-word-amber`,danger:`text-signal-word-red`,accent:`text-accent-text`,info:`text-info`,running:`text-status-running`,neutral:`text-muted-foreground`};function sn({tone:e,className:t,children:n,...i}){return(0,E.jsx)(`span`,{...i,className:r(`bg-card-2`,{"text-success":e===`success`,"text-signal-word-amber":e===`pending`,"text-signal-word-red":e===`danger`,"text-accent-text":e===`accent`,"text-info":e===`info`,"text-status-running":e===`running`,"text-muted-foreground":e===`neutral`},t),children:n})}var cn={success:`border-success`,pending:`border-pending-strong`,danger:`border-danger`,accent:`border-accent-strong`,info:`border-info`,running:`border-status-running`,neutral:`border-soft-foreground`},ln={success:`bg-success`,pending:`bg-pending-strong`,danger:`bg-danger`,accent:`bg-accent-strong`,info:`bg-info`,running:`bg-status-running`,neutral:`bg-soft-foreground`},un={tool:je,user:Ae,workers:Se,reply:be,peer:De,subagents:Se,ci:Ee,merge:Te,command:ke,timer:we,pause:Oe,queued:ve,review:ye,failed:ge,done:_e,cancelled:Ce};function dn(e,t){let n=h(e.rung),r=e.rung===`waiting-on-workers`&&(t===`worker`||e.wait?.kind===`peers`);return{tone:n.tone,shape:r?`ring`:n.shape,label:mn(e,t)??n.label}}var fn=(e,t,n)=>`${e} ${t} ${n}${t===1?``:`s`}`;function pn(e){return e?.kind===`workers`&&!e.detail.replies&&e.detail.owed>0}function mn(e,t){let n=e.wait;if(e.rung===`waiting-on-workers`){if(t===`worker`&&!pn(n))return`waiting on parent reply`;if(n?.kind===`peers`&&n.detail.peerRunIds.length>0)return fn(`waiting on`,n.detail.peerRunIds.length,`task`);if(n?.kind===`workers`&&n.detail.replies)return`waiting on replies`;if(n?.kind===`workers`&&n.detail.owed>0)return fn(`waiting on`,n.detail.owed,`worker`)}if(e.rung===`waiting-on-subagents`&&n?.kind===`subagents`&&n.detail.running>0)return fn(`waiting for`,n.detail.running,`subagent`)}function hn(e,t){if(P(e.status))return e.rung===`running`&&t===`filled`?`activity-pulse`:t===`filled`?void 0:`activity-breathe`}function W({run:e,role:t}){let{tone:n,shape:i,label:a}=dn(e,t);return(0,E.jsx)(`span`,{"data-activity-anchor":e.runId,className:r(`inline-flex size-[12px] shrink-0 items-center justify-center`,hn(e,i)),children:(0,E.jsx)(w,{tone:n,shape:i,role:`img`,"aria-label":a})})}function gn({runId:e,requests:t,waits:n,index:r,link:i,pathOf:a,className:o,linkClassName:s}){let c=Rt(e,t),l=Pt(e,n);return c.length===0&&l.length===0?null:(0,E.jsxs)(`ul`,{"data-slot":`activity-peer-links`,className:o,children:[c.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.recipientRunId),className:s,children:[`→ `,V(r,e)]})},e.requestId)),l.map(e=>(0,E.jsx)(`li`,{children:(0,E.jsxs)(i,{to:a(e.peerRunId),className:s,children:[`⋯ waits on `,B(r,e.peerRunId)]})},e.id))]})}var _n={pass:`bg-success`,fail:`bg-danger`,pending:`bg-info`,skipping:`border border-soft-foreground`,cancel:`border border-soft-foreground`},vn=(e,t)=>t?`activity-check-pass`:e===`pending`?`activity-breathe-fast`:void 0;function yn({checks:e,overflow:t,passed:n}){return(0,E.jsxs)(`span`,{"data-slot":`activity-checks`,"aria-hidden":`true`,className:r(`col-start-2 mt-[5px] flex items-center`,e.length>40?`gap-px`:`gap-[3px]`),children:[e.map(e=>(0,E.jsx)(`i`,{"data-bucket":e.bucket,"data-passed":n.has(e.name)?`true`:void 0,title:e.name,className:r(`h-[5px] min-w-px flex-1 rounded-[2px]`,_n[e.bucket],vn(e.bucket,n.has(e.name)))},e.name)),t?(0,E.jsxs)(`span`,{"data-slot":`activity-checks-overflow`,"data-bucket":t.bucket,className:`ml-1 flex shrink-0 items-center gap-1 text-[10px] leading-none text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`i`,{className:r(`h-[5px] w-2 rounded-[2px]`,_n[t.bucket])}),`+`,t.count]}):null]})}function bn({value:e,ink:t}){return(0,E.jsx)(`span`,{"data-slot":`activity-bar`,"aria-hidden":`true`,className:`col-start-2 mt-[5px] block h-1 overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:r(`block h-full bg-current`,t),style:{width:`${Math.round(e*100)}%`}})})}var xn=new Set;function Sn({box:e,now:t,dense:n,motion:i={}}){let a=un[e.icon],o=on[e.tone];return(0,E.jsxs)(`div`,{"data-slot":`activity-now`,"data-verb":e.verb,className:`relative grid grid-cols-[16px_minmax(0,1fr)] gap-x-2 gap-y-px overflow-hidden rounded-lg bg-card-2 px-2.5 py-2`,children:[i.sweep?(0,E.jsx)(`span`,{"data-slot":`activity-sweep`,"aria-hidden":`true`,className:`activity-sweep`}):null,(0,E.jsx)(a,{"aria-hidden":`true`,className:r(`mt-px size-[15px]`,o)}),(0,E.jsxs)(sn,{tone:e.tone,className:`flex gap-2 text-[11px] font-semibold tracking-[0.04em] uppercase`,children:[(0,E.jsx)(`span`,{"data-slot":`activity-verb`,children:e.verb}),e.since?(0,E.jsx)(`span`,{"data-slot":`activity-age`,className:`ml-auto font-medium tracking-normal text-muted-foreground normal-case tabular-nums`,children:j(M(e.since,t))}):null]}),(0,E.jsx)(`span`,{"data-slot":`activity-main`,className:r(`col-start-2 truncate text-[12.5px] text-foreground`,e.mono&&`font-mono text-[12px]`,i.slideKey!==void 0&&`activity-slide`),children:e.main},i.slideKey??`still`),e.checks?(0,E.jsx)(yn,{checks:e.checks,overflow:e.overflow,passed:i.passed??xn}):null,e.checkSummary?(0,E.jsx)(`span`,{"data-slot":`activity-checks-summary`,className:`sr-only`,children:e.checkSummary}):null,e.bar===void 0?null:(0,E.jsx)(bn,{value:e.bar,ink:o}),e.detail&&!n?(0,E.jsx)(`span`,{"data-slot":`activity-detail`,className:`col-start-2 text-[11.5px] text-muted-foreground tabular-nums`,children:e.detail}):null]})}function Cn({rate:e,className:t}){let n=e.reduce((e,t)=>e+t,0),i=Math.max(4,...e);return(0,E.jsxs)(`svg`,{"data-slot":`activity-heartbeat`,role:`img`,"aria-label":`${n} tool call${n===1?``:`s`} in the last ${e.length} s`,viewBox:`0 0 62 16`,className:r(`block h-4 w-[62px] shrink-0`,t),children:[(0,E.jsx)(`path`,{d:`M0 15.5h62`,className:`stroke-border`}),e.map((e,t)=>{if(e<=0)return null;let n=Math.max(1.5,e/i*14);return(0,E.jsx)(`rect`,{x:t*2.07,y:15-n,width:1.4,height:n,className:`fill-status-running`},t)})]})}var G=e=>`/tasks/${encodeURIComponent(e)}`;function wn(e,t){return[e.runner,e.model,e.currentStepId?`step ${e.currentStepId}`:void 0,e.startedAt?rt(M(e.startedAt,t)):void 0].filter(e=>!!e).join(` · `)}function Tn({texts:e}){return e.length===0?null:(0,E.jsx)(`ul`,{"data-slot":`activity-line-text`,className:`sr-only`,children:e.map((e,t)=>(0,E.jsx)(`li`,{children:e},t))})}function En({worker:e,parentId:t,requests:n,index:i,ctx:a,motion:o}){let s=Et(e,a,It(e.runId,t,n)?.text),c=o.workerHold[e.runId];return(0,E.jsxs)(`li`,{"data-slot":`activity-worker`,"data-run":e.runId,"data-asks":s.asks?`true`:void 0,"data-hold":c?.phase,className:r(`relative grid grid-cols-[14px_minmax(0,1fr)] items-start gap-x-2 rounded-lg py-[5px] before:absolute before:top-[13px] before:-left-3.5 before:w-2.5 before:border-t before:border-border`,s.asks&&`-mx-1.5 bg-message-inbound-bg px-1.5`,e.runId in o.workerEnter&&`activity-row-enter`,c?.phase===`fold`&&`activity-row-fold`),children:[c?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:r(`activity-row-flash`,ln[c.tone])},c.key):null,(0,E.jsx)(`span`,{className:`mt-[3px]`,children:(0,E.jsx)(W,{run:e,role:`worker`})}),(0,E.jsxs)(`span`,{className:`min-w-0 truncate text-[12.5px] font-medium`,children:[(0,E.jsx)(C,{to:G(e.runId),className:`relative z-[1] hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.title}),(0,E.jsx)(`span`,{className:`ml-1.5 text-[11px] font-normal text-muted-foreground`,children:[e.runner,e.model].filter(Boolean).join(` · `)})]}),(0,E.jsxs)(`span`,{"data-slot":`activity-worker-line`,className:`col-start-2 truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`b`,{className:r(`font-semibold`,on[s.tone]),children:s.verb}),` · `,(0,E.jsx)(`span`,{className:r(s.mono&&`font-mono`),children:s.main})]}),(0,E.jsx)(Tn,{texts:Ft(e.runId,n,i)})]})}function Dn({workers:e}){return(0,E.jsxs)(`div`,{"data-slot":`activity-worker-dots`,className:`mt-2 ml-[18px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[e.map(e=>(0,E.jsx)(W,{run:e,role:`worker`},e.runId)),(0,E.jsxs)(`span`,{className:`ml-1`,children:[e.length,` worker`,e.length===1?``:`s`]})]})}function On({task:e,requests:t,index:n,ctx:r,dense:i,motion:a}){let o=e=>e in a.workerHold,s=e.workers.filter(e=>P(e.status)||e.status===`review`||o(e.runId)),c=Kt(Gt(e,o));return(0,E.jsxs)(E.Fragment,{children:[s.length>0&&i?(0,E.jsx)(Dn,{workers:s}):null,s.length>0&&!i?(0,E.jsx)(`ul`,{"data-slot":`activity-workers`,className:`mt-2 ml-1 border-l border-border pl-3.5`,children:s.map(i=>(0,E.jsx)(En,{worker:i,parentId:e.runId,requests:t,index:n,ctx:r,motion:a},i.runId))}):null,c?(0,E.jsx)(`p`,{"data-slot":`activity-finished`,className:`mt-1.5 ml-[18px] text-[11px] text-muted-foreground`,children:c}):null]})}var kn=`relative z-[1] text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`;function An(e,t){return t?{onPointerEnter:()=>t(`pointer`,e),onPointerLeave:()=>t(`pointer`,void 0),onFocus:()=>t(`focus`,e),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||t(`focus`,void 0)}}:{}}function jn(e,t,n){return n?`activity-card-leave`:e.runId in t.entering?`activity-card-enter`:void 0}function Mn({task:e,motion:t,glow:n}){let i=t.flash[e.runId];return(0,E.jsxs)(E.Fragment,{children:[n?(0,E.jsx)(`span`,{"aria-hidden":`true`,className:`activity-glow`}):null,i?(0,E.jsx)(`span`,{"data-slot":`activity-flash`,"data-tone":i.tone,"aria-hidden":`true`,className:r(`activity-flash`,cn[i.tone])},i.key):null]})}var Nn=[];function Pn({task:e,requests:t,waits:n=Nn,index:i,ctx:o,dense:s,narrow:c,motion:l=U,ghost:u=!1,linked:d=!1,onHover:f}){let p=z(e,o),m=u?{"data-activity-ghost":e.runId,inert:!0,"aria-hidden":!0}:{"data-activity-card":e.runId},ee={sweep:e.rung===`running`&&P(e.status),slideKey:l.slides[e.runId]?.key,passed:Jt(l,e.runId)};return(0,E.jsxs)(`article`,{...m,"data-flip":e.runId,"data-rung":e.rung,"data-action":p.action,"data-linked":d&&!u?`true`:void 0,...u?{}:An(e.runId,f),className:r(`relative min-w-0 rounded-xl border bg-card px-3.5 py-3`,p.action?`border-pending`:`border-border`,d&&!u&&`outline-2 outline-offset-2 outline-message-peer-accent`,jn(e,l,u)),children:[(0,E.jsx)(Mn,{task:e,motion:l,glow:p.action!==void 0&&!u}),(0,E.jsxs)(`header`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(W,{run:e,role:`root`}),(0,E.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[13.5px] font-semibold`,children:(0,E.jsx)(C,{to:G(e.runId),className:`after:absolute after:inset-0 after:rounded-xl after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:e.title})}),(0,E.jsx)(Cn,{rate:e.rate})]}),(0,E.jsx)(`p`,{className:`mt-0.5 mb-2 ml-5 truncate text-[11.5px] text-muted-foreground`,children:wn(e,o.now)}),(0,E.jsx)(Tn,{texts:Ft(e.runId,t,i,n)}),(0,E.jsx)(Sn,{box:p,now:o.now,dense:s,motion:ee}),p.action?(0,E.jsx)(`div`,{className:`mt-2 flex gap-1.5`,children:(0,E.jsx)(a,{asChild:!0,size:`sm`,variant:p.action===`answer`?`primary`:`outline`,className:`relative z-[1] max-md:min-h-11`,children:(0,E.jsx)(C,{to:G(e.runId),children:p.action===`answer`?`Answer`:`Open task`})})}):null,c?(0,E.jsx)(gn,{runId:e.runId,requests:t,waits:n,index:i,link:C,pathOf:G,className:`mt-2 flex flex-col gap-1`,linkClassName:kn}):null,(0,E.jsx)(On,{task:e,requests:t,index:i,ctx:o,dense:s,motion:l})]})}function Fn(e){return!Number.isFinite(e)||e<=0?1:Math.max(1,Math.floor((e+96)/396))}function In(e,t){let n=e[0],r=1/0;for(let i of e){let e=i.reduce((e,n)=>e+t(n),0);e<r&&(n=i,r=e)}return n}function Ln(e,t,n,r=()=>1){let i=Math.max(1,Math.floor(n)),a=new Set(t),o=e?.length===i?e.map(e=>e.filter(e=>a.has(e))):Array.from({length:i},()=>[]),s=new Set(o.flat());for(let e of t)s.has(e)||(In(o,r).push(e),s.add(e));return o}function Rn(e,t){return e!==void 0&&e.length===t.length&&e.every((e,n)=>e.length===t[n]?.length&&e.every((e,r)=>e===t[n]?.[r]))}var zn=(e,t)=>({x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)});function Bn(e,t,n=1){return t.some(t=>t.x+n<e.x1&&e.x0<t.x+t.w-n&&t.y+n<e.y1&&e.y0<t.y+t.h-n)}var Vn=(e,...t)=>e.filter(e=>!t.some(t=>Hn(e,t))),Hn=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,Un=e=>Math.round(e*10)/10,K=e=>`${Un(e.x)} ${Un(e.y)}`;function Wn(e){let t=[];for(let n of e){let e=t[t.length-1];if(e&&e.x===n.x&&e.y===n.y)continue;let r=t[t.length-2];r&&e&&(r.x===e.x&&e.x===n.x||r.y===e.y&&e.y===n.y)&&t.pop(),t.push(n)}return t}function Gn(e,t=8){let n=Wn(e),r=n[0];if(!r)return``;let i=`M${K(r)}`;for(let e=1;e<n.length;e++){let r=n[e],a=n[e-1],o=n[e+1];if(!o){i+=` L ${K(r)}`;continue}let s=Math.min(t,Math.hypot(r.x-a.x,r.y-a.y)/2,Math.hypot(o.x-r.x,o.y-r.y)/2),c=(e,t,n)=>{let r=Math.hypot(t.x-e.x,t.y-e.y)||1;return{x:e.x+(t.x-e.x)/r*n,y:e.y+(t.y-e.y)/r*n}};i+=` L ${K(c(r,a,s))} Q ${K(r)}, ${K(c(r,o,s))}`}return i}function Kn(e,t,n){let r=[];for(let i of[...e].sort((e,n)=>t(e)-t(n))){let e=r[r.length-1];e&&Math.abs(t(i)-e.from)<=2?e.to=Math.max(e.to,n(i)):r.push({from:t(i),to:n(i)})}return r}function qn(e){return{rows:Kn(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:Kn(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var q=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),J=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function Jn(e,t,n){let r=e.cols,i=e=>((r[e]?.right??0)+(r[e+1]?.left??0))/2;return t<n?i(t):t>n?i(t-1):t+1<r.length?i(t):t>0?i(t-1):(r[t]?.right??0)+8}function Yn(e,t,n,r=0){let i=qn(n),a=q(i.rows,e=>e.top,e.y),o=q(i.rows,e=>e.top,t.y),s=o>a,c=e.x+e.w/2+r,l=t.x+t.w/2+r,u=(s?J(i,a):J(i,a-1))+r/2,d=(s?J(i,o-1):J(i,o))+r/2,f=Jn(i,q(i.cols,e=>e.left,e.x),q(i.cols,e=>e.left,t.x))+r/2,p={x:c,y:s?e.y+e.h+1:e.y-1},m={x:l,y:s?t.y-3:t.y+t.h+3};return{points:[p,{x:c,y:u},{x:f,y:u},{x:f,y:d},{x:l,y:d},m],label:{x:(c+f)/2,y:u}}}var Xn=15;function Zn(e,t,n){let r=[...n,...e.flatMap(e=>[e.y-Xn,e.y+e.h+Xn])].filter(t=>t>=0&&!e.some(e=>e.y-6<t&&t<e.y+e.h+6));return r.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e,r[0]??t)}function Qn(e,t,n,r,i=0){let a=t.x>e.x?1:-1,o=e.x+a*n/2+i,s=t.x-a*n/2+i,c=Zn(r.filter(e=>e.x+e.w>Math.min(o,s)&&e.x<Math.max(o,s)),(e.y+t.y)/2,[e.y,t.y])+(i===0?0:Math.sign(i)*Math.min(Math.abs(i),Xn-6)),l=c===e.y?{x:s,y:(c+t.y)/2}:{x:o,y:(e.y+c)/2};return{points:[e,{x:o,y:e.y},{x:o,y:c},{x:s,y:c},{x:s,y:t.y},{x:t.x-a*2,y:t.y}],label:l}}function $n(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
2
- `);t.set(e,[...t.get(e)??[],n.requestId])}let n=new Map;for(let e of t.values())e.forEach((t,r)=>n.set(t,(r-(e.length-1)/2)*12));return n}function er(e,t,n,r=4){let i=[],a=new Map;for(let{id:o,at:s}of e){let e={...s};for(let a=0;a<=i.length;a++){let a=i.find(n=>Math.abs(e.x-n.x)<t.w+r&&Math.abs(e.y-n.y)<t.h+r);if(!a)break;n===`x`?e.x=a.x+t.w+r:e.y=a.y+t.h+r}i.push(e),a.set(o,e)}return a}var tr=e=>Math.round(e*10)/10,Y=e=>`${tr(e.x)} ${tr(e.y)}`;function nr(e,t,n){return t&&t.x>e.x+40?1:t&&t.x<e.x-40?-1:e.x+e.w+96<=n+1?1:-1}function rr(e,t,n,r,i,a){let o=r>0?Math.max(e.x+e.w,t.x+t.w):Math.min(e.x,t.x),s=(70+n)*r;return{d:`M${Y({x:o,y:i})} C ${Y({x:o+s,y:i})}, ${Y({x:o+s,y:a})}, ${Y({x:o+2*r,y:a})}`,label:{x:o+s*.75,y:(i+a)/2}}}function ir(e,t,n=[],r=0,i=1){let a=e.y+22+r,o=t.y+22+r;if(Math.abs(e.x-t.x)<40)return rr(e,t,r,i,a,o);let s=t.x>e.x,c=s?e.x+e.w:e.x,l=s?t.x:t.x+t.w,u=Math.max(40,Math.abs(l-c)*.5)*(s?1:-1),d=l-(s?2:-2);if(Bn(zn({x:c,y:a},{x:l,y:o}),Vn(n,e,t))){let i=Qn({x:c,y:a},{x:l,y:o},96,Vn(n,e,t),r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:c,y:a})} C ${Y({x:c+u,y:a})}, ${Y({x:l-u,y:o})}, ${Y({x:d,y:o})}`,label:{x:(c+l)/2,y:(a+o)/2}}}function ar(e,{other:t,view:n,labelHeight:r}){let i=r/2+4,a=!t||!n?e+44:t.y>e?Math.max(e+44,n.y1-i):Math.min(e-44,n.y0+i);return n?or(a,n.y0+i,n.y1-i):a}var or=(e,t,n)=>Math.max(t,Math.min(n,e));function sr(e,t,n){let r=n.lane??0,i=e.y+22+r,a=n.side>0?e.x+e.w:e.x,o=a+n.side*96/2+r/2,s={x:o,y:ar(i,n)};return{d:Gn(t===`sender`?[{x:a,y:i},{x:o,y:i},s]:[s,{x:o,y:i},{x:a+2*n.side,y:i}]),label:s}}function cr(e,t,n,r=0){let i={x:e.x,y:e.y+e.h/2},a={x:t.x-2,y:t.y+t.h/2},o=n.x-18+r/2;return{d:`M${Y(i)} C ${Y({x:o,y:i.y})}, ${Y({x:o,y:a.y})}, ${Y(a)}`,label:{x:o,y:(i.y+a.y)/2}}}function lr(e,t,n=[],r=0){let i=e.x+e.w/2+r,a=t.x+t.w/2+r;if(t.y>=e.y+e.h||t.y+t.h<=e.y){let o=t.y>e.y,s=o?e.y+e.h+1:e.y-1,c=o?t.y-3:t.y+t.h+3,l=(c-s)/2;if(Bn(zn({x:i,y:s},{x:a,y:c}),Vn(n,e,t))){let i=Yn(e,t,n,r);return{d:Gn(i.points),label:i.label}}return{d:`M${Y({x:i,y:s})} C ${Y({x:i,y:s+l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:c})}`,label:{x:(i+a)/2,y:(s+c)/2}}}let o=e.y-1,s=t.y-1,c=Math.min(o,s),l=Math.max(8,Math.min(30,18+Math.abs(a-i)*.05)+r);return{d:`M${Y({x:i,y:o})} C ${Y({x:i,y:c-l})}, ${Y({x:a,y:c-l})}, ${Y({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function ur(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function dr(e,t){let n=[];for(let r of e){let e=n.find(e=>Math.abs((e[0]?.at.x??NaN)-r.at.x)<t);e?e.push(r):n.push([r])}return n}function fr(e,t,n,r){let i=e.map(e=>Math.min(r,Math.max(n,e.at.y))),a=i.map((e,t)=>t).sort((e,t)=>i[e]-i[t]);for(let e=1;e<a.length;e++){let n=a[e];i[n]=Math.max(i[n],i[a[e-1]]+t)}for(let e=a.length-1;e>=0;e--){let n=a[e],o=e+1<a.length?i[a[e+1]]-t:r;i[n]=Math.min(i[n],o)}return e.map((e,t)=>({id:e.id,at:{x:e.at.x,y:i[t]}}))}function pr(e,t,n,r=4){let i=n?n.y0+t.h/2:-1/0,a=n?n.y1-t.h/2:1/0,o=new Map;for(let n of dr(e,t.w+r))for(let e of fr(n,t.h+r,i,a))o.set(e.id,e.at);return o}var mr=(e,t)=>e.x<=t.x1&&t.x0<=e.x+e.w&&e.y<=t.y1&&t.y0<=e.y+e.h;function hr(e,t,n){let r=e!==void 0&&mr(e,n),i=t!==void 0&&mr(t,n);return r&&i?`both`:r?`sender`:i?`recipient`:`none`}var gr=e=>/(auto|scroll|hidden|clip)/.test(getComputedStyle(e).overflowY);function _r(e){let t=[];for(let n=e.parentElement;n&&n!==document.body&&n!==document.documentElement;n=n.parentElement)gr(n)&&t.push(n);return t}function vr(e,t){return{x0:Math.max(e.x0,t.x0),y0:Math.max(e.y0,t.y0),x1:Math.min(e.x1,t.x1),y1:Math.min(e.y1,t.y1)}}function yr(e){let t=e.getBoundingClientRect(),n={x0:0,y0:0,x1:window.innerWidth,y1:window.innerHeight};for(let t of _r(e)){let e=t.getBoundingClientRect();e.width>0&&e.height>0&&(n=vr(n,{x0:e.left,y0:e.top,x1:e.right,y1:e.bottom}))}return{x0:n.x0-t.left,y0:n.y0-t.top,x1:n.x1-t.left,y1:n.y1-t.top}}var X={w:88,h:40};function br(e,t){let n=e.getBoundingClientRect(),r=new Map;for(let i of e.querySelectorAll(`[${t}]`)){let e=i.getAttribute(t);e&&r.set(e,ur(i.getBoundingClientRect(),n))}return r}function xr({base:e,from:t,to:n,fromName:r,toName:i},a,o,s){let c=a.get(t),l=a.get(n),u=s.view??{x0:-1/0,y0:-1/0,x1:1/0,y1:1/0},d=(e,t)=>({side:nr(e,t,s.width),labelHeight:X.h,lane:o??0,view:u,...t?{other:t}:{}});switch(hr(c,l,u)){case`both`:return c&&l?{...e,...ir(c,l,[...a.values()],o,nr(c,void 0,s.width))}:void 0;case`sender`:return c?{...e,...sr(c,`sender`,d(c,l)),away:i()}:void 0;case`recipient`:return l?{...e,...sr(l,`recipient`,d(l,c)),away:r()}:void 0;case`none`:return}}var Sr=(e,t)=>({base:{id:e.requestId,kind:`peer`},from:e.senderRunId,to:e.recipientRunId,fromName:()=>At(t,e),toName:()=>V(t,e)}),Cr=(e,t)=>({base:{id:e.id,kind:`wait`},from:e.peerRunId,to:e.waiterRunId,fromName:()=>B(t,e.peerRunId),toName:()=>B(t,e.waiterRunId)}),wr=e=>({requestId:e.id,senderRunId:e.peerRunId,recipientRunId:e.waiterRunId});function Tr(e,t){return[...new Set([...e.values()].map(e=>Math.round(e.x+e.w)))].filter(e=>e+96<=t+1).map(e=>e+96/2)}function Er(e,t){return t.length===0?e:{x:t.reduce((t,n)=>Math.abs(n-e.x)<Math.abs(t-e.x)?n:t),y:e.y}}function Dr(e,t,n,r,i,a){let o=r.get(e.senderRunId)?.cardId??r.get(e.recipientRunId)?.cardId,s=o===void 0?void 0:t.get(o),c=n.get(e.senderRunId),l=n.get(e.recipientRunId);if(!(!s||!c||!l||a&&!mr(s,a)))return{id:e.requestId,kind:`family`,...cr(c,l,s,i)}}function Or(e,t,n,{peers:r,frame:i={width:e.clientWidth},waits:a=[]}){let o=br(e,`data-activity-card`),s=br(e,`data-activity-anchor`),c=$n([...t,...a.map(wr)]),l=[];for(let e of t){let t=c.get(e.requestId),a=e.relationship===`peer`?r?xr(Sr(e,n),o,t,i):void 0:Dr(e,o,s,n,t,i.view);a&&l.push(a)}for(let e of r?a:[]){let t=xr(Cr(e,n),o,c.get(e.id),i);t&&l.push(t)}let u=Tr(o,i.width),d=pr(l.filter(e=>e.kind!==`family`).map(e=>({id:e.id,at:Er(e.label,u)})),X,i.view);return l.map(e=>({...e,label:d.get(e.id)??e.label}))}function kr(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return r!==void 0&&e.id===r.id&&e.d===r.d&&e.away===r.away&&e.label.x===r.label.x&&e.label.y===r.label.y})}function Ar({frame:e,cancel:t,draw:n}){let r=[],i,a=t=>{i=void 0,r=r.map(e=>({...e,start:e.start??t})).filter(e=>t<e.start+e.duration),n(r,t),r.length>0&&(i=e(a))};return{launch(t){r.some(e=>e.id===t.id)||(r.push(t),i===void 0&&(i=e(a)))},stop(){i!==void 0&&t(i),i=void 0,r=[],n([],0)},running:()=>i!==void 0}}var jr=e=>e<.5?2*e*e:1-(-2*e+2)**2/2;function Mr(e,t,n=0){let r=Math.min(1,Math.max(0,(t-e.start)/e.duration)),i=Math.max(0,jr(r)-n);return e.reverse?1-i:i}var Nr=`http://www.w3.org/2000/svg`,Pr=[0,.03,.06,.09,.12],Fr=[4.5,3.5,3,2.5,2],Ir={peer:`fill-message-peer-accent`,family:`fill-message-inbound-accent`,success:`fill-success`};function Lr(e,t){let n=e.querySelector(`g[data-comet="${CSS.escape(t.id)}"]`);if(n)return n;let r=document.createElementNS(Nr,`g`);r.setAttribute(`data-comet`,t.id);let i=document.createElementNS(Nr,`circle`);return i.setAttribute(`r`,`9`),i.setAttribute(`class`,`${Ir[t.tone]} opacity-35`),r.append(i),Pr.forEach((e,n)=>{let i=document.createElementNS(Nr,`circle`);i.setAttribute(`r`,String(Fr[n])),i.setAttribute(`class`,n===0?`fill-foreground`:Ir[t.tone]),i.setAttribute(`opacity`,String(1-n*.15)),r.append(i)}),e.append(r),r}function Rr(e,t,n){let r=new Set(t.map(e=>e.id));for(let t of e.querySelectorAll(`g[data-comet]`))r.has(t.getAttribute(`data-comet`)??``)||t.remove();let i=e.ownerSVGElement;for(let r of t){let t=i?.querySelector(`path[data-request="${CSS.escape(r.requestId)}"]`);if(!t||typeof t.getTotalLength!=`function`)continue;let a=t.getTotalLength();Lr(e,r).querySelectorAll(`circle`).forEach((e,i)=>{let o=t.getPointAtLength(Mr(r,n,Pr[Math.max(0,i-1)])*a);e.setAttribute(`transform`,`translate(${o.x} ${o.y})`)})}}var zr=e=>typeof requestAnimationFrame==`function`?requestAnimationFrame(e):setTimeout(()=>e(performance.now()),16),Br=e=>typeof cancelAnimationFrame==`function`?cancelAnimationFrame(e):clearTimeout(e);function Vr(e,t,n){let r=T.useRef(null),i=T.useRef(void 0),a=T.useRef(new Set);return T.useEffect(()=>{let e=r.current;if(!e)return;let t=Ar({frame:zr,cancel:Br,draw:(t,n)=>Rr(e,t,n)});return i.current=t,()=>{t.stop(),i.current=void 0}},[]),T.useEffect(()=>{if(n){i.current?.stop();return}for(let t of a.current)t in e||a.current.delete(t);for(let[n,r]of Object.entries(e))a.current.has(n)||!t.has(r.requestId)||(a.current.add(n),i.current?.launch({id:n,requestId:r.requestId,reverse:r.reverse,tone:r.tone,duration:H.comet}))},[e,t,n]),r}function Hr(e,t){let n=new Map;for(let[r,i]of t){let t=e.get(r);if(!t)continue;let a={x:t.x-i.x,y:t.y-i.y};(Math.abs(a.x)>=1||Math.abs(a.y)>=1)&&n.set(r,a)}return n}function Ur(e,t){let n=new Map;for(let r of e.querySelectorAll(`[${t}]`)){let e=r.getBoundingClientRect();n.set(r.getAttribute(t)??``,{el:r,at:{x:e.left,y:e.top}})}return n}var Wr=`activity-layout-settled`;function Gr(e,t,n,r){let i=T.useRef(void 0),a=T.useRef(new Set);T.useLayoutEffect(()=>{let o=e.current;if(!o)return;let s=Ur(o,t),c=new Map([...s].map(([e,t])=>[e,t.at])),l=i.current;if(i.current={key:n,at:c},!(!r||!l||l.key===n))for(let[e,t]of Hr(l.at,c)){let n=s.get(e)?.el.animate?.([{transform:`translate(${t.x}px, ${t.y}px)`},{transform:`none`}],{duration:400,easing:`cubic-bezier(0.2, 0, 0, 1)`});n&&Kr(n,a.current,o)}}),T.useEffect(()=>{if(!r)for(let e of[...a.current])e.cancel()},[r])}function Kr(e,t,n){t.add(e);let r=()=>{t.delete(e)&&t.size===0&&n.dispatchEvent(new Event(Wr))};e.addEventListener(`finish`,r),e.addEventListener(`cancel`,r)}function qr(e,t,n,r,i,a=!1){let[o,s]=T.useState([]);return T.useLayoutEffect(()=>{let i=e.current?.parentElement;if(!i)return;let o=()=>{let e=t(i);s(t=>n(t,e)?t:e)};o();let c=a?Jr(i,o):void 0;i.addEventListener(Wr,o);let l=typeof ResizeObserver>`u`?void 0:new ResizeObserver(o);l?.observe(i);for(let e of i.querySelectorAll(r))l?.observe(e);return()=>{l?.disconnect(),i.removeEventListener(Wr,o),c?.()}},[e,t,n,r,i,a]),o}function Jr(e,t){let n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=[..._r(e),window];for(let e of i)e.addEventListener(`scroll`,r,{passive:!0});return window.addEventListener(`resize`,r),()=>{for(let e of i)e.removeEventListener(`scroll`,r);window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n)}}var Yr=28;function Xr(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Yr?`${t.slice(0,Yr-1).trimEnd()}…`:t}function Zr(e,t){if(e.deadline!==void 0)return Qr(e.createdAt,e.deadline,t)}function Qr(e,t,n){let r=Date.parse(e),i=Date.parse(t);return Number.isNaN(r)||Number.isNaN(i)||i<=r?1:Math.min(1,Math.max(0,(n-r)/(i-r)))}function $r(e,t){if(e===`fade`)return`activity-line-out`;if(e!==`replied`)return r(`activity-march`,t&&`activity-line-in`)}function ei(e,t){return t in e.waitsClosing?`activity-line-out`:r(`activity-drift`,t in e.opening&&`activity-line-in`)}var ti=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-lg border bg-background px-1.5 py-[3px] text-[10px] leading-[1.3] text-foreground tabular-nums`;function ni({line:e,wait:t,now:n,motion:i}){return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:r(ti,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Waiting`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:j(M(t.since,n))})]}),e.away?(0,E.jsx)(`span`,{className:`block truncate`,children:e.away}):null,(0,E.jsx)(`span`,{"data-slot":`activity-wait-bar`,className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent opacity-70`,style:{width:`${Math.round(Qr(t.since,t.deadline,n)*100)}%`}})})]})}function ri({line:e,request:t,now:n,phase:i,replied:a}){let o=Zr(t,n);return(0,E.jsxs)(`div`,{"data-slot":`activity-line-label`,"data-request":t.requestId,"data-phase":i,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y,width:X.w},className:r(ti,a?`border-success`:`border-message-peer-accent`,i===`fade`&&`activity-line-out`),children:[(0,E.jsxs)(`span`,{className:`flex gap-1 font-semibold`,children:[a?(0,E.jsx)(`span`,{className:`text-success`,children:`Replied`}):(0,E.jsx)(`span`,{className:`min-w-0 truncate text-message-peer-accent`,children:`Request`}),(0,E.jsx)(`span`,{className:`ml-auto shrink-0`,children:j(M(t.createdAt,n))})]}),(0,E.jsx)(`span`,{className:`block truncate`,children:e.away??Xr(t.text)}),o===void 0||a?null:(0,E.jsx)(`span`,{className:`mt-[3px] block h-[3px] overflow-hidden rounded-sm bg-border`,children:(0,E.jsx)(`span`,{className:`block h-full bg-message-peer-accent`,style:{width:`${Math.round(o*100)}%`}})})]})}var Z=(e,t)=>e.closing[t]?.phase??`open`;function ii(e,t){let n=e.closing[t];return n!==void 0&&n.replied&&n.phase!==`reply`}var ai=new Set;function oi({line:e,motion:t}){let n=Z(t,e.id);return(0,E.jsx)(`path`,{"data-request":e.id,"data-kind":e.kind,"data-phase":n,d:e.d,fill:`none`,strokeDasharray:n===`replied`?void 0:`6 5`,strokeWidth:e.kind===`peer`?2.2:1.8,markerEnd:`url(#activity-arrow-${e.kind})`,className:r(e.kind===`peer`?`stroke-message-peer-accent`:`stroke-message-inbound-accent`,$r(n,e.id in t.opening))})}function si({line:e,motion:t,active:n}){return(0,E.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":n?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:n?3.2:2.4,markerEnd:`url(#activity-ring-wait)`,className:r(`stroke-message-peer-accent`,n?`opacity-100`:`opacity-80`,ei(t,e.id))})}function ci({id:e}){return(0,E.jsx)(`marker`,{id:e,viewBox:`0 0 12 12`,refX:`10`,refY:`6`,markerWidth:`5`,markerHeight:`5`,markerUnits:`strokeWidth`,orient:`auto`,children:(0,E.jsx)(`circle`,{cx:`6`,cy:`6`,r:`4`,strokeWidth:`2.4`,className:`fill-background stroke-message-peer-accent`})})}var li=[];function ui({requests:e,waits:t=li,active:n=ai,index:r,peers:i,layoutKey:a,now:o,motion:s=U,paused:c=!1}){let l=T.useRef(null),u=qr(l,T.useCallback(n=>Or(n,e,r,{peers:i,waits:t,frame:{width:n.clientWidth,view:yr(n)}}),[e,t,r,i]),kr,`[data-activity-card]`,a,!0),d=T.useMemo(()=>new Set(u.map(e=>e.id)),[u]),f=Vr(s.comets,d,c),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e]));return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`svg`,{ref:l,"data-slot":`activity-lines`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible`,children:[(0,E.jsxs)(`defs`,{children:[(0,E.jsx)(`marker`,{id:`activity-arrow-peer`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,E.jsx)(`marker`,{id:`activity-arrow-family`,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`6`,markerHeight:`6`,orient:`auto`,children:(0,E.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-inbound-accent`})}),(0,E.jsx)(ci,{id:`activity-ring-wait`})]}),u.map(e=>e.kind===`wait`?(0,E.jsx)(si,{line:e,motion:s,active:n.has(e.id)},e.id):(0,E.jsx)(oi,{line:e,motion:s},e.id)),(0,E.jsx)(`g`,{ref:f,"data-slot":`activity-comets`})]}),u.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,E.jsx)(ni,{line:e,wait:t,now:o,motion:s},e.id);let n=p.get(e.id);return e.kind===`peer`&&n?(0,E.jsx)(ri,{line:e,request:n,now:o,phase:Z(s,e.id),replied:ii(s,e.id)},e.id):null})]})}function di(e,t){let n=new Map;for(let r of[...e?.projects??[],...t.projects])for(let[e,t]of kt(r))n.set(e,t);return n}var fi={"timed-out":`timed out`,cancelled:`was cancelled`,destroyed:`closed: the recipient was destroyed`,failed:`closed: the recipient failed`,"completed-without-reply":`closed without a reply`,"sender-closed":`was closed by its sender`,"human-fallback":`went to a human`,deleted:`closed: the recipient was deleted`};function pi(e,t,n){let r=n(e.senderRunId,e.senderTitle),i=n(e.recipientRunId,e.recipientTitle);return t===`replied`?`${i} replied to ${r}`:`${r}’s request to ${i} ${fi[t??``]??`closed`}`}var mi={done:{tone:`success`,word:`finished`},failed:{tone:`danger`,word:`failed`},cancelled:{tone:`neutral`,word:`was cancelled`},review:{tone:`info`,word:`waits for review`}},hi=e=>e.relationship===`peer`?`peer`:`family`;function gi(e,t,n){let r=(e,n)=>B(t,e,n);switch(e.kind){case`request-opened`:return{tone:hi(e.request),text:`${r(e.request.senderRunId,e.request.senderTitle)} asked ${r(e.request.recipientRunId,e.request.recipientTitle)}`};case`request-closed`:return{tone:e.status===`replied`?`success`:`neutral`,text:pi(e.request,e.status,r)};case`rung-changed`:return{tone:h(e.task.rung).tone,text:`${e.task.title}: ${z(e.task,{now:n,titleOf:e=>r(e)}).verb}`};case`worker-started`:return{tone:`running`,text:`${e.worker.title} started`};case`worker-settled`:{let t=mi[e.worker.status]??{tone:`neutral`,word:`settled`};return{tone:t.tone,text:`${e.worker.title} ${t.word}`}}case`card-entered`:return{tone:h(e.task.rung).tone,text:`${e.task.title} started`};case`card-left`:return{tone:`neutral`,text:`${e.task.title} left active work`};case`check-passed`:return{tone:`success`,text:`PR ${e.pr}: check “${e.name}” passed`};default:return}}function _i(e,t,n,r){return[...t.map((e,t)=>({...e,id:r+t,at:n})),...e].slice(0,6)}function vi(e){let t=Math.max(0,Math.floor(e/1e3));return t<5?`now`:t<60?`${t} s`:`${Math.floor(t/60)} min`}var yi=new Set;function bi(e){let[t,n]=T.useState({}),r=t.pointer??t.focus,i=T.useCallback((e,t)=>n(n=>n[e]===t?n:{...n,[e]:t}),[]);return{linked:T.useMemo(()=>r===void 0?yi:Nt(r,e),[r,e]),active:T.useMemo(()=>r===void 0?yi:new Set(e.filter(e=>e.waiterRunId===r||e.peerRunId===r).map(e=>e.id)),[r,e]),onHover:i}}var xi=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Si=`inline-flex items-center px-3 py-[5px] text-[12px] font-medium focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring max-md:min-h-11`;function Ci({scope:e,projectId:t}){let n=e=>r(Si,e?`bg-card-2 text-foreground`:`text-muted-foreground hover:text-foreground`);return(0,E.jsxs)(`nav`,{"aria-label":`Activity scope`,"data-slot":`activity-scope`,className:`ml-auto inline-flex overflow-hidden rounded-lg border border-border`,children:[t===null?null:(0,E.jsx)(i,{to:`/p/${encodeURIComponent(t)}/activity`,"aria-current":e===`project`?`page`:void 0,className:n(e===`project`),children:`This project`}),(0,E.jsx)(i,{to:`/activity`,state:{activityProjectId:t},"aria-current":e===`all`?`page`:void 0,className:n(e===`all`),children:`All projects`})]})}function wi({now:e,stale:t}){return(0,E.jsxs)(`span`,{"data-slot":`activity-clock`,"data-stale":t?`true`:void 0,className:`inline-flex items-center gap-1.5 text-[12px] text-muted-foreground tabular-nums`,children:[(0,E.jsx)(`span`,{"data-tone":`success`,className:r(`inline-flex size-[12px] items-center justify-center`,!t&&`activity-pulse`),children:(0,E.jsx)(w,{tone:t?`neutral`:`success`,"aria-hidden":`true`})}),(0,E.jsx)(`b`,{className:r(`font-semibold`,t?`text-muted-foreground`:`text-success`),children:t?`Not updating`:`Live`}),xi.format(e),` `,at()]})}function Ti({name:e,now:t,stale:n=!1,children:r}){return(0,E.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,E.jsxs)(`h1`,{className:`min-w-0 truncate text-[18px] font-semibold`,children:[`Activity `,(0,E.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`· `,e]})]}),t===void 0?null:(0,E.jsx)(wi,{now:t,stale:n}),r]})}function Ei({value:e,bump:t}){return(0,E.jsx)(`strong`,{"data-bump":t===void 0?void 0:`true`,className:r(`font-semibold text-foreground tabular-nums`,t!==void 0&&`activity-bump`),children:e},t??`still`)}function Q({icon:e,count:t,label:n,bump:r}){return(0,E.jsxs)(`li`,{"data-slot":`activity-chip`,"data-chip":n,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground`,children:[e,(0,E.jsx)(Ei,{value:t,bump:r}),` `,n]})}function Di({summary:e,tasksTo:t,bumps:n={}}){let r=e=>n[e]?.key;return(0,E.jsxs)(`ul`,{"data-slot":`activity-summary`,"aria-live":`polite`,"aria-label":`Summary`,className:`flex flex-wrap gap-2`,children:[(0,E.jsx)(Q,{icon:(0,E.jsx)(w,{tone:`pending`,"aria-hidden":`true`}),count:e.needsYou,label:`needs you`,bump:r(`needsYou`)}),(0,E.jsx)(Q,{icon:(0,E.jsx)(w,{tone:`running`,"aria-hidden":`true`}),count:e.working,label:`working`,bump:r(`working`)}),(0,E.jsx)(Q,{icon:(0,E.jsx)(w,{tone:`running`,shape:`ring`,"aria-hidden":`true`}),count:e.waiting,label:`waiting`,bump:r(`waiting`)}),(0,E.jsx)(Q,{icon:(0,E.jsx)(w,{tone:`neutral`,shape:`ring`,"aria-hidden":`true`}),count:e.queued,label:`queued`,bump:r(`queued`)}),(0,E.jsx)(Q,{icon:(0,E.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`}),count:e.activeWorkers,label:`active workers`,bump:r(`activeWorkers`)}),(0,E.jsx)(Q,{icon:(0,E.jsx)(be,{"aria-hidden":`true`,className:`size-3.5 text-message-peer-accent`}),count:e.openRequests,label:`open requests`,bump:r(`openRequests`)}),(0,E.jsx)(`li`,{"data-slot":`activity-chip`,"data-chip":`in review`,children:(0,E.jsxs)(C,{to:t,className:`inline-flex items-center gap-[7px] rounded-full border border-border bg-card px-[11px] py-[5px] text-[12px] text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`,children:[(0,E.jsx)(w,{tone:`info`,"aria-hidden":`true`}),(0,E.jsx)(Ei,{value:e.inReview,bump:r(`inReview`)}),` in review`]})})]})}var $=e=>new Map(e.map(e=>[e.runId,e])),Oi=e=>e!==void 0&&Ot(e)===void 0;function ki(e,t,n,r){let i=$(t.workers);for(let t of n.workers){let a=i.get(t.runId);!a&&P(t.status)&&r({kind:`worker-started`,projectId:e,parentId:n.runId,worker:t}),a&&P(a.status)&&!P(t.status)&&r({kind:`worker-settled`,projectId:e,parentId:n.runId,worker:t})}}function Ai(e,t,n,r){if(t.wait?.kind!==`pr`||n.wait?.kind!==`pr`||t.wait.detail.number!==n.wait.detail.number)return;let i=new Set((t.wait.detail.checks??[]).filter(e=>e.bucket===`pending`).map(e=>e.name));for(let t of n.wait.detail.checks??[])t.bucket===`pass`&&i.has(t.name)&&r({kind:`check-passed`,projectId:e,runId:n.runId,pr:n.wait.detail.number,name:t.name})}var ji=(e,t)=>t.tool!==void 0&&(t.tool.startedAt!==e.tool?.startedAt||t.tool.title!==e.tool?.title);function Mi(e,t,n,r){t.rung!==n.rung&&r({kind:`rung-changed`,projectId:e,task:n,from:t.rung}),ji(t,n)&&r({kind:`tool-started`,projectId:e,runId:n.runId}),ki(e,t,n,r),Ai(e,t,n,r)}function Ni(e,t,n){let r=$(e.tasks),i=$(t.tasks);for(let e of t.tasks){let i=r.get(e.runId);i?Mi(t.projectId,i,e,n):n({kind:`card-entered`,projectId:t.projectId,task:e})}for(let r of e.tasks)i.has(r.runId)||n({kind:`card-left`,projectId:t.projectId,task:r})}function Pi(e,t,n){let r=new Set(e.requests.map(e=>e.requestId)),i=new Set(t.requests.map(e=>e.requestId)),a=new Map(t.closed.map(e=>[e.requestId,e.status]));for(let e of t.requests)r.has(e.requestId)||n({kind:`request-opened`,projectId:t.projectId,request:e});for(let r of e.requests){if(i.has(r.requestId))continue;let e=a.get(r.requestId);n({kind:`request-closed`,projectId:t.projectId,request:r,...e?{status:e}:{}})}}function Fi(e,t,n){let r=Mt(e.tasks),i=Mt(t.tasks),a=new Set(r.map(e=>e.id)),o=new Set(i.map(e=>e.id));for(let e of i)a.has(e.id)||n({kind:`wait-opened`,projectId:t.projectId,wait:e});for(let e of r)o.has(e.id)||n({kind:`wait-closed`,projectId:t.projectId,wait:e})}var Ii=[`needsYou`,`working`,`waiting`,`queued`,`activeWorkers`,`openRequests`,`inReview`];function Li(e,t,n){let r=Wt(e),i=Wt(t);for(let e of Ii)r[e]!==i[e]&&n({kind:`chip-changed`,chip:e,from:r[e],to:i[e]})}function Ri(e,t){if(e===void 0)return[];let n=[],r=e=>n.push(e),i=new Map(e.projects.map(e=>[e.projectId,e]));for(let e of t.projects){let t=i.get(e.projectId);!Oi(t)||!Oi(e)||(Ni(t,e,r),Pi(t,e,r),Fi(t,e,r))}return Li(e.projects,t.projects,r),n}function zi(e){return{input:e,reconcile:!1,seq:0,motion:U,feed:[],epoch:0,...e.snapshot?{seen:e.snapshot}:{}}}function Bi(e){let{plan:t,...n}=e;return{...n,motion:U,epoch:e.epoch+1}}function Vi(e,t,n){let r=Ri(t,n);if(r.length===0)return e;let i=Date.parse(n.generatedAt),a=di(t,n),o=r.flatMap(e=>gi(e,a,i)??[]),s=e.seq+o.length+1,c=tn(r,s,e.input.reduced);return{...e,seq:s,feed:o.length>0?_i(e.feed,o,i,e.seq+1):e.feed,motion:rn(e.motion,c.changes),...c.timers.length>0?{plan:{key:s,timers:c.timers}}:{}}}function Hi(e,t){let n=e.seen;if(!t||t===n)return e;let r={...e,seen:t};return!n||!e.input.active?r:e.reconcile?{...r,reconcile:!1}:Vi(r,n,t)}function Ui(e,t){let n=e.input;if(t.scope!==n.scope)return{...zi(t),seq:e.seq,epoch:e.epoch+1};if(t.snapshot===n.snapshot&&t.active===n.active&&t.reduced===n.reduced)return e;let r={...e,input:t};return n.active&&!t.active&&(r={...Bi(r),reconcile:!0}),!n.reduced&&t.reduced&&(r=Bi(r)),Hi(r,t.snapshot)}var Wi=`(prefers-reduced-motion: reduce)`,Gi=()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(Wi):void 0;function Ki(e){let t=Gi();return t?.addEventListener?.(`change`,e),()=>t?.removeEventListener?.(`change`,e)}function qi(){return Gi()?.matches??!1}function Ji(){return(0,T.useSyncExternalStore)(Ki,qi,()=>!1)}function Yi(e,t){let n=T.useRef(new Set);T.useEffect(()=>{let e=n.current;return()=>{for(let t of e)clearTimeout(t);e.clear()}},[e.epoch]),T.useEffect(()=>{for(let{after:r,change:i}of e.plan?.timers??[]){let e=setTimeout(()=>{n.current.delete(e),t(e=>({...e,motion:rn(e.motion,[i])}))},r);n.current.add(e)}},[e.plan?.key])}function Xi(e,t){let n=Ji(),r=ae(),i={snapshot:e,scope:t,active:r,reduced:n},[a,o]=T.useState(()=>zi(i)),s=Ui(a,i);return s!==a&&o(s),Yi(s,o),{motion:s.motion,feed:s.feed,reduced:n,paused:!r}}function Zi(e,t){let n=xe(1e3),[r,i]=T.useState({offset:0}),a=r.offset;return Ze(e)&&e!==r.generatedAt&&t!==0&&(a=Date.parse(e)-t,i({generatedAt:e,offset:a})),n+a}export{Cn as A,Mt as B,Fn as C,Mn as D,Pn as E,U as F,At as G,V as H,an as I,z as J,Wt as K,zt as L,W as M,ln as N,Tn as O,sn as P,nt as Q,Ft as R,er as S,Rn as T,Lt as U,Ot as V,kt as W,j as X,N as Y,M as Z,Vr as _,Di as a,ur as b,ui as c,Z as d,ii as f,Gr as g,qr as h,Ci as i,gn as j,An as k,ci as l,Zr as m,Xi as n,bi as o,ei as p,P as q,Ti as r,vi as s,Zi as t,$r as u,wr as v,Ln as w,$n as x,lr as y,B as z};
@@ -1 +0,0 @@
1
- import{Dn as e,Mn as t}from"./project-scope-context-CjF9fBcW.js";function n(n){return e[t(n).bucket]<=e.waiting}export{n as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./button-C1fD-ZFr.js";import{a as i}from"./project-scope-context-CjF9fBcW.js";import{n as a}from"./use-desktop-DBmPhWpf.js";import{j as o,ot as s,r as c}from"./design-icons-B6-0w7Aw.js";import{n as l}from"./diff-controls-C8aqhty4.js";import{u}from"./reference-chip-D0fgKbcF.js";import{t as d}from"./project-router-CgSlk0dT.js";import{t as f}from"./centered-state-CiiA8Vgw.js";import{Mt as p}from"./index-30DUDWal.js";import{t as m}from"./diff-BD8D6wN_.js";var h=e(t(),1),g=n();function _({commit:e,sha:t,backTo:n,backLabel:_,slot:v,className:y,diffClassName:b}){let x=a(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":t,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(r,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(d,{to:n,children:[(0,g.jsx)(c,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(p,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(l,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(f,{icon:E?(0,g.jsx)(u,{}):(0,g.jsx)(s,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(f,{icon:(0,g.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ 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{E as r,M as i,l as a,t as o}from"./button-C1fD-ZFr.js";import{$ as s,Jt as c,Mn as l,Q as u,Y as d,Z as f,ti as p,ui as m}from"./project-scope-context-CjF9fBcW.js";import{D as h,Et as g,G as _,T as ee,Yt as v,j as y,k as te,s as b,t as x,w as S}from"./queries-CzcxBTP6.js";import{G as C,a as w,n as ne,o as T,r as E,z as D}from"./use-desktop-DBmPhWpf.js";import{n as O}from"./toaster-Cxgzn9ip.js";import{F as k,I as A,X as j,Y as M,c as N,l as P,ot as F,p as I,r as re}from"./design-icons-B6-0w7Aw.js";import{l as ie,n as ae}from"./nav-row-styles-CFjnD-9J.js";import{a as L,i as R}from"./format-BNCkW110.js";import{_ as oe,a as se,d as z,f as ce,h as le,i as ue,m as de,n as fe,o as pe,p as me,r as he,v as ge}from"./prompt-template-menu-DCTzkDjy.js";import{r as _e,t as B}from"./project-router-CgSlk0dT.js";import"./attention-CczhK23N.js";import{I as ve,L as V,M as ye,P as be,R as xe}from"./picker-pill-CV8i0S1a.js";import{t as H}from"./centered-state-CiiA8Vgw.js";import{C as Se,Lt as Ce,V as we,X as Te,Y as Ee,Zt as De,gn as Oe,hn as ke,s as Ae}from"./index-30DUDWal.js";import{a as je,d as Me,f as Ne,i as Pe,l as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be,u as U}from"./use-hand-to-agent-state-A1CYX_Z1.js";import{t as W}from"./tab-link-CHCa9yZ_.js";var G=e(t(),1),K=`cez-github-list-width`;function q(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Ve(){try{let e=localStorage.getItem(K);return e===null?360:q(e)}catch{return 360}}function He(e){try{localStorage.setItem(K,String(q(e)))}catch{}}var J=n();function Ue({number:e,repo:t}){let n=i();return(0,J.jsx)(We,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function We({number:e,repo:t,scope:n}){let r=(0,G.useId)(),i=(0,G.useId)(),[a,s]=(0,G.useState)(!1),c=a?Oe:ke,u=_(n,!0,n==="default"),d=b(`#${e}`,!0),f=(0,G.useMemo)(()=>de(C(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,J.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,J.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,J.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":i,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,J.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,J.jsx)(`div`,{id:i,children:a?(0,J.jsxs)(J.Fragment,{children:[u.isPending?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,J.jsx)(o,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,J.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(B,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,J.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:D(e)}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(De,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,J.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,J.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,J.jsx)(o,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,J.jsx)(o,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var Y=`w-44 max-w-full`,X=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function Ge(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function Ke(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function qe(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function Je(e){return[e.viewerLogin?``:`GitHub login unavailable.`,qe(e)].filter(Boolean).join(` `)}function Ye({options:e,assignees:t,onAssigneesChange:n}){return(0,J.jsxs)(E,{children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:X,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,J.jsx)(P,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,J.jsx)(w,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,J.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,J.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,J.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,J.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,J.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Xe({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,J.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${X} ${Y}`,value:t,onChange:e=>n(e.target.value),children:[(0,J.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,J.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,J.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${X} ${Y}`,disabled:!0,value:``,children:(0,J.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Ze({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,J.jsxs)(E,{open:i,onOpenChange:a,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsx)(`button`,{ref:o,type:`button`,className:`${X} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,J.jsx)(M,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,J.jsx)(F,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,J.jsx)(w,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Qe({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=(0,G.useRef)(null),d=Ge(e.issues,t),f=Ke(e.viewerLogin,t),p=Je(e),m=p!==``,h=(0,G.useRef)(p);m&&(h.current=p);let g=(0,G.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,G.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,G.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,J.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,J.jsx)(Ye,{options:d,assignees:t,onAssigneesChange:r}),(0,J.jsx)(`button`,{ref:u,type:`button`,className:`${X} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,J.jsx)(Xe,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,J.jsx)(Ze,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function $e({onRefresh:e,refreshing:t}){let n=Ee(i());return(0,J.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:ae,children:[(0,J.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,J.jsx)(`h1`,{className:a(ie,`min-w-0 flex-1`),children:`GitHub`}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,J.jsx)(M,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,J.jsx)(Te,{model:n,variant:`screen`})]})}function et(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function tt(e){let[t,n]=(0,G.useState)(null);return(0,G.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(et(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function nt(e,t){let[n,r]=(0,G.useState)(0);return(0,G.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function rt(e,t,n){let[r,i]=(0,G.useState)(null),a=(0,G.useRef)(n);return(0,G.useEffect)(()=>{a.current=n}),(0,G.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function it(e,t,n,r,i){let[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=tt(a),u=(0,G.useRef)(null);u.current=l;let d=nt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:rt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var at=100;function ot(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=at)break;a.add(t.number)}return[...a]}function st(e,t,n,r,i,a){let o=ot(n,e,r,i,a),s=S(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=ee(e===`issues`?`issue`:`pr`,(0,G.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,G.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function ct(e){let[t,n]=Se(),r=t.get(`filter`),i=le(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function lt(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)([]),[l,u]=(0,G.useState)([]),{setProjectFilter:d,activeProject:f}=ut(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function ut(e){let[t,n]=(0,G.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,G.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function dt(e,t,{filter:n,activeFilter:r},a){let o=i(),s=e===`issues`&&(r===`no-task`||r===`has-task`),c=_(o,s,o==="default"),l=(0,G.useMemo)(()=>c.data?me(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=ce(e,n)?ge(n):null,d=y(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,G.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,G.useMemo)(()=>f?oe(f,p):null,[f,p]),h=ft({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,G.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,G.useMemo)(()=>e===`issues`?r===`no-task`&&l?{excludeNumbers:l}:r===`has-task`&&l?{includeNumbers:l}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,r,l,t?.viewerLogin,f])}}function ft({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function Z(e,t){return t?s(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function pt(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=x.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,G.useState)(null);return(0,G.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function mt(e,t,n,{fullList:r,filterRows:i},a){let o=p(),s=(0,G.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,u=h(c,n??0,l),d=l&&u.data?.available&&u.data.item?.kind===c?u.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:x.githubItem(c,n)}:null;let[f,m]=(0,G.useState)(!1);return{exactWanted:l,exactItem:u,exactDetail:d,exactTargetRef:s,retryingExact:f,retryExact:()=>{m(!0),Z(o,s.current).then(e=>{m(!1),e||O(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function ht(e,t,n){let r=p(),i=(0,G.useRef)(null);return{refresh:v({mutationFn:e=>(Z(r,e),d({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:x.githubPages(50),exact:!0}),r.setQueryData(x.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:x.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),c=x.githubCommentCounts(o,s);r.removeQueries({queryKey:x.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(c)}),a.available&&a.commentsDeferred&&s.length>0&&f(o,s,{refresh:!0}).then(e=>r.setQueryData(c,e)).catch(()=>{}),r.invalidateQueries({queryKey:x.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:x.githubSearch(`pr`,pe)}),r.invalidateQueries({queryKey:x.githubSearch(`pr`,he)});let l=i.current;if(!l){r.removeQueries({queryKey:[`github`,`comments`]});return}let d=x.githubComments(l.kind,l.number);u(l.kind,l.number,{refresh:!0}).then(e=>r.setQueryData(d,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(d)})},onError:e=>O(e.message,{tone:`danger`})}),openThreadRef:i}}var gt=350;function _t(e,t){let[n,r]=(0,G.useState)(e);return(0,G.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function vt(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=_t(n,gt),u=(0,G.useMemo)(()=>U(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Ne(l,u),p=y(e===`issues`?`issue`:`pr`,l,f),m=U(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=yt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?U(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...bt(n,d,f,p)}}function yt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function bt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function xt({width:e,onWidthChange:t}){let n=(0,G.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(q(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,J.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(q(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function St({view:e,changes:t=!1,index:n=!1}){let{n:i}=r(),a=ct(e),{rawFilterParam:o,activeFilter:s}=a,c=ne(),{pages:l,data:u}=te(50),d=Ce(),f=wt(),p=Be(),m=Ct({index:n,isDesktop:c,rawFilterParam:o,n:i,rememberedView:g().data?.githubView}),h=Tt(u?.available===!0&&!m.filterScreen),[_,ee]=(0,G.useState)(!1),v=lt(e,u,a),y=dt(e,u,a,v.isAssignedFilter),b=vt(e,u,v,y),x=pt(e,i,b.forgeSearch,y),S=mt(e,u,x.selectedNumber,y,x.remoteDetail),C=st(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=ht(e,C.checkPrNumbers,b.debouncedQuery),E=it(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,J.jsx)(_e,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,J.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(H,{icon:(0,J.jsx)(F,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,J.jsx)(we,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,J.jsx)($e,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,J.jsx)(At,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Et(u,b.searchPayload,y.openItems,y.fullList),A=Dt({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:j,listPath:M}=Ot(e,o,s,c),N={view:e,filter:j,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},P=kt(e,v,y.filterGate,b);return(0,J.jsxs)(`div`,{ref:h.routeRef,"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:px-7 md:pt-4 md:pb-4`,children:[(0,J.jsx)(jt,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,J.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,J.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,J.jsx)(Mt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,J.jsx)(Nt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,J.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,J.jsx)(Pt,{view:e,n:i,rows:N,verdict:P,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:_,onExpandedChange:ee}),(0,J.jsx)(Bt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:N,listPath:M,changes:t,handToAgent:p})]})]})]})}function Ct({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function wt(){let e=p();return t=>{e.setQueryData(x.uiState,e=>({...e,githubView:t})),c({githubView:t}).then(t=>e.setQueryData(x.uiState,t)).catch(t=>{O(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:x.uiState})})}}function Tt(e){let[t,n]=(0,G.useState)(Ve),[r,i]=(0,G.useState)(!0),a=(0,G.useRef)(null),o=(0,G.useRef)(null);return(0,G.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=q(e);n(t),He(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Et(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Fe([...n,...r,...t?.items??[]])}}function Dt({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Ot(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:z(e,i??(e===`issues`&&!r?`all`:null))}}function kt(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,J.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,J.jsx)(L,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,J.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,J.jsx)(L,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,J.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,J.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,J.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,J.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,J.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,J.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,J.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,J.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,J.jsxs)(`p`,{children:[`No open `,d,`.`]})}function At({reason:e,refreshing:t,onRetry:n}){return(0,J.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,J.jsx)(H,{icon:(0,J.jsx)(A,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,J.jsx)(o,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,J.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,J.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,J.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function jt({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,J.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,J.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${fe[t]}`:`GitHub`}),r!==null&&i===void 0?(0,J.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,J.jsxs)(B,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,J.jsx)(re,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,J.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...ue,...se].find(e=>e.id===t)?.label})]}):null,a.repo?(0,J.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,J.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,J.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${R(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function Mt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,J.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,J.jsxs)(W,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,J.jsxs)(W,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,J.jsx)(B,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,J.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,J.jsx)(M,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Nt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,J.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,J.jsx)(j,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,J.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,J.jsx)(Kt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,J.jsx)(Qe,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,J.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Q(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function $(e,t){return(0,J.jsx)(Gt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Q(e,t.checksMap),comments:t.commentsOf(e)})}function Pt({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,J.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,J.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,J.jsx)(Ft,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,J.jsx)(It,{view:e,list:o,paging:s}):null,(0,J.jsx)(Lt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,J.jsx)(Rt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,J.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,J.jsx)(zt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,J.jsx)(xt,{width:c,onWidthChange:l})]})}function Ft({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,J.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:$(e,t)},e.url));return(0,J.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,J.jsx)(Ae,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function It({view:e,list:t,paging:n}){return(0,J.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,J.jsxs)(J.Fragment,{children:[`Could not load more.`,(0,J.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,J.jsxs)(J.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,J.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Lt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,J.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function Rt({view:e,n:t,count:n,expanded:r,onExpandedChange:i}){return e===`issues`&&t!==void 0&&n>2?(0,J.jsx)(o,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function zt({hits:e,searchPayload:t,rows:n}){return(0,J.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,J.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,J.jsx)(`li`,{children:$(e,n)},e.url))})]})}function Bt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,J.jsx)(`section`,{"data-slot":`gh-detail`,className:a(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,J.jsx)(Vt,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,J.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,J.jsx)(H,{icon:(0,J.jsx)(L,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,J.jsx)(Ht,{number:r,exact:i}):(0,J.jsx)(Ut,{view:e,number:r})})}function Vt({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,J.jsx)(Le,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,J.jsx)(Ue,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Wt,colors:r.colors,checks:Q(e,r.checksMap),children:(0,J.jsx)(Ie,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ht({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,J.jsx)(H,{icon:(0,J.jsx)(F,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,J.jsx)(o,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function Ut({view:e,number:t}){return(0,J.jsx)(H,{icon:e===`issues`?(0,J.jsx)(I,{size:16}):(0,J.jsx)(k,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Wt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Gt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:c}){let l=e.kind===`issue`?I:k,d=p(),f=()=>{d.prefetchQuery({queryKey:x.githubComments(e.kind,e.number),queryFn:({signal:t})=>u(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,J.jsxs)(B,{to:z(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Re(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,J.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,J.jsx)(l,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:a(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,J.jsx)(`span`,{"data-slot":`gh-row-title`,className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,J.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,J.jsxs)(`span`,{children:[`#`,e.number]}),(0,J.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,J.jsx)(`span`,{children:R(e.createdAt)}),(0,J.jsx)(je,{count:c}),s?(0,J.jsx)(Pe,{checks:s}):null,o?(0,J.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,J.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,J.jsx)(ze,{label:e,color:r[e],plain:!0},e))}):null]})}function Kt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,G.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,J.jsxs)(E,{open:i,onOpenChange:o,children:[(0,J.jsx)(T,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:a(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,J.jsx)(P,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,J.jsx)(w,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,J.jsxs)(ye,{children:[(0,J.jsx)(ve,{placeholder:`Filter labels…`}),(0,J.jsxs)(xe,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,J.jsx)(be,{children:`No labels.`}),n.length>0?(0,J.jsxs)(V,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,J.jsxs)(V,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Me(t[e])}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,J.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{St as GithubRoute};