@tickernelz/wardmote-ui 2026.1118.1 → 2026.1118.2

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 (119) hide show
  1. package/dist/assets/{AdapterManager-1binbhYj.js → AdapterManager-DvntZ2AW.js} +1 -1
  2. package/dist/assets/{AdvancedToolsRoute-DUyXR4Xj.js → AdvancedToolsRoute-CUW8D9Ux.js} +1 -1
  3. package/dist/assets/{AgentActionButtons-DSmnGirw.js → AgentActionButtons-CQLGCtfu.js} +1 -1
  4. package/dist/assets/{AgentChat-Dj952aW1.js → AgentChat-DCwwZA2b.js} +1 -1
  5. package/dist/assets/{AgentChats-Fv5j4CM9.js → AgentChats-DMMLdo-o.js} +1 -1
  6. package/dist/assets/{AgentDetail-CffT38lI.js → AgentDetail-BMVWOVp-.js} +1 -1
  7. package/dist/assets/{AgentTodoCard-De5ZJbUa.js → AgentTodoCard-C4BfJg4x.js} +1 -1
  8. package/dist/assets/{Agents-CDDoQ4Ds.js → Agents-C0IDC6KD.js} +3 -3
  9. package/dist/assets/{AppDetail-DnTOxWEY.js → AppDetail-DzEGsx94.js} +1 -1
  10. package/dist/assets/{AppNotConnected-CgnmB3mH.js → AppNotConnected-BVL32B49.js} +1 -1
  11. package/dist/assets/{ApprovalCard-D6X8gzHU.js → ApprovalCard-DCQ49PuW.js} +1 -1
  12. package/dist/assets/{ApprovalDetail-CWxiqPs6.js → ApprovalDetail-B0J70llD.js} +1 -1
  13. package/dist/assets/{ApprovalPayload-DFsO21LC.js → ApprovalPayload-8lqBw-XQ.js} +1 -1
  14. package/dist/assets/{Approvals-BW3osPe0.js → Approvals-BkiVjx0M.js} +1 -1
  15. package/dist/assets/{AppsReview-4g3PeYWn.js → AppsReview-CeXp22cE.js} +1 -1
  16. package/dist/assets/{ArtifactCard-BoIqK207.js → ArtifactCard-BV82tDLI.js} +1 -1
  17. package/dist/assets/{Artifacts-DDdlgUkk.js → Artifacts-CL5ZmZ3m.js} +1 -1
  18. package/dist/assets/{AssistantConnection-B7yxIifb.js → AssistantConnection-C5rmoEsm.js} +1 -1
  19. package/dist/assets/{AttentionInteractionResolver-BdcCqDXe.js → AttentionInteractionResolver-DxZpuIIF.js} +1 -1
  20. package/dist/assets/{AuditHub-CI0zjHie.js → AuditHub-DDPFGvHG.js} +1 -1
  21. package/dist/assets/{BoardChat--69z_C0h.js → BoardChat-DlaNGzcQ.js} +1 -1
  22. package/dist/assets/{BootstrapSetupUxLab-UIxdNUcO.js → BootstrapSetupUxLab-B2tOIzXd.js} +1 -1
  23. package/dist/assets/{Browse-VPYhJopu.js → Browse-xEc9mGl7.js} +1 -1
  24. package/dist/assets/{BudgetPolicyCard-45TwMzp3.js → BudgetPolicyCard-Ccr3EX5M.js} +1 -1
  25. package/dist/assets/{CaseDetail-CRN2rF4k.js → CaseDetail-CvMk_M-F.js} +1 -1
  26. package/dist/assets/{Cases-CFqnLAMq.js → Cases-H1Y4Oipe.js} +1 -1
  27. package/dist/assets/{ChatEndpointDetail-BTYAtutu.js → ChatEndpointDetail-CjDVQWl8.js} +1 -1
  28. package/dist/assets/{ChatEndpointSetup-CzrgHmvH.js → ChatEndpointSetup-BfohtKVM.js} +1 -1
  29. package/dist/assets/{Companies-C-U5WI6o.js → Companies-C4ObCu9j.js} +1 -1
  30. package/dist/assets/{CompanyAccess-DLgvUIoB.js → CompanyAccess-J5Vwnko2.js} +1 -1
  31. package/dist/assets/{CompanyActivity-8CeynedM.js → CompanyActivity-B7-kMNmz.js} +1 -1
  32. package/dist/assets/{CompanyConnections-BjMmsqei.js → CompanyConnections-D2N6UWXk.js} +1 -1
  33. package/dist/assets/{CompanyEnvironments-D6p-TNkv.js → CompanyEnvironments-ChSu4gxW.js} +1 -1
  34. package/dist/assets/{CompanyExport-Dw0QDMvs.js → CompanyExport-B_opHRSJ.js} +1 -1
  35. package/dist/assets/{CompanyImport-OSi3fM2l.js → CompanyImport-DZAMEBBy.js} +1 -1
  36. package/dist/assets/{CompanySettings-B-aPUQpY.js → CompanySettings-Rz8cwgKC.js} +1 -1
  37. package/dist/assets/{CompanySettingsPluginPage-Kp7iOUP1.js → CompanySettingsPluginPage-CM-ViPwj.js} +1 -1
  38. package/dist/assets/{CompanySkills-HZqJ5DZ8.js → CompanySkills-BnwPuZze.js} +1 -1
  39. package/dist/assets/{ConfigureBuiltInAgentModal-DL3wv3Mb.js → ConfigureBuiltInAgentModal-BAfoTveX.js} +1 -1
  40. package/dist/assets/{CopyableGatewayUrl-BLjhj10P.js → CopyableGatewayUrl-D90Bjxj0.js} +1 -1
  41. package/dist/assets/{Dashboard-DTmjsaEr.js → Dashboard-DepIxrje.js} +1 -1
  42. package/dist/assets/{DecisionDateChips-Br5r2jWZ.js → DecisionDateChips-89KkV4mo.js} +1 -1
  43. package/dist/assets/{DecisionQueuePage-zWDMjHf9.js → DecisionQueuePage-nU9qXzln.js} +1 -1
  44. package/dist/assets/{DesignGuide-BsH97scx.js → DesignGuide-40TixHZ-.js} +1 -1
  45. package/dist/assets/{EmailEndpointSetup-C7PhFwBy.js → EmailEndpointSetup-D7-8f1XV.js} +1 -1
  46. package/dist/assets/{ExecutionWorkspaceDetail-CTDvazWh.js → ExecutionWorkspaceDetail-CnUD3jLO.js} +1 -1
  47. package/dist/assets/{GatewayDetail-BtpnGGIB.js → GatewayDetail-Bg7GU-1a.js} +1 -1
  48. package/dist/assets/{GatewaysList-DrRfNyqk.js → GatewaysList-4vvZCBkY.js} +1 -1
  49. package/dist/assets/{GoalDetail-D5QqhxMg.js → GoalDetail-h7WsjaOO.js} +1 -1
  50. package/dist/assets/{GoalTree-CDexmAKW.js → GoalTree-yPtfejUx.js} +1 -1
  51. package/dist/assets/{Goals-CZinws4s.js → Goals-DOi3E4DX.js} +1 -1
  52. package/dist/assets/{ImageGalleryModal-VT9I4D2p.js → ImageGalleryModal-D_VQgcBt.js} +1 -1
  53. package/dist/assets/{Inbox-BiE243MO.js → Inbox-COKxRKhR.js} +1 -1
  54. package/dist/assets/{InstanceAdvanced-D_iqUmgn.js → InstanceAdvanced-DlMlwZbU.js} +1 -1
  55. package/dist/assets/{InviteLanding-LR84Xv76.js → InviteLanding-BGvJMHKw.js} +1 -1
  56. package/dist/assets/{IssueChatLongThreadPerf-BHdYa83T.js → IssueChatLongThreadPerf-C3U2FZKJ.js} +1 -1
  57. package/dist/assets/{IssueChatThread-Cno8fLc-.js → IssueChatThread-CDKaIB6v.js} +1 -1
  58. package/dist/assets/{IssueDetail-BWZWLO4k.js → IssueDetail-BCwHANTn.js} +1 -1
  59. package/dist/assets/{IssueOutputSection-BuwP0RQx.js → IssueOutputSection-BzXRmoV7.js} +1 -1
  60. package/dist/assets/{IssueRecoveryActionCard-O4GRNsPc.js → IssueRecoveryActionCard-BYtbaP-M.js} +1 -1
  61. package/dist/assets/{IssueReferencePill-EbOs3MtQ.js → IssueReferencePill-BT7NBEy_.js} +1 -1
  62. package/dist/assets/{IssueThreadInteractionCard-BUIzNywc.js → IssueThreadInteractionCard-Btd0rZ23.js} +1 -1
  63. package/dist/assets/{Issues-mVYaoqsX.js → Issues-XKf7zemQ.js} +1 -1
  64. package/dist/assets/{LiveNowTodoLine-DP95vmnd.js → LiveNowTodoLine-CoL6ZNuK.js} +1 -1
  65. package/dist/assets/{ManagedAiConnectionDetails-ZByBvcqo.js → ManagedAiConnectionDetails-CebBi-Tw.js} +1 -1
  66. package/dist/assets/{McpConnect-D42jtK1S.js → McpConnect-ByorZN7G.js} +1 -1
  67. package/dist/assets/{MembershipAction-Df2Qlkdz.js → MembershipAction-De0MBfgb.js} +1 -1
  68. package/dist/assets/{ModelsAndProviders-BzUob8BB.js → ModelsAndProviders-BqM4UJc7.js} +1 -1
  69. package/dist/assets/{NewAgent-BywRvCR0.js → NewAgent-pMTQYNxn.js} +1 -1
  70. package/dist/assets/{PipelineSettings-DFjxoW4i.js → PipelineSettings-C2k3BzLQ.js} +1 -1
  71. package/dist/assets/{Pipelines-CSW-En3n.js → Pipelines-Cr6Xs32p.js} +1 -1
  72. package/dist/assets/{PixelsOffice-B2b8M6LM.js → PixelsOffice-Dfd4XKSj.js} +1 -1
  73. package/dist/assets/{PluginPage-CfSIAMQa.js → PluginPage-fPlWyFSc.js} +1 -1
  74. package/dist/assets/{PluginSettings-TewUkGUA.js → PluginSettings-X_VHvvo5.js} +1 -1
  75. package/dist/assets/{ProfileDetailRoute-CCbLcj8f.js → ProfileDetailRoute-PAsWmN-1.js} +1 -1
  76. package/dist/assets/{ProfileSettings-D1D_hKPu.js → ProfileSettings-BACxlGZS.js} +1 -1
  77. package/dist/assets/{ProfileWizardRoute-BzFGrQkr.js → ProfileWizardRoute-Dbq0n7If.js} +1 -1
  78. package/dist/assets/{ProjectDetail-CEjUARCN.js → ProjectDetail-DOJZUIWu.js} +1 -1
  79. package/dist/assets/{ProjectWorkspaceDetail-7fFllUMH.js → ProjectWorkspaceDetail-ZNnaHnuA.js} +1 -1
  80. package/dist/assets/{ProjectWorkspacesContent-S4UUfVU1.js → ProjectWorkspacesContent-DrWfnTJY.js} +1 -1
  81. package/dist/assets/{Projects-NrtT8d2x.js → Projects-CCzxmEZ8.js} +1 -1
  82. package/dist/assets/{PublicIssueSharePage-CfQDHmOe.js → PublicIssueSharePage-BUSkP1Js.js} +1 -1
  83. package/dist/assets/{ReviewQueueCard-CksOubye.js → ReviewQueueCard-CrCN_30c.js} +1 -1
  84. package/dist/assets/{RichWorkProductCard-XPJ4R-il.js → RichWorkProductCard-DndJn4LV.js} +1 -1
  85. package/dist/assets/{RoutineDetail-AcrnXhjR.js → RoutineDetail-B5MzV_74.js} +1 -1
  86. package/dist/assets/{RoutineRunVariablesDialog-CtSVwZjy.js → RoutineRunVariablesDialog-kGyQVBid.js} +1 -1
  87. package/dist/assets/{Routines-B19G6Lkw.js → Routines-B2zX9h3J.js} +1 -1
  88. package/dist/assets/{ScrollToBottom-csHqjOIa.js → ScrollToBottom-Dd3SpeJi.js} +1 -1
  89. package/dist/assets/{Search-CnO6qC0m.js → Search-D4W3cZZf.js} +1 -1
  90. package/dist/assets/{Secrets-Xz6WSEnG.js → Secrets-C4nbuMIh.js} +1 -1
  91. package/dist/assets/{SkillSourceTree-BC2Ycl7g.js → SkillSourceTree-BvGzMa2u.js} +1 -1
  92. package/dist/assets/{SkillSources-BMogH_qp.js → SkillSources-DL2tNkcr.js} +1 -1
  93. package/dist/assets/{SkillStudio-HekOqqo_.js → SkillStudio-BnZ2cfDq.js} +1 -1
  94. package/dist/assets/{SourceTrustBadge-CXZGc8G4.js → SourceTrustBadge-CCPQEGrC.js} +1 -1
  95. package/dist/assets/{StatusCards-CL-RC2Mf.js → StatusCards-BkE-9R8F.js} +1 -1
  96. package/dist/assets/{SummarySlotCard-BJmo-gDJ.js → SummarySlotCard-D1EyiciB.js} +1 -1
  97. package/dist/assets/{TaskChatLab-CIZVb5Ed.js → TaskChatLab-D3PsNRr5.js} +1 -1
  98. package/dist/assets/{TaskChatMarker-CdRbWeYc.js → TaskChatMarker-DEF88_sr.js} +1 -1
  99. package/dist/assets/{TaskChatProtocolCard-C_A2mV-g.js → TaskChatProtocolCard-Ba_vhDxn.js} +1 -1
  100. package/dist/assets/{TaskChatThreadView-Bd3E40e0.js → TaskChatThreadView-BsPvbxiA.js} +1 -1
  101. package/dist/assets/{TaskTreeControls-DK6EZXLI.js → TaskTreeControls-BKOIbilg.js} +1 -1
  102. package/dist/assets/{Terminal-BcD_c9Om.js → Terminal-1uPX7VEe.js} +1 -1
  103. package/dist/assets/{TerminalView-XV2mBbcS.js → TerminalView-DDv6s-R_.js} +1 -1
  104. package/dist/assets/{TrustPresetSection-Ev8RdYhN.js → TrustPresetSection-BDb0N4Pe.js} +1 -1
  105. package/dist/assets/{UserProfile-C_BKVfMQ.js → UserProfile-DqPRuGWk.js} +1 -1
  106. package/dist/assets/{WhatNeedsMe-CYs2iX06.js → WhatNeedsMe-DtBxgH24.js} +1 -1
  107. package/dist/assets/{Workspaces-B8Wwbx8B.js → Workspaces-BQOyG5HK.js} +1 -1
  108. package/dist/assets/{connection-owner-Ca1nfKiA.js → connection-owner-CPrMcD3t.js} +1 -1
  109. package/dist/assets/{index-LM7k1NmC.js → index-QhteFtm-.js} +3 -3
  110. package/dist/assets/{issue-properties-CKLKB9AO.js → issue-properties--M7WE6Ot.js} +1 -1
  111. package/dist/assets/{issue-workspace-selection-CJYasFEQ.js → issue-workspace-selection-pUdSkrJA.js} +1 -1
  112. package/dist/assets/{pipeline-stage-presentation-BzvR-f05.js → pipeline-stage-presentation-Dv1xgEPW.js} +1 -1
  113. package/dist/assets/{shared-CMP5lH_Q.js → shared-B75ClBUg.js} +1 -1
  114. package/dist/assets/{system-notice-comment-BUfjKy0_.js → system-notice-comment-D0I6rz8Y.js} +1 -1
  115. package/dist/assets/{transcript-adapter-DiPtVkEm.js → transcript-adapter-ClaGWYVL.js} +1 -1
  116. package/dist/assets/{useSummaryDraftStream-uMW1O0Ga.js → useSummaryDraftStream-BDuMgNcA.js} +1 -1
  117. package/dist/index.html +1 -1
  118. package/dist/sw.js +1 -1
  119. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var Ol=Object.defineProperty;var a=(t,n)=>Ol(t,"name",{value:n,configurable:!0});import{i as Is}from"./rolldown-runtime-ZpX3ckPj.js";import{Ci as va,O as ks,Si as El,Ti as Na,h as M,l as g,la as Wl,m as $l,t as Ca,ua as _l,w as Ml,wi as Ll,xi as Bl}from"./createLucideIcon-CgrPXnTY.js";import{l as Fl}from"./dist-DYoIyA63.js";import{a as As,h as Ss}from"./star-eem0qj3E.js";import{X as Ia,_ as Ce,n as Aa,t as j,v as A}from"./queryKeys-BzT8CD34.js";import{o as ql}from"./companies-query-BEdFiAhG.js";import{t as Dl}from"./issue-attribution-DfN_3u2W.js";import{n as Ps,t as Rs}from"./IssueDocumentAnnotations-DpFXlkRb.js";import{n as zl,r as Ul}from"./WorkspaceRuntimeControls-Clk2nzU6.js";import{n as Kl}from"./CompanyContext-fQCNWI_f.js";import{A as sa,P as Vl,a as Ql,at as Hl,on as jt,ot as It,t as V,v as na,zt as E}from"./router-CJbFZfVR.js";import{i as Gl,p as Xl,r as Yl,t as Jl}from"./dropdown-menu-rUbU8QKw.js";import{i as Zl,n as qe,r as ei,t as ti}from"./tabs-CjHzZxtD.js";import{o as aa,r as ra,t as la}from"./popover-CWlBonqy.js";import{t as si}from"./archive-restore-tP0pyaei.js";import{t as ni}from"./arrow-right-W0iJ_-Zs.js";import{t as yt}from"./arrow-up-right-CFNgVoQj.js";import{t as ne}from"./check-Bis3vECb.js";import{t as ws}from"./chevron-down-nRcQ7bok.js";import{t as ai}from"./chevron-left-DnUVccc_.js";import{t as ri}from"./chevron-right-BP8JjEC_.js";import{t as li}from"./circle-question-mark-CasEGiDp.js";import{t as Sa}from"./clock-D2UFngg7.js";import{A as ii,E as Pa,I as oi,M as ia,N as ci,S as di,T as ui,j as xi,k as mi,n as Ra,t as Ts,x as hi}from"./MarkdownBody-cPGkwwjq.js";import{t as Ta}from"./external-link-BIcMNNSN.js";import{t as Os}from"./file-text-CsPKrMTp.js";import{t as pi}from"./file-CcVMTQhg.js";import{a as fi,i as gi,n as bi,t as ji}from"./RichWorkProductCard-XPJ4R-il.js";import{t as yi}from"./folder-open-Dkshp3J4.js";import{t as ki}from"./git-pull-request-DXoACxvx.js";import{r as Oa,t as W}from"./button-DI4w5WP7.js";import{t as vs}from"./plus-CwNlqadt.js";import{t as wi}from"./repeat-DzPORJjX.js";import{t as oa}from"./rotate-ccw-DpzLJhXT.js";import{t as vi}from"./triangle-alert-CnHMpmva.js";import{t as De}from"./user-D5V640s5.js";import{t as Ni}from"./x-6E1yeU3Q.js";import{i as Ci,n as Ii,r as Ai,t as Si}from"./tooltip-CW50mEoC.js";import{t as se}from"./badge-jeXr866I.js";import{t as Pi}from"./Identity-8eG_HXAH.js";import{t as ve}from"./AgentAvatar-BZiiDlCN.js";import{t as Ea}from"./agents-B8n-p0aX.js";import{t as Wa}from"./instanceSettings-D1nNVWU0.js";import{u as Ri}from"./inboxArchiveCache-CxaLM1R8.js";import{t as Ti}from"./projects-l3kQxnTp.js";import{a as Oi,c as Ei,n as Wi,r as $i,s as _i,t as Mi}from"./dialog-CeH7rDcv.js";import{t as Li}from"./access-DhB95qNC.js";import{i as Bi,r as Fi}from"./assignees-DkQNbPzi.js";import{t as qi}from"./activity-CudcEDwO.js";import{t as ca}from"./AgentIdentity-DBHRFgMM.js";import{t as Di}from"./textarea-CTx68BDs.js";import{t as zi}from"./recent-selections-BnN_nb6Y.js";import{a as Ui,i as Ki,r as Vi,t as Qi}from"./recent-assignees-DmalYaLf.js";import{t as Hi}from"./InlineEntitySelector-BboofK18.js";import{t as Gi}from"./clipboard-CTLKYvRL.js";import{t as kt}from"./StatusIcon-Cs1RbJGu.js";import{_ as Xi,g as Yi,h as Ji,m as da,p as Zi,v as eo}from"./issue-blockers-t3wlvg4M.js";import{Bn as to,Er as so,Ga as $a,Ja as no,Jn as ao,Qn as ro,Un as lo,Vn as io,Xn as oo,Yn as ua,Za as co,fr as xa,ir as uo,nr as xo,or as ma,pn as mo,pr as ho,qn as ha,rr as po,wn as fo}from"./index-LM7k1NmC.js";import{d as _a,i as go,n as Ma,s as bo,t as jo}from"./ImageGalleryModal-VT9I4D2p.js";import{i as yo,r as ko,t as wt}from"./IssueReferencePill-EbOs3MtQ.js";import{t as wo}from"./query-placeholder-data-Bg4z2kcq.js";import{i as vo,o as No,p as Co,r as Io,u as Ao}from"./SourceTrustBadge-CXZGc8G4.js";import{n as So}from"./runRetryState-p_i4Mh7u.js";import{o as Po,s as Ro}from"./issue-output-BM-lLts2.js";import{n as To}from"./review-policy-B1PowuVV.js";import{t as Oo}from"./separator-6cvFqhvW.js";import{n as Eo,t as Wo}from"./issue-workspace-selection-CJYasFEQ.js";import{o as $o}from"./cases-lkyebfpY.js";var La={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};La.node;var _o=Ca(La),Ba={name:"table-2",size:24,node:[["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]};Ba.node;var Mo=Ca(Ba),e=Is(Wl(),1),d=Is(_l(),1);function Fa(t){const n=A({queryKey:j.issues.workProducts(t??"__none__"),queryFn:a(({signal:x})=>E.listWorkProducts(t,{signal:x,fresh:!0}),"queryFn"),enabled:!!t,refetchOnMount:"always",placeholderData:wo(t??"__none__")}),r=n.data?.filter(x=>x.type==="pull_request")??[],l=!!t&&r.length>0,c=A({queryKey:[...j.issues.workProductPullRequestRefresh(t??"__none__"),r],queryFn:a(({signal:x})=>E.listWorkProducts(t,{refreshPullRequests:!0,signal:x,fresh:!0}),"queryFn"),enabled:l,refetchOnMount:"always"}),o=(0,d.useMemo)(()=>{const x=new Map(c.data?.map(u=>[u.id,u]));return n.data?.map(u=>{const h=x.get(u.id);return u.type!=="pull_request"||!h||new Date(h.updatedAt).getTime()!==new Date(u.updatedAt).getTime()?u:{...u,metadata:h.metadata}})},[n.data,c.data]);return{...n,data:o,isFetching:n.isFetching||c.isFetching,isError:n.isError||c.isError,error:n.error??c.error,refetch:a(async()=>{await Promise.all([n.refetch(),...l?[c.refetch()]:[]])},"refetch")}}a(Fa,"useIssueWorkProducts");var pa=Is(Fl(),1);function qa(t){return A({queryKey:[...j.issues.documents(t??""),"plan"],enabled:!!t&&!t?.startsWith("chat:"),queryFn:a(async()=>{try{return await E.getDocument(t,"plan")}catch(n){if(n instanceof Aa&&n.status===404)return null;throw n}},"queryFn")})}a(qa,"useIssuePlanDocument");function Lo(t){return t.createdByAgentId?!0:!t.createdByUserId&&!t.issueCommentId}a(Lo,"isAgentAttachment");function Bo(t){const n=new Set;for(const r of t??[]){const l=va(r);l&&n.add(l.attachmentId)}return n}a(Bo,"getAttachmentBackedWorkProductAttachmentIds");function Da(t,n){const r=Bo(n);return(t??[]).filter(l=>Lo(l)&&!r.has(l.id))}a(Da,"selectAgentArtifactAttachments");function za(t){if(t.url)return t.url;const n=t.metadata;if(!n)return null;for(const r of["openPath","url"]){const l=n[r];if(typeof l=="string"&&l.trim().length>0)return l}return null}a(za,"workProductHref");function Fo(t){if(t.title?.trim())return t.title;const n=t.key.replace(/[-_]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}a(Fo,"documentDisplayTitle");var vt=new Set(["merged","closed","archived"]);function Nt(t){return vt.has(t.status)?t.status:typeof t.metadata?.state=="string"?t.metadata.state:t.status}a(Nt,"pullRequestState");function Ns(t){const n=Nt(t);return!vt.has(n)&&n!=="changes_requested"&&t.reviewState==="needs_board_review"}a(Ns,"pullRequestNeedsReview");function At(t){const n=za(t);if(!n)return null;try{const r=new URL(n);return!["http:","https:"].includes(r.protocol)||r.username||r.password?null:r.href}catch{return null}}a(At,"pullRequestHref");function qo(t){const n=At(t);if(n){const r=new URL(n),l=r.pathname.match(/^\/([^/]+)\/([^/]+)\/pull\/(\d+)\/?$/);if(r.hostname==="github.com"&&l)return`${l[1]}/${l[2]}#${l[3]}`}return t.title}a(qo,"pullRequestLabel");function Ue(t){if(!t)return null;try{const n=new URL(t);if(!["http:","https:"].includes(n.protocol)||n.username||n.password)return null;const r=n.pathname.match(/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/|$)/);return n.hostname==="github.com"&&!n.port&&r?`github.com/${r[1].toLowerCase()}/${r[2].toLowerCase()}/pull/${Number(r[3])}`:n.href}catch{return null}}a(Ue,"pullRequestIdentity");function Do(t){const n=(t??[]).filter(l=>l.type==="pull_request").sort((l,c)=>new Date(c.updatedAt).getTime()-new Date(l.updatedAt).getTime()||Number(vt.has(Nt(c)))-Number(vt.has(Nt(l)))),r=new Set;return n.filter(l=>{const c=Ue(At(l))??l.id;return r.has(c)?!1:(r.add(c),!0)}).sort((l,c)=>Number(Ns(c))-Number(Ns(l))||Number(c.isPrimary)-Number(l.isPrimary))}a(Do,"getIssuePullRequests");function zo({products:t,externalObjects:n=[]}){return(0,e.jsx)("ul",{className:"flex min-w-0 flex-col gap-2",children:t.map(r=>{const l=At(r),c=qo(r),o=Nt(r),x=Ue(l),u=x?n.find(w=>Ue(w.url)===x):void 0,h=u?Pa(u):null,b=u?.liveness==="fresh"&&(u.statusIconKey==="git-merge"||["merged","closed"].includes(h?.toLowerCase()??""));return(0,e.jsxs)("li",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[l?(0,e.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",title:r.title,className:"break-words text-sm text-accent underline-offset-2 hover:underline",children:c}):(0,e.jsxs)("span",{className:"break-words text-sm",children:[c," · No PR link provided"]}),u?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-ink-3","data-external-status":u.statusCategory,"data-external-liveness":u.liveness,children:[(0,e.jsx)(Ra,{category:u.statusCategory,liveness:u.liveness,statusIconKey:u.statusIconKey,label:h}),(0,e.jsxs)("span",{children:[h,["fresh","unknown"].includes(u.liveness)?"":` (${ii(u.liveness)})`]})]}):null,Ns(r)&&!b?(0,e.jsx)(se,{variant:"outline",children:"Review requested"}):["merged","closed","archived","draft","changes_requested"].includes(o)&&h?.toLowerCase()!==o?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[u?"Saved: ":"",o.replaceAll("_"," ")]}):null]},r.id)})})}a(zo,"IssuePullRequestLinks");function Ua(t){return A({queryKey:[...j.issues.documents(t??""),"list"],enabled:!!t&&!t?.startsWith("chat:"),queryFn:a(()=>E.listDocuments(t),"queryFn")})}a(Ua,"useIssueDocuments");function Uo(t){const n=(0,d.useMemo)(()=>ao(t),[t]),r=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{if(n.success||r.current)return;r.current=!0;const l=n.error.issues[0]?.path[0];mo(new Error(`Invalid task execution policy (${l==="stages"?"stages":l==="monitor"?"monitor":l==="authorizationPolicy"?"authorization":l==="reviewPreset"?"review_preset":"policy"})`))},[n]),n}a(Uo,"useExecutionPolicy");function Ko({status:t}){return t==="completed"?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-emerald-500/50 bg-emerald-500/10 px-2 py-0.5 text-(length:--text-micro) font-medium text-emerald-900 dark:text-emerald-100",children:[(0,e.jsx)(As,{className:"h-3 w-3"}),"Completed"]}):(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-500/50 bg-amber-500/10 px-2 py-0.5 text-(length:--text-micro) font-medium text-amber-900 dark:text-amber-100",children:[(0,e.jsx)(Oa,{className:"h-3 w-3 animate-spin"}),"In flight"]})}a(Ko,"StatusBadge");function Vo({issueId:t,issueIdentifier:n,agentMap:r}){const{data:l}=A({queryKey:j.issues.acceptedPlanDecompositions(t),queryFn:a(()=>E.listAcceptedPlanDecompositions(t),"queryFn")}),c=(0,d.useMemo)(()=>l??[],[l]);return c.length===0?null:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-ink-3",children:"Plan decomposition"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3/80",children:c.length===1?"1 accepted plan revision":`${c.length} accepted plan revisions`})]}),(0,e.jsx)("ul",{className:"space-y-3",children:c.map(o=>{const x=o.requestedChildCount??0,u=o.childIssueIds?.length??0,h=o.ownerAgentId?r?.get(o.ownerAgentId)?.name??"agent":null,b=o.acceptedPlanRevisionNumber!=null?`revision ${o.acceptedPlanRevisionNumber}`:`revision ${o.acceptedPlanRevisionId.slice(0,8)}`,w=o.completedAt&&typeof o.completedAt=="string"?o.completedAt:o.completedAt instanceof Date?o.completedAt.toISOString():null,k=typeof o.updatedAt=="string"?o.updatedAt:o.updatedAt instanceof Date?o.updatedAt.toISOString():null,$=typeof o.createdAt=="string"?o.createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():null;return(0,e.jsxs)("li",{className:"rounded-md border border-line bg-bg-2/50 p-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Ko,{status:o.status}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Plan ",b]}),(0,e.jsx)("span",{className:"text-xs text-ink-3/70",children:"·"}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-ink",children:[(0,e.jsx)(It,{className:"h-3 w-3 text-ink-3"}),u," of ",x," child ",x===1?"task":"tasks"," created"]}),o.status==="completed"&&x>0?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-sky-500/40 bg-sky-500/10 px-1.5 py-0.5 text-(length:--text-nano) font-medium text-sky-900 dark:text-sky-100",title:"Repeat attempts with this fingerprint reuse this record instead of creating new children",children:[(0,e.jsx)(wi,{className:"h-3 w-3"}),"Idempotent claim"]}):null]}),(0,e.jsxs)("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-(length:--text-micro) text-ink-3",children:[h?(0,e.jsxs)("span",{children:["Owner: ",h]}):null,$?(0,e.jsxs)("span",{title:M($),children:["Started ",ks($)]}):null,w?(0,e.jsxs)("span",{title:M(w),children:["Completed ",ks(w)]}):k?(0,e.jsxs)("span",{title:M(k),children:["Updated ",ks(k)]}):null,n?(0,e.jsx)(V,{to:`/issues/${n}#document-plan`,className:"underline-offset-2 hover:underline",children:"Plan document"}):null]}),o.childIssues&&o.childIssues.length>0?(0,e.jsx)("ul",{className:"mt-2 flex flex-wrap gap-1.5",children:o.childIssues.map(v=>(0,e.jsx)("li",{children:(0,e.jsxs)(V,{to:`/issues/${v.identifier??v.id}`,className:g("inline-flex max-w-full items-center gap-1 rounded-sm border border-line bg-bg px-2 py-0.5 text-(length:--text-micro) text-ink transition-colors hover:bg-bg-3/40"),title:v.title,children:[(0,e.jsx)("span",{className:"font-medium",children:v.identifier??v.id.slice(0,8)}),(0,e.jsx)("span",{className:"truncate max-w-(--sz-24ch) text-ink-3",children:v.title}),(0,e.jsx)(ri,{className:"h-3 w-3 text-ink-3"})]})},v.id))}):null]},o.id)})})]})}a(Vo,"IssuePlanDecompositionsSection");function Qo(t){return(t??[]).some(n=>n.kind==="request_confirmation"&&n.status==="pending"&&n.payload.target?.type==="issue_document"&&n.payload.target.key==="plan")}a(Qo,"hasPendingPlanConfirmation");function Ho({issue:t}){const{data:n,isLoading:r}=qa(t.id),l=Ss(),[c,o]=(0,d.useState)(!1),{data:x}=A({queryKey:j.issues.acceptedPlanDecompositions(t.id),queryFn:a(()=>E.listAcceptedPlanDecompositions(t.id),"queryFn")}),{data:u}=A({queryKey:j.issues.interactions(t.id),queryFn:a(()=>E.listInteractions(t.id),"queryFn")}),h=(x?.length??0)>0,b=Qo(u);return!n&&!h?(0,e.jsx)("div",{className:"px-1 py-6 text-sm text-ink-3",children:r?"Loading plan…":t.workMode==="planning"?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{children:"This task is in plan mode but no plan document has been written yet."}),b?(0,e.jsx)("p",{className:"text-amber-foreground",children:"A plan confirmation is pending, but the plan document it should confirm is missing."}):null]}):"No plan yet. The plan document, accepted plans, and their revisions will appear here."}):(0,e.jsxs)("div",{className:"space-y-4 py-2",children:[n?(0,e.jsxs)("section",{"data-testid":"issue-plan-document",className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 text-xs text-ink-3",children:[`Revision ${n.latestRevisionNumber??1} · updated ${new Date(n.updatedAt).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}`,(0,e.jsx)(Rs,{issueId:t.id,docKey:"plan",panelOpen:c,onToggle:a(()=>o(w=>!w),"onToggle")})]}),(0,e.jsx)(Ps,{issueId:t.id,doc:{key:"plan",latestRevisionId:n.latestRevisionId,latestRevisionNumber:n.latestRevisionNumber},bodyMarkdown:n.body,draftDirty:!1,draftConflicted:!1,historicalPreview:!1,locationHash:l.hash,panelOpen:c,onPanelOpenChange:o,panelPlacement:"popover",children:(0,e.jsx)(Ts,{children:n.body})})]}):null,h?(0,e.jsx)(Vo,{issueId:t.id,issueIdentifier:t.identifier}):null]})}a(Ho,"IssuePropertiesPlansTab");function T(t,...n){for(const r of n){const l=t?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}a(T,"artifactText");function ue(t,...n){for(const r of n){const l=t?.[r];if(typeof l=="number"&&Number.isFinite(l)&&l>=0)return l}return null}a(ue,"artifactNumber");function ae(t){if(!t||/[\u0000-\u0020\\]/.test(t))return"";if(t.startsWith("/")&&!t.startsWith("//"))return t;try{const n=new URL(t);return["https:","http:"].includes(n.protocol)?t:""}catch{return""}}a(ae,"artifactUrl");function Ct(t){return/^\/api\/attachments\/[a-zA-Z0-9-]+\/content$/.test(t)?t:""}a(Ct,"artifactPreviewUrl");function Go(t){return t===null?"":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}a(Go,"artifactFileSize");var Xo=50;function Yo(t){if(new TextEncoder().encode(t).length>1048576)throw new Error("CSV is too large to preview. Download the file to view it.");const n=[];let r=[],l="",c=!1,o=!1;const x=a(()=>{if(r.push(l),r.length>Xo)throw new Error("CSV has too many columns to preview. Download the file to view it.");l="",o=!1},"endField"),u=t.replace(/^\uFEFF/,"");for(let h=0;h<u.length;h++){const b=u[h];if(c)b==='"'&&u[h+1]==='"'?(l+='"',h++):b==='"'?(c=!1,o=!0):l+=b;else if(b===",")x();else if(b===`
1
+ var Ol=Object.defineProperty;var a=(t,n)=>Ol(t,"name",{value:n,configurable:!0});import{i as Is}from"./rolldown-runtime-ZpX3ckPj.js";import{Ci as va,O as ks,Si as El,Ti as Na,h as M,l as g,la as Wl,m as $l,t as Ca,ua as _l,w as Ml,wi as Ll,xi as Bl}from"./createLucideIcon-CgrPXnTY.js";import{l as Fl}from"./dist-DYoIyA63.js";import{a as As,h as Ss}from"./star-eem0qj3E.js";import{X as Ia,_ as Ce,n as Aa,t as j,v as A}from"./queryKeys-BzT8CD34.js";import{o as ql}from"./companies-query-BEdFiAhG.js";import{t as Dl}from"./issue-attribution-DfN_3u2W.js";import{n as Ps,t as Rs}from"./IssueDocumentAnnotations-DpFXlkRb.js";import{n as zl,r as Ul}from"./WorkspaceRuntimeControls-Clk2nzU6.js";import{n as Kl}from"./CompanyContext-fQCNWI_f.js";import{A as sa,P as Vl,a as Ql,at as Hl,on as jt,ot as It,t as V,v as na,zt as E}from"./router-CJbFZfVR.js";import{i as Gl,p as Xl,r as Yl,t as Jl}from"./dropdown-menu-rUbU8QKw.js";import{i as Zl,n as qe,r as ei,t as ti}from"./tabs-CjHzZxtD.js";import{o as aa,r as ra,t as la}from"./popover-CWlBonqy.js";import{t as si}from"./archive-restore-tP0pyaei.js";import{t as ni}from"./arrow-right-W0iJ_-Zs.js";import{t as yt}from"./arrow-up-right-CFNgVoQj.js";import{t as ne}from"./check-Bis3vECb.js";import{t as ws}from"./chevron-down-nRcQ7bok.js";import{t as ai}from"./chevron-left-DnUVccc_.js";import{t as ri}from"./chevron-right-BP8JjEC_.js";import{t as li}from"./circle-question-mark-CasEGiDp.js";import{t as Sa}from"./clock-D2UFngg7.js";import{A as ii,E as Pa,I as oi,M as ia,N as ci,S as di,T as ui,j as xi,k as mi,n as Ra,t as Ts,x as hi}from"./MarkdownBody-cPGkwwjq.js";import{t as Ta}from"./external-link-BIcMNNSN.js";import{t as Os}from"./file-text-CsPKrMTp.js";import{t as pi}from"./file-CcVMTQhg.js";import{a as fi,i as gi,n as bi,t as ji}from"./RichWorkProductCard-DndJn4LV.js";import{t as yi}from"./folder-open-Dkshp3J4.js";import{t as ki}from"./git-pull-request-DXoACxvx.js";import{r as Oa,t as W}from"./button-DI4w5WP7.js";import{t as vs}from"./plus-CwNlqadt.js";import{t as wi}from"./repeat-DzPORJjX.js";import{t as oa}from"./rotate-ccw-DpzLJhXT.js";import{t as vi}from"./triangle-alert-CnHMpmva.js";import{t as De}from"./user-D5V640s5.js";import{t as Ni}from"./x-6E1yeU3Q.js";import{i as Ci,n as Ii,r as Ai,t as Si}from"./tooltip-CW50mEoC.js";import{t as se}from"./badge-jeXr866I.js";import{t as Pi}from"./Identity-8eG_HXAH.js";import{t as ve}from"./AgentAvatar-BZiiDlCN.js";import{t as Ea}from"./agents-B8n-p0aX.js";import{t as Wa}from"./instanceSettings-D1nNVWU0.js";import{u as Ri}from"./inboxArchiveCache-CxaLM1R8.js";import{t as Ti}from"./projects-l3kQxnTp.js";import{a as Oi,c as Ei,n as Wi,r as $i,s as _i,t as Mi}from"./dialog-CeH7rDcv.js";import{t as Li}from"./access-DhB95qNC.js";import{i as Bi,r as Fi}from"./assignees-DkQNbPzi.js";import{t as qi}from"./activity-CudcEDwO.js";import{t as ca}from"./AgentIdentity-DBHRFgMM.js";import{t as Di}from"./textarea-CTx68BDs.js";import{t as zi}from"./recent-selections-BnN_nb6Y.js";import{a as Ui,i as Ki,r as Vi,t as Qi}from"./recent-assignees-DmalYaLf.js";import{t as Hi}from"./InlineEntitySelector-BboofK18.js";import{t as Gi}from"./clipboard-CTLKYvRL.js";import{t as kt}from"./StatusIcon-Cs1RbJGu.js";import{_ as Xi,g as Yi,h as Ji,m as da,p as Zi,v as eo}from"./issue-blockers-t3wlvg4M.js";import{Bn as to,Er as so,Ga as $a,Ja as no,Jn as ao,Qn as ro,Un as lo,Vn as io,Xn as oo,Yn as ua,Za as co,fr as xa,ir as uo,nr as xo,or as ma,pn as mo,pr as ho,qn as ha,rr as po,wn as fo}from"./index-QhteFtm-.js";import{d as _a,i as go,n as Ma,s as bo,t as jo}from"./ImageGalleryModal-D_VQgcBt.js";import{i as yo,r as ko,t as wt}from"./IssueReferencePill-BT7NBEy_.js";import{t as wo}from"./query-placeholder-data-Bg4z2kcq.js";import{i as vo,o as No,p as Co,r as Io,u as Ao}from"./SourceTrustBadge-CCPQEGrC.js";import{n as So}from"./runRetryState-p_i4Mh7u.js";import{o as Po,s as Ro}from"./issue-output-BM-lLts2.js";import{n as To}from"./review-policy-B1PowuVV.js";import{t as Oo}from"./separator-6cvFqhvW.js";import{n as Eo,t as Wo}from"./issue-workspace-selection-pUdSkrJA.js";import{o as $o}from"./cases-lkyebfpY.js";var La={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};La.node;var _o=Ca(La),Ba={name:"table-2",size:24,node:[["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]};Ba.node;var Mo=Ca(Ba),e=Is(Wl(),1),d=Is(_l(),1);function Fa(t){const n=A({queryKey:j.issues.workProducts(t??"__none__"),queryFn:a(({signal:x})=>E.listWorkProducts(t,{signal:x,fresh:!0}),"queryFn"),enabled:!!t,refetchOnMount:"always",placeholderData:wo(t??"__none__")}),r=n.data?.filter(x=>x.type==="pull_request")??[],l=!!t&&r.length>0,c=A({queryKey:[...j.issues.workProductPullRequestRefresh(t??"__none__"),r],queryFn:a(({signal:x})=>E.listWorkProducts(t,{refreshPullRequests:!0,signal:x,fresh:!0}),"queryFn"),enabled:l,refetchOnMount:"always"}),o=(0,d.useMemo)(()=>{const x=new Map(c.data?.map(u=>[u.id,u]));return n.data?.map(u=>{const h=x.get(u.id);return u.type!=="pull_request"||!h||new Date(h.updatedAt).getTime()!==new Date(u.updatedAt).getTime()?u:{...u,metadata:h.metadata}})},[n.data,c.data]);return{...n,data:o,isFetching:n.isFetching||c.isFetching,isError:n.isError||c.isError,error:n.error??c.error,refetch:a(async()=>{await Promise.all([n.refetch(),...l?[c.refetch()]:[]])},"refetch")}}a(Fa,"useIssueWorkProducts");var pa=Is(Fl(),1);function qa(t){return A({queryKey:[...j.issues.documents(t??""),"plan"],enabled:!!t&&!t?.startsWith("chat:"),queryFn:a(async()=>{try{return await E.getDocument(t,"plan")}catch(n){if(n instanceof Aa&&n.status===404)return null;throw n}},"queryFn")})}a(qa,"useIssuePlanDocument");function Lo(t){return t.createdByAgentId?!0:!t.createdByUserId&&!t.issueCommentId}a(Lo,"isAgentAttachment");function Bo(t){const n=new Set;for(const r of t??[]){const l=va(r);l&&n.add(l.attachmentId)}return n}a(Bo,"getAttachmentBackedWorkProductAttachmentIds");function Da(t,n){const r=Bo(n);return(t??[]).filter(l=>Lo(l)&&!r.has(l.id))}a(Da,"selectAgentArtifactAttachments");function za(t){if(t.url)return t.url;const n=t.metadata;if(!n)return null;for(const r of["openPath","url"]){const l=n[r];if(typeof l=="string"&&l.trim().length>0)return l}return null}a(za,"workProductHref");function Fo(t){if(t.title?.trim())return t.title;const n=t.key.replace(/[-_]+/g," ").trim();return n.charAt(0).toUpperCase()+n.slice(1)}a(Fo,"documentDisplayTitle");var vt=new Set(["merged","closed","archived"]);function Nt(t){return vt.has(t.status)?t.status:typeof t.metadata?.state=="string"?t.metadata.state:t.status}a(Nt,"pullRequestState");function Ns(t){const n=Nt(t);return!vt.has(n)&&n!=="changes_requested"&&t.reviewState==="needs_board_review"}a(Ns,"pullRequestNeedsReview");function At(t){const n=za(t);if(!n)return null;try{const r=new URL(n);return!["http:","https:"].includes(r.protocol)||r.username||r.password?null:r.href}catch{return null}}a(At,"pullRequestHref");function qo(t){const n=At(t);if(n){const r=new URL(n),l=r.pathname.match(/^\/([^/]+)\/([^/]+)\/pull\/(\d+)\/?$/);if(r.hostname==="github.com"&&l)return`${l[1]}/${l[2]}#${l[3]}`}return t.title}a(qo,"pullRequestLabel");function Ue(t){if(!t)return null;try{const n=new URL(t);if(!["http:","https:"].includes(n.protocol)||n.username||n.password)return null;const r=n.pathname.match(/^\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/|$)/);return n.hostname==="github.com"&&!n.port&&r?`github.com/${r[1].toLowerCase()}/${r[2].toLowerCase()}/pull/${Number(r[3])}`:n.href}catch{return null}}a(Ue,"pullRequestIdentity");function Do(t){const n=(t??[]).filter(l=>l.type==="pull_request").sort((l,c)=>new Date(c.updatedAt).getTime()-new Date(l.updatedAt).getTime()||Number(vt.has(Nt(c)))-Number(vt.has(Nt(l)))),r=new Set;return n.filter(l=>{const c=Ue(At(l))??l.id;return r.has(c)?!1:(r.add(c),!0)}).sort((l,c)=>Number(Ns(c))-Number(Ns(l))||Number(c.isPrimary)-Number(l.isPrimary))}a(Do,"getIssuePullRequests");function zo({products:t,externalObjects:n=[]}){return(0,e.jsx)("ul",{className:"flex min-w-0 flex-col gap-2",children:t.map(r=>{const l=At(r),c=qo(r),o=Nt(r),x=Ue(l),u=x?n.find(w=>Ue(w.url)===x):void 0,h=u?Pa(u):null,b=u?.liveness==="fresh"&&(u.statusIconKey==="git-merge"||["merged","closed"].includes(h?.toLowerCase()??""));return(0,e.jsxs)("li",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[l?(0,e.jsx)("a",{href:l,target:"_blank",rel:"noopener noreferrer",title:r.title,className:"break-words text-sm text-accent underline-offset-2 hover:underline",children:c}):(0,e.jsxs)("span",{className:"break-words text-sm",children:[c," · No PR link provided"]}),u?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-ink-3","data-external-status":u.statusCategory,"data-external-liveness":u.liveness,children:[(0,e.jsx)(Ra,{category:u.statusCategory,liveness:u.liveness,statusIconKey:u.statusIconKey,label:h}),(0,e.jsxs)("span",{children:[h,["fresh","unknown"].includes(u.liveness)?"":` (${ii(u.liveness)})`]})]}):null,Ns(r)&&!b?(0,e.jsx)(se,{variant:"outline",children:"Review requested"}):["merged","closed","archived","draft","changes_requested"].includes(o)&&h?.toLowerCase()!==o?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[u?"Saved: ":"",o.replaceAll("_"," ")]}):null]},r.id)})})}a(zo,"IssuePullRequestLinks");function Ua(t){return A({queryKey:[...j.issues.documents(t??""),"list"],enabled:!!t&&!t?.startsWith("chat:"),queryFn:a(()=>E.listDocuments(t),"queryFn")})}a(Ua,"useIssueDocuments");function Uo(t){const n=(0,d.useMemo)(()=>ao(t),[t]),r=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{if(n.success||r.current)return;r.current=!0;const l=n.error.issues[0]?.path[0];mo(new Error(`Invalid task execution policy (${l==="stages"?"stages":l==="monitor"?"monitor":l==="authorizationPolicy"?"authorization":l==="reviewPreset"?"review_preset":"policy"})`))},[n]),n}a(Uo,"useExecutionPolicy");function Ko({status:t}){return t==="completed"?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-emerald-500/50 bg-emerald-500/10 px-2 py-0.5 text-(length:--text-micro) font-medium text-emerald-900 dark:text-emerald-100",children:[(0,e.jsx)(As,{className:"h-3 w-3"}),"Completed"]}):(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-amber-500/50 bg-amber-500/10 px-2 py-0.5 text-(length:--text-micro) font-medium text-amber-900 dark:text-amber-100",children:[(0,e.jsx)(Oa,{className:"h-3 w-3 animate-spin"}),"In flight"]})}a(Ko,"StatusBadge");function Vo({issueId:t,issueIdentifier:n,agentMap:r}){const{data:l}=A({queryKey:j.issues.acceptedPlanDecompositions(t),queryFn:a(()=>E.listAcceptedPlanDecompositions(t),"queryFn")}),c=(0,d.useMemo)(()=>l??[],[l]);return c.length===0?null:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium text-ink-3",children:"Plan decomposition"}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3/80",children:c.length===1?"1 accepted plan revision":`${c.length} accepted plan revisions`})]}),(0,e.jsx)("ul",{className:"space-y-3",children:c.map(o=>{const x=o.requestedChildCount??0,u=o.childIssueIds?.length??0,h=o.ownerAgentId?r?.get(o.ownerAgentId)?.name??"agent":null,b=o.acceptedPlanRevisionNumber!=null?`revision ${o.acceptedPlanRevisionNumber}`:`revision ${o.acceptedPlanRevisionId.slice(0,8)}`,w=o.completedAt&&typeof o.completedAt=="string"?o.completedAt:o.completedAt instanceof Date?o.completedAt.toISOString():null,k=typeof o.updatedAt=="string"?o.updatedAt:o.updatedAt instanceof Date?o.updatedAt.toISOString():null,$=typeof o.createdAt=="string"?o.createdAt:o.createdAt instanceof Date?o.createdAt.toISOString():null;return(0,e.jsxs)("li",{className:"rounded-md border border-line bg-bg-2/50 p-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Ko,{status:o.status}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Plan ",b]}),(0,e.jsx)("span",{className:"text-xs text-ink-3/70",children:"·"}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs text-ink",children:[(0,e.jsx)(It,{className:"h-3 w-3 text-ink-3"}),u," of ",x," child ",x===1?"task":"tasks"," created"]}),o.status==="completed"&&x>0?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-sm border border-sky-500/40 bg-sky-500/10 px-1.5 py-0.5 text-(length:--text-nano) font-medium text-sky-900 dark:text-sky-100",title:"Repeat attempts with this fingerprint reuse this record instead of creating new children",children:[(0,e.jsx)(wi,{className:"h-3 w-3"}),"Idempotent claim"]}):null]}),(0,e.jsxs)("div",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-0.5 text-(length:--text-micro) text-ink-3",children:[h?(0,e.jsxs)("span",{children:["Owner: ",h]}):null,$?(0,e.jsxs)("span",{title:M($),children:["Started ",ks($)]}):null,w?(0,e.jsxs)("span",{title:M(w),children:["Completed ",ks(w)]}):k?(0,e.jsxs)("span",{title:M(k),children:["Updated ",ks(k)]}):null,n?(0,e.jsx)(V,{to:`/issues/${n}#document-plan`,className:"underline-offset-2 hover:underline",children:"Plan document"}):null]}),o.childIssues&&o.childIssues.length>0?(0,e.jsx)("ul",{className:"mt-2 flex flex-wrap gap-1.5",children:o.childIssues.map(v=>(0,e.jsx)("li",{children:(0,e.jsxs)(V,{to:`/issues/${v.identifier??v.id}`,className:g("inline-flex max-w-full items-center gap-1 rounded-sm border border-line bg-bg px-2 py-0.5 text-(length:--text-micro) text-ink transition-colors hover:bg-bg-3/40"),title:v.title,children:[(0,e.jsx)("span",{className:"font-medium",children:v.identifier??v.id.slice(0,8)}),(0,e.jsx)("span",{className:"truncate max-w-(--sz-24ch) text-ink-3",children:v.title}),(0,e.jsx)(ri,{className:"h-3 w-3 text-ink-3"})]})},v.id))}):null]},o.id)})})]})}a(Vo,"IssuePlanDecompositionsSection");function Qo(t){return(t??[]).some(n=>n.kind==="request_confirmation"&&n.status==="pending"&&n.payload.target?.type==="issue_document"&&n.payload.target.key==="plan")}a(Qo,"hasPendingPlanConfirmation");function Ho({issue:t}){const{data:n,isLoading:r}=qa(t.id),l=Ss(),[c,o]=(0,d.useState)(!1),{data:x}=A({queryKey:j.issues.acceptedPlanDecompositions(t.id),queryFn:a(()=>E.listAcceptedPlanDecompositions(t.id),"queryFn")}),{data:u}=A({queryKey:j.issues.interactions(t.id),queryFn:a(()=>E.listInteractions(t.id),"queryFn")}),h=(x?.length??0)>0,b=Qo(u);return!n&&!h?(0,e.jsx)("div",{className:"px-1 py-6 text-sm text-ink-3",children:r?"Loading plan…":t.workMode==="planning"?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{children:"This task is in plan mode but no plan document has been written yet."}),b?(0,e.jsx)("p",{className:"text-amber-foreground",children:"A plan confirmation is pending, but the plan document it should confirm is missing."}):null]}):"No plan yet. The plan document, accepted plans, and their revisions will appear here."}):(0,e.jsxs)("div",{className:"space-y-4 py-2",children:[n?(0,e.jsxs)("section",{"data-testid":"issue-plan-document",className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 text-xs text-ink-3",children:[`Revision ${n.latestRevisionNumber??1} · updated ${new Date(n.updatedAt).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}`,(0,e.jsx)(Rs,{issueId:t.id,docKey:"plan",panelOpen:c,onToggle:a(()=>o(w=>!w),"onToggle")})]}),(0,e.jsx)(Ps,{issueId:t.id,doc:{key:"plan",latestRevisionId:n.latestRevisionId,latestRevisionNumber:n.latestRevisionNumber},bodyMarkdown:n.body,draftDirty:!1,draftConflicted:!1,historicalPreview:!1,locationHash:l.hash,panelOpen:c,onPanelOpenChange:o,panelPlacement:"popover",children:(0,e.jsx)(Ts,{children:n.body})})]}):null,h?(0,e.jsx)(Vo,{issueId:t.id,issueIdentifier:t.identifier}):null]})}a(Ho,"IssuePropertiesPlansTab");function T(t,...n){for(const r of n){const l=t?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}a(T,"artifactText");function ue(t,...n){for(const r of n){const l=t?.[r];if(typeof l=="number"&&Number.isFinite(l)&&l>=0)return l}return null}a(ue,"artifactNumber");function ae(t){if(!t||/[\u0000-\u0020\\]/.test(t))return"";if(t.startsWith("/")&&!t.startsWith("//"))return t;try{const n=new URL(t);return["https:","http:"].includes(n.protocol)?t:""}catch{return""}}a(ae,"artifactUrl");function Ct(t){return/^\/api\/attachments\/[a-zA-Z0-9-]+\/content$/.test(t)?t:""}a(Ct,"artifactPreviewUrl");function Go(t){return t===null?"":t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1048576).toFixed(1)} MB`}a(Go,"artifactFileSize");var Xo=50;function Yo(t){if(new TextEncoder().encode(t).length>1048576)throw new Error("CSV is too large to preview. Download the file to view it.");const n=[];let r=[],l="",c=!1,o=!1;const x=a(()=>{if(r.push(l),r.length>Xo)throw new Error("CSV has too many columns to preview. Download the file to view it.");l="",o=!1},"endField"),u=t.replace(/^\uFEFF/,"");for(let h=0;h<u.length;h++){const b=u[h];if(c)b==='"'&&u[h+1]==='"'?(l+='"',h++):b==='"'?(c=!1,o=!0):l+=b;else if(b===",")x();else if(b===`
2
2
  `||b==="\r"){if(x(),n.push(r),r=[],b==="\r"&&u[h+1]===`
3
3
  `&&h++,n.length>201)break}else if(b==='"'&&!l&&!o)c=!0;else{if(o||b==='"')throw new Error("CSV could not be previewed. Download the file to view it.");l+=b}}if(c)throw new Error("CSV could not be previewed. Download the file to view it.");return(l||r.length||o)&&(x(),n.push(r)),{columns:n[0]??[],rows:n.slice(1,201),truncated:n.length>201}}a(Yo,"parseArtifactCsv");async function Jo(t,n){if(!/^\/api\/attachments\/[a-zA-Z0-9-]+\/content$/.test(t))throw new Error("CSV preview is unavailable. Download the file to view it.");const r=await fetch(t,{credentials:"same-origin",redirect:"error",signal:n});if(!r.ok)throw new Error("CSV could not be loaded. Try again or download the file.");if(Number(r.headers.get("content-length"))>1048576)throw await r.body?.cancel(),new Error("CSV is too large to preview. Download the file to view it.");const l=r.body?.getReader();if(!l)throw new Error("CSV could not be loaded. Try again or download the file.");const c=new TextDecoder;let o="",x=0;try{for(;;){const{value:u,done:h}=await l.read();if(h)break;if(x+=u.byteLength,x>1048576)throw await l.cancel(),new Error("CSV is too large to preview. Download the file to view it.");o+=c.decode(u,{stream:!0})}o+=c.decode()}finally{l.releaseLock()}return Yo(o)}a(Jo,"loadArtifactCsv");function re({title:t,summary:n}){return(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)("h2",{className:"break-words text-lg font-semibold leading-snug",children:t}),n&&(0,e.jsx)("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-ink-3",children:n})]})}a(re,"Identity");function le({author:t,updatedAt:n,action:r,statusBadge:l}){return(0,e.jsxs)("footer",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-line px-5 py-3",children:[(0,e.jsx)("span",{className:"text-xs text-ink-3",children:[t,n].filter(Boolean).join(" · ")}),l,r]})}a(le,"Footer");function ie({children:t}){return(0,e.jsx)("article",{className:"w-full overflow-hidden rounded-lg border border-line bg-bg-2 text-ink",children:t})}a(ie,"Card");function Ke({url:t,children:n}){return t?(0,e.jsx)(W,{variant:"secondary",size:"sm",asChild:!0,children:(0,e.jsxs)("a",{href:t,target:"_blank",rel:"noreferrer",children:[n,(0,e.jsx)(Ta,{className:"size-3"})]})}):(0,e.jsx)(W,{variant:"secondary",size:"sm",disabled:!0,children:n})}a(Ke,"SourceLink");function Es({title:t,description:n,action:r,children:l}){return(0,e.jsxs)(Mi,{children:[(0,e.jsx)(Ei,{asChild:!0,children:(0,e.jsx)(W,{size:"sm",variant:"secondary",children:r})}),(0,e.jsxs)(Wi,{className:"max-h-dvh overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Oi,{children:[(0,e.jsx)(_i,{className:"pr-6",children:t}),(0,e.jsx)($i,{children:n})]}),l]})]})}a(Es,"Viewer");function Ka({additions:t,deletions:n,filesChanged:r}){return(0,e.jsxs)("div",{className:"flex flex-wrap gap-2 font-mono text-xs",children:[t!=null&&(0,e.jsxs)("span",{className:"text-(--status-task-icon-done)",children:["+",t.toLocaleString("en-US")]}),n!=null&&(0,e.jsxs)("span",{className:"text-(--status-task-icon-blocked)",children:["−",n.toLocaleString("en-US")]}),r!=null&&(0,e.jsxs)("span",{className:"text-ink-3",children:[r," ",r===1?"file":"files"]})]})}a(Ka,"Diff");var Zo={passed:"Checks passed",pending:"Checks pending",failed:"Checks failed",unknown:"Checks not available"},ec={open:"Open",draft:"Draft",merged:"Merged",closed:"Closed",unknown:"State unknown"};function tc(t){const{number:n,repository:r,sourceBranch:l,targetBranch:c,state:o,checks:x,evidenceSource:u,reviewSummary:h,url:b}=t,w={passed:As,pending:Sa,failed:vi,unknown:li}[x],k={passed:"text-(--status-task-icon-done)",pending:"text-ink-3",failed:"text-(--status-task-icon-blocked)",unknown:"text-ink-3"}[x];return(0,e.jsxs)(ie,{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 p-5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(ki,{className:"size-4"})," Pull request"," ",n!=null&&(0,e.jsxs)("span",{className:"font-mono",children:["#",n]})]}),(0,e.jsxs)(se,{variant:"outline",className:o==="merged"?"text-(--status-task-icon-done)":"text-ink-3",children:[o==="merged"&&(0,e.jsx)(oi,{className:"size-3"}),ec[o]]})]}),(0,e.jsx)(re,{...t}),(0,e.jsxs)("div",{className:"flex flex-col gap-2 text-xs text-ink-3",children:[(0,e.jsx)("span",{children:r}),(l||c)&&(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)(It,{className:"size-3.5 shrink-0"}),(0,e.jsx)("code",{className:"min-w-0 truncate",title:l,children:l}),l&&c&&(0,e.jsx)(ni,{className:"size-3.5 shrink-0"}),(0,e.jsx)("code",{className:"min-w-0 truncate",title:c,children:c})]})]}),(0,e.jsx)(Ka,{...t})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-2 border-t border-line px-5 py-4",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs",children:[(0,e.jsx)(w,{className:`size-4 ${k}`}),Zo[x]]}),h&&(0,e.jsx)("p",{className:"text-xs leading-relaxed",children:h}),u&&(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Source: ",u]})]}),(0,e.jsx)(le,{...t,action:(0,e.jsx)(Ke,{url:b,children:"Open pull request"})})]})}a(tc,"PullRequestCard");function sc(t){return(0,e.jsxs)(ie,{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(no,{className:"size-4"})," Commit"," ",(0,e.jsx)("code",{title:t.sha,children:t.sha.slice(0,8)})]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-words text-xs text-ink-3",children:t.repository}),t.branch&&(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(It,{className:"size-3.5"}),(0,e.jsx)("code",{className:"min-w-0 truncate",children:t.branch})]}),(0,e.jsx)(Ka,{...t})]}),(0,e.jsx)(le,{...t,action:(0,e.jsx)(Ke,{url:t.url,children:"View commit"})})]})}a(sc,"CommitCard");function fa({body:t}){return(0,e.jsx)("div",{className:"flex flex-col gap-3 text-sm leading-relaxed",children:(0,e.jsx)(di,{components:{h1:a(({children:n})=>(0,e.jsx)("h3",{className:"text-lg font-semibold",children:n}),"h1"),h2:a(({children:n})=>(0,e.jsx)("h3",{className:"text-base font-semibold",children:n}),"h2"),h3:a(({children:n})=>(0,e.jsx)("h4",{className:"text-sm font-semibold",children:n}),"h3"),ul:a(({children:n})=>(0,e.jsx)("ul",{className:"list-disc space-y-1 pl-5",children:n}),"ul"),ol:a(({children:n})=>(0,e.jsx)("ol",{className:"list-decimal space-y-1 pl-5",children:n}),"ol"),img:a(({src:n,alt:r})=>{const l=Ct(typeof n=="string"?n:"");if(l)return(0,e.jsx)("img",{src:l,alt:r??"",loading:"lazy",className:"h-auto max-w-full"});const c=ae(typeof n=="string"?n:"");return c?(0,e.jsx)("a",{href:c,target:"_blank",rel:"noreferrer",className:"underline underline-offset-4",children:r||"Open image"}):(0,e.jsx)("span",{children:r})},"img"),a:a(({children:n,href:r})=>(0,e.jsx)("a",{href:r,target:"_blank",rel:"noreferrer",className:"underline underline-offset-4",children:n}),"a")},children:t})})}a(fa,"Markdown");function Va(t){return(0,e.jsxs)(ie,{children:[t.body&&(0,e.jsx)("div",{className:"max-h-52 overflow-hidden border-b border-line bg-bg-3/20 p-5",inert:!0,children:(0,e.jsx)(fa,{body:t.body.slice(0,4e3)})}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(Os,{className:"size-4"})," Markdown",t.revision!=null&&` · revision ${t.revision}`]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-all font-mono text-xs text-ink-3",children:t.filename})]}),(0,e.jsx)(le,{...t,action:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.actions,t.onOpen?(0,e.jsx)(W,{size:"sm",variant:"secondary","aria-expanded":t.expanded,onClick:t.onOpen,children:t.expanded?"Close document":"Read document"}):(0,e.jsx)(Es,{title:t.title,description:t.filename,action:"Read document",children:(0,e.jsx)(fa,{body:t.body})})]})})]})}a(Va,"DocumentCard");function ga({columns:t,rows:n}){return(0,e.jsxs)("div",{className:"overflow-x-auto",children:[(0,e.jsxs)("table",{className:"w-full text-left text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsx)("tr",{children:t.map((r,l)=>(0,e.jsx)("th",{className:"border-b border-line px-3 py-3 font-medium text-ink-3",children:r},l))})}),(0,e.jsx)("tbody",{children:n.map((r,l)=>(0,e.jsx)("tr",{children:t.map((c,o)=>(0,e.jsx)("td",{className:"border-b border-line/50 px-3 py-3",children:r[o]??""},o))},l))})]}),n.length===0&&(0,e.jsx)("p",{className:"p-4 text-xs text-ink-3",children:"No rows"})]})}a(ga,"DataTable");function nc(t){const n=[t.columns,...t.rows].map(r=>r.map(l=>`"${String(l).replaceAll('"','""')}"`).join(",")).join(`
4
4
  `);return(0,e.jsxs)(ie,{children:[(0,e.jsx)("div",{className:"border-b border-line bg-bg-3/20 px-2",children:(0,e.jsx)(ga,{columns:t.columns,rows:t.rows.slice(0,3)})}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(Mo,{className:"size-4"})," CSV · ",t.truncated?"First ":"",t.rows.length," ",t.rows.length===1?"row":"rows"," ·"," ",t.columns.length," ",t.columns.length===1?"column":"columns"]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-all font-mono text-xs text-ink-3",children:t.filename})]}),(0,e.jsx)(le,{...t,action:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.actions,(0,e.jsxs)(Es,{title:t.title,description:t.filename,action:"View data",children:[(0,e.jsx)(ga,{...t}),(0,e.jsx)(W,{asChild:!0,variant:"secondary",size:"sm",className:"w-fit",children:(0,e.jsx)("a",{download:t.filename,href:t.downloadUrl||`data:text/csv;charset=utf-8,${encodeURIComponent(n)}`,children:"Download CSV"})})]})]})})]})}a(nc,"DataCard");function Cs({src:t,alt:n}){const[r,l]=(0,d.useState)(null);return t&&r!==t?(0,e.jsx)("img",{src:t,alt:n,onError:a(()=>l(t),"onError"),loading:"lazy",className:"aspect-video w-full object-contain"}):(0,e.jsxs)("div",{className:"flex aspect-video flex-col items-center justify-center gap-3 text-ink-3",children:[(0,e.jsx)($a,{className:"size-8"}),(0,e.jsx)("span",{className:"text-xs",children:"No preview available"})]})}a(Cs,"ImageContent");function ac(t){return(0,e.jsxs)(ie,{children:[(0,e.jsx)("div",{className:"border-b border-line bg-bg-3/20",children:(0,e.jsx)(Cs,{src:t.imageUrl,alt:t.alt})}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)($a,{className:"size-4"})," Image",t.width&&t.height?` · ${t.width} × ${t.height}`:""]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-all font-mono text-xs text-ink-3",children:t.filename})]}),(0,e.jsx)(le,{...t,action:t.onOpen?(0,e.jsx)(W,{size:"sm",variant:"secondary","aria-label":`View image: ${t.title}`,onClick:t.onOpen,children:"View image"}):(0,e.jsx)(Es,{title:t.title,description:t.filename,action:"View image",children:(0,e.jsx)(Cs,{src:t.imageUrl,alt:t.alt})})})]})}a(ac,"ImageCard");function rc(t){return(0,e.jsxs)(ie,{children:[(0,e.jsx)("video",{src:t.videoUrl||void 0,poster:t.posterUrl||void 0,controls:!0,preload:"metadata","aria-label":t.title,className:"aspect-video w-full border-b border-line bg-bg-3"},t.videoUrl),(0,e.jsxs)("div",{className:"flex flex-col gap-3 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(fi,{className:"size-4"})," Video",t.duration&&` · ${t.duration}`]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-all font-mono text-xs text-ink-3",children:t.filename})]}),(0,e.jsx)(le,{...t,action:t.onOpen?(0,e.jsx)(W,{size:"sm",variant:"secondary","aria-label":`Open video: ${t.title}`,onClick:t.onOpen,children:"Open video"}):(0,e.jsx)(Ke,{url:t.videoUrl,children:"Open video"})})]})}a(rc,"VideoCard");function lc(t){return(0,e.jsxs)(ie,{children:[t.imageUrl&&(0,e.jsx)("div",{className:"border-b border-line bg-bg-3/20",children:(0,e.jsx)(Cs,{src:t.imageUrl,alt:t.imageAlt})}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(Hl,{className:"size-4"})," Link preview"]}),(0,e.jsx)(re,{...t}),(0,e.jsx)("span",{className:"break-all font-mono text-xs text-ink-3",children:t.url})]}),(0,e.jsx)(le,{...t,action:(0,e.jsx)(Ke,{url:t.url,children:"Open link"})})]})}a(lc,"LinkPreviewCard");function ic(t){return(0,e.jsxs)(ie,{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 p-5",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-ink-3",children:[(0,e.jsx)(pi,{className:"size-4"})," File",t.fileSize&&` · ${t.fileSize}`]}),(0,e.jsx)(re,{...t}),(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)("span",{className:"break-all font-mono text-xs",children:t.filename}),(0,e.jsx)("span",{className:"break-all text-xs text-ink-3",children:t.contentType})]}),t.entries.length>0&&(0,e.jsx)("ul",{className:"flex flex-col gap-2 border-t border-line pt-4",children:t.entries.map((n,r)=>(0,e.jsxs)("li",{className:"flex items-center gap-2 font-mono text-xs text-ink-3",children:[(0,e.jsx)(Os,{className:"size-3.5 shrink-0"}),n]},r))})]}),(0,e.jsx)(le,{...t,action:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.actions,t.openUrl&&(0,e.jsx)(Ke,{url:t.openUrl,children:"Open file"}),t.downloadUrl?(0,e.jsx)(W,{asChild:!0,size:"sm",variant:"secondary",children:(0,e.jsx)("a",{href:t.downloadUrl,download:t.filename,children:"Download file"})}):(0,e.jsx)(W,{size:"sm",variant:"secondary",disabled:!0,children:"Download unavailable"})]})})]})}a(ic,"FileCard");function Qa(t){const{metadata:n=null,attachmentId:r}=t,l=(0,d.useContext)(gi),c=(0,d.useContext)(_a),o=c&&r&&bo({contentType:t.contentType,originalFilename:t.filename})?(0,e.jsx)(W,{variant:"secondary",size:"sm","aria-label":`Open in tab: ${t.title}`,onClick:a(()=>c(r,t.filename),"onClick"),children:"Open in tab"}):null,[x,u]=(0,d.useState)(!1),[h,b]=(0,d.useState)(!1),w=Po(t.contentType,t.filename),k=Ro(t.contentType,t.filename),$=t.contentType.split(";")[0]==="text/csv"||/\.csv$/i.test(t.filename),v=t.byteSize!==null&&t.byteSize>1048576,Q=$&&/^\/api\/attachments\/[a-zA-Z0-9-]+\/content$/.test(t.contentPath),R=A({queryKey:["artifact-csv",t.id,t.contentPath,t.updatedAt],queryFn:a(({signal:P})=>Jo(t.contentPath,P),"queryFn"),enabled:Q&&!v&&h,retry:!1,staleTime:1/0}),S=ae(t.contentPath),N=ae(t.downloadPath),X=a(()=>{l?.(S)||u(!0)},"onOpen");return(w||k)&&S?(0,e.jsxs)(e.Fragment,{children:[k?(0,e.jsx)(rc,{...t,videoUrl:S,posterUrl:Ct(T(n,"posterUrl")),duration:T(n,"durationLabel"),onOpen:X}):(0,e.jsx)(ac,{...t,imageUrl:S,alt:T(n,"alt")||t.title,width:ue(n,"width"),height:ue(n,"height"),onOpen:X}),x&&(0,e.jsx)(jo,{items:[{id:t.id,contentPath:S,contentType:t.contentType,originalFilename:t.filename,downloadPath:N}],initialIndex:0,open:!0,onOpenChange:u})]}):Q&&!v&&R.data?(0,e.jsx)(nc,{...t,...R.data,downloadUrl:N,actions:(0,e.jsxs)(e.Fragment,{children:[o,N?(0,e.jsx)(W,{asChild:!0,size:"sm",variant:"secondary",children:(0,e.jsx)("a",{href:N,download:t.filename,children:"Download file"})}):null]})}):(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(ic,{...t,fileSize:Go(t.byteSize),entries:[],downloadUrl:N,openUrl:ae(t.openPath)||S,actions:(0,e.jsxs)(e.Fragment,{children:[o,Q&&!v&&!R.isError?(0,e.jsx)(W,{variant:"secondary",size:"sm",disabled:R.isFetching,onClick:a(()=>b(!0),"onClick"),children:R.isFetching?"Loading preview…":"Preview data"}):null]})}),$&&(v||R.isError||!Q)&&(0,e.jsxs)("div",{className:"px-2 text-xs text-ink-3",role:"status",children:[v?"CSV is too large to preview. Download the file to view it.":R.isError?R.error.message:"CSV preview is unavailable. Download the file to view it.",R.isError&&(0,e.jsx)(W,{variant:"ghost",size:"sm",onClick:a(()=>{R.refetch()},"onClick"),children:"Retry preview"})]})]})}a(Qa,"IssueArtifactFile");function oc({workProduct:t,author:n}){const r=t.metadata,l=ae(za(t)),c=bi(t.type,t.status,t.reviewState),o={title:t.title,summary:t.summary??"",author:n,updatedAt:M(t.updatedAt),statusBadge:t.healthStatus==="unhealthy"?(0,e.jsx)(se,{variant:"destructive",children:"Unhealthy"}):c?(0,e.jsx)(se,{variant:"outline",children:c.label}):void 0},x={additions:ue(r,"additions"),deletions:ue(r,"deletions"),filesChanged:ue(r,"changedFiles","files")};if(t.type==="pull_request"){const u=T(r,"state")||(t.status==="active"?"open":t.status),h=T(r,"checks");return(0,e.jsx)(tc,{...o,...x,number:ue(r,"number","pullRequestNumber"),repository:T(r,"repo","repository","repositoryName"),sourceBranch:T(r,"headRef","head","headBranch","branch"),targetBranch:T(r,"baseRef","base","baseBranch"),state:u==="open"||u==="draft"||u==="merged"||u==="closed"?u:"unknown",checks:h==="passed"||h==="failed"||h==="pending"?h:"unknown",evidenceSource:T(r,"evidenceSource"),reviewSummary:T(r,"reviewSummary"),url:l,statusBadge:t.reviewState==="changes_requested"||t.reviewState==="needs_board_review"||t.status==="ready_for_review"||t.status==="changes_requested"||t.status==="failed"||t.healthStatus==="unhealthy"?o.statusBadge:void 0})}if(t.type==="commit")return(0,e.jsx)(sc,{...o,...x,sha:T(r,"sha","shortSha")||t.externalId||"",repository:T(r,"repo","repository","repositoryName"),branch:T(r,"branch","branchName"),url:l});if(t.type==="preview_url")return(0,e.jsx)(lc,{...o,url:l,imageUrl:Ct(T(r,"imageUrl")),imageAlt:T(r,"imageAlt")||t.title});if(t.type==="artifact"){const u=va(t),h=ae(u?.contentPath||T(r,"contentPath")||l);return(0,e.jsx)(Qa,{...o,id:t.id,attachmentId:u?.attachmentId,filename:T(r,"originalFilename")||t.title,contentType:T(r,"contentType"),contentPath:h,openPath:ae(T(r,"openPath"))||l||h,downloadPath:ae(T(r,"downloadPath"))||(Ct(h)?Ma({contentPath:h}):l||h),byteSize:ue(r,"byteSize","size"),metadata:r})}return(0,e.jsx)(ji,{workProduct:t,href:l||null})}a(oc,"IssueWorkProductArtifactCard");function cc(t){switch(t){case"active":case"draft":return{label:"In progress",cssVar:"--status-task-in_progress"};case"ready_for_review":return{label:"For review",cssVar:"--status-task-in_review"};case"approved":case"merged":return{label:"Done",cssVar:"--status-task-done"};case"changes_requested":return{label:"Changes requested",cssVar:"--status-task-todo"};case"failed":return{label:"Failed",cssVar:"--status-task-blocked"};default:return null}}a(cc,"workProductStatusBadge");function dc({issueId:t,workProduct:n,metadata:r,reviewDoc:l,author:c,openRequestId:o}){const x=(0,d.useContext)(_a),[u,h]=(0,d.useState)(!1),[b,w]=(0,d.useState)(!1),k=(0,d.useRef)(null),$=Ss(),v=Ia(),Q=cc(n.status),R=r.byteSize>Bl,S=Ce({mutationFn:a(()=>E.ensureWorkProductReviewDocument(t,n.id),"mutationFn"),onSuccess:a(async()=>{await v.invalidateQueries({queryKey:j.issues.documents(t)})},"onSuccess")}),N=a(()=>{l||R||S.isPending||S.isSuccess||S.isError||S.mutate()},"requestPreview"),X=a(()=>{h(H=>(H||N(),!H))},"handleToggle");(0,d.useEffect)(()=>{o!==void 0&&h(!0)},[o]),(0,d.useEffect)(()=>{o===void 0||!u||k.current?.scrollIntoView({behavior:"smooth",block:"center"})},[u,o]),(0,d.useEffect)(()=>{o!==void 0&&N()},[o,l]);const P=S.error instanceof Aa&&[413,415,422].includes(S.error.status);let p;return R?p=(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"This Markdown file is too large to preview. Use Raw or Download instead."}):l?p=l.body.trim().length>0?(0,e.jsx)(Ps,{issueId:t,doc:l,bodyMarkdown:l.body,draftDirty:!1,draftConflicted:!1,historicalPreview:!1,locationHash:$.hash,panelOpen:b,onPanelOpenChange:w,panelPlacement:"popover",children:(0,e.jsx)(Ts,{children:l.body})}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Document is empty."}):S.isError?p=(0,e.jsxs)("div",{className:"flex flex-col items-start gap-1.5",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:P?"This file can't be previewed as Markdown. Use Raw or Download instead.":"Preview failed to load."}),P?null:(0,e.jsx)("button",{type:"button",className:"rounded-md border border-line px-2 py-0.5 text-(length:--text-micro) text-ink-3 hover:bg-bg-3/50",onClick:a(()=>{S.reset(),S.mutate()},"onClick"),children:"Retry"})]}):p=(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Preparing preview…"}),(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)("div",{ref:k,children:(0,e.jsx)(Va,{title:n.title,summary:n.summary??"",author:c,updatedAt:M(n.updatedAt),filename:r.originalFilename??n.title,revision:l?.latestRevisionNumber,body:l?.body??"",onOpen:X,expanded:u,statusBadge:Q?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:Q.label}):void 0,actions:(0,e.jsxs)(e.Fragment,{children:[l?(0,e.jsx)(Rs,{issueId:t,docKey:l.key,panelOpen:b,onToggle:a(()=>{h(!0),w(H=>!H)},"onToggle")}):null,x?(0,e.jsx)("button",{type:"button",onClick:a(()=>x(r.attachmentId,r.originalFilename??n.title),"onClick"),"aria-label":`Open in tab: ${n.title}`,title:"Open in tab",className:"shrink-0 px-1.5 py-1.5 text-ink-3 hover:text-ink",children:(0,e.jsx)(Os,{className:"h-3 w-3"})}):null,(0,e.jsx)("a",{href:r.openPath,target:"_blank",rel:"noreferrer","aria-label":`Open raw ${n.title}`,title:"Open raw",className:"shrink-0 px-1.5 py-1.5 text-ink-3 hover:text-ink",children:(0,e.jsx)(Ta,{className:"h-3 w-3"})}),(0,e.jsx)("a",{href:r.downloadPath,"aria-label":`Download ${n.title}`,title:"Download",className:"shrink-0 py-1.5 pr-2 pl-0.5 text-ink-3 hover:text-ink",children:(0,e.jsx)(co,{className:"h-3 w-3"})})]})})}),u?(0,e.jsx)("div",{className:"border-t border-line px-2.5 py-2",children:p}):null]})}a(dc,"MarkdownWorkProductRow");function uc({issueId:t,doc:n,author:r,openRequestId:l,onOpen:c}){const[o,x]=(0,d.useState)(!1),[u,h]=(0,d.useState)(!1),b=(0,d.useRef)(null),w=Ss();return(0,d.useEffect)(()=>{c||l===void 0||x(!0)},[c,l]),(0,d.useEffect)(()=>{c||l===void 0||!o||b.current?.scrollIntoView({behavior:"smooth",block:"center"})},[o,c,l]),(0,e.jsxs)("div",{ref:b,children:[(0,e.jsx)(Va,{title:Fo(n),summary:"",author:r,updatedAt:M(n.updatedAt),filename:`${n.key}.md`,revision:n.latestRevisionNumber,body:n.body,onOpen:c??(()=>x(k=>!k)),expanded:c?void 0:o,actions:c?void 0:(0,e.jsx)(Rs,{issueId:t,docKey:n.key,panelOpen:u,onToggle:a(()=>{x(!0),h(k=>!k)},"onToggle")})}),o?(0,e.jsx)("div",{className:"border-t border-line px-2.5 py-2",children:n.body.trim().length>0?(0,e.jsx)(Ps,{issueId:t,doc:n,bodyMarkdown:n.body,draftDirty:!1,draftConflicted:!1,historicalPreview:!1,locationHash:w.hash,panelOpen:u,onPanelOpenChange:h,panelPlacement:"popover",children:(0,e.jsx)(Ts,{children:n.body})}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Document is empty."})}):null]})}a(uc,"DocumentRow");function xc({issue:t,documentDeepLink:n,onOpenDocument:r}){const{data:l,isPending:c,isError:o,refetch:x}=A({queryKey:j.issues.attachments(t.id),queryFn:a(()=>E.listAttachments(t.id),"queryFn")}),{data:u,isPending:h,isError:b,refetch:w}=Fa(t.id),{data:k,isPending:$,isError:v,refetch:Q}=Ua(t.id),{data:R}=A({queryKey:j.issues.runs(t.id),queryFn:a(()=>qi.runsForIssue(t.id),"queryFn")}),{data:S}=A({queryKey:j.agents.list(t.companyId),queryFn:a(()=>Ea.list(t.companyId),"queryFn")}),N=u??[],X=(k??[]).filter(f=>!Na(f.key)),P=new Map((k??[]).map(f=>[f.key,f])),p=Da(l,u),H=(0,d.useMemo)(()=>new Map((R??[]).map(f=>[f.runId,f])),[R]),Ie=(0,d.useMemo)(()=>new Map((S??[]).map(f=>[f.id,f])),[S]),J=[...(0,d.useMemo)(()=>[...N.map(f=>({kind:"work_product",id:f.id,runId:f.createdByRunId,date:new Date(f.createdAt),value:f})),...X.map(f=>({kind:"document",id:f.id,runId:null,date:new Date(f.createdAt),value:f})),...p.map(f=>({kind:"attachment",id:f.id,runId:null,date:new Date(f.createdAt),value:f}))],[X,p,N]).reduce((f,z)=>{const Y=z.runId??"other",O=f.get(Y)??[];return O.push(z),f.set(Y,O),f},new Map)].map(([f,z])=>({runId:f,rows:z.sort((Y,O)=>O.date.getTime()-Y.date.getTime()),date:f==="other"?z[0]?.date??new Date(0):new Date(H.get(f)?.startedAt??z[0]?.date??0)})).sort((f,z)=>z.date.getTime()-f.date.getTime()),xe=o||b||v?(0,e.jsxs)("div",{role:"alert",className:"px-1 py-3 text-sm text-ink-3",children:["Some artifacts could not be loaded.",(0,e.jsx)("button",{className:"ml-2 underline",onClick:a(()=>{x(),w(),Q()},"onClick"),children:"Retry"})]}):c||h||$?(0,e.jsx)("p",{role:"status",className:"px-1 py-3 text-sm text-ink-3",children:"Loading artifacts…"}):null;return N.length===0&&X.length===0&&p.length===0?xe||(0,e.jsx)("div",{className:"px-1 py-6 text-sm text-ink-3",children:"No artifacts yet. Work products, documents, and agent-produced files will appear here."}):(0,e.jsxs)("div",{className:"@container flex flex-col gap-3 py-2",children:[xe,J.map(f=>{const z=f.runId==="other"?null:H.get(f.runId),Y=z?Ie.get(z.agentId):null;return(0,e.jsxs)("section",{className:"flex flex-col gap-1.5",children:[f.runId!=="other"?(0,e.jsxs)("header",{className:"flex items-baseline justify-between gap-2 px-1",children:[(0,e.jsx)("h3",{className:"truncate text-xs font-medium text-ink",children:Y?.name??`Run ${f.runId.slice(0,8)}`}),(0,e.jsx)("time",{className:"shrink-0 text-(length:--text-micro) text-ink-3",dateTime:f.date.toISOString(),children:M(f.date)})]}):null,(0,e.jsx)("ul",{className:"grid grid-cols-1 gap-3",children:f.rows.map(O=>{if(O.kind==="work_product"){const L=O.value,Qe=Ll(L);if(Qe){const He=El(L.id);return(0,e.jsx)("li",{className:"col-span-full min-w-0",children:(0,e.jsx)(dc,{issueId:t.id,workProduct:L,author:Y?.name??"",metadata:Qe,reviewDoc:P.get(He),openRequestId:n?.documentKey===He?n.requestId:void 0})},O.id)}return(0,e.jsx)("li",{className:"col-span-full min-w-0",children:(0,e.jsx)(oc,{workProduct:L,author:Y?.name??""})},O.id)}if(O.kind==="document"){const L=O.value;return(0,e.jsx)("li",{className:"col-span-full min-w-0",children:(0,e.jsx)(uc,{issueId:t.id,doc:L,author:Ie.get(L.updatedByAgentId??L.createdByAgentId??"")?.name??"",onOpen:r?()=>r(L):void 0,openRequestId:n?.documentKey===L.key?n.requestId:void 0})},O.id)}const F=O.value,Ve=F.originalFilename??F.objectKey;return(0,e.jsx)("li",{className:"col-span-full min-w-0",children:(0,e.jsx)(Qa,{id:F.id,attachmentId:F.id,title:Ve,summary:"",author:Ie.get(F.createdByAgentId??"")?.name??"",updatedAt:M(F.updatedAt),filename:Ve,contentType:F.contentType,contentPath:F.contentPath,openPath:go(F),downloadPath:Ma(F),byteSize:F.byteSize})},O.id)})})]},f.runId)})]})}a(xc,"IssuePropertiesArtifactsTab");function ze({children:t,className:n,title:r,first:l,streamlined:c}){return(0,e.jsxs)("div",{className:n,"data-property-section":"true",children:[r?(0,e.jsx)("div",{className:g(c?"pb-1 font-mono text-(length:--text-nano) font-normal uppercase tracking-wide text-ink-3/70":"text-xs font-semibold uppercase tracking-wide text-ink-3 pb-1",l?"pt-0":"pt-3"),children:r}):null,(0,e.jsx)("div",{className:"space-y-0.5",children:t})]})}a(ze,"PropertySection");function I({label:t,children:n,wrap:r}){return(0,e.jsxs)("div",{className:g("flex w-full min-w-0 gap-3 py-1",r?"items-start":"items-center"),"data-property-row":"true",children:[(0,e.jsx)("span",{className:g("text-xs text-ink-3 shrink-0 w-24 truncate",r&&"mt-0.5"),"data-property-label":typeof t=="string"?t:void 0,title:typeof t=="string"?t:void 0,children:t}),(0,e.jsx)("div",{className:g("flex min-w-0 flex-1 items-center gap-1.5",r&&"flex-col items-start"),"data-property-value":"true",children:n})]})}a(I,"PropertyRow");function ba({children:t,className:n,style:r,title:l}){return(0,e.jsx)(se,{variant:"outline",className:g("max-w-full min-w-0 justify-start truncate font-normal",n),style:r,title:l??(typeof t=="string"?t:void 0),children:t})}a(ba,"PropertyChip");function Ha({hiddenCount:t,expanded:n,onClick:r}){return!n&&t<=0?null:(0,e.jsx)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",onClick:r,"aria-label":n?"Show fewer items":`Show ${t} more items`,children:n?"Show less":`Show ${t} more`})}a(Ha,"ExpandRelationListButton");var mc=5;function hc(t){return[...t].sort((n,r)=>{const l=ia(n.group.object?.statusTone);return ia(r.group.object?.statusTone)-l})}a(hc,"sortExternalObjectGroups");function Ga(t){const{pill:n}=t,r=n.displayKey?.trim();if(r)return r;if(n.providerKey==="github"){if(n.objectType==="pull_request")return"Github PR";if(n.objectType==="issue")return"Github Issue"}return ui(n.providerKey,n.objectType)}a(Ga,"externalObjectRowDisplayKey");function pc(t){const{pill:n}=t,r=Ga(t),l=mi(n.iconKey);return(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-start gap-1",title:r,children:[l?(0,e.jsx)(l,{"aria-hidden":"true",className:"h-3.5 w-3.5 shrink-0 mt-0.5"}):null,(0,e.jsx)("span",{className:"truncate",children:r})]})}a(pc,"externalObjectRowLabel");function fc(t){if(!t)return null;try{const n=new URL(t);if(n.hostname!=="github.com")return null;const[,r,l,c,o]=n.pathname.split("/");return!r||!l||!o?null:c==="pull"?`PR ${o}`:c==="issues"?`Issue ${o}`:null}catch{return null}}a(fc,"githubObjectPropertyValue");function Ws(t){return Pa(t.pill)}a(Ws,"externalObjectPropertyStatusLabel");function Xa(t){const{pill:n}=t,r=Ws(t),l=(n.providerKey==="github"?fc(n.url):null)??n.displayTitle?.trim()??Ga(t);return r?`${l} - ${r}`:l}a(Xa,"externalObjectPropertyValue");function Ya(t){const n=Ws(t);return t.pill.statusIconKey==="git-merge"||n.toLowerCase()==="merged"}a(Ya,"isMergedExternalObject");function gc(t){return(Ya(t)?sa.merged:sa[t.pill.statusCategory]??"text-ink-3 border-ink-3").split(" ").filter(n=>n.startsWith("text-")).join(" ")}a(gc,"externalObjectPropertyTone");function bc(t){return Ya(t)?t.pill.statusIconKey??"git-merge":t.pill.statusIconKey}a(bc,"externalObjectPropertyStatusIconKey");function ja(t){const{pill:n,sourceLabels:r}=t,l=n.displayTitle??Xa(t);return r.length>0?`${l} - ${r.join(", ")}`:l}a(ja,"externalObjectPropertyTitle");function jc({group:t}){const{pill:n}=t,r=Ws(t),l=xi(n.providerKey),c=ci(n.objectType),o=Xa(t),x=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ra,{category:n.statusCategory,liveness:n.liveness,statusIconKey:bc(t),sizeClassName:"h-3.5 w-3.5",label:`${l}: ${r}`}),(0,e.jsx)("span",{className:"min-w-0 truncate",children:o})]}),u=g("inline-flex min-w-0 max-w-full items-center gap-1.5 text-sm no-underline pointer-coarse:min-h-6",gc(t),n.url?"hover:underline focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-focus":"");return n.url?(0,e.jsx)("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","data-mention-kind":"external-object","data-external-status":n.statusCategory,"data-external-liveness":n.liveness,className:u,title:ja(t),"aria-label":`${l} ${c} - ${r}: ${n.displayTitle??o}`,children:x}):(0,e.jsx)("span",{"data-mention-kind":"external-object","data-external-status":n.statusCategory,"data-external-liveness":n.liveness,className:u,title:ja(t),"aria-label":`${l} ${c} - ${r}: ${n.displayTitle??o}`,children:x})}a(jc,"ExternalObjectPropertyValue");function yc({externalObjects:t,externalObjectsLoading:n,externalObjectsError:r,onRetryExternalObjects:l}){const[c,o]=(0,d.useState)(!1);if((0,d.useEffect)(()=>{o(!1)},[t]),r)return(0,e.jsx)(I,{label:"External objects",children:(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Couldn't load external objects.",l?(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("button",{type:"button",className:"text-accent underline-offset-2 hover:underline",onClick:l,children:"Retry"})]}):null]})});if(n)return(0,e.jsx)(I,{label:"External objects",children:(0,e.jsx)("span",{className:"h-4 w-24 animate-pulse rounded bg-bg-3/40"})});if(!t||t.length===0)return null;const x=hc(t),u=c?x:x.slice(0,mc),h=x.length-u.length;return(0,e.jsxs)(e.Fragment,{children:[u.map(b=>{const{pill:w,group:k}=b;return(0,e.jsx)(I,{label:pc(b),children:(0,e.jsx)(jc,{group:b})},k.object?.id??`${w.providerKey}:${w.objectType}:${w.url??"anon"}`)}),c||h>0?(0,e.jsx)(I,{label:"References",children:(0,e.jsx)(Ha,{hiddenCount:h,expanded:c,onClick:a(()=>o(b=>!b),"onClick")})}):null]})}a(yc,"ExternalObjectRows");function kc(t){return t?t.executionWorkspacePolicy?.defaultProjectWorkspaceId??t.workspaces?.find(n=>n.isPrimary)?.id??t.workspaces?.[0]?.id??null:null}a(kc,"defaultProjectWorkspaceIdForProject");function wc(t){const n=t?.executionWorkspacePolicy?.enabled?t.executionWorkspacePolicy.defaultMode:null;return n==="isolated_workspace"||n==="operator_branch"?n:n==="adapter_default"?"agent_default":"shared_workspace"}a(wc,"defaultExecutionWorkspaceModeForProject");function vc(t){return t?.primaryWorkspace?.id??t?.workspaces.find(n=>n.isPrimary)?.id??t?.workspaces[0]?.id??null}a(vc,"primaryWorkspaceIdForProject");function Nc(t){const n=t.issue.currentExecutionWorkspace??null,r=vc(t.project),l=n?.projectWorkspaceId??t.issue.projectWorkspaceId??null;return n?n.mode!=="shared_workspace"?!1:!l||!r?!0:n.mode==="shared_workspace"&&l===r:!l||!r?!0:l===r}a(Nc,"isMainIssueWorkspace");function ya(t){if(!t)return"";const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const r=n.getTimezoneOffset()*6e4;return new Date(n.getTime()-r).toISOString().slice(0,16)}a(ya,"toDateTimeLocalValue");function Cc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:{}}a(Cc,"asRecord");function K({inline:t,label:n,open:r,onOpenChange:l,triggerContent:c,triggerClassName:o,popoverClassName:x,popoverAlign:u="end",extra:h,stacked:b=!1,separateTrigger:w=!1,children:k}){const $=g("inline-flex min-h-5 items-center gap-1.5 cursor-pointer hover:bg-bg-3/50 rounded px-1 -mx-1 py-0.5 transition-colors min-w-0 max-w-full text-left","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",o);if(w){const v=(0,e.jsx)("button",{type:"button",className:g($,"shrink-0"),"aria-label":`Edit ${n.toLowerCase()}`,"aria-expanded":r,onClick:t?()=>l(!r):void 0,children:(0,e.jsx)(ws,{className:g("h-3 w-3 text-ink-3",r&&"rotate-180"),"aria-hidden":!0})});return(0,e.jsxs)("div",{children:[(0,e.jsxs)(I,{label:n,wrap:b,children:[(0,e.jsxs)("div",{className:"flex min-w-0 max-w-full items-start gap-1.5",children:[c,t?v:(0,e.jsxs)(la,{open:r,onOpenChange:l,children:[(0,e.jsx)(aa,{asChild:!0,children:v}),(0,e.jsx)(ra,{className:g("p-1",x),align:u,collisionPadding:16,children:k})]})]}),h]}),t&&r?(0,e.jsx)("div",{className:g("rounded-md border border-line bg-bg-2 p-1 mb-2",x),children:k}):null]})}return t?(0,e.jsxs)("div",{children:[(0,e.jsxs)(I,{label:n,wrap:b,children:[(0,e.jsxs)("button",{className:g($,b&&"items-start"),onClick:a(()=>l(!r),"onClick"),"aria-expanded":r,children:[c,(0,e.jsx)(ws,{className:g("ml-auto h-3 w-3 shrink-0 text-ink-3 transition-transform",r&&"rotate-180"),"aria-hidden":!0})]}),h]}),r&&(0,e.jsx)("div",{className:g("rounded-md border border-line bg-bg-2 p-1 mb-2",x),children:k})]}):(0,e.jsxs)(I,{label:n,wrap:b,children:[(0,e.jsxs)(la,{open:r,onOpenChange:l,children:[(0,e.jsx)(aa,{asChild:!0,children:(0,e.jsxs)("button",{className:g($,b&&"items-start"),"aria-expanded":r,children:[c,(0,e.jsx)(ws,{className:g("ml-auto h-3 w-3 shrink-0 text-ink-3 transition-transform",r&&"rotate-180"),"aria-hidden":!0})]})}),(0,e.jsx)(ra,{className:g("p-1",x),align:u,collisionPadding:16,children:k})]}),h]})}a(K,"PropertyPicker");var Ic={origin:"origin",work:"work",reference:"reference"};function Ac({issueId:t}){const n=Ql(),{data:r}=A({queryKey:j.instance.experimentalSettings,queryFn:a(()=>Wa.getExperimental(),"queryFn")}),l=r?.enableCases===!0,c=A({queryKey:j.cases.forIssue(t),queryFn:a(()=>$o.listForIssue(t),"queryFn"),enabled:l&&!!t});if(!l)return null;const o=c.data??[];return c.isError?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Cases"}),(0,e.jsx)("p",{className:"text-sm text-bad",children:"Could not load linked cases."})]}):o.length===0?null:(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:"Cases"}),(0,e.jsx)("div",{className:"space-y-1",children:o.map(x=>(0,e.jsxs)(V,{to:n(x.case.identifier),className:"flex items-center gap-2 rounded-md border border-line px-2.5 py-1.5 text-sm transition-colors hover:bg-bg-3/50",children:[(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3 shrink-0",children:x.case.identifier}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:x.case.title,children:x.case.title}),(0,e.jsx)(se,{variant:"secondary",className:"shrink-0",children:Ic[x.role]}),(0,e.jsx)(fo,{status:x.case.status})]},x.id))})]})}a(Ac,"IssueCasesPanel");function Sc(t){const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0||n>=t.length-1?null:{prefix:t.slice(0,n+1),suffix:t.slice(n+1)}}a(Sc,"splitMiddleTruncation");function ka({value:t,icon:n}){const[r,l]=(0,d.useState)(!1),c=(0,d.useRef)(void 0);(0,d.useEffect)(()=>()=>clearTimeout(c.current),[]);const o=(0,d.useCallback)(async()=>{try{await Gi(t),l(!0),clearTimeout(c.current),c.current=setTimeout(()=>l(!1),1500)}catch{}},[t]),x=Sc(t);return(0,e.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0 flex-1",title:t,children:[(0,e.jsx)(n,{className:"h-3.5 w-3.5 text-ink-3 shrink-0"}),(0,e.jsx)("button",{type:"button",className:g("cursor-pointer text-left font-mono text-sm transition-colors hover:text-ink","min-w-0 flex-1"),onClick:o,title:t,"aria-label":`Copy ${t} to clipboard`,children:x?(0,e.jsxs)("span",{className:"flex min-w-0","data-middle-truncate":"true",children:[(0,e.jsx)("span",{className:"min-w-0 truncate",children:x.prefix}),(0,e.jsx)("span",{className:"max-w-1/2 shrink-0 truncate",children:x.suffix})]}):(0,e.jsx)("span",{className:"block truncate",children:t})}),r&&(0,e.jsxs)("span",{className:g("inline-flex items-center gap-1 text-xs shrink-0",Vl.done),role:"status",children:[(0,e.jsx)(ne,{className:"h-3 w-3 shrink-0"}),"Copied"]})]})}a(ka,"TruncatedCopyable");var Ne=50,Pc=5,wa="task-detail-pane-tab h-7 rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus";function Qd({issue:t,childIssues:n=[],issueLinkState:r,onAddSubIssue:l,onUpdate:c,inline:o,hasActiveRun:x=!1,externalObjects:u,externalObjectsLoading:h,externalObjectsError:b,onRetryExternalObjects:w,onCheckMonitorNow:k,checkingMonitorNow:$=!1,documentDeepLink:v,sidePanelContentOnly:Q=!1}){const R=Uo(t.executionPolicy),S=R.success,N=R.success?R.data:null,{selectedCompanyId:X}=Kl(),P=Ia(),p=t.companyId??X,{data:H}=A({queryKey:j.instance.experimentalSettings,queryFn:a(()=>Wa.getExperimental(),"queryFn")}),Ie=H===void 0||H.enableManagedSandboxOnly===!0,[J,xe]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(o){xe(null);return}xe(document.getElementById(so))},[o]);const{data:f}=qa(t.id),{data:z}=A({queryKey:j.issues.acceptedPlanDecompositions(t.id),queryFn:a(()=>E.listAcceptedPlanDecompositions(t.id),"queryFn"),enabled:!0}),{data:Y}=A({queryKey:j.issues.attachments(t.id),queryFn:a(()=>E.listAttachments(t.id),"queryFn"),enabled:!0}),{data:O,isError:F,refetch:Ve}=Fa(t.id),L=(0,d.useMemo)(()=>Do(O),[O]),Qe=(0,d.useMemo)(()=>{const s=new Set(L.map(i=>Ue(At(i))).filter(Boolean));return u?.filter(i=>!s.has(Ue(i.pill.url)))},[u,L]),{data:He}=Ua(t.id),$s=(He??[]).filter(s=>!Na(s.key)),me=!!f||(z?.length??0)>0||$s.length>0,Ge=(O?.length??0)>0||$s.length>0||Da(Y,O).length>0,[he,Ae]=(0,d.useState)("properties"),[St,Xe]=(0,d.useState)(()=>new Set),Se=(0,d.useRef)(!1),Ja=(0,d.useCallback)(s=>{Se.current=!0,Ae(s)},[]);(0,d.useEffect)(()=>{Xe(new Set)},[t.id]),(0,d.useEffect)(()=>{me&&!Se.current&&Ae("plans")},[me]),(0,d.useEffect)(()=>{if(!v)return;const s=v.tab;s!=="document"&&(Se.current=!0,Ae(s),Xe(i=>{if(!i.has(s))return i;const m=new Set(i);return m.delete(s),m}))},[v]);const[_s,Ms]=(0,d.useState)(!1),[Pt,Rt]=(0,d.useState)(""),[pe,Ye]=(0,d.useState)(null),[Ls,Bs]=(0,d.useState)(!1),[Tt,Fs]=(0,d.useState)(""),[qs,Ds]=(0,d.useState)(!1),[Za,Je]=(0,d.useState)("mode"),[Ot,Et]=(0,d.useState)(""),[Ze,et]=(0,d.useState)(!1),[zs,tt]=(0,d.useState)(""),[Us,Ks]=(0,d.useState)(!1),[er,st]=(0,d.useState)(!1),[nt,Wt]=(0,d.useState)(!1),[Vs,Qs]=(0,d.useState)(""),[tr,sr]=(0,d.useState)(!1),[nr,Hs]=(0,d.useState)(""),[ar,rr]=(0,d.useState)(!1),[lr,Gs]=(0,d.useState)(""),[ir,at]=(0,d.useState)(!1),[or,Pe]=(0,d.useState)(!1),[cr,dr]=(0,d.useState)(!1),[ur,xr]=(0,d.useState)(!1),[mr,hr]=(0,d.useState)(!1),[$t,Xs]=(0,d.useState)(""),[_t,Ys]=(0,d.useState)(""),[Js,pr]=(0,d.useState)("#6366f1"),[rt,Zs]=(0,d.useState)(()=>ya(N?.monitor?.nextCheckAt)),[en,tn]=(0,d.useState)(N?.monitor?.notes??""),[sn,nn]=(0,d.useState)(N?.monitor?.serviceName??""),[an,rn]=(0,d.useState)(null),[ln,on]=(0,d.useState)(null),[cn,Mt]=(0,d.useState)(null),[Lt,lt]=(0,d.useState)(!1),[Re,Bt]=(0,d.useState)(t.watchdog?.watchdogAgentId??""),[dn,Ft]=(0,d.useState)(t.watchdog?.instructions??""),fe=zs.trim(),Te=Vs.trim();(0,d.useEffect)(()=>{Ks(!1)},[t.id]);const{data:un}=A({queryKey:j.auth.session,queryFn:a(()=>ql.getSession(),"queryFn")}),q=un?.user?.id??un?.session?.userId,{data:D}=A({queryKey:j.agents.list(p),queryFn:a(()=>Ea.list(p),"queryFn"),enabled:!!p}),{data:ge}=A({queryKey:j.access.companyUserDirectory(p),queryFn:a(()=>Li.listUserDirectory(p),"queryFn"),enabled:!!p}),{data:qt}=A({queryKey:j.projects.list(p,{includeArchived:!0}),queryFn:a(()=>Ti.list(p,{includeArchived:!0}),"queryFn"),enabled:!!p}),fr=(0,d.useMemo)(()=>(qt??[]).filter(s=>!s.archivedAt||s.id===t.projectId),[qt,t.projectId]),{orderedProjects:Dt}=ro({projects:fr,companyId:p,userId:q}),{data:zt}=A({queryKey:j.issues.labels(p),queryFn:a(()=>E.listLabels(p),"queryFn"),enabled:!!p}),{data:oe,isFetching:xn}=A({queryKey:j.issues.list(p),queryFn:a(()=>E.list(p),"queryFn"),enabled:!!p&&(nt||Ze&&fe.length===0)}),{data:gr,isFetching:br}=A({queryKey:p?j.issues.search(p,fe,void 0,Ne):["issues","blocker-search",fe,Ne],queryFn:a(()=>E.list(p,{q:fe,limit:Ne}),"queryFn"),enabled:!!p&&Ze&&fe.length>0}),{data:jr,isFetching:yr}=A({queryKey:p?j.issues.search(p,Te,void 0,Ne):["issues","blocker-search",Te,Ne],queryFn:a(()=>E.list(p,{q:Te,limit:Ne}),"queryFn"),enabled:!!p&&nt&&Te.length>0}),Ut=Ce({mutationFn:a(s=>E.createLabel(p,s),"mutationFn"),onSuccess:a(async s=>{P.setQueryData(j.issues.labels(p),i=>i?i.some(m=>m.id===s.id)?i:[...i,s]:[s]),c({labelIds:[...t.labelIds??[],s.id]}),P.invalidateQueries({queryKey:j.issues.labels(p)}),Ys("")},"onSuccess")}),Kt=Ce({mutationFn:a(()=>E.unarchiveFromInbox(t.id),"mutationFn"),onMutate:a(()=>{Mt(null)},"onMutate"),onSuccess:a(()=>{Mt(null),P.setQueryData(j.issues.detail(t.id),s=>s&&{...s,archivedAt:null,archivedByActorType:null,archivedByAgentId:null,archivedByRunId:null}),P.invalidateQueries({queryKey:j.issues.detail(t.id)}),p&&Ri(P,p)},"onSuccess"),onError:a(s=>{Mt(s instanceof Error&&s.message.trim().length>0?s.message:"Failed to unarchive this issue. Please try again.")},"onError")}),kr=a(s=>{const i=t.labelIds??[];c({labelIds:i.includes(s)?i.filter(m=>m!==s):[...i,s]})},"toggleLabel"),be=a(s=>!s||!D?null:D.find(i=>i.id===s)?.name??s.slice(0,8),"agentName"),mn=a(s=>s?Dt.find(i=>i.id===s)?.name??s.slice(0,8):s?.slice(0,8)??"None","projectName"),wr=t.projectId?Dt.find(s=>s.id===t.projectId)??null:null,je=t.project??wr,{visible:Vt}=ho(),Qt=Vt&&H?.enableIsolatedWorkspaces===!0&&!!je?.executionWorkspacePolicy?.enabled,{data:Ht,isLoading:vr,isError:Nr}=A({queryKey:j.executionWorkspaces.list(p,{projectId:t.projectId??void 0,projectWorkspaceId:t.projectWorkspaceId??void 0,reuseEligible:!0}),queryFn:a(()=>xa.list(p,{projectId:t.projectId??void 0,projectWorkspaceId:t.projectWorkspaceId??void 0,reuseEligible:!0}),"queryFn"),enabled:!!p&&!!t.projectId&&Qt&&qs}),hn=Eo(t,je),Cr=t.executionWorkspacePreference!=null||t.executionWorkspaceSettings!=null,ye=hn==="reuse_existing"?"reuse":Cr&&hn==="isolated_workspace"?"isolated":"default",pn=(0,d.useMemo)(()=>to(io(Ht??[])).map(s=>({...s,options:s.options.filter(i=>lo(i,Ot))})).filter(s=>s.options.length>0),[Ht,Ot]),fn=(Ht??[]).find(s=>s.id===t.executionWorkspaceId)??t.currentExecutionWorkspace??null,Ir=ye==="isolated"?"New isolated workspace":ye==="reuse"?fn?.name??"Reuse existing workspace":"Default",Ar=ye==="reuse"?fn?.branchName??void 0:void 0,Sr=a(()=>{Ds(!1),Je("mode"),Et("")},"closeWorkspacePicker"),Gt=a((s,i)=>{const m=Wo(s,i?.id,i?.mode);m&&(c(m),Sr())},"saveWorkspaceSelection"),Xt=(0,d.useMemo)(()=>Nc({issue:t,project:je}),[t,je]),Pr=!!t.executionWorkspaceId&&!Xt,Yt=Xt?null:t.currentExecutionWorkspace?.config?.workspaceRuntime??null,gn=t.currentExecutionWorkspace?.runtimeServices??[],Jt=!!t.currentExecutionWorkspace?.cwd,bn=!!Yt&&Jt,Zt=(0,d.useMemo)(()=>Ul({runtimeConfig:Yt,runtimeServices:gn,canStartServices:bn,canRunJobs:Jt}),[Jt,bn,Yt,gn]),jn=!Xt&&(Zt.services.length>0||Zt.otherServices.length>0),it=Ce({mutationFn:a(s=>{const i=t.currentExecutionWorkspace?.id??t.executionWorkspaceId;if(!i)throw new Error("This task is not attached to a workspace.");return xa.controlRuntimeCommands(i,s.action,s)},"mutationFn"),onSuccess:a((s,i)=>{P.setQueryData(j.executionWorkspaces.detail(s.workspace.id),s.workspace),P.invalidateQueries({queryKey:j.issues.detail(t.id)}),P.invalidateQueries({queryKey:j.projects.detail(s.workspace.projectId)}),P.invalidateQueries({queryKey:j.executionWorkspaces.overview(s.workspace.companyId)}),P.invalidateQueries({queryKey:j.executionWorkspaces.workspaceOperations(s.workspace.id)}),p&&(P.invalidateQueries({queryKey:j.issues.list(p)}),P.invalidateQueries({queryKey:j.executionWorkspaces.list(p)})),on(null),rn(i.action==="run"?"Workspace job completed.":i.action==="stop"?"Workspace service stopped.":i.action==="restart"?"Workspace service restarted.":"Workspace service started.")},"onSuccess"),onError:a(s=>{rn(null),on(s instanceof Error?s.message:"Failed to control workspace commands.")},"onError")}),Rr=it.isPending?it.variables??null:null,yn=t.referencedIssueIdentifiers??[],kn=(0,d.useMemo)(()=>{const s=t.relatedWork?.outbound.map(({issue:i})=>({id:i.id,identifier:i.identifier,title:i.title,status:i.status}))??[];return s.length>0?s:yn.map(i=>({id:i,identifier:i,title:i}))},[t.relatedWork?.outbound,yn]),wn=(0,d.useMemo)(()=>t.relatedWork?.inbound.map(({issue:s})=>({id:s.id,identifier:s.identifier,title:s.title,status:s.status}))??[],[t.relatedWork?.inbound]),Tr=a(s=>{if(!s)return null;const i=qt?.find(m=>m.id===s)??null;return i?Ml(i):`/projects/${s}`},"projectLink"),vn=(0,d.useMemo)(()=>Qi(),[_s]),Nn=(0,d.useMemo)(()=>Vi((D??[]).filter(ma),vn),[D,vn]),Or=(0,d.useMemo)(()=>oo(),[Ls]),es=(0,d.useMemo)(()=>po(ge?.users),[ge?.users]),Er=(0,d.useMemo)(()=>uo(ge?.users),[ge?.users]),Cn=(0,d.useMemo)(()=>xo(ge?.users,{excludeUserIds:[q,t.createdByUserId]}),[ge?.users,q,t.createdByUserId]),Oe=t.assigneeAgentId?D?.find(s=>s.id===t.assigneeAgentId):null,ts=t.assigneeAdapterOverrides??null,Wr=ts!==null,ss=Cc(ts?.adapterConfig),$r=typeof ss.model=="string"?ss.model:"",_r=String(ss.effort??""),Mr=a(s=>{c({assigneeAdapterOverrides:s})},"updateAssigneeAdapterOverrides"),Lr=(()=>{if(ts?.adapterConfig){const s=[$r,_r].filter(Boolean),i=s.length>0?`Override · ${s.join(" · ")}`:"Override · adapter options";return(0,e.jsx)("span",{className:"min-w-0 truncate text-sm",title:`Task-level model override — replaces the agent's primary model for this issue.${s.length>0?` (${s.join(" · ")})`:""}`,children:i})}return(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Primary model"})})(),Br=(0,e.jsxs)("div",{className:"w-full space-y-2 p-2",children:[(0,e.jsx)("p",{className:"text-xs text-ink-3",children:Oe?"This assignee's adapter does not expose editable task overrides.":"Select a compatible assignee agent to edit these overrides."}),(0,e.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",onClick:a(()=>Mr(null),"onClick"),children:"Clear adapter options"})]}),Z=ua(t.executionPolicy,"review"),ee=ua(t.executionPolicy,"approval"),Ee=a(s=>Fi(s,q,es),"userLabel"),In=a(s=>Bi(s,es),"actualUserLabel"),ns=Ee(t.assigneeUserId),We=In(t.createdByUserId),U=Dl(t),An=U?.kind==="user"?Er.get(U.id):null,Sn=U?.kind==="user"&&U.viaAgentId?be(U.viaAgentId)??U.viaAgentId.slice(0,8):null,as=t.assigneeAgentId?`agent:${t.assigneeAgentId}`:t.assigneeUserId?`user:${t.assigneeUserId}`:"",Fr=(0,d.useMemo)(()=>({agentMap:new Map((D??[]).map(s=>[s.id,s])),resolveUserLabel:a(s=>Ee(s),"resolveUserLabel")}),[D,es,q]),Pn=(0,d.useMemo)(()=>Co({runningAgentName:Oe?.name??null}),[Oe?.name]),Rn=a(()=>{Ms(!1),Rt(""),Ye(null)},"closeAssigneePicker"),Tn=a((s,i)=>{i?.(),c(s),Rn()},"applyAssignee"),rs=a((s,i,m)=>{if((s.assigneeAgentId?`agent:${s.assigneeAgentId}`:s.assigneeUserId?`user:${s.assigneeUserId}`:"")===as){Rn();return}if(x){Ye({...s,label:i,track:m});return}Tn(s,m)},"selectAssignee"),ls=a((s,i)=>{S&&c({executionPolicy:ha({existingPolicy:t.executionPolicy??null,reviewerValues:s,approverValues:i})})},"updateExecutionPolicy"),ot=a((s,i)=>{const m=s==="review"?Z:ee,y=m.includes(i)?m.filter(te=>te!==i):[...m,i];ls(s==="review"?y:Z,s==="approval"?y:ee)},"toggleExecutionParticipant"),On=a(s=>s.startsWith("agent:")?be(s.slice(6))??s.slice(6,14):s.startsWith("user:")?Ee(s.slice(5))??"User":s,"executionParticipantLabel"),En=Z.map(s=>On(s)).join(", "),Wn=ee.map(s=>On(s)).join(", "),qr=Z.length>0?(0,e.jsx)("span",{className:"text-sm truncate min-w-0",title:En,children:En}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),Dr=ee.length>0?(0,e.jsx)("span",{className:"text-sm truncate min-w-0",title:Wn,children:Wn}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),ct=To(t.reviewPolicy),$n=t.executionState?.status==="changes_requested"&&t.executionState.currentStageType?t.executionState.currentStageType:t.executionState?null:Z.length>0?"review":ee.length>0?"approval":null,_n=a(s=>(0,e.jsx)(I,{label:"",children:(0,e.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",onClick:a(()=>c({status:"in_review"}),"onClick"),children:s==="review"?"Run review now":"Run approval now"})}),"runExecutionButton"),is=(()=>{if(!t.executionState?.currentStageType)return null;const s=t.executionState.currentStageType==="review"?"Review":"Approval",i=t.executionState.currentParticipant,m=i?i.type==="agent"?be(i.agentId??null):Ee(i.userId??null):null;return t.executionState.status==="changes_requested"?`${s} requested changes${m?` by ${m}`:""}`:`${s} pending${m?` with ${m}`:""}`})();(0,d.useEffect)(()=>{Zs(ya(N?.monitor?.nextCheckAt)),tn(N?.monitor?.notes??""),nn(N?.monitor?.serviceName??"")},[N?.monitor?.nextCheckAt,N?.monitor?.notes,N?.monitor?.serviceName]),(0,d.useEffect)(()=>{Lt||(Bt(t.watchdog?.watchdogAgentId??""),Ft(t.watchdog?.instructions??""))},[t.watchdog?.watchdogAgentId,t.watchdog?.instructions,Lt]);const zr=(0,d.useMemo)(()=>(D??[]).filter(ma).map(s=>({id:s.id,label:s.name,searchText:`${s.name} ${s.role} ${s.title??""}`})),[D]),$e=Ce({mutationFn:a(s=>E.upsertWatchdog(t.id,s),"mutationFn"),onSuccess:a(s=>{P.setQueryData(j.issues.detail(t.id),i=>i&&{...i,watchdog:s}),P.invalidateQueries({queryKey:j.issues.detail(t.id)}),lt(!1)},"onSuccess")}),_e=Ce({mutationFn:a(()=>E.deleteWatchdog(t.id),"mutationFn"),onSuccess:a(()=>{P.setQueryData(j.issues.detail(t.id),s=>s&&{...s,watchdog:null}),P.invalidateQueries({queryKey:j.issues.detail(t.id)}),lt(!1)},"onSuccess")}),Ur=a(()=>{Re&&$e.mutate({agentId:Re,instructions:dn.trim()||null})},"saveWatchdog"),Kr=a(()=>{t.watchdog?_e.mutate():lt(!1),Bt(""),Ft("")},"removeWatchdog"),Mn=$e.error instanceof Error?$e.error.message:_e.error instanceof Error?_e.error.message:null,Me=(n??[]).find(s=>s.id===t.watchdog?.watchdogIssueId),Vr=t.watchdog?(0,e.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 text-sm",title:t.watchdog.instructions?.trim()||void 0,children:[(()=>{const s=(D??[]).find(i=>i.id===t.watchdog?.watchdogAgentId);return s?(0,e.jsx)(ve,{agent:s,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null})(),(0,e.jsx)("span",{className:"shrink-0 max-w-40 truncate",children:be(t.watchdog.watchdogAgentId)}),t.watchdog.instructions?.trim()?(0,e.jsxs)("span",{className:"min-w-0 flex-1 truncate text-ink-3",children:["· ",t.watchdog.instructions.trim()]}):null,t.watchdog.status==="disabled"?(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:"(disabled)"}):null]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),Qr=void 0,Hr=(0,e.jsxs)("div",{className:"space-y-3 p-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink",children:"Watchdog agent"}),(0,e.jsx)(Hi,{value:Re,options:zr,placeholder:"Select agent",noneLabel:"No watchdog agent",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",onChange:Bt,renderTriggerValue:a(s=>{if(!s)return(0,e.jsx)("span",{className:"text-ink-3",children:"Select agent"});const i=(D??[]).find(m=>m.id===s.id);return(0,e.jsxs)(e.Fragment,{children:[i?(0,e.jsx)(ve,{agent:i,size:16,className:"h-3 w-3 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:s.label})]})},"renderTriggerValue"),renderOption:a(s=>{const i=(D??[]).find(m=>m.id===s.id);return(0,e.jsxs)(e.Fragment,{children:[i?(0,e.jsx)(ve,{agent:i,size:16,className:"h-3 w-3 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:s.label})]})},"renderOption")})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"text-xs font-medium text-ink",children:["Instructions ",(0,e.jsx)("span",{className:"font-normal text-ink-3",children:"(optional)"})]}),(0,e.jsx)(Di,{value:dn,onChange:a(s=>Ft(s.target.value),"onChange"),placeholder:"What should the watchdog watch for and how should it keep work moving?",rows:4,className:"text-xs"})]}),Me?(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:["Watchdog task:"," ",(0,e.jsx)(V,{to:`/issues/${Me.id}`,className:"text-accent hover:underline",children:Me.identifier??"View task"})]}):null,Mn?(0,e.jsx)("div",{className:"rounded border border-bad/40 bg-bad/10 px-2 py-1 text-xs text-bad",children:Mn}):null,(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("button",{type:"button",className:"text-xs text-ink-3 hover:text-bad transition-colors disabled:opacity-50",disabled:_e.isPending||!t.watchdog&&!Re,onClick:Kr,children:_e.isPending?"Removing…":"Remove"}),(0,e.jsx)(W,{type:"button",size:"sm",className:"h-7 text-xs",disabled:!Re||$e.isPending,onClick:Ur,children:$e.isPending?"Saving…":t.watchdog?"Update":"Set watchdog"})]})]}),Ln=a(s=>{if(!S)return;const i=ha({existingPolicy:t.executionPolicy??null,reviewerValues:Z,approverValues:ee});if(!i&&!s){c({executionPolicy:null});return}const{monitor:m,...y}=i??{};c({executionPolicy:{...y,mode:i?.mode??t.executionPolicy?.mode??"normal",commentRequired:!0,stages:i?.stages??[],...s?{monitor:s}:{}}})},"updateMonitor"),Gr=a(()=>{if(!rt)return;const s=new Date(rt);if(Number.isNaN(s.getTime()))return;const i=sn.trim()||null;Ln({nextCheckAt:s.toISOString(),notes:en.trim()||null,scheduledBy:"board",kind:i?"external_service":null,serviceName:i,externalRef:null}),at(!1)},"saveMonitor"),Bn=a(()=>{Ln(null),at(!1)},"clearMonitor"),ce=t.executionState?.monitor??null,G=ce?.nextCheckAt??t.monitorNextCheckAt??N?.monitor?.nextCheckAt??null,ke=t.monitorAttemptCount??ce?.attemptCount??0,dt=t.monitorLastTriggeredAt??ce?.lastTriggeredAt??null,Xr=N?.monitor?.serviceName??ce?.serviceName??null,Yr=N?.monitor?.notes??ce?.notes??null,os=eo(G),cs=G?Ji(G,os):null,Jr=cs==="due now",Zr=!!cs?.startsWith("overdue by "),el=G?Yi(G,os):ce?.status==="cleared"?"Cleared":"None",Fn=G?Jr?"checking momentarily…":`${Zi(G,{},os)}${Zr?" · fires on next tick":ke>0?` · Attempt ${ke}`:""}`:ce?.status==="cleared"?[dt?`last checked ${jt(dt)}`:null,ke>0?`after attempt ${ke}`:null].filter(Boolean).join(" · "):null,tl=(0,e.jsx)(Ai,{children:(0,e.jsxs)(Si,{open:or,onOpenChange:Pe,children:[(0,e.jsx)(Ci,{asChild:!0,children:(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-start gap-1.5","data-testid":"monitor-row-trigger",onClick:a(()=>Pe(!1),"onClick"),children:[G?(0,e.jsx)(Sa,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-ink-3","aria-hidden":"true"}):null,(0,e.jsxs)("span",{className:"flex min-w-0 flex-col items-start",children:[(0,e.jsx)("span",{className:g("text-sm",G?"font-semibold text-ink":"text-ink-3"),children:el}),Fn?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:Fn}):null]})]})}),G?(0,e.jsxs)(Ii,{side:"left",className:"w-80 border border-line bg-bg-2 p-0 text-ink shadow-md",onPointerDown:a(s=>s.stopPropagation(),"onPointerDown"),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-line px-4 py-3",children:[(0,e.jsx)("span",{className:"text-sm font-semibold",children:"Monitor"}),ke>0?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Attempt ",ke]}):null]}),(0,e.jsxs)("div",{className:"space-y-3 px-4 py-3 text-left",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs text-ink-3",children:"Next check"}),(0,e.jsx)("div",{className:"text-sm",children:da(G)}),(0,e.jsx)("div",{className:"text-xs text-ink-3",children:cs})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs text-ink-3",children:"Watching"}),(0,e.jsx)("div",{className:"text-sm",children:Xr??"—"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs text-ink-3",children:"Notes"}),(0,e.jsx)("div",{className:"whitespace-normal text-sm",children:Yr??"—"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs text-ink-3",children:"Last triggered"}),(0,e.jsx)("div",{className:"text-sm",children:dt?da(dt):"— not yet triggered"})]})]}),(0,e.jsxs)("div",{className:"flex gap-2 border-t border-line px-4 py-3",children:[k?(0,e.jsx)(W,{type:"button",size:"sm",variant:"secondary",disabled:$,onClick:a(()=>{Pe(!1),k()},"onClick"),children:$?"Checking…":"Check now"}):null,(0,e.jsx)(W,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>{Pe(!1),at(!0)},"onClick"),children:"Edit"}),(0,e.jsx)(W,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>{Pe(!1),Bn()},"onClick"),children:"Clear"})]})]}):null]})}),C=t.scheduledRetry??null,B=vo(t.id),qn=C&&C.status==="scheduled_retry",Dn=C?.scheduledRetryAt?new Date(C.scheduledRetryAt).toISOString():null,Le=Dn?Xi(Dn):null,ut=C?.scheduledRetryAt?M(C.scheduledRetryAt):null,zn=C?.scheduledRetryAt?$l(new Date(C.scheduledRetryAt)):null,Un=So(C?.scheduledRetryReason),xt=typeof C?.scheduledRetryAttempt=="number"&&Number.isFinite(C.scheduledRetryAttempt)&&C.scheduledRetryAttempt>0?C.scheduledRetryAttempt:null,ds=C?.scheduledRetryReason==="max_turns_continuation",sl=(()=>{if(!Le)return"Pending schedule";const s=ds?"Continuation":"Retry";return Le==="now"?`${s} due now`:`${s} ${Le}`})(),us=B.isSuccess&&(B.data?.outcome==="promoted"||B.data?.outcome==="already_promoted"),nl=xt!==null?(0,e.jsxs)("span",{className:"whitespace-nowrap shrink-0 text-xs text-ink-3",children:["Attempt ",xt]}):null,al=(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(oa,{className:"h-3.5 w-3.5 shrink-0 text-ink-3","aria-hidden":"true"}),(0,e.jsx)("span",{className:"min-w-0 truncate text-sm text-ink",title:ut??void 0,children:sl}),zn?(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",title:ut??void 0,children:zn}):null]}),Kn=C?(0,e.jsxs)("div",{className:"flex w-full flex-col gap-2 p-2 text-xs",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-ink",children:ds?"Scheduled continuation":"Scheduled retry"}),xt!==null?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Attempt ",xt]}):null]}),(0,e.jsxs)("dl",{className:"grid grid-cols-(--gtc-15) gap-y-1",children:[Un?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Reason"}),(0,e.jsx)("dd",{className:"text-ink",children:Un})]}):null,ut?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Next attempt"}),(0,e.jsxs)("dd",{className:"text-ink",children:[ut,Le?(0,e.jsxs)("span",{className:"ml-1 text-ink-3",children:["· ",Le]}):null]})]}):null,C.retryOfRunId?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Replaces run"}),(0,e.jsx)("dd",{className:"text-ink",children:(0,e.jsx)(V,{to:`/agents/${C.agentId}/runs/${C.retryOfRunId}`,className:"font-mono text-ink hover:underline",children:C.retryOfRunId.slice(0,8)})})]}):null,C.agentName?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Agent"}),(0,e.jsx)("dd",{className:"text-ink",children:(0,e.jsx)(V,{to:`/agents/${C.agentId}`,className:"text-ink hover:underline",children:C.agentName})})]}):null,C.error?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Last error"}),(0,e.jsx)("dd",{className:"text-ink break-words",children:C.error})]}):null]}),(0,e.jsx)(Io,{error:B.lastError,onRetry:a(()=>{B.reset(),B.mutate()},"onRetry")}),(0,e.jsx)(Oo,{className:"my-1"}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(W,{type:"button",size:"sm",variant:"primary",onClick:a(()=>B.mutate(),"onClick"),disabled:B.isPending||us,"data-testid":"issue-scheduled-retry-properties-retry-now",children:B.isPending?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)(Oa,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Retrying…"]}):us?(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)(As,{className:"h-3.5 w-3.5","aria-hidden":"true"}),B.data?.outcome==="already_promoted"?"Already promoted":"Promoted"]}):(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,e.jsx)(oa,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Retry now"]})}),(0,e.jsx)("span",{className:"text-right text-xs text-ink-3",children:B.isPending?"Promoting scheduled retry":us?B.data?.outcome==="already_promoted"?"Already promoted — run starting":"Promoted — run starting":B.data?.outcome==="waiting"&&B.data.scheduledRetry?.runId===C.runId?B.data.message:ds?"Pulls continuation forward immediately":"Pulls retry forward immediately"})]})]}):null,rl=(0,e.jsxs)("div",{className:"flex w-full flex-col gap-2",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2 md:flex-row",children:[(0,e.jsx)("input",{type:"datetime-local",className:"rounded-md border border-line bg-transparent px-2 py-1 text-xs",value:rt,onChange:a(s=>Zs(s.target.value),"onChange")}),(0,e.jsx)("input",{type:"text",className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 text-xs",placeholder:"What should the agent re-check?",value:en,onChange:a(s=>tn(s.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-2 md:flex-row",children:[(0,e.jsx)("input",{type:"text",className:"min-w-0 flex-1 rounded-md border border-line bg-transparent px-2 py-1 text-xs",placeholder:"External service",value:sn,onChange:a(s=>nn(s.target.value),"onChange")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink disabled:opacity-50",disabled:!rt,onClick:Gr,children:"Schedule"}),N?.monitor?(0,e.jsx)("button",{type:"button",className:"inline-flex items-center rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink",onClick:Bn,children:"Clear"}):null]})]})]}),mt=(0,d.useMemo)(()=>{const s=t.labelIds??[];if(s.length===0)return t.labels??[];const i=new Map;for(const m of zt??[])i.set(m.id,m);for(const m of t.labels??[])i.set(m.id,m);return s.map(m=>i.get(m)).filter(m=>!!m)},[t.labelIds,t.labels,zt]),ll=mt.length>0?(0,e.jsxs)("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[mt.slice(0,3).map(s=>(0,e.jsx)(ba,{className:"border-0",style:{backgroundColor:`${s.color}22`,color:s.color},children:s.name},s.id)),mt.length>3&&(0,e.jsxs)(se,{variant:"outline",className:"border-line text-ink-3",children:["+",mt.length-3," more"]})]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),il=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:"Search labels...",value:$t,onChange:a(s=>Xs(s.target.value),"onChange"),autoFocus:!o}),(0,e.jsx)("div",{className:"max-h-44 overflow-y-auto overscroll-contain space-y-0.5",children:(zt??[]).filter(s=>$t.trim()?s.name.toLowerCase().includes($t.toLowerCase()):!0).map(s=>{const i=(t.labelIds??[]).includes(s.id);return(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50 text-left",i&&"bg-bg-3"),onClick:a(()=>kr(s.id),"onClick"),children:[(0,e.jsx)("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:s.color}}),(0,e.jsx)("span",{className:"truncate flex-1",children:s.name}),i&&(0,e.jsx)(ne,{className:"h-3.5 w-3.5 shrink-0 text-ink","aria-hidden":"true"})]},s.id)})}),(0,e.jsxs)("div",{className:"mt-2 border-t border-line pt-2 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("input",{className:"h-7 w-7 p-0 rounded bg-transparent",type:"color",value:Js,onChange:a(s=>pr(s.target.value),"onChange")}),(0,e.jsx)("input",{className:"flex-1 px-2 py-1.5 text-xs bg-transparent outline-none rounded placeholder:text-ink-3/50",placeholder:"New label",value:_t,onChange:a(s=>Ys(s.target.value),"onChange")})]}),(0,e.jsxs)("button",{className:"flex items-center justify-center gap-1.5 w-full px-2 py-1.5 text-xs rounded border border-line hover:bg-bg-3/50 disabled:opacity-50",disabled:!_t.trim()||Ut.isPending,onClick:a(()=>Ut.mutate({name:_t.trim(),color:Js}),"onClick"),children:[(0,e.jsx)(vs,{className:"h-3 w-3"}),Ut.isPending?"Creating…":"Create label"]})]})]}),ol=Oe?(0,e.jsx)(ca,{agent:Oe,size:"sm"}):ns?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(De,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsx)("span",{className:"min-w-0 truncate text-sm",title:ns,children:ns})]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Unassigned"}),cl=[...q?[{kind:"user",value:`user:${q}`,userId:q,label:"Assign to me",searchText:Ee(q)??""}]:[],...t.createdByUserId&&t.createdByUserId!==q?[{kind:"user",value:`user:${t.createdByUserId}`,userId:t.createdByUserId,label:We?`Assign to ${We}`:"Assign to requester",searchText:We??"requester"}]:[],...Cn.map(s=>({kind:"user",value:s.id,userId:s.id.slice(5),label:s.label,searchText:s.searchText??""}))],dl=Nn.map(s=>({kind:"agent",value:`agent:${s.id}`,agent:s,label:s.name,searchText:`${s.name} ${s.role} ${s.title??""}`})),xs=a((s,i)=>Pt.trim()?`${s} ${i}`.toLowerCase().includes(Pt.toLowerCase()):!0,"matchesAssigneeSearch"),ms=a(s=>(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50 text-left",s.value===as&&"bg-bg-3"),onClick:a(()=>{s.kind==="agent"?rs({assigneeAgentId:s.agent.id,assigneeUserId:null},s.label,()=>Ki(s.agent.id,p??void 0)):s.kind==="user"?rs({assigneeAgentId:null,assigneeUserId:s.userId},s.label,()=>Ui(s.userId,p??void 0)):rs({assigneeAgentId:null,assigneeUserId:null},s.label)},"onClick"),children:[s.kind==="agent"?(0,e.jsx)(ve,{agent:s.agent,size:16,className:"shrink-0 h-3 w-3 text-ink-3"}):s.kind==="user"?(0,e.jsx)(De,{className:"h-3 w-3 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s.label}),s.value===as?(0,e.jsx)(ne,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-ink","aria-hidden":"true"}):null]},s.value||"__none__"),"renderAssigneeOption"),hs=cl.filter(s=>xs(s.label,s.searchText)),ps=dl.filter(s=>xs(s.label,s.searchText)),Vn=xs("No assignee",""),Qn=a(s=>(0,e.jsx)("div",{className:"px-2 pb-0.5 pt-1.5 text-xs font-semibold uppercase tracking-wide text-ink-3",children:s}),"sectionHeader"),ul=pe?(0,e.jsx)("div",{className:"space-y-2 p-1",children:(0,e.jsx)(Ao,{copy:Pn,to:{agentId:pe.assigneeAgentId,userId:pe.assigneeUserId},resolvers:Fr,onConfirm:a(()=>Tn({assigneeAgentId:pe.assigneeAgentId,assigneeUserId:pe.assigneeUserId},pe.track),"onConfirm"),onCancel:a(()=>Ye(null),"onCancel")})}):(0,e.jsxs)(e.Fragment,{children:[x?(0,e.jsx)("div",{className:"px-1 pt-1",children:(0,e.jsx)(No,{copy:Pn})}):null,(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:"Search assignees...",value:Pt,onChange:a(s=>Rt(s.target.value),"onChange"),autoFocus:!o}),(0,e.jsxs)("div",{className:"max-h-56 overflow-y-auto overscroll-contain",children:[Vn?ms({kind:"none",value:"",label:"No assignee",searchText:""}):null,ps.length>0?(0,e.jsxs)(e.Fragment,{children:[Qn("Agents"),ps.map(s=>ms(s))]}):null,hs.length>0?(0,e.jsxs)(e.Fragment,{children:[Qn("Board users"),hs.map(s=>ms(s))]}):null,!Vn&&ps.length===0&&hs.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No matches."}):null]})]}),Hn=a((s,i,m,y,te)=>(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:`Search ${s==="review"?"reviewers":"approvers"}...`,value:m,onChange:a(_=>y(_.target.value),"onChange"),autoFocus:!o}),(0,e.jsxs)("div",{className:"max-h-48 overflow-y-auto overscroll-contain",children:[(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",i.length===0&&"bg-bg-3"),onClick:te,children:["No ",s==="review"?"reviewers":"approvers"]}),q&&(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",i.includes(`user:${q}`)&&"bg-bg-3"),onClick:a(()=>ot(s,`user:${q}`),"onClick"),children:[(0,e.jsx)(De,{className:"h-3 w-3 shrink-0 text-ink-3"}),"Assign to me"]}),t.createdByUserId&&t.createdByUserId!==q&&(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",i.includes(`user:${t.createdByUserId}`)&&"bg-bg-3"),onClick:a(()=>ot(s,`user:${t.createdByUserId}`),"onClick"),children:[(0,e.jsx)(De,{className:"h-3 w-3 shrink-0 text-ink-3"}),We||"Requester"]}),Cn.filter(_=>m.trim()?`${_.label} ${_.searchText??""}`.toLowerCase().includes(m.toLowerCase()):!0).map(_=>(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",i.includes(_.id)&&"bg-bg-3"),onClick:a(()=>ot(s,_.id),"onClick"),children:[(0,e.jsx)(De,{className:"h-3 w-3 shrink-0 text-ink-3"}),_.label]},`${s}:${_.id}`)),Nn.filter(_=>m.trim()?_.name.toLowerCase().includes(m.toLowerCase()):!0).map(_=>{const ta=`agent:${_.id}`;return(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",i.includes(ta)&&"bg-bg-3"),onClick:a(()=>ot(s,ta),"onClick"),children:[(0,e.jsx)(ve,{agent:_,size:16,className:"shrink-0 h-3 w-3 text-ink-3"}),_.name]},`${s}:${_.id}`)})]})]}),"executionParticipantsContent"),xl=t.projectId?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(na,{color:je?.color??null,icon:je?.icon??null,size:"sm"}),(0,e.jsx)("span",{className:"text-sm truncate min-w-0",title:mn(t.projectId),children:mn(t.projectId)})]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),ml=zi([{id:"",kind:"none",name:"No project",color:null},...Dt.map(s=>({id:s.id,kind:"project",project:s,name:s.name,color:s.color??null}))],t.projectId??"",Or),hl=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:"Search projects...",value:Tt,onChange:a(s=>Fs(s.target.value),"onChange"),autoFocus:!o}),(0,e.jsx)("div",{className:"max-h-48 overflow-y-auto overscroll-contain",children:ml.filter(s=>{if(!Tt.trim())return!0;const i=Tt.toLowerCase();return s.name.toLowerCase().includes(i)}).map(s=>(0,e.jsxs)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50 whitespace-nowrap",s.id===(t.projectId??"")&&"bg-bg-3"),onClick:a(()=>{if(s.kind==="project"){const i=wc(s.project);c({projectId:s.project.id,projectWorkspaceId:kc(s.project),executionWorkspaceId:null,executionWorkspacePreference:Vt?i:null,executionWorkspaceSettings:Vt&&s.project.executionWorkspacePolicy?.enabled?{mode:i}:null})}else c({projectId:null,projectWorkspaceId:null,executionWorkspaceId:null,executionWorkspacePreference:null,executionWorkspaceSettings:null});Bs(!1)},"onClick"),children:[s.kind==="project"?(0,e.jsx)(na,{color:s.project.color??null,icon:s.project.icon??null,size:"xs"}):null,s.name]},s.id||"__none__"))})]}),we=t.blockedBy?.map(s=>s.id)??[],Be=t.blockedBy??[],ht=t.blocks??[],Gn=Us?ht:ht.slice(0,Pc),pl=ht.length-Gn.length,fl=Be.length>0?(0,e.jsxs)("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[Be.slice(0,2).map(s=>(0,e.jsx)(wt,{issue:s,onRemove:a(i=>c({blockedByIssueIds:we.filter(m=>m!==i)}),"onRemove")},s.id)),Be.length>2?(0,e.jsx)(se,{asChild:!0,variant:"outline",className:"border-line text-ink-3 hover:bg-bg-3/50",children:(0,e.jsxs)("button",{type:"button",onClick:a(()=>et(!0),"onClick"),children:["+",Be.length-2," more"]})}):null]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),gl=n.length>0?(0,e.jsxs)("div",{className:"flex min-w-0 flex-col items-start gap-1",children:[n.slice(0,2).map(s=>(0,e.jsx)(wt,{variant:"property",issue:s,className:"min-w-0 max-w-full"},s.id)),n.length>2?(0,e.jsx)(se,{asChild:!0,variant:"outline",className:"border-line text-ink-3 hover:bg-bg-3/50",children:(0,e.jsxs)("button",{type:"button",onClick:a(()=>st(!0),"onClick"),children:["+",n.length-2," more"]})}):null]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),bl=(0,d.useMemo)(()=>{if(!oe?.length)return new Set;const s=new Map;for(const y of oe){if(!y.parentId)continue;const te=s.get(y.parentId)??[];te.push(y.id),s.set(y.parentId,te)}const i=new Set,m=[...s.get(t.id)??[]];for(;m.length>0;){const y=m.pop();!y||i.has(y)||(i.add(y),m.push(...s.get(y)??[]))}return i},[oe,t.id]),fs=(0,d.useMemo)(()=>t.parentId?oe?.find(s=>s.id===t.parentId)??null:null,[oe,t.parentId]),Fe=t.ancestors?.find(s=>s.id===t.parentId),jl=Fe?.identifier??fs?.identifier,yl=Fe?.title??fs?.title??t.parentId?.slice(0,8),kl=t.parentId?(0,e.jsx)(wt,{variant:"property",issue:hi(Fe)?Fe:{id:t.parentId,identifier:jl??t.parentId,title:yl??"Parent task",status:Fe?.status??fs?.status},className:"min-w-0 max-w-full"}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"}),Xn=Te.length>0,Yn=((Xn?jr:oe)??[]).filter(s=>s.id!==t.id).filter(s=>!bl.has(s.id)).sort((s,i)=>{const m=`${s.identifier??""} ${s.title}`.trim(),y=`${i.identifier??""} ${i.title}`.trim();return m.localeCompare(y)}),wl=nt&&(Xn?yr:xn),vl=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:"Search tasks...",value:Vs,onChange:a(s=>Qs(s.target.value),"onChange"),autoFocus:!o}),(0,e.jsxs)("div",{className:"max-h-48 overflow-y-auto overscroll-contain",children:[(0,e.jsx)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",!t.parentId&&"bg-bg-3"),onClick:a(()=>{c({parentId:null}),Wt(!1)},"onClick"),children:"No parent"}),Yn.map(s=>(0,e.jsxs)("button",{className:g("flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs rounded hover:bg-bg-3/50",s.id===t.parentId&&"bg-bg-3"),onClick:a(()=>{c({parentId:s.id}),Wt(!1)},"onClick"),children:[(0,e.jsx)(kt,{status:s.status,className:"h-3 w-3"}),(0,e.jsxs)("span",{className:"truncate",children:[s.identifier?`${s.identifier} `:"",s.title]})]},s.id)),wl?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"Searching tasks..."}):Yn.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No matching tasks."}):null]})]}),gs=fe.length>0,Nl=gs?gr:[...t.blockedBy??[],...oe??[]],bs=Array.from(new Map((Nl??[]).filter(s=>s.id!==t.id).map(s=>[s.id,s])).values());gs||bs.sort((s,i)=>{const m=`${s.identifier??""} ${s.title}`.trim(),y=`${i.identifier??""} ${i.title}`.trim();return m.localeCompare(y)});const Cl=Ze&&(gs?br:xn),Il=a(s=>{c({blockedByIssueIds:we.includes(s)?we.filter(i=>i!==s):[...we,s]}),et(!1),tt("")},"toggleBlockedBy"),Al=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("input",{className:"w-full px-2 py-1.5 text-xs bg-transparent outline-none border-b border-line mb-1 placeholder:text-ink-3/50",placeholder:"Search tasks...",value:zs,onChange:a(s=>tt(s.target.value),"onChange"),autoFocus:!o,"aria-label":"Search tasks to add as blockers"}),(0,e.jsxs)("div",{className:"max-h-48 overflow-y-auto overscroll-contain",children:[(0,e.jsx)("button",{className:g("flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-bg-3/50",we.length===0&&"bg-bg-3"),onClick:a(()=>{c({blockedByIssueIds:[]}),et(!1),tt("")},"onClick"),children:"No blockers"}),bs.map(s=>{const i=we.includes(s.id);return(0,e.jsxs)("button",{className:g("flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs rounded hover:bg-bg-3/50",i&&"bg-bg-3"),onClick:a(()=>Il(s.id),"onClick"),children:[(0,e.jsx)(kt,{status:s.status,className:"h-3 w-3"}),(0,e.jsxs)("span",{className:"truncate",children:[s.identifier?`${s.identifier} `:"",s.title]}),i&&(0,e.jsx)(ne,{className:"ml-auto h-3.5 w-3.5 shrink-0 text-ink","aria-hidden":"true"})]},s.id)}),Cl?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"Searching tasks..."}):bs.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No matching tasks."}):null]})]}),Sl=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"max-h-48 overflow-y-auto overscroll-contain",children:n.length>0?n.map(s=>(0,e.jsxs)(V,{to:`/issues/${s.identifier??s.id}`,state:r,className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-bg-3/50",onClick:a(()=>st(!1),"onClick"),children:[(0,e.jsx)(kt,{status:s.status,className:"h-3 w-3"}),(0,e.jsxs)("span",{className:"min-w-0 truncate",children:[s.identifier?`${s.identifier} `:"",s.title]})]},s.id)):(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No subtasks yet."})}),l?(0,e.jsx)("div",{className:"mt-2 border-t border-line pt-2",children:(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center justify-center gap-1.5 rounded border border-line px-2 py-1.5 text-xs hover:bg-bg-3/50",onClick:a(()=>{st(!1),l()},"onClick"),children:[(0,e.jsx)(vs,{className:"h-3 w-3"}),"Add subtask"]})}):null]}),js=(0,e.jsxs)("div",{className:g("task-detail-properties pl-4"),children:[(0,e.jsxs)(ze,{title:"Work",first:!0,streamlined:!0,children:[(0,e.jsx)(I,{label:"Status",children:(0,e.jsx)(kt,{status:t.status,externalConversationState:t.externalConversationState,glyphContainerClassName:"inline-flex size-6 shrink-0 items-center justify-center",blockerAttention:t.blockerAttention,onChange:a(s=>c({status:s}),"onChange"),showLabel:!0})}),!1,(0,e.jsx)(K,{inline:o,label:"Assignee",open:_s,onOpenChange:a(s=>{Ms(s),s||(Rt(""),Ye(null))},"onOpenChange"),triggerContent:ol,popoverClassName:"w-52",extra:t.assigneeAgentId?(0,e.jsx)(V,{to:`/agents/${t.assigneeAgentId}`,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-bg-3/50 transition-colors text-ink-3 hover:text-ink",onClick:a(s=>s.stopPropagation(),"onClick"),children:(0,e.jsx)(yt,{className:"h-3 w-3"})}):void 0,children:ul}),Wr?(0,e.jsx)(K,{inline:o,label:"Model",open:mr,onOpenChange:hr,triggerContent:Lr,triggerClassName:"min-w-0 max-w-full",popoverClassName:g("max-w-full",o?"w-full":"w-72"),children:Br}):null,(0,e.jsx)(K,{inline:o,label:"Project",open:Ls,onOpenChange:a(s=>{Bs(s),s||Fs("")},"onOpenChange"),triggerContent:xl,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-fit min-w-(--sz-11rem)",extra:t.projectId?(0,e.jsx)(V,{to:Tr(t.projectId),className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-bg-3/50 transition-colors text-ink-3 hover:text-ink",onClick:a(s=>s.stopPropagation(),"onClick"),children:(0,e.jsx)(yt,{className:"h-3 w-3"})}):void 0,children:hl}),(0,e.jsx)(K,{inline:o,label:"Labels",open:ur,onOpenChange:a(s=>{xr(s),s||Xs("")},"onOpenChange"),triggerContent:ll,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-64",extra:Qr,stacked:!0,children:il})]}),(0,e.jsxs)(ze,{title:"Relationships",streamlined:!0,children:[(0,e.jsx)(K,{inline:o,label:"Parent",open:nt,onOpenChange:a(s=>{Wt(s),s||Qs("")},"onOpenChange"),triggerContent:kl,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-72",separateTrigger:!!t.parentId,children:vl}),(0,e.jsx)(K,{inline:o,label:"Blocked by",open:Ze,onOpenChange:a(s=>{et(s),s||tt("")},"onOpenChange"),separateTrigger:Be.length>0,triggerContent:fl,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-72",stacked:!0,children:Al}),(0,e.jsx)(I,{label:"Blocking",wrap:!0,children:ht.length>0?(0,e.jsxs)("div",{className:"flex flex-col items-start gap-1.5",children:[Gn.map(s=>(0,e.jsx)(wt,{variant:"property",issue:s},s.id)),(0,e.jsx)(Ha,{hiddenCount:pl,expanded:Us,onClick:a(()=>Ks(s=>!s),"onClick")})]}):(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"None"})}),(0,e.jsx)(K,{inline:o,label:"Subtasks",open:er,onOpenChange:st,separateTrigger:n.length>0,triggerContent:gl,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-72",stacked:!0,children:Sl}),L.length>0||F?(0,e.jsx)(I,{label:"Pull requests",wrap:!0,children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,e.jsx)(zo,{products:L,externalObjects:u?.map(s=>s.pill)}),F?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Couldn’t load pull requests. ",(0,e.jsx)("button",{type:"button",className:"text-accent hover:underline",onClick:a(()=>{Ve()},"onClick"),children:"Retry"})]}):null]})}):null,(0,e.jsx)(yc,{externalObjects:Qe,externalObjectsLoading:h,externalObjectsError:b,onRetryExternalObjects:w})]}),(0,e.jsxs)(ze,{title:"Execution",streamlined:!0,children:[ct?(0,e.jsx)(I,{label:"Approvals",children:(0,e.jsxs)(ba,{title:ct.description,children:[(0,e.jsx)(ct.Icon,{className:"shrink-0 text-ink-3","aria-hidden":!0}),(0,e.jsx)("span",{className:"min-w-0 truncate",children:ct.label})]})}):null,S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(K,{inline:o,label:"Reviewers",open:tr,onOpenChange:a(s=>{sr(s),s||Hs("")},"onOpenChange"),triggerContent:qr,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-56",children:Hn("review",Z,nr,Hs,()=>ls([],ee))}),$n==="review"&&Z.length>0?_n("review"):null,(0,e.jsx)(K,{inline:o,label:"Approvers",open:ar,onOpenChange:a(s=>{rr(s),s||Gs("")},"onOpenChange"),triggerContent:Dr,triggerClassName:"min-w-0 max-w-full",popoverClassName:"w-56",children:Hn("approval",ee,lr,Gs,()=>ls(Z,[]))}),$n==="approval"&&ee.length>0?_n("approval"):null]}):(0,e.jsx)(I,{label:"Execution policy",wrap:!0,children:(0,e.jsx)("span",{role:"status",className:"text-sm text-ink-3",children:"Execution policy unavailable. Refresh to try again."})}),is&&(0,e.jsx)(I,{label:"Execution",children:(0,e.jsx)("span",{className:"text-sm truncate min-w-0",title:is,children:is})}),qn&&C?.scheduledRetryReason==="workspace_busy"?(0,e.jsx)(I,{label:"Workspace",children:(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Waiting for workspace"})}):qn&&Kn?(0,e.jsx)(K,{inline:o,label:"Scheduled retry",open:cr,onOpenChange:dr,triggerContent:al,triggerClassName:"min-w-0 max-w-full",popoverClassName:g("max-w-full",o?"w-full":"w-80 sm:w-(--sz-32rem)"),extra:nl,children:Kn}):null,S?(0,e.jsx)(K,{inline:o,label:"Monitor",open:ir,onOpenChange:at,triggerContent:tl,triggerClassName:"min-w-0 max-w-full",popoverClassName:g("max-w-full",o?"w-full":"w-80 sm:w-(--sz-32rem)"),children:rl}):null,(0,e.jsx)(K,{inline:o,label:"Watchdog",open:Lt,onOpenChange:lt,triggerContent:Vr,triggerClassName:"min-w-0 max-w-full",popoverClassName:g("max-w-full",o?"w-full":"w-80 sm:w-96"),extra:Me?(0,e.jsx)(V,{to:`/issues/${Me.id}`,className:"inline-flex items-center justify-center h-5 w-5 rounded hover:bg-bg-3/50 transition-colors text-ink-3 hover:text-ink",title:"Open watchdog task","aria-label":"Open watchdog task",onClick:a(s=>s.stopPropagation(),"onClick"),children:(0,e.jsx)(yt,{className:"h-3 w-3"})}):void 0,children:Hr})]}),Qt||jn||t.currentExecutionWorkspace?.branchName||t.currentExecutionWorkspace?.cwd||t.executionWorkspaceId?(0,e.jsxs)(ze,{title:"Workspace",streamlined:!0,children:[Qt?(0,e.jsx)(K,{inline:o,label:"Execution",open:qs,onOpenChange:a(s=>{Ds(s),s||(Je("mode"),Et(""))},"onOpenChange"),triggerContent:(0,e.jsx)("span",{className:"truncate",title:Ar,children:Ir}),triggerClassName:"min-w-0 max-w-full",popoverClassName:g("max-w-full",o?"w-full":"w-72"),children:Za==="mode"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-0.5",children:[(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-bg-3/50",onClick:a(()=>Gt(null),"onClick"),children:[(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block text-sm",children:"Default"}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"Use the project workspace policy"})]}),ye==="default"?(0,e.jsx)(ne,{className:"h-3.5 w-3.5 shrink-0"}):null]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-bg-3/50",onClick:a(()=>Gt("isolated_workspace"),"onClick"),children:[(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block text-sm",children:"New isolated workspace"}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"Create a fresh workspace on the next run"})]}),ye==="isolated"?(0,e.jsx)(ne,{className:"h-3.5 w-3.5 shrink-0"}):null]}),(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-bg-3/50",onClick:a(()=>Je("reuse"),"onClick"),children:[(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block text-sm",children:"Reuse existing workspace…"}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"Pick a workspace to reuse"})]}),ye==="reuse"?(0,e.jsx)(ne,{className:"h-3.5 w-3.5 shrink-0"}):null]})]}),(0,e.jsx)("div",{className:"mt-1 border-t border-line px-2 py-1.5 text-xs text-ink-3",children:t.executionWorkspaceId?"Current workspace stays active. Applies on the next run.":"Applies on the next run."})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"border-b border-line pb-1",children:[(0,e.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded px-1 py-1 text-xs text-ink-3 hover:bg-bg-3/50 hover:text-ink",onClick:a(()=>Je("mode"),"onClick"),"aria-label":"Back to workspace options",children:[(0,e.jsx)(ai,{className:"h-3.5 w-3.5"}),"Workspace mode"]}),(0,e.jsx)("input",{className:"block w-full bg-transparent px-2 py-1.5 text-xs outline-none placeholder:text-ink-3/50",placeholder:"Search workspaces...",value:Ot,onChange:a(s=>Et(s.target.value),"onChange"),autoFocus:!o,"aria-label":"Search reusable workspaces"})]}),(0,e.jsx)("div",{className:"max-h-48 overflow-y-auto overscroll-contain py-1",children:vr?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"Loading workspaces..."}):Nr?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-bad",children:"Failed to load workspaces."}):pn.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No matching workspaces."}):pn.map(s=>(0,e.jsxs)("div",{className:"py-1",children:[(0,e.jsx)("div",{className:"px-2 pb-1 text-xs font-medium text-ink-3",children:s.label}),s.options.map(i=>(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left hover:bg-bg-3/50",onClick:a(()=>Gt("reuse_existing",i.workspace),"onClick"),children:[(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block truncate text-sm",children:i.label}),(0,e.jsx)("span",{className:"block truncate text-xs text-ink-3",children:i.description})]}),t.executionWorkspaceId===i.workspaceId?(0,e.jsx)(ne,{className:"h-3.5 w-3.5 shrink-0"}):null]},i.key))]},s.id))}),(0,e.jsx)("div",{className:"border-t border-line px-2 py-1.5 text-xs text-ink-3",children:t.executionWorkspaceId?"Current workspace stays active. Applies on the next run.":"Applies on the next run."})]})}):null,Pr&&t.executionWorkspaceId&&(0,e.jsx)(I,{label:"Workspace",children:(0,e.jsxs)(V,{to:`/execution-workspaces/${t.executionWorkspaceId}`,className:"text-sm text-accent hover:underline inline-flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(_o,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),"View workspace",(0,e.jsx)(yt,{className:"h-3 w-3 shrink-0"})]})}),jn&&(0,e.jsx)(I,{label:"Service",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,e.jsx)(zl,{sections:Zt,isPending:it.isPending,pendingRequest:Rr,onAction:a(s=>it.mutate(s),"onAction"),square:!0,align:"start",iconOnly:!0}),an?(0,e.jsx)("span",{className:"text-xs text-ink-3",role:"status",children:an}):null,ln?(0,e.jsx)("span",{className:"text-xs text-bad",role:"alert",children:ln}):null]})}),t.currentExecutionWorkspace?.branchName&&(0,e.jsx)(I,{label:"Branch",children:(0,e.jsx)(ka,{value:t.currentExecutionWorkspace.branchName,icon:It})}),t.currentExecutionWorkspace?.cwd&&!Ie&&(0,e.jsx)(I,{label:"Folder",children:(0,e.jsx)(ka,{value:t.currentExecutionWorkspace.cwd,icon:yi})})]}):null,(0,e.jsxs)(ze,{title:"About",streamlined:!0,children:[U?(0,e.jsx)(I,{label:"Originating",children:U.kind==="agent"?(0,e.jsx)(V,{to:`/agents/${U.id}`,className:"hover:underline",children:(0,e.jsx)(ca,{agent:D?.find(s=>s.id===U.id)??{id:U.id,name:be(U.id)??"Agent"},size:"sm"})}):(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(Pi,{name:In(U.id)??An?.label??"User",avatarUrl:An?.image??null,size:"sm"}),Sn?(0,e.jsxs)("span",{className:"shrink-0 truncate text-xs text-ink-3",children:["via ",Sn]}):null]})}):null,t.startedAt&&(0,e.jsx)(I,{label:"Started",children:(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-sm",title:M(t.startedAt),children:M(t.startedAt)})}),t.completedAt&&(0,e.jsx)(I,{label:"Completed",children:(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-sm",title:M(t.completedAt),children:M(t.completedAt)})}),(0,e.jsx)(I,{label:"Created",children:(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-sm",title:M(t.createdAt),children:M(t.createdAt)})}),(0,e.jsx)(I,{label:"Updated",children:(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-sm",title:jt(t.updatedAt),children:jt(t.updatedAt)})}),t.archivedAt&&t.archivedByActorType==="agent"&&t.archivedByAgentId?(()=>{const s=(D??[]).find(m=>m.id===t.archivedByAgentId),i=be(t.archivedByAgentId);return(0,e.jsx)(I,{label:"Archived",children:(0,e.jsxs)("div",{className:"flex min-w-0 max-w-full flex-col items-start gap-1",children:[(0,e.jsxs)("span",{className:"flex min-w-0 max-w-full items-center gap-1.5 text-sm",title:`Archived by ${i} · ${M(t.archivedAt)}`,children:[s?(0,e.jsx)(ve,{agent:s,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"min-w-0 truncate",children:i})]}),(0,e.jsxs)("div",{className:"flex min-w-0 max-w-full items-center gap-2",children:[(0,e.jsx)("span",{className:"shrink-0 text-xs text-ink-3",children:jt(t.archivedAt)}),(0,e.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs text-ink-3 transition-colors hover:bg-bg-3/50 hover:text-ink disabled:opacity-50",onClick:a(()=>Kt.mutate(),"onClick"),disabled:Kt.isPending,children:[(0,e.jsx)(si,{className:"h-3 w-3"}),Kt.isPending?"Unarchiving…":"Unarchive"]})]}),cn?(0,e.jsx)("p",{className:"text-xs text-bad",role:"alert",children:cn}):null]})})})():null,t.requestDepth>0&&(0,e.jsx)(I,{label:"Depth",children:(0,e.jsx)("span",{className:"text-sm font-mono",children:t.requestDepth})})]}),(0,e.jsx)("div",{className:"pt-3",children:(0,e.jsx)(Ac,{issueId:t.id})})]});if(Q)return js;const pt=n.length>0,ft=kn.length>0||wn.length>0,gt=[{value:"properties",label:"Properties",closable:!1},...pt?[{value:"subtasks",label:"Subtasks",count:n.length,closable:!0}]:[],...ft?[{value:"references",label:"References",closable:!0}]:[],...me?[{value:"plans",label:"Plan",closable:!0}]:[],...Ge?[{value:"artifacts",label:"Artifacts",closable:!0}]:[]],bt=gt.filter(s=>s.value==="properties"||!St.has(s.value)),ys=gt.filter(s=>St.has(s.value));if(!pt&&!ft&&!me&&!Ge)return(0,e.jsxs)(e.Fragment,{children:[J?(0,pa.createPortal)((0,e.jsx)("div",{className:"flex items-center",role:"tablist","aria-label":"Properties panel sections",children:(0,e.jsx)("button",{type:"button",role:"tab","aria-selected":"true",className:g(wa,"inline-flex flex-none items-center bg-bg-3 px-3"),children:"Properties"})}),J):null,js]});const Jn=he==="plans"&&!me||he==="artifacts"&&!Ge||he==="subtasks"&&!pt||he==="references"&&!ft||St.has(he)?"properties":he,Pl=a(s=>{if(s==="properties"||(Se.current=!0,Xe(y=>{const te=new Set(y);return te.add(s),te}),Jn!==s))return;const i=bt.findIndex(y=>y.value===s),m=bt[i-1]??bt[i+1]??gt[0];Ae(m.value)},"closePaneTab"),Rl=a(s=>{Se.current=!0,Xe(i=>{if(!i.has(s))return i;const m=new Set(i);return m.delete(s),m}),Ae(s)},"reopenPaneTab"),de=!!J,Tl=J?g(wa,"min-w-0 flex-1 justify-start overflow-hidden after:hidden"):void 0,Zn=(0,e.jsx)(ei,{variant:"line",className:J?"min-w-0 flex-1 items-center justify-start gap-0 overflow-hidden p-0 group-data-[orientation=horizontal]/tabs:h-full":"w-full justify-start gap-1",children:(de?bt:gt).map((s,i)=>{const m=(0,e.jsxs)(Zl,{value:s.value,className:g(Tl,de&&"mx-1.5 hover:bg-bg-3/50 group-focus-within/pane-tab:bg-bg-3/50",de&&"px-3"),children:[(0,e.jsx)("span",{className:g(de&&"task-detail-pane-tab-label min-w-0 flex-1 overflow-hidden whitespace-nowrap"),title:s.label,children:s.label}),s.count?(0,e.jsx)("span",{className:"shrink-0 font-mono text-(length:--text-nano) text-ink-3 transition-opacity group-hover/pane-tab:opacity-0 group-focus-within/pane-tab:opacity-0",children:s.count}):null]},de?void 0:s.value);return de?(0,e.jsxs)("div",{"data-slot":"task-detail-pane-tab",className:"group/pane-tab relative flex min-w-0 flex-1 basis-0 items-center",children:[i>0?(0,e.jsx)("span",{"data-slot":"task-detail-pane-tab-divider","aria-hidden":"true",className:"absolute left-0 top-1/2 h-4 w-px -translate-y-1/2 bg-line"}):null,m,s.closable?(0,e.jsx)("button",{type:"button",className:"absolute right-2.5 top-1/2 z-20 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded-sm text-ink-3 opacity-0 transition-opacity hover:bg-bg-3 hover:text-ink focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-focus group-hover/pane-tab:opacity-100 group-focus-within/pane-tab:opacity-100","aria-label":`Close ${s.label} tab`,onPointerDown:a(y=>{y.preventDefault(),y.stopPropagation()},"onPointerDown"),onClick:a(y=>{y.preventDefault(),y.stopPropagation(),Pl(s.value)},"onClick"),children:(0,e.jsx)(Ni,{className:"size-3.5","aria-hidden":!0})}):null]},s.value):m})}),ea=de?(0,e.jsxs)("div",{className:"flex h-full min-w-0 flex-1 items-center",children:[Zn,(0,e.jsxs)(Jl,{children:[(0,e.jsx)(Xl,{asChild:!0,children:(0,e.jsx)(W,{variant:"ghost",size:"icon-xs",className:"size-6 shrink-0",disabled:ys.length===0,"aria-label":"Open closed sidebar tab",title:ys.length===0?"All sidebar tabs are open":"Open closed sidebar tab",children:(0,e.jsx)(vs,{className:"size-3.5","aria-hidden":!0})})}),(0,e.jsx)(Yl,{align:"start",className:"min-w-(--sz-8rem)",children:ys.map(s=>(0,e.jsx)(Gl,{onClick:a(()=>Rl(s.value),"onClick"),children:s.label},s.value))})]})]}):Zn;return(0,e.jsxs)(ti,{value:Jn,onValueChange:Ja,className:"flex min-h-0 flex-col gap-3",children:[J?(0,pa.createPortal)((0,e.jsx)("div",{className:"group/tabs contents","data-orientation":"horizontal",children:ea}),J):ea,(0,e.jsx)(qe,{value:"properties",children:js}),pt?(0,e.jsx)(qe,{value:"subtasks",children:(0,e.jsx)(yo,{items:n,onAddSubtask:l,issueLinkState:r})}):null,ft?(0,e.jsx)(qe,{value:"references",children:(0,e.jsx)(ko,{referenced:kn,mentionedIn:wn,issueLinkState:r})}):null,me?(0,e.jsx)(qe,{value:"plans",children:(0,e.jsx)(Ho,{issue:t,inline:o})}):null,Ge?(0,e.jsx)(qe,{value:"artifacts",children:(0,e.jsx)(xc,{issue:t,documentDeepLink:v?.tab==="artifacts"?v:null})}):null]})}a(Qd,"IssueProperties");export{xc as a,zo as c,Fo as d,Lo as f,Fa as g,qa as h,ze as i,Do as l,za as m,ba as n,Ho as o,Da as p,I as r,Ua as s,Qd as t,Ns as u};
@@ -1 +1 @@
1
- var t=Object.defineProperty;var o=(e,r)=>t(e,"name",{value:r,configurable:!0});import{$n as c,tr as u}from"./index-LM7k1NmC.js";function s(e,r){const n=e.currentExecutionWorkspace?.mode??e.executionWorkspaceSettings?.mode??e.executionWorkspacePreference;return e.executionWorkspaceId&&(n==="isolated_workspace"||n==="operator_branch")?"reuse_existing":e.executionWorkspacePreference??e.executionWorkspaceSettings?.mode??c(r)}o(s,"currentWorkspaceSelection");function p(e,r,n){return e==="reuse_existing"&&!r?null:e===null?{executionWorkspacePreference:null,executionWorkspaceId:null,executionWorkspaceSettings:null}:{executionWorkspacePreference:e,executionWorkspaceId:e==="reuse_existing"?r:null,executionWorkspaceSettings:{mode:e==="reuse_existing"?u(n):e,environmentId:null}}}o(p,"buildWorkspaceSelectionUpdate");export{s as n,p as t};
1
+ var t=Object.defineProperty;var o=(e,r)=>t(e,"name",{value:r,configurable:!0});import{$n as c,tr as u}from"./index-QhteFtm-.js";function s(e,r){const n=e.currentExecutionWorkspace?.mode??e.executionWorkspaceSettings?.mode??e.executionWorkspacePreference;return e.executionWorkspaceId&&(n==="isolated_workspace"||n==="operator_branch")?"reuse_existing":e.executionWorkspacePreference??e.executionWorkspaceSettings?.mode??c(r)}o(s,"currentWorkspaceSelection");function p(e,r,n){return e==="reuse_existing"&&!r?null:e===null?{executionWorkspacePreference:null,executionWorkspaceId:null,executionWorkspaceSettings:null}:{executionWorkspacePreference:e,executionWorkspaceId:e==="reuse_existing"?r:null,executionWorkspaceSettings:{mode:e==="reuse_existing"?u(n):e,environmentId:null}}}o(p,"buildWorkspaceSelectionUpdate");export{s as n,p as t};
@@ -1,2 +1,2 @@
1
- var F=Object.defineProperty;var i=(e,t)=>F(e,"name",{value:t,configurable:!0});import{i as S}from"./rolldown-runtime-ZpX3ckPj.js";import{l as N,la as I,ua as C}from"./createLucideIcon-CgrPXnTY.js";import{t as f,v as g}from"./queryKeys-BzT8CD34.js";import{n as T}from"./CompanyContext-fQCNWI_f.js";import{t as P}from"./router-CJbFZfVR.js";import{t as L}from"./chevron-right-BP8JjEC_.js";import{t as _}from"./triangle-alert-CnHMpmva.js";import{t as K}from"./agents-B8n-p0aX.js";import{t as R}from"./projects-l3kQxnTp.js";import{t as O}from"./access-DhB95qNC.js";import{t as h}from"./assignees-DkQNbPzi.js";import{ar as M}from"./index-LM7k1NmC.js";function he(e){return e==="done"||e==="cancelled"}i(he,"isPipelineTerminalStageKind");function be(e){const t={};for(const r of e)(t[r.stageId]??=[]).push(r);return t}i(be,"groupWarningsByStage");var q=S(C(),1);function ye(e={}){const{selectedCompanyId:t}=T(),r=e.companyId??t,n=(e.enabled??!0)&&!!r,s=g({queryKey:r?f.agents.list(r):["agents","standard-mentions","none"],queryFn:i(()=>K.list(r),"queryFn"),enabled:n&&e.agents===void 0}),o=g({queryKey:r?f.projects.list(r):["projects","standard-mentions","none"],queryFn:i(()=>R.list(r),"queryFn"),enabled:n&&e.projects===void 0}),u=g({queryKey:r?f.access.companyUserDirectory(r):["access","standard-mentions","users","none"],queryFn:i(()=>O.listUserDirectory(r),"queryFn"),enabled:n&&e.members===void 0}),l=e.agents??s.data,c=e.projects??o.data,x=e.members??u.data?.users;return(0,q.useMemo)(()=>M({agents:l,projects:c,members:x}),[l,x,c])}i(ye,"useStandardMarkdownMentionOptions");var D=new Set(["nextSuggestedStageId","suggestionResolution","upstreamDrift","upstreamChanged","changeAcknowledgedAt","thisChanged"]);function d(e){return typeof e=="string"&&e.trim()?e.trim():null}i(d,"readString");function b(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(b,"readRecord");function y(e,t){return!t||!e?null:Array.isArray(e)?e.find(r=>r.key===t||r.id===t)?.name??null:e instanceof Map?e.get(t)??null:e[t]??null}i(y,"stageNameFromLookup");function v(e){return e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}i(v,"humanizeKey");function ve(e){if(!e)return"Open";const t=e.trim().toLowerCase();return t?{open:"Open",working:"In progress",done:"Done",cancelled:"Removed",in_review:"In review",review:"In review",in_progress:"In progress"}[t]??v(t):"Open"}i(ve,"humanizePipelineItemStatus");function $(e){if(Array.isArray(e)){const r=e.map($).filter(Boolean);return r.length?r.join(", "):"None"}if(e==null||e==="")return"None";if(typeof e=="boolean")return e?"Yes":"No";if(typeof e=="number")return String(e);if(typeof e=="string")return e;const t=b(e);return t?d(t.label)??d(t.name)??d(t.title)??"Added details":String(e)}i($,"formatFieldValue");function xe(e){return Object.entries(e??{}).filter(([t])=>!D.has(t)).map(([t,r])=>({key:t,label:v(t),value:$(r)}))}i(xe,"displayPipelineItemFields");var W=180;function B(e){const t=e.value.trim();return!t||t==="None"?!1:t.includes(`
1
+ var F=Object.defineProperty;var i=(e,t)=>F(e,"name",{value:t,configurable:!0});import{i as S}from"./rolldown-runtime-ZpX3ckPj.js";import{l as N,la as I,ua as C}from"./createLucideIcon-CgrPXnTY.js";import{t as f,v as g}from"./queryKeys-BzT8CD34.js";import{n as T}from"./CompanyContext-fQCNWI_f.js";import{t as P}from"./router-CJbFZfVR.js";import{t as L}from"./chevron-right-BP8JjEC_.js";import{t as _}from"./triangle-alert-CnHMpmva.js";import{t as K}from"./agents-B8n-p0aX.js";import{t as R}from"./projects-l3kQxnTp.js";import{t as O}from"./access-DhB95qNC.js";import{t as h}from"./assignees-DkQNbPzi.js";import{ar as M}from"./index-QhteFtm-.js";function he(e){return e==="done"||e==="cancelled"}i(he,"isPipelineTerminalStageKind");function be(e){const t={};for(const r of e)(t[r.stageId]??=[]).push(r);return t}i(be,"groupWarningsByStage");var q=S(C(),1);function ye(e={}){const{selectedCompanyId:t}=T(),r=e.companyId??t,n=(e.enabled??!0)&&!!r,s=g({queryKey:r?f.agents.list(r):["agents","standard-mentions","none"],queryFn:i(()=>K.list(r),"queryFn"),enabled:n&&e.agents===void 0}),o=g({queryKey:r?f.projects.list(r):["projects","standard-mentions","none"],queryFn:i(()=>R.list(r),"queryFn"),enabled:n&&e.projects===void 0}),u=g({queryKey:r?f.access.companyUserDirectory(r):["access","standard-mentions","users","none"],queryFn:i(()=>O.listUserDirectory(r),"queryFn"),enabled:n&&e.members===void 0}),l=e.agents??s.data,c=e.projects??o.data,x=e.members??u.data?.users;return(0,q.useMemo)(()=>M({agents:l,projects:c,members:x}),[l,x,c])}i(ye,"useStandardMarkdownMentionOptions");var D=new Set(["nextSuggestedStageId","suggestionResolution","upstreamDrift","upstreamChanged","changeAcknowledgedAt","thisChanged"]);function d(e){return typeof e=="string"&&e.trim()?e.trim():null}i(d,"readString");function b(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}i(b,"readRecord");function y(e,t){return!t||!e?null:Array.isArray(e)?e.find(r=>r.key===t||r.id===t)?.name??null:e instanceof Map?e.get(t)??null:e[t]??null}i(y,"stageNameFromLookup");function v(e){return e.replace(/[_-]+/g," ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").trim().replace(/\s+/g," ").replace(/^./,t=>t.toUpperCase())}i(v,"humanizeKey");function ve(e){if(!e)return"Open";const t=e.trim().toLowerCase();return t?{open:"Open",working:"In progress",done:"Done",cancelled:"Removed",in_review:"In review",review:"In review",in_progress:"In progress"}[t]??v(t):"Open"}i(ve,"humanizePipelineItemStatus");function $(e){if(Array.isArray(e)){const r=e.map($).filter(Boolean);return r.length?r.join(", "):"None"}if(e==null||e==="")return"None";if(typeof e=="boolean")return e?"Yes":"No";if(typeof e=="number")return String(e);if(typeof e=="string")return e;const t=b(e);return t?d(t.label)??d(t.name)??d(t.title)??"Added details":String(e)}i($,"formatFieldValue");function xe(e){return Object.entries(e??{}).filter(([t])=>!D.has(t)).map(([t,r])=>({key:t,label:v(t),value:$(r)}))}i(xe,"displayPipelineItemFields");var W=180;function B(e){const t=e.value.trim();return!t||t==="None"?!1:t.includes(`
2
2
  `)||t.length>=W}i(B,"isLongPipelineItemField");function ke(e){const t=[],r=[];for(const n of e)B(n)?r.push(n):t.push(n);return{shortFields:t,longFields:r}}i(ke,"splitPipelineItemFields");function p(e){return e?h(e)||h({assigneeAgentId:e.createdByAgentId}):""}i(p,"sourceIssueAssigneeValue");function Ae(e){const t=e.conversationIssue??null,r=h(t??{});if(r)return r;const n=e.conversationSource;if(n?.issue&&n.kind!=="explicit_conversation"){const o=p(n.issue);if(o)return o}const s=(e.issueLinks??[]).filter(o=>o.link.role!=="conversation").slice().reverse();return p(((t?.parentId?s.find(o=>o.issue.id===t.parentId):null)??s.find(o=>p(o.issue)))?.issue)}i(Ae,"pipelineConversationStarterAssigneeValue");function E(e){const t=e.pipeline?.id,r=e.stage;return!t||!r?null:{case:{id:e.id,pipelineId:t,stageId:r.id,caseKey:e.caseKey??null,title:e.title,fields:{},terminalKind:e.terminalKind??null,childCount:e.rollup?.total??e.childGroups?.reduce((n,s)=>n+(s.cases?.length??0),0)??0,createdAt:e.createdAt,updatedAt:e.updatedAt},stage:{id:r.id,pipelineId:t,key:r.key,name:r.name,kind:r.kind,position:0}}}i(E,"treeNodeToChildRow");function we(e){if(Array.isArray(e))return e.filter(r=>{const n=r;return!!(n.case?.id&&n.case.pipelineId&&n.stage?.id)});const t=b(e);return t?(t.childGroups??t.case?.childGroups??[]).flatMap(r=>r.cases??[]).map(E).filter(r=>!!r):[]}i(we,"normalizePipelineChildRows");function Se(e,t){const r=e.fields??{};if(r.suggestionResolution||r.changeAcknowledgedAt)return{visible:!1,reason:"resolved"};const n=e.pendingSuggestion??null,s=n?.toStageKey??d(r.nextSuggestedStageId);return s?{visible:!0,suggestionId:n?.id??null,toStageKey:s,stageName:y(t,s)??"the next stage",rationale:n?.rationale??null}:{visible:!1,reason:"no_next_stage"}}i(Se,"getPendingTransitionBannerState");function Ne(e){const t=e.fields??{};return e.changeAcknowledgedAt||t.changeAcknowledgedAt?null:e.thisChanged||t.thisChanged||t.upstreamChanged||t.upstreamDrift?{title:"This changed",body:"Upstream work changed after this item was created. Review the latest details before continuing."}:null}i(Ne,"itemHasChangedNotice");function U(e){const t=e.filter(r=>r.type==="drift_acknowledged").map(r=>new Date(r.createdAt).getTime()).filter(r=>Number.isFinite(r)).reduce((r,n)=>Math.max(r,n),0);return e.some(r=>{if(r.type!=="upstream_drift")return!1;const n=new Date(r.createdAt).getTime();return Number.isFinite(n)&&n>t})}i(U,"eventsHaveUnacknowledgedDrift");function _e(e){return U(e)?{title:"This changed",body:"Upstream work changed after this item was created. Review the latest details before continuing."}:null}i(_e,"changedNoticeFromEvents");function k(e,t,r){const n=r==="from"?e.fromStage:e.toStage;return n?.name?n.name:y(t,(r==="from"?e.fromStageId:e.toStageId)??void 0)}i(k,"stageName");function A(e){return d(e.decision)?.toLowerCase()??null}i(A,"readDecision");function z(e){return e.actorAgent?.name?e.actorAgent.name:e.actorType==="user"?"Board":e.actorType==="system"?"Wardmote":null}i(z,"actorName");function H(e){const t=d(e.reason);return t?t==="children_terminal"?"all child items done":t:null}i(H,"movementReason");function V(e,t){const r=d(t.transitionClass)?.toLowerCase();return r==="auto"||r==="automatic"||e.actorType==="system"&&d(t.reason)==="children_terminal"?"automatic":r==="manual"?"manual":r}i(V,"movementClass");function G(e){const t=e.automation?.issue;return t?t.identifier??t.title:null}i(G,"automationIssueLabel");function Q(e){return v(e).replace(/^./,t=>t.toLowerCase())}i(Q,"humanizeReason");function $e(e,t){const r=e.type.startsWith("case.")?e.type.slice(5):e.type,n=e.payload??{};if(r==="ingested")return"Item added.";if(r==="updated")return n.action==="stage_automation_rerun_requested"?"Stage automation re-run requested.":"Item details updated.";if(r==="transitioned"){const s=k(e,t,"from"),o=k(e,t,"to"),u=s&&o?`Moved from ${s} to ${o}`:o?`Moved to ${o}`:"Moved to another stage",l=H(n);if(V(e,n)==="automatic")return`${u} — automatic${l?` (${l})`:""}.`;const c=z(e);return l&&c?`${u} — ${c}: '${l}'.`:l?`${u} — '${l}'.`:c&&e.actorType!=="system"?`${u} — ${c}.`:`${u}.`}if(r==="suggested"||r==="transition_suggested")return`Suggested moving to ${y(t,d(b(n.suggestion)?.toStageKey)??d(n.toStageKey))??"the next stage"}.`;if(r==="suggestion_resolved"){const s=A(n);return s==="accept"?"Suggestion approved.":s==="dismiss"?"Suggestion dismissed.":"Suggestion resolved."}if(r==="reviewed"||r==="review_decided"){const s=A(n);return s==="request_changes"?"Review requested changes.":s==="drop"||s==="reject"?"Review removed this item.":s==="approve"?"Review approved this item.":"Review completed."}if(r==="conversation_opened")return"Conversation started.";if(r==="issue_linked")return"Linked to work.";if(r==="issue_unlinked")return"Work link removed.";if(r==="blockers_set")return"Waiting items updated.";if(r==="blockers_resolved")return"Waiting items cleared.";if(r==="children_terminal")return"Built-from items completed.";if(r==="upstream_drift"){const s=d(n.upstreamCaseKey);return s?`Upstream change detected from ${s}.`:"Upstream change detected."}if(r==="drift_acknowledged")return"Upstream change acknowledged.";if(r==="automation_executed"){const s=e.automation?.routine?.title??"the automation",o=G(e);return`Automation completed — ran ${s}${o?` -> ${o}`:""}.`}if(r==="automation_failed"){const s=d(n.error);return`Automation needs attention${s?` — ${Q(s)}`:""}.`}return r==="claimed"?"Work started.":r==="lease_released"||r==="lease_expired"?"Work handoff cleared.":"Activity recorded."}i($e,"formatPipelineItemEvent");var a=S(I(),1);function Y(e){return`${e} thing${e===1?"":"s"} to fix`}i(Y,"warningCount");var Z=5;function j({warning:e}){return(0,a.jsxs)(a.Fragment,{children:[e.message,e.href?(0,a.jsxs)(a.Fragment,{children:[" ",(0,a.jsx)(P,{to:e.href,className:"font-medium underline underline-offset-2",children:e.hrefLabel??"Open"})]}):null]})}i(j,"WarningMessage");function je({warnings:e,onSelectStage:t,className:r}){if(e.length===0)return null;const n=e.slice(0,Z),s=e.length-n.length;return(0,a.jsxs)("div",{role:"region","aria-labelledby":"pipeline-health-bar-heading",className:N("rounded-md border border-amber-200 bg-amber-50 px-3 py-2.5 text-amber-900 dark:border-amber-300/30 dark:bg-amber-400/10 dark:text-amber-200",r),children:[(0,a.jsxs)("h2",{id:"pipeline-health-bar-heading",className:"flex items-center gap-2 text-sm font-semibold",children:[(0,a.jsx)(_,{className:"h-4 w-4 shrink-0"}),(0,a.jsxs)("span",{children:["Some steps won't run yet — ",Y(e.length)]})]}),(0,a.jsx)("ul",{className:"mt-1.5 space-y-1 pl-6 text-sm",children:n.map((o,u)=>{const l=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"font-medium",children:[o.stageName,":"]})," ",(0,a.jsx)(j,{warning:o})]});return(0,a.jsx)("li",{className:"list-disc",children:o.href?(0,a.jsx)("span",{children:l}):t?(0,a.jsxs)("button",{type:"button","aria-label":`Open ${o.stageName} settings`,className:"group flex w-full items-start gap-1 text-left underline-offset-2 hover:underline",onClick:i(()=>t(o.stageId),"onClick"),children:[(0,a.jsx)("span",{className:"min-w-0 flex-1",children:l}),(0,a.jsx)(L,{className:"mt-0.5 h-3 w-3 shrink-0 opacity-70","aria-hidden":"true"})]}):(0,a.jsx)("span",{children:l})},`${o.stageId}-${o.code}-${u}`)})}),s>0?(0,a.jsxs)("p",{className:"mt-1.5 pl-6 text-xs text-amber-800/80 dark:text-amber-200/70",children:["+",s," more in stage settings"]}):null]})}i(je,"PipelineHealthBar");function Fe({warnings:e,className:t}){return e.length===0?null:(0,a.jsxs)("div",{role:"region","aria-labelledby":"stage-health-warnings-heading",className:N("rounded-md border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-300/30 dark:bg-amber-400/10 dark:text-amber-200",t),children:[(0,a.jsxs)("h2",{id:"stage-health-warnings-heading",className:"flex items-center gap-2 text-sm font-semibold",children:[(0,a.jsx)(_,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{children:e.length===1?"This step won't run yet":`This step won't run yet — ${e.length} things to fix`})]}),(0,a.jsx)("ul",{className:"mt-1.5 space-y-1 pl-6",children:e.map((r,n)=>(0,a.jsx)("li",{className:"list-disc",children:(0,a.jsx)(j,{warning:r})},`${r.code}-${n}`))})]})}i(Fe,"StageHealthWarnings");function m(e){return typeof e=="string"?e.trim():""}i(m,"asString");function w(e){if(!Array.isArray(e))return[];const t=new Set;return e.flatMap(r=>{const n=m(r);return!n||t.has(n)?[]:(t.add(n),[n])})}i(w,"asStringList");function J(e,t){const r=e.carryOverPolicy;if(r&&typeof r=="object"&&!Array.isArray(r)){const n=r;return{version:1,mode:n.mode==="all_except"||n.mode==="only"?n.mode:"all_except",includeFields:w(n.includeFields),excludeFields:w(n.excludeFields)}}return{version:1,mode:"only",includeFields:t,excludeFields:[]}}i(J,"readCarryOverPolicy");function X(e){const t=e.replace(/[^A-Za-z0-9]/g,"").toLowerCase();return t==="name"||t==="title"||t==="casename"||t==="casetitle"}i(X,"isCarryOverIdentityFieldKey");function Ie(e,t){return!e||X(t)?!1:e.mode==="only"?e.includeFields.includes(t):!e.excludeFields.includes(t)}i(Ie,"isCarryOverFieldEnabled");function Ce(e){const t=e?.config?.breakdown;if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t,n=Array.isArray(r.inheritFields)?r.inheritFields.filter(o=>typeof o=="string"&&o.trim().length>0).map(o=>o.trim()):[],s=J(r,n);return{targetPipelineId:m(r.targetPipelineId),targetStageKey:m(r.targetStageKey),pieceNoun:m(r.pieceNoun)||"piece",inheritFields:n,carryOverPolicy:s,advanceTo:m(r.advanceTo)||null,waitForPieces:r.waitForPieces===!0,whenFinishedMoveTo:m(r.whenFinishedMoveTo)||null}}i(Ce,"readStageBreakdown");function Te(e){return`${e.trim()||"piece"}s`}i(Te,"pieceNounPlural");function ee(e){const t=e.filter(r=>r.trim().length>0);return t.length===0?"":t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}i(ee,"joinWithAnd");function Pe(e,t){if(!e.targetPipelineId||!e.targetStageKey||!t.targetPipelineName)return null;const r=e.pieceNoun,n=[`Wardmote will create one ${r} per item in ${t.targetPipelineName} → ${t.entryStageName}`];t.inheritedFieldLabels.length>0&&n.push(`carry over ${ee(t.inheritedFieldLabels)}`),t.advanceToName&&n.push(`move this case to ${t.advanceToName}`);let s=n.join(", ");return e.waitForPieces&&t.whenFinishedName&&(s+=`, then wait until every ${r} is finished before moving it to ${t.whenFinishedName}`),`${s}.`}i(Pe,"breakdownSummarySentence");var te={outer:"border-line bg-bg",header:"border-line text-ink-3",meta:"border-line",body:"",bodyOver:"bg-bg-3/40"},re={review:{outer:"border-violet-500/25 bg-violet-50/50 dark:bg-violet-950/15",header:"border-violet-500/15 text-violet-700 dark:text-violet-300",meta:"border-violet-500/15",body:"bg-violet-50/30 dark:bg-violet-950/10",bodyOver:"bg-violet-100/65 dark:bg-violet-950/30"},in_review:{outer:"border-violet-500/25 bg-violet-50/50 dark:bg-violet-950/15",header:"border-violet-500/15 text-violet-700 dark:text-violet-300",meta:"border-violet-500/15",body:"bg-violet-50/30 dark:bg-violet-950/10",bodyOver:"bg-violet-100/65 dark:bg-violet-950/30"},done:{outer:"border-green-500/25 bg-green-50/50 dark:bg-green-950/15",header:"border-green-500/15 text-green-700 dark:text-green-300",meta:"border-green-500/15",body:"bg-green-50/30 dark:bg-green-950/10",bodyOver:"bg-green-100/65 dark:bg-green-950/30"},cancelled:{outer:"border-neutral-300/70 bg-bg-3/25 opacity-85 dark:border-neutral-700/70 dark:bg-neutral-900/20",header:"border-line/70 text-ink-3/80",meta:"border-line/70",body:"bg-bg-3/20",bodyOver:"bg-bg-3/45"}};function Le(e){return re[e?.trim().toLowerCase()??""]??te}i(Le,"getPipelineStageColumnTone");function Ke(e,t){return`/pipelines/${e}/settings?stage=${t}&section=instructions`}i(Ke,"pipelineStageAutomationSettingsHref");export{he as S,we as _,X as a,ye as b,je as c,_e as d,xe as f,Ne as g,ve as h,Ie as i,Fe as l,Se as m,Ke as n,Te as o,$e as p,Pe as r,Ce as s,Le as t,D as u,Ae as v,be as x,ke as y};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var r=(e,s)=>c(e,"name",{value:s,configurable:!0});import{i as u}from"./rolldown-runtime-ZpX3ckPj.js";import{la as m}from"./createLucideIcon-CgrPXnTY.js";import{n as x}from"./queryKeys-BzT8CD34.js";import{t as f}from"./triangle-alert-CnHMpmva.js";import{t as i}from"./badge-jeXr866I.js";import{r as h,t as p}from"./card-BVZvs7aX.js";import{wn as b}from"./index-LM7k1NmC.js";var t=u(m(),1);function T({risk:e}){return e?(0,t.jsx)(i,{variant:e==="high"||e==="critical"?"destructive":e==="medium"?"secondary":"outline",children:e}):(0,t.jsx)(i,{variant:"outline",children:"unknown"})}r(T,"RiskBadge");function q({isReadOnly:e,isWrite:s,isDestructive:a}){return(0,t.jsxs)("span",{className:"inline-flex flex-wrap gap-1",children:[e?(0,t.jsx)(i,{variant:"outline",children:"read-only"}):null,s?(0,t.jsx)(i,{variant:"secondary",children:"write"}):null,a?(0,t.jsx)(i,{variant:"destructive",children:"destructive"}):null]})}r(q,"CapabilityBadges");function g(e){switch(e){case"allow":case"allowed":return{key:"allowed",label:"allowed"};case"deny":case"denied":return{key:"denied",label:"denied"};case"block":return{key:"block",label:"block"};case"require_approval":case"requires_approval":return{key:"require-approval",label:"require approval"};case"redact":case"redacted":return{key:"redacted",label:"redacted"};case"rate_limited":return{key:"rate-limit",label:"rate limited"};case"defer":case"deferred":return{key:"deferred",label:"deferred"};case"hidden":return{key:"hidden",label:"hidden"};default:return{key:e,label:e}}}r(g,"decisionToStatusKey");function C({decision:e}){if(!e)return(0,t.jsx)(i,{variant:"outline",children:"—"});const{key:s,label:a}=g(e.toString());return(0,t.jsx)(b,{status:s,label:a})}r(C,"DecisionBadge");function M({value:e}){if(!e)return(0,t.jsx)("span",{className:"text-ink-3",children:"never"});const s=typeof e=="string"?new Date(e):e;if(Number.isNaN(s.getTime()))return(0,t.jsx)("span",{className:"text-ink-3",children:"—"});const a=Date.now()-s.getTime(),n=Math.round(Math.abs(a)/6e4),o=a<0;let l;if(n<1)l="just now";else{const d=n<60?`${n}m`:n<1440?`${Math.round(n/60)}h`:`${Math.round(n/1440)}d`;l=o?`in ${d}`:`${d} ago`}return(0,t.jsx)("span",{title:s.toLocaleString(),className:"text-ink-3",children:l})}r(M,"RelativeTime");function B({title:e,description:s,actions:a}){return(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-ink",children:e}),s?(0,t.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:s}):null]}),a?(0,t.jsx)("div",{className:"flex shrink-0 gap-2",children:a}):null]})}r(B,"ToolsPageHeader");function $({label:e="Loading…"}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-10 text-sm text-ink-3",children:[(0,t.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-ink-3/30 border-t-ink-3"}),e]})}r($,"LoadingState");function A({error:e,onRetry:s}){let a;return e instanceof x?e.status===403?a="You do not have permission to view this. Tools & Access requires board/admin access.":e.status===404||/route not found/i.test(e.message)?a="Tools & Access isn't available on this server yet — try refreshing after the next deployment.":a=e.message:e instanceof Error?a=e.message:a="Something went wrong.",(0,t.jsx)(p,{className:"border-bad/40",children:(0,t.jsxs)(h,{className:"flex flex-col gap-3 py-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 text-sm text-bad",children:[(0,t.jsx)(f,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"Could not load this view"}),(0,t.jsx)("p",{className:"text-bad/80",children:a})]})]}),s?(0,t.jsx)("button",{type:"button",onClick:s,className:"self-start rounded-md border border-line px-3 py-1.5 text-xs font-medium hover:bg-bg-3",children:"Retry"}):null]})})}r(A,"ErrorState");export{M as a,$ as i,C as n,T as o,A as r,B as s,q as t};
1
+ var c=Object.defineProperty;var r=(e,s)=>c(e,"name",{value:s,configurable:!0});import{i as u}from"./rolldown-runtime-ZpX3ckPj.js";import{la as m}from"./createLucideIcon-CgrPXnTY.js";import{n as x}from"./queryKeys-BzT8CD34.js";import{t as f}from"./triangle-alert-CnHMpmva.js";import{t as i}from"./badge-jeXr866I.js";import{r as h,t as p}from"./card-BVZvs7aX.js";import{wn as b}from"./index-QhteFtm-.js";var t=u(m(),1);function T({risk:e}){return e?(0,t.jsx)(i,{variant:e==="high"||e==="critical"?"destructive":e==="medium"?"secondary":"outline",children:e}):(0,t.jsx)(i,{variant:"outline",children:"unknown"})}r(T,"RiskBadge");function q({isReadOnly:e,isWrite:s,isDestructive:a}){return(0,t.jsxs)("span",{className:"inline-flex flex-wrap gap-1",children:[e?(0,t.jsx)(i,{variant:"outline",children:"read-only"}):null,s?(0,t.jsx)(i,{variant:"secondary",children:"write"}):null,a?(0,t.jsx)(i,{variant:"destructive",children:"destructive"}):null]})}r(q,"CapabilityBadges");function g(e){switch(e){case"allow":case"allowed":return{key:"allowed",label:"allowed"};case"deny":case"denied":return{key:"denied",label:"denied"};case"block":return{key:"block",label:"block"};case"require_approval":case"requires_approval":return{key:"require-approval",label:"require approval"};case"redact":case"redacted":return{key:"redacted",label:"redacted"};case"rate_limited":return{key:"rate-limit",label:"rate limited"};case"defer":case"deferred":return{key:"deferred",label:"deferred"};case"hidden":return{key:"hidden",label:"hidden"};default:return{key:e,label:e}}}r(g,"decisionToStatusKey");function C({decision:e}){if(!e)return(0,t.jsx)(i,{variant:"outline",children:"—"});const{key:s,label:a}=g(e.toString());return(0,t.jsx)(b,{status:s,label:a})}r(C,"DecisionBadge");function M({value:e}){if(!e)return(0,t.jsx)("span",{className:"text-ink-3",children:"never"});const s=typeof e=="string"?new Date(e):e;if(Number.isNaN(s.getTime()))return(0,t.jsx)("span",{className:"text-ink-3",children:"—"});const a=Date.now()-s.getTime(),n=Math.round(Math.abs(a)/6e4),o=a<0;let l;if(n<1)l="just now";else{const d=n<60?`${n}m`:n<1440?`${Math.round(n/60)}h`:`${Math.round(n/1440)}d`;l=o?`in ${d}`:`${d} ago`}return(0,t.jsx)("span",{title:s.toLocaleString(),className:"text-ink-3",children:l})}r(M,"RelativeTime");function B({title:e,description:s,actions:a}){return(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold text-ink",children:e}),s?(0,t.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:s}):null]}),a?(0,t.jsx)("div",{className:"flex shrink-0 gap-2",children:a}):null]})}r(B,"ToolsPageHeader");function $({label:e="Loading…"}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 py-10 text-sm text-ink-3",children:[(0,t.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-ink-3/30 border-t-ink-3"}),e]})}r($,"LoadingState");function A({error:e,onRetry:s}){let a;return e instanceof x?e.status===403?a="You do not have permission to view this. Tools & Access requires board/admin access.":e.status===404||/route not found/i.test(e.message)?a="Tools & Access isn't available on this server yet — try refreshing after the next deployment.":a=e.message:e instanceof Error?a=e.message:a="Something went wrong.",(0,t.jsx)(p,{className:"border-bad/40",children:(0,t.jsxs)(h,{className:"flex flex-col gap-3 py-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 text-sm text-bad",children:[(0,t.jsx)(f,{className:"mt-0.5 h-4 w-4 shrink-0"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium",children:"Could not load this view"}),(0,t.jsx)("p",{className:"text-bad/80",children:a})]})]}),s?(0,t.jsx)("button",{type:"button",onClick:s,className:"self-start rounded-md border border-line px-3 py-1.5 text-xs font-medium hover:bg-bg-3",children:"Retry"}):null]})})}r(A,"ErrorState");export{M as a,$ as i,C as n,T as o,A as r,B as s,q as t};