@tickernelz/wardmote-ui 2026.1114.1 → 2026.1114.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/assets/{ActiveAgentsPanel-CKzCe8AC.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
  2. package/dist/assets/{AdapterManager-DFPaPUUr.js → AdapterManager-DUXWwNxv.js} +1 -1
  3. package/dist/assets/{AdvancedToolsRoute-CN5fWS4T.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
  4. package/dist/assets/{AgentActionButtons-a9LacJPP.js → AgentActionButtons-CPIhsP04.js} +1 -1
  5. package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
  6. package/dist/assets/{AgentChat-D5FDUYuV.js → AgentChat-BAn_ghsu.js} +1 -1
  7. package/dist/assets/{AgentChats-TN5SE_gN.js → AgentChats-f73hodzr.js} +1 -1
  8. package/dist/assets/{AgentDefaults-CiVVS_pQ.js → AgentDefaults-BL1XYvEo.js} +1 -1
  9. package/dist/assets/{AgentDetail-bCAmWRXs.js → AgentDetail-DthxFfuB.js} +1 -1
  10. package/dist/assets/{AgentTodoCard-BpmvHEsm.js → AgentTodoCard-BvgkWD0T.js} +1 -1
  11. package/dist/assets/{Agents-CToMMxGu.js → Agents-D5qI6yZZ.js} +3 -3
  12. package/dist/assets/{AppDetail-P807ou0a.js → AppDetail-B6PtMl8J.js} +1 -1
  13. package/dist/assets/{AppNotConnected-DuA4PukX.js → AppNotConnected-C_tGn786.js} +1 -1
  14. package/dist/assets/{ApprovalCard-BDdZDBMj.js → ApprovalCard-DrfZAdGQ.js} +1 -1
  15. package/dist/assets/{ApprovalDetail-CVgy1uNi.js → ApprovalDetail-sfPpfdXc.js} +1 -1
  16. package/dist/assets/{ApprovalPayload-H5zW6yQ4.js → ApprovalPayload-C4F3ItGH.js} +1 -1
  17. package/dist/assets/{Approvals-DL6kx45P.js → Approvals-DZoMl7_m.js} +1 -1
  18. package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
  19. package/dist/assets/{AppsReview-Bf7oB0ES.js → AppsReview-DokFETm0.js} +1 -1
  20. package/dist/assets/{ArtifactCard-Cp4KPgZl.js → ArtifactCard-BTf2-JIV.js} +1 -1
  21. package/dist/assets/{Artifacts-Dz3eHCaQ.js → Artifacts-CK8FaygC.js} +1 -1
  22. package/dist/assets/{AssistantConnection-5Y4fBVXq.js → AssistantConnection-BlKC7jk0.js} +1 -1
  23. package/dist/assets/{AttentionInteractionResolver-DlP6a6AG.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
  24. package/dist/assets/{AuditHub-Dz2UXl0c.js → AuditHub-DMhunMn8.js} +1 -1
  25. package/dist/assets/{BoardChat-DsMVXf5M.js → BoardChat-C4W8JLKB.js} +1 -1
  26. package/dist/assets/{BootstrapSetupUxLab-CWWisaHp.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
  27. package/dist/assets/{Browse-Be6aSv-F.js → Browse-BDjohBak.js} +1 -1
  28. package/dist/assets/{BudgetPolicyCard-Dka022-Z.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
  29. package/dist/assets/{CaseDetail-DdJrlm0m.js → CaseDetail-CL0FC5sG.js} +1 -1
  30. package/dist/assets/{Cases-Da1szfrr.js → Cases-C-7dXrEt.js} +1 -1
  31. package/dist/assets/{ChatEndpointDetail-DSOH-zfs.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
  32. package/dist/assets/{ChatEndpointSetup-J23lq-xi.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
  33. package/dist/assets/{ChoiceControls-B9yrYshK.js → ChoiceControls-3Qpci4yE.js} +1 -1
  34. package/dist/assets/{Companies-BkHWSxdB.js → Companies-97toQ8Cw.js} +1 -1
  35. package/dist/assets/{CompanyAccess-BaiGlxY1.js → CompanyAccess-CKhS1BaS.js} +1 -1
  36. package/dist/assets/{CompanyActivity-CMBXXwCw.js → CompanyActivity-DzNrAyAb.js} +1 -1
  37. package/dist/assets/{CompanyConnections-CVzsivTW.js → CompanyConnections-ORCH4i3U.js} +1 -1
  38. package/dist/assets/{CompanyEnvironments-K7piWRrx.js → CompanyEnvironments-DphURbtb.js} +1 -1
  39. package/dist/assets/{CompanyExport-Bo8tUPaY.js → CompanyExport-XeVCUcK3.js} +1 -1
  40. package/dist/assets/{CompanyImport-CBVjSXPA.js → CompanyImport-DPKpUaRa.js} +1 -1
  41. package/dist/assets/{CompanySettings-CuU9qSp5.js → CompanySettings-4JQpzuS1.js} +1 -1
  42. package/dist/assets/{CompanySettingsPluginPage-59_bMQQ3.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
  43. package/dist/assets/{CompanySkills-GBJMThWx.js → CompanySkills-BA_9Ztwj.js} +1 -1
  44. package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
  45. package/dist/assets/{ConfigureBuiltInAgentModal-D8Xnl51H.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
  46. package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
  47. package/dist/assets/{CopyableGatewayUrl-GuvA-DoQ.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
  48. package/dist/assets/{Dashboard-Cgj9BeTt.js → Dashboard--iaPJqJp.js} +1 -1
  49. package/dist/assets/{DashboardLive-Ku1cHAj9.js → DashboardLive-4rGeotay.js} +1 -1
  50. package/dist/assets/{DecisionDateChips-Z97mgInq.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
  51. package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
  52. package/dist/assets/{DecisionQueuePage-D8cyKm4V.js → DecisionQueuePage-D-kNFav_.js} +1 -1
  53. package/dist/assets/{DesignGuide-DvO3NaE-.js → DesignGuide-D7486q4b.js} +1 -1
  54. package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
  55. package/dist/assets/{EmailEndpointSetup-Cm_KKjjw.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
  56. package/dist/assets/{ExecutionWorkspaceDetail-CVB4ZY8I.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
  57. package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
  58. package/dist/assets/{GatewayDetail-DB1J44bF.js → GatewayDetail-CdXNQ9gD.js} +1 -1
  59. package/dist/assets/{GatewaysList-CKSwMmOi.js → GatewaysList-B0Jq1IRC.js} +1 -1
  60. package/dist/assets/{GoalDetail-Bscma2qU.js → GoalDetail-D2VhPtvw.js} +1 -1
  61. package/dist/assets/{GoalTree-jEFB788p.js → GoalTree-kFpgH4dA.js} +1 -1
  62. package/dist/assets/{Goals-jLNZ4UKT.js → Goals-B-_gq_Qu.js} +1 -1
  63. package/dist/assets/{ImageGalleryModal-CghUxjQC.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
  64. package/dist/assets/{Inbox-DHwNNh-Z.js → Inbox-zllmqRcB.js} +1 -1
  65. package/dist/assets/{InstanceAdvanced-C5IIPBwh.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
  66. package/dist/assets/{InviteLanding-BHmCRaWY.js → InviteLanding-brwa_8NC.js} +1 -1
  67. package/dist/assets/{IssueChatLongThreadPerf-JH8rtLk0.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
  68. package/dist/assets/{IssueChatThread-ByTyrsxz.js → IssueChatThread-CMXzuvrF.js} +1 -1
  69. package/dist/assets/{IssueDetail-BIif8Swu.js → IssueDetail-DGdg-mB8.js} +1 -1
  70. package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
  71. package/dist/assets/{IssueOutputSection-CFE6aU9L.js → IssueOutputSection-aSyiE1pg.js} +1 -1
  72. package/dist/assets/{IssueRecoveryActionCard-DBgE7aMm.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
  73. package/dist/assets/{IssueThreadInteractionCard-C3LFe8cu.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
  74. package/dist/assets/{Issues-B5QG33RC.js → Issues-CsmM33z_.js} +1 -1
  75. package/dist/assets/{LiveNowTodoLine-D52WDE8-.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
  76. package/dist/assets/{ManagedAiConnectionDetails-C9nV0oIT.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
  77. package/dist/assets/{McpConnect-Bk8Qskqw.js → McpConnect-CYLP1yLX.js} +1 -1
  78. package/dist/assets/{MembershipAction-DjdBY6Bk.js → MembershipAction-CKs7Ua9x.js} +1 -1
  79. package/dist/assets/{ModelsAndProviders-BtbhNxf_.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
  80. package/dist/assets/{NewAgent-C4JqnMkp.js → NewAgent-DBQzvxIr.js} +1 -1
  81. package/dist/assets/{OmpAllSettings-aHENTYf5.js → OmpAllSettings-B_Knr51Z.js} +1 -1
  82. package/dist/assets/{PipelineSettings-CCoxV9Es.js → PipelineSettings-Dl-94FB5.js} +1 -1
  83. package/dist/assets/{Pipelines-DaQPh688.js → Pipelines-CY9hGe0h.js} +1 -1
  84. package/dist/assets/{PixelsOffice-D1X7mdpk.js → PixelsOffice-BgyGZsiV.js} +1 -1
  85. package/dist/assets/{PluginPage-B4kdPADI.js → PluginPage-CMA4Ei50.js} +1 -1
  86. package/dist/assets/{PluginSettings-yP8NX-sM.js → PluginSettings-Cm4H1JRT.js} +1 -1
  87. package/dist/assets/{ProfileDetailRoute-DMdAvFmb.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
  88. package/dist/assets/{ProfileSettings-DVm3Tqzs.js → ProfileSettings-Djo7BLIj.js} +1 -1
  89. package/dist/assets/{ProfileWizardRoute-CijS7-aN.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
  90. package/dist/assets/{ProjectDetail-DeLSGbmz.js → ProjectDetail-CmmdvUHn.js} +1 -1
  91. package/dist/assets/{ProjectWorkspaceDetail-DPajDjA-.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
  92. package/dist/assets/{ProjectWorkspacesContent-BCATCcZI.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
  93. package/dist/assets/{Projects-DPmo6PFV.js → Projects-BTAauZr0.js} +1 -1
  94. package/dist/assets/{PublicIssueSharePage-B_W1Qpy_.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
  95. package/dist/assets/{ReviewQueueCard-DhfCjwYP.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
  96. package/dist/assets/{RichWorkProductCard-rJC8tWnB.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
  97. package/dist/assets/{RoutineDetail-Cb0oYk5B.js → RoutineDetail-BT6_GKnC.js} +1 -1
  98. package/dist/assets/{RoutineRunVariablesDialog-CWNUGmiH.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
  99. package/dist/assets/{Routines-Ct6W3Ht-.js → Routines-4LevOfvV.js} +1 -1
  100. package/dist/assets/{ScrollToBottom-BvL4b3BQ.js → ScrollToBottom-jItsgDR8.js} +1 -1
  101. package/dist/assets/{Search-CXiBakEC.js → Search-bmcm0_m_.js} +1 -1
  102. package/dist/assets/{Secrets-XUpMCMhK.js → Secrets-DfR1fBAZ.js} +1 -1
  103. package/dist/assets/{SkillSourceTree-Brg47aIX.js → SkillSourceTree--FWKWyF3.js} +1 -1
  104. package/dist/assets/{SkillSources-C3kuN9Hz.js → SkillSources-jUDjqy5i.js} +1 -1
  105. package/dist/assets/{SkillStudio-DVVVKjdn.js → SkillStudio-BsqtUnzF.js} +1 -1
  106. package/dist/assets/{SourceTrustBadge-D-MXuX_l.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
  107. package/dist/assets/{StatusCards-BmNOGr1d.js → StatusCards-Dt3zorUZ.js} +1 -1
  108. package/dist/assets/{SummarySlotCard-DiTaQ4km.js → SummarySlotCard-D1C0qH2L.js} +1 -1
  109. package/dist/assets/{TaskChatLab-fOJfHKjI.js → TaskChatLab-B0coUvdp.js} +1 -1
  110. package/dist/assets/{TaskChatMarker-Cgyrmeab.js → TaskChatMarker-C40twVjh.js} +1 -1
  111. package/dist/assets/{TaskChatProtocolCard-DrIe_IYV.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
  112. package/dist/assets/{TaskChatThreadView-DKqNA1fZ.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
  113. package/dist/assets/{TaskDetailRelationsPanel-C9mJfMvL.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
  114. package/dist/assets/{TaskTreeControls-B1CSnDVK.js → TaskTreeControls-DznugVpi.js} +1 -1
  115. package/dist/assets/Terminal-NjEb5-2b.js +1 -0
  116. package/dist/assets/TerminalView-DZxK2Ei5.js +58 -0
  117. package/dist/assets/{TrustPresetSection-D4qB_VZo.js → TrustPresetSection-CjNwNBo3.js} +1 -1
  118. package/dist/assets/{UserProfile-Cavc3nhB.js → UserProfile-Dujv3qdz.js} +1 -1
  119. package/dist/assets/{WhatNeedsMe-B7BSt_wb.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
  120. package/dist/assets/{Workspaces-CDTiwIHd.js → Workspaces-BTgSx9nA.js} +1 -1
  121. package/dist/assets/{connection-owner-Cx9obLlP.js → connection-owner-DL4yKhSt.js} +1 -1
  122. package/dist/assets/dist-ypeTPGg_.js +1 -0
  123. package/dist/assets/dropdown-menu-DEO3mF_E.js +1 -0
  124. package/dist/assets/{environment-variables-editor-CCxeFKKk.js → environment-variables-editor-0qgSPgNN.js} +1 -1
  125. package/dist/assets/{index-B7mmhFG7.js → index-3AxqhPET.js} +4 -4
  126. package/dist/assets/index-B5bd7Tk6.css +2 -0
  127. package/dist/assets/{issue-properties-C_y5-tny.js → issue-properties-B1cYnBDU.js} +1 -1
  128. package/dist/assets/{issue-workspace-selection-ChtddJZC.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
  129. package/dist/assets/{pipeline-stage-presentation-jxAxpF6f.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
  130. package/dist/assets/{shared-hwt7Xn4W.js → shared-4LF6wQ38.js} +1 -1
  131. package/dist/assets/{tool-taxonomy-6170LibQ.js → tool-taxonomy-B5zpbkHA.js} +1 -1
  132. package/dist/assets/{transcript-adapter-C9uEslxp.js → transcript-adapter-C29ZJiU2.js} +1 -1
  133. package/dist/assets/{useSummaryDraftStream-BulT3Wwh.js → useSummaryDraftStream-R2Y2bAUU.js} +1 -1
  134. package/dist/index.html +7 -6
  135. package/dist/sw.js +1 -1
  136. package/package.json +1 -1
  137. package/dist/assets/Terminal-CGmILZtz.js +0 -1
  138. package/dist/assets/TerminalView-BqCU9Vc3.js +0 -58
  139. package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
  140. package/dist/assets/index-KZ2bEg2H.css +0 -2
@@ -1,2 +1,2 @@
1
- var Pr=Object.defineProperty;var r=(t,l)=>Pr(t,"name",{value:l,configurable:!0});import{i as Ta,n as Ur}from"./rolldown-runtime-ZpX3ckPj.js";import{Oi as Gn,l as M,na as $r,ta as zr}from"./createLucideIcon-DJi9suAC.js";import{a as Gr,h as Vr}from"./star-BZgQbzhV.js";import{X as Wr,_ as he,n as Qr,t as R,v as W}from"./queryKeys-DYV5MhM_.js";import{o as Xr}from"./companies-query-D9PxIiMT.js";import{t as Hr}from"./issue-attribution-DfN_3u2W.js";import{n as Yr}from"./CompanyContext-CSrVsSze.js";import{Ct as Vn,G as Jr,Ht as Zr,Jt as Wn,Ut as Qn,Vt as Xn,Yt as Hn,an as qt,o as ei,t as Xs,tt as Yn,zt as ne}from"./router-2UfGeejU.js";import{t as si}from"./tabs-B2Os_leL.js";import{o as St,r as Nt,t as Ct}from"./popover-BhYHYj7q.js";import{t as ti}from"./archive-CTfe4zq5.js";import{t as ni}from"./arrow-up-down-Bpe9xqCo.js";import{t as _t}from"./check-Ctsrlfa-.js";import{t as ai}from"./chevron-right-s7L6hXXq.js";import{t as ri}from"./circle-x-CFlSbYzD.js";import{t as ii}from"./clock-CzrJT_cP.js";import{t as Jn}from"./inbox-C08arfF_.js";import{t as z}from"./button-CMwV3L1P.js";import{t as oi}from"./pause-CJSwJvLv.js";import{t as li}from"./plus-C6fnr28l.js";import{t as Zn}from"./rotate-ccw-CQEJ4ewP.js";import{t as ci}from"./search-04O7m-IF.js";import{t as ks}from"./triangle-alert-CBVKiaXB.js";import{t as ui}from"./user-Ccom_Ph0.js";import{t as Hs}from"./x-DRDFdlYE.js";import{r as di}from"./SidebarContext-CF3RWLxh.js";import{t as mi}from"./Identity-Cv_2a9qJ.js";import{a as pi}from"./ToastContext-DMdt9oTd.js";import{t as ea}from"./agents-DmlgUVso.js";import{t as sa}from"./heartbeats-DOyojsaN.js";import{t as hi}from"./instanceSettings-D8g_QlS-.js";import{n as bs,t as gs}from"./useSharedPolling-D4Xn8mY2.js";import{a as ta,d as fi,f as xi,i as bi,l as gi,m as yi,n as na,o as Ii,p as vi,r as aa,u as ra}from"./inboxArchiveCache-D8QGdg49.js";import{t as ki}from"./projects-mixWrT5q.js";import{a as wi,i as ji,n as Si,r as Ni,s as Ci,t as _i}from"./dialog-CKUblzlR.js";import{t as zs}from"./access-GAosX22P.js";import{d as Ai,n as Ri,r as Mi,t as Bt}from"./issue-filters-BO9xiK0c.js";import{r as ia}from"./assignees-DkQNbPzi.js";import{n as Ti}from"./BreadcrumbContext-BVZDZoC0.js";import{t as Fi}from"./AgentIdentity-I_kB4rMX.js";import{t as oa}from"./card-Bru3x_SJ.js";import{t as Ys}from"./StatusIcon-0GcYXDdN.js";import{A as la,Ai as ca,Bi as ua,Bt as Ei,Ci as Bi,D as Li,Di as vs,E as Di,Ei as qi,Fi as Oi,Gi as da,Gt as Ki,Hi as ma,Ii as Pi,Ji as Ui,Ki as $i,Kn as zi,Kr as Gi,Kt as Vi,L as Wi,Li as Qi,M as Xi,Mi as Hi,N as Yi,Ni as pa,O as ha,Oi as At,Pi as fa,Ri as Fa,S as xa,Si as Ji,T as ba,Ti as ga,Ui as ya,Ut as Zi,Vi as eo,Wi as so,Xi as to,Yi as no,Zi as Rt,_ as ao,_i as ro,a as io,ar as oo,b as Ot,bi as lo,c as Ia,ca as co,cr as uo,di as mo,gi as Js,ha as po,hi as ho,j as fo,ja as xo,ji as Mt,ki as bo,lr as go,mi as yo,o as Io,or as vo,pi as ko,pn as wo,pr as jo,q as So,qi as No,qn as Co,s as _o,sr as va,tr as Ao,ur as Ro,v as Mo,vi as To,w as Ea,wi as Fo,x as Ba,xi as Eo,yi as Tt,zi as Bo,zt as ka}from"./index-B7mmhFG7.js";import{a as Lo,i as Do,n as La}from"./ApprovalPayload-H5zW6yQ4.js";import{t as wa}from"./separator-B2LFqBpM.js";function qo(t,l){return l?t.responsibleUserId?t.responsibleUserId===l:l==="local-board":!1}r(qo,"isHeartbeatRunVisibleInMine");var o=Ta($r(),1),Oo={pending_board_decision:"needs_decision",pending_user_decision:"needs_decision",missing_successful_run_disposition:"needs_decision",blocked_chain_stalled:"stalled",blocked_by_unassigned_issue:"needs_attention",blocked_by_assigned_backlog_issue:"needs_attention",blocked_by_cancelled_issue:"needs_attention",in_review_without_action_path:"needs_attention",invalid_review_participant:"needs_attention",open_recovery_issue:"recovery_required",external_owner_action:"external_wait",blocked_by_uninvokable_assignee:"owner_paused"},Ko=["needs_decision","stalled","needs_attention","recovery_required","external_wait","owner_paused"],Da={needs_decision:"Needs decision",stalled:"Blocked chain stalled",needs_attention:"Needs attention",recovery_required:"Recovery required",external_wait:"External wait",owner_paused:"Owner paused"},Po={pending_board_decision:"Pending board decision",pending_user_decision:"Pending user decision",missing_successful_run_disposition:"Pick disposition",blocked_chain_stalled:"Blocked chain stalled",blocked_by_unassigned_issue:"Unassigned blocker",blocked_by_assigned_backlog_issue:"Parked blocker",blocked_by_cancelled_issue:"Cancelled blocker",in_review_without_action_path:"Review without action path",invalid_review_participant:"Invalid review participant",open_recovery_issue:"Recovery in progress",external_owner_action:"External owner action",blocked_by_uninvokable_assignee:"Owner paused"},Uo={critical:0,high:1,medium:2,low:3};function qa(t){return Oo[t]??"needs_attention"}r(qa,"blockedReasonVariant");function $o(t){return Po[t]??"Stopped"}r($o,"blockedReasonLabel");function zo(t){return Da[t]}r(zo,"blockedVariantLabel");function Zs(t){return Uo[t]??9}r(Zs,"blockedSeverityRank");function ja(t,l){const c=Zs(t.severity)-Zs(l.severity);if(c!==0)return c;const n=(t.stoppedSinceAt?new Date(t.stoppedSinceAt).getTime():Number.POSITIVE_INFINITY)-(l.stoppedSinceAt?new Date(l.stoppedSinceAt).getTime():Number.POSITIVE_INFINITY);return Number.isFinite(n)?n:0}r(ja,"compareBlockedAttention");var Go=[["blocker_type","Blocker type"],["none","None"]],Vo=[["urgency","Most urgent"],["most_recent","Most recent"],["longest_stopped","Longest stopped"]];function Wo(t){const l=[];for(const c of t){const n=c.blockedInboxAttention;n&&l.push({issue:c,attention:n,variant:qa(n.reason),reasonLabel:$o(n.reason),stoppedAtMs:n.stoppedSinceAt?new Date(n.stoppedSinceAt).getTime():null})}return l}r(Wo,"buildBlockedInboxRows");function Qo(t){if(!t)return null;const l=new Date(t).getTime();return Number.isFinite(l)?l:null}r(Qo,"issueTimestampMs");function Gs(t){return t.stoppedAtMs??Qo(t.issue.updatedAt)??0}r(Gs,"blockedRowRecencyMs");function Ft(t,l){const c=t.issue.title.localeCompare(l.issue.title);return c!==0?c:t.issue.id.localeCompare(l.issue.id)}r(Ft,"compareBlockedRowsByTitle");function Xo(t,l,c="urgency"){if(c==="most_recent"){const f=Gs(l)-Gs(t);if(f!==0)return f;const x=ja(t.attention,l.attention);return x!==0?x:Ft(t,l)}if(c==="longest_stopped"){const f=(t.stoppedAtMs??Number.POSITIVE_INFINITY)-(l.stoppedAtMs??Number.POSITIVE_INFINITY);if(f!==0)return f;const x=Zs(t.attention.severity)-Zs(l.attention.severity);return x!==0?x:Ft(t,l)}const n=ja(t.attention,l.attention);if(n!==0)return n;const d=Gs(l)-Gs(t);return d!==0?d:Ft(t,l)}r(Xo,"compareBlockedRows");function Oa(t,l="urgency"){return[...t].sort((c,n)=>Xo(c,n,l))}r(Oa,"sortBlockedInboxRows");function Ho(t,l="urgency"){const c=new Map;for(const d of t){const f=c.get(d.variant)??[];f.push(d),c.set(d.variant,f)}const n=[];for(const d of Ko){const f=c.get(d);if(!f||f.length===0)continue;const x=Oa(f,l);n.push({variant:d,label:Da[d],rows:x})}return n}r(Ho,"groupBlockedInboxRows");function Yo(t,l){const c=l.trim().toLowerCase();return c?[t.issue.title,t.issue.identifier??"",t.attention.owner.label??"",t.attention.action.label,t.attention.action.detail??"",t.reasonLabel,t.attention.leafIssue?.identifier??"",t.attention.leafIssue?.title??"",t.attention.recoveryIssue?.identifier??"",t.attention.recoveryIssue?.title??""].join(" ").toLowerCase().includes(c):!0}r(Yo,"blockedRowMatchesSearch");function Jo(t,l=Date.now()){if(!t)return"stopped";const c=new Date(t).getTime();if(!Number.isFinite(c))return"stopped";const n=Math.max(0,Math.round((l-c)/1e3));return n<60?"stopped just now":n<3600?`stopped ${Math.floor(n/60)}m`:n<86400?`stopped ${Math.floor(n/3600)}h`:n<604800?`stopped ${Math.floor(n/86400)}d`:n<2592e3?`stopped ${Math.floor(n/604800)}w`:`stopped ${Math.floor(n/2592e3)}mo`}r(Jo,"formatStoppedAge");function Sa(t){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.trunc(t))}r(Sa,"normalizeLiveDescendantCount");function Zo(t){if(!t||typeof t!="object")return null;const l=t;return typeof l.state=="string"?l:null}r(Zo,"asBlockerAttention");function Ka(t,l=0){return Math.max(Sa(t.liveDescendantCount),Sa(l))}r(Ka,"resolveIssueLiveDescendantCount");function Pa(t,l){const c=Zo(t.blockerAttention);if(t.status!=="blocked"||l.isLive||c?.state==="needs_attention"||c?.state==="stalled"||c?.state==="covered")return c;const n=Ka(t,l.loadedSubtreeLiveCount);return n<=0?c:{state:"covered",reason:"active_child",unresolvedBlockerCount:c?.unresolvedBlockerCount??0,coveredBlockerCount:n,stalledBlockerCount:c?.stalledBlockerCount??0,attentionBlockerCount:c?.attentionBlockerCount??0,sampleBlockerIdentifier:c?.sampleBlockerIdentifier??null,sampleStalledBlockerIdentifier:c?.sampleStalledBlockerIdentifier??null}}r(Pa,"resolveInboxIssueBlockerAttention");var s=Ta(zr(),1),el={needs_decision:"border-violet-300/70 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",recovery_required:"border-cyan-300/70 bg-cyan-50 text-cyan-800 dark:border-cyan-500/30 dark:bg-cyan-500/10 dark:text-cyan-300",stalled:"border-amber-400/70 bg-amber-100 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-200",needs_attention:"border-amber-300/70 bg-amber-50 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-300",external_wait:"border-slate-300 bg-slate-50 text-slate-700 dark:border-slate-500/30 dark:bg-slate-500/15 dark:text-slate-300",owner_paused:"border-red-300/70 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"},sl={needs_decision:ii,recovery_required:Jr,stalled:ks,needs_attention:ks,external_wait:ui,owner_paused:oi},tl={critical:"bg-red-500",high:"bg-orange-500"};function Na({reason:t,severity:l,compact:c=!1,className:n}){const d=qa(t),f=zo(d),x=sl[d],m=tl[l];return(0,s.jsxs)("span",{"data-testid":"blocked-reason-chip","data-variant":d,"data-severity":l,"aria-label":`Reason: ${f}, severity ${l}`,className:M("inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-0.5 text-(length:--text-nano) font-medium leading-tight sm:text-(length:--text-micro)",el[d],n),children:[m?(0,s.jsx)("span",{"aria-hidden":"true",className:M("inline-block h-1.5 w-1.5 shrink-0 rounded-full",m)}):null,c?null:(0,s.jsx)(x,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate",children:f})]})}r(Na,"BlockedReasonChip");var nl=200;function al({companyId:t,searchQuery:l,agentNameById:c,agents:n,userLabelById:d,issueLinkState:f,groupBy:x,sortBy:m,issueFilters:b,currentUserId:g,liveIssueIds:p,subtreeLiveCounts:C,workspaceFilterContext:_,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L="legacy"}){const[Q,Te]=(0,o.useState)(()=>new Set),{data:O=[],isLoading:Fe,isFetching:ae,error:fe,refetch:je}=W({queryKey:[...R.issues.listBlockedAttention(t),"live-descendant-summary"],queryFn:r(()=>ne.list(t,{attention:"blocked",includeBlockedInboxAttention:!0,includeBlockedBy:!0,includeLiveDescendantSummary:!0,limit:nl}),"queryFn")}),Se=(0,o.useMemo)(()=>Wo(O),[O]),Y=(0,o.useMemo)(()=>Se.filter(F=>Yo(F,l)),[Se,l]),xe=(0,o.useMemo)(()=>{const F=new Set(Bt(Y.map(S=>S.issue),b,g,!0,p,_).map(S=>S.id));return Y.filter(S=>F.has(S.issue.id))},[g,Y,b,p,_]),$e=(0,o.useMemo)(()=>Oa(xe,m),[xe,m]),be=(0,o.useMemo)(()=>Ho(xe,m),[xe,m]),re=r(F=>{Te(S=>{const K=new Set(S);return K.has(F)?K.delete(F):K.add(F),K})},"toggleVariant");if(Fe)return(0,s.jsx)("div",{"data-testid":"blocked-inbox-loading",className:"space-y-3","aria-busy":"true",children:Array.from({length:3}).map((F,S)=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-4 w-40 animate-pulse rounded bg-bg-3/70"}),Array.from({length:2}).map((K,ie)=>(0,s.jsxs)("div",{className:M("flex items-center gap-3 px-3 py-2.5 sm:px-4",L==="legacy"&&"border-b border-line/60"),children:[(0,s.jsx)("div",{className:"h-3.5 w-3.5 animate-pulse rounded-full bg-bg-3"}),(0,s.jsx)("div",{className:"h-4 w-16 animate-pulse rounded bg-bg-3/70"}),(0,s.jsx)("div",{className:"h-4 w-32 animate-pulse rounded-md bg-bg-3/70"}),(0,s.jsx)("div",{className:"h-4 flex-1 animate-pulse rounded bg-bg-3/60"}),(0,s.jsx)("div",{className:"hidden h-3 w-24 animate-pulse rounded bg-bg-3/60 sm:block"})]},ie))]},S))});if(fe){const F=fe instanceof Error?fe.message:"Couldn't load the Blocked tab.";return(0,s.jsx)("div",{"data-testid":"blocked-inbox-error",role:"alert",className:"flex flex-col gap-2 rounded-md border border-amber-300/70 bg-amber-50/90 p-4 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(ks,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Couldn't load the Blocked tab."}),(0,s.jsxs)("p",{className:"text-xs opacity-80",children:["Other Inbox tabs still work. ",F]})]}),(0,s.jsx)(z,{type:"button",variant:"secondary",size:"sm",className:"h-7 shrink-0",onClick:r(()=>{je()},"onClick"),disabled:ae,children:ae?"Trying…":"Try again"})]})})}return Se.length===0?(0,s.jsxs)(oa,{"data-testid":"blocked-inbox-empty",className:"items-center gap-3 border-line/70 bg-bg-2/40 px-6 py-10 text-center",children:[(0,s.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",children:(0,s.jsx)(Gr,{className:"h-5 w-5","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-ink",children:"No work is stopped."}),(0,s.jsx)("p",{className:"text-xs text-ink-3",children:"Tasks that need a decision, recovery, or external action will appear here."})]})]}):be.length===0?(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)(oa,{"data-testid":"blocked-inbox-no-search-results",className:"block border-line/70 bg-bg-2/40 px-4 py-6 text-center text-sm text-ink-3",children:"No stopped items match your search."})}):(0,s.jsx)("div",{"data-testid":"blocked-inbox",className:"space-y-3",children:(0,s.jsx)("div",{className:"overflow-hidden rounded-xl",children:x==="none"?$e.map(F=>(0,s.jsx)(Ca,{row:F,issueLinkState:f,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:p,subtreeLiveCounts:C,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L},F.issue.id)):be.map(F=>{const S=Q.has(F.variant);return(0,s.jsxs)("div",{"data-testid":`blocked-inbox-group-${F.variant}`,children:[(0,s.jsx)("div",{className:L==="task"?"rounded-lg px-3 sm:pl-0 sm:pr-4":"px-3 sm:px-4",children:(0,s.jsx)(Ea,{label:`${F.label} · ${F.rows.length}`,collapsible:!0,collapsed:S,onToggle:r(()=>re(F.variant),"onToggle")})}),!S&&(0,s.jsx)("div",{children:F.rows.map(K=>(0,s.jsx)(Ca,{row:K,issueLinkState:f,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:p,subtreeLiveCounts:C,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L},K.issue.id))})]},F.variant)})})})}r(al,"BlockedInboxView");function rl(t,l,c){const n=t.attention.owner;return n.label?{label:n.label,isAgent:n.type==="agent"}:n.agentId?{label:l.get(n.agentId)??null,isAgent:!0}:n.userId?{label:c?.get(n.userId)??null,isAgent:!1}:{label:null,isAgent:!1}}r(rl,"resolveOwnerName");function Ca({row:t,issueLinkState:l,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:f,subtreeLiveCounts:x,showStatusColumn:m,showIdentifierColumn:b,showUpdatedColumn:g,presentation:p}){const{label:C,isAgent:_}=rl(t,c,d),A=Jo(t.attention.stoppedSinceAt),T=Pa(t.issue,{isLive:f.has(t.issue.id),loadedSubtreeLiveCount:x.get(t.issue.id)??0}),q=(0,s.jsxs)("span",{className:"flex shrink-0 items-center gap-3 text-xs",children:[(0,s.jsx)("span",{className:"hidden w-(--sz-10_5rem) shrink-0 justify-start sm:inline-flex","data-testid":"blocked-row-reason-column",children:(0,s.jsx)(Na,{reason:t.attention.reason,severity:t.attention.severity,className:"max-w-full"})}),C?(0,s.jsx)("span",{className:"hidden w-(--sz-150px) min-w-0 items-center text-ink-3 sm:inline-flex",children:_?(0,s.jsx)(Fi,{agent:n?.find(Q=>Q.id===t.attention.owner.agentId)??{id:t.attention.owner.agentId??void 0,name:C},size:"xs",className:"max-w-full"}):(0,s.jsx)(mi,{name:C,size:"xs",className:"max-w-full"})}):(0,s.jsx)("span",{className:"hidden w-(--sz-150px) shrink-0 sm:inline-flex","aria-hidden":"true"}),p==="legacy"&&g?(0,s.jsx)("span",{className:"hidden w-(--sz-5_75rem) text-right text-ink-3 sm:inline","data-testid":"blocked-row-age",children:A}):null]}),L=(0,s.jsxs)("span",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-ink-3",children:[p==="legacy"&&(0,s.jsx)("span",{"data-testid":"blocked-row-age-mobile",children:A}),C?(0,s.jsxs)(s.Fragment,{children:[p==="legacy"&&(0,s.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,s.jsx)("span",{className:M(_?"font-medium text-ink/90":null),"data-testid":"blocked-row-owner-mobile",children:C})]}):null]});return(0,s.jsx)(Ba,{issue:t.issue,issueLinkState:l,presentation:p,showDivider:p==="legacy",statusSlot:p==="task"?m?(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:T}):(0,s.jsx)("span",{className:"inline-flex size-4","aria-hidden":"true"}):void 0,showIdentifier:p==="task"?b:void 0,desktopMetaLeading:p==="legacy"?(0,s.jsx)(il,{row:t,blockerAttention:T,showStatusColumn:m,showIdentifierColumn:b}):void 0,mobileLeading:(0,s.jsx)("span",{className:"flex shrink-0 items-center gap-1.5 pt-px",children:(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:T})}),titleSuffix:(0,s.jsx)(Na,{reason:t.attention.reason,severity:t.attention.severity,className:"ml-2 max-w-(--sz-12rem) align-middle sm:hidden"}),mobileMeta:L,mobileTitleMeta:p==="task"?(0,s.jsx)("span",{"data-testid":"blocked-row-age-mobile",children:A}):void 0,desktopTrailing:q,trailingMeta:p==="task"&&g?A:null})}r(Ca,"BlockedInboxRow");function il({row:t,blockerAttention:l,showStatusColumn:c,showIdentifierColumn:n}){const d=t.issue.identifier??t.issue.id.slice(0,8);return(0,s.jsxs)("span",{className:"hidden shrink-0 items-center gap-2 sm:inline-flex",children:[c?(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:l}):null,n?(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3",children:d}):null]})}r(il,"BlockedRowDesktopMeta");var ol=.32,ll=.88,cl=140;function ys({children:t,onArchive:l,disabled:c=!1,selected:n=!1,className:d}){const f=(0,o.useRef)(null),x=(0,o.useRef)(null),m=(0,o.useRef)(0),b=(0,o.useRef)(null),g=(0,o.useRef)(null),p=(0,o.useRef)(!1),C=(0,o.useRef)(0),[_,A]=(0,o.useState)(0),[T,q]=(0,o.useState)(!1),[L,Q]=(0,o.useState)(!1),[Te,O]=(0,o.useState)(null);(0,o.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current),g.current!==null&&window.clearTimeout(g.current),b.current=null,g.current=null,x.current=null,p.current=!1},[]);const Fe=r(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null)},"clearArchiveTimeout"),ae=r(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},"clearClickSuppressionTimeout"),fe=r(()=>{ae(),p.current=!1},"clearClickSuppression"),je=r(()=>{ae(),g.current=window.setTimeout(()=>{p.current=!1,g.current=null},350)},"releaseClickSuppressionSoon"),Se=r(()=>{x.current=null,C.current=0,q(!1),Q(!1),O(null),A(0)},"reset"),Y=r(()=>{Fe();const S=f.current;if(!S){l();return}x.current=null,q(!1),O(S.offsetHeight);const K=-Math.max(m.current,S.offsetWidth);C.current=K,A(K),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{Q(!0)})}),b.current=window.setTimeout(()=>{b.current=null,l()},cl)},"commitArchive"),xe=r(S=>{if(c||L||b.current!==null||S.touches.length!==1)return;Fe(),fe();const K=S.touches[0],ie=f.current;m.current=ie?.offsetWidth??0,O(ie?.offsetHeight??null),Q(!1),p.current=!1,x.current={x:K.clientX,y:K.clientY}},"handleTouchStart"),$e=r(S=>{if(c||L)return;const K=x.current;if(!K||S.touches.length!==1)return;const ie=S.touches[0],U=ie.clientX-K.x,Ne=ie.clientY-K.y;if(!T){if(Math.abs(U)<6)return;if(Math.abs(Ne)>Math.abs(U)){x.current=null;return}p.current=!0}if(U>=0){S.preventDefault(),q(!0),C.current=0,A(0);return}const $=m.current>0?m.current*ll:Number.POSITIVE_INFINITY;S.preventDefault(),q(!0);const ge=Math.max(U,-$);C.current=ge,A(ge)},"handleTouchMove"),be=r(()=>{if(!(c||L||b.current!==null)){if(m.current>0&&Math.abs(C.current)>=m.current*ol){je(),Y();return}T&&je(),Se()}},"handleTouchEnd"),re=r(()=>{c||L||b.current!==null||(fe(),Se())},"handleTouchCancel"),F=m.current>0?Math.min(Math.abs(_)/m.current,1):0;return(0,s.jsxs)("div",{ref:f,className:M("relative overflow-hidden touch-pan-y",d),style:{height:Te===null?void 0:L?0:Te,opacity:L?0:1,transition:L?"height 200ms ease, opacity 200ms ease":void 0},onTouchStart:xe,onTouchMove:$e,onTouchEnd:be,onTouchCancel:re,onClickCapture:r(S=>{p.current&&(S.preventDefault(),S.stopPropagation(),fe())},"onClickCapture"),children:[(0,s.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-end rounded-lg bg-emerald-600 px-4 text-white",style:{opacity:F},children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm font-medium",children:[(0,s.jsx)(ti,{className:"h-4 w-4"}),"Archive"]})}),(0,s.jsx)("div",{"data-inbox-row-surface":!0,className:M("relative will-change-transform",n?"rounded-lg bg-bg-3/50":"bg-bg"),style:{transform:`translate3d(${_}px, 0, 0)`,transition:T?"none":"transform 180ms ease-out"},children:t})]})}r(ys,"SwipeToArchive");var ul=15e4,dl=3e4;function _a(){return typeof document>"u"||document.visibilityState==="visible"}r(_a,"isDocumentVisible");function ml({viewIdentity:t,onCommit:l,idleCommitMs:c=ul,hiddenCommitMs:n=dl}){const d=(0,o.useRef)(l),f=(0,o.useRef)(null),x=(0,o.useRef)(null),m=(0,o.useRef)(!1),b=(0,o.useRef)(t);(0,o.useEffect)(()=>{d.current=l},[l]);const g=(0,o.useCallback)(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),p=(0,o.useCallback)(()=>{if(g(),!_a())return;const A=r(()=>{f.current=setTimeout(()=>{f.current=null,_a()&&(d.current("idle"),A())},c)},"armIdleTimer");A()},[g,c]),C=(0,o.useCallback)(()=>{p()},[p]),_=(0,o.useCallback)(()=>{d.current("manual-refresh"),p()},[p]);return(0,o.useEffect)(()=>(m.current?b.current!==t&&d.current("view-identity-change"):(m.current=!0,d.current("mount")),b.current=t,p(),g),[g,p,t]),(0,o.useEffect)(()=>{if(typeof document>"u")return;document.visibilityState!=="visible"&&(x.current=Date.now(),g());const A=r(()=>{if(document.visibilityState!=="visible"){x.current=Date.now(),g();return}const T=x.current;x.current=null,T!==null&&Date.now()-T>=n&&d.current("visibility"),p()},"handleVisibilityChange");return document.addEventListener("visibilitychange",A),()=>document.removeEventListener("visibilitychange",A)},[g,n,p]),{noteInteraction:C,commitManualRefresh:_}}r(ml,"useInboxSortAttention");function Lt(t){return t.kind==="issue"?t.issue.id:vs(t)}r(Lt,"inboxOrderRowKey");function Aa(t){return Array.from(t,l=>({key:l,missingSince:null}))}r(Aa,"captureKeys");function Ua(t){return{key:t.key,missingSince:null,rows:Aa(t.displayItems.map(Lt)),childrenByIssueId:new Map(Array.from(t.childrenByIssueId,([l,c])=>[l,Aa(c.map(n=>n.id))]))}}r(Ua,"captureSection");function pl(t){return{sections:t.map(Ua)}}r(pl,"captureInboxOrderPin");function hl(t,l,c){let n=0;for(let d=0;d<t.length;d+=1){if(n===c)return d;l.has(t[d].key)&&(n+=1)}return t.length}r(hl,"insertionIndexForVisiblePosition");function Kt(t,l,c){const n=new Set(l),d=t.flatMap(m=>{if(n.has(m.key))return m.missingSince===null||c-m.missingSince<5e3?[{key:m.key,missingSince:null}]:[];const b=m.missingSince??c;return c-b<5e3?[{key:m.key,missingSince:b}]:[]}),f=new Set(d.map(m=>m.key)),x=new Set(d.filter(m=>m.missingSince===null).map(m=>m.key));return l.forEach((m,b)=>{if(f.has(m))return;const g=hl(d,x,b);d.splice(g,0,{key:m,missingSince:null}),x.add(m)}),{entries:d,retainedPinnedKeys:f,visibleKeys:d.filter(m=>m.missingSince===null).map(m=>m.key)}}r(Kt,"reconcileKeys");function fl(t,l,c){const n=new Set([...t.keys(),...l.keys()]),d=new Map,f=new Map;for(const x of n){const m=l.get(x)??[],b=new Map(m.map(p=>[p.id,p])),g=Kt(t.get(x)??[],m.map(p=>p.id),c);g.entries.length>0&&d.set(x,g.entries),l.has(x)&&f.set(x,g.visibleKeys.flatMap(p=>{const C=b.get(p);return C?[C]:[]}))}return{pin:d,display:f}}r(fl,"reconcileChildren");function xl(t,l,c){if(!t)return{pin:Ua(l),display:l};const n=new Map(l.displayItems.map(x=>[Lt(x),x])),d=Kt(t.rows,l.displayItems.map(Lt),c),f=fl(t.childrenByIssueId,l.childrenByIssueId,c);return{pin:{key:l.key,missingSince:null,rows:d.entries,childrenByIssueId:f.pin},display:{...l,displayItems:d.visibleKeys.flatMap(x=>{const m=n.get(x);return m?[m]:[]}),childrenByIssueId:f.display}}}r(xl,"reconcileSection");function bl(t,l,c){const n=new Map(l.map(b=>[b.key,b])),d=Kt(t.sections,l.map(b=>b.key),c),f=new Map(t.sections.map(b=>[b.key,b])),x=new Map;for(const b of l)x.set(b.key,xl(d.retainedPinnedKeys.has(b.key)?f.get(b.key):void 0,b,c));const m=d.entries.flatMap(b=>{const g=x.get(b.key);if(g)return[{...g.pin,missingSince:b.missingSince}];const p=f.get(b.key);return p?[{...p,missingSince:b.missingSince}]:[]});return{sections:d.visibleKeys.flatMap(b=>{const g=n.get(b);return g?[x.get(b)?.display??g]:[]}),pin:{sections:m}}}r(bl,"reconcileInboxOrderPin");var Ic=Ur({FailedRunInboxRow:r(()=>Va,"FailedRunInboxRow"),Inbox:r(()=>Sl,"Inbox"),formatJoinRequestInboxLabel:r(()=>Ga,"formatJoinRequestInboxLabel")}),Ra=200,Me=500,Vs=3e4,gl="inbox",yl={allCategoryFilter:"everything",allApprovalFilter:"all",issueFilters:{...Mi},showDateGroupSeparators:!0};function Il(t){const l=t&&typeof t=="object"?t:{},c=l.allCategoryFilter,n=l.allApprovalFilter;return{allCategoryFilter:c==="issues_i_touched"||c==="join_requests"||c==="approvals"||c==="failed_runs"||c==="alerts"?c:"everything",allApprovalFilter:n==="actionable"||n==="resolved"?n:"all",issueFilters:{...Ai(l.issueFilters),workspaces:[]},showDateGroupSeparators:l.showDateGroupSeparators!==!1}}r(Il,"normalizeInboxCollectionViewState");function Dt(t){return{companyId:t??"__unscoped__",collectionKey:gl,legacyViewStorageKey:t?`${ro}:${t}`:void 0,legacyColumnsStorageKey:To}}r(Dt,"inboxCollectionPreferenceLocation");function Et(t){return _o({...Dt(t),defaultViewState:yl,defaultColumns:Js,normalizeViewState:Il,normalizeColumns:r(l=>Array.isArray(l)?Fa(l):Js,"normalizeColumns")})}r(Et,"loadInboxCollectionPreferences");var Ws=r(t=>t?t.type==="top"?`top:${t.itemKey}`:t.type==="child"?`child:${t.issueId}`:`group:${t.groupKey}`:null,"navEntryKey");function Ma(t){return t?t.split(`
1
+ var Pr=Object.defineProperty;var r=(t,l)=>Pr(t,"name",{value:l,configurable:!0});import{i as Ta,n as Ur}from"./rolldown-runtime-ZpX3ckPj.js";import{Oi as Gn,l as M,na as $r,ta as zr}from"./createLucideIcon-DJi9suAC.js";import{a as Gr,h as Vr}from"./star-BZgQbzhV.js";import{X as Wr,_ as he,n as Qr,t as R,v as W}from"./queryKeys-DYV5MhM_.js";import{o as Xr}from"./companies-query-D9PxIiMT.js";import{t as Hr}from"./issue-attribution-DfN_3u2W.js";import{n as Yr}from"./CompanyContext-CSrVsSze.js";import{Ct as Vn,G as Jr,Ht as Zr,Jt as Wn,Ut as Qn,Vt as Xn,Yt as Hn,an as qt,o as ei,t as Xs,tt as Yn,zt as ne}from"./router-2UfGeejU.js";import{t as si}from"./tabs-B2Os_leL.js";import{o as St,r as Nt,t as Ct}from"./popover-BhYHYj7q.js";import{t as ti}from"./archive-CTfe4zq5.js";import{t as ni}from"./arrow-up-down-Bpe9xqCo.js";import{t as _t}from"./check-Ctsrlfa-.js";import{t as ai}from"./chevron-right-s7L6hXXq.js";import{t as ri}from"./circle-x-CFlSbYzD.js";import{t as ii}from"./clock-CzrJT_cP.js";import{t as Jn}from"./inbox-C08arfF_.js";import{t as z}from"./button-CMwV3L1P.js";import{t as oi}from"./pause-CJSwJvLv.js";import{t as li}from"./plus-C6fnr28l.js";import{t as Zn}from"./rotate-ccw-CQEJ4ewP.js";import{t as ci}from"./search-04O7m-IF.js";import{t as ks}from"./triangle-alert-CBVKiaXB.js";import{t as ui}from"./user-Ccom_Ph0.js";import{t as Hs}from"./x-DRDFdlYE.js";import{r as di}from"./SidebarContext-CF3RWLxh.js";import{t as mi}from"./Identity-Cv_2a9qJ.js";import{a as pi}from"./ToastContext-DMdt9oTd.js";import{t as ea}from"./agents-DmlgUVso.js";import{t as sa}from"./heartbeats-DOyojsaN.js";import{t as hi}from"./instanceSettings-D8g_QlS-.js";import{n as bs,t as gs}from"./useSharedPolling-D4Xn8mY2.js";import{a as ta,d as fi,f as xi,i as bi,l as gi,m as yi,n as na,o as Ii,p as vi,r as aa,u as ra}from"./inboxArchiveCache-D8QGdg49.js";import{t as ki}from"./projects-mixWrT5q.js";import{a as wi,i as ji,n as Si,r as Ni,s as Ci,t as _i}from"./dialog-CKUblzlR.js";import{t as zs}from"./access-GAosX22P.js";import{d as Ai,n as Ri,r as Mi,t as Bt}from"./issue-filters-BO9xiK0c.js";import{r as ia}from"./assignees-DkQNbPzi.js";import{n as Ti}from"./BreadcrumbContext-BVZDZoC0.js";import{t as Fi}from"./AgentIdentity-I_kB4rMX.js";import{t as oa}from"./card-Bru3x_SJ.js";import{t as Ys}from"./StatusIcon-0GcYXDdN.js";import{A as la,Ai as ca,Bi as ua,Bt as Ei,Ci as Bi,D as Li,Di as vs,E as Di,Ei as qi,Fi as Oi,Gi as da,Gt as Ki,Hi as ma,Ii as Pi,Ji as Ui,Ki as $i,Kn as zi,Kr as Gi,Kt as Vi,L as Wi,Li as Qi,M as Xi,Mi as Hi,N as Yi,Ni as pa,O as ha,Oi as At,Pi as fa,Ri as Fa,S as xa,Si as Ji,T as ba,Ti as ga,Ui as ya,Ut as Zi,Vi as eo,Wi as so,Xi as to,Yi as no,Zi as Rt,_ as ao,_i as ro,a as io,ar as oo,b as Ot,bi as lo,c as Ia,ca as co,cr as uo,di as mo,gi as Js,ha as po,hi as ho,j as fo,ja as xo,ji as Mt,ki as bo,lr as go,mi as yo,o as Io,or as vo,pi as ko,pn as wo,pr as jo,q as So,qi as No,qn as Co,s as _o,sr as va,tr as Ao,ur as Ro,v as Mo,vi as To,w as Ea,wi as Fo,x as Ba,xi as Eo,yi as Tt,zi as Bo,zt as ka}from"./index-3AxqhPET.js";import{a as Lo,i as Do,n as La}from"./ApprovalPayload-C4F3ItGH.js";import{t as wa}from"./separator-B2LFqBpM.js";function qo(t,l){return l?t.responsibleUserId?t.responsibleUserId===l:l==="local-board":!1}r(qo,"isHeartbeatRunVisibleInMine");var o=Ta($r(),1),Oo={pending_board_decision:"needs_decision",pending_user_decision:"needs_decision",missing_successful_run_disposition:"needs_decision",blocked_chain_stalled:"stalled",blocked_by_unassigned_issue:"needs_attention",blocked_by_assigned_backlog_issue:"needs_attention",blocked_by_cancelled_issue:"needs_attention",in_review_without_action_path:"needs_attention",invalid_review_participant:"needs_attention",open_recovery_issue:"recovery_required",external_owner_action:"external_wait",blocked_by_uninvokable_assignee:"owner_paused"},Ko=["needs_decision","stalled","needs_attention","recovery_required","external_wait","owner_paused"],Da={needs_decision:"Needs decision",stalled:"Blocked chain stalled",needs_attention:"Needs attention",recovery_required:"Recovery required",external_wait:"External wait",owner_paused:"Owner paused"},Po={pending_board_decision:"Pending board decision",pending_user_decision:"Pending user decision",missing_successful_run_disposition:"Pick disposition",blocked_chain_stalled:"Blocked chain stalled",blocked_by_unassigned_issue:"Unassigned blocker",blocked_by_assigned_backlog_issue:"Parked blocker",blocked_by_cancelled_issue:"Cancelled blocker",in_review_without_action_path:"Review without action path",invalid_review_participant:"Invalid review participant",open_recovery_issue:"Recovery in progress",external_owner_action:"External owner action",blocked_by_uninvokable_assignee:"Owner paused"},Uo={critical:0,high:1,medium:2,low:3};function qa(t){return Oo[t]??"needs_attention"}r(qa,"blockedReasonVariant");function $o(t){return Po[t]??"Stopped"}r($o,"blockedReasonLabel");function zo(t){return Da[t]}r(zo,"blockedVariantLabel");function Zs(t){return Uo[t]??9}r(Zs,"blockedSeverityRank");function ja(t,l){const c=Zs(t.severity)-Zs(l.severity);if(c!==0)return c;const n=(t.stoppedSinceAt?new Date(t.stoppedSinceAt).getTime():Number.POSITIVE_INFINITY)-(l.stoppedSinceAt?new Date(l.stoppedSinceAt).getTime():Number.POSITIVE_INFINITY);return Number.isFinite(n)?n:0}r(ja,"compareBlockedAttention");var Go=[["blocker_type","Blocker type"],["none","None"]],Vo=[["urgency","Most urgent"],["most_recent","Most recent"],["longest_stopped","Longest stopped"]];function Wo(t){const l=[];for(const c of t){const n=c.blockedInboxAttention;n&&l.push({issue:c,attention:n,variant:qa(n.reason),reasonLabel:$o(n.reason),stoppedAtMs:n.stoppedSinceAt?new Date(n.stoppedSinceAt).getTime():null})}return l}r(Wo,"buildBlockedInboxRows");function Qo(t){if(!t)return null;const l=new Date(t).getTime();return Number.isFinite(l)?l:null}r(Qo,"issueTimestampMs");function Gs(t){return t.stoppedAtMs??Qo(t.issue.updatedAt)??0}r(Gs,"blockedRowRecencyMs");function Ft(t,l){const c=t.issue.title.localeCompare(l.issue.title);return c!==0?c:t.issue.id.localeCompare(l.issue.id)}r(Ft,"compareBlockedRowsByTitle");function Xo(t,l,c="urgency"){if(c==="most_recent"){const f=Gs(l)-Gs(t);if(f!==0)return f;const x=ja(t.attention,l.attention);return x!==0?x:Ft(t,l)}if(c==="longest_stopped"){const f=(t.stoppedAtMs??Number.POSITIVE_INFINITY)-(l.stoppedAtMs??Number.POSITIVE_INFINITY);if(f!==0)return f;const x=Zs(t.attention.severity)-Zs(l.attention.severity);return x!==0?x:Ft(t,l)}const n=ja(t.attention,l.attention);if(n!==0)return n;const d=Gs(l)-Gs(t);return d!==0?d:Ft(t,l)}r(Xo,"compareBlockedRows");function Oa(t,l="urgency"){return[...t].sort((c,n)=>Xo(c,n,l))}r(Oa,"sortBlockedInboxRows");function Ho(t,l="urgency"){const c=new Map;for(const d of t){const f=c.get(d.variant)??[];f.push(d),c.set(d.variant,f)}const n=[];for(const d of Ko){const f=c.get(d);if(!f||f.length===0)continue;const x=Oa(f,l);n.push({variant:d,label:Da[d],rows:x})}return n}r(Ho,"groupBlockedInboxRows");function Yo(t,l){const c=l.trim().toLowerCase();return c?[t.issue.title,t.issue.identifier??"",t.attention.owner.label??"",t.attention.action.label,t.attention.action.detail??"",t.reasonLabel,t.attention.leafIssue?.identifier??"",t.attention.leafIssue?.title??"",t.attention.recoveryIssue?.identifier??"",t.attention.recoveryIssue?.title??""].join(" ").toLowerCase().includes(c):!0}r(Yo,"blockedRowMatchesSearch");function Jo(t,l=Date.now()){if(!t)return"stopped";const c=new Date(t).getTime();if(!Number.isFinite(c))return"stopped";const n=Math.max(0,Math.round((l-c)/1e3));return n<60?"stopped just now":n<3600?`stopped ${Math.floor(n/60)}m`:n<86400?`stopped ${Math.floor(n/3600)}h`:n<604800?`stopped ${Math.floor(n/86400)}d`:n<2592e3?`stopped ${Math.floor(n/604800)}w`:`stopped ${Math.floor(n/2592e3)}mo`}r(Jo,"formatStoppedAge");function Sa(t){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.trunc(t))}r(Sa,"normalizeLiveDescendantCount");function Zo(t){if(!t||typeof t!="object")return null;const l=t;return typeof l.state=="string"?l:null}r(Zo,"asBlockerAttention");function Ka(t,l=0){return Math.max(Sa(t.liveDescendantCount),Sa(l))}r(Ka,"resolveIssueLiveDescendantCount");function Pa(t,l){const c=Zo(t.blockerAttention);if(t.status!=="blocked"||l.isLive||c?.state==="needs_attention"||c?.state==="stalled"||c?.state==="covered")return c;const n=Ka(t,l.loadedSubtreeLiveCount);return n<=0?c:{state:"covered",reason:"active_child",unresolvedBlockerCount:c?.unresolvedBlockerCount??0,coveredBlockerCount:n,stalledBlockerCount:c?.stalledBlockerCount??0,attentionBlockerCount:c?.attentionBlockerCount??0,sampleBlockerIdentifier:c?.sampleBlockerIdentifier??null,sampleStalledBlockerIdentifier:c?.sampleStalledBlockerIdentifier??null}}r(Pa,"resolveInboxIssueBlockerAttention");var s=Ta(zr(),1),el={needs_decision:"border-violet-300/70 bg-violet-50 text-violet-800 dark:border-violet-500/30 dark:bg-violet-500/10 dark:text-violet-300",recovery_required:"border-cyan-300/70 bg-cyan-50 text-cyan-800 dark:border-cyan-500/30 dark:bg-cyan-500/10 dark:text-cyan-300",stalled:"border-amber-400/70 bg-amber-100 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-200",needs_attention:"border-amber-300/70 bg-amber-50 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-300",external_wait:"border-slate-300 bg-slate-50 text-slate-700 dark:border-slate-500/30 dark:bg-slate-500/15 dark:text-slate-300",owner_paused:"border-red-300/70 bg-red-50 text-red-800 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"},sl={needs_decision:ii,recovery_required:Jr,stalled:ks,needs_attention:ks,external_wait:ui,owner_paused:oi},tl={critical:"bg-red-500",high:"bg-orange-500"};function Na({reason:t,severity:l,compact:c=!1,className:n}){const d=qa(t),f=zo(d),x=sl[d],m=tl[l];return(0,s.jsxs)("span",{"data-testid":"blocked-reason-chip","data-variant":d,"data-severity":l,"aria-label":`Reason: ${f}, severity ${l}`,className:M("inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-0.5 text-(length:--text-nano) font-medium leading-tight sm:text-(length:--text-micro)",el[d],n),children:[m?(0,s.jsx)("span",{"aria-hidden":"true",className:M("inline-block h-1.5 w-1.5 shrink-0 rounded-full",m)}):null,c?null:(0,s.jsx)(x,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),(0,s.jsx)("span",{className:"truncate",children:f})]})}r(Na,"BlockedReasonChip");var nl=200;function al({companyId:t,searchQuery:l,agentNameById:c,agents:n,userLabelById:d,issueLinkState:f,groupBy:x,sortBy:m,issueFilters:b,currentUserId:g,liveIssueIds:p,subtreeLiveCounts:C,workspaceFilterContext:_,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L="legacy"}){const[Q,Te]=(0,o.useState)(()=>new Set),{data:O=[],isLoading:Fe,isFetching:ae,error:fe,refetch:je}=W({queryKey:[...R.issues.listBlockedAttention(t),"live-descendant-summary"],queryFn:r(()=>ne.list(t,{attention:"blocked",includeBlockedInboxAttention:!0,includeBlockedBy:!0,includeLiveDescendantSummary:!0,limit:nl}),"queryFn")}),Se=(0,o.useMemo)(()=>Wo(O),[O]),Y=(0,o.useMemo)(()=>Se.filter(F=>Yo(F,l)),[Se,l]),xe=(0,o.useMemo)(()=>{const F=new Set(Bt(Y.map(S=>S.issue),b,g,!0,p,_).map(S=>S.id));return Y.filter(S=>F.has(S.issue.id))},[g,Y,b,p,_]),$e=(0,o.useMemo)(()=>Oa(xe,m),[xe,m]),be=(0,o.useMemo)(()=>Ho(xe,m),[xe,m]),re=r(F=>{Te(S=>{const K=new Set(S);return K.has(F)?K.delete(F):K.add(F),K})},"toggleVariant");if(Fe)return(0,s.jsx)("div",{"data-testid":"blocked-inbox-loading",className:"space-y-3","aria-busy":"true",children:Array.from({length:3}).map((F,S)=>(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-4 w-40 animate-pulse rounded bg-bg-3/70"}),Array.from({length:2}).map((K,ie)=>(0,s.jsxs)("div",{className:M("flex items-center gap-3 px-3 py-2.5 sm:px-4",L==="legacy"&&"border-b border-line/60"),children:[(0,s.jsx)("div",{className:"h-3.5 w-3.5 animate-pulse rounded-full bg-bg-3"}),(0,s.jsx)("div",{className:"h-4 w-16 animate-pulse rounded bg-bg-3/70"}),(0,s.jsx)("div",{className:"h-4 w-32 animate-pulse rounded-md bg-bg-3/70"}),(0,s.jsx)("div",{className:"h-4 flex-1 animate-pulse rounded bg-bg-3/60"}),(0,s.jsx)("div",{className:"hidden h-3 w-24 animate-pulse rounded bg-bg-3/60 sm:block"})]},ie))]},S))});if(fe){const F=fe instanceof Error?fe.message:"Couldn't load the Blocked tab.";return(0,s.jsx)("div",{"data-testid":"blocked-inbox-error",role:"alert",className:"flex flex-col gap-2 rounded-md border border-amber-300/70 bg-amber-50/90 p-4 text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(ks,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Couldn't load the Blocked tab."}),(0,s.jsxs)("p",{className:"text-xs opacity-80",children:["Other Inbox tabs still work. ",F]})]}),(0,s.jsx)(z,{type:"button",variant:"secondary",size:"sm",className:"h-7 shrink-0",onClick:r(()=>{je()},"onClick"),disabled:ae,children:ae?"Trying…":"Try again"})]})})}return Se.length===0?(0,s.jsxs)(oa,{"data-testid":"blocked-inbox-empty",className:"items-center gap-3 border-line/70 bg-bg-2/40 px-6 py-10 text-center",children:[(0,s.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",children:(0,s.jsx)(Gr,{className:"h-5 w-5","aria-hidden":"true"})}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-ink",children:"No work is stopped."}),(0,s.jsx)("p",{className:"text-xs text-ink-3",children:"Tasks that need a decision, recovery, or external action will appear here."})]})]}):be.length===0?(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)(oa,{"data-testid":"blocked-inbox-no-search-results",className:"block border-line/70 bg-bg-2/40 px-4 py-6 text-center text-sm text-ink-3",children:"No stopped items match your search."})}):(0,s.jsx)("div",{"data-testid":"blocked-inbox",className:"space-y-3",children:(0,s.jsx)("div",{className:"overflow-hidden rounded-xl",children:x==="none"?$e.map(F=>(0,s.jsx)(Ca,{row:F,issueLinkState:f,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:p,subtreeLiveCounts:C,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L},F.issue.id)):be.map(F=>{const S=Q.has(F.variant);return(0,s.jsxs)("div",{"data-testid":`blocked-inbox-group-${F.variant}`,children:[(0,s.jsx)("div",{className:L==="task"?"rounded-lg px-3 sm:pl-0 sm:pr-4":"px-3 sm:px-4",children:(0,s.jsx)(Ea,{label:`${F.label} · ${F.rows.length}`,collapsible:!0,collapsed:S,onToggle:r(()=>re(F.variant),"onToggle")})}),!S&&(0,s.jsx)("div",{children:F.rows.map(K=>(0,s.jsx)(Ca,{row:K,issueLinkState:f,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:p,subtreeLiveCounts:C,showStatusColumn:A,showIdentifierColumn:T,showUpdatedColumn:q,presentation:L},K.issue.id))})]},F.variant)})})})}r(al,"BlockedInboxView");function rl(t,l,c){const n=t.attention.owner;return n.label?{label:n.label,isAgent:n.type==="agent"}:n.agentId?{label:l.get(n.agentId)??null,isAgent:!0}:n.userId?{label:c?.get(n.userId)??null,isAgent:!1}:{label:null,isAgent:!1}}r(rl,"resolveOwnerName");function Ca({row:t,issueLinkState:l,agentNameById:c,agents:n,userLabelById:d,liveIssueIds:f,subtreeLiveCounts:x,showStatusColumn:m,showIdentifierColumn:b,showUpdatedColumn:g,presentation:p}){const{label:C,isAgent:_}=rl(t,c,d),A=Jo(t.attention.stoppedSinceAt),T=Pa(t.issue,{isLive:f.has(t.issue.id),loadedSubtreeLiveCount:x.get(t.issue.id)??0}),q=(0,s.jsxs)("span",{className:"flex shrink-0 items-center gap-3 text-xs",children:[(0,s.jsx)("span",{className:"hidden w-(--sz-10_5rem) shrink-0 justify-start sm:inline-flex","data-testid":"blocked-row-reason-column",children:(0,s.jsx)(Na,{reason:t.attention.reason,severity:t.attention.severity,className:"max-w-full"})}),C?(0,s.jsx)("span",{className:"hidden w-(--sz-150px) min-w-0 items-center text-ink-3 sm:inline-flex",children:_?(0,s.jsx)(Fi,{agent:n?.find(Q=>Q.id===t.attention.owner.agentId)??{id:t.attention.owner.agentId??void 0,name:C},size:"xs",className:"max-w-full"}):(0,s.jsx)(mi,{name:C,size:"xs",className:"max-w-full"})}):(0,s.jsx)("span",{className:"hidden w-(--sz-150px) shrink-0 sm:inline-flex","aria-hidden":"true"}),p==="legacy"&&g?(0,s.jsx)("span",{className:"hidden w-(--sz-5_75rem) text-right text-ink-3 sm:inline","data-testid":"blocked-row-age",children:A}):null]}),L=(0,s.jsxs)("span",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-ink-3",children:[p==="legacy"&&(0,s.jsx)("span",{"data-testid":"blocked-row-age-mobile",children:A}),C?(0,s.jsxs)(s.Fragment,{children:[p==="legacy"&&(0,s.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,s.jsx)("span",{className:M(_?"font-medium text-ink/90":null),"data-testid":"blocked-row-owner-mobile",children:C})]}):null]});return(0,s.jsx)(Ba,{issue:t.issue,issueLinkState:l,presentation:p,showDivider:p==="legacy",statusSlot:p==="task"?m?(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:T}):(0,s.jsx)("span",{className:"inline-flex size-4","aria-hidden":"true"}):void 0,showIdentifier:p==="task"?b:void 0,desktopMetaLeading:p==="legacy"?(0,s.jsx)(il,{row:t,blockerAttention:T,showStatusColumn:m,showIdentifierColumn:b}):void 0,mobileLeading:(0,s.jsx)("span",{className:"flex shrink-0 items-center gap-1.5 pt-px",children:(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:T})}),titleSuffix:(0,s.jsx)(Na,{reason:t.attention.reason,severity:t.attention.severity,className:"ml-2 max-w-(--sz-12rem) align-middle sm:hidden"}),mobileMeta:L,mobileTitleMeta:p==="task"?(0,s.jsx)("span",{"data-testid":"blocked-row-age-mobile",children:A}):void 0,desktopTrailing:q,trailingMeta:p==="task"&&g?A:null})}r(Ca,"BlockedInboxRow");function il({row:t,blockerAttention:l,showStatusColumn:c,showIdentifierColumn:n}){const d=t.issue.identifier??t.issue.id.slice(0,8);return(0,s.jsxs)("span",{className:"hidden shrink-0 items-center gap-2 sm:inline-flex",children:[c?(0,s.jsx)(Ys,{status:t.issue.status,blockerAttention:l}):null,n?(0,s.jsx)("span",{className:"font-mono text-xs text-ink-3",children:d}):null]})}r(il,"BlockedRowDesktopMeta");var ol=.32,ll=.88,cl=140;function ys({children:t,onArchive:l,disabled:c=!1,selected:n=!1,className:d}){const f=(0,o.useRef)(null),x=(0,o.useRef)(null),m=(0,o.useRef)(0),b=(0,o.useRef)(null),g=(0,o.useRef)(null),p=(0,o.useRef)(!1),C=(0,o.useRef)(0),[_,A]=(0,o.useState)(0),[T,q]=(0,o.useState)(!1),[L,Q]=(0,o.useState)(!1),[Te,O]=(0,o.useState)(null);(0,o.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current),g.current!==null&&window.clearTimeout(g.current),b.current=null,g.current=null,x.current=null,p.current=!1},[]);const Fe=r(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null)},"clearArchiveTimeout"),ae=r(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},"clearClickSuppressionTimeout"),fe=r(()=>{ae(),p.current=!1},"clearClickSuppression"),je=r(()=>{ae(),g.current=window.setTimeout(()=>{p.current=!1,g.current=null},350)},"releaseClickSuppressionSoon"),Se=r(()=>{x.current=null,C.current=0,q(!1),Q(!1),O(null),A(0)},"reset"),Y=r(()=>{Fe();const S=f.current;if(!S){l();return}x.current=null,q(!1),O(S.offsetHeight);const K=-Math.max(m.current,S.offsetWidth);C.current=K,A(K),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{Q(!0)})}),b.current=window.setTimeout(()=>{b.current=null,l()},cl)},"commitArchive"),xe=r(S=>{if(c||L||b.current!==null||S.touches.length!==1)return;Fe(),fe();const K=S.touches[0],ie=f.current;m.current=ie?.offsetWidth??0,O(ie?.offsetHeight??null),Q(!1),p.current=!1,x.current={x:K.clientX,y:K.clientY}},"handleTouchStart"),$e=r(S=>{if(c||L)return;const K=x.current;if(!K||S.touches.length!==1)return;const ie=S.touches[0],U=ie.clientX-K.x,Ne=ie.clientY-K.y;if(!T){if(Math.abs(U)<6)return;if(Math.abs(Ne)>Math.abs(U)){x.current=null;return}p.current=!0}if(U>=0){S.preventDefault(),q(!0),C.current=0,A(0);return}const $=m.current>0?m.current*ll:Number.POSITIVE_INFINITY;S.preventDefault(),q(!0);const ge=Math.max(U,-$);C.current=ge,A(ge)},"handleTouchMove"),be=r(()=>{if(!(c||L||b.current!==null)){if(m.current>0&&Math.abs(C.current)>=m.current*ol){je(),Y();return}T&&je(),Se()}},"handleTouchEnd"),re=r(()=>{c||L||b.current!==null||(fe(),Se())},"handleTouchCancel"),F=m.current>0?Math.min(Math.abs(_)/m.current,1):0;return(0,s.jsxs)("div",{ref:f,className:M("relative overflow-hidden touch-pan-y",d),style:{height:Te===null?void 0:L?0:Te,opacity:L?0:1,transition:L?"height 200ms ease, opacity 200ms ease":void 0},onTouchStart:xe,onTouchMove:$e,onTouchEnd:be,onTouchCancel:re,onClickCapture:r(S=>{p.current&&(S.preventDefault(),S.stopPropagation(),fe())},"onClickCapture"),children:[(0,s.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex items-center justify-end rounded-lg bg-emerald-600 px-4 text-white",style:{opacity:F},children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm font-medium",children:[(0,s.jsx)(ti,{className:"h-4 w-4"}),"Archive"]})}),(0,s.jsx)("div",{"data-inbox-row-surface":!0,className:M("relative will-change-transform",n?"rounded-lg bg-bg-3/50":"bg-bg"),style:{transform:`translate3d(${_}px, 0, 0)`,transition:T?"none":"transform 180ms ease-out"},children:t})]})}r(ys,"SwipeToArchive");var ul=15e4,dl=3e4;function _a(){return typeof document>"u"||document.visibilityState==="visible"}r(_a,"isDocumentVisible");function ml({viewIdentity:t,onCommit:l,idleCommitMs:c=ul,hiddenCommitMs:n=dl}){const d=(0,o.useRef)(l),f=(0,o.useRef)(null),x=(0,o.useRef)(null),m=(0,o.useRef)(!1),b=(0,o.useRef)(t);(0,o.useEffect)(()=>{d.current=l},[l]);const g=(0,o.useCallback)(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),p=(0,o.useCallback)(()=>{if(g(),!_a())return;const A=r(()=>{f.current=setTimeout(()=>{f.current=null,_a()&&(d.current("idle"),A())},c)},"armIdleTimer");A()},[g,c]),C=(0,o.useCallback)(()=>{p()},[p]),_=(0,o.useCallback)(()=>{d.current("manual-refresh"),p()},[p]);return(0,o.useEffect)(()=>(m.current?b.current!==t&&d.current("view-identity-change"):(m.current=!0,d.current("mount")),b.current=t,p(),g),[g,p,t]),(0,o.useEffect)(()=>{if(typeof document>"u")return;document.visibilityState!=="visible"&&(x.current=Date.now(),g());const A=r(()=>{if(document.visibilityState!=="visible"){x.current=Date.now(),g();return}const T=x.current;x.current=null,T!==null&&Date.now()-T>=n&&d.current("visibility"),p()},"handleVisibilityChange");return document.addEventListener("visibilitychange",A),()=>document.removeEventListener("visibilitychange",A)},[g,n,p]),{noteInteraction:C,commitManualRefresh:_}}r(ml,"useInboxSortAttention");function Lt(t){return t.kind==="issue"?t.issue.id:vs(t)}r(Lt,"inboxOrderRowKey");function Aa(t){return Array.from(t,l=>({key:l,missingSince:null}))}r(Aa,"captureKeys");function Ua(t){return{key:t.key,missingSince:null,rows:Aa(t.displayItems.map(Lt)),childrenByIssueId:new Map(Array.from(t.childrenByIssueId,([l,c])=>[l,Aa(c.map(n=>n.id))]))}}r(Ua,"captureSection");function pl(t){return{sections:t.map(Ua)}}r(pl,"captureInboxOrderPin");function hl(t,l,c){let n=0;for(let d=0;d<t.length;d+=1){if(n===c)return d;l.has(t[d].key)&&(n+=1)}return t.length}r(hl,"insertionIndexForVisiblePosition");function Kt(t,l,c){const n=new Set(l),d=t.flatMap(m=>{if(n.has(m.key))return m.missingSince===null||c-m.missingSince<5e3?[{key:m.key,missingSince:null}]:[];const b=m.missingSince??c;return c-b<5e3?[{key:m.key,missingSince:b}]:[]}),f=new Set(d.map(m=>m.key)),x=new Set(d.filter(m=>m.missingSince===null).map(m=>m.key));return l.forEach((m,b)=>{if(f.has(m))return;const g=hl(d,x,b);d.splice(g,0,{key:m,missingSince:null}),x.add(m)}),{entries:d,retainedPinnedKeys:f,visibleKeys:d.filter(m=>m.missingSince===null).map(m=>m.key)}}r(Kt,"reconcileKeys");function fl(t,l,c){const n=new Set([...t.keys(),...l.keys()]),d=new Map,f=new Map;for(const x of n){const m=l.get(x)??[],b=new Map(m.map(p=>[p.id,p])),g=Kt(t.get(x)??[],m.map(p=>p.id),c);g.entries.length>0&&d.set(x,g.entries),l.has(x)&&f.set(x,g.visibleKeys.flatMap(p=>{const C=b.get(p);return C?[C]:[]}))}return{pin:d,display:f}}r(fl,"reconcileChildren");function xl(t,l,c){if(!t)return{pin:Ua(l),display:l};const n=new Map(l.displayItems.map(x=>[Lt(x),x])),d=Kt(t.rows,l.displayItems.map(Lt),c),f=fl(t.childrenByIssueId,l.childrenByIssueId,c);return{pin:{key:l.key,missingSince:null,rows:d.entries,childrenByIssueId:f.pin},display:{...l,displayItems:d.visibleKeys.flatMap(x=>{const m=n.get(x);return m?[m]:[]}),childrenByIssueId:f.display}}}r(xl,"reconcileSection");function bl(t,l,c){const n=new Map(l.map(b=>[b.key,b])),d=Kt(t.sections,l.map(b=>b.key),c),f=new Map(t.sections.map(b=>[b.key,b])),x=new Map;for(const b of l)x.set(b.key,xl(d.retainedPinnedKeys.has(b.key)?f.get(b.key):void 0,b,c));const m=d.entries.flatMap(b=>{const g=x.get(b.key);if(g)return[{...g.pin,missingSince:b.missingSince}];const p=f.get(b.key);return p?[{...p,missingSince:b.missingSince}]:[]});return{sections:d.visibleKeys.flatMap(b=>{const g=n.get(b);return g?[x.get(b)?.display??g]:[]}),pin:{sections:m}}}r(bl,"reconcileInboxOrderPin");var Ic=Ur({FailedRunInboxRow:r(()=>Va,"FailedRunInboxRow"),Inbox:r(()=>Sl,"Inbox"),formatJoinRequestInboxLabel:r(()=>Ga,"formatJoinRequestInboxLabel")}),Ra=200,Me=500,Vs=3e4,gl="inbox",yl={allCategoryFilter:"everything",allApprovalFilter:"all",issueFilters:{...Mi},showDateGroupSeparators:!0};function Il(t){const l=t&&typeof t=="object"?t:{},c=l.allCategoryFilter,n=l.allApprovalFilter;return{allCategoryFilter:c==="issues_i_touched"||c==="join_requests"||c==="approvals"||c==="failed_runs"||c==="alerts"?c:"everything",allApprovalFilter:n==="actionable"||n==="resolved"?n:"all",issueFilters:{...Ai(l.issueFilters),workspaces:[]},showDateGroupSeparators:l.showDateGroupSeparators!==!1}}r(Il,"normalizeInboxCollectionViewState");function Dt(t){return{companyId:t??"__unscoped__",collectionKey:gl,legacyViewStorageKey:t?`${ro}:${t}`:void 0,legacyColumnsStorageKey:To}}r(Dt,"inboxCollectionPreferenceLocation");function Et(t){return _o({...Dt(t),defaultViewState:yl,defaultColumns:Js,normalizeViewState:Il,normalizeColumns:r(l=>Array.isArray(l)?Fa(l):Js,"normalizeColumns")})}r(Et,"loadInboxCollectionPreferences");var Ws=r(t=>t?t.type==="top"?`top:${t.itemKey}`:t.type==="child"?`child:${t.issueId}`:`group:${t.groupKey}`:null,"navEntryKey");function Ma(t){return t?t.split(`
2
2
  `).map(l=>l.trim()).find(Boolean)??null:null}r(Ma,"firstNonEmptyLine");function $a(t){return Ma(t.error)??Ma(t.stderrExcerpt)??"Run exited with an error."}r($a,"runFailureMessage");function vl(t){return t.replaceAll("_"," ")}r(vl,"approvalStatusLabel");function za(t){const l=t.contextSnapshot;if(!l)return null;const c=l.issueId;if(typeof c=="string"&&c.length>0)return c;const n=l.taskId;return typeof n=="string"&&n.length>0?n:null}r(za,"readIssueIdFromRun");function Qs(t){const l=t?.trim();return l||null}r(Qs,"nonEmptyLabel");function Ga(t){if(t.requestType!=="human")return`Agent join request${t.agentName?`: ${t.agentName}`:""}`;const l=Qs(t.requesterUser?.name),c=Qs(t.requesterUser?.email)??Qs(t.requestEmailSnapshot),n=Qs(t.requestingUserId);return l&&c?`${l} (${c})`:c||l||n||"Human join request"}r(Ga,"formatJoinRequestInboxLabel");function Is({selected:t,children:l}){return(0,s.jsx)("div",{className:M(t&&"rounded-lg bg-bg-3/50"),children:l})}r(Is,"InboxRowSurface");function Va({run:t,issueById:l,agentName:c,issueLinkState:n,onDismiss:d,onRetry:f,isRetrying:x,unreadState:m=null,onMarkRead:b,onArchive:g,archiveDisabled:p,selected:C=!1,className:_}){const A=za(t),T=A?l.get(A)??null:null,q=$a(t),L=m!==null,Q=m==="visible"||m==="fading";return(0,s.jsxs)("div",{className:M("group py-2.5 pl-4 pr-2 sm:py-2",_),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 sm:items-center",children:[L?(0,s.jsx)("span",{className:"hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center",children:Q?(0,s.jsx)("button",{type:"button",onClick:b,className:M("inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors","hover:bg-blue-500/20"),"aria-label":"Mark as read",children:(0,s.jsx)("span",{className:M("block h-2 w-2 rounded-full transition-opacity duration-300","bg-blue-600 dark:bg-blue-400",m==="fading"?"opacity-0":"opacity-100")})}):(0,s.jsx)("span",{className:"inline-flex h-4 w-4","aria-hidden":"true"})}):null,(0,s.jsxs)(Xs,{to:`/agents/${t.agentId}/runs/${t.id}`,className:M("flex min-w-0 flex-1 items-start gap-2 no-underline text-inherit transition-colors",C?"hover:bg-transparent":"hover:bg-bg-3/50"),children:[!L&&(0,s.jsx)("span",{className:"hidden h-2 w-2 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"hidden h-3.5 w-3.5 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"mt-0.5 shrink-0 rounded-md bg-red-500/20 p-1.5 sm:mt-0",children:(0,s.jsx)(ri,{className:"h-4 w-4 text-red-600 dark:text-red-400"})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none",children:T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-mono text-ink-3 mr-1.5",children:T.identifier??T.id.slice(0,8)}),T.title]}):(0,s.jsxs)(s.Fragment,{children:["Failed run",c?` — ${c}`:""]})}),(0,s.jsxs)("span",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-ink-3",children:[(0,s.jsx)(wo,{status:t.status}),c&&T?(0,s.jsx)("span",{children:c}):null,(0,s.jsx)("span",{className:"truncate max-w-(--sz-300px)",children:q}),(0,s.jsx)("span",{children:qt(t.createdAt)})]})]})]}),(0,s.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",children:[g?(0,s.jsx)(Ot,{onArchive:g,disabled:p}):null,(0,s.jsxs)(z,{type:"button",variant:"secondary",size:"sm",className:"h-8 shrink-0 px-2.5",onClick:f,disabled:x,children:[(0,s.jsx)(Zn,{className:"mr-1.5 h-3.5 w-3.5"}),x?"Retrying…":"Retry"]}),!L&&(0,s.jsx)("button",{type:"button",onClick:d,className:"rounded-md p-1 text-ink-3 opacity-0 transition-opacity hover:bg-bg-3 hover:text-ink group-hover:opacity-100","aria-label":"Dismiss",children:(0,s.jsx)(Hs,{className:"h-4 w-4"})})]})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2 sm:hidden",children:[(0,s.jsxs)(z,{type:"button",variant:"secondary",size:"sm",className:"h-8 shrink-0 px-2.5",onClick:f,disabled:x,children:[(0,s.jsx)(Zn,{className:"mr-1.5 h-3.5 w-3.5"}),x?"Retrying…":"Retry"]}),!L&&(0,s.jsx)("button",{type:"button",onClick:d,className:"rounded-md p-1 text-ink-3 hover:bg-bg-3 hover:text-ink","aria-label":"Dismiss",children:(0,s.jsx)(Hs,{className:"h-4 w-4"})})]})]})}r(Va,"FailedRunInboxRow");function kl({approval:t,requesterName:l,onApprove:c,onReject:n,isPending:d,unreadState:f=null,onMarkRead:x,onArchive:m,archiveDisabled:b,selected:g=!1,className:p}){const C=Lo[t.type]??Do,_=La(t.type,t.payload),A=t.type!=="budget_override_required"&&ho.has(t.status),T=f!==null,q=f==="visible"||f==="fading";return(0,s.jsxs)("div",{className:M("group py-2.5 pl-4 pr-2 sm:py-2",p),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 sm:items-center",children:[T?(0,s.jsx)("span",{className:"hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center",children:q?(0,s.jsx)("button",{type:"button",onClick:x,className:M("inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors","hover:bg-blue-500/20"),"aria-label":"Mark as read",children:(0,s.jsx)("span",{className:M("block h-2 w-2 rounded-full transition-opacity duration-300","bg-blue-600 dark:bg-blue-400",f==="fading"?"opacity-0":"opacity-100")})}):(0,s.jsx)("span",{className:"inline-flex h-4 w-4","aria-hidden":"true"})}):null,(0,s.jsxs)(Xs,{to:`/approvals/${t.id}`,className:M("flex min-w-0 flex-1 items-start gap-2 no-underline text-inherit transition-colors",g?"hover:bg-transparent":"hover:bg-bg-3/50"),children:[!T&&(0,s.jsx)("span",{className:"hidden h-2 w-2 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"hidden h-3.5 w-3.5 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"mt-0.5 shrink-0 rounded-md bg-bg-3 p-1.5 sm:mt-0",children:(0,s.jsx)(C,{className:"h-4 w-4 text-ink-3"})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none",children:_}),(0,s.jsxs)("span",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-ink-3",children:[(0,s.jsx)("span",{className:"capitalize",children:vl(t.status)}),l?(0,s.jsxs)("span",{children:["requested by ",l]}):null,(0,s.jsxs)("span",{children:["updated ",qt(t.updatedAt)]})]})]})]}),m||A?(0,s.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",children:[m?(0,s.jsx)(Ot,{onArchive:m,disabled:b}):null,A?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z,{size:"sm",className:"h-8 min-w-(--sz-64px) justify-center px-3",onClick:c,disabled:d,children:"Approve"}),(0,s.jsx)(z,{variant:"secondary",size:"sm",className:"h-8 min-w-(--sz-64px) justify-center px-3",onClick:n,disabled:d,children:"Reject"})]}):null]}):null]}),A?(0,s.jsxs)("div",{className:"mt-3 flex gap-2 sm:hidden",children:[(0,s.jsx)(z,{size:"sm",className:"h-8 min-w-(--sz-64px) justify-center px-3",onClick:c,disabled:d,children:"Approve"}),(0,s.jsx)(z,{variant:"secondary",size:"sm",className:"h-8 min-w-(--sz-64px) justify-center px-3",onClick:n,disabled:d,children:"Reject"})]}):null]})}r(kl,"ApprovalInboxRow");function wl({joinRequest:t,onApprove:l,onReject:c,isPending:n,unreadState:d=null,onMarkRead:f,onArchive:x,archiveDisabled:m,selected:b=!1,className:g}){const p=Ga(t),C=d!==null,_=d==="visible"||d==="fading";return(0,s.jsxs)("div",{className:M("group py-2.5 pl-4 pr-2 sm:py-2",g),children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 sm:items-center",children:[C?(0,s.jsx)("span",{className:"hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center",children:_?(0,s.jsx)("button",{type:"button",onClick:f,className:M("inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors","hover:bg-blue-500/20"),"aria-label":"Mark as read",children:(0,s.jsx)("span",{className:M("block h-2 w-2 rounded-full transition-opacity duration-300","bg-blue-600 dark:bg-blue-400",d==="fading"?"opacity-0":"opacity-100")})}):(0,s.jsx)("span",{className:"inline-flex h-4 w-4","aria-hidden":"true"})}):null,(0,s.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2",children:[!C&&(0,s.jsx)("span",{className:"hidden h-2 w-2 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"hidden h-3.5 w-3.5 shrink-0 sm:inline-flex","aria-hidden":"true"}),(0,s.jsx)("span",{className:"mt-0.5 shrink-0 rounded-md bg-bg-3 p-1.5 sm:mt-0",children:(0,s.jsx)(po,{className:"h-4 w-4 text-ink-3"})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,s.jsx)("span",{className:"line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none",children:p}),(0,s.jsxs)("span",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-ink-3",children:[(0,s.jsxs)("span",{children:["requested ",qt(t.createdAt)," from IP ",t.requestIp]}),t.adapterType&&(0,s.jsxs)("span",{children:["adapter: ",t.adapterType]})]})]})]}),(0,s.jsxs)("div",{className:"hidden shrink-0 items-center gap-2 sm:flex",children:[x?(0,s.jsx)(Ot,{onArchive:x,disabled:m}):null,(0,s.jsx)(z,{size:"sm",className:"h-8 px-3",onClick:l,disabled:n,children:"Approve"}),(0,s.jsx)(z,{variant:"secondary",size:"sm",className:"h-8 px-3",onClick:c,disabled:n,children:"Reject"})]})]}),(0,s.jsxs)("div",{className:"mt-3 flex gap-2 sm:hidden",children:[(0,s.jsx)(z,{size:"sm",className:"h-8 px-3",onClick:l,disabled:n,children:"Approve"}),(0,s.jsx)(z,{variant:"secondary",size:"sm",className:"h-8 px-3",onClick:c,disabled:n,children:"Reject"})]})]})}r(wl,"JoinRequestInboxRow");function jl({streamlined:t,context:l,search:c,controls:n,feedback:d,ariaLabel:f}){return t?(0,s.jsx)(Mo,{ariaLabel:f,context:l,search:c,controls:n,feedback:d}):(0,s.jsxs)("div",{role:"toolbar","aria-label":f,className:"space-y-2",children:[c?(0,s.jsx)("div",{className:"sm:hidden",children:c}):null,(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[l,(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[c?(0,s.jsx)("div",{className:"hidden sm:block",children:c}):null,n]})]}),d]})}r(jl,"InboxCollectionToolbar");function Sl(t={}){return(0,s.jsx)(Nl,{...t})}r(Sl,"Inbox");function Nl({tab:t,toolbarContext:l,surfaceLabel:c="Inbox"}){const{selectedCompanyId:n}=Yr(),{setBreadcrumbs:d}=Ti(),{openNewIssue:f}=co(),{isMobile:x}=di(),m=ei(),{pushToast:b}=pi(),g=Vr(),p=Wr(),[C,_]=(0,o.useState)(null),{data:A}=W({queryKey:R.instance.experimentalSettings,queryFn:r(()=>hi.getExperimental(),"queryFn"),retry:!1}),T=A!==void 0,[q,L]=(0,o.useState)(""),[Q,Te]=(0,o.useState)(()=>Et(n).viewState),[O,Fe]=(0,o.useState)(()=>Pi()),[ae,fe]=(0,o.useState)("none"),[je,Se]=(0,o.useState)("most_recent"),[Y,xe]=(0,o.useState)(()=>Et(n).columns),{dismissed:$e,dismiss:be}=mo(),{dismissedAtByKey:re,dismiss:F}=ko(n),{readItems:S,markRead:K,markUnread:ie}=yo(),{allCategoryFilter:U,allApprovalFilter:Ne,issueFilters:$}=Q,ge=g.pathname.split("/").pop()??"mine",I=t??(ge==="mine"||ge==="recent"||ge==="all"||ge==="unread"||ge==="blocked"?ge:"mine"),Z=Hi(I),ze=(0,o.useMemo)(()=>Zr(c,`${g.pathname}${g.search}${g.hash}`,"inbox"),[c,g.pathname,g.search,g.hash]),{data:Pt}=W({queryKey:R.auth.session,queryFn:r(()=>Xr.getSession(),"queryFn")}),{data:ee}=W({queryKey:R.agents.list(n),queryFn:r(()=>ea.list(n),"queryFn"),enabled:!!n}),{data:oe}=W({queryKey:R.projects.list(n,{includeArchived:!0}),queryFn:r(()=>ki.list(n,{includeArchived:!0}),"queryFn"),enabled:!!n}),{data:ws}=W({queryKey:R.issues.labels(n),queryFn:r(()=>ne.listLabels(n),"queryFn"),enabled:!!n}),le=A?.enableIsolatedWorkspaces===!0,js=A?.enableExternalObjects===!0,{data:Ut=[]}=W({queryKey:n?R.executionWorkspaces.summaryList(n):["execution-workspaces","__disabled__"],queryFn:r(()=>Ao.listSummaries(n),"queryFn"),enabled:!!n&&le});(0,o.useEffect)(()=>{d([{label:c}])},[d,c]),(0,o.useEffect)(()=>{$i(I),pe(-1),L("")},[I]);const $t=(0,o.useRef)(n);(0,o.useEffect)(()=>{if($t.current!==n){$t.current=n;const e=Et(n);Te(e.viewState),xe(e.columns),pt(pa(n)),dt(fa(n))}},[n]);const{data:zt,isLoading:Wa,error:Gt}=W({queryKey:R.approvals.list(n),queryFn:r(()=>Rt.list(n),"queryFn"),enabled:!!n}),{data:et=[],isLoading:Qa}=W({queryKey:R.access.joinRequests(n),queryFn:r(async()=>{try{return await zs.listJoinRequests(n,"pending_approval")}catch(e){if(e instanceof Qr&&(e.status===403||e.status===401))return[];throw e}},"queryFn"),enabled:!!n,retry:!1}),Vt=R.dashboard(n),Xa=bs({companyId:n,resourceKey:"dashboard",queryKey:Vt,enabled:!!n}),{data:ye,isLoading:Ha,dataUpdatedAt:Ya}=W({queryKey:Vt,queryFn:r(()=>to.summary(n),"queryFn"),enabled:!!n});gs(Xa,ye,Ya);const Wt=[...R.issues.list(n),"compact","with-routine-executions","live-descendant-summary",Me],Ja=bs({companyId:n,resourceKey:"inbox:issues",queryKey:Wt,enabled:!!n}),{data:es,isLoading:Za,dataUpdatedAt:er}=W({queryKey:Wt,queryFn:r(()=>ne.listCompact(n,{includeRoutineExecutions:!0,includeLiveDescendantSummary:!0,limit:Me}).then(e=>e),"queryFn"),enabled:!!n,refetchOnWindowFocus:!1,staleTime:Vs});gs(Ja,es,er);const{data:ss=[],isLoading:sr,dataUpdatedAt:tr}=W({queryKey:[...R.issues.listMineByMe(n),"compact","with-routine-executions","live-descendant-summary",Me],queryFn:r(()=>ne.listCompact(n,{touchedByUserId:"me",inboxArchivedByUserId:"me",status:Gn,includeRoutineExecutions:!0,includeLiveDescendantSummary:!0,limit:Me}).then(e=>e),"queryFn"),enabled:!!n,refetchOnWindowFocus:!1,staleTime:Vs}),nr=[...R.issues.listMineByMe(n),"compact","with-routine-executions","live-descendant-summary",Me],ar=bs({companyId:n,resourceKey:"inbox:mine-issues",queryKey:nr,enabled:!!n});gs(ar,ss,tr);const{data:ts=[],isLoading:rr,dataUpdatedAt:ir}=W({queryKey:[...R.issues.listTouchedByMe(n),"compact","with-routine-executions","live-descendant-summary",Me],queryFn:r(()=>ne.listCompact(n,{touchedByUserId:"me",status:Gn,includeRoutineExecutions:!0,includeLiveDescendantSummary:!0,limit:Me}).then(e=>e),"queryFn"),enabled:!!n,refetchOnWindowFocus:!1,staleTime:Vs}),or=[...R.issues.listTouchedByMe(n),"compact","with-routine-executions","live-descendant-summary",Me],lr=bs({companyId:n,resourceKey:"inbox:touched-issues",queryKey:or,enabled:!!n});gs(lr,ts,ir);const{data:Qt,isLoading:cr}=W({queryKey:[...R.heartbeats(n),"limit",Ra],queryFn:r(()=>sa.list(n,void 0,Ra,{summary:!0}),"queryFn"),enabled:!!n,refetchOnWindowFocus:!1,staleTime:Vs}),Xt=R.liveRuns(n),st=bs({companyId:n,resourceKey:"live-runs",queryKey:Xt,enabled:!!n,refetchInterval:!1,leaderOnly:!0}),{data:tt,dataUpdatedAt:ur}=W({queryKey:Xt,queryFn:r(()=>sa.liveRunsForCompany(n),"queryFn"),enabled:st.enabled,refetchInterval:st.refetchInterval});gs(st,tt,ur);const{data:Ss}=W({queryKey:R.access.companyUserDirectory(n),queryFn:r(()=>zs.listUserDirectory(n),"queryFn"),enabled:!!n}),E=Pt?.user.id??Pt?.session.userId??null,nt=(0,o.useMemo)(()=>({currentUserId:E,agents:ee,projects:oe,labels:ws}),[ee,E,ws,oe]),ns=(0,o.useMemo)(()=>Ro(q.trim(),nt),[nt,q]),Ee=ns.filters,Ge=oo(Ee),at=ns.query,Ht=(0,o.useMemo)(()=>jo(Ee),[Ee]),Ve=go(ns.query),Yt=(0,o.useMemo)(()=>uo(ns.query),[ns.query]),as=Ve.length>0||Ge,[Ce,rt]=(0,o.useState)(new Set),[Ns,Cs]=(0,o.useState)([]),[We,it]=(0,o.useState)(new Set),_s=yi(n),As=(0,o.useMemo)(()=>{const e=new Set(_s);for(const a of Ns)e.add(a);for(const a of Ce)e.add(a);for(const a of We)e.delete(a);return e},[Ce,_s,Ns,We]),Rs=(0,o.useMemo)(()=>zi(Ss?.users),[Ss?.users]),ot=(0,o.useMemo)(()=>Co(Ss?.users),[Ss?.users]),Qe=(0,o.useMemo)(()=>ca(ss).filter(e=>!As.has(e.id)),[As,ss]),Xe=(0,o.useMemo)(()=>ca(ts).filter(e=>!As.has(e.id)),[As,ts]),dr=!!n&&as,{data:He=[]}=W({queryKey:[...R.issues.search(n,at,void 0,25),Ht,"compact","inbox-supplement","live-descendant-summary"],queryFn:r(()=>ne.listCompact(n,{...Ht,...at.length>0?{q:at}:{},limit:25,includeRoutineExecutions:!0,includeLiveDescendantSummary:!0}).then(e=>e),"queryFn"),enabled:dr,placeholderData:r(e=>e,"placeholderData")}),ce=(0,o.useMemo)(()=>Xi(tt,[...es??[],...ss,...ts,...He]),[es,tt,ss,He,ts]),mr=(0,o.useMemo)(()=>{const e=new Set;for(const a of Qe)e.add(a.id);for(const a of Xe)e.add(a.id);for(const a of He)e.add(a.id);return[...e]},[Qe,He,Xe]),{summaries:Jt,isLoading:Zt,isReady:en}=So(n,mr),Ye=(0,o.useMemo)(()=>({externalObjectSummaryByIssueId:Jt,externalObjectSummariesReady:en&&!Zt}),[Zt,en,Jt]),rs=(0,o.useMemo)(()=>Bt(Qe,$,E,!0,ce,Ye),[Qe,$,E,ce,Ye]),Be=(0,o.useMemo)(()=>Bt(Xe,$,E,!0,ce,Ye),[Xe,$,E,ce,Ye]),lt=(0,o.useMemo)(()=>Be.filter(e=>e.isUnreadForMe),[Be]),sn=(0,o.useMemo)(()=>{const e=new Map,a=[...Qe,...Xe];E&&e.set(`user:${E}`,{id:`user:${E}`,label:E==="local-board"?"Board":"Me",kind:"user",searchText:E==="local-board"?"board me human local-board":`me board human ${E}`});for(const i of a)if(i.createdByUserId){const h=`user:${i.createdByUserId}`;e.has(h)||e.set(h,{id:h,label:ia(i.createdByUserId,E)??i.createdByUserId.slice(0,5),kind:"user",searchText:`${i.createdByUserId} board user human`})}const u=new Set;for(const i of ee??[]){u.add(i.id);const h=`agent:${i.id}`;e.has(h)||e.set(h,{id:h,label:i.name,kind:"agent",searchText:`${i.name} ${i.id} agent`})}for(const i of a)if(i.createdByAgentId&&!u.has(i.createdByAgentId)){const h=`agent:${i.createdByAgentId}`;e.has(h)||e.set(h,{id:h,label:i.createdByAgentId.slice(0,8),kind:"agent",searchText:`${i.createdByAgentId} agent`})}return[...e.values()].sort((i,h)=>i.kind!==h.kind?i.kind==="user"?-1:1:i.label.localeCompare(h.label))},[ee,E,Qe,Xe]),tn=(0,o.useMemo)(()=>I==="mine"?rs:I==="unread"?lt:Be,[I,rs,Be,lt]),Je=(0,o.useMemo)(()=>{const e=new Map;for(const a of ee??[])e.set(a.id,a.name);return e},[ee]),is=(0,o.useMemo)(()=>{const e=new Map;for(const a of es??[])e.set(a.id,a);return e},[es]),ct=(0,o.useMemo)(()=>{const e=new Map;for(const a of oe??[])e.set(a.id,{name:a.name,color:a.color});return e},[oe]),Ie=(0,o.useMemo)(()=>{const e=new Map;for(const a of oe??[])for(const u of a.workspaces??[])e.set(u.id,{name:u.name,projectId:a.id});return e},[oe]),Le=(0,o.useMemo)(()=>{const e=new Map;for(const a of oe??[]){const u=a.executionWorkspacePolicy?.defaultProjectWorkspaceId??a.primaryWorkspace?.id??null;u&&e.set(a.id,u)}return e},[oe]),De=(0,o.useMemo)(()=>{const e=new Map;for(const a of Ut){const u=a.projectWorkspaceId?Ie.get(a.projectWorkspaceId)??null:null;e.set(a.id,{name:a.name,mode:a.mode,projectWorkspaceId:a.projectWorkspaceId??null,projectId:u?.projectId??null})}return e},[Ut,Ie]),qe=(0,o.useMemo)(()=>({agentById:Je,executionWorkspaceById:De,projectWorkspaceById:Ie,defaultProjectWorkspaceIdByProjectId:Le,projectById:ct,userLabelById:Rs,currentUserId:E}),[Je,Rs,E,Le,De,ct,Ie]),ue=(0,o.useMemo)(()=>new Set(Y),[Y]),Ms=(0,o.useMemo)(()=>Fo(le),[le]),_e=(0,o.useMemo)(()=>new Set(Ms),[Ms]),nn=(0,o.useMemo)(()=>fo.filter(e=>ue.has(e)&&_e.has(e)),[_e,ue]),an=(0,o.useMemo)(()=>nn.filter(e=>e!=="updated"),[nn]),pr=ue.has("updated")&&_e.has("updated"),Ts=(0,o.useMemo)(()=>bo(Qt??[]).filter(e=>!Mt(re,`run:${e.id}`,e.createdAt)),[Qt,re]),rn=(0,o.useMemo)(()=>{let e=Ji(zt??[],I,Ne,E);return I==="mine"&&(e=e.filter(a=>!Mt(re,`approval:${a.id}`,a.updatedAt))),e},[zt,I,Ne,E,re]),on=U==="everything"||U==="join_requests",ln=U==="everything"||U==="issues_i_touched",Fs=U==="everything"||U==="approvals",cn=U==="everything"||U==="failed_runs",hr=U==="everything"||U==="alerts",un=(0,o.useMemo)(()=>I==="all"&&!cn?[]:I==="mine"?Ts.filter(e=>qo(e,E)):Ts,[Ts,I,cn,E]),dn=(0,o.useMemo)(()=>I==="all"&&!on?[]:I==="mine"?et.filter(e=>!Mt(re,`join:${e.id}`,e.updatedAt??e.createdAt)):et,[et,I,on,re]),ut=(0,o.useMemo)(()=>At({issues:I==="all"&&!ln?[]:tn,approvals:I==="all"&&!Fs?[]:rn,failedRuns:un,joinRequests:dn}),[rn,tn,Fs,ln,I,un,dn]),Es=(0,o.useMemo)(()=>{const e=Ve.toLowerCase();return!e&&!Ge?ut:ut.filter(a=>{if(a.kind==="issue")return va(a.issue,Ee)?vo(a.issue,Yt)?!0:Qi(a.issue,e,{isolatedWorkspacesEnabled:le,executionWorkspaceById:De,projectWorkspaceById:Ie,defaultProjectWorkspaceIdByProjectId:Le}):!1;if(Ge)return!1;if(a.kind==="approval"){const u=a.approval;return!!(La(u.type,u.payload).toLowerCase().includes(e)||u.type.toLowerCase().includes(e))}if(a.kind==="failed_run"){const u=a.run;if(Je.get(u.agentId)?.toLowerCase().includes(e)||$a(u).toLowerCase().includes(e))return!0;const i=za(u);if(i){const h=is.get(i);if(h?.title.toLowerCase().includes(e)||h?.identifier?.toLowerCase().includes(e))return!0}return!1}if(a.kind==="join_request"){const u=a.joinRequest;return!!(u.agentName?.toLowerCase().includes(e)||u.capabilities?.toLowerCase().includes(e))}return!1})},[ut,Je,Le,De,is,le,Yt,Ve,Ie,Ee,Ge]),Ze=(0,o.useMemo)(()=>I==="mine"?Bi({visibleIssues:rs,searchableIssues:Ge?Be.filter(e=>va(e,Ee)):Be,query:Ve,isolatedWorkspacesEnabled:le,executionWorkspaceById:De,projectWorkspaceById:Ie,defaultProjectWorkspaceIdByProjectId:Le}):[],[Le,De,le,Ve,Ie,Ee,Ge,I,rs,Be]),Bs=(0,o.useMemo)(()=>qi({query:as?q:"",filteredWorkItems:Es,archivedSearchIssues:Ze,remoteIssues:He,issueFilters:$,currentUserId:E,enableRoutineVisibilityFilter:!0,liveIssueIds:ce,issueFilterContext:Ye}),[Ze,E,Es,Ye,$,ce,He,as,q]),mn=(0,o.useMemo)(()=>new Set([...Ze.map(e=>e.id),...Bs.map(e=>e.id)]),[Ze,Bs]),[fr,xr]=(0,o.useState)(()=>Oi()),de=Bo(fr,x);(0,o.useEffect)(()=>{No(O,le,T)&&(Fe("none"),da("none"))},[T,O,le]);const br=(0,o.useCallback)(()=>{xr(e=>{const a=!e;return so(a),a})},[]),[Ls,dt]=(0,o.useState)(()=>fa(n)),[mt,pt]=(0,o.useState)(()=>pa(n)),gr=(0,o.useCallback)(e=>{pt(a=>{const u=new Set(a);return u.has(e)?u.delete(e):u.add(e),ma(n,u),u})},[n]),pn=(0,o.useCallback)((e,a)=>{pt(u=>{if(a?u.has(e):!u.has(e))return u;const i=new Set(u);return a?i.add(e):i.delete(e),ma(n,i),i})},[n]),Ds=(0,o.useMemo)(()=>[...Tt(Es,O,qe,{nestingEnabled:de}),...Tt(At({issues:Ze,approvals:[]}),O,qe,{keyPrefix:"archived-search:",searchSection:"archived",nestingEnabled:de}),...Tt(At({issues:Bs,approvals:[]}),O,qe,{keyPrefix:"other-search:",searchSection:"other",nestingEnabled:de})],[Ze,Es,O,qe,Bs,de]),ht=(0,o.useRef)({sections:[]}),[yr,Ir]=(0,o.useState)(0),qs=(0,o.useRef)(!1),vr=(0,o.useCallback)(()=>{qs.current=!0,Ir(e=>e+1)},[]),os=(0,o.useMemo)(()=>JSON.stringify([n,I,O,de,q,U,Ne,$]),[Ne,U,O,$,de,q,n,I]),hn=(0,o.useRef)(os);hn.current!==os&&(hn.current=os,qs.current=!0);const me=(0,o.useMemo)(()=>{const e=Date.now();if(qs.current)return qs.current=!1,ht.current=pl(Ds),Ds;const{sections:a,pin:u}=bl(ht.current,Ds,e);return ht.current=u,a},[Ds,os,yr]),ve=ml({viewIdentity:os,onCommit:vr}).noteInteraction,kr=(0,o.useCallback)(e=>{const a=lo(e.key,O,e.displayItems,qe);a&&f(a)},[O,qe,f]),wr=(0,o.useMemo)(()=>me.reduce((e,a)=>e+a.displayItems.length,0),[me]),jr=(0,o.useCallback)(e=>{dt(a=>{const u=new Set(a);return u.has(e)?u.delete(e):u.add(e),ya(n,u),u})},[n]),fn=(0,o.useCallback)((e,a)=>{dt(u=>{if(u.has(e)===a)return u;const i=new Set(u);return a?i.add(e):i.delete(e),ya(n,i),i})},[n]),V=(0,o.useMemo)(()=>Eo(me,mt,Ls),[mt,Ls,me]),xn=(0,o.useRef)(V);xn.current=V;const bn=(0,o.useMemo)(()=>{const e=[],a=new Set,u=r(i=>{a.has(i.id)||(a.add(i.id),e.push({id:i.id,parentId:i.parentId}))},"pushIssue");for(const i of me){for(const h of i.displayItems)h.kind==="issue"&&u(h.issue);for(const h of i.childrenByIssueId.values())for(const B of h)u(B)}return Yi(e,ce)},[me,ce]),Sr=(0,o.useMemo)(()=>{const e=new Map;return V.forEach((a,u)=>{a.type==="top"&&e.set(a.itemKey,u)}),e},[V]),Nr=(0,o.useMemo)(()=>{const e=new Map;return V.forEach((a,u)=>{a.type==="child"&&e.set(a.issueId,u)}),e},[V]),Cr=(0,o.useMemo)(()=>{const e=new Map;return V.forEach((a,u)=>{a.type==="group"&&e.set(a.groupKey,u)}),e},[V]),ls=r(e=>e?Je.get(e)??null:null,"agentName"),cs=(0,o.useCallback)(e=>{const a=Fa(e);xe(a),Ia(Dt(n),{viewState:Q,columns:a})},[Q,n]),gn=(0,o.useCallback)((e,a)=>{if(a){cs([...Y,e]);return}cs(Y.filter(u=>u!==e))},[cs,Y]),ke=(0,o.useCallback)(e=>{Te(a=>{const u=e(a);return Ia(Dt(n),{viewState:u,columns:Y}),u})},[n,Y]),Os=(0,o.useCallback)(e=>{ke(a=>({...a,issueFilters:{...a.issueFilters,...e}}))},[ke]);(0,o.useEffect)(()=>{!T||js||$.externalObjectStatuses.length===0||Os({externalObjectStatuses:[]})},[T,js,$.externalObjectStatuses.length,Os]);const _r=(0,o.useCallback)(e=>{ke(a=>({...a,allCategoryFilter:e}))},[ke]),Ar=(0,o.useCallback)(e=>{ke(a=>({...a,allApprovalFilter:e}))},[ke]),Rr=(0,o.useCallback)(e=>{Fe(e),da(e)},[]),yn=he({mutationFn:r(e=>Rt.approve(e),"mutationFn"),onSuccess:r((e,a)=>{_(null),p.invalidateQueries({queryKey:R.approvals.list(n)}),m(`/approvals/${a}?resolved=approved`)},"onSuccess"),onError:r(e=>{_(e instanceof Error?e.message:"Failed to approve")},"onError")}),In=he({mutationFn:r(e=>Rt.reject(e),"mutationFn"),onSuccess:r(()=>{_(null),p.invalidateQueries({queryKey:R.approvals.list(n)})},"onSuccess"),onError:r(e=>{_(e instanceof Error?e.message:"Failed to reject")},"onError")}),vn=he({mutationFn:r(e=>zs.approveJoinRequest(n,e.id),"mutationFn"),onSuccess:r(()=>{_(null),p.invalidateQueries({queryKey:R.access.joinRequests(n)}),p.invalidateQueries({queryKey:R.sidebarBadges(n)}),p.invalidateQueries({queryKey:R.agents.list(n)}),p.invalidateQueries({queryKey:R.companies.all})},"onSuccess"),onError:r(e=>{_(e instanceof Error?e.message:"Failed to approve join request")},"onError")}),kn=he({mutationFn:r(e=>zs.rejectJoinRequest(n,e.id),"mutationFn"),onSuccess:r(()=>{_(null),p.invalidateQueries({queryKey:R.access.joinRequests(n)}),p.invalidateQueries({queryKey:R.sidebarBadges(n)})},"onSuccess"),onError:r(e=>{_(e instanceof Error?e.message:"Failed to reject join request")},"onError")}),[Mr,wn]=(0,o.useState)(new Set),Tr=he({mutationFn:r(async e=>({newRun:await ea.retryFailedRun(e.agentId,e.id,e.companyId),originalRun:e}),"mutationFn"),onMutate:r(e=>{wn(a=>new Set(a).add(e.id))},"onMutate"),onSuccess:r(({newRun:e,originalRun:a})=>{p.invalidateQueries({queryKey:R.heartbeats(a.companyId)}),p.invalidateQueries({queryKey:R.heartbeats(a.companyId,a.agentId)}),e.runId?m(`/agents/${a.agentId}/runs/${e.runId}`):e.issueId&&m(`/issues/${e.issueId}`)},"onSuccess"),onError:r(e=>{b({title:"Run retry failed",body:e instanceof Error?e.message:"Unable to retry run",tone:"error"})},"onError"),onSettled:r((e,a,u)=>{u&&wn(i=>{const h=new Set(i);return h.delete(u.id),h})},"onSettled")}),[us,Ks]=(0,o.useState)(new Set),[Fr,Ps]=(0,o.useState)(!1),[Er,jn]=(0,o.useState)(new Set),[ds,Sn]=(0,o.useState)(new Set),[se,pe]=(0,o.useState)(-1),ft=(0,o.useRef)(null),Oe=(0,o.useRef)(!0);(0,o.useEffect)(()=>{const e=r(()=>{Oe.current=!0},"handlePointerMove");return window.addEventListener("mousemove",e,{passive:!0}),()=>window.removeEventListener("mousemove",e)},[]);const xt=(0,o.useRef)(null),bt=(0,o.useRef)(null),gt=(0,o.useCallback)(e=>{Oe.current&&(ve(),xt.current=e,bt.current=Ws(xn.current[e]),pe(a=>a<0?a:-1))},[ve]),Us=r(()=>{n&&ra(p,n)},"invalidateInboxIssueQueryCaches"),ms=he({mutationFn:r(e=>ne.archiveFromInbox(e),"mutationFn"),onMutate:r(async e=>{if(ve(),_(null),rt(u=>new Set(u).add(e)),!n)return{previousData:[]};na(n,e),await bi(p,n);const a=vi(p,n);return fi(p,n,e),{companyId:n,previousData:a}},"onMutate"),onError:r((e,a,u)=>{_(e instanceof Error?e.message:"Failed to archive task"),u?.companyId&&ta(u.companyId,a),rt(i=>{const h=new Set(i);return h.delete(a),h}),u?.previousData&&xi(p,u.previousData,a)},"onError"),onSettled:r(async(e,a,u,i)=>{rt(h=>{const B=new Set(h);return B.delete(u),B}),i?.companyId&&(a||aa(i.companyId,u),await ra(p,i.companyId),a||gi(p,i.companyId,u)!=="unknown"&&Ii(i.companyId,u))},"onSettled"),onSuccess:r((e,a)=>{Cs(u=>[...u.filter(i=>i!==a),a])},"onSuccess")}),Nn=he({mutationFn:r(e=>ne.unarchiveFromInbox(e),"mutationFn"),onMutate:r(e=>(_(null),it(a=>new Set(a).add(e)),n&&ta(n,e),{companyId:n}),"onMutate"),onError:r((e,a,u)=>{_(e instanceof Error?e.message:"Failed to undo inbox archive"),u?.companyId&&(na(u.companyId,a),aa(u.companyId,a))},"onError"),onSuccess:r((e,a)=>{Cs(u=>u.filter(i=>i!==a))},"onSuccess"),onSettled:r((e,a,u)=>{it(i=>{const h=new Set(i);return h.delete(u),h}),Us()},"onSettled")}),yt=he({mutationFn:r(e=>ne.markRead(e),"mutationFn"),onMutate:r(e=>{Ks(a=>new Set(a).add(e))},"onMutate"),onSuccess:r(()=>{Us()},"onSuccess"),onSettled:r((e,a,u)=>{setTimeout(()=>{Ks(i=>{const h=new Set(i);return h.delete(u),h})},300)},"onSettled")}),It=he({mutationFn:r(async e=>{await Promise.all(e.map(a=>ne.markRead(a)))},"mutationFn"),onMutate:r(e=>{Ks(a=>{const u=new Set(a);for(const i of e)u.add(i);return u})},"onMutate"),onSuccess:r(()=>{Us()},"onSuccess"),onSettled:r((e,a,u)=>{setTimeout(()=>{Ks(i=>{const h=new Set(i);for(const B of u)h.delete(B);return h})},300)},"onSettled")}),Cn=he({mutationFn:r(e=>ne.markUnread(e),"mutationFn"),onSuccess:r(()=>{Us()},"onSuccess")}),ps=(0,o.useCallback)(e=>{jn(a=>new Set(a).add(e)),K(e),setTimeout(()=>{jn(a=>{const u=new Set(a);return u.delete(e),u})},300)},[K]),Ae=(0,o.useCallback)(e=>{ve(),Sn(a=>new Set(a).add(e)),setTimeout(()=>{e.startsWith("alert:")?be(e):F(e),Sn(a=>{const u=new Set(a);return u.delete(e),u})},200)},[be,F,ve]),vt=r(e=>{if(!Z)return null;const a=S.has(e);return Er.has(e)?"fading":a?"hidden":"visible"},"nonIssueUnreadState"),_n=(0,o.useRef)(null);(0,o.useEffect)(()=>{const e=bt.current,a=e===null?-1:V.findIndex(u=>Ws(u)===e);xt.current=a>=0?a:null,a<0&&(bt.current=null),pe(u=>{if(u<0)return ua(u,V.length);const i=_n.current,h=i===null?-1:V.findIndex(B=>Ws(B)===i);return h>=0?h:ua(u,V.length)})},[V]),(0,o.useEffect)(()=>{_n.current=se>=0?Ws(V[se]):null},[V,se]),(0,o.useEffect)(()=>{Cs(e=>e.filter(a=>_s.has(a)||We.has(a)))},[_s,We]),(0,o.useEffect)(()=>{Cs([]),it(new Set)},[n]);const An=(0,o.useRef)({workItems:me,flatNavItems:V,selectedIndex:se,canArchive:Z,nonInboxSearchIssueIds:mn,archivingIssueIds:Ce,undoableArchiveIssueIds:Ns,unarchivingIssueIds:We,archivingNonIssueIds:ds,fadingOutIssues:us,readItems:S});An.current={workItems:me,flatNavItems:V,selectedIndex:se,canArchive:Z,nonInboxSearchIssueIds:mn,archivingIssueIds:Ce,undoableArchiveIssueIds:Ns,unarchivingIssueIds:We,archivingNonIssueIds:ds,fadingOutIssues:us,readItems:S};const Rn=(0,o.useRef)({archiveIssue:r(e=>ms.mutate(e),"archiveIssue"),undoArchiveIssue:r(e=>Nn.mutate(e),"undoArchiveIssue"),archiveNonIssue:Ae,markRead:r(e=>yt.mutate(e),"markRead"),markUnreadIssue:r(e=>Cn.mutate(e),"markUnreadIssue"),markNonIssueRead:ps,markNonIssueUnread:ie,setGroupCollapsed:pn,setInboxParentCollapsed:fn,navigate:m});if(Rn.current={archiveIssue:r(e=>ms.mutate(e),"archiveIssue"),undoArchiveIssue:r(e=>Nn.mutate(e),"undoArchiveIssue"),archiveNonIssue:Ae,markRead:r(e=>yt.mutate(e),"markRead"),markUnreadIssue:r(e=>Cn.mutate(e),"markUnreadIssue"),markNonIssueRead:ps,markNonIssueUnread:ie,setGroupCollapsed:pn,setInboxParentCollapsed:fn,navigate:m},(0,o.useEffect)(()=>{const e=r(a=>{if(a.defaultPrevented)return;const u=a.target;if(!(u instanceof HTMLElement)||Ei(u)||ka(document)||a.metaKey||a.ctrlKey||a.altKey)return;const i=An.current,h=Rn.current;if((i.canArchive?Zi({hasUndoableArchive:i.undoableArchiveIssueIds.length>0,defaultPrevented:a.defaultPrevented,key:a.key,metaKey:a.metaKey,ctrlKey:a.ctrlKey,altKey:a.altKey,target:u,hasOpenDialog:ka(document)}):"none")==="undo_archive"){const k=i.undoableArchiveIssueIds[i.undoableArchiveIssueIds.length-1];if(!k||i.unarchivingIssueIds.has(k))return;a.preventDefault(),h.undoArchiveIssue(k);return}const B=i.flatNavItems,X=B.length;if(X===0)return;ve();const P=r(k=>{const y=B[k];return y?y.type==="child"?{issue:y.issue}:y.type==="top"?{item:y.item}:{}:{}},"resolveNavEntry"),j=xt.current,te=j!=null&&j>=0&&j<X?j:-1,N=Oe.current&&te>=0?te:i.selectedIndex;switch(a.key){case"j":case"ArrowDown":a.preventDefault(),Oe.current=!1,pe(ga(N,X,"next"));break;case"k":case"ArrowUp":a.preventDefault(),Oe.current=!1,pe(ga(N,X,"previous"));break;case"ArrowLeft":case"ArrowRight":{if(N<0||N>=X)return;const k=B[N];if(!k)return;if(k.type==="group"){a.preventDefault(),Oe.current=!1,pe(N),h.setGroupCollapsed(k.groupKey,a.key==="ArrowLeft");break}const{issue:y,item:v}=P(N),D=y??(v?.kind==="issue"?v.issue:null);if(!D||!i.workItems.some(Re=>(Re.childrenByIssueId.get(D.id)?.length??0)>0))return;a.preventDefault(),Oe.current=!1,pe(N),h.setInboxParentCollapsed(D.id,a.key==="ArrowLeft");break}case"a":case"y":{if(!i.canArchive||N<0||N>=X)return;a.preventDefault();const{issue:k,item:y}=P(N);if(k)!i.nonInboxSearchIssueIds.has(k.id)&&!i.archivingIssueIds.has(k.id)&&h.archiveIssue(k.id);else if(y)if(y.kind==="issue")!i.nonInboxSearchIssueIds.has(y.issue.id)&&!i.archivingIssueIds.has(y.issue.id)&&h.archiveIssue(y.issue.id);else{const v=vs(y);i.archivingNonIssueIds.has(v)||h.archiveNonIssue(v)}break}case"U":{if(!i.canArchive||N<0||N>=X)return;a.preventDefault();const{issue:k,item:y}=P(N);k?h.markUnreadIssue(k.id):y&&(y.kind==="issue"?h.markUnreadIssue(y.issue.id):h.markNonIssueUnread(vs(y)));break}case"r":{if(!i.canArchive||N<0||N>=X)return;a.preventDefault();const{issue:k,item:y}=P(N);if(k)k.isUnreadForMe&&!i.fadingOutIssues.has(k.id)&&h.markRead(k.id);else if(y)if(y.kind==="issue")y.issue.isUnreadForMe&&!i.fadingOutIssues.has(y.issue.id)&&h.markRead(y.issue.id);else{const v=vs(y);i.readItems.has(v)||h.markNonIssueRead(v)}break}case"Enter":{if(N<0||N>=X)return;a.preventDefault();const{issue:k,item:y}=P(N);if(k){const v=k.identifier??k.id,D=Xn(Hn(ze,k));Wn(v,D),Vn(p,v,{issue:k}),h.navigate(Qn(v),{state:D})}else if(y)if(y.kind==="issue"){const v=y.issue.identifier??y.issue.id,D=Xn(Hn(ze,y.issue));Wn(v,D),Vn(p,v,{issue:y.issue}),h.navigate(Qn(v),{state:D})}else y.kind==="approval"?h.navigate(`/approvals/${y.approval.id}`):y.kind==="failed_run"&&h.navigate(`/agents/${y.run.agentId}/runs/${y.run.id}`);break}default:return}},"handleKeyDown");return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ze,ve]),(0,o.useEffect)(()=>{if(se<0||!ft.current)return;const e=ft.current.querySelectorAll("[data-inbox-item]")[se];e&&e.scrollIntoView({block:"nearest"})},[se]),!n)return(0,s.jsx)(ba,{icon:Jn,message:`Select an organization to view ${c.toLowerCase()}.`});const Br=Ts.length>0,Mn=Ui(I)&&hr,Tn=Mn&&!!ye&&ye.agents.error>0&&!Br&&!$e.has("alert:agent-errors"),Fn=Mn&&!!ye&&ye.costs.monthBudgetCents>0&&ye.costs.monthUtilizationPercent>=80&&!$e.has("alert:budget"),En=Tn||Fn,Bn=wr>0,Ln=no({tab:I,hasItems:En,showOnMine:!1,showOnRecent:!1,showOnUnread:!1,showOnAll:En}),kt=[Ln?"alerts":null,Bn?"work_items":null].filter(e=>e!==null),Dn=!Qa&&!Wa&&!Ha&&!Za&&!sr&&!rr&&!cr,qn=r(e=>kt.indexOf(e)>0,"showSeparatorBefore"),$s=(I==="mine"?rs:lt).filter(e=>e.isUnreadForMe&&!us.has(e.id)&&!Ce.has(e.id)).map(e=>e.id),Lr=$s.length>0,On=Ri($,!0),Dr=On+(I==="all"?+(U!=="everything")+Number(Fs&&Ne!=="all"):0),qr=I!=="blocked",Or=$.statuses.length===4&&["todo","in_progress","in_review","blocked"].every(e=>$.statuses.includes(e)),Kn=$.liveOnly?"Live runs only — tasks currently connected to an agent run.":Or?"Active statuses — open tasks, whether or not an agent is running.":null;return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsx)(jl,{streamlined:!0,ariaLabel:`${c} controls`,context:l??(0,s.jsx)(si,{value:I,onValueChange:r(e=>m(`/inbox/${e}`),"onValueChange"),children:(0,s.jsx)(Gi,{items:[{value:"mine",label:"Mine"},{value:"recent",label:"Recent"},{value:"unread",label:"Unread"},{value:"blocked",label:"Blocked"},{value:"all",label:"All"}]})}),search:(0,s.jsx)(Wi,{value:q,onChange:r(({raw:e})=>L(e),"onChange"),context:nt,placeholder:`Search ${c.toLowerCase()}…`,ariaLabel:`Search ${c.toLowerCase()}`,className:"ml-auto w-full sm:w-(--sz-220px)",inputClassName:"text-xs",pageSearchTarget:!0,onKeyDown:r(e=>{if(Ki({key:e.key,isComposing:e.nativeEvent.isComposing})){e.currentTarget.blur();return}Vi({key:e.key,isComposing:e.nativeEvent.isComposing,currentValue:e.currentTarget.value})&&e.currentTarget.blur()},"onKeyDown")}),controls:(0,s.jsx)(s.Fragment,{children:I==="blocked"?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(xa,{state:$,onChange:Os,activeFilterCount:On,agents:ee,creators:sn,projects:oe?.map(e=>({id:e.id,name:e.name})),labels:ws?.map(e=>({id:e.id,name:e.name,color:e.color})),currentUserId:E,enableExternalObjectFilters:js,enableRoutineVisibilityFilter:!0,buttonVariant:"secondary",iconOnly:!0,presentation:"streamlined"}),(0,s.jsxs)(Ct,{children:[(0,s.jsx)(St,{asChild:!0,children:(0,s.jsx)(z,{active:ae!=="none",type:"button",variant:"secondary",size:"icon",className:M("h-8 w-8 shrink-0"),title:"Group",children:(0,s.jsx)(Yn,{className:"h-3.5 w-3.5"})})}),(0,s.jsx)(Nt,{align:"end",className:"w-44 p-0",children:(0,s.jsx)("div",{className:"space-y-0.5 p-2",children:Go.map(([e,a])=>(0,s.jsxs)("button",{type:"button",className:M("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",ae===e?"bg-bg-3/50 text-ink":"text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>fe(e),"onClick"),children:[(0,s.jsx)("span",{children:a}),ae===e?(0,s.jsx)(_t,{className:"h-3.5 w-3.5"}):null]},e))})})]}),(0,s.jsx)(ha,{availableColumns:Ms,visibleColumnSet:ue,onToggleColumn:gn,showDateGroupSeparators:Q.showDateGroupSeparators,onToggleDateGroupSeparators:r(e=>{ke(a=>({...a,showDateGroupSeparators:e}))},"onToggleDateGroupSeparators"),onResetColumns:r(()=>cs(Js),"onResetColumns"),title:"Choose which columns stay visible",iconOnly:!0}),(0,s.jsxs)(Ct,{children:[(0,s.jsx)(St,{asChild:!0,children:(0,s.jsx)(z,{type:"button",variant:"secondary",size:"icon",className:"h-8 w-8 shrink-0",title:"Sort",children:(0,s.jsx)(ni,{className:"h-3.5 w-3.5"})})}),(0,s.jsx)(Nt,{align:"end",className:"w-48 p-0",children:(0,s.jsx)("div",{className:"space-y-0.5 p-2",children:Vo.map(([e,a])=>(0,s.jsxs)("button",{type:"button",className:M("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",je===e?"bg-bg-3/50 text-ink":"text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>Se(e),"onClick"),children:[(0,s.jsx)("span",{children:a}),je===e?(0,s.jsx)(_t,{className:"h-3.5 w-3.5"}):null]},e))})})]})]}):qr?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z,{active:de,type:"button",variant:"secondary",size:"icon",className:M("hidden h-8 w-8 shrink-0 sm:inline-flex"),onClick:br,title:de?"Disable parent-child nesting":"Enable parent-child nesting",children:(0,s.jsx)(xo,{className:"h-3.5 w-3.5"})}),(0,s.jsx)(xa,{state:$,onChange:Os,activeFilterCount:Dr,agents:ee,creators:sn,projects:oe?.map(e=>({id:e.id,name:e.name})),labels:ws?.map(e=>({id:e.id,name:e.name,color:e.color})),currentUserId:E,enableExternalObjectFilters:js,enableRoutineVisibilityFilter:!0,buttonVariant:"secondary",iconOnly:!0,presentation:"streamlined",inboxScopeFilters:I==="all"?{category:U,approvalStatus:Ne,showApprovalStatus:Fs,onCategoryChange:_r,onApprovalStatusChange:Ar,onClear:r(()=>{ke(e=>({...e,allCategoryFilter:"everything",allApprovalFilter:"all"}))},"onClear")}:void 0}),(0,s.jsxs)(Ct,{children:[(0,s.jsx)(St,{asChild:!0,children:(0,s.jsx)(z,{active:O!=="none",type:"button",variant:"secondary",size:"icon",className:M("h-8 w-8 shrink-0"),title:"Group",children:(0,s.jsx)(Yn,{className:"h-3.5 w-3.5"})})}),(0,s.jsx)(Nt,{align:"end",className:"w-40 p-2",children:(0,s.jsx)("div",{className:"space-y-0.5",children:[["none","None"],["type","Type"],["assignee","Responsible"],["project","Project"],...le?[["workspace","Workspace"]]:[]].map(([e,a])=>(0,s.jsxs)("button",{type:"button",className:M("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",O===e?"bg-bg-3/50 text-ink":"text-ink-3 hover:bg-bg-3/50"),onClick:r(()=>Rr(e),"onClick"),children:[(0,s.jsx)("span",{children:a}),O===e?(0,s.jsx)(_t,{className:"h-3.5 w-3.5"}):null]},e))})})]}),(0,s.jsx)(ha,{availableColumns:Ms,visibleColumnSet:ue,onToggleColumn:gn,showDateGroupSeparators:Q.showDateGroupSeparators,onToggleDateGroupSeparators:r(e=>{ke(a=>({...a,showDateGroupSeparators:e}))},"onToggleDateGroupSeparators"),onResetColumns:r(()=>cs(Js),"onResetColumns"),title:"Choose which columns stay visible",iconOnly:!0,rowPresentation:"task"}),Lr&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(z,{type:"button",variant:"secondary",size:"sm",className:"h-8 shrink-0",onClick:r(()=>Ps(!0),"onClick"),disabled:It.isPending,children:It.isPending?"Marking…":"Mark all as read"}),(0,s.jsx)(_i,{open:Fr,onOpenChange:Ps,children:(0,s.jsxs)(Si,{className:"sm:max-w-md",children:[(0,s.jsxs)(wi,{children:[(0,s.jsx)(Ci,{children:"Mark all as read?"}),(0,s.jsxs)(Ni,{children:["This will mark ",$s.length," unread ",$s.length===1?"item":"items"," as read."]})]}),(0,s.jsxs)(ji,{children:[(0,s.jsx)(z,{variant:"secondary",onClick:r(()=>Ps(!1),"onClick"),children:"Cancel"}),(0,s.jsx)(z,{onClick:r(()=>{Ps(!1),It.mutate($s)},"onClick"),children:"Mark all as read"})]})]})})]})]}):null}),feedback:Kn?(0,s.jsx)("p",{className:"text-xs text-ink-3","data-testid":"inbox-filter-scope-feedback",children:Kn}):null}),Gt&&(0,s.jsx)("p",{className:"text-sm text-bad",children:Gt.message}),C&&(0,s.jsx)("p",{className:"text-sm text-bad",children:C}),I==="blocked"?(0,s.jsx)("div",{className:"-mx-2 sm:mx-0",children:(0,s.jsx)(al,{companyId:n,searchQuery:Ve,agentNameById:Je,agents:ee,userLabelById:Rs,issueLinkState:ze,groupBy:ae,sortBy:je,issueFilters:$,currentUserId:E,liveIssueIds:ce,subtreeLiveCounts:bn,workspaceFilterContext:qe,showStatusColumn:ue.has("status")&&_e.has("status"),showIdentifierColumn:ue.has("id")&&_e.has("id"),showUpdatedColumn:ue.has("updated")&&_e.has("updated"),presentation:"task"})}):null,I!=="blocked"&&!Dn&&kt.length===0&&(0,s.jsx)(ao,{variant:"inbox"}),I!=="blocked"&&Dn&&kt.length===0&&(0,s.jsx)(ba,{icon:as?ci:Jn,message:as?"No inbox items match your search.":I==="mine"?"Inbox zero.":I==="unread"?"No new inbox items.":I==="recent"?"No recent inbox items.":"No inbox items match these filters."}),I!=="blocked"&&Bn&&(0,s.jsxs)(s.Fragment,{children:[qn("work_items")&&(0,s.jsx)(wa,{}),(0,s.jsx)("div",{children:(0,s.jsx)("div",{ref:ft,className:"-mx-2 overflow-hidden sm:mx-0",onPointerDownCapture:ve,onWheelCapture:ve,children:(()=>{const e=r(({issue:i,depth:h,selected:B,hasChildren:X=!1,isExpanded:P=!1,childCount:j=0,collapseParentId:te=null,allowArchive:N=Z})=>{const k=i.isUnreadForMe&&!us.has(i.id),y=us.has(i.id),v=Ce.has(i.id),D=i.projectId?ct.get(i.projectId)??null:null,Re=i.assigneeUserId?ot.get(i.assigneeUserId)??null:null,Ke=Hr(i),Pe=Ke?.kind==="user"?Ke.id:null,Ue=Ke?.kind==="user"?Ke.viaAgentId??null:null,hs=ce.has(i.id),fs=bn.get(i.id)??0,w=Ka(i,fs),G=Pa(i,{isLive:hs,loadedSubtreeLiveCount:fs}),H=!(ue.has("status")&&_e.has("status")&&i.status==="blocked"&&G?.state==="covered"),J=(0,s.jsx)(Ys,{status:i.status,externalConversationState:i.externalConversationState,blockerAttention:G,size:"md"});return(0,s.jsx)(Ba,{issue:i,presentation:"task",issueLinkState:ze,treeGuides:h,chevronInGuide:h>0&&X,selected:B,className:v?"pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out":"transition-all duration-200 ease-out",leadingControl:de&&X&&te?(0,s.jsx)("button",{type:"button","data-slot":"icon-button",className:"inline-flex h-4 w-4 shrink-0 items-center justify-center","aria-label":P?"Collapse sub-tasks":"Expand sub-tasks",onClick:r(we=>{we.preventDefault(),we.stopPropagation(),jr(te)},"onClick"),children:(0,s.jsx)(ai,{className:M("h-3.5 w-3.5 transition-transform",P&&"rotate-90")})}):(0,s.jsx)("span",{"data-slot":"task-row-disclosure-spacer",className:M("h-4 w-4 shrink-0",!de&&"hidden sm:block"),"aria-hidden":"true"}),statusSlot:J,metadata:(0,s.jsx)(Di,{issue:i,isLive:hs,subtreeLiveCount:w,showSubtreeLiveChip:H,showStatus:!1,showIdentifier:!1}),showIdentifier:ue.has("id")&&_e.has("id"),desktopMetaLeading:void 0,titleSuffix:X&&!P?(0,s.jsxs)("span",{className:"ml-1.5 text-xs text-ink-3",children:["(",j," sub-task",j!==1?"s":"",")"]}):void 0,mobileTitleMeta:la(i),mobileMeta:void 0,mobileLeading:void 0,unreadState:k?"visible":y?"fading":"hidden",onMarkRead:r(()=>yt.mutate(i.id),"onMarkRead"),onArchive:N?()=>ms.mutate(i.id):void 0,archiveDisabled:v,desktopTrailing:an.length>0?(0,s.jsx)(Li,{issue:i,columns:an,projectName:D?.name??null,projectColor:D?.color??null,workspaceName:eo(i,{executionWorkspaceById:De,projectWorkspaceById:Ie,defaultProjectWorkspaceIdByProjectId:Le}),assigneeName:ls(i.assigneeAgentId),assigneeAgent:ee?.find(we=>we.id===i.assigneeAgentId),creatorAgent:ee?.find(we=>we.id===i.createdByAgentId),assigneeUserName:ia(i.assigneeUserId,E,Rs)??Re?.label??null,assigneeUserAvatarUrl:Re?.image??null,creatorAgentName:ls(i.createdByAgentId),creatorUserName:Pe?ot.get(Pe)?.label??null:null,creatorUserAvatarUrl:Pe?ot.get(Pe)?.image??null:null,viaAgentName:Ue?ls(Ue):null,currentUserId:E,parentIdentifier:i.parentId?is.get(i.parentId)?.identifier??null:null,parentTitle:i.parentId?is.get(i.parentId)?.title??null:null}):void 0,trailingMeta:pr?la(i):null},`issue:${i.id}`)},"renderInboxIssue");let a=null,u=Number.POSITIVE_INFINITY;return me.flatMap((i,h)=>{const B=[],X=mt.has(i.key);if(i.searchSection!=="none"&&i.searchSection!==me[h-1]?.searchSection&&B.push((0,s.jsxs)("div",{className:"flex items-center gap-3 border-y border-line/70 bg-bg-3/30 px-4 py-2",children:[(0,s.jsx)("div",{className:"h-px flex-1 bg-line/80"}),(0,s.jsx)("span",{className:"shrink-0 text-(length:--text-micro) font-semibold uppercase tracking-wide text-ink-3",children:i.searchSection==="archived"?"Archived":"Other results"}),(0,s.jsx)("div",{className:"h-px flex-1 bg-line/80"})]},`${i.searchSection}-search-divider`)),i.label){const P=Cr.get(i.key)??-1,j=P>=0&&se===P,te=i.displayItems.some(N=>N.kind==="issue");B.push((0,s.jsx)("div",{"data-inbox-item":!0,className:M(h>0&&"pt-2"),onClick:r(()=>{P>=0&&pe(P)},"onClick"),onMouseEnter:r(()=>{P>=0&&gt(P)},"onMouseEnter"),children:(0,s.jsx)("div",{className:M("rounded-lg px-3 sm:pl-0 sm:pr-4",j?"bg-bg-3/50":"hover:bg-bg-3/50"),children:(0,s.jsx)(Ea,{label:i.label,collapsible:!0,collapsed:X,onToggle:r(()=>gr(i.key),"onToggle"),trailing:te?(0,s.jsx)(z,{variant:"ghost",size:"icon-xs",className:"-mr-2",title:`New task in ${i.label}`,"aria-label":`New task in ${i.label}`,onClick:r(N=>{N.stopPropagation(),kr(i)},"onClick"),children:(0,s.jsx)(li,{className:"h-3 w-3"})}):null})})},`group-${i.key}`))}if(X)return B;for(let P=0;P<i.displayItems.length;P+=1){const j=i.displayItems[P],te=Sr.get(`${i.key}:${vs(j)}`)??0,N=r((w,G,H)=>(0,s.jsx)("div",{"data-inbox-item":!0,className:"relative",onClick:r(()=>pe(te),"onClick"),onMouseEnter:r(()=>gt(te),"onMouseEnter"),children:H},`sel-${w}`),"wrapItem"),k=io(j.timestamp),y=Q.showDateGroupSeparators&&O==="none"?Io(a,k):null;a=k,u=j.timestamp>0?j.timestamp:u,y&&B.push((0,s.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1.5 sm:pl-0 sm:pr-4","data-testid":"inbox-date-group",role:"separator","aria-label":y,children:[(0,s.jsx)("span",{className:"h-px min-w-0 flex-1 bg-line/80","aria-hidden":"true","data-date-group-rule":""}),(0,s.jsx)("span",{className:"shrink-0 text-(length:--text-nano) font-medium uppercase tracking-wider text-ink-3/70","data-date-group-label":"",children:y}),(0,s.jsx)("span",{className:"h-px min-w-0 flex-1 bg-line/80","aria-hidden":"true","data-date-group-rule":""})]},`date-divider-${i.key}-${k}-${P}`));const v=se===te;if(j.kind==="approval"){const w=`approval:${j.approval.id}`,G=ds.has(w),H=(0,s.jsx)(kl,{approval:j.approval,selected:v,requesterName:ls(j.approval.requestedByAgentId),onApprove:r(()=>yn.mutate(j.approval.id),"onApprove"),onReject:r(()=>In.mutate(j.approval.id),"onReject"),isPending:yn.isPending||In.isPending,unreadState:vt(w),onMarkRead:r(()=>ps(w),"onMarkRead"),onArchive:Z?()=>Ae(w):void 0,archiveDisabled:G,className:G?"pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out":"transition-all duration-200 ease-out"},w);B.push(N(w,v,Z?(0,s.jsx)(ys,{selected:v,disabled:G,onArchive:r(()=>Ae(w),"onArchive"),children:H},w):(0,s.jsx)(Is,{selected:v,children:H})));continue}if(j.kind==="failed_run"){const w=`run:${j.run.id}`,G=ds.has(w),H=(0,s.jsx)(Va,{run:j.run,selected:v,issueById:is,agentName:ls(j.run.agentId),issueLinkState:ze,onDismiss:r(()=>F(w),"onDismiss"),onRetry:r(()=>Tr.mutate(j.run),"onRetry"),isRetrying:Mr.has(j.run.id),unreadState:vt(w),onMarkRead:r(()=>ps(w),"onMarkRead"),onArchive:Z?()=>Ae(w):void 0,archiveDisabled:G,className:G?"pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out":"transition-all duration-200 ease-out"},w);B.push(N(w,v,Z?(0,s.jsx)(ys,{selected:v,disabled:G,onArchive:r(()=>Ae(w),"onArchive"),children:H},w):(0,s.jsx)(Is,{selected:v,children:H})));continue}if(j.kind==="join_request"){const w=`join:${j.joinRequest.id}`,G=ds.has(w),H=(0,s.jsx)(wl,{joinRequest:j.joinRequest,selected:v,onApprove:r(()=>vn.mutate(j.joinRequest),"onApprove"),onReject:r(()=>kn.mutate(j.joinRequest),"onReject"),isPending:vn.isPending||kn.isPending,unreadState:vt(w),onMarkRead:r(()=>ps(w),"onMarkRead"),onArchive:Z?()=>Ae(w):void 0,archiveDisabled:G,className:G?"pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out":"transition-all duration-200 ease-out"},w);B.push(N(w,v,Z?(0,s.jsx)(ys,{selected:v,disabled:G,onArchive:r(()=>Ae(w),"onArchive"),children:H},w):(0,s.jsx)(Is,{selected:v,children:H})));continue}const D=j.issue,Re=i.childrenByIssueId.get(D.id)??[],Ke=Re.length>0,Pe=Ke&&!Ls.has(D.id),Ue=Z&&i.searchSection==="none",hs=r((w,G,H)=>w.flatMap(J=>{if(H.has(J.id))return[];const we=new Set(H);we.add(J.id);const xs=Nr.get(J.id)??-1,wt=se===xs,jt=i.childrenByIssueId.get(J.id)??[],Pn=jt.length>0,Un=Pn&&!Ls.has(J.id),$n=e({issue:J,depth:G,selected:wt,hasChildren:Pn,isExpanded:Un,childCount:jt.length,collapseParentId:J.id,allowArchive:Ue}),Kr=Ce.has(J.id),zn=(0,s.jsx)("div",{"data-inbox-item":!0,className:"relative",onClick:r(()=>{xs>=0&&pe(xs)},"onClick"),onMouseEnter:r(()=>{xs>=0&&gt(xs)},"onMouseEnter"),children:Ue?(0,s.jsx)(ys,{selected:wt,disabled:Kr,onArchive:r(()=>ms.mutate(J.id),"onArchive"),children:$n},`issue:${J.id}`):(0,s.jsx)(Is,{selected:wt,children:$n})},`sel-issue:${J.id}`);return Un?[zn,...hs(jt,G+1,we)]:[zn]}),"renderChildIssueRows"),fs=e({issue:D,depth:0,selected:v,hasChildren:Ke,isExpanded:Pe,childCount:Re.length,collapseParentId:D.id,allowArchive:Ue});B.push(N(`issue:${D.id}`,v,Ue?(0,s.jsx)(ys,{selected:v,disabled:Ce.has(D.id),onArchive:r(()=>ms.mutate(D.id),"onArchive"),children:fs},`issue:${D.id}`):(0,s.jsx)(Is,{selected:v,children:fs}))),Pe&&B.push(...hs(Re,1,new Set([D.id])))}return B})})()})})]}),Ln&&(0,s.jsxs)(s.Fragment,{children:[qn("alerts")&&(0,s.jsx)(wa,{}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-ink-3",children:"Alerts"}),(0,s.jsxs)("div",{className:"divide-y divide-line border border-line",children:[Tn&&(0,s.jsxs)("div",{className:"group/alert relative flex items-center gap-3 px-4 py-3 transition-colors hover:bg-bg-3/50",children:[(0,s.jsxs)(Xs,{to:"/agents",className:"flex flex-1 cursor-pointer items-center gap-3 no-underline text-inherit",children:[(0,s.jsx)(ks,{className:"h-4 w-4 shrink-0 text-red-600 dark:text-red-400"}),(0,s.jsxs)("span",{className:"text-sm",children:[(0,s.jsx)("span",{className:"font-medium",children:ye.agents.error})," ",ye.agents.error===1?"agent has":"agents have"," errors"]})]}),(0,s.jsx)("button",{type:"button",onClick:r(()=>be("alert:agent-errors"),"onClick"),className:"rounded-md p-1 text-ink-3 opacity-0 transition-opacity hover:bg-bg-3 hover:text-ink group-hover/alert:opacity-100","aria-label":"Dismiss",children:(0,s.jsx)(Hs,{className:"h-3.5 w-3.5"})})]}),Fn&&(0,s.jsxs)("div",{className:"group/alert relative flex items-center gap-3 px-4 py-3 transition-colors hover:bg-bg-3/50",children:[(0,s.jsxs)(Xs,{to:"/costs",className:"flex flex-1 cursor-pointer items-center gap-3 no-underline text-inherit",children:[(0,s.jsx)(ks,{className:"h-4 w-4 shrink-0 text-yellow-400"}),(0,s.jsxs)("span",{className:"text-sm",children:["Budget at"," ",(0,s.jsxs)("span",{className:"font-medium",children:[ye.costs.monthUtilizationPercent,"%"]})," ","utilization this month"]})]}),(0,s.jsx)("button",{type:"button",onClick:r(()=>be("alert:budget"),"onClick"),className:"rounded-md p-1 text-ink-3 opacity-0 transition-opacity hover:bg-bg-3 hover:text-ink group-hover/alert:opacity-100","aria-label":"Dismiss",children:(0,s.jsx)(Hs,{className:"h-3.5 w-3.5"})})]})]})]})]})]})}r(Nl,"StreamlinedInbox");export{Ic as n,Sl as t};
@@ -1 +1 @@
1
- var j=Object.defineProperty;var r=(n,t)=>j(n,"name",{value:t,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{Gt as b,Ht as k,Jt as N,Yt as u,na as _,ta as A}from"./createLucideIcon-DJi9suAC.js";import{t as y}from"./button-CMwV3L1P.js";import{t as E}from"./play-CJNuUj69.js";import{t as R}from"./rotate-ccw-CQEJ4ewP.js";import{t as x}from"./triangle-alert-CBVKiaXB.js";import{t as w}from"./badge-DuA2EgZC.js";import{n as S}from"./BreadcrumbContext-BVZDZoC0.js";import{in as T,rn as D}from"./index-B7mmhFG7.js";import{n as W,r as C,t as L}from"./useInstanceFeatureSettings-CEK6Xn3o.js";var O=f(_(),1),e=f(A(),1),F={developer:"Developer",runtime:"Runtime"},q=N("advanced");function B(n,t){return n?.enableWorktreeRunExecution!==!0?{kind:"off"}:n.worktreeRunExecutionActivatedAt?t?n.worktreeRunExecutionActivationInstanceId!==t?{kind:"fail_closed",reason:"instance_mismatch"}:{kind:"armed",activatedAt:n.worktreeRunExecutionActivatedAt}:{kind:"fail_closed",reason:"missing_instance_id"}:{kind:"fail_closed",reason:"missing_cutoff"}}r(B,"resolveWorktreeRunExecutionDisplayState");function G(n){const t=new Date(n);return Number.isNaN(t.getTime())?n:t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}r(G,"formatActivationTimestamp");function I({state:n}){return n.kind==="armed"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-sm",children:[(0,e.jsx)(E,{"aria-hidden":"true",className:"size-4 shrink-0 text-(--status-task-done)"}),(0,e.jsxs)("span",{children:["Running tasks created after ",(0,e.jsx)("span",{className:"font-medium",children:G(n.activatedAt)}),"."]})]}):n.kind==="fail_closed"?(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-line px-3 py-2 text-sm",children:[(0,e.jsx)(x,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"space-y-0.5",children:[(0,e.jsx)("p",{className:"font-medium",children:"Execution is suppressed, so it is effectively off."}),(0,e.jsxs)("p",{className:"text-ink-3",children:[n.reason==="instance_mismatch"?"This was turned on in a different instance and copied here, so no tasks run automatically.":"This is missing its activation cutoff, so no tasks run automatically."," ","Turn it off and on again to run tasks created here."]})]})]}):null}r(I,"WorktreeRunExecutionState");function X(){const{setBreadcrumbs:n}=S(),t=L();if((0,O.useEffect)(()=>{n([{label:"Settings",href:"/company/settings"},{label:"Advanced"}])},[n]),t.query.isLoading)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Loading advanced settings..."});if(t.query.error)return(0,e.jsx)("div",{className:"text-sm text-bad",children:t.query.error.message||"Failed to load advanced settings."});const p=T(),o=q.filter(s=>!t.isHidden(s)&&(s!=="enableWorktreeRunExecution"||p)),d=r(s=>b[s].selfHostedDefault,"defaultOf"),c=r(s=>t.isOn(s)!==d(s),"changed"),l=o.filter(c),h=r(()=>{t.save(Object.fromEntries(l.map(s=>[s,d(s)])))},"reset"),v=k.map(s=>({group:s,keys:o.filter(i=>u(i,"advanced")?.group===s)})).filter(({keys:s})=>s.length>0);return(0,e.jsxs)("div",{className:"max-w-4xl space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Advanced"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Tools for people who run or develop this instance."})]}),(0,e.jsxs)(y,{variant:"secondary",disabled:t.pending||l.length===0,onClick:h,children:[(0,e.jsx)(R,{"aria-hidden":"true"}),"Reset to defaults"]})]}),(0,e.jsxs)("div",{role:"note",className:"flex items-start gap-3 rounded-lg border border-line bg-bg-2 px-4 py-3 text-sm",children:[(0,e.jsx)(x,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-ink-3"}),(0,e.jsx)("p",{children:"These change how runs are executed or show internal data. Leave them alone unless you know why you need one."})]}),t.error?(0,e.jsx)("div",{role:"alert",className:"rounded-md border border-bad/40 px-3 py-2 text-sm text-bad",children:t.error}):null,v.map(({group:s,keys:i})=>(0,e.jsx)(W,{id:`advanced-group-${s}`,title:F[s],children:i.map(a=>{const m=u(a,"advanced");return(0,e.jsx)(C,{name:m.name,summary:m.summary,checked:t.isOn(a),disabled:t.pending,onCheckedChange:r(g=>t.save({[a]:g}),"onCheckedChange"),badges:(0,e.jsx)(e.Fragment,{children:c(a)?(0,e.jsx)(w,{variant:"outline",children:"changed"}):null}),children:a==="enableWorktreeRunExecution"?(0,e.jsx)(I,{state:B(t.settings,D())}):null},a)})},s))]})}r(X,"InstanceAdvanced");export{X as InstanceAdvanced};
1
+ var j=Object.defineProperty;var r=(n,t)=>j(n,"name",{value:t,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{Gt as b,Ht as k,Jt as N,Yt as u,na as _,ta as A}from"./createLucideIcon-DJi9suAC.js";import{t as y}from"./button-CMwV3L1P.js";import{t as E}from"./play-CJNuUj69.js";import{t as R}from"./rotate-ccw-CQEJ4ewP.js";import{t as x}from"./triangle-alert-CBVKiaXB.js";import{t as w}from"./badge-DuA2EgZC.js";import{n as S}from"./BreadcrumbContext-BVZDZoC0.js";import{in as T,rn as D}from"./index-3AxqhPET.js";import{n as W,r as C,t as L}from"./useInstanceFeatureSettings-CEK6Xn3o.js";var O=f(_(),1),e=f(A(),1),F={developer:"Developer",runtime:"Runtime"},q=N("advanced");function B(n,t){return n?.enableWorktreeRunExecution!==!0?{kind:"off"}:n.worktreeRunExecutionActivatedAt?t?n.worktreeRunExecutionActivationInstanceId!==t?{kind:"fail_closed",reason:"instance_mismatch"}:{kind:"armed",activatedAt:n.worktreeRunExecutionActivatedAt}:{kind:"fail_closed",reason:"missing_instance_id"}:{kind:"fail_closed",reason:"missing_cutoff"}}r(B,"resolveWorktreeRunExecutionDisplayState");function G(n){const t=new Date(n);return Number.isNaN(t.getTime())?n:t.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}r(G,"formatActivationTimestamp");function I({state:n}){return n.kind==="armed"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-sm",children:[(0,e.jsx)(E,{"aria-hidden":"true",className:"size-4 shrink-0 text-(--status-task-done)"}),(0,e.jsxs)("span",{children:["Running tasks created after ",(0,e.jsx)("span",{className:"font-medium",children:G(n.activatedAt)}),"."]})]}):n.kind==="fail_closed"?(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-line px-3 py-2 text-sm",children:[(0,e.jsx)(x,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"space-y-0.5",children:[(0,e.jsx)("p",{className:"font-medium",children:"Execution is suppressed, so it is effectively off."}),(0,e.jsxs)("p",{className:"text-ink-3",children:[n.reason==="instance_mismatch"?"This was turned on in a different instance and copied here, so no tasks run automatically.":"This is missing its activation cutoff, so no tasks run automatically."," ","Turn it off and on again to run tasks created here."]})]})]}):null}r(I,"WorktreeRunExecutionState");function X(){const{setBreadcrumbs:n}=S(),t=L();if((0,O.useEffect)(()=>{n([{label:"Settings",href:"/company/settings"},{label:"Advanced"}])},[n]),t.query.isLoading)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Loading advanced settings..."});if(t.query.error)return(0,e.jsx)("div",{className:"text-sm text-bad",children:t.query.error.message||"Failed to load advanced settings."});const p=T(),o=q.filter(s=>!t.isHidden(s)&&(s!=="enableWorktreeRunExecution"||p)),d=r(s=>b[s].selfHostedDefault,"defaultOf"),c=r(s=>t.isOn(s)!==d(s),"changed"),l=o.filter(c),h=r(()=>{t.save(Object.fromEntries(l.map(s=>[s,d(s)])))},"reset"),v=k.map(s=>({group:s,keys:o.filter(i=>u(i,"advanced")?.group===s)})).filter(({keys:s})=>s.length>0);return(0,e.jsxs)("div",{className:"max-w-4xl space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Advanced"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Tools for people who run or develop this instance."})]}),(0,e.jsxs)(y,{variant:"secondary",disabled:t.pending||l.length===0,onClick:h,children:[(0,e.jsx)(R,{"aria-hidden":"true"}),"Reset to defaults"]})]}),(0,e.jsxs)("div",{role:"note",className:"flex items-start gap-3 rounded-lg border border-line bg-bg-2 px-4 py-3 text-sm",children:[(0,e.jsx)(x,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-ink-3"}),(0,e.jsx)("p",{children:"These change how runs are executed or show internal data. Leave them alone unless you know why you need one."})]}),t.error?(0,e.jsx)("div",{role:"alert",className:"rounded-md border border-bad/40 px-3 py-2 text-sm text-bad",children:t.error}):null,v.map(({group:s,keys:i})=>(0,e.jsx)(W,{id:`advanced-group-${s}`,title:F[s],children:i.map(a=>{const m=u(a,"advanced");return(0,e.jsx)(C,{name:m.name,summary:m.summary,checked:t.isOn(a),disabled:t.pending,onCheckedChange:r(g=>t.save({[a]:g}),"onCheckedChange"),badges:(0,e.jsx)(e.Fragment,{children:c(a)?(0,e.jsx)(w,{variant:"outline",children:"changed"}):null}),children:a==="enableWorktreeRunExecution"?(0,e.jsx)(I,{state:B(t.settings,D())}):null},a)})},s))]})}r(X,"InstanceAdvanced");export{X as InstanceAdvanced};
@@ -1 +1 @@
1
- var ze=Object.defineProperty;var s=(a,i)=>ze(a,"name",{value:i,configurable:!0});import{i as de}from"./rolldown-runtime-ZpX3ckPj.js";import{m as we,na as Ae,ta as ke,xi as _e}from"./createLucideIcon-DJi9suAC.js";import{v as Se}from"./star-BZgQbzhV.js";import{X as Ce,_ as ae,t as g,v as O}from"./queryKeys-DYV5MhM_.js";import{a as Ie,n as qe,o as Q}from"./companies-query-D9PxIiMT.js";import{n as Ee}from"./CompanyContext-CSrVsSze.js";import{o as Te,t as ne}from"./router-2UfGeejU.js";import{t as S}from"./button-CMwV3L1P.js";import{t as U}from"./access-GAosX22P.js";import{t as Pe}from"./health-DF7yrggW.js";import{n as Re}from"./adapter-display-registry-Bk0KWAHT.js";import{Jr as Le}from"./index-B7mmhFG7.js";import{r as se,t as P}from"./invite-memory-CHGcQdLs.js";var l=de(Ae(),1),e=de(ke(),1),Fe=_e.filter(a=>a!=="wardmote_runner"),ie=new Set(["omp_local"]);function Me(a,i){let c=a;for(const r of i){if(!c||typeof c!="object")return null;c=c[r]}return typeof c=="string"&&c.trim().length>0?c:null}s(Me,"readNestedString");var N="w-full border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none focus:border-zinc-500",re="border border-zinc-800 bg-zinc-950/95 p-6",oe="flex-1 border px-3 py-2 text-sm transition-colors";function Be(a){return a?a.charAt(0).toUpperCase()+a.slice(1):null}s(Be,"formatHumanRole");function me(a){if(!a||typeof a!="object")return null;const i=a.code;return typeof i=="string"&&i.trim().length>0?i:null}s(me,"getAuthErrorCode");function We(a){if(!(a instanceof Error))return null;const i=a.message.trim();return i.length>0?i:null}s(We,"getAuthErrorMessage");function $e(a,i,c){const r=me(a),o=We(a),p=c.trim().length>0?c.trim():"that email";return r==="USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL"?{tone:"info",message:`An account already exists for ${p}. Sign in below to continue with this invite.`}:r==="INVALID_EMAIL_OR_PASSWORD"?{tone:"error",message:"That email and password did not match an existing Wardmote account. Check both fields, or create an account first if you are new here."}:i==="sign_in"&&o==="Request failed: 401"?{tone:"error",message:"That email and password did not match an existing Wardmote account. Check both fields, or create an account first if you are new here."}:i==="sign_up"&&o==="Request failed: 422"?{tone:"info",message:`An account may already exist for ${p}. Try signing in instead.`}:{tone:"error",message:o??"Authentication failed"}}s($e,"mapInviteAuthFeedback");function ce(a){return!!(a&&typeof a=="object"&&"bootstrapAccepted"in a)}s(ce,"isBootstrapAcceptancePayload");function Oe(a,i){return!a||typeof a!="object"||i?!1:a.status==="approved"}s(Oe,"isApprovedHumanJoinPayload");function K({companyDisplayName:a,companyLogoUrl:i,className:c}){return(0,e.jsx)(Le,{companyName:a,logoUrl:i,logoFit:"contain",className:c})}s(K,"InviteCompanyLogo");function le({companyDisplayName:a,companyLogoUrl:i,invitedByUserName:c,claimSecret:r=null,claimApiKeyPath:o=null,onboardingTextUrl:p=null}){return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6","data-testid":"invite-pending-approval",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(K,{companyDisplayName:a,companyLogoUrl:i,className:"h-12 w-12 border border-zinc-800 rounded-none"}),(0,e.jsxs)("h1",{className:"text-lg font-semibold",children:["Request to join ",a]})]}),(0,e.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,e.jsxs)("p",{className:"text-sm text-zinc-400",children:["Your request is still awaiting approval. ",c??"An organization admin"," must approve your request to join."]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("p",{className:"text-xs text-zinc-500 mb-1",children:"Approval page"}),(0,e.jsx)("p",{className:"text-sm text-zinc-200",children:"Settings → Members"})]}),(0,e.jsxs)("p",{className:"text-sm text-zinc-400",children:["Ask them to visit ",(0,e.jsx)("span",{className:"text-zinc-200",children:"Settings → Members"})," to approve your request."]}),(0,e.jsx)("p",{className:"text-xs text-zinc-500",children:"Refresh this page after you've been approved — you'll be redirected automatically."})]}),r&&o?(0,e.jsxs)("div",{className:"mt-4 space-y-1 border border-zinc-800 p-3 text-xs text-zinc-400",children:[(0,e.jsx)("div",{className:"text-zinc-200",children:"Claim secret"}),(0,e.jsx)("div",{className:"font-mono break-all",children:r}),(0,e.jsxs)("div",{className:"font-mono break-all",children:["POST ",o]})]}):null,p?(0,e.jsxs)("div",{className:"mt-4 text-xs text-zinc-400",children:["Onboarding: ",(0,e.jsx)("span",{className:"font-mono break-all",children:p})]}):null]})})}s(le,"AwaitingJoinApprovalPanel");function nt(){const a=Ce(),i=Te(),{setSelectedCompanyId:c}=Ee(),r=(Se().token??"").trim(),[o,p]=(0,l.useState)("sign_up"),[R,ue]=(0,l.useState)(""),[z,pe]=(0,l.useState)(""),[w,D]=(0,l.useState)(""),[L,xe]=(0,l.useState)(""),[J,he]=(0,l.useState)("omp_local"),[H,ge]=(0,l.useState)(""),[C,ve]=(0,l.useState)(null),[A,F]=(0,l.useState)(null),[x,v]=(0,l.useState)(null),[Y,X]=(0,l.useState)(!1),I="invite-auth-error",M=O({queryKey:g.health,queryFn:s(()=>Pe.get(),"queryFn"),retry:!1}),u=O({queryKey:g.auth.session,queryFn:s(()=>Q.getSession(),"queryFn"),retry:!1}),f=O({queryKey:g.access.invite(r),queryFn:s(()=>U.getInvite(r),"queryFn"),enabled:r.length>0,retry:!1}),q=Ie({enabled:!!u.data&&!!f.data?.companyId,staleTime:0}),E=M.data?.deploymentMode!=="local_trusted"?q.isFetchedAfterMount:!0,be=E?q.data?.companies??[]:[];(0,l.useEffect)(()=>{r&&se(r)},[r]),(0,l.useEffect)(()=>{X(!1)},[r]),(0,l.useEffect)(()=>{if(!E)return;const t=q.data?.companies;!t||!f.data?.companyId||t.some(h=>h.id===f.data.companyId)&&P(r)},[q.data,f.data,E,r]);const n=f.data,B=!!u.data&&!!n?.companyId&&!E,b=!!n?.companyId&&be.some(t=>t.id===n?.companyId),d=n?.companyName?.trim()||"this Wardmote company",T=n?.companyLogoUrl?.trim()||null,W=n?.invitedByUserName?.trim()||null,G=n?.inviteMessage?.trim()||null,ye=Be(n?.humanRole),j=n?.joinRequestStatus??null,V=n?.joinRequestType??null,$=V==="human"&&(j==="pending_approval"||j==="approved"),Z=M.data?.deploymentMode==="authenticated"&&!u.data&&n?.allowedJoinTypes!=="agent",y=n?.inviteType!=="bootstrap_ceo"&&n?.allowedJoinTypes==="agent",k=!!u.data&&!y&&n?.inviteType!=="bootstrap_ceo"&&(!j||$)&&!B&&!b&&!C&&A===null,fe=u.data?.user.name?.trim()||u.data?.user.email?.trim()||"this account",ee=z.trim().length>0&&w.trim().length>0&&(o==="sign_in"||R.trim().length>0&&w.trim().length>=8),m=ae({mutationFn:s(async()=>{if(!n)throw new Error("Invite not found");if(B)throw new Error("Checking your organization access. Try again in a moment.");if(b)throw new Error("This account already belongs to the organization.");return n.inviteType==="bootstrap_ceo"||n.allowedJoinTypes!=="agent"?U.acceptInvite(r,{requestType:"human"}):U.acceptInvite(r,{requestType:"agent",agentName:L.trim(),adapterType:J,capabilities:H.trim()||null})},"mutationFn"),onSuccess:s(async t=>{F(null),P(r);const h=ce(t);ve({kind:h?"bootstrap":"join",payload:t}),await a.invalidateQueries({queryKey:g.auth.session}),await a.invalidateQueries({queryKey:g.access.currentBoardAccess}),await a.invalidateQueries({queryKey:g.companies.all}),n?.companyId&&Oe(t,y)&&(c(n.companyId,{source:"manual"}),i("/",{replace:!0}))},"onSuccess"),onError:s(t=>{F(t instanceof Error?t.message:"Failed to accept invite")},"onError")});(0,l.useEffect)(()=>{!k||Y||m.isPending||(X(!0),F(null),m.mutate())},[m,Y,k]);const _=ae({mutationFn:s(async()=>{if(o==="sign_in"){await Q.signInEmail({email:z.trim(),password:w});return}await Q.signUpEmail({name:R.trim(),email:z.trim(),password:w})},"mutationFn"),onSuccess:s(async()=>{v(null),se(r),await a.invalidateQueries({queryKey:g.auth.session}),await a.invalidateQueries({queryKey:g.health}),await a.invalidateQueries({queryKey:g.access.currentBoardAccess});const{companies:t}=await qe(a);if(n?.companyId&&t.some(h=>h.id===n.companyId)){P(r),c(n.companyId,{source:"manual"}),i("/",{replace:!0});return}if(!(!n||n.inviteType!=="bootstrap_ceo"))try{ce(await m.mutateAsync())&&i("/",{replace:!0})}catch{return}},"onSuccess"),onError:s(t=>{const h=$e(t,o,z);me(t)==="USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL"&&(p("sign_in"),D("")),v(h)},"onError")}),te=(0,l.useMemo)(()=>n?b?"Open organization":n.inviteType==="bootstrap_ceo"?"Accept invite":y?"Submit request":u.data?"Accept invite":"Continue":"Continue",[n,b,u.data,y]);if(!r)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-bad",children:"Invalid invite token."});if(f.isLoading||M.isLoading||u.isLoading)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Loading invite..."});if(B)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Checking your access..."});if(f.error||!n)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsxs)("div",{className:"border border-line bg-bg-2 p-6","data-testid":"invite-error",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Invite not available"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"This invite may be expired, revoked, or already used."})]})});if(j==="approved"&&V==="human"&&b)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Opening organization..."});if(j==="pending_approval"&&!$)return(0,e.jsx)(le,{companyDisplayName:d,companyLogoUrl:T,invitedByUserName:W});if(j&&!$)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsxs)("div",{className:"border border-line bg-bg-2 p-6","data-testid":"invite-error",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Invite not available"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:j==="rejected"?"This join request was not approved.":"This invite has already been used."})]})});if(C?.kind==="bootstrap")return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Bootstrap complete"}),(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(S,{asChild:!0,className:"rounded-none",children:(0,e.jsx)(ne,{to:"/",children:"Open board"})})})]})});if(C?.kind==="join"){const t=C.payload,h=typeof t.claimSecret=="string"?t.claimSecret:null,je=typeof t.claimApiKeyPath=="string"?t.claimApiKeyPath:null,Ne=Me(t.onboarding,["textInstructions","url"]);return!y&&t.status==="approved"?(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(K,{companyDisplayName:d,companyLogoUrl:T,className:"h-12 w-12 border border-zinc-800 rounded-none"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"You joined the organization"})]}),(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(S,{asChild:!0,className:"w-full rounded-none",children:(0,e.jsx)(ne,{to:"/",children:"Open board"})})})]})}):(0,e.jsx)(le,{companyDisplayName:d,companyLogoUrl:T,invitedByUserName:W,claimSecret:h,claimApiKeyPath:je,onboardingTextUrl:Ne})}return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsx)("div",{className:"mx-auto max-w-5xl",children:(0,e.jsxs)("div",{className:"grid gap-6 lg:grid-cols-(--gtc-36)",children:[(0,e.jsxs)("section",{className:`${re} space-y-6`,children:[(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)(K,{companyDisplayName:d,companyLogoUrl:T,className:"h-16 w-16 rounded-none border border-zinc-800"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"You've been invited to join Wardmote"}),(0,e.jsx)("h1",{className:"mt-2 text-2xl font-semibold",children:n.inviteType==="bootstrap_ceo"?"Set up Wardmote":`Join ${d}`}),(0,e.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-zinc-300",children:y?"Review the invite details, then submit the agent information below to start the join request.":Z?"Create your Wardmote account first. If you already have one, switch to sign in and continue the invite with the same email.":"Your account is ready. Review the invite details, then accept it to continue."})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Organization"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:d})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Invited by"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:W??"Wardmote board"})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Requested access"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:y?"Agent join request":ye??"Organization access"})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Invite expires"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:we(n.expiresAt)})]})]}),G?(0,e.jsxs)("div",{className:"border border-amber-500/40 bg-amber-500/10 p-4",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-amber-200/80",children:"Message from inviter"}),(0,e.jsx)("p",{className:"mt-2 text-sm leading-6 text-amber-50",children:G})]}):null,u.data?(0,e.jsxs)("div",{className:"border border-emerald-500/40 bg-emerald-500/10 p-4 text-sm text-emerald-50",children:["Signed in as ",(0,e.jsx)("span",{className:"font-medium",children:fe}),"."]}):null]}),(0,e.jsx)("section",{className:`${re} h-fit`,children:y?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Submit agent details"}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-zinc-400",children:["This invite will create an approval request for a new agent in ",d,"."]})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Agent name"}),(0,e.jsx)("input",{className:N,value:L,onChange:s(t=>xe(t.target.value),"onChange")})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Adapter type"}),(0,e.jsx)("select",{className:N,value:J,onChange:s(t=>he(t.target.value),"onChange"),children:Fe.map(t=>(0,e.jsxs)("option",{value:t,disabled:!ie.has(t),children:[Re(t),ie.has(t)?"":" (Coming soon)"]},t))})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Capabilities"}),(0,e.jsx)("textarea",{className:N,rows:4,value:H,onChange:s(t=>ge(t.target.value),"onChange")})]}),A?(0,e.jsx)("p",{className:"text-xs text-red-400",children:A}):null,(0,e.jsx)(S,{className:"w-full rounded-none",disabled:m.isPending||L.trim().length===0,onClick:s(()=>m.mutate(),"onClick"),children:m.isPending?"Working...":te})]}):Z?(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:o==="sign_up"?"Create your account":"Sign in to continue"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:o==="sign_up"?`Start with a Wardmote account. After that, you'll come right back here to accept the invite for ${d}.`:"Use the Wardmote account that already matches this invite. If you do not have one yet, switch back to create account."})]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{type:"button",className:`${oe} ${o==="sign_up"?"border-zinc-100 bg-zinc-100 text-zinc-950":"border-zinc-800 text-zinc-300 hover:border-zinc-600"}`,onClick:s(()=>{v(null),p("sign_up")},"onClick"),children:"Create account"}),(0,e.jsx)("button",{type:"button",className:`${oe} ${o==="sign_in"?"border-zinc-100 bg-zinc-100 text-zinc-950":"border-zinc-800 text-zinc-300 hover:border-zinc-600"}`,onClick:s(()=>{v(null),p("sign_in")},"onClick"),children:"I already have an account"})]}),(0,e.jsxs)("form",{className:"space-y-4",method:"post",action:o==="sign_up"?"/api/auth/sign-up/email":"/api/auth/sign-in/email",onSubmit:s(t=>{if(t.preventDefault(),!_.isPending){if(!ee){v({tone:"error",message:"Please fill in all required fields."});return}_.mutate()}},"onSubmit"),"data-testid":"invite-inline-auth",children:[o==="sign_up"?(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-name",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Name"}),(0,e.jsx)("input",{id:"invite-name",name:"name",className:N,value:R,onChange:s(t=>{ue(t.target.value),v(null)},"onChange"),autoComplete:"name",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0,autoFocus:!0})]}):null,(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-email",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Email"}),(0,e.jsx)("input",{id:"invite-email",name:"email",type:"email",className:N,value:z,onChange:s(t=>{pe(t.target.value),v(null)},"onChange"),autoComplete:"username",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0,autoFocus:o==="sign_in"})]}),(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-password",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Password"}),(0,e.jsx)("input",{id:"invite-password",name:"password",type:"password",className:N,value:w,onChange:s(t=>{D(t.target.value),v(null)},"onChange"),autoComplete:o==="sign_in"?"current-password":"new-password",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0})]}),x?(0,e.jsx)("p",{id:I,role:"alert",className:`text-xs ${x.tone==="info"?"text-amber-300":"text-red-400"}`,children:x.message}):null,(0,e.jsx)(S,{type:"submit",className:"w-full rounded-none",disabled:_.isPending,"aria-disabled":!ee||_.isPending,children:_.isPending?"Working...":o==="sign_in"?"Sign in and continue":"Create account and continue"})]}),(0,e.jsx)("p",{className:"text-xs leading-5 text-zinc-500",children:o==="sign_up"?"Already signed up before? Use the existing-account option instead so the invite lands on the right Wardmote user.":"No account yet? Switch back to create account so you can accept the invite with a new login."})]}):(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:b?"Already in this organization":k?"Completing organization access":n.inviteType==="bootstrap_ceo"?"Accept bootstrap invite":"Accept organization invite"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:k?`Granting your access to ${d}.`:b?`This account already belongs to ${d}.`:`This will ${n.inviteType==="bootstrap_ceo"?"finish setting up Wardmote":`grant or complete your access to ${d}`}.`})]}),A?(0,e.jsx)("p",{className:"text-xs text-red-400",children:A}):null,k?(0,e.jsx)("div",{className:"text-sm text-zinc-400",children:m.isPending?"Submitting request...":"Finishing sign-in..."}):(0,e.jsx)(S,{className:"w-full rounded-none",disabled:m.isPending,onClick:s(()=>{if(b&&n.companyId){P(r),c(n.companyId,{source:"manual"}),i("/",{replace:!0});return}m.mutate()},"onClick"),children:m.isPending?"Working...":te})]})})]})})})}s(nt,"InviteLandingPage");export{nt as InviteLandingPage};
1
+ var ze=Object.defineProperty;var s=(a,i)=>ze(a,"name",{value:i,configurable:!0});import{i as de}from"./rolldown-runtime-ZpX3ckPj.js";import{m as we,na as Ae,ta as ke,xi as _e}from"./createLucideIcon-DJi9suAC.js";import{v as Se}from"./star-BZgQbzhV.js";import{X as Ce,_ as ae,t as g,v as O}from"./queryKeys-DYV5MhM_.js";import{a as Ie,n as qe,o as Q}from"./companies-query-D9PxIiMT.js";import{n as Ee}from"./CompanyContext-CSrVsSze.js";import{o as Te,t as ne}from"./router-2UfGeejU.js";import{t as S}from"./button-CMwV3L1P.js";import{t as U}from"./access-GAosX22P.js";import{t as Pe}from"./health-DF7yrggW.js";import{n as Re}from"./adapter-display-registry-Bk0KWAHT.js";import{Jr as Le}from"./index-3AxqhPET.js";import{r as se,t as P}from"./invite-memory-CHGcQdLs.js";var l=de(Ae(),1),e=de(ke(),1),Fe=_e.filter(a=>a!=="wardmote_runner"),ie=new Set(["omp_local"]);function Me(a,i){let c=a;for(const r of i){if(!c||typeof c!="object")return null;c=c[r]}return typeof c=="string"&&c.trim().length>0?c:null}s(Me,"readNestedString");var N="w-full border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none focus:border-zinc-500",re="border border-zinc-800 bg-zinc-950/95 p-6",oe="flex-1 border px-3 py-2 text-sm transition-colors";function Be(a){return a?a.charAt(0).toUpperCase()+a.slice(1):null}s(Be,"formatHumanRole");function me(a){if(!a||typeof a!="object")return null;const i=a.code;return typeof i=="string"&&i.trim().length>0?i:null}s(me,"getAuthErrorCode");function We(a){if(!(a instanceof Error))return null;const i=a.message.trim();return i.length>0?i:null}s(We,"getAuthErrorMessage");function $e(a,i,c){const r=me(a),o=We(a),p=c.trim().length>0?c.trim():"that email";return r==="USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL"?{tone:"info",message:`An account already exists for ${p}. Sign in below to continue with this invite.`}:r==="INVALID_EMAIL_OR_PASSWORD"?{tone:"error",message:"That email and password did not match an existing Wardmote account. Check both fields, or create an account first if you are new here."}:i==="sign_in"&&o==="Request failed: 401"?{tone:"error",message:"That email and password did not match an existing Wardmote account. Check both fields, or create an account first if you are new here."}:i==="sign_up"&&o==="Request failed: 422"?{tone:"info",message:`An account may already exist for ${p}. Try signing in instead.`}:{tone:"error",message:o??"Authentication failed"}}s($e,"mapInviteAuthFeedback");function ce(a){return!!(a&&typeof a=="object"&&"bootstrapAccepted"in a)}s(ce,"isBootstrapAcceptancePayload");function Oe(a,i){return!a||typeof a!="object"||i?!1:a.status==="approved"}s(Oe,"isApprovedHumanJoinPayload");function K({companyDisplayName:a,companyLogoUrl:i,className:c}){return(0,e.jsx)(Le,{companyName:a,logoUrl:i,logoFit:"contain",className:c})}s(K,"InviteCompanyLogo");function le({companyDisplayName:a,companyLogoUrl:i,invitedByUserName:c,claimSecret:r=null,claimApiKeyPath:o=null,onboardingTextUrl:p=null}){return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6","data-testid":"invite-pending-approval",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(K,{companyDisplayName:a,companyLogoUrl:i,className:"h-12 w-12 border border-zinc-800 rounded-none"}),(0,e.jsxs)("h1",{className:"text-lg font-semibold",children:["Request to join ",a]})]}),(0,e.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,e.jsxs)("p",{className:"text-sm text-zinc-400",children:["Your request is still awaiting approval. ",c??"An organization admin"," must approve your request to join."]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("p",{className:"text-xs text-zinc-500 mb-1",children:"Approval page"}),(0,e.jsx)("p",{className:"text-sm text-zinc-200",children:"Settings → Members"})]}),(0,e.jsxs)("p",{className:"text-sm text-zinc-400",children:["Ask them to visit ",(0,e.jsx)("span",{className:"text-zinc-200",children:"Settings → Members"})," to approve your request."]}),(0,e.jsx)("p",{className:"text-xs text-zinc-500",children:"Refresh this page after you've been approved — you'll be redirected automatically."})]}),r&&o?(0,e.jsxs)("div",{className:"mt-4 space-y-1 border border-zinc-800 p-3 text-xs text-zinc-400",children:[(0,e.jsx)("div",{className:"text-zinc-200",children:"Claim secret"}),(0,e.jsx)("div",{className:"font-mono break-all",children:r}),(0,e.jsxs)("div",{className:"font-mono break-all",children:["POST ",o]})]}):null,p?(0,e.jsxs)("div",{className:"mt-4 text-xs text-zinc-400",children:["Onboarding: ",(0,e.jsx)("span",{className:"font-mono break-all",children:p})]}):null]})})}s(le,"AwaitingJoinApprovalPanel");function nt(){const a=Ce(),i=Te(),{setSelectedCompanyId:c}=Ee(),r=(Se().token??"").trim(),[o,p]=(0,l.useState)("sign_up"),[R,ue]=(0,l.useState)(""),[z,pe]=(0,l.useState)(""),[w,D]=(0,l.useState)(""),[L,xe]=(0,l.useState)(""),[J,he]=(0,l.useState)("omp_local"),[H,ge]=(0,l.useState)(""),[C,ve]=(0,l.useState)(null),[A,F]=(0,l.useState)(null),[x,v]=(0,l.useState)(null),[Y,X]=(0,l.useState)(!1),I="invite-auth-error",M=O({queryKey:g.health,queryFn:s(()=>Pe.get(),"queryFn"),retry:!1}),u=O({queryKey:g.auth.session,queryFn:s(()=>Q.getSession(),"queryFn"),retry:!1}),f=O({queryKey:g.access.invite(r),queryFn:s(()=>U.getInvite(r),"queryFn"),enabled:r.length>0,retry:!1}),q=Ie({enabled:!!u.data&&!!f.data?.companyId,staleTime:0}),E=M.data?.deploymentMode!=="local_trusted"?q.isFetchedAfterMount:!0,be=E?q.data?.companies??[]:[];(0,l.useEffect)(()=>{r&&se(r)},[r]),(0,l.useEffect)(()=>{X(!1)},[r]),(0,l.useEffect)(()=>{if(!E)return;const t=q.data?.companies;!t||!f.data?.companyId||t.some(h=>h.id===f.data.companyId)&&P(r)},[q.data,f.data,E,r]);const n=f.data,B=!!u.data&&!!n?.companyId&&!E,b=!!n?.companyId&&be.some(t=>t.id===n?.companyId),d=n?.companyName?.trim()||"this Wardmote company",T=n?.companyLogoUrl?.trim()||null,W=n?.invitedByUserName?.trim()||null,G=n?.inviteMessage?.trim()||null,ye=Be(n?.humanRole),j=n?.joinRequestStatus??null,V=n?.joinRequestType??null,$=V==="human"&&(j==="pending_approval"||j==="approved"),Z=M.data?.deploymentMode==="authenticated"&&!u.data&&n?.allowedJoinTypes!=="agent",y=n?.inviteType!=="bootstrap_ceo"&&n?.allowedJoinTypes==="agent",k=!!u.data&&!y&&n?.inviteType!=="bootstrap_ceo"&&(!j||$)&&!B&&!b&&!C&&A===null,fe=u.data?.user.name?.trim()||u.data?.user.email?.trim()||"this account",ee=z.trim().length>0&&w.trim().length>0&&(o==="sign_in"||R.trim().length>0&&w.trim().length>=8),m=ae({mutationFn:s(async()=>{if(!n)throw new Error("Invite not found");if(B)throw new Error("Checking your organization access. Try again in a moment.");if(b)throw new Error("This account already belongs to the organization.");return n.inviteType==="bootstrap_ceo"||n.allowedJoinTypes!=="agent"?U.acceptInvite(r,{requestType:"human"}):U.acceptInvite(r,{requestType:"agent",agentName:L.trim(),adapterType:J,capabilities:H.trim()||null})},"mutationFn"),onSuccess:s(async t=>{F(null),P(r);const h=ce(t);ve({kind:h?"bootstrap":"join",payload:t}),await a.invalidateQueries({queryKey:g.auth.session}),await a.invalidateQueries({queryKey:g.access.currentBoardAccess}),await a.invalidateQueries({queryKey:g.companies.all}),n?.companyId&&Oe(t,y)&&(c(n.companyId,{source:"manual"}),i("/",{replace:!0}))},"onSuccess"),onError:s(t=>{F(t instanceof Error?t.message:"Failed to accept invite")},"onError")});(0,l.useEffect)(()=>{!k||Y||m.isPending||(X(!0),F(null),m.mutate())},[m,Y,k]);const _=ae({mutationFn:s(async()=>{if(o==="sign_in"){await Q.signInEmail({email:z.trim(),password:w});return}await Q.signUpEmail({name:R.trim(),email:z.trim(),password:w})},"mutationFn"),onSuccess:s(async()=>{v(null),se(r),await a.invalidateQueries({queryKey:g.auth.session}),await a.invalidateQueries({queryKey:g.health}),await a.invalidateQueries({queryKey:g.access.currentBoardAccess});const{companies:t}=await qe(a);if(n?.companyId&&t.some(h=>h.id===n.companyId)){P(r),c(n.companyId,{source:"manual"}),i("/",{replace:!0});return}if(!(!n||n.inviteType!=="bootstrap_ceo"))try{ce(await m.mutateAsync())&&i("/",{replace:!0})}catch{return}},"onSuccess"),onError:s(t=>{const h=$e(t,o,z);me(t)==="USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL"&&(p("sign_in"),D("")),v(h)},"onError")}),te=(0,l.useMemo)(()=>n?b?"Open organization":n.inviteType==="bootstrap_ceo"?"Accept invite":y?"Submit request":u.data?"Accept invite":"Continue":"Continue",[n,b,u.data,y]);if(!r)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-bad",children:"Invalid invite token."});if(f.isLoading||M.isLoading||u.isLoading)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Loading invite..."});if(B)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Checking your access..."});if(f.error||!n)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsxs)("div",{className:"border border-line bg-bg-2 p-6","data-testid":"invite-error",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Invite not available"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"This invite may be expired, revoked, or already used."})]})});if(j==="approved"&&V==="human"&&b)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-ink-3",children:"Opening organization..."});if(j==="pending_approval"&&!$)return(0,e.jsx)(le,{companyDisplayName:d,companyLogoUrl:T,invitedByUserName:W});if(j&&!$)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsxs)("div",{className:"border border-line bg-bg-2 p-6","data-testid":"invite-error",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Invite not available"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:j==="rejected"?"This join request was not approved.":"This invite has already been used."})]})});if(C?.kind==="bootstrap")return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Bootstrap complete"}),(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(S,{asChild:!0,className:"rounded-none",children:(0,e.jsx)(ne,{to:"/",children:"Open board"})})})]})});if(C?.kind==="join"){const t=C.payload,h=typeof t.claimSecret=="string"?t.claimSecret:null,je=typeof t.claimApiKeyPath=="string"?t.claimApiKeyPath:null,Ne=Me(t.onboarding,["textInstructions","url"]);return!y&&t.status==="approved"?(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsxs)("div",{className:"mx-auto max-w-md border border-zinc-800 bg-zinc-950 p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(K,{companyDisplayName:d,companyLogoUrl:T,className:"h-12 w-12 border border-zinc-800 rounded-none"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"You joined the organization"})]}),(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(S,{asChild:!0,className:"w-full rounded-none",children:(0,e.jsx)(ne,{to:"/",children:"Open board"})})})]})}):(0,e.jsx)(le,{companyDisplayName:d,companyLogoUrl:T,invitedByUserName:W,claimSecret:h,claimApiKeyPath:je,onboardingTextUrl:Ne})}return(0,e.jsx)("div",{className:"min-h-screen bg-zinc-950 px-6 py-12 text-zinc-100",children:(0,e.jsx)("div",{className:"mx-auto max-w-5xl",children:(0,e.jsxs)("div",{className:"grid gap-6 lg:grid-cols-(--gtc-36)",children:[(0,e.jsxs)("section",{className:`${re} space-y-6`,children:[(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)(K,{companyDisplayName:d,companyLogoUrl:T,className:"h-16 w-16 rounded-none border border-zinc-800"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"You've been invited to join Wardmote"}),(0,e.jsx)("h1",{className:"mt-2 text-2xl font-semibold",children:n.inviteType==="bootstrap_ceo"?"Set up Wardmote":`Join ${d}`}),(0,e.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-6 text-zinc-300",children:y?"Review the invite details, then submit the agent information below to start the join request.":Z?"Create your Wardmote account first. If you already have one, switch to sign in and continue the invite with the same email.":"Your account is ready. Review the invite details, then accept it to continue."})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Organization"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:d})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Invited by"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:W??"Wardmote board"})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Requested access"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:y?"Agent join request":ye??"Organization access"})]}),(0,e.jsxs)("div",{className:"border border-zinc-800 p-3",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-zinc-500",children:"Invite expires"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-zinc-100",children:we(n.expiresAt)})]})]}),G?(0,e.jsxs)("div",{className:"border border-amber-500/40 bg-amber-500/10 p-4",children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-caps) text-amber-200/80",children:"Message from inviter"}),(0,e.jsx)("p",{className:"mt-2 text-sm leading-6 text-amber-50",children:G})]}):null,u.data?(0,e.jsxs)("div",{className:"border border-emerald-500/40 bg-emerald-500/10 p-4 text-sm text-emerald-50",children:["Signed in as ",(0,e.jsx)("span",{className:"font-medium",children:fe}),"."]}):null]}),(0,e.jsx)("section",{className:`${re} h-fit`,children:y?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Submit agent details"}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-zinc-400",children:["This invite will create an approval request for a new agent in ",d,"."]})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Agent name"}),(0,e.jsx)("input",{className:N,value:L,onChange:s(t=>xe(t.target.value),"onChange")})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Adapter type"}),(0,e.jsx)("select",{className:N,value:J,onChange:s(t=>he(t.target.value),"onChange"),children:Fe.map(t=>(0,e.jsxs)("option",{value:t,disabled:!ie.has(t),children:[Re(t),ie.has(t)?"":" (Coming soon)"]},t))})]}),(0,e.jsxs)("label",{className:"block text-sm",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Capabilities"}),(0,e.jsx)("textarea",{className:N,rows:4,value:H,onChange:s(t=>ge(t.target.value),"onChange")})]}),A?(0,e.jsx)("p",{className:"text-xs text-red-400",children:A}):null,(0,e.jsx)(S,{className:"w-full rounded-none",disabled:m.isPending||L.trim().length===0,onClick:s(()=>m.mutate(),"onClick"),children:m.isPending?"Working...":te})]}):Z?(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:o==="sign_up"?"Create your account":"Sign in to continue"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:o==="sign_up"?`Start with a Wardmote account. After that, you'll come right back here to accept the invite for ${d}.`:"Use the Wardmote account that already matches this invite. If you do not have one yet, switch back to create account."})]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)("button",{type:"button",className:`${oe} ${o==="sign_up"?"border-zinc-100 bg-zinc-100 text-zinc-950":"border-zinc-800 text-zinc-300 hover:border-zinc-600"}`,onClick:s(()=>{v(null),p("sign_up")},"onClick"),children:"Create account"}),(0,e.jsx)("button",{type:"button",className:`${oe} ${o==="sign_in"?"border-zinc-100 bg-zinc-100 text-zinc-950":"border-zinc-800 text-zinc-300 hover:border-zinc-600"}`,onClick:s(()=>{v(null),p("sign_in")},"onClick"),children:"I already have an account"})]}),(0,e.jsxs)("form",{className:"space-y-4",method:"post",action:o==="sign_up"?"/api/auth/sign-up/email":"/api/auth/sign-in/email",onSubmit:s(t=>{if(t.preventDefault(),!_.isPending){if(!ee){v({tone:"error",message:"Please fill in all required fields."});return}_.mutate()}},"onSubmit"),"data-testid":"invite-inline-auth",children:[o==="sign_up"?(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-name",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Name"}),(0,e.jsx)("input",{id:"invite-name",name:"name",className:N,value:R,onChange:s(t=>{ue(t.target.value),v(null)},"onChange"),autoComplete:"name",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0,autoFocus:!0})]}):null,(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-email",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Email"}),(0,e.jsx)("input",{id:"invite-email",name:"email",type:"email",className:N,value:z,onChange:s(t=>{pe(t.target.value),v(null)},"onChange"),autoComplete:"username",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0,autoFocus:o==="sign_in"})]}),(0,e.jsxs)("label",{className:"block text-sm",htmlFor:"invite-password",children:[(0,e.jsx)("span",{className:"mb-1 block text-zinc-400",children:"Password"}),(0,e.jsx)("input",{id:"invite-password",name:"password",type:"password",className:N,value:w,onChange:s(t=>{D(t.target.value),v(null)},"onChange"),autoComplete:o==="sign_in"?"current-password":"new-password",required:!0,"aria-required":"true","aria-invalid":x?.tone==="error"?!0:void 0,"aria-describedby":x?I:void 0})]}),x?(0,e.jsx)("p",{id:I,role:"alert",className:`text-xs ${x.tone==="info"?"text-amber-300":"text-red-400"}`,children:x.message}):null,(0,e.jsx)(S,{type:"submit",className:"w-full rounded-none",disabled:_.isPending,"aria-disabled":!ee||_.isPending,children:_.isPending?"Working...":o==="sign_in"?"Sign in and continue":"Create account and continue"})]}),(0,e.jsx)("p",{className:"text-xs leading-5 text-zinc-500",children:o==="sign_up"?"Already signed up before? Use the existing-account option instead so the invite lands on the right Wardmote user.":"No account yet? Switch back to create account so you can accept the invite with a new login."})]}):(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:b?"Already in this organization":k?"Completing organization access":n.inviteType==="bootstrap_ceo"?"Accept bootstrap invite":"Accept organization invite"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-zinc-400",children:k?`Granting your access to ${d}.`:b?`This account already belongs to ${d}.`:`This will ${n.inviteType==="bootstrap_ceo"?"finish setting up Wardmote":`grant or complete your access to ${d}`}.`})]}),A?(0,e.jsx)("p",{className:"text-xs text-red-400",children:A}):null,k?(0,e.jsx)("div",{className:"text-sm text-zinc-400",children:m.isPending?"Submitting request...":"Finishing sign-in..."}):(0,e.jsx)(S,{className:"w-full rounded-none",disabled:m.isPending,onClick:s(()=>{if(b&&n.companyId){P(r),c(n.companyId,{source:"manual"}),i("/",{replace:!0});return}m.mutate()},"onClick"),children:m.isPending?"Working...":te})]})})]})})})}s(nt,"InviteLandingPage");export{nt as InviteLandingPage};
@@ -1,2 +1,2 @@
1
- var S=Object.defineProperty;var n=(t,r)=>S(t,"name",{value:r,configurable:!0});import{i as I}from"./rolldown-runtime-ZpX3ckPj.js";import{na as P,ta as L}from"./createLucideIcon-DJi9suAC.js";import{t as N}from"./badge-DuA2EgZC.js";import{o as x,r as b,s as v,t as w}from"./card-Bru3x_SJ.js";import{n as O}from"./IssueChatThread-ByTyrsxz.js";var o=I(P(),1);var E=new Date("2026-04-28T14:00:00.000Z").getTime();function i(t){return new Date(E+t*6e4)}n(i,"atMinute");function _(t,r,a,A){const l=new Date("2026-04-28T14:00:00.000Z");return{id:t,companyId:"company-long-thread",name:r,urlKey:A,role:"engineer",title:null,icon:a,status:"active",reportsTo:null,capabilities:null,adapterType:"omp_local",adapterConfig:{},runtimeConfig:{},budgetMonthlyCents:0,spentMonthlyCents:0,lastHeartbeatAt:null,metadata:null,createdAt:l,updatedAt:l,pauseReason:null,pausedAt:null,permissions:{canCreateAgents:!1}}}n(_,"createAgent");var m=_("agent-perf-codex","CodexCoder","code","codexcoder"),h=_("agent-perf-reviewer","ReviewBot","sparkles","reviewbot"),$=new Map([[m.id,m],[h.id,h]]);function B(t){return[`## Baseline note ${t}`,"",`This assistant update captures a deterministic markdown-heavy row for long-thread rendering. It references [PAP-${2600+t}](/PAP/issues/PAP-${2600+t}) and includes enough structure to exercise markdown parsing.`,"","- Parsed checklist item one with inline `code`","- Parsed checklist item two with **bold** and _italic_ text","- Parsed checklist item three with a link to [Wardmote](/PAP/dashboard)","","| Metric | Value |","| --- | ---: |",`| Fixture row | ${t} |`,`| Synthetic tokens | ${1200+t} |`,"","```ts",`const fixtureRow${t} = { markdown: true, deterministic: true };`,"```"].join(`
1
+ var S=Object.defineProperty;var n=(t,r)=>S(t,"name",{value:r,configurable:!0});import{i as I}from"./rolldown-runtime-ZpX3ckPj.js";import{na as P,ta as L}from"./createLucideIcon-DJi9suAC.js";import{t as N}from"./badge-DuA2EgZC.js";import{o as x,r as b,s as v,t as w}from"./card-Bru3x_SJ.js";import{n as O}from"./IssueChatThread-CMXzuvrF.js";var o=I(P(),1);var E=new Date("2026-04-28T14:00:00.000Z").getTime();function i(t){return new Date(E+t*6e4)}n(i,"atMinute");function _(t,r,a,A){const l=new Date("2026-04-28T14:00:00.000Z");return{id:t,companyId:"company-long-thread",name:r,urlKey:A,role:"engineer",title:null,icon:a,status:"active",reportsTo:null,capabilities:null,adapterType:"omp_local",adapterConfig:{},runtimeConfig:{},budgetMonthlyCents:0,spentMonthlyCents:0,lastHeartbeatAt:null,metadata:null,createdAt:l,updatedAt:l,pauseReason:null,pausedAt:null,permissions:{canCreateAgents:!1}}}n(_,"createAgent");var m=_("agent-perf-codex","CodexCoder","code","codexcoder"),h=_("agent-perf-reviewer","ReviewBot","sparkles","reviewbot"),$=new Map([[m.id,m],[h.id,h]]);function B(t){return[`## Baseline note ${t}`,"",`This assistant update captures a deterministic markdown-heavy row for long-thread rendering. It references [PAP-${2600+t}](/PAP/issues/PAP-${2600+t}) and includes enough structure to exercise markdown parsing.`,"","- Parsed checklist item one with inline `code`","- Parsed checklist item two with **bold** and _italic_ text","- Parsed checklist item three with a link to [Wardmote](/PAP/dashboard)","","| Metric | Value |","| --- | ---: |",`| Fixture row | ${t} |`,`| Synthetic tokens | ${1200+t} |`,"","```ts",`const fixtureRow${t} = { markdown: true, deterministic: true };`,"```"].join(`
2
2
  `)}n(B,"markdownBody");function U(t){return`Board checkpoint ${t}: keep the issue-detail page responsive while the thread is full of historical comments.`}n(U,"plainUserBody");function F(t){return`Processed checkpoint ${t}. The current direct-render path should keep this row mounted with the rest of the thread.`}n(F,"plainAssistantBody");function H(t){const r=t<150,a=r||t%4===1||t%4===2?t%7===0?h.id:m.id:null;return{id:`long-thread-comment-${String(t+1).padStart(3,"0")}`,companyId:"company-long-thread",issueId:"issue-long-thread",authorType:a?"agent":"user",authorAgentId:a,authorUserId:a?null:"user-board",body:r?B(t+1):a?F(t+1):U(t+1),presentation:null,metadata:null,createdAt:i(t),updatedAt:i(t)}}n(H,"createComment");var R=Array.from({length:469},(t,r)=>H(r)),G=new Set(R.slice(0,150).map(t=>t.id)),T=Array.from({length:12},(t,r)=>({id:`long-thread-event-${r+1}`,createdAt:i(r*36+18),actorType:r%3===0?"user":"agent",actorId:r%3===0?"user-board":m.id,statusChange:r%2===0?{from:r===0?"todo":"in_progress",to:"in_progress"}:void 0,assigneeChange:r%2===1?{from:{agentId:null,userId:null},to:{agentId:r%4===1?m.id:h.id,userId:null}}:void 0})),C=Array.from({length:6},(t,r)=>({runId:`long-thread-run-${r+1}`,status:r%3===0?"failed":r%3===1?"timed_out":"succeeded",agentId:r%2===0?m.id:h.id,agentName:r%2===0?m.name:h.name,adapterType:"omp_local",createdAt:i(r*72+12),startedAt:i(r*72+12),finishedAt:i(r*72+16),hasStoredOutput:!0})),V=[],k=new Map(C.map((t,r)=>[t.runId,[{kind:"thinking",ts:i(r*72+13).toISOString(),text:`Inspecting long-thread segment ${r+1}.`},{kind:"tool_call",ts:i(r*72+14).toISOString(),name:"read_file",toolUseId:`long-thread-tool-${r+1}`,input:{path:"ui/src/components/IssueChatThread.tsx"}},{kind:"tool_result",ts:i(r*72+15).toISOString(),toolUseId:`long-thread-tool-${r+1}`,content:"Confirmed the direct-render fixture keeps the full message subtree mounted.",isError:t.status!=="succeeded"},{kind:"assistant",ts:i(r*72+16).toISOString(),text:`Run ${r+1} produced a compact transcript row for adjacent run context.`}]])),W={issue:{identifier:"PAP-PERF",title:"Long-thread rendering baseline fixture",status:"in_progress",priority:"medium",projectName:"Wardmote App"},documents:["Implementation Plan","Profiler Notes","Release Checklist","QA Readout"],subIssues:["Phase 1: Add long-thread perf fixture and baseline","Phase 2: Isolate issue-thread row rendering and Markdown work","Phase 3: Apply virtualization and guard scroll behavior","Phase 4: Verify production issue profile improvement"],sidebarStats:[["Comments",String(469)],["Markdown bodies",String(150)],["Timeline events",String(12)],["Linked runs",String(6)]]},e=I(L(),1),q=n(async()=>{},"noop"),y={commitCount:0,mountActualDuration:null,latestActualDuration:null,maxActualDuration:0,totalActualDuration:0};function j(t){return t===null||!Number.isFinite(t)?"pending":`${t.toFixed(1)} ms`}n(j,"formatMs");function c({label:t,value:r,testId:a}){return(0,e.jsxs)("div",{className:"rounded-md border border-line bg-bg px-3 py-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-medium uppercase tracking-(--tracking-eyebrow) text-ink-3",children:t}),(0,e.jsx)("div",{"data-testid":a,className:"mt-1 font-mono text-sm text-ink",children:r})]})}n(c,"MetricTile");function Y(){const[t,r]=(0,o.useState)(y),a=(0,o.useRef)(y),A=(0,o.useRef)(performance.now()),l=(0,o.useRef)(null),g=(0,o.useRef)(!1),u=W,D=(0,o.useMemo)(()=>469+T.length+C.length,[]);(0,o.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,o.useLayoutEffect)(()=>{if(g.current||a.current.commitCount>0)return;const s=performance.now()-A.current,d={commitCount:1,mountActualDuration:s,latestActualDuration:s,maxActualDuration:s,totalActualDuration:s};a.current=d,g.current=!0,r(d)},[]);const M=n((s,d,f)=>{const p=a.current;a.current={commitCount:p.commitCount+1,mountActualDuration:d==="mount"&&p.mountActualDuration===null?f:p.mountActualDuration,latestActualDuration:f,maxActualDuration:Math.max(p.maxActualDuration,f),totalActualDuration:p.totalActualDuration+f},!(g.current||l.current!==null)&&(l.current=window.setTimeout(()=>{l.current=null,g.current=!0,r(a.current)},0))},"handleRender");return(0,e.jsxs)("div",{"data-testid":"issue-chat-long-thread-perf",className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 border-b border-line pb-5 lg:flex-row lg:items-end lg:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(N,{variant:"outline",className:"font-mono text-(length:--text-micro)",children:u.issue.identifier}),(0,e.jsx)(N,{variant:"secondary",children:u.issue.status.replace(/_/g," ")}),(0,e.jsx)(N,{variant:"outline",children:u.issue.projectName})]}),(0,e.jsx)("h1",{className:"mt-3 text-2xl font-semibold tracking-tight",children:u.issue.title}),(0,e.jsx)("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-ink-3",children:"Deterministic local fixture for measuring the current direct-render issue chat path with hundreds of merged thread rows, markdown-heavy assistant bodies, linked runs, documents, sub-issues, and sidebar context."})]}),(0,e.jsxs)("div",{className:"grid min-w-(--sz-280px) grid-cols-2 gap-2",children:[(0,e.jsx)(c,{label:"Fixture rows",value:String(D),testId:"perf-fixture-row-target"}),(0,e.jsx)(c,{label:"Markdown rows",value:String(150),testId:"perf-fixture-markdown-rows"})]})]}),(0,e.jsxs)("div",{className:"grid gap-4 xl:grid-cols-(--gtc-40)",children:[(0,e.jsxs)("main",{className:"min-w-0 space-y-4",children:[(0,e.jsxs)(w,{className:"border-line/70",children:[(0,e.jsx)(x,{className:"pb-2",children:(0,e.jsx)(v,{className:"text-base",children:"Issue documents"})}),(0,e.jsx)(b,{className:"grid gap-2 sm:grid-cols-2",children:u.documents.map(s=>(0,e.jsx)("div",{className:"rounded-md border border-line bg-bg-3/30 px-3 py-2 text-sm",children:s},s))})]}),(0,e.jsxs)(w,{className:"border-line/70",children:[(0,e.jsx)(x,{className:"pb-2",children:(0,e.jsx)(v,{className:"text-base",children:"Sub-issues"})}),(0,e.jsx)(b,{className:"space-y-2",children:u.subIssues.map((s,d)=>(0,e.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-line bg-bg px-3 py-2 text-sm",children:[(0,e.jsxs)("span",{className:"font-mono text-xs text-ink-3",children:["#",d+1]}),(0,e.jsx)("span",{children:s})]},s))})]}),(0,e.jsx)(o.Profiler,{id:"issue-chat-long-thread",onRender:M,children:(0,e.jsx)(O,{comments:R,linkedRuns:C,timelineEvents:T,liveRuns:V,issueStatus:"in_progress",agentMap:$,currentUserId:"user-board",onAdd:q,showComposer:!1,showJumpToLatest:!1,enableLiveTranscriptPolling:!1,transcriptsByRunId:k,hasOutputForRun:n(s=>k.has(s),"hasOutputForRun")})})]}),(0,e.jsxs)("aside",{className:"space-y-4 xl:sticky xl:top-4 xl:self-start",children:[(0,e.jsxs)(w,{className:"border-line/70",children:[(0,e.jsx)(x,{className:"pb-2",children:(0,e.jsx)(v,{className:"text-base",children:"Baseline metrics"})}),(0,e.jsxs)(b,{className:"grid gap-2",children:[(0,e.jsx)(c,{label:"Profiler commits",value:String(t.commitCount),testId:"perf-commit-count"}),(0,e.jsx)(c,{label:"Mount duration",value:j(t.mountActualDuration),testId:"perf-mount-duration"}),(0,e.jsx)(c,{label:"Latest duration",value:j(t.latestActualDuration),testId:"perf-latest-duration"}),(0,e.jsx)(c,{label:"Max duration",value:j(t.maxActualDuration),testId:"perf-max-duration"}),(0,e.jsx)(c,{label:"Total duration",value:j(t.totalActualDuration),testId:"perf-total-duration"})]})]}),(0,e.jsxs)(w,{className:"border-line/70",children:[(0,e.jsx)(x,{className:"pb-2",children:(0,e.jsx)(v,{className:"text-base",children:"Fixture shape"})}),(0,e.jsxs)(b,{className:"space-y-2",children:[u.sidebarStats.map(([s,d])=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 text-sm",children:[(0,e.jsx)("span",{className:"text-ink-3",children:s}),(0,e.jsx)("span",{className:"font-mono",children:d})]},s)),(0,e.jsx)("div",{className:"hidden","data-testid":"perf-markdown-comment-id-sample",children:[...G].slice(0,3).join(",")})]})]})]})]})]})}n(Y,"IssueChatLongThreadPerf");export{Y as IssueChatLongThreadPerf};