@wjarka/cezarion 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/contract/index.js +2 -1
  2. package/dist/contract/workspace.d.ts +14 -0
  3. package/dist/core/opencode-model-catalog.d.ts +5 -5
  4. package/dist/core/opencode-model-catalog.js +96 -34
  5. package/dist/core/opencode-model-catalog.js.map +1 -1
  6. package/dist/core/opencode-server-runner.js +37 -2
  7. package/dist/core/opencode-server-runner.js.map +1 -1
  8. package/dist/core/pi-model-catalog.d.ts +7 -0
  9. package/dist/core/pi-model-catalog.js +123 -26
  10. package/dist/core/pi-model-catalog.js.map +1 -1
  11. package/dist/core/pi-runner.js +12 -10
  12. package/dist/core/pi-runner.js.map +1 -1
  13. package/dist/core/pi-ui-mapper.d.ts +1 -0
  14. package/dist/core/pi-ui-mapper.js +68 -11
  15. package/dist/core/pi-ui-mapper.js.map +1 -1
  16. package/dist/core/runner-model-catalog.d.ts +2 -0
  17. package/dist/core/runner-model-catalog.js.map +1 -1
  18. package/dist/server/server.d.ts +1 -0
  19. package/dist/workflows/run.d.ts +3 -0
  20. package/dist/workflows/run.js +48 -21
  21. package/dist/workflows/run.js.map +1 -1
  22. package/package.json +3 -3
  23. package/scripts/mock-pi-rpc.mjs +49 -2
  24. package/web/dist/assets/{alert-dialog-g-GVThSw.js → alert-dialog-Bib2-aHJ.js} +1 -1
  25. package/web/dist/assets/arrow-down-DF9UfPoy.js +1 -0
  26. package/web/dist/assets/arrow-left-BVgebuvi.js +1 -0
  27. package/web/dist/assets/{centered-state-DdbE_pNl.js → centered-state-TyZe3tga.js} +1 -1
  28. package/web/dist/assets/chevron-right-W2B4c3Bn.js +1 -0
  29. package/web/dist/assets/{collapsible-R1r7zUOB.js → collapsible-DTRw1YnV.js} +1 -1
  30. package/web/dist/assets/{commit-list-Bgb1DHBX.js → commit-list-BKtzO28W.js} +1 -1
  31. package/web/dist/assets/{compare-variants-UA_0n_5a.js → compare-variants--E1SPJzi.js} +1 -1
  32. package/web/dist/assets/{diff-Cv3z9esx.js → diff-DtXK3tZy.js} +2 -2
  33. package/web/dist/assets/{diff-stat-ydfu0_5T.js → diff-stat-CJSJmLcb.js} +1 -1
  34. package/web/dist/assets/{diff-view-DnPdkmk2.js → diff-view-wZScCPoa.js} +1 -1
  35. package/web/dist/assets/{dropdown-menu-CPP9gEmn.js → dropdown-menu-CQp168wo.js} +1 -1
  36. package/web/dist/assets/editable-title-BWosq6YG.js +1 -0
  37. package/web/dist/assets/{ellipsis-vertical-WNkaehnw.js → ellipsis-vertical-BXllsyll.js} +1 -1
  38. package/web/dist/assets/{file-RvhJlchx.js → file-BgcgwEU-.js} +1 -1
  39. package/web/dist/assets/{folder-Dz-weqBo.js → folder-DGrkgLg9.js} +1 -1
  40. package/web/dist/assets/{git-toolbar-BEKuAjHk.js → git-toolbar-D9Wu2J60.js} +1 -1
  41. package/web/dist/assets/{github-CmFHDNje.js → github-xAF2VFFK.js} +1 -1
  42. package/web/dist/assets/{image-preview-DYiOSYoY.js → image-preview-Cd7b7Evu.js} +1 -1
  43. package/web/dist/assets/index-CKWqcYjr.js +7 -0
  44. package/web/dist/assets/{markdown-DQHRRO9e.js → markdown-Cvzv-jvo.js} +1 -1
  45. package/web/dist/assets/new-task-form-CZAdHx_5.js +1 -0
  46. package/web/dist/assets/{pill-FAFXjmY6.js → pill-B9vrSbT6.js} +1 -1
  47. package/web/dist/assets/{project-router-Dzc0JK2j.js → project-router-CF-1GU39.js} +1 -1
  48. package/web/dist/assets/{prompt-templates-DmqtzSPL.js → prompt-templates-CSmaXZ5G.js} +1 -1
  49. package/web/dist/assets/{refresh-cw-BP4TkA4M.js → refresh-cw-D5a-hkgq.js} +1 -1
  50. package/web/dist/assets/{repo-git-C20pc5tT.js → repo-git-BicCjDSy.js} +1 -1
  51. package/web/dist/assets/{run-diff-CvcsWwew.js → run-diff-DWzdGMTg.js} +1 -1
  52. package/web/dist/assets/run-header-Cc7KFOMX.js +1 -0
  53. package/web/dist/assets/{search-x-Drnmsmd0.js → search-x-DJIOs-nB.js} +1 -1
  54. package/web/dist/assets/{skill-empty-hint-D2l_OqZ5.js → skill-empty-hint-BcecPZ6K.js} +1 -1
  55. package/web/dist/assets/skills-BKYATWFF.js +1 -0
  56. package/web/dist/assets/{sparkles-B9ja4FHw.js → sparkles-C-1JzGqe.js} +1 -1
  57. package/web/dist/assets/{square-terminal-CB2du-YG.js → square-terminal-CnrkOecA.js} +1 -1
  58. package/web/dist/assets/{tab-link-C5FWJ66Y.js → tab-link-CQgzNUwP.js} +1 -1
  59. package/web/dist/assets/{task-changes-CuUmQArS.js → task-changes--AyxNXvn.js} +1 -1
  60. package/web/dist/assets/{task-commits-DgIWIhW9.js → task-commits-DlBBODPF.js} +1 -1
  61. package/web/dist/assets/{task-files-BeDXPyz5.js → task-files-DZ49FGVz.js} +1 -1
  62. package/web/dist/assets/task-thread-D10akRi2.js +9 -0
  63. package/web/dist/assets/{textarea-Sm6doUPO.js → textarea-BPMIukW0.js} +1 -1
  64. package/web/dist/assets/{thread-loading-DojNeADh.js → thread-loading-C9cWYGbd.js} +1 -1
  65. package/web/dist/assets/{trash-2-C_lGBXG2.js → trash-2-CwmIdbv2.js} +1 -1
  66. package/web/dist/assets/{triangle-alert-Brk_ldFl.js → triangle-alert-BU7Fnc0D.js} +1 -1
  67. package/web/dist/assets/{upload-Cxs1UROt.js → upload-B54t9i6X.js} +1 -1
  68. package/web/dist/assets/{use-desktop-Cmrz3npD.js → use-desktop-Co7z3Xov.js} +1 -1
  69. package/web/dist/assets/{use-submit-shortcut-DzeqN3GK.js → use-submit-shortcut-DfJM2Y1U.js} +1 -1
  70. package/web/dist/assets/{utils-Unt0mZvU.js → utils-BLZyueuK.js} +1 -1
  71. package/web/dist/assets/{workflows-D_GyBbup.js → workflows-CfC6b8y4.js} +1 -1
  72. package/web/dist/assets/{zoomable-image-ByySCppM.js → zoomable-image-BQMum6hd.js} +1 -1
  73. package/web/dist/index.html +22 -22
  74. package/web/dist/assets/arrow-down-BzmL0uj0.js +0 -1
  75. package/web/dist/assets/arrow-left-DtUM7GFU.js +0 -1
  76. package/web/dist/assets/chevron-right-DnLh0uM2.js +0 -1
  77. package/web/dist/assets/editable-title-D_bWdmY0.js +0 -1
  78. package/web/dist/assets/index-BQTfjxFm.js +0 -7
  79. package/web/dist/assets/new-task-form-D2KlpqYC.js +0 -1
  80. package/web/dist/assets/run-header-xFlbebSJ.js +0 -1
  81. package/web/dist/assets/skills-Cn2ppPow.js +0 -1
  82. package/web/dist/assets/task-thread-2nmi0vcz.js +0 -9
@@ -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{A as r,Br as i,Bt as a,Hr as o,J as s,Jn as c,K as l,Kn as u,Kr as d,Ln as f,Lt as p,M as m,Ur as h,Ut as g,Y as _,Yn as v,Z as ee,a as y,fr as te,i as b,k as x,q as S,qn as C,t as w,ti as T,tr as E}from"./centered-state-DdbE_pNl.js";import{n as D,r as O,t as k}from"./utils-Unt0mZvU.js";import{t as A}from"./arrow-left-DtUM7GFU.js";import{C as j,S as M,_ as N,b as P,g as F,m as I,w as ne,x as re,y as ie}from"./new-task-form-D2KlpqYC.js";import{t as L}from"./chevron-right-DnLh0uM2.js";import{b as R,x as ae,y as oe}from"./dropdown-menu-CPP9gEmn.js";import{C as se,S as ce,_ as z,a as le,g as B,h as V,n as H,o as ue,p as U,r as W,u as de,v as G,y as K}from"./prompt-templates-DmqtzSPL.js";import{t as fe}from"./refresh-cw-BP4TkA4M.js";import{t as q}from"./sparkles-B9ja4FHw.js";import{t as pe}from"./triangle-alert-Brk_ldFl.js";import{n as J,t as me}from"./textarea-Sm6doUPO.js";import{a as he,c as ge,l as _e,n as ve,o as ye,r as be,s as xe,t as Se}from"./use-submit-shortcut-DzeqN3GK.js";import{r as Ce,t as Y}from"./project-router-Dzc0JK2j.js";import{r as X,t as we}from"./markdown-DQHRRO9e.js";import{c as Te,d as Ee,f as De,i as Oe,s as ke,t as Ae,u as je}from"./skills-9oR_oHse.js";import{_ as Me,d as Ne,f as Pe,h as Fe,l as Ie,p as Le,s as Re,u as ze}from"./index-BQTfjxFm.js";import{t as Be}from"./diff-Cv3z9esx.js";import{t as Ve}from"./tab-link-C5FWJ66Y.js";var He=O(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),We=O(`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`}]]),Z=e(t(),1),Q=n();function Ge({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(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=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(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 Xe(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 Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(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 $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(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 tt(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))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(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 rt={workflow:null,skills:[]},it=`cez-followup-selection`;function at(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 ot(){try{let e=localStorage.getItem(it);return e?at(JSON.parse(e)):{...rt}}catch{return{...rt}}}function st(e){try{localStorage.setItem(it,JSON.stringify(e))}catch{}}var ct=`cez-followup-prompt:`;function lt(e){try{return localStorage.getItem(ct+e)??``}catch{return``}}function ut(e,t){try{t===``?localStorage.removeItem(ct+e):localStorage.setItem(ct+e,t)}catch{}}function dt({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:u,onEngineChange:p,queuedRunId:h,onQueued:g}){let _=d(),v=a(),ee=e.kind===`pr`?`PR`:`issue`,x=c.filter(e=>n.some(t=>t.name===e)),[S]=(0,Z.useState)(()=>Ke(e)),[C,w]=(0,Z.useState)(()=>lt(e.url)||S),T=Pe(u),E=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{ut(e.url,C===S?``:C)},[e.url,C,S]);let D=(0,Z.useMemo)(()=>le(v.data?.promptTemplates),[v.data?.promptTemplates]),O=e=>{let t=E.current,n=C===S?C.length:t?.selectionStart??C.length,r=W(C,n,e);w(r.text),requestAnimationFrame(()=>{E.current?.focus(),E.current?.setSelectionRange(r.caret,r.caret)})},k=H(D,x),A=(0,Z.useRef)(C);A.current=C;let j=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{let e=ue(A.current,j.current,k,S);j.current=e.applied,e.text!==A.current&&w(e.text)},[k,S]);let M=o({mutationFn:async()=>T.canRun?f($e(e,i,x,C,Ne(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&g(e.url,n.id),b(`Added to the queue — ${ee} #${e.number}`),x.length>0&&v.data!==void 0&&te({skillUsage:x.reduce((e,t)=>Ae(e,t),v.data.skillUsage)}).then(()=>_.invalidateQueries({queryKey:m.uiState})).catch(()=>{}),ut(e.url,``),w(S),j.current=``,_.invalidateQueries({queryKey:m.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),N=e=>{Se({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(),!M.isPending&&T.canRun&&M.mutate())},F=e=>l(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,Q.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(ft,{workflows:t,value:i,onChange:s}),(0,Q.jsx)(pt,{skills:n,skillUsage:v.data?.skillUsage,selected:x,onToggle:F}),(0,Q.jsx)(ze,{pick:u,onChange:p,disabled:M.isPending||!T.canRun,accounts:!0}),!T.providerPending&&!T.canRun?(0,Q.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Q.jsx)(Y,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,Q.jsx)(Ie,{templates:D,onInsert:O})]}),x.length>0?(0,Q.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:x.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>F(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Q.jsx)(J,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Q.jsx)(me,{ref:E,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:N,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsxs)(y,{variant:`contrast`,"data-action":`gh-run`,disabled:M.isPending||!T.canRun,onClick:()=>M.mutate(),children:[(0,Q.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,ee]}),(0,Q.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:ve()}),h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Q.jsx)(Y,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function ft({workflows:e,value:t,onChange:n}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=(0,Z.useRef)(null),l=Ee(e,o);return(0,Q.jsxs)(I,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:k(de,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Q.jsx)(Me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(F,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(U,{shouldFilter:!1,children:[(0,Q.jsx)(z,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Q.jsxs)(K,{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,Q.jsx)(V,{children:`Nothing matches.`}):null,(0,Q.jsx)(B,{children:l.map(e=>{let i=t===e.name;return(0,Q.jsxs)(G,{value:`workflow ${e.name}`,keywords:De(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(i?null:e.name),a(!1)},children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,i?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function pt({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d=(0,Z.useRef)(null),{mostUsed:f,project:p,global:m}=Te(je(e,s,t),t),h=(e,t)=>{let a=n.includes(e.name);return(0,Q.jsxs)(G,{value:`skill ${e.name} ${e.path}`,keywords:De(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,Q.jsx)(`span`,{className:k(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Re,{skill:l,onClose:()=>u(null)}),(0,Q.jsxs)(I,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:k(de,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(q,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(F,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(U,{shouldFilter:!1,children:[(0,Q.jsx)(z,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Q.jsxs)(K,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[f.length===0&&p.length===0&&m.length===0?(0,Q.jsx)(V,{children:`Nothing matches.`}):null,f.length>0?(0,Q.jsx)(B,{heading:`Most used`,children:f.map(e=>h(e,Oe(e)))}):null,p.length>0?(0,Q.jsx)(B,{heading:`Project skills`,children:p.map(e=>h(e,!0))}):null,m.length>0?(0,Q.jsx)(B,{heading:`Global`,children:m.map(e=>h(e,!1))}):null]})]})})]})]})}var $=1e3,mt=100;function ht(){return a().data?.githubView===`prs`?(0,Q.jsx)(Ce,{to:`/github/prs`,replace:!0}):(0,Q.jsx)(gt,{view:`issues`})}function gt({view:e,changes:t=!1}){let{n}=i(),r=l({limit:$}),s=ee().data?.capabilities?.automations===!0,c=r.data,f=n===void 0?null:Number.parseInt(n,10),h=(0,Z.useMemo)(()=>{if(!c?.available)return[];let t=new Set;e===`prs`&&f!==null&&Number.isInteger(f)&&t.add(f);for(let e of c.prs){if(t.size>=mt)break;t.add(e.number)}return[...t]},[c,e,f]),_=S(h,e===`prs`),v=_.data?.available?_.data.checks:void 0,x=d(),E=e=>{x.setQueryData(m.uiState,t=>({...t,githubView:e})),te({githubView:e}).then(e=>x.setQueryData(m.uiState,e)).catch(e=>{b(e instanceof Error?e.message:String(e),{tone:`danger`}),x.invalidateQueries({queryKey:m.uiState})})},D=(0,Z.useRef)(null),O=o({mutationFn:()=>u({refresh:!0,limit:$}),onSuccess:e=>{x.setQueryData(m.github({limit:$}),e),x.invalidateQueries({queryKey:m.githubChecks(h)});let t=D.current;if(!t){x.removeQueries({queryKey:[`github`,`comments`]});return}let n=m.githubComments(t.kind,t.number);C(t.kind,t.number,{refresh:!0}).then(e=>x.setQueryData(n,e)).catch(()=>{}),x.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==T(n)})},onError:e=>b(e.message,{tone:`danger`})}),A=g(),j=p(),N=a(),[P,F]=(0,Z.useState)(()=>ot().workflow),[I,ne]=(0,Z.useState)(()=>ot().skills),[re,ie]=(0,Z.useState)({runner:null,model:null,effort:null,account:null});(0,Z.useEffect)(()=>{st({workflow:P,skills:[...I]})},[P,I]);let L=A.data?.workflows;(0,Z.useEffect)(()=>{L&&P!==null&&!L.some(e=>e.name===P)&&F(null)},[L,P]);let R=j.data,ae=N.data?.skillUsage,se=(0,Z.useMemo)(()=>ke(R??[],ae),[R,ae]),[z,le]=(0,Z.useState)(new Map),[B,V]=(0,Z.useState)(``),[H,ue]=(0,Z.useState)([]);if(!c)return r.isError?(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(w,{icon:(0,Q.jsx)(pe,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:r.error.message})}):(0,Q.jsx)(Le,{});if(D.current=null,!c.available)return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(w,{icon:(0,Q.jsx)(Fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:c.reason??`unknown reason`,actions:(0,Q.jsx)(y,{variant:`outline`,"data-action":`gh-retry`,disabled:O.isPending,onClick:()=>O.mutate(),children:`Try again`}),children:(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let U=e===`issues`?c.issues:c.prs,W=c.labelColors??{},de=et(U),G=tt(U,{query:B,labels:H}),K=B.trim()!==``||H.length>0,q=n===void 0?null:Number.parseInt(n,10),J=q===null?G[0]??null:U.find(e=>e.number===q)??null;D.current=J?{kind:J.kind,number:J.number}:null;let me=e===`issues`?`/github`:`/github/prs`;return(0,Q.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Q.jsxs)(`section`,{"data-slot":`gh-list`,className:k(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n===void 0?`flex`:`hidden`),children:[(0,Q.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),c.repo?(0,Q.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:c.repo}):null,s?(0,Q.jsx)(Y,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:O.isPending,onClick:()=>O.mutate(),className:k(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!s&&`ml-auto`),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`,className:k(`size-[9px]`,O.isPending&&`motion-safe:animate-spin`)}),c.syncedAt?`synced ${X(c.syncedAt)} ago`:`refresh`]})]}),(0,Q.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Q.jsxs)(Ve,{to:`/github`,active:e===`issues`,onClick:()=>E(`issues`),children:[`Issues · `,_t(c.issues.length)]}),(0,Q.jsxs)(Ve,{to:`/github/prs`,active:e===`prs`,onClick:()=>E(`prs`),children:[`Pull requests · `,_t(c.prs.length)]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Q.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:B,onChange:e=>V(e.target.value),className:`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,Q.jsx)(yt,{options:de,colors:W,selected:H,onChange:ue})]})]}),G.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:K?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Q.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:G.map(t=>(0,Q.jsx)(vt,{item:t,view:e,colors:W,active:J?.url===t.url,queued:z.has(t.url),checks:t.kind===`pr`?v?.[t.number]??t.checks:t.checks},t.url))})]}),(0,Q.jsx)(`section`,{"data-slot":`gh-detail`,className:k(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n===void 0?`hidden md:flex`:`flex`),children:J?(0,Q.jsx)(xt,{item:J,listPath:me,colors:W,changes:t,checks:J.kind===`pr`?v?.[J.number]??J.checks:J.checks,children:(0,Q.jsx)(dt,{item:J,workflows:A.data?.workflows??[],skills:se,workflow:P,onWorkflowChange:F,selectedSkills:I,onSkillsChange:ne,engine:re,onEngineChange:ie,queuedRunId:z.get(J.url)??null,onQueued:(e,t)=>le(n=>new Map(n).set(e,t))},J.url)}):(0,Q.jsx)(w,{icon:e===`issues`?(0,Q.jsx)(M,{}):(0,Q.jsx)(oe,{}),tone:`neutral`,heading:`h2`,title:q===null?`Nothing selected`:`Not in the open list`,subtitle:q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${q} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function _t(e){return`${e}${e>=$?`+`:``}`}function vt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let o=e.kind===`issue`?M:oe,s=d(),c=()=>{s.prefetchQuery({queryKey:m.githubComments(e.kind,e.number),queryFn:({signal:t})=>C(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(Y,{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:c,onFocus:c,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:k(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:k(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Q.jsx)(`span`,{className:k(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),(0,Q.jsx)(zt,{count:e.comments}),a?(0,Q.jsx)(Vt,{checks:a}):null,i?(0,Q.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Q.jsx)(bt,{label:e,color:n[e]},e))}):null]})})}function yt({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Z.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Q.jsxs)(I,{open:a,onOpenChange:o,children:[(0,Q.jsx)(N,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`flex 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-primary/60 text-foreground`),children:[(0,Q.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Q.jsx)(F,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(z,{placeholder:`Filter labels…`}),(0,Q.jsxs)(K,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(V,{children:`No labels.`}),n.length>0?(0,Q.jsxs)(G,{value:`__clear__`,onSelect:()=>i([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let i=n.includes(e);return(0,Q.jsxs)(G,{value:e,onSelect:()=>s(e),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:nt(t[e])}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),i?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function bt({label:e,color:t}){return(0,Q.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:nt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function xt({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,Q.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Q.jsxs)(Y,{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,Q.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Q.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,Q.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Q.jsx)(`span`,{children:o}),`·`,(0,Q.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Q.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsx)(zt,{count:e.comments})]}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,D(e.url)?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Q.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Q.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,Q.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Q.jsx)(Ve,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Q.jsx)(Ve,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Q.jsx)(bt,{label:e,color:n[e]},e)),a?(0,Q.jsx)(Bt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Q.jsx)(Tt,{item:e}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Q.jsx)(we,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Q.jsx)(Et,{item:e,colors:n}),e.kind===`pr`?(0,Q.jsx)(wt,{number:e.number}):null,r]})]})}var St={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ct({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Q.jsx)(j,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:k(t,`text-success`)}):e===`failing`?(0,Q.jsx)(re,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:k(t,`text-danger`)}):e===`pending`?(0,Q.jsx)(x,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:k(t,`animate-spin text-warning`)}):(0,Q.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:k(t,`text-soft-foreground`)})}function wt({number:e}){let t=d(),n=h({queryKey:m.githubMergeState(e),queryFn:({signal:t})=>v(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(!1),p=o({mutationFn:()=>v(e,{refresh:!0}),onSuccess:n=>t.setQueryData(m.githubMergeState(e),n),onError:e=>b(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,_=o({mutationFn:()=>{if(!i||!g)throw Error(`No merge method is available.`);return E(e,{method:g,expectedHeadSha:i.headSha,...u&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),b(`Pull request #${e} merged`),t.invalidateQueries({queryKey:m.githubMergeState(e)}),t.invalidateQueries({queryKey:m.github({limit:$})}),t.invalidateQueries({queryKey:m.githubComments(`pr`,e)})},onError:n=>{b(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:m.githubMergeState(e)})}});if(n.isPending)return(0,Q.jsx)(Ge,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,Q.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let ee=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,te=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,x=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,S=!!(g&&(i.canMerge||i.canOverride&&u));return(0,Q.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Q.jsx)(pe,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:ee}),(0,Q.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`,className:k(`size-3.5`,p.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Q.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,Q.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:te}),(0,Q.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:x}),(0,Q.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,Q.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:e.state}),(0,Q.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,Q.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>f(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Q.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,i.state===`open`&&i.methods.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Q.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,Q.jsx)(`option`,{value:e,children:St[e]},e))}),(0,Q.jsx)(y,{disabled:!S,onClick:()=>l(!0),children:g?St[g]:`Merge`})]}):null]})]}),(0,Q.jsx)(be,{open:c,onOpenChange:l,children:(0,Q.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsxs)(_e,{children:[g?St[g]:`Merge`,` pull request #`,e,`?`]}),(0,Q.jsxs)(ye,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,u&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),_.error?(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Q.jsxs)(xe,{children:[(0,Q.jsx)(y,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Q.jsx)(y,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?St[g]:`Merge`})]})]})})]})}function Tt({item:e}){let t=d(),n=_(e.number),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),s=n.data,l=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===a);(0,Z.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===a)&&o(l[0].path)},[s?.available?s.headSha:``,r]);let f=async()=>{let n=s?.available?s.headSha:null,r=await c(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),b(`The reviewed revision changed.`))};if(n.isPending)return(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Q.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Q.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let p=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),m=D(e.url)?`${e.url}/files`:null,h=l.find(e=>e.path===a);return(0,Q.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Q.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,Q.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,Q.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),s.truncated?(0,Q.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,m?(0,Q.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Q.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Q.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,Q.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,Q.jsx)(`option`,{children:e.path},e.path))}),(0,Q.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:k(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Q.jsx)(y,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>o(l[u-1]?.path??null),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(y,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>o(l[u+1]?.path??null),children:(0,Q.jsx)(L,{})})]}),l.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Be,{files:p.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Q.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Et({item:e,colors:t}){let n=s(e.kind,e.number),r=n.data,i=(0,Z.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(Dt(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,Q.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.jsx)(Ge,{className:`mb-3 h-3 w-24`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(Ge,{className:`h-14 w-full`}),(0,Q.jsx)(Ge,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Q.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Q.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.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,Q.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ot(i).map(e=>e.group===`commits`?(0,Q.jsx)(kt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Q.jsx)(Ft,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Q.jsx)(jt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Dt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ot(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 kt({commits:e,colors:t}){let[n,r]=(0,Z.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Q.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,Q.jsx)(`span`,{"aria-hidden":`true`,children:At.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Q.jsx)(jt,{event:e,colors:t},e.id))]}):(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Q.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,Q.jsx)(`span`,{"aria-hidden":`true`,children:At.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var At={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function jt({event:e,colors:t}){return(0,Q.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:k(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:At[e.kind]}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Q.jsx)(Mt,{event:e,colors:t}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Mt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Q.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Q.jsx)(Nt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Q.jsx)(`span`,{"data-slot":`gh-event-label`,style:nt(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,Q.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Q.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Q.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Q.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Q.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Nt({checks:e}){return e?(0,Q.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:k(`shrink-0`,Rt[e]),children:Lt[e]}):null}var Pt={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 Ft({comment:e}){let t=e.reviewState?Pt[e.reviewState]:null;return(0,Q.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Q.jsx)(It,{url:e.avatarUrl,login:e.author}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),t?(0,Q.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:k(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Q.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Q.jsx)(we,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function It({url:e,login:t}){let[n,r]=(0,Z.useState)(!1);return e&&!n?(0,Q.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,Q.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 Lt={passing:`✓`,failing:`✗`,pending:`○`},Rt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function zt({count:e}){return e?(0,Q.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,Q.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Bt({checks:e,url:t}){let n=k(`text-[11px] font-medium`,Rt[e],t&&`hover:underline`),r=`${Lt[e]} checks ${e}`;return t?(0,Q.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Q.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Vt({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:k(`shrink-0 font-sans text-[11px] font-semibold`,Rt[e]),children:Lt[e]})}export{ht as GithubIndexRoute,gt 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{A as r,Br as i,Bt as a,Hr as o,J as s,Jn as c,K as l,Kn as u,Kr as d,Ln as f,Lt as p,M as m,Ur as h,Ut as g,Y as _,Yn as v,Z as y,a as b,fr as ee,i as x,k as S,q as C,qn as w,t as T,ti as E,tr as D}from"./centered-state-TyZe3tga.js";import{n as O,r as k,t as A}from"./utils-BLZyueuK.js";import{t as j}from"./arrow-left-BVgebuvi.js";import{C as M,S as N,T as te,_ as P,b as ne,h as F,v as I,w as re,x as ie}from"./new-task-form-CZAdHx_5.js";import{t as L}from"./chevron-right-W2B4c3Bn.js";import{b as R,x as ae,y as oe}from"./dropdown-menu-CQp168wo.js";import{C as se,S as ce,_ as z,a as le,g as B,h as V,n as H,o as ue,p as U,r as W,u as de,v as G,y as K}from"./prompt-templates-CSmaXZ5G.js";import{t as fe}from"./refresh-cw-D5a-hkgq.js";import{t as q}from"./sparkles-C-1JzGqe.js";import{t as pe}from"./triangle-alert-BU7Fnc0D.js";import{n as J,t as me}from"./textarea-BPMIukW0.js";import{a as he,c as ge,l as _e,n as ve,o as ye,r as be,s as xe,t as Se}from"./use-submit-shortcut-DfJM2Y1U.js";import{r as Ce,t as Y}from"./project-router-CF-1GU39.js";import{r as X,t as we}from"./markdown-Cvzv-jvo.js";import{c as Te,d as Ee,f as De,i as Oe,s as ke,t as Ae,u as je}from"./skills-9oR_oHse.js";import{_ as Me,d as Ne,f as Pe,h as Fe,l as Ie,p as Le,s as Re,u as ze}from"./index-CKWqcYjr.js";import{t as Be}from"./diff-DtXK3tZy.js";import{t as Ve}from"./tab-link-CQgzNUwP.js";var He=k(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=k(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),We=k(`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`}]]),Z=e(t(),1),Q=n();function Ge({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:A(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(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=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(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 Xe(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 Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(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 $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(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 tt(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))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(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 rt={workflow:null,skills:[]},it=`cez-followup-selection`;function at(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 ot(){try{let e=localStorage.getItem(it);return e?at(JSON.parse(e)):{...rt}}catch{return{...rt}}}function st(e){try{localStorage.setItem(it,JSON.stringify(e))}catch{}}var ct=`cez-followup-prompt:`;function lt(e){try{return localStorage.getItem(ct+e)??``}catch{return``}}function ut(e,t){try{t===``?localStorage.removeItem(ct+e):localStorage.setItem(ct+e,t)}catch{}}function dt({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:u,onEngineChange:p,queuedRunId:h,onQueued:g}){let _=d(),v=a(),y=e.kind===`pr`?`PR`:`issue`,S=c.filter(e=>n.some(t=>t.name===e)),[C]=(0,Z.useState)(()=>Ke(e)),[w,T]=(0,Z.useState)(()=>lt(e.url)||C),E=Pe(u),D=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{ut(e.url,w===C?``:w)},[e.url,w,C]);let O=(0,Z.useMemo)(()=>le(v.data?.promptTemplates),[v.data?.promptTemplates]),k=e=>{let t=D.current,n=w===C?w.length:t?.selectionStart??w.length,r=W(w,n,e);T(r.text),requestAnimationFrame(()=>{D.current?.focus(),D.current?.setSelectionRange(r.caret,r.caret)})},A=H(O,S),j=(0,Z.useRef)(w);j.current=w;let M=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{let e=ue(j.current,M.current,A,C);M.current=e.applied,e.text!==j.current&&T(e.text)},[A,C]);let N=o({mutationFn:async()=>E.canRun?f($e(e,i,S,w,Ne(E))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&g(e.url,n.id),x(`Added to the queue — ${y} #${e.number}`),S.length>0&&v.data!==void 0&&ee({skillUsage:S.reduce((e,t)=>Ae(e,t),v.data.skillUsage)}).then(()=>_.invalidateQueries({queryKey:m.uiState})).catch(()=>{}),ut(e.url,``),T(C),M.current=``,_.invalidateQueries({queryKey:m.runs.all})},onError:e=>x(e.message,{tone:`danger`})}),te=e=>{Se({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(),!N.isPending&&E.canRun&&N.mutate())},P=e=>l(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,Q.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Q.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(ft,{workflows:t,value:i,onChange:s}),(0,Q.jsx)(pt,{skills:n,skillUsage:v.data?.skillUsage,selected:S,onToggle:P}),(0,Q.jsx)(ze,{pick:u,onChange:p,disabled:N.isPending||!E.canRun,accounts:!0}),!E.providerPending&&!E.canRun?(0,Q.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[E.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Q.jsx)(Y,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,Q.jsx)(Ie,{templates:O,onInsert:k})]}),S.length>0?(0,Q.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:S.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>P(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Q.jsx)(J,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Q.jsx)(me,{ref:D,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:w,onChange:e=>T(e.target.value),onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsxs)(b,{variant:`contrast`,"data-action":`gh-run`,disabled:N.isPending||!E.canRun,onClick:()=>N.mutate(),children:[(0,Q.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Q.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:ve()}),h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Q.jsx)(Y,{to:`/tasks/${h}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function ft({workflows:e,value:t,onChange:n}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),c=(0,Z.useRef)(null),l=Ee(e,o);return(0,Q.jsxs)(F,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Q.jsx)(I,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:A(de,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Q.jsx)(Me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(P,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(U,{shouldFilter:!1,children:[(0,Q.jsx)(z,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Q.jsxs)(K,{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,Q.jsx)(V,{children:`Nothing matches.`}):null,(0,Q.jsx)(B,{children:l.map(e=>{let i=t===e.name;return(0,Q.jsxs)(G,{value:`workflow ${e.name}`,keywords:De(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(i?null:e.name),a(!1)},children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,i?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function pt({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(null),d=(0,Z.useRef)(null),{mostUsed:f,project:p,global:m}=Te(je(e,s,t),t),h=(e,t)=>{let a=n.includes(e.name);return(0,Q.jsxs)(G,{value:`skill ${e.name} ${e.path}`,keywords:De(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,Q.jsx)(`span`,{className:A(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Re,{skill:l,onClose:()=>u(null)}),(0,Q.jsxs)(F,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Q.jsx)(I,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:A(de,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(q,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Q.jsx)(te,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(P,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(U,{shouldFilter:!1,children:[(0,Q.jsx)(z,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Q.jsxs)(K,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[f.length===0&&p.length===0&&m.length===0?(0,Q.jsx)(V,{children:`Nothing matches.`}):null,f.length>0?(0,Q.jsx)(B,{heading:`Most used`,children:f.map(e=>h(e,Oe(e)))}):null,p.length>0?(0,Q.jsx)(B,{heading:`Project skills`,children:p.map(e=>h(e,!0))}):null,m.length>0?(0,Q.jsx)(B,{heading:`Global`,children:m.map(e=>h(e,!1))}):null]})]})})]})]})}var $=1e3,mt=100;function ht(){return a().data?.githubView===`prs`?(0,Q.jsx)(Ce,{to:`/github/prs`,replace:!0}):(0,Q.jsx)(gt,{view:`issues`})}function gt({view:e,changes:t=!1}){let{n}=i(),r=l({limit:$}),s=y().data?.capabilities?.automations===!0,c=r.data,f=n===void 0?null:Number.parseInt(n,10),h=(0,Z.useMemo)(()=>{if(!c?.available)return[];let t=new Set;e===`prs`&&f!==null&&Number.isInteger(f)&&t.add(f);for(let e of c.prs){if(t.size>=mt)break;t.add(e.number)}return[...t]},[c,e,f]),_=C(h,e===`prs`),v=_.data?.available?_.data.checks:void 0,S=d(),D=e=>{S.setQueryData(m.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>S.setQueryData(m.uiState,e)).catch(e=>{x(e instanceof Error?e.message:String(e),{tone:`danger`}),S.invalidateQueries({queryKey:m.uiState})})},O=(0,Z.useRef)(null),k=o({mutationFn:()=>u({refresh:!0,limit:$}),onSuccess:e=>{S.setQueryData(m.github({limit:$}),e),S.invalidateQueries({queryKey:m.githubChecks(h)});let t=O.current;if(!t){S.removeQueries({queryKey:[`github`,`comments`]});return}let n=m.githubComments(t.kind,t.number);w(t.kind,t.number,{refresh:!0}).then(e=>S.setQueryData(n,e)).catch(()=>{}),S.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==E(n)})},onError:e=>x(e.message,{tone:`danger`})}),j=g(),N=p(),te=a(),[P,ne]=(0,Z.useState)(()=>ot().workflow),[F,I]=(0,Z.useState)(()=>ot().skills),[re,ie]=(0,Z.useState)({runner:null,model:null,effort:null,account:null});(0,Z.useEffect)(()=>{st({workflow:P,skills:[...F]})},[P,F]);let L=j.data?.workflows;(0,Z.useEffect)(()=>{L&&P!==null&&!L.some(e=>e.name===P)&&ne(null)},[L,P]);let R=N.data,ae=te.data?.skillUsage,se=(0,Z.useMemo)(()=>ke(R??[],ae),[R,ae]),[z,le]=(0,Z.useState)(new Map),[B,V]=(0,Z.useState)(``),[H,ue]=(0,Z.useState)([]);if(!c)return r.isError?(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(T,{icon:(0,Q.jsx)(pe,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:r.error.message})}):(0,Q.jsx)(Le,{});if(O.current=null,!c.available)return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(T,{icon:(0,Q.jsx)(Fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:c.reason??`unknown reason`,actions:(0,Q.jsx)(b,{variant:`outline`,"data-action":`gh-retry`,disabled:k.isPending,onClick:()=>k.mutate(),children:`Try again`}),children:(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let U=e===`issues`?c.issues:c.prs,W=c.labelColors??{},de=et(U),G=tt(U,{query:B,labels:H}),K=B.trim()!==``||H.length>0,q=n===void 0?null:Number.parseInt(n,10),J=q===null?G[0]??null:U.find(e=>e.number===q)??null;O.current=J?{kind:J.kind,number:J.number}:null;let me=e===`issues`?`/github`:`/github/prs`;return(0,Q.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Q.jsxs)(`section`,{"data-slot":`gh-list`,className:A(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n===void 0?`flex`:`hidden`),children:[(0,Q.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),c.repo?(0,Q.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:c.repo}):null,s?(0,Q.jsx)(Y,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:k.isPending,onClick:()=>k.mutate(),className:A(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!s&&`ml-auto`),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`,className:A(`size-[9px]`,k.isPending&&`motion-safe:animate-spin`)}),c.syncedAt?`synced ${X(c.syncedAt)} ago`:`refresh`]})]}),(0,Q.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Q.jsxs)(Ve,{to:`/github`,active:e===`issues`,onClick:()=>D(`issues`),children:[`Issues · `,_t(c.issues.length)]}),(0,Q.jsxs)(Ve,{to:`/github/prs`,active:e===`prs`,onClick:()=>D(`prs`),children:[`Pull requests · `,_t(c.prs.length)]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(ce,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Q.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:B,onChange:e=>V(e.target.value),className:`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,Q.jsx)(yt,{options:de,colors:W,selected:H,onChange:ue})]})]}),G.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:K?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Q.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:G.map(t=>(0,Q.jsx)(vt,{item:t,view:e,colors:W,active:J?.url===t.url,queued:z.has(t.url),checks:t.kind===`pr`?v?.[t.number]??t.checks:t.checks},t.url))})]}),(0,Q.jsx)(`section`,{"data-slot":`gh-detail`,className:A(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n===void 0?`hidden md:flex`:`flex`),children:J?(0,Q.jsx)(xt,{item:J,listPath:me,colors:W,changes:t,checks:J.kind===`pr`?v?.[J.number]??J.checks:J.checks,children:(0,Q.jsx)(dt,{item:J,workflows:j.data?.workflows??[],skills:se,workflow:P,onWorkflowChange:ne,selectedSkills:F,onSkillsChange:I,engine:re,onEngineChange:ie,queuedRunId:z.get(J.url)??null,onQueued:(e,t)=>le(n=>new Map(n).set(e,t))},J.url)}):(0,Q.jsx)(T,{icon:e===`issues`?(0,Q.jsx)(M,{}):(0,Q.jsx)(oe,{}),tone:`neutral`,heading:`h2`,title:q===null?`Nothing selected`:`Not in the open list`,subtitle:q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${q} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function _t(e){return`${e}${e>=$?`+`:``}`}function vt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let o=e.kind===`issue`?M:oe,s=d(),c=()=>{s.prefetchQuery({queryKey:m.githubComments(e.kind,e.number),queryFn:({signal:t})=>w(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(Y,{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:c,onFocus:c,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:A(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(o,{"aria-hidden":`true`,className:A(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Q.jsx)(`span`,{className:A(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),(0,Q.jsx)(zt,{count:e.comments}),a?(0,Q.jsx)(Vt,{checks:a}):null,i?(0,Q.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Q.jsx)(bt,{label:e,color:n[e]},e))}):null]})})}function yt({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Z.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Q.jsxs)(F,{open:a,onOpenChange:o,children:[(0,Q.jsx)(I,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:A(`flex 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-primary/60 text-foreground`),children:[(0,Q.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Q.jsx)(P,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(z,{placeholder:`Filter labels…`}),(0,Q.jsxs)(K,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(V,{children:`No labels.`}),n.length>0?(0,Q.jsxs)(G,{value:`__clear__`,onSelect:()=>i([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let i=n.includes(e);return(0,Q.jsxs)(G,{value:e,onSelect:()=>s(e),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:nt(t[e])}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),i?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function bt({label:e,color:t}){return(0,Q.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:nt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function xt({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,Q.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Q.jsxs)(Y,{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,Q.jsx)(j,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Q.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,Q.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Q.jsx)(`span`,{children:o}),`·`,(0,Q.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Q.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsx)(zt,{count:e.comments})]}):null,s?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,O(e.url)?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Q.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Q.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,Q.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Q.jsx)(Ve,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Q.jsx)(Ve,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Q.jsx)(bt,{label:e,color:n[e]},e)),a?(0,Q.jsx)(Bt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Q.jsx)(Tt,{item:e}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Q.jsx)(we,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Q.jsx)(Et,{item:e,colors:n}),e.kind===`pr`?(0,Q.jsx)(wt,{number:e.number}):null,r]})]})}var St={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ct({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Q.jsx)(re,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:A(t,`text-success`)}):e===`failing`?(0,Q.jsx)(N,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:A(t,`text-danger`)}):e===`pending`?(0,Q.jsx)(S,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:A(t,`animate-spin text-warning`)}):(0,Q.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:A(t,`text-soft-foreground`)})}function wt({number:e}){let t=d(),n=h({queryKey:m.githubMergeState(e),queryFn:({signal:t})=>v(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(!1),p=o({mutationFn:()=>v(e,{refresh:!0}),onSuccess:n=>t.setQueryData(m.githubMergeState(e),n),onError:e=>x(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,_=o({mutationFn:()=>{if(!i||!g)throw Error(`No merge method is available.`);return D(e,{method:g,expectedHeadSha:i.headSha,...u&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),x(`Pull request #${e} merged`),t.invalidateQueries({queryKey:m.githubMergeState(e)}),t.invalidateQueries({queryKey:m.github({limit:$})}),t.invalidateQueries({queryKey:m.githubComments(`pr`,e)})},onError:n=>{x(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:m.githubMergeState(e)})}});if(n.isPending)return(0,Q.jsx)(Ge,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,Q.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Q.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 y=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,ee=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,S=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,C=!!(g&&(i.canMerge||i.canOverride&&u));return(0,Q.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,Q.jsx)(r,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Q.jsx)(pe,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:y}),(0,Q.jsxs)(b,{type:`button`,variant:`ghost`,size:`sm`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,Q.jsx)(fe,{"aria-hidden":`true`,className:A(`size-3.5`,p.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Q.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,Q.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:ee}),(0,Q.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Q.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:S}),(0,Q.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,Q.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Ct,{state:e.state}),(0,Q.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&O(e.url)?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,Q.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,Q.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,Q.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>f(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Q.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,i.state===`open`&&i.methods.length>0?(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Q.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,Q.jsx)(`option`,{value:e,children:St[e]},e))}),(0,Q.jsx)(b,{disabled:!C,onClick:()=>l(!0),children:g?St[g]:`Merge`})]}):null]})]}),(0,Q.jsx)(be,{open:c,onOpenChange:l,children:(0,Q.jsxs)(he,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsxs)(_e,{children:[g?St[g]:`Merge`,` pull request #`,e,`?`]}),(0,Q.jsxs)(ye,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,u&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),_.error?(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Q.jsxs)(xe,{children:[(0,Q.jsx)(b,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Q.jsx)(b,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?St[g]:`Merge`})]})]})})]})}function Tt({item:e}){let t=d(),n=_(e.number),[r,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(null),s=n.data,l=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===a);(0,Z.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===a)&&o(l[0].path)},[s?.available?s.headSha:``,r]);let f=async()=>{let n=s?.available?s.headSha:null,r=await c(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),x(`The reviewed revision changed.`))};if(n.isPending)return(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Q.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Q.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let p=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),m=O(e.url)?`${e.url}/files`:null,h=l.find(e=>e.path===a);return(0,Q.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Q.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,Q.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,Q.jsx)(b,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),s.truncated?(0,Q.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,m?(0,Q.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Q.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Q.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Q.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,Q.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,Q.jsx)(`option`,{children:e.path},e.path))}),(0,Q.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:A(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Q.jsx)(b,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>o(l[u-1]?.path??null),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(b,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>o(l[u+1]?.path??null),children:(0,Q.jsx)(L,{})})]}),l.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Be,{files:p.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Q.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Et({item:e,colors:t}){let n=s(e.kind,e.number),r=n.data,i=(0,Z.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(Dt(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,Q.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.jsx)(Ge,{className:`mb-3 h-3 w-24`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(Ge,{className:`h-14 w-full`}),(0,Q.jsx)(Ge,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Q.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Q.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.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,Q.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Ot(i).map(e=>e.group===`commits`?(0,Q.jsx)(kt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Q.jsx)(Ft,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Q.jsx)(jt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Dt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Ot(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 kt({commits:e,colors:t}){let[n,r]=(0,Z.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Q.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,Q.jsx)(`span`,{"aria-hidden":`true`,children:At.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Q.jsx)(jt,{event:e,colors:t},e.id))]}):(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Q.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,Q.jsx)(`span`,{"aria-hidden":`true`,children:At.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var At={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function jt({event:e,colors:t}){return(0,Q.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:A(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:At[e.kind]}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Q.jsx)(Mt,{event:e,colors:t}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Mt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Q.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Q.jsx)(Nt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Q.jsx)(`span`,{"data-slot":`gh-event-label`,style:nt(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,Q.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Q.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Q.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Q.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Q.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Nt({checks:e}){return e?(0,Q.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:A(`shrink-0`,Rt[e]),children:Lt[e]}):null}var Pt={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 Ft({comment:e}){let t=e.reviewState?Pt[e.reviewState]:null;return(0,Q.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Q.jsx)(It,{url:e.avatarUrl,login:e.author}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),t?(0,Q.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:A(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Q.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,Q.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Q.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Q.jsx)(we,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function It({url:e,login:t}){let[n,r]=(0,Z.useState)(!1);return e&&!n?(0,Q.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,Q.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 Lt={passing:`✓`,failing:`✗`,pending:`○`},Rt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function zt({count:e}){return e?(0,Q.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,Q.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Bt({checks:e,url:t}){let n=A(`text-[11px] font-medium`,Rt[e],t&&`hover:underline`),r=`${Lt[e]} checks ${e}`;return t?(0,Q.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Q.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Vt({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:A(`shrink-0 font-sans text-[11px] font-semibold`,Rt[e]),children:Lt[e]})}export{ht as GithubIndexRoute,gt as GithubRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./zoomable-image-ByySCppM.js";var n=e();function r(e){return e.image===!0&&(e.binary===!0||e.patch===``)}function i({file:e,imageSrc:r,onOpenInApp:i}){return e.status===`deleted`?(0,n.jsx)(a,{children:`Image deleted — only the new side can be previewed.`}):r?(0,n.jsxs)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:[(0,n.jsx)(t,{src:r(e.path),alt:e.path,className:`max-h-[60vh] max-w-full rounded-sm`}),i?(0,n.jsx)(`button`,{type:`button`,"data-slot":`diff-image-open`,onClick:()=>i(e.path),className:`text-[11px] font-medium text-soft-foreground hover:text-foreground hover:underline`,children:`Open in default app`}):null]}):(0,n.jsx)(a,{children:`Binary file — no text diff.`})}function a({children:e}){return(0,n.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}export{r as n,i as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./zoomable-image-BQMum6hd.js";var n=e();function r(e){return e.image===!0&&(e.binary===!0||e.patch===``)}function i({file:e,imageSrc:r,onOpenInApp:i}){return e.status===`deleted`?(0,n.jsx)(a,{children:`Image deleted — only the new side can be previewed.`}):r?(0,n.jsxs)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:[(0,n.jsx)(t,{src:r(e.path),alt:e.path,className:`max-h-[60vh] max-w-full rounded-sm`}),i?(0,n.jsx)(`button`,{type:`button`,"data-slot":`diff-image-open`,onClick:()=>i(e.path),className:`text-[11px] font-medium text-soft-foreground hover:text-foreground hover:underline`,children:`Open in default app`}):null]}):(0,n.jsx)(a,{children:`Binary file — no text diff.`})}function a({children:e}){return(0,n.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}export{r as n,i as t};