@hearsay-tools/squawk 0.19.0-dev.8893 → 0.19.0-dev.8902

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 (130) hide show
  1. package/dist/activity/requests.js +1 -1
  2. package/dist/activity/requests.js.map +1 -1
  3. package/dist/activity/text.d.ts +0 -2
  4. package/dist/activity/text.js +1 -7
  5. package/dist/activity/text.js.map +1 -1
  6. package/dist/activity/tool-activity.js +1 -1
  7. package/dist/activity/tool-activity.js.map +1 -1
  8. package/dist/activity/wait.js +1 -1
  9. package/dist/activity/wait.js.map +1 -1
  10. package/dist/ci-wait/errors.js +2 -2
  11. package/dist/ci-wait/errors.js.map +1 -1
  12. package/dist/ci-wait/github.d.ts +22 -30
  13. package/dist/ci-wait/github.js +27 -9
  14. package/dist/ci-wait/github.js.map +1 -1
  15. package/dist/ci-wait/pr-wait-kind.d.ts +2 -2
  16. package/dist/ci-wait/pr-wait-kind.js +3 -3
  17. package/dist/ci-wait/pr-wait-kind.js.map +1 -1
  18. package/dist/ci-wait/pr-wait-port.d.ts +44 -0
  19. package/dist/ci-wait/pr-wait-port.js +125 -0
  20. package/dist/ci-wait/pr-wait-port.js.map +1 -0
  21. package/dist/ci-wait/progress.d.ts +4 -5
  22. package/dist/ci-wait/progress.js +1 -1
  23. package/dist/ci-wait/progress.js.map +1 -1
  24. package/dist/ci-wait/supervisor.d.ts +13 -8
  25. package/dist/ci-wait/supervisor.js +59 -26
  26. package/dist/ci-wait/supervisor.js.map +1 -1
  27. package/dist/ci-wait/tool-catalog.js +1 -1
  28. package/dist/ci-wait/tool-catalog.js.map +1 -1
  29. package/dist/core/clamp-text.d.ts +2 -0
  30. package/dist/core/clamp-text.js +8 -0
  31. package/dist/core/clamp-text.js.map +1 -0
  32. package/dist/core/forge-pr-wait.d.ts +99 -0
  33. package/dist/core/forge-pr-wait.js +20 -0
  34. package/dist/core/forge-pr-wait.js.map +1 -0
  35. package/dist/core/forge-registry.d.ts +6 -2
  36. package/dist/core/forge-registry.js +5 -0
  37. package/dist/core/forge-registry.js.map +1 -1
  38. package/dist/features/automations/tools.d.ts +8 -8
  39. package/dist/plugin/index.d.ts +3 -0
  40. package/dist/plugin/index.js +2 -0
  41. package/dist/plugin/index.js.map +1 -1
  42. package/dist/runs/run-archive.d.ts +72 -72
  43. package/dist/server/forge/github-forge.js +3 -0
  44. package/dist/server/forge/github-forge.js.map +1 -1
  45. package/dist/server/live-routes.d.ts +6 -6
  46. package/dist/server/runs-routes.d.ts +17 -17
  47. package/dist/server/server.d.ts +1396 -1396
  48. package/dist/server/workspace-live-routes.d.ts +6 -6
  49. package/dist/workflows/input-acknowledgement.d.ts +24 -24
  50. package/dist/workflows/run/wait-input-descriptors.js +1 -1
  51. package/dist/workflows/run/wait-input-descriptors.js.map +1 -1
  52. package/dist/workflows/run/wait-kind-registry.d.ts +3 -2
  53. package/dist/workflows/run/wait-kind-registry.js.map +1 -1
  54. package/dist/workflows/run/wait-registration-tool.js +3 -1
  55. package/dist/workflows/run/wait-registration-tool.js.map +1 -1
  56. package/package.json +4 -4
  57. package/web/dist/assets/{accounts-section-DV18K14j.js → accounts-section-CL4_y1Ap.js} +1 -1
  58. package/web/dist/assets/{activity-motion-U0gkYTm-.js → activity-motion-1nxINCqs.js} +1 -1
  59. package/web/dist/assets/{activity-route-CKFb-IYI.js → activity-route-yCPzQHRl.js} +1 -1
  60. package/web/dist/assets/{agent-config-section-X66FRjsE.js → agent-config-section-CO-Bl7d7.js} +1 -1
  61. package/web/dist/assets/{agent-defaults-section-EEYiGk_Q.js → agent-defaults-section-C90pO0nt.js} +1 -1
  62. package/web/dist/assets/{appearance-D4I-ANZ_.js → appearance-dgwYTY63.js} +1 -1
  63. package/web/dist/assets/{archive-on-merge-field-D6y7pCov.js → archive-on-merge-field-DJZVhb_I.js} +1 -1
  64. package/web/dist/assets/{automations-route-4ahsnx6z.js → automations-route-BhSkU9kZ.js} +2 -2
  65. package/web/dist/assets/{command-ppU3xBNs.js → command-BMMjB5k9.js} +1 -1
  66. package/web/dist/assets/{commit-list-Dp0c_x8b.js → commit-list-mYh1t3BD.js} +1 -1
  67. package/web/dist/assets/{design-icons-CzEoMH9c.js → design-icons-BZt8Kqs9.js} +1 -1
  68. package/web/dist/assets/{dialog-DXCws12U.js → dialog-CB9ZhEk2.js} +1 -1
  69. package/web/dist/assets/{diff-n7BcLjSi.js → diff-B4l1BaZJ.js} +2 -2
  70. package/web/dist/assets/{diff-controls-7hWjGeWp.js → diff-controls-Bs58JOMz.js} +1 -1
  71. package/web/dist/assets/{diff-view-CJNrRCRI.js → diff-view-BGwOGavy.js} +1 -1
  72. package/web/dist/assets/{discard-changes-dialog-Bd3w4xOW.js → discard-changes-dialog-Cr1vlcjZ.js} +1 -1
  73. package/web/dist/assets/dropdown-menu-VFda6KAg.js +1 -0
  74. package/web/dist/assets/{file-preview-DS5j5uFi.js → file-preview-DqopZwES.js} +1 -1
  75. package/web/dist/assets/{git-toolbar-D5N_Ucqr.js → git-toolbar-pr68yTY4.js} +1 -1
  76. package/web/dist/assets/github-BY-X8L5Q.js +1 -0
  77. package/web/dist/assets/{global-activity-route-DqyHJiZz.js → global-activity-route-XkwjlnaD.js} +1 -1
  78. package/web/dist/assets/index-BOWGArJd.css +1 -0
  79. package/web/dist/assets/index-I4_drgNu.js +21 -0
  80. package/web/dist/assets/{markdown-9FIYg1nH.js → markdown-fuaT5ciN.js} +1 -1
  81. package/web/dist/assets/{open-in-menu-L5v_AQZt.js → open-in-menu-Uw-sJhbG.js} +1 -1
  82. package/web/dist/assets/{option-select-CYbw9rk4.js → option-select-_tHcMUWt.js} +1 -1
  83. package/web/dist/assets/{preferences-section-Do1nZwKg.js → preferences-section-Crh_5QfK.js} +1 -1
  84. package/web/dist/assets/{preview-pane-connected-o7nx7h4-.js → preview-pane-connected-CLWRxEhI.js} +1 -1
  85. package/web/dist/assets/{project-location-BFN7mvbZ.js → project-location-DmGO5Dqx.js} +1 -1
  86. package/web/dist/assets/{projects-section-Bq9DzRDF.js → projects-section-CLPN14JX.js} +1 -1
  87. package/web/dist/assets/{prompt-templates-section-CNa_K7AU.js → prompt-templates-section-CQHpVrcB.js} +2 -2
  88. package/web/dist/assets/{reference-chip-O8Bfl1Oi.js → reference-chip-Dk69XD7Q.js} +1 -1
  89. package/web/dist/assets/{remote-settings-notice-CbCCb3QA.js → remote-settings-notice-C8naX_yp.js} +1 -1
  90. package/web/dist/assets/{repo-git-Dz3fhj6j.js → repo-git-CTSdvalV.js} +1 -1
  91. package/web/dist/assets/{report-reader-BfsdCLq-.js → report-reader-DJJixZxy.js} +1 -1
  92. package/web/dist/assets/{report-selection-cuFCCxDW.js → report-selection-BH0M_8bk.js} +1 -1
  93. package/web/dist/assets/{reports-Df83TkE3.js → reports-DXfywo34.js} +1 -1
  94. package/web/dist/assets/{resources-section-CKJGgLWa.js → resources-section-CA-D1Vj2.js} +1 -1
  95. package/web/dist/assets/review-panel-UI6FQQmp.js +11 -0
  96. package/web/dist/assets/{run-header-BWNapiIC.js → run-header-DDQU9tCB.js} +2 -2
  97. package/web/dist/assets/select-QO8XlmjU.js +1 -0
  98. package/web/dist/assets/{session-context-section-CSDtUgJI.js → session-context-section-CTDQl-i5.js} +1 -1
  99. package/web/dist/assets/{settings-agent-picker-pMZcMiW4.js → settings-agent-picker-DE5zKJtS.js} +1 -1
  100. package/web/dist/assets/{settings-list-detail-Ch1KMPjr.js → settings-list-detail-DcRsGkGy.js} +1 -1
  101. package/web/dist/assets/{settings-save-bar-CFkofH5G.js → settings-save-bar-DM7T22Nr.js} +1 -1
  102. package/web/dist/assets/{settings-shell-B6-ofejE.js → settings-shell-EOUcgx1J.js} +1 -1
  103. package/web/dist/assets/{sidebar-section-DwcXrxn2.js → sidebar-section-C69ES3GL.js} +1 -1
  104. package/web/dist/assets/{skills-DD5hhynR.js → skills-DuaNQ6XW.js} +1 -1
  105. package/web/dist/assets/task-changes-midIkW0D.js +1 -0
  106. package/web/dist/assets/{task-commits-D8Pzk4b3.js → task-commits-DAT7-sIh.js} +1 -1
  107. package/web/dist/assets/{task-file-scope-DPJOeknI.js → task-file-scope-BYAH1Mj8.js} +1 -1
  108. package/web/dist/assets/{task-files-DJnNyynG.js → task-files-CJaZfp0y.js} +1 -1
  109. package/web/dist/assets/{task-github-item-Di9HWGn6.js → task-github-item-BnoxG2el.js} +1 -1
  110. package/web/dist/assets/task-thread-fsRo8vgf.js +2 -0
  111. package/web/dist/assets/{thread-state-B2dX4psn.js → thread-state-T5A2uz_q.js} +1 -1
  112. package/web/dist/assets/use-hand-to-agent-state-CqiCI37V.css +1 -0
  113. package/web/dist/assets/use-hand-to-agent-state-Cy6oaj7k.js +1 -0
  114. package/web/dist/assets/use-path-bases-x6weDx5i.js +1 -0
  115. package/web/dist/assets/workflows-CwZ1aiR4.js +7 -0
  116. package/web/dist/assets/{workspace-tools-6fvZHbrZ.js → workspace-tools-0-Yx7SCS.js} +1 -1
  117. package/web/dist/assets/{worktrees-section-C1fpzChO.js → worktrees-section-Cn8sFOCC.js} +1 -1
  118. package/web/dist/index.html +9 -9
  119. package/web/dist/assets/dropdown-menu-B60L-d_4.js +0 -1
  120. package/web/dist/assets/github-Bhj0PA8h.js +0 -1
  121. package/web/dist/assets/index-UMSYsh9P.css +0 -1
  122. package/web/dist/assets/index-i4Bu7SvU.js +0 -21
  123. package/web/dist/assets/review-panel-BaUd88ko.js +0 -11
  124. package/web/dist/assets/select-Cy2NunWj.js +0 -1
  125. package/web/dist/assets/task-changes-CbWxyOEd.js +0 -1
  126. package/web/dist/assets/task-thread-gXImKbGN.js +0 -2
  127. package/web/dist/assets/use-hand-to-agent-state-BHaqyTxa.css +0 -1
  128. package/web/dist/assets/use-hand-to-agent-state-DhUiLIQg.js +0 -1
  129. package/web/dist/assets/use-path-bases-BzlzA9bw.js +0 -1
  130. package/web/dist/assets/workflows-slzqyi2_.js +0 -7
@@ -0,0 +1,7 @@
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{C as m,R as h,Y as re,Z as g,a as ie,ct as ae,l as oe,n as se,nt as _,ot as v,pt as y,st as ce,ut as b,x as le,y as ue}from"./design-icons-BZt8Kqs9.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-CB9ZhEk2.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-I4_drgNu.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-_tHcMUWt.js";import{t as je}from"./discard-changes-dialog-Cr1vlcjZ.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)(ae,{"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)(le,{"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)(b,{"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)(v,{"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)(b,{"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)(y,{"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)(g,{"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)(m,{"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)(_,{"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)(v,{"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)(ie,{"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)(se,{"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)(re,{"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)(oe,{"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(),m=ct(),{draft:h,setDraft:g}=m,[ie,ae]=(0,V.useState)(``),[se,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),[b,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,v,r.data?.skillUsage);(0,V.useEffect)(()=>{if(h!==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`);m.replace(r?ut(r):$(),r?.name)},[h,t.data,e,m.replace]);let H=e=>g(t=>t===null?t:{...t,steps:e}),U=s({mutationFn:e=>f(e),onSuccess:e=>{g({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=>{g(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??h?.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:()=>m.sending(),mutationFn:e=>te({...He(h?.name??``,h?.description??``,h?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:(e,t,n)=>{k(!1),m.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}".`),m.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)(ce,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(h===null)return(0,J.jsx)(be,{});let K=h.steps,q=h.name.trim(),Y=R.find(e=>e.name===q&&e.source===`file`),X=Re(h.name,h.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:()=>m.guardedReplace($(),void 0),children:[(0,J.jsx)(re,{"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)(oe,{"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:h,trimmedName:q,nameRef:I,onDraft:g,onLoadWorkflow:e=>m.guardedReplace(ut(e),e.name),renamedFrom:m.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(h.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),y(``),_(!0)},children:[(0,J.jsx)(re,{"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:ie,onQueryChange:ae,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:se,onOpenChange:_,query:v,onQueryChange:y,matches:Ae,skillsCount:z.length,error:n.isError?n.error.message:null,selectedSkill:b,onSelectSkill:le,stepsCount:K.length,onCloseAutoFocus:e=>{e.preventDefault(),L.current?.focus()},onCancel:()=>_(!1),onAdd:e=>{Q(e),_(!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:m.discardOpen,subject:q===``?`this workflow`:`“${q}”`,onKeep:m.keepEditing,onDiscard:m.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};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Qt as r,St as i,Vt as a,rn as o,yt as s}from"./queries-CIeJg62Y.js";import{n as c}from"./toaster-D0HMoto5.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-CvZ2ZyCa.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./status-dot-BXf-Ubd0.js";import{f as p,o as m}from"./page-shell-Dky5crRl.js";import{r as h,t as g}from"./agents-settings-path-7X6_cvUg.js";import{$n as _,Qt as v,Zn as y,jn as b,tr as x}from"./index-i4Bu7SvU.js";var S=e(t(),1),C=n();function w(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,C.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,C.jsx)(`span`,{children:e},t):null)}function T(e,t){let n=r(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function E({mode:e,version:t,rawVersion:n}){return e?(0,C.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,C.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var D=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function O({health:e,projects:t,repository:n,onAction:r}){let i=!!(e.data?.repoRoot||n||t.data?.projectsDir);return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`add-project-heading`,className:`text-base font-semibold text-foreground`,children:`Add project`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`})]}),i?(0,C.jsxs)(`div`,{className:`border-y border-border py-3.5`,children:[(0,C.jsx)(`h3`,{className:`mb-2.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:`Active project`}),(0,C.jsxs)(`dl`,{className:`space-y-2 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Local folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Repository`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Checkout folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:t.data.projectsDir})]}):null]})]}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`local`),children:`Open local folder`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function k({health:e,runners:t,copying:n,onCopy:r}){return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:D,children:(0,C.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,C.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,C.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,C.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=v(e),r=T(e.name,t),i=b(e);return(0,C.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,C.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,C.jsx)(f,{tone:i.availability.tone,shape:i.availability.shape}),(0,C.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,C.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,C.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,C.jsx)(E,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),e.available?null:(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:`${D} ml-auto`,children:(0,C.jsxs)(l,{to:h(e.name),"data-slot":`tool-setup`,children:[`Set up`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),n?(0,C.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:w(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`})]})]})}function A(){let e=s(),t=i(),n=o().data,r=a(e.data?.repo?.remote),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(!1),h=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},g=e.data?.checks.length??4;return(0,C.jsxs)(m,{route:`workspace-tools`,density:e.data?p(g):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Add projects and inspect local workspace CLI diagnostics.`},children:[(0,C.jsx)(O,{health:e,projects:t,repository:r,onAction:u}),(0,C.jsx)(k,{health:e,runners:n,copying:d,onCopy:h}),l===`new`?(0,C.jsx)(y,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,C.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,C.jsx)(_,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{A as WorkspaceToolsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Qt as r,St as i,Vt as a,rn as o,yt as s}from"./queries-CIeJg62Y.js";import{n as c}from"./toaster-D0HMoto5.js";import{n as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import"./tasks-table-CvZ2ZyCa.js";import{t as u}from"./chevron-right-BENZ-1ZN.js";import{t as d}from"./button-C8jUIs8Q.js";import{t as f}from"./status-dot-BXf-Ubd0.js";import{f as p,o as m}from"./page-shell-Dky5crRl.js";import{r as h,t as g}from"./agents-settings-path-7X6_cvUg.js";import{$n as _,Qt as v,Zn as y,jn as b,tr as x}from"./index-I4_drgNu.js";var S=e(t(),1),C=n();function w(e){let t=e.replace(/\binstall\b/g,(e,t)=>t===0?`Install`:e),n=t.split(/(`[^`]+`)/g);if(n.length===1){let e=t.split(/(\bgh auth login\b)/g);return e.length===1?t:e.map((e,t)=>e===`gh auth login`?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e},t):(0,C.jsx)(`span`,{children:e},t))}return n.map((e,t)=>e.startsWith("`")&&e.endsWith("`")&&e.length>2?(0,C.jsx)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground`,children:e.slice(1,-1)},t):e?(0,C.jsx)(`span`,{children:e},t):null)}function T(e,t){let n=r(t,e);return n?{label:n.displayName,isAgent:!0}:{label:e,isAgent:!1}}function E({mode:e,version:t,rawVersion:n}){return e?(0,C.jsx)(`span`,{"data-slot":`tool-dry-run`,title:n,className:`shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground`,children:e.label}):t?(0,C.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`· `,t]}):null}var D=`h-8 text-xs font-medium max-md:h-11 no-hover:h-11`;function O({health:e,projects:t,repository:n,onAction:r}){let i=!!(e.data?.repoRoot||n||t.data?.projectsDir);return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`add-project-heading`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`add-project-heading`,className:`text-base font-semibold text-foreground`,children:`Add project`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Start a new repository, open an existing local folder, or clone a GitHub repository.`})]}),i?(0,C.jsxs)(`div`,{className:`border-y border-border py-3.5`,children:[(0,C.jsx)(`h3`,{className:`mb-2.5 text-xs font-semibold tracking-wide text-muted-foreground uppercase`,children:`Active project`}),(0,C.jsxs)(`dl`,{className:`space-y-2 text-[13px] leading-[1.5] text-muted-foreground`,children:[e.data?.repoRoot?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Local folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:e.data.repo?.root??e.data.repoRoot})]}):null,n?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Repository`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:n.replace(/^https:\/\//,``)})]}):null,t.data?.projectsDir?(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,C.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Checkout folder`}),(0,C.jsx)(`dd`,{className:`min-w-0 font-mono text-xs break-all`,children:t.data.projectsDir})]}):null]})]}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,"data-action":`new-project`,onClick:()=>r(`new`),children:`New project`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`local`),children:`Open local folder`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,onClick:()=>r(`clone`),children:`Clone from GitHub`})]})]})}function k({health:e,runners:t,copying:n,onCopy:r}){return(0,C.jsxs)(`section`,{className:`space-y-4 rounded-xl border border-card-edge bg-card p-6 shadow-card max-md:p-4`,"aria-labelledby":`tools-heading`,children:[(0,C.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{id:`tools-heading`,className:`text-base font-semibold text-foreground`,children:`Tools diagnostics`}),(0,C.jsx)(`p`,{className:`mt-1 text-[13px] leading-[1.5] text-muted-foreground`,children:`Check the tools available to this local workspace.`})]}),(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:D,children:(0,C.jsxs)(l,{to:g,"data-slot":`tools-settings`,children:[`Tool settings`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),e.isError?(0,C.jsx)(`p`,{role:`alert`,className:`text-sm text-semantic-red`,children:`Could not refresh tool diagnostics. Recheck to retry.`}):null,!e.data&&!e.isError?(0,C.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Checking installed tools…`}):null,e.data?(0,C.jsx)(`dl`,{className:`divide-y divide-border border-y border-border text-[13px] leading-[1.5] text-muted-foreground`,children:e.data.checks.map(e=>{let n=v(e),r=T(e.name,t),i=b(e);return(0,C.jsxs)(`div`,{"data-slot":`tool-row`,"data-tool":e.name,"data-available":e.available,className:`grid grid-cols-1 gap-x-4 gap-y-1 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center`,children:[(0,C.jsxs)(`dt`,{className:`flex items-center gap-2.5`,children:[(0,C.jsx)(f,{tone:i.availability.tone,shape:i.availability.shape}),(0,C.jsx)(`span`,{className:r.isAgent?`text-[14px] font-semibold text-foreground`:`font-mono text-[13px] font-semibold text-foreground`,children:r.label})]}),(0,C.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-x-1.5 text-muted-foreground`,children:[(0,C.jsx)(`span`,{className:`shrink-0`,children:i.availability.label}),(0,C.jsx)(E,{mode:i.mode,version:i.version,rawVersion:i.rawVersion}),e.available?null:(0,C.jsx)(d,{asChild:!0,variant:`outline`,size:`sm`,className:`${D} ml-auto`,children:(0,C.jsxs)(l,{to:h(e.name),"data-slot":`tool-setup`,children:[`Set up`,(0,C.jsx)(u,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})]})})]}),n?(0,C.jsx)(`dd`,{"data-slot":`tool-hint`,className:`min-w-0 break-words text-xs leading-relaxed text-muted-foreground sm:col-start-2`,children:w(n)}):null]},e.name)})}):null,e.data?.checks.length===0?(0,C.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tool diagnostics reported by this server.`}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:e.isFetching,onClick:()=>void e.refetch(),children:e.isFetching?`Checking tools…`:`Recheck tools`}),(0,C.jsx)(d,{variant:`outline`,className:`h-10 rounded-lg px-3.5 text-xs font-medium max-md:h-11`,disabled:!e.data||n,onClick:()=>void r(),children:n?`Copying…`:`Copy diagnostics`})]})]})}function A(){let e=s(),t=i(),n=o().data,r=a(e.data?.repo?.remote),[l,u]=(0,S.useState)(null),[d,f]=(0,S.useState)(!1),h=async()=>{if(!(!e.data||d)){f(!0);try{await navigator.clipboard.writeText(JSON.stringify({version:e.data.version,checks:e.data.checks},null,2)),c(`Diagnostics copied`)}catch{c(`Could not copy diagnostics. Please try again.`,{tone:`danger`})}finally{f(!1)}}},g=e.data?.checks.length??4;return(0,C.jsxs)(m,{route:`workspace-tools`,density:e.data?p(g):`full`,bodyClassName:`gap-5`,header:{title:`Workspace tools`,subtitle:`Add projects and inspect local workspace CLI diagnostics.`},children:[(0,C.jsx)(O,{health:e,projects:t,repository:r,onAction:u}),(0,C.jsx)(k,{health:e,runners:n,copying:d,onCopy:h}),l===`new`?(0,C.jsx)(y,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`local`?(0,C.jsx)(x,{open:!0,onOpenChange:e=>{e||u(null)}}):null,l===`clone`?(0,C.jsx)(_,{open:!0,onOpenChange:e=>{e||u(null)}}):null]})}export{A as WorkspaceToolsRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Wt as r,_ as i,dn as a,yt as o}from"./queries-CIeJg62Y.js";import{Fn as s,Ir as c,Lr as l,P as u,hi as d,n as f}from"./toaster-D0HMoto5.js";import{u as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./project-router-BHFXTx5l.js";import{t as h}from"./centered-state-BgSV4e79.js";import{cr as g}from"./index-i4Bu7SvU.js";import{n as _,r as v,t as y}from"./remote-settings-notice-CbCCb3QA.js";import{n as b}from"./settings-field-Bhh8I9fJ.js";import{n as x}from"./project-location-BFN7mvbZ.js";import{r as S}from"./settings-save-bar-CFkofH5G.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Wt as r,_ as i,dn as a,yt as o}from"./queries-CIeJg62Y.js";import{Fn as s,Ir as c,Lr as l,P as u,hi as d,n as f}from"./toaster-D0HMoto5.js";import{d as p}from"./design-icons-BZt8Kqs9.js";import{t as m}from"./project-router-BHFXTx5l.js";import{t as h}from"./centered-state-BgSV4e79.js";import{cr as g}from"./index-I4_drgNu.js";import{n as _,r as v,t as y}from"./remote-settings-notice-C8naX_yp.js";import{n as b}from"./settings-field-Bhh8I9fJ.js";import{n as x}from"./project-location-DmGO5Dqx.js";import{r as S}from"./settings-save-bar-DM7T22Nr.js";import{n as C}from"./saved-draft-BwzBc-_Y.js";var w=e(t(),1),T=n();function E({copy:e,savedCommandCount:t,settingsAdmin:n,configPath:r,issue:i,invalid:a,children:o}){let s=e.slot;return(0,T.jsxs)(T.Fragment,{children:[t===0&&i===null?(0,T.jsx)(`p`,{"data-slot":`${s}-empty`,className:`text-xs text-muted-foreground`,children:e.empty}):null,o,n===!1?(0,T.jsxs)(`p`,{"data-slot":`${s}-readonly`,className:`text-xs text-foreground`,children:[`Edit `,(0,T.jsxs)(`code`,{children:[e.key,`.commands`]}),` in`,` `,r===null?(0,T.jsxs)(T.Fragment,{children:[`the project’s `,(0,T.jsx)(`code`,{children:`.ai/cezar/config.json`})]}):(0,T.jsx)(`code`,{className:`break-all`,children:r}),` `,`on the machine running Squawk. `,e.fileEditApplies,` No restart is needed. To edit here, the host operator runs `,(0,T.jsx)(`code`,{children:y}),`.`]}):null,i===null?null:(0,T.jsxs)(`p`,{"data-slot":`${s}-issue`,className:`text-xs text-danger`,children:[`config.json has an invalid `,e.key,` (`,i,`) — saving replaces it.`]}),a===null?null:(0,T.jsx)(`p`,{"data-slot":`${s}-invalid`,className:`text-xs text-danger`,children:a})]})}function D(e,t){let n=e.split(`
2
2
  `).map(e=>e.trim()).filter(e=>e!==``),r=Number(t);return{commands:n,timeoutSeconds:r,invalid:n.length>20?`Enter at most 20 commands.`:n.some(e=>e.length>4e3)?`Keep each command under ${c.toLocaleString(`en-US`)} characters.`:t.trim()===``||!Number.isInteger(r)||r<1||r>7200?`Enter a whole number of seconds from 1 to ${l}.`:null}}var O={setup:{key:`worktreeSetup`,issueKey:`worktreeSetupIssue`,slot:`worktree-setup`,title:`Prepare new worktrees`,hint:`Runs in order in every new task and worker worktree before the agent starts. The first failure stops setup.`,empty:`No setup commands configured. No commands will run in new worktrees.`,label:`Worktree setup commands, one per line`,example:`npm ci`,fileEditApplies:`Valid file edits apply to new worktrees.`},teardown:{key:`worktreeTeardown`,issueKey:`worktreeTeardownIssue`,slot:`worktree-teardown`,title:`Stop worker services before destroy`,hint:`Runs in order in a worker’s worktree when the worker is destroyed, before its processes stop. The first failure stops teardown; destroy goes on and records it on the worker.`,empty:`No teardown commands configured. Destroy runs no commands in worker worktrees.`,label:`Worktree teardown commands, one per line`,example:`docker compose down`,fileEditApplies:`Valid file edits apply to the next worker destroy.`}};function k(e,t){return t?`One command per line, for example: ${e.example}`:void 0}function A({config:e,copy:t}){let n=d(),i=o(),c=v(),p=x(),m=p===null?null:`${p.replace(/\/$/,``)}/.ai/cezar/config.json`,h=i.data?.capabilities?.settingsAdmin===!0,g=e[t.key],y=e[t.issueKey],O=g?.commands??[],A=g?.timeoutSeconds??900,[j,M]=C(O.join(`
3
3
  `)),[N,P]=C(String(A)),{commands:F,timeoutSeconds:I,invalid:L}=D(j,N),R=F.length===O.length&&F.every((e,t)=>e===O[t])&&(F.length===0||I===A),z=a({mutationFn:e=>u(e),onSuccess:e=>{n.setQueryData(r.config,e),M(F.join(`
4
4
  `))},onError:e=>{f(e.message,{tone:`danger`}),e instanceof s&&e.status===409&&c()}}),B=()=>z.mutateAsync({[t.key]:F.length===0?null:{commands:F,...I===900?{}:{timeoutSeconds:I}}}),[V,H]=(0,w.useState)(null);S({dirty:h&&(y!==null&&y!==V||!R),holdsReload:h&&!R,invalid:L!==null,save:B,discard:()=>{M(O.join(`
@@ -59,7 +59,7 @@
59
59
  }
60
60
  })()
61
61
  </script>
62
- <script type="module" crossorigin src="/assets/index-i4Bu7SvU.js"></script>
62
+ <script type="module" crossorigin src="/assets/index-I4_drgNu.js"></script>
63
63
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/react-runtime-CCIEwYL0.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-rHxsej31.js">
@@ -76,7 +76,7 @@
76
76
  <link rel="modulepreload" crossorigin href="/assets/attention-V1gJ7gKo.js">
77
77
  <link rel="modulepreload" crossorigin href="/assets/task-groups-C9pTQm-2.js">
78
78
  <link rel="modulepreload" crossorigin href="/assets/tasks-table-CvZ2ZyCa.js">
79
- <link rel="modulepreload" crossorigin href="/assets/design-icons-CzEoMH9c.js">
79
+ <link rel="modulepreload" crossorigin href="/assets/design-icons-BZt8Kqs9.js">
80
80
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-BHp8sXmF.js">
81
81
  <link rel="modulepreload" crossorigin href="/assets/bot-TkDIw4y-.js">
82
82
  <link rel="modulepreload" crossorigin href="/assets/external-link-BE6y205O.js">
@@ -87,9 +87,9 @@
87
87
  <link rel="modulepreload" crossorigin href="/assets/dist-BSUJIXeE.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/dist-BuF3mvCA.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/dist-DudPJH39.js">
90
- <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-B60L-d_4.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-VFda6KAg.js">
91
91
  <link rel="modulepreload" crossorigin href="/assets/own-lookup-DS54wXvD.js">
92
- <link rel="modulepreload" crossorigin href="/assets/open-in-menu-L5v_AQZt.js">
92
+ <link rel="modulepreload" crossorigin href="/assets/open-in-menu-Uw-sJhbG.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/check-OP-CVgZG.js">
94
94
  <link rel="modulepreload" crossorigin href="/assets/chevron-down-CHGyCDBH.js">
95
95
  <link rel="modulepreload" crossorigin href="/assets/nav-row-styles-CgP5uNp4.js">
@@ -99,26 +99,26 @@
99
99
  <link rel="modulepreload" crossorigin href="/assets/loader-circle-CPBhhDbB.js">
100
100
  <link rel="modulepreload" crossorigin href="/assets/play-CmVAj_fu.js">
101
101
  <link rel="modulepreload" crossorigin href="/assets/popover-CvL6hQ5c.js">
102
- <link rel="modulepreload" crossorigin href="/assets/reference-chip-O8Bfl1Oi.js">
102
+ <link rel="modulepreload" crossorigin href="/assets/reference-chip-Dk69XD7Q.js">
103
103
  <link rel="modulepreload" crossorigin href="/assets/dist--f2yFdPY.js">
104
104
  <link rel="modulepreload" crossorigin href="/assets/dist-Czz3Y5qH.js">
105
105
  <link rel="modulepreload" crossorigin href="/assets/switch-CAKeV99j.js">
106
106
  <link rel="modulepreload" crossorigin href="/assets/badge-B6B-xYQQ.js">
107
- <link rel="modulepreload" crossorigin href="/assets/dialog-DXCws12U.js">
107
+ <link rel="modulepreload" crossorigin href="/assets/dialog-CB9ZhEk2.js">
108
108
  <link rel="modulepreload" crossorigin href="/assets/project-router-BHFXTx5l.js">
109
109
  <link rel="modulepreload" crossorigin href="/assets/status-dot-BXf-Ubd0.js">
110
110
  <link rel="modulepreload" crossorigin href="/assets/use-search-params-writer-ClMScnNe.js">
111
- <link rel="modulepreload" crossorigin href="/assets/report-selection-cuFCCxDW.js">
111
+ <link rel="modulepreload" crossorigin href="/assets/report-selection-BH0M_8bk.js">
112
112
  <link rel="modulepreload" crossorigin href="/assets/diff-stat-Dy4uLuyP.js">
113
113
  <link rel="modulepreload" crossorigin href="/assets/format-BU7D3IfE.js">
114
- <link rel="modulepreload" crossorigin href="/assets/command-ppU3xBNs.js">
114
+ <link rel="modulepreload" crossorigin href="/assets/command-BMMjB5k9.js">
115
115
  <link rel="modulepreload" crossorigin href="/assets/project-order-AcHI4Dcl.js">
116
116
  <link rel="modulepreload" crossorigin href="/assets/skills-pM_PouEs.js">
117
117
  <link rel="modulepreload" crossorigin href="/assets/page-shell-Dky5crRl.js">
118
118
  <link rel="modulepreload" crossorigin href="/assets/agents-settings-path-7X6_cvUg.js">
119
119
  <link rel="modulepreload" crossorigin href="/assets/centered-state-BgSV4e79.js">
120
120
  <link rel="stylesheet" crossorigin href="/assets/page-shell-DQPYcKyL.css">
121
- <link rel="stylesheet" crossorigin href="/assets/index-UMSYsh9P.css">
121
+ <link rel="stylesheet" crossorigin href="/assets/index-BOWGArJd.css">
122
122
  </head>
123
123
  <body>
124
124
  <div id="root"></div>
@@ -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{a as r,c as i,n as a,o}from"./dist-C_rn70hE.js";import{c as s,m as c,u as l}from"./design-icons-CzEoMH9c.js";import{a as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as ee,p as b,r as x,t as S,u as C}from"./es2015-CUEfzDjB.js";import{n as w,t as T}from"./dist-BSUJIXeE.js";import{a as E,i as D,n as O,r as te,t as ne}from"./dist-DudPJH39.js";var k=e(t(),1),A=!1;function j(){let[e,t]=k.useState(A);return k.useEffect(()=>{A||(A=!0,t(!0))},[]),e}var re=k.useSyncExternalStore;function M(){return()=>{}}function N(){return re(M,()=>!0,()=>!1)}var P=typeof re==`function`?N:j,F=n(),I=`rovingFocusGroup.onEntryFocus`,ie={bubbles:!1,cancelable:!0},L=`RovingFocusGroup`,[R,ae,oe]=w(L),[se,ce]=v(L,[oe]),[le,ue]=se(L),de=k.forwardRef((e,t)=>(0,F.jsx)(R.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(R.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,F.jsx)(fe,{...e,ref:t})})}));de.displayName=L;var fe=k.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:p=!1,...m}=e,g=k.useRef(null),_=r(t,g),v=T(o),[y,ee]=f({prop:s,defaultProp:c??null,onChange:l,caller:L}),[x,S]=k.useState(!1),C=d(u),w=ae(n),E=k.useRef(!1),[D,O]=k.useState(0);return k.useEffect(()=>{let e=g.current;if(e)return e.addEventListener(I,C),()=>e.removeEventListener(I,C)},[C]),(0,F.jsx)(le,{scope:n,orientation:i,dir:v,loop:a,currentTabStopId:y,onItemFocus:k.useCallback(e=>ee(e),[ee]),onItemShiftTab:k.useCallback(()=>S(!0),[]),onFocusableItemAdd:k.useCallback(()=>O(e=>e+1),[]),onFocusableItemRemove:k.useCallback(()=>O(e=>e-1),[]),children:(0,F.jsx)(h.div,{tabIndex:x||D===0?-1:0,"data-orientation":i,...m,ref:_,style:{outline:`none`,...e.style},onMouseDown:b(e.onMouseDown,()=>{E.current=!0}),onFocus:b(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(I,ie);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=w().filter(e=>e.focusable);ve([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),p)}}E.current=!1}),onBlur:b(e.onBlur,()=>S(!1))})})}),pe=`RovingFocusGroupItem`,me=k.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=_(),l=a||c,u=ue(pe,n),d=u.currentTabStopId===l,f=ae(n),{onFocusableItemAdd:m,onFocusableItemRemove:g,currentTabStopId:v}=u,y=P();return p(()=>{if(!(!y||!r))return m(),()=>g()},[y,r,m,g]),k.useEffect(()=>{if(!(y||!r))return m(),()=>g()},[y,r,m,g]),(0,F.jsx)(R.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,F.jsx)(h.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:b(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:b(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:b(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=_e(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?ye(n,r+1):n.slice(r+1)}setTimeout(()=>ve(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:v!=null}):o})})});me.displayName=pe;var he={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function ge(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function _e(e,t,n){let r=ge(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return he[r]}function ve(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ye(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var be=de,xe=me,Se=[`Enter`,` `],Ce=[`ArrowDown`,`PageUp`,`Home`],we=[`ArrowUp`,`PageDown`,`End`],Te=[...Ce,...we],Ee={ltr:[...Se,`ArrowRight`],rtl:[...Se,`ArrowLeft`]},De={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},z=`Menu`,[B,Oe,ke]=w(z),[V,Ae]=v(z,[ke,E,ce]),H=E(),je=ce(),[Me,U]=V(z),[Ne,W]=V(z),Pe=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=H(t),[c,l]=k.useState(null),u=k.useRef(!1),f=d(a),p=T(i);return k.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),k.useEffect(()=>{if(!n)return;let e=()=>f(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,f]),(0,F.jsx)(D,{...s,children:(0,F.jsx)(Me,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:l,children:(0,F.jsx)(Ne,{scope:t,onClose:k.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:p,modal:o,children:r})})})};Pe.displayName=z;var Fe=`MenuAnchor`,G=k.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=H(n);return(0,F.jsx)(ne,{...i,...r,ref:t})});G.displayName=Fe;var Ie=`MenuPortal`,[Le,Re]=V(Ie,{forceMount:void 0}),ze=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=U(Ie,t);return(0,F.jsx)(Le,{scope:t,forceMount:n,children:(0,F.jsx)(C,{present:n||a.open,children:(0,F.jsx)(g,{asChild:!0,container:i,children:r})})})};ze.displayName=Ie;var K=`MenuContent`,[Be,Ve]=V(K),He=k.forwardRef((e,t)=>{let n=Re(K,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=U(K,e.__scopeMenu),o=W(K,e.__scopeMenu);return(0,F.jsx)(B.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(C,{present:r||a.open,children:(0,F.jsx)(B.Slot,{scope:e.__scopeMenu,children:o.modal?(0,F.jsx)(Ue,{...i,ref:t}):(0,F.jsx)(We,{...i,ref:t})})})})}),Ue=k.forwardRef((e,t)=>{let n=U(K,e.__scopeMenu),i=k.useRef(null),a=r(t,i);return k.useEffect(()=>{let e=i.current;if(e)return S(e)},[]),(0,F.jsx)(Ke,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:b(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),We=k.forwardRef((e,t)=>{let n=U(K,e.__scopeMenu);return(0,F.jsx)(Ke,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Ge=a(`MenuContent.ScrollLock`),Ke=k.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=U(K,n),S=W(K,n),C=H(n),w=je(n),T=Oe(n),[E,D]=k.useState(null),O=k.useRef(null),ne=r(t,O,v.onContentChange),A=k.useRef(0),j=k.useRef(``),re=k.useRef(0),M=k.useRef(null),N=k.useRef(`right`),P=k.useRef(0),I=g?y:k.Fragment,ie=g?{as:Ge,allowPinchZoom:!0}:void 0,L=e=>{let t=j.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Et(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){j.current=t,window.clearTimeout(A.current),t!==``&&(A.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};k.useEffect(()=>()=>window.clearTimeout(A.current),[]),x();let R=k.useCallback(e=>N.current===M.current?.side&&Ot(e,M.current?.area),[]);return(0,F.jsx)(Be,{scope:n,searchRef:j,onItemEnter:k.useCallback(e=>{R(e)&&e.preventDefault()},[R]),onItemLeave:k.useCallback(e=>{R(e)||(O.current?.focus(),D(null))},[R]),onTriggerLeave:k.useCallback(e=>{R(e)&&e.preventDefault()},[R]),pointerGraceTimerRef:re,onPointerGraceIntentChange:k.useCallback(e=>{M.current=e},[]),children:(0,F.jsx)(I,{...ie,children:(0,F.jsx)(u,{asChild:!0,trapped:a,onMountAutoFocus:b(o,e=>{e.preventDefault(),O.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,F.jsx)(ee,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,F.jsx)(be,{asChild:!0,...w,dir:S.dir,orientation:`vertical`,loop:i,currentTabStopId:E,onCurrentTabStopIdChange:D,onEntryFocus:b(l,e=>{S.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,F.jsx)(te,{role:`menu`,"aria-orientation":`vertical`,"data-state":St(v.open),"data-radix-menu-content":``,dir:S.dir,...C,..._,ref:ne,style:{outline:`none`,..._.style},onKeyDown:b(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&L(e.key));let i=O.current;if(e.target!==i||!Te.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);we.includes(e.key)&&a.reverse(),wt(a)}),onBlur:b(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),j.current=``)}),onPointerMove:b(e.onPointerMove,Z(e=>{let t=e.target,n=P.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>P.current?`right`:`left`;N.current=t,P.current=e.clientX}}))})})})})})})});He.displayName=K;var qe=`MenuGroup`,Je=k.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,F.jsx)(h.div,{role:`group`,...r,ref:t})});Je.displayName=qe;var Ye=`MenuLabel`,Xe=k.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,F.jsx)(h.div,{...r,ref:t})});Xe.displayName=Ye;var q=`MenuItem`,Ze=`menu.itemSelect`,J=k.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=k.useRef(null),s=W(q,e.__scopeMenu),c=Ve(q,e.__scopeMenu),l=r(t,o),u=k.useRef(!1),d=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Ze,{bubbles:!0,cancelable:!0});e.addEventListener(Ze,e=>i?.(e),{once:!0}),m(e,t),t.defaultPrevented?u.current=!1:s.onClose()}};return(0,F.jsx)(Qe,{...a,ref:l,disabled:n,onClick:b(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:b(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:b(e.onKeyDown,e=>{n||e.target!==e.currentTarget||c.searchRef.current!==``&&e.key===` `||Se.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});J.displayName=q;var Qe=k.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=Ve(q,n),c=je(n),l=k.useRef(null),u=r(t,l),[d,f]=k.useState(!1),[p,m]=k.useState(``);return k.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,F.jsx)(B.ItemSlot,{scope:n,disabled:i,textValue:a??p,children:(0,F.jsx)(xe,{asChild:!0,...c,focusable:!i,children:(0,F.jsx)(h.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:b(e.onPointerMove,Z(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:b(e.onPointerLeave,Z(e=>s.onItemLeave(e))),onFocus:b(e.onFocus,()=>f(!0)),onBlur:b(e.onBlur,()=>f(!1))})})})}),$e=`MenuCheckboxItem`,et=k.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,F.jsx)(ct,{scope:e.__scopeMenu,checked:n,children:(0,F.jsx)(J,{role:`menuitemcheckbox`,"aria-checked":X(n)?`mixed`:n,...i,ref:t,"data-state":Ct(n),onSelect:b(i.onSelect,()=>r?.(X(n)?!0:!n),{checkForDefaultPrevented:!1})})})});et.displayName=$e;var tt=`MenuRadioGroup`,[nt,rt]=V(tt,{value:void 0,onValueChange:()=>{}}),it=k.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=d(r);return(0,F.jsx)(nt,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,F.jsx)(Je,{...i,ref:t})})});it.displayName=tt;var at=`MenuRadioItem`,ot=k.forwardRef((e,t)=>{let{value:n,...r}=e,i=rt(at,e.__scopeMenu),a=n===i.value;return(0,F.jsx)(ct,{scope:e.__scopeMenu,checked:a,children:(0,F.jsx)(J,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Ct(a),onSelect:b(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ot.displayName=at;var st=`MenuItemIndicator`,[ct,lt]=V(st,{checked:!1}),ut=k.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=lt(st,n);return(0,F.jsx)(C,{present:r||X(a.checked)||a.checked===!0,children:(0,F.jsx)(h.span,{...i,ref:t,"data-state":Ct(a.checked)})})});ut.displayName=st;var dt=`MenuSeparator`,ft=k.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,F.jsx)(h.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});ft.displayName=dt;var pt=`MenuArrow`,mt=k.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=H(n);return(0,F.jsx)(O,{...i,...r,ref:t})});mt.displayName=pt;var ht=`MenuSub`,[gt,_t]=V(ht),vt=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=U(ht,t),o=H(t),[s,c]=k.useState(null),[l,u]=k.useState(null),f=d(i);return k.useEffect(()=>(a.open===!1&&f(!1),()=>f(!1)),[a.open,f]),(0,F.jsx)(D,{...o,children:(0,F.jsx)(Me,{scope:t,open:r,onOpenChange:f,content:l,onContentChange:u,children:(0,F.jsx)(gt,{scope:t,contentId:_(),triggerId:_(),trigger:s,onTriggerChange:c,children:n})})})};vt.displayName=ht;var Y=`MenuSubTrigger`,yt=k.forwardRef((e,t)=>{let n=U(Y,e.__scopeMenu),i=W(Y,e.__scopeMenu),a=_t(Y,e.__scopeMenu),o=Ve(Y,e.__scopeMenu),s=k.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=k.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);k.useEffect(()=>d,[d]),k.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,F.jsx)(G,{asChild:!0,...u,children:(0,F.jsx)(Qe,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":St(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:b(e.onPointerMove,Z(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:b(e.onPointerLeave,Z(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:b(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Ee[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});yt.displayName=Y;var bt=`MenuSubContent`,xt=k.forwardRef((e,t)=>{let n=Re(K,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=U(K,e.__scopeMenu),c=W(K,e.__scopeMenu),l=_t(bt,e.__scopeMenu),u=k.useRef(null),d=r(t,u);return(0,F.jsx)(B.Provider,{scope:e.__scopeMenu,children:(0,F.jsx)(C,{present:i||s.open,children:(0,F.jsx)(B.Slot,{scope:e.__scopeMenu,children:(0,F.jsx)(Ke,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:b(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:b(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:b(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=De[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});xt.displayName=bt;function St(e){return e?`open`:`closed`}function X(e){return e===`indeterminate`}function Ct(e){return X(e)?`indeterminate`:e?`checked`:`unchecked`}function wt(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Dt(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ot(e,t){return t?Dt({x:e.clientX,y:e.clientY},t):!1}function Z(e){return t=>t.pointerType===`mouse`?e(t):void 0}var kt=Pe,At=G,jt=ze,Mt=He,Nt=Je,Pt=Xe,Ft=J,It=et,Lt=it,Rt=ot,zt=ut,Bt=ft,Vt=mt,Ht=vt,Ut=yt,Wt=xt,Q=`DropdownMenu`,[Gt,Kt]=v(Q,[Ae]),$=Ae(),[qt,Jt]=Gt(Q),Yt=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=k.useRef(null),[u,d]=f({prop:i,defaultProp:a??!1,onChange:o,caller:Q});return(0,F.jsx)(qt,{scope:t,triggerId:_(),triggerRef:l,contentId:_(),open:u,onOpenChange:d,onOpenToggle:k.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,F.jsx)(kt,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Yt.displayName=Q;var Xt=`DropdownMenuTrigger`,Zt=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Jt(Xt,n),s=$(n),c=r(t,o.triggerRef);return(0,F.jsx)(At,{asChild:!0,...s,children:(0,F.jsx)(h.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:b(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:b(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Zt.displayName=Xt;var Qt=`DropdownMenuPortal`,$t=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,F.jsx)(jt,{...r,...n})};$t.displayName=Qt;var en=`DropdownMenuContent`,tn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Jt(en,n),a=$(n),o=k.useRef(!1);return(0,F.jsx)(Mt,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:b(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:b(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});tn.displayName=en;var nn=`DropdownMenuGroup`,rn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Nt,{...i,...r,ref:t})});rn.displayName=nn;var an=`DropdownMenuLabel`,on=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Pt,{...i,...r,ref:t})});on.displayName=an;var sn=`DropdownMenuItem`,cn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Ft,{...i,...r,ref:t})});cn.displayName=sn;var ln=`DropdownMenuCheckboxItem`,un=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(It,{...i,...r,ref:t})});un.displayName=ln;var dn=`DropdownMenuRadioGroup`,fn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Lt,{...i,...r,ref:t})});fn.displayName=dn;var pn=`DropdownMenuRadioItem`,mn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Rt,{...i,...r,ref:t})});mn.displayName=pn;var hn=`DropdownMenuItemIndicator`,gn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(zt,{...i,...r,ref:t})});gn.displayName=hn;var _n=`DropdownMenuSeparator`,vn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Bt,{...i,...r,ref:t})});vn.displayName=_n;var yn=`DropdownMenuArrow`,bn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Vt,{...i,...r,ref:t})});bn.displayName=yn;var xn=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=$(t),[s,c]=f({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,F.jsx)(Ht,{...o,open:s,onOpenChange:c,children:n})},Sn=`DropdownMenuSubTrigger`,Cn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Ut,{...i,...r,ref:t})});Cn.displayName=Sn;var wn=`DropdownMenuSubContent`,Tn=k.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,F.jsx)(Wt,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Tn.displayName=wn;var En=Yt,Dn=Zt,On=$t,kn=tn,An=on,jn=cn,Mn=un,Nn=fn,Pn=mn,Fn=gn,In=vn,Ln=xn,Rn=Cn,zn=Tn;function Bn({...e}){return(0,F.jsx)(En,{"data-slot":`dropdown-menu`,...e})}function Vn({...e}){return(0,F.jsx)(On,{"data-slot":`dropdown-menu-portal`,...e})}function Hn({...e}){return(0,F.jsx)(Dn,{"data-slot":`dropdown-menu-trigger`,...e})}function Un({className:e,sideOffset:t=4,...n}){return(0,F.jsx)(On,{children:(0,F.jsx)(kn,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:o(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...n})})}function Wn({className:e,inset:t,variant:n=`default`,...r}){return(0,F.jsx)(jn,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:o(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Gn({className:e,children:t,checked:n,...r}){return(0,F.jsxs)(Mn,{"data-slot":`dropdown-menu-checkbox-item`,className:o(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i({checked:n}),...r,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Fn,{children:(0,F.jsx)(s,{className:`size-4`})})}),t]})}function Kn({...e}){return(0,F.jsx)(Nn,{"data-slot":`dropdown-menu-radio-group`,...e})}function qn({className:e,children:t,...n}){return(0,F.jsxs)(Pn,{"data-slot":`dropdown-menu-radio-item`,className:o(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,F.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Fn,{children:(0,F.jsx)(c,{className:`size-2 fill-current`})})}),t]})}function Jn({className:e,inset:t,...n}){return(0,F.jsx)(An,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:o(`px-2 py-1.5 text-sm font-medium data-[inset]:ps-8`,e),...n})}function Yn({className:e,...t}){return(0,F.jsx)(In,{"data-slot":`dropdown-menu-separator`,className:o(`-mx-1 my-1 h-px bg-border`,e),...t})}function Xn({...e}){return(0,F.jsx)(Ln,{"data-slot":`dropdown-menu-sub`,...e})}function Zn({className:e,inset:t,children:n,...r}){return(0,F.jsxs)(Rn,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:o(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:ps-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(l,{className:`ms-auto size-4`})]})}function Qn({className:e,...t}){return(0,F.jsx)(zn,{"data-slot":`dropdown-menu-sub-content`,className:o(`z-50 min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...t})}export{Jn as a,qn as c,Qn as d,Zn as f,Wn as i,Yn as l,Gn as n,Vn as o,Hn as p,Un as r,Kn as s,Bn as t,Xn as u};
@@ -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,p as i}from"./dist-C_rn70hE.js";import{M as a,Wt as o,cn as s,dn as c,i as l,k as u,l as d,o as f,r as p,s as m}from"./queries-CIeJg62Y.js";import{An as h,G as g,I as _,K as v,Si as y,U as b,hi as x,n as S,q as C}from"./toaster-D0HMoto5.js";import{h as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{F as w,I as T,X as E,Y as D,c as O,ct as k,l as A,ot as j,p as M,r as te}from"./design-icons-CzEoMH9c.js";import{t as ne}from"./chevron-down-CHGyCDBH.js";import{t as N}from"./chevron-right-BENZ-1ZN.js";import{t as P}from"./loader-circle-CPBhhDbB.js";import{t as re}from"./play-CmVAj_fu.js";import{t as F}from"./button-C8jUIs8Q.js";import{a as I,i as L,n as ie,r as R,t as ae}from"./select-Cy2NunWj.js";import{i as z,r as B,t as V}from"./popover-CvL6hQ5c.js";import{r as oe,t as H}from"./project-router-BHFXTx5l.js";import"./attention-V1gJ7gKo.js";import{f as se,v as ce}from"./task-groups-C9pTQm-2.js";import{t as le}from"./status-dot-BXf-Ubd0.js";import{a as ue,o as de,r as fe,s as pe,t as me}from"./command-ppU3xBNs.js";import{c as U,d as W,f as he,m as ge}from"./page-shell-Dky5crRl.js";import{t as G}from"./centered-state-BgSV4e79.js";import{t as _e}from"./use-search-params-writer-ClMScnNe.js";import{An as ve,Bn as ye,Ct as be,Dt as xe,Et as Se,Ot as Ce,Pn as we,Sn as K,St as Te,Tt as Ee,_t as De,bt as Oe,ct as ke,gt as Ae,kt as je,r as Me,s as Ne,vt as Pe,wt as Fe,xt as Ie,yt as Le}from"./index-i4Bu7SvU.js";import{a as Re,d as ze,f as Be,i as Ve,l as He,n as Ue,o as We,r as Ge,s as Ke,t as qe,u as q}from"./use-hand-to-agent-state-DhUiLIQg.js";import{t as Je}from"./tab-link-BYYXdpLn.js";var J=e(t(),1),Ye=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Ye);return e===null?360:Y(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Ye,String(Y(e)))}catch{}}var X=n();function Qe({number:e,repo:t}){let n=i();return(0,X.jsx)($e,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function $e({number:e,repo:t,scope:n}){let i=(0,J.useId)(),o=(0,J.useId)(),[c,l]=(0,J.useState)(!1),u=c?ne:N,d=s(n,!0,n==="default"),f=a(`#${e}`,!0),p=(0,J.useMemo)(()=>Se(ce(d.data??[],f.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[d.data,f.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":i,className:r(`mt-4 min-w-0 rounded-lg border border-border`,c?`p-3`:`p-0.5`),children:[(0,X.jsx)(`h3`,{id:i,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":c,"aria-controls":o,onClick:()=>l(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(u,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,d.data?` (${p.length}${f.hasNextPage||f.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:o,children:c?(0,X.jsxs)(X.Fragment,{children:[d.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry linked tasks`})]}):null,d.data&&p.length===0&&!d.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,p.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:p.map(e=>{let t=ve(e,h(e));return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:se(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(le,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(Me,{"data-slot":`linked-task-archived`,dot:K.tone,shape:K.shape,className:`px-2 py-px`,children:K.label}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,f.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.refetch(),disabled:f.isFetching,children:`Retry older linked tasks`})]}):f.hasNextPage?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void f.fetchNextPage(),disabled:f.isFetchingNextPage,children:f.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var et=`w-44 max-w-full`,Z=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-ring disabled:opacity-60`,Q=`__all__`;function tt(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function nt(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function rt(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function it(e){return[e.viewerLogin?``:`GitHub login unavailable.`,rt(e)].filter(Boolean).join(` `)}function at({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:`${Z} inline-flex items-center gap-1.5`,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function ot({data:e,projectId:t,onProjectChange:n,pickerRef:r}){if(e.projects?.length)return(0,X.jsxs)(ae,{value:t||Q,onValueChange:e=>n(e===Q?``:e),children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":t,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:`All boards`})}),(0,X.jsxs)(ie,{align:`start`,children:[(0,X.jsx)(R,{value:Q,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(R,{value:e.id,"data-board":e.id,children:e.title},e.id))]})]});if(e.projects||e.projectsState){let t=e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`;return(0,X.jsxs)(ae,{disabled:!0,value:Q,children:[(0,X.jsx)(L,{ref:r,"aria-label":`Project board`,"data-slot":`gh-board-filter`,"data-value":``,className:`${Z} ${et} justify-between`,children:(0,X.jsx)(I,{placeholder:t,children:t})}),(0,X.jsx)(ie,{align:`start`,children:(0,X.jsx)(R,{value:Q,children:t})})]})}return null}function st({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(V,{open:i,onOpenChange:a,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Z} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(D,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(B,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function ct({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,J.useState)(!1),s=(0,J.useRef)(null),c=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=tt(e.issues,t),f=nt(e.viewerLogin,t),p=it(e),m=p!==``,h=(0,J.useRef)(p);m&&(h.current=p);let g=(0,J.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,J.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,J.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(at,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsxs)(`button`,{ref:u,type:`button`,"data-slot":`gh-assigned-me`,className:`${Z} inline-flex items-center gap-1.5 rounded-full aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:[(0,X.jsx)(k,{size:14,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`Assigned to me`]}),(0,X.jsx)(ot,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(st,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function lt({onRefresh:e,refreshing:t}){let n=Ae(i());return(0,X.jsx)(W,{route:`github`,density:`full`,headerSpacing:`compact`,header:{title:`GitHub`,secondaryActions:(0,X.jsx)(U,{type:`button`,variant:`ghost`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,children:(0,X.jsx)(D,{size:17,"aria-hidden":`true`,className:r(`size-[17px]`,t&&`motion-safe:animate-spin`)})})},children:(0,X.jsx)(`div`,{"data-slot":`github-filter-screen`,children:(0,X.jsx)(De,{model:n,variant:`screen`})})})}function ut({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a,actions:o}){return{headerSlot:`gh-masthead`,title:n?e===`issues`?`Issues`:`Pull requests`:`GitHub`,scope:n?Pe[t]:void 0,scopeSlot:`gh-title-qualifier`,subtitle:a.repo?(0,X.jsxs)(`span`,{className:`block min-w-0 truncate`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,title:a.syncedAt?new Date(a.syncedAt).toLocaleString():void 0,children:[` `,`· `,a.syncedAt?(0,X.jsx)(we,{iso:a.syncedAt,prefix:`Synced `}):`Not synced yet`]})]}):void 0,secondaryActions:(0,X.jsx)(dt,{...o}),headerExtra:r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`mt-1 flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(te,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-muted-foreground`,children:[...Oe,...Ie].find(e=>e.id===t)?.label})]}):void 0}}function dt({automationsAvailable:e,refreshing:t,onRefresh:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-page-actions`,className:`flex shrink-0 flex-wrap items-center gap-2`,children:[e?(0,X.jsx)(U,{variant:`outline`,asChild:!0,children:(0,X.jsx)(H,{to:`/automations/new`,children:`Set up automations`})}):null,(0,X.jsxs)(U,{type:`button`,variant:`outline`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:t,onClick:n,children:[(0,X.jsx)(D,{size:16,"aria-hidden":`true`,className:r(`size-3.5`,t&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function ft({view:e,number:t}){return(0,X.jsx)(G,{icon:e===`issues`?(0,X.jsx)(M,{size:16}):(0,X.jsx)(w,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function pt({item:e,view:t,filter:n,colors:i,active:a,queued:s,checks:c,comments:l}){let u=e.kind===`issue`?M:w,d=x(),f=()=>{d.prefetchQuery({queryKey:o.githubComments(e.kind,e.number),queryFn:({signal:t})=>v(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(H,{to:be(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Ge(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":a?`page`:void 0,title:`Drag into the composer to prefill a task`,className:r(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,a&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(u,{"aria-hidden":`true`,"data-slot":`gh-row-icon`,className:r(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{"data-slot":`gh-row-title`,className:r(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,a&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{"data-slot":`gh-row-meta`,className:`flex flex-wrap items-center gap-x-1.5 gap-y-1 pl-[22px] text-xs text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[`#`,e.number]}),(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-row-author`,className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)($,{}),(0,X.jsx)(we,{iso:e.createdAt,className:`shrink-0`}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Re,{count:l})]}):null,c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(Ve,{checks:c})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{}),(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`shrink-0 font-sans font-medium text-accent-text`,children:`↗ run queued`})]}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Ke,{label:e,color:i[e],plain:!0},e))}):null]})}function $(){return(0,X.jsx)(`span`,{"data-slot":`gh-row-dot`,"aria-hidden":`true`,className:`shrink-0`,children:`·`})}function mt(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function ht(e){let[t,n]=(0,J.useState)(null);return(0,J.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(mt(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function gt(e,t){let[n,r]=(0,J.useState)(0);return(0,J.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function _t(e,t,n){let[r,i]=(0,J.useState)(null),a=(0,J.useRef)(n);return(0,J.useEffect)(()=>{a.current=n}),(0,J.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function vt(e,t,n,r,i){let[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=ht(a),u=(0,J.useRef)(null);u.current=l;let d=gt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:_t(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}function yt({item:e,queuedRunId:t}){return t?(0,X.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,className:`max-md:h-11 no-hover:h-11`,children:(0,X.jsxs)(H,{to:`/tasks/${t}`,"data-action":`gh-header-view-task`,children:[(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 text-success`}),`Open queued task`]})}):(0,X.jsxs)(F,{type:`button`,variant:`primary`,size:`sm`,"data-action":`gh-header-handoff`,title:`Write the prompt and pick the workflow and runner for this ${e.kind===`pr`?`PR`:`issue`}`,className:`max-md:h-11 no-hover:h-11`,onClick:bt,children:[(0,X.jsx)(re,{"aria-hidden":`true`,className:`size-3.5`}),`Hand to agent`]})}function bt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}var xt=100;function St(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=xt)break;a.add(t.number)}return[...a]}function Ct(e,t,n,r,i,a){let o=St(n,e,r,i,a),s=p(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,u=l(e===`issues`?`issue`:`pr`,(0,J.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),d=(0,J.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>u[e.number]??(d.has(e.number)?void 0:e.comments)}}function wt(e){let[t,n]=_e(),r=t.get(`filter`),i=xe(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function Tt(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)([]),[l,u]=(0,J.useState)([]),{setProjectFilter:d,activeProject:f}=Et(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function Et(e){let[t,n]=(0,J.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,J.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function Dt(e,t,{filter:n,activeFilter:r},a){let o=i(),c=e===`issues`&&(r===`no-task`||r===`has-task`),l=s(o,c,o==="default"),u=(0,J.useMemo)(()=>l.data?Ee(l.data,t?.repo,o):null,[l.data,t?.repo,o]),f=Fe(e,n)?je(n):null,p=d(`pr`,f??``,f!==null&&t?.available===!0),m=f!==null&&p.data?.available?p.data.items:null,h=(0,J.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),g=(0,J.useMemo)(()=>m?Ce(m,h):null,[m,h]),_=Ot({view:e,gh:t,activeFilter:r,isAssignedFilter:a,taskFilter:c,taskNumbers:u,runsQuery:l,backedQuery:f,filterHits:m,filterSearch:p});return{backedQuery:f,filterSearch:p,fullList:h,filterRows:g,filterGate:_,openItems:(0,J.useMemo)(()=>_?[]:g??h,[_,g,h]),narrow:(0,J.useMemo)(()=>e===`issues`?r===`no-task`&&u?{excludeNumbers:u}:r===`has-task`&&u?{includeNumbers:u}:{}:r===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:m?{includeNumbers:new Set(m.map(e=>e.number))}:{},[e,r,u,t?.viewerLogin,m])}}function Ot({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function kt(e,t){return t?C(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function At(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let s=o.github()[0],c=t===void 0?null:Number.parseInt(t,10),l=!r&&n.data?.available?n.data.items.find(e=>e.number===c):void 0,u=i&&c!==null&&!a.some(e=>e.number===c)?i.find(e=>e.number===c):void 0,d=l??u,[f,p]=(0,J.useState)(null);return(0,J.useEffect)(()=>{d&&p({scope:s,view:e,item:d})},[s,e,d]),{selectedNumber:c,remoteDetail:d??(f?.scope===s&&f.view===e&&f.item.number===c?f.item:null)}}function jt(e,t,n,{fullList:r,filterRows:i},a){let s=x(),c=(0,J.useRef)(null),l=e===`issues`?`issue`:`pr`,u=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=f(l,n??0,u),p=u&&d.data?.available&&d.data.item?.kind===l?d.data.item:null;c.current=u&&n!==null?{kind:l,number:n,key:o.githubItem(l,n)}:null;let[m,h]=(0,J.useState)(!1);return{exactWanted:u,exactItem:d,exactDetail:p,exactTargetRef:c,retryingExact:m,retryExact:()=>{h(!0),kt(s,c.current).then(e=>{h(!1),e||S(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function Mt(e,t,n){let r=x(),i=(0,J.useRef)(null);return{refresh:c({mutationFn:e=>(kt(r,e),b({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:o.githubPages(50),exact:!0}),r.setQueryData(o.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:o.githubChecks(t)});let s=e===`issues`?`issue`:`pr`,c=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=o.githubCommentCounts(s,c);r.removeQueries({queryKey:o.githubCommentCounts(s,[]).slice(0,4),predicate:e=>e.queryHash!==y(l)}),a.available&&a.commentsDeferred&&c.length>0&&g(s,c,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:o.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Te)}),r.invalidateQueries({queryKey:o.githubSearch(`pr`,Le)});let u=i.current,d=o.githubComments(`issue`,0).slice(0,3);if(!u){r.removeQueries({queryKey:d});return}let f=o.githubComments(u.kind,u.number);v(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:d,predicate:e=>e.queryHash!==y(f)})},onError:e=>S(e.message,{tone:`danger`})}),openThreadRef:i}}var Nt=350;function Pt(e,t){let[n,r]=(0,J.useState)(e);return(0,J.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ft(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=Pt(n,Nt),u=(0,J.useMemo)(()=>q(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),f=n.trim()===l.trim(),p=t?.available===!0&&!c&&f&&Be(l,u),m=d(e===`issues`?`issue`:`pr`,l,p),h=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),g=p&&m.data?.available?m.data:null,_=new Set(h.map(e=>e.number)),v=It(e,g,a,i);return{debouncedQuery:l,searchWanted:p,forgeSearch:m,items:h,searchPayload:g,metadataFailure:v,searchHits:g&&!v?q(g.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!_.has(e.number)):[],...Lt(n,f,p,m)}}function It(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function Lt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function Rt({width:e,onWidthChange:t}){let n=(0,J.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function zt({view:e,changes:t=!1,index:n=!1}){let{n:r}=ee(),i=wt(e),{rawFilterParam:a,activeFilter:o}=i,s=ge(),{pages:c,data:l}=m(50),d=ye(),f=Vt(),p=qe(),h=Bt({index:n,isDesktop:s,rawFilterParam:a,n:r,rememberedView:u().data?.githubView}),g=Ht(l?.available===!0&&!h.filterScreen),[_,v]=(0,J.useState)(!1),y=Tt(e,l,i),b=Dt(e,l,i,y.isAssignedFilter),x=Ft(e,l,y,b),S=At(e,r,x.forgeSearch,b),C=jt(e,l,S.selectedNumber,b,S.remoteDetail),w=Ct(e,c,l,S.selectedNumber,x.searchHits,b.openItems),{refresh:T,openThreadRef:E}=Mt(e,w.checkPrNumbers,x.debouncedQuery),D=vt(e,c,l,b.backedQuery,y.narrowing);if(h.restorePrs)return(0,X.jsx)(oe,{to:`/github/prs`,replace:!0});if(!l)return c.isError?(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:c.error.message})}):(0,X.jsx)(ke,{});E.current=null;let O=()=>T.mutate(C.exactTargetRef.current);if(h.filterScreen&&l.available)return(0,X.jsx)(lt,{onRefresh:O,refreshing:T.isPending});if(!l.available)return(0,X.jsx)(qt,{reason:l.reason,refreshing:T.isPending,onRetry:O});let{labelColors:k,labelOptions:A}=Ut(l,x.searchPayload,b.openItems,b.fullList),M=Wt({number:S.selectedNumber,items:x.items,searchHits:x.searchHits,fullList:b.fullList,filterRows:b.filterRows,remoteDetail:S.remoteDetail,exactDetail:C.exactDetail});E.current=M?{kind:M.kind,number:M.number}:null;let{linkFilter:te,listPath:ne}=Gt(e,a,o,s),N={view:e,filter:te,colors:k,selected:M,queued:p.queued,checksMap:w.checksMap,commentsOf:w.commentsOf},P=Kt(e,y,b.filterGate,x),re=he(x.items.length+x.searchHits.length);return(0,X.jsx)(W,{rootRef:g.routeRef,route:`github`,density:re,headerSpacing:`compact`,className:`pb-[calc(90px+env(safe-area-inset-bottom))] md:pb-4`,bodyClassName:`gap-2.5`,header:ut({view:e,activeFilter:o,isDesktop:s,rawFilterParam:a,n:r,gh:l,actions:{automationsAvailable:d,refreshing:T.isPending,onRefresh:O}}),children:(0,X.jsxs)(`div`,{ref:g.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":g.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-5`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-4`,children:[(0,X.jsx)(Jt,{view:e,isDesktop:s,gh:l,onSaveView:f}),(0,X.jsx)(Yt,{view:e,gh:l,filters:y,labelOptions:A,labelColors:k,searchPayload:x.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Qt,{view:e,n:r,rows:N,verdict:P,search:x,sidebar:b,list:c,paging:D,width:g.githubListWidth,onWidthChange:g.changeGithubListWidth,expanded:_,onExpandedChange:v}),(0,X.jsx)(an,{view:e,n:r,selected:M,selectedNumber:S.selectedNumber,exact:C,repo:l.repo,rows:N,listPath:ne,changes:t,handToAgent:p})]})]})})}function Bt({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Vt(){let e=x();return t=>{e.setQueryData(o.uiState,e=>({...e,githubView:t})),_({githubView:t}).then(t=>e.setQueryData(o.uiState,t)).catch(t=>{S(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:o.uiState})})}}function Ht(e){let[t,n]=(0,J.useState)(Xe),[r,i]=(0,J.useState)(!0),a=(0,J.useRef)(null),o=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Ut(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:He([...n,...r,...t?.items??[]])}}function Wt({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Gt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:be(e,i??(e===`issues`&&!r?`all`:null))}}function Kt(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function qt({reason:e,refreshing:t,onRetry:n}){return(0,X.jsx)(W,{route:`github`,density:`empty`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(T,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(F,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:n,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in Squawk works without it.`]})})})}function Jt({view:e,isDesktop:t,gh:n,onSaveView:r}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(Je,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>r(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(Je,{to:`/github/prs`,active:e===`prs`,onClick:()=>r(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]})]})}function Yt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(E,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-lg border border-card-edge bg-card shadow-card py-1 pr-2.5 pl-8 text-[13px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(cn,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(ct,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,"data-slot":`gh-clear-filters`,className:`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:border-border disabled:bg-transparent disabled:text-muted-foreground`,onClick:n.clearFilters,children:`Clear filters`})]})}function Xt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Zt(e,t){return(0,X.jsx)(pt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Xt(e,t.checksMap),comments:t.commentsOf(e)})}function Qt({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-card-edge bg-card shadow-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):(0,X.jsx)($t,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(en,{view:e,list:o,paging:s}):null,(0,X.jsx)(tn,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(nn,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-muted-foreground`,children:r}):null,p.length>0?(0,X.jsx)(rn,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(Rt,{width:c,onWidthChange:l})]})}function $t({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Zt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(Ne,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function en({view:e,list:t,paging:n}){return(0,X.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-muted-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function tn({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-muted-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function nn({view:e,n:t,count:n,expanded:r,onExpandedChange:i}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(F,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>i(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function rn({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Zt(e,n)},e.url))})]})}function an({view:e,n:t,selected:n,selectedNumber:i,exact:a,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=a;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:r(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-card-edge bg-card shadow-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(on,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(G,{icon:(0,X.jsx)(P,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${i}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(sn,{number:i,exact:a}):(0,X.jsx)(ft,{view:e,number:i})})}function on({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(We,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(Qe,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:bt,headerAction:(0,X.jsx)(yt,{item:e,queuedRunId:h.get(e.url)??null}),colors:r.colors,checks:Xt(e,r.checksMap),children:(0,X.jsx)(Ue,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function sn({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:i}=t;return(0,X.jsx)(G,{icon:(0,X.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,X.jsx)(F,{variant:`outline`,disabled:r,onClick:i,children:`Retry`})})}function cn({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,J.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(V,{open:a,onOpenChange:o,children:[(0,X.jsx)(z,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:r(`inline-flex min-h-11 min-w-11 shrink-0 items-center gap-1.5 rounded-md border border-input bg-card px-3 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(A,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-muted-foreground`})]})}),(0,X.jsx)(B,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(me,{children:[(0,X.jsx)(ue,{placeholder:`Filter labels…`}),(0,X.jsxs)(pe,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(fe,{children:`No labels.`}),n.length>0?(0,X.jsxs)(de,{value:`__clear__`,onSelect:()=>i([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,X.jsxs)(de,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ze(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{zt as GithubRoute};