@wjarka/cezarion 0.13.3 → 0.13.4

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 (46) hide show
  1. package/dist/core/claude-cli-runner.d.ts +0 -11
  2. package/dist/core/claude-cli-runner.js +1 -11
  3. package/dist/core/claude-cli-runner.js.map +1 -1
  4. package/dist/core/codex-app-server-runner.js +1 -1
  5. package/dist/core/codex-app-server-runner.js.map +1 -1
  6. package/dist/core/codex-app-server-transport.js +1 -1
  7. package/dist/core/codex-app-server-transport.js.map +1 -1
  8. package/dist/core/opencode-server-runner.js +1 -1
  9. package/dist/core/opencode-server-runner.js.map +1 -1
  10. package/dist/core/pi-runner.js +16 -5
  11. package/dist/core/pi-runner.js.map +1 -1
  12. package/dist/core/pi-ui-mapper.js +11 -2
  13. package/dist/core/pi-ui-mapper.js.map +1 -1
  14. package/dist/core/runner-runtime.d.ts +11 -0
  15. package/dist/core/runner-runtime.js +12 -0
  16. package/dist/core/runner-runtime.js.map +1 -0
  17. package/dist/delegation/cli.js +72 -15
  18. package/dist/delegation/cli.js.map +1 -1
  19. package/dist/delegation/routes.d.ts +50 -50
  20. package/dist/delegation/transport.d.ts +54 -54
  21. package/dist/server/server.d.ts +1115 -1115
  22. package/dist/skills-remote.d.ts +6 -3
  23. package/dist/skills-remote.js +16 -7
  24. package/dist/skills-remote.js.map +1 -1
  25. package/dist/workflows/run.js +7 -4
  26. package/dist/workflows/run.js.map +1 -1
  27. package/package.json +3 -3
  28. package/scripts/pi-retry-degraded-service.mjs +16 -0
  29. package/web/dist/assets/{commit-list-Bl6yslwB.js → commit-list-B4XC1ODn.js} +1 -1
  30. package/web/dist/assets/{compare-variants-CRfTVKZK.js → compare-variants-BVL8TqP9.js} +1 -1
  31. package/web/dist/assets/github-BvQUJN1z.js +1 -0
  32. package/web/dist/assets/{index-BqKAvjft.js → index-CDG8WjQr.js} +6 -6
  33. package/web/dist/assets/{index-DB79l_Rb.css → index-DZ8KZzHE.css} +1 -1
  34. package/web/dist/assets/{prompt-templates-2ZlJ8pR_.js → prompt-templates-BmXStVbF.js} +1 -1
  35. package/web/dist/assets/{repo-git-ChEhD9Vs.js → repo-git-BKB_uTPT.js} +1 -1
  36. package/web/dist/assets/{skills-BVcO-q_l.js → skills-Cyk33xfz.js} +1 -1
  37. package/web/dist/assets/{task-changes-D-FuYcgt.js → task-changes-DI4_6Wp4.js} +1 -1
  38. package/web/dist/assets/{task-commits-D_5KeJj9.js → task-commits-CGosUb8O.js} +1 -1
  39. package/web/dist/assets/{task-files-CwN8ipV-.js → task-files-Bc1H59kO.js} +1 -1
  40. package/web/dist/assets/task-thread-C8ssWDxr.css +1 -0
  41. package/web/dist/assets/{task-thread-62uC3nOQ.js → task-thread-CVJ8_hAS.js} +5 -5
  42. package/web/dist/assets/{thread-loading-YEaIJp2x.js → thread-loading-L-UhMGht.js} +1 -1
  43. package/web/dist/assets/{workflows-DqHC8wuw.js → workflows-CfPTxrDw.js} +1 -1
  44. package/web/dist/index.html +4 -4
  45. package/web/dist/assets/github-CsJUOUdV.js +0 -1
  46. package/web/dist/assets/task-thread-Ddwh2DhG.css +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjarka/cezarion",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,8 +50,8 @@
50
50
  "zod": "^4.4.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@open-mercato/cezar-api-client": "^0.13.3",
54
- "@open-mercato/cezar-contract": "^0.13.3",
53
+ "@open-mercato/cezar-api-client": "^0.13.4",
54
+ "@open-mercato/cezar-contract": "^0.13.4",
55
55
  "@types/node": "^20.14.0",
56
56
  "@types/ws": "^8.18.1",
57
57
  "esbuild": "^0.28.1",
@@ -0,0 +1,16 @@
1
+ const RETRY_HINT = '[cezar:retry-xai-degraded] Service unavailable: ';
2
+ const DEGRADED_XAI_SERVICE = /service temporarily unavailable|availability is currently degraded/i;
3
+
4
+ export default function registerPiDegradedServiceRetry(pi) {
5
+ pi.on('message_end', (event) => {
6
+ const message = event.message;
7
+ if (message?.role !== 'assistant' || message.provider !== 'xai' || message.stopReason !== 'error') return;
8
+ if (typeof message.errorMessage !== 'string') return;
9
+
10
+ const errorMessage = DEGRADED_XAI_SERVICE.test(message.errorMessage)
11
+ ? `${RETRY_HINT}${message.errorMessage}`
12
+ : message.errorMessage;
13
+ if (errorMessage === message.errorMessage) return;
14
+ return { message: { ...message, errorMessage } };
15
+ });
16
+ }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,ct as i,gt as a}from"./alert-dialog-Duzl27Ie.js";import{t as o}from"./utils-9-zDpWwO.js";import{t as s}from"./project-router-B8sUN_Ka.js";import{h as c}from"./index-BqKAvjft.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,ct as i,gt as a}from"./alert-dialog-Duzl27Ie.js";import{t as o}from"./utils-9-zDpWwO.js";import{t as s}from"./project-router-B8sUN_Ka.js";import{h as c}from"./index-CDG8WjQr.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Br as i,Cr as a,Da as o,Dr as s,J as c,Sa as l,Sn as u,X as d,a as f,ba as p,c as m,d as h,i as g,ia as _,l as v,n as y,nn as b,o as x,or as S,qr as C,r as w,s as T,t as E,xn as D,zi as O}from"./alert-dialog-Duzl27Ie.js";import{t as k}from"./utils-9-zDpWwO.js";import{n as A,r as j,t as M}from"./collapsible-O6Tjzyk-.js";import{c as N,t as P}from"./project-router-B8sUN_Ka.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Ni-GM0ra.js";import{n as L,t as R}from"./token-metrics-CWXw3O9q.js";import{g as z,m as B}from"./index-BqKAvjft.js";import{t as V}from"./run-diff-DanadyNi.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=p(),t=D(e),n=R(u().data),i=o();if((0,H.useEffect)(()=>{e&&i.invalidateQueries({queryKey:b.groups.detail(e)})},[i,e,(S().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof r&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(v,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(h,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:r}){let s=N(),c=o(),[u,d]=(0,H.useState)(null),p=t.every(e=>a.has(e.status)),h=t[0]?i(t[0]):``,v=l({mutationFn:t=>O(e,t),onSuccess:(t,n)=>{c.invalidateQueries({queryKey:b.runs.all}),c.invalidateQueries({queryKey:b.groups.detail(e)}),s(`/tasks/${t.winner?.id??n}`)},onError:e=>_(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[h,` · `,t.length,` `,p?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),p?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:p,pickPending:v.isPending,onPick:()=>d(e),showTokens:n,showCost:r},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(E,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(g,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(T,{children:[(0,U.jsxs)(m,{children:[`Pick variant `,u?.variant,`?`]}),(0,U.jsxs)(f,{children:[`Variant `,u?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,U.jsxs)(x,{children:[(0,U.jsx)(w,{children:`Cancel`}),(0,U.jsxs)(y,{"data-slot":`confirm-pick`,onClick:()=>{u&&v.mutate(u.id),d(null)},children:[`Pick variant `,u?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=C(e),l=s(e.costUsd),u=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:o.label})]}),i&&u||a&&l?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&u&&a&&l?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&l?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:l}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(h,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(h,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,U.jsx)(c,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,U.jsxs)(j,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,U.jsx)(d,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Br as i,Cr as a,Da as o,Dr as s,J as c,Sa as l,Sn as u,X as d,a as f,ba as p,c as m,d as h,i as g,ia as _,l as v,n as y,nn as b,o as x,or as S,qr as C,r as w,s as T,t as E,xn as D,zi as O}from"./alert-dialog-Duzl27Ie.js";import{t as k}from"./utils-9-zDpWwO.js";import{n as A,r as j,t as M}from"./collapsible-O6Tjzyk-.js";import{c as N,t as P}from"./project-router-B8sUN_Ka.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Ni-GM0ra.js";import{n as L,t as R}from"./token-metrics-CWXw3O9q.js";import{g as z,m as B}from"./index-CDG8WjQr.js";import{t as V}from"./run-diff-DanadyNi.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=p(),t=D(e),n=R(u().data),i=o();if((0,H.useEffect)(()=>{e&&i.invalidateQueries({queryKey:b.groups.detail(e)})},[i,e,(S().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof r&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(v,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(h,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:r}){let s=N(),c=o(),[u,d]=(0,H.useState)(null),p=t.every(e=>a.has(e.status)),h=t[0]?i(t[0]):``,v=l({mutationFn:t=>O(e,t),onSuccess:(t,n)=>{c.invalidateQueries({queryKey:b.runs.all}),c.invalidateQueries({queryKey:b.groups.detail(e)}),s(`/tasks/${t.winner?.id??n}`)},onError:e=>_(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[h,` · `,t.length,` `,p?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),p?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:p,pickPending:v.isPending,onPick:()=>d(e),showTokens:n,showCost:r},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(E,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(g,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(T,{children:[(0,U.jsxs)(m,{children:[`Pick variant `,u?.variant,`?`]}),(0,U.jsxs)(f,{children:[`Variant `,u?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,U.jsxs)(x,{children:[(0,U.jsx)(w,{children:`Cancel`}),(0,U.jsxs)(y,{"data-slot":`confirm-pick`,onClick:()=>{u&&v.mutate(u.id),d(null)},children:[`Pick variant `,u?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=C(e),l=s(e.costUsd),u=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:o.label})]}),i&&u||a&&l?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&u&&a&&l?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&l?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:l}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(h,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(h,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,U.jsx)(c,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,U.jsxs)(j,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,U.jsx)(d,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};
@@ -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{$ as r,$t as i,Ca as a,Ci as o,Da as s,Ht as c,Ia as l,It as u,J as d,Jt as f,Lt as p,Mi as m,Q as h,Sa as g,Si as _,Sn as v,Ti as y,U as b,Wi as ee,X as x,Y as S,Zt as C,_n as te,ba as ne,bn as re,bt as ie,d as w,gn as ae,gr as oe,ia as T,l as E,nn as D,pi as O,pr as se,tt as ce,ur as le,vn as ue,wi as de,xt as fe,yn as pe}from"./alert-dialog-Duzl27Ie.js";import{d as me,n as k,t as A}from"./utils-9-zDpWwO.js";import{i as he,r as j,t as ge}from"./popover-ClNt8Xa0.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as Ce}from"./textarea-Bl6llqoA.js";import{t as M}from"./createLucideIcon-BHp8sXmF.js";import{t as N}from"./external-link-BE6y205O.js";import{A as P,L as we,M as F,N as I,O as L,P as Te,R,a as Ee,d as z,j as B,n as De,o as Oe,r as V,s as H}from"./prompt-templates-BmXStVbF.js";import{r as ke,t as Ae,u as je}from"./project-router-B8sUN_Ka.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as U,t as W}from"./markdown-Ni-GM0ra.js";import{d as Ne,f as G,i as Pe,s as Fe,t as Ie,u as K}from"./skills-DFBiAuJG.js";import{n as Le,t as q}from"./use-submit-shortcut-KWJsC906.js";import{d as Re,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-CDG8WjQr.js";import{t as We}from"./diff-BHmZWDtg2.js";import{t as Ge}from"./tab-link-DAMk-HDQ.js";var Ke=M(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=M(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),J=e(t(),1),Y=n();function X({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`skeleton`,className:A(`animate-pulse rounded-md bg-accent`,e),...t})}var Je=`cez-github-list-width`;function Ye(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Je);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Je,String(Ye(e)))}catch{}}function Z(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Q(e,t=[]){let n=Z(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Qe(t)),n}function Qe(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function $e(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function et(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function $(e,t,n){let r=(n??``).trim();if(!r)return Q(e,t);let i=Z(e),a=r.startsWith(i)?i+$e(r.slice(i.length),e):$e(r,e),o=et(a,e)?a:`${i}\n\n${a}`;return t.length?o+Qe(t):o}function tt(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function nt(e,t,n,r,i={}){return t?{...i,workflow:t,task:$(e,n,r)}:n.length?{...i,steps:tt(n),task:$(e,[],r)}:{...i,workflow:`quick-task`,task:$(e,[],r)}}var rt=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function it({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let a=new Map;for(let t of e.issues)for(let e of t.assignees??[])a.set(e.toLowerCase(),e);for(let e of t)a.set(e.toLowerCase(),e);let o=[...a.values()].sort((e,t)=>e.localeCompare(t)),s=!!e.viewerLogin&&t.length===1&&t[0]?.toLowerCase()===e.viewerLogin.toLowerCase();return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Y.jsxs)(ge,{children:[(0,Y.jsx)(he,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,className:rt,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Y.jsx)(j,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Y.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Y.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),o.map(e=>{let n=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Y.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Y.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Y.jsx)(`button`,{type:`button`,className:`${rt} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":s,onClick:()=>r(s?[]:[e.viewerLogin]),children:`Assigned to me`}),e.viewerLogin?null:(0,Y.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Y.jsxs)(`select`,{"aria-label":`Project board`,className:rt,value:n,onChange:e=>i(e.target.value),children:[(0,Y.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Y.jsx)(`select`,{"aria-label":`Project board`,className:rt,disabled:!0,value:``,children:(0,Y.jsx)(`option`,{value:``,children:`No boards`})}):(0,Y.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function at(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function ot(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.projectId&&!e.projectIds?.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function st(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function ct(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var lt={workflow:null,skills:[]},ut=`cez-followup-selection`;function dt(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ft(){try{let e=localStorage.getItem(ut);return e?dt(JSON.parse(e)):{...lt}}catch{return{...lt}}}function pt(e){try{localStorage.setItem(ut,JSON.stringify(e))}catch{}}var mt=`cez-followup-prompt:`;function ht(e){try{return localStorage.getItem(mt+e)??``}catch{return``}}function gt(e,t){try{t===``?localStorage.removeItem(mt+e):localStorage.setItem(mt+e,t)}catch{}}function _t({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:c,engine:l,onEngineChange:u,queuedRunId:f,onQueued:p}){let m=s(),h=se(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[y]=(0,J.useState)(()=>Z(e)),[b,x]=(0,J.useState)(()=>ht(e.url)||y),S=ze(l),C=(0,J.useRef)(null),te=(0,J.useRef)(null);(0,J.useEffect)(()=>{gt(e.url,b===y?``:b)},[e.url,b,y]);let ne=(0,J.useMemo)(()=>Ee(h.data?.promptTemplates),[h.data?.promptTemplates]),re=e=>{let t=C.current,n=H({prompt:b,base:y,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:te.current}),r=V(b,n,e);x(r.text),te.current=r.caret,requestAnimationFrame(()=>{C.current?.focus(),C.current?.setSelectionRange(r.caret,r.caret)})},ie=De(ne,v),ae=(0,J.useRef)(b);ae.current=b;let oe=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=Oe(ae.current,oe.current,ie,y);oe.current=e.applied,e.text!==ae.current&&x(e.text)},[ie,y]);let E=g({mutationFn:async()=>S.canRun?O(nt(e,r,v,b,Re(S))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&p(e.url,n.id),T(`Added to the queue — ${_} #${e.number}`),v.length>0&&h.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ie(e,t),h.data.skillUsage)}).then(()=>m.invalidateQueries({queryKey:D.uiState})).catch(()=>{}),gt(e.url,``),x(y),oe.current=``,m.invalidateQueries({queryKey:D.runs.all})},onError:e=>T(e.message,{tone:`danger`})}),ce=e=>{q({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!E.isPending&&S.canRun&&E.mutate())},le=e=>c(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Ce,{ref:C,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:b,onChange:e=>x(e.target.value),onSelect:e=>{te.current=e.currentTarget.selectionStart},onKeyDown:ce,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(Be,{templates:ne,onInsert:re}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(vt,{workflows:t,value:r,onChange:a})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(yt,{skills:n,skillUsage:h.data?.skillUsage,selected:v,onToggle:le})]}),v.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>le(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Y.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Y.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Y.jsx)(Ue,{pick:l,onChange:u,disabled:E.isPending||!S.canRun,accounts:!0}),S.runners.length<=1&&!S.accounts.some(e=>e.provider===S.runner&&e.id!=="default")?(0,Y.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Y.jsx)(`span`,{children:`Runner`}),S.runner]}):null]}),(0,Y.jsxs)(`label`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsxs)(`select`,{"aria-label":`Account`,value:S.account??S.repoAccount?.[S.runner]??`default`,disabled:E.isPending||!S.canRun,onChange:e=>u({...l,account:e.target.value}),children:[S.accounts.some(e=>e.provider===S.runner&&e.id==="default")?null:(0,Y.jsx)(`option`,{value:me,children:`Default`}),S.accounts.filter(e=>e.provider===S.runner).map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),!S.providerPending&&!S.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[k(e.url)?(0,Y.jsx)(w,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(w,{variant:`primary`,"data-action":`gh-run`,disabled:E.isPending||!S.canRun,onClick:()=>E.mutate(),children:[(0,Y.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:Le()}),f?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(Ae,{to:`/tasks/${f}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vt({workflows:e,value:t,onChange:n}){let[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(``),s=(0,J.useRef)(null),c=Ne(e,a);return(0,Y.jsxs)(ge,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Y.jsx)(he,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:A(z,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Y.jsx)(C,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(S,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(j,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(L,{shouldFilter:!1,children:[(0,Y.jsx)(F,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Y.jsxs)(Te,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Y.jsx)(P,{children:`Nothing matches.`}):null,(0,Y.jsx)(B,{children:c.map(e=>{let r=t===e.name;return(0,Y.jsxs)(I,{value:`workflow ${e.name}`,keywords:G(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function yt({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),f=(0,J.useRef)(null),{mostUsed:p,project:m,global:h,ranked:g}=K(e,o,t),_=(e,t)=>{let i=n.includes(e.name);return(0,Y.jsxs)(I,{value:`skill ${e.name} ${e.path}`,keywords:G(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Y.jsx)(`span`,{className:A(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(He,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(ge,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(he,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:A(z,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(c,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(S,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(j,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(L,{shouldFilter:!1,children:[(0,Y.jsx)(F,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>f.current?.scrollTo(0,0)}),(0,Y.jsxs)(Te,{ref:f,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(g?g.length===0:p.length===0&&m.length===0&&h.length===0)?(0,Y.jsx)(P,{children:`Nothing matches.`}):null,g?g.length>0?(0,Y.jsx)(B,{children:g.map(e=>_(e,Pe(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[p.length>0?(0,Y.jsx)(B,{heading:`Most used`,children:p.map(e=>_(e,Pe(e)))}):null,m.length>0?(0,Y.jsx)(B,{heading:`Project skills`,children:m.map(e=>_(e,!0))}):null,h.length>0?(0,Y.jsx)(B,{heading:`Global`,children:h.map(e=>_(e,!1))}):null]})]})]})})]})]})}var bt=1e3,xt=100,St=350;function Ct({width:e,onWidthChange:t}){let n=(0,J.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Ye(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Y.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Ye(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function wt(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Tt({view:e,changes:t=!1,index:n=!1}){let{n:r}=ne(),i=ae({limit:bt}),a=v().data?.capabilities?.automations===!0,c=i.data,d=s(),m=e=>{d.setQueryData(D.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>d.setQueryData(D.uiState,e)).catch(e=>{T(e instanceof Error?e.message:String(e),{tone:`danger`}),d.invalidateQueries({queryKey:D.uiState})})},y=(0,J.useRef)(null),b=g({mutationFn:()=>_({refresh:!0,limit:bt}),onSuccess:t=>{d.setQueryData(D.github({limit:bt}),t),d.invalidateQueries({queryKey:D.githubChecks(Ue)}),d.invalidateQueries({queryKey:D.githubSearch(e===`issues`?`issue`:`pr`,z)});let n=y.current;if(!n){d.removeQueries({queryKey:[`github`,`comments`]});return}let r=D.githubComments(n.kind,n.number);o(n.kind,n.number,{refresh:!0}).then(e=>d.setQueryData(r,e)).catch(()=>{}),d.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==l(r)})},onError:e=>T(e.message,{tone:`danger`})}),x=oe(),S=le(),C=se(),[O,ce]=(0,J.useState)(()=>ft().workflow),[ue,de]=(0,J.useState)(()=>ft().skills),[pe,me]=(0,J.useState)({runner:null,model:null,effort:null,account:null}),[k,he]=(0,J.useState)(Xe),[j,ge]=(0,J.useState)(!1),_e=e=>{let t=Ye(e);he(t),Ze(t)};(0,J.useEffect)(()=>{pt({workflow:O,skills:[...ue]})},[O,ue]);let ve=x.data?.workflows;(0,J.useEffect)(()=>{ve&&O!==null&&!ve.some(e=>e.name===O)&&ce(null)},[ve,O]);let ye=S.data,be=C.data?.skillUsage,xe=(0,J.useMemo)(()=>Fe(ye??[],be),[ye,be]),[Se,Ce]=(0,J.useState)(new Map),[M,N]=(0,J.useState)(``),[P,we]=(0,J.useState)([]),[F,I]=(0,J.useState)([]),[L,Te]=(0,J.useState)(``),R=c?.projects?.some(e=>e.id===L)?L:``;(0,J.useEffect)(()=>{c&&L&&!R&&Te(``)},[c,L,R]);let Ee=()=>{N(``),we([]),I([]),Te(``)},z=wt(M,St),B=(0,J.useMemo)(()=>c?.available?e===`issues`?c.issues:c.prs:[],[c,e]),De=(0,J.useMemo)(()=>ot(B,{query:z,labels:P,...e===`issues`?{assignees:F,projectId:R}:{}}),[B,z,P,e,F,R]),Oe=M.trim()===z.trim(),V=c?.available===!0&&Oe&&st(z,De),H=re(e===`issues`?`issue`:`pr`,z,V),Me=B,W=ot(Me,{query:M,labels:P,...e===`issues`?{assignees:F,projectId:R}:{}}),Ne=M.trim()!==``||P.length>0||e===`issues`&&(F.length>0||R!==``),G=V&&H.data?.available?H.data:null,Pe=new Set(W.map(e=>e.number)),Ie=e===`issues`&&G?R&&G.items.some(e=>e.projectIds===void 0)?G.projectsReason??`Project board data is incomplete. Refresh to try again.`:F.length&&G.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,K=G&&!Ie?ot(G.items,{labels:P,...e===`issues`?{assignees:F,projectId:R}:{}}).filter(e=>!Pe.has(e.number)):[],Le=D.github()[0],q=r===void 0?null:Number.parseInt(r,10),Re=H.data?.available?H.data.items.find(e=>e.number===q):void 0,[ze,Be]=(0,J.useState)(null);(0,J.useEffect)(()=>{Re&&Be({scope:Le,view:e,item:Re})},[Le,e,Re]);let He=Re??(ze?.scope===Le&&ze.view===e&&ze.item.number===q?ze.item:null),Ue=(()=>{if(!c?.available||e!==`prs`)return[];let t=new Set;q!==null&&Number.isInteger(q)&&t.add(q);for(let e of[...K,...c.prs]){if(t.size>=xt)break;t.add(e.number)}return[...t]})(),We=te(Ue,e===`prs`),Ke=We.data?.available?We.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Y.jsx)(ke,{to:`/github/prs`,replace:!0});if(!c)return i.isError?(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(E,{icon:(0,Y.jsx)(f,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:i.error.message})}):(0,Y.jsx)(Ve,{});if(y.current=null,!c.available)return(0,Y.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(E,{icon:(0,Y.jsx)(fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:c.reason??`unknown reason`,actions:(0,Y.jsx)(w,{variant:`outline`,"data-action":`gh-retry`,disabled:b.isPending,onClick:()=>b.mutate(),children:`Try again`}),children:(0,Y.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Y.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let qe=M.trim()!==``&&!Oe||V&&H.isPending,X={...G?.labelColors??{},...c.labelColors??{}},Je=at([...Me,...G?.items??[]]),Z=r===void 0?null:Number.parseInt(r,10),Q=Z===null?W[0]??K[0]??null:Me.find(e=>e.number===Z)??He??null;y.current=Q?{kind:Q.kind,number:Q.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=V&&(H.data?.available===!1||H.isError),et=H.data?.available===!1?H.data.reason??`unknown reason`:H.error instanceof Error?H.error.message:`the search request failed`,$=Ne?qe?(0,Y.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,M.trim(),`”…`]}):$e?K.length>0?(0,Y.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Y.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Ie?(0,Y.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Ie]}):K.length>0?null:G?.truncated?(0,Y.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):G&&W.length>0?(0,Y.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):G?(0,Y.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Y.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Y.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-[22px] px-[18px] pt-6 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-9`,children:[(0,Y.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-[22px]`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Y.jsx)(`h1`,{className:`w-full text-[30px] font-semibold tracking-tight`,children:`GitHub`}),c.repo?(0,Y.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Y.jsx)(`span`,{"data-slot":`gh-repo`,children:c.repo}),(0,Y.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,c.syncedAt?`Synced ${U(c.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Y.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>m(`issues`),children:[`Issues · `,Et(c.issues.length)]}),(0,Y.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>m(`prs`),children:[`Pull requests · `,Et(c.prs.length)]}),a?(0,Y.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:b.isPending,onClick:()=>b.mutate(),className:`gh-utility`,children:[(0,Y.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Y.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Y.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Y.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:M,onChange:e=>N(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Y.jsx)(Ot,{options:Je,colors:X,selected:P,onChange:we}),e===`issues`?(0,Y.jsx)(it,{data:{...c,issues:[...c.issues,...G?.items??[]]},assignees:F,projectId:R,onAssigneesChange:I,onProjectChange:Te}):null,(0,Y.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Ee,children:`Clear filters`})]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row`,children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":e===`issues`&&r!==void 0&&!j||void 0,style:{"--github-list-width":`${k}px`},className:`relative flex w-full min-h-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0`,children:[W.length===0?$&&(0,Y.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:$}):(0,Y.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map(t=>(0,Y.jsx)(Dt,{item:t,view:e,colors:X,active:Q?.url===t.url,queued:Se.has(t.url),checks:t.kind===`pr`?Ke?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&r!==void 0&&W.length>2?(0,Y.jsx)(w,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":j,onClick:()=>ge(e=>!e),children:j?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&V&&$?(0,Y.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:$}):null,K.length>0?(0,Y.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Y.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,G?.truncated?` (first matches)`:``]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:K.map(t=>(0,Y.jsx)(Dt,{item:t,view:e,colors:X,active:Q?.url===t.url,queued:Se.has(t.url),checks:t.kind===`pr`?Ke?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Y.jsx)(Ct,{width:k,onWidthChange:_e})]}),(0,Y.jsx)(`section`,{"data-slot":`gh-detail`,className:A(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,r===void 0?`hidden md:flex`:`flex`),children:Q?(0,Y.jsx)(At,{item:Q,listPath:Qe,colors:X,changes:t,checks:Q.kind===`pr`?Ke?.[Q.number]??Q.checks:Q.checks,children:(0,Y.jsx)(_t,{item:Q,workflows:x.data?.workflows??[],skills:xe,workflow:O,onWorkflowChange:ce,selectedSkills:ue,onSkillsChange:de,engine:pe,onEngineChange:me,queuedRunId:Se.get(Q.url)??null,onQueued:(e,t)=>Ce(n=>new Map(n).set(e,t))},Q.url)}):(0,Y.jsx)(E,{icon:e===`issues`?(0,Y.jsx)(h,{size:16}):(0,Y.jsx)(ie,{size:16}),tone:`neutral`,heading:`h2`,title:Z===null?`Nothing selected`:`Not found`,subtitle:Z===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Z} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Z} above to look it up on GitHub, closed and merged included.`})})]})]})}function Et(e){return`${e}${e>=bt?`+`:``}`}function Dt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let c=e.kind===`issue`?h:ie,l=s(),u=()=>{l.prefetchQuery({queryKey:D.githubComments(e.kind,e.number),queryFn:({signal:t})=>o(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(Ae,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Q(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:u,onFocus:u,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:A(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,r&&`bg-accent-strong/10 text-accent-text`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Y.jsx)(c,{"aria-hidden":`true`,className:A(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Y.jsx)(`span`,{className:A(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,r&&`font-semibold`),children:e.title})]}),(0,Y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[10.5px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),(0,Y.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Y.jsx)(`span`,{children:U(e.createdAt)}),(0,Y.jsx)(Jt,{count:e.comments}),a?(0,Y.jsx)(Xt,{checks:a}):null,i?(0,Y.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Y.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Y.jsx)(kt,{label:e,color:n[e],plain:!0},e))}):null]})})}function Ot({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,J.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Y.jsxs)(ge,{open:i,onOpenChange:a,children:[(0,Y.jsx)(he,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:A(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[(0,Y.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Y.jsx)(j,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Y.jsxs)(L,{children:[(0,Y.jsx)(F,{placeholder:`Filter labels…`}),(0,Y.jsxs)(Te,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Y.jsx)(P,{children:`No labels.`}),n.length>0?(0,Y.jsxs)(I,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Y.jsxs)(I,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ct(t[e])}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function kt({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ct(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function At({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsxs)(Ae,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:o}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[U(e.createdAt),` ago`]}),e.comments?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Jt,{count:e.comments})]}):null,s?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,k(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Y.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(kt,{label:e,color:n[e]},e)),a?(0,Y.jsx)(Yt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Y.jsx)(Pt,{item:e}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Y.jsx)(W,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(Ft,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Y.jsx)(Nt,{number:e.number}):null,r]})}var jt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Mt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:A(t,`text-success`)}):e===`failing`?(0,Y.jsx)(ce,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:A(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:A(t,`animate-spin text-warning`)}):(0,Y.jsx)(r,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:A(t,`text-soft-foreground`)})}function Nt({number:e}){let t=s(),n=a({queryKey:D.githubMergeState(e),queryFn:({signal:t})=>y(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[p,h]=(0,J.useState)(!1),_=g({mutationFn:()=>y(e,{refresh:!0}),onSuccess:n=>t.setQueryData(D.githubMergeState(e),n),onError:e=>T(e instanceof Error?e.message:String(e),{tone:`danger`})}),v=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,b=g({mutationFn:()=>{if(!r||!v)throw Error(`No merge method is available.`);return m(e,{method:v,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),T(`Pull request #${e} merged`),t.invalidateQueries({queryKey:D.githubMergeState(e)}),t.invalidateQueries({queryKey:D.github({limit:bt})}),t.invalidateQueries({queryKey:D.githubComments(`pr`,e)})},onError:n=>{T(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:D.githubMergeState(e)})}});if(n.isPending)return(0,Y.jsx)(X,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let ee=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:r.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`,x=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(v&&(r.canMerge||r.canOverride&&p));return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":r.eligibility,"data-conflicting":r.mergeable===`conflicting`?`true`:void 0,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Y.jsx)(d,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(f,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:ee}),(0,Y.jsxs)(w,{type:`button`,variant:`ghost`,size:`sm`,disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,Y.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,_.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Mt,{state:x}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Mt,{state:S}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(Mt,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&k(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Y.jsx)(w,{className:`mt-4`,onClick:e=>{let t=e.currentTarget.closest(`article`)?.querySelector(`[data-slot="gh-custom-prompt"]`);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})},children:`Run agent on this PR`}):null,r.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>h(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,r.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,r.state===`open`&&r.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:v??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:r.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:jt[e]},e))}),(0,Y.jsx)(w,{disabled:!C,onClick:()=>l(!0),children:v?jt[v]:`Merge`})]}):null]})]}),(0,Y.jsx)(ye,{open:c,onOpenChange:l,children:(0,Y.jsxs)(xe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(be,{children:[(0,Y.jsxs)(Se,{children:[v?jt[v]:`Merge`,` pull request #`,e,`?`]}),(0,Y.jsx)(ve,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),p&&r.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),b.error?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:b.error.message}):null,(0,Y.jsxs)(_e,{children:[(0,Y.jsx)(w,{variant:`outline`,disabled:b.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Y.jsx)(w,{disabled:b.isPending,onClick:()=>b.mutate(),children:b.isPending?`Merging…`:v?jt[v]:`Merge`})]})]})})]})}function Pt({item:e}){let t=s(),n=pe(e.number),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===a);(0,J.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===a)&&o(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await de(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),T(`The reviewed revision changed.`))};if(n.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=k(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===a);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,Y.jsx)(w,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,p?(0,Y.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:A(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(w,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>o(l[u-1]?.path??null),children:(0,Y.jsx)(Ke,{})}),(0,Y.jsx)(w,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>o(l[u+1]?.path??null),children:(0,Y.jsx)(x,{size:16})})]}),l.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(We,{files:f.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Ft({item:e,colors:t}){let n=ue(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(It(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(X,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(X,{className:`h-14 w-full`}),(0,Y.jsx)(X,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Lt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Rt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Wt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Bt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var It=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Lt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Rt({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Bt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:zt.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:U(e[e.length-1].createdAt)})]})})}var zt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Bt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:A(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:zt[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(Vt,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:U(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Vt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Ht,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:ct(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Y.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Y.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Y.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Y.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Ht({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:A(`shrink-0`,qt[e]),children:Kt[e]}):null}var Ut={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Wt({comment:e}){let t=e.reviewState?Ut[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Gt,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:U(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:A(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(W,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Gt({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Kt={passing:`✓`,failing:`✗`,pending:`○`},qt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Jt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Yt({checks:e,url:t}){let n=A(`text-[11px] font-medium`,qt[e],t&&`hover:underline`),r=`${Kt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Xt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:A(`shrink-0 font-sans text-[11px] font-semibold`,qt[e]),children:Kt[e]})}export{Tt as GithubRoute};