@hearsay-tools/squawk 0.19.0-dev.8874 → 0.19.0-dev.8881

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 (155) hide show
  1. package/dist/server/repo-routes.d.ts +13 -13
  2. package/dist/server/server.d.ts +66 -66
  3. package/package.json +4 -4
  4. package/web/dist/assets/accounts-section-BM-HWieF.js +1 -0
  5. package/web/dist/assets/activity-motion-BlDa0Oee.js +1 -0
  6. package/web/dist/assets/activity-route-BOozKrPn.js +1 -0
  7. package/web/dist/assets/agent-config-section-Bg0OgLPn.js +7 -0
  8. package/web/dist/assets/agent-defaults-section-B-uXUUCT.js +1 -0
  9. package/web/dist/assets/appearance-Cv8Qr8nS.js +1 -0
  10. package/web/dist/assets/archive-on-merge-field-DExgXlBg.js +1 -0
  11. package/web/dist/assets/attention-CnhIF76m.js +1 -0
  12. package/web/dist/assets/{automations-route-BCXGQLB5.js → automations-route-DqS_DIp2.js} +2 -2
  13. package/web/dist/assets/badge-B6B-xYQQ.js +1 -0
  14. package/web/dist/assets/button-C8jUIs8Q.js +1 -0
  15. package/web/dist/assets/centered-state-BgSV4e79.js +1 -0
  16. package/web/dist/assets/change-counts-wqSYI3W8.js +1 -0
  17. package/web/dist/assets/{code-editor-B4baSOhz.js → code-editor-GfQChdgl.js} +1 -1
  18. package/web/dist/assets/{collapsible-BEV4FO-1.js → collapsible-CW6CfTJO.js} +1 -1
  19. package/web/dist/assets/command-DuxcX6Hr.js +1 -0
  20. package/web/dist/assets/commit-list-a1vNhwzg.js +1 -0
  21. package/web/dist/assets/dialog-Dbu3HnqC.js +1 -0
  22. package/web/dist/assets/diff-DDjPsaQ6.js +3 -0
  23. package/web/dist/assets/diff-controls-QeCV3Sy1.js +1 -0
  24. package/web/dist/assets/diff-stat-Dy4uLuyP.js +1 -0
  25. package/web/dist/assets/{diff-view-BLsl8Jxr.js → diff-view-Bv9YauBT.js} +1 -1
  26. package/web/dist/assets/{dist-Da4ckcJG.js → dist-BS5vYfFC.js} +1 -1
  27. package/web/dist/assets/dist-C_rn70hE.js +1 -0
  28. package/web/dist/assets/{dist-DXO3xwbC.js → dist-CtdIjNlG.js} +1 -1
  29. package/web/dist/assets/{dist-BAoXdNsT.js → dist-DDhqweuB.js} +1 -1
  30. package/web/dist/assets/{dist-C5mlVBmd.js → dist-Tubgdd25.js} +1 -1
  31. package/web/dist/assets/dist-VPUfzsfL.js +1 -0
  32. package/web/dist/assets/dropdown-menu-BaqO-x7U.js +1 -0
  33. package/web/dist/assets/{es2015-CQth82uv.js → es2015-DpKptHDx.js} +1 -1
  34. package/web/dist/assets/file-preview-CuwkUuqd.js +2 -0
  35. package/web/dist/assets/folder-browser-CK1mNIQi.js +1 -0
  36. package/web/dist/assets/git-toolbar-BWSmSiqy.js +1 -0
  37. package/web/dist/assets/github-CS_bLWjw.js +1 -0
  38. package/web/dist/assets/{global-activity-route-CrIQm98Y.js → global-activity-route-D7HmA4W3.js} +1 -1
  39. package/web/dist/assets/highlighter-Cfo7mLVB.js +3 -0
  40. package/web/dist/assets/html-report-frame-Ck76gKfA.js +1 -0
  41. package/web/dist/assets/{image-preview-DCUeM8u3.js → image-preview-CeEKI2T5.js} +1 -1
  42. package/web/dist/assets/index-B0_haEFL.js +21 -0
  43. package/web/dist/assets/index-D0mx-XUg.css +1 -0
  44. package/web/dist/assets/label-eNfbfYFG.js +1 -0
  45. package/web/dist/assets/markdown-Djjm7pRl.js +2 -0
  46. package/web/dist/assets/nav-row-styles-CgP5uNp4.js +1 -0
  47. package/web/dist/assets/{notifications-section-DRRyTHmL.js → notifications-section-Dcclastm.js} +1 -1
  48. package/web/dist/assets/{open-in-menu-VhRao_Jk.js → open-in-menu-CSbpfQy7.js} +1 -1
  49. package/web/dist/assets/option-select-DzjSpnye.js +1 -0
  50. package/web/dist/assets/page-shell-CpdYMj52.js +1 -0
  51. package/web/dist/assets/popover-CVo54-aS.js +1 -0
  52. package/web/dist/assets/{preview-pane-connected-Cj_mwoFj.js → preview-pane-connected-DOnixsSz.js} +3 -3
  53. package/web/dist/assets/{project-location-DATkk1gA.js → project-location-CBzVRz73.js} +1 -1
  54. package/web/dist/assets/{project-router-B9FTk0rB.js → project-router-CEnizJ8F.js} +1 -1
  55. package/web/dist/assets/projects-section-CJAE2fqb.js +1 -0
  56. package/web/dist/assets/prompt-templates-section-BqmYEq-d.js +1 -0
  57. package/web/dist/assets/queries-ByqTmyCs.js +1 -0
  58. package/web/dist/assets/reference-chip-hn8jj_Mo.js +1 -0
  59. package/web/dist/assets/{remote-settings-notice-0suHSrOy.js → remote-settings-notice-ChJJ2HzF.js} +1 -1
  60. package/web/dist/assets/repo-git-DzX-ZqFC.js +1 -0
  61. package/web/dist/assets/{report-reader-C__EDjjn.js → report-reader-DMLkJxpC.js} +1 -1
  62. package/web/dist/assets/report-selection-BkBJw-sm.js +1 -0
  63. package/web/dist/assets/reports-DyilNFvz.js +1 -0
  64. package/web/dist/assets/resources-section-NWZHHXtk.js +1 -0
  65. package/web/dist/assets/{review-panel-DsMQp4bE.js → review-panel-BsKM2hDc.js} +8 -8
  66. package/web/dist/assets/{run-detail-refresh-Ye2jcT7n.js → run-detail-refresh-BJ4laDVB.js} +1 -1
  67. package/web/dist/assets/run-header-DpTjMIK-.js +2 -0
  68. package/web/dist/assets/select-CvnOk0OI.js +1 -0
  69. package/web/dist/assets/{session-context-section-odpGIMPe.js → session-context-section-B3bs0GoD.js} +2 -2
  70. package/web/dist/assets/settings-agent-picker-DlX1-8_P.js +1 -0
  71. package/web/dist/assets/settings-shell-1FhhEiGa.css +1 -0
  72. package/web/dist/assets/{settings-shell-DGjDI-c1.js → settings-shell-twGuaJwv.js} +1 -1
  73. package/web/dist/assets/sidebar-section-Crbl2_-9.js +1 -0
  74. package/web/dist/assets/skills-CXdbXepC.js +1 -0
  75. package/web/dist/assets/status-dot-BXf-Ubd0.js +1 -0
  76. package/web/dist/assets/switch-DfPCm1H_.js +1 -0
  77. package/web/dist/assets/tab-link-3A_SF95U.js +1 -0
  78. package/web/dist/assets/task-changes-C8m5S54H.js +1 -0
  79. package/web/dist/assets/{task-commits-vu5Nxx5O.js → task-commits-CwNBsoyL.js} +1 -1
  80. package/web/dist/assets/{task-file-scope-CLJD_Mve.js → task-file-scope-C313CMq7.js} +1 -1
  81. package/web/dist/assets/task-files-CdpANvF1.js +1 -0
  82. package/web/dist/assets/task-github-item-f4J2WBEt.js +1 -0
  83. package/web/dist/assets/{task-groups-DD46syqv.js → task-groups-BRrlyl5P.js} +1 -1
  84. package/web/dist/assets/{task-thread-BFg_zKMs.js → task-thread-BqoX3viB.js} +2 -2
  85. package/web/dist/assets/{tasks-table-D17JLOhe.js → tasks-table-DtLW8U-4.js} +1 -1
  86. package/web/dist/assets/textarea-vEsJAUAV.js +1 -0
  87. package/web/dist/assets/thread-state-Bh4adRbN.js +4 -0
  88. package/web/dist/assets/toaster-Lf_4oY96.js +4 -0
  89. package/web/dist/assets/use-hand-to-agent-state-C3NlsVVQ.js +1 -0
  90. package/web/dist/assets/workflows-Df7ulEcU.js +7 -0
  91. package/web/dist/assets/{workspace-tools-Bqx4oCjd.js → workspace-tools-C_93GWNV.js} +1 -1
  92. package/web/dist/assets/{worktrees-section--ES3ssJy.js → worktrees-section-w9Q1xpeU.js} +4 -4
  93. package/web/dist/assets/zoomable-image-BUTgYpld.js +1 -0
  94. package/web/dist/index.html +33 -33
  95. package/web/dist/assets/accounts-section-vUm3Oo91.js +0 -1
  96. package/web/dist/assets/activity-motion-5PqpNBr3.js +0 -1
  97. package/web/dist/assets/activity-route-y4J0XPmC.js +0 -1
  98. package/web/dist/assets/agent-config-section-B6nb-4Tg.js +0 -7
  99. package/web/dist/assets/agent-defaults-section-WBjj9Ohn.js +0 -1
  100. package/web/dist/assets/appearance-CC_zz6GG.js +0 -1
  101. package/web/dist/assets/archive-on-merge-field-BkwRlcuT.js +0 -1
  102. package/web/dist/assets/attention-ILOaW2-t.js +0 -1
  103. package/web/dist/assets/badge-DQ3U69Ht.js +0 -1
  104. package/web/dist/assets/button-B7MKxYjT.js +0 -1
  105. package/web/dist/assets/centered-state-V15AR_qo.js +0 -1
  106. package/web/dist/assets/change-counts-npLATh-3.js +0 -1
  107. package/web/dist/assets/command-KdW7aO0N.js +0 -1
  108. package/web/dist/assets/commit-list-Cw8yFUN-.js +0 -1
  109. package/web/dist/assets/dialog-B531GGAo.js +0 -1
  110. package/web/dist/assets/diff-CWizOg4r.js +0 -3
  111. package/web/dist/assets/diff-controls-DY_B9_uk.js +0 -1
  112. package/web/dist/assets/diff-stat-C7KB1kDX.js +0 -1
  113. package/web/dist/assets/dist-BW234Kg5.js +0 -1
  114. package/web/dist/assets/dropdown-menu-4e2iKSMT.js +0 -1
  115. package/web/dist/assets/file-preview-Bz07aJkJ.js +0 -2
  116. package/web/dist/assets/folder-browser-B_jJl4is.js +0 -1
  117. package/web/dist/assets/git-toolbar-D22Fx9FV.js +0 -1
  118. package/web/dist/assets/github-BxWZugau.js +0 -1
  119. package/web/dist/assets/highlighter-DvLzHjjY.js +0 -3
  120. package/web/dist/assets/html-report-frame-DkHr39E2.js +0 -1
  121. package/web/dist/assets/index-CjcLSwvy.js +0 -21
  122. package/web/dist/assets/index-DOVwFCfP.css +0 -1
  123. package/web/dist/assets/label-DMC9mkYa.js +0 -1
  124. package/web/dist/assets/markdown-DVqtRtwM.js +0 -2
  125. package/web/dist/assets/nav-row-styles-D5HpOmDZ.js +0 -1
  126. package/web/dist/assets/page-shell-7pLJMOgh.js +0 -1
  127. package/web/dist/assets/popover-CZV6tz9i.js +0 -1
  128. package/web/dist/assets/projects-section-UDntLOSd.js +0 -1
  129. package/web/dist/assets/prompt-templates-section-D2bXkdN-.js +0 -1
  130. package/web/dist/assets/queries-hzlF788B.js +0 -1
  131. package/web/dist/assets/reference-chip-Dgo5aKeb.js +0 -1
  132. package/web/dist/assets/repo-git-B-vjoloe.js +0 -1
  133. package/web/dist/assets/report-selection-C-2DJb8L.js +0 -1
  134. package/web/dist/assets/reports-Dk8YneJS.js +0 -1
  135. package/web/dist/assets/resources-section-sabtBqDV.js +0 -1
  136. package/web/dist/assets/run-header-B48O-vRv.js +0 -2
  137. package/web/dist/assets/select-Ceegk4kO.js +0 -1
  138. package/web/dist/assets/settings-agent-picker-B7D6qReD.js +0 -1
  139. package/web/dist/assets/settings-select-CCIMGnyA.js +0 -1
  140. package/web/dist/assets/settings-shell-AMRJAsgc.css +0 -1
  141. package/web/dist/assets/sidebar-section-Ctg5OW0G.js +0 -1
  142. package/web/dist/assets/skills-B8jOrPvl.js +0 -1
  143. package/web/dist/assets/status-dot-BRzVlF2X.js +0 -1
  144. package/web/dist/assets/switch-DKqVf8-p.js +0 -1
  145. package/web/dist/assets/tab-link-BlZX-nKP.js +0 -1
  146. package/web/dist/assets/task-changes-BmmEftoB.js +0 -1
  147. package/web/dist/assets/task-files-DZ77QBej.js +0 -1
  148. package/web/dist/assets/task-github-item-DpD171qE.js +0 -1
  149. package/web/dist/assets/textarea-vJt9undk.js +0 -1
  150. package/web/dist/assets/thread-state-C96iPHAz.js +0 -4
  151. package/web/dist/assets/toaster-fWyfEGWF.js +0 -4
  152. package/web/dist/assets/use-hand-to-agent-state-DdohFuox.js +0 -1
  153. package/web/dist/assets/utils-DSMR_WLb.js +0 -1
  154. package/web/dist/assets/workflows-iiAfPhwp.js +0 -7
  155. package/web/dist/assets/zoomable-image-6RTKhLGE.js +0 -1
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{t as n}from"./button-B7MKxYjT.js";var r=e();function i(e,t=3){return e<=0?`empty`:e<=t?`sparse`:`full`}function a({variant:e=`outline`,className:i,...a}){return(0,r.jsx)(n,{variant:e,"data-page-shell-action":``,className:t(`shrink-0`,i),...a})}function o({title:e,scope:n,subtitle:i,status:a,primaryAction:o,secondaryActions:s,headerSlot:c=`page-header`,scopeSlot:l=`page-header-scope`,subtitleSlot:u=`page-header-subtitle`,hideSubtitleOnMobile:d=!1,headerExtra:f,headerRef:p}){let m=!!(a||s||o);return(0,r.jsx)(`header`,{ref:p,"data-slot":`page-shell-header`,"data-header-slot":c,children:(0,r.jsxs)(`div`,{"data-slot":c,className:`flex min-w-0 flex-col`,children:[(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-row`,children:[(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-title-block`,children:[(0,r.jsxs)(`h1`,{"data-slot":`page-shell-header-title`,className:`min-w-0 break-words`,children:[e,n?(0,r.jsxs)(r.Fragment,{children:[` `,(0,r.jsxs)(`span`,{"data-slot":l,className:`font-normal text-muted-foreground`,children:[`· `,n]})]}):null]}),i?(0,r.jsx)(`p`,{"data-slot":u,className:t(`mt-1 text-[13px] text-muted-foreground`,d&&`max-md:hidden`),children:i}):null]}),m?(0,r.jsxs)(`div`,{"data-slot":`page-shell-header-actions`,children:[a?(0,r.jsx)(`div`,{"data-slot":`page-header-status`,className:`flex shrink-0 items-center`,children:a}):null,s?(0,r.jsx)(`div`,{"data-slot":`page-header-secondary`,className:`flex flex-wrap items-center gap-2`,children:s}):null,o?(0,r.jsx)(`div`,{"data-slot":`page-header-primary`,className:`flex shrink-0 items-center`,children:o}):null]}):null]}),f]})})}function s({template:e,route:t,density:n,header:i,headerSpacing:a=`default`,fillHeight:s=!1,flushPadding:c=!1,beforeHeader:l,emptyState:u,sparseFooter:d,rootProps:f,rootRef:p,className:m,bodyClassName:h,children:g}){let _=n===`empty`&&u!==void 0;return(0,r.jsx)(`div`,{ref:p,"data-slot":`page-shell`,"data-route":t,"data-template":e,"data-density":n,"data-header-spacing":a,"data-fill-height":s?`true`:void 0,"data-flush-padding":c?`true`:void 0,className:m,...f,children:(0,r.jsxs)(`div`,{"data-slot":`page-shell-frame`,children:[l,i?(0,r.jsx)(o,{...i}):null,(0,r.jsx)(`div`,{"data-slot":`page-shell-body`,className:h,children:_?(0,r.jsx)(`div`,{"data-slot":`page-shell-empty`,children:u}):(0,r.jsxs)(r.Fragment,{children:[g,n===`sparse`&&d?d:null]})})]})})}function c(e){return(0,r.jsx)(s,{template:`Table`,...e})}function l(e){return(0,r.jsx)(s,{template:`Split`,...e})}function u(e){return(0,r.jsx)(s,{template:`Reading`,...e})}function d(e){return(0,r.jsx)(s,{template:`Form`,...e})}function f(e){return(0,r.jsx)(s,{template:`Board`,...e})}function p({icon:e,title:n,description:i,actions:a,slot:o=`page-shell-empty-state`,className:s}){return(0,r.jsxs)(`section`,{"data-slot":o,"data-page-shell-empty":``,"aria-label":n,className:t(`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-6`,s),children:[(0,r.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e?(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/50 text-muted-foreground [&_svg]:size-4`,children:e}):null,(0,r.jsxs)(`div`,{className:`min-w-0`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:n}),i?(0,r.jsx)(`div`,{className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:i}):null]})]}),a?(0,r.jsx)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:a}):null]})}function m({summary:e,actions:n,slot:i=`page-shell-sparse-footer`,className:a}){return(0,r.jsxs)(`aside`,{"data-slot":i,"data-page-shell-sparse":``,className:t(`min-w-0`,a),children:[(0,r.jsx)(`div`,{className:`min-w-0 text-muted-foreground`,children:e}),n?(0,r.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:n}):null]})}function h({list:e,detail:t,className:n}){return(0,r.jsx)(`div`,{"data-slot":`page-shell-split-host`,className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,r.jsxs)(`div`,{"data-slot":`page-shell-split-pane`,"data-has-detail":t?`true`:`false`,className:n,children:[(0,r.jsx)(`div`,{"data-slot":`page-shell-split-list`,className:`flex min-h-0 min-w-0 flex-col`,children:e}),t?(0,r.jsx)(`div`,{"data-slot":`page-shell-split-detail`,className:`flex min-h-0 min-w-0 flex-col`,children:t}):null]})})}export{d as a,u as c,i as d,f as i,l,m as n,s as o,h as r,a as s,p as t,c as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{a as i,n as a}from"./dist-BW234Kg5.js";import{a as o,i as s,r as c,t as l}from"./dist-C5mlVBmd.js";import{a as u,i as d,l as f,n as p,o as m,r as ee,t as h,u as g}from"./es2015-CQth82uv.js";import{a as _,i as te,n as ne,r as re,t as v}from"./dist-BAoXdNsT.js";var y=e(t(),1),b=n(),x=`Popover`,[S,ie]=s(x,[_]),C=_(),[ae,w]=S(x),T=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=C(t),c=y.useRef(null),[u,d]=y.useState(!1),[p,m]=l({prop:r,defaultProp:i??!1,onChange:a,caller:x});return(0,b.jsx)(te,{...s,children:(0,b.jsx)(ae,{scope:t,contentId:f(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:y.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:u,onCustomAnchorAdd:y.useCallback(()=>d(!0),[]),onCustomAnchorRemove:y.useCallback(()=>d(!1),[]),modal:o,children:n})})};T.displayName=x;var E=`PopoverAnchor`,D=y.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=w(E,n),a=C(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return y.useEffect(()=>(o(),()=>s()),[o,s]),(0,b.jsx)(v,{...a,...r,ref:t})});D.displayName=E;var O=`PopoverTrigger`,k=y.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,a=w(O,n),s=C(n),l=i(t,a.triggerRef),u=(0,b.jsx)(o.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":W(a.open),...r,ref:l,onClick:c(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?u:(0,b.jsx)(v,{asChild:!0,...s,children:u})});k.displayName=O;var A=`PopoverPortal`,[j,M]=S(A,{forceMount:void 0}),N=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=w(A,t);return(0,b.jsx)(j,{scope:t,forceMount:n,children:(0,b.jsx)(g,{present:n||a.open,children:(0,b.jsx)(d,{asChild:!0,container:i,children:r})})})};N.displayName=A;var P=`PopoverContent`,F=y.forwardRef((e,t)=>{let n=M(P,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=w(P,e.__scopePopover);return(0,b.jsx)(g,{present:r||a.open,children:a.modal?(0,b.jsx)(L,{...i,ref:t}):(0,b.jsx)(R,{...i,ref:t})})});F.displayName=P;var I=a(`PopoverContent.RemoveScroll`),L=y.forwardRef((e,t)=>{let n=w(P,e.__scopePopover),r=y.useRef(null),a=i(t,r),o=y.useRef(!1);return y.useEffect(()=>{let e=r.current;if(e)return h(e)},[]),(0,b.jsx)(p,{as:I,allowPinchZoom:!0,children:(0,b.jsx)(z,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),R=y.forwardRef((e,t)=>{let n=w(P,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return(0,b.jsx)(z,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),z=y.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:d,...f}=e,p=w(P,n),h=C(n);return ee(),(0,b.jsx)(u,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,b.jsx)(m,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,b.jsx)(re,{"data-state":W(p.open),role:`dialog`,id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),B=`PopoverClose`,V=y.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=w(B,n);return(0,b.jsx)(o.button,{type:`button`,...r,ref:t,onClick:c(e.onClick,()=>i.onOpenChange(!1))})});V.displayName=B;var H=`PopoverArrow`,U=y.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=C(n);return(0,b.jsx)(ne,{...i,...r,ref:t})});U.displayName=H;function W(e){return e?`open`:`closed`}var G=T,K=D,q=k,J=N,oe=F;function Y(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function se(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=Y(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(Y(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function ce(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:Y(e)}:{top:0,bottom:0}}function le(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function ue(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(ce(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function de(){let[e,t]=(0,y.useState)({top:0,bottom:0});return(0,y.useEffect)(()=>ue(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function fe(e){let t=(0,y.useRef)(e);t.current=e,(0,y.useEffect)(()=>{let e=document.documentElement;return se(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var X=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function pe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?X.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var Z=new WeakMap;function me(e){let t=Z.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return Z.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function Q(e){let t=me(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&Y(e)>80||t>80&&pe(e.document?.activeElement)}function he(){let[e,t]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{let e=window,n=()=>t(Q(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}var $=y.createContext(null);function ge({...e}){let t=y.useRef(!1);return(0,b.jsx)($,{value:t,children:(0,b.jsx)(G,{"data-slot":`popover`,...e})})}function _e({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=y.useContext($);return(0,b.jsx)(q,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function ve({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:i,onOpenAutoFocus:a,...o}){let s=de(),c=y.useContext($);return(0,b.jsx)(J,{children:(0,b.jsx)(oe,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:le(s,i),className:r(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function ye({...e}){return(0,b.jsx)(K,{"data-slot":`popover-anchor`,...e})}export{Q as a,_e as i,ye as n,fe as o,ve as r,he as s,ge as t};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{Bt as a,Gt as o,It as s,Ot as c,Pt as l,St as u,dn as d,zt as f}from"./queries-hzlF788B.js";import{hi as p,n as m,sn as h}from"./toaster-fWyfEGWF.js";import{n as g}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{O as _,ft as v}from"./design-icons-CzEoMH9c.js";import{t as y}from"./button-B7MKxYjT.js";import{n as b,r as x,t as S}from"./popover-CZV6tz9i.js";import{t as C}from"./centered-state-V15AR_qo.js";import{Gt as w,Ht as T,Jt as E,Kt as D,Qn as O,Ut as k,Wt as A,Yt as j,qt as M}from"./index-CjcLSwvy.js";import{t as N}from"./settings-select-CCIMGnyA.js";import{t as P}from"./save-cue-Cd3ZAPBS.js";import{n as F,t as I}from"./settings-field-DP9sYv5a.js";var L=t(n(),1),R=r();function z(){let e=c();return{isPending:e.isPending,confirm:(t,n)=>e.mutate(t.id,{onSuccess:()=>{m(`${t.name} removed from the workspace — its files are untouched`),n?.()},onError:e=>m(e.message,{tone:`danger`})})}}function B({project:e,onOpenChange:t,onConfirm:n}){return(0,R.jsx)(T,{open:e!==null,onOpenChange:t,children:(0,R.jsxs)(w,{children:[(0,R.jsxs)(E,{children:[(0,R.jsxs)(j,{children:[`Remove `,e?.name,` from the workspace?`]}),(0,R.jsxs)(D,{children:[`This only unregisters the project — `,(0,R.jsx)(`strong`,{children:`nothing on disk is deleted`}),`. The folder, its git history and its task history all stay exactly where they are, and opening it again re-registers it with everything intact.`,(0,R.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-foreground`,title:e?.root,children:e?.root})]})]}),(0,R.jsxs)(M,{children:[(0,R.jsx)(A,{children:`Keep it`}),(0,R.jsx)(k,{"data-action":`projects-confirm-remove`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:n,children:`Remove from list`})]})]})})}var V=e({MaxParallelSelect:()=>Z,ProjectTagsEditor:()=>X,ProjectsSection:()=>G,STATUS_LABEL:()=>U}),H=1,U={ok:`ok`,"not-git":`no git repo`,missing:`folder not found`};function W(e){let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function G(){let e=s(),t=u();return e.isPending||t.isPending?(0,R.jsx)(`p`,{"data-slot":`projects-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading projects…`}):e.isError||t.isError?(0,R.jsx)(C,{icon:(0,R.jsx)(_,{}),tone:`danger`,title:`Project settings did not load`,subtitle:(e.error??t.error)?.message,heading:`h2`}):(0,R.jsx)(K,{config:e.data,registry:t.data})}function K({config:e,registry:t}){let[n,r]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{"data-slot":`projects-section`,className:`flex w-full flex-col gap-7`,children:[(0,R.jsx)(q,{configKey:`browseRoot`,value:e.browseRoot,title:`Default browse folder`,hint:`Where “Open local folder…” starts. The picker cannot navigate above this folder.`,placeholder:`~/`,slot:`browse`,savedLabel:`Browse folder`,footer:`Only affects folder browsing; GitHub checkouts use the separate checkout folder.`}),(0,R.jsx)(q,{configKey:`projectsDir`,value:e.projectsDir,title:`Default checkout folder`,hint:`Where “Clone from GitHub” puts new projects: <folder>/<project name>.`,placeholder:`~/squawk/projects`,slot:`checkout`,savedLabel:`Checkout folder`,footer:`Only affects new checkouts; projects already registered keep their location.`,refreshProjects:!0}),(0,R.jsx)(J,{registry:t,workspaceMax:e.resources.maxParallel}),(0,R.jsx)(y,{className:`self-start`,onClick:()=>r(!0),children:`Add project`}),n?(0,R.jsx)(O,{open:!0,onOpenChange:r}):null]})}function q({configKey:e,value:t,title:n,hint:r,placeholder:i,slot:a,savedLabel:s,footer:c,refreshProjects:l=!1}){let u=p(),f=d({mutationFn:t=>h(e===`browseRoot`?{browseRoot:t}:{projectsDir:t}),onSuccess:t=>{u.setQueryData(o.config,t),e===`browseRoot`?u.invalidateQueries({queryKey:o.fsBrowseRoot}):l&&u.invalidateQueries({queryKey:o.projects})}}),[g,_]=(0,L.useState)(t),v=g.trim(),b=v===t,x=f.isError?f.error.message:null;return(0,R.jsxs)(F,{title:n,hint:`${r} ${e===`browseRoot`?`Choose an existing folder; it is verified writable before saving.`:`The folder is created recursively if needed, then verified writable before saving.`}`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`input`,{type:`text`,spellCheck:!1,"aria-label":n,"aria-invalid":x!==null,"data-slot":`projects-${a}-root`,value:g,disabled:f.isPending,placeholder:i,onChange:e=>{_(e.target.value),f.isError&&f.reset()},className:`block w-full max-w-sm rounded-md border border-input bg-card px-3 py-1.5 font-mono text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-danger disabled:opacity-50`}),(0,R.jsx)(P,{show:b&&v!==``&&!f.isPending,children:(0,R.jsx)(y,{type:`button`,variant:`primary`,size:`sm`,"data-action":`projects-save-${a}-root`,disabled:b||v===``||f.isPending,onClick:()=>f.mutate(v,{onSuccess:()=>m(`${s} set to ${v}`)}),children:`Save`})})]}),x===null?(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:c}):(0,R.jsxs)(`p`,{"data-slot":`projects-${a}-root-error`,role:`alert`,className:`text-xs text-danger`,children:[x,` — setting unchanged`]})]})}function J({registry:e,workspaceMax:t}){let[n,r]=(0,L.useState)(null),i=z(),a=(0,L.useMemo)(()=>f(e.projects),[e.projects]);return(0,R.jsxs)(F,{title:`Registered projects`,hint:`Connected repositories. Removing a project only unregisters it — no files on disk are deleted.`,children:[e.projects.length===0?(0,R.jsx)(`p`,{"data-slot":`projects-empty`,className:`text-[13px] text-soft-foreground`,children:`No projects registered yet.`}):(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-border`,children:(0,R.jsxs)(`table`,{className:`w-full border-collapse text-sm`,children:[(0,R.jsx)(`caption`,{className:`sr-only`,children:`Projects registered in this workspace`}),(0,R.jsxs)(`colgroup`,{children:[(0,R.jsx)(`col`,{}),(0,R.jsx)(`col`,{style:{width:`104px`}}),(0,R.jsx)(`col`,{style:{width:`260px`}}),(0,R.jsx)(`col`,{style:{width:`150px`}}),(0,R.jsx)(`col`,{style:{width:`72px`}}),(0,R.jsx)(`col`,{style:{width:`92px`}})]}),(0,R.jsx)(`thead`,{children:(0,R.jsxs)(`tr`,{className:`border-b border-border text-left text-[12px] text-soft-foreground`,children:[(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Project`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Status`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Tags`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Max parallel`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium`,children:`Added`}),(0,R.jsx)(`th`,{scope:`col`,className:`px-3 py-2 font-medium text-right`,children:`Actions`})]})}),(0,R.jsx)(`tbody`,{children:e.projects.map(n=>(0,R.jsx)(Y,{project:n,isBoot:n.id===e.bootProject,workspaceMax:t,vocabulary:a,disabled:i.isPending,onRemove:()=>r(n)},n.id))})]})}),(0,R.jsx)(B,{project:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>{if(!n)return;let e=n;r(null),i.confirm(e)}})]})}function Y({project:e,isBoot:t,workspaceMax:n,vocabulary:r,disabled:i,onRemove:a}){return(0,R.jsxs)(`tr`,{"data-slot":`project-row`,"data-project":e.id,className:`border-b border-border last:border-0`,children:[(0,R.jsxs)(`th`,{scope:`row`,className:`max-w-0 px-3 py-2 text-left font-normal`,children:[(0,R.jsx)(`span`,{className:`block truncate text-foreground`,children:e.name}),(0,R.jsx)(`span`,{className:`block truncate font-mono text-xs text-soft-foreground`,title:e.root,children:e.root})]}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsxs)(`span`,{"data-slot":`project-status-pill`,className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-0.5 text-[12px] leading-5`,children:[(0,R.jsx)(`span`,{"data-slot":`project-status`,className:e.status===`missing`?`text-danger`:`text-foreground`,children:U[e.status]}),e.status===`missing`?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`text-soft-foreground`,children:`·`}),(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.source})]})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsx)(X,{project:e,vocabulary:r})}),(0,R.jsx)(`td`,{className:`px-3 py-2`,children:(0,R.jsxs)(`label`,{"data-slot":`project-max-parallel-field`,className:`flex flex-col gap-1.5`,children:[(0,R.jsx)(`span`,{className:I,children:`Max parallel tasks`}),(0,R.jsx)(Z,{project:e,workspaceMax:n})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2 tabular-nums text-soft-foreground`,children:W(e.addedAt)}),(0,R.jsxs)(`td`,{className:`px-3 py-2 text-right`,children:[e.status===`missing`?null:(0,R.jsx)(y,{asChild:!0,variant:`outline`,className:`mr-2`,children:(0,R.jsx)(g,{to:`/p/${encodeURIComponent(e.id)}`,children:`Open`})}),(0,R.jsx)(y,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`project-remove`,"aria-label":`Remove ${e.name} from the workspace — unregisters it, no files are deleted`,title:t?`Squawk is serving this project — it re-registers itself at every start`:void 0,disabled:i||t,onClick:a,children:`Remove`})]})]})}function X({project:e,vocabulary:t}){let n=l(),[r,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(!1),[u,d]=(0,L.useState)(-1),f=(0,L.useRef)(null),p=e.tags??[],h=a(t,p,r),g=s&&h.length>0,_=(t,r)=>{n.mutate({id:e.id,tags:t},{onSuccess:()=>m(r),onError:e=>m(e.message,{tone:`danger`})})},y=t=>{let n=t.trim().slice(0,32);if(d(-1),n){if(p.some(e=>e.toLowerCase()===n.toLowerCase())){o(``);return}if(p.length>=20){m(`${e.name} already has the maximum of 20 tags`,{tone:`danger`});return}o(``),_([...p,n],`${e.name} tagged \u201c${n}\u201d`)}},C=t=>{_(p.filter(e=>e!==t),`\u201c${t}\u201d removed from ${e.name}`)},w=`project-tag-suggestions-${e.id}`;return(0,R.jsxs)(`div`,{"data-slot":`project-tags`,className:`flex flex-wrap items-center gap-1`,children:[p.map(t=>(0,R.jsxs)(`span`,{"data-slot":`project-tag`,className:`inline-flex max-w-full items-center gap-1 rounded-full bg-accent-strong/15 py-px pr-1 pl-2 text-xs font-medium whitespace-nowrap text-accent-text`,children:[t,(0,R.jsx)(`button`,{type:`button`,"data-action":`project-tag-remove`,"aria-label":`Remove tag ${t} from ${e.name}`,disabled:n.isPending,onClick:()=>C(t),className:`rounded-full p-0.5 hover:bg-accent-strong/25 disabled:opacity-50`,children:(0,R.jsx)(v,{className:`size-3`,"aria-hidden":`true`})})]},t)),(0,R.jsxs)(S,{open:g,onOpenChange:c,children:[(0,R.jsx)(b,{asChild:!0,children:(0,R.jsx)(`input`,{ref:f,type:`text`,"data-slot":`project-tag-input`,"aria-label":`Add a tag to ${e.name}`,role:`combobox`,"aria-expanded":g,"aria-controls":g?w:void 0,"aria-autocomplete":`list`,"aria-activedescendant":g&&u>=0?`${w}-${u}`:void 0,placeholder:p.length===0?`Add tag…`:`+`,value:r,maxLength:32,disabled:n.isPending,onFocus:()=>c(!0),onBlur:()=>c(!1),onChange:e=>{if(c(!0),d(-1),e.target.value.includes(`,`)){o(e.target.value.replace(/,/g,``));return}o(e.target.value)},onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(h.length===0)return;e.preventDefault(),c(!0);let t=e.key===`ArrowDown`?1:-1,n=u+t;d(n>=h.length?-1:n<-1?h.length-1:n);return}if(e.key===`Escape`&&g){e.preventDefault(),c(!1),d(-1);return}if(e.key===`Enter`||e.key===`,`){e.preventDefault(),y(u>=0?h[u]??r:r);return}if(e.key===`Tab`){c(!1);return}if(e.key===`Backspace`&&r===``&&p.length>0){e.preventDefault();let t=p[p.length-1];t!==void 0&&C(t)}},className:`h-6 w-16 min-w-0 flex-1 rounded-md border border-input bg-card px-1.5 text-[12px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`})}),(0,R.jsxs)(x,{align:`start`,sideOffset:4,id:w,role:`listbox`,"data-slot":`project-tag-suggestions`,className:`w-56 p-1`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,R.jsx)(`p`,{className:`px-2 pt-1 pb-1.5 text-xs text-soft-foreground`,children:`Tags used in this workspace`}),h.map((e,t)=>(0,R.jsx)(`button`,{type:`button`,id:`${w}-${t}`,role:`option`,"aria-selected":t===u,"data-slot":`project-tag-suggestion`,onMouseDown:e=>e.preventDefault(),onClick:()=>{y(e),f.current?.focus()},onMouseEnter:()=>d(t),className:i(`flex w-full items-center rounded-sm px-2 py-1 text-left text-[12px] font-medium text-accent-text`,t===u&&`bg-muted`),children:e},e))]})]})]})}function Z({project:e,workspaceMax:t}){let n=l(),r=e.maxParallel===void 0?``:String(e.maxParallel);return(0,R.jsxs)(N,{"aria-label":`Max parallel tasks for ${e.name}`,"data-slot":`project-max-parallel`,value:r,disabled:n.isPending,onChange:r=>{let i=r.target.value,a=i===``?null:Number(i);n.mutate({id:e.id,maxParallel:a},{onSuccess:()=>m(a===null?`${e.name} inherits the workspace limit (${t})`:`${e.name} runs at most ${a} task${a===1?``:`s`} at a time`),onError:e=>m(e.message,{tone:`danger`})})},className:`block w-full rounded-md border border-input bg-card px-2 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,R.jsxs)(`option`,{value:``,children:[`Inherit workspace (`,t,`)`]}),Array.from({length:16},(e,t)=>t+H).map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})}export{z as a,B as i,U as n,V as r,Z as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Jt as i,Wt as a,dn as o,k as s}from"./queries-hzlF788B.js";import{I as c,hi as l,n as u}from"./toaster-fWyfEGWF.js";import{J as d,W as f,at as p,c as m,ft as h,l as g,tt as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./button-B7MKxYjT.js";import{i as y,r as b,t as x}from"./popover-CZV6tz9i.js";import{a as S,i as C,o as w,r as T,s as E,t as D}from"./command-KdW7aO0N.js";import{f as O,i as k,p as A,u as j}from"./skills-pM_PouEs.js";import{t as M}from"./centered-state-V15AR_qo.js";import{Q as N,Zn as P,at as F,nt as I,pn as L,tt as R}from"./index-CjcLSwvy.js";import{t as z}from"./textarea-vJt9undk.js";import{n as B,t as V}from"./saved-draft-BwzBc-_Y.js";import{t as H}from"./save-cue-Cd3ZAPBS.js";import{t as U}from"./settings-field-DP9sYv5a.js";var W=e(t(),1),G=n();function K(){let e=s();return e.isPending?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading prompt templates…`}):e.isError?(0,G.jsx)(M,{icon:(0,G.jsx)(f,{}),tone:`danger`,title:`Prompt templates did not load`,subtitle:e.error.message,heading:`h2`}):(0,G.jsx)(q,{initial:I(e.data.promptTemplates)})}function q({initial:e}){let t=l(),n=i(),r=s(),[f,m]=B(e,V),[g,_]=(0,W.useState)(``),[y,b]=(0,W.useState)(``),x=o({mutationFn:e=>c({promptTemplates:e}),onSuccess:(e,n)=>{t.setQueryData(a.uiState,e),m(t=>V(t,n)?I(e.promptTemplates):t),u(`Prompt templates saved`)},onError:e=>u(e.message,{tone:`danger`})}),S=JSON.stringify(f)!==JSON.stringify(e),C=g.trim()!==``||y.trim()!==``;L(S||C);let w=f.some(e=>e.label.trim()===``||e.text.trim()===``),T=(e,t)=>m(n=>n.map(n=>n.id===e?{...n,...t}:n)),E=(e,t)=>m(n=>n.map(n=>{if(n.id!==e)return n;let r=n.skills??[],i=r.includes(t)?r.filter(e=>e!==t):[...r,t],{skills:a,...o}=n;return i.length>0?{...o,skills:i}:o})),D=e=>m(t=>t.filter(t=>t.id!==e));return(0,G.jsx)(`div`,{"data-slot":`prompt-templates-section`,"data-reports-dirty":``,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:(0,G.jsxs)(Y,{title:`Reusable instructions`,hint:`Insert templates from task composers, or apply them automatically with selected skills when the prompt is empty.`,children:[(0,G.jsx)(`div`,{"data-slot":`prompt-template-list`,className:`flex flex-col gap-3`,children:f.length===0?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-empty`,className:`text-[13px] text-soft-foreground`,children:`No templates. Add one below, or reset to the built-ins.`}):f.map(e=>(0,G.jsxs)(`div`,{"data-slot":`prompt-template-row`,"data-template":e.id,className:`flex flex-col gap-1.5 rounded-md border border-border bg-card p-3`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`label`,{htmlFor:`template-label-${e.id}`,className:U,children:`Template label`}),(0,G.jsx)(P,{id:`template-label-${e.id}`,"aria-label":`Label for ${e.label||`this template`}`,"data-slot":`prompt-template-label-input`,value:e.label,maxLength:80,onChange:t=>T(e.id,{label:t.target.value}),className:`flex-1 border-border bg-background`})]}),(0,G.jsx)(`label`,{htmlFor:`template-text-${e.id}`,className:U,children:`Instructions`}),(0,G.jsx)(z,{id:`template-text-${e.id}`,"aria-label":`Text for ${e.label||`this template`}`,"data-slot":`prompt-template-text-input`,value:e.text,maxLength:2e3,onChange:t=>T(e.id,{text:t.target.value}),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,G.jsx)(`p`,{className:U,children:`Apply automatically with skills`}),(0,G.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,G.jsx)(J,{label:e.label,skills:n.data??[],skillUsage:r.data?.skillUsage,selected:e.skills??[],onToggle:t=>E(e.id,t)}),(e.skills??[]).map(t=>(0,G.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skill-chip`,"data-skill":t,title:`Stop applying “${e.label}” automatically with ${t}`,onClick:()=>E(e.id,t),className:`inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 font-mono text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[t,(0,G.jsx)(h,{"aria-hidden":`true`,className:`size-3`})]},t))]}),(0,G.jsxs)(v,{type:`button`,className:`self-start`,variant:`danger-ghost`,size:`sm`,"data-action":`prompt-template-remove`,title:`Remove this template`,onClick:()=>D(e.id),children:[(0,G.jsx)(p,{"aria-hidden":`true`,className:`size-3`}),`Delete template`]})]},e.id))}),(0,G.jsxs)(`div`,{"data-slot":`prompt-template-new`,className:`flex flex-col gap-1.5 rounded-md border border-dashed border-border p-3`,children:[(0,G.jsx)(`h3`,{className:`text-lg`,children:`New template`}),(0,G.jsx)(`label`,{htmlFor:`new-template-label`,className:U,children:`Label`}),(0,G.jsx)(P,{id:`new-template-label`,"aria-label":`New template label`,"data-slot":`prompt-template-new-label`,placeholder:`e.g. Review security`,value:g,maxLength:80,onChange:e=>_(e.target.value),className:`border-border bg-background`}),(0,G.jsx)(`label`,{htmlFor:`new-template-text`,className:U,children:`Instructions to insert`}),(0,G.jsx)(z,{id:`new-template-text`,"aria-label":`New template text`,"data-slot":`prompt-template-new-text`,placeholder:`Enter reusable instructions…`,value:y,maxLength:2e3,onChange:e=>b(e.target.value),className:`min-h-14 rounded-md border border-border bg-background text-[13px]`}),(0,G.jsxs)(v,{type:`button`,variant:`outline`,size:`sm`,"data-action":`prompt-template-add`,disabled:!g.trim()||!y.trim(),onClick:()=>{let e=g.trim(),t=y.trim();!e||!t||(m(n=>[...n,{id:R(),label:e,text:t}]),_(``),b(``))},className:`self-start`,children:[(0,G.jsx)(d,{"aria-hidden":`true`,className:`size-3.5`}),`Add template`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(H,{show:!S&&!w&&!x.isPending,children:(0,G.jsx)(v,{type:`button`,variant:`primary`,size:`sm`,"data-action":`prompt-templates-save`,disabled:!S||w||x.isPending,onClick:()=>x.mutate(f),children:`Save`})}),(0,G.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,"data-action":`prompt-templates-reset`,disabled:x.isPending,onClick:()=>m(N.map(e=>({...e}))),children:`Reset to defaults`}),w?(0,G.jsx)(`p`,{"data-slot":`prompt-templates-invalid`,className:`text-xs text-danger`,children:`Every template needs both a label and text.`}):null]})]})})}function J({label:e,skills:t,skillUsage:n,selected:i,onToggle:a}){let[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),u=(0,W.useRef)(null),{mostUsed:d,project:f,global:p,ranked:h}=j(t,c,n),v=(e,t)=>{let n=i.includes(e.id);return(0,G.jsxs)(w,{value:O(e),keywords:A(e.name,e.description),"data-slot":`prompt-template-skill-option`,"data-skill":e.id,"data-selected":n?`true`:void 0,onSelect:()=>a(e.id),children:[(0,G.jsx)(F,{skill:e,emphasized:t}),n?(0,G.jsx)(m,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},O(e))};return(0,G.jsxs)(x,{open:o,onOpenChange:e=>{s(e),e||l(``)},children:[(0,G.jsx)(y,{asChild:!0,children:(0,G.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-skills-trigger`,"aria-label":`Apply ${e||`this template`} automatically with a skill`,title:`Pick the skills this template applies itself to`,className:r(`inline-flex h-[26px] shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,i.length>0&&`text-foreground`),children:[(0,G.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`Add skill`,(0,G.jsx)(g,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,G.jsx)(b,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,G.jsxs)(D,{shouldFilter:!1,children:[(0,G.jsx)(S,{placeholder:`search skills…`,value:c,onValueChange:l,onInput:()=>u.current?.scrollTo(0,0)}),(0,G.jsxs)(E,{ref:u,"data-slot":`prompt-template-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.trim()&&!t.some(e=>e.id===c.trim())?(0,G.jsx)(C,{children:(0,G.jsxs)(w,{value:`typed-skill`,onSelect:()=>a(c.trim()),children:[`Use skill id “`,c.trim(),`” (unchecked)`]})}):null,(h?h.length===0:d.length===0&&f.length===0&&p.length===0)?(0,G.jsx)(T,{children:`Nothing matches.`}):null,h?h.length>0?(0,G.jsx)(C,{children:h.map(e=>v(e,k(e)))}):null:(0,G.jsxs)(G.Fragment,{children:[d.length>0?(0,G.jsx)(C,{heading:`Most used`,children:d.map(e=>v(e,k(e)))}):null,f.length>0?(0,G.jsx)(C,{heading:`Project skills`,children:f.map(e=>v(e,!0))}):null,p.length>0?(0,G.jsx)(C,{heading:`Global`,children:p.map(e=>v(e,!1))}):null]})]})]})})]})}function Y({title:e,hint:t,children:n}){return(0,G.jsxs)(`section`,{className:`settings-field flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:e}),(0,G.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:t})]}),n]})}export{K as PromptTemplatesSection};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{c as n,o as r}from"./utils-DSMR_WLb.js";import{$t as i,At as a,Bn as o,Br as s,C as c,Ct as l,D as u,Di as d,E as f,Et as p,F as m,Fi as h,Fn as g,G as _,Gt as v,In as y,J as ee,Jt as te,K as ne,Kr as re,Kt as ie,Ln as ae,Mi as oe,N as se,Nt as ce,O as le,Q as ue,Qt as de,Rn as fe,Rr as pe,Rt as me,S as he,Si as ge,Sr as _e,St as ve,T as ye,Tt as be,U as xe,Ut as Se,Vn as Ce,Vr as we,Vt as Te,W as Ee,Wt as De,X as Oe,Xt as ke,Yt as Ae,Z as je,Zt as Me,_n as Ne,_r as Pe,_t as Fe,a as Ie,ai as Le,an as Re,b as ze,bt as Be,ci as Ve,di as He,dn as Ue,dt as We,fi as Ge,fn as Ke,gi as qe,gn as Je,gt as Ye,h as Xe,hi as b,ht as Ze,ii as x,in as Qe,j as $e,ji as et,jt as tt,ki as nt,kt as rt,li as it,ln as at,m as ot,mn as st,mt as ct,n as lt,nn as ut,oi as dt,on as ft,ot as pt,pn as mt,q as ht,qr as gt,qt as _t,ri as vt,rn as yt,si as bt,ti as xt,tn as St,ui as Ct,un as wt,v as Tt,vi as Et,vn as Dt,vt as Ot,w as kt,wi as At,wt as jt,x as Mt,xt as Nt,y as Pt,yi as Ft,yn as It,yt as Lt,zn as Rt,zt}from"./toaster-fWyfEGWF.js";import{A as Bt,B as S,F as C,H as w,I as T,N as E,P as D,W as O,Z as k,a as Vt,j as A,z as j}from"./live-protocol-DMhTnCmf.js";function Ht(e,t){return e??t}function Ut(e,t){let n=Ht(e,t);return n===`1`||n===`true`}function Wt(e,t,n){return e?.trim()||Ht(t,n)||``}var Gt=class extends Et{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Kt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Ft({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),k.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Kt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qt=class extends h{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),et(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ge(t.mutationKey)!==ge(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Kt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){k.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Jt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Yt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Xt=class extends h{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!et(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Jt(e,n).forEach(e=>{e.destroy()}),Jt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=nt(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new qe(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Yt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=b(n),i=Ge(),a=He(),o=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{Le(e);let t=r.getQueryCache().get(e.queryHash);Ve(e,a,t)}),Ct(a);let[s]=M.useState(()=>new Xt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),f=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>f?s.subscribe(k.batchCalls(e)):d,[s,f]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let p=c.some((e,t)=>bt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&bt(n,e)?dt(n,new qe(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let m=c.find((e,t)=>{let n=o[t];return n&&it({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(m?.error)throw m.error;return l(u())}function P(e,t){let n=b(t),[r]=M.useState(()=>new qt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(k.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(d)},[r]);if(i.error&&oe(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function F(e={}){let t=e.projectId??n();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function I(e,t={}){return{...F(t),runId:e}}function Zt(e,t=!0,n=!1,r){return x({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>a(F({projectId:e,boot:n}),{signal:t}),enabled:t,...r?{select:r}:{},placeholderData:(t,r)=>n&&r?.queryKey[0]===e?t:void 0})}function L(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:G.models(t),refetchType:n})}function Qt(e,t=!0,n){return x({...$t(e,n),enabled:t})}var $t=(e,t)=>({queryKey:G.models(e,t),queryFn:({signal:n})=>Ce(e,{signal:n},t),staleTime:300*1e3});function en(e,t=!0){let n=N({queries:e.map(e=>({...$t(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function tn(e,t){return JSON.stringify([e,t])}function nn(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function rn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var an=class{runs;copied=!1;positions=new Map;constructor(e){this.runs=e,this.reindex()}reindex(){this.positions.clear(),this.runs.forEach((e,t)=>this.positions.set(tn(e.projectId,e.id),t))}at(e,t){return this.positions.get(tn(e,t))??-1}mutable(){return this.copied||=(this.runs=[...this.runs],!0),this.runs}replace(e,t){return this.mutable()[e]=t,this.runs}remove(e){return this.mutable().splice(e,1),this.reindex(),this.runs}insert(e){let t=this.runs.findIndex(t=>(t.createdAt??``).localeCompare(e.createdAt)<0);return this.mutable().splice(t<0?this.runs.length:t,0,e),this.reindex(),this.runs}};function on(e,t,n){let r=new an(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=fn(i,e.project,e.usage,r);else{let t=ln(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function sn(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function cn(e,t,n){return ln(e,t,n,new an(e.runs))}function ln(e,t,n,r){let{project:i}=t,a=r.at(i,nn(t)),o=a>=0?e.runs[a]:void 0,s=e.truncated.includes(i);if(t.type===`deleted`)return o?{index:R(e,r.remove(a)),reconcile:s&&o.archived}:{index:e,reconcile:!1};let{run:c}=t;if(c.delegation?.role===`worker`)return o?{index:R(e,r.remove(a)),reconcile:!1}:{index:e,reconcile:!1};if(!o&&!sn(e,i,n))return{index:e,reconcile:!0};let l=nt(o,{projectId:i,...c});if(o){if(l===o)return{index:e,reconcile:!1};let t=r.replace(a,l),n=o.archived!==l.archived&&(s||rn(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return dn(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&rn(u,i)>e.perProjectLimit}}function un(e,t){let n;for(let r of e)r.projectId===t&&r.archived&&(n===void 0||r.createdAt<n)&&(n=r.createdAt);return n}function dn(e,t,n){let r=un(e.runs,t.projectId),i=r!==void 0&&t.createdAt>r;return t.archived&&!i?{index:e,reconcile:!1}:{index:R(e,n.insert(t)),reconcile:t.archived||r===void 0||t.createdAt<r}}function fn(e,t,n,r){let i=!1;return e.runs.forEach((e,a)=>{if(e.projectId!==t)return;let o=n[e.id];if(o){let t=nt(e.usage,o);if(t===e.usage)return;r.replace(a,{...e,usage:t})}else{if(e.usage===void 0)return;let{usage:t,...n}=e;r.replace(a,n)}i=!0}),i?R(e,r.runs):e}function pn(e,t){let n=e.runs.filter(e=>e.projectId!==t),r=e.truncated.filter(e=>e!==t),i=Object.prototype.hasOwnProperty.call(e.referenceStatuses,t);if(n.length===e.runs.length&&r.length===e.truncated.length&&!i)return e;let a={...e.referenceStatuses};return delete a[t],{...e,runs:n,truncated:r,referenceStatuses:a}}function mn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function hn(e,t,n){if(e.lastStream===t)e.floor=Math.max(e.floor??n,n);else{for(let[n,r]of e.changes)r.generation!==t&&e.changes.delete(n);e.floor=n}e.stream=t,e.lastStream=t,e.mismatch=void 0}function gn(e){e.stream=void 0}function _n(e,t,n=!1){let r=e.stream;if(r===void 0)return!1;(e.floor===void 0||n)&&(e.floor=t.seq-1);let i=JSON.stringify([r,t.project,nn(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function vn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function yn(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function bn(e,t,n){if(!yn(t))return{index:t,reconcile:!1};let{generation:r,eventSeq:i}=t;if(e.stream!==void 0&&e.stream!==r){let n=e.mismatch!==r;return e.mismatch=r,{index:t,reconcile:n}}let a=e.lastStream===r&&e.floor!==void 0,o=a&&i<e.floor,s=t,c=o,l=[...e.changes.entries()].filter(([,e])=>e.generation===r),u=l.map(([,e])=>e).filter(e=>e.seq>i).sort((e,t)=>e.seq-t.seq);for(let e of u){let t=cn(s,e,n);s=t.index,c||=t.reconcile}for(let[t,n]of l)n.seq<=i&&e.changes.delete(t);return a&&!o&&(e.floor=i),{index:s,reconcile:c}}var z=[`workspace`,`runs-index`],xn=[`workspace`,`projects`],Sn=6e4,Cn=100,wn=new WeakMap;function Tn(e){let t=wn.get(e);return t||(t=An(e),wn.set(e,t)),t}function En(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:Tn(t).merge(e)}function Dn(e){let t=e.getQueryData(xn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function On(e,t,n){if(!(!e||typeof e.eventSeq!=`number`||typeof t.eventSeq!=`number`))return e.generation===t.generation?t.eventSeq<e.eventSeq?e:void 0:n!==void 0&&e.generation===n&&t.generation!==n?e:void 0}function kn(e,t){return t.type===`run-summary`?{type:`run`,project:e,seq:t.seq,run:t.summary}:{type:`deleted`,project:e,seq:t.seq,id:t.id}}function An(e){let t=mn(),n=[],r,i,a,o,s=!1,c=-1/0,l=new Set,u=!1,d,f=!1,p=()=>{if(!u){if(u=!0,d?.()){f=!0;return}_({hold:!0})}},m=t=>{c=Date.now(),e.setQueryData(z,t)},h=()=>e.getQueryData(z),g=()=>{clearTimeout(a),a=void 0;let t=e.getQueryCache().find({queryKey:z,exact:!0}),n=(t!==void 0&&t.state.data===void 0&&t.state.fetchStatus!==`idle`?e.cancelQueries({queryKey:z,exact:!0}).then(()=>e.invalidateQueries({queryKey:z})):e.invalidateQueries({queryKey:z})).catch(()=>void 0).finally(()=>{o===n&&(o=void 0,s&&(s=!1,g()))});return o=n,n},_=(e={})=>o?(s=!0,o):e.hold?(a??=setTimeout(()=>{g()},400),Promise.resolve()):g(),v=()=>{r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0;let t=n;n=[];let a=h();if(!a||t.length===0)return;let o=Dn(e),{index:s,reconcile:c}=on(a,t.filter(e=>e.generation===a.generation?e.type===`usage`?!l.has(e.project):!l.has(e.change.project)&&e.change.seq>a.eventSeq:!1),o);s!==a&&m(s),c&&_({hold:!0})},y=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,Cn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){hn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){gn(t)},run(e,r,i=!1){if(l.has(e))return;let a=kn(e,r);if(!_n(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),y()},usage(e,r){if(!l.has(e)){if(t.stream===void 0){p();return}n.push({type:`usage`,project:e,usage:r,generation:t.stream}),y()}},dropProject(e){l.add(e),vn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=pn(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=bn(t,n,Dn(e));for(let e of l)i.index=pn(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),On(r,n,t.stream)??i.index},reconcile:_,flush:v,stop(){r!==void 0&&typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(r),r=void 0,clearTimeout(i),i=void 0,clearTimeout(a),a=void 0,n=[],s=!1}}}var jn=A([`own`,`provider-spanning`]),Mn=S({suggested:E(S({id:O(),label:O(),desc:O()})),retired:E(O())}),Nn=S({id:A([`settings`,`mcp`,`memory`]),label:O(),note:O().optional(),empty:O().optional(),showsUserMcp:T(!0).optional()}),Pn=S({label:O(),note:O().optional(),groups:E(Nn)}),Fn=S({runners:E(S({id:xt,displayName:O(),modelListName:O(),modelIdScope:jn,pickerLabel:O(),pickerDescription:O(),icon:O(),installHint:O(),loginCommand:O(),terminalLogin:D().optional(),browserLogin:D().optional(),managedInstall:T(!0).optional(),accountFolderExample:O().optional(),models:Mn,agentConfig:Pn}))}),In=[`workspace`,`runners`];async function Ln(e){return o(await y.api.v1.runners.$get({},ae(e)),`/runners`,Fn)}var Rn={queryKey:In,queryFn:({signal:e})=>Ln({signal:e}),staleTime:1/0};function zn(){return x(Rn)}function Bn(e){return e?.runners??[]}function Vn(e){return Bn(e).map(e=>e.id)}function Hn(e,t){if(e!==void 0)return t.includes(e)?e:t[0]}function Un(e){let t=zn();return{runner:t.isSuccess?Hn(e,Vn(t.data))??e:e,ready:!t.isPending}}function B(e,t){return e?.runners.find(e=>e.id===t)}function Wn(e,t){return B(e,t)?.displayName??t}function Gn(e,t){return B(e,t)?.pickerLabel??t}function Kn(e,t){return B(e,t)?.modelListName}function qn(e,t,r=!0){let i=Ii(),a=Ur(),{runner:o,ready:s}=Un(e??i.data?.defaultRunner??`claude`),c=a.data?.capabilities?.localHandoff===!1?null:t,l=n(),u=x({queryKey:W.runnerSkills(o,c),queryFn:({signal:e})=>kt(o,c,{signal:e,projectId:l}),enabled:r&&s&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...u,runner:o,account:c,data:u.data?.skills,list:u.data,unchecked:u.isError||!u.data||u.data.source===`unavailable`}}var Jn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},Yn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function Xn(e){return typeof e==`string`&&Object.hasOwn(Jn,e)}function Zn(e){return e!==void 0&&Xn(e)?Jn[e]:void 0}var Qn=`cez.reference-statuses.v1`,$n=`cez.reference-conflicts.v1`,V=new Map(rr()),er=1e3;function tr(e,t){if(V.get(e)!==t){for(V.delete(e),V.set(e,t);V.size>er;){let e=V.keys().next().value;if(e===void 0)break;V.delete(e)}or()}}var H=new Set(ir());function nr(e,t){if(H.has(e)!==t){if(t)for(H.add(e);H.size>er;){let e=H.values().next().value;if(e===void 0)break;H.delete(e)}else H.delete(e);or()}}function rr(){try{let e=globalThis.sessionStorage?.getItem(Qn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&Xn(e[1])):[]}catch{return[]}}function ir(){try{let e=globalThis.sessionStorage?.getItem($n);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var ar;function or(){ar===void 0&&(ar=setTimeout(()=>{ar=void 0;try{globalThis.sessionStorage?.setItem(Qn,JSON.stringify([...V])),globalThis.sessionStorage?.setItem($n,JSON.stringify([...H]))}catch{}},250))}var U=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function sr(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function cr(e){return[...e.prs.map(t=>({projectId:e.projectId,kind:`PR`,number:t})),...e.issues.map(t=>({projectId:e.projectId,kind:`Issue`,number:t}))]}function lr(e,t,n,r,i,a){let o=r.prs[n.number]??r.issues[n.number];if(!o){e.set(t,{state:`unknown`,...i?{status:i}:{}});return}let s=r.conflicts?r.conflicts.includes(n.number):void 0;tr(t,o),s!==void 0&&nr(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function ur(e,t,n){let r=U(t),i=V.get(r),a=H.has(r)?!0:void 0,o=n.data;if(o?.available){lr(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...sr(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...sr(i,a)});return}e.set(r,{state:`loading`,...sr(i,a)})}function dr(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of cr(i))ur(n,e,t)}),n}var W={get health(){return[n(),`health`]},runs:{get all(){return[n(),`runs`]},relationships:e=>[n(),`runs`,`relationships`,e],list:(e=n())=>[e,`runs`,`list`],archived:e=>[n(),`runs`,`archived`,e],detail:(e,t=n())=>[t,`runs`,`detail`,e],diff:e=>[n(),`runs`,`diff`,e],changes:e=>[n(),`runs`,`changes`,e],file:(e,t)=>[n(),`runs`,`files`,e,t],handoff:e=>[n(),`runs`,`handoff`,e],commits:e=>[n(),`runs`,`commits`,e],commit:(e,t)=>[n(),`runs`,`commit`,e,t]},get workflows(){return[n(),`workflows`]},runnerSkills:(e,t)=>[n(),`runner-skills`,e,t??null],get repo(){return[n(),`repo`]},get repoChanges(){return[n(),`repo`,`changes`]},repoCommit:e=>[n(),`repo`,`commit`,e],get repoBranches(){return[n(),`repo`,`branches`]},get uiState(){return[n(),`ui-state`]},get config(){return[n(),`config`]},get agentConfig(){return[n(),`agent-config`]},agentConfigFile:e=>[n(),`agent-config`,`file`,e],get sessionContext(){return[n(),`session-context`]},sessionContextPreview:(e,t,r=``)=>[n(),`session-context`,`preview`,t,e,r],get worktrees(){return[n(),`worktrees`]},github:(e={})=>[n(),`github`,e.limit??null],githubPages:e=>[n(),`github`,`pages`,e],githubPagesHead:e=>[n(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[n(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[n(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[n(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[n(),`github`,`comments`,e,t],githubItem:(e,t)=>[n(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[n(),`github`,`pr-changes`,e],githubMergeState:e=>[n(),`github`,`merge-state`,e],get openTargets(){return[n(),`open-targets`]}},G={models:(e,t)=>t&&t!=="default"?[`workspace`,`models`,e,t]:[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:z,runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...G.fsBrowseRoot,e,t]};function fr(){return Ut(void 0,void 0)}function K(e){return!fr()&&e}function pr(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function mr(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function hr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function gr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function _r(e,t){return gt({kind:`topic`,topic:e},{value:t})}function vr(){let e=b();return x({queryKey:G.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(G.providerStatus),r=await Qe(!1,{signal:t});return _e(n,e.getQueryData(G.providerStatus),r)},staleTime:5*6e4,refetchInterval:K(!1),refetchOnWindowFocus:!0})}function yr(){let e=b();return P({mutationFn:()=>Qe(!0),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>_e(r,e,t)),L(e)}})}function br(){let e=b();return P({mutationFn:({provider:e,authFailureId:t})=>mt(e,t),onMutate:()=>e.getQueryData(G.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(G.providerStatus,e=>_e(r,e,t,n.authFailureId)),L(e,n.provider)}})}function xr(e={}){return x({queryKey:G.projects,queryFn:({signal:e})=>yt({signal:e}),...e})}function Sr(e,t=!1){return x({queryKey:G.fsBrowse(e,t),queryFn:({signal:n})=>ie(e??void 0,{signal:n,showHidden:t}),retry:!1})}function Cr(){let e=b();return P({mutationFn:e=>at(e),onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function wr(){let e=b();return P({mutationFn:e=>Ue(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:G.projects})}})}function Tr(){let e=b();return P({mutationFn:e=>{let{id:t,...n}=e;return Dt(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:G.projects});let r=e.getQueryData(G.projects);return e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?Er(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(G.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(G.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:G.projects})})}function Er(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:gr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function Dr(e){let t=b();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(G.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:G.projects})})}function Or(){return Dr(e=>{let{projectId:t,...n}=e;return Me(t,n)})}function kr(){return Dr(e=>{let{projectId:t,webhookId:n,...r}=e;return It(t,n,r)})}function Ar(){return Dr(({projectId:e,webhookId:t})=>Ke(e,t))}function jr(){return P({mutationFn:({projectId:e,webhookId:t})=>Je(e,t),retry:!1})}function q(e){let t=b();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:G.agentProfiles}),t.invalidateQueries({queryKey:G.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])},onError:()=>{t.invalidateQueries({queryKey:W.health}),t.invalidateQueries({queryKey:G.agentProfiles,exact:!0})}})}function Mr(){return q(e=>Ae(e))}function Nr(){return q(e=>{let{id:t,...n}=e;return Ne(t,n)})}function Pr(){return q(e=>wt(e))}function Fr(){return q(e=>st(e))}function Ir(e,t){return x({queryKey:G.agentAccountStatus(e),queryFn:({signal:t})=>de(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Lr(){let e=b();return P({mutationFn:({provider:e,profileId:t})=>te(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:G.agentProfiles}),e.invalidateQueries({queryKey:G.providerStatus}),L(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:W.health}),e.invalidateQueries({queryKey:G.agentProfiles,exact:!0})}})}function Rr(){let e=b();return P({mutationFn:e=>de(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(G.agentAccountStatus(n),t),e.invalidateQueries({queryKey:G.agentProfiles}),L(e,t.status.provider)}})}function zr(){let e=b();return P({mutationFn:e=>_t(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Br(){let e=b();return P({mutationFn:e=>ke(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:G.projects})})}function Vr({enabled:e}){return x({queryKey:G.githubOwners,queryFn:({signal:e})=>St({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Hr(){let e=b();(0,M.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(W.health);n&&(s({bootProject:n.bootProject??`default`,apiBase:r()}),t??=_r(`health`,t=>{e.setQueryData(W.health,t)}))};n();let i=e.getQueryCache().subscribe(n);return()=>{i(),t?.(),re()}},[e])}function Ur(){return x({queryKey:W.health,queryFn:({signal:e})=>ut({signal:e})})}function Wr(e,t){let n=Ur().data,r=xr(t).data?.projects,i=Ie(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?pr(n?.repo?.remote):void 0}function Gr(){return x({queryKey:G.uiState,queryFn:({signal:e})=>ft({signal:e})})}function Kr(){return x({queryKey:G.config,queryFn:({signal:e})=>Re({signal:e})})}function qr(){return x({queryKey:G.agentProfiles,queryFn:({signal:e})=>i({signal:e})})}var J=[`workspace`,`runs-index`],Y=e=>[e.cacheScope,`runs`,`list`],X=e=>[e.cacheScope,`runs`,`detail`,e.runId],Z=e=>typeof e==`function`?e():e;function Jr(e){let{seenAt:t,...n}=e;return n}function Yr(e,t){let n=Jr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function Xr(e,t,n){return t?{...e,seenAt:n}:Jr(e)}function Zr(e){let t=()=>{e.invalidateQueries({queryKey:J})};function r(r,i){if(r===`index`)return t();let a=typeof i==`function`?i():i;if(r===`indexed`){t(),e.invalidateQueries({queryKey:[n(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(r===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=we(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,n()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:Y(Z(n))}),await e.cancelQueries({queryKey:X(Z(n))});let i=e.getQueryData(Y(Z(n))),a=e.getQueryData(X(Z(n))),o=Z(n).runId,s=new Date().toISOString();return e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Xr(e,r,s):e)),e.setQueryData(X(Z(n)),e=>e&&Xr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(Y(Z(n)),i),a&&e.setQueryData(X(Z(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(Y(Z(n)),e=>e?.map(e=>e.id===o?Yr(e,t):e)),a&&e.setQueryData(X(Z(n)),e=>e&&Yr(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?Xr(e,r,i.seenAt):e;e.setQueryData(Y(Z(n)),e=>e?.map(a));let s={...Z(n),runId:r?o:i.id};e.setQueryData(X(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:J});let i=e.getQueryData(J),a=n();return e.setQueryData(J,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(J,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function Q(){let e=b();return(0,M.useMemo)(()=>Zr(e),[e])}function Qr(e,t){if(!Vt(e.path))throw Error(`unsupported shared read`);let n=new URL(e.path,`http://cezar.invalid`);return n.searchParams.sort(),gt({kind:`read`,path:`${n.pathname}${n.search}`,intervalMs:e.intervalMs},{value:t})}function $(e,t,n,r){let i=b(),a=JSON.stringify(t),o=(0,M.useMemo)(()=>JSON.parse(a),[a]);(0,M.useEffect)(()=>{if(!e||n===!1)return;let t=!0,a=Qr({path:e,intervalMs:n},(e,n)=>{n||i.cancelQueries({queryKey:o,exact:!0}).then(()=>{t&&i.setQueryData(o,r?r(e,i):e)})});return()=>{t=!1,a()}},[i,e,o,n,r])}async function $r(e,t=!1){return Rt(await y.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:n(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),fe(e,`/worker-destroy`))}function ei(){return x({queryKey:W.openTargets,queryFn:({signal:e})=>Lt({signal:e}),staleTime:5*6e4})}function ti(){return x({queryKey:W.runs.list(),queryFn:({signal:e})=>a(F(),{signal:e})})}function ni(e,t){return vt({queryKey:W.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>ct({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===n()?e:void 0})}function ri(e){let t=e.trim();return x({queryKey:G.runsSearch(t),queryFn:({signal:e})=>Se(t,{signal:e}),enabled:t.length>=2,placeholderData:At,staleTime:1e4})}function ii(e=!0,t=Sn,n){let r=Tn(b());return $(`/api/v1/workspace/runs-index`,G.runsIndex,K(e?t:!1),En),x({queryKey:G.runsIndex,queryFn:({signal:e})=>tt({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function ai(e){let t=b();return P({mutationFn:({workerId:e,discardWork:t=!1})=>$r(e,t),onSettled:()=>t.invalidateQueries({queryKey:W.runs.relationships(e)})})}function oi(e,t={}){return x({queryKey:W.runs.relationships(e),queryFn:({signal:t})=>rt(e,{signal:t}),enabled:t.enabled??!0})}function si(e){return x({queryKey:W.runs.detail(e??``),queryFn:({signal:t})=>Be(I(e),{signal:t}),enabled:!!e})}function ci(e,t,n=!0,r){return x({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Be(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t,...r?.staleTime===void 0?{}:{staleTime:r.staleTime},...r?.refetchOnMount===void 0?{}:{refetchOnMount:r.refetchOnMount}})}function li(e,t){return x({queryKey:t?[t,`runs`,`diff`,e??``]:W.runs.diff(e??``),queryFn:({signal:n})=>jt(e,{signal:n,...t?{projectId:t}:{}}),enabled:!!e})}function ui(e,t=!1){return $(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,W.runs.changes(e??``),K(t?4e3:!1)),x({queryKey:W.runs.changes(e??``),queryFn:({signal:t})=>Nt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function di(e,t){return x({queryKey:W.runs.file(e??``,t??``),queryFn:({signal:n})=>be(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function fi(e,t){return x({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Ot(e,t,{signal:n}),enabled:t!==null,retry:!1})}function pi(e,t){return x({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>Ze(e,t,{signal:n}),enabled:t!==null,retry:!1})}function mi(e,t){return x({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>Ye(e,t,{signal:n}),enabled:t!==null,retry:!1})}function hi(e){return x({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Fe(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function gi(e,t=!1){return $(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,W.runs.commits(e??``),K(t?5e3:!1)),x({queryKey:W.runs.commits(e??``),queryFn:({signal:t})=>l(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function _i(e,t){return x({queryKey:W.runs.commit(e??``,t??``),queryFn:({signal:n})=>ve(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function vi(e,t=!0){return x({queryKey:W.runs.handoff(e??``),queryFn:({signal:t})=>p(I(e),{signal:t}),enabled:!!e&&t})}function yi(e,t,n){return x({queryKey:e===void 0?W.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>p(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function bi(e,t){let r=[...new Set(e)],i=N({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>Tt({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,M.useMemo)(()=>{let e=new Map;return a.forEach((t,n)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([r[n]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([r,i.map(e=>e.dataUpdatedAt)])])}function xi(e){let t=b();return P({mutationFn:t=>ce(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Si(e){let t=b();return P({mutationFn:t=>me(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Ci(e){let t=Q(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>v(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,M.useCallback)(e=>({...I(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,M.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,M.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,M.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function wi(){let e=Q();return P({mutationFn:e=>v(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function Ti(e){let t=Q();return P({mutationFn:({id:t,pinned:n})=>zt(I(t,e),n),onError:e=>lt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ei(e,t){let n=Q();return P({mutationFn:n=>De(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof g&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function Di(e,t){let n=Q();return P({mutationFn:(n={})=>pt(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Oi(e){let t=b();return P({mutationFn:({msgId:t,message:n})=>We(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function ki(e){let t=b();return P({mutationFn:t=>Te(e,t),onSuccess:()=>t.invalidateQueries({queryKey:W.runs.all})})}function Ai(){return x({queryKey:W.workflows,queryFn:({signal:e})=>u({signal:e})})}function ji(e){return x({queryKey:e?[e,`repo`]:W.repo,queryFn:({signal:t})=>ze({signal:t},e)})}function Mi(e){return x({queryKey:[e,`repo`],queryFn:({signal:t})=>ze({signal:t},e)})}function Ni(){return x({queryKey:W.repoBranches,queryFn:({signal:e})=>Mt({signal:e})})}function Pi(){return x({queryKey:W.repoChanges,queryFn:({signal:e})=>he({signal:e}),retry:!1})}function Fi(e){return x({queryKey:W.repoCommit(e??``),queryFn:({signal:t})=>c(e,{signal:t}),enabled:!!e,retry:!1})}function Ii(e){return x({queryKey:e?[e,`config`]:W.config,queryFn:({signal:t})=>Pt({signal:t,...e?{projectId:e}:{}})})}function Li(){return x({queryKey:W.worktrees,queryFn:({signal:e})=>le({signal:e})})}function Ri(e){return x({queryKey:[e,`worktrees`],queryFn:({signal:t})=>le({signal:t},e),staleTime:0})}function zi(e,t=!0,n=!1){return x({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>f({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:pe(e.sidebarLimits)},enabled:t})}function Bi(){return zi(n())}function Vi(){return x({queryKey:W.agentConfig,queryFn:({signal:e})=>ot({signal:e})})}function Hi(e){return x({queryKey:W.agentConfigFile(e??``),queryFn:({signal:t})=>Xe(e,{signal:t}),enabled:e!==null})}function Ui(){return x({queryKey:W.sessionContext,queryFn:({signal:e})=>ye({signal:e})})}function Wi(e,t,n=``){return x({queryKey:W.sessionContextPreview(e,t,n),queryFn:({signal:n})=>$e({content:e,role:t},{signal:n}),placeholderData:At,staleTime:0,retry:!1})}function Gi(){let e=b();return P({onMutate:()=>({fileKey:W.sessionContext}),mutationFn:e=>m(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function Ki(e){let t=b(),n=W.agentConfig,r=W.agentConfigFile(e);return P({mutationFn:t=>se(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var qi=A([`passing`,`failing`,`pending`]).nullable(),Ji=S({kind:A([`issue`,`pr`]),number:j(),title:O(),author:O(),createdAt:O(),labels:E(O()),body:O().optional(),url:O(),comments:j(),assignees:E(O()).optional(),projectIds:E(O()).optional(),isDraft:D().optional(),additions:j().optional(),deletions:j().optional(),checks:qi.optional()});C(`available`,[S({available:T(!0),item:Ji.nullable(),labelColors:w(O(),O()).optional()}),S({available:T(!1),reason:O()})]),S({kind:A([`issue`,`pr`]),number:Bt().int().positive().safe()});var Yi=S({id:O(),title:O(),url:O()});S({available:D(),reason:O().optional(),repo:O().optional(),syncedAt:O().optional(),issues:E(Ji),prs:E(Ji),labelColors:w(O(),O()).optional(),viewerLogin:O().optional(),projects:E(Yi).optional(),projectsReason:O().optional(),projectsState:A([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:O().optional(),issuesTotal:j().int().nonnegative().optional(),prsTotal:j().int().nonnegative().optional(),issuesNextCursor:O().nullable().optional(),prsNextCursor:O().nullable().optional(),commentsDeferred:T(!0).optional()});var Xi=O().min(1).max(2e3).optional();S({limit:O().optional(),refresh:O().optional(),issuesCursor:Xi,prsCursor:Xi,issuesDone:T(`1`).optional(),prsDone:T(`1`).optional()}).superRefine((e,t)=>{e.issuesDone&&e.issuesCursor&&t.addIssue({code:`custom`,message:`issuesDone and issuesCursor are exclusive`}),e.prsDone&&e.prsCursor&&t.addIssue({code:`custom`,message:`prsDone and prsCursor are exclusive`}),e.issuesDone&&e.prsDone&&t.addIssue({code:`custom`,message:`both sides are done; there is no page to ask for`})}),S({kind:A([`issue`,`pr`]),numbers:O().regex(/^[1-9]\d{0,15}(,[1-9]\d{0,15})*$/).refine(e=>{let t=e.split(`,`);return t.length<=100&&t.every(e=>Number.isSafeInteger(Number(e)))},{message:`at most 100 safe positive integers`}),refresh:T(`1`).optional()}),C(`available`,[S({available:T(!0),counts:w(j(),j().int().nonnegative())}),S({available:T(!1),reason:O()})]),C(`available`,[S({available:T(!0),checks:w(j(),qi)}),S({available:T(!1),reason:O()})]),S({kind:A([`issue`,`pr`]),q:O().trim().min(1).max(256),limit:Bt().int().positive().max(50).optional()}),S({available:D(),projectsReason:O().optional(),reason:O().optional(),items:E(Ji),truncated:D().optional(),labelColors:w(O(),O()).optional()});var Zi=j().nullable();C(`available`,[S({available:T(!0),prs:w(j(),Pe),issues:w(j(),Pe),conflicts:E(j()).optional(),recheckAfterMs:Zi}),S({available:T(!1),reason:O(),recheckAfterMs:Zi})]);var Qi=S({id:j(),author:O(),avatarUrl:O().optional(),createdAt:O(),body:O(),kind:A([`comment`,`review`]),reviewState:A([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:O()}),$i=A([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ea=S({id:O(),kind:$i,actor:O(),avatarUrl:O().optional(),createdAt:O(),url:O().optional(),sha:O().optional(),message:O().optional(),checks:qi.optional(),label:S({name:O(),color:O().optional()}).optional(),subject:O().optional(),refNumber:j().optional(),refTitle:O().optional(),refIsPr:D().optional()});S({available:D(),reason:O().optional(),comments:E(Qi),truncated:D().optional(),events:E(ea).optional(),detail:S({body:O(),additions:j().int().nonnegative().optional(),deletions:j().int().nonnegative().optional()}).optional()});var ta=A([`merge`,`squash`,`rebase`]),na=S({name:O(),state:A([`passing`,`failing`,`pending`,`unknown`]),required:D().nullable(),url:O().optional()}),ra=S({number:j(),title:O(),url:O(),state:A([`open`,`closed`,`merged`]),isDraft:D(),headRef:O(),baseRef:O(),headSha:O(),mergeable:A([`mergeable`,`conflicting`,`unknown`]),reviewDecision:A([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:E(na),methods:E(ta),defaultMethod:ta.nullable(),eligibility:A([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:E(S({code:O(),message:O()})),canMerge:D(),canOverride:D()});C(`available`,[S({available:T(!0),mergeState:ra}),S({available:T(!1),reason:O()})]),S({merged:T(!0),number:j(),url:O(),method:ta,mergeCommitSha:O().optional()});var ia=S({path:O(),previousPath:O().optional(),status:A([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:j(),deletions:j(),patch:O().optional(),patchUnavailableReason:A([`binary`,`too-large`,`not-provided`]).optional(),truncated:D().optional()});C(`available`,[S({available:T(!0),number:j(),headSha:O(),files:E(ia),additions:j(),deletions:j(),truncated:D(),reason:O().optional()}),S({available:T(!1),reason:O()})]),S({generation:O().uuid()}),C(`state`,[S({generation:O().uuid(),state:T(`ready`),projects:E(Yi),membership:w(O(),E(O()))}),S({generation:O().uuid(),state:T(`unavailable`),reason:O()})]);function aa(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function oa(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function sa(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function ca(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){sa(t.issues,a,r),sa(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:f,projectsReason:p,...m}=t;return{...m,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var la=e=>e.map(e=>e.number).join(`,`);function ua(e,t){let n=e[0];if(e.length>1&&n&&(la(n.issues)!==la(t.issues)||la(n.prs)!==la(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}function da(e={},t=!0){let r=b(),i=W.github(e);$(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,K(t?6e4:!1));let a=x({queryKey:W.github(e),queryFn:({signal:t})=>xe({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),o=a.data?.projectsGeneration,s=x({queryKey:[...i,`projects`,o],queryFn:({signal:e})=>Oe(o,{signal:e}),enabled:t&&a.data?.projectsState===`refreshing`&&!!o,staleTime:1/0,retry:!1});return(0,M.useEffect)(()=>{!o||!s.data&&!s.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==o||e.projectsState!==`refreshing`)return e;let t=s.data;return t?.generation&&t.generation!==o?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[r,o,s.data,s.error,i]),a}var fa=class extends Error{};function pa(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await xe({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new fa(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>aa(e),retry:(e,t)=>!(t instanceof fa)&&!(t instanceof g&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function ma(e=50,t=!0){let r=b(),i=W.githubPages(e),a=W.githubPagesHead(e);$(`/api/v1/p/${n()}/github?limit=${e}`,a,K(t?6e4:!1));let o=vt({...pa(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),s=x({queryKey:a,queryFn:({signal:t})=>xe({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:c}=o;(0,M.useEffect)(()=>{if(!s.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=ua(e.pages,s.data);t===`refetch`?c():r.setQueryData(i,{...e,pages:t})},[r,s.dataUpdatedAt,c]);let l=(o.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),u=N({queries:l.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>Oe(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{u.forEach((e,t)=>{let n=l[t];!n||!e.data&&!e.error||r.setQueryData(i,t=>{if(!t)return t;let r=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==n||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==n?t:(r=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return r?{...t,pages:i}:t})})},[r,u.map((e,t)=>e.data||e.error?l[t]:``).join(`,`)]),{pages:o,data:(0,M.useMemo)(()=>ca(o.data?.pages??[]),[o.data])}}function ha(e,t=50,n=!0){let r=vt({...pa([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>ca(r.data?.pages??[]),[r.data])}}function ga(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:W.githubCommentCounts(e,t),queryFn:({signal:n})=>_(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,M.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function _a(e,t,n,r=!0){return x({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>ue(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function va(e,t=!0){return x({queryKey:W.githubChecks(e),queryFn:({signal:t})=>Ee(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function ya(e,t,n=!0){return x({queryKey:W.githubSearch(e,t),queryFn:({signal:n})=>ue(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var ba=100;function xa(e){return[...e].sort((e,t)=>t-e).slice(0,ba).sort((e,t)=>e-t)}function Sa(){let e=Ie(),t=Ur();return e.projectId??t.data?.bootProject}function Ca(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))tr(U({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))tr(U({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var wa=5*6e4;function Ta(e){return e?e.recheckAfterMs:wa}function Ea(e,t=!0){let n=(0,M.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:xa(t.prs),issues:xa(t.issues)}))},[e.map(U).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:W.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>je(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>Ta(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),i=b(),a=JSON.stringify(n.map((e,t)=>({...e,interval:Ta(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||fr())return;let e=!0,n=JSON.parse(a).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=W.githubRefStatus(t.projectId,t.prs,t.issues);return Qr({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,a,i]);let o=(0,M.useMemo)(()=>dr(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=U(e),n=o.get(t);if(n)return n;let r=V.get(t);return{state:`idle`,...r?{status:r}:{},...H.has(t)?{conflicting:!0}:{}}},[o])}function Da(e,t,n=!0){return x({queryKey:W.githubComments(e,t),queryFn:({signal:n})=>ne(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function Oa(e,t,n=!0){return x({queryKey:W.githubItem(e,t),queryFn:({signal:n})=>ht(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ka(e){return x({queryKey:W.githubPrChanges(e??0),queryFn:({signal:t})=>ee(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{li as $,Vn as $t,Ai as A,br as At,fi as B,hr as Bt,ji as C,vr as Ct,Ui as D,Pr as Dt,Fi as E,Cr as Et,hi as F,kr as Ft,Si as G,G as Gt,wi as H,K as Ht,bi as I,Kr as It,ki as J,qn as Jt,Ti as K,Yn as Kt,Di as L,Gr as Lt,ni as M,jr as Mt,pi as N,Nr as Nt,Wi as O,wr as Ot,mi as P,Tr as Pt,gi as Q,B as Qt,ai as R,_r as Rt,Gi as S,xr as St,Pi as T,yr as Tt,xi as U,fr as Ut,Ci as V,pr as Vt,ei as W,W as Wt,ui as X,Wn as Xt,si as Y,Hn as Yt,_i as Z,Bn as Zt,Ii as _,Sr as _t,Da as a,L as an,ri as at,Ri as b,Hr as bt,ka as c,Zt as cn,Qr as ct,_a as d,P as dn,qr as dt,Kn as en,di as et,Sa as f,N as fn,zr as ft,Hi as g,Or as gt,Vi as h,Br as ht,ga as i,Tn as in,ii as it,Li as j,Fr as jt,Bi as k,Ar as kt,ya as l,F as ln,Q as lt,oa as m,Wt as mn,Mr as mt,da as n,Un as nn,oi as nt,Oa as o,en as on,Ei as ot,Ea as p,Gt as pn,Lr as pt,ci as q,Zn as qt,va as r,zn as rn,ti as rt,ma as s,Qt as sn,yi as st,Ca as t,Gn as tn,vi as tt,ha as u,I as un,Ir as ut,Mi as v,Vr as vt,Ni as w,Rr as wt,Ki as x,Wr as xt,zi as y,Ur as yt,Oi as z,mr as zt};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Kt as a,p as o,qt as s}from"./queries-hzlF788B.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as l}from"./tasks-table-D17JLOhe.js";import{F as u,H as d,M as f,N as p,P as m,f as h,g,h as _,m as v,ot as y,p as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{n as S,r as C,t as w}from"./popover-CZV6tz9i.js";var T=x(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E=e(t(),1),D=n(),O=(0,E.createContext)(null);function k({children:e}){let[t,n]=(0,E.useState)(()=>new Map),r=(0,E.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,E.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=o((0,E.useMemo)(()=>[...t.values()].flat(),[t])),s=(0,E.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,D.jsx)(O.Provider,{value:s,children:e})}var A=(0,E.createContext)(null);function j({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,E.useContext)(O),a=(0,E.useContext)(A),s=(0,E.useId)();(0,E.useEffect)(()=>{if(i)return i.publish(s,n),()=>i.retract(s)},[i,s,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=o(i?M:n),l=i?.lookup??c,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,E.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,D.jsx)(A.Provider,{value:d,children:r})}var M=[];function N(e,t,n){let r=(0,E.useContext)(A),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function ee(e,t){let n=(0,E.useContext)(A),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function P(){let e=(0,E.useContext)(A);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),F={success:`border-success/40 text-semantic-green`,danger:`border-danger/40 text-semantic-red`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-semantic-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-semantic-amber`,conflict:`border-conflict/45 text-semantic-conflict`},I={success:`text-semantic-green`,danger:`text-semantic-red`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-semantic-info`,neutral:`text-soft-foreground`,pending:`text-semantic-amber`,conflict:`text-semantic-conflict`},ne={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},re={draft:m,"review-required":u,"changes-requested":d,"checks-pending":null,"checks-failing":g,ready:h,merged:f,closed:p,open:b,completed:h,"not-planned":_};function L(e){return e===`PR`?`pr-chip`:`issue-chip`}function R(e){return e?{"data-conflicting":`true`}:{}}function z(e,t,n,r){return!n||r!==void 0&&l({kind:e,number:t??0,url:n},r)}function B(e,t,n){return e===`PR`&&(t??n)===!0}function V({plain:e,inert:t,conflicting:n,className:r,tone:a}){return e?i(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,r):i(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,F[a],r)}function H(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function U(e){return e===`PR`?`pull request`:`issue`}function W(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function G(e,t){return e&&t?I[t.tone]:void 0}function K(e,t){return!e&&(!t||!r(t))}function q({conflicting:e,presentation:t,status:n,plain:r,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(y,{className:i(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,D.jsx)($,{status:t?n:void 0,className:r?i(`size-2.5`,l):void 0}),r&&a?s===`PR`?(0,D.jsx)(u,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,D.jsx)(b,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,D.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function J({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,D.jsx)(`span`,{"data-slot":L(e),"data-status":t,"data-inert":`true`,...R(n),className:r,children:i})}function Y({kind:e,number:t,tooltip:n,url:i}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,D.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,D.jsx)(`span`,{className:`block text-muted-foreground`,children:n.also}):null,i&&r(i)?(0,D.jsx)(`span`,{className:`block text-muted-foreground`,children:i.replace(/^https?:\/\//,``)}):null]})}function ie({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:o,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=P(),y=N(h,z(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=s(b),S=B(h,r,y.conflicting),C=S?a:x,w=C?.tone??`accent`,T=V({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=le(y,C,S?x:void 0),O=H(h,g,p,f),k=U(h),A=W(k,g,t,C),j=(0,D.jsx)(q,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:O,glyphClass:G(p,C)});if(m)return(0,D.jsx)(J,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=K(u,_)?(0,D.jsx)(`span`,{"data-slot":L(h),"data-status":b,...R(S),"aria-label":C?`${k} ${O} — ${C.label}`:void 0,className:T,children:j}):(0,D.jsx)(ae,{to:u,url:_,"data-slot":L(h),"data-status":b,...R(S),title:E?void 0:_,"aria-label":A,className:p?T:i(T,ne[w]),children:j});return E?(0,D.jsx)(ce,{chip:M,action:S?o:void 0,state:y.state,children:(0,D.jsx)(Y,{kind:h,number:g,tooltip:E,url:_})}):M}function ae({to:e,url:t,children:n,...r}){return e?(0,D.jsx)(c,{to:e,...r,children:n}):(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var X=(0,E.createContext)(()=>{});function oe(){return(0,E.useContext)(X)}var se=150,Z=120;function ce({chip:e,action:t,state:n,children:r}){let[i,a]=(0,E.useState)(!1),o=(0,E.useRef)(null),s=(0,E.useRef)(null),c=(0,E.useRef)(void 0),l=(0,E.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,E.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,E.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,D.jsxs)(w,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,D.jsx)(S,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,se)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},onFocus:()=>a(!0),onBlur:e=>{d(e.relatedTarget)||u()},onKeyDown:e=>{if(e.key===`Escape`)return u();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,D.jsxs)(C,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),d(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},children:[(0,D.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,D.jsx)(X.Provider,{value:u,children:t}):null]})]})}function le(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ue(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ue(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Q({kind:e,number:t,className:n}){let r=N(e,t),o=s(r.status),c=e===`PR`&&r.conflicting===!0,l=c?a:o;if(!l)return null;let u=i(`size-2.5`,I[l.tone]);return(0,D.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":r.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:i(`inline-flex items-center`,n),children:c?(0,D.jsx)(y,{className:i(`shrink-0`,u),"aria-hidden":`true`}):(0,D.jsx)($,{status:r.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,D.jsx)(v,{"data-slot":`status-dot`,"data-tone":`pending`,className:i(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=re[e];return n?(0,D.jsx)(n,{className:i(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{k as a,N as c,j as i,T as l,Q as n,ee as o,oe as r,P as s,ie as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{C as o,E as s,T as c,W as l,Wt as u,dn as d,j as f,n as p,qt as m,rt as h,w as g,xt as _,yt as v}from"./queries-hzlF788B.js";import{Fn as y,It as b,L as x,R as S,ct as C,f as w,hi as T,l as E,n as D}from"./toaster-fWyfEGWF.js";import{Z as O}from"./live-protocol-DMhTnCmf.js";import{g as k,h as A}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as j}from"./tasks-table-D17JLOhe.js";import{A as M,C as N,E as ee,F as P,J as te,M as ne,X as re,Y as ie,at as ae,c as oe,j as se,n as ce,ot as le,s as ue,u as de,v as fe,x as pe}from"./design-icons-CzEoMH9c.js";import{t as me}from"./createLucideIcon-BHp8sXmF.js";import{n as he,t as ge}from"./circle-x-7nTlobAF.js";import{_ as _e}from"./nav-row-styles-D5HpOmDZ.js";import{i as ve,r as ye,t as be}from"./git-toolbar-D22Fx9FV.js";import{t as xe}from"./info-DA1x_4bz.js";import{t as Se}from"./loader-circle-CPBhhDbB.js";import{i as Ce,n as we,r as Te}from"./diff-controls-DY_B9_uk.js";import{c as Ee,i as De,t as Oe}from"./reference-chip-Dgo5aKeb.js";import{t as F}from"./button-B7MKxYjT.js";import{i as I,l as ke,p as Ae,r as je,t as Me}from"./dropdown-menu-4e2iKSMT.js";import{t as L}from"./project-router-B9FTk0rB.js";import{t as Ne}from"./status-dot-BRzVlF2X.js";import{a as Pe,o as Fe}from"./format-BU7D3IfE.js";import{d as Ie,n as Le,o as R,s as Re,t as ze,u as Be}from"./page-shell-7pLJMOgh.js";import{t as z}from"./centered-state-V15AR_qo.js";import{At as Ve,Bt as He,Dn as Ue,E as B,Ft as We,Gt as V,Ht as H,It as U,Jt as W,Kt as G,Lt as Ge,Mn as Ke,Mt as qe,Nn as Je,Nt as Ye,Ot as Xe,Pt as Ze,Rt as Qe,T as $e,Ut as K,Vt as et,Wt as q,Yt as J,Zn as tt,Zt as nt,dr as rt,fn as it,ir as at,jn as ot,jt as st,kt as ct,pr as lt,qt as Y,zt as ut}from"./index-CjcLSwvy.js";import{t as dt}from"./markdown-BBDDg-4t.js";import{t as ft}from"./diff-CWizOg4r.js";import{t as pt}from"./change-counts-npLATh-3.js";import{n as mt,r as ht}from"./commit-list-Cw8yFUN-.js";var X=e(t(),1);function gt(e,t){let n=T(t),r=n.getQueryCache();return X.useSyncExternalStore(X.useCallback(e=>r.subscribe(O.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var _t=me(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),vt=me(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),Z=n();function yt(){let e=r(),t=o(),n=T(),i=gt({queryKey:u.repo})>0,s=t.data?.info?t.data:null,c=Xe(e,s,`screen`);return(0,Z.jsx)(Be,{route:`repo-git`,density:s?.info?`full`:`empty`,headerSpacing:`compact`,header:{title:`Git`,secondaryActions:(0,Z.jsx)(Re,{type:`button`,variant:`ghost`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:u.repo}),n.invalidateQueries({queryKey:u.worktrees})},children:(0,Z.jsx)(ie,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})},children:(0,Z.jsxs)(`div`,{"data-slot":`git-screen`,children:[s?.info?(0,Z.jsx)(`div`,{className:`mb-[16px]`,children:(0,Z.jsx)(st,{scope:e,repo:s,info:s.info,variant:`screen`},e)}):t.isPending?(0,Z.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,Z.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,Z.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,Z.jsx)(ct,{branch:s?.info?.branch??null,counts:c,variant:`screen`})]})})}function bt({entry:e}){return e.keptReason?(0,Z.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function xt(e){if(e===``)return null;if(e===`@`)return`A branch cannot be named “@”.`;if(e.startsWith(`-`))return`A branch name cannot start with “-”.`;if(/\s/.test(e))return`A branch name cannot contain spaces.`;if(/[\u0000-\u001f\u007f]/.test(e))return`A branch name cannot contain control characters.`;let t=/[~^:?*[\\]/.exec(e);if(t)return`A branch name cannot contain “${t[0]}”.`;if(e.includes(`..`))return`A branch name cannot contain “..”.`;if(e.includes(`@{`))return`A branch name cannot contain “@{”.`;if(e.startsWith(`/`)||e.endsWith(`/`))return`A branch name cannot start or end with “/”.`;if(e.includes(`//`))return`A branch name cannot contain “//”.`;if(e.endsWith(`.`))return`A branch name cannot end with “.”.`;for(let t of e.split(`/`)){if(t.startsWith(`.`))return`A part of a branch name cannot start with “.”.`;if(t.endsWith(`.lock`))return`A part of a branch name cannot end with “.lock”.`}return null}function St({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=v(),c=g(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),u=T(),f=d({mutationFn:e=>E({name:e},n),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([u.invalidateQueries({queryKey:i}),u.invalidateQueries({queryKey:o})]),u.setQueryData(i,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),u.setQueryData(o,t=>Ye(t,n,e.branch))},onError:e=>D(e.message,{tone:`danger`})}),[p,m]=(0,X.useState)(``),[h,_]=(0,X.useState)(``),y=h.trim().toLowerCase(),b=Ot(e,c.data?.branches),x=y?b.filter(e=>e.toLowerCase().includes(y)):b,S=p.trim(),C=xt(S);return(0,Z.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 md:grid-cols-[minmax(0,1fr)_290px]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,Z.jsxs)(`label`,{className:`relative block`,children:[(0,Z.jsx)(re,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,Z.jsx)(tt,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:h,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,Z.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[x.map(e=>{let n=e===t.branch,r=l.get(e);return(0,Z.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,Z.jsx)(L,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,Z.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,Z.jsx)(Dt,{entry:r}):null]}),r?(0,Z.jsx)(bt,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,Z.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:f.isPending,onClick:()=>f.mutate(e),children:[(0,Z.jsx)(M,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),x.length===0?(0,Z.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,h.trim(),`”.`]}):null]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,Z.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=S;!t||C||f.mutate(t,{onSuccess:()=>m(``)})},children:[(0,Z.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,Z.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,Z.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:t.branch}),`.`]}),(0,Z.jsx)(tt,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-soft-foreground`,value:p,"aria-invalid":C?!0:void 0,"aria-describedby":C?`new-branch-name-hint`:void 0,onChange:e=>m(e.target.value)}),C?(0,Z.jsx)(`p`,{id:`new-branch-name-hint`,"data-slot":`branch-name-hint`,role:`alert`,className:`-mt-1 text-xs text-danger`,children:C}):null,(0,Z.jsxs)(F,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!S||C!==null||f.isPending,children:[(0,Z.jsx)(te,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,Z.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,Z.jsx)(Ct,{}):null]})}function Ct(){let e=p({limit:20});return(0,Z.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,Z.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,Z.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,Z.jsx)(wt,{pr:e},e.number))}):(0,Z.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function wt({pr:e}){let t=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,Z.jsx)(Tt,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,Z.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,Z.jsx)(`span`,{className:n,children:t})})}function Tt({checks:e}){let t=e===`passing`?he:e===`failing`?ge:rt;return(0,Z.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:a(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,Z.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var Et={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function Dt({entry:e}){return(0,Z.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-xs leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:Et[e.class]})}function Ot(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function kt(){let e=c(),t=nt(),[n,r]=(0,X.useState)(`unified`),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(!1),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),f=e.isError&&e.error instanceof y&&e.error.status===409,p=e.data?.files??[],m=(0,X.useMemo)(()=>ye(p),[p]),h=(0,X.useMemo)(()=>p.some(dt),[p]),g=t?n:`unified`;return(0,Z.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`py-6 text-center text-xs text-muted-foreground`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(z,{icon:f?(0,Z.jsx)(N,{size:16}):(0,Z.jsx)(le,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,Z.jsx)(z,{icon:(0,Z.jsx)(N,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 pb-4 [&_button]:min-h-11`,children:[e.data?(0,Z.jsx)(be,{stat:e.data.stat}):null,(0,Z.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h&&o?(0,Z.jsx)(Te,{}):null,h?(0,Z.jsx)(Ce,{preview:o,onPreviewChange:s}):null,(0,Z.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,Z.jsx)(we,{mode:n,wrap:i,onModeChange:r,onWrapChange:a,disabled:h&&o})})]})]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 [--diff-sticky-top:0px] md:flex-row md:items-start`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,Z.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(ve,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,Z.jsx)(ft,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function At({repo:e,info:t}){let{sha:n}=A(),r=e.log,i=(0,X.useMemo)(()=>et(r),[r]);if(n)return(0,Z.jsx)(Nt,{sha:n});let a=Ge(e,t),o=a&&a.behind>0?(0,Z.jsx)(Mt,{info:t,tracking:a}):null;return r.length===0?(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsx)(`div`,{children:o}):null,(0,Z.jsx)(z,{icon:(0,Z.jsx)(se,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,Z.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4`,children:[o,i.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsxs)(L,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,Z.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,Z.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(mt,{sha:e.hash}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,Z.jsx)(`span`,{title:He(e.when,e.at),children:ut(e.when,e.at)})]})]})]}),(0,Z.jsx)(jt,{source:e.source})]},e.hash))})]},e.label))]})}function jt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-xs text-muted-foreground md:flex`;return e?(0,Z.jsxs)(L,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:a(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,Z.jsx)(ue,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,Z.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function Mt({info:e,tracking:t}){let n=Ze(r(),e),i=(0,X.useRef)(null);return(0,Z.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,Z.jsx)(_t,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,Z.jsxs)(`button`,{ref:i,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,Z.jsx)(Se,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,Z.jsx)(ce,{"aria-hidden":`true`}),`Pull`]}),(0,Z.jsx)(qe,{checkout:n,returnFocus:i})]})}function Nt({sha:e}){return(0,Z.jsx)(ht,{commit:s(e),sha:e,backTo:nt()?`/git`:We,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:px-9`})}var Pt=`Squash-merged branches may show as not landed without GitHub`;function Ft(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function It(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}function Lt(){let e=g(),t=h(),n=r(),i=_(),[a,o]=(0,X.useState)(null);if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`py-5 text-[13px] text-muted-foreground`,children:`Loading branches…`});if(e.isError)return(0,Z.jsx)(z,{icon:(0,Z.jsx)(le,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Ft(e.data.branches),c=s.reduce((e,t)=>e+t.rows.length,0),l=It(e.data.branches),u=l>0?(0,Z.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,Z.jsx)(xe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{children:[l,` finished task`,l===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,l===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,Z.jsx)(L,{to:U.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,d=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,Z.jsxs)(De,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,Z.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[e.data.prStateKnown?null:(0,Z.jsx)(Rt,{}),u,s.length===0?(0,Z.jsx)(ze,{icon:(0,Z.jsx)(at,{size:16}),title:l>0?`Nothing else waiting to land`:`Everything landed`,description:l>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`,actions:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(F,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(L,{to:U.cleanup,children:`Check cleanup`})}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(L,{to:`/`,children:`View tasks`})})]})}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,Z.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,Z.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{children:e.note})]}):null]}),(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,Z.jsx)(zt,{entry:e,finishedAt:e.runId?d.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,Z.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,Z.jsx)(xe,{"aria-hidden":`true`,className:`mt-px size-3 shrink-0`}),`Delete a branch from its row's … menu. It confirms and names the commits it drops; nothing here is bulk-deleted.`]}),c<=3?(0,Z.jsx)(Le,{summary:`${c} ${c===1?`branch`:`branches`} waiting to land. Open a draft PR or inspect worktrees in Cleanup.`,actions:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,asChild:!0,className:`max-md:min-h-11`,children:(0,Z.jsx)(L,{to:U.cleanup,children:`Open cleanup`})})}):null]})]}),(0,Z.jsx)(Wt,{entry:a,onClose:()=>o(null)})]})}function Rt({className:e}){return(0,Z.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,Z.jsx)(xe,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),Pt,`.`]})}function zt({entry:e,finishedAt:t,onDelete:n}){return(0,Z.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,Z.jsx)(Ht,{entry:e,finishedAt:t}),(0,Z.jsx)(Bt,{entry:e}),(0,Z.jsx)(Vt,{entry:e,onDelete:n})]})}function Bt({entry:e}){return(0,Z.jsx)(Z.Fragment,{children:e.pr?(0,Z.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,Z.jsx)(Oe,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,Z.jsx)(Ut,{entry:e})]}):null})}function Vt({entry:e,onDelete:t}){let n=T(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,o=!r&&e.runId!==null&&!i,s=d({mutationFn:()=>C(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:u.repoBranches}),n.invalidateQueries({queryKey:u.runs.all})},onError:e=>D(e instanceof y&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),[c,l]=(0,X.useState)(!1),f=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{f.current!==null&&clearTimeout(f.current)},[]);let p=()=>void navigator.clipboard.writeText(e.name).then(()=>{D(`Copied ${e.name}`),f.current!==null&&clearTimeout(f.current),l(!0),f.current=setTimeout(()=>l(!1),2e3)},()=>D(`Could not copy the branch name`,{tone:`danger`})),m=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,Z.jsxs)(Z.Fragment,{children:[e.runId?(0,Z.jsx)(L,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,Z.jsx)(vt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,Z.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,"data-copied":c||void 0,"aria-live":`polite`,onClick:p,className:a(m,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[c?(0,Z.jsx)(oe,{"aria-hidden":`true`}):(0,Z.jsx)(fe,{"aria-hidden":`true`}),c?`Copied`:`Copy branch`]}):null,(0,Z.jsxs)(Me,{children:[(0,Z.jsx)(Ae,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,Z.jsx)(pe,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,Z.jsxs)(je,{align:`end`,className:`w-52`,children:[e.runId?(0,Z.jsx)(I,{asChild:!0,className:`md:hidden`,children:(0,Z.jsx)(L,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,Z.jsx)(I,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,Z.jsx)(I,{className:a(!r&&`md:hidden`),onSelect:p,children:`Copy branch`}),(0,Z.jsx)(ke,{className:`md:hidden`}),(0,Z.jsx)(I,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function Ht({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=t??e.lastCommit.at,a=Pe(i),o=e.runStatus?Ue(e.runStatus):void 0,s=n||!o?a:`${o.label}${a?` ${a}`:``}`,c=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,Z.jsx)(_e,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,Z.jsx)(Ne,{tone:o?.tone??`neutral`,shape:o?.shape??`filled`,"aria-label":o?.label})}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,Z.jsx)(L,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,Z.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,Z.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,Z.jsx)(Q,{}),(0,Z.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(pt,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{className:`truncate`,title:c,children:s})]}):null]}),e.parentRunId?(0,Z.jsx)(L,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,Z.jsx)(bt,{entry:e})]})]})}function Q(){return(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Ut({entry:e}){let t=m(Ee(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Q,{}),(0,Z.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Wt({entry:e,onClose:t}){let n=T(),[r,i]=(0,X.useState)(``),a=(0,X.useId)(),o=d({mutationFn:e=>w({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;D(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:u.repo}),s()},onError:e=>D(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,Z.jsx)(H,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,Z.jsxs)(V,{"data-slot":`delete-branch-dialog`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsxs)(J,{children:[`Delete `,e?.name,`?`]}),(0,Z.jsx)(G,{asChild:!0,children:(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,Z.jsxs)(Z.Fragment,{children:[`This drops the work of `,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,Z.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,e?.lastCommit.sha?(0,Z.jsxs)(Z.Fragment,{children:[` (`,(0,Z.jsx)(Je,{sha:e.lastCommit.sha,variant:`inline`}),`)`]}):null,`.`]})]})})]}),(0,Z.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,Z.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,Z.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,Z.jsx)(tt,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(q,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,Z.jsx)(K,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Gt({base:e}){let t=g(),n=T(),[r,i]=(0,X.useState)({merged:!1,empty:!1}),[a,o]=(0,X.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],f=d({mutationFn:e=>w({names:e}),onSuccess:e=>{let t=e.refused.length;D(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:u.repo})},onError:e=>{n.invalidateQueries({queryKey:u.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,Z.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,Z.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let p=l.length,m=`branch${p===1?``:`es`}`;return(0,Z.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,p]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:p===0||f.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(ae,{"aria-hidden":`true`,className:`size-[12px]`}),f.isPending?`Deleting…`:`Delete ${p} ${m}`]})]}),(0,Z.jsx)(Kt,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:Pt.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,Z.jsx)(Kt,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,Z.jsx)(H,{open:a,onOpenChange:o,children:(0,Z.jsxs)(V,{children:[(0,Z.jsxs)(W,{children:[(0,Z.jsxs)(J,{children:[`Delete `,p,` `,m,`?`]}),(0,Z.jsxs)(G,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(q,{children:`Keep them`}),(0,Z.jsxs)(K,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{f.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,p,` `,m]})]})]})})]})}function Kt({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,Z.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n})]}),r.length>0?(0,Z.jsx)(de,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,Z.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,Z.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-xs`,children:[(0,Z.jsx)(ot,{value:e.name,className:`shrink-0 text-muted-foreground`}),e.runId?(0,Z.jsx)(L,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,Z.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,Z.jsx)(Ke,{iso:e.lastCommit.at,className:`shrink-0 text-soft-foreground`})]},e.name))}):null]})}function $(e){return e.some(e=>e.sizeBytes===null)?null:e.reduce((e,t)=>e+(t.sizeBytes??0),0)}function qt(e){return e.kind===`dirty`?`${e.uncommittedFiles} uncommitted`:e.kind===`detached-head`?`detached HEAD`:e.kind===`submodules`?`has submodules`:`broken worktree`}function Jt(e){if(e.kind===`dirty`){let t=`${e.uncommittedFiles} uncommitted file${e.uncommittedFiles===1?``:`s`}`;return e.detachedHead?`${t} and a detached HEAD on no branch`:t}return e.kind===`detached-head`?`a detached HEAD whose commit is on no branch`:e.kind===`submodules`?`initialized submodules that Git will not remove without force`:`an unregistered or broken Git worktree directory`}function Yt(e){let t=e.some(e=>e.reclaimBlocker?.kind===`dirty`),n=e.some(e=>e.reclaimBlocker?.kind===`detached-head`||e.reclaimBlocker?.kind===`dirty`&&e.reclaimBlocker.detachedHead),r=e.some(e=>e.reclaimBlocker?.kind===`submodules`),i=e.some(e=>e.reclaimBlocker?.kind===`invalid`),a=[...t?[`uncommitted work`]:[],...n?[`a detached HEAD`]:[],...r?[`initialized submodules`]:[],...i?[`a broken checkout`]:[]];return a.length<=1?a[0]??`uncommitted work`:`${a.slice(0,-1).join(`, `)} or ${a.at(-1)}`}function Xt(e,t,n){let r=Math.max(0,t-e);return e===0?r===0?`Nothing to reclaim — no finished worktrees exceed the keep limit`:n?`Nothing was reclaimed — the worktrees past the keep limit are in use or could not be removed`:`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Reclaimed ${e} worktree${e===1?``:`s`} (branch kept)${r>0?` · ${r} kept: ${n?`in use or could not be removed`:`uncommitted work or in use`}`:``}`}function Zt(e,t){return e===0?`Reclaim now`:t?`Reclaim ${j(t)} now`:`Reclaim ${e} now`}function Qt(e,t,n){let r=t?j(t):String(e);return n?`Discard & reclaim all ${r}`:`Discard & reclaim ${r}`}function $t(e,t){if(!e)return t>0?`No clean worktrees past the keep limit — use Discard & reclaim for blocked worktrees`:`Nothing past the keep limit to reclaim`}function en(e){return e===0?{prefix:`Retention is unlimited (`,suffix:`), so nothing is reclaimed on its own.`}:{prefix:`Retention keeps the newest ${e} finished checkout${e===1?``:`s`} (`,suffix:`) and reclaims the rest.`}}function tn({blocked:e,discardLabel:t,disabled:n,onDiscard:r}){let i=$(e),a=e.length===1?``:`s`,o=e.length===1?`it has`:`they have`;return(0,Z.jsxs)(`div`,{"data-slot":`worktrees-blocked-banner`,className:`flex flex-col gap-[10px] border-b border-border bg-muted/40 px-[14px] py-[10px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`p`,{className:`min-w-0 flex-1 text-[12px] leading-[17px] text-foreground`,children:[e.length,` worktree`,a,` past the keep limit`,i?` (${j(i)})`:``,` `,`cannot be reclaimed automatically because `,o,` `,Yt(e),`.`]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-discard-reclaim`,disabled:n,onClick:r,className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] border border-danger/40 px-[10px] text-[12px] font-medium text-danger hover:bg-danger/10 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[12px]`}),t]})]})}function nn({confirmClean:e,onCloseClean:t,cleanCount:n,cleanBytes:r,reclaimLabel:i,onConfirmClean:a,discardBatch:o,onCloseDiscardBatch:s,onConfirmDiscardBatch:c,discardRow:l,onCloseRow:u,onConfirmRow:d}){let f=o?$(o):null,p=o?o.filter(e=>e.reclaimBlocker!==null).length:0,m=o?o.some(e=>!e.reclaimBlocker):!1,h=o?Qt(o.length,f,m):``;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{open:e,onOpenChange:e=>{e||t()},children:(0,Z.jsxs)(V,{children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{children:`Reclaim old worktrees?`}),(0,Z.jsxs)(G,{children:[n,` finished worktree`,n===1?``:`s`,` beyond the keep limit`,r?` (${j(r)})`:``,` `,n===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(q,{children:`Keep them`}),(0,Z.jsx)(K,{"data-action":`worktrees-confirm`,onClick:a,children:i})]})]})}),(0,Z.jsx)(H,{open:o!==null,onOpenChange:e=>{e||s()},children:(0,Z.jsxs)(V,{children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{children:`Discard changes and reclaim worktrees?`}),(0,Z.jsx)(G,{children:o?(0,Z.jsxs)(Z.Fragment,{children:[o.length,` finished worktree`,o.length===1?``:`s`,` beyond the keep limit`,f?` (${j(f)})`:``,` will be reclaimed now.`,` `,`Uncommitted files and detached-HEAD commits in `,p,` blocked checkout`,p===1?``:`s`,` will be permanently discarded. Each task’s branch is kept.`]}):null})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(q,{children:`Keep them`}),(0,Z.jsx)(K,{"data-action":`worktrees-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{o&&c(o),s()},children:h})]})]})}),(0,Z.jsx)(H,{open:l!==null,onOpenChange:e=>{e||u()},children:(0,Z.jsxs)(V,{children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{children:`Discard changes and reclaim worktree?`}),(0,Z.jsx)(G,{children:l?.reclaimBlocker?(0,Z.jsxs)(Z.Fragment,{children:[l.title,` has `,Jt(l.reclaimBlocker),`. Reclaiming removes the directory and permanently discards uncommitted or unbranched changes in it. The branch (`,l.branch??l.runId.slice(0,8),`) is kept.`]}):null})]}),(0,Z.jsxs)(Y,{children:[(0,Z.jsx)(q,{children:`Keep it`}),(0,Z.jsx)(K,{"data-action":`worktree-discard-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{l&&d(l),u()},children:`Discard & reclaim`})]})]})})]})}function rn(){let e=f(),t=l().data?.targets.find(e=>e.id===`finder`),n=d({mutationFn:e=>b(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=T(),[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(null),[c,p]=(0,X.useState)(null),m=()=>Promise.all([r.invalidateQueries({queryKey:u.worktrees}),r.invalidateQueries({queryKey:u.repoBranches})]),h=d({mutationFn:({runIds:e})=>S(e?{discardWork:!0,runIds:e}:void 0),onSuccess:(e,{expected:t,runIds:n})=>{m(),D(Xt(e.reclaimed.length,t,!!n))},onError:e=>D(e.message,{tone:`danger`})}),g=d({mutationFn:({worktree:e,discardWork:t})=>x(e.runId,t?{discardWork:!0}:void 0),onSuccess:(e,{worktree:t})=>{m(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{m(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,Z.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,Z.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:_,totalBytes:v,keep:y}=e.data,C=h.isPending||g.isPending,w=_.filter(e=>e.pastKeep),E=w.filter(e=>!e.reclaimBlocker),O=w.filter(e=>e.reclaimBlocker!==null),k=E.length>0,A=$(E),M=$(w),N=Zt(E.length,A),ee=Qt(w.length,M,k),P=v?j(v):null,te=en(y);return(0,Z.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,P?` · ${P}`:``]}),(0,Z.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-xs leading-[17px] text-soft-foreground`,children:[te.prefix,(0,Z.jsx)(L,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:it(`worktrees`,` › `)}),te.suffix,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,Z.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:C||!k,title:$t(k,O.length),onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[12px]`}),N]})]}),O.length>0?(0,Z.jsx)(tn,{blocked:O,discardLabel:ee,disabled:C,onDiscard:()=>s(w)}):null,_.length===0?(0,Z.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,Z.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:_.map(e=>(0,Z.jsx)(sn,{worktree:e,keep:y,disabled:C,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>{e.reclaimBlocker?p(e):g.mutate({worktree:e,discardWork:!1})}},e.runId))}),(0,Z.jsx)(nn,{confirmClean:i,onCloseClean:()=>a(!1),cleanCount:E.length,cleanBytes:A,reclaimLabel:N,onConfirmClean:()=>{h.mutate({expected:E.length}),a(!1)},discardBatch:o,onCloseDiscardBatch:()=>s(null),onConfirmDiscardBatch:e=>{h.mutate({expected:e.length,runIds:e.map(e=>e.runId)})},discardRow:c,onCloseRow:()=>p(null),onConfirmRow:e=>g.mutate({worktree:e,discardWork:!0})})]})}var an=new Set([`queued`,`running`,`waiting`,`review`]);function on(e,t){return an.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`,state:`in-use`}:e.reclaimBlocker?{label:qt(e.reclaimBlocker),tone:`blocked`,state:`blocked`}:e.pastKeep?{label:`reclaimable`,tone:`plain`,state:`reclaimable`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`,state:`kept`}}function sn({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=on(e,t),c=Pe(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Fe(c)}`:e.status,u=s.tone===`in-use`?`text-status-running`:s.tone===`blocked`?`text-danger`:`text-soft-foreground`,d=e.reclaimBlocker?`Cannot auto-reclaim: ${Jt(e.reclaimBlocker)}`:void 0,f=(0,Z.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.state,title:d,className:a(`text-xs`,u),children:s.label}),p=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`,m=e.reclaimBlocker?`Discard changes and reclaim the worktree of ${e.title} (branch kept)`:`Reclaim the worktree of ${e.title} (branch kept)`,h=e.reclaimBlocker?`Discard changes and reclaim the directory (branch kept)`:`Reclaim the directory (branch kept)`;return(0,Z.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,Z.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,Z.jsxs)(`span`,{className:`truncate font-mono text-xs text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,Z.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,Z.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-xs tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:j(e.sizeBytes)||`0 kB`}),(0,Z.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:f}),r?(0,Z.jsx)(`button`,{type:`button`,className:p,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,Z.jsx)(ee,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,Z.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":m,title:h,disabled:n,onClick:o,className:a(p,e.reclaimBlocker&&`text-danger hover:text-danger`),children:(0,Z.jsx)(lt,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function cn(e){return e===`main`||e===`changes`?`Split`:`Table`}function ln({section:e,index:t=!1}){let n=o(),r=nt(),[i]=k(),a=cn(e);if(t&&!r&&i.get(`view`)!==`repo`)return(0,Z.jsx)(yt,{});if(n.isPending)return(0,Z.jsx)($e,{});if(n.isError)return(0,Z.jsx)(R,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(B,{}),children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(le,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})});let s=n.data.info;return s?(0,Z.jsx)(un,{repo:n.data,info:s,section:e}):(0,Z.jsx)(R,{template:a,route:`repo-git`,density:`empty`,beforeHeader:(0,Z.jsx)(B,{}),children:(0,Z.jsx)(z,{icon:(0,Z.jsx)(M,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`Squawk is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function un({repo:e,info:t,section:n}){let r=cn(n),i=g(),a=n===`main`?e.log.length:n===`changes`?e.status.length:n===`branches`?Ot(e,i.data?.branches).length:n===`not-landed`?i.data?.branches.filter(e=>e.class===`not-landed`||e.class===`orphan`).length??0:4;return(0,Z.jsx)(R,{template:r,route:`repo-git`,density:n===`not-landed`&&i.isPending?`full`:Ie(a),rootProps:{"data-git-section":n},beforeHeader:(0,Z.jsx)(B,{}),header:{title:Ve(n,t.branch),headerSlot:`repo-header`,subtitle:(0,Z.jsx)(dn,{repo:e,info:t,section:n}),subtitleSlot:`repo-meta`},children:n===`main`?(0,Z.jsx)(At,{repo:e,info:t}):n===`not-landed`?(0,Z.jsx)(Lt,{}):n===`cleanup`?(0,Z.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-0`,children:[(0,Z.jsx)(rn,{}),(0,Z.jsx)(Gt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,Z.jsx)(St,{repo:e,info:t}):(0,Z.jsx)(kt,{})})}function dn({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,Z.jsxs)(Z.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Qe(e.tracking)}`:``]});case`not-landed`:return(0,Z.jsxs)(Z.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,Z.jsx)(fn,{repo:e,info:t});case`changes`:return(0,Z.jsxs)(Z.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,Z.jsxs)(Z.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function fn({repo:e,info:t}){let n=Ot(e,g().data?.branches).length;return(0,Z.jsxs)(Z.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{ln as RepoGitRoute};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{Ut as i}from"./queries-hzlF788B.js";import{f as a,p as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ft as s}from"./design-icons-CzEoMH9c.js";import{a as c,c as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-Da4ckcJG.js";import{t as g}from"./use-search-params-writer-ClMScnNe.js";var _=e(t(),1),v=n();function y({...e}){return(0,v.jsx)(h,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-trigger`,...e})}function x({...e}){return(0,v.jsx)(d,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,v.jsx)(f,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,v.jsx)(c,{"data-slot":`sheet-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function w({className:e,children:t,side:n=`right`,showCloseButton:i=!0,overlayClassName:a,...o}){return(0,v.jsxs)(S,{children:[(0,v.jsx)(C,{className:a}),(0,v.jsxs)(p,{"data-slot":`sheet-content`,className:r(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition-colors ease-in-out motion-safe:data-[state=closed]:animate-out data-[state=closed]:duration-300 motion-safe:data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 end-0 h-full w-3/4 border-s motion-safe:data-[state=closed]:slide-out-to-right motion-safe:data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 start-0 h-full w-3/4 border-e motion-safe:data-[state=closed]:slide-out-to-left motion-safe:data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 inset-bs-0 h-auto border-be motion-safe:data-[state=closed]:slide-out-to-top motion-safe:data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 inset-be-0 h-auto border-bs motion-safe:data-[state=closed]:slide-out-to-bottom motion-safe:data-[state=open]:slide-in-from-bottom`,e),...o,children:[t,i&&(0,v.jsxs)(d,{className:`absolute inset-bs-4 end-4 rounded-sm opacity-70 ring-offset-background transition-opacity pointer-hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,v.jsx)(s,{className:`size-4`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function T({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:r(`flex flex-col gap-1.5 p-4`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:r(`font-semibold text-foreground`,e),...t})}function D({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function O(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(i())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var k=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function A(e){let t=e.get(`report`);return!t||!k.test(t)||e.getAll(`report`).length!==1||e.getAll(`card`).length>1?null:{artifactId:t,card:e.get(`card`)||null}}var j=(0,_.createContext)(null);function M(e){let t=a(),n=o(),[r,i]=g(),s=A(r),[c,l]=(0,_.useState)(()=>({runId:e,entries:new Map}));c.runId!==e&&l({runId:e,entries:new Map});let u=(0,_.useCallback)((t,n)=>(l(r=>{if(r.runId===e&&r.entries.get(t)===n)return r;let i=new Map(r.runId===e?r.entries:[]);return i.set(t,n),{runId:e,entries:i}}),()=>void 0),[e]),d=(0,_.useRef)({runId:e,callbacks:new Map});d.current.runId!==e&&(d.current={runId:e,callbacks:new Map});let f=(0,_.useCallback)((e,t)=>(d.current.callbacks.set(e,t),()=>{d.current.callbacks.get(e)===t&&d.current.callbacks.delete(e)}),[]),p=(0,_.useMemo)(()=>({register:u,registerOpener:f}),[u,f]),m=(0,_.useRef)(null);return(0,_.useEffect)(()=>{r.has(`report`)&&!s&&i(e=>(e.delete(`report`),e.delete(`card`),e))},[r,s,i]),(0,_.useEffect)(()=>{let n=m.current;!s&&n&&n.runId===e&&n.card&&d.current.callbacks.get(n.card)?.(n.artifactId,n.scrollTop),m.current=s?{...s,runId:e,scrollTop:t.state?.reportScrollTop}:null},[e,s,t.state]),{selection:s,sourceRunId:c.runId===e&&s?c.entries.get(s.artifactId)??(s.card?void 0:e):void 0,registry:p,close:()=>{let e=t.state,r=window.navigation;if(e?.reportReturnKey&&r){r.traverseTo(e.reportReturnKey);return}if(e?.reportReturnTo){n(e.reportReturnTo,{replace:!0});return}i(e=>(e.delete(`report`),e.delete(`card`),e))}}}export{x as a,T as c,y as i,E as l,M as n,w as o,O as r,D as s,j as t,b as u};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,t as i}from"./utils-DSMR_WLb.js";import{N as a,Rt as o,ct as s}from"./queries-hzlF788B.js";import{Hr as c,In as l,Ln as u,Wr as d,br as f,hi as p,pi as m,ri as h,zn as g}from"./toaster-fWyfEGWF.js";import{B as _,F as v,I as y,J as b,N as x,W as S,Y as C,z as w}from"./live-protocol-DMhTnCmf.js";import{f as T,m as E}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{X as D}from"./design-icons-CzEoMH9c.js";import{t as ee}from"./arrow-up-right-DKGzsMqY.js";import{t as te}from"./chevron-right-BENZ-1ZN.js";import{t as O}from"./eye-B8okNWXU.js";import{t as k}from"./button-B7MKxYjT.js";import{t as A}from"./project-router-B9FTk0rB.js";import{d as j,l as M,n as N,r as P,t as F}from"./page-shell-7pLJMOgh.js";import{t as I}from"./use-search-params-writer-ClMScnNe.js";import{Mn as L,Zn as R,Zt as z,mn as B,or as V}from"./index-CjcLSwvy.js";import{t as H}from"./report-title-D4Mbu2Er.js";import{t as U}from"./html-report-frame-DkHr39E2.js";var W=e(t(),1),G=1e3,K=S().min(1).max(1024);_({q:S().max(G).optional(),before:K.optional(),limit:S().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var q=_({reports:x(_({id:b(),runId:b(),name:S(),title:S(),createdAt:C(),size:w().int().nonnegative(),taskTitle:S(),taskStatus:f}).strict()),nextCursor:K.nullable(),total:w().int().nonnegative()}).strict(),J=_({epoch:b(),generation:w().int().nonnegative(),metadataGeneration:w().int().nonnegative()}).strict(),Y=_({runId:b(),taskTitle:S(),taskStatus:f}).strict(),X=v(`type`,[J.extend({type:y(`snapshot`)}),J.extend({type:y(`content`)}),J.extend({type:y(`metadata`),runs:x(Y)})]),Z=new WeakMap;function ne(e,t){if(!e)return{content:t.type===`content`,metadata:t.type===`metadata`,reset:!1};if(e.epoch!==t.epoch)return{content:!0,metadata:!0,reset:!0};if(!(t.generation<e.generation||t.metadataGeneration<e.metadataGeneration)&&!(e.generation===t.generation&&e.metadataGeneration===t.metadataGeneration))return{content:t.generation!==e.generation,metadata:t.metadataGeneration!==e.metadataGeneration,reset:!1}}var re=class{client;project;state;content=0;metadata=0;patches=new Map;trailing=new Set;flights=new Map;constructor(e,t){this.client=e,this.project=t,e.getQueryCache().subscribe(n=>{if(n.type===`removed`){this.trailing.delete(n.query),this.flights.delete(n.query);return}if(!(n.query.queryKey[0]!==t||n.query.queryKey[1]!==`reports`)){if(n.type===`updated`&&n.action.type===`fetch`&&this.flights.set(n.query,this.metadata),n.query.state.fetchStatus===`idle`&&this.flights.has(n.query)){let e=this.flights.get(n.query);this.flights.delete(n.query),e!==this.metadata&&String(n.query.queryKey[2]??``).trim()===``&&this.client.setQueryData(n.query.queryKey,t=>t&&{...t,pages:t.pages.map(t=>this.patch(t,e))})}!this.trailing.has(n.query)||n.query.state.fetchStatus!==`idle`||(this.trailing.delete(n.query),queueMicrotask(()=>{e.invalidateQueries({queryKey:n.query.queryKey,exact:!0,refetchType:`active`},{cancelRefetch:!1})}))}})}patch(e,t=-1){return{...e,reports:e.reports.map(e=>{let n=this.patches.get(e.runId);return n&&n.version>t?{...e,taskTitle:n.value.taskTitle,taskStatus:n.value.taskStatus}:e})}}async read(e,t){for(;;){let n=this.content,r=this.metadata,i=await t();if(!(n!==this.content||e.trim()!==``&&r!==this.metadata))return e.trim()===``?this.patch(i,r):i}}receive(e,t=!1){let n=this.state;if(!n&&e.type===`snapshot`){this.state=e,this.content++,this.client.getQueryCache().findAll({queryKey:[this.project,`reports`]}).some(e=>e.state.data!==void 0)&&this.invalidate(!0);return}let r=ne(n,e);if(!r){t&&e.type===`snapshot`&&(this.content++,this.invalidate(!0));return}let{metadata:i,reset:a}=r,o=r.content||t&&e.type===`snapshot`;this.state=e,a&&this.patches.clear(),i&&this.metadata++,o&&this.content++,e.type===`metadata`&&!a&&this.patchCaches(e);let s=o||i&&e.type!==`metadata`;(s||i)&&this.invalidate(s)}patchCaches(e){for(let t of e.runs)this.patches.set(t.runId,{value:t,version:this.metadata});this.client.setQueriesData({queryKey:[this.project,`reports`],predicate:e=>String(e.queryKey[2]??``).trim()===``},e=>e&&{...e,pages:e.pages.map(e=>this.patch(e,this.metadata-1))})}invalidate(e){let t={queryKey:[this.project,`reports`],refetchType:`active`,...e?{}:{predicate:e=>String(e.queryKey[2]??``).trim()!==``}};for(let e of this.client.getQueryCache().findAll(t))e.state.fetchStatus===`fetching`&&this.trailing.add(e);this.client.invalidateQueries(t,{cancelRefetch:!1})}};function ie(e,t){let n=Z.get(e);n||(n=new Map,Z.set(e,n));let r=n.get(t);return r||(r=new re(e,t),n.set(t,r)),r}async function ae(e,t){let n=await l.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},u({signal:t}));return J.parse(await g(n,`/reports/state`))}function oe(e){let t=ie(p(),e);return(0,W.useEffect)(()=>{let n=o(`reports:project:${e}`,e=>{let n=X.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,i,a=()=>{if(c()===`finite`&&!r){i=new AbortController;let n=i.signal;ae(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=s({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=J.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else c()!==`finite`&&(i?.abort(),r?.(),r=void 0)};a();let l=d(a);return()=>{l(),i?.abort(),r?.(),n()}},[t,e]),t}async function se(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,G),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return q.parse(await g(i,`/reports`))}function ce(e){let t=r(),n=oe(t);return h({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>se(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Q=n(),$=new Map;function le(e){let t=z(),[n,r]=(0,W.useState)(!1);return(0,W.useLayoutEffect)(()=>{let n=e.current;if(!n)return;let i=e=>{r(e>0?e>=660:t)};if(i(n.getBoundingClientRect().width),typeof ResizeObserver!=`function`)return;let a=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??n.getBoundingClientRect().width;i(t)});return a.observe(n),()=>a.disconnect()},[e,t]),n}function ue(){let e=T(),t=E(),[n,r]=I(),a=(n.get(`q`)??``).slice(0,G),o=ce(a),s=(0,W.useRef)(null),c=(0,W.useRef)(null),l=(0,W.useRef)(``),u=e.pathname+e.search,d=o.data?.pages.flatMap(e=>e.reports)??[],f=e=>{$.set(u,{scroll:c.current?.scrollTop??0,row:e,pages:o.data?.pages.length??1})},[p,m]=(0,W.useState)(null),h=le(s);(0,W.useLayoutEffect)(()=>{if(!o.data||l.current===u)return;let n=$.get(u),r=e.state?.filesRestoreKey===u;if(!n||!c.current||t!==`POP`&&!r){l.current=u;return}let i=c.current.querySelector(`[data-report-id="${n.row}"]`);if(o.isFetchNextPageError){l.current=u,c.current.scrollTop=0;return}if((!i||o.data.pages.length<n.pages)&&o.hasNextPage){o.isFetchingNextPage||o.fetchNextPage();return}l.current=u,c.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[u,o.data,o.hasNextPage,o.isFetchingNextPage,o.isFetchNextPageError,o.fetchNextPage,e.state,t]);let g=t=>r(n=>(t?n.set(`q`,t.slice(0,G)):n.delete(`q`),$.delete(e.pathname+`?`+n.toString()),n)),_=d.find(e=>e.id===p)??d[0]??null,v=o.isPending?`full`:j(d.length);return(0,Q.jsx)(M,{route:`reports`,density:v,fillHeight:!0,bodyClassName:`gap-4`,header:{title:`Reports`,subtitle:`Published HTML snapshots from tasks in this project.`},children:(0,Q.jsxs)(`div`,{ref:s,"data-slot":`reports-content`,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`relative w-full shrink-0`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Q.jsx)(R,{maxLength:G,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:a,onChange:e=>g(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]}),o.isPending?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`})}):o.isError&&d.length===0?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o.error.message}),(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,onClick:()=>void o.refetch(),children:`Retry`})]})}):d.length===0?(0,Q.jsx)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(F,{icon:(0,Q.jsx)(V,{}),title:a?`No matching reports`:`No published reports yet`,description:a?`Try a different keyword or clear the search filter.`:(0,Q.jsxs)(Q.Fragment,{children:[`Publish an HTML snapshot with`,` `,(0,Q.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[B(),` artifact publish`]}),` `,`to list it here.`]}),actions:a?(0,Q.jsx)(k,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>g(``),children:`Clear search`}):(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,asChild:!0,children:(0,Q.jsx)(A,{to:`/new`,children:`Start a task`})})})}):(0,Q.jsx)(P,{list:(0,Q.jsxs)(`div`,{ref:c,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:d.map(e=>{let t=_?.id===e.id;return(0,Q.jsxs)(`li`,{"data-slot":`report-row`,"data-selected":h&&t?`true`:void 0,className:i(`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,h&&t&&`border-accent-strong/60 bg-sidebar-row-selected/40`),children:[(0,Q.jsx)(V,{"aria-hidden":`true`,className:`reports-icon mt-0.5 size-4 shrink-0 self-start text-accent-text`}),(0,Q.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Q.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:H(e),children:(0,Q.jsx)(A,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:u,filesRestoreKey:u},onClick:()=>f(e.id),children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:H(e)})})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Q.jsx)(A,{className:`reports-task min-w-0 truncate text-xs text-muted-foreground no-underline hover:text-foreground hover:underline`,to:`/tasks/${e.runId}`,children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Q.jsx)(L,{className:`shrink-0`,iso:e.createdAt,prefix:`Published · `})]})]}),h?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`report-preview-select`,"aria-label":`Preview ${H(e)}`,"aria-pressed":t,onClick:()=>m(e.id),className:`reports-preview-btn inline-flex min-h-8 min-w-8 shrink-0 items-center justify-center gap-1 rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:(0,Q.jsx)(O,{"aria-hidden":`true`,className:`size-3.5`})}):(0,Q.jsx)(te,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id)})}),o.hasNextPage?(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(k,{variant:`outline`,className:`min-h-11`,disabled:o.isFetchingNextPage,onClick:()=>void o.fetchNextPage(),children:`Load more reports`})}):null,v===`sparse`?(0,Q.jsx)(N,{summary:`${d.length} published ${d.length===1?`report`:`reports`}. Select a row to open full screen or preview beside the list.`}):null]}),detail:h&&_?(0,Q.jsx)(de,{report:_,restoreKey:u,onOpenReader:()=>f(_.id)}):null})]})})}function de({report:e,restoreKey:t,onOpenReader:n}){let r=(0,W.useContext)(m)!==void 0;return(0,Q.jsxs)(`section`,{"data-slot":`reports-preview-pane`,"aria-label":`Preview of ${H(e)}`,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:H(e)}),(0,Q.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:[e.taskTitle,` · `,(0,Q.jsx)(L,{iso:e.createdAt,prefix:`Published · `})]})]}),(0,Q.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,className:`h-auto min-h-8 shrink-0 py-1.5`,children:(0,Q.jsxs)(A,{"data-slot":`reports-preview-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:t,filesRestoreKey:t},onClick:n,children:[`Open reader`,(0,Q.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5`})]})})]}),r?(0,Q.jsx)(fe,{report:e}):(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-xs text-muted-foreground`,children:`Open reader to view this HTML report.`})]})}function fe({report:e}){let t=a(e.runId,e.id);if(t.isPending)return(0,Q.jsx)(`p`,{role:`status`,className:`p-6 text-xs text-muted-foreground`,children:`Loading preview…`});if(t.isError)return(0,Q.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 p-6 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{className:`font-medium text-foreground`,children:`Could not load report preview`}),(0,Q.jsx)(`p`,{children:t.error.message}),(0,Q.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void t.refetch(),children:`Retry`})]});let n=t.data;return!n||n.type!==`file`||n.binary||n.content===void 0?(0,Q.jsx)(`p`,{className:`p-6 text-xs text-muted-foreground`,children:`Preview unavailable for this artifact.`}):(0,Q.jsx)(U,{html:n.content,title:H(e),className:`min-h-0 flex-1`})}export{ue as ReportsRoute};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{Gt as t,It as n,dn as r}from"./queries-hzlF788B.js";import{hi as i,n as a,sn as o}from"./toaster-fWyfEGWF.js";import{n as s}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{t as u}from"./switch-DKqVf8-p.js";import{t as d}from"./centered-state-V15AR_qo.js";import{pn as f}from"./index-CjcLSwvy.js";import{t as p}from"./settings-select-CCIMGnyA.js";import{n as m}from"./saved-draft-BwzBc-_Y.js";import{t as h}from"./save-cue-Cd3ZAPBS.js";import{n as g,t as _}from"./settings-field-DP9sYv5a.js";var v=e(),y=1,b=1,x=60,S=256;function C(){let e=n();return e.isPending?(0,v.jsx)(`p`,{"data-slot":`resources-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading resource settings…`}):e.isError?(0,v.jsx)(d,{icon:(0,v.jsx)(c,{}),tone:`danger`,title:`Resource settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,v.jsx)(w,{config:e.data})}function w({config:e}){let n=i(),s=r({mutationFn:e=>o(e),onSuccess:e=>n.setQueryData(t.config,e),onError:e=>a(e.message,{tone:`danger`})}),[c,l]=m(e.resources.memoryLimitMb?String(e.resources.memoryLimitMb):``),d=e.resources.monitoringWakeIntervalMinutes??null,[f,p]=m(d===null?`park`:`interval`),[h,_]=m(String(d??5)),y=Number(h),C=!Number.isInteger(y)||y<b||y>x,w=f===`park`?d===null:!C&&d===y,k=f===`interval`&&C,j=()=>s.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>a(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>s.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>a(e?`Tasks stopped by a usage limit will resume themselves`:`Tasks stopped by a usage limit will stay failed`)}),P=c.trim()===``?0:Number(c),F=c.trim()!==``&&(!Number.isInteger(P)||P<S),I=(e.resources.memoryLimitMb??0)===(F?-1:P),L=()=>s.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>a(P===0?`Memory limit cleared`:`Memory limit set to ${P} MiB`)}),R=e.composerDefaults??{autonomous:null,worktree:null,inheritedAutonomous:`source-dependent`,inheritedWorktree:!0};return(0,v.jsxs)(`div`,{"data-slot":`resources-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,v.jsx)(T,{maxParallel:e.resources.maxParallel,onSelect:e=>s.mutate({resources:{maxParallel:e}}),disabled:s.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>s.mutate({resources:{maxMonitoringSessions:e}}),disabled:s.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:s.isPending}),(0,v.jsx)(g,{title:`Auto-resume after a usage limit`,hint:`Resumes eligible tasks at the reset time the provider reports. Saves automatically.`,children:(0,v.jsx)(u,{"aria-label":`Auto-resume after a usage limit`,"data-slot":`resources-auto-resume`,checked:M,disabled:s.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:s.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>s.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:s.isPending})]})}function T({maxParallel:e,onSelect:t,disabled:n}){return(0,v.jsxs)(g,{title:`Max parallel tasks`,hint:`Limits how many tasks run at once. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Max parallel tasks`,"data-slot":`resources-max-parallel`,value:e,disabled:n,onChange:e=>t(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:16},(e,t)=>t+y).map(e=>(0,v.jsx)(`option`,{value:e,children:e},e))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need a different limit for one project?`,` `,(0,v.jsx)(s,{to:`/settings/global/projects`,"data-slot":`resources-project-limits-link`,className:`font-medium text-link-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:`Configure per-project limits`}),`.`]})]})}function E({maxParallel:e,maxMonitoringSessions:t,onSelect:n,disabled:r}){return(0,v.jsxs)(g,{title:`Extra monitoring sessions`,hint:`Extra slots reserved for monitoring sessions. Saves automatically.`,children:[(0,v.jsx)(p,{"aria-label":`Extra monitoring sessions`,"data-slot":`resources-max-monitoring`,value:t??2,disabled:r,onChange:e=>n(Number(e.target.value)),className:`block w-28 rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:Array.from({length:17},(e,t)=>(0,v.jsx)(`option`,{value:t,children:t},t))}),(0,v.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Capacity: `,e,` active + `,t??2,` monitoring. 0 shares the active slots.`]})]})}function D({wakeMode:e,setWakeMode:t,wakeInterval:n,setWakeInterval:r,showInvalid:i,wakeSaved:a,saveWake:o,saveIsPending:s}){return f(!a),(0,v.jsxs)(g,{title:`Monitoring wake-up`,hint:`Wake monitoring sessions periodically.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(u,{"aria-label":`Monitoring wake-up`,"data-slot":`resources-monitoring-wake-mode`,checked:e===`interval`,disabled:s,onCheckedChange:e=>t(e?`interval`:`park`)}),e===`interval`?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`label`,{htmlFor:`monitoring-wake-interval`,className:`w-full ${_}`,children:`Wake interval`}),(0,v.jsx)(`input`,{id:`monitoring-wake-interval`,type:`number`,min:b,max:x,"aria-label":`Wake interval in minutes`,"data-slot":`resources-monitoring-wake-interval`,value:n,disabled:s,onChange:e=>r(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`minutes`})]}):null,(0,v.jsx)(h,{show:a&&!i&&!s,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-monitoring-wake`,disabled:a||i||s,onClick:o,children:`Save`})})]}),i?(0,v.jsx)(`p`,{"data-slot":`resources-monitoring-wake-invalid`,className:`text-xs text-danger`,children:`Enter a whole number from 1 to 60 minutes.`}):null]})}function O({memory:e,setMemory:t,memoryInvalid:n,memorySaved:r,saveMemory:i,saveIsPending:a}){return f(!r),(0,v.jsxs)(g,{title:`Per-task memory limit`,hint:`Applies to newly started tasks. Leave blank for no limit.`,children:[(0,v.jsxs)(`div`,{"data-reports-dirty":``,className:`settings-resource-controls flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:S,step:256,"aria-label":`Per-task memory limit in MiB`,"data-slot":`resources-memory-limit`,value:e,disabled:a,placeholder:`no limit`,onChange:e=>t(e.target.value),className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`}),(0,v.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`MiB`}),(0,v.jsx)(h,{show:r&&!n&&!a,children:(0,v.jsx)(l,{type:`button`,variant:`primary`,size:`sm`,"data-action":`resources-save-memory`,disabled:r||n||a,onClick:i,children:`Save`})})]}),n?(0,v.jsxs)(`p`,{"data-slot":`resources-memory-invalid`,className:`text-xs text-danger`,children:[`Enter a whole number of at least `,S,` MiB, or leave empty for no limit.`]}):null]})}function k(e){return e===null?`inherit`:e?`on`:`off`}function A({composerDefaults:e,saveComposerDefault:t,saveIsPending:n}){return(0,v.jsxs)(g,{title:`New task defaults`,hint:`Apply to new tasks unless overridden.`,children:[(0,v.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,"data-slot":`resources-composer-defaults`,children:[(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Autonomous by default`}),(0,v.jsxs)(p,{"aria-label":`Autonomous by default`,value:k(e.autonomous),disabled:n,onChange:e=>t(`autonomous`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedAutonomous===`source-dependent`?`Source-dependent — skills on, workflows off`:e.inheritedAutonomous?`On`:`Off`]})]}),(0,v.jsxs)(`label`,{className:`grid gap-1.5 text-sm sm:grid-cols-1`,children:[(0,v.jsx)(`span`,{className:_,children:`Use a worktree by default`}),(0,v.jsxs)(p,{"aria-label":`Use a worktree by default`,value:k(e.worktree),disabled:n,onChange:e=>t(`worktree`,e.target.value),className:`rounded-md border border-input bg-card px-3 py-1.5 shadow-xs outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,v.jsx)(`option`,{value:`inherit`,children:`Inherit environment`}),(0,v.jsx)(`option`,{value:`on`,children:`On`}),(0,v.jsx)(`option`,{value:`off`,children:`Off`})]}),(0,v.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`Inherited: `,e.inheritedWorktree?`On`:`Off`]})]})]}),(0,v.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Interactive skills may recommend both off. Multi-step and parallel runs remain isolated. Saves automatically.`})]})}export{C as ResourcesSection};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{Ct as a,G as o,H as s,K as c,St as l,U as u,W as d,Wt as f,Y as p,dn as m,f as h,ln as g,lt as _,rn as v,rt as ee,tt as y,un as te,xt as b,yt as ne}from"./queries-hzlF788B.js";import{An as re,Fn as ie,It as ae,Lt as x,cr as oe,hi as se,n as S,or as C,tt as w,ut as ce,yr as le}from"./toaster-fWyfEGWF.js";import{_ as ue,a as de,c as fe,f as pe,h as me,m as he,o as ge,p as _e}from"./tasks-table-D17JLOhe.js";import{F as ve,at as ye,ft as be,i as xe,l as Se,p as Ce,q as we,t as Te,v as T,x as Ee}from"./design-icons-CzEoMH9c.js";import{t as E}from"./createLucideIcon-BHp8sXmF.js";import{t as De}from"./app-window-CSHwDX9N.js";import{n as Oe,r as ke,t as Ae}from"./open-in-menu-VhRao_Jk.js";import{t as je}from"./info-DA1x_4bz.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{i as Ne,n as Pe,t as D}from"./reference-chip-Dgo5aKeb.js";import{t as Fe}from"./square-terminal-B6RYYieR.js";import{t as O}from"./button-B7MKxYjT.js";import{a as k,i as A,l as j,n as M,p as N,r as P,t as F}from"./dropdown-menu-4e2iKSMT.js";import{i as Ie,r as Le,t as Re}from"./popover-CZV6tz9i.js";import{a as ze,i as Be,o as Ve,r as He,s as Ue,t as We}from"./dialog-B531GGAo.js";import{c as Ge,s as Ke,t as I}from"./project-router-B9FTk0rB.js";import"./attention-ILOaW2-t.js";import{T as qe,f as L,u as Je}from"./task-groups-DD46syqv.js";import{t as Ye}from"./status-dot-BRzVlF2X.js";import{t as Xe}from"./format-BU7D3IfE.js";import{B as R,Gn as Ze,Gt as z,Ht as B,Jt as V,Kt as H,On as Qe,Qt as $e,R as et,Un as tt,Ut as nt,Wn as rt,Wt as it,Yt as at,a as ot,bn as U,cn as W,en as st,in as ct,ln as G,m as lt,mr as ut,nr as dt,o as ft,or as pt,qt as mt,r as K,tr as ht,vn as gt,z as _t}from"./index-CjcLSwvy.js";import{t as vt}from"./markdown-DVqtRtwM.js";import{t as yt}from"./textarea-vJt9undk.js";import{t as bt}from"./task-file-scope-CLJD_Mve.js";import{t as q}from"./tab-link-BlZX-nKP.js";var xt=E(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),St=E(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Ct=E(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),J=e(t(),1),Y=n();function wt(e){let t=_();return m({mutationFn:t=>w(te(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>g()),onError:e=>S(e.message,{tone:`danger`})})}function Tt(e){return e.archived?`Unarchive`:`Archive task`}function Et({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(B,{open:t,onOpenChange:n,children:(0,Y.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(at,{children:`Archive task?`}),(0,Y.jsxs)(H,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:L(e),children:L(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(it,{children:`Cancel`}),(0,Y.jsx)(nt,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Dt({run:e,className:t}){let[n,r]=(0,J.useState)(!1),a=wt(e.id),o=Tt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(O,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,Y.jsx)(ut,{"aria-hidden":`true`}):(0,Y.jsx)(Te,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:o})]}),(0,Y.jsx)(Et,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Ot({run:e,action:t,prUrl:n,patch:i}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(O,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>S(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function kt({run:e,blocker:t,flags:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(I,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Y.jsx)(O,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(Dt,{run:e}):null]})]})}function At({run:e}){let t=o(e.id),n=G(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let s=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-card-edge bg-card p-3 shadow-card [margin-block:0.75rem]`,children:[a?(0,Y.jsx)(Ot,{run:e,action:a,prUrl:s,patch:t}):null,i?(0,Y.jsx)(kt,{run:e,blocker:i,flags:n}):null]})}var jt=[`running`,`queued`,`waiting`];function Mt(e,{queuePosition:t,now:n=new Date}){let r=re(e),i=Qe(e,r).label,a=t===void 0?i:`${i} #${t}`,o=jt.includes(e.status)?Pt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Nt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Pt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:Xe(n,t)}}async function X(e,t){try{await navigator.clipboard.writeText(e),S(t)}catch{S(`Run manually: ${e}`)}}function Ft(e){let t=b(),n=h(),r=(0,J.useMemo)(()=>ue(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>de(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function It(e){return m({mutationFn:()=>x(e.id),onError:e=>{if(e instanceof ie&&e.command){X(e.command,`No terminal found — command copied to clipboard.`);return}S(e.message,{tone:`danger`})}})}function Z(e,t){let n=d(),r=a(),i=v(),o=m({mutationFn:t=>ae(e.id,t),onError:e=>S(e.message,{tone:`danger`})}),s=gt(),c=qe(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,u=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&u(ct(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Oe(e.id);return t===void 0||i.isSuccess&&u(t)}).map(t=>({target:t,...st(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Lt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=v().data,s=W(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(O,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)(Fe,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=ke(e,o);return(0,Y.jsxs)(O,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(O,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>S(`Worktree path copied`)).catch(()=>S(`Path: ${t}`))},children:[(0,Y.jsx)(T,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(O,{variant:`outline`,onClick:()=>void X(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{}),`Copy resume command`]})]}):null]})}function Rt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Z(e,t),o=W(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(Ae,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Y.jsxs)(A,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)(Fe,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,className:c,onClick:()=>void X(s,`Worktree path copied`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void X(o,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function zt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=Z(e,t);return!a&&o.length===0?null:r?(0,Y.jsx)(A,{onSelect:r,children:`Open in…`}):(0,Y.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(be,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(Lt,{run:e,canResume:t,onResume:n})})]})}function Bt({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{S(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-xs font-medium break-all`,children:e}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Y.jsx)(T,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Vt({run:e}){let t=b(),n=h(),i=r=>n===void 0?void 0:_e(n,e.id,r,t),a=(0,J.useMemo)(()=>ue(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(D,{reference:t,to:i(t),taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)($e,{run:e,prNumber:t.number})},fe(t)));let l=me(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(D,{reference:{kind:`PR`,url:l},taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Y.jsx)(D,{reference:t,to:i(t),taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},fe(t)));let d=pe(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=ge(d);s.push((0,Y.jsx)(D,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:L(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Y.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Ht(){let e=Ke(),t=l();return et(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ut=e=>e.map(e=>`${e.name}: ${_t(e.url)}`).join(`
2
- `);function Wt(e){return Ht().length>0||e.notify===!0}function Q({run:e}){let t=Ht(),n=t.length>0,r=u(e.id),[i,a]=(0,J.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Y.jsxs)(Y.Fragment,{children:[o?(0,Y.jsxs)(F,{children:[(0,Y.jsx)(N,{asChild:!0,children:(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${R(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ut(t):void 0,children:[(0,Y.jsx)(Ye,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(Se,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(P,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(k,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-xs font-normal text-muted-foreground`,children:t.map(e=>(0,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:_t(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(A,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Y.jsx)(Me,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(A,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>S(`Stopped notifying the webhook`),onError:e=>S(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(xt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Y.jsx)(ht,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(Gt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),S(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>S(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Gt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,J.useId)(),o=(0,J.useId)(),[s,c]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=R(t);return(0,Y.jsx)(We,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Y.jsx)(He,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Y.jsxs)(Ve,{className:`text-left`,children:[(0,Y.jsx)(Ue,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(Be,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:Ut(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(yt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Y.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)(ze,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(O,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(O,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Y.jsx)(ht,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Kt({id:e}){return(0,Y.jsxs)(I,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Y.jsx)(xe,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function qt({id:e}){let t=p(e),n=t.data?L(t.data):e;return(0,Y.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Y.jsxs)(I,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Y.jsx)(xe,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(O,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Jt=3,$=(e,t)=>e.kind===t.kind&&e.number===t.number;function Yt(e,t,n=Jt){let r=t?e.findIndex(e=>$(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Xt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function Zt({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?ve:Ce,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(Pe,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Qt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function $t({servers:e}){let t=lt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Y.jsxs)(O,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(De,{"aria-hidden":`true`}),Qt(e,n),t.live?(0,Y.jsx)(Ye,{tone:`success`,"aria-label":`Preview is live`}):null]})}function en(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function tn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Y.jsx)(Kt,{id:n}):(0,Y.jsx)(qt,{id:n})}function nn({isDesktop:e,desktopActivitySlot:t,attention:n,statusLine:r}){return e&&t?(0,Y.jsx)(Y.Fragment,{children:t}):(0,Y.jsx)(K,{dot:n.tone,shape:n.shape,pulse:n.pulse,className:`max-md:hidden`,children:Nt(r)})}function rn(e,t,n){return n&&!e.archiveBlocker&&t.archive?(0,Y.jsx)(Dt,{run:e}):null}function an({archived:e,className:t}){return e?(0,Y.jsx)(K,{"data-slot":`run-archived-pill`,dot:U.tone,shape:U.shape,className:t,children:U.label}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Wt(t);return e&&(n||r)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,Y.jsx)(Q,{run:t})]}):null}function cn({isDesktop:e,phoneBar:t,run:n,previewToggle:r,mobileActivitySlot:a}){let o=Wt(n);if(e||!a)return null;let s=t&&(!!r||o);return(0,Y.jsxs)(`div`,{"data-slot":s?`run-mobile-actions`:void 0,"data-mobile-session-bar":t||void 0,className:i(`flex flex-wrap items-center gap-2 md:hidden`,t&&`border-t border-border py-1`),children:[a,s?(0,Y.jsxs)(`span`,{className:`ms-auto flex shrink-0 flex-wrap items-center gap-2`,children:[r,(0,Y.jsx)(Q,{run:n})]}):null]})}function ln({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:a,phoneBar:o,isDesktop:s}){let c=(0,J.useRef)(null),[l,u]=(0,J.useState)(!1);(0,J.useEffect)(()=>{let e=c.current;if(!e||s){u(!1);return}let t=()=>u(e.scrollWidth-e.clientWidth-e.scrollLeft>1),n=new ResizeObserver(t);n.observe(e);for(let t of e.children)n.observe(t);return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{n.disconnect(),e.removeEventListener(`scroll`,t)}},[s,r,a,e.diffStat?.files]);let d=n?`${n.kind}#${n.number}`:null;return(0,J.useEffect)(()=>{!d||s||c.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[d,r.map(e=>`${e.kind}#${e.number}`).join(`,`),s]),(0,Y.jsxs)(`div`,{ref:c,"data-slot":`run-tabs`,"data-phone-bar":o||void 0,"data-overflow-end":l||void 0,className:i(`flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-2 max-md:[&>a]:text-[13.5px]`,o?`mt-0`:`mt-3`),children:[(0,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:o,children:`Session`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:o,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:o,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:o,children:`Files`}),r.map(t=>(0,Y.jsx)(q,{to:Xt(e.id,t),active:n!==null&&$(t,n),replace:o,children:(0,Y.jsx)(Zt,{tab:t})},`${t.kind}-${t.number}`)),a.length>0?(0,Y.jsxs)(F,{children:[(0,Y.jsxs)(N,{"data-slot":`run-tabs-more`,"aria-label":`${a.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,a.length]}),(0,Y.jsx)(P,{align:`end`,children:a.map(t=>(0,Y.jsx)(A,{asChild:!0,children:(0,Y.jsx)(I,{to:Xt(e.id,t),replace:o,children:(0,Y.jsx)(Zt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function un({run:e,tab:t=`session`,onMarkedUnread:n,desktopActivitySlot:r,mobileActivitySlot:a}){let o=re(e),s=G(e),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1),f=dn(e,n),p=ee(),m=ne(),h=Mt(e,{queuePosition:e.status===`queued`?Je(p.data??[]).get(e.id):void 0}),g=Ze(),_=rt(),v=g!==null&&!_?g:null,y=v!==null,{referenceProjectId:te,repoBase:b,requests:ie}=Ft(e),ae=(0,J.useMemo)(()=>he(e,b),[e,b]),x=typeof t==`object`?t:null,{inline:oe,overflow:se}=Yt(ae,x),S=m.data?.capabilities?.preview===!0,C=e.worktreePath&&S?(0,Y.jsx)($t,{servers:e.previewServers??[]}):null,w=(0,Y.jsx)(hn,{run:e,actions:f,onOpenChooser:()=>d(!0),onToggleNotes:()=>l(e=>!e)}),ce=rn(e,s,_);return(0,Y.jsx)(Ne,{projectId:te,repoBase:b,requests:ie,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 shrink-0 bg-background px-4 md:px-9 md:pt-7`,y?`pt-0`:`pt-[18px]`,t===`session`&&`border-b border-border`),children:[(0,Y.jsx)(on,{run:e}),(0,Y.jsx)(At,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[(0,Y.jsx)(tn,{run:e}),v?(0,Y.jsxs)(tt,{slot:v,children:[(0,Y.jsx)(mn,{run:e,status:(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,Y.jsx)(K,{"data-slot":`mobile-run-status`,dot:o.tone,shape:o.shape,pulse:o.pulse,className:`max-w-full self-start truncate px-2 py-px text-xs leading-4`,children:h.label}),(0,Y.jsx)(an,{archived:e.archived,className:`px-2 py-px text-xs leading-4`})]})}),(0,Y.jsx)(tn,{run:e,compact:!0}),w]}):(0,Y.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:en(e.delegation)}),(0,Y.jsx)(pn,{run:e}),(0,Y.jsx)(nn,{isDesktop:_,desktopActivitySlot:r,attention:o,statusLine:h}),(0,Y.jsx)(an,{archived:e.archived,className:`max-md:hidden`}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[ce,C,(0,Y.jsx)(Q,{run:e}),w]})]}),(0,Y.jsx)(sn,{shown:v!==null&&!a,run:e,previewToggle:C}),(0,Y.jsx)(ln,{run:e,tab:t,activeItem:x,inlineItemTabs:oe,overflowItemTabs:se,phoneBar:y,isDesktop:_}),(0,Y.jsx)(cn,{isDesktop:_,phoneBar:y,run:e,previewToggle:C,mobileActivitySlot:a}),c?(0,Y.jsx)(vn,{runId:e.id,onClose:()=>l(!1)}):null,u?(0,Y.jsx)(zt,{run:e,canResume:G(e).terminal,onResume:()=>f.terminal.mutate(),onClose:()=>d(!1)}):null]}),(0,Y.jsx)(_n,{run:e,actions:f})]})})}function dn(e,t){let n=se(),r=Ge(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:f.runs.all}),l=e=>S(e.message,{tone:`danger`}),u=c(),d={isPending:u.isPending,mutate:()=>u.mutate({id:e.id,pinned:!e.pinned})},p=s();return{pin:d,markUnread:{isPending:p.isPending,mutate:()=>{t?.(),p.mutate(e.id,{onError:l})}},delete:m({mutationFn:()=>ce(e.id),onSuccess:()=>{o(),r(`/`)},onError:l}),terminal:It(e),confirming:i,setConfirming:a}}function fn(e){let t=o(e.id),n=L(e);return{title:n,editor:ft(n,e=>t.mutate({title:e},{onError:e=>S(e.message,{tone:`danger`})}))}}function pn({run:e}){let{title:t,editor:n}=fn(e);return n.editing?(0,Y.jsx)(ot,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function mn({run:e,status:t}){let{title:n,editor:r}=fn(e);return(0,Y.jsxs)(Re,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Y.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Y.jsx)(Ie,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(dt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Le,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Y.jsx)(ot,{editor:r,className:`text-[16px] font-semibold`})})]})}function hn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=G(e),a=W(e),s=rt(),c=wt(e.id),[l,u]=(0,J.useState)(!1),d=o(e.id),f=(0,J.useId)();return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Et,{run:e,open:l,onOpenChange:u,onConfirm:()=>{c.mutate(!0),u(!1)}}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(N,{asChild:!0,children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(Ee,{"aria-hidden":`true`})})}),(0,Y.jsxs)(P,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(k,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!s&&i.archive&&!e.archiveBlocker?(0,Y.jsx)(A,{disabled:c.isPending,onSelect:()=>e.archived?c.mutate(!1):u(!0),children:Tt(e)}):null,(0,Y.jsxs)(A,{onSelect:n,children:[(0,Y.jsx)(pt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(zt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Y.jsxs)(A,{onSelect:()=>void X(a,`Command copied to clipboard.`),children:[(0,Y.jsx)(T,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(A,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(St,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(M,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(Ct,{"aria-hidden":`true`}):(0,Y.jsx)(we,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(j,{}),(0,Y.jsx)(k,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(M,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:d.isPending,onCheckedChange:e=>d.mutate({archiveWhenDone:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(M,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:d.isPending,"aria-describedby":f,onCheckedChange:e=>d.mutate({autoMergePr:e},{onError:e=>S(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:f,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Y.jsx)(gn,{run:e,patch:d}),i.deleteRun?(0,Y.jsx)(j,{}):null,i.deleteRun?(0,Y.jsxs)(A,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(ye,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function gn({run:e,patch:t}){let n=(0,J.useId)(),r=(0,J.useId)(),i=(0,J.useId)(),a=e=>S(e.message,{tone:`danger`});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{}),(0,Y.jsx)(k,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Y.jsx)(M,{"data-slot":`allow-workers`,className:`min-h-11`,checked:oe(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Y.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,Y.jsx)(M,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:C(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Y.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Y.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function _n({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(B,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(z,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(at,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(H,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:L(e),children:L(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!le(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Y.jsxs)(mt,{children:[(0,Y.jsx)(it,{children:`Cancel`}),(0,Y.jsx)(nt,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function vn({runId:e,onClose:t}){let n=y(e);return(0,Y.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 flex max-h-[min(45dvh,420px)] flex-col overflow-hidden rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(be,{})})]}),(0,Y.jsx)(`div`,{"data-slot":`notes-panel-body`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(bt,{runId:e,children:(0,Y.jsx)(vt,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})}),(0,Y.jsxs)(`div`,{className:`mt-4 flex shrink-0 gap-3`,children:[(0,Y.jsx)(O,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void X(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(O,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{It as a,Rt as i,Bt as n,Ft as o,Vt as r,Mt as s,un as t};