@hearsay-tools/squawk 0.19.0-dev.9092 → 0.19.0-dev.9102

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 (63) hide show
  1. package/package.json +4 -4
  2. package/web/dist/assets/{accounts-section-DrA0kndh.js → accounts-section-DL3fIJ3Y.js} +1 -1
  3. package/web/dist/assets/{activity-motion-C23PnhhH.js → activity-motion-nt1FXMrF.js} +1 -1
  4. package/web/dist/assets/{activity-route-CWGPbwtG.js → activity-route-xVy2K_Fi.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-DWZQ2DSW.js → agent-config-section-nFavGeR2.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-Da4tKbp7.js → agent-defaults-section-CN0pC4xG.js} +1 -1
  7. package/web/dist/assets/{appearance-Bm4ePfiH.js → appearance-zGuTSgIy.js} +1 -1
  8. package/web/dist/assets/{archive-on-merge-field-DuRmMR6k.js → archive-on-merge-field-BaKNf-j4.js} +1 -1
  9. package/web/dist/assets/{ask-card-vM_Z-WAg.js → ask-card-huOW3GMV.js} +3 -3
  10. package/web/dist/assets/{automations-route-B8zD3wux.js → automations-route-GBaRU2IS.js} +2 -2
  11. package/web/dist/assets/{commit-list-lwVhwbS8.js → commit-list-x-75vYko.js} +1 -1
  12. package/web/dist/assets/{diff-CC5UqjNZ.js → diff-Bhh_CAtI.js} +2 -2
  13. package/web/dist/assets/{diff-controls-C8KWZ5S-.js → diff-controls-BOnMrLuP.js} +1 -1
  14. package/web/dist/assets/{diff-view-DiuQQoKq.js → diff-view-DiPeQi9D.js} +1 -1
  15. package/web/dist/assets/{discard-changes-dialog-CX7M4k9n.js → discard-changes-dialog-BMofaFwH.js} +1 -1
  16. package/web/dist/assets/{file-preview-C_0CRYAr.js → file-preview-ChwOU1Uc.js} +1 -1
  17. package/web/dist/assets/{git-toolbar-PM540i_A.js → git-toolbar-BdhjSQLm.js} +1 -1
  18. package/web/dist/assets/{github-CeBvZzjo.js → github-DqXXUCBy.js} +1 -1
  19. package/web/dist/assets/{global-activity-route-CiTt7W6o.js → global-activity-route-CZJRu2G1.js} +1 -1
  20. package/web/dist/assets/index-CbSPKU4g.js +21 -0
  21. package/web/dist/assets/{markdown-CqzDs1kO.js → markdown-DMFXz4xY.js} +1 -1
  22. package/web/dist/assets/{option-select-CDOKbUov.js → option-select-Cq_bhgu6.js} +1 -1
  23. package/web/dist/assets/{preferences-section-cdbIMfEU.js → preferences-section-CHhUi72X.js} +1 -1
  24. package/web/dist/assets/{preview-pane-connected-BcU9ryyW.js → preview-pane-connected-DH9rjYI7.js} +2 -2
  25. package/web/dist/assets/{project-location-BpBbcl3v.js → project-location-CSXt_Yk6.js} +1 -1
  26. package/web/dist/assets/{projects-section-CX1WJq4d.js → projects-section-CSBdiEM-.js} +1 -1
  27. package/web/dist/assets/{prompt-templates-section-DrQthAY7.js → prompt-templates-section-DaJbpROr.js} +2 -2
  28. package/web/dist/assets/{remote-settings-notice-_MtFnktv.js → remote-settings-notice-Chx8LxP6.js} +1 -1
  29. package/web/dist/assets/repo-git-D8Sn_897.js +1 -0
  30. package/web/dist/assets/{report-reader-iboN3k6l.js → report-reader-Ccymt9jp.js} +1 -1
  31. package/web/dist/assets/reports-GvAw7DYA.js +1 -0
  32. package/web/dist/assets/{resources-section-BmDbIpaO.js → resources-section-BWqoBxtC.js} +1 -1
  33. package/web/dist/assets/{review-notes-drafts-DXxIudVB.js → review-notes-drafts-BKzyNpXo.js} +1 -1
  34. package/web/dist/assets/{review-panel-BjWbFGev.js → review-panel-DxAlY6hQ.js} +1 -1
  35. package/web/dist/assets/{review-strip-QIghY88F.js → review-strip-QDKNuOm9.js} +1 -1
  36. package/web/dist/assets/run-header-BS7SXYup.js +2 -0
  37. package/web/dist/assets/{select-BxuV2GlN.js → select-DVQEFrtF.js} +1 -1
  38. package/web/dist/assets/{session-context-section-OLW5UTvx.js → session-context-section-YxCcDlRl.js} +2 -2
  39. package/web/dist/assets/{settings-agent-picker-Dasyc6Qo.js → settings-agent-picker-CDyluV99.js} +1 -1
  40. package/web/dist/assets/{settings-save-bar-Mrc6Vm7P.js → settings-save-bar-CMJaZn_P.js} +1 -1
  41. package/web/dist/assets/settings-shell-DHVB7FYt.js +1 -0
  42. package/web/dist/assets/{sidebar-section-CVNvjM29.js → sidebar-section-hphp-63V.js} +1 -1
  43. package/web/dist/assets/{skills-7MwCp2i_.js → skills-BlHcP8uc.js} +1 -1
  44. package/web/dist/assets/{task-changes-DSZjztX7.js → task-changes-DWMFWq5g.js} +1 -1
  45. package/web/dist/assets/{task-commits-P_ElCQ4M.js → task-commits-q5Cn_tdG.js} +1 -1
  46. package/web/dist/assets/{task-file-scope-B63NmSov.js → task-file-scope-BKjO7lKK.js} +1 -1
  47. package/web/dist/assets/{task-files-CSFB6sG7.js → task-files-DbRJAKAg.js} +1 -1
  48. package/web/dist/assets/{task-github-item-BJ1rGyc6.js → task-github-item-DV6uUcx2.js} +1 -1
  49. package/web/dist/assets/{task-thread-C0DbAGi_.js → task-thread-05LMMzIs.js} +1 -1
  50. package/web/dist/assets/{thread-state-B7pyjJYO.js → thread-state-uf_28v2G.js} +1 -1
  51. package/web/dist/assets/{use-finish-run-B1Gy5JPt.js → use-finish-run-BsTPLn1d.js} +1 -1
  52. package/web/dist/assets/{use-hand-to-agent-state-CMyKCFeb.js → use-hand-to-agent-state-DyjrAs-3.js} +1 -1
  53. package/web/dist/assets/use-path-bases-hbJkikc4.js +1 -0
  54. package/web/dist/assets/{workflows-seQiL2pi.js → workflows-B5xr64g0.js} +3 -3
  55. package/web/dist/assets/{workspace-tools-BDf7nsE5.js → workspace-tools-DGlrX2Uj.js} +1 -1
  56. package/web/dist/assets/{worktrees-section-x7r5wRhx.js → worktrees-section-D2bbdi3Y.js} +1 -1
  57. package/web/dist/index.html +1 -1
  58. package/web/dist/assets/index-UFO7Bk2I.js +0 -21
  59. package/web/dist/assets/repo-git-5JS3oL12.js +0 -1
  60. package/web/dist/assets/reports-Cn3kWlK7.js +0 -1
  61. package/web/dist/assets/run-header-BWLcG57S.js +0 -2
  62. package/web/dist/assets/settings-shell-DWRk12-i.js +0 -1
  63. package/web/dist/assets/use-path-bases-wGc__G57.js +0 -1
@@ -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{o as r}from"./dist-C_rn70hE.js";import{Qt as i,Ut as a,Xt as o,b as s,h as c,m as l,nn as u,vt as d}from"./queries-CchoEEzj.js";import{Rn as f,n as p,vi as m}from"./toaster-zMN8cNZQ.js";import{t as h}from"./button-B22ANdCY.js";import{t as g}from"./badge-DVxxThpb.js";import{t as _}from"./centered-state-BgSV4e79.js";import{Bn as v,R as y,Wn as b,vr as x}from"./index-UFO7Bk2I.js";import{n as S,r as C,t as w}from"./remote-settings-notice-_MtFnktv.js";import{t as T}from"./use-path-bases-wGc__G57.js";import{t as E}from"./code-editor-GfQChdgl.js";import{t as D}from"./discard-changes-dialog-CX7M4k9n.js";import{r as O}from"./settings-save-bar-Mrc6Vm7P.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:j(e.id,t)}))}}function N(e){return o(e).map(M)}var P=n();function F(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function I(){let e=l(),t=C(),n=d(),r=u(),a=r.data,o=(0,k.useMemo)(()=>N(a),[a]),s=(0,k.useMemo)(()=>n.data?y(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,k.useState)(`claude`),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),p=t.find(e=>e.id===a)??t[0];if(p===void 0)return null;let m=R(p,e),h=m.find(e=>e.id===s)??z(m),_=e=>{l?f(()=>e):e()},v=e=>{e!==p.id&&_(()=>{o(e),c(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===p.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===p.id,onClick:()=>v(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===p.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),p.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:p.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:p,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){i();return}_(()=>{c(e),i()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:u},h.id):(0,P.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]}),(0,P.jsx)(D,{open:d!==null,subject:h?.label??`this file`,onKeep:()=>f(null),onDiscard:()=>{let e=d;f(null),u(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:i}){let a=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(o=>{let s=t.files.filter(o.files),c=o.showsUserMcp?t.userMcp:void 0;return s.length===0&&!c&&!o.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":o.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:o.label}),o.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.note}),s.length===0&&o.empty&&(0,P.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:o.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,P.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),c&&(0,P.jsx)(H,{userMcp:c,path:b(c.path,a)})]},o.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=c(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:y}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:s,setFormatError:u});return O({dirty:m&&p,save:y,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),s(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(v,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:G(e,n)})]})}function G(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
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{Qt as i,Ut as a,Xt as o,b as s,h as c,m as l,nn as u,vt as d}from"./queries-CchoEEzj.js";import{Rn as f,n as p,vi as m}from"./toaster-zMN8cNZQ.js";import{t as h}from"./button-B22ANdCY.js";import{t as g}from"./badge-DVxxThpb.js";import{t as _}from"./centered-state-BgSV4e79.js";import{Bn as v,R as y,Wn as b,br as x}from"./index-CbSPKU4g.js";import{n as S,r as C,t as w}from"./remote-settings-notice-Chx8LxP6.js";import{t as T}from"./use-path-bases-hbJkikc4.js";import{t as E}from"./code-editor-GfQChdgl.js";import{t as D}from"./discard-changes-dialog-BMofaFwH.js";import{r as O}from"./settings-save-bar-CMJaZn_P.js";var k=e(t(),1);function A(e){return t=>t.runners.includes(e)}function j(e,t){let n=A(e);return e=>n(e)&&e.kind===t}function M(e){let{label:t,note:n,groups:r}=e.agentConfig;return{id:e.id,label:t,note:n,groups:r.map(({id:t,label:n,note:r,empty:i,showsUserMcp:a})=>({id:t,label:n,note:r,...i?{empty:i}:{},...a?{showsUserMcp:a}:{},files:j(e.id,t)}))}}function N(e){return o(e).map(M)}var P=n();function F(e){return e.seeded?`Copied into each run’s worktree — takes effect on your next run.`:e.tracked===`tracked`?`Runs read the committed copy — this edit applies after you commit it.`:e.tracked===`outside-repo`?`Applies to every session on this machine.`:`Personal, git-ignored.`}function I(){let e=l(),t=C(),n=d(),r=u(),a=r.data,o=(0,k.useMemo)(()=>N(a),[a]),s=(0,k.useMemo)(()=>n.data?y(n.data.checks,a):i(a),[n.data,a]);return r.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Runners did not load`,subtitle:r.error.message,heading:`h2`}):e.isError?(0,P.jsx)(_,{icon:(0,P.jsx)(x,{}),tone:`danger`,title:`Agent config did not load`,subtitle:e.error.message,heading:`h2`}):e.isPending||a===void 0?(0,P.jsx)(`p`,{"data-slot":`agent-config-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent config…`}):(0,P.jsx)(L,{listing:e.data,descriptors:o,installed:s,onOpenFile:t})}function L({listing:e,descriptors:t,installed:n,onOpenFile:i}){let[a,o]=(0,k.useState)(`claude`),[s,c]=(0,k.useState)(null),[l,u]=(0,k.useState)(!1),[d,f]=(0,k.useState)(null),p=t.find(e=>e.id===a)??t[0];if(p===void 0)return null;let m=R(p,e),h=m.find(e=>e.id===s)??z(m),_=e=>{l?f(()=>e):e()},v=e=>{e!==p.id&&_(()=>{o(e),c(null)})};return(0,P.jsxs)(`div`,{"data-slot":`agent-config`,className:`flex flex-col gap-5 p-4 md:p-6`,children:[(0,P.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Edit project, local, and user-wide config files for each coding agent.`}),!e.editable&&(0,P.jsxs)(`div`,{"data-slot":`agent-config-readonly`,className:`rounded-md border border-border bg-muted/40 px-3 py-2 text-[13px] text-muted-foreground`,children:[`Read-only: this remote cockpit cannot edit agent config. You can still see every file and which one wins. To edit here, the host operator runs `,(0,P.jsx)(`code`,{children:w}),`.`]}),(0,P.jsx)(S,{risk:`Agent config can define hooks and MCP servers that run commands on the machine running Squawk`}),(0,P.jsx)(`div`,{"data-slot":`agent-config-agents`,role:`tablist`,className:`flex flex-wrap gap-1`,children:t.map(e=>(0,P.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":e.id===p.id,"data-slot":`agent-config-agent`,"data-agent":e.id,"data-selected":e.id===p.id,onClick:()=>v(e.id),className:r(`flex min-w-11 items-center justify-center gap-2 rounded-md px-3 py-1.5 text-[13px] transition-colors`,e.id===p.id?`bg-background font-semibold shadow-sm`:`hover:bg-muted/60`),children:[e.label,!n.includes(e.id)&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs text-soft-foreground`,children:`Not installed`})]},e.id))}),p.note&&(0,P.jsx)(`p`,{"data-slot":`agent-config-agent-note`,className:`text-xs text-muted-foreground`,children:p.note}),(0,P.jsxs)(`div`,{className:`grid min-w-0 gap-6 lg:grid-cols-[minmax(17rem,24rem)_minmax(0,1fr)]`,children:[(0,P.jsx)(`nav`,{"data-slot":`agent-config-nav`,className:`flex min-w-0 flex-col gap-5`,children:(0,P.jsx)(V,{agent:p,listing:e,selectedId:h?.id??null,onSelect:e=>{if(e===h?.id){i();return}_(()=>{c(e),i()})}})}),(0,P.jsx)(`div`,{"data-slot":`agent-config-editor-pane`,className:`min-w-0`,children:h?(0,P.jsx)(U,{file:h,onDirtyChange:u},h.id):(0,P.jsx)(`p`,{"data-slot":`agent-config-editor-empty`,className:`rounded-md border border-border bg-muted/40 px-4 py-3 text-[13px] text-soft-foreground`,children:`This agent has no config files to show.`})})]}),(0,P.jsx)(D,{open:d!==null,subject:h?.label??`this file`,onKeep:()=>f(null),onDiscard:()=>{let e=d;f(null),u(!1),e?.()}})]})}function R(e,t){return e.groups.flatMap(e=>t.files.filter(e.files))}function z(e){return e.find(e=>e.scope===`project`)??e[0]??null}var B={project:`Project scope`,local:`Local scope`,user:`User scope`};function V({agent:e,listing:t,selectedId:n,onSelect:i}){let a=T();return(0,P.jsx)(P.Fragment,{children:e.groups.map(o=>{let s=t.files.filter(o.files),c=o.showsUserMcp?t.userMcp:void 0;return s.length===0&&!c&&!o.empty?null:(0,P.jsxs)(`section`,{"data-slot":`agent-config-group`,"data-group":o.id,"data-agent":e.id,children:[(0,P.jsx)(`p`,{className:`mb-1 text-xs font-medium uppercase tracking-wide text-soft-foreground`,children:o.label}),o.note&&(0,P.jsx)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:o.note}),s.length===0&&o.empty&&(0,P.jsx)(`p`,{"data-slot":`agent-config-group-empty`,className:`rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground`,children:o.empty}),(0,P.jsx)(`ul`,{className:`flex flex-col gap-1`,children:s.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,"data-slot":`agent-config-file`,"data-selected":e.id===n,onClick:()=>i(e.id),title:e.label,className:r(`flex w-full flex-col items-start gap-1 rounded-md px-2 py-1.5 text-left text-[13px] transition-colors`,e.id===n?`bg-accent-strong/15 text-foreground`:`hover:bg-muted/60`),children:[(0,P.jsx)(`span`,{"data-slot":`agent-config-file-name`,className:`min-w-0 max-w-full break-all font-mono text-[12px]`,children:e.label}),e.seeded||!e.exists?(0,P.jsxs)(`span`,{"data-slot":`agent-config-file-meta`,className:`flex flex-wrap items-center gap-1.5`,children:[e.seeded&&(0,P.jsx)(g,{variant:`outline`,className:`text-xs`,children:`Default template`}),!e.exists&&(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Not created`})]}):null]})},e.id))}),c&&(0,P.jsx)(H,{userMcp:c,path:b(c.path,a)})]},o.id)})})}function H({userMcp:e,path:t}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-user-mcp`,className:`mt-3`,children:[(0,P.jsx)(`h4`,{className:`mb-1 text-[12px] font-semibold`,children:`User & local scopes`}),(0,P.jsxs)(`p`,{className:`mb-2 text-xs text-muted-foreground`,children:[`Managed by `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-command`,className:`whitespace-nowrap font-mono`,children:`claude mcp add`}),` in`,` `,(0,P.jsx)(`code`,{"data-slot":`agent-config-user-mcp-path`,title:e.path,className:`break-all font-mono text-foreground`,children:t}),` — Squawk does not edit Claude’s state file.`]}),e.readable?e.servers.length>0?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1`,children:e.servers.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(g,{variant:`outline`,className:`font-mono text-xs`,children:e})},e))}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No user-scoped MCP servers.`}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Could not read the file.`})]})}function U({file:e,onDirtyChange:t}){let n=c(e.id),r=T(),[i,a]=(0,k.useState)(null),[o,s]=(0,k.useState)(!1),[l,u]=(0,k.useState)(null),d=n.data?.version??null,f=i??n.data?.content??``,p=n.data?f!==n.data.content:!1,m=e.writable,h=e.kind===`mcp`||e.holdsMcp,_=m&&p;(0,k.useEffect)(()=>{t?.(_)},[_,t]),(0,k.useEffect)(()=>()=>t?.(!1),[t]);let{save:y}=J({file:e,content:f,loadedVersion:d,setDraft:a,setConflict:s,setFormatError:u});return O({dirty:m&&p,save:y,discard:()=>a(null)}),(0,k.useEffect)(()=>{n.data&&(a(n.data.content),s(!1),u(null))},[n.data?.version,n.data]),(0,P.jsxs)(`div`,{"data-slot":`settings-config-editor`,"data-reports-dirty":``,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h3`,{className:`text-sm`,children:`Configuration file`}),(0,P.jsx)(g,{variant:`outline`,"data-slot":`agent-config-scope`,"data-scope":e.scope,className:`text-[12px]`,children:B[e.scope]})]}),(0,P.jsx)(v,{"data-slot":`agent-config-path`,value:e.path,bases:r,className:`text-xs text-foreground`}),(0,P.jsxs)(`div`,{className:`settings-readout flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.label}),(0,P.jsx)(g,{variant:`outline`,className:`text-[12px] uppercase`,children:e.format}),(0,P.jsx)(`a`,{href:e.docsUrl,target:`_blank`,rel:`noreferrer`,className:`text-[12px] text-soft-foreground underline hover:text-foreground`,children:`docs`})]}),(0,P.jsxs)(`div`,{className:`settings-config-content-heading`,children:[(0,P.jsx)(`h3`,{children:h?`MCP configuration`:`File contents`}),h&&(0,P.jsx)(`p`,{children:`Review server commands before saving. MCP servers execute locally.`})]}),n.isPending?(0,P.jsx)(`p`,{className:`text-[13px] text-soft-foreground`,children:`Loading file…`}):n.isError?(0,P.jsx)(`p`,{className:`text-[13px] text-destructive`,children:n.error.message}):(0,P.jsx)(W,{file:e,content:f,isMcp:h,onChange:a}),(0,P.jsx)(K,{formatError:l,conflict:o,onReload:()=>void n.refetch()}),m&&!e.exists&&!p?(0,P.jsx)(`p`,{"data-slot":`agent-config-save-cue`,className:`text-xs text-muted-foreground`,children:`Enter content above to create this file.`}):null,(0,P.jsxs)(`div`,{className:`settings-config-save-help`,children:[(0,P.jsx)(`p`,{"data-slot":`agent-config-precedence`,className:`text-xs text-muted-foreground`,children:e.precedence}),(0,P.jsxs)(`p`,{"data-slot":`agent-config-effect`,className:`text-xs text-foreground`,children:[F(e),e.hotReload?` ${e.hotReload}`:``]}),(0,P.jsx)(q,{reason:e.readOnlyReason})]})]})}function W({file:e,content:t,isMcp:n,onChange:r}){return(0,P.jsxs)(`div`,{"data-slot":`agent-config-editor-frame`,className:`relative`,children:[(0,P.jsx)(E,{value:t,language:e.format,readOnly:!e.writable,onChange:r,"aria-label":`${e.label} contents`,className:`h-[210px]`}),!e.exists&&t===``&&(0,P.jsx)(`pre`,{"data-slot":`agent-config-placeholder`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-px m-0 overflow-hidden whitespace-pre px-3 py-2 font-mono text-xs leading-[1.7] text-soft-foreground`,children:G(e,n)})]})}function G(e,t){switch(e.format){case`json`:case`jsonc`:return`// File not created yet — example:\n${t?`{
2
2
  "mcpServers": {}
3
3
  }`:`{
4
4
  "permissions": {}
@@ -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{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-CchoEEzj.js";import{I as b,Or as x,Rn as S,Zt as ee,a as C,n as w,vi as T,vn as E}from"./toaster-zMN8cNZQ.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-B22ANdCY.js";import{t as k}from"./switch-CAKeV99j.js";import{t as A}from"./status-dot-Drd4-nfa.js";import{n as j}from"./agent-accounts-D_7QcFSx.js";import{t as M}from"./centered-state-BgSV4e79.js";import{L as N,Pn as P,V as F,z as I}from"./index-UFO7Bk2I.js";import{t as te}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-CDOKbUov.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-Dasyc6Qo.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-Bhh8I9fJ.js";import{r as G}from"./settings-save-bar-Mrc6Vm7P.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>w(`${e.displayName} can be tried again.`),onError:e=>w(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=h(),t=o(),n=v(),r=m(),i=T(),[a,s]=(0,q.useState)(null),d=(0,q.useRef)(Promise.resolve()),f=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,q.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=X(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await E(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=X(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?X(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,X(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),w(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),C=g({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{s(null),w(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}w(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),w(`Command copied`)}catch{w(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=re(o,t.isPending),c=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:s.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:b})]}),l===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,J.jsx)(se,{manual:a,provider:e.id,connected:o===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(M,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=T(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>w(e.message,{tone:`danger`})}),[u,d]=K(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Z;G({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=H(),_=H(),v=H(),y=H(),x=H(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,J.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,J.jsx)(W,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),s=t[i.id],l=I(i.id,r,s),u=F(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:N,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:f.length,overLimit:m})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=C(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=j(c.data,u.projectId,m),v=h().data,b=B(c.data?.profiles??[],v),S=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>w(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,S?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{le as AgentDefaultsSection};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,Qt as i,S as a,St as o,Ut as s,Wt as c,Xt as l,Yt as u,an as d,g as f,in as p,kt as m,nn as h,un as g,ut as _,wt as v,xt as y}from"./queries-CchoEEzj.js";import{I as b,Or as x,Rn as S,Zt as ee,a as C,n as w,vi as T,vn as E}from"./toaster-zMN8cNZQ.js";import{c as D}from"./design-icons-QbNMZniQ.js";import{t as O}from"./button-B22ANdCY.js";import{t as k}from"./switch-CAKeV99j.js";import{t as A}from"./status-dot-Drd4-nfa.js";import{n as j}from"./agent-accounts-D_7QcFSx.js";import{t as M}from"./centered-state-BgSV4e79.js";import{L as N,Pn as P,V as F,z as I}from"./index-CbSPKU4g.js";import{t as te}from"./textarea-vEsJAUAV.js";import{t as L}from"./option-select-Cq_bhgu6.js";import{a as ne,i as R,n as z,r as B,t as V}from"./settings-agent-picker-CDyluV99.js";import{n as H,t as U}from"./save-cue-CpHgT93o.js";import{n as W}from"./settings-field-Bhh8I9fJ.js";import{r as G}from"./settings-save-bar-CMJaZn_P.js";import{n as K}from"./saved-draft-BwzBc-_Y.js";var q=e(t(),1),J=n(),Y={connected:P(`connected`),disconnected:P(`disconnected`),"not-installed":P(`not-installed`),unknown:P(`unknown`)};function X(e,t,n){return{providers:e.providers.map(e=>e.provider===t?{...e,enabled:n}:e)}}function re(e,t){return e?Y[e]:t?{label:`Checking…`,tone:`neutral`}:Y.unknown}function ie(e,t){return e===`unknown`||t&&!e}function ae({provider:e,state:t,current:n,statusIsError:r}){return t===`not-installed`?(0,J.jsxs)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:[`Install `,e.displayName,`, then run `,(0,J.jsx)(`code`,{children:e.loginCommand}),`.`]}):ie(t,r)?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Verification failed. Check again when the provider is available.`}):n?.hint?(0,J.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:n.hint}):null}function oe({provider:e,state:t,current:n,isConnecting:r,incidentId:i,refresh:a,connect:o,retry:s,queueToggle:c}){let l=t===`disconnected`||t===`unknown`,u=H();return(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t===`not-installed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{saved:u.saved}),(0,J.jsx)(k,{checked:n?.enabled??!0,"aria-label":`Use ${e.displayName}`,onCheckedChange:t=>c(e.id,t,u.flash)})]}),l?(0,J.jsx)(O,{type:`button`,variant:`ghost`,size:`sm`,disabled:a.isPending,onClick:()=>a.mutate(void 0,{onError:e=>w(e.message,{tone:`danger`})}),children:`Check again`}):null,t===`disconnected`&&e.browserLogin?(0,J.jsx)(z,{provider:e.id,label:e.displayName}):null,t===`disconnected`&&e.terminalLogin!==!1?(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:o.isPending,onClick:()=>o.mutate(e.id),children:r?`Opening…`:`Connect`}):null,i===void 0?null:(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:s.isPending,onClick:()=>s.mutate({provider:e.id,authFailureId:i},{onSuccess:()=>w(`${e.displayName} can be tried again.`),onError:e=>w(e.message,{tone:`danger`})}),children:`Try again`})]})}function se({manual:e,provider:t,connected:n,onCopy:r}){return e===null||e.provider!==t||n?null:(0,J.jsxs)(`div`,{role:`region`,"aria-label":`${e.label} manual sign-in`,className:`rounded-md border border-pending/40 bg-pending/5 px-3.5 py-3`,children:[(0,J.jsx)(`p`,{className:`text-[13px] text-foreground`,children:e.message}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded-sm bg-muted px-2 py-1.5 text-xs`,children:e.command}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void r(e.command),children:`Copy command`})]})]})}function ce(){let e=h(),t=o(),n=v(),r=m(),i=T(),[a,s]=(0,q.useState)(null),d=(0,q.useRef)(Promise.resolve()),f=(0,q.useRef)({}),_=(0,q.useRef)({}),y=(0,q.useRef)(t.data);(0,q.useEffect)(()=>{a&&x(t.data,a.provider)?.status===`connected`&&s(null)},[a,t.data]),(0,q.useEffect)(()=>{if(t.data){if(Object.values(_.current).every(e=>e===0)||!y.current){y.current=t.data;return}y.current={providers:t.data.providers.map(e=>({...e,enabled:(_.current[e.provider]??0)>0?x(y.current,e.provider)?.enabled??e.enabled:e.enabled}))}}},[t.data]);let b=(0,q.useCallback)((e,t,n)=>{let r=c.providerStatus,a=i.getQueryData(r);if(!a)return;y.current||=a;let o=X(a,e,t);_.current[e]=(_.current[e]??0)+1,i.setQueryData(r,o);let s=(f.current[e]??0)+1;f.current[e]=s,d.current=d.current.then(async()=>{try{let a=await E(e,t),o=x(a,e)?.enabled;if(o===void 0)return;if(y.current=X(y.current??a,e,o),s===f.current[e]){let t=i.getQueryData(r);i.setQueryData(r,t?X(t,e,o):a),n()}}catch(t){if(s===f.current[e]){let n=x(y.current,e)?.enabled,a=i.getQueryData(r);a&&n!==void 0?i.setQueryData(r,X(a,e,n)):y.current?i.setQueryData(r,y.current):i.removeQueries({queryKey:r,exact:!0}),w(t instanceof Error?t.message:String(t),{tone:`danger`})}}finally{_.current[e]=(_.current[e]??0)-1}})},[i]),C=g({mutationFn:e=>ee(e),onSuccess:async(e,t)=>{s(null),w(e.opened?`Finish signing in in the terminal, then check again.`:`Provider is already connected.`),await i.invalidateQueries({queryKey:c.providerStatus}),await p(i,t,`none`)},onError:(t,n)=>{if(t instanceof S&&t.command){let r=u(e.data,n);s({provider:n,label:r,message:t.message,command:t.command});return}w(t.message,{tone:`danger`})}}),D=async e=>{try{await navigator.clipboard.writeText(e),w(`Command copied`)}catch{w(`Could not copy the command`,{tone:`danger`})}};return(0,J.jsxs)(`section`,{id:`providers`,"data-slot":`provider-settings`,className:`scroll-mt-20`,children:[(0,J.jsxs)(`div`,{className:`mb-2`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Providers`}),(0,J.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Connect the coding agents available on this computer.`})]}),t.isError?(0,J.jsxs)(`div`,{role:`alert`,className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border border-danger/30 bg-danger/5 px-3 py-2.5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:`Provider status could not be loaded`}),(0,J.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.error.message})]}),(0,J.jsx)(O,{type:`button`,variant:`outline`,size:`sm`,disabled:t.isFetching,onClick:()=>void t.refetch(),children:`Retry`})]}):null,(0,J.jsx)(`div`,{className:`flex flex-col gap-2`,children:l(e.data).map(e=>{let i=x(t.data,e.id),o=i?.status,s=re(o,t.isPending),c=C.isPending&&C.variables===e.id,l=i?.authFailureId;return(0,J.jsxs)(q.Fragment,{children:[(0,J.jsxs)(`div`,{"data-slot":`provider-card`,"data-provider":e.id,className:`rounded-md border border-border bg-card px-3.5 py-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-[13px] font-semibold text-foreground`,children:e.displayName}),(0,J.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,J.jsx)(A,{tone:s.tone,pulse:t.isPending}),(0,J.jsx)(`span`,{children:s.label}),i?.enabled===!1?(0,J.jsx)(`span`,{children:`Disabled`}):null]}),(0,J.jsx)(ae,{provider:e,state:o,current:i,statusIsError:t.isError})]}),(0,J.jsx)(oe,{provider:e,state:o,current:i,isConnecting:c,incidentId:l,refresh:n,connect:C,retry:r,queueToggle:b})]}),l===void 0?null:(0,J.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Use this after completing the provider sign-in flow. Squawk cannot validate the credential without a task/model request; it will verify it on the next task.`})]}),(0,J.jsx)(se,{manual:a,provider:e.id,connected:o===`connected`,onCopy:D})]},e.id)})})]})}var Z=2e4;function le(){let e=f(),t=h(),n=d(i(t.data)),r=o();return e.isPending?(0,J.jsx)(`p`,{"data-slot":`agents-loading`,className:`p-4 text-[13px] text-soft-foreground md:p-6`,children:`Loading agent settings…`}):e.isError?(0,J.jsx)(M,{icon:(0,J.jsx)(D,{}),tone:`danger`,title:`Agent settings did not load`,subtitle:e.error.message,heading:`h2`}):(0,J.jsx)(ue,{config:e.data,catalogs:n,providerStatus:r,runners:t.data})}function ue({config:e,catalogs:t,providerStatus:n,runners:r}){let i=a(),o=T(),c=g({mutationFn:e=>b(e),onSuccess:e=>{o.setQueryData(s.config,e),o.invalidateQueries({queryKey:s.health}),o.invalidateQueries({queryKey:s.repo})},onError:e=>w(e.message,{tone:`danger`})}),[u,d]=K(e.systemPrompt??``),f=u.trim(),p=f===(e.systemPrompt??``),m=f.length>Z;G({dirty:!p,invalid:m,busy:c.isPending,save:()=>c.mutateAsync({systemPrompt:f===``?null:f}),discard:()=>d(e.systemPrompt??``)});let h=H(),_=H(),v=H(),y=H(),x=H(),S=(e,t)=>c.mutate(e,{onSuccess:t});return(0,J.jsxs)(`div`,{"data-slot":`agent-defaults-section`,className:`mx-auto flex w-full max-w-2xl flex-col gap-7 p-4 pb-[calc(90px+env(safe-area-inset-bottom))] md:p-6 md:pb-6`,children:[(0,J.jsx)(Q,{defaultRunner:e.defaultRunner,providerStatus:n,saving:c.isPending,saved:h.saved,onSaved:h.flash,onPick:e=>S({defaultRunner:e},h.flash)}),(0,J.jsx)(W,{wide:!0,title:`Default model`,hint:e.modelsLocked?`Models are locked to the defaults configured in the native coding-agent settings.`:`The model preselected in the composer for each runner. Runner default lets the runner decide per task.`,saved:e.modelsLocked?void 0:_.saved,children:(0,J.jsx)(`div`,{"data-slot":`agents-model-rows`,className:`flex flex-col gap-2.5`,children:l(r).map(i=>{let{providerConnected:a,providerReason:o}=ne(n,i.id),s=t[i.id],l=I(i.id,r,s),u=F(i.id,r,s?.data,[e.defaultModels[i.id]]),d=e.defaultModels[i.id]??``,f=u.find(e=>e.id===d)?.label??d??`Runner default`;return(0,J.jsxs)(`label`,{className:`settings-option-row`,children:[(0,J.jsx)(`div`,{children:(0,J.jsx)(`h3`,{children:i.displayName})}),e.modelsLocked?(0,J.jsx)(`output`,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,title:`Model selection is locked to native coding-agent settings.`,className:`block rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs`,children:f}):(0,J.jsx)(L,{"aria-label":`Default model for ${i.pickerLabel}`,"data-slot":`agents-model`,"data-runner":i.id,value:d,title:o??i.pickerDescription,disabled:c.isPending||!a,onValueChange:e=>S({defaultModels:{[i.id]:e||null}},_.flash),className:`settings-select max-w-full bg-card`,options:[...u.map(e=>({value:e.id,label:e.label})),...l?[{value:N,label:l,disabled:!0}]:[]]})]},i.id)})})}),(0,J.jsxs)(W,{wide:!0,title:`System prompt`,hint:`Extra instructions for every run in this project.`,reportsDirty:!0,children:[(0,J.jsx)(te,{"aria-label":`System prompt`,"data-slot":`agents-system-prompt`,value:u,onChange:e=>d(e.target.value),placeholder:`Extra rules for every agent run — conventions, tone, review requirements…`,className:`min-h-48 w-full`}),(0,J.jsx)(de,{length:f.length,overLimit:m})]}),(0,J.jsxs)(`section`,{"data-slot":`agents-task-runs`,className:`settings-field flex flex-col gap-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:`Task runs`}),(0,J.jsx)($,{title:`Live title updates`,hint:`Refresh a task's short title through the namer model as the run progresses. A manual rename always wins and stops updates for that task.`,saved:v.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Live title updates`,"data-slot":`agents-live-title-updates`,checked:e.liveTitleUpdates??!0,disabled:c.isPending,onCheckedChange:e=>S({liveTitleUpdates:e},v.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.liveTitleUpdates??!0?`On`:`Off`,e.liveTitleUpdates===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Review changes before finishing`,hint:`When on, a task with changes pauses so you can Accept, Send back, or open a Draft PR. Autonomous tasks always skip this and finish on their own. Default: off — tasks finish without asking.`,saved:y.saved,children:(0,J.jsxs)(`label`,{className:`flex w-fit items-center gap-3`,children:[(0,J.jsx)(k,{"aria-label":`Review changes before finishing`,"data-slot":`agents-review-gate`,checked:e.reviewGate??!1,disabled:c.isPending,onCheckedChange:e=>S({reviewGate:e},y.flash)}),(0,J.jsxs)(`span`,{className:`text-[13px] text-muted-foreground`,children:[e.reviewGate??!1?`On`:`Off`,e.reviewGate===null&&` (default)`]})]})}),(0,J.jsx)($,{title:`Base branch`,hint:`New task worktrees branch from this and draft PRs target it. Also settable from the Git view.`,saved:x.saved,children:i.data?.info?(0,J.jsx)(L,{"aria-label":`Base branch`,"data-slot":`agents-base-branch`,value:e.baseBranch??``,disabled:c.isPending,onValueChange:e=>S({baseBranch:e||null},x.flash),className:`settings-select max-w-full bg-card`,options:[{value:``,label:`follow checked-out branch (default)`},...i.data.branches.map(e=>({value:e,label:e}))]}):(0,J.jsx)(`p`,{"data-slot":`agents-base-branch-unavailable`,className:`text-[13px] text-soft-foreground`,children:i.isPending?`Loading branches…`:`Not a git repository — tasks run in place, no branching.`})})]}),(0,J.jsxs)(`details`,{className:`settings-disclosure`,children:[(0,J.jsx)(`summary`,{children:`Provider connections`}),(0,J.jsx)(ce,{})]})]})}function Q({defaultRunner:e,providerStatus:t,saving:n,saved:i,onSaved:o,onPick:s}){let c=_(),l=y(),u=C(),d=a(),f=r(),p=u.projectId??`default`,m=d.data?.info?.root,g=j(c.data,u.projectId,m),v=h().data,b=B(c.data?.profiles??[],v),S=R(b,v);return(0,J.jsxs)(W,{title:`Default runner`,hint:`Project defaults. A task can override these choices.`,saved:i,children:[(0,J.jsx)(V,{rows:b,runner:e,accountFor:e=>g?.[e]??null,providerStatus:t,disabled:n,accountDisabled:f.isPending||l.data===void 0,onPick:(t,n,r)=>{t!==e&&s(t),r&&f.mutate({projectId:p,provider:t,profileId:n},{onSuccess:o,onError:e=>w(e.message,{tone:`danger`})})}}),!t.isPending&&!t.isError&&x(t.data,e)?.enabled===!1?(0,J.jsx)(`p`,{"data-slot":`agents-runner-disabled`,className:`text-[13px] text-muted-foreground`,children:`This provider is disabled. Enable it above or choose another provider.`}):null,S?(0,J.jsx)(`p`,{className:`max-w-md text-[13px] text-muted-foreground`,children:`The account is personal and never committed. Tasks already started under another account can’t be resumed here — their sessions live in that account’s folder.`}):null]})}function $({title:e,hint:t,saved:n,children:r}){return(0,J.jsxs)(`section`,{className:`settings-option-row`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{children:e}),(0,J.jsxs)(`p`,{children:[t,` `,(0,J.jsx)(U,{saved:n})]})]}),r]})}function de({length:e,overLimit:t}){return(0,J.jsx)(J.Fragment,{children:t?(0,J.jsxs)(`p`,{"data-slot":`agents-prompt-limit`,className:`text-xs text-danger`,children:[e.toLocaleString(),` characters — the limit is `,Z.toLocaleString(),`.`]}):(0,J.jsx)(`p`,{"data-slot":`agents-prompt-help`,className:`text-xs text-muted-foreground`,children:`Leave empty and save to clear. Applied to new runs only.`})})}export{le as AgentDefaultsSection};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{xt as n}from"./queries-CchoEEzj.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-B22ANdCY.js";import{On as s,nr as c,yt as l}from"./index-UFO7Bk2I.js";import{n as u}from"./save-cue-CpHgT93o.js";import{n as d}from"./settings-field-Bhh8I9fJ.js";var f=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),p=e(),m=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:f},{value:`dark`,label:`Dark`,icon:a}],h=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],g=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function v({slot:e,label:n,value:r,options:i,onChange:a}){return(0,p.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,p.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,p.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function y(){let e=n(),{order:t,canReorder:r,reset:i}=s();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,p.jsx)(d,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,p.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function b(){let{theme:e,setTheme:t}=c(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=l(),f=u(),b=u(),x=u(),S=u(),C=e=>t=>{t&&e()};return(0,p.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,p.jsx)(d,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,saved:f.saved,children:(0,p.jsx)(v,{slot:`appearance-theme`,label:`Theme`,value:e,options:m,onChange:e=>{t(e)&&f.flash()}})}),h.length>1?(0,p.jsx)(d,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,saved:b.saved,children:(0,p.jsx)(v,{slot:`appearance-accent`,label:`Accent`,value:n,options:h,onChange:e=>void a(e).then(C(b.flash))})}):null,(0,p.jsx)(d,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,saved:x.saved,children:(0,p.jsx)(v,{slot:`appearance-density`,label:`Density`,value:r,options:g,onChange:e=>void o(e).then(C(x.flash))})}),(0,p.jsx)(d,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,saved:S.saved,children:(0,p.jsx)(v,{slot:`appearance-width`,label:`Reading width`,value:i,options:_,onChange:e=>void s(e).then(C(S.flash))})}),(0,p.jsx)(y,{}),(0,p.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,p.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,p.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,p.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{b as AppearanceSection};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{o as t}from"./dist-C_rn70hE.js";import{xt as n}from"./queries-CchoEEzj.js";import{t as r}from"./createLucideIcon-BHp8sXmF.js";import{n as i,t as a}from"./moon-CRE9nU5R.js";import{t as o}from"./button-B22ANdCY.js";import{On as s,ir as c,yt as l}from"./index-CbSPKU4g.js";import{n as u}from"./save-cue-CpHgT93o.js";import{n as d}from"./settings-field-Bhh8I9fJ.js";var f=r(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),p=e(),m=[{value:`system`,label:`System`,icon:i},{value:`light`,label:`Light`,icon:f},{value:`dark`,label:`Dark`,icon:a}],h=[{value:`cezarion`,label:`Squawk`,swatch:`var(--accent-strong)`}],g=[{value:`comfortable`,label:`Comfortable`},{value:`compact`,label:`Compact`},{value:`ultra`,label:`Ultra-compact`}],_=[{value:`narrow`,label:`Narrow`},{value:`wide`,label:`Wide`}];function v({slot:e,label:n,value:r,options:i,onChange:a}){return(0,p.jsx)(`div`,{role:`radiogroup`,"aria-label":n,"data-slot":e,className:`inline-flex w-fit gap-0.5 rounded-lg border border-border bg-muted/60 p-1 max-md:max-w-full max-md:flex-wrap`,children:i.map(e=>{let n=e.value===r;return(0,p.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"data-value":e.value,onClick:()=>a(e.value),className:t(`flex min-h-11 items-center gap-2 whitespace-nowrap rounded-md border border-transparent px-3 py-1.5 text-[13px] font-medium transition-colors`,n?`border border-border bg-card text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[e.icon?(0,p.jsx)(e.icon,{"aria-hidden":`true`,className:`size-3.5`}):null,e.swatch?(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-3 rounded-full border border-border`,style:{background:e.swatch}}):null,e.label]},e.value)})})}function y(){let e=n(),{order:t,canReorder:r,reset:i}=s();return!((e.data?.projects.length??0)>1)||t.length===0?null:(0,p.jsx)(d,{title:`Project order`,hint:`The project rail is in the order you dragged it into. Reset puts it back in the order the projects were added. Saved with your workspace, so every browser sees it.`,children:(0,p.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`appearance-project-order-reset`,disabled:!r,onClick:i,className:`w-fit`,children:`Reset order`})})}function b(){let{theme:e,setTheme:t}=c(),{accent:n,density:r,width:i,setAccent:a,setDensity:o,setWidth:s}=l(),f=u(),b=u(),x=u(),S=u(),C=e=>t=>{t&&e()};return(0,p.jsxs)(`div`,{"data-slot":`appearance-section`,className:`flex w-full flex-col gap-7 rounded-lg border border-border bg-card p-5`,children:[(0,p.jsx)(d,{title:`Theme`,hint:`System follows your OS preference. Applies to this browser.`,saved:f.saved,children:(0,p.jsx)(v,{slot:`appearance-theme`,label:`Theme`,value:e,options:m,onChange:e=>{t(e)&&f.flash()}})}),h.length>1?(0,p.jsx)(d,{title:`Accent`,hint:`The cockpit brand accent. Saved with your workspace appearance.`,saved:b.saved,children:(0,p.jsx)(v,{slot:`appearance-accent`,label:`Accent`,value:n,options:h,onChange:e=>void a(e).then(C(b.flash))})}):null,(0,p.jsx)(d,{title:`Density`,hint:`Compact tightens spacing across the cockpit — text stays the same size.`,saved:x.saved,children:(0,p.jsx)(v,{slot:`appearance-density`,label:`Density`,value:r,options:g,onChange:e=>void o(e).then(C(x.flash))})}),(0,p.jsx)(d,{title:`Reading width`,hint:`Wide lets a task's session and commits use more of the screen. Narrow keeps a comfortable reading column. The Changes tab is always full-width.`,saved:S.saved,children:(0,p.jsx)(v,{slot:`appearance-width`,label:`Reading width`,value:i,options:_,onChange:e=>void s(e).then(C(S.flash))})}),(0,p.jsx)(y,{}),(0,p.jsxs)(`div`,{className:`settings-appearance-preview settings-readout`,children:[(0,p.jsx)(`span`,{className:`text-[12px] text-soft-foreground`,children:`PREVIEW`}),(0,p.jsx)(`p`,{className:`mt-3 text-base`,children:`Review finalization retries`}),(0,p.jsxs)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:[`Needs you · Squawk · Task `,`#`,`227`]}),(0,p.jsx)(`span`,{className:`mt-3 inline-flex rounded-md border border-border bg-card px-4 py-3 text-xs text-foreground shadow-xs`,children:`Open task`})]}),(0,p.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Changes apply immediately. Theme is browser-local; density and reading width are saved with your workspace.`})]})}export{b as AppearanceSection};
@@ -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{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-CchoEEzj.js";import{I as c,un as l,vi as u}from"./toaster-zMN8cNZQ.js";import{t as d}from"./option-select-CDOKbUov.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=r();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),r=u(),o=f(),g=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):l({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(a.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:i.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ft as r,Ut as i,Wt as a,g as o,un as s}from"./queries-CchoEEzj.js";import{I as c,un as l,vi as u}from"./toaster-zMN8cNZQ.js";import{t as d}from"./option-select-Cq_bhgu6.js";import{n as f,t as p}from"./save-cue-CpHgT93o.js";var m=e(t(),1),h=n();function g(){let e=o();return e.isPending?(0,h.jsx)(`p`,{role:`status`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`project`})}function _(){let e=r();return e.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm`,children:`Loading task settings…`}):e.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Task settings did not load: `,e.error.message]}):(0,h.jsx)(v,{config:e.data,scope:`global`})}function v({config:e,scope:t}){let n=(0,m.useId)(),r=u(),o=f(),g=s({mutationFn:async({archiveOnMerge:e,projectKey:n})=>t===`project`?c({archiveOnMerge:e},n[0]):l({archiveOnMerge:e}),onSuccess:(e,{projectKey:n})=>{t===`project`?r.setQueryData(n,e):(r.setQueryData(a.config,e),r.invalidateQueries({predicate:e=>e.queryKey.at(-1)===`config`&&e.queryKey!==a.config})),o.flash()}});return(0,h.jsxs)(`section`,{"data-slot":`archive-on-merge-field`,className:`settings-field flex min-w-0 flex-col gap-3`,children:[(0,h.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,h.jsx)(`label`,{htmlFor:n,className:`text-sm font-semibold text-foreground`,children:`Archive tasks after PRs merge`}),(0,h.jsxs)(`p`,{id:`${n}-hint`,className:`text-[13px] text-muted-foreground`,children:[`Automatically archive a settled task and its workers once all their associated pull requests merge. History stays available in Archived. `,(0,h.jsx)(p,{saved:o.saved})]})]}),(0,h.jsx)(d,{id:n,"aria-describedby":`${n}-hint ${n}-effective`,className:`settings-select w-64 max-w-full bg-background`,value:e.archiveOnMerge===null?`inherit`:e.archiveOnMerge?`enabled`:`disabled`,disabled:g.isPending,onValueChange:e=>g.mutate({archiveOnMerge:e===`inherit`?null:e===`enabled`,projectKey:i.config}),options:[{value:`inherit`,label:t===`project`?`Inherit global setting`:`Use default`},{value:`enabled`,label:`Enabled`},{value:`disabled`,label:`Disabled`}]}),(0,h.jsxs)(`p`,{id:`${n}-effective`,className:`text-[13px] text-muted-foreground`,children:[`Currently `,e.effectiveArchiveOnMerge?`enabled`:`disabled`,` · `,e.archiveOnMergeSource,` setting.`]}),(0,h.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Unarchive restores the task. It stays visible until a later associated PR merges.`}),g.isPending?(0,h.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Saving…`}):null,g.isError?(0,h.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not save: `,g.error.message]}):null]})}export{_ as n,g as t};
@@ -1,9 +1,9 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i}from"./dist-C_rn70hE.js";import{N as a,Yt as o,nn as s}from"./queries-CchoEEzj.js";import{mr as c}from"./toaster-zMN8cNZQ.js";import{f as l,n as u,p as d}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as f,Q as p,V as m,c as h,d as g,mt as _,pt as v,st as y,y as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./check-OP-CVgZG.js";import{t as C}from"./chevron-right-BENZ-1ZN.js";import{n as w}from"./smartphone-Lr8Ug2z_.js";import{t as T}from"./loader-circle-CPBhhDbB.js";import{t as ee}from"./message-square-B-MD-8rD.js";import{n as te,t as ne}from"./tool-display-B9NN44oU.js";import{t as E}from"./square-terminal-B6RYYieR.js";import{t as D}from"./button-B22ANdCY.js";import{n as O,r as k,t as A}from"./collapsible-Bx2vViFx.js";import{t as j}from"./project-router-j0uBi7Ep.js";import{a as M,c as re,i as ie,l as ae,o as oe,s as se,t as ce}from"./report-selection-BdGxjISG.js";import{r as le}from"./html-report-BX3msvci.js";import{En as ue,Sr as de,T as fe,dr as pe,fn as me,gr as N,w as he}from"./index-UFO7Bk2I.js";import{t as ge}from"./zoomable-image-BUTgYpld.js";import{t as P}from"./textarea-vEsJAUAV.js";import{t as F}from"./markdown-CqzDs1kO.js";import{t as _e}from"./task-file-scope-B63NmSov.js";import{t as ve}from"./report-title-D4Mbu2Er.js";var ye=x(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),be=x(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),xe=x(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),I=x(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Se=x(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),L=e(t(),1),R=n();function Ce(e,t){if(e.length===1)return[t.replace(RegExp(`^${we(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Te(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ee=`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{m as r,o as i}from"./dist-C_rn70hE.js";import{N as a,Yt as o,nn as s}from"./queries-CchoEEzj.js";import{mr as c}from"./toaster-zMN8cNZQ.js";import{f as l,n as u,p as d}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{J as f,Q as p,V as m,c as h,d as g,mt as _,pt as v,st as y,y as b}from"./design-icons-QbNMZniQ.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{t as S}from"./check-OP-CVgZG.js";import{t as C}from"./chevron-right-BENZ-1ZN.js";import{n as w}from"./smartphone-Lr8Ug2z_.js";import{t as T}from"./loader-circle-CPBhhDbB.js";import{t as ee}from"./message-square-B-MD-8rD.js";import{n as te,t as ne}from"./tool-display-B9NN44oU.js";import{t as E}from"./square-terminal-B6RYYieR.js";import{t as D}from"./button-B22ANdCY.js";import{n as O,r as k,t as A}from"./collapsible-Bx2vViFx.js";import{t as j}from"./project-router-j0uBi7Ep.js";import{a as M,c as re,i as ie,l as ae,o as oe,s as se,t as ce}from"./report-selection-BdGxjISG.js";import{r as le}from"./html-report-BX3msvci.js";import{En as ue,T as de,fn as fe,pr as pe,vr as N,w as me,wr as he}from"./index-CbSPKU4g.js";import{t as ge}from"./zoomable-image-BUTgYpld.js";import{t as P}from"./textarea-vEsJAUAV.js";import{t as F}from"./markdown-DMFXz4xY.js";import{t as _e}from"./task-file-scope-BKjO7lKK.js";import{t as ve}from"./report-title-D4Mbu2Er.js";var ye=x(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),be=x(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),xe=x(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),I=x(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Se=x(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),L=e(t(),1),R=n();function Ce(e,t){if(e.length===1)return[t.replace(RegExp(`^${we(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Te(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var Ee=`
2
2
 
3
3
  Additional comments:
4
- `;function De(e){let t=e.indexOf(Ee);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function Oe({ask:e}){let t=e.answer===void 0?void 0:De(e.answer),n=t===void 0?void 0:Ce(e.questions,t.body);return(0,R.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=Te(t,i),o=i!==void 0&&a.length===0;return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,R.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,R.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,R.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,R.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,R.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,R.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,R.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,R.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,R.jsx)(z,{text:i}):null]})]}):i===void 0?null:(0,R.jsx)(z,{text:i})]},t.id??r)}),n&&t?.comment?(0,R.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,R.jsx)(z,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,R.jsx)(z,{text:e.answer}):null]})}function z({text:e}){return(0,R.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function B(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function ke(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function Ae({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,R.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,R.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,R.jsxs)(D,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:c,children:[(0,R.jsx)(N,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,R.jsx)(Le,{onShowOrigin:l}):null,r?(0,R.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function je({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,R.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=B(a,n,r);return(0,R.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,R.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,R.jsx)(S,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,R.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,R.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Comment`})]})]})}function Me({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,L.useId)();return(0,R.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,R.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,R.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=B(r,t,n);return(0,R.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:ke(r,t,n)})]},e.id??r)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Ne({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,L.useId)();return r?(0,R.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,R.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,R.jsx)(P,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function Pe({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[(0,R.jsx)(de,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,R.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=B(n,p,m);return(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,R.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,R.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:[`Next`,(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:s||!r,onClick:d,children:v}):null]})]})}function Fe({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,R.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,R.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,R.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Ie({blockedBy:e,reason:t,error:n}){return(0,R.jsxs)(R.Fragment,{children:[t?(0,R.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Le({onShowOrigin:e,className:t}){return(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function Re({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,L.useRef)(!1);return(0,R.jsx)(ie,{open:e,onOpenChange:t,children:(0,R.jsxs)(oe,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,R.jsxs)(re,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,R.jsx)(ae,{children:`Question context`}),(0,R.jsx)(se,{children:`Your selections and drafts stay intact while you read.`}),(0,R.jsx)(M,{asChild:!0,children:(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,R.jsx)(_,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,R.jsx)(_e,{runId:n,children:(0,R.jsx)(F,{breaks:!0,children:r})})}),i?(0,R.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ze(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Be=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ve(e){return e.replaceAll(`'`,`'\\''`)}function He(e){return e===``?`''`:Be.test(e)?e:`\u0027${Ve(e)}\u0027`}function Ue(e){if(!ze(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(He).join(` `)}}function We(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Ge(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Ke(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function V(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function qe(e){let t=We(Ge(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))V(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){V(e[2])&&i.push({label:Ke(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Ke(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&V(t)&&i.push({label:t,href:t})}return i}var Je=(0,L.createContext)(void 0),Ye=(0,L.createContext)(void 0);function H(e,t){let n=new Map;for(let r of qe(e)){let e=fe(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function U(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xe({text:e,messageKey:t}){let n=(0,L.useContext)(he),r=(0,L.useContext)(Ye),i=t??r;if(!n||i===void 0)return null;let a=H(e,n);return a.length===0?null:(0,R.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,R.jsx)(Ze,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Ze({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:o}=e,s=(0,L.useContext)(Je),c=(0,L.useContext)(ce);(0,L.useLayoutEffect)(()=>c?.register(n,r),[c,n,r]);let f=a(r,n),p=l(),m=d();if(f.isError)return(0,R.jsx)(u,{id:U(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:i});let h=f.data?.artifact;if(h&&!le(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,R.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,R.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ve(h):i}),(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,R.jsx)(u,{id:U(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qe={message:!0,reasoning:!0,tool:!0,hook:!0};function $e(e){return Object.hasOwn(Qe,e)&&Qe[e]}var W=e=>e.kind===`tool`,et=e=>e.kind===`conversation`,tt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,nt=(e,t,n)=>`${e} ${e===1?t:n}`;function rt(e,t){let n=[];return e>0&&n.push(nt(e,`file`,`files`)),t>0&&n.push(nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function it(e){return`${e} earlier tool call${e===1?``:`s`}`}var at=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ot(e){for(let t of at)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var st=new WeakMap;function ct(e){let t=st.get(e);if(t)return t;let n=lt(e);return st.set(e,n),n}function lt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(W).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$e(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:rt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of ut(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(et(e)){s(),c.push(e);continue}l(),W(e)&&tt(e)&&!r.has(e.id)?o.push(e):(s(),W(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function ut(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var G=new Map,dt=(0,L.createContext)(null);function K(){return(0,L.useContext)(dt)}function ft({runId:e,children:t}){let n=(0,L.useMemo)(()=>({get:t=>G.get(e)?.get(t),set:(t,n)=>{let r=G.get(e)??new Map;r.set(t,n),G.set(e,r)}}),[e]);return(0,R.jsx)(dt.Provider,{value:n,children:t})}function pt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function mt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function ht(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function gt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function _t(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var vt=new Map;function yt(e,t){vt.set(e,t)}function bt(e){return vt.get(e)}var q=new Map;function xt(e,t){q.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function St(e){return q.get(e)}function Ct(e,t,n){let r=q.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var wt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),Tt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Et=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Dt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ot=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function J(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Y(e){let t=J(e);return t===void 0?void 0:wt.format(t)}function kt(e){let t=J(e);return t===void 0?void 0:Tt.format(t)}var X=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function At(e){let t=J(e);return t===void 0?void 0:X(t)}function jt(e,t=new Date){let n=J(e);if(n===void 0)return;let r=X(n);return r===X(t)?`Today`:r===X(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Et:Dt).format(n)}function Mt(e,t){let n=J(e),r=J(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Nt({ts:e}){let t=Y(e);return t===void 0?null:(0,R.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:kt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Pt({startedAt:e,completedAt:t}){let n=Y(t);if(n===void 0)return null;let r=Mt(e,t);return(0,R.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,R.jsx)(`time`,{dateTime:t,title:kt(t),children:n}),r===void 0?null:(0,R.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Ft({ts:e}){let t=jt(e),n=J(e);if(t===void 0||n===void 0)return null;let r=Ot.format(n);return(0,R.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,R.jsx)(`time`,{dateTime:At(e),title:r,children:t}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var It={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Lt({note:e}){return e.icon===`handoff`?(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,R.jsx)(pe,{className:`size-3`})}),(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,R.jsxs)(A,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,R.jsxs)(k,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,R.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,R.jsx)(O,{children:(0,R.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,R.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,R.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[It[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Rt={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Z({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=Rt[e],c=r===void 0?void 0:Y(r);return(0,R.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,R.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,R.jsx)(ee,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,R.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,R.jsx)(Nt,{ts:r})})]}),(0,R.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var zt=[],Bt=(0,L.memo)(function({text:e,imageCount:t=0,images:n=zt,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e),[_,v]=(0,L.useState)(!1),[b,x]=(0,L.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await a?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await o?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,R.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,R.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:_?(0,R.jsx)(T,{className:`size-3.5 animate-spin`}):`Save`})]}),b?(0,R.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:b}):null]}):(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,R.jsx)(`button`,{type:`button`,"aria-label":s,onClick:S,disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,R.jsx)(Se,{className:`size-3.5`})}):null,o?(0,R.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,R.jsx)(y,{className:`size-3.5`})}):null]}):null,b?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:b}):null,u??(0,R.jsx)(F,{breaks:!0,children:e}),n.length>0?(0,R.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>c(e.split(`/`).pop()??``)?(0,R.jsx)(ge,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,R.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,R.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Vt=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Ht=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Ut(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Ht).forEach(e=>e.remove());let r=qe(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!V(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Wt(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Ut(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Gt=(0,L.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Wt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,R.jsxs)(Z,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Vt,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Vt,children:[(0,R.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,R.jsx)(`div`,{ref:r,children:(0,R.jsx)(F,{breaks:!0,children:e})}),(0,R.jsx)(Xe,{text:e,messageKey:n})]})});function Kt({incident:e}){let t=s().data;if(!t)return null;let n=o(t,e.provider);return(0,R.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,R.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var qt=(0,L.memo)(function({text:e}){let t=(0,L.useId)();if(e.trim()===``)return null;let n=e.split(`
4
+ `;function De(e){let t=e.indexOf(Ee);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function Oe({ask:e}){let t=e.answer===void 0?void 0:De(e.answer),n=t===void 0?void 0:Ce(e.questions,t.body);return(0,R.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=Te(t,i),o=i!==void 0&&a.length===0;return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,R.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,R.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,R.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,R.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,R.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,R.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,R.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,R.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,R.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,R.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,R.jsx)(z,{text:i}):null]})]}):i===void 0?null:(0,R.jsx)(z,{text:i})]},t.id??r)}),n&&t?.comment?(0,R.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,R.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,R.jsx)(z,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,R.jsx)(z,{text:e.answer}):null]})}function z({text:e}){return(0,R.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function B(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function ke(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function Ae({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,R.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,R.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,R.jsxs)(D,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:c,children:[(0,R.jsx)(N,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,R.jsx)(Le,{onShowOrigin:l}):null,r?(0,R.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,R.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function je({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,R.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=B(a,n,r);return(0,R.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,R.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,R.jsx)(S,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,R.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,R.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3`}),(0,R.jsx)(`span`,{children:`Comment`})]})]})}function Me({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,L.useId)();return(0,R.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,R.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,R.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,R.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=B(r,t,n);return(0,R.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,R.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:ke(r,t,n)})]},e.id??r)})})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function Ne({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,L.useId)();return r?(0,R.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,R.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,R.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,R.jsx)(P,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function Pe({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:c,children:[(0,R.jsx)(he,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,R.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=B(n,p,m);return(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,R.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,R.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,R.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,R.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,R.jsxs)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:l,children:[`Next`,(0,R.jsx)(C,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`px-3`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:s||!r,onClick:d,children:v}):null]})]})}function Fe({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,R.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:s,children:[(0,R.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,R.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,R.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function Ie({blockedBy:e,reason:t,error:n}){return(0,R.jsxs)(R.Fragment,{children:[t?(0,R.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,R.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function Le({onShowOrigin:e,className:t}){return(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,t),children:`Show where it was asked`})}function Re({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,L.useRef)(!1);return(0,R.jsx)(ie,{open:e,onOpenChange:t,children:(0,R.jsxs)(oe,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,R.jsxs)(re,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,R.jsx)(ae,{children:`Question context`}),(0,R.jsx)(se,{children:`Your selections and drafts stay intact while you read.`}),(0,R.jsx)(M,{asChild:!0,children:(0,R.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2`,children:(0,R.jsx)(_,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,R.jsx)(_e,{runId:n,children:(0,R.jsx)(F,{breaks:!0,children:r})})}),i?(0,R.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function ze(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Be=/^[A-Za-z0-9_./:=+,@%-]+$/;function Ve(e){return e.replaceAll(`'`,`'\\''`)}function He(e){return e===``?`''`:Be.test(e)?e:`\u0027${Ve(e)}\u0027`}function Ue(e){if(!ze(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(He).join(` `)}}function We(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Ge(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Ke(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function V(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function qe(e){let t=We(Ge(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))V(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){V(e[2])&&i.push({label:Ke(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Ke(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&V(t)&&i.push({label:t,href:t})}return i}var Je=(0,L.createContext)(void 0),Ye=(0,L.createContext)(void 0);function H(e,t){let n=new Map;for(let r of qe(e)){let e=de(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function U(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xe({text:e,messageKey:t}){let n=(0,L.useContext)(me),r=(0,L.useContext)(Ye),i=t??r;if(!n||i===void 0)return null;let a=H(e,n);return a.length===0?null:(0,R.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,R.jsx)(Ze,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Ze({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:o}=e,s=(0,L.useContext)(Je),c=(0,L.useContext)(ce);(0,L.useLayoutEffect)(()=>c?.register(n,r),[c,n,r]);let f=a(r,n),p=l(),m=d();if(f.isError)return(0,R.jsx)(u,{id:U(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:p.pathname+p.search},children:i});let h=f.data?.artifact;if(h&&!le(h.name))return null;let g=new URLSearchParams(p.search);g.set(`report`,n),g.set(`card`,t);let _=new URLSearchParams(p.search).has(`report`)?p.state:null,v=new URLSearchParams(p.search);v.delete(`report`),v.delete(`card`);let y=`${p.pathname}${v.size?`?${v}`:``}`,b=window.navigation,x={reportCardEntry:!0,reportReturnTo:_?.reportReturnTo??y,reportReturnKey:_?.reportReturnKey??b?.currentEntry?.key,reportScrollTop:_?.reportScrollTop},S={pathname:p.pathname,search:`?${g}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,R.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":f.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,R.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:h?ve(h):i}),(0,R.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,R.jsx)(u,{id:U(t,n),to:S,state:x,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=x.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;m(S,{state:{...x,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${f.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qe={message:!0,reasoning:!0,tool:!0,hook:!0};function $e(e){return Object.hasOwn(Qe,e)&&Qe[e]}var W=e=>e.kind===`tool`,et=e=>e.kind===`conversation`,tt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,nt=(e,t,n)=>`${e} ${e===1?t:n}`;function rt(e,t){let n=[];return e>0&&n.push(nt(e,`file`,`files`)),t>0&&n.push(nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function it(e){return`${e} earlier tool call${e===1?``:`s`}`}var at=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function ot(e){for(let t of at)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var st=new WeakMap;function ct(e){let t=st.get(e);if(t)return t;let n=lt(e);return st.set(e,n),n}function lt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(W).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$e(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:rt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of ut(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(et(e)){s(),c.push(e);continue}l(),W(e)&&tt(e)&&!r.has(e.id)?o.push(e):(s(),W(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function ut(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var G=new Map,dt=(0,L.createContext)(null);function K(){return(0,L.useContext)(dt)}function ft({runId:e,children:t}){let n=(0,L.useMemo)(()=>({get:t=>G.get(e)?.get(t),set:(t,n)=>{let r=G.get(e)??new Map;r.set(t,n),G.set(e,r)}}),[e]);return(0,R.jsx)(dt.Provider,{value:n,children:t})}function pt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function mt(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function ht(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function gt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function _t(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var vt=new Map;function yt(e,t){vt.set(e,t)}function bt(e){return vt.get(e)}var q=new Map;function xt(e,t){q.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function St(e){return q.get(e)}function Ct(e,t,n){let r=q.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var wt=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),Tt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Et=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Dt=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ot=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function J(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Y(e){let t=J(e);return t===void 0?void 0:wt.format(t)}function kt(e){let t=J(e);return t===void 0?void 0:Tt.format(t)}var X=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function At(e){let t=J(e);return t===void 0?void 0:X(t)}function jt(e,t=new Date){let n=J(e);if(n===void 0)return;let r=X(n);return r===X(t)?`Today`:r===X(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Et:Dt).format(n)}function Mt(e,t){let n=J(e),r=J(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Nt({ts:e}){let t=Y(e);return t===void 0?null:(0,R.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:kt(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function Pt({startedAt:e,completedAt:t}){let n=Y(t);if(n===void 0)return null;let r=Mt(e,t);return(0,R.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,R.jsx)(`time`,{dateTime:t,title:kt(t),children:n}),r===void 0?null:(0,R.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Ft({ts:e}){let t=jt(e),n=J(e);if(t===void 0||n===void 0)return null;let r=Ot.format(n);return(0,R.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,R.jsx)(`time`,{dateTime:At(e),title:r,children:t}),(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var It={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function Lt({note:e}){return e.icon===`handoff`?(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,R.jsx)(pe,{className:`size-3`})}),(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,R.jsxs)(A,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,R.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,R.jsxs)(k,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,R.jsx)(g,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,R.jsx)(O,{children:(0,R.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,R.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,R.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[It[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,R.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var Rt={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Z({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=Rt[e],c=r===void 0?void 0:Y(r);return(0,R.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,R.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,R.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,R.jsx)(ee,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,R.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,R.jsx)(Nt,{ts:r})})]}),(0,R.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var zt=[],Bt=(0,L.memo)(function({text:e,imageCount:t=0,images:n=zt,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:l=`Remove message`,children:u}){let d=t-n.length,[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(e),[_,v]=(0,L.useState)(!1),[b,x]=(0,L.useState)(),S=()=>{g(e),x(void 0),m(!0)},C=async()=>{let t=h.trim();if(!t||t===e){m(!1);return}v(!0),x(void 0);try{await a?.(t),m(!1)}catch(e){x(e instanceof Error?e.message:`Could not save the message`)}finally{v(!1)}},w=async()=>{v(!0),x(void 0);try{await o?.()}catch(e){x(e instanceof Error?e.message:`Could not remove the message`)}finally{v(!1)}};return p?(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,R.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:h,onChange:e=>g(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),m(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,R.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>m(!1),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:_,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:_?(0,R.jsx)(T,{className:`size-3.5 animate-spin`}):`Save`})]}),b?(0,R.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:b}):null]}):(0,R.jsxs)(Z,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,R.jsx)(`button`,{type:`button`,"aria-label":s,onClick:S,disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,R.jsx)(Se,{className:`size-3.5`})}):null,o?(0,R.jsx)(`button`,{type:`button`,"aria-label":l,onClick:()=>void w(),disabled:_,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,R.jsx)(y,{className:`size-3.5`})}):null]}):null,b?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:b}):null,u??(0,R.jsx)(F,{breaks:!0,children:e}),n.length>0?(0,R.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>c(e.split(`/`).pop()??``)?(0,R.jsx)(ge,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,R.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,R.jsx)(f,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,R.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,d>0?(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[d,` image`,d>1?`s`:``,` attached`]}):null]})}),Vt=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Ht=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Ut(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Ht).forEach(e=>e.remove());let r=qe(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!V(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Wt(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Ut(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var Gt=(0,L.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)(null),[o,s]=(0,L.useState)(null),c=(0,L.useRef)(null);(0,L.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Wt(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,R.jsxs)(Z,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,R.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Vt,children:[(0,R.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,R.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Vt,children:[(0,R.jsx)(N,{className:`size-3.5`,"aria-hidden":`true`}),(0,R.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,R.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,R.jsx)(`div`,{ref:r,children:(0,R.jsx)(F,{breaks:!0,children:e})}),(0,R.jsx)(Xe,{text:e,messageKey:n})]})});function Kt({incident:e}){let t=s().data;if(!t)return null;let n=o(t,e.provider);return(0,R.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,R.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,R.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,R.jsx)(j,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var qt=(0,L.memo)(function({text:e}){let t=(0,L.useId)();if(e.trim()===``)return null;let n=e.split(`
5
5
  `,1)[0]??``,r=n.length<e.length;return(0,R.jsxs)(A,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,R.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,R.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,R.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,R.jsx)(F,{inline:!0,children:n})}),r?(0,R.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,R.jsx)(k,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,R.jsx)(F,{children:e})})})]})});function Jt(){return(0,R.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,R.jsx)(T,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,R.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Yt={read:N,edit:Se,delete:y,move:xe,search:p,execute:E,think:be,fetch:w,task:h,plan:m,other:v},Xt=e=>e.split(`
6
6
  `).length;function Zt({text:e,streaming:t}){let[n,r]=(0,L.useState)(!1),a=(0,L.useRef)(null),o=(0,L.useRef)(!0);(0,L.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=Xt(e),c=!t&&!n&&s>12;return(0,R.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,R.jsxs)(`div`,{className:`relative`,children:[(0,R.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=gt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,R.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,R.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,R.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function Qt({diffs:e}){return(0,R.jsx)(R.Fragment,{children:e.map((e,t)=>(0,R.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,R.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...$t(e.oldText).map((e,t)=>(0,R.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...$t(e.newText).map((e,t)=>(0,R.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
7
7
  `).map((e,t)=>(0,R.jsx)(en,{text:e},t))})]},`${e.path}:${t}`))})}function $t(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
8
8
  `)}function en({text:e}){return(0,R.jsx)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function tn(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function nn(e){let t=e.status===`running`||e.status===`pending`,n=ot(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?Ue(e.input):te(e.name).toolKind===e.toolKind?ne(e.name,e.input):void 0)??i,Icon:Yt[e.toolKind]??v}}function rn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function an({item:e,busy:t}){return(0,R.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,R.jsx)(T,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,R.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,R.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function on({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,R.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,R.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,R.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,R.jsx)(Qt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,R.jsx)(Zt,{text:e.output,streaming:n}):null,r.length>0?(0,R.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:a?.(r,i??e.id)}):null]})}function sn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=K(),[o,s]=(0,L.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=nn(e),m=rn(e,t.length),h=f!==void 0||m,_=h&&(o??(m&&tn(e)));return(0,R.jsxs)(A,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:_,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,R.jsxs)(k,{disabled:!h,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,R.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,R.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,R.jsx)(an,{item:e,busy:l})]}),(0,R.jsx)(O,{children:(0,R.jsx)(on,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function cn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function ln({item:e,cacheKey:t}){let n=K(),[r,a]=(0,L.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=cn(e);return(0,R.jsxs)(A,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,R.jsxs)(k,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,R.jsx)(ye,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,R.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,R.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,R.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,R.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,R.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,R.jsx)(O,{children:(0,R.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,R.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,R.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,R.jsxs)(A,{className:`border-t border-border`,children:[(0,R.jsxs)(k,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,R.jsxs)(O,{children:[e.stdout?(0,R.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,R.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function un({group:e,scope:t}){return(0,R.jsxs)(A,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,R.jsxs)(k,{className:`group flex h-[34px] tabular-nums w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,R.jsx)(sn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function dn({count:e,children:t}){return(0,R.jsxs)(A,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,R.jsxs)(k,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,R.jsx)(g,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),it(e)]}),(0,R.jsx)(O,{children:(0,R.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function fn({image:e}){return(0,R.jsx)(ge,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}var pn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function mn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function hn(e,t,n,r=``){let i=e.map((e,r)=>mn(e,t[r]??[],n[r])).join(`
9
- `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function gn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,R.jsx)(Q,{text:e.context}):null;if(e.resolved)return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,R.jsx)(Q,{text:e.context}):null,(0,R.jsxs)(Z,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?pn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,R.jsx)(Oe,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(_n,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(xn,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Q({text:e}){return(0,R.jsx)(Z,{role:`agent`,children:(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,R.jsx)(F,{breaks:!0,children:e})})})}function _n({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,R.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,R.jsx)(D,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,R.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,R.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,R.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,R.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,R.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,R.jsxs)(`li`,{className:`break-words`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,R.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,R.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,R.jsx)(j,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,R.jsx)(Le,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,R.jsx)(Re,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function vn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,L.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)({}),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(``),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(``),[T,ee]=(0,L.useState)(!1),te=s&&p===c,ne=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;ue(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let E=(e,t)=>g(n=>({...n,[e]:t})),D=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),O=e=>{E(e,[]),v(t=>({...t,[e]:t[e]??``}))},k=o.some((e,t)=>!e.options||_[t]!==void 0),A=o.filter((e,t)=>B(t,h,_)).length,j=A===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:ee,onCommentStep:te,oneTap:ne,setQuestion:E,clearOtherAnswer:D,selectOther:O,hasOtherAnswer:k,answeredCount:A,allAnswered:j,deliver:M,sendAll:()=>void M(hn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function yn({state:e,renderFreeTextReply:t}){let n=(0,L.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,R.jsx)(Ne,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,R.jsx)(Me,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(wn,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(mn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,R.jsxs)(`div`,{className:`pt-1`,children:[(0,R.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function bn({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`px-3`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`px-3`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function xn(e){return e.delivery===void 0?(0,R.jsx)(Sn,{...e}):(0,R.jsx)($,{...e,delivery:e.delivery})}function Sn(e){let t=me(e.run,e.projectId);return(0,R.jsx)($,{...e,delivery:t})}function $({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=vn(e,m,d,f,a),[g,_]=(0,L.useState)(void 0),v=(0,L.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,R.jsx)(bn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,R.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,R.jsx)(Ae,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,R.jsx)(je,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,R.jsx)(yn,{state:h,renderFreeTextReply:o})}),(0,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,R.jsx)(Cn,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,R.jsx)(Ie,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,R.jsx)(Re,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function Cn({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,R.jsx)(Pe,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,R.jsx)(Fe,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function wn({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,L.useId)(),u=(0,L.useRef)(null),d=(0,L.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,L.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,R.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,R.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,R.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,R.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,R.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,R.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,R.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,R.jsx)(D,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,size:`block`,className:i(`px-2.5`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,R.jsxs)(`div`,{className:`mt-2`,children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}export{K as A,Ct as C,ht as D,yt as E,Je as F,U as I,H as L,ot as M,$e as N,_t as O,Ye as P,Oe as R,St as S,xt as T,Y as _,ln as a,gt as b,qt as c,Bt as d,Jt as f,Pt as g,Nt as h,un as i,ct as j,ft as k,sn as l,Ft as m,Q as n,fn as o,Lt as p,Gt as r,Kt as s,gn as t,dn as u,At as v,bt as w,pt as x,mt as y,I as z};
9
+ `),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function gn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,R.jsx)(Q,{text:e.context}):null;if(e.resolved)return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,R.jsx)(Q,{text:e.context}):null,(0,R.jsxs)(Z,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,R.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?pn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,R.jsx)(Oe,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(_n,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,R.jsx)(xn,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Q({text:e}){return(0,R.jsx)(Z,{role:`agent`,children:(0,R.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,R.jsx)(F,{breaks:!0,children:e})})})}function _n({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,R.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,R.jsx)(D,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto px-2 text-xs font-medium text-link-foreground underline underline-offset-4`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,R.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,R.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,R.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,R.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,R.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,R.jsxs)(`li`,{className:`break-words`,children:[(0,R.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,R.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,R.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,R.jsx)(j,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,R.jsx)(Le,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,R.jsx)(Re,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function vn(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,L.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)({}),[_,v]=(0,L.useState)({}),[y,b]=(0,L.useState)(``),[x,S]=(0,L.useState)(!1),[C,w]=(0,L.useState)(``),[T,ee]=(0,L.useState)(!1),te=s&&p===c,ne=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;ue(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let E=(e,t)=>g(n=>({...n,[e]:t})),D=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),O=e=>{E(e,[]),v(t=>({...t,[e]:t[e]??``}))},k=o.some((e,t)=>!e.options||_[t]!==void 0),A=o.filter((e,t)=>B(t,h,_)).length,j=A===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:ee,onCommentStep:te,oneTap:ne,setQuestion:E,clearOtherAnswer:D,selectOther:O,hasOtherAnswer:k,answeredCount:A,allAnswered:j,deliver:M,sendAll:()=>void M(hn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function yn({state:e,renderFreeTextReply:t}){let n=(0,L.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,R.jsx)(Ne,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,R.jsx)(Me,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(wn,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(mn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,R.jsxs)(`div`,{className:`pt-1`,children:[(0,R.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,R.jsx)(P,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function bn({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`px-3`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,R.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`px-3`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function xn(e){return e.delivery===void 0?(0,R.jsx)(Sn,{...e}):(0,R.jsx)($,{...e,delivery:e.delivery})}function Sn(e){let t=fe(e.run,e.projectId);return(0,R.jsx)($,{...e,delivery:t})}function $({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=vn(e,m,d,f,a),[g,_]=(0,L.useState)(void 0),v=(0,L.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,R.jsx)(bn,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,R.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,R.jsx)(Ae,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,R.jsx)(je,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,R.jsx)(yn,{state:h,renderFreeTextReply:o})}),(0,R.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,R.jsx)(Cn,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,R.jsx)(Ie,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,R.jsx)(Re,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function Cn({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,R.jsx)(D,{type:`button`,size:`sm`,className:`px-3.5`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,R.jsx)(Pe,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,R.jsx)(Fe,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function wn({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,L.useId)(),u=(0,L.useRef)(null),d=(0,L.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,L.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,R.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,R.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,R.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,R.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,R.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,R.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,R.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,R.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,R.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,R.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,R.jsx)(D,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,size:`block`,className:i(`px-2.5`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,R.jsxs)(`div`,{className:`mt-2`,children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,R.jsx)(P,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}export{K as A,Ct as C,ht as D,yt as E,Je as F,U as I,H as L,ot as M,$e as N,_t as O,Ye as P,Oe as R,St as S,xt as T,Y as _,ln as a,gt as b,qt as c,Bt as d,Jt as f,Pt as g,Nt as h,un as i,ct as j,ft as k,sn as l,Ft as m,Q as n,fn as o,Lt as p,Gt as r,Kt as s,gn as t,dn as u,At as v,bt as w,pt as x,mt as y,I as z};