cezarion 0.18.0 → 0.19.0

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 (200) hide show
  1. package/package.json +5 -5
  2. package/web/dist/app-icon.png +0 -0
  3. package/web/dist/assets/accounts-section-COizLyTO.js +1 -0
  4. package/web/dist/assets/{activity-motion-0wHCeUs7.css → activity-motion-DcKVM8fM.css} +1 -1
  5. package/web/dist/assets/activity-motion-DfI5xoMG.js +2 -0
  6. package/web/dist/assets/activity-route-BQs2vBeo.js +1 -0
  7. package/web/dist/assets/agent-config-section-BwBo-HRw.js +7 -0
  8. package/web/dist/assets/agent-defaults-section-h-Gjb_gh.js +1 -0
  9. package/web/dist/assets/agents-settings-path-7X6_cvUg.js +1 -0
  10. package/web/dist/assets/appearance-Bcl2amXv.js +1 -0
  11. package/web/dist/assets/archive-on-merge-field-Bm8miJjt.js +1 -0
  12. package/web/dist/assets/attention-8bNiiAFt.js +1 -0
  13. package/web/dist/assets/automation-format-DB34jUyF.js +1 -0
  14. package/web/dist/assets/automations-route-CutF-cGn.css +1 -0
  15. package/web/dist/assets/automations-route-rSezHxBp.js +2 -0
  16. package/web/dist/assets/badge-DQ3U69Ht.js +1 -0
  17. package/web/dist/assets/bot-TkDIw4y-.js +1 -0
  18. package/web/dist/assets/bundle-mjs-rHxsej31.js +1 -0
  19. package/web/dist/assets/button-B7MKxYjT.js +1 -0
  20. package/web/dist/assets/centered-state-V15AR_qo.js +1 -0
  21. package/web/dist/assets/cez-idle-CdswdDRd.js +1 -0
  22. package/web/dist/assets/change-counts-CW7O8g5Y.js +1 -0
  23. package/web/dist/assets/check-OP-CVgZG.js +1 -0
  24. package/web/dist/assets/chevron-down-CHGyCDBH.js +1 -0
  25. package/web/dist/assets/chevron-right-BENZ-1ZN.js +1 -0
  26. package/web/dist/assets/{chunk-BO2N2NFS-DE6qKn3r.js → chunk-BO2N2NFS-DQrpGzb-.js} +17 -17
  27. package/web/dist/assets/chunk-KS7C4IRE-Cg8l-LDN.js +3 -0
  28. package/web/dist/assets/circle-x-7nTlobAF.js +1 -0
  29. package/web/dist/assets/code-editor-B4baSOhz.js +4 -0
  30. package/web/dist/assets/collapsible-BEV4FO-1.js +1 -0
  31. package/web/dist/assets/command-KdW7aO0N.js +1 -0
  32. package/web/dist/assets/commit-list-DtEqtn9o.js +1 -0
  33. package/web/dist/assets/{core-BCsw8oQw.js → core-DzoyrHjB.js} +2 -2
  34. package/web/dist/assets/design-icons-CzEoMH9c.js +1 -0
  35. package/web/dist/assets/dialog-B531GGAo.js +1 -0
  36. package/web/dist/assets/diff-BK789dS0.js +3 -0
  37. package/web/dist/assets/diff-controls-BFqQNxRu.js +1 -0
  38. package/web/dist/assets/diff-view-BEgQ7jZV.js +11 -0
  39. package/web/dist/assets/dist-BAoXdNsT.js +1 -0
  40. package/web/dist/assets/dist-BW234Kg5.js +1 -0
  41. package/web/dist/assets/dist-C5mlVBmd.js +1 -0
  42. package/web/dist/assets/dist-Czz3Y5qH.js +1 -0
  43. package/web/dist/assets/dist-DXO3xwbC.js +1 -0
  44. package/web/dist/assets/dist-Da4ckcJG.js +1 -0
  45. package/web/dist/assets/dropdown-menu-4e2iKSMT.js +1 -0
  46. package/web/dist/assets/es2015-CQth82uv.js +41 -0
  47. package/web/dist/assets/external-link-BE6y205O.js +1 -0
  48. package/web/dist/assets/file-preview-CDWTFZ4P.js +2 -0
  49. package/web/dist/assets/folder-browser-BfclRPcX.js +1 -0
  50. package/web/dist/assets/folder-o-AvL3y3.js +1 -0
  51. package/web/dist/assets/format-BU7D3IfE.js +1 -0
  52. package/web/dist/assets/git-toolbar-Pugtjt-9.js +1 -0
  53. package/web/dist/assets/github-CvpaGHe6.js +1 -0
  54. package/web/dist/assets/global-activity-route-Di_ICsRI.js +1 -0
  55. package/web/dist/assets/{highlighted-body-OFNGDK62-BL-MfFgl.js → highlighted-body-OFNGDK62-Cx8MiNVZ.js} +1 -1
  56. package/web/dist/assets/highlighter-DvLzHjjY.js +3 -0
  57. package/web/dist/assets/hourglass-CikYdGGQ.js +1 -0
  58. package/web/dist/assets/image-preview-Dx2w5oIn.js +1 -0
  59. package/web/dist/assets/index-CGjknHnV.css +1 -0
  60. package/web/dist/assets/index-CJFT0IZP.js +21 -0
  61. package/web/dist/assets/label-DEH7fJN4.js +1 -0
  62. package/web/dist/assets/lib-DrPFkMXk.js +1 -0
  63. package/web/dist/assets/live-protocol-DMhTnCmf.js +64 -0
  64. package/web/dist/assets/live-reads-BJ9eDISf.js +1 -0
  65. package/web/dist/assets/live-refetch-VoLPvzhe.js +1 -0
  66. package/web/dist/assets/{live-worker-BWdeGzQX.ts → live-worker-DBw-5jVE.ts} +3 -1
  67. package/web/dist/assets/loader-circle-CPBhhDbB.js +1 -0
  68. package/web/dist/assets/markdown-Dv0r75AX.js +4 -0
  69. package/web/dist/assets/mermaid-GHXKKRXX-lTc_AjAC.js +1 -0
  70. package/web/dist/assets/moon-CRE9nU5R.js +1 -0
  71. package/web/dist/assets/nav-row-styles-DqKjMToI.js +1 -0
  72. package/web/dist/assets/notifications-section-DCiqPl3M.js +1 -0
  73. package/web/dist/assets/open-in-menu-HM5l7Bwk.js +1 -0
  74. package/web/dist/assets/own-lookup-DS54wXvD.js +1 -0
  75. package/web/dist/assets/play-CmVAj_fu.js +1 -0
  76. package/web/dist/assets/plus-CxRU2X8C.js +1 -0
  77. package/web/dist/assets/popover-BPgUYFyu.js +1 -0
  78. package/web/dist/assets/preload-helper-Czpn1I53.js +1 -0
  79. package/web/dist/assets/preview-pane-connected-WV9oolnn.js +3 -0
  80. package/web/dist/assets/project-location-CfJLc6aJ.js +1 -0
  81. package/web/dist/assets/project-order-AcHI4Dcl.js +1 -0
  82. package/web/dist/assets/project-rail-sortable-BmVI4_-T.js +1 -0
  83. package/web/dist/assets/project-router-Bii3ofOk.js +1 -0
  84. package/web/dist/assets/project-scope-context-BdqKyBHa.js +4 -0
  85. package/web/dist/assets/projects-section-D2cACaaG.js +1 -0
  86. package/web/dist/assets/prompt-templates-section-toLPd5u2.js +1 -0
  87. package/web/dist/assets/queries-C7VNk-nW.js +1 -0
  88. package/web/dist/assets/reference-chip-rylFalfg.js +1 -0
  89. package/web/dist/assets/remote-settings-notice-N9vtBTIK.js +1 -0
  90. package/web/dist/assets/repo-git-DJym0aRY.js +1 -0
  91. package/web/dist/assets/report-reader-CjskGtxS.js +1 -0
  92. package/web/dist/assets/reports-B-G9HA48.js +1 -0
  93. package/web/dist/assets/reports-CNFNb36Z.css +1 -0
  94. package/web/dist/assets/resources-section-B88h1y0Q.js +1 -0
  95. package/web/dist/assets/run-header-B-olCSdg.js +2 -0
  96. package/web/dist/assets/{run-header-CC7VUTg9.css → run-header-Ccnr9k0X.css} +1 -1
  97. package/web/dist/assets/save-cue-Cd3ZAPBS.js +1 -0
  98. package/web/dist/assets/saved-draft-BwzBc-_Y.js +1 -0
  99. package/web/dist/assets/select-BaydzE-I.js +1 -0
  100. package/web/dist/assets/session-context-section-BJKRXbss.js +119 -0
  101. package/web/dist/assets/settings-agent-picker-6xZMIC_D.js +1 -0
  102. package/web/dist/assets/settings-field-DP9sYv5a.js +1 -0
  103. package/web/dist/assets/settings-select-CCIMGnyA.js +1 -0
  104. package/web/dist/assets/settings-shell-BkTgs1S9.js +1 -0
  105. package/web/dist/assets/settings-shell-iSd4xMWS.css +1 -0
  106. package/web/dist/assets/sidebar-section-B57HIEgv.js +1 -0
  107. package/web/dist/assets/skills-pBrfwrKF.js +1 -0
  108. package/web/dist/assets/skills-pM_PouEs.js +1 -0
  109. package/web/dist/assets/smartphone-Lr8Ug2z_.js +1 -0
  110. package/web/dist/assets/sortable.esm-CAVTYaA3.js +5 -0
  111. package/web/dist/assets/square-terminal-B6RYYieR.js +1 -0
  112. package/web/dist/assets/status-dot-BRzVlF2X.js +1 -0
  113. package/web/dist/assets/switch-SP8pw5uU.js +1 -0
  114. package/web/dist/assets/tab-link-B1CULYRs.js +1 -0
  115. package/web/dist/assets/task-changes-CXldTh93.js +1 -0
  116. package/web/dist/assets/task-commits-BZ3B_GPB.js +1 -0
  117. package/web/dist/assets/task-files-BSfmCkJc.js +1 -0
  118. package/web/dist/assets/task-github-item-v2bygvdO.js +1 -0
  119. package/web/dist/assets/task-groups-BbnYlkYj.js +1 -0
  120. package/web/dist/assets/task-thread-BPWnJ7Qx.js +9 -0
  121. package/web/dist/assets/task-thread-DzADOhZd.css +1 -0
  122. package/web/dist/assets/tasks-table-Cx7AM7lZ.js +1 -0
  123. package/web/dist/assets/textarea-vJt9undk.js +1 -0
  124. package/web/dist/assets/thread-state-R0MTvwlo.js +4 -0
  125. package/web/dist/assets/toaster-Bo5vCbz-.js +1 -0
  126. package/web/dist/assets/use-hand-to-agent-state-B6h6kcQg.css +1 -0
  127. package/web/dist/assets/use-hand-to-agent-state-BckHuhr8.js +1 -0
  128. package/web/dist/assets/{useInfiniteQuery-qEY8OhKb.js → useInfiniteQuery--iQKfpUQ.js} +1 -1
  129. package/web/dist/assets/useQuery-BSyhc3l3.js +1 -0
  130. package/web/dist/assets/utils-DSMR_WLb.js +1 -0
  131. package/web/dist/assets/workflows-BBc2PFDB.js +7 -0
  132. package/web/dist/assets/workflows-C6suai0L.css +1 -0
  133. package/web/dist/assets/workspace-tools-CiTG-ArW.js +1 -0
  134. package/web/dist/assets/worktrees-section-C07tNayi.js +4 -0
  135. package/web/dist/assets/zoomable-image-CIQl1Wpe.js +1 -0
  136. package/web/dist/index.html +68 -32
  137. package/web/dist/live-worker.js +2 -2
  138. package/web/dist/assets/activity-motion-hhx0e841.js +0 -2
  139. package/web/dist/assets/activity-route-De0BnSrc.js +0 -1
  140. package/web/dist/assets/agent-accounts-BCg-578Q.js +0 -18
  141. package/web/dist/assets/alert-dialog-Dj464rjk.js +0 -1
  142. package/web/dist/assets/bundle-mjs-BT31bpU6.js +0 -1
  143. package/web/dist/assets/button-CHUAMTHK.js +0 -3
  144. package/web/dist/assets/centered-state-DGyy0SuA.js +0 -1
  145. package/web/dist/assets/cez-idle-BT0U4GN_.js +0 -1
  146. package/web/dist/assets/commit-diff-panel-DYtYc_dH.js +0 -1
  147. package/web/dist/assets/control-locations-CA9TMupq.js +0 -1
  148. package/web/dist/assets/design-icons-DmYTv2r1.js +0 -1
  149. package/web/dist/assets/diff-controls-BR2uqhwG.js +0 -1
  150. package/web/dist/assets/diff-tVGVhYyc.js +0 -3
  151. package/web/dist/assets/diff-view-CNM3u77o.js +0 -11
  152. package/web/dist/assets/dropdown-menu-DhrBcVgr.js +0 -1
  153. package/web/dist/assets/es2015-D345RR4o.js +0 -41
  154. package/web/dist/assets/file-preview-C1eTdJLJ.js +0 -2
  155. package/web/dist/assets/git-toolbar-Dwz8p8GW.js +0 -1
  156. package/web/dist/assets/github-BSezqH6f.js +0 -1
  157. package/web/dist/assets/github-sidebar-model-Ct0DltOv.js +0 -1
  158. package/web/dist/assets/global-activity-route-BZiYz-B0.js +0 -1
  159. package/web/dist/assets/hourglass-B0lPAJvT.js +0 -1
  160. package/web/dist/assets/image-preview-Cq1vDiEo.js +0 -1
  161. package/web/dist/assets/index-B18AqW0Z.css +0 -1
  162. package/web/dist/assets/index-D489J7QW.js +0 -14
  163. package/web/dist/assets/lib-BxQXEXDF.js +0 -1
  164. package/web/dist/assets/live-protocol-BDY7JJpT.js +0 -64
  165. package/web/dist/assets/live-refetch-C0kQc3-z.js +0 -1
  166. package/web/dist/assets/loader-circle-CZkGEdoI.js +0 -1
  167. package/web/dist/assets/markdown-D7DUNWcJ.js +0 -6
  168. package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +0 -1
  169. package/web/dist/assets/nav-row-styles-BZUUavOF.js +0 -1
  170. package/web/dist/assets/popover-DRcRI46x.js +0 -1
  171. package/web/dist/assets/preview-pane-connected-DGkEs_L3.js +0 -3
  172. package/web/dist/assets/project-router-1m_VlC22.js +0 -1
  173. package/web/dist/assets/project-scope-context-CaUqlAd7.js +0 -4
  174. package/web/dist/assets/queries-DYfIpJ-d.js +0 -1
  175. package/web/dist/assets/repo-git-CU1S5P-y.js +0 -1
  176. package/web/dist/assets/report-reader-DlZol2Ux.js +0 -1
  177. package/web/dist/assets/reports-B7QAzibP.css +0 -1
  178. package/web/dist/assets/reports-DIGGjk7C.js +0 -1
  179. package/web/dist/assets/run-header-DPjiPKRe.js +0 -2
  180. package/web/dist/assets/skill-empty-hint-YDmkqgo-.js +0 -1
  181. package/web/dist/assets/skills-BMwanop_.js +0 -1
  182. package/web/dist/assets/skills-DFBiAuJG.js +0 -1
  183. package/web/dist/assets/skills-workflows-C21NystW.css +0 -1
  184. package/web/dist/assets/sortable.esm-zp_qkYGV.js +0 -5
  185. package/web/dist/assets/tab-link-DCUifQ46.js +0 -1
  186. package/web/dist/assets/task-changes-BZXWvQN3.js +0 -1
  187. package/web/dist/assets/task-commits-ByI9MSfc.js +0 -1
  188. package/web/dist/assets/task-files-LJbenpiH.js +0 -1
  189. package/web/dist/assets/task-github-item-B0CU9lGR.js +0 -1
  190. package/web/dist/assets/task-thread-CXCN__1a.js +0 -9
  191. package/web/dist/assets/task-thread-DtQ6uGfQ.css +0 -1
  192. package/web/dist/assets/textarea-DlVUfdWG.js +0 -1
  193. package/web/dist/assets/thread-state-BLaCzqeX.js +0 -4
  194. package/web/dist/assets/toaster-B1MyeHiE.js +0 -1
  195. package/web/dist/assets/use-hand-to-agent-state-BkmKad8x.js +0 -1
  196. package/web/dist/assets/use-hand-to-agent-state-C7esPJ-N.css +0 -1
  197. package/web/dist/assets/useQuery-DOJQOEBO.js +0 -1
  198. package/web/dist/assets/workflows-Dbxb-d-6.js +0 -7
  199. package/web/dist/assets/ws-DvGmrP4z.js +0 -1
  200. package/web/dist/assets/zoomable-image-5pOUaPEg.js +0 -1
@@ -0,0 +1 @@
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{n as i,t as a,u as o}from"./live-refetch-VoLPvzhe.js";import{$t as s,Ai as c,C as l,Ct as u,Di as d,Dt as f,E as p,G as m,Gt as h,H as g,Ht as _,In as v,Ir as ee,It as te,J as ne,Jt as re,K as ie,Kt as ae,Ln as oe,Lt as se,N as ce,Ni as le,Nn as ue,Ot as de,Pn as fe,Rr as pe,S as me,Si as he,St as ge,T as _e,Ti as ve,U as ye,Ut as be,V as xe,Vt as Se,W as Ce,Wr as we,Wt as Te,X as Ee,Xt as De,Y as Oe,Yt as ke,Zt as Ae,_ as je,_i as Me,_n as Ne,_t as Pe,ai as Fe,b as Ie,bi as Le,br as Re,bt as ze,ci as Be,cn as Ve,di as y,dn as He,en as Ue,f as We,fi as Ge,fn as Ke,ft as qe,g as Je,gi as Ye,gn as Xe,gt as Ze,hn as Qe,hr as $e,ht as et,ii as tt,in as nt,it as rt,j as it,jt as at,k as ot,ki as st,kt as ct,li as lt,ln as ut,lt as dt,mn as ft,mt as pt,ni as mt,nn as ht,oi as gt,p as _t,pt as vt,qt as yt,r as bt,ri as xt,rn as St,si as Ct,sn as wt,tn as Tt,un as Et,v as Dt,vt as Ot,w as kt,wt as At,x as jt,xt as Mt,y as Nt,yt as Pt,zn as Ft,zr as It,zt as Lt}from"./project-scope-context-BdqKyBHa.js";import{A as Rt,B as b,F as x,H as S,I as C,N as w,P as T,W as E,Z as D,j as O,z as k}from"./live-protocol-DMhTnCmf.js";import{t as zt}from"./useInfiniteQuery--iQKfpUQ.js";import{t as A}from"./useQuery-BSyhc3l3.js";import{n as j,r as Bt,t as Vt}from"./live-reads-BJ9eDISf.js";import{n as Ht}from"./toaster-Bo5vCbz-.js";var Ut=class extends Ye{#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||Wt(),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=Me({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),D.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Wt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Gt=class extends le{#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),st(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Le(t.mutationKey)!==Le(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??Wt();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){D.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 Kt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function qt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Jt=class extends le{#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,D.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||!st(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Kt(e,n).forEach(e=>{e.destroy()}),Kt(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=d(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 Ge(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=qt(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)&&D.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},M=e(t(),1);function N({queries:e,...t},n){let r=y(n),i=lt(),a=Be(),o=M.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{mt(e);let t=r.getQueryCache().get(e.queryHash);Fe(e,a,t)}),Ct(a);let[s]=M.useState(()=>new Jt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;M.useSyncExternalStore(M.useCallback(e=>d?s.subscribe(D.batchCalls(e)):ve,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),M.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>tt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&tt(n,e)?xt(n,new Ge(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&gt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function P(e,t){let n=y(t),[r]=M.useState(()=>new Gt(n,e));M.useEffect(()=>{r.setOptions(e)},[r,e]);let i=M.useSyncExternalStore(M.useCallback(e=>r.subscribe(D.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=M.useCallback((e,t)=>{r.mutate(e,t).catch(ve)},[r]);if(i.error&&c(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 Yt(e,t=!0,n=!1,r){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>de(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`]:W.models(t),refetchType:n})}function Xt(e,t=!0,n){return A({...Zt(e,n),enabled:t})}var Zt=(e,t)=>({queryKey:W.models(e,t),queryFn:({signal:n})=>Ft(e,{signal:n},t),staleTime:300*1e3});function Qt(e,t=!0){let n=N({queries:e.map(e=>({...Zt(e),enabled:t}))});return Object.fromEntries(e.map((e,t)=>[e,n[t]]))}function $t(e,t){return JSON.stringify([e,t])}function en(e){return e.type===`run`?e.run.id:e.id}function R(e,t){return{...e,runs:t}}function tn(e,t){let n=0;for(let r of e)r.projectId===t&&r.archived&&(n+=1);return n}var nn=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($t(e.projectId,e.id),t))}at(e,t){return this.positions.get($t(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 rn(e,t,n){let r=new nn(e.runs),i=e,a=!1;for(let e of t)if(e.type===`usage`)i=un(i,e.project,e.usage,r);else{let t=sn(i,e.change,n,r);i=t.index,a||=t.reconcile}return{index:i,reconcile:a}}function an(e,t,n){return n?n.has(t):e.runs.some(e=>e.projectId===t)}function on(e,t,n){return sn(e,t,n,new nn(e.runs))}function sn(e,t,n,r){let{project:i}=t,a=r.at(i,en(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&&!an(e,i,n))return{index:e,reconcile:!0};let l=d(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||tn(t,i)>e.perProjectLimit);return{index:R(e,t),reconcile:n}}if(s)return ln(e,l,r);let u=r.insert(l);return{index:R(e,u),reconcile:l.archived&&tn(u,i)>e.perProjectLimit}}function cn(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 ln(e,t,n){let r=cn(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 un(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=d(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 dn(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 fn(){return{stream:void 0,lastStream:void 0,mismatch:void 0,floor:void 0,changes:new Map}}function pn(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 mn(e){e.stream=void 0}function hn(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,en(t)]),a=e.changes.get(i);return(!a||a.seq<t.seq)&&e.changes.set(i,{...t,generation:r}),!0}function gn(e,t){for(let[n,r]of e.changes)r.project===t&&e.changes.delete(n)}function _n(e){return typeof e.generation==`string`&&typeof e.eventSeq==`number`}function vn(e,t,n){if(!_n(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=on(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`],yn=[`workspace`,`projects`],bn=6e4,xn=100,Sn=new WeakMap;function Cn(e){let t=Sn.get(e);return t||(t=On(e),Sn.set(e,t)),t}function wn(e,t){return typeof e!=`object`||!e||!Array.isArray(e.runs)?e:Cn(t).merge(e)}function Tn(e){let t=e.getQueryData(yn)?.projects;return t?new Set(t.map(e=>e.id)):void 0}function En(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 Dn(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 On(e){let t=fn(),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=Tn(e),{index:s,reconcile:c}=rn(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})},ee=()=>{if(i!==void 0)return;let e=c+250-Date.now();if(e>0){i=setTimeout(v,e);return}i=setTimeout(v,xn),typeof requestAnimationFrame==`function`&&(r=requestAnimationFrame(v))};return{ready(e,n){pn(t,e,n),u=!1,f&&(f=!1,_({hold:!0}))},detach(){mn(t)},run(e,r,i=!1){if(l.has(e))return;let a=Dn(e,r);if(!hn(t,a,i)){p();return}n.push({type:`change`,change:a,generation:t.stream}),ee()},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}),ee()}},dropProject(e){l.add(e),gn(t,e),n=n.filter(t=>(t.type===`change`?t.change.project:t.project)!==e);let r=h();if(!r)return;let i=dn(r,e);i!==r&&m(i)},setUnknownGenerationHandler(e){d=e},restoreProject(e){l.delete(e)},merge(n){let r=h(),i=vn(t,n,Tn(e));for(let e of l)i.index=dn(i.index,e);return i.reconcile&&queueMicrotask(()=>{_({hold:!0})}),En(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}}}function kn(e,t,r=!0){let i=mi(),a=K(),{runner:s,ready:c}=o(e??i.data?.defaultRunner??`claude`),l=a.data?.capabilities?.localHandoff===!1?null:t,u=n(),d=A({queryKey:U.runnerSkills(s,l),queryFn:({signal:e})=>me(s,l,{signal:e,projectId:u}),enabled:r&&c&&(e!==void 0||!i.isPending)&&(!t||!a.isPending),retry:!1});return{...d,runner:s,account:l,data:d.data?.skills,list:d.data,unchecked:d.isError||!d.data||d.data.source===`unavailable`}}var An={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`}},jn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function Mn(e){return typeof e==`string`&&Object.hasOwn(An,e)}function Nn(e){return e!==void 0&&Mn(e)?An[e]:void 0}var Pn=`cez.reference-statuses.v1`,Fn=`cez.reference-conflicts.v1`,B=new Map(zn()),In=1e3;function Ln(e,t){if(B.get(e)!==t){for(B.delete(e),B.set(e,t);B.size>In;){let e=B.keys().next().value;if(e===void 0)break;B.delete(e)}Hn()}}var V=new Set(Bn());function Rn(e,t){if(V.has(e)!==t){if(t)for(V.add(e);V.size>In;){let e=V.values().next().value;if(e===void 0)break;V.delete(e)}else V.delete(e);Hn()}}function zn(){try{let e=globalThis.sessionStorage?.getItem(Pn);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`&&Mn(e[1])):[]}catch{return[]}}function Bn(){try{let e=globalThis.sessionStorage?.getItem(Fn);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var Vn;function Hn(){Vn===void 0&&(Vn=setTimeout(()=>{Vn=void 0;try{globalThis.sessionStorage?.setItem(Pn,JSON.stringify([...B])),globalThis.sessionStorage?.setItem(Fn,JSON.stringify([...V]))}catch{}},250))}var H=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function Un(e,t){return{...e?{status:e}:{},...t?{conflicting:!0}:{}}}function Wn(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 Gn(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;Ln(t,o),s!==void 0&&Rn(t,s),e.set(t,{state:`ready`,status:o,...s??a?{conflicting:!0}:{}})}function Kn(e,t,n){let r=H(t),i=B.get(r),a=V.has(r)?!0:void 0,o=n.data;if(o?.available){Gn(e,r,t,o,i,a);return}if(o){e.set(r,{state:`unavailable`,reason:o.reason,...Un(i,a)});return}if(n.isError){e.set(r,{state:`unavailable`,reason:n.error instanceof Error?n.error.message:void 0,...Un(i,a)});return}e.set(r,{state:`loading`,...Un(i,a)})}function qn(e,t){let n=new Map;return t.forEach((t,r)=>{let i=e[r];if(i)for(let e of Wn(i))Kn(n,e,t)}),n}var U={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`]}},W={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)=>[...W.fsBrowseRoot,e,t]};function Jn(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 Yn(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 Xn(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 Zn(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 Qn(){let e=y();return A({queryKey:W.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(W.providerStatus),r=await ht(!1,{signal:t});return Re(n,e.getQueryData(W.providerStatus),r)},staleTime:5*6e4,refetchInterval:a(!1),refetchOnWindowFocus:!0})}function $n(){let e=y();return P({mutationFn:()=>ht(!0),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Re(r,e,t)),L(e)}})}function er(){let e=y();return P({mutationFn:({provider:e,authFailureId:t})=>He(e,t),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>Re(r,e,t,n.authFailureId)),L(e,n.provider)}})}function tr(e={}){return A({queryKey:W.projects,queryFn:({signal:e})=>Tt({signal:e}),...e})}function nr(e,t=!1){return A({queryKey:W.fsBrowse(e,t),queryFn:({signal:n})=>Te(e??void 0,{signal:n,showHidden:t}),retry:!1})}function rr(){let e=y();return P({mutationFn:e=>wt(e),onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function ir(){let e=y();return P({mutationFn:e=>ut(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:W.projects})}})}function ar(){let e=y();return P({mutationFn:e=>{let{id:t,...n}=e;return Xe(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:W.projects});let r=e.getQueryData(W.projects);return e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?or(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(W.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:W.projects})})}function or(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?[]:Zn(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 sr(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(W.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:W.projects})})}function cr(){return sr(e=>{let{projectId:t,...n}=e;return ke(t,n)})}function lr(){return sr(e=>{let{projectId:t,webhookId:n,...r}=e;return Ne(t,n,r)})}function ur(){return sr(({projectId:e,webhookId:t})=>Et(e,t))}function dr(){return P({mutationFn:({projectId:e,webhookId:t})=>ft(e,t),retry:!1})}function G(e){let t=y();return P({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:W.agentProfiles}),t.invalidateQueries({queryKey:W.projects}),t.invalidateQueries({predicate:({queryKey:e})=>e[1]===`runner-skills`}),L(t)])},onError:()=>{t.invalidateQueries({queryKey:U.health}),t.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function fr(){return G(e=>yt(e))}function pr(){return G(e=>{let{id:t,...n}=e;return Qe(t,n)})}function mr(){return G(e=>Ve(e))}function hr(){return G(e=>Ke(e))}function gr(e,t){return A({queryKey:W.agentAccountStatus(e),queryFn:({signal:t})=>De(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function _r(){let e=y();return P({mutationFn:({provider:e,profileId:t})=>ae(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:W.agentProfiles}),e.invalidateQueries({queryKey:W.providerStatus}),L(e,n,`none`)])},onError:()=>{e.invalidateQueries({queryKey:U.health}),e.invalidateQueries({queryKey:W.agentProfiles,exact:!0})}})}function vr(){let e=y();return P({mutationFn:e=>De(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(W.agentAccountStatus(n),t),e.invalidateQueries({queryKey:W.agentProfiles}),L(e,t.status.provider)}})}function yr(){let e=y();return P({mutationFn:e=>h(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function br(){let e=y();return P({mutationFn:e=>re(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function xr({enabled:e}){return A({queryKey:W.githubOwners,queryFn:({signal:e})=>s({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Sr(){let e=y();(0,M.useEffect)(()=>{let t,n=()=>{let n=e.getQueryData(U.health);n&&(pe({bootProject:n.bootProject??`default`,apiBase:r()}),t??=Bt(`health`,t=>{e.setQueryData(U.health,t)}))};n();let i=e.getQueryCache().subscribe(n);return()=>{i(),t?.(),we()}},[e])}function K(){return A({queryKey:U.health,queryFn:({signal:e})=>Ue({signal:e})})}function Cr(e,t){let n=K().data,r=tr(t).data?.projects,i=bt(),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?Jn(n?.repo?.remote):void 0}function wr(){return A({queryKey:W.uiState,queryFn:({signal:e})=>nt({signal:e})})}function Tr(){return A({queryKey:W.config,queryFn:({signal:e})=>St({signal:e})})}function Er(){return A({queryKey:W.agentProfiles,queryFn:({signal:e})=>Ae({signal:e})})}var q=[`workspace`,`runs-index`],J=e=>[e.cacheScope,`runs`,`list`],Y=e=>[e.cacheScope,`runs`,`detail`,e.runId],X=e=>typeof e==`function`?e():e;function Dr(e){let{seenAt:t,...n}=e;return n}function Or(e,t){let n=Dr(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function kr(e,t,n){return t?{...e,seenAt:n}:Dr(e)}function Ar(e){let t=()=>{e.invalidateQueries({queryKey:q})};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=It(),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:J(X(n))}),await e.cancelQueries({queryKey:Y(X(n))});let i=e.getQueryData(J(X(n))),a=e.getQueryData(Y(X(n))),o=X(n).runId,s=new Date().toISOString();return e.setQueryData(J(X(n)),e=>e?.map(e=>e.id===o?kr(e,r,s):e)),e.setQueryData(Y(X(n)),e=>e&&kr(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(J(X(n)),i),a&&e.setQueryData(Y(X(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(J(X(n)),e=>e?.map(e=>e.id===o?Or(e,t):e)),a&&e.setQueryData(Y(X(n)),e=>e&&Or(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?kr(e,r,i.seenAt):e;e.setQueryData(J(X(n)),e=>e?.map(a));let s={...X(n),runId:r?o:i.id};e.setQueryData(Y(s),e=>e?a(e):i),t()}}}async function a(t,n){await e.cancelQueries({queryKey:q});let i=e.getQueryData(q),a=n();return e.setQueryData(q,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(q,i)},settle(){r(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:r}}function Z(){let e=y();return(0,M.useMemo)(()=>Ar(e),[e])}async function jr(e,t=!1){return oe(await fe.api.v1.p[`:projectId`].runs[`:id`][`worker-destroy`].$post({param:{projectId:n(),id:encodeURIComponent(e)},query:{},json:t?{discardWork:!0}:{}}),v(e,`/worker-destroy`))}function Mr(){return A({queryKey:U.openTargets,queryFn:({signal:e})=>Pe({signal:e}),staleTime:5*6e4})}function Nr(){return A({queryKey:U.runs.list(),queryFn:({signal:e})=>de(F(),{signal:e})})}function Pr(e,t){return zt({queryKey:U.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>qe({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 Fr(e){let t=e.trim();return A({queryKey:W.runsSearch(t),queryFn:({signal:e})=>Se(t,{signal:e}),enabled:t.length>=2,placeholderData:he,staleTime:1e4})}function Ir(e=!0,t=bn,n){let r=Cn(y());return j(`/api/v1/workspace/runs-index`,W.runsIndex,a(e?t:!1),wn),A({queryKey:W.runsIndex,queryFn:({signal:e})=>ct({signal:e}).then(r.merge),enabled:e,...n?{select:n}:{},staleTime:3e4,refetchInterval:!1})}function Lr(e){let t=y();return P({mutationFn:({workerId:e,discardWork:t=!1})=>jr(e,t),onSettled:()=>t.invalidateQueries({queryKey:U.runs.relationships(e)})})}function Rr(e,t={}){return A({queryKey:U.runs.relationships(e),queryFn:({signal:t})=>f(e,{signal:t}),enabled:t.enabled??!0})}function zr(e){return A({queryKey:U.runs.detail(e??``),queryFn:({signal:t})=>Ot(I(e),{signal:t}),enabled:!!e})}function Br(e,t,n=!0){return A({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Ot(I(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function Vr(e){return A({queryKey:U.runs.diff(e??``),queryFn:({signal:t})=>ge(e,{signal:t}),enabled:!!e})}function Hr(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/changes`:void 0,U.runs.changes(e??``),a(t?4e3:!1)),A({queryKey:U.runs.changes(e??``),queryFn:({signal:t})=>Pt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function Ur(e,t){return A({queryKey:U.runs.file(e??``,t??``),queryFn:({signal:n})=>u(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function Wr(e,t){return A({queryKey:[n(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Ze(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Gr(e,t){return A({queryKey:[n(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>vt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function Kr(e,t){return A({queryKey:[n(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>pt(e,t,{signal:n}),enabled:t!==null,retry:!1})}function qr(e){return A({queryKey:[n(),`runs`,`artifacts`,e],queryFn:({signal:t})=>et(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function Jr(e,t=!1){return j(e?`/api/v1/p/${n()}/runs/${encodeURIComponent(e)}/commits`:void 0,U.runs.commits(e??``),a(t?5e3:!1)),A({queryKey:U.runs.commits(e??``),queryFn:({signal:t})=>Mt(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function Yr(e,t){return A({queryKey:U.runs.commit(e??``,t??``),queryFn:({signal:n})=>ze(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function Xr(e,t=!0){return A({queryKey:U.runs.handoff(e??``),queryFn:({signal:t})=>At(I(e),{signal:t}),enabled:!!e&&t})}function Zr(e,t,n){return A({queryKey:e===void 0?U.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>At(I(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function Qr(e,t){let r=[...new Set(e)],i=N({queries:r.map(e=>({queryKey:[e??n(),`automations`,`names`],queryFn:({signal:t})=>Je({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 $r(e){let t=y();return P({mutationFn:t=>at(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ei(e){let t=y();return P({mutationFn:t=>te(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ti(e){let t=Z(),n=e?.projectId,r=e?.cacheScope,i=P({mutationFn:e=>be(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 ni(){let e=Z();return P({mutationFn:e=>be(I(e),!1),onMutate:t=>e.patchRead(()=>I(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function ri(e){let t=Z();return P({mutationFn:({id:t,pinned:n})=>se(I(t,e),n),onError:e=>Ht(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??F(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function ii(e,t){let n=Z();return P({mutationFn:n=>_(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof ue&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function ai(e,t){let n=Z();return P({mutationFn:(n={})=>rt(I(e,{projectId:t}),n),onMutate:()=>F({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function oi(e){let t=y();return P({mutationFn:({msgId:t,message:n})=>dt(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function si(e){let t=y();return P({mutationFn:t=>Lt(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function ci(){return A({queryKey:U.workflows,queryFn:({signal:e})=>_e({signal:e})})}function li(){return A({queryKey:U.repo,queryFn:({signal:e})=>Dt({signal:e})})}function ui(e){return A({queryKey:[e,`repo`],queryFn:({signal:t})=>Dt({signal:t},e)})}function di(){return A({queryKey:U.repoBranches,queryFn:({signal:e})=>Nt({signal:e})})}function fi(){return A({queryKey:U.repoChanges,queryFn:({signal:e})=>Ie({signal:e}),retry:!1})}function pi(e){return A({queryKey:U.repoCommit(e??``),queryFn:({signal:t})=>jt(e,{signal:t}),enabled:!!e,retry:!1})}function mi(){return A({queryKey:U.config,queryFn:({signal:e})=>je({signal:e})})}function hi(){return A({queryKey:U.worktrees,queryFn:({signal:e})=>p({signal:e})})}function gi(e){return A({queryKey:[e,`worktrees`],queryFn:({signal:t})=>p({signal:t},e),staleTime:0})}function _i(e,t=!0,n=!1){return A({queryKey:[F({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>kt({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:ee(e.sidebarLimits)},enabled:t})}function vi(){return _i(n())}function yi(){return A({queryKey:U.agentConfig,queryFn:({signal:e})=>We({signal:e})})}function bi(e){return A({queryKey:U.agentConfigFile(e??``),queryFn:({signal:t})=>_t(e,{signal:t}),enabled:e!==null})}function xi(){return A({queryKey:U.sessionContext,queryFn:({signal:e})=>l({signal:e})})}function Si(e,t,n=``){return A({queryKey:U.sessionContextPreview(e,t,n),queryFn:({signal:n})=>ot({content:e,role:t},{signal:n}),placeholderData:he,staleTime:0,retry:!1})}function Ci(){let e=y();return P({onMutate:()=>({fileKey:U.sessionContext}),mutationFn:e=>ce(e),onSuccess:(t,n,r)=>{r&&e.setQueryData(r.fileKey,t)}})}function wi(e){let t=y(),n=U.agentConfig,r=U.agentConfigFile(e);return P({mutationFn:t=>it(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}var Ti=O([`passing`,`failing`,`pending`]).nullable(),Q=b({kind:O([`issue`,`pr`]),number:k(),title:E(),author:E(),createdAt:E(),labels:w(E()),body:E().optional(),url:E(),comments:k(),assignees:w(E()).optional(),projectIds:w(E()).optional(),isDraft:T().optional(),additions:k().optional(),deletions:k().optional(),checks:Ti.optional()});x(`available`,[b({available:C(!0),item:Q.nullable(),labelColors:S(E(),E()).optional()}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),number:Rt().int().positive().safe()});var Ei=b({id:E(),title:E(),url:E()});b({available:T(),reason:E().optional(),repo:E().optional(),syncedAt:E().optional(),issues:w(Q),prs:w(Q),labelColors:S(E(),E()).optional(),viewerLogin:E().optional(),projects:w(Ei).optional(),projectsReason:E().optional(),projectsState:O([`refreshing`,`ready`,`unavailable`]).optional(),projectsGeneration:E().optional(),issuesTotal:k().int().nonnegative().optional(),prsTotal:k().int().nonnegative().optional(),issuesNextCursor:E().nullable().optional(),prsNextCursor:E().nullable().optional(),commentsDeferred:C(!0).optional()});var Di=E().min(1).max(2e3).optional();b({limit:E().optional(),refresh:E().optional(),issuesCursor:Di,prsCursor:Di,issuesDone:C(`1`).optional(),prsDone:C(`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`})}),b({kind:O([`issue`,`pr`]),numbers:E().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:C(`1`).optional()}),x(`available`,[b({available:C(!0),counts:S(k(),k().int().nonnegative())}),b({available:C(!1),reason:E()})]),x(`available`,[b({available:C(!0),checks:S(k(),Ti)}),b({available:C(!1),reason:E()})]),b({kind:O([`issue`,`pr`]),q:E().trim().min(1).max(256),limit:Rt().int().positive().max(50).optional()}),b({available:T(),projectsReason:E().optional(),reason:E().optional(),items:w(Q),truncated:T().optional(),labelColors:S(E(),E()).optional()});var Oi=k().nullable();x(`available`,[b({available:C(!0),prs:S(k(),$e),issues:S(k(),$e),conflicts:w(k()).optional(),recheckAfterMs:Oi}),b({available:C(!1),reason:E(),recheckAfterMs:Oi})]);var ki=b({id:k(),author:E(),avatarUrl:E().optional(),createdAt:E(),body:E(),kind:O([`comment`,`review`]),reviewState:O([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:E()}),Ai=O([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),ji=b({id:E(),kind:Ai,actor:E(),avatarUrl:E().optional(),createdAt:E(),url:E().optional(),sha:E().optional(),message:E().optional(),checks:Ti.optional(),label:b({name:E(),color:E().optional()}).optional(),subject:E().optional(),refNumber:k().optional(),refTitle:E().optional(),refIsPr:T().optional()});b({available:T(),reason:E().optional(),comments:w(ki),truncated:T().optional(),events:w(ji).optional(),detail:b({body:E(),additions:k().int().nonnegative().optional(),deletions:k().int().nonnegative().optional()}).optional()});var Mi=O([`merge`,`squash`,`rebase`]),Ni=b({name:E(),state:O([`passing`,`failing`,`pending`,`unknown`]),required:T().nullable(),url:E().optional()}),Pi=b({number:k(),title:E(),url:E(),state:O([`open`,`closed`,`merged`]),isDraft:T(),headRef:E(),baseRef:E(),headSha:E(),mergeable:O([`mergeable`,`conflicting`,`unknown`]),reviewDecision:O([`approved`,`changes-requested`,`review-required`,`not-required`,`unknown`]),checks:w(Ni),methods:w(Mi),defaultMethod:Mi.nullable(),eligibility:O([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:w(b({code:E(),message:E()})),canMerge:T(),canOverride:T()});x(`available`,[b({available:C(!0),mergeState:Pi}),b({available:C(!1),reason:E()})]),b({merged:C(!0),number:k(),url:E(),method:Mi,mergeCommitSha:E().optional()});var Fi=b({path:E(),previousPath:E().optional(),status:O([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:k(),deletions:k(),patch:E().optional(),patchUnavailableReason:O([`binary`,`too-large`,`not-provided`]).optional(),truncated:T().optional()});x(`available`,[b({available:C(!0),number:k(),headSha:E(),files:w(Fi),additions:k(),deletions:k(),truncated:T(),reason:E().optional()}),b({available:C(!1),reason:E()})]),b({generation:E().uuid()}),x(`state`,[b({generation:E().uuid(),state:C(`ready`),projects:w(Ei),membership:S(E(),w(E()))}),b({generation:E().uuid(),state:C(`unavailable`),reason:E()})]);function Ii(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 Li(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function Ri(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function zi(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){Ri(t.issues,a,r),Ri(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 $=e=>e.map(e=>e.number).join(`,`);function Bi(e,t){let n=e[0];if(e.length>1&&n&&($(n.issues)!==$(t.issues)||$(n.prs)!==$(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 Vi(e={},t=!0){let r=y(),i=U.github(e);j(`/api/v1/p/${n()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,a(t?6e4:!1));let o=A({queryKey:U.github(e),queryFn:({signal:t})=>xe({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),s=o.data?.projectsGeneration,c=A({queryKey:[...i,`projects`,s],queryFn:({signal:e})=>ne(s,{signal:e}),enabled:t&&o.data?.projectsState===`refreshing`&&!!s,staleTime:1/0,retry:!1});return(0,M.useEffect)(()=>{!s||!c.data&&!c.error||r.setQueryData(i,e=>{if(!e||e.projectsGeneration!==s||e.projectsState!==`refreshing`)return e;let t=c.data;return t?.generation&&t.generation!==s?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,s,c.data,c.error,i]),o}var Hi=class extends Error{};function Ui(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 Hi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>Ii(e),retry:(e,t)=>!(t instanceof Hi)&&!(t instanceof ue&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function Wi(e=50,t=!0){let r=y(),i=U.githubPages(e),o=U.githubPagesHead(e);j(`/api/v1/p/${n()}/github?limit=${e}`,o,a(t?6e4:!1));let s=zt({...Ui(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),c=A({queryKey:o,queryFn:({signal:t})=>xe({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:l}=s;(0,M.useEffect)(()=>{if(!c.data)return;let e=r.getQueryData(i);if(!e||e.pages.length===0)return;let t=Bi(e.pages,c.data);t===`refetch`?l():r.setQueryData(i,{...e,pages:t})},[r,c.dataUpdatedAt,l]);let u=(s.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),d=N({queries:u.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>ne(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,M.useEffect)(()=>{d.forEach((e,t)=>{let n=u[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,d.map((e,t)=>e.data||e.error?u[t]:``).join(`,`)]),{pages:s,data:(0,M.useMemo)(()=>zi(s.data?.pages??[]),[s.data])}}function Gi(e,t=50,n=!0){let r=zt({...Ui([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,M.useMemo)(()=>zi(r.data?.pages??[]),[r.data])}}function Ki(e,t,n=!0){let r=N({queries:t.filter(e=>e.length>0).map(t=>({queryKey:U.githubCommentCounts(e,t),queryFn:({signal:n})=>ye(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 qi(e,t,n,r=!0){return A({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>Ee(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function Ji(e,t=!0){return A({queryKey:U.githubChecks(e),queryFn:({signal:t})=>g(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Yi(e,t,n=!0){return A({queryKey:U.githubSearch(e,t),queryFn:({signal:n})=>Ee(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Xi=100;function Zi(e){return[...e].sort((e,t)=>t-e).slice(0,Xi).sort((e,t)=>e-t)}function Qi(){let e=bt(),t=K();return e.projectId??t.data?.bootProject}function $i(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Ln(H({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Ln(H({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var ea=5*6e4;function ta(e){return e?e.recheckAfterMs:ea}function na(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:Zi(t.prs),issues:Zi(t.issues)}))},[e.map(H).sort().join(`|`)]),r=N({queries:n.map(e=>({queryKey:U.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>Oe(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}))}),a=y(),o=JSON.stringify(n.map((e,t)=>({...e,interval:ta(r[t]?.data)??!1})));(0,M.useEffect)(()=>{if(!t||i())return;let e=!0,n=JSON.parse(o).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=U.githubRefStatus(t.projectId,t.prs,t.issues);return Vt({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||a.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&a.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,o,a]);let s=(0,M.useMemo)(()=>qn(n,r),[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,M.useCallback)(e=>{let t=H(e),n=s.get(t);if(n)return n;let r=B.get(t);return{state:`idle`,...r?{status:r}:{},...V.has(t)?{conflicting:!0}:{}}},[s])}function ra(e,t,n=!0){return A({queryKey:U.githubComments(e,t),queryFn:({signal:n})=>Ce(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function ia(e,t,n=!0){return A({queryKey:U.githubItem(e,t),queryFn:({signal:n})=>m(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function aa(e){return A({queryKey:U.githubPrChanges(e??0),queryFn:({signal:t})=>ie(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{Vr as $,N as $t,ci as A,hr as At,Wr as B,U as Bt,li as C,vr as Ct,xi as D,ir as Dt,pi as E,mr as Et,qr as F,Tr as Ft,ei as G,Cn as Gt,ni as H,jn as Ht,Qr as I,wr as It,si as J,Xt as Jt,ri as K,L as Kt,ai as L,Yn as Lt,Pr as M,pr as Mt,Gr as N,ar as Nt,Si as O,ur as Ot,Kr as P,lr as Pt,Jr as Q,P as Qt,Lr as R,Xn as Rt,Ci as S,Qn as St,fi as T,rr as Tt,$r as U,Nn as Ut,ti as V,W as Vt,Mr as W,kn as Wt,Hr as X,F as Xt,zr as Y,Yt,Yr as Z,I as Zt,mi as _,xr as _t,ra as a,Fr as at,gi as b,Cr as bt,aa as c,Z as ct,qi as d,yr as dt,Ut as en,Ur as et,Qi as f,_r as ft,bi as g,nr as gt,yi as h,cr as ht,Ki as i,Ir as it,hi as j,dr as jt,vi as k,er as kt,Yi as l,gr as lt,Li as m,br as mt,Vi as n,Rr as nt,ia as o,ii as ot,na as p,fr as pt,Br as q,Qt as qt,Ji as r,Nr as rt,Wi as s,Zr as st,$i as t,Xr as tt,Gi as u,Er as ut,ui as v,K as vt,di as w,$n as wt,wi as x,tr as xt,_i as y,Sr as yt,oi as z,Jn as zt};
@@ -0,0 +1 @@
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{Ht as a,Ut as o,p as s}from"./queries-C7VNk-nW.js";import{n as c}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as l}from"./tasks-table-Cx7AM7lZ.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-BPgUYFyu.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={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agent defaults`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function D(e,t=` → `){return E[e].join(t)}var O=e(t(),1),k=n(),A=(0,O.createContext)(null);function j({children:e}){let[t,n]=(0,O.useState)(()=>new Map),r=(0,O.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,O.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=s((0,O.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,O.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,k.jsx)(A.Provider,{value:o,children:e})}var M=(0,O.createContext)(null);function ee({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,O.useContext)(A),a=(0,O.useContext)(M),o=(0,O.useId)();(0,O.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let c=s(i?N:n),l=i?.lookup??c,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,O.useMemo)(()=>({lookup:l,projectId:e,repoBase:u}),[l,e,u]);return(0,k.jsx)(M.Provider,{value:d,children:r})}var N=[];function P(e,t,n){let r=(0,O.useContext)(M),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function F(e,t){let n=(0,O.useContext)(M),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function I(){let e=(0,O.useContext)(M);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),ne={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},L={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},re={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`},R={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 z(e){return e===`PR`?`pr-chip`:`issue-chip`}function B(e){return e?{"data-conflicting":`true`}:{}}function V(e,t,n,r){return!n||r!==void 0&&l({kind:e,number:t??0,url:n},r)}function H(e,t,n){return e===`PR`&&(t??n)===!0}function U({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`,ne[a],r)}function W(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function G(e){return e===`PR`?`pull request`:`issue`}function K(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function q(e,t){return e&&t?L[t.tone]:void 0}function J(e,t){return!e&&(!t||!r(t))}function Y({conflicting:e,presentation:t,status:n,plain:r,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,k.jsxs)(k.Fragment,{children:[e?(0,k.jsx)(y,{className:i(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,k.jsx)($,{status:t?n:void 0,className:r?i(`size-2.5`,l):void 0}),r&&a?s===`PR`?(0,k.jsx)(u,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,k.jsx)(b,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,r?(0,k.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function ie({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,k.jsx)(`span`,{"data-slot":z(e),"data-status":t,"data-inert":`true`,...B(n),className:r,children:i})}function ae({kind:e,number:t,tooltip:n,url:i}){return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,t?` #${t}`:``,` · `,n.headline]}),(0,k.jsx)(`span`,{className:`block`,children:n.detail}),n.also?(0,k.jsx)(`span`,{className:`block opacity-70`,children:n.also}):null,i&&r(i)?(0,k.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function oe({reference:e,taskTitle:t,status:n,conflicting:r,conflictAction:s,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=I(),y=P(h,V(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=o(b),S=H(h,r,y.conflicting),C=S?a:x,w=C?.tone??`accent`,T=U({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=ue(y,C,S?x:void 0),D=W(h,g,p,f),O=G(h),A=K(O,g,t,C),j=(0,k.jsx)(Y,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:D,glyphClass:q(p,C)});if(m)return(0,k.jsx)(ie,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=J(u,_)?(0,k.jsx)(`span`,{"data-slot":z(h),"data-status":b,...B(S),"aria-label":C?`${O} ${D} — ${C.label}`:void 0,className:T,children:j}):(0,k.jsx)(se,{to:u,url:_,"data-slot":z(h),"data-status":b,...B(S),title:E?void 0:_,"aria-label":A,className:p?T:i(T,re[w]),children:j});return E?(0,k.jsx)(le,{chip:M,action:S?s:void 0,state:y.state,children:(0,k.jsx)(ae,{kind:h,number:g,tooltip:E,url:_})}):M}function se({to:e,url:t,children:n,...r}){return e?(0,k.jsx)(c,{to:e,...r,children:n}):(0,k.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...r,children:n})}var X=(0,O.createContext)(()=>{});function ce(){return(0,O.useContext)(X)}var Z=150,Q=120;function le({chip:e,action:t,state:n,children:r}){let[i,a]=(0,O.useState)(!1),o=(0,O.useRef)(null),s=(0,O.useRef)(null),c=(0,O.useRef)(void 0),l=(0,O.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),u=(0,O.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,O.useEffect)(()=>()=>clearTimeout(c.current),[]);let d=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,k.jsxs)(w,{open:i,onOpenChange:e=>e?a(!0):u(),children:[(0,k.jsx)(S,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,Z)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Q)},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,k.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,Q)},children:[(0,k.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,k.jsx)(X.Provider,{value:u,children:t}):null]})]})}function ue(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${de(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 de(e){return e.charAt(0).toLowerCase()+e.slice(1)}function fe({kind:e,number:t,className:n}){let r=P(e,t),s=o(r.status),c=e===`PR`&&r.conflicting===!0,l=c?a:s;if(!l)return null;let u=i(`size-2.5`,L[l.tone]);return(0,k.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,k.jsx)(y,{className:i(`shrink-0`,u),"aria-hidden":`true`}):(0,k.jsx)($,{status:r.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,k.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=R[e];return n?(0,k.jsx)(n,{className:i(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}export{j as a,P as c,ee as i,D as l,fe as n,F as o,ce as r,I as s,oe as t,T as u};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{di as r}from"./project-scope-context-BdqKyBHa.js";import{Bt as i,Vt as a,vt as o}from"./queries-C7VNk-nW.js";import{_n as s}from"./index-CJFT0IZP.js";var c=e(t(),1),l=n();function u(){let e=r(),t=(0,c.useCallback)(async()=>{await Promise.all([e.invalidateQueries({queryKey:i.health}),e.invalidateQueries({queryKey:i.agentConfig,exact:!0}),e.invalidateQueries({queryKey:a.agentProfiles,exact:!0})])},[e]);return(0,c.useEffect)(()=>{t()},[t]),t}var d=`${s()} remote-settings enable`;function f({risk:e}){return o().data?.capabilities?.remoteSettingsAdmin===!0?(0,l.jsxs)(`p`,{role:`note`,"data-slot":`remote-settings-notice`,className:`rounded-md border border-warning/40 bg-warning/10 px-3 py-2 text-[13px] text-foreground`,children:[`Remote settings administration is on. `,e,`, and anyone who can open this cockpit can change them. The host operator turns this off with`,` `,(0,l.jsxs)(`code`,{children:[s(),` remote-settings disable`]}),`.`]}):null}export{f as n,u as r,d as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{c as r,n as i,t as a}from"./utils-DSMR_WLb.js";import{F as o,I as s,Nn as c,Pt as l,di as u,ot as d,s as f,u as p}from"./project-scope-context-BdqKyBHa.js";import{Z as m}from"./live-protocol-DMhTnCmf.js";import{Bt as h,C as g,E as _,Qt as v,T as y,Ut as b,W as x,bt as S,j as ee,n as C,rt as w,vt as te,w as T}from"./queries-C7VNk-nW.js";import{g as ne,h as re}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{i as E}from"./tasks-table-Cx7AM7lZ.js";import{n as D}from"./toaster-Bo5vCbz-.js";import{A as O,C as k,E as ie,F as ae,J as oe,M as se,X as ce,Y as le,at as ue,j as de,n as fe,ot as A,s as pe,u as me,v as he,x as ge}from"./design-icons-CzEoMH9c.js";import{t as _e}from"./createLucideIcon-BHp8sXmF.js";import{n as ve,t as ye}from"./circle-x-7nTlobAF.js";import{l as be,n as xe,y as Se}from"./nav-row-styles-DqKjMToI.js";import{i as Ce,r as we,t as Te}from"./git-toolbar-Pugtjt-9.js";import{t as j}from"./info-DA1x_4bz.js";import{t as Ee}from"./loader-circle-CPBhhDbB.js";import{n as De,r as Oe}from"./diff-controls-BFqQNxRu.js";import{c as ke,i as Ae,l as je,t as Me}from"./reference-chip-rylFalfg.js";import{t as M}from"./button-B7MKxYjT.js";import{i as N,l as Ne,p as Pe,r as Fe,t as Ie}from"./dropdown-menu-4e2iKSMT.js";import{t as P}from"./project-router-Bii3ofOk.js";import{t as Le}from"./status-dot-BRzVlF2X.js";import{a as F,o as Re}from"./format-BU7D3IfE.js";import{t as I}from"./centered-state-V15AR_qo.js";import{At as ze,Bt as Be,D as L,E as Ve,Ft as He,Gt as R,Ht as z,It as Ue,Jt as B,Kt as V,Lt as We,Mt as Ge,Nt as Ke,Ot as qe,Pt as Je,Rt as Ye,Ut as H,Vt as Xe,Wn as U,Wt as W,Yt as G,Zn as Ze,en as K,ir as Qe,jt as $e,kt as et,or as q,qt as J,zt as tt}from"./index-CJFT0IZP.js";import{t as nt}from"./markdown-BBDDg-4t.js";import{t as rt}from"./diff-BK789dS0.js";import{t as it}from"./change-counts-CW7O8g5Y.js";import{n as at,r as ot}from"./commit-list-DtEqtn9o.js";var Y=e(t(),1);function st(e,t){let n=u(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(m.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var ct=_e(`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`}]]),lt=_e(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=n();function ut(){let e=r(),t=g(),n=u(),i=st({queryKey:h.repo})>0,o=t.data?.info?t.data:null,s=qe(e,o,`screen`);return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-slot":`git-screen`,className:xe,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:a(be,`min-w-0 flex-1`),children:`Git`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:i,onClick:()=>{n.invalidateQueries({queryKey:h.repo}),n.invalidateQueries({queryKey:h.worktrees})},className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,X.jsx)(le,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,i&&`motion-safe:animate-spin`)})})]}),o?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)($e,{scope:e,repo:o,info:o.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(et,{branch:o?.info?.branch??null,counts:s,variant:`screen`})]})}function Z({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-xs text-muted-foreground`,children:e.keptReason}):null}function dt({repo:e,info:t}){let n=r(),i=[n,`repo`],o=[n,`health`],s=te(),c=T(),l=new Map((c.data?.branches??[]).map(e=>[e.name,e])),d=u(),p=v({mutationFn:e=>f({name:e},n),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([d.invalidateQueries({queryKey:i}),d.invalidateQueries({queryKey:o})]),d.setQueryData(i,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),d.setQueryData(o,t=>Ke(t,n,e.branch))},onError:e=>D(e.message,{tone:`danger`})}),[m,h]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(``),y=g.trim().toLowerCase(),b=Q(e,c.data?.branches),x=y?b.filter(e=>e.toLowerCase().includes(y)):b;return(0,X.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-4 pt-0 pb-9 md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(ce,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground`}),(0,X.jsx)(U,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:g,onChange:e=>_(e.target.value),className:`h-10 rounded-lg border-border bg-card pl-10`})]}),(0,X.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-3.5 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[x.map(e=>{let n=e===t.branch,r=l.get(e);return(0,X.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-[60px] flex-col items-start justify-center gap-1.5 py-2 md:flex-row md:items-center md:justify-start md:gap-2.5`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,X.jsx)(P,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] font-mono text-[12px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,X.jsx)(`span`,{className:a(`min-w-0 truncate font-mono text-[12px]`,n&&`font-medium`),children:e}),r&&!(n&&r.class===`active`)?(0,X.jsx)(gt,{entry:r}):null]}),r?(0,X.jsx)(Z,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.jsx)(`span`,{"data-slot":`branch-current`,className:`flex h-8 shrink-0 items-center rounded-md bg-accent-strong/10 px-2.5 text-[12px] font-medium text-accent-text md:ml-auto`,children:`Current`}):(0,X.jsxs)(M,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`h-8 max-md:h-11 no-hover:h-11 md:ml-auto`,disabled:p.isPending,onClick:()=>p.mutate(e),children:[(0,X.jsx)(O,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),x.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-muted-foreground`,children:[`No branches match “`,g.trim(),`”.`]}):null]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,X.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-5 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&p.mutate(t,{onSuccess:()=>h(``)})},children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsxs)(`p`,{"data-slot":`branch-create-base`,className:`-mt-1 text-xs text-muted-foreground`,children:[`Create from `,(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-foreground`,children:t.branch}),`.`]}),(0,X.jsx)(U,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background placeholder:text-muted-foreground/70`,value:m,onChange:e=>h(e.target.value)}),(0,X.jsxs)(M,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!m.trim()||p.isPending,children:[(0,X.jsx)(oe,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,X.jsx)(`p`,{"data-slot":`branch-create-note`,className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),s.data?.forge?.available?(0,X.jsx)(ft,{}):null]})}function ft(){let e=C({limit:20});return(0,X.jsxs)(`div`,{"data-slot":`repo-prs`,className:`min-w-0 rounded-xl border border-border bg-card p-5 md:col-span-2`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Open pull requests`}),e.isPending?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Loading pull requests…`}):e.isError?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,X.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`No open pull requests.`}):(0,X.jsx)(`ul`,{className:`mt-3 flex flex-col divide-y divide-border border-t border-border`,children:e.data.prs.map(e=>(0,X.jsx)(pt,{pr:e},e.number))}):(0,X.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-3 text-xs text-muted-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function pt({pr:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,X.jsx)(mt,{checks:e.checks}):null]}),n=`flex min-h-11 min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,X.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:i(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:a(n,`hover:bg-muted`),children:t}):(0,X.jsx)(`span`,{className:n,children:t})})}function mt({checks:e}){let t=e===`passing`?ve:e===`failing`?ye:Qe;return(0,X.jsxs)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:a(`inline-flex shrink-0 items-center gap-1 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:[(0,X.jsx)(t,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),e]})}var ht={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function gt({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:a(`shrink-0 rounded-[4px] border px-1.5 py-px text-[11px] leading-4 font-medium`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:ht[e.class]})}function Q(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 _t(){let e=y(),t=K(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!0),[o,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),d=(0,Y.useRef)(null),f=e.isError&&e.error instanceof c&&e.error.status===409,p=e.data?.files??[],m=(0,Y.useMemo)(()=>we(p),[p]),h=(0,Y.useMemo)(()=>p.some(nt),[p]),g=t?n:`unified`;return(0,X.jsx)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-muted-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,X.jsx)(I,{icon:f?(0,X.jsx)(k,{size:16}):(0,X.jsx)(A,{size:16}),tone:f?`neutral`:`danger`,heading:`h2`,title:f?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):p.length===0?(0,X.jsx)(I,{icon:(0,X.jsx)(k,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 px-4 pb-4 md:px-9 [&_button]:min-h-11`,children:[e.data?(0,X.jsx)(Te,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-2`,children:[h?(0,X.jsx)(Oe,{preview:o,onPreviewChange:s}):null,(0,X.jsx)(`span`,{className:`flex items-center gap-1.5`,children:(0,X.jsx)(De,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})})]})]}),(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 pb-9 pt-0 [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,X.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[288px]`,children:[(0,X.jsx)(`h2`,{"data-slot":`changes-tree-heading`,className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(Ce,{root:m,selected:l,onSelect:e=>{u(e),d.current?.scrollToPath(e)}})]}),(0,X.jsx)(rt,{files:p,viewRef:d,mode:g,wrap:i,preview:o,totals:!1,className:`min-w-0 flex-1`})]})]})})}function vt({repo:e,info:t}){let{sha:n}=re(),r=e.log,i=(0,Y.useMemo)(()=>Xe(r),[r]);if(n)return(0,X.jsx)(xt,{sha:n});let a=We(e,t),o=a&&a.behind>0?(0,X.jsx)(bt,{info:t,tracking:a}):null;return r.length===0?(0,X.jsxs)(X.Fragment,{children:[o?(0,X.jsx)(`div`,{className:`px-4 pt-0 md:px-9`,children:o}):null,(0,X.jsx)(I,{icon:(0,X.jsx)(de,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-4 px-4 pt-0 pb-9 md:px-9`,children:[o,i.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.commits.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-3.5 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,X.jsxs)(P,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-0.5 px-4 py-2 focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] font-medium text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(at,{sha:e.hash}),(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[e.author,` · `,(0,X.jsx)(`span`,{title:Be(e.when,e.at),children:tt(e.when,e.at)})]})]})]}),(0,X.jsx)(yt,{source:e.source})]},e.hash))})]},e.label))]})}function yt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-4 text-[11.5px] text-muted-foreground md:flex`;return e?(0,X.jsxs)(P,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:a(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(se,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(pe,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function bt({info:e,tracking:t}){let n=Je(r(),e),i=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`flex min-h-[44px] items-center gap-2.5 rounded-xl border border-border bg-card px-4 py-2`,children:[(0,X.jsx)(ct,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:i,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[28px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(Ee,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(fe,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(Ge,{checkout:n,returnFocus:i})]})}function xt({sha:e}){return(0,X.jsx)(ot,{commit:_(e),sha:e,backTo:K()?`/git`:He,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-9`})}var St=`Squash-merged branches may show as not landed without GitHub`;function Ct(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 wt(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var Tt={done:`success`,failed:`danger`,cancelled:`neutral`};function Et(){let e=T(),t=w(),n=r(),i=S(),[a,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`px-4 py-5 text-[13px] text-muted-foreground md:px-9`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(I,{icon:(0,X.jsx)(A,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=Ct(e.data.branches),c=wt(e.data.branches),l=c>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,X.jsx)(j,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),(0,X.jsxs)(`span`,{children:[c,` finished task`,c===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,c===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(P,{to:Ue.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,u=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(Ae,{projectId:n,repoBase:i,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-4 px-4 pt-0 pb-[calc(90px+env(safe-area-inset-bottom))] md:px-9 md:pb-9`,children:[e.data.prStateKnown?null:(0,X.jsx)(Dt,{}),l,s.length===0?(0,X.jsx)(I,{icon:(0,X.jsx)(Ze,{size:16}),tone:`neutral`,heading:`h2`,title:c>0?`Nothing else waiting to land`:`Everything landed`,subtitle:c>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.`}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-5`,children:s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.rows.length}),e.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{children:e.note})]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col divide-y divide-border rounded-xl border border-border bg-card`,children:e.rows.map(e=>(0,X.jsx)(Ot,{entry:e,finishedAt:e.runId?u.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key))}),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-1.5 px-1 text-xs leading-snug text-muted-foreground`,children:[(0,X.jsx)(j,{"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.`]})]})]}),(0,X.jsx)(Nt,{entry:a,onClose:()=>o(null)})]})}function Dt({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:a(`flex items-start gap-2 text-xs leading-relaxed text-muted-foreground`,e),children:[(0,X.jsx)(j,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0`}),St,`.`]})}function Ot({entry:e,finishedAt:t,onDelete:n}){return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[60px] items-center gap-3 px-4 py-3 first:rounded-t-xl last:rounded-b-xl hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(jt,{entry:e,finishedAt:t}),(0,X.jsx)(kt,{entry:e}),(0,X.jsx)(At,{entry:e,onDelete:n})]})}function kt({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-1.5 text-xs text-muted-foreground md:flex`,children:[(0,X.jsx)(Me,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(Mt,{entry:e})]}):null})}function At({entry:e,onDelete:t}){let n=u(),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=v({mutationFn:()=>d(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:h.repoBranches}),n.invalidateQueries({queryKey:h.runs.all})},onError:e=>D(e instanceof c&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),l=()=>void navigator.clipboard.writeText(e.name).then(()=>D(`Copied ${e.name}`),()=>D(`Could not copy the branch name`,{tone:`danger`})),f=`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-sm px-2.5 text-[12.5px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:`Open task`}):null,o?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:s.isPending,onClick:()=>s.mutate(),className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(lt,{"aria-hidden":`true`}),s.isPending?`Creating…`:`Draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:l,className:a(f,`hidden border border-border bg-card hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(he,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(Ie,{children:[(0,X.jsx)(Pe,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-8 shrink-0 items-center justify-center rounded-sm text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(ge,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(Fe,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(N,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(P,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,o?(0,X.jsx)(N,{className:`md:hidden`,disabled:s.isPending,onSelect:()=>s.mutate(),children:`Draft PR`}):null,(0,X.jsx)(N,{className:a(!r&&`md:hidden`),onSelect:l,children:`Copy branch`}),(0,X.jsx)(Ne,{className:`md:hidden`}),(0,X.jsx)(N,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function jt({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=F(i),o=n||!e.runStatus?a:`${e.runStatus}${a?` ${a}`:``}`,s=Number.isFinite(Date.parse(i))?new Date(i).toLocaleString():void 0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(Se,{"aria-label":`Task deleted`,className:`size-[12px] text-muted-foreground`}):(0,X.jsx)(Le,{tone:e.runStatus&&Tt[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] font-medium text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] font-medium text-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),(0,X.jsx)($,{}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(it,{adds:e.diffStat.additions,dels:e.diffStat.deletions})]}):null,o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{className:`truncate`,title:s,children:o})]}):null]}),e.parentRunId?(0,X.jsx)(P,{to:`/tasks/${e.parentRunId}`,"data-slot":`not-landed-parent`,className:`w-fit rounded-[2px] text-xs text-muted-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:`Worker of its parent task`}):null,(0,X.jsx)(Z,{entry:e})]})]})}function $(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function Mt({entry:e}){let t=b(ke(`PR`,e.pr?.number).status),n=e.pr?.state,r=n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`not-landed-pr-state`,children:r})]})}function Nt({entry:e,onClose:t}){let n=u(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=v({mutationFn:e=>p({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:h.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,X.jsx)(z,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(R,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(G,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(V,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,X.jsx)(`span`,{className:`font-mono`,title:e?.lastCommit.sha,children:e?.lastCommit.sha.slice(0,8)}),`).`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&!o.isPending&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(U,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(J,{children:[(0,X.jsx)(W,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(H,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Pt({base:e}){let t=T(),n=u(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],d=v({mutationFn:e=>p({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:h.repo})},onError:e=>{n.invalidateQueries({queryKey:h.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let f=l.length,m=`branch${f===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,f]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:f===0||d.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(ue,{"aria-hidden":`true`,className:`size-[12px]`}),d.isPending?`Deleting…`:`Delete ${f} ${m}`]})]}),(0,X.jsx)(Ft,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:St.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(Ft,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(z,{open:a,onOpenChange:o,children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(B,{children:[(0,X.jsxs)(G,{children:[`Delete `,f,` `,m,`?`]}),(0,X.jsxs)(V,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(J,{children:[(0,X.jsx)(W,{children:`Keep them`}),(0,X.jsxs)(H,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{d.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,f,` `,m]})]})]})})]})}function Ft({kind:e,title:t,hint:n,rows:r,open:i,onToggle:o}){let s=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":s,disabled:r.length===0,onClick:o,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(me,{"aria-hidden":`true`,className:a(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:s,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,X.jsx)(P,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:F(e.lastCommit.at)})]},e.name))}):null]})}function It(){let e=ee(),t=x().data?.targets.find(e=>e.id===`finder`),n=v({mutationFn:e=>l(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=u(),[i,a]=(0,Y.useState)(!1),c=()=>Promise.all([r.invalidateQueries({queryKey:h.worktrees}),r.invalidateQueries({queryKey:h.repoBranches})]),d=v({mutationFn:e=>s(),onSuccess:(e,t)=>{c();let n=e.reclaimed.length,r=Math.max(0,t-n);D(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>D(e.message,{tone:`danger`})}),f=v({mutationFn:e=>o(e.runId),onSuccess:(e,t)=>{c(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{c(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:p,totalBytes:m,keep:g}=e.data,_=d.isPending||f.isPending,y=p.filter(e=>e.pastKeep),b=y.length>0,S=y.some(e=>e.sizeBytes===null)?null:y.reduce((e,t)=>e+(t.sizeBytes??0),0),C=b?S?`Reclaim ${E(S)} now`:`Reclaim ${y.length} now`:`Reclaim now`,w=m?E(m):null;return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,w?` · ${w}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[g===0?`Retention is unlimited (`:`Retention keeps the newest ${g} finished checkout${g===1?``:`s`} (`,(0,X.jsx)(P,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:je(`worktrees`,` › `)}),g===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:_||!b,title:b?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[12px]`}),C]})]}),p.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:p.map(e=>(0,X.jsx)(zt,{worktree:e,keep:g,disabled:_,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>f.mutate(e)},e.runId))}),(0,X.jsx)(z,{open:i,onOpenChange:a,children:(0,X.jsxs)(R,{children:[(0,X.jsxs)(B,{children:[(0,X.jsx)(G,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(V,{children:[y.length,` finished worktree`,y.length===1?``:`s`,` beyond the keep limit`,S?` (${E(S)})`:``,` `,y.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(J,{children:[(0,X.jsx)(W,{children:`Keep them`}),(0,X.jsx)(H,{"data-action":`worktrees-confirm`,onClick:()=>{d.mutate(y.length),a(!1)},children:C})]})]})})]})}var Lt=new Set([`queued`,`running`,`waiting`,`review`]);function Rt(e,t){return Lt.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function zt({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:o}){let s=Rt(e,t),c=F(e.finishedAt??void 0),l=e.status===`review`?`at review`:c?`${e.status} ${Re(c)}`:e.status,u=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":s.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:a(`text-[11.5px]`,s.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:s.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-[11px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,s.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:E(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,X.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(ie,{"aria-hidden":`true`,className:`size-[13px]`})}):null,s.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:o,className:d,children:(0,X.jsx)(q,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function Bt({section:e,index:t=!1}){let n=g(),r=K(),[i]=ne();if(t&&!r&&i.get(`view`)!==`repo`)return(0,X.jsx)(ut,{});if(n.isPending)return(0,X.jsx)(Ve,{});if(n.isError)return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(L,{}),(0,X.jsx)(I,{icon:(0,X.jsx)(A,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})]});let a=n.data.info;return a?(0,X.jsx)(Vt,{repo:n.data,info:a,section:e}):(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(L,{}),(0,X.jsx)(I,{icon:(0,X.jsx)(O,{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 Vt({repo:e,info:t,section:n}){return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-git-section":n,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(L,{}),(0,X.jsx)(`header`,{"data-slot":`repo-header`,className:`flex flex-wrap items-start justify-between gap-4 px-4 pt-7 pb-5 md:px-9`,children:(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h1`,{className:`text-[26px] leading-[1.2] font-semibold tracking-tight text-foreground md:text-[28px]`,children:ze(n,t.branch)}),(0,X.jsx)(`p`,{"data-slot":`repo-meta`,className:`mt-1 text-[13px] text-muted-foreground`,children:(0,X.jsx)(Ht,{repo:e,info:t,section:n})})]})}),n===`main`?(0,X.jsx)(vt,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(Et,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-4 px-4 pt-0 pb-[calc(90px+env(safe-area-inset-bottom))] md:px-9 md:pb-9`,children:[(0,X.jsx)(It,{}),(0,X.jsx)(Pt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(dt,{repo:e,info:t}):(0,X.jsx)(_t,{})]})}function Ht({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`No commits yet`:`Latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Ye(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`Finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Ut,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`Nothing here can delete work that is not on `,r]})}}function Ut({repo:e,info:t}){let n=Q(e,T().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{Bt as RepoGitRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Nn as r,et as i}from"./project-scope-context-BdqKyBHa.js";import{B as a,N as o}from"./queries-C7VNk-nW.js";import{f as s,g as c,h as l,i as u,n as d,p as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{ot as p,r as m}from"./design-icons-CzEoMH9c.js";import{a as h,c as g,l as _,s as v,t as y,u as b}from"./file-preview-CDWTFZ4P.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./centered-state-V15AR_qo.js";import{_ as C,g as w,h as T}from"./index-CJFT0IZP.js";import{s as E}from"./markdown-Dv0r75AX.js";var D=e(t(),1),O=n();function k(){let e=s(),t=f();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=A(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function A(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function j(e){return e?.type===`file`?e:null}function M(){let[e]=c(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function N(){let{id:e=``}=l(),t=M(),n=s(),r=k();return(0,O.jsx)(P,{runId:e,selection:t,fragment:n.hash,onBack:r,variant:`route`})}function P({runId:e,selection:t,fragment:n,onBack:r,variant:i,sourceLookup:a}){let{path:o,conflict:c,selected:l,result:d}=I(e,t,a),f=C(T,!0),p=C(w,!1),m=s(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(i===`route`&&L(_))return(0,O.jsx)(u,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,o),y=i===`pane`&&!p&&!f?`Conversation`:`Back`,b=i===`pane`&&!h&&R(_),x=F(m.pathname,e,t);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":i,onKeyDown:e=>{i!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),r())},className:i===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,O.jsx)(B,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:r,backLabel:y,hideDownload:i===`pane`&&p,focusBack:i===`pane`}),(0,O.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,O.jsx)(V,{conflict:c,selected:l,result:d,source:h,name:v,fragment:n,pane:i===`pane`,filesHref:x})})]})}function F(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function I(e,t,n){let{path:r=null,artifactId:i=null,conflict:s=!1}=t,c=n?.isPending||n?.isError,l=a(e,i||s||c?null:r),u=o(e,s||c?null:i),d=c&&n?{...n,data:void 0}:i?u:l;return{path:r,conflict:s,selected:r!==null||i!==null,result:d}}function L(e){return e!==null&&(!E(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function R(e){return e!==null&&!e.tooLarge&&!e.binary}function z(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function B({runId:e,file:t,name:n,source:r,onSource:a,onBack:o,backLabel:s,hideDownload:c,focusBack:l}){let u=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&u.current?.focus({preventScroll:!0})},[l]);let d=t?.artifact;return(0,O.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,O.jsxs)(x,{ref:u,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:o,"aria-label":s,children:[(0,O.jsx)(m,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:s})]}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,O.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[d?`Published snapshot · ${new Date(d.createdAt).toLocaleString()}`:`Live file`,` · `,h(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(x,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:a,children:r?`Preview`:`Source`}):null,d&&!c?(0,O.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:i(e,d.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:s}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,O.jsx)(U,{icon:(0,O.jsx)(_,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,O.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,O.jsx)(H,{result:n});let c=n.data;return c.type===`file`?o&&!E(c.path)?(0,O.jsx)(U,{icon:(0,O.jsx)(_,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,O.jsx)(d,{to:s,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):c.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),title:`Too large to preview`,subtitle:`${h(c.size)} is past the 500 kB preview limit. Download it to read it.`}):c.binary?(0,O.jsx)(U,{icon:(0,O.jsx)(_,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,O.jsx)(`div`,{className:`bg-card`,children:(0,O.jsx)(y,{path:c.path,text:c.content??``})}):(0,O.jsx)(v,{html:c.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:c.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:c.reason})}function H({result:e}){let t=e.error instanceof r&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(g,{}):(0,O.jsx)(p,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,O.jsx)(x,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function U({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,O.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,O.jsx)(S,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
@@ -0,0 +1 @@
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}from"./utils-DSMR_WLb.js";import{Br as i,Fn as a,Hr as o,Ln as s,Pn as c,di as l,vr as u}from"./project-scope-context-BdqKyBHa.js";import{B as d,F as f,I as p,J as m,N as h,W as g,Y as _,z as v}from"./live-protocol-DMhTnCmf.js";import{t as y}from"./useInfiniteQuery--iQKfpUQ.js";import{f as b,m as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{r as S,t as C}from"./live-reads-BJ9eDISf.js";import{X as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./chevron-right-BENZ-1ZN.js";import{t as E}from"./button-B7MKxYjT.js";import{t as D}from"./project-router-Bii3ofOk.js";import{a as O}from"./format-BU7D3IfE.js";import{$n as k,Wn as A,_n as j,b as M}from"./index-CJFT0IZP.js";import{t as N}from"./report-title-D4Mbu2Er.js";var P=e(t(),1),F=1e3,I=g().min(1).max(1024);d({q:g().max(F).optional(),before:I.optional(),limit:g().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var L=d({reports:h(d({id:m(),runId:m(),name:g(),title:g(),createdAt:_(),size:v().int().nonnegative(),taskTitle:g(),taskStatus:u}).strict()),nextCursor:I.nullable(),total:v().int().nonnegative()}).strict(),R=d({epoch:m(),generation:v().int().nonnegative(),metadataGeneration:v().int().nonnegative()}).strict(),z=d({runId:m(),taskTitle:g(),taskStatus:u}).strict(),B=f(`type`,[R.extend({type:p(`snapshot`)}),R.extend({type:p(`content`)}),R.extend({type:p(`metadata`),runs:h(z)})]),V=new WeakMap;function H(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 U=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=H(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 W(e,t){let n=V.get(e);n||(n=new Map,V.set(e,n));let r=n.get(t);return r||(r=new U(e,t),n.set(t,r)),r}async function G(e,t){let n=await c.api.v1.p[`:projectId`].reports.state.$get({param:{projectId:e}},a({signal:t}));return R.parse(await s(n,`/reports/state`))}function K(e){let t=W(l(),e);return(0,P.useEffect)(()=>{let n=S(`reports:project:${e}`,e=>{let n=B.safeParse(e);n.success&&t.receive(n.data,n.data.type===`snapshot`)}),r,a,s=()=>{if(i()===`finite`&&!r){a=new AbortController;let n=a.signal;G(e,n).then(e=>{n.aborted||t.receive({type:`snapshot`,...e})}).catch(()=>void 0),r=C({path:`/api/v1/p/${encodeURIComponent(e)}/reports/state`,intervalMs:5e3},(e,n)=>{let r=R.safeParse(e);!n&&r.success&&t.receive({type:`snapshot`,...r.data})})}else i()!==`finite`&&(a?.abort(),r?.(),r=void 0)};s();let c=o(s);return()=>{c(),a?.abort(),r?.(),n()}},[t,e]),t}async function q(e,t,n,r){let i=await c.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,F),...n?{before:n}:{}}},a(r?{signal:r}:void 0));return L.parse(await s(i,`/reports`))}function J(e){let t=r(),n=K(t);return y({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:r,signal:i})=>n.read(e,()=>q(t,e,r,i)),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var Y=n(),X=new Map;function Z(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}function Q(){let e=b(),t=x(),[n,r]=M(),i=(n.get(`q`)??``).slice(0,F),a=J(i),o=(0,P.useRef)(null),s=(0,P.useRef)(``),c=e.pathname+e.search,l=a.data?.pages.flatMap(e=>e.reports)??[];(0,P.useLayoutEffect)(()=>{if(!a.data||s.current===c)return;let n=X.get(c),r=e.state?.filesRestoreKey===c;if(!n||!o.current||t!==`POP`&&!r){s.current=c;return}let i=o.current.querySelector(`[data-report-id="${n.row}"]`);if(a.isFetchNextPageError){s.current=c,o.current.scrollTop=0;return}if((!i||a.data.pages.length<n.pages)&&a.hasNextPage){a.isFetchingNextPage||a.fetchNextPage();return}s.current=c,o.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[c,a.data,a.hasNextPage,a.isFetchingNextPage,a.isFetchNextPageError,a.fetchNextPage,e.state,t]);let u=t=>r(n=>(t?n.set(`q`,t.slice(0,F)):n.delete(`q`),X.delete(e.pathname+`?`+n.toString()),n));return(0,Y.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 px-4 pt-7 pb-4 md:px-9`,children:[(0,Y.jsx)(`header`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h1`,{className:`text-[26px] font-semibold tracking-tight leading-[1.2] text-foreground md:text-[28px]`,children:`Reports`}),(0,Y.jsx)(`p`,{className:`mt-1 text-[13px] text-muted-foreground`,children:`Published HTML snapshots from tasks in this project.`})]})}),(0,Y.jsxs)(`div`,{className:`relative w-full`,children:[(0,Y.jsx)(w,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),(0,Y.jsx)(A,{maxLength:F,"aria-label":`Search reports`,placeholder:`Search reports or source tasks…`,value:i,onChange:e=>u(e.target.value),className:`h-10 w-full rounded-lg border-border bg-card pl-9 text-sm max-md:h-11`})]})]}),(0,Y.jsxs)(`div`,{ref:o,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-9 md:px-9`,children:[a.isPending?(0,Y.jsx)(`p`,{role:`status`,className:`py-4 text-sm text-muted-foreground`,children:`Loading reports…`}):a.isError?(0,Y.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-5`,children:[(0,Y.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:`Could not load reports`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a.error.message}),(0,Y.jsx)(E,{variant:`outline`,className:`min-h-11`,onClick:()=>void a.refetch(),children:`Retry`})]}):l.length===0?(0,Y.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:i?`No matching reports`:`No published reports yet`}),i?(0,Y.jsx)(E,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>u(``),children:`Clear search`}):(0,Y.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Publish an HTML snapshot with `,(0,Y.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:[j(),` artifact publish`]}),` to list it here.`]})]}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1.5`,"aria-label":`Reports`,children:l.map(e=>(0,Y.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 transition-colors`,children:[(0,Y.jsx)(k,{"aria-hidden":`true`,className:`reports-icon size-4 shrink-0 self-start mt-0.5 text-accent-text`}),(0,Y.jsxs)(`div`,{className:`reports-lines flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsx)(`h2`,{className:`flex min-w-0 text-[14px] leading-5 font-semibold text-foreground`,title:N(e),children:(0,Y.jsx)(D,{"data-report-id":e.id,className:`reports-open text-foreground no-underline`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:c,filesRestoreKey:c},onClick:()=>X.set(c,{scroll:o.current?.scrollTop??0,row:e.id,pages:a.data?.pages.length??1}),children:(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:N(e)})})}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-xs leading-4 text-muted-foreground`,children:[(0,Y.jsx)(D,{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,Y.jsx)(`span`,{className:`min-w-0 truncate`,title:e.taskTitle,children:e.taskTitle})}),(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:`·`}),(0,Y.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:e.createdAt,title:Z(e.createdAt),children:$(e.createdAt)})]})]}),(0,Y.jsx)(T,{"aria-hidden":`true`,"data-slot":`report-open-cue`,className:`reports-cue size-4 shrink-0 text-muted-foreground`})]},e.id))}),a.hasNextPage?(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(E,{variant:`outline`,className:`min-h-11`,disabled:a.isFetchingNextPage,onClick:()=>void a.fetchNextPage(),children:`Load more reports`})}):null]})]})}function $(e){let t=O(e);return t?t===`just now`?`Published just now`:`Published · ${t}`:``}export{Q as ReportsRoute};
@@ -0,0 +1 @@
1
+ .reports-row{position:relative}.reports-open{align-items:center;min-width:0;display:flex}.reports-open:after{content:"";position:absolute;inset:0}.reports-task{z-index:1;align-items:center;min-width:0;max-width:100%;display:inline-flex;position:relative}@media (hover:none),(width<=767px){.reports-row{padding-block:0}.reports-lines{gap:0}.reports-icon{margin-block-start:14px}.reports-open,.reports-task{min-block-size:44px}}.reports-open:focus-visible{outline:2px solid #0000}.reports-row:has(.reports-open:focus-visible){outline:2px solid var(--ring);outline-offset:2px}.reports-task:focus-visible{outline:2px solid var(--ring);outline-offset:2px;border-radius:4px}.reports-row:active{background:var(--sidebar-row-selected)}@media (hover:hover) and (pointer:fine){.reports-row:hover{background:var(--sidebar-row-hover)}.reports-row:hover .reports-cue{color:var(--foreground)}}
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{an as t,di as n}from"./project-scope-context-BdqKyBHa.js";import{Ft as r,Qt as i,Vt as a}from"./queries-C7VNk-nW.js";import{n as o}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{n as s}from"./toaster-Bo5vCbz-.js";import{k as c}from"./design-icons-CzEoMH9c.js";import{t as l}from"./button-B7MKxYjT.js";import{r as u}from"./switch-SP8pw5uU.js";import{t as d}from"./centered-state-V15AR_qo.js";import{gn as f}from"./index-CJFT0IZP.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=r();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 r=n(),o=i({mutationFn:e=>t(e),onSuccess:e=>r.setQueryData(a.config,e),onError:e=>s(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=()=>o.mutate({resources:{monitoringWakeIntervalMinutes:f===`park`?null:y}},{onSuccess:()=>s(f===`park`?`Monitoring will stay parked`:`Monitoring will re-check every ${y} minutes`)}),M=e.resources.autoResumeOnUsageLimit??!0,N=e=>o.mutate({resources:{autoResumeOnUsageLimit:e}},{onSuccess:()=>s(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=()=>o.mutate({resources:{memoryLimitMb:P===0?null:P}},{onSuccess:()=>s(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=>o.mutate({resources:{maxParallel:e}}),disabled:o.isPending}),(0,v.jsx)(E,{maxParallel:e.resources.maxParallel,maxMonitoringSessions:e.resources.maxMonitoringSessions,onSelect:e=>o.mutate({resources:{maxMonitoringSessions:e}}),disabled:o.isPending}),(0,v.jsx)(D,{wakeMode:f,setWakeMode:p,wakeInterval:h,setWakeInterval:_,showInvalid:k,wakeSaved:w,saveWake:j,saveIsPending:o.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:o.isPending,onCheckedChange:N})}),(0,v.jsx)(O,{memory:c,setMemory:l,memoryInvalid:F,memorySaved:I,saveMemory:L,saveIsPending:o.isPending}),(0,v.jsx)(A,{composerDefaults:R,saveComposerDefault:(e,t)=>o.mutate({composerDefaults:{[e]:t===`inherit`?null:t===`on`}}),saveIsPending:o.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)(o,{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};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{d as a}from"./live-refetch-VoLPvzhe.js";import{$ as o,Ft as s,Nn as c,On as l,Pt as u,_r as d,ct as f,di as p,ir as m,or as h}from"./project-scope-context-BdqKyBHa.js";import{Bt as g,G as _,H as v,K as y,Qt as b,St as x,U as ee,W as S,Xt as C,Y as w,Zt as T,bt as E,ct as D,f as O,rt as te,tt as ne,vt as re,xt as ie}from"./queries-C7VNk-nW.js";import{d as ae,h as oe}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{a as se,d as ce,f as le,g as ue,m as de,o as fe,p as pe,s as me}from"./tasks-table-Cx7AM7lZ.js";import{n as k}from"./toaster-Bo5vCbz-.js";import{F as he,at as ge,ft as A,i as j,l as _e,p as ve,q as ye,t as be,v as M,x as xe}from"./design-icons-CzEoMH9c.js";import{t as N}from"./createLucideIcon-BHp8sXmF.js";import{t as Se}from"./app-window-CSHwDX9N.js";import{n as Ce,r as we,t as Te}from"./open-in-menu-HM5l7Bwk.js";import{t as Ee}from"./info-DA1x_4bz.js";import{t as De}from"./message-square-B-MD-8rD.js";import{i as Oe,n as ke,t as P}from"./reference-chip-rylFalfg.js";import{t as F}from"./square-terminal-B6RYYieR.js";import{t as I}from"./button-B7MKxYjT.js";import{a as L,i as R,l as z,n as B,p as V,r as H,t as U}from"./dropdown-menu-4e2iKSMT.js";import{i as Ae,r as je,t as Me}from"./popover-BPgUYFyu.js";import{a as Ne,i as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./dialog-B531GGAo.js";import{c as ze,s as Be,t as W}from"./project-router-Bii3ofOk.js";import"./attention-8bNiiAFt.js";import{T as Ve,f as G,u as He}from"./task-groups-BbnYlkYj.js";import{t as Ue}from"./status-dot-BRzVlF2X.js";import{t as We}from"./format-BU7D3IfE.js";import{$n as Ge,B as Ke,Gt as qe,Ht as Je,Jn as Ye,Jt as K,Kt as Xe,Mn as Ze,Nn as Qe,R as $e,Ut as et,Wt as tt,Yn as nt,Yt as rt,a as it,dn as q,fn as J,jn as at,m as ot,o as st,qt as ct,r as lt,rn as ut,sn as dt,sr as ft,tn as pt,xn as mt,z as ht}from"./index-CJFT0IZP.js";import{r as gt,t as _t}from"./markdown-Dv0r75AX.js";import{t as vt}from"./textarea-vJt9undk.js";import{t as Y}from"./tab-link-B1CULYRs.js";var yt=N(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),bt=N(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),xt=N(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),X=e(t(),1),Z=n();function St(e){let t=D();return b({mutationFn:t=>o(T(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>C()),onError:e=>k(e.message,{tone:`danger`})})}function Ct(e){return e.archived?`Unarchive`:`Archive task`}function wt({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Z.jsx)(Je,{open:t,onOpenChange:n,children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{children:`Archive task?`}),(0,Z.jsxs)(Xe,{children:[`Move “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function Tt({run:e,className:t}){let[n,r]=(0,X.useState)(!1),a=St(e.id),o=Ct(e);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":o,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:i(`h-11 gap-[7px] px-3`,t),onClick:()=>e.archived?a.mutate(!1):r(!0),children:[e.archived?(0,Z.jsx)(ft,{"aria-hidden":`true`}):(0,Z.jsx)(be,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:o})]}),(0,Z.jsx)(wt,{run:e,open:n,onOpenChange:r,onConfirm:()=>{a.mutate(!0),r(!1)}})]})}function Et({run:e,action:t,prUrl:n,patch:i}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:t.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,t.message||(t.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&r(n)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Z.jsx)(I,{variant:`outline`,disabled:i.isPending,onClick:()=>i.mutate({autoMergePr:!1},{onError:e=>k(e.message,{tone:`danger`})}),children:i.isPending?`Saving…`:`Disable auto-merge`}):null]})]})}function Dt({run:e,blocker:t,flags:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,t.message]}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.runId?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(W,{to:`/tasks/${t.runId}`,children:`Open blocking task`})}):null,t.pullRequestUrl&&r(t.pullRequestUrl)?(0,Z.jsx)(I,{variant:`outline`,asChild:!0,children:(0,Z.jsx)(`a`,{href:t.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Z.jsx)(Tt,{run:e}):null]})]})}function Ot({run:e}){let t=_(e.id),n=J(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,a=r&&r.phase!==`complete`?r:void 0;if(!a&&!i)return null;let o=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Z.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[a?(0,Z.jsx)(Et,{run:e,action:a,prUrl:o,patch:t}):null,i?(0,Z.jsx)(Dt,{run:e,blocker:i,flags:n}):null]})}var kt=[`running`,`queued`,`waiting`];function At(e,{queuePosition:t,now:n=new Date}){let r=l(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=kt.includes(e.status)?Mt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function jt(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Mt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:We(n,t)}}async function Q(e,t){try{await navigator.clipboard.writeText(e),k(t)}catch{k(`Run manually: ${e}`)}}function Nt(e){let t=E(),n=O(),r=(0,X.useMemo)(()=>ue(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,X.useMemo)(()=>n===void 0?[]:r.filter(e=>se(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function Pt(e){return b({mutationFn:()=>s(e.id),onError:e=>{if(e instanceof c&&e.command){Q(e.command,`No terminal found — command copied to clipboard.`);return}k(e.message,{tone:`danger`})}})}function $(e,t){let n=S(),r=x(),i=a(),o=b({mutationFn:t=>u(e.id,t),onError:e=>k(e.message,{tone:`danger`})}),s=mt(),c=Ve(e),l=s.runnersOn(e=>t&&c.sessionId!==void 0&&e===c.backend?c.profileId??`default`:s.repoAccount?.[e]).runners,d=e=>!r.isSuccess||!i.isSuccess||l.includes(e??`claude`);return{canResumeHere:t&&d(dt(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=Ce(e.id);return t===void 0||i.isSuccess&&d(t)}).map(t=>({target:t,...ut(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:o}}function Ft({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:o}=$(e,t),s=a().data,c=q(e);return!r&&i.length===0&&!c?null:(0,Z.jsxs)(Z.Fragment,{children:[r||i.length>0?(0,Z.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Z.jsxs)(I,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Z.jsx)(F,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=we(e,s);return(0,Z.jsxs)(I,{variant:`outline`,"data-target":e.id,title:n,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:[(0,Z.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>k(`Worktree path copied`)).catch(()=>k(`Path: ${t}`))},children:[(0,Z.jsx)(M,{}),`Copy worktree path`]}):null]}):null,c?(0,Z.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Z.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Z.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:c}),(0,Z.jsxs)(I,{variant:`outline`,onClick:()=>void Q(c,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{}),`Copy resume command`]})]}):null]})}function It({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=$(e,t),o=q(e),s=e.worktreePath;if(!r&&i.length===0&&!o&&!s)return null;let c=`max-md:min-h-11`;return(0,Z.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Z.jsx)(Te,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:c,leading:r?(0,Z.jsxs)(R,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Z.jsx)(F,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,s?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,className:c,onClick:()=>void Q(s,`Worktree path copied`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy worktree path`]}):null,o?(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:o,className:c,onClick:()=>void Q(o,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Lt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:o}=$(e,t);return!a&&o.length===0?null:r?(0,Z.jsx)(R,{onSelect:r,children:`Open in…`}):(0,Z.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Z.jsx)(A,{})})]}),e.worktreePath?(0,Z.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Z.jsx)(`div`,{className:`mt-4`,children:(0,Z.jsx)(Ft,{run:e,canResume:t,onResume:n})})]})}function Rt({branch:e}){let[t,n]=(0,X.useState)(null),r=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{k(`Could not copy branch. Select and copy: ${e}`)}};return(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Z.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Z.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Z.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function zt({run:e}){let t=E(),n=O(),i=r=>n===void 0?void 0:le(n,e.id,r,t),a=(0,X.useMemo)(()=>ue(e,t),[e,t]),o=[],s=[],c=a.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Z.jsx)(pt,{run:e,prNumber:t.number})},me(t)));let l=de(e);l&&r(l)&&!c.some(e=>e.url===l)&&o.push((0,Z.jsx)(P,{reference:{kind:`PR`,url:l},taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=a.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Z.jsx)(P,{reference:t,to:i(t),taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},me(t)));let d=ce(e,t);if(d&&r(d)&&!u.some(e=>e.url===d)){let t=fe(d);s.push((0,Z.jsx)(P,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?i({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:G(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Z.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Z.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function Bt(){let e=Be(),t=ie();return $e(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Vt=e=>e.map(e=>`${e.name}: ${ht(e.url)}`).join(`
2
+ `);function Ht(e){return Bt().length>0||e.notify===!0}function Ut({run:e}){let t=Bt(),n=t.length>0,r=ee(e.id),[i,a]=(0,X.useState)(null),o=e.notify===!0;return!n&&!o?null:(0,Z.jsxs)(Z.Fragment,{children:[o?(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${Ke(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Vt(t):void 0,children:[(0,Z.jsx)(Ue,{tone:`success`}),(0,Z.jsx)(`span`,{children:`Notifying`}),(0,Z.jsx)(_e,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Z.jsx)(L,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Z.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:ht(e.url),children:e.name},e.id))}):null,n?(0,Z.jsxs)(R,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Z.jsx)(De,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Z.jsxs)(R,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>k(`Stopped notifying the webhook`),onError:e=>k(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Z.jsx)(yt,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Z.jsx)(Wt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),k(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>k(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Wt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,X.useId)(),o=(0,X.useId)(),[s,c]=(0,X.useState)(``);(0,X.useEffect)(()=>{e!==null&&c(``)},[e]);let l=e===`note`,u=Ke(t);return(0,Z.jsx)(Re,{open:e!==null,onOpenChange:e=>{e||c(``),r(e)},children:(0,Z.jsx)(Ie,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Z.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(s.trim())},children:[(0,Z.jsxs)(Fe,{className:`text-left`,children:[(0,Z.jsx)(Le,{children:l?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Z.jsx)(Pe,{children:(0,Z.jsx)(`span`,{"data-webhook-destination":``,title:Vt(t),children:l?`${u} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${u} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Z.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Z.jsx)(vt,{id:a,"data-slot":`handoff-note`,"aria-describedby":o,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:s,onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`p`,{id:o,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Z.jsx)(Ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Z.jsxs)(Ne,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Z.jsx)(I,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Z.jsxs)(I,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||l&&s.trim()===``,children:[(0,Z.jsx)(Ye,{"aria-hidden":`true`}),l?`Send note`:`Hand off`]})]})]})})})}function Gt({runId:e,children:t}){let n=ae(),r=(0,X.useMemo)(()=>({runId:e}),[e]);return n?(0,Z.jsx)(Kt,{runId:e,children:t}):(0,Z.jsx)(gt.Provider,{value:r,children:t})}function Kt({runId:e,children:t}){let{projectId:n}=oe(),r=(0,X.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Z.jsx)(gt.Provider,{value:r,children:t})}function qt({id:e}){return(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Jt({id:e}){let t=w(e),n=t.data?G(t.data):e;return(0,Z.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Z.jsxs)(W,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Z.jsx)(j,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Z.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Z.jsx)(I,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Yt=3,Xt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Zt(e,t,n=Yt){let r=t?e.findIndex(e=>Xt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Qt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function $t({tab:e}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(e.kind===`pr`?he:ve,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Z.jsx)(ke,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function en(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function tn({servers:e}){let t=ot();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Z.jsxs)(I,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Z.jsx)(Se,{"aria-hidden":`true`}),en(e,n),t.live?(0,Z.jsx)(Ue,{tone:`success`,"aria-label":`Preview is live`}):null]})}function nn(e){return e?.role===`worker`?`Worker session`:e?.role===`root`?`Parent session`:`Task session`}function rn({run:e,compact:t=!1}){if(e.delegation?.role!==`worker`)return null;let n=e.delegation.supervisorRunId??e.delegation.parentRunId;return t?(0,Z.jsx)(qt,{id:n}):(0,Z.jsx)(Jt,{id:n})}function an(e,t){return!e.archiveBlocker&&t.archive?(0,Z.jsx)(Tt,{run:e}):null}function on({run:e}){return e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Z.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null}function sn({shown:e,run:t,previewToggle:n}){let r=Ht(t);return e&&(n||r)?(0,Z.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[n,(0,Z.jsx)(Ut,{run:t})]}):null}function cn({run:e,tab:t,activeItem:n,inlineItemTabs:r,overflowItemTabs:i,phoneBar:a,isDesktop:o}){let s=(0,X.useRef)(null),c=n?`${n.kind}#${n.number}`:null;return(0,X.useEffect)(()=>{!c||o||s.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[c,r.map(e=>`${e.kind}#${e.number}`).join(`,`),o]),(0,Z.jsxs)(`div`,{ref:s,"data-slot":`run-tabs`,"data-phone-bar":a||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Z.jsx)(Y,{to:`/tasks/${e.id}`,active:t===`session`,replace:a,children:`Session`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:a,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:a,children:`Commits`}),(0,Z.jsx)(Y,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:a,children:`Files`}),r.map(t=>(0,Z.jsx)(Y,{to:Qt(e.id,t),active:n!==null&&Xt(t,n),replace:a,children:(0,Z.jsx)($t,{tab:t})},`${t.kind}-${t.number}`)),i.length>0?(0,Z.jsxs)(U,{children:[(0,Z.jsxs)(V,{"data-slot":`run-tabs-more`,"aria-label":`${i.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,i.length]}),(0,Z.jsx)(H,{align:`end`,children:i.map(t=>(0,Z.jsx)(R,{asChild:!0,children:(0,Z.jsx)(W,{to:Qt(e.id,t),replace:a,children:(0,Z.jsx)($t,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]})}function ln({run:e,tab:t=`session`,onMarkedUnread:n}){let r=l(e),a=J(e),[o,s]=(0,X.useState)(!1),[c,u]=(0,X.useState)(!1),d=un(e,n),f=te(),p=re(),m=At(e,{queuePosition:e.status===`queued`?He(f.data??[]).get(e.id):void 0}),h=Qe(),g=Ze(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:y,repoBase:b,requests:x}=Nt(e),ee=(0,X.useMemo)(()=>pe(e,b),[e,b]),S=typeof t==`object`?t:null,{inline:C,overflow:w}=Zt(ee,S),T=p.data?.capabilities?.preview===!0,E=e.worktreePath&&T?(0,Z.jsx)(tn,{servers:e.previewServers??[]}):null,D=(0,Z.jsx)(mn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>s(e=>!e)}),O=an(e,a);return(0,Z.jsx)(Oe,{projectId:y,repoBase:b,requests:x,children:(0,Z.jsxs)(`header`,{"data-slot":`run-header`,"data-sticky":t===`session`||void 0,className:i(`relative z-20 bg-background px-4 md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`sticky [inset-block-start:0]`),children:[(0,Z.jsx)(on,{run:e}),(0,Z.jsx)(Ot,{run:e}),(0,Z.jsxs)(`div`,{className:`w-full`,children:[(0,Z.jsx)(rn,{run:e}),_?(0,Z.jsxs)(at,{slot:_,children:[(0,Z.jsx)(pn,{run:e,status:(0,Z.jsx)(lt,{"data-slot":`mobile-run-status`,dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-w-full self-start truncate px-2 py-px text-[11px] leading-4`,children:m.label})}),(0,Z.jsx)(rn,{run:e,compact:!0}),D]}):(0,Z.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Z.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:nn(e.delegation)}),(0,Z.jsx)(fn,{run:e}),(0,Z.jsx)(lt,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:jt(m)}),(0,Z.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[g?O:null,E,(0,Z.jsx)(Ut,{run:e}),D]})]}),(0,Z.jsx)(sn,{shown:_!==null,run:e,previewToggle:E}),(0,Z.jsx)(cn,{run:e,tab:t,activeItem:S,inlineItemTabs:C,overflowItemTabs:w,phoneBar:v,isDesktop:g}),o?(0,Z.jsx)(_n,{runId:e.id,onClose:()=>s(!1)}):null,c?(0,Z.jsx)(Lt,{run:e,canResume:J(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Z.jsx)(gn,{run:e,actions:d})]})})}function un(e,t){let n=p(),r=ze(),[i,a]=(0,X.useState)(null),o=()=>n.invalidateQueries({queryKey:g.runs.all}),s=e=>k(e.message,{tone:`danger`}),c=y(),l={isPending:c.isPending,mutate:()=>c.mutate({id:e.id,pinned:!e.pinned})},u=v();return{pin:l,markUnread:{isPending:u.isPending,mutate:()=>{t?.(),u.mutate(e.id,{onError:s})}},delete:b({mutationFn:()=>f(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:Pt(e),confirming:i,setConfirming:a}}function dn(e){let t=_(e.id),n=G(e);return{title:n,editor:st(n,e=>t.mutate({title:e},{onError:e=>k(e.message,{tone:`danger`})}))}}function fn({run:e}){let{title:t,editor:n}=dn(e);return n.editing?(0,Z.jsx)(it,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Z.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function pn({run:e,status:t}){let{title:n,editor:r}=dn(e);return(0,Z.jsxs)(Me,{open:r.editing,onOpenChange:e=>{e?r.begin():r.commit()},children:[(0,Z.jsxs)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`line-clamp-2 break-words text-[15px] leading-[18px] font-semibold text-foreground`,title:e.task,children:n}),t]}),(0,Z.jsx)(Ae,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Z.jsx)(nt,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Z.jsx)(je,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),r.cancel()},children:(0,Z.jsx)(it,{editor:r,className:`text-[16px] font-semibold`})})]})}function mn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=J(e),a=q(e),o=Ze(),s=St(e.id),[c,l]=(0,X.useState)(!1),u=_(e.id),d=(0,X.useId)();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(wt,{run:e,open:c,onOpenChange:l,onConfirm:()=>{s.mutate(!0),l(!1)}}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{asChild:!0,children:(0,Z.jsx)(I,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Z.jsx)(xe,{"aria-hidden":`true`})})}),(0,Z.jsxs)(H,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Z.jsx)(L,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),!o&&i.archive&&!e.archiveBlocker?(0,Z.jsx)(R,{disabled:s.isPending,onSelect:()=>e.archived?s.mutate(!1):l(!0),children:Ct(e)}):null,(0,Z.jsxs)(R,{onSelect:n,children:[(0,Z.jsx)(Ge,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Z.jsx)(Lt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Z.jsxs)(R,{onSelect:()=>void Q(a,`Command copied to clipboard.`),children:[(0,Z.jsx)(M,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Z.jsxs)(R,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Z.jsx)(bt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Z.jsxs)(B,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Z.jsx)(xt,{"aria-hidden":`true`}):(0,Z.jsx)(ye,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Z.jsx)(B,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:u.isPending,onCheckedChange:e=>u.mutate({archiveWhenDone:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Z.jsx)(B,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:u.isPending,"aria-describedby":d,onCheckedChange:e=>u.mutate({autoMergePr:e},{onError:e=>k(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Z.jsx)(`p`,{id:d,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),e.delegation?.role===`worker`?null:(0,Z.jsx)(hn,{run:e,patch:u}),i.deleteRun?(0,Z.jsx)(z,{}):null,i.deleteRun?(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Z.jsx)(ge,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})]})}function hn({run:e,patch:t}){let n=(0,X.useId)(),r=(0,X.useId)(),i=(0,X.useId)(),a=e=>k(e.message,{tone:`danger`});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{className:`text-xs text-muted-foreground`,children:`TASK ACCESS`}),(0,Z.jsx)(B,{"data-slot":`allow-workers`,className:`min-h-11`,checked:h(e),disabled:t.isPending,"aria-describedby":`${n} ${i}`,onCheckedChange:e=>t.mutate({allowWorkers:e},{onError:a}),children:`Allow Squawk workers`}),(0,Z.jsx)(`p`,{id:n,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can start Squawk workers. Each worker is a separate paid agent session. Worker limits cap resources, not spending.`}),(0,Z.jsx)(B,{"data-slot":`allow-messaging`,className:`min-h-11`,checked:m(e),disabled:t.isPending,"aria-describedby":`${r} ${i}`,onCheckedChange:e=>t.mutate({allowMessaging:e},{onError:a}),children:`Allow task messaging`}),(0,Z.jsx)(`p`,{id:r,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Agents in this task can message other tasks in this project.`}),(0,Z.jsx)(`p`,{id:i,"data-slot":`task-access-session-note`,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block-end:0.5rem]`,children:`Turning one off applies at once. Turning one on reaches a running agent at its next session.`})]})}function gn({run:e,actions:t}){let n=t.confirming;return(0,Z.jsx)(Je,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Z.jsxs)(qe,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(rt,{className:`text-danger`,children:`Delete task permanently?`}),(0,Z.jsx)(Xe,{children:(0,Z.jsxs)(Z.Fragment,{children:[`Delete “`,(0,Z.jsx)(`span`,{className:`font-medium text-foreground`,title:G(e),children:G(e)}),`” and its transcript`,e.delegation?.role===`worker`&&!d(e.delegation.workspace)?``:`, worktree and branch`,`. This cannot be undone.`]})})]}),(0,Z.jsxs)(ct,{children:[(0,Z.jsx)(tt,{children:`Cancel`}),(0,Z.jsx)(et,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function _n({runId:e,onClose:t}){let n=ne(e);return(0,Z.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Z.jsx)(I,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Z.jsx)(A,{})})]}),n.isPending?(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Z.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Z.jsx)(Gt,{runId:e,children:(0,Z.jsx)(_t,{children:n.data})}):(0,Z.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Z.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Z.jsx)(I,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Q(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Z.jsx)(I,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{It as a,At as c,zt as i,Gt as n,Pt as o,Rt as r,Nt as s,ln as t};
@@ -1 +1 @@
1
- [data-slot=task-confirmation]{border-radius:12px;padding:24px}[data-slot=task-confirmation] [data-slot=alert-dialog-title]{font-size:20px;font-weight:500}[data-slot=task-confirmation] [data-slot=alert-dialog-description]{font-size:13px;line-height:1.6}@media (width<=767px){[data-slot=notes-panel],.task-action-panel{padding:18px}}[data-slot=run-actions-menu] [role^=menuitem]>svg{display:none}@media (hover:hover) and (pointer:fine){[data-slot=parent-task-link]:hover{color:var(--foreground);text-underline-offset:.2em;text-decoration:underline}}@media (width<=767px){[data-slot=run-title-row]{grid-template-columns:minmax(0,1fr) auto auto;gap:6px;display:grid}[data-slot=run-title-row] [data-slot=session-kind]{grid-area:1/1}[data-slot=run-title-row]>.group{grid-area:2/1/auto/-1;max-width:100%}[data-slot=run-title-row]>.group h1{font-size:20px;line-height:1.4}[data-slot=run-title-row]>[data-slot=pill]{grid-area:1/2}[data-slot=run-title-row]>span:last-child{grid-area:1/3}}[data-slot=notes-panel] .thread-markdown{color:var(--muted-foreground);font-size:13px;line-height:1.6}[data-slot=notes-panel] .thread-markdown :is(h1,h2,h3){color:var(--foreground);margin-block:20px 8px;font-size:16px;font-weight:400;line-height:1.5}[data-slot=notes-panel]>div:first-child h2,.task-action-panel h2{font-size:18px;font-weight:400}[data-slot=notes-panel] button,.task-action-panel button{font-size:13px;font-weight:400}.task-action-panel h3{font-size:16px;font-weight:400}[data-slot=run-tabs]{gap:calc(var(--spacing) * 6)}[data-slot=run-tabs]>a,[data-slot=run-tabs]>[data-slot=run-tabs-more]{height:44px;padding-inline:4px;font-size:12px;font-weight:400}[data-slot=run-tabs]>a[aria-current=page]{color:var(--accent-text);border-block-end-color:var(--accent-strong)}@media (width<=767px){[data-slot=run-tabs]{gap:calc(var(--spacing) * 5)}}[data-slot=run-tabs]{margin-block-start:calc(var(--spacing) * 3)}[data-slot=run-tabs]>a[aria-current=page]{font-weight:600}@media (width<=767px){[data-slot=run-tabs][data-phone-bar]{margin-block-start:0}[data-slot=run-tabs][data-phone-bar]>a,[data-slot=run-tabs][data-phone-bar]>[data-slot=run-tabs-more]{color:var(--soft-foreground);font-weight:500}[data-slot=run-tabs][data-phone-bar]>a[aria-current=page]{color:var(--foreground);border-block-end-color:var(--foreground);border-block-end-width:2px;font-weight:600}[data-slot=run-tabs][data-phone-bar]>a [data-slot=tab-count]{color:var(--soft-foreground);font-size:11.5px}}@media (width>=768px){[data-slot=run-header]{padding-block-start:calc(var(--spacing) * 5.5)}[data-slot=run-title-row]{flex-wrap:nowrap;align-items:center;gap:12px;display:flex}[data-slot=run-title-row]>.group{flex:1;min-width:0;max-width:none}[data-slot=run-title-row] h1{letter-spacing:-.7px;font-size:25px}[data-slot=run-title-row]>span:last-child{margin-inline-start:0}}[data-slot=run-header]{container-type:inline-size}@container (width<=240px){[data-slot=run-title-row]{flex-wrap:wrap;display:flex}[data-slot=run-title-row]>.group{flex-basis:100%;order:1}}
1
+ [data-slot=task-confirmation]{border-radius:12px;padding:24px}[data-slot=task-confirmation] [data-slot=alert-dialog-title]{font-size:20px;font-weight:500}[data-slot=task-confirmation] [data-slot=alert-dialog-description]{font-size:13px;line-height:1.6}@media (width<=767px){[data-slot=notes-panel],.task-action-panel{padding:18px}}[data-slot=run-actions-menu] [role^=menuitem]>svg{display:none}@media (hover:hover) and (pointer:fine){[data-slot=parent-task-link]:hover{color:var(--foreground);text-underline-offset:.2em;text-decoration:underline}}@media (width<=767px){[data-slot=run-title-row]{grid-template-columns:minmax(0,1fr) auto auto;gap:6px;display:grid}[data-slot=run-title-row] [data-slot=session-kind]{grid-area:1/1}[data-slot=run-title-row]>.group{grid-area:2/1/auto/-1;max-width:100%}[data-slot=run-title-row]>.group h1{font-size:20px;line-height:1.4}[data-slot=run-title-row]>[data-slot=pill]{grid-area:1/2}[data-slot=run-title-row]>span:last-child{grid-area:1/3}}[data-slot=notes-panel] .thread-markdown{color:var(--muted-foreground);font-size:13px;line-height:1.6}[data-slot=notes-panel] .thread-markdown :is(h1,h2,h3){color:var(--foreground);margin-block:20px 8px;font-size:16px;font-weight:400;line-height:1.5}[data-slot=notes-panel]>div:first-child h2,.task-action-panel h2{font-size:18px;font-weight:400}[data-slot=notes-panel] button,.task-action-panel button{font-size:13px;font-weight:400}.task-action-panel h3{font-size:16px;font-weight:400}[data-slot=run-tabs]{gap:calc(var(--spacing) * 6)}[data-slot=run-tabs]>a,[data-slot=run-tabs]>[data-slot=run-tabs-more]{height:44px;padding-inline:4px;font-size:12px;font-weight:400}[data-slot=run-tabs]>a[aria-current=page]{color:var(--foreground);border-block-end-color:var(--accent-text)}@media (width<=767px){[data-slot=run-tabs]{gap:calc(var(--spacing) * 5)}}[data-slot=run-tabs]{margin-block-start:calc(var(--spacing) * 3)}[data-slot=run-tabs]>a[aria-current=page]{font-weight:600}@media (width<=767px){[data-slot=run-tabs][data-phone-bar]{margin-block-start:0}[data-slot=run-tabs][data-phone-bar]>a,[data-slot=run-tabs][data-phone-bar]>[data-slot=run-tabs-more]{color:var(--soft-foreground);font-weight:500}[data-slot=run-tabs][data-phone-bar]>a[aria-current=page]{color:var(--foreground);border-block-end-color:var(--accent-text);border-block-end-width:2px;font-weight:600}[data-slot=run-tabs][data-phone-bar]>a [data-slot=tab-count]{color:var(--soft-foreground);font-size:11.5px}}@media (width>=768px){[data-slot=run-header]{padding-block-start:calc(var(--spacing) * 5.5)}[data-slot=run-title-row]{flex-wrap:nowrap;align-items:center;gap:12px;display:flex}[data-slot=run-title-row]>.group{flex:1;min-width:0;max-width:none}[data-slot=run-title-row] h1{letter-spacing:-.7px;font-size:25px}[data-slot=run-title-row]>span:last-child{margin-inline-start:0}}[data-slot=run-header]{container-type:inline-size}@container (width<=240px){[data-slot=run-title-row]{flex-wrap:wrap;display:flex}[data-slot=run-title-row]>.group{flex-basis:100%;order:1}}
@@ -0,0 +1 @@
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";var t=e();function n({show:e}){return e?(0,t.jsx)(`span`,{"data-slot":`settings-save-cue`,className:`whitespace-nowrap text-xs leading-none text-muted-foreground`,children:`No unsaved changes`}):null}function r({show:e,children:r}){return(0,t.jsxs)(`span`,{"data-slot":`settings-save-row`,className:`inline-flex shrink-0 items-center gap-3 [&>*]:m-0`,children:[r,(0,t.jsx)(n,{show:e})]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";var n=e(t(),1);function r(e,t=Object.is){let[r,i]=(0,n.useState)({value:e,base:e}),a=r;t(r.base,e)||(a={value:t(r.value,r.base)?e:r.value,base:e},i(a));let o=(0,n.useCallback)(e=>i(t=>({...t,value:typeof e==`function`?e(t.value):e})),[]);return[a.value,o]}var i=(e,t)=>JSON.stringify(e)===JSON.stringify(t);export{r as n,i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./utils-DSMR_WLb.js";import{c as a,d as o,l as s}from"./design-icons-CzEoMH9c.js";import{a as c,n as l}from"./dist-BW234Kg5.js";import{a as u,i as d,n as f,r as p,t as m}from"./dist-C5mlVBmd.js";import{h,m as g}from"./dropdown-menu-4e2iKSMT.js";import{a as _,c as v,i as y,l as b,n as x,o as S,r as C,t as w,u as T}from"./es2015-CQth82uv.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-BAoXdNsT.js";import{Kn as ee}from"./index-CJFT0IZP.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=h(R),[H,U]=d(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,x]=M.useState(null),[S,C]=M.useState(null),[w,T]=M.useState(!1),E=g(l),[D,k]=m({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=m({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=b(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:p,trigger:y,onTriggerChange:x,valueNode:S,onValueNodeChange:C,valueNodeHasChildren:w,onValueNodeHasChildrenChange:T,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:f,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=W(n),o=G(ae,n),s=o.disabled||r,l=c(t,o.onTriggerChange),d=B(n),f=M.useRef(`touch`),[m,h,g]=$e(e=>{let t=d().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),_=e=>{s||(o.onOpenChange(!0),g()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...a,children:(0,F.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":$(o.value)?``:void 0,...i,ref:l,onClick:p(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&_(e)}),onPointerDown:p(i.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(_(e),e.preventDefault())}),onKeyDown:p(i.onKeyDown,e=>{let t=m.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&h(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(_(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,l=G(se,n),{onValueNodeHasChildrenChange:d}=l,p=a!==void 0,m=c(t,l.onValueNodeChange);f(()=>{d(p)},[d,p]);let h=$(l.value);return(0,F.jsx)(u.span,{...s,asChild:!h&&s.asChild,ref:m,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?o:a},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(y,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return f(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(T,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=l(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y,...b}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=c(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return w(E)},[E]),C();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:v,avoidCollisions:y}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(x,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(_,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:p(i,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(S,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...b,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:p(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=G(J,n),o=X(J,n),[s,l]=M.useState(null),[d,p]=M.useState(null),m=c(t,p),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,S=M.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&d&&v&&y&&b){let e=a.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=h(),c=window.innerHeight-Y*2,l=v.scrollHeight,u=window.getComputedStyle(d),f=parseInt(u.borderTopWidth,10),p=parseInt(u.paddingTop,10),m=parseInt(u.borderBottomWidth,10),_=parseInt(u.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=o.length>0&&y===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=d.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);s.style.height=n+`px`}else{let e=o.length>0&&y===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,a.trigger,a.valueNode,s,d,v,y,b,a.dir,r]);f(()=>S(),[S]);let[C,w]=M.useState();return f(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,F.jsx)(Te,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(u.div,{...i,ref:m,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(De,n),o=Ee(De,n),s=c(t,a.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:p(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=b();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(u.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(u.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=G(Z,n),l=X(Z,n),d=s.value===r,[f,m]=M.useState(a??``),[h,g]=M.useState(!1),_=c(t,v(e=>l.itemRefCallback?.(e,r,i))),y=b(),x=M.useRef(`touch`),S=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:i,textId:y,isSelected:d,onItemTextChange:M.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:(0,F.jsx)(u.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":d&&h,"data-state":d?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:_,onFocus:p(o.onFocus,()=>g(!0)),onBlur:p(o.onBlur,()=>g(!1)),onClick:p(o.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:p(o.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:p(o.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:p(o.onPointerMove,e=>{x.current=e.pointerType,i?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:p(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:p(o.onKeyDown,e=>{i||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=G(Q,n),s=X(Q,n),l=Ie(Q,n),d=re(Q,n),[p,m]=M.useState(null),h=v(e=>s.itemTextRefCallback?.(e,l.value,l.disabled)),g=c(t,m,l.onItemTextChange,h),_=p?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:_},l.value),[l.disabled,l.value,_]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=d;return f(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u.span,{id:l.textId,...a,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!$(o.value)?N.createPortal(a.children,o.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[i,a]=M.useState(!1),o=c(t,r.onScrollButtonChange);return f(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,F.jsx)(Ge,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),f(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:p(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:p(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:p(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:i,onValueChange:a,required:o,disabled:s,name:l,autoComplete:d,form:f}=r,{nativeOptions:p,nativeSelectKey:m}=r,h=M.useRef(null),g=c(n,h),_=i??``,v=E(_),y=Array.from(p).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(u.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:l,autoComplete:d,disabled:s,form:f,onChange:e=>a(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(i)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(p)]},m)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=v(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:i(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(s,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...a}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:i(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md 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`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...a,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:i(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:i(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(a,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(o,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:i(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(s,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt as t};