@hearsay-tools/squawk 0.19.0-dev.8901 → 0.19.0-nightly.20261129.95

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/delegation/routes.d.ts +65 -65
  2. package/dist/server/providers-routes.d.ts +57 -57
  3. package/dist/server/repo-routes.d.ts +34 -34
  4. package/dist/server/runner-install-routes.d.ts +10 -10
  5. package/dist/server/runs-routes.d.ts +303 -303
  6. package/dist/server/server.d.ts +58 -58
  7. package/dist/server/workspace-routes.d.ts +85 -85
  8. package/package.json +4 -4
  9. package/web/dist/assets/{accounts-section-DV18K14j.js → accounts-section-CL4_y1Ap.js} +1 -1
  10. package/web/dist/assets/{activity-motion-U0gkYTm-.js → activity-motion-1nxINCqs.js} +1 -1
  11. package/web/dist/assets/{activity-route-CKFb-IYI.js → activity-route-yCPzQHRl.js} +1 -1
  12. package/web/dist/assets/{agent-config-section-X66FRjsE.js → agent-config-section-CO-Bl7d7.js} +1 -1
  13. package/web/dist/assets/{agent-defaults-section-EEYiGk_Q.js → agent-defaults-section-C90pO0nt.js} +1 -1
  14. package/web/dist/assets/{appearance-D4I-ANZ_.js → appearance-dgwYTY63.js} +1 -1
  15. package/web/dist/assets/{archive-on-merge-field-D6y7pCov.js → archive-on-merge-field-DJZVhb_I.js} +1 -1
  16. package/web/dist/assets/{automations-route-4ahsnx6z.js → automations-route-BhSkU9kZ.js} +2 -2
  17. package/web/dist/assets/{command-ppU3xBNs.js → command-BMMjB5k9.js} +1 -1
  18. package/web/dist/assets/{commit-list-Dp0c_x8b.js → commit-list-mYh1t3BD.js} +1 -1
  19. package/web/dist/assets/{design-icons-CzEoMH9c.js → design-icons-BZt8Kqs9.js} +1 -1
  20. package/web/dist/assets/{dialog-DXCws12U.js → dialog-CB9ZhEk2.js} +1 -1
  21. package/web/dist/assets/{diff-n7BcLjSi.js → diff-B4l1BaZJ.js} +2 -2
  22. package/web/dist/assets/{diff-controls-7hWjGeWp.js → diff-controls-Bs58JOMz.js} +1 -1
  23. package/web/dist/assets/{diff-view-CJNrRCRI.js → diff-view-BGwOGavy.js} +1 -1
  24. package/web/dist/assets/{discard-changes-dialog-Bd3w4xOW.js → discard-changes-dialog-Cr1vlcjZ.js} +1 -1
  25. package/web/dist/assets/dropdown-menu-VFda6KAg.js +1 -0
  26. package/web/dist/assets/{file-preview-DS5j5uFi.js → file-preview-DqopZwES.js} +1 -1
  27. package/web/dist/assets/{git-toolbar-D5N_Ucqr.js → git-toolbar-pr68yTY4.js} +1 -1
  28. package/web/dist/assets/github-BY-X8L5Q.js +1 -0
  29. package/web/dist/assets/{global-activity-route-DqyHJiZz.js → global-activity-route-XkwjlnaD.js} +1 -1
  30. package/web/dist/assets/index-BOWGArJd.css +1 -0
  31. package/web/dist/assets/index-I4_drgNu.js +21 -0
  32. package/web/dist/assets/{markdown-9FIYg1nH.js → markdown-fuaT5ciN.js} +1 -1
  33. package/web/dist/assets/{open-in-menu-L5v_AQZt.js → open-in-menu-Uw-sJhbG.js} +1 -1
  34. package/web/dist/assets/{option-select-CYbw9rk4.js → option-select-_tHcMUWt.js} +1 -1
  35. package/web/dist/assets/{preferences-section-Do1nZwKg.js → preferences-section-Crh_5QfK.js} +1 -1
  36. package/web/dist/assets/{preview-pane-connected-o7nx7h4-.js → preview-pane-connected-CLWRxEhI.js} +1 -1
  37. package/web/dist/assets/{project-location-BFN7mvbZ.js → project-location-DmGO5Dqx.js} +1 -1
  38. package/web/dist/assets/{projects-section-Bq9DzRDF.js → projects-section-CLPN14JX.js} +1 -1
  39. package/web/dist/assets/{prompt-templates-section-CNa_K7AU.js → prompt-templates-section-CQHpVrcB.js} +2 -2
  40. package/web/dist/assets/{reference-chip-O8Bfl1Oi.js → reference-chip-Dk69XD7Q.js} +1 -1
  41. package/web/dist/assets/{remote-settings-notice-CbCCb3QA.js → remote-settings-notice-C8naX_yp.js} +1 -1
  42. package/web/dist/assets/{repo-git-Dz3fhj6j.js → repo-git-CTSdvalV.js} +1 -1
  43. package/web/dist/assets/{report-reader-BfsdCLq-.js → report-reader-DJJixZxy.js} +1 -1
  44. package/web/dist/assets/{report-selection-cuFCCxDW.js → report-selection-BH0M_8bk.js} +1 -1
  45. package/web/dist/assets/{reports-Df83TkE3.js → reports-DXfywo34.js} +1 -1
  46. package/web/dist/assets/{resources-section-CKJGgLWa.js → resources-section-CA-D1Vj2.js} +1 -1
  47. package/web/dist/assets/review-panel-UI6FQQmp.js +11 -0
  48. package/web/dist/assets/{run-header-BWNapiIC.js → run-header-DDQU9tCB.js} +2 -2
  49. package/web/dist/assets/select-QO8XlmjU.js +1 -0
  50. package/web/dist/assets/{session-context-section-CSDtUgJI.js → session-context-section-CTDQl-i5.js} +1 -1
  51. package/web/dist/assets/{settings-agent-picker-pMZcMiW4.js → settings-agent-picker-DE5zKJtS.js} +1 -1
  52. package/web/dist/assets/{settings-list-detail-Ch1KMPjr.js → settings-list-detail-DcRsGkGy.js} +1 -1
  53. package/web/dist/assets/{settings-save-bar-CFkofH5G.js → settings-save-bar-DM7T22Nr.js} +1 -1
  54. package/web/dist/assets/{settings-shell-B6-ofejE.js → settings-shell-EOUcgx1J.js} +1 -1
  55. package/web/dist/assets/{sidebar-section-DwcXrxn2.js → sidebar-section-C69ES3GL.js} +1 -1
  56. package/web/dist/assets/{skills-DD5hhynR.js → skills-DuaNQ6XW.js} +1 -1
  57. package/web/dist/assets/task-changes-midIkW0D.js +1 -0
  58. package/web/dist/assets/{task-commits-D8Pzk4b3.js → task-commits-DAT7-sIh.js} +1 -1
  59. package/web/dist/assets/{task-file-scope-DPJOeknI.js → task-file-scope-BYAH1Mj8.js} +1 -1
  60. package/web/dist/assets/{task-files-DJnNyynG.js → task-files-CJaZfp0y.js} +1 -1
  61. package/web/dist/assets/{task-github-item-Di9HWGn6.js → task-github-item-BnoxG2el.js} +1 -1
  62. package/web/dist/assets/task-thread-fsRo8vgf.js +2 -0
  63. package/web/dist/assets/{thread-state-B2dX4psn.js → thread-state-T5A2uz_q.js} +1 -1
  64. package/web/dist/assets/use-hand-to-agent-state-CqiCI37V.css +1 -0
  65. package/web/dist/assets/use-hand-to-agent-state-Cy6oaj7k.js +1 -0
  66. package/web/dist/assets/use-path-bases-x6weDx5i.js +1 -0
  67. package/web/dist/assets/workflows-CwZ1aiR4.js +7 -0
  68. package/web/dist/assets/{workspace-tools-6fvZHbrZ.js → workspace-tools-0-Yx7SCS.js} +1 -1
  69. package/web/dist/assets/{worktrees-section-C1fpzChO.js → worktrees-section-Cn8sFOCC.js} +1 -1
  70. package/web/dist/index.html +9 -9
  71. package/web/dist/assets/dropdown-menu-B60L-d_4.js +0 -1
  72. package/web/dist/assets/github-Bhj0PA8h.js +0 -1
  73. package/web/dist/assets/index-UMSYsh9P.css +0 -1
  74. package/web/dist/assets/index-i4Bu7SvU.js +0 -21
  75. package/web/dist/assets/review-panel-BaUd88ko.js +0 -11
  76. package/web/dist/assets/select-Cy2NunWj.js +0 -1
  77. package/web/dist/assets/task-changes-CbWxyOEd.js +0 -1
  78. package/web/dist/assets/task-thread-gXImKbGN.js +0 -2
  79. package/web/dist/assets/use-hand-to-agent-state-BHaqyTxa.css +0 -1
  80. package/web/dist/assets/use-hand-to-agent-state-DhUiLIQg.js +0 -1
  81. package/web/dist/assets/use-path-bases-BzlzA9bw.js +0 -1
  82. package/web/dist/assets/workflows-slzqyi2_.js +0 -7
@@ -1 +0,0 @@
1
- [data-route=github]{width:100%}[data-slot=gh-workspace][data-stacked=true]{height:auto}[data-slot=gh-workspace][data-stacked=true] [data-slot=gh-panes]{flex-direction:column;flex:none;overflow:visible}[data-slot=gh-workspace][data-stacked=true] :is([data-slot=gh-list],[data-slot=gh-detail]){flex:none;width:100%;overflow:visible}[data-slot=gh-workspace][data-stacked=true] [data-slot=gh-list-resize-handle]{display:none}[data-slot=gh-hand]{border-color:color-mix(in oklch, var(--accent-strong) 24%, var(--border));background:var(--background);border-radius:12px;flex-direction:column;gap:16px;padding:20px;display:flex}[data-slot=gh-hand]>h3{margin:0}.gh-handoff-settings{flex-direction:column;gap:16px;display:flex}.gh-field{flex-direction:column;gap:6px;min-width:0;display:flex}.gh-field>span{color:var(--muted-foreground);font-size:12px}.gh-field>button,.gh-field>select{border:1px solid var(--border);background:var(--card);width:100%;min-height:44px;color:var(--foreground);text-align:start;border-radius:8px;padding-block:0;padding-inline:12px;font-size:12px}.gh-field>button>svg:last-child{margin-inline-start:auto}[data-slot=gh-custom-prompt]{min-height:150px;margin-block-start:0;padding:16px;font-size:14px}[data-slot=gh-merge-box]{border-radius:12px;margin-block:22px;padding:24px}[data-slot=gh-merge-box] select{flex:none;min-height:44px}@media (width<=767px){[data-slot=gh-panes]{flex-direction:column;display:flex}[data-slot=gh-list]{width:100%}[data-slot=gh-hand],[data-slot=gh-merge-box]{padding:16px}}[data-slot=gh-hand]>[data-slot=prompt-template-trigger]{border-radius:8px;align-self:flex-start;min-height:44px;padding-block:0;padding-inline:12px}@media (width<=767px){[data-slot=gh-list][data-mobile-preview] [data-slot=gh-row-item][data-compact-hidden]{display:none}}[data-slot=gh-merge-box]>div>svg{display:none}[data-slot=gh-merge-box] h3{font-size:18px;font-weight:400}[data-slot=gh-merge-box] ul{margin-block-start:20px;font-size:13px}[data-slot=gh-merge-box] ul>li+li{margin-block-start:16px}[data-route=github] [data-slot=gh-tabs]{border-block-end:1px solid var(--border);flex-flow:wrap;gap:20px}[data-route=github] [data-slot=gh-tabs]>a{border:none;min-height:44px;color:var(--muted-foreground);background:0 0;border-block-end:2px solid #0000;border-radius:0;align-items:center;gap:6px;margin-block-end:-1px;padding-block:8px;padding-inline:0;font-size:13px;font-weight:500;display:inline-flex}[data-route=github] [data-slot=gh-tabs]>a[aria-current=page]{color:var(--foreground);border-color:var(--accent-text);font-weight:500}[data-slot=gh-merge-box]:not([data-eligibility=ready]) h3{color:var(--pending-strong)}[data-slot=gh-header]>div:first-child{row-gap:8px}[data-slot=gh-search]{border-radius:8px;padding-inline-start:34px;font-size:13px}[data-slot=gh-rows]{gap:0}[data-slot=gh-row-item][data-divided]{border-block-start:1px solid var(--border)}[data-slot=gh-row]{border-radius:8px;padding-block:14px;padding-inline:12px}[data-slot=gh-row][data-kind=issue]>span:first-child>svg{display:none}[data-slot=gh-row][data-kind=issue]>span{padding-inline-start:0}[data-slot=gh-row]>span:first-child>span{white-space:normal;font-weight:400}[data-slot=gh-row]>span:nth-child(2){font-family:inherit;font-size:12px}[data-slot=gh-detail-inner]{padding:24px}[data-slot=gh-hand]{border-color:color-mix(in oklch, var(--accent-strong) 24%, var(--border))}.gh-prompt-field{gap:8px}.gh-prompt-field [data-slot=gh-custom-prompt]{border:1px solid var(--border);background:var(--card);border-radius:8px;min-height:96px;padding:12px}.gh-field [data-slot=account-pill]{width:100%}@media (width<=767px){[data-slot=gh-detail-inner]{padding:16px}}[data-slot=gh-row][data-kind=issue]>span:first-child{color:var(--foreground)}[data-slot=gh-row-labels]{order:1}[data-slot=gh-row-labels]>span+span:before{content:"·";margin-inline-end:4px}[data-slot=gh-row]>span:nth-child(2){order:2}[data-slot=gh-merge-box][data-conflicting=true] h3{color:var(--conflict)}[data-slot=gh-bypass-warning]{color:var(--pending-strong)}@media (width<=767px){[data-route=github] [data-slot=gh-tabs]{gap:12px}[data-route=github] [data-slot=gh-filter-toolbar]>div:first-child{flex-basis:auto;width:100%}}@media (width>=768px){[data-route=github] [data-slot=gh-tabs]{gap:24px;min-height:0}[data-route=github] [data-slot=gh-tabs]>a{min-height:44px;padding-block:0;padding-inline:0}[data-route=github] [data-slot=gh-filter-toolbar]{gap:10px}[data-route=github] [data-slot=gh-filter-toolbar] :is(input,button){border-radius:7px;height:36px;min-height:36px;padding-block:0;font-size:12.5px}[data-route=github] [data-slot=gh-filter-toolbar] [data-slot=gh-search]{color:var(--foreground);padding-inline-start:32px}[data-route=github] [data-slot=gh-filter-toolbar] [data-slot=gh-assigned-me]{border-radius:999px}}[data-slot=engine-row-box]{width:100%;min-width:0;container:engine-row/inline-size}.engine-row{grid-template-columns:max-content minmax(0,1fr) max-content;gap:10px;display:grid}.engine-row>:is([data-slot$=pill],:has(>[data-slot$=pill])){min-width:0}.engine-row [data-slot$=pill]{border-color:var(--border);border-radius:9px;width:100%;min-width:0;min-height:44px}.engine-row [data-slot=model-pill]{justify-content:flex-start}.engine-row [data-slot$=pill]>svg:last-child{margin-inline-start:auto}@container engine-row (width>=550px){.engine-row:not(:has([data-slot=runner-pill])){grid-template-columns:minmax(0,1fr) max-content}}@container engine-row (width<=549.99px){.engine-row{grid-template-columns:max-content minmax(0,1fr)}.engine-row>:is([data-slot=model-pill],:has(>[data-slot=model-pill])){grid-area:2/1/auto/-1}.engine-row>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-area:1/2}.engine-row:not(:has([data-slot=runner-pill]))>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-column:1/-1}.engine-row :is([data-slot=runner-pill],[data-slot=effort-pill])>svg:first-child{display:none}}@media (width<=767px){.engine-row{grid-template-columns:max-content minmax(0,1fr)}.engine-row>:is([data-slot=model-pill],:has(>[data-slot=model-pill])){grid-area:2/1/auto/-1}.engine-row>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-area:1/2}.engine-row:not(:has([data-slot=runner-pill]))>:is([data-slot=effort-pill],:has(>[data-slot=effort-pill])){grid-column:1/-1}}
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r,s as i}from"./dist-C_rn70hE.js";import{A as a,Ct as o,Jt as s,Wt as c,_ as l,a as u,c as d,dn as f,f as p,k as m,rn as h,sn as g}from"./queries-CIeJg62Y.js";import{$ as _,I as v,J as y,Pr as b,Y as x,a as S,hi as C,ii as w,n as T,st as E}from"./toaster-D0HMoto5.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as ee,m as P,ot as F,r as I,tt as L,u as te,ut as R,y as ne}from"./design-icons-CzEoMH9c.js";import{t as z}from"./external-link-BE6y205O.js";import{t as re}from"./eye-B8okNWXU.js";import{t as ie}from"./loader-circle-CPBhhDbB.js";import{t as ae}from"./message-square-B-MD-8rD.js";import{t as oe}from"./play-CmVAj_fu.js";import{t as B}from"./button-C8jUIs8Q.js";import{i as se,r as ce,t as le}from"./popover-CvL6hQ5c.js";import{a as ue,i as de,o as fe,r as pe,s as me,t as he}from"./dialog-DXCws12U.js";import{t as V}from"./project-router-BHFXTx5l.js";import{a as ge,i as H,o as U,r as _e,s as ve,t as ye}from"./command-ppU3xBNs.js";import{d as be,f as W,i as xe,o as Se,p as Ce,s as we,t as Te,u as Ee}from"./skills-pM_PouEs.js";import{$ as De,Ct as G,F as Oe,Fn as ke,G as Ae,I as je,In as Me,J as Ne,K,L as Pe,M as Fe,N as Ie,P as Le,Pn as q,Q as Re,Qn as J,R as ze,W as Be,X as Ve,_n as He,at as Ue,bn as We,hr as Ge,it as Ke,nt as qe,ot as Je,q as Ye,tt as Xe}from"./index-i4Bu7SvU.js";import{t as Ze}from"./markdown-9FIYg1nH.js";import{t as Qe}from"./textarea-vEsJAUAV.js";import{t as $e}from"./diff-n7BcLjSi.js";import{t as Y}from"./change-counts-wqSYI3W8.js";import{t as et}from"./option-select-CYbw9rk4.js";import{t as tt}from"./tab-link-BYYXdpLn.js";var X=e(t(),1),Z=n(),nt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Q({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:r(t,`text-semantic-green`)}):e===`failing`?(0,Z.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:r(t,`text-semantic-red`)}):e===`pending`?(0,Z.jsx)(ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:r(t,`animate-spin text-semantic-amber motion-reduce:animate-none`)}):e===`review`?(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-review`,className:r(t,`text-semantic-info`)}):e===`conflict`?(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-conflict`,className:r(t,`text-semantic-conflict`)}):(0,Z.jsx)(P,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:r(t,`text-soft-foreground`)})}function rt(e){return e?.available?e.mergeState:null}function it(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function at(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function ot(e){return e===`approved`||e===`not-required`?`passing`:e===`review-required`?`review`:e===`unknown`?`unknown`:`failing`}function st(e){switch(e){case`approved`:return`Approved`;case`not-required`:return`Not required`;case`review-required`:return`Waiting for review`;case`changes-requested`:return`Changes requested`;case`unknown`:return`Unknown`}}function ct(e){return e===`mergeable`?`passing`:e===`conflicting`?`conflict`:`unknown`}function lt(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function ut(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function dt(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function ft(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function $(e){return e?nt[e]:`Merge`}function pt(e){return e===`conflicting`?`true`:void 0}function mt({check:e}){return(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Q,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,ut(e.required)]})]}),e.url&&i(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ht({reason:e}){return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function gt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:i,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=at(e),f=ot(e.reviewDecision),p=ct(e.mergeable);return(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-semantic-green`}):(0,Z.jsx)(F,{size:16,"aria-hidden":`true`,className:r(`mt-0.5 size-5 shrink-0`,e.mergeable===`conflicting`?`text-semantic-conflict`:`text-semantic-amber`)}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Z.jsx)(D,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-xs text-soft-foreground`,children:[e.headRef,` (`,Me(e.headSha),`) → `,e.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:f}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,st(e.reviewDecision)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Q,{state:p}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,lt(e.mergeable)]})]}),e.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Z.jsx)(mt,{check:e},e.name)),e.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Z.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Z.jsx)(et,{"aria-label":`Merge method`,value:t??``,onValueChange:e=>l(e),options:e.methods.map(e=>({value:e,label:nt[e]})),className:`w-full min-w-0 flex-1 bg-background sm:w-auto`}),(0,Z.jsx)(B,{disabled:!i,onClick:c,children:$(t)})]}):null]})]})}function _t({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Z.jsx)(he,{open:r,onOpenChange:s,children:(0,Z.jsxs)(pe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(fe,{children:[(0,Z.jsxs)(me,{children:[$(n),` pull request #`,e,`?`]}),(0,Z.jsx)(de,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-semantic-amber`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Z.jsxs)(ue,{children:[(0,Z.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Z.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:$(n)})]})]})})}function vt({number:e,onRunAgent:t}){let n=C(),r=p(),i=w({queryKey:c.githubMergeState(e),queryFn:({signal:t})=>x(e,{},{signal:t}),retry:!1}),a=rt(i.data),[o,s]=(0,X.useState)(null),[l,u]=(0,X.useState)(!1),[d,m]=(0,X.useState)(!1),h=f({mutationFn:t=>x(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>T(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=it(o,a),v=()=>({mergeState:c.githubMergeState(e),list:c.githubPages(50),comments:c.githubComments(`pr`,e),item:c.githubItem(`pr`,e),refStatus:r===void 0?void 0:c.githubRefStatusOf(r)}),y=f({mutationFn:t=>{if(!a||!g)throw Error(`No merge method is available.`);return _(e,{method:g,expectedHeadSha:a.headSha,...d&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{u(!1),T(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{T(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Z.jsx)(J,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":pt(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-card-edge bg-card p-4 shadow-card`,children:[(0,Z.jsx)(gt,{state:a,selectedMethod:g,overrideRules:d,mergeEnabled:ft(g,a,d),refreshPending:h.isPending,onRefresh:()=>h.mutate(c.githubMergeState(e)),onRunAgent:t,onConfirm:()=>u(!0),onMethodChange:s,onOverrideChange:m}),(0,Z.jsx)(_t,{number:e,state:a,selectedMethod:g,confirming:l,overrideRules:d,mergePending:y.isPending,mergeError:y.error,onOpenChange:u,onMerge:()=>y.mutate(v())})]}):(0,Z.jsx)(ht,{reason:dt(i.data)})}function yt(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 bt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function xt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function St(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))`}}function Ct({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:St(t),className:n?`text-xs font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function wt(e){return e===`pr`?`pull request`:`issue`}function Tt(e,t,n){return e===`pr`&&!!(t||n)}function Et({backLink:e}){return e?(0,Z.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}var Dt=r(`text-sm`,`[&_[data-streamdown="code-block"]]:relative [&_[data-streamdown="code-block"]]:my-2.5 [&_[data-streamdown="code-block"]]:gap-0 [&_[data-streamdown="code-block"]]:overflow-hidden [&_[data-streamdown="code-block"]]:rounded-lg [&_[data-streamdown="code-block"]]:border [&_[data-streamdown="code-block"]]:border-border [&_[data-streamdown="code-block"]]:bg-background [&_[data-streamdown="code-block"]]:p-0 [&_[data-streamdown="code-block"]]:![content-visibility:visible] [&_[data-streamdown="code-block"]]:![contain-intrinsic-size:auto]`,`[&_[data-streamdown="code-block-header"]]:h-7 [&_[data-streamdown="code-block-header"]]:border-b [&_[data-streamdown="code-block-header"]]:border-border [&_[data-streamdown="code-block-header"]]:bg-muted/40 [&_[data-streamdown="code-block-header"]]:px-3 [&_[data-streamdown="code-block-header"]]:text-xs`,`[&_[data-streamdown="code-block-header"][data-language=""]]:hidden [&_[data-streamdown="code-block-header"]:not([data-language])]:hidden [&_[data-streamdown="code-block-header"]:has(>span:empty)]:hidden`,`[&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:absolute [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:top-1 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:right-1.5 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:mt-0 [&_[data-streamdown="code-block"]>*:has([data-streamdown="code-block-actions"])]:h-auto`,`[&_[data-streamdown="code-block-actions"]]:border-0 [&_[data-streamdown="code-block-actions"]]:bg-transparent [&_[data-streamdown="code-block-actions"]]:p-0 [&_[data-streamdown="code-block-actions"]]:backdrop-blur-none`,`[&_[data-streamdown="image-fallback"]]:inline-flex [&_[data-streamdown="image-fallback"]]:rounded-md [&_[data-streamdown="image-fallback"]]:border [&_[data-streamdown="image-fallback"]]:border-dashed [&_[data-streamdown="image-fallback"]]:border-border [&_[data-streamdown="image-fallback"]]:bg-muted/40 [&_[data-streamdown="image-fallback"]]:px-3 [&_[data-streamdown="image-fallback"]]:py-2 [&_[data-streamdown="image-fallback"]]:not-italic [&_[data-streamdown="image-fallback"]]:after:content-["_—_open_on_GitHub_to_view"]`,`[&_[data-streamdown="code-block-body"]]:rounded-none [&_[data-streamdown="code-block-body"]]:border-0 [&_[data-streamdown="code-block-body"]]:bg-transparent [&_[data-streamdown="code-block-body"]]:px-3.5 [&_[data-streamdown="code-block-body"]]:py-2.5 [&_[data-streamdown="code-block-body"]]:pr-10`);function Ot(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString():e}function kt({item:e,kindWord:t,commentCount:n,hasDiffStat:r,additions:a,deletions:o}){return(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:t}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsx)(q,{iso:e.createdAt,title:Ot(e.createdAt)}),n?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(tn,{count:n})]}):null,r?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(`span`,{"data-slot":`gh-diffstat`,children:(0,Z.jsx)(Y,{adds:a??0,dels:o??0})})]}):null,`·`,i(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function At({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(tt,{to:G(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Z.jsx)(tt,{to:G(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Z.jsx)(V,{to:G(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function jt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Ct,{label:e,color:t[e]},e)),n?(0,Z.jsx)(nn,{checks:n,url:e.url}):null]}):null}function Mt({item:e,colors:t,body:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:r(`mt-5`,Dt),children:n?(0,Z.jsx)(Ze,{children:n}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no description)`})}),(0,Z.jsx)(It,{item:e,colors:t})]})}function Nt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,headerAction:c,children:l}){let d=a?.changes??!1,f=wt(e.kind),p=u(e.kind,e.number,!d).data?.detail,m=p?.body??e.body,h=p?.additions??e.additions,g=p?.deletions??e.deletions,_=Tt(e.kind,h,g),v=r??e.comments;return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsx)(Et,{backLink:i}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsx)(Pt,{action:c,className:`mb-4`,children:(0,Z.jsxs)(`h2`,{className:`min-w-0 text-[22px] leading-snug font-semibold tracking-tight`,children:[`#`,e.number,` `,e.title]})}):null,(0,Z.jsx)(Pt,{action:e.kind===`pr`?void 0:c,children:(0,Z.jsx)(kt,{item:e,kindWord:f,commentCount:v,hasDiffStat:_,additions:h,deletions:g})}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-semibold tracking-tight`,children:e.title}),s,(0,Z.jsx)(At,{item:e,subNav:a,changes:d}),(0,Z.jsx)(jt,{item:e,colors:t,checks:n}),d&&e.kind===`pr`?(0,Z.jsx)(Ft,{item:e}):(0,Z.jsx)(Mt,{item:e,colors:t,body:m})]}),e.kind===`pr`?(0,Z.jsx)(vt,{number:e.number,onRunAgent:o}):null,l]})}function Pt({action:e,className:t,children:n}){return e?(0,Z.jsxs)(`div`,{"data-slot":`gh-header-row`,className:r(`flex flex-wrap items-center gap-x-3 gap-y-2`,t),children:[(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:n}),(0,Z.jsx)(`div`,{"data-slot":`gh-header-action`,className:`flex shrink-0 items-center gap-2`,children:e})]}):t?(0,Z.jsx)(`div`,{className:t,children:n}):(0,Z.jsx)(Z.Fragment,{children:n})}function Ft({item:e}){let t=C(),n=d(e.number),[a,o]=(0,X.useState)(``),[s,l]=(0,X.useState)(null),u=n.data,f=e=>u?.available?u.files.filter(t=>t.path.toLowerCase().includes(e.toLowerCase())):[],p=f(a),m=p.some(e=>e.path===s)?s:p[0]?.path??null,h=p.findIndex(e=>e.path===m),g=e=>{o(e);let t=f(e),n=m??s,r=t.some(e=>e.path===n)?n:t[0]?.path??n;r!==s&&l(r)},_=async()=>{let n=u?.available?u.headSha:null,r=c.githubPrChanges(e.number),i=await y(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),T(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!u)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!u.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:u.reason});let v=p.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??``})),b=i(e.url)?`${e.url}/files`:null,x=p.find(e=>e.path===m);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[u.files.length,` changed files`]}),(0,Z.jsx)(Y,{adds:u.additions,dels:u.deletions}),(0,Z.jsx)(ke,{sha:u.headSha,variant:`inline`,prefix:`head `,className:`text-muted-foreground`}),(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void _(),children:`Refresh`})]}),u.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-pending-strong/40 bg-pending/10 p-3 text-xs`,children:[u.reason??`This response is incomplete.`,` `,b?(0,Z.jsx)(`a`,{href:b,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:a,onChange:e=>g(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsx)(et,{"aria-label":`Select changed file`,value:m??``,onValueChange:l,options:p.map(e=>({value:e.path,label:e.path})),className:`mt-2 w-full min-w-0 bg-background lg:hidden`,contentClassName:`max-w-[calc(100vw-2rem)]`}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:p.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:r(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,m===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsx)(Y,{adds:e.additions,dels:e.deletions})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<=0,onClick:()=>l(p[h-1]?.path??null),children:(0,Z.jsx)(Ge,{})}),(0,Z.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:h<0||h>=p.length-1,onClick:()=>l(p[h+1]?.path??null),children:(0,Z.jsx)(te,{size:16})})]}),p.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($e,{files:v.filter(e=>e.path===m),wrap:!0,className:`min-w-0`}),x&&!x.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,x.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function It({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Lt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(J,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(J,{className:`h-14 w-full`}),(0,Z.jsx)(J,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-muted-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Rt(i).map(e=>e.group===`commits`?(0,Z.jsx)(zt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(Xt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Vt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-muted-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Lt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Rt(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 zt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Vt,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Bt.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(q,{iso:e[e.length-1].createdAt,className:`shrink-0`})]})})}var Bt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Vt({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:r(`flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Bt[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(qt,{event:e,colors:t}),(0,Z.jsx)(q,{iso:e.createdAt,className:`shrink-0`}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ht({event:e}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(ke,{sha:e.sha,variant:`inline`,className:`shrink-0 text-xs text-muted-foreground`}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Jt,{checks:e.checks})]})}function Ut({event:e,colors:t}){return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:St(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function Wt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Gt({event:e}){return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Kt={committed:e=>(0,Z.jsx)(Ht,{event:e}),labeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),unlabeled:(e,t)=>(0,Z.jsx)(Ut,{event:e,colors:t}),assigned:e=>(0,Z.jsx)(Wt,{event:e}),unassigned:e=>(0,Z.jsx)(Wt,{event:e}),merged:()=>(0,Z.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Z.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Z.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Z.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Z.jsx)(Gt,{event:e})};function qt({event:e,colors:t}){return Kt[e.kind]?.(e,t)??null}function Jt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:r(`shrink-0`,$t[e]),children:Qt[e]}):null}var Yt={approved:{label:`Approved`,tone:`border-success/40 text-semantic-green`},changes_requested:{label:`Changes requested`,tone:`border-danger/40 text-semantic-red`},commented:{label:`Commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`Dismissed`,tone:`border-border text-muted-foreground`}};function Xt({comment:e}){let t=e.reviewState?Yt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Z.jsx)(Zt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(q,{iso:e.createdAt}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:r(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(z,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:Dt,children:e.body?(0,Z.jsx)(Ze,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-muted-foreground`,children:`(no body)`})})]})}function Zt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:20,height:20,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-5 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Qt={passing:`✓`,failing:`✗`,pending:`○`},$t={passing:`text-semantic-green`,failing:`text-semantic-red`,pending:`text-semantic-amber`},en={passing:`Checks passing`,failing:`Checks failing`,pending:`Checks pending`};function tn({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(ae,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function nn({checks:e,url:t}){let n=r(`text-xs font-medium`,$t[e],t&&`hover:underline`),i=`${Qt[e]} ${en[e]}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:i}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:i})}function rn({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:en[e],"aria-label":en[e],className:r(`shrink-0 font-sans text-xs font-semibold`,$t[e]),children:Qt[e]})}function an(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function on(e,t=[]){let n=an(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=sn(t)),n}function sn(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function cn(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 ln(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 un(e,t,n){let r=(n??``).trim();if(!r)return on(e,t);let i=an(e),a=r.startsWith(i)?i+cn(r.slice(i.length),e):cn(r,e),o=ln(a,e)?a:`${i}\n\n${a}`;return t.length?o+sn(t):o}function dn(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 fn(e,t,n,r,i={}){return t?{...i,workflow:t,task:un(e,n.map(e=>e.id),r)}:n.length?{...i,steps:dn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:un(e,[],r)}:{...i,workflow:`quick-task`,task:un(e,[],r)}}function pn(e){let t=o(),n=l(),r=h(),{runners:i,uninstalled:a,signedOut:s,accounts:c,repoAccount:u,accountFor:d}=We(),f=n.data?.defaultRunner,p=Pe(e.runner,i,f??i[0]??`claude`),m=n.data?.modelsLocked===!0,_=d(p,e.account),v=g(p,!0,_??u?.[p]),y=je(m?null:e.model,p,r.data,n.data?.defaultModels,v.data),b=Ie(y,v.data);return{runner:p,runnerExplicit:e.runner!==null,model:y,effort:m?``:Oe(e.effort,b),effortOptions:b,runners:i,uninstalled:a,signedOut:s,defaultRunner:f,canRun:t.isSuccess&&i.length>0,modelsLocked:m,providerPending:t.isPending,providerError:t.isError,accounts:c,account:_,repoAccount:u}}function mn(e){return{runner:ze(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function hn(e){return{...mn(e),...e.account?{agentProfile:e.account}:{}}}function gn(e,t){return e.find(e=>e.id===t)?.label??(t===``?`Runner default`:t)}function _n(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>He(t,e))}function vn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,X.useRef)(null),o=(0,X.useRef)(null),[s,c]=(0,X.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,X.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,X.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let u=pn(e),{runner:d,model:f,effort:p,effortOptions:m,runners:_,canRun:v,modelsLocked:y}=u,b=l(),x=h(),S=g(d,!0,u.account??u.repoAccount?.[d]),C=Le(d,x.data,S.data,[e.model,b.data?.defaultModels?.[d]]),w=n||!v,T=r?u.accounts:[],E=_n(u,T)?(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,uninstalled:u.uninstalled,signedOut:u.signedOut,value:d,accounts:T,account:r?u.account:null,repoAccount:r?u.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===d?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Z.jsx)(K,{icon:(0,Z.jsx)(ne,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:gn(C,f),value:f,disabled:w,readOnly:y===!0,disabledHint:y?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,S.data);t({...e,model:n,effort:e.effort===null?null:Oe(e.effort,r)})},options:C.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Fe(d,x.data,S)},`model`),O=(0,Z.jsx)(K,{icon:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===p)?.label??`Runner default`,value:p,disabled:w,readOnly:y===!0,disabledHint:y?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Z.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Z.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Z.jsx)(Ye,{fill:`model-pill`,children:s?[E,O,D]:[E,D,O]})})}):(0,Z.jsxs)(Ye,{children:[E,D,O]})}var yn={workflow:null,skills:[]},bn=`cez-followup-selection`;function xn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function Sn(){try{let e=localStorage.getItem(bn);return e?xn(JSON.parse(e)):{...yn}}catch{return{...yn}}}function Cn(e){try{localStorage.setItem(bn,JSON.stringify(e))}catch{}}var wn=`cez-followup-prompt:`;function Tn(e){try{return localStorage.getItem(wn+e)??``}catch{return``}}function En(e,t){try{t===``?localStorage.removeItem(wn+e):localStorage.setItem(wn+e,t)}catch{}}function Dn({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:l,engine:u,onEngineChange:d,queuedRunId:p,onQueued:h}){let g=C(),_=m(),y=e.kind===`pr`?`PR`:`issue`,b=pn(u),x=s(b.runner,b.account),S=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),w=S.length!==o.length,[D]=(0,X.useState)(()=>an(e)),[k,A]=(0,X.useState)(()=>Tn(e.url)||D),j=(0,X.useRef)(null),M=(0,X.useRef)(null);(0,X.useEffect)(()=>{En(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,X.useMemo)(()=>Ke(_.data?.promptTemplates),[_.data?.promptTemplates]),ee=e=>{let t=j.current,n=Je({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=qe(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},P=Xe(N,S.map(e=>e.id)),F=(0,X.useRef)(k);F.current=k;let I=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=Ue(F.current,I.current,P,D);I.current=e.applied,e.text!==F.current&&A(e.text)},[P,D]);let L=f({mutationFn:async()=>!b.canRun||w?null:E(fn(e,r,S,k,hn(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&h(e.url,n.id),T(`Added to the queue — ${y} #${e.number}`),S.length>0&&_.data!==void 0&&v({skillUsage:S.reduce((e,t)=>Te(e,t.id),_.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:c.uiState})).catch(()=>{}),En(e.url,``),A(D),I.current=``,g.invalidateQueries({queryKey:c.runs.all})},onError:e=>T(e.message,{tone:`danger`})}),te=e=>{Re({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!L.isPending&&b.canRun&&L.mutate())},R=e=>l(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,we(e)]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(Qe,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:te,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Ae,{templates:N,onInsert:ee}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(kn,{workflows:t,value:r,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(jn,{skills:n,skillUsage:_.data?.skillUsage,selected:o,onToggle:R})]}),o.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Z.jsx)(On,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>R(e)},W(e)))}):null,w?(0,Z.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Z.jsx)(vn,{layout:`row`,pick:u,onChange:d,disabled:L.isPending||!b.canRun,accounts:!0}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(An,{resolved:b,disabled:L.isPending||!b.canRun,onPick:e=>d({...u,account:e})})]}),!b.providerPending&&!b.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[i(e.url)?(0,Z.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:L.isPending||!b.canRun||w,onClick:()=>L.mutate(),children:[(0,Z.jsx)(oe,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-xs font-medium text-muted-foreground`,children:De()}),p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function On({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Z.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function kn({workflows:e,value:t,onChange:n}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=be(e,o);return(0,Z.jsxs)(le,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:r(Ve,t&&`border-foreground/60 font-mono text-xs font-semibold text-foreground`),children:[(0,Z.jsx)(R,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(ce,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ye,{shouldFilter:!1,children:[(0,Z.jsx)(ge,{placeholder:`Search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(ve,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Z.jsx)(_e,{children:`Nothing matches.`}):null,(0,Z.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(U,{value:`workflow ${e.name}`,keywords:Ce(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function An({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:b,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(K,{icon:(0,Z.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function jn({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(null),d=(0,X.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=Ee(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Z.jsxs)(U,{value:W(e),keywords:Ce(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>i(we(e)),children:[(0,Z.jsx)(`span`,{className:r(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Z.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Be,{skill:l,onClose:()=>u(null)}),(0,Z.jsxs)(le,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:r(Ve,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(ce,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(ye,{shouldFilter:!1,children:[(0,Z.jsx)(ge,{placeholder:`Search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Z.jsxs)(ve,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Z.jsx)(H,{children:(0,Z.jsxs)(U,{value:`typed-skill`,onSelect:()=>i({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Z.jsx)(_e,{children:`Nothing matches.`}):null,h?h.length>0?(0,Z.jsx)(H,{children:h.map(e=>g(e,xe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[f.length>0?(0,Z.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,xe(e)))}):null,p.length>0?(0,Z.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Z.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Mn=new WeakMap;function Nn(){let e=Sn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&Cn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function Pn(){let e=C(),{projectId:t}=S(),n=Mn.get(e);n||Mn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Nn());let{snapshot:i,subscribe:o,update:c}=r,l=(0,X.useSyncExternalStore)(o,i,i),u=a(),d=pn(l.engine),f=s(d.runner,d.account),p=m(),h=u.data?.workflows;(0,X.useEffect)(()=>{h&&l.workflow!==null&&!h.some(e=>e.name===l.workflow)&&c({workflow:null})},[c,h,l.workflow]);let g=(0,X.useMemo)(()=>Se(f.data??[],p.data?.skillUsage),[f.data,p.data?.skillUsage]);return{...l,workflows:u,skillList:g,skillsUnchecked:f.unchecked,setWorkflow:e=>c({workflow:e}),setSelectedSkills:e=>c({selectedSkills:e}),setEngine:e=>c({engine:e}),onQueued:(e,t)=>c({queued:new Map(i().queued).set(e,t)})}}export{tn as a,Rt as c,St as d,xt as f,rn as i,yt as l,Dn as n,Nt as o,on as r,Ct as s,Pn as t,bt as u};
@@ -1 +0,0 @@
1
- import{It as e}from"./queries-CIeJg62Y.js";import{n as t}from"./project-location-BFN7mvbZ.js";function n(){return{home:e().data?.homeDir??null,root:t()}}export{n as t};
@@ -1,7 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{o as r}from"./dist-C_rn70hE.js";import{A as i,Jt as a,Wt as o,dn as s,k as c}from"./queries-CIeJg62Y.js";import{A as l,Fn as u,hi as d,k as f,n as p,p as ee,u as te}from"./toaster-D0HMoto5.js";import{h as ne}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as m,L as h,S as g,X as _,at as re,b as ie,c as ae,ft as oe,i as v,lt as y,n as b,ot as se,st as ce,tt as le,v as ue}from"./design-icons-CzEoMH9c.js";import{t as x}from"./button-C8jUIs8Q.js";import{i as S,o as de,r as C,s as fe,t as w}from"./dialog-DXCws12U.js";import{i as pe,l as me,o as he}from"./skills-pM_PouEs.js";import{c as ge,f as _e,u as ve}from"./page-shell-Dky5crRl.js";import{t as ye}from"./centered-state-BgSV4e79.js";import{Gt as T,Jt as E,Kt as D,Wt as O,Xt as k,Yt as A,Zt as j,er as M,hn as N,qt as P,w as be}from"./index-i4Bu7SvU.js";import{_ as xe,a as Se,c as Ce,f as we,g as Te,h as Ee,i as F,m as I,n as De,o as Oe,p as L,r as R,t as z,u as ke}from"./sortable.esm-CAVTYaA3.js";import{t as B}from"./textarea-vEsJAUAV.js";import{t as Ae}from"./option-select-CYbw9rk4.js";import{t as je}from"./discard-changes-dialog-Bd3w4xOW.js";var V=e(t(),1);function H(e){let t=[];for(let n of e){if(n.kind===`plugin`||n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.timeoutMs!==void 0||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Me(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function Ne(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Pe(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Fe(e,t){return e.filter((e,n)=>n!==t)}function U(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function W(e,t,n){let r=` `.repeat(n);return t.includes(`
2
- `)?[`${r}${e}: |`,...t.split(`
3
- `).map(e=>`${r} ${e}`)]:[`${r}${e}: ${U(t)}`]}function G(e){let t=[];return e.name&&e.name!==e.id&&t.push(` name: ${U(e.name)}`),e.skill&&t.push(` skill: ${U(e.skill)}`),t}function Ie(e){let t=[];return e.model&&t.push(` model: ${U(e.model)}`),e.timeoutMs!==void 0&&t.push(` timeoutMs: ${e.timeoutMs}`),e.effort!==void 0&&t.push(` effort: ${U(e.effort)}`),e.runner&&t.push(` runner: ${U(e.runner)}`),e.agentProfile&&t.push(` agentProfile: ${U(e.agentProfile)}`),t}function Le(e){let t=[];return e.allowedTools&&t.push(` allowedTools: [${e.allowedTools.map(U).join(`, `)}]`),e.bashAllowlist&&t.push(` bashAllowlist: [${e.bashAllowlist.map(U).join(`, `)}]`),t}function K(e){return e.onFail?[` onFail:`,` retry: ${U(e.onFail.retry)}`,` max: ${e.onFail.max??2}`]:[]}function q(e){return[` - id: ${U(e.id)}`,...G(e),...e.prompt?W(`prompt`,e.prompt,4):[],...e.kind===`plugin`?[` kind: plugin`,` pluginKind: ${U(e.pluginKind)}`,...e.config===void 0?[]:[` config: ${JSON.stringify(e.config)}`]]:[],...Ie(e),...Le(e),...e.command?W(`command`,e.command,4):[],...K(e)]}function Re(e,t,n){let r=[`name: ${U(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...W(`description`,t.trim(),0));let i=H(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${U(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(...q(e))}else r.push(`skills: []`);return`${r.join(`
4
- `)}\n`}function ze(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`chain`}function Be(e){let t=H(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function Ve(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function He(e,t,n){let r=H(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var J=n();function Ue({workflows:e,draft:t,trimmedName:n,nameRef:r,onDraft:i,onLoadWorkflow:a,renamedFrom:o}){return(0,J.jsxs)(`section`,{"data-slot":`wb-metadata`,"data-reports-dirty":``,className:`grid min-w-0 grid-cols-1 gap-3 @xl:grid-cols-2 @4xl:grid-cols-[minmax(180px,240px)_minmax(200px,280px)_minmax(0,1fr)] @xl:items-start`,children:[(0,J.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs font-medium text-foreground`,children:`Load an existing workflow`}),(0,J.jsx)(Ae,{id:`workflow-load`,"data-slot":`wb-load-picker`,value:e.some(e=>e.name===n)?n:``,placeholder:`Choose a workflow`,onValueChange:t=>{let n=e.find(e=>e.name===t);n&&a(n)},options:e.map(e=>({value:e.name,label:e.name})),className:`w-full min-w-0 rounded-lg border-border bg-card px-3.5 text-xs font-medium text-foreground md:data-[size=default]:h-10`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-medium text-foreground`,children:`Workflow name`}),(0,J.jsx)(M,{id:`workflow-name`,ref:r,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:t.name,"aria-describedby":o===void 0?void 0:`workflow-rename-note`,onChange:e=>i({...t,name:e.target.value}),className:`h-10 bg-card text-sm max-md:h-11`}),(0,J.jsx)(`p`,{id:`workflow-rename-note`,"aria-live":`polite`,className:`text-xs text-muted-foreground empty:hidden`,children:o===void 0?null:(0,J.jsxs)(`span`,{"data-slot":`wb-rename-note`,children:[`Saving creates a new workflow “`,n,`”. “`,o,`” stays as it is.`]})})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5 @xl:col-span-2 @4xl:col-span-1`,children:[(0,J.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-medium text-foreground`,children:`Description`}),(0,J.jsx)(B,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,rows:1,value:t.description,onChange:e=>i({...t,description:e.target.value}),className:`min-h-10 bg-card px-3 py-2 text-sm max-md:min-h-11`})]})]})}function We({savedFile:e,autoOpen:t,onImportToggle:n,onExport:r,onAutoToggle:i,onDeleteRequest:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:n,children:[(0,J.jsx)(ce,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:r,children:[(0,J.jsx)(ie,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":t,"aria-describedby":`wb-auto-hint`,title:`Auto-build: describe the chain in words and an agent drafts its steps for you to review`,onClick:i,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),`Auto-build`]}),(0,J.jsx)(`span`,{id:`wb-auto-hint`,className:`sr-only`,children:`Describe the chain in words and an agent drafts its steps for you to review.`}),e?(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`relative text-danger hover:text-danger sm:ms-3 sm:before:absolute sm:before:-start-[13px] sm:before:top-1/2 sm:before:h-5 sm:before:w-px sm:before:-translate-y-1/2 sm:before:bg-border sm:before:content-['']`,title:`Delete the saved workflow file`,onClick:a,children:[(0,J.jsx)(re,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]})}function Ge({text:e,onTextChange:t,pending:n,onRun:r,onCancel:i}){return(0,J.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,J.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,J.jsx)(B,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),r())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsxs)(x,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:n||e.trim()===``,onClick:r,children:[(0,J.jsx)(y,{"aria-hidden":`true`,className:`size-3`}),n?`Building…`:`Build chain`]}),(0,J.jsxs)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:i,children:[(0,J.jsx)(oe,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]})}function Ke({open:e,onOpenChange:t,text:n,onTextChange:r,error:i,pending:a,onRun:o,onCancel:s}){return(0,J.jsx)(w,{open:e,onOpenChange:t,children:(0,J.jsxs)(C,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,J.jsx)(fe,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,J.jsx)(S,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,J.jsx)(B,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
5
- skills:
6
- - test-conventions
7
- - commit-style`,value:n,onChange:e=>r(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,J.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),i===``?null:(0,J.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:i}),(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,J.jsx)(x,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:a,onClick:o,children:`Import`}),(0,J.jsx)(x,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:s,children:`Cancel`})]})]})})}function qe({paletteSkills:e,query:t,onQueryChange:n,error:r,inFlow:i,onAdd:a,yaml:o}){return(0,J.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsx)(`h2`,{className:`text-[16px] font-semibold`,children:`Available skills`}),(0,J.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,J.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(M,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:t,onChange:e=>n(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,J.jsx)(it,{skills:e,query:t,error:r,inFlow:i,onAdd:a}),(0,J.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,J.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,J.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,J.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(g,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsx)(ot,{yaml:o})}),(0,J.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-xs leading-relaxed whitespace-pre text-muted-foreground`,children:o})]})]})}function Y({dragging:e,steps:t,skills:n}){return e?.type===`palette`?(0,J.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,J.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),e.skill]}):e?.type===`step`?(0,J.jsx)(rt,{step:e.step,index:t.findIndex(t=>t.id===e.step.id),skills:n,overlay:!0}):null}function Je({open:e,onOpenChange:t,query:n,onQueryChange:r,matches:i,skillsCount:a,error:o,selectedSkill:s,onSelectSkill:c,stepsCount:l,onCloseAutoFocus:u,onCancel:d,onAdd:f}){return(0,J.jsx)(w,{open:e,onOpenChange:t,children:(0,J.jsxs)(C,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:u,className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,J.jsxs)(de,{children:[(0,J.jsx)(fe,{className:`text-xl font-normal`,children:`Add step`}),(0,J.jsx)(S,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,J.jsx)(M,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:n,onChange:e=>r(e.target.value)}),o===null?(0,J.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[i.map(e=>(0,J.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,J.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.id,checked:s===e.id,onChange:()=>c(e.id)}),(0,J.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,J.jsx)(`span`,{className:`block`,children:e.name}),(0,J.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description}),e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs`,children:e.path}):null]})]},JSON.stringify([e.id,e.path]))),i.length===0?(0,J.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a===0?`No skills available in this project.`:`No matching skills.`}):null]}):(0,J.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,o]}),n.trim()&&!i.some(e=>e.id===n.trim())?(0,J.jsxs)(x,{onClick:()=>c(n.trim()),children:[`Use skill id “`,n.trim(),`” (unchecked)`]}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,J.jsx)(x,{variant:`outline`,onClick:d,children:`Cancel`}),(0,J.jsx)(x,{variant:`primary`,disabled:!s||l>=8,onClick:()=>{s&&f(s)},children:`Add selected skill`})]}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),l>=8?(0,J.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})})}function Ye({trimmedName:e,savedFile:t,overwriteOpen:n,onOverwriteDismiss:r,deleteOpen:i,onDeleteDismiss:a,onOverwrite:o,onDelete:s}){return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(O,{open:n,onOpenChange:e=>!e&&r(),children:(0,J.jsxs)(P,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsxs)(j,{children:[`“`,e,`” already exists`]}),(0,J.jsx)(E,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(D,{children:`Keep the file`}),(0,J.jsx)(T,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:o,children:`Overwrite`})]})]})}),(0,J.jsx)(O,{open:i,onOpenChange:e=>!e&&a(),children:(0,J.jsxs)(P,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,J.jsxs)(k,{children:[(0,J.jsxs)(j,{children:[`Delete workflow “`,e,`”?`]}),(0,J.jsxs)(E,{children:[`Removes `,t?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,J.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,J.jsxs)(A,{children:[(0,J.jsx)(D,{children:`Keep the file`}),(0,J.jsx)(T,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:s,children:`Delete workflow`})]})]})})]})}function X(e){return e.name??e.skill??e.id}function Z(e){return e.skill&&e.name&&e.name!==e.skill?e.skill:void 0}function Q(e){return e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim()}function Xe(e){let t=e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``;return`$ ${e.command}${t}`}function Ze(e,t){return Q(e)||t?.description||`Not listed by this runner and account. Step open will check the skill id.`}function Qe(e,t){return e.command?Xe(e):e.skill?Ze(e,t):e.prompt??``}function $e(e,t){return e.skill&&!t?`unknown`:null}function et(e){return e.command?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}function tt({index:e,title:t,badge:n,onRemove:i,gripProps:a}){return(0,J.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,J.jsxs)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${e+1}: ${t}`,className:`group/grip inline-flex h-[26px] shrink-0 cursor-grab items-center justify-center gap-0.5 rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 active:cursor-grabbing`,...a,children:[(0,J.jsx)(h,{"aria-hidden":`true`,className:`size-4 opacity-70 transition-opacity group-hover/grip:opacity-100`}),(0,J.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[12px] text-link-foreground`,children:String(e+1).padStart(2,`0`)})]}),(0,J.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:t}),n?(0,J.jsx)(`span`,{"data-slot":`wb-step-badge`,className:r(`shrink-0 rounded-full border px-2 py-px font-mono text-xs`,n===`unknown`&&`border-danger/35 text-danger`),children:n}):null,i?(0,J.jsxs)(x,{"data-slot":`wb-step-remove`,variant:`ghost`,size:`sm`,className:`shrink-0`,"aria-label":`Remove step ${e+1}: ${t}`,onClick:i,children:[(0,J.jsx)(re,{"aria-hidden":`true`}),` Remove`]}):null]})}function nt({index:e,onMoveUp:t,onMoveDown:n}){return(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,J.jsxs)(x,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} up`,disabled:!t,onClick:t,children:[(0,J.jsx)(v,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,J.jsxs)(x,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${e+1} down`,disabled:!n,onClick:n,children:[(0,J.jsx)(b,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})}function rt({step:e,index:t,skills:n,onRemove:i,gripProps:a,onMoveUp:o,onMoveDown:s,overlay:c=!1}){let l=n.find(t=>t.id===e.skill),u=X(e),d=Qe(e,l),f=$e(e,l);return(0,J.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:r(`rounded-lg border border-border bg-background p-4`,c&&`shadow-md`),children:[(0,J.jsx)(tt,{index:t,title:u,badge:f,onRemove:i,gripProps:a}),d?(0,J.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-1.5 break-words text-xs leading-relaxed text-muted-foreground`,children:d}):null,(0,J.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-1.5 text-xs text-link-foreground`,children:et(e)}),Z(e)?(0,J.jsx)(`p`,{"data-slot":`wb-step-skill`,className:`mt-1 font-mono text-xs text-muted-foreground`,children:Z(e)}):null,c?null:(0,J.jsx)(nt,{index:t,onMoveUp:o,onMoveDown:s})]})}function it({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,J.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=me(e,t);return(0,J.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,J.jsx)(at,{skill:e,inFlow:r.has(e.id),onAdd:i},JSON.stringify([e.id,e.path]))):(0,J.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:`This runner reports no skills.`})})}function at({skill:e,inFlow:t,onAdd:n}){let{listeners:i,setNodeRef:a,isDragging:o}=L({id:`palette:${JSON.stringify([e.id,e.path])}`,data:{type:`palette`,skill:e.id}});return(0,J.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.id,"data-in-flow":t||void 0,title:e.description??``,className:r(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...i,children:[(0,J.jsxs)(`span`,{className:r(`min-w-0 flex-1 break-words text-xs`,pe(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:[e.name,e.path?(0,J.jsx)(`span`,{className:`block break-all text-xs text-soft-foreground`,children:e.path}):null]}),(0,J.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.id),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-3.5`})})]})}function ot({yaml:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useRef)(null);return(0,V.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,J.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ae,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ue,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}function st(e,t){return{yaml:Re(e.name,e.description,e.steps),loadedName:t}}function ct(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),o=(0,V.useRef)(0),s=e!==null&&n!==null&&st(e,void 0).yaml!==n.yaml;N(s);let c=(e,n)=>{o.current+=1,t(e),r(st(e,n))};return{draft:e,setDraft:t,dirty:s,replace:c,guardedReplace:(e,t)=>{s?a({draft:e,loadedName:t}):c(e,t)},sending:()=>e===null?null:{baseline:st(e,e.name.trim()),replacement:o.current},saved:e=>{e&&e.replacement===o.current&&r(e.baseline)},renamedFrom:e=>{let t=n?.loadedName;if(!(t===void 0||e===``))return ze(e)===ze(t)?void 0:t},discardOpen:i!==null,keepEditing:()=>a(null),discard:()=>{i&&c(i.draft,i.loadedName),a(null)}}}var lt=`wb-canvas`;function $(){return{name:`my-workflow`,description:``,steps:[]}}function ut(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function dt(){let{name:e}=ne();return(0,J.jsx)(ft,{routeName:e},e??``)}function ft({routeName:e}){let t=i(),n=a(),r=c(),ne=d(),h=ct(),{draft:g,setDraft:_}=h,[re,ie]=(0,V.useState)(``),[oe,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(``),[ce,le]=(0,V.useState)(null),[ue,S]=(0,V.useState)(!1),[de,C]=(0,V.useState)(``),[fe,w]=(0,V.useState)(``),[pe,T]=(0,V.useState)(!1),[E,D]=(0,V.useState)(``),[O,k]=(0,V.useState)(!1),[A,j]=(0,V.useState)(!1),M=(0,V.useId)(),[N,P]=(0,V.useState)(null),[xe,F]=(0,V.useState)(null),I=(0,V.useRef)(null),L=(0,V.useRef)(null),R=t.data?.workflows??[],z=n.data??[],B=he(z,r.data?.skillUsage),Ae=me(B,y,r.data?.skillUsage);(0,V.useEffect)(()=>{if(g!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);h.replace(r?ut(r):$(),r?.name)},[g,t.data,e,h.replace]);let H=e=>_(t=>t===null?t:{...t,steps:e}),U=s({mutationFn:e=>f(e),onSuccess:e=>{_({name:e.name,description:e.description??``,steps:e.steps}),S(!1),C(``),w(``),p(`Imported "${e.name}" — review, then Save.`)},onError:e=>w(e.message)}),W=s({mutationFn:e=>l(e),onSuccess:e=>{_(t=>{let n=t??$(),{name:r,steps:i}=Ve(e,n.name);return{...n,name:r,steps:i}}),T(!1),D(``),p(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??g?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>p(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=s({onMutate:()=>h.sending(),mutationFn:e=>te({...He(g?.name??``,g?.description??``,g?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{k(!1),h.saved(n),p(`Saved — ${e.path.split(`/`).pop()??e.path}`),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{e instanceof u&&e.exists===!0?k(!0):p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ie=s({mutationFn:e=>ee(e),onSuccess:(e,t)=>{j(!1),p(`Deleted "${t}".`),h.replace($(),void 0),ne.invalidateQueries({queryKey:o.workflows})},onError:e=>{j(!1),p(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Le=Te(Ee(ke,{activationConstraint:{distance:4}}),Ee(Ce,{coordinateGetter:De}));if(t.isError)return(0,J.jsx)(ve,{route:`workflows`,density:`empty`,className:`@container`,children:(0,J.jsx)(ye,{icon:(0,J.jsx)(se,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(g===null)return(0,J.jsx)(be,{});let K=g.steps,q=g.name.trim(),Y=R.find(e=>e.name===q&&e.source===`file`),X=Re(g.name,g.description,K),Z=Y!==void 0&&Re(Y.name,Y.description??``,Y.steps??[])===X,Q=(e,t=K.length)=>{if(K.length>=8){p(`A workflow holds at most 8 steps.`,{tone:`danger`});return}H(Ne(K,Me(e,K),t))};return(0,J.jsxs)(ve,{route:`workflows`,density:_e(K.length),className:`@container`,header:{title:`Workflows`,subtitle:`Portable skill chains. Steps run from top to bottom.`,status:Z?(0,J.jsx)(`span`,{id:M,"data-slot":`wb-save-cue`,className:`whitespace-nowrap text-xs text-muted-foreground`,children:`No unsaved changes`}):void 0,secondaryActions:(0,J.jsxs)(ge,{type:`button`,variant:`outline`,"data-slot":`wb-new`,onClick:()=>h.guardedReplace($(),void 0),children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]}),primaryAction:(0,J.jsxs)(ge,{type:`button`,variant:`primary`,"data-slot":`wb-save`,disabled:G.isPending||Z,"aria-describedby":Z?M:void 0,onClick:()=>{if(q===``){I.current?.focus();return}if(K.length===0){p(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,J.jsx)(ae,{"aria-hidden":`true`,className:`size-4`}),`Save workflow`]})},children:[(0,J.jsxs)(Se,{sensors:Le,collisionDetection:we,onDragStart:e=>{let t=e.active.data.current;P(t??null)},onDragOver:e=>{F(e.over?String(e.over.id):null)},onDragEnd:e=>{P(null),F(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===lt?K.length:K.findIndex(e=>e.id===n.id);Q(r.skill,e===-1?K.length:e);return}if(n.id===t.id)return;let i=K.findIndex(e=>e.id===t.id),a=K.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&H(Pe(K,i,a))},onDragCancel:()=>{P(null),F(null)},children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4 pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,J.jsx)(Ue,{workflows:R,draft:g,trimmedName:q,nameRef:I,onDraft:_,onLoadWorkflow:e=>h.guardedReplace(ut(e),e.name),renamedFrom:h.renamedFrom(q)}),(0,J.jsx)(We,{savedFile:Y,autoOpen:pe,onImportToggle:()=>{w(``),T(!1),S(e=>!e)},onExport:()=>{let e=new Blob([X],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${ze(g.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},onAutoToggle:()=>{S(!1),T(e=>!e)},onDeleteRequest:()=>j(!0)}),pe?(0,J.jsx)(Ge,{text:E,onTextChange:D,pending:W.isPending,onRun:()=>{let e=E.trim();e===``||W.isPending||W.mutate(e)},onCancel:()=>{T(!1),D(``)}}):null,(0,J.jsx)(Ke,{open:ue,onOpenChange:S,text:de,onTextChange:C,error:fe,pending:U.isPending,onRun:()=>{let e=de.trim();e!==``&&U.mutate(e)},onCancel:()=>{S(!1),C(``),w(``)}}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,J.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,title:`A workflow holds at most 8 steps`,children:[`Steps · `,K.length,` of `,8,` max`,(0,J.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:Be(K)})]}),(0,J.jsx)(pt,{steps:K,skills:z,dragging:N!==null,overId:xe,activeStepId:N?.type===`step`?N.step.id:null,onRemove:e=>H(Fe(K,e)),onMove:(e,t)=>H(Pe(K,e,t))}),(0,J.jsxs)(x,{ref:L,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{le(null),b(``),v(!0)},children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,J.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,J.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,J.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]})]}),(0,J.jsx)(qe,{paletteSkills:B,query:re,onQueryChange:ie,error:n.isError?n.error.message:null,inFlow:new Set(K.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>Q(e),yaml:X})]})]}),(0,J.jsx)(Oe,{children:(0,J.jsx)(ht,{dragging:N,steps:K,skills:z})})]}),(0,J.jsx)(Je,{open:oe,onOpenChange:v,query:y,onQueryChange:b,matches:Ae,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:ce,onSelectSkill:le,stepsCount:K.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>v(!1),onAdd:e=>{Q(e),v(!1)}}),(0,J.jsx)(Ye,{trimmedName:q,savedFile:Y,overwriteOpen:O,onOverwriteDismiss:()=>k(!1),deleteOpen:A,onDeleteDismiss:()=>j(!1),onOverwrite:()=>G.mutate(!0),onDelete:()=>Ie.mutate(q)}),(0,J.jsx)(je,{open:h.discardOpen,subject:q===``?`this workflow`:`“${q}”`,onKeep:h.keepEditing,onDiscard:h.discard})]})}function pt({steps:e,skills:t,dragging:n,overId:i,activeStepId:a,onRemove:o,onMove:s}){let{setNodeRef:c,isOver:l}=I({id:lt}),u=n&&i===lt;return(0,J.jsx)(`div`,{ref:c,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:r(`relative mt-3 rounded-lg transition-colors`,l?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,J.jsx)(`p`,{className:r(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,l?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,J.jsxs)(z,{items:e.map(e=>e.id),strategy:F,children:[(0,J.jsx)(`ol`,{className:`flex flex-col gap-2.5`,children:e.map((r,c)=>(0,J.jsx)(mt,{step:r,index:c,skills:t,dragging:n,insertBefore:n&&i===r.id&&a!==r.id,onRemove:()=>o(c),onMoveUp:c>0?()=>s(c,c-1):void 0,onMoveDown:c<e.length-1?()=>s(c,c+1):void 0},r.id))}),(0,J.jsx)(`div`,{"aria-hidden":`true`,className:r(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,u?`bg-accent-strong`:`bg-transparent`)})]})})}function mt({step:e,index:t,insertBefore:n,onRemove:i,onMoveUp:o,onMoveDown:s}){let c=a(e.runner,e.agentProfile),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:p,isDragging:ee}=R({id:e.id,data:{type:`step`,step:e}});return(0,J.jsxs)(`li`,{ref:d,style:{transform:xe.Transform.toString(f),transition:p},className:r(`relative`,ee&&`opacity-40`),children:[n?(0,J.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,J.jsx)(rt,{step:e,index:t,skills:c.data??[],onRemove:i,onMoveUp:o,onMoveDown:s,gripProps:{...l,...u}})]})}function ht(e){let t=e.dragging?.type===`step`?e.dragging.step:void 0,n=a(t?.runner,t?.agentProfile,!!t);return(0,J.jsx)(Y,{...e,skills:t?n.data??[]:e.skills})}export{dt as WorkflowsRoute};