@hearsay-tools/squawk 0.19.0-dev.9132 → 0.19.0-dev.9137

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 (64) hide show
  1. package/package.json +4 -4
  2. package/web/dist/assets/{accounts-section-B4kEEiWs.js → accounts-section-BsgnDmow.js} +1 -1
  3. package/web/dist/assets/{activity-motion-DUZ4l5Y3.js → activity-motion-Ckq9kC3I.js} +1 -1
  4. package/web/dist/assets/{activity-route-YAqJVIKB.js → activity-route-5S9WhN9U.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-bUNUaoek.js → agent-config-section-D8pxNy2V.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-B8dWNT51.js → agent-defaults-section-et5LHv9W.js} +1 -1
  7. package/web/dist/assets/{appearance-BwqalVnF.js → appearance-D_t3wCjY.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-B3PVwd5v.js → archive-on-merge-field-C63xRNFZ.js} +1 -1
  9. package/web/dist/assets/{ask-card-BmLwnSDP.js → ask-card-kqWOqKIc.js} +3 -3
  10. package/web/dist/assets/{automations-route-B0AiEpEO.js → automations-route-B5YBpGMc.js} +2 -2
  11. package/web/dist/assets/{commit-list-DidJ1SQk.js → commit-list-Bjc-pQxv.js} +1 -1
  12. package/web/dist/assets/{diff-controls-BW6ZPORB.js → diff-controls-CaCUSyxs.js} +1 -1
  13. package/web/dist/assets/{diff-1-ZZxHE7.js → diff-lwWO-At7.js} +2 -2
  14. package/web/dist/assets/{diff-view-BXLNGK_U.js → diff-view-4wxDvYXE.js} +1 -1
  15. package/web/dist/assets/discard-changes-dialog-B3gvm7lX.js +1 -0
  16. package/web/dist/assets/{file-preview-CL7CFVQW.js → file-preview-98pJhZJj.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-Cn5M9SIx.js → git-toolbar-CepvG0Ng.js} +1 -1
  18. package/web/dist/assets/{github-CWssvL9L.js → github-4Jhl7lLG.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-WSb9IeCy.js → global-activity-route-DhmrWj31.js} +1 -1
  20. package/web/dist/assets/index-BK1FcZrA.css +1 -0
  21. package/web/dist/assets/index-DJB0lid-.js +21 -0
  22. package/web/dist/assets/{markdown-DkyIbV7h.js → markdown-BAPhDASs.js} +1 -1
  23. package/web/dist/assets/{option-select-DgSc8QKe.js → option-select-BwSkbCrQ.js} +1 -1
  24. package/web/dist/assets/{preferences-section-C5ipASFT.js → preferences-section-Cvh644K0.js} +1 -1
  25. package/web/dist/assets/{preview-pane-connected-B_DUnNJx.js → preview-pane-connected-B08ZdGux.js} +2 -2
  26. package/web/dist/assets/{project-location-0NYs0ZDN.js → project-location-DR8go8oL.js} +1 -1
  27. package/web/dist/assets/{projects-section-CQquy8jC.js → projects-section-XDboHBFP.js} +1 -1
  28. package/web/dist/assets/{prompt-templates-section-CbchtG9G.js → prompt-templates-section-DcxD28iA.js} +2 -2
  29. package/web/dist/assets/{remote-settings-notice-BosQQg8I.js → remote-settings-notice-Dtaa3ovl.js} +1 -1
  30. package/web/dist/assets/repo-git-Dp9R2TuI.js +1 -0
  31. package/web/dist/assets/{report-reader-DCpgZb3Q.js → report-reader-mbkd2DKt.js} +1 -1
  32. package/web/dist/assets/{reports-C7oXbx7H.js → reports-ya2OW-iR.js} +1 -1
  33. package/web/dist/assets/{resources-section-B7ikBubL.js → resources-section-g5XRlefz.js} +1 -1
  34. package/web/dist/assets/{review-notes-drafts-DrS7HBu8.js → review-notes-drafts-BdBvLP6E.js} +1 -1
  35. package/web/dist/assets/{review-panel-DocPb2sY.js → review-panel-Ba8yb8Fu.js} +1 -1
  36. package/web/dist/assets/{review-strip-BqnpW1n1.js → review-strip-CdlMeV2i.js} +1 -1
  37. package/web/dist/assets/{run-header-C_asFhAY.js → run-header-BTRXYB4W.js} +2 -2
  38. package/web/dist/assets/{select-DuuHVsVn.js → select-DdH25sWT.js} +1 -1
  39. package/web/dist/assets/{session-context-section-DecXXiZF.js → session-context-section-BqEdLdTv.js} +2 -2
  40. package/web/dist/assets/{settings-agent-picker-C4KKci2g.js → settings-agent-picker-b4M6fQ8m.js} +1 -1
  41. package/web/dist/assets/{settings-save-bar-Jp9UQXYS.js → settings-save-bar-DFY_Km4X.js} +1 -1
  42. package/web/dist/assets/{settings-shell-D_WnST_P.js → settings-shell-BUwdvhI9.js} +1 -1
  43. package/web/dist/assets/{sidebar-section-Dyw_hnnC.js → sidebar-section-CcucfASN.js} +1 -1
  44. package/web/dist/assets/{skills-C48utCzL.js → skills-BLkPhZO8.js} +1 -1
  45. package/web/dist/assets/{task-changes-CHMaGATC.js → task-changes-Drvnew5P.js} +2 -2
  46. package/web/dist/assets/{task-commits-BWBec83J.js → task-commits-1MJHuX1i.js} +1 -1
  47. package/web/dist/assets/{task-file-scope-bmyzqReq.js → task-file-scope-CB3L3KQl.js} +1 -1
  48. package/web/dist/assets/{task-files-BjSP_4uv.js → task-files-B9okW1TC.js} +1 -1
  49. package/web/dist/assets/{task-github-item-CFCxfzlu.js → task-github-item-CMNk7FxR.js} +1 -1
  50. package/web/dist/assets/{task-thread-C4aSbGAi.js → task-thread-_2ch8BRt.js} +2 -2
  51. package/web/dist/assets/{task-thread-C70CCqyd.css → task-thread-a6CXLxwn.css} +1 -1
  52. package/web/dist/assets/{thread-state-C1Pf77GN.js → thread-state-qNczqxZQ.js} +1 -1
  53. package/web/dist/assets/{use-finish-run-CqVI9_BW.js → use-finish-run-Dvm4JnAH.js} +1 -1
  54. package/web/dist/assets/{use-hand-to-agent-state-B0wW0kOx.js → use-hand-to-agent-state-CBJvP-US.js} +1 -1
  55. package/web/dist/assets/use-path-bases-C9yvZF5B.js +1 -0
  56. package/web/dist/assets/{workflows-B8CS-UWS.js → workflows-BUcx-n8J.js} +3 -3
  57. package/web/dist/assets/{workspace-tools-DA2Q9bj8.js → workspace-tools-dbiR1fzO.js} +1 -1
  58. package/web/dist/assets/{worktrees-section-BdZorHZ5.js → worktrees-section-Dyb_QkSd.js} +1 -1
  59. package/web/dist/index.html +2 -2
  60. package/web/dist/assets/discard-changes-dialog-BVKAatbp.js +0 -1
  61. package/web/dist/assets/index-CESQIsLq.css +0 -1
  62. package/web/dist/assets/index-CS4efF3Z.js +0 -21
  63. package/web/dist/assets/repo-git-DxWPoHJ9.js +0 -1
  64. package/web/dist/assets/use-path-bases-BZSjw1dB.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i}from"./dist-C_rn70hE.js";import{Gt as a,Kt as o,O as s,Ut as c,a as l,c as u,d,i as f,j as p,n as m,o as h,r as g,sn as _,un as v}from"./queries-CchoEEzj.js";import{G as y,J as b,Nn as x,R as S,Ti as C,Y as w,n as T,q as E,vi as D}from"./toaster-zMN8cNZQ.js";import{f as O,h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{c as te,i as k,t as ne}from"./reference-chip-z7dZJVH-.js";import{I as re,L as ie,Q as A,Z as j,ct as M,i as ae,l as N,m as P,r as oe,u as F,ut as se}from"./design-icons-QbNMZniQ.js";import{t as ce}from"./chevron-down-CHGyCDBH.js";import{t as le}from"./chevron-right-BENZ-1ZN.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./play-CmVAj_fu.js";import{t as L}from"./button-B22ANdCY.js";import{a as de,i as fe,n as pe,r as R,t as me}from"./select-DuuHVsVn.js";import{i as z,r as B,t as V}from"./popover-CvL6hQ5c.js";import{r as he,t as H}from"./project-router-j0uBi7Ep.js";import"./attention-DnxGjw_R.js";import{f as ge,v as _e}from"./task-groups-CGCnVqHE.js";import{t as ve}from"./status-dot-Drd4-nfa.js";import{c as U,d as W,f as ye,m as be}from"./page-shell-BgabWJ3w.js";import{a as xe,o as Se,r as Ce,s as we,t as Te}from"./command-B2Y0By1v.js";import{t as G}from"./centered-state-BgSV4e79.js";import{t as Ee}from"./use-search-params-writer-ClMScnNe.js";import{At as De,Ct as Oe,Dt as ke,Et as Ae,Ft as je,It as Me,Ln as Ne,Lt as Pe,Mt as K,Nt as Fe,Ot as Ie,Pt as Le,Rt as Re,Tt as ze,Vn as Be,ht as Ve,jt as He,kn as q,kt as Ue,qn as We,r as Ge,s as Ke,sr as qe,wt as Je,zt as Ye}from"./index-CS4efF3Z.js";import{t as Xe}from"./markdown-DkyIbV7h.js";import{a as Ze,c as Qe,f as $e,h as et,i as tt,l as nt,m as rt,n as it,o as at,p as J,r as ot,s as st,t as ct,u as lt}from"./use-hand-to-agent-state-B0wW0kOx.js";import{t as ut}from"./tab-link-BKlpD9sn.js";var Y=e(t(),1),X=n();function dt({number:e,repo:t}){let n=i();return(0,X.jsx)(ft,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function ft({number:e,repo:t,scope:n}){let i=(0,Y.useId)(),a=(0,Y.useId)(),[o,s]=(0,Y.useState)(!1),c=o?ce:le,l=_(n,!0,n==="default"),u=p(`#${e}`,!0),d=(0,Y.useMemo)(()=>je(_e(l.data??[],u.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[l.data,u.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,o?`p-3`:`p-0.5`),children:[(0,X.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,l.data?` (${d.length}${u.hasNextPage||u.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:a,children:o?(0,X.jsxs)(X.Fragment,{children:[l.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,l.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry linked tasks`})]}):null,l.data&&d.length===0&&!l.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,d.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:d.map(e=>{let t=Ne(e,x(e));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{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,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:ge(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ve,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(Ge,{"data-slot":`linked-task-archived`,dot:q.tone,shape:q.shape,className:`px-2 py-px`,children:q.label}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,u.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry older linked tasks`})]}):u.hasNextPage?(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void u.fetchNextPage(),disabled:u.isFetchingNextPage,children:u.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var pt=`w-44 max-w-full`,Z=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Q=`__all__`;function mt(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 ht(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function gt(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 _t(e){return[e.viewerLogin?``:`GitHub login unavailable.`,gt(e)].filter(Boolean).join(` `)}function vt({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`${Z} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.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,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function yt({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,X.jsxs)(me,{value:t||Q,onValueChange:e=>n(e===Q?``:e),children:[(0,X.jsx)(fe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${Z} ${pt} justify-between`,children:(0,X.jsx)(de,{placeholder:`All boards`})}),(0,X.jsxs)(pe,{align:`start`,children:[(0,X.jsx)(R,{value:Q,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(R,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,X.jsxs)(me,{disabled:!0,value:Q,children:[(0,X.jsx)(fe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${Z} ${pt} justify-between`,children:(0,X.jsx)(de,{placeholder:t,children:t})}),(0,X.jsx)(pe,{align:`start`,children:(0,X.jsx)(R,{value:Q,children:t})})]})}return null}function bt({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(V,{open:i,onOpenChange:a,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Z} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(M,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(B,{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 xt({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=mt(e.issues,t),f=ht(e.viewerLogin,t),p=_t(e),m=p!==``,h=(0,Y.useRef)(p);m&&(h.current=p);let g=(0,Y.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,Y.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,Y.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(vt,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${Z} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-accent-strong aria-pressed:bg-accent-strong aria-pressed:text-accent-strong-foreground aria-pressed:hover:bg-accent-strong`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,X.jsx)(se,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,X.jsx)(yt,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(bt,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function St({onRefresh:e,refreshing:t}){let n=Oe(i());return(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,X.jsx)(U,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,X.jsx)(j,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,X.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,X.jsx)(Je,{model:n,variant:`screen`})})})}function Ct({view:e,activeFilter:t,isDesktop:n,listInUrl:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?ze[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,X.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,X.jsx)(Be,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,X.jsx)(wt,{...o}),headerExtra:r&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{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,X.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Ie,...Ue].find(e=>e.id===t)?.label})]}):void 0}}function wt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,X.jsx)(U,{variant:`outline`,asChild:!0,children:(0,X.jsx)(H,{to:`/automations/new`,children:`Set up automations`})}):null,(0,X.jsxs)(U,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,X.jsx)(j,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Tt({view:e,number:t}){return(0,X.jsx)(G,{icon:e===`issues`?(0,X.jsx)(P,{size:16}):(0,X.jsx)(re,{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`}. Go back to the list and search for ${t} to look it up on GitHub, closed and merged included.`})}var Et=/^(\[[^\]\n]{1,24}\]:?)\s+(\S.*)$/s;function Dt(e){let t=Et.exec(e);return t?{prefix:t[1],rest:t[2]}:{prefix:null,rest:e}}function Ot(e,t){if(!t)return e.kind===`issue`?`open`:e.isDraft?`draft`:void 0}function kt(e){let t=e.reduce((e,t)=>Math.max(e,String(t.number).length),1);return Math.ceil(28+(t+1)*7.2)}var At=2;function jt({item:e,view:t,filter:n,narrows:i,colors:s,expanded:l,onToggle:u,queuedRunId:d,checks:f,comments:p,status:m,task:h,referenceWidth:g}){let _=D(),v=`gh-row-summary-${e.kind}-${e.number}`,y=e.kind===`pr`?`PR`:`Issue`,x=te(y,e.number),S=(y===`PR`&&x.conflicting===!0?a:o(m??x.status))?.label,C=Dt(e.title),w=()=>{_.prefetchQuery({queryKey:c.githubComments(e.kind,e.number),queryFn:({signal:t})=>b(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(`div`,{"data-slot":`gh-row-shell`,"data-expanded":l||void 0,style:{"--gh-ref-width":`${g}px`},className:r(`@container rounded-md`,l&&`bg-sidebar-row-selected`),children:[(0,X.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,ot(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:w,onFocus:w,onClick:u,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-expanded":l,"aria-controls":l?v:void 0,title:`Drag into the composer to prefill a task`,className:`grid w-full grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 @4xl:grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto_auto]`,children:[(0,X.jsxs)(`span`,{"data-slot":`gh-row-ref`,title:S,className:`flex h-[18px] items-center`,children:[(0,X.jsx)(ne,{reference:{kind:y,number:e.number},taskTitle:e.title,status:m,compact:!0,inert:!0}),S?(0,X.jsx)(`span`,{className:`sr-only`,children:S}):null]}),(0,X.jsxs)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium text-foreground [overflow-wrap:anywhere] @4xl:line-clamp-none`,l&&`font-semibold`),children:[C.prefix?(0,X.jsxs)(`span`,{"data-slot":`gh-row-title-prefix`,className:`font-normal text-soft-foreground`,children:[C.prefix,` `]}):null,C.rest]}),(0,X.jsx)(F,{"data-slot":`gh-row-cue`,"aria-hidden":`true`,className:r(`col-start-3 row-start-1 mt-px size-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none @4xl:col-start-4`,l&&`rotate-180`)}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap gap-1 @4xl:col-end-3`,children:e.labels.map(e=>(0,X.jsx)(lt,{label:e,color:s[e],className:`max-w-full truncate`},e))}):null,(0,X.jsx)(Mt,{item:e,view:t,task:h,queuedRunId:d,checks:f,comments:p})]}),l?(0,X.jsx)(Pt,{id:v,item:e,checks:f,detailPath:He(t,n,e.number,``,i),queuedRunId:d}):null]})}function Mt({item:e,view:t,task:n,queuedRunId:r,checks:i,comments:a}){let o=e.assignees??[];return(0,X.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground @4xl:col-start-3 @4xl:col-end-4 @4xl:row-start-1 @4xl:h-[18px] @4xl:flex-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-row-task`,className:$.task,children:n?(0,X.jsx)(Ge,{dot:n.status.tone,shape:n.status.shape,pulse:n.status.pulse,title:`Newest task: ${n.status.label}`,className:`max-w-full py-0.5`,children:(0,X.jsx)(`span`,{className:`truncate`,children:n.status.label})}):r?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`}):null}),(0,X.jsx)(`span`,{"data-slot":`gh-row-assignees`,className:$.assignees,children:o.length>0?(0,X.jsx)(Nt,{logins:o}):null}),t===`prs`?(0,X.jsx)(`span`,{"data-slot":`gh-row-checks-slot`,className:$.checks,children:i?(0,X.jsx)(at,{checks:i}):null}):null,(0,X.jsx)(`span`,{"data-slot":`gh-row-comments`,className:$.comments,children:a?(0,X.jsx)(st,{count:a}):null}),(0,X.jsx)(Be,{iso:e.createdAt,className:`shrink-0 @4xl:w-9 @4xl:text-right`})]})}var $={task:`flex min-w-0 max-w-full empty:hidden @4xl:w-44 @4xl:empty:block`,assignees:`flex shrink-0 items-center empty:hidden @4xl:w-12 @4xl:justify-center @4xl:empty:block`,checks:`flex shrink-0 empty:hidden @4xl:w-4 @4xl:justify-center @4xl:empty:block`,comments:`flex shrink-0 empty:hidden @4xl:w-10 @4xl:empty:block`};function Nt({logins:e}){let t=e.join(`, `);return(0,X.jsxs)(`span`,{title:`Assigned to ${t}`,className:`flex items-center -space-x-1`,children:[e.slice(0,At).map(e=>(0,X.jsx)(tt,{login:e},e)),e.length>At?(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`pl-2 tabular-nums`,children:[`+`,e.length-At]}):null,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Assigned to `,t]})]})}function Pt({id:e,item:t,checks:n,detailPath:r,queuedRunId:i}){let a=f(t.kind,t.number),o=(a.data?.detail?.body??t.body)?.trim(),s=t.kind===`pr`?`PR`:`issue`;return(0,X.jsxs)(`div`,{id:e,"data-slot":`gh-row-summary`,className:`flex flex-col gap-3 px-3 pb-4 @4xl:pl-[calc(var(--gh-ref-width)+1.5rem)]`,children:[(0,X.jsx)(`div`,{"data-slot":`gh-row-body`,className:`text-[13px] leading-relaxed text-soft-foreground`,children:o?(0,X.jsx)(`div`,{"data-slot":`gh-row-excerpt`,inert:!0,className:Ft,children:(0,X.jsx)(Xe,{document:!0,children:o})}):a.isPending?(0,X.jsx)(qe,{className:`h-4 w-2/3`}):a.isError||a.data?.available===!1?(0,X.jsx)(`p`,{"data-slot":`gh-row-body-unavailable`,className:`text-muted-foreground`,children:`Description unavailable. Use Refresh to try again.`}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,X.jsxs)(`div`,{"data-slot":`gh-row-facts`,className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Opened by `,(0,X.jsx)(`span`,{"data-slot":`gh-row-author`,className:`font-medium`,children:t.author})]}),n?(0,X.jsx)(Ze,{checks:n,url:t.url}):null]}),(0,X.jsxs)(`div`,{"data-slot":`gh-row-actions`,className:`flex flex-wrap items-center gap-2`,children:[i?(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:`/tasks/${i}`,"data-action":`gh-row-view-task`,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsx)(L,{asChild:!0,variant:`primary`,size:`sm`,children:(0,X.jsxs)(H,{to:r,state:{focusHandoff:!0},"data-action":`gh-row-handoff`,title:`Open this ${s} and write the prompt for an agent`,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}),(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:r,"data-action":`gh-row-open`,children:[`Open `,s,(0,X.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3.5`})]})})]})]})}var Ft=r(`max-h-[calc(3lh)] overflow-hidden [overflow-wrap:anywhere]`,`[&_*]:!my-0 [&_p+*]:!mt-1 [&_ul]:list-inside [&_ol]:list-inside`,`[&_:is(h1,h2,h3,h4,h5,h6,pre,img,table,hr,[data-streamdown="code-block"],[data-streamdown="table-wrapper"],[data-streamdown="image-wrapper"],[data-streamdown="mermaid-block"])]:hidden`);function It(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Lt(e){let[t,n]=(0,Y.useState)(null);return(0,Y.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(It(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 Rt(e,t){let[n,r]=(0,Y.useState)(0);return(0,Y.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 zt(e,t,n){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(n);return(0,Y.useEffect)(()=>{a.current=n}),(0,Y.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 Bt(e,t,n,r,i){let[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=Lt(a),u=(0,Y.useRef)(null);u.current=l;let d=Rt(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:zt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function Vt({item:e,queuedRunId:t}){return t?(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsxs)(L,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,onClick:Ht,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function Ht(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var Ut=100;function Wt(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>=Ut)break;a.add(t.number)}return[...a]}function Gt(e,t,n,r,i,a){let o=Wt(n,e,r,i,a),s=m(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=g(e===`issues`?`issue`:`pr`,(0,Y.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,Y.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 Kt(e){let t=i(),n=_(t,!0,t==="default").data,r=(0,Y.useMemo)(()=>n?Me(n,e,t):null,[n,e,t]);return(0,Y.useCallback)(e=>{let t=e.kind===`issue`?r?.get(e.number):void 0;return t?{runId:t.id,status:Ne(t)}:null},[r])}function qt(e){let[t,n]=Ee(),r=t.get(`filter`),i=Pe(e,r),a=i??`all`,o=e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n}),s=K(t);return{rawFilterParam:r,filter:i,activeFilter:a,setFilterParam:o,narrows:s,url:(0,Y.useMemo)(()=>{let t=new URLSearchParams(s);return{query:t.get(`q`)??``,labels:t.getAll(`label`),assignees:e===`issues`?t.getAll(`assignee`):[],board:e===`issues`?t.get(`board`)??``:``}},[s,e]),writeNarrows:(0,Y.useCallback)(e=>n(t=>{let n=e(t);return(t.has(`filter`)||K(t)!==``)&&!n.has(`filter`)&&K(n)===``&&n.set(`filter`,`all`),n}),[n])}}function Jt(e,t){return n=>{let r=new URLSearchParams(n);r.delete(e);for(let n of t)r.append(e,n);return r}}function Yt(e,t,{rawFilterParam:n,filter:r,activeFilter:i,setFilterParam:a,narrows:o,url:s,writeNarrows:c}){let l=Zt(s.query,n!==null||o!==``,c),{query:u,setQuery:d}=l,f=s.labels,p=s.assignees,m=e=>c(Jt(`label`,e)),{setProjectFilter:h,activeProject:g}=Qt(t,s.board,c),_=e===`issues`&&i===`assigned`,v=_?t?.viewerLogin?[t.viewerLogin]:[]:p;return{query:u,setQuery:d,labelFilter:f,setLabelFilter:m,setProjectFilter:h,activeProject:g,isAssignedFilter:_,effectiveAssignees:v,changeAssignees:e=>{c(Jt(`assignee`,e)),_&&a(`all`)},clearFilters:()=>{l.clear(),c(e=>{let t=new URLSearchParams(e);for(let e of ke)t.delete(e);return r!==null&&r!==`all`&&t.set(`filter`,`all`),t})},filtering:u.trim()!==``||f.length>0||e===`issues`&&(v.length>0||g!==``)||r!==null&&r!==`all`,narrowing:u.trim()!==``||f.length>0||e===`issues`&&(!_&&p.length>0||g!==``)}}var Xt=250;function Zt(e,t,n){let r=`${O().pathname}${t?``:`#entry`}`,[i,a]=(0,Y.useState)(e),o=(0,Y.useRef)(e),s=(0,Y.useRef)(void 0),c=(0,Y.useRef)(r);return(0,Y.useEffect)(()=>{e===o.current&&r===c.current||(clearTimeout(s.current),c.current=r,o.current=e,a(e))},[e,r]),(0,Y.useEffect)(()=>()=>clearTimeout(s.current),[]),{query:i,setQuery:e=>{a(e),clearTimeout(s.current),s.current=setTimeout(()=>{let t=e.trim();o.current=t,n(e=>{let n=new URLSearchParams(e);return t===``?n.delete(`q`):n.set(`q`,t),n})},Xt)},clear:()=>{clearTimeout(s.current),o.current=``,a(``)}}}function Qt(e,t,n){let r=e=>n(t=>{let n=new URLSearchParams(t);return e===``?n.delete(`board`):n.set(`board`,e),n}),i=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,a=i||e?.projects?.some(e=>e.id===t)===!0,o=e?.available===!0&&!i&&t!==``&&!a,[s,c]=(0,Y.useState)(``);s!==``&&s!==t&&c(``),o&&s!==t&&c(t);let l=o||s!==``&&s===t,u=a&&!l?t:``;return(0,Y.useEffect)(()=>{l&&n(e=>{let t=new URLSearchParams(e);return t.delete(`board`),t})},[l,n]),{setProjectFilter:r,activeProject:u}}function $t(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,Y.useMemo)(()=>c.data?Le(c.data,t?.repo,o):null,[c.data,t?.repo,o]),d=Fe(e,n)?Ye(n):null,f=u(`pr`,d??``,d!==null&&t?.available===!0),p=d!==null&&f.data?.available?f.data.items:null,m=(0,Y.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),h=(0,Y.useMemo)(()=>p?Re(p,m):null,[p,m]),g=en({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:d,filterHits:p,filterSearch:f});return{backedQuery:d,filterSearch:f,fullList:m,filterRows:h,filterGate:g,openItems:(0,Y.useMemo)(()=>g?[]:h??m,[g,h,m]),narrow:(0,Y.useMemo)(()=>e===`issues`?r===`no-task`&&l?{excludeNumbers:l}:r===`has-task`&&l?{includeNumbers:l}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:p?{includeNumbers:new Set(p.map(e=>e.number))}:{},[e,r,l,t?.viewerLogin,p])}}function en({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 tn(e,t){return t?w(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function nn(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=c.github()[0],s=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,u=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,d=l??u,[f,p]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{d&&p({scope:o,view:e,item:d})},[o,e,d]),{selectedNumber:s,remoteDetail:d??(f?.scope===o&&f.view===e&&f.item.number===s?f.item:null)}}function rn(e,t,n,{fullList:r,filterRows:i},a){let o=D(),s=(0,Y.useRef)(null),u=e===`issues`?`issue`:`pr`,d=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,f=l(u,n??0,d),p=d&&f.data?.available&&f.data.item?.kind===u?f.data.item:null;s.current=d&&n!==null?{kind:u,number:n,key:c.githubItem(u,n)}:null;let[m,h]=(0,Y.useState)(!1);return{exactWanted:d,exactItem:f,exactDetail:p,exactTargetRef:s,retryingExact:m,retryExact:()=>{h(!0),tn(o,s.current).then(e=>{h(!1),e||T(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function an(e,t,n){let r=D(),i=(0,Y.useRef)(null);return{refresh:v({mutationFn:e=>(tn(r,e),y({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:c.githubPages(50),exact:!0}),r.setQueryData(c.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:c.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=c.githubCommentCounts(o,s);r.removeQueries({queryKey:c.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==C(l)}),a.available&&a.commentsDeferred&&s.length>0&&E(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:c.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:c.githubSearch(`pr`,De)}),r.invalidateQueries({queryKey:c.githubSearch(`pr`,Ae)});let u=i.current,d=c.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=c.githubComments(u.kind,u.number);b(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==C(f)})},onError:e=>T(e.message,{tone:`danger`})}),openThreadRef:i}}var on=350;function sn(e,t){let[n,r]=(0,Y.useState)(e);return(0,Y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function cn(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=sn(n,on),d=(0,Y.useMemo)(()=>J(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),f=n.trim()===l.trim(),p=t?.available===!0&&!c&&f&&et(l,d),m=u(e===`issues`?`issue`:`pr`,l,p),h=J(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=ln(e,g,a,i);return{debouncedQuery:l,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?J(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...un(n,f,p,m)}}function ln(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 un(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 dn({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=qt(e),{rawFilterParam:a,activeFilter:o,narrows:c}=i,l=a!==null||c!==``,u=be(),{pages:d,data:f}=h(50),p=We(),m=pn(),g=ct(),_=fn({index:n,isDesktop:u,listInUrl:l,n:r,rememberedView:s().data?.githubView}),[v,y]=(0,Y.useState)(null),b=Yt(e,f,i),x=$t(e,f,i,b.isAssignedFilter),S=cn(e,f,b,x),C=nn(e,r,S.forgeSearch,x),w=rn(e,f,C.selectedNumber,x,C.remoteDetail),T=Gt(e,d,f,C.selectedNumber,S.searchHits,x.openItems),{refresh:E,openThreadRef:D}=an(e,T.checkPrNumbers,S.debouncedQuery),O=Bt(e,d,f,x.backedQuery,b.narrowing),te=Kt(f?.available?f.repo:void 0);if(_.restorePrs)return(0,X.jsx)(he,{to:`/github/prs`,replace:!0});if(!f)return d.isError?(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(M,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:d.error.message})}):(0,X.jsx)(Ve,{});D.current=null;let k=()=>E.mutate(w.exactTargetRef.current);if(_.filterScreen&&f.available)return(0,X.jsx)(St,{onRefresh:k,refreshing:E.isPending});if(!f.available)return(0,X.jsx)(vn,{reason:f.reason,refreshing:E.isPending,onRetry:k});let{labelColors:ne,labelOptions:re}=mn(f,S.searchPayload,x.openItems,x.fullList),ie=hn({number:C.selectedNumber,fullList:x.fullList,filterRows:x.filterRows,remoteDetail:C.remoteDetail,exactDetail:w.exactDetail}),A=r===void 0?[...S.items,...S.searchHits].find(e=>e.url===v)??null:null,j=ie??A;D.current=j?{kind:j.kind,number:j.number}:null;let{linkFilter:ae,listPath:N}=gn(e,a,o,u,c),P={view:e,filter:ae,narrows:c,colors:ne,expandedUrl:A?.url??null,onToggle:e=>y(t=>t===e.url?null:e.url),queued:g.queued,checksMap:T.checksMap,commentsOf:T.commentsOf,taskOf:te,referenceWidth:kt([...S.items,...S.searchHits])},oe=_n(e,b,x.filterGate,S),F=Ct({view:e,activeFilter:o,isDesktop:u,listInUrl:l,n:r,gh:f,actions:{automationsAvailable:p,refreshing:E.isPending,onRefresh:k}});return r===void 0?(0,X.jsxs)(W,{route:`github`,density:ye(S.items.length+S.searchHits.length),headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:F,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,X.jsx)(yn,{view:e,isDesktop:u,gh:f,onSaveView:m}),(0,X.jsx)(bn,{view:e,gh:f,filters:b,labelOptions:re,labelColors:ne,searchPayload:S.searchPayload})]}),(0,X.jsx)(Cn,{view:e,rows:P,verdict:oe,search:S,sidebar:x,list:d,paging:O})]}):(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,header:F,children:(0,X.jsx)(On,{view:e,selected:ie,selectedNumber:C.selectedNumber,exact:w,repo:f.repo,rows:P,listPath:N,changes:t,handToAgent:g})})}function fn({index:e,isDesktop:t,listInUrl:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&!n&&r===void 0,restorePrs:e&&t&&!n&&i===`prs`}}function pn(){let e=D();return t=>{e.setQueryData(c.uiState,e=>({...e,githubView:t})),S({githubView:t}).then(t=>e.setQueryData(c.uiState,t)).catch(t=>{T(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:c.uiState})})}}function mn(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:$e([...n,...r,...t?.items??[]])}}function hn({number:e,fullList:t,filterRows:n,remoteDetail:r,exactDetail:i}){return e===null?null:t.find(t=>t.number===e)??n?.find(t=>t.number===e)??r??i??null}function gn(e,t,n,r,i){let a=t===null?null:n;return{linkFilter:a,listPath:He(e,a??(e===`issues`&&!r?`all`:null),void 0,``,i)}}function _n(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,X.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,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function vn({reason:e,refreshing:t,onRetry:n}){return(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(ie,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(L,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function yn({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(ut,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(ut,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function bn({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,X.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-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(jn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(xt,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function xn(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Sn(e,t,n=!1){return(0,X.jsx)(jt,{item:e,view:t.view,filter:t.filter,narrows:t.narrows,colors:t.colors,expanded:t.expandedUrl===e.url,onToggle:()=>t.onToggle(e),queuedRunId:t.queued.get(e.url)??null,checks:xn(e,t.checksMap),comments:t.commentsOf(e),status:Ot(e,n),task:t.taskOf(e),referenceWidth:t.referenceWidth})}function Cn({view:e,rows:t,verdict:n,search:r,sidebar:i,list:a,paging:o}){let{items:s,searchHits:c}=r;return(0,X.jsxs)(`section`,{ref:o.setListEl,"data-slot":`gh-list`,className:`relative flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3`,children:[s.length===0?n&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):(0,X.jsx)(wn,{items:s,rows:t,paging:o}),o.pagingAvailable?(0,X.jsx)(Tn,{view:e,list:a,paging:o}):null,(0,X.jsx)(En,{backedQuery:i.backedQuery,filterSearch:i.filterSearch}),s.length>0&&r.searchWanted&&n?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):null,c.length>0?(0,X.jsx)(Dn,{hits:c,searchPayload:r.searchPayload,rows:t}):null]})}function wn({items:e,rows:t,paging:n}){let{setRowsEl:r,scrollOwner:i,listEl:a,scrollOwnerRef:o,startMargin:s}=n,c=(0,Y.useRef)(null),l=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(l.current||!i)return;l.current=!0;let n=e.findIndex(e=>e.url===t.expandedUrl);n>=0&&c.current?.scrollToIndex(n,{align:`start`})},[i,e,t.expandedUrl]);let u=e.map((e,n)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":n>0||void 0,children:Sn(e,t)},e.url));return(0,X.jsx)(`div`,{ref:r,"data-slot":`gh-rows`,"data-virtualized":i?`true`:void 0,role:`list`,children:i?(0,X.jsx)(Ke,{ref:c,scrollRef:o,startMargin:s,children:u},i===a?`list`:`main`):u})}function Tn({view:e,list:t,paging:n}){return(0,X.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-muted-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.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,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.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 En({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function Dn({hits:e,searchPayload:t,rows:n}){let r=(0,Y.useRef)(null),i=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{i.current||(i.current=!0,(r.current?.querySelector(`[data-slot="gh-row"][aria-expanded="true"]`))?.scrollIntoView({block:`start`}))},[]);let a=d();return(0,X.jsx)(k,{projectId:a,requests:a?e.map(e=>({projectId:a,kind:e.kind===`pr`?`PR`:`Issue`,number:e.number})):[],children:(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{ref:r,className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Sn(e,n,!0)},e.url))})]})})}function On({view:e,selected:t,selectedNumber:n,exact:r,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}){let{exactWanted:l,exactItem:u}=r;return(0,X.jsxs)(`section`,{"data-slot":`gh-detail`,className:`flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card`,children:[t?null:(0,X.jsx)(`div`,{className:`px-4 pt-4 md:px-7 md:pt-5`,children:(0,X.jsx)(Qe,{backLink:{to:o}})}),t?(0,X.jsx)(kn,{item:t,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}):l&&u.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex flex-1 flex-col`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${n}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):l&&(u.isError||u.data?.available===!1)?(0,X.jsx)(An,{number:n,exact:r}):(0,X.jsx)(Tt,{view:e,number:n})]})}function kn({item:e,repo:t,rows:n,listPath:r,changes:i,handToAgent:a}){let{workflows:o,skillList:s,workflow:c,setWorkflow:l,selectedSkills:u,setSelectedSkills:d,engine:f,setEngine:p,queued:m,onQueued:h}=a,g=O().state?.focusHandoff===!0;return(0,Y.useEffect)(()=>{g&&Ht()},[g,e.url]),(0,X.jsx)(nt,{item:e,comments:n.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(dt,{number:e.number,repo:t},e.url):void 0,backLink:{to:r},subNav:{filter:n.filter,narrows:n.narrows,changes:i},onRunAgent:Ht,headerAction:(0,X.jsx)(Vt,{item:e,queuedRunId:m.get(e.url)??null}),colors:n.colors,checks:xn(e,n.checksMap),children:(0,X.jsx)(it,{item:e,workflows:o.data?.workflows??[],skills:s,workflow:c,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m.get(e.url)??null,onQueued:h},e.url)})}function An({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,X.jsx)(G,{icon:(0,X.jsx)(M,{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,X.jsx)(L,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function jn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Y.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(V,{open:a,onOpenChange:o,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(Te,{children:[(0,X.jsx)(xe,{placeholder:`Filter labels…`}),(0,X.jsxs)(we,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(Ce,{children:`No labels.`}),n.length>0?(0,X.jsxs)(Se,{value:`__clear__`,onSelect:()=>i([]),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,X.jsxs)(Se,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`gh-label-dot`,className:`size-2.5 shrink-0 rounded-full ring-1 ring-foreground/30`,style:rt(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{dn as GithubRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,p as i}from"./dist-C_rn70hE.js";import{Gt as a,Kt as o,O as s,Ut as c,a as l,c as u,d,i as f,j as p,n as m,o as h,r as g,sn as _,un as v}from"./queries-CchoEEzj.js";import{G as y,J as b,Nn as x,R as S,Ti as C,Y as w,n as T,q as E,vi as D}from"./toaster-zMN8cNZQ.js";import{f as O,h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{c as te,i as k,t as ne}from"./reference-chip-z7dZJVH-.js";import{I as re,L as ie,Q as A,Z as j,ct as M,i as ae,l as N,m as P,r as oe,u as F,ut as se}from"./design-icons-QbNMZniQ.js";import{t as ce}from"./chevron-down-CHGyCDBH.js";import{t as le}from"./chevron-right-BENZ-1ZN.js";import{t as I}from"./loader-circle-CPBhhDbB.js";import{t as ue}from"./play-CmVAj_fu.js";import{t as L}from"./button-B22ANdCY.js";import{a as de,i as fe,n as pe,r as R,t as me}from"./select-DdH25sWT.js";import{i as z,r as B,t as V}from"./popover-CvL6hQ5c.js";import{r as he,t as H}from"./project-router-j0uBi7Ep.js";import"./attention-DnxGjw_R.js";import{f as ge,v as _e}from"./task-groups-CGCnVqHE.js";import{t as ve}from"./status-dot-Drd4-nfa.js";import{c as U,d as W,f as ye,m as be}from"./page-shell-BgabWJ3w.js";import{a as xe,o as Se,r as Ce,s as we,t as Te}from"./command-B2Y0By1v.js";import{t as G}from"./centered-state-BgSV4e79.js";import{t as Ee}from"./use-search-params-writer-ClMScnNe.js";import{An as K,At as De,Bt as Oe,Dt as ke,Et as Ae,Ft as je,Hn as Me,It as Ne,Jn as Pe,Lt as Fe,Mt as Ie,Nt as q,Ot as Le,Pt as Re,Rn as ze,Rt as Be,Tt as Ve,cr as He,gt as Ue,jt as We,kt as Ge,r as Ke,s as qe,wt as Je,zt as Ye}from"./index-DJB0lid-.js";import{t as Xe}from"./markdown-BAPhDASs.js";import{a as Ze,c as Qe,f as $e,h as et,i as tt,l as nt,m as rt,n as it,o as at,p as J,r as ot,s as st,t as ct,u as lt}from"./use-hand-to-agent-state-CBJvP-US.js";import{t as ut}from"./tab-link-BKlpD9sn.js";var Y=e(t(),1),X=n();function dt({number:e,repo:t}){let n=i();return(0,X.jsx)(ft,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function ft({number:e,repo:t,scope:n}){let i=(0,Y.useId)(),a=(0,Y.useId)(),[o,s]=(0,Y.useState)(!1),c=o?ce:le,l=_(n,!0,n==="default"),u=p(`#${e}`,!0),d=(0,Y.useMemo)(()=>Ne(_e(l.data??[],u.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[l.data,u.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,o?`p-3`:`p-0.5`),children:[(0,X.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,l.data?` (${d.length}${u.hasNextPage||u.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:a,children:o?(0,X.jsxs)(X.Fragment,{children:[l.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,l.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void l.refetch(),disabled:l.isFetching,children:`Retry linked tasks`})]}):null,l.data&&d.length===0&&!l.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,d.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:d.map(e=>{let t=ze(e,x(e));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{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,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:ge(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ve,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(Ke,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,u.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry older linked tasks`})]}):u.hasNextPage?(0,X.jsx)(L,{variant:`outline`,className:`mt-2`,onClick:()=>void u.fetchNextPage(),disabled:u.isFetchingNextPage,children:u.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var pt=`w-44 max-w-full`,Z=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Q=`__all__`;function mt(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 ht(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function gt(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 _t(e){return[e.viewerLogin?``:`GitHub login unavailable.`,gt(e)].filter(Boolean).join(` `)}function vt({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`${Z} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.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,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function yt({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,X.jsxs)(me,{value:t||Q,onValueChange:e=>n(e===Q?``:e),children:[(0,X.jsx)(fe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${Z} ${pt} justify-between`,children:(0,X.jsx)(de,{placeholder:`All boards`})}),(0,X.jsxs)(pe,{align:`start`,children:[(0,X.jsx)(R,{value:Q,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(R,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,X.jsxs)(me,{disabled:!0,value:Q,children:[(0,X.jsx)(fe,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${Z} ${pt} justify-between`,children:(0,X.jsx)(de,{placeholder:t,children:t})}),(0,X.jsx)(pe,{align:`start`,children:(0,X.jsx)(R,{value:Q,children:t})})]})}return null}function bt({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(V,{open:i,onOpenChange:a,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Z} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(M,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(B,{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 xt({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=mt(e.issues,t),f=ht(e.viewerLogin,t),p=_t(e),m=p!==``,h=(0,Y.useRef)(p);m&&(h.current=p);let g=(0,Y.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,Y.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,Y.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(vt,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${Z} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-accent-strong aria-pressed:bg-accent-strong aria-pressed:text-accent-strong-foreground aria-pressed:hover:bg-accent-strong`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,X.jsx)(se,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,X.jsx)(yt,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(bt,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function St({onRefresh:e,refreshing:t}){let n=Je(i());return(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,X.jsx)(U,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,X.jsx)(j,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,X.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,X.jsx)(Ve,{model:n,variant:`screen`})})})}function Ct({view:e,activeFilter:t,isDesktop:n,listInUrl:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Ae[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,X.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,X.jsx)(Me,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,X.jsx)(wt,{...o}),headerExtra:r&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{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,X.jsx)(oe,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Ge,...De].find(e=>e.id===t)?.label})]}):void 0}}function wt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,X.jsx)(U,{variant:`outline`,asChild:!0,children:(0,X.jsx)(H,{to:`/automations/new`,children:`Set up automations`})}):null,(0,X.jsxs)(U,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,X.jsx)(j,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Tt({view:e,number:t}){return(0,X.jsx)(G,{icon:e===`issues`?(0,X.jsx)(P,{size:16}):(0,X.jsx)(re,{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`}. Go back to the list and search for ${t} to look it up on GitHub, closed and merged included.`})}var Et=/^(\[[^\]\n]{1,24}\]:?)\s+(\S.*)$/s;function Dt(e){let t=Et.exec(e);return t?{prefix:t[1],rest:t[2]}:{prefix:null,rest:e}}function Ot(e,t){if(!t)return e.kind===`issue`?`open`:e.isDraft?`draft`:void 0}function kt(e){let t=e.reduce((e,t)=>Math.max(e,String(t.number).length),1);return Math.ceil(28+(t+1)*7.2)}var At=2;function jt({item:e,view:t,filter:n,narrows:i,colors:s,expanded:l,onToggle:u,queuedRunId:d,checks:f,comments:p,status:m,task:h,referenceWidth:g}){let _=D(),v=`gh-row-summary-${e.kind}-${e.number}`,y=e.kind===`pr`?`PR`:`Issue`,x=te(y,e.number),S=(y===`PR`&&x.conflicting===!0?a:o(m??x.status))?.label,C=Dt(e.title),w=()=>{_.prefetchQuery({queryKey:c.githubComments(e.kind,e.number),queryFn:({signal:t})=>b(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(`div`,{"data-slot":`gh-row-shell`,"data-expanded":l||void 0,style:{"--gh-ref-width":`${g}px`},className:r(`@container rounded-md`,l&&`bg-sidebar-row-selected`),children:[(0,X.jsxs)(`button`,{type:`button`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,ot(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:w,onFocus:w,onClick:u,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-expanded":l,"aria-controls":l?v:void 0,title:`Drag into the composer to prefill a task`,className:`grid w-full grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto] items-start gap-x-3 gap-y-1.5 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 @4xl:grid-cols-[var(--gh-ref-width)_minmax(0,1fr)_auto_auto]`,children:[(0,X.jsxs)(`span`,{"data-slot":`gh-row-ref`,title:S,className:`flex h-[18px] items-center`,children:[(0,X.jsx)(ne,{reference:{kind:y,number:e.number},taskTitle:e.title,status:m,compact:!0,inert:!0}),S?(0,X.jsx)(`span`,{className:`sr-only`,children:S}):null]}),(0,X.jsxs)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 text-[13px] leading-[18px] font-medium text-foreground [overflow-wrap:anywhere] @4xl:line-clamp-none`,l&&`font-semibold`),children:[C.prefix?(0,X.jsxs)(`span`,{"data-slot":`gh-row-title-prefix`,className:`font-normal text-soft-foreground`,children:[C.prefix,` `]}):null,C.rest]}),(0,X.jsx)(F,{"data-slot":`gh-row-cue`,"aria-hidden":`true`,className:r(`col-start-3 row-start-1 mt-px size-4 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none @4xl:col-start-4`,l&&`rotate-180`)}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap gap-1 @4xl:col-end-3`,children:e.labels.map(e=>(0,X.jsx)(lt,{label:e,color:s[e],className:`max-w-full truncate`},e))}):null,(0,X.jsx)(Mt,{item:e,view:t,task:h,queuedRunId:d,checks:f,comments:p})]}),l?(0,X.jsx)(Pt,{id:v,item:e,checks:f,detailPath:Ie(t,n,e.number,``,i),queuedRunId:d}):null]})}function Mt({item:e,view:t,task:n,queuedRunId:r,checks:i,comments:a}){let o=e.assignees??[];return(0,X.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`col-start-2 col-end-4 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground @4xl:col-start-3 @4xl:col-end-4 @4xl:row-start-1 @4xl:h-[18px] @4xl:flex-nowrap`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-row-task`,className:$.task,children:n?(0,X.jsx)(Ke,{dot:n.status.tone,shape:n.status.shape,pulse:n.status.pulse,title:`Newest task: ${n.status.label}`,className:`max-w-full py-0.5`,children:(0,X.jsx)(`span`,{className:`truncate`,children:n.status.label})}):r?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`}):null}),(0,X.jsx)(`span`,{"data-slot":`gh-row-assignees`,className:$.assignees,children:o.length>0?(0,X.jsx)(Nt,{logins:o}):null}),t===`prs`?(0,X.jsx)(`span`,{"data-slot":`gh-row-checks-slot`,className:$.checks,children:i?(0,X.jsx)(at,{checks:i}):null}):null,(0,X.jsx)(`span`,{"data-slot":`gh-row-comments`,className:$.comments,children:a?(0,X.jsx)(st,{count:a}):null}),(0,X.jsx)(Me,{iso:e.createdAt,className:`shrink-0 @4xl:w-9 @4xl:text-right`})]})}var $={task:`flex min-w-0 max-w-full empty:hidden @4xl:w-44 @4xl:empty:block`,assignees:`flex shrink-0 items-center empty:hidden @4xl:w-12 @4xl:justify-center @4xl:empty:block`,checks:`flex shrink-0 empty:hidden @4xl:w-4 @4xl:justify-center @4xl:empty:block`,comments:`flex shrink-0 empty:hidden @4xl:w-10 @4xl:empty:block`};function Nt({logins:e}){let t=e.join(`, `);return(0,X.jsxs)(`span`,{title:`Assigned to ${t}`,className:`flex items-center -space-x-1`,children:[e.slice(0,At).map(e=>(0,X.jsx)(tt,{login:e},e)),e.length>At?(0,X.jsxs)(`span`,{"aria-hidden":`true`,className:`pl-2 tabular-nums`,children:[`+`,e.length-At]}):null,(0,X.jsxs)(`span`,{className:`sr-only`,children:[`Assigned to `,t]})]})}function Pt({id:e,item:t,checks:n,detailPath:r,queuedRunId:i}){let a=f(t.kind,t.number),o=(a.data?.detail?.body??t.body)?.trim(),s=t.kind===`pr`?`PR`:`issue`;return(0,X.jsxs)(`div`,{id:e,"data-slot":`gh-row-summary`,className:`flex flex-col gap-3 px-3 pb-4 @4xl:pl-[calc(var(--gh-ref-width)+1.5rem)]`,children:[(0,X.jsx)(`div`,{"data-slot":`gh-row-body`,className:`text-[13px] leading-relaxed text-soft-foreground`,children:o?(0,X.jsx)(`div`,{"data-slot":`gh-row-excerpt`,inert:!0,className:Ft,children:(0,X.jsx)(Xe,{document:!0,children:o})}):a.isPending?(0,X.jsx)(He,{className:`h-4 w-2/3`}):a.isError||a.data?.available===!1?(0,X.jsx)(`p`,{"data-slot":`gh-row-body-unavailable`,className:`text-muted-foreground`,children:`Description unavailable. Use Refresh to try again.`}):(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,X.jsxs)(`div`,{"data-slot":`gh-row-facts`,className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Opened by `,(0,X.jsx)(`span`,{"data-slot":`gh-row-author`,className:`font-medium`,children:t.author})]}),n?(0,X.jsx)(Ze,{checks:n,url:t.url}):null]}),(0,X.jsxs)(`div`,{"data-slot":`gh-row-actions`,className:`flex flex-wrap items-center gap-2`,children:[i?(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:`/tasks/${i}`,"data-action":`gh-row-view-task`,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsx)(L,{asChild:!0,variant:`primary`,size:`sm`,children:(0,X.jsxs)(H,{to:r,state:{focusHandoff:!0},"data-action":`gh-row-handoff`,title:`Open this ${s} and write the prompt for an agent`,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}),(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:r,"data-action":`gh-row-open`,children:[`Open `,s,(0,X.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3.5`})]})})]})]})}var Ft=r(`max-h-[calc(3lh)] overflow-hidden [overflow-wrap:anywhere]`,`[&_*]:!my-0 [&_p+*]:!mt-1 [&_ul]:list-inside [&_ol]:list-inside`,`[&_:is(h1,h2,h3,h4,h5,h6,pre,img,table,hr,[data-streamdown="code-block"],[data-streamdown="table-wrapper"],[data-streamdown="image-wrapper"],[data-streamdown="mermaid-block"])]:hidden`);function It(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function Lt(e){let[t,n]=(0,Y.useState)(null);return(0,Y.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(It(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 Rt(e,t){let[n,r]=(0,Y.useState)(0);return(0,Y.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 zt(e,t,n){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(n);return(0,Y.useEffect)(()=>{a.current=n}),(0,Y.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 Bt(e,t,n,r,i){let[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=Lt(a),u=(0,Y.useRef)(null);u.current=l;let d=Rt(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:zt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function Vt({item:e,queuedRunId:t}){return t?(0,X.jsx)(L,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(H,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsxs)(L,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,onClick:Ht,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function Ht(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var Ut=100;function Wt(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>=Ut)break;a.add(t.number)}return[...a]}function Gt(e,t,n,r,i,a){let o=Wt(n,e,r,i,a),s=m(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=g(e===`issues`?`issue`:`pr`,(0,Y.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,Y.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 Kt(e){let t=i(),n=_(t,!0,t==="default").data,r=(0,Y.useMemo)(()=>n?Fe(n,e,t):null,[n,e,t]);return(0,Y.useCallback)(e=>{let t=e.kind===`issue`?r?.get(e.number):void 0;return t?{runId:t.id,status:ze(t)}:null},[r])}function qt(e){let[t,n]=Ee(),r=t.get(`filter`),i=Be(e,r),a=i??`all`,o=e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n}),s=q(t);return{rawFilterParam:r,filter:i,activeFilter:a,setFilterParam:o,narrows:s,url:(0,Y.useMemo)(()=>{let t=new URLSearchParams(s);return{query:t.get(`q`)??``,labels:t.getAll(`label`),assignees:e===`issues`?t.getAll(`assignee`):[],board:e===`issues`?t.get(`board`)??``:``}},[s,e]),writeNarrows:(0,Y.useCallback)(e=>n(t=>{let n=e(t);return(t.has(`filter`)||q(t)!==``)&&!n.has(`filter`)&&q(n)===``&&n.set(`filter`,`all`),n}),[n])}}function Jt(e,t){return n=>{let r=new URLSearchParams(n);r.delete(e);for(let n of t)r.append(e,n);return r}}function Yt(e,t,{rawFilterParam:n,filter:r,activeFilter:i,setFilterParam:a,narrows:o,url:s,writeNarrows:c}){let l=Zt(s.query,n!==null||o!==``,c),{query:u,setQuery:d}=l,f=s.labels,p=s.assignees,m=e=>c(Jt(`label`,e)),{setProjectFilter:h,activeProject:g}=Qt(t,s.board,c),_=e===`issues`&&i===`assigned`,v=_?t?.viewerLogin?[t.viewerLogin]:[]:p;return{query:u,setQuery:d,labelFilter:f,setLabelFilter:m,setProjectFilter:h,activeProject:g,isAssignedFilter:_,effectiveAssignees:v,changeAssignees:e=>{c(Jt(`assignee`,e)),_&&a(`all`)},clearFilters:()=>{l.clear(),c(e=>{let t=new URLSearchParams(e);for(let e of Le)t.delete(e);return r!==null&&r!==`all`&&t.set(`filter`,`all`),t})},filtering:u.trim()!==``||f.length>0||e===`issues`&&(v.length>0||g!==``)||r!==null&&r!==`all`,narrowing:u.trim()!==``||f.length>0||e===`issues`&&(!_&&p.length>0||g!==``)}}var Xt=250;function Zt(e,t,n){let r=`${O().pathname}${t?``:`#entry`}`,[i,a]=(0,Y.useState)(e),o=(0,Y.useRef)(e),s=(0,Y.useRef)(void 0),c=(0,Y.useRef)(r);return(0,Y.useEffect)(()=>{e===o.current&&r===c.current||(clearTimeout(s.current),c.current=r,o.current=e,a(e))},[e,r]),(0,Y.useEffect)(()=>()=>clearTimeout(s.current),[]),{query:i,setQuery:e=>{a(e),clearTimeout(s.current),s.current=setTimeout(()=>{let t=e.trim();o.current=t,n(e=>{let n=new URLSearchParams(e);return t===``?n.delete(`q`):n.set(`q`,t),n})},Xt)},clear:()=>{clearTimeout(s.current),o.current=``,a(``)}}}function Qt(e,t,n){let r=e=>n(t=>{let n=new URLSearchParams(t);return e===``?n.delete(`board`):n.set(`board`,e),n}),i=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,a=i||e?.projects?.some(e=>e.id===t)===!0,o=e?.available===!0&&!i&&t!==``&&!a,[s,c]=(0,Y.useState)(``);s!==``&&s!==t&&c(``),o&&s!==t&&c(t);let l=o||s!==``&&s===t,u=a&&!l?t:``;return(0,Y.useEffect)(()=>{l&&n(e=>{let t=new URLSearchParams(e);return t.delete(`board`),t})},[l,n]),{setProjectFilter:r,activeProject:u}}function $t(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,Y.useMemo)(()=>c.data?je(c.data,t?.repo,o):null,[c.data,t?.repo,o]),d=Re(e,n)?Oe(n):null,f=u(`pr`,d??``,d!==null&&t?.available===!0),p=d!==null&&f.data?.available?f.data.items:null,m=(0,Y.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),h=(0,Y.useMemo)(()=>p?Ye(p,m):null,[p,m]),g=en({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:d,filterHits:p,filterSearch:f});return{backedQuery:d,filterSearch:f,fullList:m,filterRows:h,filterGate:g,openItems:(0,Y.useMemo)(()=>g?[]:h??m,[g,h,m]),narrow:(0,Y.useMemo)(()=>e===`issues`?r===`no-task`&&l?{excludeNumbers:l}:r===`has-task`&&l?{includeNumbers:l}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:p?{includeNumbers:new Set(p.map(e=>e.number))}:{},[e,r,l,t?.viewerLogin,p])}}function en({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 tn(e,t){return t?w(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function nn(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=c.github()[0],s=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,u=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,d=l??u,[f,p]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{d&&p({scope:o,view:e,item:d})},[o,e,d]),{selectedNumber:s,remoteDetail:d??(f?.scope===o&&f.view===e&&f.item.number===s?f.item:null)}}function rn(e,t,n,{fullList:r,filterRows:i},a){let o=D(),s=(0,Y.useRef)(null),u=e===`issues`?`issue`:`pr`,d=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,f=l(u,n??0,d),p=d&&f.data?.available&&f.data.item?.kind===u?f.data.item:null;s.current=d&&n!==null?{kind:u,number:n,key:c.githubItem(u,n)}:null;let[m,h]=(0,Y.useState)(!1);return{exactWanted:d,exactItem:f,exactDetail:p,exactTargetRef:s,retryingExact:m,retryExact:()=>{h(!0),tn(o,s.current).then(e=>{h(!1),e||T(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function an(e,t,n){let r=D(),i=(0,Y.useRef)(null);return{refresh:v({mutationFn:e=>(tn(r,e),y({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:c.githubPages(50),exact:!0}),r.setQueryData(c.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:c.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=c.githubCommentCounts(o,s);r.removeQueries({queryKey:c.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==C(l)}),a.available&&a.commentsDeferred&&s.length>0&&E(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:c.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:c.githubSearch(`pr`,We)}),r.invalidateQueries({queryKey:c.githubSearch(`pr`,ke)});let u=i.current,d=c.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=c.githubComments(u.kind,u.number);b(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==C(f)})},onError:e=>T(e.message,{tone:`danger`})}),openThreadRef:i}}var on=350;function sn(e,t){let[n,r]=(0,Y.useState)(e);return(0,Y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function cn(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=sn(n,on),d=(0,Y.useMemo)(()=>J(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),f=n.trim()===l.trim(),p=t?.available===!0&&!c&&f&&et(l,d),m=u(e===`issues`?`issue`:`pr`,l,p),h=J(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=ln(e,g,a,i);return{debouncedQuery:l,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?J(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...un(n,f,p,m)}}function ln(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 un(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 dn({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=qt(e),{rawFilterParam:a,activeFilter:o,narrows:c}=i,l=a!==null||c!==``,u=be(),{pages:d,data:f}=h(50),p=Pe(),m=pn(),g=ct(),_=fn({index:n,isDesktop:u,listInUrl:l,n:r,rememberedView:s().data?.githubView}),[v,y]=(0,Y.useState)(null),b=Yt(e,f,i),x=$t(e,f,i,b.isAssignedFilter),S=cn(e,f,b,x),C=nn(e,r,S.forgeSearch,x),w=rn(e,f,C.selectedNumber,x,C.remoteDetail),T=Gt(e,d,f,C.selectedNumber,S.searchHits,x.openItems),{refresh:E,openThreadRef:D}=an(e,T.checkPrNumbers,S.debouncedQuery),O=Bt(e,d,f,x.backedQuery,b.narrowing),te=Kt(f?.available?f.repo:void 0);if(_.restorePrs)return(0,X.jsx)(he,{to:`/github/prs`,replace:!0});if(!f)return d.isError?(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(M,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:d.error.message})}):(0,X.jsx)(Ue,{});D.current=null;let k=()=>E.mutate(w.exactTargetRef.current);if(_.filterScreen&&f.available)return(0,X.jsx)(St,{onRefresh:k,refreshing:E.isPending});if(!f.available)return(0,X.jsx)(vn,{reason:f.reason,refreshing:E.isPending,onRetry:k});let{labelColors:ne,labelOptions:re}=mn(f,S.searchPayload,x.openItems,x.fullList),ie=hn({number:C.selectedNumber,fullList:x.fullList,filterRows:x.filterRows,remoteDetail:C.remoteDetail,exactDetail:w.exactDetail}),A=r===void 0?[...S.items,...S.searchHits].find(e=>e.url===v)??null:null,j=ie??A;D.current=j?{kind:j.kind,number:j.number}:null;let{linkFilter:ae,listPath:N}=gn(e,a,o,u,c),P={view:e,filter:ae,narrows:c,colors:ne,expandedUrl:A?.url??null,onToggle:e=>y(t=>t===e.url?null:e.url),queued:g.queued,checksMap:T.checksMap,commentsOf:T.commentsOf,taskOf:te,referenceWidth:kt([...S.items,...S.searchHits])},oe=_n(e,b,x.filterGate,S),F=Ct({view:e,activeFilter:o,isDesktop:u,listInUrl:l,n:r,gh:f,actions:{automationsAvailable:p,refreshing:E.isPending,onRefresh:k}});return r===void 0?(0,X.jsxs)(W,{route:`github`,density:ye(S.items.length+S.searchHits.length),headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:F,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,X.jsx)(yn,{view:e,isDesktop:u,gh:f,onSaveView:m}),(0,X.jsx)(bn,{view:e,gh:f,filters:b,labelOptions:re,labelColors:ne,searchPayload:S.searchPayload})]}),(0,X.jsx)(Cn,{view:e,rows:P,verdict:oe,search:S,sidebar:x,list:d,paging:O})]}):(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,header:F,children:(0,X.jsx)(On,{view:e,selected:ie,selectedNumber:C.selectedNumber,exact:w,repo:f.repo,rows:P,listPath:N,changes:t,handToAgent:g})})}function fn({index:e,isDesktop:t,listInUrl:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&!n&&r===void 0,restorePrs:e&&t&&!n&&i===`prs`}}function pn(){let e=D();return t=>{e.setQueryData(c.uiState,e=>({...e,githubView:t})),S({githubView:t}).then(t=>e.setQueryData(c.uiState,t)).catch(t=>{T(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:c.uiState})})}}function mn(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:$e([...n,...r,...t?.items??[]])}}function hn({number:e,fullList:t,filterRows:n,remoteDetail:r,exactDetail:i}){return e===null?null:t.find(t=>t.number===e)??n?.find(t=>t.number===e)??r??i??null}function gn(e,t,n,r,i){let a=t===null?null:n;return{linkFilter:a,listPath:Ie(e,a??(e===`issues`&&!r?`all`:null),void 0,``,i)}}function _n(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,X.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,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function vn({reason:e,refreshing:t,onRetry:n}){return(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(ie,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(L,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function yn({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(ut,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(ut,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function bn({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,X.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-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(jn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(xt,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function xn(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Sn(e,t,n=!1){return(0,X.jsx)(jt,{item:e,view:t.view,filter:t.filter,narrows:t.narrows,colors:t.colors,expanded:t.expandedUrl===e.url,onToggle:()=>t.onToggle(e),queuedRunId:t.queued.get(e.url)??null,checks:xn(e,t.checksMap),comments:t.commentsOf(e),status:Ot(e,n),task:t.taskOf(e),referenceWidth:t.referenceWidth})}function Cn({view:e,rows:t,verdict:n,search:r,sidebar:i,list:a,paging:o}){let{items:s,searchHits:c}=r;return(0,X.jsxs)(`section`,{ref:o.setListEl,"data-slot":`gh-list`,className:`relative flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3`,children:[s.length===0?n&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):(0,X.jsx)(wn,{items:s,rows:t,paging:o}),o.pagingAvailable?(0,X.jsx)(Tn,{view:e,list:a,paging:o}):null,(0,X.jsx)(En,{backedQuery:i.backedQuery,filterSearch:i.filterSearch}),s.length>0&&r.searchWanted&&n?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:n}):null,c.length>0?(0,X.jsx)(Dn,{hits:c,searchPayload:r.searchPayload,rows:t}):null]})}function wn({items:e,rows:t,paging:n}){let{setRowsEl:r,scrollOwner:i,listEl:a,scrollOwnerRef:o,startMargin:s}=n,c=(0,Y.useRef)(null),l=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(l.current||!i)return;l.current=!0;let n=e.findIndex(e=>e.url===t.expandedUrl);n>=0&&c.current?.scrollToIndex(n,{align:`start`})},[i,e,t.expandedUrl]);let u=e.map((e,n)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":n>0||void 0,children:Sn(e,t)},e.url));return(0,X.jsx)(`div`,{ref:r,"data-slot":`gh-rows`,"data-virtualized":i?`true`:void 0,role:`list`,children:i?(0,X.jsx)(qe,{ref:c,scrollRef:o,startMargin:s,children:u},i===a?`list`:`main`):u})}function Tn({view:e,list:t,paging:n}){return(0,X.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-muted-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(I,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.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,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.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 En({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function Dn({hits:e,searchPayload:t,rows:n}){let r=(0,Y.useRef)(null),i=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{i.current||(i.current=!0,(r.current?.querySelector(`[data-slot="gh-row"][aria-expanded="true"]`))?.scrollIntoView({block:`start`}))},[]);let a=d();return(0,X.jsx)(k,{projectId:a,requests:a?e.map(e=>({projectId:a,kind:e.kind===`pr`?`PR`:`Issue`,number:e.number})):[],children:(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{ref:r,className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Sn(e,n,!0)},e.url))})]})})}function On({view:e,selected:t,selectedNumber:n,exact:r,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}){let{exactWanted:l,exactItem:u}=r;return(0,X.jsxs)(`section`,{"data-slot":`gh-detail`,className:`flex w-full min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card`,children:[t?null:(0,X.jsx)(`div`,{className:`px-4 pt-4 md:px-7 md:pt-5`,children:(0,X.jsx)(Qe,{backLink:{to:o}})}),t?(0,X.jsx)(kn,{item:t,repo:i,rows:a,listPath:o,changes:s,handToAgent:c}):l&&u.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex flex-1 flex-col`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(I,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${n}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):l&&(u.isError||u.data?.available===!1)?(0,X.jsx)(An,{number:n,exact:r}):(0,X.jsx)(Tt,{view:e,number:n})]})}function kn({item:e,repo:t,rows:n,listPath:r,changes:i,handToAgent:a}){let{workflows:o,skillList:s,workflow:c,setWorkflow:l,selectedSkills:u,setSelectedSkills:d,engine:f,setEngine:p,queued:m,onQueued:h}=a,g=O().state?.focusHandoff===!0;return(0,Y.useEffect)(()=>{g&&Ht()},[g,e.url]),(0,X.jsx)(nt,{item:e,comments:n.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(dt,{number:e.number,repo:t},e.url):void 0,backLink:{to:r},subNav:{filter:n.filter,narrows:n.narrows,changes:i},onRunAgent:Ht,headerAction:(0,X.jsx)(Vt,{item:e,queuedRunId:m.get(e.url)??null}),colors:n.colors,checks:xn(e,n.checksMap),children:(0,X.jsx)(it,{item:e,workflows:o.data?.workflows??[],skills:s,workflow:c,onWorkflowChange:l,selectedSkills:u,onSkillsChange:d,engine:f,onEngineChange:p,queuedRunId:m.get(e.url)??null,onQueued:h},e.url)})}function An({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,X.jsx)(G,{icon:(0,X.jsx)(M,{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,X.jsx)(L,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function jn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Y.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(V,{open:a,onOpenChange:o,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(Te,{children:[(0,X.jsx)(xe,{placeholder:`Filter labels…`}),(0,X.jsxs)(we,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(Ce,{children:`No labels.`}),n.length>0?(0,X.jsxs)(Se,{value:`__clear__`,onSelect:()=>i([]),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,X.jsxs)(Se,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`gh-label-dot`,className:`size-2.5 shrink-0 rounded-full ring-1 ring-foreground/30`,style:rt(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(N,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{dn as GithubRoute};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{vt as i,xt as a}from"./queries-CchoEEzj.js";import{f as o,n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{A as c,C as l,D as u,F as d,I as f,L as p,M as m,N as h,O as g,P as _,R as ee,S as v,T as y,_ as b,a as x,b as S,c as te,d as ne,f as re,g as ie,h as ae,i as oe,j as se,k as ce,l as le,m as ue,n as de,o as fe,p as pe,r as me,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"./activity-motion-DUZ4l5Y3.js";import{t as A}from"./button-B22ANdCY.js";import{a as j,f as M,n as N,t as P}from"./page-shell-BgabWJ3w.js";import{i as F}from"./project-order-AcHI4Dcl.js";import{On as I}from"./index-CS4efF3Z.js";var L=e(t(),1),R=(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 z(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 he=(e,...t)=>e.filter(e=>!t.some(t=>ge(e,t))),ge=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,B=e=>Math.round(e*10)/10,V=e=>`${B(e.x)} ${B(e.y)}`;function _e(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 ve(e,t=8){let n=_e(e),r=n[0];if(!r)return``;let i=`M${V(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 ${V(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 ${V(c(r,a,s))} Q ${V(r)}, ${V(c(r,o,s))}`}return i}function H(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 ye(e){return{rows:H(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:H(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var U=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),W=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function be(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 xe(e,t,n,r=0){let i=ye(n),a=U(i.rows,e=>e.top,e.y),o=U(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?W(i,a):W(i,a-1))+r/2,d=(s?W(i,o-1):W(i,o))+r/2,f=be(i,U(i.cols,e=>e.left,e.x),U(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}}}function Se(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{vt as i,xt as a}from"./queries-CchoEEzj.js";import{f as o,n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{A as c,C as l,D as u,F as d,I as f,L as p,M as m,N as h,O as g,P as _,R as ee,S as v,T as y,_ as b,a as x,b as S,c as te,d as ne,f as re,g as ie,h as ae,i as oe,j as se,k as ce,l as le,m as ue,n as de,o as fe,p as pe,r as me,s as C,t as w,u as T,v as E,w as D,x as O,y as k}from"./activity-motion-Ckq9kC3I.js";import{t as A}from"./button-B22ANdCY.js";import{a as j,f as M,n as N,t as P}from"./page-shell-BgabWJ3w.js";import{i as F}from"./project-order-AcHI4Dcl.js";import{kn as I}from"./index-DJB0lid-.js";var L=e(t(),1),R=(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 z(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 he=(e,...t)=>e.filter(e=>!t.some(t=>ge(e,t))),ge=(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h,B=e=>Math.round(e*10)/10,V=e=>`${B(e.x)} ${B(e.y)}`;function _e(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 ve(e,t=8){let n=_e(e),r=n[0];if(!r)return``;let i=`M${V(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 ${V(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 ${V(c(r,a,s))} Q ${V(r)}, ${V(c(r,o,s))}`}return i}function H(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 ye(e){return{rows:H(e,e=>e.y,e=>e.y+e.h).map(({from:e,to:t})=>({top:e,bottom:t})),cols:H(e,e=>e.x,e=>e.x+e.w).map(({from:e,to:t})=>({left:e,right:t}))}}var U=(e,t,n)=>Math.max(0,e.findIndex(e=>Math.abs(t(e)-n)<=2)),W=(e,t)=>((e.rows[t]?.bottom??0)+(e.rows[t+1]?.top??(e.rows[t]?.bottom??0)+16))/2;function be(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 xe(e,t,n,r=0){let i=ye(n),a=U(i.rows,e=>e.top,e.y),o=U(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?W(i,a):W(i,a-1))+r/2,d=(s?W(i,o-1):W(i,o))+r/2,f=be(i,U(i.cols,e=>e.left,e.x),U(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}}}function Se(e){let t=new Map;for(let n of e){let e=[n.senderRunId,n.recipientRunId].sort().join(`
2
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 Ce(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 G=e=>Math.round(e*10)/10,K=e=>`${G(e.x)} ${G(e.y)}`;function we(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(z(R({x:i,y:s},{x:a,y:c}),he(n,e,t))){let i=xe(e,t,n,r);return{d:ve(i.points),label:i.label}}return{d:`M${K({x:i,y:s})} C ${K({x:i,y:s+l})}, ${K({x:a,y:c-l})}, ${K({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${K({x:i,y:o})} C ${K({x:i,y:c-l})}, ${K({x:a,y:c-l})}, ${K({x:a,y:s-3})}`,label:{x:(i+a)/2,y:c-l*.75}}}function Te(e,t){return{x:e.left-t.left,y:e.top-t.top,w:e.width,h:e.height}}function Ee(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function De(e){let t=[],n=[];for(let r of e)v(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function Oe(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function ke(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function Ae(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>m(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function je(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=n(),Me={w:104,h:20};function Ne(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,Te(r.getBoundingClientRect(),t))}return n}function Pe(e,t,n=[]){let r=Ne(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...re(e),kind:`wait`}))],o=Se(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...we(t,n,i,o.get(e.requestId))})}let c=Ce(s.map(e=>({id:e.id,at:e.label})),Me,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function Fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-xs whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function Ie({arc:e,wait:t,now:n,motion:i}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:r(J,`border-dashed border-message-peer-accent`,t.id in i.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,_(f(t.since,n))]})}function Le({arc:e,request:t,now:n,motion:i}){let a=te(i,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:r(J,a?`border-success`:`border-message-peer-accent`,C(i,e.id)===`fade`&&`activity-line-out`),children:[a?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,_(f(t.createdAt,n))]})}var Re=[],ze=new Set;function Be({arcs:e,waits:t=Re,active:n=ze,layoutKey:i,now:a,motion:o=b,paused:s=!1}){let c=L.useRef(null),l=T(c,L.useCallback(n=>Pe(n,e,t),[e,t]),Fe,`[data-activity-pill]`,i),u=L.useMemo(()=>new Set(l.map(e=>e.id)),[l]),d=ne(o.comets,u,s),f=new Map(e.map(e=>[e.requestId,e])),p=new Map(t.map(e=>[e.id,e])),m=L.useId().replace(/[^a-zA-Z0-9_-]/g,``),h=`activity-arrow-arc-${m}`,g=`activity-ring-arc-${m}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:h,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(x,{id:g})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${g})`,className:r(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,le(o,e.id))},e.id)}let t=C(o,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${h})`,className:r(`stroke-message-peer-accent`,fe(t,e.id in o.opening))},e.id)}),(0,q.jsx)(`g`,{ref:d,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?p.get(e.id):void 0;if(t)return(0,q.jsx)(Ie,{arc:e,wait:t,now:a,motion:o},e.id);let n=f.get(e.id);return n?(0,q.jsx)(Le,{arc:e,request:n,now:a,motion:o},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,Ve=[],He=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function Ue({task:e}){let t=e.workers.filter(e=>m(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(c,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function We({projectId:e,task:t,requests:n,waits:i=Ve,index:a,ctx:o,motion:l=b,linked:u=!1,onHover:g}){let _=h(t,o);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-action":_.action,"data-linked":u?`true`:void 0,...ae(t.runId,g),className:r(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,_.action?_.tone===`info`?`border-info/70`:`border-pending/70`:t.rung===`running`&&m(t.status)?`border-status-running/60`:`border-border`,u&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in l.entering&&`activity-card-enter`),children:[(0,q.jsx)(pe,{task:t,motion:l,glow:_.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(c,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(s,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(ce,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`div`,{className:`mt-[3px] ml-[19px] flex items-center gap-2`,children:[(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`min-w-0 flex-1 truncate text-xs text-muted-foreground tabular-nums`,children:[(0,q.jsx)(se,{"data-slot":`activity-verb`,tone:_.tone,className:`font-semibold`,children:_.verb}),_.action&&_.since?(0,q.jsxs)(q.Fragment,{children:[` · `,(0,q.jsx)(`span`,{"data-slot":`activity-pill-age`,title:d(_.since),children:p(f(_.since,o.now))})]}):null,` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:r(_.mono&&`font-mono text-xs`),children:_.main})]}),_.action?(0,q.jsx)(A,{asChild:!0,size:`sm`,variant:_.action===`answer`?`primary`:`outline`,className:`relative z-[1] px-2 text-[12px]`,children:(0,q.jsx)(s,{"data-slot":`activity-pill-action`,to:Y(e,t.runId),children:_.action===`answer`?`Answer`:`Open task`})}):null]}),(0,q.jsx)(ue,{texts:k(t.runId,n,a,i)}),(0,q.jsx)(Ue,{task:t}),(0,q.jsx)(ie,{runId:t.runId,requests:n,waits:i,index:a,link:s,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:He})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Ge=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-card-edge bg-card shadow-card px-4 pt-3.5 pb-4`,Q=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function $({project:e,headingId:t,detail:n,to:r,label:i}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:n}),(0,q.jsx)(s,{to:r,className:Q,children:i})]})}function Ke({project:e,notice:t}){let n=L.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)($,{project:e,headingId:n,detail:t,to:Ge(e.projectId),label:`Open project →`})})}function qe(e,t){return L.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return Oe({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Je({project:e,now:t,motion:n=b,paused:i=!1}){let a=L.useId(),o=L.useMemo(()=>l(e),[e]),s=qe(e,n),c=L.useMemo(()=>O(e.tasks),[e.tasks]),u=L.useMemo(()=>ke(e.tasks,[...c,...E(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),d=oe(c),f={now:t,titleOf:e=>S(o,e)},p=`${e.tasks.map(e=>e.runId).join(`,`)}:${s.map(e=>e.requestId).join(`,`)}:${u.map(e=>e.id).join(`,`)}`,m=s.length>0||u.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":a,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)($,{project:e,headingId:a,detail:Ae(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:r(`relative mt-3`,m&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:r(`grid grid-cols-[repeat(auto-fit,minmax(min(100%,300px),1fr))] items-start gap-3.5`,m&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(We,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:o,ctx:f,motion:n,linked:d.linked.has(t.runId),onHover:d.onHover},t.runId))}),m?(0,q.jsx)(Be,{arcs:s,waits:u,active:d.active,layoutKey:p,now:t,motion:n,paused:i}):null]})]})}function Ye(e){let t=v(e.project);return t===void 0?(0,q.jsx)(Je,{...e}):(0,q.jsx)(Ke,{project:e.project,notice:t})}function Xe({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[je(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(L.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(s,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground 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.name})]},e.projectId))]})}var Ze={kind:`workspace`};function Qe(){let e=a().data?.projects,{order:t}=I();return L.useMemo(()=>e?F(e,t).map(e=>e.id):void 0,[e,t])}function $e(){let e=a().data,t=i(),n=o().state?.activityProjectId,r=e?.bootProject??t.data?.bootProject??null,s=typeof n==`string`&&e?.projects.some(e=>e.id===n&&e.status!==`missing`)?n:r;return{id:s,name:e?.projects.find(e=>e.id===s)?.name,projects:e?.projects}}function et(){let e=ee(Ze),t=$e(),n=Qe(),[r,i]=L.useState(!1),a=w(e.data?.generatedAt,e.dataUpdatedAt),o=e.data?.projects,c=L.useMemo(()=>Ee(o??[],n),[o,n]),l=L.useMemo(()=>De(c),[c]),d=L.useMemo(()=>l.panels.filter(e=>v(e)===void 0),[l.panels]),f=L.useMemo(()=>l.panels.filter(e=>v(e)!==void 0),[l.panels]),p=L.useMemo(()=>c.map(e=>e.projectId),[c]),{motion:m,feed:h,paused:_,reduced:b}=de(e.data,`workspace`),x=d.reduce((e,t)=>e+t.tasks.length,0);return(0,q.jsxs)(j,{route:`activity-global`,density:o?M(x+f.length):`full`,headerSpacing:`compact`,rootProps:{"data-activity-paused":_?`true`:void 0},bodyClassName:`gap-3.5`,header:g({name:`All projects`,now:e.data?a:void 0,updatedAt:e.data?.generatedAt,stale:e.isError,scopeSwitch:(0,q.jsx)(y,{scope:`all`,projects:t.projects,projectId:t.id,projectName:t.name,grouped:r,onToggleGroup:()=>i(e=>!e)})}),sparseFooter:o&&l.panels.length>0?(0,q.jsx)(N,{summary:`${d.length} active ${d.length===1?`project`:`projects`} with live work.`,actions:(0,q.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(s,{to:`/tasks`,children:`View all tasks`})})}):void 0,children:[o?(0,q.jsx)(u,{summary:D(o),tasksTo:`/tasks`,bumps:m.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!o?(0,q.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-border bg-card p-5 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(A,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),children:`Retry`})]}):null,o&&l.panels.length===0&&l.idle.length===0?(0,q.jsx)(P,{slot:`activity-empty`,title:`No projects to show.`,description:`Register a project in Workspace tools to monitor live agent work across repositories.`,actions:(0,q.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsx)(s,{to:`/tools`,children:`Open workspace tools`})})}):null,d.length>0||h.length>0?(0,q.jsx)(me,{projects:d,now:a,global:!0,grouped:r,projectOrder:p,motion:m,feed:h,still:b,paused:_}):null,f.length>0?(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3`,children:f.map(e=>(0,q.jsx)(Ye,{project:e,now:a,motion:m,paused:_||b},e.projectId))}):null,(0,q.jsx)(Xe,{projects:l.idle,belowPanels:l.panels.length>0})]})}export{et as GlobalActivityRoute};