@wjarka/cezarion 0.14.2-pr417.646.2 → 0.14.2-pr420.648

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.
@@ -300,18 +300,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
300
300
  } & {
301
301
  "/:workerId": {
302
302
  $get: {
303
- output: {
304
- error: string;
305
- code?: "invalid_input" | undefined;
306
- };
307
- outputFormat: "json";
308
- status: 400;
309
- input: {
310
- param: {
311
- workerId: string;
312
- };
313
- };
314
- } | {
315
303
  output: {
316
304
  workerId: string;
317
305
  parentRunId: string;
@@ -388,11 +376,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
388
376
  workerId: string;
389
377
  };
390
378
  };
391
- };
392
- };
393
- } & {
394
- "/:workerId/collect": {
395
- $post: {
379
+ } | {
396
380
  output: {
397
381
  error: string;
398
382
  code?: "invalid_input" | undefined;
@@ -403,10 +387,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
403
387
  param: {
404
388
  workerId: string;
405
389
  };
406
- } & {
407
- json: Record<string, never>;
408
390
  };
409
- } | {
391
+ };
392
+ };
393
+ } & {
394
+ "/:workerId/collect": {
395
+ $post: {
410
396
  output: {
411
397
  workerId: string;
412
398
  parentRunId: string;
@@ -508,11 +494,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
508
494
  } & {
509
495
  json: Record<string, never>;
510
496
  };
511
- };
512
- };
513
- } & {
514
- "/:workerId/steer": {
515
- $post: {
497
+ } | {
516
498
  output: {
517
499
  error: string;
518
500
  code?: "invalid_input" | undefined;
@@ -524,11 +506,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
524
506
  workerId: string;
525
507
  };
526
508
  } & {
527
- json: {
528
- text: string;
529
- };
509
+ json: Record<string, never>;
530
510
  };
531
- } | {
511
+ };
512
+ };
513
+ } & {
514
+ "/:workerId/steer": {
515
+ $post: {
532
516
  output: {
533
517
  workerId: string;
534
518
  state: "delivered" | "queued";
@@ -544,11 +528,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
544
528
  text: string;
545
529
  };
546
530
  };
547
- };
548
- };
549
- } & {
550
- "/:workerId/stop": {
551
- $post: {
531
+ } | {
552
532
  output: {
553
533
  error: string;
554
534
  code?: "invalid_input" | undefined;
@@ -560,9 +540,15 @@ export declare function createDelegationRoutes(service: DelegationService, crede
560
540
  workerId: string;
561
541
  };
562
542
  } & {
563
- json: Record<string, never>;
543
+ json: {
544
+ text: string;
545
+ };
564
546
  };
565
- } | {
547
+ };
548
+ };
549
+ } & {
550
+ "/:workerId/stop": {
551
+ $post: {
566
552
  output: {
567
553
  workerId: string;
568
554
  state: "stopping" | "terminated";
@@ -576,11 +562,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
576
562
  } & {
577
563
  json: Record<string, never>;
578
564
  };
579
- };
580
- };
581
- } & {
582
- "/:workerId/destroy": {
583
- $post: {
565
+ } | {
584
566
  output: {
585
567
  error: string;
586
568
  code?: "invalid_input" | undefined;
@@ -594,7 +576,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
594
576
  } & {
595
577
  json: Record<string, never>;
596
578
  };
597
- } | {
579
+ };
580
+ };
581
+ } & {
582
+ "/:workerId/destroy": {
583
+ $post: {
598
584
  output: {
599
585
  workerId: string;
600
586
  state: "complete" | "incomplete";
@@ -617,6 +603,20 @@ export declare function createDelegationRoutes(service: DelegationService, crede
617
603
  } & {
618
604
  json: Record<string, never>;
619
605
  };
606
+ } | {
607
+ output: {
608
+ error: string;
609
+ code?: "invalid_input" | undefined;
610
+ };
611
+ outputFormat: "json";
612
+ status: 400;
613
+ input: {
614
+ param: {
615
+ workerId: string;
616
+ };
617
+ } & {
618
+ json: Record<string, never>;
619
+ };
620
620
  } | {
621
621
  output: {
622
622
  workerId: string;
@@ -646,11 +646,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
646
646
  "/:workerId/diff": {
647
647
  $get: {
648
648
  output: {
649
- error: string;
650
- code?: "invalid_input" | undefined;
649
+ workerId: string;
650
+ baselineSha: string;
651
+ diff: string;
652
+ truncated: boolean;
651
653
  };
652
654
  outputFormat: "json";
653
- status: 400;
655
+ status: 200;
654
656
  input: {
655
657
  param: {
656
658
  workerId: string;
@@ -658,13 +660,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
658
660
  };
659
661
  } | {
660
662
  output: {
661
- workerId: string;
662
- baselineSha: string;
663
- diff: string;
664
- truncated: boolean;
663
+ error: string;
664
+ code?: "invalid_input" | undefined;
665
665
  };
666
666
  outputFormat: "json";
667
- status: 200;
667
+ status: 400;
668
668
  input: {
669
669
  param: {
670
670
  workerId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjarka/cezarion",
3
- "version": "0.14.2-pr417.646.2",
3
+ "version": "0.14.2-pr420.648",
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.14.2-pr417.646.2",
54
- "@open-mercato/cezar-contract": "0.14.2-pr417.646.2",
53
+ "@open-mercato/cezar-api-client": "0.14.2-pr420.648",
54
+ "@open-mercato/cezar-contract": "0.14.2-pr420.648",
55
55
  "@types/node": "^20.14.0",
56
56
  "@types/ws": "^8.18.1",
57
57
  "esbuild": "^0.28.1",
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Rt as r,_t as i,lt as a}from"./alert-dialog-BOp2HnnL.js";import{t as o}from"./utils-GZNjgma4.js";import{t as s}from"./project-router-CvFAMDcP.js";import{h as c}from"./index-BuhKPVdF.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)(i,{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)(a,{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{Rt as r,_t as i,lt as a}from"./alert-dialog-BOp2HnnL.js";import{t as o}from"./utils-GZNjgma4.js";import{t as s}from"./project-router-CvFAMDcP.js";import{h as c}from"./index-C4iEPAUV.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)(i,{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)(a,{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{Aa as r,Ca as i,Cn as a,Hi as o,Hr as s,Ta as c,Tr as l,Xr as u,Y as d,Z as f,a as p,c as m,cr as h,d as g,i as _,in as v,kr as y,l as b,n as x,ni as S,o as C,r as w,s as T,sa as E,t as D,wn as O}from"./alert-dialog-BOp2HnnL.js";import{t as k}from"./utils-GZNjgma4.js";import{n as A,r as j,t as M}from"./collapsible-bb0csfMs.js";import{c as N,t as P}from"./project-router-CvFAMDcP.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Ir62-VMS.js";import{n as L,t as R}from"./token-metrics-BLzFUb8F.js";import{g as z,m as B}from"./index-BuhKPVdF.js";import{t as V}from"./run-diff-DrQsmf3-.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=i(),t=a(e),n=R(O().data),o=r();if((0,H.useEffect)(()=>{e&&o.invalidateQueries({queryKey:v.groups.detail(e)})},[o,e,(h().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 S&&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)(b,{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)(g,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(g,{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:i}){let a=N(),u=r(),[d,f]=(0,H.useState)(null),h=t.every(e=>l.has(e.status)),g=t[0]?s(t[0]):``,y=c({mutationFn:t=>o(e,t),onSuccess:(t,n)=>{u.invalidateQueries({queryKey:v.runs.all}),u.invalidateQueries({queryKey:v.groups.detail(e)}),a(`/tasks/${t.winner?.id??n}`)},onError:e=>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:[g,` · `,t.length,` `,h?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),h?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:h,pickPending:y.isPending,onPick:()=>f(e),showTokens:n,showCost:i},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)(D,{open:d!==null,onOpenChange:e=>!e&&f(null),children:(0,U.jsxs)(_,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(T,{children:[(0,U.jsxs)(m,{children:[`Pick variant `,d?.variant,`?`]}),(0,U.jsxs)(p,{children:[`Variant `,d?.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)(C,{children:[(0,U.jsx)(w,{children:`Cancel`}),(0,U.jsxs)(x,{"data-slot":`confirm-pick`,onClick:()=>{d&&y.mutate(d.id),f(null)},children:[`Pick variant `,d?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=u(e),s=y(e.costUsd),c=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&&c||a&&s?(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&&c&&a&&s?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&s?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:s}):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)(g,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(g,{"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)(d,{"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)(f,{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{Aa as r,Ca as i,Cn as a,Hi as o,Hr as s,Ta as c,Tr as l,Xr as u,Y as d,Z as f,a as p,c as m,cr as h,d as g,i as _,in as v,kr as y,l as b,n as x,ni as S,o as C,r as w,s as T,sa as E,t as D,wn as O}from"./alert-dialog-BOp2HnnL.js";import{t as k}from"./utils-GZNjgma4.js";import{n as A,r as j,t as M}from"./collapsible-bb0csfMs.js";import{c as N,t as P}from"./project-router-CvFAMDcP.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Ir62-VMS.js";import{n as L,t as R}from"./token-metrics-BLzFUb8F.js";import{g as z,m as B}from"./index-C4iEPAUV.js";import{t as V}from"./run-diff-DrQsmf3-.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=i(),t=a(e),n=R(O().data),o=r();if((0,H.useEffect)(()=>{e&&o.invalidateQueries({queryKey:v.groups.detail(e)})},[o,e,(h().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 S&&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)(b,{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)(g,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(g,{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:i}){let a=N(),u=r(),[d,f]=(0,H.useState)(null),h=t.every(e=>l.has(e.status)),g=t[0]?s(t[0]):``,y=c({mutationFn:t=>o(e,t),onSuccess:(t,n)=>{u.invalidateQueries({queryKey:v.runs.all}),u.invalidateQueries({queryKey:v.groups.detail(e)}),a(`/tasks/${t.winner?.id??n}`)},onError:e=>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:[g,` · `,t.length,` `,h?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),h?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:h,pickPending:y.isPending,onPick:()=>f(e),showTokens:n,showCost:i},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)(D,{open:d!==null,onOpenChange:e=>!e&&f(null),children:(0,U.jsxs)(_,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(T,{children:[(0,U.jsxs)(m,{children:[`Pick variant `,d?.variant,`?`]}),(0,U.jsxs)(p,{children:[`Variant `,d?.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)(C,{children:[(0,U.jsx)(w,{children:`Cancel`}),(0,U.jsxs)(x,{"data-slot":`confirm-pick`,onClick:()=>{d&&y.mutate(d.id),f(null)},children:[`Pick variant `,d?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=u(e),s=y(e.costUsd),c=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&&c||a&&s?(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&&c&&a&&s?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&s?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:s}):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)(g,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(g,{"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)(d,{"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)(f,{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 +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,Aa as a,Ca as o,Di as s,Ea as c,Ei as l,Fi as u,Lt as d,Oi as f,Rt as p,Sn as m,St as h,Ta as ee,Ti as g,U as _,Ut as v,X as y,Y as b,Yt as x,Z as S,Zt as C,bn as w,d as T,et as E,fr as te,gi as ne,hr as re,in as D,l as O,nt as k,qi as ie,sa as A,tn as ae,vn as oe,vr as se,wn as ce,xn as le,xt as ue,yn as de,za as fe}from"./alert-dialog-BOp2HnnL.js";import{d as pe,n as me,t as j}from"./utils-GZNjgma4.js";import{a as M,o as he,r as ge}from"./agent-accounts-BxBsIXGa.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as N}from"./textarea-DfvlPIgO.js";import{t as Ce}from"./createLucideIcon-BHp8sXmF.js";import{t as P}from"./external-link-BE6y205O.js";import{A as F,E as I,F as we,I as L,M as R,O as z,a as Te,c as B,d as Ee,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-BGGpAIzb.js";import{r as ke,t as Ae,u as je}from"./project-router-CvFAMDcP.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-Ir62-VMS.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-BuhKPVdF.js";import{t as We}from"./diff-BjLZHKfD2.js";import{t as Ge}from"./tab-link-CkIV8ixq.js";var Ke=Ce(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=Ce(`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`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`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(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qe(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(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 tt(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 nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(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 it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`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 ot({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,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(ge,{children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(M,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.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,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} 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,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(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 ct(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 lt(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 ut(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 dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(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 mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:o,onSkillsChange:s,engine:c,onEngineChange:l,queuedRunId:u,onQueued:d}){let f=a(),p=re(),m=e.kind===`pr`?`PR`:`issue`,h=o.filter(e=>n.some(t=>t.name===e)),[g]=(0,X.useState)(()=>$(e)),[_,v]=(0,X.useState)(()=>_t(e.url)||g),y=ze(c),x=(0,X.useRef)(null),S=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,_===g?``:_)},[e.url,_,g]);let C=(0,X.useMemo)(()=>Te(p.data?.promptTemplates),[p.data?.promptTemplates]),w=e=>{let t=x.current,n=W({prompt:_,base:g,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:S.current}),r=Oe(_,n,e);v(r.text),S.current=r.caret,requestAnimationFrame(()=>{x.current?.focus(),x.current?.setSelectionRange(r.caret,r.caret)})},E=H(C,h),te=(0,X.useRef)(_);te.current=_;let O=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(te.current,O.current,E,g);O.current=e.applied,e.text!==te.current&&v(e.text)},[E,g]);let k=ee({mutationFn:async()=>y.canRun?ne(it(e,r,h,_,Y(y))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&d(e.url,n.id),A(`Added to the queue — ${m} #${e.number}`),h.length>0&&p.data!==void 0&&ie({skillUsage:h.reduce((e,t)=>q(e,t),p.data.skillUsage)}).then(()=>f.invalidateQueries({queryKey:D.uiState})).catch(()=>{}),vt(e.url,``),v(g),O.current=``,f.invalidateQueries({queryKey:D.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),oe=e=>{Re({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(),!k.isPending&&y.canRun&&k.mutate())},se=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(N,{ref:x,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:_,onChange:e=>v(e.target.value),onSelect:e=>{S.current=e.currentTarget.selectionStart},onKeyDown:oe,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:C,onInsert:w}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:i})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:p.data?.skillUsage,selected:h,onToggle:se})]}),h.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>se(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,Z.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:c,onChange:l,disabled:k.isPending||!y.canRun,accounts:!0}),y.runners.length<=1&&!y.accounts.some(e=>e.provider===y.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),y.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:y,disabled:k.isPending||!y.canRun,onPick:e=>l({...c,account:e})})]}),!y.providerPending&&!y.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[y.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[me(e.url)?(0,Z.jsx)(T,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(T,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!y.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,m]}),(0,Z.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:J()}),u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${u}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=K(e,o);return(0,Z.jsxs)(ge,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:j(Ee,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:pe,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(B,{icon:(0,Z.jsx)(C,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=Le(e,o,t),h=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(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,Z.jsx)(`span`,{className:j(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ge,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:j(Ee,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(V,{children:m.map(e=>h(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:d.map(e=>h(e,Fe(e)))}):null,f.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(V,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.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,Z.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 Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:i}=o(),s=oe({limit:Ct}),c=ce().data?.capabilities?.automations===!0,u=s.data,f=a(),_=e=>{f.setQueryData(D.uiState,t=>({...t,githubView:e})),ie({githubView:e}).then(e=>f.setQueryData(D.uiState,e)).catch(e=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),f.invalidateQueries({queryKey:D.uiState})})},v=(0,X.useRef)(null),y=ee({mutationFn:()=>g({refresh:!0,limit:Ct}),onSuccess:t=>{f.setQueryData(D.github({limit:Ct}),t),f.invalidateQueries({queryKey:D.githubChecks(He)}),f.invalidateQueries({queryKey:D.githubSearch(e===`issues`?`issue`:`pr`,B)});let n=v.current;if(!n){f.removeQueries({queryKey:[`github`,`comments`]});return}let r=D.githubComments(n.kind,n.number);l(n.kind,n.number,{refresh:!0}).then(e=>f.setQueryData(r,e)).catch(()=>{}),f.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==fe(r)})},onError:e=>A(e.message,{tone:`danger`})}),b=se(),S=te(),C=re(),[w,E]=(0,X.useState)(()=>mt().workflow),[ne,k]=(0,X.useState)(()=>mt().skills),[ae,le]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[pe,me]=(0,X.useState)(Xe),[M,he]=(0,X.useState)(!1),ge=e=>{let t=Ye(e);me(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:w,skills:[...ne]})},[w,ne]);let _e=b.data?.workflows;(0,X.useEffect)(()=>{_e&&w!==null&&!_e.some(e=>e.name===w)&&E(null)},[_e,w]);let ve=S.data,ye=C.data?.skillUsage,be=(0,X.useMemo)(()=>Ie(ve??[],ye),[ve,ye]),[xe,Se]=(0,X.useState)(new Map),[N,Ce]=(0,X.useState)(``),[P,F]=(0,X.useState)([]),[I,we]=(0,X.useState)([]),[L,R]=(0,X.useState)(``),z=u?.projects?.some(e=>e.id===L)?L:``;(0,X.useEffect)(()=>{u&&L&&!z&&R(``)},[u,L,z]);let Te=()=>{Ce(``),F([]),we([]),R(``)},B=Dt(N,Tt),Ee=(0,X.useMemo)(()=>u?.available?e===`issues`?u.issues:u.prs:[],[u,e]),De=(0,X.useMemo)(()=>ct(Ee,{query:B,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),[Ee,B,P,e,I,z]),V=N.trim()===B.trim(),H=u?.available===!0&&V&&lt(B,De),U=m(e===`issues`?`issue`:`pr`,B,H),Oe=Ee,W=ct(Oe,{query:N,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),Me=e===`issues`&&i!==void 0&&!M,Ne=N.trim()!==``||P.length>0||e===`issues`&&(I.length>0||z!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?z&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:I.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}).filter(e=>!Pe.has(e.number)):[],Le=D.github()[0],J=i===void 0?null:Number.parseInt(i,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!u?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...u.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=de(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!u)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(x,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(v.current=null,!u.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(h,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,Z.jsx)(T,{variant:`outline`,"data-action":`gh-retry`,disabled:y.isPending,onClick:()=>y.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=N.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...u.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=i===void 0?null:Number.parseInt(i,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;v.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,N.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),u.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:u.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,u.syncedAt?`Synced ${G(u.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>_(`issues`),children:[`Issues · `,kt(u.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>_(`prs`),children:[`Pull requests · `,kt(u.prs.length)]}),c?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:y.isPending,onClick:()=>y.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,y.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.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,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:N,onChange:e=>Ce(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,Z.jsx)(jt,{options:Je,colors:qe,selected:P,onChange:F}),e===`issues`?(0,Z.jsx)(ot,{data:{...u,issues:[...u.issues,...K?.items??[]]},assignees:I,projectId:z,onAssigneesChange:we,onProjectChange:R}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Te,children:`Clear filters`})]})]}),(0,Z.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,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${pe}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?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&i!==void 0&&W.length>2?(0,Z.jsx)(T,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":M,onClick:()=>he(e=>!e),children:M?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:pe,onWidthChange:ge})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:j(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,i===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:b.data?.workflows??[],skills:be,workflow:w,onWorkflowChange:E,selectedSkills:ne,onSkillsChange:k,engine:ae,onEngineChange:le,queuedRunId:xe.get($.url)??null,onQueued:(e,t)=>Se(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(O,{icon:e===`issues`?(0,Z.jsx)(r,{size:16}):(0,Z.jsx)(ue,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:i,compactHidden:o,queued:s,checks:c}){let u=e.kind===`issue`?r:ue,d=a(),f=()=>{d.prefetchQuery({queryKey:D.githubComments(e.kind,e.number),queryFn:({signal:t})=>l(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":o||void 0,children:(0,Z.jsxs)(Ae,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:j(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`,className:j(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:j(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),c?(0,Z.jsx)($t,{checks:c}):null,s?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(ge,{open:i,onOpenChange:a,children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:j(`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,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(M,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{placeholder:`Filter labels…`}),(0,Z.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(z,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{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,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(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 Nt({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,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.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,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.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,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,me(e.url)?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:j(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:j(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:j(t,`animate-spin text-warning`)}):(0,Z.jsx)(E,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:j(t,`text-soft-foreground`)})}function It({number:e}){let t=a(),n=c({queryKey:D.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ee({mutationFn:()=>f(e,{refresh:!0}),onSuccess:n=>t.setQueryData(D.githubMergeState(e),n),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,_=ee({mutationFn:()=>{if(!r||!g)throw Error(`No merge method is available.`);return u(e,{method:g,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),A(`Pull request #${e} merged`),t.invalidateQueries({queryKey:D.githubMergeState(e)}),t.invalidateQueries({queryKey:D.github({limit:Ct})}),t.invalidateQueries({queryKey:D.githubComments(`pr`,e)})},onError:n=>{A(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:D.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.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 v=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`,y=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(g&&(r.canMerge||r.canOverride&&p));return(0,Z.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,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(x,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:v}),(0,Z.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:y}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&me(e.url)?(0,Z.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,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(T,{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,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,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,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(T,{disabled:!C,onClick:()=>l(!0),children:g?Pt[g]:`Merge`})]}):null]})]}),(0,Z.jsx)(ye,{open:s,onOpenChange:l,children:(0,Z.jsxs)(xe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(be,{children:[(0,Z.jsxs)(Se,{children:[g?Pt[g]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.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,Z.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]})})]}),_.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(T,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(T,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?Pt[g]:`Merge`})]})]})})]})}function Lt({item:e}){let t=a(),n=le(e.number),[r,i]=(0,X.useState)(``),[o,c]=(0,X.useState)(null),l=n.data,u=l?.available?l.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],d=u.findIndex(e=>e.path===o);(0,X.useEffect)(()=>{u.length>0&&!u.some(e=>e.path===o)&&c(u[0].path)},[l?.available?l.headSha:``,r]);let f=async()=>{let n=l?.available?l.headSha:null,r=await s(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(c(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!l)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!l.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:l.reason});let p=u.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??``})),m=me(e.url)?`${e.url}/files`:null,h=u.find(e=>e.path===o);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[l.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,l.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,l.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:l.headSha,children:[`head `,l.headSha.slice(0,8)]}),(0,Z.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),l.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[l.reason??`This response is incomplete.`,` `,m?(0,Z.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.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,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>c(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:u.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:j(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(T,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<=0,onClick:()=>c(u[d-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(T,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<0||d>=u.length-1,onClick:()=>c(u[d+1]?.path??null),children:(0,Z.jsx)(S,{size:16})})]}),u.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:p.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=w(e.kind,e.number),r=n.data,i=(0,X.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(zt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(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 Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:j(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:j(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:j(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.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,Z.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 Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.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,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=j(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:j(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot as GithubRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,$t as i,Aa as a,Ca as o,Di as s,Ea as c,Ei as l,Fi as u,Lt as d,Oi as f,Rt as p,Sn as m,St as h,Ta as ee,Ti as g,U as _,Ut as v,X as y,Y as b,Yt as x,Z as S,Zt as C,bn as w,d as T,et as E,fr as te,gi as ne,hr as re,in as D,l as O,nt as k,qi as ie,sa as A,tn as ae,vn as oe,vr as se,wn as ce,xn as le,xt as ue,yn as de,za as fe}from"./alert-dialog-BOp2HnnL.js";import{d as pe,n as me,t as j}from"./utils-GZNjgma4.js";import{a as M,o as he,r as ge}from"./agent-accounts-BxBsIXGa.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as N}from"./textarea-DfvlPIgO.js";import{t as Ce}from"./createLucideIcon-BHp8sXmF.js";import{t as P}from"./external-link-BE6y205O.js";import{A as F,E as I,F as we,I as L,M as R,O as z,a as Te,c as B,d as Ee,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-BGGpAIzb.js";import{r as ke,t as Ae,u as je}from"./project-router-CvFAMDcP.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-Ir62-VMS.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-C4iEPAUV.js";import{t as We}from"./diff-BjLZHKfD2.js";import{t as Ge}from"./tab-link-CkIV8ixq.js";var Ke=Ce(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=Ce(`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`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`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(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qe(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(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 tt(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 nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(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 it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`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 ot({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,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(ge,{children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(M,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.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,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} 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,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(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 ct(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 lt(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 ut(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 dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(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 mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:o,onSkillsChange:s,engine:c,onEngineChange:l,queuedRunId:u,onQueued:d}){let f=a(),p=re(),m=e.kind===`pr`?`PR`:`issue`,h=o.filter(e=>n.some(t=>t.name===e)),[g]=(0,X.useState)(()=>$(e)),[_,v]=(0,X.useState)(()=>_t(e.url)||g),y=ze(c),x=(0,X.useRef)(null),S=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,_===g?``:_)},[e.url,_,g]);let C=(0,X.useMemo)(()=>Te(p.data?.promptTemplates),[p.data?.promptTemplates]),w=e=>{let t=x.current,n=W({prompt:_,base:g,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:S.current}),r=Oe(_,n,e);v(r.text),S.current=r.caret,requestAnimationFrame(()=>{x.current?.focus(),x.current?.setSelectionRange(r.caret,r.caret)})},E=H(C,h),te=(0,X.useRef)(_);te.current=_;let O=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(te.current,O.current,E,g);O.current=e.applied,e.text!==te.current&&v(e.text)},[E,g]);let k=ee({mutationFn:async()=>y.canRun?ne(it(e,r,h,_,Y(y))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&d(e.url,n.id),A(`Added to the queue — ${m} #${e.number}`),h.length>0&&p.data!==void 0&&ie({skillUsage:h.reduce((e,t)=>q(e,t),p.data.skillUsage)}).then(()=>f.invalidateQueries({queryKey:D.uiState})).catch(()=>{}),vt(e.url,``),v(g),O.current=``,f.invalidateQueries({queryKey:D.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),oe=e=>{Re({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(),!k.isPending&&y.canRun&&k.mutate())},se=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(N,{ref:x,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:_,onChange:e=>v(e.target.value),onSelect:e=>{S.current=e.currentTarget.selectionStart},onKeyDown:oe,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:C,onInsert:w}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:i})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:p.data?.skillUsage,selected:h,onToggle:se})]}),h.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>se(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,Z.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:c,onChange:l,disabled:k.isPending||!y.canRun,accounts:!0}),y.runners.length<=1&&!y.accounts.some(e=>e.provider===y.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),y.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:y,disabled:k.isPending||!y.canRun,onPick:e=>l({...c,account:e})})]}),!y.providerPending&&!y.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[y.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.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,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[me(e.url)?(0,Z.jsx)(T,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(T,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!y.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,m]}),(0,Z.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:J()}),u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${u}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=K(e,o);return(0,Z.jsxs)(ge,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:j(Ee,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:pe,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(B,{icon:(0,Z.jsx)(C,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=Le(e,o,t),h=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(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,Z.jsx)(`span`,{className:j(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ge,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:j(Ee,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(V,{children:m.map(e=>h(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:d.map(e=>h(e,Fe(e)))}):null,f.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(V,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.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,Z.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 Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:i}=o(),s=oe({limit:Ct}),c=ce().data?.capabilities?.automations===!0,u=s.data,f=a(),_=e=>{f.setQueryData(D.uiState,t=>({...t,githubView:e})),ie({githubView:e}).then(e=>f.setQueryData(D.uiState,e)).catch(e=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),f.invalidateQueries({queryKey:D.uiState})})},v=(0,X.useRef)(null),y=ee({mutationFn:()=>g({refresh:!0,limit:Ct}),onSuccess:t=>{f.setQueryData(D.github({limit:Ct}),t),f.invalidateQueries({queryKey:D.githubChecks(He)}),f.invalidateQueries({queryKey:D.githubSearch(e===`issues`?`issue`:`pr`,B)});let n=v.current;if(!n){f.removeQueries({queryKey:[`github`,`comments`]});return}let r=D.githubComments(n.kind,n.number);l(n.kind,n.number,{refresh:!0}).then(e=>f.setQueryData(r,e)).catch(()=>{}),f.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==fe(r)})},onError:e=>A(e.message,{tone:`danger`})}),b=se(),S=te(),C=re(),[w,E]=(0,X.useState)(()=>mt().workflow),[ne,k]=(0,X.useState)(()=>mt().skills),[ae,le]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[pe,me]=(0,X.useState)(Xe),[M,he]=(0,X.useState)(!1),ge=e=>{let t=Ye(e);me(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:w,skills:[...ne]})},[w,ne]);let _e=b.data?.workflows;(0,X.useEffect)(()=>{_e&&w!==null&&!_e.some(e=>e.name===w)&&E(null)},[_e,w]);let ve=S.data,ye=C.data?.skillUsage,be=(0,X.useMemo)(()=>Ie(ve??[],ye),[ve,ye]),[xe,Se]=(0,X.useState)(new Map),[N,Ce]=(0,X.useState)(``),[P,F]=(0,X.useState)([]),[I,we]=(0,X.useState)([]),[L,R]=(0,X.useState)(``),z=u?.projects?.some(e=>e.id===L)?L:``;(0,X.useEffect)(()=>{u&&L&&!z&&R(``)},[u,L,z]);let Te=()=>{Ce(``),F([]),we([]),R(``)},B=Dt(N,Tt),Ee=(0,X.useMemo)(()=>u?.available?e===`issues`?u.issues:u.prs:[],[u,e]),De=(0,X.useMemo)(()=>ct(Ee,{query:B,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),[Ee,B,P,e,I,z]),V=N.trim()===B.trim(),H=u?.available===!0&&V&&lt(B,De),U=m(e===`issues`?`issue`:`pr`,B,H),Oe=Ee,W=ct(Oe,{query:N,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),Me=e===`issues`&&i!==void 0&&!M,Ne=N.trim()!==``||P.length>0||e===`issues`&&(I.length>0||z!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?z&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:I.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}).filter(e=>!Pe.has(e.number)):[],Le=D.github()[0],J=i===void 0?null:Number.parseInt(i,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!u?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...u.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=de(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!u)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(x,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(v.current=null,!u.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(h,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,Z.jsx)(T,{variant:`outline`,"data-action":`gh-retry`,disabled:y.isPending,onClick:()=>y.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=N.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...u.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=i===void 0?null:Number.parseInt(i,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;v.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,N.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),u.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:u.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,u.syncedAt?`Synced ${G(u.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>_(`issues`),children:[`Issues · `,kt(u.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>_(`prs`),children:[`Pull requests · `,kt(u.prs.length)]}),c?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:y.isPending,onClick:()=>y.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,y.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.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,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:N,onChange:e=>Ce(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,Z.jsx)(jt,{options:Je,colors:qe,selected:P,onChange:F}),e===`issues`?(0,Z.jsx)(ot,{data:{...u,issues:[...u.issues,...K?.items??[]]},assignees:I,projectId:z,onAssigneesChange:we,onProjectChange:R}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Te,children:`Clear filters`})]})]}),(0,Z.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,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${pe}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?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&i!==void 0&&W.length>2?(0,Z.jsx)(T,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":M,onClick:()=>he(e=>!e),children:M?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:pe,onWidthChange:ge})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:j(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,i===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:b.data?.workflows??[],skills:be,workflow:w,onWorkflowChange:E,selectedSkills:ne,onSkillsChange:k,engine:ae,onEngineChange:le,queuedRunId:xe.get($.url)??null,onQueued:(e,t)=>Se(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(O,{icon:e===`issues`?(0,Z.jsx)(r,{size:16}):(0,Z.jsx)(ue,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:i,compactHidden:o,queued:s,checks:c}){let u=e.kind===`issue`?r:ue,d=a(),f=()=>{d.prefetchQuery({queryKey:D.githubComments(e.kind,e.number),queryFn:({signal:t})=>l(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":o||void 0,children:(0,Z.jsxs)(Ae,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:j(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`,className:j(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:j(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),c?(0,Z.jsx)($t,{checks:c}):null,s?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(ge,{open:i,onOpenChange:a,children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:j(`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,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(M,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{placeholder:`Filter labels…`}),(0,Z.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(z,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{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,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(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 Nt({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,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.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,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.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,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,me(e.url)?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:j(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:j(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:j(t,`animate-spin text-warning`)}):(0,Z.jsx)(E,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:j(t,`text-soft-foreground`)})}function It({number:e}){let t=a(),n=c({queryKey:D.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ee({mutationFn:()=>f(e,{refresh:!0}),onSuccess:n=>t.setQueryData(D.githubMergeState(e),n),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,_=ee({mutationFn:()=>{if(!r||!g)throw Error(`No merge method is available.`);return u(e,{method:g,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),A(`Pull request #${e} merged`),t.invalidateQueries({queryKey:D.githubMergeState(e)}),t.invalidateQueries({queryKey:D.github({limit:Ct})}),t.invalidateQueries({queryKey:D.githubComments(`pr`,e)})},onError:n=>{A(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:D.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.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 v=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`,y=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(g&&(r.canMerge||r.canOverride&&p));return(0,Z.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,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(x,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:v}),(0,Z.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:y}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&me(e.url)?(0,Z.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,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(T,{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,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,Z.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,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,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,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(T,{disabled:!C,onClick:()=>l(!0),children:g?Pt[g]:`Merge`})]}):null]})]}),(0,Z.jsx)(ye,{open:s,onOpenChange:l,children:(0,Z.jsxs)(xe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(be,{children:[(0,Z.jsxs)(Se,{children:[g?Pt[g]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.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,Z.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]})})]}),_.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(T,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(T,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?Pt[g]:`Merge`})]})]})})]})}function Lt({item:e}){let t=a(),n=le(e.number),[r,i]=(0,X.useState)(``),[o,c]=(0,X.useState)(null),l=n.data,u=l?.available?l.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],d=u.findIndex(e=>e.path===o);(0,X.useEffect)(()=>{u.length>0&&!u.some(e=>e.path===o)&&c(u[0].path)},[l?.available?l.headSha:``,r]);let f=async()=>{let n=l?.available?l.headSha:null,r=await s(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(c(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!l)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!l.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:l.reason});let p=u.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??``})),m=me(e.url)?`${e.url}/files`:null,h=u.find(e=>e.path===o);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[l.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,l.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,l.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:l.headSha,children:[`head `,l.headSha.slice(0,8)]}),(0,Z.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),l.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[l.reason??`This response is incomplete.`,` `,m?(0,Z.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.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,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>c(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:u.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:j(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(T,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<=0,onClick:()=>c(u[d-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(T,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<0||d>=u.length-1,onClick:()=>c(u[d+1]?.path??null),children:(0,Z.jsx)(S,{size:16})})]}),u.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:p.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=w(e.kind,e.number),r=n.data,i=(0,X.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(zt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(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 Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:j(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:j(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:j(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.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,Z.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 Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.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,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=j(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:j(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot as GithubRoute};