@microvac/ui 0.1.0-rc.14 → 0.1.0-rc.15
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.
- package/dist/assets/{ActiveAgentsPanel-C9AP9hJu.js → ActiveAgentsPanel-BEx06tMt.js} +1 -1
- package/dist/assets/{AdapterManager-CmxTUKJH.js → AdapterManager-3kEEQWFJ.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CXsQnTei.js → AdvancedToolsRoute-CgS6B-oh.js} +1 -1
- package/dist/assets/{AgentActionButtons-DWq2OuVK.js → AgentActionButtons-Cz3jCEd7.js} +1 -1
- package/dist/assets/{AgentAdvancedTab-dhBDxF-H.js → AgentAdvancedTab-BG6ZIAuN.js} +1 -1
- package/dist/assets/{AgentBulkSettingsSheet-DYT4ovDg.js → AgentBulkSettingsSheet-BrrbvspS.js} +1 -1
- package/dist/assets/{AgentChat-r0TPOfPK.js → AgentChat-Dw9iXD6H.js} +1 -1
- package/dist/assets/{AgentDetailPage-Bc_okBuS.js → AgentDetailPage-CuVIHv_q.js} +3 -3
- package/dist/assets/{AgentIdentityChip-CB2NBXkZ.js → AgentIdentityChip-BrVCcuHQ.js} +1 -1
- package/dist/assets/{AgentRosterFilters-b7qMLv8-.js → AgentRosterFilters-GQ2bdXfW.js} +2 -2
- package/dist/assets/{Agents-BsvXy3pZ.js → Agents-clrVQnvc.js} +2 -2
- package/dist/assets/{Agents.production-BeOZmzaF.js → Agents.production-DTopo7XB.js} +2 -2
- package/dist/assets/{AnimatedDialogContent-CWshmxP2.js → AnimatedDialogContent-CDLfw-dJ.js} +1 -1
- package/dist/assets/{AppDetail-DbqENTF_.js → AppDetail-BcWBg5yW.js} +1 -1
- package/dist/assets/{AppNotConnected-BhnCqL0F.js → AppNotConnected-NgfyHZ4L.js} +1 -1
- package/dist/assets/{ApprovalDetail-B2KiYLTj.js → ApprovalDetail-Dm_1V4tC.js} +1 -1
- package/dist/assets/{Approvals-j-wRmqKj.js → Approvals-i5AB3JPj.js} +1 -1
- package/dist/assets/{AppsConnect-CcPVEZ0C.js → AppsConnect-D660Tpuo.js} +1 -1
- package/dist/assets/{AppsReview-B8eWvKkS.js → AppsReview-DdTqOisY.js} +1 -1
- package/dist/assets/{ArtifactEmptyGraphic-5mdkS5jj.js → ArtifactEmptyGraphic-DzxCruYA.js} +1 -1
- package/dist/assets/{Artifacts-Bz7Oo6VX.js → Artifacts-CkXBz6nh.js} +1 -1
- package/dist/assets/{AssigneePickerInner-DdpF7hck.js → AssigneePickerInner-BNjyABBe.js} +1 -1
- package/dist/assets/{AssistantConnection-BpaaJDc_.js → AssistantConnection-CNF6mDmO.js} +1 -1
- package/dist/assets/{AttentionInlineVerbs-DlPQVCO-.js → AttentionInlineVerbs-BiyZ1ekZ.js} +1 -1
- package/dist/assets/{AttentionQueueRow-BC6ezctS.js → AttentionQueueRow-Bh0dKHpF.js} +1 -1
- package/dist/assets/{AuditHub-BVP7LKL9.js → AuditHub-BK848cb4.js} +1 -1
- package/dist/assets/{AuditRuns-DqizHgX1.js → AuditRuns-CUdlbP7S.js} +1 -1
- package/dist/assets/{Auth-DOF0snjp.js → Auth-DDqxm5gD.js} +1 -1
- package/dist/assets/{BoardChat-BYAbDtfd.js → BoardChat-fvKqk0R7.js} +1 -1
- package/dist/assets/{BoardClaim-7y41Pr8e.js → BoardClaim-BEC5BZfz.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-BftH1vOv.js → BootstrapSetupUxLab-CXzErrin.js} +1 -1
- package/dist/assets/{Browse-Ck01W1Yl.js → Browse-DoovSMuF.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-CKhrzfgy.js → BudgetPolicyCard-BYMlczCq.js} +1 -1
- package/dist/assets/{CaseDetail-qlXKJ66D.js → CaseDetail-UMAcSH_x.js} +1 -1
- package/dist/assets/{CaseStatus-B3RiZVDH.js → CaseStatus-BI0aMl9l.js} +1 -1
- package/dist/assets/{Cases-CFV3V-5X.js → Cases-CMTkGghU.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-7Hi5TJNt.js → ChatEndpointDetail-CocNEInH.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-CtwgH6sg.js → ChatEndpointSetup-Cyi2tI9K.js} +1 -1
- package/dist/assets/{ChatIdentityConfirm-CXjksBwX.js → ChatIdentityConfirm-Ba3JuTX1.js} +1 -1
- package/dist/assets/{CliAuth-KVjrGMfZ.js → CliAuth-D2jnueGH.js} +1 -1
- package/dist/assets/{Companies-oeJem3De.js → Companies-K75I9dJs.js} +1 -1
- package/dist/assets/{CompanyAccess-vWT6G-n_.js → CompanyAccess-Cw6nLUhE.js} +1 -1
- package/dist/assets/{CompanyActivity-zOzzeN1B.js → CompanyActivity-BsgmVpWS.js} +1 -1
- package/dist/assets/CompanyActivity.production-w-KGxvo6.js +1 -0
- package/dist/assets/{CompanyConnections-llSEaVa2.js → CompanyConnections-yRPYSdm7.js} +1 -1
- package/dist/assets/{CompanyEnvironments-DNyyGC_S.js → CompanyEnvironments-BA7kWdOJ.js} +1 -1
- package/dist/assets/{CompanyExport-CFa-F8Es.js → CompanyExport-DfsK4b9c.js} +1 -1
- package/dist/assets/{CompanyImport-DG6qwQ8F.js → CompanyImport-DJHAsmSF.js} +1 -1
- package/dist/assets/{CompanySettings-Dv5Z3ZQi.js → CompanySettings-DwzHGXec.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-CZk1d_0d.js → CompanySettingsPluginPage-Bpa81PF3.js} +1 -1
- package/dist/assets/{CompanySkills-CdzWhJfQ.js → CompanySkills-eTqgbqQN.js} +1 -1
- package/dist/assets/{CompanySkills.production-IoCRW5FQ.js → CompanySkills.production-CQSWfH0r.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-BwW7XQ1O.js → ConfigureBuiltInAgentModal-DgeD7t_i.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-PTn061ft.js → CopyableGatewayUrl-B6K3rOal.js} +1 -1
- package/dist/assets/{CordisPluginSettings-C_BeeGEc.js → CordisPluginSettings-DD3AnD2G.js} +1 -1
- package/dist/assets/{Costs-DhuNxwSj.js → Costs-orBM8T-a.js} +1 -1
- package/dist/assets/{CrossIssueCollaborationUxLab-ZaAXq46r.js → CrossIssueCollaborationUxLab-Bv9y9-NE.js} +1 -1
- package/dist/assets/{Dashboard-BaDnqiKo.js → Dashboard-CrSBNKX1.js} +1 -1
- package/dist/assets/{DashboardLive-D-Ed7osd.js → DashboardLive-Cg8C9RiS.js} +1 -1
- package/dist/assets/{DecisionDateChips-D3pl_mLn.js → DecisionDateChips-BLZKZH71.js} +1 -1
- package/dist/assets/{DecisionHistoryPanel-D5MzyrOh.js → DecisionHistoryPanel-yK-CP7Qg.js} +1 -1
- package/dist/assets/{DecisionQueuePage-D3UZ9oRk.js → DecisionQueuePage-BKXbERai.js} +1 -1
- package/dist/assets/{DesignGuide-COTo7ICj.js → DesignGuide-2FswNsXz.js} +1 -1
- package/dist/assets/{DesignSandboxTaskThread-CMeCSQid.js → DesignSandboxTaskThread-CGU--FXR.js} +1 -1
- package/dist/assets/{EmailConnectionAccess-kCL7obSr.js → EmailConnectionAccess-CZ5QRKyg.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-BGrksR_u.js → EmailEndpointSetup-BI2vsd8Y.js} +1 -1
- package/dist/assets/{EnforcementBanner-_Eb_nK3M.js → EnforcementBanner-B-iX466h.js} +1 -1
- package/dist/assets/{EntityRow-gpsOgEtu.js → EntityRow-BsICt6pd.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-DwGkH6d3.js → ExecutionWorkspaceDetail-CMqR9puh.js} +1 -1
- package/dist/assets/{ExternalAgentInviteDialog-CGid6pM9.js → ExternalAgentInviteDialog-De30ZrLP.js} +1 -1
- package/dist/assets/{FilterBar-1D-VhrvG.js → FilterBar-rCmsTtG4.js} +1 -1
- package/dist/assets/{FolderControls-CQ6kef3c.js → FolderControls-CmnB7Ap-.js} +1 -1
- package/dist/assets/{GatewayDetail-CCqekM1J.js → GatewayDetail-Duw9pJ10.js} +1 -1
- package/dist/assets/{GatewaysList-nFsRcszh.js → GatewaysList-BBhVGhRq.js} +1 -1
- package/dist/assets/{GitHubConnectionRecovery-B9sFWJup.js → GitHubConnectionRecovery-6VshLoNV.js} +1 -1
- package/dist/assets/{GoalDetail-BQ8y55P-.js → GoalDetail-CahntjlI.js} +1 -1
- package/dist/assets/{GoalTree-laRjXp0P.js → GoalTree-CU4GBFCh.js} +1 -1
- package/dist/assets/{Goals-Cm14EaeP.js → Goals-CzM2NDFR.js} +1 -1
- package/dist/assets/{InstanceAccess-DxQ-Akt_.js → InstanceAccess-CZzkE65W.js} +1 -1
- package/dist/assets/{InstanceExperimentalSettings-BxwqbXNw.js → InstanceExperimentalSettings-DWumKtOK.js} +1 -1
- package/dist/assets/{InviteLanding-Cf0L_u6s.js → InviteLanding-BIy2z50u.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-BfsF6FdF.js → IssueChatLongThreadPerf-D4DJvdOG.js} +1 -1
- package/dist/assets/{JoinRequestQueue-BXCdTFG_.js → JoinRequestQueue-C5rauGYm.js} +1 -1
- package/dist/assets/{Layout.production-CqzU0qMi.js → Layout.production-BSDWnupa.js} +1 -1
- package/dist/assets/{McpConnect-COWnZ9Eb.js → McpConnect-BN8ST0RS.js} +1 -1
- package/dist/assets/{MembershipAction-C9i9Sdmi.js → MembershipAction-DTjhGn-L.js} +1 -1
- package/dist/assets/{MetricCard-Bwnt3_p3.js → MetricCard-CeL9Pdn5.js} +1 -1
- package/dist/assets/{MissingPluginTabPlaceholder-B0Zxv1Kx.js → MissingPluginTabPlaceholder-CbQiSVnZ.js} +1 -1
- package/dist/assets/{NewAgent-BIlJ5Dyt.js → NewAgent-BszrNpQk.js} +1 -1
- package/dist/assets/{NewAgentDialog-CJdMxxYL.js → NewAgentDialog-U9qAcTzc.js} +1 -1
- package/dist/assets/{NewGoalDialog-B8izfKLm.js → NewGoalDialog-DqKbk4-i.js} +1 -1
- package/dist/assets/{NewProjectDialog-DXqjTYFK.js → NewProjectDialog-DrlUAF-N.js} +1 -1
- package/dist/assets/{OnboardingPrimitives-DHYBqn_0.js → OnboardingPrimitives-BkgPF4Mu.js} +1 -1
- package/dist/assets/{OnboardingWizard-DqSfZ13V.js → OnboardingWizard-CMBMcuXv.js} +1 -1
- package/dist/assets/{OrgChart.production-DrSFUf7i.js → OrgChart.production-BLczTjRj.js} +1 -1
- package/dist/assets/{PaperclipCloudOAuthHandoff-jPUvjJ8q.js → PaperclipCloudOAuthHandoff-BTtF8UPD.js} +1 -1
- package/dist/assets/{PluginManager-h3LFPaUq.js → PluginManager-CCcqlfgK.js} +1 -1
- package/dist/assets/{PluginPage-E5Im4454.js → PluginPage-B1empV69.js} +1 -1
- package/dist/assets/{PluginSettings-BBO0jAgo.js → PluginSettings-DtopaRqR.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-CQBD7fms.js → ProfileDetailRoute-BqvVpBZi.js} +1 -1
- package/dist/assets/{ProfileSettings-BwnVEHLp.js → ProfileSettings-5__tVfGi.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-By_SC6Gn.js → ProfileWizardRoute-vt-MRLuD.js} +1 -1
- package/dist/assets/{ProjectDetail-CbiwFBAE.js → ProjectDetail-DJ4zjube.js} +1 -1
- package/dist/assets/{ProjectRepositoryInput-DZF9bX4E.js → ProjectRepositoryInput-BJcnj3At.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DPsl_4bD.js → ProjectWorkspaceDetail-DEAO3q6v.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-COH4dOWK.js → ProjectWorkspacesContent-CZvO7p0i.js} +1 -1
- package/dist/assets/{Projects-Ch9Qu7sn.js → Projects-Dm7-zXUH.js} +1 -1
- package/dist/assets/{QuotaBar-DIFOT9Uh.js → QuotaBar-Drp3CaxX.js} +1 -1
- package/dist/assets/{RepositoryEditor-DHB1bqId.js → RepositoryEditor-BT_VAkJu.js} +1 -1
- package/dist/assets/{Responsibilities-C5O0JXXG.js → Responsibilities-DbUEtGZu.js} +1 -1
- package/dist/assets/{ResponsibilityDetail-D6NpZpkm.js → ResponsibilityDetail--S8_GOkb.js} +1 -1
- package/dist/assets/{ResponsibleUserDenialUxLab-CFrIWYwe.js → ResponsibleUserDenialUxLab-1PB3JNG0.js} +1 -1
- package/dist/assets/{ReviewQueueCard-BPC4Lm67.js → ReviewQueueCard-B8w9aXKU.js} +1 -1
- package/dist/assets/{RoutineAuditActivity-sKyzMajz.js → RoutineAuditActivity-BCo7pYe5.js} +1 -1
- package/dist/assets/{RoutineDetail-CG8HF5fp.js → RoutineDetail-C9Dwn5G9.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-CKh3CmLD.js → RoutineRunVariablesDialog-Baomcbe3.js} +1 -1
- package/dist/assets/{Routines-tF2qfUKo.js → Routines-Dkv4gJno.js} +1 -1
- package/dist/assets/{Routines.production-BTyj1Ljr.js → Routines.production-Cs2Y-lpt.js} +1 -1
- package/dist/assets/{RoutinesToolbar-CvUFVCGN.js → RoutinesToolbar-BNKfCrTo.js} +1 -1
- package/dist/assets/{Search-Z9D0NuS1.js → Search-CVx4cl2o.js} +1 -1
- package/dist/assets/{Secrets-DgmbLOJK.js → Secrets-C2qv2HKZ.js} +1 -1
- package/dist/assets/{SkillBinaryFile-F3_9qcaM.js → SkillBinaryFile-DDkhLlfC.js} +1 -1
- package/dist/assets/{SkillCardIcon-CXHUCMej.js → SkillCardIcon-Cp_hws0N.js} +1 -1
- package/dist/assets/{SkillFolderTree-CB3lrTIE.js → SkillFolderTree-Cv0CmfYx.js} +1 -1
- package/dist/assets/{SkillSourceTree-BbuciCo6.js → SkillSourceTree-DmjlUswf.js} +1 -1
- package/dist/assets/{SkillSources-Dlo6Cew3.js → SkillSources-nmlYypUU.js} +1 -1
- package/dist/assets/{SkillStudio-ZO-Nf7eI.js → SkillStudio-BK3y_3zr.js} +1 -1
- package/dist/assets/{SkillsNavigationTabs-B9Iqnlqt.js → SkillsNavigationTabs-DRwMP1eu.js} +1 -1
- package/dist/assets/{SpekoPhoneCallback-C4VnMiZh.js → SpekoPhoneCallback-Cqi7AIyH.js} +1 -1
- package/dist/assets/{SpekoProviderSetup-I4evPZb3.js → SpekoProviderSetup-CJI4oXk5.js} +1 -1
- package/dist/assets/{StatusCards-D0MVzbsw.js → StatusCards-DKyyY81S.js} +1 -1
- package/dist/assets/{SummarySlotCard-DUXgZPxG.js → SummarySlotCard-f3RomdZS.js} +1 -1
- package/dist/assets/{TailscaleConnector-CMhT73gj.js → TailscaleConnector-yQWLR1Ra.js} +1 -1
- package/dist/assets/{TaskChatLab-D9-KAE-7.js → TaskChatLab-Dsr7eyj4.js} +1 -1
- package/dist/assets/{TaskSummaryList-CUxieFNe.js → TaskSummaryList-eFDfK_QH.js} +1 -1
- package/dist/assets/{Timeline-BNMoRbtK.js → Timeline-BWA9dyk6.js} +1 -1
- package/dist/assets/{ToolsAdminGate-CEr0zy2T.js → ToolsAdminGate-DpBg30hQ.js} +1 -1
- package/dist/assets/{TrustPresetSection-B9YXZtkh.js → TrustPresetSection-DtWjK9Kp.js} +1 -1
- package/dist/assets/{UserProfile-D-tnW96X.js → UserProfile-C66UI5xx.js} +1 -1
- package/dist/assets/{WebhookUrlWarning-Ba_DixKh.js → WebhookUrlWarning-CDygVnDH.js} +1 -1
- package/dist/assets/{WhatNeedsMe-B-Jzj8_M.js → WhatNeedsMe-BQ82RHus.js} +1 -1
- package/dist/assets/{Workspaces-BqhDI_Bl.js → Workspaces-DrjJes30.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-Bn9P-nUW.js → abnfDiagram-YUKMZFIV-Crkksu2D.js} +1 -1
- package/dist/assets/{architecture-WOLXFQ4H-V1ldsZlt.js → architecture-WOLXFQ4H-bHU8FW0c.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-BkYxt-Gc.js → architectureDiagram-47P4ROYG-Bj5Styf9.js} +1 -1
- package/dist/assets/{arrow-down-left-o81ENfeW.js → arrow-down-left-Ck9VQyqQ.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BO7pPYbp.js → blockDiagram-E7TT5TSB-OeHpNCQ-.js} +1 -1
- package/dist/assets/{budgets-0Dw6TH1A.js → budgets-CAWPqcn4.js} +1 -1
- package/dist/assets/{building-complex-DciZTnys.js → building-complex-Dxiyk_pH.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-D4EpmmzV.js → c4Diagram-CRA5TL53-QbK5p76P.js} +1 -1
- package/dist/assets/channel-BSmZkKA8.js +1 -0
- package/dist/assets/{chat-channels-DWyry-9M.js → chat-channels-CzTZV2fr.js} +1 -1
- package/dist/assets/{chunk-2BW5OAIV-DFXIyCJy.js → chunk-2BW5OAIV-Ckr4HfBO.js} +1 -1
- package/dist/assets/{chunk-3YJQHVM4-Dj5wEKIw.js → chunk-3YJQHVM4-C_uoPpLR.js} +1 -1
- package/dist/assets/{chunk-4EA7E6EY-5XiUVgzK.js → chunk-4EA7E6EY-BeMEfIRS.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-D0opKcsy.js → chunk-7TKQ45FW-DiwqWHvN.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-DnjsTe04.js → chunk-AW2ZBBNX-Cf57K3PO.js} +1 -1
- package/dist/assets/{chunk-DBDB3WZW-DNqSQPZ0.js → chunk-DBDB3WZW-B2qouVQO.js} +1 -1
- package/dist/assets/{chunk-E2ZNV5FY-cjSf_BTz.js → chunk-E2ZNV5FY-DG8wQ_NS.js} +1 -1
- package/dist/assets/{chunk-EU5HNXII-CZYBiaSw.js → chunk-EU5HNXII-cxRrXRGV.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-DSc0-wJA.js → chunk-FVRAUYC3-Dizswk0V.js} +1 -1
- package/dist/assets/{chunk-HJ2JQQFS-MXK0gYSP.js → chunk-HJ2JQQFS-DL4lnpSv.js} +1 -1
- package/dist/assets/{chunk-HTAEGDNF-BjDZm_5k.js → chunk-HTAEGDNF-Zxjdb6kj.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-Bfj0tDmO.js → chunk-KQW6MTUR-BsVaJdnu.js} +1 -1
- package/dist/assets/{chunk-NTY3LDVX-Bpz5TkVb.js → chunk-NTY3LDVX-DyT9N5sM.js} +1 -1
- package/dist/assets/{chunk-VPRB5NB3-CfeHjtbb.js → chunk-VPRB5NB3-BNz5CtBn.js} +1 -1
- package/dist/assets/{chunk-XC4XBNZT-FBCWmi6K.js → chunk-XC4XBNZT-CCgIhjYS.js} +1 -1
- package/dist/assets/{circle-slash-DqKFFqfb.js → circle-slash-uNv_ha0X.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DbC_J0kK.js → classDiagram-v2-K4WV4PDN-Cdh3CEl4.js} +1 -1
- package/dist/assets/{coins-BztUbqyl.js → coins-BDAh8hDQ.js} +1 -1
- package/dist/assets/{collections-BxrcELwt.js → collections-B58p51lw.js} +1 -1
- package/dist/assets/{connection-owner-D-ikSHyR.js → connection-owner-D8fNrFqC.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-COwSJ4qP.js → cynefin-EF2NZ3EQ-BkwhfqJ0.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-diaEJq9Y.js → cynefinDiagram-3GCD6N5R-DuGb_wq2.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-BPAMRuIj.js → dagre-W4DXFKR2-Bxq_Mhia.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-BvRnO1Id.js → diagram-2UJZ2QOL-B-P_hrXV.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CDgBeD0m.js → diagram-OVF4WLC6-Ds0BqQWH.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-DAw9lREG.js → diagram-PFPMY2P6-Dpqb2-Cb.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-ZQqQn22t.js → diagram-UMYRVEAY-BJSoxjiu.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-CoJtGgWs.js → diagram-YEKJPTXX-BxaG_9tT.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-qW_Zn_bO.js → diagram-ZIFT7M5P-6acvVOtc.js} +1 -1
- package/dist/assets/{dist-B2E6oBK1.js → dist-0EWXio4m.js} +1 -1
- package/dist/assets/{dist-IcdxEhjC.js → dist-BGvZP_Cl.js} +1 -1
- package/dist/assets/{dist-DXjkgaZX.js → dist-BZ7AbEhN.js} +1 -1
- package/dist/assets/{dist-_EtfntKJ.js → dist-BlosHr86.js} +1 -1
- package/dist/assets/{dist-DylHAy-6.js → dist-Bmr4uhSk.js} +1 -1
- package/dist/assets/{dist-DML0cJH3.js → dist-C6yMfMNS.js} +1 -1
- package/dist/assets/{dist-Dl94YqeS.js → dist-CMZQedYl.js} +1 -1
- package/dist/assets/{dist-DKyBHaH2.js → dist-C_N_-eaT.js} +1 -1
- package/dist/assets/{dist-CvRpZH53.js → dist-CaUbG4Hl.js} +1 -1
- package/dist/assets/{dist-ptDa9fKh.js → dist-Cn7-nxjU.js} +1 -1
- package/dist/assets/{dist-CG-phytt.js → dist-Cnj95_pX.js} +1 -1
- package/dist/assets/{dist-DbXGl-wj.js → dist-D9DR7k9k.js} +1 -1
- package/dist/assets/{dist-CjRqeLFz.js → dist-DIwsVdS2.js} +1 -1
- package/dist/assets/{dist-BCJybC91.js → dist-DVE0lLId.js} +1 -1
- package/dist/assets/{dist-CPgRB-NQ.js → dist-DkAPL4CQ.js} +1 -1
- package/dist/assets/{dist-CeSzCyeG.js → dist-Dl6N3kpQ.js} +1 -1
- package/dist/assets/{dist-DZruZxAk.js → dist-DmBvXBzK.js} +1 -1
- package/dist/assets/{dist-CdmdXwCZ.js → dist-DpgXK0aZ.js} +1 -1
- package/dist/assets/{dist-CYRzGbSY.js → dist-gMRyU9GJ.js} +1 -1
- package/dist/assets/{dist-CG6fC1Db.js → dist-jQQX2kOU.js} +1 -1
- package/dist/assets/{dist-DZIxMHOT.js → dist-lUaUoFTq.js} +1 -1
- package/dist/assets/{dist-CuwPDbnL.js → dist-qw1ZF2vD.js} +1 -1
- package/dist/assets/{dist-B6Qde8KJ.js → dist-rH4qrNAn.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-DA4UvKXV.js → ebnfDiagram-VR2GEFS7-Ytj3Z5qC.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-CM74d3mJ.js → elk-IJKZMXRS-CJurNqqK.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-d869V0qL.js → erDiagram-O2IAPWRE-hyXckW2d.js} +1 -1
- package/dist/assets/{eventmodeling-K75KTNOO-C-oz_eyI.js → eventmodeling-K75KTNOO-D3xQujrh.js} +1 -1
- package/dist/assets/flowDiagram-OXPTDLAJ-D4ojBTuY.js +1 -0
- package/dist/assets/{folder-plus-CxWXoYCi.js → folder-plus-BJZSMzuj.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-BBul4Kpm.js → ganttDiagram-R7TSEDQI-C8U_ITl4.js} +1 -1
- package/dist/assets/{gitGraph-VSP46ZUC-BriEZgAq.js → gitGraph-VSP46ZUC-CDeq3yKT.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-I12rg8s1.js → gitGraphDiagram-XJZIOB7I-CST3EWE9.js} +1 -1
- package/dist/assets/{goals-CvMWzjH4.js → goals-BNJZ4nzg.js} +1 -1
- package/dist/assets/{index-Bt31d8ga.js → index-BJtnP7H1.js} +8 -8
- package/dist/assets/{info-OHQRW6UA-CxrcGiem.js → info-OHQRW6UA-CPvTWk7J.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-4Sm0LiOu.js → infoDiagram-5W2HQ5XZ-BPUiNdxI.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-CKXvKV-s.js → ishikawaDiagram-K3B6WC7H-D5Z3rmaA.js} +1 -1
- package/dist/assets/{issue-detail-4PCbYpdv.js → issue-detail-CZfjXs0M.js} +3 -3
- package/dist/assets/{journeyDiagram-COXZFDF6-BHsrZLvQ.js → journeyDiagram-COXZFDF6-CEkwEYdR.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-8HhnIs_l.js → kanban-definition-P3RFRI5V-8h_R6Qjq.js} +1 -1
- package/dist/assets/{line-rrKrpB-b.js → line-Ljt_vfsb.js} +1 -1
- package/dist/assets/{link-BecLzmfo.js → link-DvgFK0mz.js} +1 -1
- package/dist/assets/{list-filter-BC3D4IoX.js → list-filter-BR4_dvwm.js} +1 -1
- package/dist/assets/{log-in-BJCGwGGT.js → log-in-Dvx9-FMC.js} +1 -1
- package/dist/assets/{mcpSkills-DRs3pGKn.js → mcpSkills-76szK_k1.js} +1 -1
- package/dist/assets/{mermaid-parser.core-DmG0b4S0.js → mermaid-parser.core-BjFu937m.js} +3 -3
- package/dist/assets/{mermaid.core-D1vILTuF.js → mermaid.core-B0t95EIS.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DIMpL0de.js → mindmap-definition-LZFPQGKD-TVnHYUR4.js} +1 -1
- package/dist/assets/{packet-JDAUHWVQ-BnbYht3G.js → packet-JDAUHWVQ-aNGiRWLy.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-BUjtJVjT.js → pegDiagram-BGZESJAR-DDadxqWQ.js} +1 -1
- package/dist/assets/{pie-XZMESJXO-CM4VXUb-.js → pie-XZMESJXO-CydFP1hd.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-B3v8ryvG.js → pieDiagram-CAPJLFHJ-KhdUDwDS.js} +1 -1
- package/dist/assets/{power-0mw59G-l.js → power-sYV-WuqQ.js} +1 -1
- package/dist/assets/{profile-summary-B5rPf8v-.js → profile-summary-D4LPX-Dv.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-Cv-dS2Rn.js → quadrantDiagram-GDMTTRAM-B1X8K2Fs.js} +1 -1
- package/dist/assets/{radar-ABXABTNO-v6yZj4Fk.js → radar-ABXABTNO-BqodkLpx.js} +1 -1
- package/dist/assets/{railroad-I3PHUGI6-D-U8Cs0m.js → railroad-I3PHUGI6-HmRKXDJj.js} +1 -1
- package/dist/assets/{railroad-abnf-LNEFI6M7-Dw3fkrVy.js → railroad-abnf-LNEFI6M7-CkBttaHp.js} +1 -1
- package/dist/assets/{railroad-ebnf-DWYD2UWJ-_ln-e3Tx.js → railroad-ebnf-DWYD2UWJ-C6DBawFA.js} +1 -1
- package/dist/assets/{railroad-peg-JR7BVNR7-Bf8u1-RZ.js → railroad-peg-JR7BVNR7-Z9df3u5o.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-Drr5UhQI.js → railroadDiagram-SM67HX2B-2vDUUppL.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-D5ef6_ac.js → requirementDiagram-X7JNWC4A-DAuP39Hc.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-DncJWIz_.js → sankeyDiagram-UM26HJRW-ByS54QZK.js} +1 -1
- package/dist/assets/{saved-permissions-CizWg8-P.js → saved-permissions-CPiYtxkZ.js} +1 -1
- package/dist/assets/{scroll-text-Ck6HB7eM.js → scroll-text-CVSt6aO2.js} +1 -1
- package/dist/assets/{sdk-CWyUlmcn.js → sdk-vrG4HtB4.js} +1 -1
- package/dist/assets/{search-DkTqg7ab.js → search-CG-QtPVH.js} +1 -1
- package/dist/assets/{send-CYVi50sh.js → send-CH-0xdLm.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Cs0nGCCg.js → sequenceDiagram-ZO4K6R2Y-DvWxKTLK.js} +1 -1
- package/dist/assets/{shared-CIwISWMj.js → shared-D37zfckm.js} +1 -1
- package/dist/assets/{smoke-lab-matrix-A7ubFpfk.js → smoke-lab-matrix-C5gR81E3.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-Dpp3m5Wq.js → stateDiagram-v2-TBUQTH76-DtiiZIXq.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-NXVbx1w8.js → swimlanes-N4OXWK64-BWSEtCbX.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Bl_9DvHU.js +8 -0
- package/dist/assets/{timeline-definition-YOQAKGHF-DqI-Mv2e.js → timeline-definition-YOQAKGHF-U4QcniMh.js} +1 -1
- package/dist/assets/{treeView-D4JQ5SDB-CZBlE7ya.js → treeView-D4JQ5SDB-B2tdrtsj.js} +1 -1
- package/dist/assets/{treemap-SAJKECNS-BlueznID.js → treemap-SAJKECNS-DodN8j4n.js} +1 -1
- package/dist/assets/{useAgentlessOnboardingAutoOpen-CnFwEQ-H.js → useAgentlessOnboardingAutoOpen-DSWW7Juw.js} +1 -1
- package/dist/assets/{useAuthorizationWindow-DnFQsiFj.js → useAuthorizationWindow-tg3aKEU7.js} +1 -1
- package/dist/assets/{useDateRange-9EbqkWXy.js → useDateRange-CnZQr2KO.js} +1 -1
- package/dist/assets/{useFastResponsesEnabled-D8dunm4j.js → useFastResponsesEnabled-B8tHSJ1y.js} +1 -1
- package/dist/assets/{usePageView-BiX5i8ck.js → usePageView-CtFMs34g.js} +1 -1
- package/dist/assets/{useProfilesData-0VYQ4lAT.js → useProfilesData-CWHdMSuL.js} +1 -1
- package/dist/assets/{useReviewCount-WBWxwKI3.js → useReviewCount-W_bCZ2Hz.js} +1 -1
- package/dist/assets/{useRoutineFormOptions-DnX5DBn1.js → useRoutineFormOptions-CCLMmVSF.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-DPQRvaXT.js → useSummaryDraftStream-NVNYNt72.js} +1 -1
- package/dist/assets/{useTailscaleConnections-BDff6dWx.js → useTailscaleConnections-Dy52nCY3.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-BSDn8OaJ.js → usecaseDiagram-VIAY4XPW-kEHhqgOj.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BBSA9KNN.js → vennDiagram-BLWOH2XV-NPJU0aCU.js} +1 -1
- package/dist/assets/{wardley-7MLQ67FV-CsT-rTZ9.js → wardley-7MLQ67FV-bUGKvIPT.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-BLClsIjw.js → wardleyDiagram-YMQ3BMBF-qtUDHfhb.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-2x4wB0gq.js → xychartDiagram-TAQBALBS-C-z57aZj.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/CompanyActivity.production-DbaFBsM0.js +0 -1
- package/dist/assets/channel-BQh2vFIU.js +0 -1
- package/dist/assets/flowDiagram-OXPTDLAJ-Be1xLbJu.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Ct3LnXZt.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
var me=Object.defineProperty;var o=(s,r)=>me(s,"name",{value:r,configurable:!0});import{a as X}from"./rolldown-runtime-DhZMWcEn.js";import{D as T,E as I,I as _,K as xe,Nt as ue,R as he,T as E,_i as pe}from"./issue-detail-4PCbYpdv.js";import{C as fe,y as ge}from"./collections-BxrcELwt.js";import{$A as je,$S as ee,$t as A,Ap as P,E_ as ye,GS as w,GT as Ne,Gb as y,Gw as be,H_ as we,Jb as F,Kr as se,MT as ke,Mb as ve,NE as R,Np as z,Op as H,Pp as K,S_ as Ae,Up as Ie,WE as D,Yw as L,_s as Ce,aE as Se,ab as te,fy as ne,hy as Te,iD as O,ib as Re,kT as $e,kp as M,lS as re,lb as Ee,ly as ae,mT as De,my as ie,nE as _e,nj as Fe,on as Le,pE as Oe,pb as qe,qb as Be,qp as Pe,rb as ze,sy as le,ub as $,uy as He,x as q,xE as k,zE as j}from"./index-Bt31d8ga.js";import{t as Ke}from"./EntityRow-gpsOgEtu.js";import{n as de}from"./CaseStatus-B3RiZVDH.js";var g=X(Fe(),1),e=X(je(),1);function Me(s){return s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(0)} KB`:`${(s/1048576).toFixed(1)} MB`}o(Me,"humanBytes");function Ve({attachments:s}){const[r,i]=(0,g.useState)(null),a=(0,g.useMemo)(()=>s.filter(T).map(n=>({id:n.id,contentPath:E(n),contentType:n.asset.contentType,originalFilename:n.asset.originalFilename})),[s]);return s.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No attachments."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4",children:s.map(n=>{const d=T(n),t=n.asset.originalFilename??"attachment",l=d?a.findIndex(h=>h.id===n.id):-1;return(0,e.jsxs)("button",{type:"button",onClick:o(()=>d&&l>=0&&i(l),"onClick"),disabled:!d,title:t,className:j("group relative flex aspect-square flex-col overflow-hidden rounded-lg border border-border bg-muted/40 text-left",d&&"cursor-pointer hover:border-primary/50"),children:[d?(0,e.jsx)("img",{src:E(n),alt:t,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-(--s-1_02)"}):(0,e.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 p-2 text-muted-foreground",children:[(0,e.jsx)(L,{className:"h-6 w-6","aria-hidden":!0}),(0,e.jsx)("span",{className:"w-full truncate text-center text-(length:--text-micro)",children:t})]}),(0,e.jsx)("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/60 to-transparent px-1.5 py-1 text-(length:--text-nano) text-white/90",children:Me(n.asset.byteSize)})]},n.id)})}),r!==null&&(0,e.jsx)(ue,{items:a,initialIndex:r,open:r!==null,onOpenChange:o(n=>!n&&i(null),"onOpenChange")})]})}o(Ve,"CaseAttachmentsGallery");var Ue=/^https?:\/\/\S+$/i,Qe=/^[A-Z][A-Z0-9]*-C\d+$/,oe=/^[A-Z][A-Z0-9]*-\d+$/,Ze=/\b[A-Z][A-Z0-9]*-\d+\b/g;function V(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}o(V,"isPlainObject");function Ge(){return(0,e.jsx)("span",{className:"text-muted-foreground",children:"—"})}o(Ge,"EmptyValue");function ce(s){if(!s)return!1;const r=s.toLowerCase().replace(/[^a-z0-9]/g,"");return r.includes("issueidentifier")||r.includes("taskidentifier")}o(ce,"isIssueIdentifierField");function We(s,r){if(!ce(r))return typeof s=="string"&&oe.test(s.trim())?[s.trim()]:[];const i=[],a=o(n=>{if(typeof n=="string")for(const d of n.matchAll(Ze))i.push(d[0])},"add");return Array.isArray(s)?s.forEach(a):a(s),[...new Set(i)]}o(We,"extractIssueIdentifiers");function Je(s){const r=[],i=o((a,n,d)=>{if(V(a)){const t=Object.entries(a);if(t.length>0){t.forEach(([l,h])=>i(h,`${n}.${l}`,[...d,l]));return}}else if(Array.isArray(a)&&a.some(t=>typeof t=="object"&&t!==null)){a.length===1&&V(a[0])?i(a[0],n,[...d,0]):a.forEach((t,l)=>i(t,`${n}[${l}]`,[...d,l]));return}r.push({id:JSON.stringify(d),path:n,value:a})},"visit");return Object.entries(s).forEach(([a,n])=>i(n,a,[a])),r}o(Je,"flattenCaseFields");function U({value:s,fieldKey:r,quoted:i=!1}){const a=F(),n=s.trim(),d=i?JSON.stringify(s).slice(1,-1):s,t="text-primary underline-offset-2 hover:underline";let l=d;if(Ue.test(n))l=(0,e.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:t,children:d});else if(Qe.test(n))l=(0,e.jsx)(y,{to:a(n),className:t,children:d});else if(oe.test(n))l=(0,e.jsx)(y,{to:`/issues/${n}`,className:t,children:d});else if(ce(r)){const h=new Set(We(s,r));l=d.split(/(\b[A-Z][A-Z0-9]*-\d+\b)/g).map((x,p)=>h.has(x)?(0,e.jsx)(y,{to:`/issues/${x}`,className:t,children:x},p):x)}return i?(0,e.jsxs)(e.Fragment,{children:['"',l,'"']}):s===""?'""':l}o(U,"TableStringValue");function Ye({value:s,fieldKey:r}){return s==null?(0,e.jsx)(Ge,{}):typeof s=="string"?(0,e.jsx)(U,{value:s,fieldKey:r}):Array.isArray(s)?(0,e.jsxs)(e.Fragment,{children:["[",s.map((i,a)=>(0,e.jsxs)(g.Fragment,{children:[a>0?",":null,typeof i=="string"?(0,e.jsx)(U,{value:i,fieldKey:r,quoted:!0}):JSON.stringify(i)]},a)),"]"]}):typeof s=="object"?JSON.stringify(s):String(s)}o(Ye,"TableFieldValue");function Xe({fields:s}){const r=Je(s);return r.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No fields set"}):(0,e.jsx)("table",{"aria-label":"Case fields",className:j("w-full table-fixed border-collapse font-mono text-xs leading-5",ee),children:(0,e.jsx)("tbody",{children:r.map(({id:i,path:a,value:n})=>(0,e.jsxs)("tr",{className:"even:bg-muted/50",children:[(0,e.jsx)("th",{scope:"row",className:"w-1/3 break-all px-2 py-1 text-left align-top font-normal text-muted-foreground md:w-1/4",children:a}),(0,e.jsx)("td",{className:"break-all whitespace-pre-wrap px-2 py-1 align-top",children:(0,e.jsx)(Ye,{value:n,fieldKey:a})})]},i))})})}o(Xe,"CaseFieldsTable");function Q({value:s,label:r,className:i,containerClassName:a,truncate:n=!0,stopPropagation:d}){const[t,l]=(0,g.useState)(!1),h=(0,g.useRef)(void 0);(0,g.useEffect)(()=>()=>clearTimeout(h.current),[]);const x=(0,g.useCallback)(p=>{d&&(p.preventDefault(),p.stopPropagation()),Pe(s).then(()=>{l(!0),clearTimeout(h.current),h.current=setTimeout(()=>l(!1),1500)})},[d,s]);return(0,e.jsxs)("span",{className:j("relative inline-flex min-w-0 max-w-full",a),children:[(0,e.jsx)("button",{type:"button",className:j("min-w-0 cursor-copy text-left transition-colors hover:text-foreground",n?"truncate":"whitespace-normal break-all",i),title:s,"aria-label":`Copy ${r} ${s}`,onClick:x,children:s}),t?(0,e.jsxs)("span",{role:"status","aria-live":"polite",className:"pointer-events-none absolute bottom-full left-1/2 mb-1.5 inline-flex -translate-x-1/2 items-center gap-1 rounded-md bg-foreground px-2 py-1 text-xs whitespace-nowrap text-background",children:[(0,e.jsx)(ke,{className:"h-3 w-3 shrink-0"}),"Copied"]}):null]})}o(Q,"CaseCopyableToken");function es({identifier:s,caseKey:r,className:i,stopPropagation:a}){return(0,e.jsxs)("span",{className:j("inline-flex min-w-0 max-w-full items-center gap-2 whitespace-nowrap",i),"data-case-identity-group":"true",children:[(0,e.jsx)(Q,{value:s,label:"case ID",className:"shrink-0 font-mono text-xs text-muted-foreground",containerClassName:"shrink-0",stopPropagation:a}),r?(0,e.jsx)(Q,{value:r,label:"case key",className:"font-mono text-xs text-muted-foreground",stopPropagation:a}):null]})}o(es,"CaseIdentifierKey");function Z({revision:s}){const r=s.actorAgentName??(s.createdByAgentId?"Agent":s.createdByUserId?"User":"System");return(0,e.jsxs)("span",{className:"flex flex-wrap items-center gap-x-1 text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsx)("span",{children:r}),s.issue&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,e.jsx)("span",{children:"via"}),(0,e.jsx)(y,{to:`/issues/${s.issue.identifier}`,className:"font-mono text-foreground/80 hover:underline",onClick:o(i=>i.stopPropagation(),"onClick"),title:s.issue.title,children:s.issue.identifier})]})]})}o(Z,"RevisionByline");function G(s){const r=s.actorAgentName??(s.createdByAgentId?"agent":s.createdByUserId?"board":"system");return`rev ${s.revisionNumber} - ${O(s.createdAt)} - ${r}`}o(G,"getRevisionLabel");function ss({documentKey:s,revisions:r,latestRevisionNumber:i,open:a,onOpenChange:n}){const[d,t]=(0,g.useState)(null),[l,h]=(0,g.useState)(null),x=d??r.find(m=>m.revisionNumber===i-1)?.id??null,p=l??r.find(m=>m.revisionNumber===i)?.id??null,f=r.find(m=>m.id===x)??null,N=r.find(m=>m.id===p)??null,u=he(f?.body??"",N?.body??""),b={context:"bg-transparent",removed:"bg-red-500/10 text-red-900 dark:text-red-100",added:"bg-green-500/10 text-green-900 dark:text-green-100"},v={context:" ",removed:"-",added:"+"};return(0,e.jsx)(le,{open:a,onOpenChange:n,children:(0,e.jsxs)(ae,{className:"!max-w-(--pct-90) flex max-h-(--sz-85vh) w-full flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,e.jsx)(ne,{className:"min-w-0",children:(0,e.jsxs)(ie,{className:"break-words pr-6",children:["Diff - ",(0,e.jsx)("span",{className:"font-mono text-sm",children:s})]})}),(0,e.jsxs)("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2 lg:gap-4",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)("span",{className:"shrink-0 rounded-full border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-(--tracking-caps) text-red-400",children:"Old"}),(0,e.jsxs)(H,{value:x??"",onValueChange:t,children:[(0,e.jsx)(z,{"aria-label":"Old revision",className:"min-w-0 w-full border-border/60 data-[size=default]:h-11 md:w-60 md:text-xs md:data-[size=default]:h-9",children:(0,e.jsx)(K,{className:"min-w-0 truncate",placeholder:"Select revision"})}),(0,e.jsx)(M,{children:r.map(m=>(0,e.jsx)(P,{value:m.id,className:"text-xs",children:G(m)},m.id))})]})]}),(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)("span",{className:"shrink-0 rounded-full border border-green-500/30 bg-green-500/10 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-(--tracking-caps) text-green-400",children:"New"}),(0,e.jsxs)(H,{value:p??"",onValueChange:h,children:[(0,e.jsx)(z,{"aria-label":"New revision",className:"min-w-0 w-full border-border/60 data-[size=default]:h-11 md:w-60 md:text-xs md:data-[size=default]:h-9",children:(0,e.jsx)(K,{className:"min-w-0 truncate",placeholder:"Select revision"})}),(0,e.jsx)(M,{children:r.map(m=>(0,e.jsx)(P,{value:m.id,className:"text-xs",children:G(m)},m.id))})]})]})]})]}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border text-xs",children:!f||!N?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Select two revisions to compare."}):f.id===N.id?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Both sides are the same revision."}):(0,e.jsxs)("div",{className:"font-mono text-xs leading-6",children:[(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-1) border-b border-border/60 bg-muted/30 px-3 py-2 text-(length:--text-micro) uppercase tracking-(--tracking-caps) text-muted-foreground",children:[(0,e.jsx)("span",{children:"Old"}),(0,e.jsx)("span",{children:"New"}),(0,e.jsx)("span",{}),(0,e.jsx)("span",{children:"Content"})]}),u.map((m,C)=>(0,e.jsxs)("div",{className:j("grid grid-cols-(--gtc-1) gap-0 border-b border-border/30 px-3",b[m.kind]),children:[(0,e.jsx)("span",{className:"select-none border-r border-border/30 pr-3 text-right text-muted-foreground",children:m.oldLineNumber??""}),(0,e.jsx)("span",{className:"select-none border-r border-border/30 px-3 text-right text-muted-foreground",children:m.newLineNumber??""}),(0,e.jsx)("span",{className:"select-none px-3 text-center text-muted-foreground",children:v[m.kind]}),(0,e.jsx)("pre",{className:j("overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit",ee),children:m.text.length>0?m.text:" "})]},`${m.kind}-${C}-${m.oldLineNumber??"x"}-${m.newLineNumber??"x"}`))]})})]})})}o(ss,"CaseDocumentDiffModal");function ts({caseIdentifier:s,documentKey:r="body",taskId:i}){const a=k({queryKey:i?w.issues.documentRevisions(i,r):w.cases.revisions(s,r),queryFn:o(()=>i?re.listDocumentRevisions(i,r):I.listRevisions(s,r),"queryFn")}),n=$(a),d=a.data,t=Array.isArray(d)?d.map(u=>({...u,title:u.title??r,createdAt:new Date(u.createdAt).toISOString(),actorAgentName:null,createdByRunId:null,issue:null})):d?.revisions??[],[l,h]=(0,g.useState)(null),[x,p]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{t.length!==0&&(!l||!t.some(u=>u.id===l))&&h(t[0].id)},[t,l]),a.isLoading||n.kind==="reconnecting")return(0,e.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Loading revisions…"});if(n.kind==="error")return(0,e.jsx)("div",{className:"flex justify-center py-6",children:(0,e.jsx)(te,{size:"inline",error:a.error,action:"load revisions",onRetry:n.retry,retrying:n.isFetching})});if(t.length===0)return(0,e.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No revisions yet."});const f=t.find(u=>u.id===l)??t[0],N=(Array.isArray(d)?d[0]?.revisionNumber:d?.document.latestRevisionNumber)??f.revisionNumber;return(0,e.jsxs)("div",{className:"grid gap-4 md:grid-cols-(--gtc-case-revisions)",children:[(0,e.jsxs)("aside",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Revisions"}),t.length>1?(0,e.jsxs)(R,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:o(()=>p(!0),"onClick"),children:[(0,e.jsx)(pe,{className:"h-3.5 w-3.5"}),"Diff"]}):null]}),(0,e.jsx)("ol",{className:"space-y-1",children:t.map((u,b)=>(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:o(()=>h(u.id),"onClick"),"aria-current":u.id===f.id,className:j("w-full rounded-md border px-2.5 py-1.5 text-left transition-colors",u.id===f.id?"border-primary bg-primary/5":"border-border hover:bg-accent/50"),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"text-xs font-medium",children:["rev ",u.revisionNumber,b===0&&(0,e.jsx)("span",{className:"ml-1.5 rounded bg-muted px-1 py-0.5 text-(length:--text-nano) text-muted-foreground",children:"latest"})]}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-muted-foreground",children:O(u.createdAt)})]}),u.changeSummary&&(0,e.jsx)("p",{className:"mt-0.5 truncate text-(length:--text-micro) text-muted-foreground",title:u.changeSummary,children:u.changeSummary}),(0,e.jsx)(Z,{revision:u})]})},u.id))})]}),(0,e.jsxs)(ye,{className:"min-w-0 px-4 py-3",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-baseline justify-between border-b border-border pb-2",children:[(0,e.jsxs)("span",{className:"text-sm font-medium",children:["rev ",f.revisionNumber]}),(0,e.jsx)(Z,{revision:f})]}),f.body?(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:f.body}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This revision has no body."})]}),t.length>1?(0,e.jsx)(ss,{documentKey:r,revisions:t,latestRevisionNumber:N,open:x,onOpenChange:p}):null]})}o(ts,"CaseRevisionRail");function W({caseIdentifier:s,document:r}){const[i,a]=(0,g.useState)(!1),[n,d]=(0,g.useState)(!1),t="sourceKind"in r?r:null,l=k({queryKey:t?["issues","document",t.taskId,t.key]:["cases","document",s,r.key],queryFn:o(()=>t?re.getDocument(t.taskId,t.key):I.getDocument(s,r.key),"queryFn"),enabled:i}),h=$(l),x=l.data,p=x?.title??r.document.title??r.key;return(0,e.jsxs)(le,{open:i,onOpenChange:a,children:[(0,e.jsx)(Te,{asChild:!0,children:(0,e.jsxs)(R,{variant:"ghost","aria-label":r.document.title??r.key,className:"h-auto w-full justify-start gap-3 rounded-none px-0 py-3 text-left font-normal whitespace-normal",children:[(0,e.jsx)(L,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"min-w-0 flex-1",children:r.document.title??r.key}),t&&(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.taskIdentifier??"Task"})]})}),(0,e.jsxs)(ae,{className:"max-h-(--pct-80) overflow-y-auto sm:max-w-3xl",children:[(0,e.jsxs)(ne,{children:[(0,e.jsx)(ie,{children:p}),(0,e.jsxs)(He,{children:[t?(0,e.jsx)(y,{to:`/issues/${t.taskIdentifier??t.taskId}#document-${encodeURIComponent(t.key)}`,className:"hover:underline",children:t.taskIdentifier??"Task document"}):`${s} · Saved on case`,x?.latestRevisionNumber!=null?` · Revision ${x.latestRevisionNumber}`:""]})]}),l.isLoading?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading document…"}):h.kind==="error"?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"This document couldn’t be loaded."}):x?(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsx)(xe,{sourceTrust:x.sourceTrust,artifactLabel:"document"}),x.body?(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:x.body}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This document is empty."}),(0,e.jsxs)("details",{open:n,onToggle:o(f=>d(f.currentTarget.open),"onToggle"),className:"space-y-3",children:[(0,e.jsx)("summary",{className:"w-fit cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"Revision history"}),n&&(0,e.jsx)(ts,{caseIdentifier:s,documentKey:r.key,taskId:t?.taskId})]})]}):null]})]})}o(W,"CaseDocumentPreview");function J({id:s,name:r,fallback:i,agents:a}){return s?(0,e.jsx)(se,{agent:a?.get(s)??{id:s,name:r??"Agent"},size:"xs"}):(0,e.jsx)(ve,{name:r??i,size:"xs"})}o(J,"HandoffActor");function ns({caseId:s,task:r,agents:i}){const a=fe({queryKey:w.cases.handoffs(s),initialPageParam:null,queryFn:o(({pageParam:l})=>I.listHandoffs(s,l),"queryFn"),getNextPageParam:o(l=>l.nextCursor??void 0,"getNextPageParam")}),n=$(a),d=["loading","reconnecting"].includes(n.kind),t=a.data?.pages.flatMap(l=>l.items)??[];return(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case handoffs",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Handoffs"}),d?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading handoffs…"}):null,n.kind==="error"?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Handoffs couldn’t be loaded."}):null,!d&&n.kind!=="error"&&t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No handoffs yet."}):null,(0,e.jsx)("ol",{className:"divide-y divide-border",children:t.map(l=>(0,e.jsx)(rs,{handoff:l,task:r,agents:i},l.id))}),a.hasNextPage?(0,e.jsx)(R,{variant:"ghost",size:"sm",disabled:a.isFetchingNextPage,onClick:o(()=>{a.fetchNextPage()},"onClick"),children:"Load older handoffs"}):null]})}o(ns,"CaseHandoffHistory");function rs({handoff:s,task:r,agents:i}){const a=new Date(s.createdAt).toISOString(),n=s.destinationKind==="done",d=s.state==="delivered"||s.state==="completed",t=s.state==="cancelled"?s.assignmentAppliedAt?"Applied · delivery cancelled":"Cancelled before transfer":d?null:n?"Waiting for task completion":s.assignmentAppliedAt?"Applied · waiting for delivery":"Pending transfer",l=r?.id===s.issueId?r:null;return(0,e.jsx)("li",{children:(0,e.jsxs)("details",{className:"group",children:[(0,e.jsxs)("summary",{className:"flex cursor-pointer list-none items-start gap-2 rounded-sm py-3 marker:content-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)($e,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform duration-(--motion-duration-fast) group-open:rotate-90 motion-reduce:transition-none"}),(0,e.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,e.jsxs)("span",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,e.jsxs)("span",{className:"text-sm font-medium",children:[n?"Done":s.phase,t&&(0,e.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t})]}),(0,e.jsxs)("span",{className:"flex items-center gap-3",children:[l&&(0,e.jsx)(_,{issue:l,variant:"property"}),(0,e.jsx)("time",{dateTime:a,title:D(a),className:"font-mono text-xs text-muted-foreground",children:O(a)})]})]}),(0,e.jsxs)("span",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[(0,e.jsx)(J,{id:s.fromAgentId,name:s.fromAgentName,fallback:s.actorType==="user"?"User":"System",agents:i}),(0,e.jsx)(Ne,{"aria-hidden":!0,className:"size-3"}),n?(0,e.jsx)("span",{className:"text-xs",children:"Done"}):(0,e.jsx)(J,{id:s.toAgentId,name:s.toAgentName,fallback:"Agent",agents:i})]})]})]}),(0,e.jsxs)("div",{className:"space-y-2 pb-4 pl-6",children:[s.workflowTransition&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.workflowTransition.from.name??"Case instructions",s.workflowTransition.from.phase?` · ${s.workflowTransition.from.phase}`:""," → ",s.workflowTransition.to.name??"Case instructions"," · ",s.workflowTransition.to.phase]}),s.lastError&&!d&&s.state!=="cancelled"?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s.lastError}):null,(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:s.instructions})]})]})})}o(rs,"HandoffRow");function as({caseData:s,pendingHandoff:r,agents:i}){const a=s.workIssue,n=r===void 0?s.pendingHandoff:r,d=a?.assigneeAgentId?i?.get(a.assigneeAgentId)??{id:a.assigneeAgentId,name:a.assigneeAgentName??"Agent"}:null,t=n?.fromAgentId?i?.get(n.fromAgentId)?.name??n.fromAgentName??"the previous agent":"the previous agent",l=n?(n.toAgentId?i?.get(n.toAgentId)?.name:null)??n.toAgentName??"the receiving agent":null,h=n?.toAgentId?i?.get(n.toAgentId):null,x=n?.destinationKind==="done"?"Case will close when the task is complete.":n?.lastError??(n?.state==="awaiting_release"?`Waiting for ${t} to finish.`:h?.status==="paused"?`${l} is paused.`:`Waiting for ${l} to start.`);return(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case work",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Work"}),s.workIssueId?(0,e.jsxs)("div",{className:"space-y-3",children:[a?(0,e.jsxs)("div",{children:[(0,e.jsx)(A,{label:"Task",children:(0,e.jsx)(_,{issue:a,className:"min-h-11 md:min-h-0"})}),(0,e.jsx)(A,{label:"Workflow",children:(0,e.jsx)("span",{className:"text-sm",children:s.workflow?.name??"Case instructions"})}),s.phase&&(0,e.jsx)(A,{label:"Phase",children:(0,e.jsx)("span",{className:"text-sm",children:s.phase})}),(0,e.jsx)(A,{label:"Agent",children:d?(0,e.jsx)(se,{agent:d,size:"xs"}):(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Unassigned"})}),(0,e.jsx)(A,{label:"Task status",children:(0,e.jsx)(ge,{...Ie(a)})})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"The primary task is unavailable."}),n&&n.state!=="delivered"&&n.state!=="completed"&&n.state!=="cancelled"&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,e.jsx)(De,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[n.state==="awaiting_release"&&(0,e.jsxs)("p",{children:["Next: ",n.workflowTransition?.to.name??"Case instructions"," · ",n.phase]}),(0,e.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:x})]})]})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No task linked"})]})}o(as,"CaseWorkSummary");function Y({item:s,search:r}){const i=F();return(0,e.jsx)(Ke,{to:`${i(s.identifier)}${r}`,title:s.title,subtitle:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono",children:s.identifier}),(0,e.jsxs)("span",{children:[" · ",s.caseType]})]}),trailing:(0,e.jsx)(de,{status:s.status}),className:"px-0"})}o(Y,"CaseRelation");function us(){const{caseIdentifier:s}=Se(),{search:r}=_e(),i=F(),{setBreadcrumbs:a}=Re(),n=k({queryKey:w.cases.detail(s??""),queryFn:o(()=>I.get(s),"queryFn"),enabled:!!s}),d=$(n),t=n.data,l=`${i()}${r}`,h=k({queryKey:w.cases.children(t?.id??""),queryFn:o(()=>I.listChildren(t.companyId,t.id),"queryFn"),enabled:!!t}),x=k({queryKey:w.agents.list(t?.companyId??""),queryFn:o(()=>ze.list(t.companyId),"queryFn"),enabled:!!t?.workIssueId}),p=k({queryKey:w.projects.detail(t?.projectId??""),queryFn:o(()=>Ae.get(t.projectId,t.companyId),"queryFn"),enabled:!!t?.projectId}),f=(0,g.useMemo)(()=>new Map((x.data??[]).map(c=>[c.id,c])),[x.data]);if((0,g.useEffect)(()=>{a([{label:"Cases",href:l},{label:t?.identifier??s??"Case"}])},[a,l,t?.identifier,s]),!s)return(0,e.jsx)(Be,{to:l,replace:!0});if(n.isLoading||d.kind==="reconnecting")return(0,e.jsx)("div",{"data-testid":"case-pages",children:(0,e.jsx)(qe,{variant:"detail"})});if(d.kind==="error"||!t){const c=n.error instanceof Oe&&[403,404].includes(n.error.status);return(0,e.jsxs)("div",{"data-testid":"case-pages",className:"space-y-4",children:[c?(0,e.jsx)(Le,{icon:be,message:"Case not found"}):(0,e.jsx)(te,{size:"page",error:n.error,action:"load this case",onRetry:d.retry,retrying:d.isFetching}),(0,e.jsx)("div",{className:"flex justify-center gap-3",children:(0,e.jsx)(R,{variant:"link",asChild:!0,children:(0,e.jsx)(y,{to:l,children:"Back to cases"})})})]})}const N=new Set(t.documents.map(c=>c.key.toLowerCase())),u=t.taskDocuments??[],b=Object.entries(t.fields).filter(([c,B])=>!N.has(c.toLowerCase())&&!(c.toLowerCase()==="title"&&B===t.title)&&!(c.toLowerCase()==="description"&&B===t.summary)),v=t.issueLinks.filter(c=>c.issueId!==t.workIssueId),m=t.attachments.filter(T),C=t.attachments.filter(c=>!T(c)),S=h.data??[];return(0,e.jsxs)("div",{className:"mx-auto min-w-0 max-w-5xl space-y-8","data-testid":"case-pages",children:[(0,e.jsxs)("header",{className:"min-w-0 space-y-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[(0,e.jsx)(es,{identifier:t.identifier,caseKey:t.key}),(0,e.jsx)("span",{children:t.caseType}),(0,e.jsx)(de,{status:t.status})]}),(0,e.jsx)("h1",{className:"min-w-0 break-words wrap-anywhere text-2xl font-semibold tracking-tight",children:t.title}),t.summary&&(0,e.jsx)("p",{className:j("min-w-0 max-w-3xl break-words text-sm leading-relaxed text-muted-foreground","ph-mask ph-sensitive"),children:t.summary}),t.labels.length>0&&(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5","aria-label":"Case labels",children:t.labels.map(c=>(0,e.jsx)(we,{variant:"secondary",className:"font-normal",children:c.name},c.id))})]}),(0,e.jsxs)("div",{className:"min-w-0 space-y-8",children:[(0,e.jsx)(as,{caseData:t,agents:f}),b.length>0&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case details",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Details"}),(0,e.jsx)(Xe,{fields:Object.fromEntries(b)})]}),(t.documents.length>0||u.length>0)&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case documents",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Documents"}),(0,e.jsxs)("div",{className:"divide-y divide-border",children:[u.map(c=>(0,e.jsx)(W,{caseIdentifier:t.identifier,document:c},c.id)),t.documents.map(c=>(0,e.jsx)(W,{caseIdentifier:t.identifier,document:c},`case:${t.id}:${c.key}`))]}),t.taskDocumentsOmitted&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"More documents are available on the linked tasks."})]}),t.attachments.length>0&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case attachments",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Attachments"}),m.length>0&&(0,e.jsx)(Ve,{attachments:m}),C.length>0&&(0,e.jsx)("ul",{className:j("space-y-2","ph-mask ph-sensitive"),children:C.map(c=>(0,e.jsx)("li",{children:(0,e.jsxs)("a",{href:E(c),target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-center gap-2 text-sm text-primary hover:underline",children:[(0,e.jsx)(L,{"aria-hidden":!0,className:"size-4 shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:c.asset.originalFilename??"Download attachment"})]})},c.id))})]}),t.workIssueId&&(0,e.jsx)(ns,{caseId:t.id,task:t.workIssue,agents:f}),v.length>0&&(0,e.jsxs)("details",{className:"space-y-3",children:[(0,e.jsxs)("summary",{className:"w-fit cursor-pointer text-sm font-semibold",children:["Related tasks ",(0,e.jsx)("span",{className:"text-muted-foreground",children:v.length})]}),(0,e.jsx)("ul",{className:"space-y-2",children:v.map(c=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(_,{issue:c.issue}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:c.issue.title}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:c.role})]},c.id))})]}),(t.parent||S.length>0||h.isError)&&(0,e.jsxs)("details",{className:"space-y-3",children:[(0,e.jsx)("summary",{className:"w-fit cursor-pointer text-sm font-semibold",children:"Related cases"}),t.parent&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{className:"text-xs text-muted-foreground",children:"Parent"}),(0,e.jsx)(Y,{item:t.parent,search:r})]}),S.length>0&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("h3",{className:"text-xs text-muted-foreground",children:["Children ",S.length]}),S.map(c=>(0,e.jsx)(Y,{item:c,search:r},c.id))]}),Ee(h)==="error"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Child cases couldn’t be loaded."})]}),!b.length&&!t.documents.length&&!u.length&&!t.attachments.length&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No findings recorded yet."}),(0,e.jsxs)("dl",{className:"flex flex-wrap gap-x-6 gap-y-3 text-xs text-muted-foreground",children:[p.data&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Project"}),(0,e.jsx)("dd",{children:(0,e.jsx)(y,{to:`/projects/${p.data.id}`,className:"text-foreground hover:underline",children:p.data.name})})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Created"}),(0,e.jsx)("dd",{children:(0,e.jsx)("time",{dateTime:t.createdAt,className:"font-mono",children:D(t.createdAt,{includeYear:!1})})})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Updated"}),(0,e.jsx)("dd",{children:(0,e.jsx)("time",{dateTime:t.updatedAt,className:"font-mono",children:D(t.updatedAt,{includeYear:!1})})})]})]}),(0,e.jsx)(y,{to:Ce(t.id),className:"inline-block text-sm text-muted-foreground hover:text-foreground hover:underline",children:"View in Audit"})]})]})}o(us,"CaseDetail");export{us as CaseDetail};
|
|
1
|
+
var me=Object.defineProperty;var o=(s,r)=>me(s,"name",{value:r,configurable:!0});import{a as X}from"./rolldown-runtime-DhZMWcEn.js";import{D as T,E as I,I as _,K as xe,Nt as ue,R as he,T as E,_i as pe}from"./issue-detail-CZfjXs0M.js";import{C as fe,y as ge}from"./collections-B58p51lw.js";import{$A as je,$S as ee,$t as A,Ap as P,E_ as ye,GS as w,GT as Ne,Gb as y,Gw as be,H_ as we,Jb as F,Kr as se,MT as ke,Mb as ve,NE as R,Np as z,Op as H,Pp as K,S_ as Ae,Up as Ie,WE as D,Yw as L,_s as Ce,aE as Se,ab as te,fy as ne,hy as Te,iD as O,ib as Re,kT as $e,kp as M,lS as re,lb as Ee,ly as ae,mT as De,my as ie,nE as _e,nj as Fe,on as Le,pE as Oe,pb as qe,qb as Be,qp as Pe,rb as ze,sy as le,ub as $,uy as He,x as q,xE as k,zE as j}from"./index-BJtnP7H1.js";import{t as Ke}from"./EntityRow-BsICt6pd.js";import{n as de}from"./CaseStatus-BI0aMl9l.js";var g=X(Fe(),1),e=X(je(),1);function Me(s){return s<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(0)} KB`:`${(s/1048576).toFixed(1)} MB`}o(Me,"humanBytes");function Ve({attachments:s}){const[r,i]=(0,g.useState)(null),a=(0,g.useMemo)(()=>s.filter(T).map(n=>({id:n.id,contentPath:E(n),contentType:n.asset.contentType,originalFilename:n.asset.originalFilename})),[s]);return s.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No attachments."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4",children:s.map(n=>{const d=T(n),t=n.asset.originalFilename??"attachment",l=d?a.findIndex(h=>h.id===n.id):-1;return(0,e.jsxs)("button",{type:"button",onClick:o(()=>d&&l>=0&&i(l),"onClick"),disabled:!d,title:t,className:j("group relative flex aspect-square flex-col overflow-hidden rounded-lg border border-border bg-muted/40 text-left",d&&"cursor-pointer hover:border-primary/50"),children:[d?(0,e.jsx)("img",{src:E(n),alt:t,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-(--s-1_02)"}):(0,e.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-1 p-2 text-muted-foreground",children:[(0,e.jsx)(L,{className:"h-6 w-6","aria-hidden":!0}),(0,e.jsx)("span",{className:"w-full truncate text-center text-(length:--text-micro)",children:t})]}),(0,e.jsx)("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/60 to-transparent px-1.5 py-1 text-(length:--text-nano) text-white/90",children:Me(n.asset.byteSize)})]},n.id)})}),r!==null&&(0,e.jsx)(ue,{items:a,initialIndex:r,open:r!==null,onOpenChange:o(n=>!n&&i(null),"onOpenChange")})]})}o(Ve,"CaseAttachmentsGallery");var Ue=/^https?:\/\/\S+$/i,Qe=/^[A-Z][A-Z0-9]*-C\d+$/,oe=/^[A-Z][A-Z0-9]*-\d+$/,Ze=/\b[A-Z][A-Z0-9]*-\d+\b/g;function V(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}o(V,"isPlainObject");function Ge(){return(0,e.jsx)("span",{className:"text-muted-foreground",children:"—"})}o(Ge,"EmptyValue");function ce(s){if(!s)return!1;const r=s.toLowerCase().replace(/[^a-z0-9]/g,"");return r.includes("issueidentifier")||r.includes("taskidentifier")}o(ce,"isIssueIdentifierField");function We(s,r){if(!ce(r))return typeof s=="string"&&oe.test(s.trim())?[s.trim()]:[];const i=[],a=o(n=>{if(typeof n=="string")for(const d of n.matchAll(Ze))i.push(d[0])},"add");return Array.isArray(s)?s.forEach(a):a(s),[...new Set(i)]}o(We,"extractIssueIdentifiers");function Je(s){const r=[],i=o((a,n,d)=>{if(V(a)){const t=Object.entries(a);if(t.length>0){t.forEach(([l,h])=>i(h,`${n}.${l}`,[...d,l]));return}}else if(Array.isArray(a)&&a.some(t=>typeof t=="object"&&t!==null)){a.length===1&&V(a[0])?i(a[0],n,[...d,0]):a.forEach((t,l)=>i(t,`${n}[${l}]`,[...d,l]));return}r.push({id:JSON.stringify(d),path:n,value:a})},"visit");return Object.entries(s).forEach(([a,n])=>i(n,a,[a])),r}o(Je,"flattenCaseFields");function U({value:s,fieldKey:r,quoted:i=!1}){const a=F(),n=s.trim(),d=i?JSON.stringify(s).slice(1,-1):s,t="text-primary underline-offset-2 hover:underline";let l=d;if(Ue.test(n))l=(0,e.jsx)("a",{href:n,target:"_blank",rel:"noreferrer",className:t,children:d});else if(Qe.test(n))l=(0,e.jsx)(y,{to:a(n),className:t,children:d});else if(oe.test(n))l=(0,e.jsx)(y,{to:`/issues/${n}`,className:t,children:d});else if(ce(r)){const h=new Set(We(s,r));l=d.split(/(\b[A-Z][A-Z0-9]*-\d+\b)/g).map((x,p)=>h.has(x)?(0,e.jsx)(y,{to:`/issues/${x}`,className:t,children:x},p):x)}return i?(0,e.jsxs)(e.Fragment,{children:['"',l,'"']}):s===""?'""':l}o(U,"TableStringValue");function Ye({value:s,fieldKey:r}){return s==null?(0,e.jsx)(Ge,{}):typeof s=="string"?(0,e.jsx)(U,{value:s,fieldKey:r}):Array.isArray(s)?(0,e.jsxs)(e.Fragment,{children:["[",s.map((i,a)=>(0,e.jsxs)(g.Fragment,{children:[a>0?",":null,typeof i=="string"?(0,e.jsx)(U,{value:i,fieldKey:r,quoted:!0}):JSON.stringify(i)]},a)),"]"]}):typeof s=="object"?JSON.stringify(s):String(s)}o(Ye,"TableFieldValue");function Xe({fields:s}){const r=Je(s);return r.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No fields set"}):(0,e.jsx)("table",{"aria-label":"Case fields",className:j("w-full table-fixed border-collapse font-mono text-xs leading-5",ee),children:(0,e.jsx)("tbody",{children:r.map(({id:i,path:a,value:n})=>(0,e.jsxs)("tr",{className:"even:bg-muted/50",children:[(0,e.jsx)("th",{scope:"row",className:"w-1/3 break-all px-2 py-1 text-left align-top font-normal text-muted-foreground md:w-1/4",children:a}),(0,e.jsx)("td",{className:"break-all whitespace-pre-wrap px-2 py-1 align-top",children:(0,e.jsx)(Ye,{value:n,fieldKey:a})})]},i))})})}o(Xe,"CaseFieldsTable");function Q({value:s,label:r,className:i,containerClassName:a,truncate:n=!0,stopPropagation:d}){const[t,l]=(0,g.useState)(!1),h=(0,g.useRef)(void 0);(0,g.useEffect)(()=>()=>clearTimeout(h.current),[]);const x=(0,g.useCallback)(p=>{d&&(p.preventDefault(),p.stopPropagation()),Pe(s).then(()=>{l(!0),clearTimeout(h.current),h.current=setTimeout(()=>l(!1),1500)})},[d,s]);return(0,e.jsxs)("span",{className:j("relative inline-flex min-w-0 max-w-full",a),children:[(0,e.jsx)("button",{type:"button",className:j("min-w-0 cursor-copy text-left transition-colors hover:text-foreground",n?"truncate":"whitespace-normal break-all",i),title:s,"aria-label":`Copy ${r} ${s}`,onClick:x,children:s}),t?(0,e.jsxs)("span",{role:"status","aria-live":"polite",className:"pointer-events-none absolute bottom-full left-1/2 mb-1.5 inline-flex -translate-x-1/2 items-center gap-1 rounded-md bg-foreground px-2 py-1 text-xs whitespace-nowrap text-background",children:[(0,e.jsx)(ke,{className:"h-3 w-3 shrink-0"}),"Copied"]}):null]})}o(Q,"CaseCopyableToken");function es({identifier:s,caseKey:r,className:i,stopPropagation:a}){return(0,e.jsxs)("span",{className:j("inline-flex min-w-0 max-w-full items-center gap-2 whitespace-nowrap",i),"data-case-identity-group":"true",children:[(0,e.jsx)(Q,{value:s,label:"case ID",className:"shrink-0 font-mono text-xs text-muted-foreground",containerClassName:"shrink-0",stopPropagation:a}),r?(0,e.jsx)(Q,{value:r,label:"case key",className:"font-mono text-xs text-muted-foreground",stopPropagation:a}):null]})}o(es,"CaseIdentifierKey");function Z({revision:s}){const r=s.actorAgentName??(s.createdByAgentId?"Agent":s.createdByUserId?"User":"System");return(0,e.jsxs)("span",{className:"flex flex-wrap items-center gap-x-1 text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsx)("span",{children:r}),s.issue&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,e.jsx)("span",{children:"via"}),(0,e.jsx)(y,{to:`/issues/${s.issue.identifier}`,className:"font-mono text-foreground/80 hover:underline",onClick:o(i=>i.stopPropagation(),"onClick"),title:s.issue.title,children:s.issue.identifier})]})]})}o(Z,"RevisionByline");function G(s){const r=s.actorAgentName??(s.createdByAgentId?"agent":s.createdByUserId?"board":"system");return`rev ${s.revisionNumber} - ${O(s.createdAt)} - ${r}`}o(G,"getRevisionLabel");function ss({documentKey:s,revisions:r,latestRevisionNumber:i,open:a,onOpenChange:n}){const[d,t]=(0,g.useState)(null),[l,h]=(0,g.useState)(null),x=d??r.find(m=>m.revisionNumber===i-1)?.id??null,p=l??r.find(m=>m.revisionNumber===i)?.id??null,f=r.find(m=>m.id===x)??null,N=r.find(m=>m.id===p)??null,u=he(f?.body??"",N?.body??""),b={context:"bg-transparent",removed:"bg-red-500/10 text-red-900 dark:text-red-100",added:"bg-green-500/10 text-green-900 dark:text-green-100"},v={context:" ",removed:"-",added:"+"};return(0,e.jsx)(le,{open:a,onOpenChange:n,children:(0,e.jsxs)(ae,{className:"!max-w-(--pct-90) flex max-h-(--sz-85vh) w-full flex-col overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[(0,e.jsx)(ne,{className:"min-w-0",children:(0,e.jsxs)(ie,{className:"break-words pr-6",children:["Diff - ",(0,e.jsx)("span",{className:"font-mono text-sm",children:s})]})}),(0,e.jsxs)("div",{className:"grid min-w-0 gap-3 sm:grid-cols-2 lg:gap-4",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)("span",{className:"shrink-0 rounded-full border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-(--tracking-caps) text-red-400",children:"Old"}),(0,e.jsxs)(H,{value:x??"",onValueChange:t,children:[(0,e.jsx)(z,{"aria-label":"Old revision",className:"min-w-0 w-full border-border/60 data-[size=default]:h-11 md:w-60 md:text-xs md:data-[size=default]:h-9",children:(0,e.jsx)(K,{className:"min-w-0 truncate",placeholder:"Select revision"})}),(0,e.jsx)(M,{children:r.map(m=>(0,e.jsx)(P,{value:m.id,className:"text-xs",children:G(m)},m.id))})]})]}),(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)("span",{className:"shrink-0 rounded-full border border-green-500/30 bg-green-500/10 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-(--tracking-caps) text-green-400",children:"New"}),(0,e.jsxs)(H,{value:p??"",onValueChange:h,children:[(0,e.jsx)(z,{"aria-label":"New revision",className:"min-w-0 w-full border-border/60 data-[size=default]:h-11 md:w-60 md:text-xs md:data-[size=default]:h-9",children:(0,e.jsx)(K,{className:"min-w-0 truncate",placeholder:"Select revision"})}),(0,e.jsx)(M,{children:r.map(m=>(0,e.jsx)(P,{value:m.id,className:"text-xs",children:G(m)},m.id))})]})]})]})]}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border text-xs",children:!f||!N?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Select two revisions to compare."}):f.id===N.id?(0,e.jsx)("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Both sides are the same revision."}):(0,e.jsxs)("div",{className:"font-mono text-xs leading-6",children:[(0,e.jsxs)("div",{className:"grid grid-cols-(--gtc-1) border-b border-border/60 bg-muted/30 px-3 py-2 text-(length:--text-micro) uppercase tracking-(--tracking-caps) text-muted-foreground",children:[(0,e.jsx)("span",{children:"Old"}),(0,e.jsx)("span",{children:"New"}),(0,e.jsx)("span",{}),(0,e.jsx)("span",{children:"Content"})]}),u.map((m,C)=>(0,e.jsxs)("div",{className:j("grid grid-cols-(--gtc-1) gap-0 border-b border-border/30 px-3",b[m.kind]),children:[(0,e.jsx)("span",{className:"select-none border-r border-border/30 pr-3 text-right text-muted-foreground",children:m.oldLineNumber??""}),(0,e.jsx)("span",{className:"select-none border-r border-border/30 px-3 text-right text-muted-foreground",children:m.newLineNumber??""}),(0,e.jsx)("span",{className:"select-none px-3 text-center text-muted-foreground",children:v[m.kind]}),(0,e.jsx)("pre",{className:j("overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit",ee),children:m.text.length>0?m.text:" "})]},`${m.kind}-${C}-${m.oldLineNumber??"x"}-${m.newLineNumber??"x"}`))]})})]})})}o(ss,"CaseDocumentDiffModal");function ts({caseIdentifier:s,documentKey:r="body",taskId:i}){const a=k({queryKey:i?w.issues.documentRevisions(i,r):w.cases.revisions(s,r),queryFn:o(()=>i?re.listDocumentRevisions(i,r):I.listRevisions(s,r),"queryFn")}),n=$(a),d=a.data,t=Array.isArray(d)?d.map(u=>({...u,title:u.title??r,createdAt:new Date(u.createdAt).toISOString(),actorAgentName:null,createdByRunId:null,issue:null})):d?.revisions??[],[l,h]=(0,g.useState)(null),[x,p]=(0,g.useState)(!1);if((0,g.useEffect)(()=>{t.length!==0&&(!l||!t.some(u=>u.id===l))&&h(t[0].id)},[t,l]),a.isLoading||n.kind==="reconnecting")return(0,e.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"Loading revisions…"});if(n.kind==="error")return(0,e.jsx)("div",{className:"flex justify-center py-6",children:(0,e.jsx)(te,{size:"inline",error:a.error,action:"load revisions",onRetry:n.retry,retrying:n.isFetching})});if(t.length===0)return(0,e.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No revisions yet."});const f=t.find(u=>u.id===l)??t[0],N=(Array.isArray(d)?d[0]?.revisionNumber:d?.document.latestRevisionNumber)??f.revisionNumber;return(0,e.jsxs)("div",{className:"grid gap-4 md:grid-cols-(--gtc-case-revisions)",children:[(0,e.jsxs)("aside",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Revisions"}),t.length>1?(0,e.jsxs)(R,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs",onClick:o(()=>p(!0),"onClick"),children:[(0,e.jsx)(pe,{className:"h-3.5 w-3.5"}),"Diff"]}):null]}),(0,e.jsx)("ol",{className:"space-y-1",children:t.map((u,b)=>(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:o(()=>h(u.id),"onClick"),"aria-current":u.id===f.id,className:j("w-full rounded-md border px-2.5 py-1.5 text-left transition-colors",u.id===f.id?"border-primary bg-primary/5":"border-border hover:bg-accent/50"),children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"text-xs font-medium",children:["rev ",u.revisionNumber,b===0&&(0,e.jsx)("span",{className:"ml-1.5 rounded bg-muted px-1 py-0.5 text-(length:--text-nano) text-muted-foreground",children:"latest"})]}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-muted-foreground",children:O(u.createdAt)})]}),u.changeSummary&&(0,e.jsx)("p",{className:"mt-0.5 truncate text-(length:--text-micro) text-muted-foreground",title:u.changeSummary,children:u.changeSummary}),(0,e.jsx)(Z,{revision:u})]})},u.id))})]}),(0,e.jsxs)(ye,{className:"min-w-0 px-4 py-3",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-baseline justify-between border-b border-border pb-2",children:[(0,e.jsxs)("span",{className:"text-sm font-medium",children:["rev ",f.revisionNumber]}),(0,e.jsx)(Z,{revision:f})]}),f.body?(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:f.body}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This revision has no body."})]}),t.length>1?(0,e.jsx)(ss,{documentKey:r,revisions:t,latestRevisionNumber:N,open:x,onOpenChange:p}):null]})}o(ts,"CaseRevisionRail");function W({caseIdentifier:s,document:r}){const[i,a]=(0,g.useState)(!1),[n,d]=(0,g.useState)(!1),t="sourceKind"in r?r:null,l=k({queryKey:t?["issues","document",t.taskId,t.key]:["cases","document",s,r.key],queryFn:o(()=>t?re.getDocument(t.taskId,t.key):I.getDocument(s,r.key),"queryFn"),enabled:i}),h=$(l),x=l.data,p=x?.title??r.document.title??r.key;return(0,e.jsxs)(le,{open:i,onOpenChange:a,children:[(0,e.jsx)(Te,{asChild:!0,children:(0,e.jsxs)(R,{variant:"ghost","aria-label":r.document.title??r.key,className:"h-auto w-full justify-start gap-3 rounded-none px-0 py-3 text-left font-normal whitespace-normal",children:[(0,e.jsx)(L,{"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"min-w-0 flex-1",children:r.document.title??r.key}),t&&(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:t.taskIdentifier??"Task"})]})}),(0,e.jsxs)(ae,{className:"max-h-(--pct-80) overflow-y-auto sm:max-w-3xl",children:[(0,e.jsxs)(ne,{children:[(0,e.jsx)(ie,{children:p}),(0,e.jsxs)(He,{children:[t?(0,e.jsx)(y,{to:`/issues/${t.taskIdentifier??t.taskId}#document-${encodeURIComponent(t.key)}`,className:"hover:underline",children:t.taskIdentifier??"Task document"}):`${s} · Saved on case`,x?.latestRevisionNumber!=null?` · Revision ${x.latestRevisionNumber}`:""]})]}),l.isLoading?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading document…"}):h.kind==="error"?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"This document couldn’t be loaded."}):x?(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsx)(xe,{sourceTrust:x.sourceTrust,artifactLabel:"document"}),x.body?(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:x.body}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This document is empty."}),(0,e.jsxs)("details",{open:n,onToggle:o(f=>d(f.currentTarget.open),"onToggle"),className:"space-y-3",children:[(0,e.jsx)("summary",{className:"w-fit cursor-pointer text-sm text-muted-foreground hover:text-foreground",children:"Revision history"}),n&&(0,e.jsx)(ts,{caseIdentifier:s,documentKey:r.key,taskId:t?.taskId})]})]}):null]})]})}o(W,"CaseDocumentPreview");function J({id:s,name:r,fallback:i,agents:a}){return s?(0,e.jsx)(se,{agent:a?.get(s)??{id:s,name:r??"Agent"},size:"xs"}):(0,e.jsx)(ve,{name:r??i,size:"xs"})}o(J,"HandoffActor");function ns({caseId:s,task:r,agents:i}){const a=fe({queryKey:w.cases.handoffs(s),initialPageParam:null,queryFn:o(({pageParam:l})=>I.listHandoffs(s,l),"queryFn"),getNextPageParam:o(l=>l.nextCursor??void 0,"getNextPageParam")}),n=$(a),d=["loading","reconnecting"].includes(n.kind),t=a.data?.pages.flatMap(l=>l.items)??[];return(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case handoffs",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Handoffs"}),d?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading handoffs…"}):null,n.kind==="error"?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Handoffs couldn’t be loaded."}):null,!d&&n.kind!=="error"&&t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No handoffs yet."}):null,(0,e.jsx)("ol",{className:"divide-y divide-border",children:t.map(l=>(0,e.jsx)(rs,{handoff:l,task:r,agents:i},l.id))}),a.hasNextPage?(0,e.jsx)(R,{variant:"ghost",size:"sm",disabled:a.isFetchingNextPage,onClick:o(()=>{a.fetchNextPage()},"onClick"),children:"Load older handoffs"}):null]})}o(ns,"CaseHandoffHistory");function rs({handoff:s,task:r,agents:i}){const a=new Date(s.createdAt).toISOString(),n=s.destinationKind==="done",d=s.state==="delivered"||s.state==="completed",t=s.state==="cancelled"?s.assignmentAppliedAt?"Applied · delivery cancelled":"Cancelled before transfer":d?null:n?"Waiting for task completion":s.assignmentAppliedAt?"Applied · waiting for delivery":"Pending transfer",l=r?.id===s.issueId?r:null;return(0,e.jsx)("li",{children:(0,e.jsxs)("details",{className:"group",children:[(0,e.jsxs)("summary",{className:"flex cursor-pointer list-none items-start gap-2 rounded-sm py-3 marker:content-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)($e,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform duration-(--motion-duration-fast) group-open:rotate-90 motion-reduce:transition-none"}),(0,e.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,e.jsxs)("span",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,e.jsxs)("span",{className:"text-sm font-medium",children:[n?"Done":s.phase,t&&(0,e.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t})]}),(0,e.jsxs)("span",{className:"flex items-center gap-3",children:[l&&(0,e.jsx)(_,{issue:l,variant:"property"}),(0,e.jsx)("time",{dateTime:a,title:D(a),className:"font-mono text-xs text-muted-foreground",children:O(a)})]})]}),(0,e.jsxs)("span",{className:"flex flex-wrap items-center gap-2 text-muted-foreground",children:[(0,e.jsx)(J,{id:s.fromAgentId,name:s.fromAgentName,fallback:s.actorType==="user"?"User":"System",agents:i}),(0,e.jsx)(Ne,{"aria-hidden":!0,className:"size-3"}),n?(0,e.jsx)("span",{className:"text-xs",children:"Done"}):(0,e.jsx)(J,{id:s.toAgentId,name:s.toAgentName,fallback:"Agent",agents:i})]})]})]}),(0,e.jsxs)("div",{className:"space-y-2 pb-4 pl-6",children:[s.workflowTransition&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.workflowTransition.from.name??"Case instructions",s.workflowTransition.from.phase?` · ${s.workflowTransition.from.phase}`:""," → ",s.workflowTransition.to.name??"Case instructions"," · ",s.workflowTransition.to.phase]}),s.lastError&&!d&&s.state!=="cancelled"?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:s.lastError}):null,(0,e.jsx)(q,{linkIssueReferences:!0,linkCaseReferences:!0,children:s.instructions})]})]})})}o(rs,"HandoffRow");function as({caseData:s,pendingHandoff:r,agents:i}){const a=s.workIssue,n=r===void 0?s.pendingHandoff:r,d=a?.assigneeAgentId?i?.get(a.assigneeAgentId)??{id:a.assigneeAgentId,name:a.assigneeAgentName??"Agent"}:null,t=n?.fromAgentId?i?.get(n.fromAgentId)?.name??n.fromAgentName??"the previous agent":"the previous agent",l=n?(n.toAgentId?i?.get(n.toAgentId)?.name:null)??n.toAgentName??"the receiving agent":null,h=n?.toAgentId?i?.get(n.toAgentId):null,x=n?.destinationKind==="done"?"Case will close when the task is complete.":n?.lastError??(n?.state==="awaiting_release"?`Waiting for ${t} to finish.`:h?.status==="paused"?`${l} is paused.`:`Waiting for ${l} to start.`);return(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case work",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Work"}),s.workIssueId?(0,e.jsxs)("div",{className:"space-y-3",children:[a?(0,e.jsxs)("div",{children:[(0,e.jsx)(A,{label:"Task",children:(0,e.jsx)(_,{issue:a,className:"min-h-11 md:min-h-0"})}),(0,e.jsx)(A,{label:"Workflow",children:(0,e.jsx)("span",{className:"text-sm",children:s.workflow?.name??"Case instructions"})}),s.phase&&(0,e.jsx)(A,{label:"Phase",children:(0,e.jsx)("span",{className:"text-sm",children:s.phase})}),(0,e.jsx)(A,{label:"Agent",children:d?(0,e.jsx)(se,{agent:d,size:"xs"}):(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"Unassigned"})}),(0,e.jsx)(A,{label:"Task status",children:(0,e.jsx)(ge,{...Ie(a)})})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"The primary task is unavailable."}),n&&n.state!=="delivered"&&n.state!=="completed"&&n.state!=="cancelled"&&(0,e.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[(0,e.jsx)(De,{"aria-hidden":!0,className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[n.state==="awaiting_release"&&(0,e.jsxs)("p",{children:["Next: ",n.workflowTransition?.to.name??"Case instructions"," · ",n.phase]}),(0,e.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:x})]})]})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No task linked"})]})}o(as,"CaseWorkSummary");function Y({item:s,search:r}){const i=F();return(0,e.jsx)(Ke,{to:`${i(s.identifier)}${r}`,title:s.title,subtitle:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono",children:s.identifier}),(0,e.jsxs)("span",{children:[" · ",s.caseType]})]}),trailing:(0,e.jsx)(de,{status:s.status}),className:"px-0"})}o(Y,"CaseRelation");function us(){const{caseIdentifier:s}=Se(),{search:r}=_e(),i=F(),{setBreadcrumbs:a}=Re(),n=k({queryKey:w.cases.detail(s??""),queryFn:o(()=>I.get(s),"queryFn"),enabled:!!s}),d=$(n),t=n.data,l=`${i()}${r}`,h=k({queryKey:w.cases.children(t?.id??""),queryFn:o(()=>I.listChildren(t.companyId,t.id),"queryFn"),enabled:!!t}),x=k({queryKey:w.agents.list(t?.companyId??""),queryFn:o(()=>ze.list(t.companyId),"queryFn"),enabled:!!t?.workIssueId}),p=k({queryKey:w.projects.detail(t?.projectId??""),queryFn:o(()=>Ae.get(t.projectId,t.companyId),"queryFn"),enabled:!!t?.projectId}),f=(0,g.useMemo)(()=>new Map((x.data??[]).map(c=>[c.id,c])),[x.data]);if((0,g.useEffect)(()=>{a([{label:"Cases",href:l},{label:t?.identifier??s??"Case"}])},[a,l,t?.identifier,s]),!s)return(0,e.jsx)(Be,{to:l,replace:!0});if(n.isLoading||d.kind==="reconnecting")return(0,e.jsx)("div",{"data-testid":"case-pages",children:(0,e.jsx)(qe,{variant:"detail"})});if(d.kind==="error"||!t){const c=n.error instanceof Oe&&[403,404].includes(n.error.status);return(0,e.jsxs)("div",{"data-testid":"case-pages",className:"space-y-4",children:[c?(0,e.jsx)(Le,{icon:be,message:"Case not found"}):(0,e.jsx)(te,{size:"page",error:n.error,action:"load this case",onRetry:d.retry,retrying:d.isFetching}),(0,e.jsx)("div",{className:"flex justify-center gap-3",children:(0,e.jsx)(R,{variant:"link",asChild:!0,children:(0,e.jsx)(y,{to:l,children:"Back to cases"})})})]})}const N=new Set(t.documents.map(c=>c.key.toLowerCase())),u=t.taskDocuments??[],b=Object.entries(t.fields).filter(([c,B])=>!N.has(c.toLowerCase())&&!(c.toLowerCase()==="title"&&B===t.title)&&!(c.toLowerCase()==="description"&&B===t.summary)),v=t.issueLinks.filter(c=>c.issueId!==t.workIssueId),m=t.attachments.filter(T),C=t.attachments.filter(c=>!T(c)),S=h.data??[];return(0,e.jsxs)("div",{className:"mx-auto min-w-0 max-w-5xl space-y-8","data-testid":"case-pages",children:[(0,e.jsxs)("header",{className:"min-w-0 space-y-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[(0,e.jsx)(es,{identifier:t.identifier,caseKey:t.key}),(0,e.jsx)("span",{children:t.caseType}),(0,e.jsx)(de,{status:t.status})]}),(0,e.jsx)("h1",{className:"min-w-0 break-words wrap-anywhere text-2xl font-semibold tracking-tight",children:t.title}),t.summary&&(0,e.jsx)("p",{className:j("min-w-0 max-w-3xl break-words text-sm leading-relaxed text-muted-foreground","ph-mask ph-sensitive"),children:t.summary}),t.labels.length>0&&(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5","aria-label":"Case labels",children:t.labels.map(c=>(0,e.jsx)(we,{variant:"secondary",className:"font-normal",children:c.name},c.id))})]}),(0,e.jsxs)("div",{className:"min-w-0 space-y-8",children:[(0,e.jsx)(as,{caseData:t,agents:f}),b.length>0&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case details",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Details"}),(0,e.jsx)(Xe,{fields:Object.fromEntries(b)})]}),(t.documents.length>0||u.length>0)&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case documents",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Documents"}),(0,e.jsxs)("div",{className:"divide-y divide-border",children:[u.map(c=>(0,e.jsx)(W,{caseIdentifier:t.identifier,document:c},c.id)),t.documents.map(c=>(0,e.jsx)(W,{caseIdentifier:t.identifier,document:c},`case:${t.id}:${c.key}`))]}),t.taskDocumentsOmitted&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"More documents are available on the linked tasks."})]}),t.attachments.length>0&&(0,e.jsxs)("section",{className:"space-y-3","aria-label":"Case attachments",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Attachments"}),m.length>0&&(0,e.jsx)(Ve,{attachments:m}),C.length>0&&(0,e.jsx)("ul",{className:j("space-y-2","ph-mask ph-sensitive"),children:C.map(c=>(0,e.jsx)("li",{children:(0,e.jsxs)("a",{href:E(c),target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full items-center gap-2 text-sm text-primary hover:underline",children:[(0,e.jsx)(L,{"aria-hidden":!0,className:"size-4 shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:c.asset.originalFilename??"Download attachment"})]})},c.id))})]}),t.workIssueId&&(0,e.jsx)(ns,{caseId:t.id,task:t.workIssue,agents:f}),v.length>0&&(0,e.jsxs)("details",{className:"space-y-3",children:[(0,e.jsxs)("summary",{className:"w-fit cursor-pointer text-sm font-semibold",children:["Related tasks ",(0,e.jsx)("span",{className:"text-muted-foreground",children:v.length})]}),(0,e.jsx)("ul",{className:"space-y-2",children:v.map(c=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(_,{issue:c.issue}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:c.issue.title}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:c.role})]},c.id))})]}),(t.parent||S.length>0||h.isError)&&(0,e.jsxs)("details",{className:"space-y-3",children:[(0,e.jsx)("summary",{className:"w-fit cursor-pointer text-sm font-semibold",children:"Related cases"}),t.parent&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{className:"text-xs text-muted-foreground",children:"Parent"}),(0,e.jsx)(Y,{item:t.parent,search:r})]}),S.length>0&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("h3",{className:"text-xs text-muted-foreground",children:["Children ",S.length]}),S.map(c=>(0,e.jsx)(Y,{item:c,search:r},c.id))]}),Ee(h)==="error"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Child cases couldn’t be loaded."})]}),!b.length&&!t.documents.length&&!u.length&&!t.attachments.length&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No findings recorded yet."}),(0,e.jsxs)("dl",{className:"flex flex-wrap gap-x-6 gap-y-3 text-xs text-muted-foreground",children:[p.data&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Project"}),(0,e.jsx)("dd",{children:(0,e.jsx)(y,{to:`/projects/${p.data.id}`,className:"text-foreground hover:underline",children:p.data.name})})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Created"}),(0,e.jsx)("dd",{children:(0,e.jsx)("time",{dateTime:t.createdAt,className:"font-mono",children:D(t.createdAt,{includeYear:!1})})})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{children:"Updated"}),(0,e.jsx)("dd",{children:(0,e.jsx)("time",{dateTime:t.updatedAt,className:"font-mono",children:D(t.updatedAt,{includeYear:!1})})})]})]}),(0,e.jsx)(y,{to:Ce(t.id),className:"inline-block text-sm text-muted-foreground hover:text-foreground hover:underline",children:"View in Audit"})]})]})}o(us,"CaseDetail");export{us as CaseDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=Object.defineProperty;var a=(r,e)=>o(r,"name",{value:e,configurable:!0});import{a as t}from"./rolldown-runtime-DhZMWcEn.js";import{b as n}from"./collections-
|
|
1
|
+
var o=Object.defineProperty;var a=(r,e)=>o(r,"name",{value:e,configurable:!0});import{a as t}from"./rolldown-runtime-DhZMWcEn.js";import{b as n}from"./collections-B58p51lw.js";import{$A as s}from"./index-BJtnP7H1.js";var i=t(s(),1),p={draft:"Draft",in_progress:"In progress",in_review:"In review",approved:"Approved",done:"Done",cancelled:"Cancelled"};function f({status:r,className:e}){return(0,i.jsx)(n,{status:r,label:p[r],className:e})}a(f,"CaseStatus");export{f as n,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var ue=Object.defineProperty;var r=(t,h)=>ue(t,"name",{value:h,configurable:!0});import{a as ie}from"./rolldown-runtime-DhZMWcEn.js";import{E as X,w as Y}from"./issue-detail-4PCbYpdv.js";import{$A as pe,Cx as M,Ev as he,Ex as U,GS as ee,Gw as se,IC as te,Jb as me,Kr as xe,LS as ge,MT as je,NE as b,Tw as fe,Tx as O,Uw as ye,WE as be,WT as ve,__ as we,_v as Ne,an as Ce,hv as Se,iD as ke,ib as Ae,jp as Te,mb as Pe,mv as Ee,nj as Ie,oE as _e,on as ae,pv as Fe,uT as Le,ub as $,vt as qe,vv as ze,xE as R,x_ as Be,xv as re,zE as P}from"./index-Bt31d8ga.js";import{t as Me}from"./EntityRow-gpsOgEtu.js";import{n as Ue,t as ne}from"./CaseStatus-B3RiZVDH.js";var G=ie(Ie(),1),V=[["identifier","Identifier"],["type","Type"],["project","Project"],["phase","Phase"],["assignee","Agent"],["status","Status"],["updated","Updated"]],E=["identifier","type","project","phase","assignee","status"],oe=[["updated","Updated"],["created","Created"],["title","Title"],["status","Status"],["type","Type"]],le=[["none","None"],["status","Status"],["type","Type"],["project","Project"]];function Oe(t){const h=t.get("sort"),o=t.get("group"),x=t.get("columns");return{columns:x===null?E:V.map(([l])=>l).filter(l=>x.split(",").includes(l)),sortField:oe.find(([l])=>l===h)?.[0]??"updated",sortDir:t.get("dir")==="asc"?"asc":"desc",groupBy:le.find(([l])=>l===o)?.[0]??"none"}}r(Oe,"caseListView");var e=ie(pe(),1);function $e({caseData:t,projectName:h,search:o="",columns:x=E}){const l=me(),m=t.workIssue,a=new Set(x),g=a.has("phase")||a.has("assignee"),f=m?.assigneeAgentId?{id:m.assigneeAgentId,name:m.assigneeAgentName??"Agent"}:null,n=m?(0,e.jsxs)(e.Fragment,{children:[a.has("phase")&&t.phase?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.phase}):null,a.has("assignee")&&(f?(0,e.jsx)(xe,{agent:f,size:"xs"}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Unassigned"}))]}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.workIssueId?"Task unavailable":"No task linked"}),c=[a.has("identifier")?t.identifier:null,a.has("type")?t.caseType:null,a.has("project")?h:null].filter(Boolean);return(0,e.jsx)(Me,{to:`${l(t.identifier)}${o}`,title:t.title,titleTextClassName:"line-clamp-2 font-medium sm:line-clamp-1",subtitle:c.length?c.map((j,p)=>(0,e.jsxs)("span",{className:j===t.identifier?"font-mono":void 0,children:[p>0?" · ":"",j]},p)):void 0,className:"px-3 py-3",trailing:g||a.has("status")||a.has("updated")?(0,e.jsxs)(e.Fragment,{children:[g&&(0,e.jsx)("div",{className:"hidden w-44 flex-col gap-1 lg:flex",children:n}),a.has("status")&&(0,e.jsx)("div",{className:"flex w-24 justify-end",children:(0,e.jsx)(Ue,{status:t.status})}),a.has("updated")&&(0,e.jsx)("time",{dateTime:t.updatedAt,title:be(t.updatedAt),className:"hidden font-mono text-xs text-muted-foreground sm:block",children:ke(t.updatedAt)})]}):void 0,secondaryRow:g?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:n}):void 0,secondaryRowClassName:"pl-0 lg:hidden"})}r($e,"CaseListRow");function Re({filters:t,activeFilterCount:h,columns:o,onColumnsChange:x,sortField:l,sortDir:m,onSortChange:a,groupBy:g,onGroupChange:f}){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Fe,{children:[(0,e.jsx)(he,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:"h-8 w-8 shrink-0","aria-label":"Columns",title:"Columns",children:(0,e.jsx)(Le,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(Se,{align:"end",className:"w-48",children:[(0,e.jsx)(ze,{children:"Visible fields"}),(0,e.jsx)(re,{}),V.map(([n,c])=>(0,e.jsx)(Ee,{checked:o.includes(n),onSelect:r(j=>j.preventDefault(),"onSelect"),onCheckedChange:r(j=>x(V.map(([p])=>p).filter(p=>p===n?j===!0:o.includes(p))),"onCheckedChange"),children:c},n)),(0,e.jsx)(re,{}),(0,e.jsx)(Ne,{onSelect:r(()=>x(E),"onSelect"),children:"Reset defaults"})]})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsxs)(b,{variant:"outline",size:"icon",className:P("relative h-8 w-8 shrink-0",h>0&&"text-(--collection-filter-active)"),"aria-label":h?`Filter cases (${h} active)`:"Filter cases",title:"Filter",children:[(0,e.jsx)(ye,{"aria-hidden":!0,className:"h-3.5 w-3.5"}),h>0&&(0,e.jsx)("span",{"aria-hidden":!0,className:"absolute -right-1 -top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-(--collection-filter-badge) text-(length:--text-nano) font-bold text-(--collection-filter-badge-foreground)",children:h})]})}),(0,e.jsxs)(O,{align:"end",className:"w-64 space-y-3","aria-label":"Case filters",children:[(0,e.jsx)("h2",{className:"text-sm font-medium",children:"Filters"}),t]})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:"h-8 w-8 shrink-0","aria-label":"Sort",title:"Sort",children:(0,e.jsx)(ve,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsx)(O,{align:"end",className:"w-48 p-2","aria-label":"Sort cases",children:oe.map(([n,c])=>(0,e.jsxs)("button",{type:"button","aria-pressed":l===n,className:P("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",l===n?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:r(()=>a(n,l===n&&m==="asc"?"desc":"asc"),"onClick"),children:[(0,e.jsx)("span",{children:c}),l===n&&(0,e.jsx)("span",{"aria-label":m==="asc"?"Ascending":"Descending",className:"text-xs text-muted-foreground",children:m==="asc"?"↑":"↓"})]},n))})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:P("h-8 w-8 shrink-0",g!=="none"&&"bg-accent"),"aria-label":"Group",title:"Group",children:(0,e.jsx)(fe,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsx)(O,{align:"end",className:"w-44 p-2","aria-label":"Group cases",children:le.map(([n,c])=>(0,e.jsxs)("button",{type:"button","aria-pressed":g===n,className:P("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",g===n?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:r(()=>f(n),"onClick"),children:[(0,e.jsx)("span",{children:c}),g===n&&(0,e.jsx)(je,{"aria-hidden":!0,className:"h-3.5 w-3.5"})]},n))})]})]})}r(Re,"CaseListControls");var Q=50,u="all";function D({label:t,value:h,options:o,onChange:x,disabled:l}){return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t}),(0,e.jsx)(Te,{"aria-label":`Filter by ${t.toLowerCase()}`,value:h,options:o,onValueChange:x,disabled:l,className:"text-sm data-[size=default]:h-9"})]})}r(D,"CaseFilter");function He(){const{selectedCompanyId:t}=ge(),{setBreadcrumbs:h}=Ae(),[o,x]=_e(),l=(0,G.useRef)(o);(0,G.useLayoutEffect)(()=>{l.current=o},[o]);const m=o.get("q")??"",a=Oe(o),g=o.get("status")??u,f=Y.includes(g)?g:u,n=o.get("type")||u,c=o.get("project")||u,j=Number(o.get("page")??1),p=Number.isSafeInteger(j)&&j>0&&j<=2001?j:1,I=(p-1)*Q,N=m!==""||f!==u||n!==u||c!==u,ce=[f,n,c].filter(s=>s!==u).length,K={q:m.trim()||void 0,status:f===u?void 0:f,type:n===u?void 0:n,projectId:c===u||c==="none"?void 0:c,includeNoProject:c==="none"||void 0,limit:51,offset:I,...a.sortField!=="updated"?{sortField:a.sortField}:{},...a.sortDir!=="desc"?{sortDir:a.sortDir}:{},...a.groupBy!=="none"?{groupBy:a.groupBy}:{}};(0,G.useEffect)(()=>h([{label:"Cases"}]),[h]);const y=R({queryKey:[...ee.cases.list(t??""),K],queryFn:r(()=>X.list(t,K),"queryFn"),enabled:!!t,placeholderData:r((s,i)=>i?.queryKey[1]===t?s:void 0,"placeholderData")}),_=$(y),W=["loading","reconnecting"].includes(_.kind),C=R({queryKey:[...ee.cases.list(t??""),"types"],queryFn:r(()=>X.listTypes(t),"queryFn"),enabled:!!t}),F=$(C),w=R({...Be(t??"",{includeArchived:!0}),enabled:!!t}),L=$(w),v=(y.data??[]).slice(0,Q),S=(y.data?.length??0)>Q,q=new Map((w.data??[]).map(s=>[s.id,s.name])),de=[...new Set([...C.data??[],...n!==u?[n]:[]])].sort(),k=new Map;for(const s of v){const i=a.groupBy==="status"?s.status:a.groupBy==="type"?s.caseType:a.groupBy==="project"?s.projectId??"none":u,d=a.groupBy==="status"?ne[s.status]:a.groupBy==="project"?s.projectId?q.get(s.projectId)??"Project unavailable":"No project":i;k.has(i)||k.set(i,{label:d,records:[]}),k.get(i).records.push(s)}const z=r((s,i=!1)=>{const d=new URLSearchParams(l.current);s(d),l.current=d,x(d,{replace:i})},"updateParams"),A=r((s,i)=>{z(d=>{!i||s!=="q"&&i===u?d.delete(s):d.set(s,i),d.delete("page")},!0)},"setFilter"),B=r(s=>{z(i=>{s===1?i.delete("page"):i.set("page",String(s))})},"setPage"),T=r((s,i=!0)=>{z(d=>{for(const[J,Z]of Object.entries(s))Z?d.set(J,Z):d.delete(J);i&&d.delete("page")},!0)},"setView"),H=r(()=>T({q:"",status:"",type:"",project:""}),"clearFilters");return t?(0,e.jsxs)("div",{className:"mx-auto max-w-6xl space-y-4","data-testid":"case-pages",children:[(0,e.jsx)(qe,{ariaLabel:"Case controls",search:(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative min-w-0 flex-1 sm:max-w-xs",children:[(0,e.jsx)(te,{"aria-hidden":!0,className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,e.jsx)(we,{"aria-label":"Search cases",placeholder:"Search cases…",value:m,"data-page-search-target":"true",onChange:r(s=>A("q",s.target.value),"onChange"),className:"h-8 pl-8"})]}),(0,e.jsx)("p",{role:"status",className:"whitespace-nowrap text-xs text-muted-foreground",children:W?"Loading cases…":y.isFetching?"Updating cases…":_.kind==="error"?"":p>1&&v.length>0?`${I+1}–${I+v.length} cases`:`${v.length}${S?"+":""} ${v.length===1&&!S?"case":"cases"}`})]}),controls:(0,e.jsx)(Re,{activeFilterCount:ce,columns:a.columns,onColumnsChange:r(s=>T({columns:s.join(",")===E.join(",")?"":s.join(",")||"none"},!1),"onColumnsChange"),sortField:a.sortField,sortDir:a.sortDir,onSortChange:r((s,i)=>T({sort:s==="updated"?"":s,dir:i==="desc"?"":i}),"onSortChange"),groupBy:a.groupBy,onGroupChange:r(s=>T({group:s==="none"?"":s}),"onGroupChange"),filters:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D,{label:"Status",value:f,onChange:r(s=>A("status",s),"onChange"),options:[{value:u,label:"All statuses"},...Y.map(s=>({value:s,label:ne[s]}))]}),(0,e.jsx)(D,{label:"Type",value:n,disabled:C.isPending||F.kind==="error",onChange:r(s=>A("type",s),"onChange"),options:[{value:u,label:"All types"},...de.map(s=>({value:s,label:s}))]}),(0,e.jsx)(D,{label:"Project",value:c,disabled:w.isPending||L.kind==="error",onChange:r(s=>A("project",s),"onChange"),options:[{value:u,label:"All projects"},{value:"none",label:"No project"},...(w.data??[]).map(s=>({value:s.id,label:s.name})),...c!==u&&c!=="none"&&!q.has(c)?[{value:c,label:"Selected project"}]:[]]})]})}),feedback:N?(0,e.jsx)(b,{variant:"ghost",size:"sm",onClick:H,children:"Clear filters"}):void 0}),F.kind==="error"||L.kind==="error"?(0,e.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-3 text-sm",children:[(0,e.jsx)("p",{children:"Some case filters couldn’t be loaded."}),(0,e.jsx)(b,{variant:"ghost",size:"sm",onClick:r(()=>{F.kind==="error"&&C.refetch(),L.kind==="error"&&w.refetch()},"onClick"),children:"Retry filters"})]}):null,W?(0,e.jsx)("div",{"aria-hidden":"true",className:"space-y-2",children:Array.from({length:6},(s,i)=>(0,e.jsx)(Pe,{className:"h-16 w-full rounded-none"},i))}):_.kind==="error"?(0,e.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-3 py-6 text-sm",children:[(0,e.jsx)("p",{children:"Cases couldn’t be loaded."}),(0,e.jsx)(b,{variant:"outline",size:"sm",onClick:r(()=>{y.refetch()},"onClick"),children:"Try again"})]}):v.length===0?(0,e.jsx)(ae,{icon:N?te:se,message:p>1?"No cases on this page":N?"No cases match these filters":"No cases yet",action:p>1?"First page":N?"Clear filters":void 0,hideActionIcon:!0,onAction:r(()=>p>1?B(1):H(),"onAction")}):(0,e.jsx)("section",{"aria-label":"Case list","aria-busy":y.isFetching,inert:y.isPlaceholderData,className:"border-t border-border",children:[...k].map(([s,i])=>(0,e.jsxs)("div",{children:[a.groupBy!=="none"&&(0,e.jsx)(Ce,{label:i.label,className:"border-b border-border px-3 pt-4"}),i.records.map(d=>(0,e.jsx)($e,{caseData:d,columns:a.columns,projectName:d.projectId?q.get(d.projectId):void 0,search:o.size?`?${o}`:""},d.id))]},s))}),p>1||S?(0,e.jsxs)("nav",{"aria-label":"Case list pages",className:"flex items-center justify-end gap-2",children:[(0,e.jsx)(b,{variant:"outline",size:"sm",disabled:p===1||y.isFetching,onClick:r(()=>B(p-1),"onClick"),children:"Previous"}),(0,e.jsx)(b,{variant:"outline",size:"sm",disabled:!S||y.isFetching,onClick:r(()=>B(p+1),"onClick"),children:"Next"})]}):null]}):(0,e.jsx)(ae,{icon:se,message:"Select a company to view cases."})}r(He,"Cases");export{He as Cases};
|
|
1
|
+
var ue=Object.defineProperty;var r=(t,h)=>ue(t,"name",{value:h,configurable:!0});import{a as ie}from"./rolldown-runtime-DhZMWcEn.js";import{E as X,w as Y}from"./issue-detail-CZfjXs0M.js";import{$A as pe,Cx as M,Ev as he,Ex as U,GS as ee,Gw as se,IC as te,Jb as me,Kr as xe,LS as ge,MT as je,NE as b,Tw as fe,Tx as O,Uw as ye,WE as be,WT as ve,__ as we,_v as Ne,an as Ce,hv as Se,iD as ke,ib as Ae,jp as Te,mb as Pe,mv as Ee,nj as Ie,oE as _e,on as ae,pv as Fe,uT as Le,ub as $,vt as qe,vv as ze,xE as R,x_ as Be,xv as re,zE as P}from"./index-BJtnP7H1.js";import{t as Me}from"./EntityRow-BsICt6pd.js";import{n as Ue,t as ne}from"./CaseStatus-BI0aMl9l.js";var G=ie(Ie(),1),V=[["identifier","Identifier"],["type","Type"],["project","Project"],["phase","Phase"],["assignee","Agent"],["status","Status"],["updated","Updated"]],E=["identifier","type","project","phase","assignee","status"],oe=[["updated","Updated"],["created","Created"],["title","Title"],["status","Status"],["type","Type"]],le=[["none","None"],["status","Status"],["type","Type"],["project","Project"]];function Oe(t){const h=t.get("sort"),o=t.get("group"),x=t.get("columns");return{columns:x===null?E:V.map(([l])=>l).filter(l=>x.split(",").includes(l)),sortField:oe.find(([l])=>l===h)?.[0]??"updated",sortDir:t.get("dir")==="asc"?"asc":"desc",groupBy:le.find(([l])=>l===o)?.[0]??"none"}}r(Oe,"caseListView");var e=ie(pe(),1);function $e({caseData:t,projectName:h,search:o="",columns:x=E}){const l=me(),m=t.workIssue,a=new Set(x),g=a.has("phase")||a.has("assignee"),f=m?.assigneeAgentId?{id:m.assigneeAgentId,name:m.assigneeAgentName??"Agent"}:null,n=m?(0,e.jsxs)(e.Fragment,{children:[a.has("phase")&&t.phase?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.phase}):null,a.has("assignee")&&(f?(0,e.jsx)(xe,{agent:f,size:"xs"}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Unassigned"}))]}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.workIssueId?"Task unavailable":"No task linked"}),c=[a.has("identifier")?t.identifier:null,a.has("type")?t.caseType:null,a.has("project")?h:null].filter(Boolean);return(0,e.jsx)(Me,{to:`${l(t.identifier)}${o}`,title:t.title,titleTextClassName:"line-clamp-2 font-medium sm:line-clamp-1",subtitle:c.length?c.map((j,p)=>(0,e.jsxs)("span",{className:j===t.identifier?"font-mono":void 0,children:[p>0?" · ":"",j]},p)):void 0,className:"px-3 py-3",trailing:g||a.has("status")||a.has("updated")?(0,e.jsxs)(e.Fragment,{children:[g&&(0,e.jsx)("div",{className:"hidden w-44 flex-col gap-1 lg:flex",children:n}),a.has("status")&&(0,e.jsx)("div",{className:"flex w-24 justify-end",children:(0,e.jsx)(Ue,{status:t.status})}),a.has("updated")&&(0,e.jsx)("time",{dateTime:t.updatedAt,title:be(t.updatedAt),className:"hidden font-mono text-xs text-muted-foreground sm:block",children:ke(t.updatedAt)})]}):void 0,secondaryRow:g?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:n}):void 0,secondaryRowClassName:"pl-0 lg:hidden"})}r($e,"CaseListRow");function Re({filters:t,activeFilterCount:h,columns:o,onColumnsChange:x,sortField:l,sortDir:m,onSortChange:a,groupBy:g,onGroupChange:f}){return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(Fe,{children:[(0,e.jsx)(he,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:"h-8 w-8 shrink-0","aria-label":"Columns",title:"Columns",children:(0,e.jsx)(Le,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(Se,{align:"end",className:"w-48",children:[(0,e.jsx)(ze,{children:"Visible fields"}),(0,e.jsx)(re,{}),V.map(([n,c])=>(0,e.jsx)(Ee,{checked:o.includes(n),onSelect:r(j=>j.preventDefault(),"onSelect"),onCheckedChange:r(j=>x(V.map(([p])=>p).filter(p=>p===n?j===!0:o.includes(p))),"onCheckedChange"),children:c},n)),(0,e.jsx)(re,{}),(0,e.jsx)(Ne,{onSelect:r(()=>x(E),"onSelect"),children:"Reset defaults"})]})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsxs)(b,{variant:"outline",size:"icon",className:P("relative h-8 w-8 shrink-0",h>0&&"text-(--collection-filter-active)"),"aria-label":h?`Filter cases (${h} active)`:"Filter cases",title:"Filter",children:[(0,e.jsx)(ye,{"aria-hidden":!0,className:"h-3.5 w-3.5"}),h>0&&(0,e.jsx)("span",{"aria-hidden":!0,className:"absolute -right-1 -top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-(--collection-filter-badge) text-(length:--text-nano) font-bold text-(--collection-filter-badge-foreground)",children:h})]})}),(0,e.jsxs)(O,{align:"end",className:"w-64 space-y-3","aria-label":"Case filters",children:[(0,e.jsx)("h2",{className:"text-sm font-medium",children:"Filters"}),t]})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:"h-8 w-8 shrink-0","aria-label":"Sort",title:"Sort",children:(0,e.jsx)(ve,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsx)(O,{align:"end",className:"w-48 p-2","aria-label":"Sort cases",children:oe.map(([n,c])=>(0,e.jsxs)("button",{type:"button","aria-pressed":l===n,className:P("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",l===n?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:r(()=>a(n,l===n&&m==="asc"?"desc":"asc"),"onClick"),children:[(0,e.jsx)("span",{children:c}),l===n&&(0,e.jsx)("span",{"aria-label":m==="asc"?"Ascending":"Descending",className:"text-xs text-muted-foreground",children:m==="asc"?"↑":"↓"})]},n))})]}),(0,e.jsxs)(M,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{variant:"outline",size:"icon",className:P("h-8 w-8 shrink-0",g!=="none"&&"bg-accent"),"aria-label":"Group",title:"Group",children:(0,e.jsx)(fe,{"aria-hidden":!0,className:"h-3.5 w-3.5"})})}),(0,e.jsx)(O,{align:"end",className:"w-44 p-2","aria-label":"Group cases",children:le.map(([n,c])=>(0,e.jsxs)("button",{type:"button","aria-pressed":g===n,className:P("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",g===n?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:r(()=>f(n),"onClick"),children:[(0,e.jsx)("span",{children:c}),g===n&&(0,e.jsx)(je,{"aria-hidden":!0,className:"h-3.5 w-3.5"})]},n))})]})]})}r(Re,"CaseListControls");var Q=50,u="all";function D({label:t,value:h,options:o,onChange:x,disabled:l}){return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t}),(0,e.jsx)(Te,{"aria-label":`Filter by ${t.toLowerCase()}`,value:h,options:o,onValueChange:x,disabled:l,className:"text-sm data-[size=default]:h-9"})]})}r(D,"CaseFilter");function He(){const{selectedCompanyId:t}=ge(),{setBreadcrumbs:h}=Ae(),[o,x]=_e(),l=(0,G.useRef)(o);(0,G.useLayoutEffect)(()=>{l.current=o},[o]);const m=o.get("q")??"",a=Oe(o),g=o.get("status")??u,f=Y.includes(g)?g:u,n=o.get("type")||u,c=o.get("project")||u,j=Number(o.get("page")??1),p=Number.isSafeInteger(j)&&j>0&&j<=2001?j:1,I=(p-1)*Q,N=m!==""||f!==u||n!==u||c!==u,ce=[f,n,c].filter(s=>s!==u).length,K={q:m.trim()||void 0,status:f===u?void 0:f,type:n===u?void 0:n,projectId:c===u||c==="none"?void 0:c,includeNoProject:c==="none"||void 0,limit:51,offset:I,...a.sortField!=="updated"?{sortField:a.sortField}:{},...a.sortDir!=="desc"?{sortDir:a.sortDir}:{},...a.groupBy!=="none"?{groupBy:a.groupBy}:{}};(0,G.useEffect)(()=>h([{label:"Cases"}]),[h]);const y=R({queryKey:[...ee.cases.list(t??""),K],queryFn:r(()=>X.list(t,K),"queryFn"),enabled:!!t,placeholderData:r((s,i)=>i?.queryKey[1]===t?s:void 0,"placeholderData")}),_=$(y),W=["loading","reconnecting"].includes(_.kind),C=R({queryKey:[...ee.cases.list(t??""),"types"],queryFn:r(()=>X.listTypes(t),"queryFn"),enabled:!!t}),F=$(C),w=R({...Be(t??"",{includeArchived:!0}),enabled:!!t}),L=$(w),v=(y.data??[]).slice(0,Q),S=(y.data?.length??0)>Q,q=new Map((w.data??[]).map(s=>[s.id,s.name])),de=[...new Set([...C.data??[],...n!==u?[n]:[]])].sort(),k=new Map;for(const s of v){const i=a.groupBy==="status"?s.status:a.groupBy==="type"?s.caseType:a.groupBy==="project"?s.projectId??"none":u,d=a.groupBy==="status"?ne[s.status]:a.groupBy==="project"?s.projectId?q.get(s.projectId)??"Project unavailable":"No project":i;k.has(i)||k.set(i,{label:d,records:[]}),k.get(i).records.push(s)}const z=r((s,i=!1)=>{const d=new URLSearchParams(l.current);s(d),l.current=d,x(d,{replace:i})},"updateParams"),A=r((s,i)=>{z(d=>{!i||s!=="q"&&i===u?d.delete(s):d.set(s,i),d.delete("page")},!0)},"setFilter"),B=r(s=>{z(i=>{s===1?i.delete("page"):i.set("page",String(s))})},"setPage"),T=r((s,i=!0)=>{z(d=>{for(const[J,Z]of Object.entries(s))Z?d.set(J,Z):d.delete(J);i&&d.delete("page")},!0)},"setView"),H=r(()=>T({q:"",status:"",type:"",project:""}),"clearFilters");return t?(0,e.jsxs)("div",{className:"mx-auto max-w-6xl space-y-4","data-testid":"case-pages",children:[(0,e.jsx)(qe,{ariaLabel:"Case controls",search:(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative min-w-0 flex-1 sm:max-w-xs",children:[(0,e.jsx)(te,{"aria-hidden":!0,className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,e.jsx)(we,{"aria-label":"Search cases",placeholder:"Search cases…",value:m,"data-page-search-target":"true",onChange:r(s=>A("q",s.target.value),"onChange"),className:"h-8 pl-8"})]}),(0,e.jsx)("p",{role:"status",className:"whitespace-nowrap text-xs text-muted-foreground",children:W?"Loading cases…":y.isFetching?"Updating cases…":_.kind==="error"?"":p>1&&v.length>0?`${I+1}–${I+v.length} cases`:`${v.length}${S?"+":""} ${v.length===1&&!S?"case":"cases"}`})]}),controls:(0,e.jsx)(Re,{activeFilterCount:ce,columns:a.columns,onColumnsChange:r(s=>T({columns:s.join(",")===E.join(",")?"":s.join(",")||"none"},!1),"onColumnsChange"),sortField:a.sortField,sortDir:a.sortDir,onSortChange:r((s,i)=>T({sort:s==="updated"?"":s,dir:i==="desc"?"":i}),"onSortChange"),groupBy:a.groupBy,onGroupChange:r(s=>T({group:s==="none"?"":s}),"onGroupChange"),filters:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(D,{label:"Status",value:f,onChange:r(s=>A("status",s),"onChange"),options:[{value:u,label:"All statuses"},...Y.map(s=>({value:s,label:ne[s]}))]}),(0,e.jsx)(D,{label:"Type",value:n,disabled:C.isPending||F.kind==="error",onChange:r(s=>A("type",s),"onChange"),options:[{value:u,label:"All types"},...de.map(s=>({value:s,label:s}))]}),(0,e.jsx)(D,{label:"Project",value:c,disabled:w.isPending||L.kind==="error",onChange:r(s=>A("project",s),"onChange"),options:[{value:u,label:"All projects"},{value:"none",label:"No project"},...(w.data??[]).map(s=>({value:s.id,label:s.name})),...c!==u&&c!=="none"&&!q.has(c)?[{value:c,label:"Selected project"}]:[]]})]})}),feedback:N?(0,e.jsx)(b,{variant:"ghost",size:"sm",onClick:H,children:"Clear filters"}):void 0}),F.kind==="error"||L.kind==="error"?(0,e.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-3 text-sm",children:[(0,e.jsx)("p",{children:"Some case filters couldn’t be loaded."}),(0,e.jsx)(b,{variant:"ghost",size:"sm",onClick:r(()=>{F.kind==="error"&&C.refetch(),L.kind==="error"&&w.refetch()},"onClick"),children:"Retry filters"})]}):null,W?(0,e.jsx)("div",{"aria-hidden":"true",className:"space-y-2",children:Array.from({length:6},(s,i)=>(0,e.jsx)(Pe,{className:"h-16 w-full rounded-none"},i))}):_.kind==="error"?(0,e.jsxs)("div",{role:"alert",className:"flex flex-wrap items-center gap-3 py-6 text-sm",children:[(0,e.jsx)("p",{children:"Cases couldn’t be loaded."}),(0,e.jsx)(b,{variant:"outline",size:"sm",onClick:r(()=>{y.refetch()},"onClick"),children:"Try again"})]}):v.length===0?(0,e.jsx)(ae,{icon:N?te:se,message:p>1?"No cases on this page":N?"No cases match these filters":"No cases yet",action:p>1?"First page":N?"Clear filters":void 0,hideActionIcon:!0,onAction:r(()=>p>1?B(1):H(),"onAction")}):(0,e.jsx)("section",{"aria-label":"Case list","aria-busy":y.isFetching,inert:y.isPlaceholderData,className:"border-t border-border",children:[...k].map(([s,i])=>(0,e.jsxs)("div",{children:[a.groupBy!=="none"&&(0,e.jsx)(Ce,{label:i.label,className:"border-b border-border px-3 pt-4"}),i.records.map(d=>(0,e.jsx)($e,{caseData:d,columns:a.columns,projectName:d.projectId?q.get(d.projectId):void 0,search:o.size?`?${o}`:""},d.id))]},s))}),p>1||S?(0,e.jsxs)("nav",{"aria-label":"Case list pages",className:"flex items-center justify-end gap-2",children:[(0,e.jsx)(b,{variant:"outline",size:"sm",disabled:p===1||y.isFetching,onClick:r(()=>B(p-1),"onClick"),children:"Previous"}),(0,e.jsx)(b,{variant:"outline",size:"sm",disabled:!S||y.isFetching,onClick:r(()=>B(p+1),"onClick"),children:"Next"})]}):null]}):(0,e.jsx)(ae,{icon:se,message:"Select a company to view cases."})}r(He,"Cases");export{He as Cases};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ts=Object.defineProperty;var t=(s,a)=>Ts(s,"name",{value:a,configurable:!0});import{a as is}from"./rolldown-runtime-DhZMWcEn.js";import{Br as Rs}from"./issue-detail-4PCbYpdv.js";import{C as Ps,b as Te}from"./collections-BxrcELwt.js";import{t as Es}from"./arrow-down-left-o81ENfeW.js";import{t as $s}from"./send-CYVi50sh.js";import{$A as _s,$S as M,Cb as He,Ci as B,Db as Ge,Dp as Oe,Eb as Ke,Ep as fe,Ev as os,Fb as qs,Fu as Us,GD as ls,GS as $,Gb as L,HC as Ce,Hm as Be,IC as Ls,JC as Fs,Jp as Ds,Lw as Ms,ME as Y,MT as pe,Mb as ke,NE as C,Nb as zs,Ob as Qe,Pb as Hs,QT as cs,RS as Gs,Rb as Os,Rp as xe,Sb as Ve,Sp as Se,TT as Ks,Tb as We,Ti as _,UT as Bs,VS as Qs,WE as le,YD as ds,Yb as us,ZC as Vs,ZT as Ws,__ as J,_v as ge,_w as W,aE as Js,ab as G,ay as Je,bE as Q,cT as X,cw as Ys,dy as ms,fy as Re,gC as Zs,g_ as hs,hC as Xs,hE as F,hv as ps,hy as et,ib as st,jT as tt,jb as xs,kb as Ye,ly as be,my as ve,nE as at,nT as gs,nj as nt,on as fs,op as H,pv as bs,qC as Ze,qb as rt,qp as oe,rb as Ae,sv as Pe,sy as ye,tT as ue,uE as ne,ub as D,uy as Ee,vT as it,vb as ot,vm as lt,wb as Xe,x as Ne,xE as U,x_ as ct,xb as dt,y_ as ut,yb as mt,zE as z}from"./index-Bt31d8ga.js";import{a as ht,c as pt,l as xt,o as gt,r as ft,t as bt}from"./SpekoPhoneCallback-C4VnMiZh.js";import{t as vt}from"./EmailConnectionAccess-kCL7obSr.js";import{n as yt}from"./EmailEndpointSetup-BGrksR_u.js";import{t as jt}from"./useAuthorizationWindow-DnFQsiFj.js";import{a as kt,c as K,d as Nt,i as wt,o as Ct,r as St,s as At,u as Ie}from"./GitHubConnectionRecovery-B9sFWJup.js";var es=["opened","synchronize","reopened","ready_for_review","mention","comment"],vs={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};vs.node;var It=cs(vs),ys={name:"unlink",size:24,node:[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]};ys.node;var Tt=cs(ys),b=is(nt(),1),e=is(_s(),1);function Rt({endpointId:s}){const a=Y(),[n,l]=(0,b.useState)(()=>crypto.randomUUID()),[d,x]=(0,b.useState)(null),[g,m]=(0,b.useState)(null),[h,k]=(0,b.useState)(""),[i,u]=(0,b.useState)(!1),[p,r]=(0,b.useState)(""),o=Q({mutationFn:t(y=>_.sendSlackTestMessage(s,{requestId:n,...y}),"mutationFn"),onSuccess:t((y,T)=>{if(y.status==="connection_required"){x(S=>T.accountCursor?[...new Map([...S??[],...y.accounts].map(R=>[R.id,R])).values()]:y.accounts),m(y.nextCursor);return}x(null),a.invalidateQueries({queryKey:$.chatEndpoints.principals(s)})},"onSuccess")}),f=o.data?.status==="sent",A=o.data?.status==="connection_pending"?o.data:null;(0,b.useEffect)(()=>{if(u(!1),!A)return;const y=setTimeout(()=>u(!0),Math.max(0,new Date(A.expiresAt).getTime()-Date.now()));return()=>clearTimeout(y)},[A?.expiresAt]);const w=U({queryKey:$.chatEndpoints.principals(s),queryFn:t(()=>_.listPrincipals(s),"queryFn"),enabled:!!A&&!i,refetchInterval:A&&!i?3e3:!1}),I=!!(A&&w.data?.some(y=>y.principalId===A.principalId&&y.status==="linked"));(0,b.useEffect)(()=>{I&&!o.isPending&&!o.error&&o.mutate({slackUserId:h})},[I,o.isPending,o.error]);const E=t(()=>{l(crypto.randomUUID()),o.reset()},"reset"),j=t(()=>{if(i){const y=crypto.randomUUID();l(y),o.mutate({requestId:y,slackUserId:h})}else o.mutate({})},"startTest");return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(C,{variant:"outline",disabled:o.isPending||f||!!(A&&!i),onClick:j,children:[o.isPending?(0,e.jsx)(W,{className:"size-4 animate-spin"}):f?(0,e.jsx)(pe,{className:"size-4"}):(0,e.jsx)($s,{className:"size-4"}),o.isPending?"Sending…":f?"Test message sent":i?"Request a new invitation":A?"Waiting for Slack connection…":"Send me a test message"]}),A&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:i?"The Slack invitation expired.":"Open the invitation in Slack to connect your account."}),o.error&&(0,e.jsxs)("div",{role:"alert",className:"max-w-sm text-sm text-destructive",children:[F(o.error).body," ",(0,e.jsx)("button",{className:"underline",onClick:E,children:"Dismiss"})]}),(0,e.jsx)(ye,{open:d!==null,onOpenChange:t(y=>{!y&&!o.isPending&&x(null)},"onOpenChange"),children:(0,e.jsxs)(be,{className:M,children:[(0,e.jsxs)(Re,{children:[(0,e.jsx)(ve,{children:"Connect your Slack account"}),(0,e.jsx)(Ee,{children:"Choose your account. Messages to this agent will use your Microvac permissions."})]}),(0,e.jsx)(J,{"aria-label":"Find your Slack account",placeholder:"Find your name",value:p,onChange:t(y=>r(y.target.value),"onChange")}),(0,e.jsxs)("div",{className:"max-h-64 space-y-1 overflow-y-auto",role:"radiogroup","aria-label":"Your Slack account",children:[d?.filter(y=>`${y.name} ${y.id}`.toLowerCase().includes(p.toLowerCase())).map(y=>(0,e.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 rounded-md border border-border p-3 text-sm",children:[(0,e.jsx)("input",{type:"radio",name:"slack-account",value:y.id,checked:h===y.id,onChange:t(()=>k(y.id),"onChange")}),(0,e.jsxs)("span",{className:M,children:[y.name," ",(0,e.jsxs)("span",{className:"text-muted-foreground",children:["(",y.id,")"]})]})]},y.id)),d?.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No available accounts found in this Slack workspace."})]}),g&&(0,e.jsx)(C,{variant:"ghost",disabled:o.isPending,onClick:t(()=>o.mutate({accountCursor:g}),"onClick"),children:"Load more Slack accounts"}),o.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:F(o.error).body}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)(C,{variant:"ghost",disabled:o.isPending,onClick:t(()=>x(null),"onClick"),children:"Cancel"}),(0,e.jsx)(C,{disabled:!h||o.isPending,onClick:t(()=>o.mutate({slackUserId:h}),"onClick"),children:o.isPending?"Sending invitation…":"Send connection invitation"})]})]})})]})}t(Rt,"SlackTestMessageButton");var re=t((s,a)=>`/companies/${s}/slack/endpoints/${a}`,"root"),ie={capabilities:t((s,a)=>ne.get(`${re(s,a)}/capabilities`),"capabilities"),search:t((s,a)=>ne.get(`${re(s,a)}/search`),"search"),configure:t((s,a,n)=>ne.put(`${re(s,a)}/search`,n),"configure"),connect:t((s,a)=>ne.post(`${re(s,a)}/search/connect`,{}),"connect"),disconnect:t((s,a)=>ne.delete(`${re(s,a)}/search`),"disconnect")};function Pt({capabilities:s,error:a}){return(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Read, search, and act in Slack. Some actions require approval."}),a&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:a}),!s&&!a&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Checking Slack permissions…"}),s&&(0,e.jsx)(e.Fragment,{children:s.missingScopes.length>0&&(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Add permissions to unlock more tools"}),(0,e.jsxs)("p",{className:"text-sm",children:["Your existing connection still works. In"," ",(0,e.jsx)("a",{className:"underline underline-offset-4",href:"https://api.slack.com/apps",target:"_blank",rel:"noreferrer",children:"Slack app settings"}),", choose your app, open OAuth & Permissions, add these Bot Token Scopes, then reinstall the app to your workspace."]}),(0,e.jsx)("p",{className:"text-xs font-mono break-words",children:s.missingScopes.join(", ")})]})})]})}t(Pt,"SlackCapabilitiesView");function Et({status:s,onConnect:a,onDisconnect:n,onConfigure:l}){const d=(0,b.useId)(),[x,g]=(0,b.useState)(s.clientId??""),[m,h]=(0,b.useState)(""),[k,i]=(0,b.useState)(!1),[u,p]=(0,b.useState)(null),r=t(async o=>{i(!0),p(null);try{await o()}catch(f){p(F(f).body)}finally{i(!1)}},"perform");return(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Your Slack search access"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Optional personal authorization enables private search on supported runtimes. It cannot read channels the bot hasn’t joined or let the bot write as you. Basic channel reading works without it."}),!s.nativeSearchAvailable&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:s.limitation}),s.connected?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm",children:"Slack search connected"}),(0,e.jsx)(C,{variant:"outline",size:"sm",disabled:k,onClick:t(()=>{r(n)},"onClick"),children:"Disconnect search"})]}):(0,e.jsx)(C,{variant:"outline",disabled:k||!s.configured,onClick:t(()=>{r(a)},"onClick"),children:"Connect Slack search"}),!s.configured&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"A connection manager needs to configure your Slack app’s OAuth credentials first."}),s.canConfigure&&(0,e.jsxs)("details",{className:"text-sm",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-muted-foreground",children:"OAuth app configuration for connection managers"}),(0,e.jsxs)("form",{className:"mt-3 space-y-3",onSubmit:t(o=>{o.preventDefault(),r(async()=>{await l({clientId:x,clientSecret:m}),h("")})},"onSubmit"),children:[(0,e.jsxs)("p",{className:"text-sm",children:["In Slack app settings, add this redirect URL under OAuth & Permissions. Add user scopes ",(0,e.jsx)("code",{children:"search:read.public"}),","," ",(0,e.jsx)("code",{children:"search:read.private"})," and"," ",(0,e.jsx)("code",{children:"search:read.files"}),". Find Client ID and Client Secret under Basic Information."]}),(0,e.jsx)("p",{className:"text-xs font-mono break-all",children:s.redirectUri??"Configure a public HTTPS URL first."}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-client`,children:"Client ID"}),(0,e.jsx)(J,{id:`${d}-client`,value:x,onChange:t(o=>g(o.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-secret`,children:"Client Secret"}),(0,e.jsx)(J,{id:`${d}-secret`,type:"password",autoComplete:"new-password",value:m,onChange:t(o=>h(o.target.value),"onChange")})]}),(0,e.jsx)("div",{className:"flex items-center justify-end gap-3",children:(0,e.jsx)(C,{type:"submit",size:"sm",disabled:k||!x||!m,children:"Save OAuth configuration"})})]})]}),u&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:u})]})}t(Et,"SlackSearchView");function $t({companyId:s,endpointId:a}){const n=U({queryKey:["slack-capabilities",s,a],queryFn:t(()=>ie.capabilities(s,a),"queryFn"),staleTime:6e4}),l=D(n);return(0,e.jsx)("div",{className:"space-y-3",children:(0,e.jsx)(Pt,{capabilities:n.data,error:l.kind==="error"?F(n.error).body:void 0})})}t($t,"SlackToolsSettings");function _t({companyId:s,endpointId:a}){const n=U({queryKey:["slack-search",s,a],queryFn:t(()=>ie.search(s,a),"queryFn")}),l=jt(),d=D(n);return d.kind==="error"?(0,e.jsx)(G,{error:n.error,action:"load Slack search access",onRetry:d.retry,retrying:d.isFetching}):n.data?(0,e.jsxs)(e.Fragment,{children:[l.fallback,(0,e.jsx)(Et,{status:n.data,onConnect:t(async()=>{l.reserve();try{const x=await ie.connect(s,a);await l.open(x.url)}catch(x){throw l.cancel(),x}},"onConnect"),onDisconnect:t(async()=>{await ie.disconnect(s,a),await n.refetch()},"onDisconnect"),onConfigure:t(async x=>{await ie.configure(s,a,x),await n.refetch()},"onConfigure")})]}):(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading search access…"})}t(_t,"SlackSearchAccess");function qt({value:s,onSave:a}){const n=(0,b.useId)(),[l,d]=(0,b.useState)(null),[x,g]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[k,i]=(0,b.useState)(!1),u=l??s,p=u.trim()!==s;return(0,e.jsxs)("form",{className:"space-y-3","aria-labelledby":`${n}-label`,onSubmit:t(async r=>{if(r.preventDefault(),!(x||!p)){g(!0),h(null),i(!1);try{await a(u.trim()),d(null),i(!0)}catch(o){h(F(o).body)}finally{g(!1)}}},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{id:`${n}-label`,htmlFor:n,className:"text-sm font-semibold",children:"Additional communication instructions"}),(0,e.jsx)("p",{id:`${n}-help`,className:"text-sm text-muted-foreground",children:"Applies to new conversations."})]}),(0,e.jsx)(hs,{id:n,"aria-describedby":`${n}-help`,value:u,disabled:x,maxLength:4e3,rows:4,placeholder:"For example: Keep replies brief and explain technical terms.",onChange:t(r=>{d(r.target.value),i(!1),h(null)},"onChange")}),m&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:m}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{children:p?(0,e.jsx)(C,{type:"button",variant:"ghost",disabled:x,onClick:t(()=>{d(null),h(null),i(!1)},"onClick"),children:"Cancel"}):k?(0,e.jsx)("span",{role:"status",className:"text-sm text-muted-foreground",children:"Saved. Applies to new tasks."}):null}),(0,e.jsx)(C,{type:"submit",disabled:!p||x,children:x?"Saving…":"Save instructions"})]})]})}t(qt,"ChatCommunicationInstructions");function Ut(s){return s===void 0?"inherit":s===null?"clear":s.kind==="task_directory"?"task":s.kind==="existing"?`existing:${s.workspaceId}`:`source:${s.projectWorkspaceId}:${s.mode}`}t(Ut,"selectionKey");function $e({companyId:s,value:a,resource:n=!1,onSave:l}){const d=(0,b.useId)(),[x,g]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[k,i]=(0,b.useState)(null),[u,p]=(0,b.useState)(null),r=U({...ct(s)}),o=U({queryKey:["channel-workspace-choices",s],queryFn:t(()=>ut.listSummaries(s,{selectableForTask:!0}),"queryFn")}),f=x??a??{},A=JSON.stringify(a??{}),w=u!==null;(0,b.useEffect)(()=>{u!==null&&u!==A&&g(null)},[u,A]);const I=f.projectId===void 0?"inherit":f.projectId??"none",E=Ut(f.workspace),j=new Map;j.set("task",{kind:"task_directory"});for(const S of r.data??[])for(const R of S.workspaces??[])for(const c of["managed_isolated","shared"])j.set(`source:${R.id}:${c}`,{kind:"configured_source",projectWorkspaceId:R.id,mode:c});for(const S of o.data??[])j.set(`existing:${S.id}`,{kind:"existing",workspaceId:S.id});const y=!w&&JSON.stringify(f)!==A,T=t(S=>{g(S),p(null),i(null)},"change");return(0,e.jsxs)("form",{className:"space-y-3","aria-labelledby":`${d}-title`,onSubmit:t(async S=>{if(S.preventDefault(),!(m||!y)){h(!0),i(null),p(null);try{await l(Object.keys(f).length?f:null),p(A)}catch(R){i(R instanceof Error?R.message:"Couldn’t save task defaults. Try again.")}finally{h(!1)}}},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{id:`${d}-title`,className:"text-sm font-semibold",children:"Task defaults"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Applies to new conversations. Existing tasks keep their files and project."})]}),(r.isError||o.isError)&&(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t load available projects or workspaces. ",(0,e.jsx)("button",{type:"button",className:"underline",onClick:t(()=>{r.refetch(),o.refetch()},"onClick"),children:"Try again"})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-project`,className:"text-sm font-medium",children:"Project"}),(0,e.jsxs)(Oe,{id:`${d}-project`,value:I,disabled:m||r.isPending,onChange:t(S=>{const{projectId:R,...c}=f;T(S.target.value==="inherit"?c:{...c,projectId:S.target.value==="none"?null:S.target.value})},"onChange"),children:[(0,e.jsx)("option",{value:"inherit",children:n?"Use connection defaults":"Use task defaults"}),(0,e.jsx)("option",{value:"none",children:"No project"}),f.projectId&&!r.data?.some(S=>S.id===f.projectId)&&(0,e.jsx)("option",{value:f.projectId,children:"Saved project (unavailable)"}),(r.data??[]).map(S=>(0,e.jsx)("option",{value:S.id,children:S.name},S.id))]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-workspace`,className:"text-sm font-medium",children:"Workspace"}),(0,e.jsxs)(Oe,{id:`${d}-workspace`,value:E,disabled:m||r.isPending||o.isPending,onChange:t(S=>{const R=S.target.value,{workspace:c,...v}=f;if(R==="inherit")T(v);else if(R==="clear")T({...v,workspace:null});else{const q=j.get(R);q&&T({...v,workspace:q})}},"onChange"),children:[(0,e.jsx)("option",{value:"inherit",children:n?"Use connection defaults":"Use project or task defaults"}),n&&(0,e.jsx)("option",{value:"clear",children:"Use project or task defaults"}),!n&&E==="clear"&&(0,e.jsx)("option",{value:"clear",children:"Use project or task defaults"}),(0,e.jsx)("option",{value:"task",children:"Task files — separate folder"}),f.workspace&&!j.has(E)&&(0,e.jsx)("option",{value:E,children:"Saved workspace (unavailable)"}),(r.data??[]).filter(S=>S.workspaces?.length).map(S=>(0,e.jsx)("optgroup",{label:S.name,children:S.workspaces.flatMap(R=>[(0,e.jsxs)("option",{value:`source:${R.id}:managed_isolated`,children:[R.name," — isolated checkout"]},`${R.id}:isolated`),(0,e.jsxs)("option",{value:`source:${R.id}:shared`,children:[R.name," — shared folder"]},`${R.id}:shared`)])},S.id)),(o.data?.length??0)>0&&(0,e.jsx)("optgroup",{label:"Existing workspaces",children:o.data.map(S=>(0,e.jsx)("option",{value:`existing:${S.id}`,children:S.name},S.id))})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Project and workspace access is checked for each task. A shared folder must also be allowed by the agent’s execution policy."})]}),k&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:k}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{children:y?(0,e.jsx)(C,{type:"button",variant:"ghost",disabled:m,onClick:t(()=>{g(null),i(null)},"onClick"),children:"Cancel"}):w?(0,e.jsx)("span",{role:"status",className:"text-sm text-muted-foreground",children:"Saved for new tasks."}):null}),(0,e.jsx)(C,{type:"submit",disabled:!y||m,children:m?"Saving…":"Save defaults"})]})]})}t($e,"ChatExecutionDefaults");function Lt(s,a){if(a==="github"&&s.externalUrl)try{const n=new URL(s.externalUrl),l=n.pathname.split("/");if(n.hostname==="github.com"&&["issues","pull"].includes(l[3])&&/^\d+$/.test(l[4]))return`${l[1]}/${l[2]} #${l[4]}`}catch{}return s.externalLabel}t(Lt,"conversationDestination");function Ft({rows:s,provider:a}){return s.length?(0,e.jsx)("ul",{"aria-label":"Conversations",className:"divide-y divide-border border-y border-border",children:s.map(n=>(0,e.jsxs)("li",{className:"flex items-start gap-3 py-4 text-sm",children:[(0,e.jsx)(xe,{name:a,brandKey:a,compact:!0,className:"mt-0.5 size-5! shrink-0 rounded-sm bg-transparent"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,e.jsxs)("div",{className:"break-words",children:[n.issueIdentifier&&(0,e.jsx)("span",{className:"mr-2 text-xs text-muted-foreground",children:n.issueIdentifier}),n.issueId?(0,e.jsx)(L,{className:"break-words font-medium hover:underline",to:`/issues/${n.issueId}`,children:n.issueTitle??n.issueIdentifier??"Microvac task"}):(0,e.jsx)("span",{className:"font-medium",children:n.issueTitle??"Waiting for task"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[n.externalUrl?(0,e.jsx)("a",{href:n.externalUrl,target:"_blank",rel:"noreferrer",className:z("break-words hover:text-foreground hover:underline",M),children:Lt(n,a)}):(0,e.jsx)("span",{className:z("break-all",M),children:n.externalLabel}),n.updatedAt&&(0,e.jsx)("time",{dateTime:n.updatedAt,children:le(n.updatedAt)}),n.state==="completed"&&(0,e.jsx)("span",{children:"Completed"})]})]}),n.state!=="active"&&n.state!=="completed"&&(0,e.jsx)(Te,{status:n.state})]},n.id))}):(0,e.jsx)(fs,{icon:Ys,message:"No conversations yet",description:a==="speko"?"Open an assigned task and choose Talk to agent.":a==="agentmail"?"Send an email to this agent’s address to start one.":"Mention the agent in an enabled destination to start one."})}t(Ft,"ChatConversationList");function ss({companyId:s,members:a,access:n,value:l,onChange:d,label:x}){const g=n?.memberships?.find(i=>i.companyId===s&&i.status==="active"),m=n?.isInstanceAdmin===!0||g?.membershipRole==="owner"||g?.membershipRole==="admin",h=a.filter(i=>i.status==="active"&&i.membershipRole!=="viewer"&&n&&(m||i.principalId===n.userId)).map(i=>({key:i.principalId,value:i.principalId,label:i.user?.name??i.user?.email??i.principalId,avatarUrl:i.user?.image,searchText:i.user?.email??void 0})),k=a.find(i=>i.principalId===l);return(0,e.jsx)(lt,{value:l,groups:[{id:"sponsors",options:h}],onValueChange:d,placeholder:"Select a member",searchPlaceholder:"Search members…",triggerAriaLabel:x,disabled:!n||h.length===0,renderValue:t(i=>i?(0,e.jsx)(ke,{name:i.label,avatarUrl:i.avatarUrl,size:"sm"}):l?(0,e.jsx)(ke,{name:k?.user?.name??k?.user?.email??l,avatarUrl:k?.user?.image,size:"sm"}):null,"renderValue"),renderOption:t(i=>(0,e.jsx)(ke,{name:i.label,avatarUrl:i.avatarUrl,size:"sm"}),"renderOption")})}t(ss,"GitHubSponsorSelect");var ts="w-full rounded-md border border-input bg-background px-3 py-2 text-sm",we={opened:"New pull request",synchronize:"Updated commits",reopened:"Reopened",ready_for_review:"Ready for review",mention:"Mention",comment:"Follow-up comment"};function Dt({label:s,children:a}){const[n,l]=(0,b.useState)(!1);return(0,e.jsxs)(ot,{open:n,onOpenChange:l,children:[(0,e.jsx)(dt,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":`About ${s}`,className:"inline-flex shrink-0 items-center text-muted-foreground hover:text-foreground",onClick:t(()=>l(!0),"onClick"),children:(0,e.jsx)(it,{className:"size-4"})})}),(0,e.jsx)(mt,{className:z("max-w-xs",M),children:a})]})}t(Dt,"GitHubHelp");function O({label:s,description:a,help:n,checked:l,onChange:d,ariaLabel:x,disabled:g}){return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4 py-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("p",{className:"break-words text-sm font-medium",children:s}),n&&(0,e.jsx)(Dt,{label:s,children:n})]}),a&&(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a})]}),(0,e.jsx)(fe,{"aria-label":x??s,disabled:g,checked:l,onCheckedChange:d})]})}t(O,"GitHubToggle");function as({id:s,values:a,separator:n=`
|
|
1
|
+
var Ts=Object.defineProperty;var t=(s,a)=>Ts(s,"name",{value:a,configurable:!0});import{a as is}from"./rolldown-runtime-DhZMWcEn.js";import{Br as Rs}from"./issue-detail-CZfjXs0M.js";import{C as Ps,b as Te}from"./collections-B58p51lw.js";import{t as Es}from"./arrow-down-left-Ck9VQyqQ.js";import{t as $s}from"./send-CH-0xdLm.js";import{$A as _s,$S as M,Cb as He,Ci as B,Db as Ge,Dp as Oe,Eb as Ke,Ep as fe,Ev as os,Fb as qs,Fu as Us,GD as ls,GS as $,Gb as L,HC as Ce,Hm as Be,IC as Ls,JC as Fs,Jp as Ds,Lw as Ms,ME as Y,MT as pe,Mb as ke,NE as C,Nb as zs,Ob as Qe,Pb as Hs,QT as cs,RS as Gs,Rb as Os,Rp as xe,Sb as Ve,Sp as Se,TT as Ks,Tb as We,Ti as _,UT as Bs,VS as Qs,WE as le,YD as ds,Yb as us,ZC as Vs,ZT as Ws,__ as J,_v as ge,_w as W,aE as Js,ab as G,ay as Je,bE as Q,cT as X,cw as Ys,dy as ms,fy as Re,gC as Zs,g_ as hs,hC as Xs,hE as F,hv as ps,hy as et,ib as st,jT as tt,jb as xs,kb as Ye,ly as be,my as ve,nE as at,nT as gs,nj as nt,on as fs,op as H,pv as bs,qC as Ze,qb as rt,qp as oe,rb as Ae,sv as Pe,sy as ye,tT as ue,uE as ne,ub as D,uy as Ee,vT as it,vb as ot,vm as lt,wb as Xe,x as Ne,xE as U,x_ as ct,xb as dt,y_ as ut,yb as mt,zE as z}from"./index-BJtnP7H1.js";import{a as ht,c as pt,l as xt,o as gt,r as ft,t as bt}from"./SpekoPhoneCallback-Cqi7AIyH.js";import{t as vt}from"./EmailConnectionAccess-CZ5QRKyg.js";import{n as yt}from"./EmailEndpointSetup-BI2vsd8Y.js";import{t as jt}from"./useAuthorizationWindow-tg3aKEU7.js";import{a as kt,c as K,d as Nt,i as wt,o as Ct,r as St,s as At,u as Ie}from"./GitHubConnectionRecovery-6VshLoNV.js";var es=["opened","synchronize","reopened","ready_for_review","mention","comment"],vs={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};vs.node;var It=cs(vs),ys={name:"unlink",size:24,node:[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]};ys.node;var Tt=cs(ys),b=is(nt(),1),e=is(_s(),1);function Rt({endpointId:s}){const a=Y(),[n,l]=(0,b.useState)(()=>crypto.randomUUID()),[d,x]=(0,b.useState)(null),[g,m]=(0,b.useState)(null),[h,k]=(0,b.useState)(""),[i,u]=(0,b.useState)(!1),[p,r]=(0,b.useState)(""),o=Q({mutationFn:t(y=>_.sendSlackTestMessage(s,{requestId:n,...y}),"mutationFn"),onSuccess:t((y,T)=>{if(y.status==="connection_required"){x(S=>T.accountCursor?[...new Map([...S??[],...y.accounts].map(R=>[R.id,R])).values()]:y.accounts),m(y.nextCursor);return}x(null),a.invalidateQueries({queryKey:$.chatEndpoints.principals(s)})},"onSuccess")}),f=o.data?.status==="sent",A=o.data?.status==="connection_pending"?o.data:null;(0,b.useEffect)(()=>{if(u(!1),!A)return;const y=setTimeout(()=>u(!0),Math.max(0,new Date(A.expiresAt).getTime()-Date.now()));return()=>clearTimeout(y)},[A?.expiresAt]);const w=U({queryKey:$.chatEndpoints.principals(s),queryFn:t(()=>_.listPrincipals(s),"queryFn"),enabled:!!A&&!i,refetchInterval:A&&!i?3e3:!1}),I=!!(A&&w.data?.some(y=>y.principalId===A.principalId&&y.status==="linked"));(0,b.useEffect)(()=>{I&&!o.isPending&&!o.error&&o.mutate({slackUserId:h})},[I,o.isPending,o.error]);const E=t(()=>{l(crypto.randomUUID()),o.reset()},"reset"),j=t(()=>{if(i){const y=crypto.randomUUID();l(y),o.mutate({requestId:y,slackUserId:h})}else o.mutate({})},"startTest");return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(C,{variant:"outline",disabled:o.isPending||f||!!(A&&!i),onClick:j,children:[o.isPending?(0,e.jsx)(W,{className:"size-4 animate-spin"}):f?(0,e.jsx)(pe,{className:"size-4"}):(0,e.jsx)($s,{className:"size-4"}),o.isPending?"Sending…":f?"Test message sent":i?"Request a new invitation":A?"Waiting for Slack connection…":"Send me a test message"]}),A&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:i?"The Slack invitation expired.":"Open the invitation in Slack to connect your account."}),o.error&&(0,e.jsxs)("div",{role:"alert",className:"max-w-sm text-sm text-destructive",children:[F(o.error).body," ",(0,e.jsx)("button",{className:"underline",onClick:E,children:"Dismiss"})]}),(0,e.jsx)(ye,{open:d!==null,onOpenChange:t(y=>{!y&&!o.isPending&&x(null)},"onOpenChange"),children:(0,e.jsxs)(be,{className:M,children:[(0,e.jsxs)(Re,{children:[(0,e.jsx)(ve,{children:"Connect your Slack account"}),(0,e.jsx)(Ee,{children:"Choose your account. Messages to this agent will use your Microvac permissions."})]}),(0,e.jsx)(J,{"aria-label":"Find your Slack account",placeholder:"Find your name",value:p,onChange:t(y=>r(y.target.value),"onChange")}),(0,e.jsxs)("div",{className:"max-h-64 space-y-1 overflow-y-auto",role:"radiogroup","aria-label":"Your Slack account",children:[d?.filter(y=>`${y.name} ${y.id}`.toLowerCase().includes(p.toLowerCase())).map(y=>(0,e.jsxs)("label",{className:"flex cursor-pointer items-center gap-3 rounded-md border border-border p-3 text-sm",children:[(0,e.jsx)("input",{type:"radio",name:"slack-account",value:y.id,checked:h===y.id,onChange:t(()=>k(y.id),"onChange")}),(0,e.jsxs)("span",{className:M,children:[y.name," ",(0,e.jsxs)("span",{className:"text-muted-foreground",children:["(",y.id,")"]})]})]},y.id)),d?.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No available accounts found in this Slack workspace."})]}),g&&(0,e.jsx)(C,{variant:"ghost",disabled:o.isPending,onClick:t(()=>o.mutate({accountCursor:g}),"onClick"),children:"Load more Slack accounts"}),o.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:F(o.error).body}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)(C,{variant:"ghost",disabled:o.isPending,onClick:t(()=>x(null),"onClick"),children:"Cancel"}),(0,e.jsx)(C,{disabled:!h||o.isPending,onClick:t(()=>o.mutate({slackUserId:h}),"onClick"),children:o.isPending?"Sending invitation…":"Send connection invitation"})]})]})})]})}t(Rt,"SlackTestMessageButton");var re=t((s,a)=>`/companies/${s}/slack/endpoints/${a}`,"root"),ie={capabilities:t((s,a)=>ne.get(`${re(s,a)}/capabilities`),"capabilities"),search:t((s,a)=>ne.get(`${re(s,a)}/search`),"search"),configure:t((s,a,n)=>ne.put(`${re(s,a)}/search`,n),"configure"),connect:t((s,a)=>ne.post(`${re(s,a)}/search/connect`,{}),"connect"),disconnect:t((s,a)=>ne.delete(`${re(s,a)}/search`),"disconnect")};function Pt({capabilities:s,error:a}){return(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Read, search, and act in Slack. Some actions require approval."}),a&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:a}),!s&&!a&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Checking Slack permissions…"}),s&&(0,e.jsx)(e.Fragment,{children:s.missingScopes.length>0&&(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Add permissions to unlock more tools"}),(0,e.jsxs)("p",{className:"text-sm",children:["Your existing connection still works. In"," ",(0,e.jsx)("a",{className:"underline underline-offset-4",href:"https://api.slack.com/apps",target:"_blank",rel:"noreferrer",children:"Slack app settings"}),", choose your app, open OAuth & Permissions, add these Bot Token Scopes, then reinstall the app to your workspace."]}),(0,e.jsx)("p",{className:"text-xs font-mono break-words",children:s.missingScopes.join(", ")})]})})]})}t(Pt,"SlackCapabilitiesView");function Et({status:s,onConnect:a,onDisconnect:n,onConfigure:l}){const d=(0,b.useId)(),[x,g]=(0,b.useState)(s.clientId??""),[m,h]=(0,b.useState)(""),[k,i]=(0,b.useState)(!1),[u,p]=(0,b.useState)(null),r=t(async o=>{i(!0),p(null);try{await o()}catch(f){p(F(f).body)}finally{i(!1)}},"perform");return(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Your Slack search access"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Optional personal authorization enables private search on supported runtimes. It cannot read channels the bot hasn’t joined or let the bot write as you. Basic channel reading works without it."}),!s.nativeSearchAvailable&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:s.limitation}),s.connected?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm",children:"Slack search connected"}),(0,e.jsx)(C,{variant:"outline",size:"sm",disabled:k,onClick:t(()=>{r(n)},"onClick"),children:"Disconnect search"})]}):(0,e.jsx)(C,{variant:"outline",disabled:k||!s.configured,onClick:t(()=>{r(a)},"onClick"),children:"Connect Slack search"}),!s.configured&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"A connection manager needs to configure your Slack app’s OAuth credentials first."}),s.canConfigure&&(0,e.jsxs)("details",{className:"text-sm",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-muted-foreground",children:"OAuth app configuration for connection managers"}),(0,e.jsxs)("form",{className:"mt-3 space-y-3",onSubmit:t(o=>{o.preventDefault(),r(async()=>{await l({clientId:x,clientSecret:m}),h("")})},"onSubmit"),children:[(0,e.jsxs)("p",{className:"text-sm",children:["In Slack app settings, add this redirect URL under OAuth & Permissions. Add user scopes ",(0,e.jsx)("code",{children:"search:read.public"}),","," ",(0,e.jsx)("code",{children:"search:read.private"})," and"," ",(0,e.jsx)("code",{children:"search:read.files"}),". Find Client ID and Client Secret under Basic Information."]}),(0,e.jsx)("p",{className:"text-xs font-mono break-all",children:s.redirectUri??"Configure a public HTTPS URL first."}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-client`,children:"Client ID"}),(0,e.jsx)(J,{id:`${d}-client`,value:x,onChange:t(o=>g(o.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-secret`,children:"Client Secret"}),(0,e.jsx)(J,{id:`${d}-secret`,type:"password",autoComplete:"new-password",value:m,onChange:t(o=>h(o.target.value),"onChange")})]}),(0,e.jsx)("div",{className:"flex items-center justify-end gap-3",children:(0,e.jsx)(C,{type:"submit",size:"sm",disabled:k||!x||!m,children:"Save OAuth configuration"})})]})]}),u&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:u})]})}t(Et,"SlackSearchView");function $t({companyId:s,endpointId:a}){const n=U({queryKey:["slack-capabilities",s,a],queryFn:t(()=>ie.capabilities(s,a),"queryFn"),staleTime:6e4}),l=D(n);return(0,e.jsx)("div",{className:"space-y-3",children:(0,e.jsx)(Pt,{capabilities:n.data,error:l.kind==="error"?F(n.error).body:void 0})})}t($t,"SlackToolsSettings");function _t({companyId:s,endpointId:a}){const n=U({queryKey:["slack-search",s,a],queryFn:t(()=>ie.search(s,a),"queryFn")}),l=jt(),d=D(n);return d.kind==="error"?(0,e.jsx)(G,{error:n.error,action:"load Slack search access",onRetry:d.retry,retrying:d.isFetching}):n.data?(0,e.jsxs)(e.Fragment,{children:[l.fallback,(0,e.jsx)(Et,{status:n.data,onConnect:t(async()=>{l.reserve();try{const x=await ie.connect(s,a);await l.open(x.url)}catch(x){throw l.cancel(),x}},"onConnect"),onDisconnect:t(async()=>{await ie.disconnect(s,a),await n.refetch()},"onDisconnect"),onConfigure:t(async x=>{await ie.configure(s,a,x),await n.refetch()},"onConfigure")})]}):(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading search access…"})}t(_t,"SlackSearchAccess");function qt({value:s,onSave:a}){const n=(0,b.useId)(),[l,d]=(0,b.useState)(null),[x,g]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[k,i]=(0,b.useState)(!1),u=l??s,p=u.trim()!==s;return(0,e.jsxs)("form",{className:"space-y-3","aria-labelledby":`${n}-label`,onSubmit:t(async r=>{if(r.preventDefault(),!(x||!p)){g(!0),h(null),i(!1);try{await a(u.trim()),d(null),i(!0)}catch(o){h(F(o).body)}finally{g(!1)}}},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("label",{id:`${n}-label`,htmlFor:n,className:"text-sm font-semibold",children:"Additional communication instructions"}),(0,e.jsx)("p",{id:`${n}-help`,className:"text-sm text-muted-foreground",children:"Applies to new conversations."})]}),(0,e.jsx)(hs,{id:n,"aria-describedby":`${n}-help`,value:u,disabled:x,maxLength:4e3,rows:4,placeholder:"For example: Keep replies brief and explain technical terms.",onChange:t(r=>{d(r.target.value),i(!1),h(null)},"onChange")}),m&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:m}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{children:p?(0,e.jsx)(C,{type:"button",variant:"ghost",disabled:x,onClick:t(()=>{d(null),h(null),i(!1)},"onClick"),children:"Cancel"}):k?(0,e.jsx)("span",{role:"status",className:"text-sm text-muted-foreground",children:"Saved. Applies to new tasks."}):null}),(0,e.jsx)(C,{type:"submit",disabled:!p||x,children:x?"Saving…":"Save instructions"})]})]})}t(qt,"ChatCommunicationInstructions");function Ut(s){return s===void 0?"inherit":s===null?"clear":s.kind==="task_directory"?"task":s.kind==="existing"?`existing:${s.workspaceId}`:`source:${s.projectWorkspaceId}:${s.mode}`}t(Ut,"selectionKey");function $e({companyId:s,value:a,resource:n=!1,onSave:l}){const d=(0,b.useId)(),[x,g]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[k,i]=(0,b.useState)(null),[u,p]=(0,b.useState)(null),r=U({...ct(s)}),o=U({queryKey:["channel-workspace-choices",s],queryFn:t(()=>ut.listSummaries(s,{selectableForTask:!0}),"queryFn")}),f=x??a??{},A=JSON.stringify(a??{}),w=u!==null;(0,b.useEffect)(()=>{u!==null&&u!==A&&g(null)},[u,A]);const I=f.projectId===void 0?"inherit":f.projectId??"none",E=Ut(f.workspace),j=new Map;j.set("task",{kind:"task_directory"});for(const S of r.data??[])for(const R of S.workspaces??[])for(const c of["managed_isolated","shared"])j.set(`source:${R.id}:${c}`,{kind:"configured_source",projectWorkspaceId:R.id,mode:c});for(const S of o.data??[])j.set(`existing:${S.id}`,{kind:"existing",workspaceId:S.id});const y=!w&&JSON.stringify(f)!==A,T=t(S=>{g(S),p(null),i(null)},"change");return(0,e.jsxs)("form",{className:"space-y-3","aria-labelledby":`${d}-title`,onSubmit:t(async S=>{if(S.preventDefault(),!(m||!y)){h(!0),i(null),p(null);try{await l(Object.keys(f).length?f:null),p(A)}catch(R){i(R instanceof Error?R.message:"Couldn’t save task defaults. Try again.")}finally{h(!1)}}},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{id:`${d}-title`,className:"text-sm font-semibold",children:"Task defaults"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Applies to new conversations. Existing tasks keep their files and project."})]}),(r.isError||o.isError)&&(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t load available projects or workspaces. ",(0,e.jsx)("button",{type:"button",className:"underline",onClick:t(()=>{r.refetch(),o.refetch()},"onClick"),children:"Try again"})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-project`,className:"text-sm font-medium",children:"Project"}),(0,e.jsxs)(Oe,{id:`${d}-project`,value:I,disabled:m||r.isPending,onChange:t(S=>{const{projectId:R,...c}=f;T(S.target.value==="inherit"?c:{...c,projectId:S.target.value==="none"?null:S.target.value})},"onChange"),children:[(0,e.jsx)("option",{value:"inherit",children:n?"Use connection defaults":"Use task defaults"}),(0,e.jsx)("option",{value:"none",children:"No project"}),f.projectId&&!r.data?.some(S=>S.id===f.projectId)&&(0,e.jsx)("option",{value:f.projectId,children:"Saved project (unavailable)"}),(r.data??[]).map(S=>(0,e.jsx)("option",{value:S.id,children:S.name},S.id))]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:`${d}-workspace`,className:"text-sm font-medium",children:"Workspace"}),(0,e.jsxs)(Oe,{id:`${d}-workspace`,value:E,disabled:m||r.isPending||o.isPending,onChange:t(S=>{const R=S.target.value,{workspace:c,...v}=f;if(R==="inherit")T(v);else if(R==="clear")T({...v,workspace:null});else{const q=j.get(R);q&&T({...v,workspace:q})}},"onChange"),children:[(0,e.jsx)("option",{value:"inherit",children:n?"Use connection defaults":"Use project or task defaults"}),n&&(0,e.jsx)("option",{value:"clear",children:"Use project or task defaults"}),!n&&E==="clear"&&(0,e.jsx)("option",{value:"clear",children:"Use project or task defaults"}),(0,e.jsx)("option",{value:"task",children:"Task files — separate folder"}),f.workspace&&!j.has(E)&&(0,e.jsx)("option",{value:E,children:"Saved workspace (unavailable)"}),(r.data??[]).filter(S=>S.workspaces?.length).map(S=>(0,e.jsx)("optgroup",{label:S.name,children:S.workspaces.flatMap(R=>[(0,e.jsxs)("option",{value:`source:${R.id}:managed_isolated`,children:[R.name," — isolated checkout"]},`${R.id}:isolated`),(0,e.jsxs)("option",{value:`source:${R.id}:shared`,children:[R.name," — shared folder"]},`${R.id}:shared`)])},S.id)),(o.data?.length??0)>0&&(0,e.jsx)("optgroup",{label:"Existing workspaces",children:o.data.map(S=>(0,e.jsx)("option",{value:`existing:${S.id}`,children:S.name},S.id))})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Project and workspace access is checked for each task. A shared folder must also be allowed by the agent’s execution policy."})]}),k&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:k}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{children:y?(0,e.jsx)(C,{type:"button",variant:"ghost",disabled:m,onClick:t(()=>{g(null),i(null)},"onClick"),children:"Cancel"}):w?(0,e.jsx)("span",{role:"status",className:"text-sm text-muted-foreground",children:"Saved for new tasks."}):null}),(0,e.jsx)(C,{type:"submit",disabled:!y||m,children:m?"Saving…":"Save defaults"})]})]})}t($e,"ChatExecutionDefaults");function Lt(s,a){if(a==="github"&&s.externalUrl)try{const n=new URL(s.externalUrl),l=n.pathname.split("/");if(n.hostname==="github.com"&&["issues","pull"].includes(l[3])&&/^\d+$/.test(l[4]))return`${l[1]}/${l[2]} #${l[4]}`}catch{}return s.externalLabel}t(Lt,"conversationDestination");function Ft({rows:s,provider:a}){return s.length?(0,e.jsx)("ul",{"aria-label":"Conversations",className:"divide-y divide-border border-y border-border",children:s.map(n=>(0,e.jsxs)("li",{className:"flex items-start gap-3 py-4 text-sm",children:[(0,e.jsx)(xe,{name:a,brandKey:a,compact:!0,className:"mt-0.5 size-5! shrink-0 rounded-sm bg-transparent"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,e.jsxs)("div",{className:"break-words",children:[n.issueIdentifier&&(0,e.jsx)("span",{className:"mr-2 text-xs text-muted-foreground",children:n.issueIdentifier}),n.issueId?(0,e.jsx)(L,{className:"break-words font-medium hover:underline",to:`/issues/${n.issueId}`,children:n.issueTitle??n.issueIdentifier??"Microvac task"}):(0,e.jsx)("span",{className:"font-medium",children:n.issueTitle??"Waiting for task"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[n.externalUrl?(0,e.jsx)("a",{href:n.externalUrl,target:"_blank",rel:"noreferrer",className:z("break-words hover:text-foreground hover:underline",M),children:Lt(n,a)}):(0,e.jsx)("span",{className:z("break-all",M),children:n.externalLabel}),n.updatedAt&&(0,e.jsx)("time",{dateTime:n.updatedAt,children:le(n.updatedAt)}),n.state==="completed"&&(0,e.jsx)("span",{children:"Completed"})]})]}),n.state!=="active"&&n.state!=="completed"&&(0,e.jsx)(Te,{status:n.state})]},n.id))}):(0,e.jsx)(fs,{icon:Ys,message:"No conversations yet",description:a==="speko"?"Open an assigned task and choose Talk to agent.":a==="agentmail"?"Send an email to this agent’s address to start one.":"Mention the agent in an enabled destination to start one."})}t(Ft,"ChatConversationList");function ss({companyId:s,members:a,access:n,value:l,onChange:d,label:x}){const g=n?.memberships?.find(i=>i.companyId===s&&i.status==="active"),m=n?.isInstanceAdmin===!0||g?.membershipRole==="owner"||g?.membershipRole==="admin",h=a.filter(i=>i.status==="active"&&i.membershipRole!=="viewer"&&n&&(m||i.principalId===n.userId)).map(i=>({key:i.principalId,value:i.principalId,label:i.user?.name??i.user?.email??i.principalId,avatarUrl:i.user?.image,searchText:i.user?.email??void 0})),k=a.find(i=>i.principalId===l);return(0,e.jsx)(lt,{value:l,groups:[{id:"sponsors",options:h}],onValueChange:d,placeholder:"Select a member",searchPlaceholder:"Search members…",triggerAriaLabel:x,disabled:!n||h.length===0,renderValue:t(i=>i?(0,e.jsx)(ke,{name:i.label,avatarUrl:i.avatarUrl,size:"sm"}):l?(0,e.jsx)(ke,{name:k?.user?.name??k?.user?.email??l,avatarUrl:k?.user?.image,size:"sm"}):null,"renderValue"),renderOption:t(i=>(0,e.jsx)(ke,{name:i.label,avatarUrl:i.avatarUrl,size:"sm"}),"renderOption")})}t(ss,"GitHubSponsorSelect");var ts="w-full rounded-md border border-input bg-background px-3 py-2 text-sm",we={opened:"New pull request",synchronize:"Updated commits",reopened:"Reopened",ready_for_review:"Ready for review",mention:"Mention",comment:"Follow-up comment"};function Dt({label:s,children:a}){const[n,l]=(0,b.useState)(!1);return(0,e.jsxs)(ot,{open:n,onOpenChange:l,children:[(0,e.jsx)(dt,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":`About ${s}`,className:"inline-flex shrink-0 items-center text-muted-foreground hover:text-foreground",onClick:t(()=>l(!0),"onClick"),children:(0,e.jsx)(it,{className:"size-4"})})}),(0,e.jsx)(mt,{className:z("max-w-xs",M),children:a})]})}t(Dt,"GitHubHelp");function O({label:s,description:a,help:n,checked:l,onChange:d,ariaLabel:x,disabled:g}){return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4 py-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("p",{className:"break-words text-sm font-medium",children:s}),n&&(0,e.jsx)(Dt,{label:s,children:n})]}),a&&(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a})]}),(0,e.jsx)(fe,{"aria-label":x??s,disabled:g,checked:l,onCheckedChange:d})]})}t(O,"GitHubToggle");function as({id:s,values:a,separator:n=`
|
|
2
2
|
`,onChange:l}){const d=n===","?", ":`
|
|
3
3
|
`,[x,g]=(0,b.useState)(a.join(d)),m=t(k=>k.split(n).map(i=>i.trim()).filter(Boolean),"parse");(0,b.useEffect)(()=>{g(k=>JSON.stringify(m(k))===JSON.stringify(a)?k:a.join(d))},[a,n]);const h={id:s,value:x,onChange:t(k=>{g(k.target.value),l(m(k.target.value))},"onChange")};return n===`
|
|
4
4
|
`?(0,e.jsx)(hs,{...h}):(0,e.jsx)(J,{...h})}t(as,"GitHubListInput");function Mt({value:s,onChange:a,onValidityChange:n,text:l,onTextChange:d}){const x=(0,b.useId)(),[g,m]=(0,b.useState)(String(s??5)),h=l??g,k=d??m,i=Number(h),u=s===null||h.trim()!==""&&Number.isInteger(i)&&i>=1&&i<=5;return(0,b.useEffect)(()=>m(String(s??5)),[s]),(0,b.useEffect)(()=>{n?.(u)},[u,n]),(0,e.jsxs)("div",{className:"space-y-3 py-3",children:[(0,e.jsx)(H,{htmlFor:x,children:"Passing score"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(J,{id:x,type:"number",min:1,max:5,step:1,required:!0,className:"w-20",value:h,disabled:s===null,"aria-invalid":!u,"aria-describedby":`${x}-help${u?"":` ${x}-error`}`,onChange:t(p=>{const r=p.target.value;k(r);const o=Number(r);r.trim()&&Number.isInteger(o)&&o>=1&&o<=5&&a(o)},"onChange")}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"out of 5"})]}),(0,e.jsxs)(H,{className:"flex items-center gap-2 text-sm font-normal",children:[(0,e.jsx)(Se,{"aria-label":"Report only",checked:s===null,onCheckedChange:t(p=>{k("5"),a(p===!0?null:5)},"onCheckedChange")}),"Report only"]})]}),!u&&(0,e.jsx)("p",{id:`${x}-error`,role:"alert",className:"text-xs text-destructive",children:"Enter a whole number from 1 to 5."}),(0,e.jsx)("p",{id:`${x}-help`,className:"text-xs text-muted-foreground",children:s===null?"Publishes a neutral check without a score requirement. GitHub can accept neutral checks for merging.":"Microvac passes the check when a complete review of the latest commit meets this score. Lower scores fail. This does not approve the PR."}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["To block merging, require the ",(0,e.jsx)("strong",{children:"Microvac Review"})," check from this App in your GitHub branch rules."," ",(0,e.jsx)("a",{className:"underline hover:text-foreground",href:"https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository",target:"_blank",rel:"noreferrer",children:"Configure on GitHub"})]})]})}t(Mt,"GitHubPassingScore");function zt({policy:s,onChange:a,accessHref:n,onValidityChange:l,scoreText:d,onScoreTextChange:x,rememberedAutomaticMode:g,readOnly:m=!1}){const h=(0,b.useId)(),k=(0,b.useRef)("linked_authors");s.invocation!=="mentions_only"&&(k.current=s.invocation);const i=t((o,f,A)=>(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(H,{htmlFor:`${h}-github-${o}`,children:f}),(0,e.jsx)(as,{id:`${h}-github-${o}`,values:s[o],onChange:t(w=>r(o,w),"onChange")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:A})]}),"filterField"),[u,p]=(0,b.useState)("opened"),r=t((o,f)=>a({...s,[o]:f}),"set");return(0,e.jsxs)("div",{className:"space-y-8",children:[(0,e.jsxs)("section",{className:"space-y-3","aria-labelledby":`${h}-github-instructions-heading`,children:[(0,e.jsx)("h2",{id:`${h}-github-instructions-heading`,className:"text-base font-semibold",children:"Instructions"}),(0,e.jsx)(Be,{readOnly:m,ariaLabel:"Agent instructions",contentClassName:"min-h-32",value:s.instructions,placeholder:"What should this agent do on GitHub?",onChange:t(o=>r("instructions",o),"onChange")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Included in every GitHub task. Type / to select a skill for the agent to use."}),(0,e.jsx)(K,{title:"Event-specific instructions",children:(0,e.jsxs)("div",{className:"grid gap-3 pt-3",children:[(0,e.jsx)(H,{htmlFor:`${h}-github-prompt-event`,className:"sr-only",children:"Event"}),(0,e.jsxs)("select",{id:`${h}-github-prompt-event`,className:ts,value:u,onChange:t(o=>p(o.target.value),"onChange"),children:[es.map(o=>(0,e.jsx)("option",{value:o,children:we[o]},o)),(0,e.jsx)("option",{value:"issue_opened",children:"New issue"})]}),(0,e.jsx)(Be,{readOnly:m,ariaLabel:`${u==="issue_opened"?"New issue":we[u]} instructions`,contentClassName:"min-h-32",value:u==="issue_opened"?s.issueOpenedInstructions??"":s.prompts[u],onChange:t(o=>u==="issue_opened"?r("issueOpenedInstructions",o):r("prompts",{...s.prompts,[u]:o}),"onChange")},u),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Added to the main instructions for this event. Type / to select a skill for the agent to use."})]})})]}),(0,e.jsxs)("section",{className:"space-y-3","aria-labelledby":`${h}-github-triggers-heading`,children:[(0,e.jsx)("h2",{id:`${h}-github-triggers-heading`,className:"text-base font-semibold",children:"When to run"}),(0,e.jsxs)("div",{className:"flex items-start gap-3 py-2",children:[(0,e.jsx)(It,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"When mentioned"}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Authorized people can always @mention this bot."," ",n&&(0,e.jsx)(L,{className:"underline underline-offset-4",to:n,children:"Manage people in Access"})]})]})]}),(0,e.jsx)(O,{label:"Run automatically",description:"Start work without a mention when an allowed person creates an issue or updates a pull request.",checked:s.invocation!=="mentions_only",onChange:t(o=>r("invocation",o?g??k.current:"mentions_only"),"onChange")}),s.invocation!=="mentions_only"&&(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"grid gap-x-6 gap-y-3 sm:grid-cols-2","aria-label":"Automatic events",children:[es.slice(0,4).map(o=>(0,e.jsxs)(H,{className:"flex cursor-pointer items-center gap-3 text-sm font-normal",children:[(0,e.jsx)(Se,{checked:s.events.includes(o),onCheckedChange:t(f=>r("events",f===!0?[...new Set([...s.events,o])]:s.events.filter(A=>A!==o)),"onCheckedChange")}),we[o]]},o)),(0,e.jsxs)(H,{className:"flex cursor-pointer items-center gap-3 text-sm font-normal",children:[(0,e.jsx)(Se,{checked:s.issueOpened===!0,onCheckedChange:t(o=>r("issueOpened",o===!0),"onCheckedChange")}),"New issues"]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Runs for authorized authors in Access. Use the author filters below to limit whose issues and PRs start work."}),(0,e.jsxs)(K,{title:"Automatic review filters",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{label:"Include draft PRs",checked:s.reviewDrafts,onChange:t(o=>r("reviewDrafts",o),"onChange")}),(0,e.jsx)(O,{label:"Include bot authors",description:"The account also needs a sponsor and external-contributor automatic runs enabled in Access.",checked:s.reviewBotAuthors,onChange:t(o=>r("reviewBotAuthors",o),"onChange")})]}),(0,e.jsx)(K,{title:"Authors",children:(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[i("includeAuthors","Included authors","Leave empty for all authorized authors. One username or glob per line."),i("excludeAuthors","Excluded authors","One username or glob per line.")]})}),(0,e.jsx)(K,{title:"Branches",children:(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[i("targetBranches","Target branches","Leave empty for all branches. Supports * and **."),i("excludedBranches","Excluded branches","Supports * and **.")]})}),(0,e.jsx)(K,{title:"Labels",children:(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[i("requiredLabels","Required labels","All listed labels must be present."),i("excludedLabels","Excluded labels","Any listed label prevents automatic review.")]})}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Reviews requested by @mention bypass these scheduling filters. Repository access and ignored files still apply."})]})]})]}),(0,e.jsxs)("section",{className:"space-y-3","aria-labelledby":`${h}-github-results-heading`,children:[(0,e.jsx)("h2",{id:`${h}-github-results-heading`,className:"text-base font-semibold",children:"Review results"}),(0,e.jsxs)("div",{className:"grid gap-x-8 sm:grid-cols-2",children:[(0,e.jsx)(O,{label:"Post a review summary",checked:s.publishSummary,onChange:t(o=>r("publishSummary",o),"onChange")}),(0,e.jsx)(O,{label:"Post inline findings",checked:s.publishInline,onChange:t(o=>r("publishInline",o),"onChange")})]}),(0,e.jsx)(Mt,{value:s.ratingThreshold,text:d,onTextChange:x,onChange:t(o=>r("ratingThreshold",o),"onChange"),onValidityChange:l})]}),(0,e.jsxs)("div",{className:"divide-y divide-border",children:[(0,e.jsx)(K,{title:"Ignored files",children:i("ignoredPaths","File patterns","Excluded from all reviews, including @mentions. One pattern per line; supports * and **.")}),(0,e.jsx)(K,{title:"Inline comment options",children:(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(H,{htmlFor:`${h}-github-categories`,children:"Finding categories"}),(0,e.jsx)(as,{id:`${h}-github-categories`,values:s.findingCategories,separator:",",onChange:t(o=>r("findingCategories",o),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(H,{htmlFor:`${h}-github-severity`,children:"Minimum inline severity"}),(0,e.jsxs)("select",{id:`${h}-github-severity`,className:ts,value:s.minimumCommentSeverity,onChange:t(o=>r("minimumCommentSeverity",o.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"info",children:"Info"}),(0,e.jsx)("option",{value:"warning",children:"Warning"}),(0,e.jsx)("option",{value:"error",children:"Error"})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Hidden findings still count in the assessment."})]})]})}),(0,e.jsxs)(K,{title:"Approvals and change requests",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Optional formal decisions on GitHub. Scores, comments, and checks still work when these are off."}),(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{label:"Allow approvals",help:"Lets the agent submit an Approve review on GitHub after a complete assessment. The agent must explicitly choose it; a 5/5 score or passing check does not approve the PR. Off still allows scores, comments, and checks.",checked:s.allowApprove,onChange:t(o=>r("allowApprove",o),"onChange")}),(0,e.jsx)(O,{label:"Allow request changes",help:"Lets the agent submit a Request changes review on GitHub after a complete assessment. This is a formal review decision and may prevent merging under your repository rules. Off still allows findings, comments, and a failing check.",checked:s.allowRequestChanges,onChange:t(o=>r("allowRequestChanges",o),"onChange")})]})]})]})]})}t(zt,"GitHubPolicyEditor");function Ht({endpointId:s,companyId:a,configuration:n,onChange:l}){const d=Gs()?.companies.find(N=>N.id===a),x=(0,b.useRef)(null),[g,m]=(0,b.useState)(!1),[h,k]=(0,b.useState)(null),i=U({queryKey:["github-members",a],queryFn:t(()=>Je.listMembers(a),"queryFn")}),u=U({queryKey:$.access.currentBoardAccess,queryFn:t(()=>Je.getCurrentBoardAccess(),"queryFn")}),p=U({queryKey:["github-linked-members",s],queryFn:t(()=>_.listPrincipals(s),"queryFn")}),r=D(i),o=D(p),f=D(u),A=o.kind==="ready"||o.kind==="stale",[w,I]=(0,b.useState)(""),[E,j]=(0,b.useState)(""),y=E||u.data?.userId||"",[T,S]=(0,b.useState)(null),[R,c]=(0,b.useState)(""),[v,q]=(0,b.useState)(""),[V,ce]=(0,b.useState)(!1),Z=(i.data?.members??[]).filter(N=>N.status==="active"&&N.membershipRole!=="viewer"),de=(p.data??[]).filter(N=>N.status==="linked"),Cs=Z.find(N=>N.principalId===n.responsibleUserId),_e=t(N=>Z.find(P=>P.principalId===N)?.user?.name??N,"memberName"),je=n.defaults.invocation!=="mentions_only",Ss=n.defaults.invocation==="allowed_authors",qe=n.people.filter(N=>N.kind==="guest"),Ue=[...n.people.filter(N=>N.kind==="member"),...de.filter(N=>N.githubUserId&&N.paperclipUserId&&!n.people.some(P=>P.githubUserId===N.githubUserId)).map(N=>({kind:"member",userId:N.paperclipUserId,githubUserId:N.githubUserId,login:N.githubLogin??N.externalLabel}))],Le=t(N=>l({...n,people:n.people.some(P=>P.githubUserId===N.githubUserId)?n.people.map(P=>P.githubUserId===N.githubUserId?N:P):[...n.people,N]}),"updatePerson"),Fe=t(N=>l({...n,people:n.people.filter(P=>P.githubUserId!==N.githubUserId)}),"removePerson"),As=t(async N=>{ce(!0),c("");try{await _.revokeLink(s,N),await p.refetch()}catch(P){c(F(P).body)}finally{ce(!1)}},"unlink"),De=t(N=>(0,e.jsx)("div",{className:"divide-y divide-border",children:N.map(P=>{const se=de.find(ae=>ae.githubUserId===P.githubUserId),te=P.kind==="guest"||!!se,Me=n.people.some(ae=>ae.githubUserId===P.githubUserId),Is=P.kind==="guest"||n.memberAccess==="all_linked"||Me,ze=Me&&(P.kind==="guest"||n.memberAccess==="selected");return(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-3 py-4",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 basis-32",children:[(0,e.jsxs)("p",{className:z("break-words text-sm font-medium",M),children:["@",P.login]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:P.kind==="guest"?`Sponsored by ${_e(P.sponsorUserId)}`:se?.paperclipUserLabel??"Company member"}),!te&&(0,e.jsx)("p",{className:"mt-1 text-xs text-destructive",children:"GitHub account needs linking."})]}),(0,e.jsxs)("div",{className:"flex items-center gap-5",children:[(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Mentions"}),P.kind==="guest"||n.memberAccess==="all_linked"?(0,e.jsxs)("span",{className:"flex h-5 items-center gap-1 text-xs","aria-label":`Mentions ${te?"allowed":"unavailable"} for @${P.login}`,children:[te&&(0,e.jsx)(pe,{className:"size-3.5 text-muted-foreground"}),te?"Allowed":"Unlinked"]}):(0,e.jsx)(fe,{"aria-label":`Allow mentions from @${P.login}`,checked:Is,disabled:!te,onCheckedChange:t(ae=>ae?Le(P):Fe(P),"onCheckedChange")})]}),(se||ze)&&(0,e.jsxs)(bs,{children:[(0,e.jsx)(os,{asChild:!0,children:(0,e.jsx)(C,{size:"icon",variant:"ghost","aria-label":`Manage @${P.login}`,children:(0,e.jsx)(gs,{className:"size-4"})})}),(0,e.jsxs)(ps,{className:"ph-mask ph-sensitive",align:"end",children:[ze&&(0,e.jsx)(ge,{onClick:t(()=>Fe(P),"onClick"),children:"Remove access"}),se&&(0,e.jsx)(ge,{disabled:V,onClick:t(()=>{As(se.principalId)},"onClick"),children:"Unlink GitHub account"})]})]})]})]},P.githubUserId)})}),"peopleRows");return(0,e.jsxs)("section",{className:"space-y-6","aria-label":"People",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"People"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Choose who can mention this bot and whose activity can start work automatically."})]}),(0,e.jsxs)("section",{className:"space-y-2","aria-label":"Company members",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Company members"}),(0,e.jsxs)(C,{variant:"outline",size:"sm",onClick:t(()=>{k("member"),m(!1),c("")},"onClick"),children:[(0,e.jsx)(Ze,{className:"size-4"}),"Link a member"]})]}),(0,e.jsx)(O,{label:"Allow mentions from all linked members",description:n.memberAccess==="all_linked"?`Includes members from ${d?.name??"this company"} who link their GitHub account later.`:"Only members you enable below can mention this bot.",checked:n.memberAccess==="all_linked",onChange:t(N=>l({...n,memberAccess:N?"all_linked":"selected"}),"onChange")}),De(Ue),(p.isPending||o.kind==="reconnecting")&&(0,e.jsx)("p",{role:"status",className:"py-4 text-sm text-muted-foreground",children:"Loading linked accounts…"}),A&&Ue.length===0&&(0,e.jsx)("p",{className:"py-4 text-sm text-muted-foreground",children:"No members linked yet. Link an account to get started."}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:je?(0,e.jsxs)(e.Fragment,{children:["Automatic runs use the events and author filters in"," ",(0,e.jsx)(L,{className:"underline underline-offset-4",to:`/apps/chat/${s}/settings`,children:"Settings"}),"."]}):(0,e.jsxs)(e.Fragment,{children:["Automatic runs are off in"," ",(0,e.jsx)(L,{className:"underline underline-offset-4",to:`/apps/chat/${s}/settings`,children:"Settings"}),". Authorized @mentions still work."]})})]}),(0,e.jsxs)("section",{className:"space-y-2 border-t border-border pt-6","aria-label":"External contributors",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"External contributors"}),(0,e.jsxs)(C,{variant:"outline",size:"sm",onClick:t(()=>{j(u.data?.userId??""),k("guest"),q("")},"onClick"),children:[(0,e.jsx)(Ze,{className:"size-4"}),"Add external contributor"]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Allow specific GitHub users with a member as their sponsor. They receive restricted access, without company membership or the sponsor’s personal credentials."}),De(qe),qe.length>0&&(0,e.jsx)(O,{label:"Allow automatic runs for external contributors",description:je?"Authorized contributors can trigger the events and author filters configured in Settings.":"Turn on automatic runs in Settings first. Mentions remain available.",checked:Ss,disabled:!je,onChange:t(N=>l({...n,defaults:{...n.defaults,invocation:N?"allowed_authors":"linked_authors"}}),"onChange")})]}),(0,e.jsx)(K,{title:"Automatic task responsibility",children:(0,e.jsxs)("div",{className:"space-y-2",children:[Z.length===1&&Cs?(0,e.jsxs)("p",{className:"text-sm",children:["Responsible member: ",_e(n.responsibleUserId)]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(H,{children:"Responsible member"}),(0,e.jsx)(ss,{label:"Responsible member",companyId:a,members:Z,access:u.data,value:n.responsibleUserId,onChange:t(N=>l({...n,responsibleUserId:N}),"onChange")})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"The member accountable for automatically created Microvac tasks. GitHub authors remain recorded separately. This grants no access to the member’s personal credentials. Only company owners, company admins, and instance admins can select another person as a sponsor or responsible member."})]})}),R&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:R}),(r.kind==="error"||o.kind==="error"||f.kind==="error")&&(0,e.jsx)(G,{error:r.kind==="error"?i.error:o.kind==="error"?p.error:u.error,action:"load members, linked accounts, and your access",onRetry:t(()=>{r.retry(),o.retry(),f.retry()},"onRetry"),retrying:i.isFetching||p.isFetching||u.isFetching}),(0,e.jsx)(ye,{open:h!==null,onOpenChange:t(N=>{N||k(null)},"onOpenChange"),children:(0,e.jsxs)(be,{className:M,children:[(0,e.jsxs)(Re,{children:[(0,e.jsx)(ve,{children:h==="member"?"Link a company member":"Add external contributor"}),(0,e.jsx)(Ee,{children:h==="member"?"Each member confirms their own GitHub identity. Share this link with an existing company member, or link your own account.":"Allow a GitHub user to mention this bot. A company member must sponsor their restricted access."})]}),h==="member"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(C,{variant:"outline","aria-label":"Copy account linking URL",onClick:t(()=>{x.current&&oe(x.current.href).then(()=>m(!0),()=>c("Could not copy the link. Open account linking and copy the address."))},"onClick"),children:[(0,e.jsx)(X,{className:"size-4"}),g?"Copied":"Copy invitation link"]}),(0,e.jsx)(L,{ref:x,to:`/apps/chat/connect?provider=github&resume=${s}&stage=identity`,className:"text-sm underline underline-offset-4",children:"Link your account"}),R&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:R})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(H,{htmlFor:"github-guest-login",children:"GitHub username"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(J,{id:"github-guest-login",value:w,placeholder:"octocat",disabled:V,onChange:t(N=>{I(N.target.value),S(null),q("")},"onChange")}),(0,e.jsx)(C,{variant:"outline",disabled:V||!w.trim(),onClick:t(async()=>{ce(!0),q(""),S(null);try{S(await B.lookup(s,w))}catch(N){q(F(N).body)}finally{ce(!1)}},"onClick"),children:V?"Looking up…":"Look up"})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(H,{children:"Sponsor"}),(0,e.jsx)(ss,{label:"Sponsor",companyId:a,members:Z,access:u.data,value:y,onChange:j})]}),T&&(0,e.jsx)("p",{role:"status",className:z("text-sm","ph-mask ph-sensitive"),children:n.people.some(N=>N.githubUserId===T.githubUserId)||de.some(N=>N.githubUserId===T.githubUserId)?`@${T.login} is already listed in People.`:`Found @${T.login}. They will be able to mention the bot after you save.`}),v&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:v}),(0,e.jsxs)(ms,{className:"flex-row justify-between sm:justify-between",children:[(0,e.jsx)(C,{variant:"ghost",onClick:t(()=>k(null),"onClick"),children:"Cancel"}),(0,e.jsx)(C,{disabled:!T||!Z.some(N=>N.principalId===y)||n.people.some(N=>N.githubUserId===T.githubUserId)||de.some(N=>N.githubUserId===T.githubUserId),onClick:t(()=>{T&&(Le({...T,kind:"guest",sponsorUserId:y,permissionProfile:"restricted"}),k(null),S(null),I(""))},"onClick"),children:"Add contributor"})]})]})]})})]})}t(Ht,"GitHubAccessEditor");function Gt({endpointId:s,companyId:a,managementUrl:n,pending:l,onRefresh:d,onChange:x,onToggleAll:g}){const m=Y(),[h,k]=(0,b.useState)(""),i=(0,b.useRef)(null),u=(0,b.useRef)(null),p=Ps({queryKey:["github-bot-repository-pages",s,h],queryFn:t(({pageParam:w})=>B.repositories(s,{limit:20,offset:w,search:h}),"queryFn"),initialPageParam:0,getNextPageParam:t(w=>w.nextOffset??void 0,"getNextPageParam")}),r=D(p),o=p.data?.pages.flatMap(w=>w.items)??[],f=p.data?.pages[0],A=(f?.enabledCount??0)>0;return(0,b.useEffect)(()=>{i.current&&(i.current.scrollTop=0)},[h]),(0,b.useEffect)(()=>{if(!p.hasNextPage||p.isFetching||p.isError||r.kind==="error"||l||!u.current||typeof IntersectionObserver>"u")return;const w=new IntersectionObserver(([I])=>{I?.isIntersecting&&p.fetchNextPage({cancelRefetch:!1})},{root:i.current});return w.observe(u.current),()=>w.disconnect()},[p.hasNextPage,p.isFetching,p.isError,r.kind,p.fetchNextPage,l]),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Repositories"}),(0,e.jsxs)(bs,{children:[(0,e.jsx)(os,{asChild:!0,children:(0,e.jsx)(C,{variant:"ghost",size:"icon","aria-label":"Manage repositories",children:(0,e.jsx)(gs,{className:"size-4"})})}),(0,e.jsxs)(ps,{className:M,align:"end",children:[(0,e.jsx)(ge,{asChild:!0,children:(0,e.jsxs)("a",{href:n,target:"_blank",rel:"noreferrer",children:["Manage on GitHub",(0,e.jsx)(ue,{className:"size-4"})]})}),(0,e.jsxs)(ge,{disabled:l,onClick:d,children:[(0,e.jsx)(Ce,{className:"size-4"}),"Refresh repositories"]})]})]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose where the bot can receive messages and use tools. Repository changes save immediately."}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative min-w-0 flex-1 basis-48",children:[(0,e.jsx)(Ls,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),(0,e.jsx)(J,{"aria-label":"Search repositories",placeholder:"Search repositories",className:"pl-9",value:h,maxLength:200,onChange:t(w=>k(w.target.value),"onChange")})]}),(0,e.jsx)(C,{variant:"outline",size:"sm",disabled:l||p.isFetching||!f||!f.totalCount||!A&&!f.availableCount,"aria-label":`${A?"Disable":"Enable"} all repositories`,onClick:t(()=>g(!A),"onClick"),children:A?"Disable all":"Enable all"})]}),f&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[f.enabledCount," of ",f.totalCount," repositories enabled. Toggle all applies across the entire connection."]}),r.kind==="error"&&(0,e.jsx)(G,{error:p.error,action:"load repositories",onRetry:r.retry,retrying:r.isFetching}),(0,e.jsxs)("div",{ref:i,role:"region","aria-label":"Repositories",tabIndex:0,className:"max-h-96 overflow-y-auto overscroll-contain border-y border-border",children:[(0,e.jsx)("div",{className:"divide-y divide-border",children:o.map(w=>(0,e.jsxs)("div",{className:"px-1 py-1",children:[(0,e.jsx)(O,{label:w.label??w.providerResourceId,checked:w.enabled,disabled:l||w.availability!=="available"&&!w.enabled,description:w.availability==="available"?void 0:"Unavailable on GitHub. Update the App’s installation access, then refresh.",onChange:t(I=>x(w.id,I),"onChange")}),(0,e.jsxs)("details",{className:"text-sm",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-muted-foreground",children:"Task defaults"}),(0,e.jsx)("div",{className:"pt-3",children:(0,e.jsx)($e,{companyId:a,value:w.executionDefaults,resource:!0,onSave:t(async I=>{await _.updateResources(s,[{id:w.id,executionDefaults:I}]),await m.invalidateQueries({queryKey:["github-bot-repositories",s]}),await m.invalidateQueries({queryKey:["github-bot-repository-pages",s]})},"onSave")})})]})]},w.id))}),p.isPending||r.kind==="reconnecting"?(0,e.jsx)("p",{role:"status",className:"py-4 text-sm text-muted-foreground",children:"Loading repositories…"}):(r.kind==="ready"||r.kind==="stale")&&o.length===0&&(0,e.jsx)("p",{className:"py-4 text-sm text-muted-foreground",children:h?"No repositories match your search.":"No repositories available. Add repository access on GitHub, then refresh."}),p.hasNextPage&&(0,e.jsx)("div",{ref:u,className:"flex justify-center py-2",children:(0,e.jsx)(C,{variant:"ghost",size:"sm",disabled:l||p.isFetching,onClick:t(()=>{p.fetchNextPage({cancelRefetch:!1})},"onClick"),children:p.isFetchingNextPage?"Loading repositories…":"Load more repositories"})})]})]})}t(Gt,"GitHubRepositoryAccess");function Ot({endpoint:s,view:a}){const n=Y(),l=U({queryKey:["github-bot-configuration",s.id],queryFn:t(()=>B.configuration(s.id),"queryFn")}),d=D(l),[x,g]=(0,b.useState)(null),[m,h]=(0,b.useState)(0),[k,i]=(0,b.useState)(null),[u,p]=(0,b.useState)(null),[r,o]=(0,b.useState)(!1),[f,A]=(0,b.useState)(""),[w,I]=(0,b.useState)(""),E=x??l.data,j=k??String(E?.configuration.defaults.ratingThreshold??5),y=Number(j),T=E?.configuration.defaults.ratingThreshold===null||j.trim()!==""&&Number.isInteger(y)&&y>=1&&y<=5,S=!!(x&&JSON.stringify(x.configuration)!==JSON.stringify(l.data?.configuration)),R=t(q=>{E&&(q.defaults.invocation!=="mentions_only"?p(q.defaults.invocation):E.configuration.defaults.invocation!=="mentions_only"&&p(E.configuration.defaults.invocation),g({...E,configuration:q})),A("")},"edit"),c=t(async q=>{o(!0),I("");try{await q()}catch(V){I(F(V).body)}finally{o(!1)}},"act");if(d.kind==="error")return(0,e.jsx)(G,{error:l.error,action:"load the bot configuration",onRetry:d.retry,retrying:d.isFetching});if(!E)return(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading configuration…"});const v=E.configuration;return(0,e.jsxs)("section",{className:"max-w-3xl space-y-8",children:[(0,e.jsx)("fieldset",{disabled:r,className:"min-w-0 space-y-8",children:a==="access"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Gt,{endpointId:s.id,companyId:s.companyId,pending:r,managementUrl:s.setup?.github?.managementUrl??s.setup?.github?.installationUrl??"https://github.com/settings/installations",onRefresh:t(()=>{c(async()=>{await B.refreshRepositories(s.id),await n.invalidateQueries({queryKey:["github-bot-repositories",s.id]}),await n.invalidateQueries({queryKey:["github-bot-repository-pages",s.id]}),A("Repository access refreshed. New repositories stay disabled.")})},"onRefresh"),onChange:t((q,V)=>{c(async()=>{await _.updateResources(s.id,[{id:q,enabled:V}]),await n.invalidateQueries({queryKey:["github-bot-repositories",s.id]}),await n.invalidateQueries({queryKey:["github-bot-repository-pages",s.id]})})},"onChange"),onToggleAll:t(q=>{c(async()=>{await B.toggleAllRepositories(s.id,q),await n.invalidateQueries({queryKey:["github-bot-repositories",s.id]}),await n.invalidateQueries({queryKey:["github-bot-repository-pages",s.id]})})},"onToggleAll")}),(0,e.jsx)(Ht,{endpointId:s.id,companyId:s.companyId,configuration:v,onChange:R}),!v.toolsEnabled&&(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This saved bot has GitHub tools disabled, so it cannot start work or respond."}),(0,e.jsx)(C,{variant:"outline",onClick:t(()=>R({...v,toolsEnabled:!0}),"onClick"),children:"Enable bot tools"})]}),s.connectionId&&(0,e.jsx)(L,{className:"text-xs text-muted-foreground underline underline-offset-4",to:`/apps/${s.connectionId}`,children:"Manage tool permissions"})]}):(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(zt,{readOnly:r,scoreText:j,onScoreTextChange:i,rememberedAutomaticMode:u??(v.defaults.invocation==="mentions_only"?"linked_authors":v.defaults.invocation),accessHref:`/apps/chat/${s.id}/access`,policy:v.defaults,onChange:t(q=>R({...v,defaults:q}),"onChange")},m)})}),w&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:w}),f&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:f}),(S||!T)&&(0,e.jsxs)("div",{className:"sticky bottom-(--tc-composer-bottom) z-10 flex items-center justify-between gap-3 border-t border-border bg-background py-4 md:bottom-0",children:[(0,e.jsx)(C,{variant:"ghost",disabled:r,onClick:t(()=>{g(null),i(null),p(null),h(q=>q+1),I("")},"onClick"),children:"Discard changes"}),(0,e.jsx)(C,{disabled:r||!T,onClick:t(()=>{c(async()=>{const q=await B.save(s.id,E.revision,v);n.setQueryData(["github-bot-configuration",s.id],q),g(null),i(null),p(null),A("Changes saved.")})},"onClick"),children:r?"Saving…":"Save changes"})]})]})}t(Ot,"GitHubBotManagement");function Kt(s){return[...s].sort((a,n)=>Date.parse(n.createdAt)-Date.parse(a.createdAt))}t(Kt,"orderedGitHubReviews");function js(s){const a=s.state==="completed"&&s.assessment?.complete,n=s.conclusion?{success:"Passed",failure:"Below threshold",neutral:"Report only",action_required:"Action required"}[s.conclusion]:"Awaiting check",l={queued:"Queued",running:"Reviewing",completed:"Incomplete",incomplete:"Incomplete",error:"Review failed",superseded:"Superseded",manual_required:"Action required"}[s.state];return a?`${s.assessment.score}/5 · ${n}`:l}t(js,"gitHubReviewResultLabel");function Bt({review:s}){return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:js(s)}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Commit ",(0,e.jsx)("code",{children:s.headSha.slice(0,7)})," ·"," ",le(s.updatedAt)]})]}),s.assessment?(0,e.jsx)(Ne,{className:"text-sm",children:s.assessment.summary}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No assessment has been submitted yet."}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-4 text-xs text-muted-foreground",children:[(0,e.jsx)(L,{className:"underline underline-offset-4",to:`/issues/${s.issueId}`,children:"Microvac task"}),s.summaryUrl&&(0,e.jsx)("a",{className:"underline underline-offset-4",href:s.summaryUrl,target:"_blank",rel:"noreferrer",children:"GitHub comment"}),s.checkUrl&&(0,e.jsx)("a",{className:"underline underline-offset-4",href:s.checkUrl,target:"_blank",rel:"noreferrer",children:"Check"})]}),(0,e.jsx)("section",{className:"space-y-4 text-sm","aria-label":"Review evidence",children:(0,e.jsxs)("div",{className:"space-y-3",children:[s.runId&&(0,e.jsx)(L,{className:"text-xs underline underline-offset-4",to:`/issues/${s.issueId}?runId=${s.runId}`,children:"Agent run"}),s.assessment&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h3",{className:"font-medium",children:"Rationale"}),(0,e.jsx)(Ne,{children:s.assessment.rationale}),s.assessment.findings.length>0&&(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"font-medium",children:"Findings"}),s.assessment.findings.map(a=>(0,e.jsxs)("div",{className:"space-y-2 border-l border-border pl-4",children:[(0,e.jsxs)("p",{className:"break-all font-mono text-xs",children:[a.path,":",a.line," · ",a.severity]}),(0,e.jsx)(Ne,{children:a.body})]},a.key))]}),(0,e.jsx)("h3",{className:"font-medium",children:"Coverage"}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.assessment.coverage.reviewedPaths.length," files reviewed · ",s.assessment.coverage.omittedPaths.length," omitted"]}),s.assessment.coverage.limitations.map((a,n)=>(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a},n))]})]})})]})}t(Bt,"ReviewResult");function Qt({endpointId:s,reviews:a}){return a.length?(0,e.jsx)("ul",{"aria-label":"Reviews",className:"divide-y divide-border border-y border-border",children:Kt(a).map(n=>(0,e.jsx)("li",{children:(0,e.jsxs)(L,{to:`/apps/chat/${s}/reviews/${n.id}`,className:"flex flex-wrap items-center gap-x-6 gap-y-2 py-4 text-sm hover:bg-accent/50",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 basis-48 space-y-1",children:[(0,e.jsx)("p",{className:"break-words font-medium",children:n.event.title||`Pull request #${n.pullNumber}`}),(0,e.jsxs)("p",{className:"break-all text-xs text-muted-foreground",children:[n.repository," #",n.pullNumber," ·"," ",(0,e.jsx)("code",{children:n.headSha.slice(0,7)})]})]}),(0,e.jsxs)("div",{className:"space-y-1 text-right",children:[(0,e.jsx)("p",{className:"font-medium",children:js(n)}),(0,e.jsx)("time",{className:"text-xs text-muted-foreground",dateTime:n.createdAt,children:le(n.createdAt)})]})]})},n.id))}):(0,e.jsx)(fs,{icon:Ms,message:"No reviews yet",description:"Mention the bot on a pull request, or enable automatic events in Settings."})}t(Qt,"GitHubReviewList");function Vt({endpointId:s,review:a}){return(0,e.jsxs)("article",{className:"max-w-3xl space-y-6",children:[(0,e.jsx)(L,{className:"text-sm text-muted-foreground hover:underline",to:`/apps/chat/${s}/reviews`,children:"← All reviews"}),(0,e.jsxs)("header",{className:"space-y-2",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:a.event.title||`Pull request #${a.pullNumber}`}),(0,e.jsxs)("a",{className:"break-all text-sm text-muted-foreground hover:underline",href:`https://github.com/${a.repository}/pull/${a.pullNumber}`,target:"_blank",rel:"noreferrer",children:[a.repository," #",a.pullNumber]})]}),(0,e.jsx)(Bt,{review:a})]})}t(Vt,"GitHubReviewDetail");function Wt({endpointId:s,reviewId:a}){const n=U({queryKey:["github-bot-reviews",s,a??"list"],queryFn:t(async()=>a?[await B.review(s,a)]:B.reviews(s),"queryFn"),refetchInterval:5e3}),l=D(n),d=(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{role:"alert",className:"text-sm text-muted-foreground",children:"This review was not found in this connection."}),(0,e.jsx)(L,{to:`/apps/chat/${s}/reviews`,className:"text-sm underline",children:"All reviews"})]});if(l.kind==="error")return a&&l.errorKind==="not_found"?d:(0,e.jsx)(G,{error:n.error,action:a?"load the review":"load reviews",onRetry:l.retry,retrying:l.isFetching});if(n.isPending||l.kind==="reconnecting")return(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading reviews…"});if(a){const x=n.data?.find(g=>g.id===a);return x?(0,e.jsx)(Vt,{endpointId:s,review:x}):d}return(0,e.jsx)(Qt,{endpointId:s,reviews:n.data??[]})}t(Wt,"GitHubReviews");function Jt({endpoint:s,agent:a,runtimeChecks:n,onClose:l,onCloseAutoFocus:d}){const x=U({queryKey:["github-connected-repositories",s.id],queryFn:t(()=>B.repositories(s.id,{limit:1}),"queryFn")}),g=D(x),m=a??{id:s.assignedAgentId,name:s.assignedAgentName},h=`${At(s)||"@your-bot"} review this pull request`,k=x.data?.enabledCount,i=n?.filter(u=>!u.ok)??[];return(0,e.jsx)(ye,{open:!0,onOpenChange:t(u=>{u||l()},"onOpenChange"),children:(0,e.jsx)(be,{className:z("max-h-(--sz-85dvh) overflow-y-auto sm:max-w-xl",M),"aria-describedby":void 0,onCloseAutoFocus:d?u=>{u.preventDefault(),d()}:void 0,children:(0,e.jsxs)("div",{className:"@container space-y-6",children:[(0,e.jsxs)("header",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(Ks,{className:"size-6 shrink-0 text-(--status-task-done)"}),(0,e.jsx)(ve,{className:"text-xl leading-normal",children:"GitHub connected"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(xs,{agent:m,size:48}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("h2",{className:"break-words text-base font-semibold",children:s.botLabel??s.botUsername??s.assignedAgentName}),(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:[(0,e.jsx)(L,{to:`/agents/${s.assignedAgentId}`,className:"hover:text-foreground hover:underline",children:s.assignedAgentName}),s.providerAccountLabel&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,e.jsxs)("span",{className:z("inline-flex items-center gap-1.5","ph-mask ph-sensitive"),children:[(0,e.jsx)(xe,{name:"GitHub",brandKey:"github",compact:!0,className:"size-4! rounded-sm bg-transparent"}),s.providerAccountLabel]})]})]}),(0,e.jsx)(L,{to:`/apps/chat/${s.id}/access`,className:"inline-block text-xs text-muted-foreground underline underline-offset-4",children:g.kind==="error"?"Repository access unavailable":k===void 0?"Repository access":k===0?"No repositories enabled":`${k} ${k===1?"repository":"repositories"} enabled`})]})]})]}),i.length>0&&(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h2",{className:"text-sm font-medium",children:"Before your first review"}),i.map(u=>(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:u.detail},u.key))]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Try your bot"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:k===0?"Enable a repository in Access to try your bot.":"Post this on a pull request in an enabled repository."})]}),(0,e.jsxs)(Us,{text:h,ariaLabel:"Copy mention",title:"Copy mention",containerClassName:"w-full",className:"flex w-full items-center gap-3 rounded-md border border-border bg-muted/30 p-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)("code",{className:"min-w-0 flex-1 break-words text-sm",children:h}),(0,e.jsx)(X,{className:"size-4 shrink-0 text-muted-foreground"})]})]}),(0,e.jsx)(wt,{endpoint:s,avatarUrl:ls(ds(m.appearance,s.assignedAgentId),512,1,"rest")}),(0,e.jsx)(ms,{children:(0,e.jsx)(C,{onClick:l,children:"Done"})})]})})})}t(Jt,"GitHubConnectionComplete");var ks=["settings","access","reviews","conversations","activity"],Yt=ks.map(s=>({value:s,label:s[0].toUpperCase()+s.slice(1)})),Ns={speko:"Speko",agentmail:"AgentMail",slack:"Slack",github:"GitHub",discord:"Discord","microsoft-teams":"Microsoft Teams",telegram:"Telegram","imessage-photon":"iMessage Photon"},ns={speko:{reconnect:"Reverify this voice persona and update its signed session tools. Existing task assignments stay attached to their history.",remove:"Stop this connection from accepting voice requests. Accepted work and task history remain in Microvac."},agentmail:{reconnect:"Reconnect the same email inbox.",remove:"Disconnect email and retain task history."},slack:{reconnect:"Reconnect verifies or replaces credentials for this same Slack app. It does not reinstall the app or change its workspace or channel membership.",remove:"Microvac archives the endpoint, stops new ingress, and retires its saved Slack credentials. It does not uninstall the Slack app: the app remains installed, and its bot remains in channels, until you remove them in Slack."},github:{reconnect:"Reconnect verifies this same App and installation, then updates its webhook URL, secret, and secure delivery settings. It does not reinstall the App or change repository access.",remove:"Microvac archives the endpoint, stops new ingress, and retires its saved App key and webhook secret. It does not uninstall the GitHub App: the App, its installations, and its webhook settings remain until you remove or update them on GitHub."},discord:{reconnect:"Reconnect verifies this same Discord application and server installation. It does not add or remove the bot from the server.",remove:"Microvac archives the endpoint, stops its Microvac Gateway connection, and retires its saved bot token. It does not uninstall the bot: the bot remains in the Discord server, and the application remains in the Developer Portal, until you remove them there."},"microsoft-teams":{reconnect:"Reconnect verifies this same Microsoft app, tenant, and bot identity. It does not upload or reinstall the Teams app.",remove:"Microvac archives the endpoint, stops new ingress, and retires its saved client secret. It does not uninstall the Teams app: the Entra app registration, Azure Bot, custom Teams app, and Teams installations remain until you remove them in Microsoft."},"imessage-photon":{reconnect:"Reconnect verifies the same Photon project and line allocation, then recovers eligible missed messages.",remove:"Disconnect archives this channel and removes its saved secret. Your Photon project, number, subscription, and Messages history remain in Photon."},telegram:{reconnect:"Reconnect verifies this same BotFather bot and automatically refreshes its Microvac webhook and command menu.",remove:"Microvac archives the endpoint and queues durable removal of its Telegram webhook and command menu. After Telegram confirms that cleanup, Microvac retires the saved token. The BotFather bot and its chat memberships remain until you remove them in Telegram."}},Zt={delivery:"Inbound delivery",publication:"Outbound publication",action:"Provider action",health:"Connection health",repair:"Connection repair"},ws=new Set(["failed"]),ee={staleTime:0,refetchInterval:5e3,refetchIntervalInBackground:!1};function Xt(s){return s.fileTransfer||!s.replayable||!ws.has(s.status)?!1:s.kind==="delivery"?s.status==="failed":s.kind==="publication"}t(Xt,"isReplayEligible");function me(s){const a=s.resolutionActions??[];return s.fileTransfer?s.kind!=="publication"||!Number.isSafeInteger(s.fileTransfer.version)||s.fileTransfer.version<1?[]:["consent_unknown","upload_unknown","file_info_unknown","conflict"].includes(s.fileTransfer.phase)?s.fileTransfer.phase==="file_info_unknown"?a:a.filter(n=>n==="cancel"):[]:a}t(me,"activityResolutionActions");function ea(s){const a=s.fileTransfer?.phase;return a==="file_info_unknown"?"The file upload was confirmed, but its Teams notification was not. Check Teams first. Retrying sends only that notification, not the file bytes, and may create a duplicate card.":a==="consent_unknown"?"The consent card may have reached Teams. File delivery is not confirmed. Cancelling here does not remove any card already sent.":a?"The file may already exist in OneDrive. Cancelling stops this Microvac transfer; it does not delete remote bytes. Uploads cannot be marked delivered or retried from this uncertain state.":"Microvac lost confirmation after sending. Check the provider conversation first. Retrying can create a duplicate message."}t(ea,"activityResolutionDescription");function sa(s){return(s.kind==="publication"||s.kind==="action")&&s.status==="delivery_unknown"&&me(s).length>0}t(sa,"isResolutionEligible");function ta(s,a){return!(s==="microsoft-teams"&&(a==="direct_message"||a==="group_chat"))}t(ta,"isIndividuallyToggleableResource");function aa(s){return ws.has(s.status)?"Reason":"Details"}t(aa,"activityDetailLabel");function na(s){const a=s.status==="active"?null:{draft:"Connection setup is incomplete.",verifying:"Connection verification is in progress.",paused:"Connection is paused. Resume it to receive new messages.",attention:"Connection needs attention.",revoked:"Connection access is revoked. Reconnect to verify access.",archived:"Connection has been removed from Microvac."}[s.status];return{message:a??s.healthMessage??null,previousHealth:a?s.healthMessage??null:null,error:s.lastError??null,errorLabel:["active","attention","revoked"].includes(s.status)?"Reason":"Last reported error"}}t(na,"connectionHealthPresentation");function Na(){const{userId:s,settled:a}=Qs(),{endpointId:n="",tab:l,reviewId:d}=Js(),x=d?"reviews":l??"settings",g=ks.includes(x)?x:null,m=us(),h=at(),k=(0,b.useRef)(null),i=h.state?.githubConnectionComplete,{setBreadcrumbs:u}=st(),p=U({queryKey:$.chatEndpoints.detail(n),queryFn:t(()=>_.get(n),"queryFn"),enabled:!!(n&&g),...ee,refetchInterval:g==="activity"||g==="conversations"?ee.refetchInterval:!1}),r=p.data,o=D(p),f=U({queryKey:$.agents.detail(r?.assignedAgentId??""),queryFn:t(()=>Ae.get(r.assignedAgentId),"queryFn"),enabled:r?.provider==="github"}),[A,w]=(0,b.useState)(null),I=U({queryKey:$.agents.detail(r?.assignedAgentId??""),queryFn:t(()=>Ae.get(r.assignedAgentId,r.companyId),"queryFn"),enabled:!!r?.assignedAgentId});if((0,b.useEffect)(()=>{if(!(!r||!g))return u([{label:"Connectors",href:"/apps"},{label:`${r.assignedAgentName} · ${Ns[r.provider]}`,href:`/apps/chat/${r.id}/settings`},...d?[{label:"Reviews",href:`/apps/chat/${r.id}/reviews`},{label:"Review"}]:[{label:Yt.find(T=>T.value===g)?.label??"Settings"}]]),()=>u([])},[g,r,d,u]),!g)return(0,e.jsx)(rt,{replace:!0,to:`/apps/chat/${n}/settings`});if(p.isLoading||o.kind==="reconnecting")return(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)(W,{className:"h-4 w-4 animate-spin"}),"Loading connection…"]});if(o.kind==="error"||!r)return(0,e.jsx)(G,{size:"page",error:p.error,action:"load the connection",onRetry:o.retry,retrying:o.isFetching});if(r.provider==="agentmail"&&g==="settings")return(0,e.jsxs)("div",{className:"space-y-7",children:[(0,e.jsx)(yt,{endpointId:r.id,companyId:r.companyId,assignedAgentName:r.assignedAgentName},r.id),(0,e.jsx)(rs,{endpoint:r})]});const E=r.setup?.step!=="complete"&&!(r.provider==="slack"&&r.setup?.step==="test")&&["draft","verifying","attention","revoked"].includes(r.status),j=r.setup?.slackRegistration?.appId,y=r.provider==="slack"?j?`https://api.slack.com/apps/${encodeURIComponent(j)}/oauth`:"https://api.slack.com/apps":null;return(0,e.jsxs)("div",{className:"max-w-5xl space-y-6 pb-12",children:[(0,e.jsxs)("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,e.jsx)(xs,{agent:I.data??{id:r.assignedAgentId,name:r.assignedAgentName},size:r.provider==="github"?64:48}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("h1",{ref:k,tabIndex:-1,className:r.provider==="speko"?"flex items-center gap-3 text-xl font-bold":"text-xl font-bold",children:[r.provider==="speko"&&(0,e.jsx)(xe,{name:"Speko",brandKey:"speko",size:36}),r.provider==="github"?r.botLabel??r.assignedAgentName:r.assignedAgentName,r.provider==="speko"?" in Speko":""]}),(0,e.jsx)("p",{className:z("mt-1 flex flex-wrap items-center gap-2 text-sm text-muted-foreground",M),children:r.provider==="github"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(xe,{name:"GitHub",brandKey:"github",compact:!0,className:"size-4! rounded-sm bg-transparent"}),(0,e.jsx)(L,{to:`/agents/${r.assignedAgentId}`,className:"hover:underline",children:r.assignedAgentName}),r.providerAccountLabel&&(0,e.jsxs)("span",{children:["· ",r.providerAccountLabel]})]}):r.providerAccountLabel??(r.provider==="agentmail"?r.botExternalId??"Email connection":"Chat connection")}),r.provider==="github"&&(0,e.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,e.jsx)(Ct,{endpoint:r}),(0,e.jsx)(kt,{endpoint:r,avatarUrl:f.data?ls(ds(f.data.appearance,r.assignedAgentId),512,1,"rest"):void 0})]}),r.provider==="imessage-photon"&&r.botExternalId&&r.photonAllocation!=="shared"&&(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-sm",children:[(0,e.jsx)("span",{children:r.botExternalId}),(0,e.jsxs)(C,{variant:"ghost",size:"sm","aria-label":"Copy dedicated number",onClick:t(async()=>{try{await oe(r.botExternalId),w("Number copied")}catch{w("Could not copy the number. Select and copy it manually.")}},"onClick"),children:[(0,e.jsx)(X,{className:"size-4"}),"Copy number"]}),(0,e.jsx)("span",{role:"status",className:"text-muted-foreground",children:A})]})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[r.provider==="speko"&&(0,e.jsxs)("a",{href:"https://platform.speko.ai/agents",target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-sm text-primary underline",children:["Open Speko",(0,e.jsx)(ue,{className:"size-3.5","aria-hidden":"true"})]}),r.provider==="slack"&&!E&&(0,e.jsx)(C,{asChild:!0,variant:"outline",children:(0,e.jsxs)("a",{href:Nt(r,a?s:null),target:"_blank",rel:"noopener noreferrer",children:["Open Slack ",(0,e.jsx)(ue,{className:"size-4"})]})}),y&&(0,e.jsx)(C,{asChild:!0,variant:"outline",children:(0,e.jsxs)("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:["Open Slack configuration ",(0,e.jsx)(ue,{className:"size-4"})]})}),E?(0,e.jsx)(C,{variant:"outline",onClick:t(()=>m(`/apps/chat/connect?provider=${r.provider}&purpose=chat&resume=${r.id}`),"onClick"),children:"Continue setup"}):null,r.status!=="active"&&(0,e.jsx)(Te,{status:r.status,className:r.provider==="speko"?"text-foreground":void 0})]})]}),(0,e.jsxs)("div",{className:z("space-y-6",M),children:[r.provider==="github"&&(0,e.jsx)(St,{endpoint:r}),g==="settings"&&r.provider==="speko"&&r.status==="active"&&(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsx)(bt,{companyId:r.companyId,endpointId:r.id}),(0,e.jsx)(xt,{companyId:r.companyId,endpointId:r.id}),(0,e.jsx)(pt,{companyId:r.companyId,endpointId:r.id,agentId:r.assignedAgentId})]}),r.provider==="slack"&&(0,e.jsx)(Rt,{endpointId:r.id},r.id),r.provider==="github"&&(0,e.jsx)("div",{hidden:g!=="settings"&&g!=="access",children:(0,e.jsx)(Ot,{endpoint:r,view:g==="access"?"access":"settings"},r.id)}),g==="settings"&&r.provider!=="github"&&(0,e.jsx)(ia,{endpointId:r.id,endpoint:r}),g==="settings"&&(0,e.jsx)(rs,{endpoint:r}),g==="reviews"&&r.provider==="github"&&(0,e.jsx)(Wt,{endpointId:r.id,reviewId:d}),g==="access"&&r.provider==="speko"&&(0,e.jsxs)("section",{className:"max-w-3xl space-y-3",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Private voice access"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Browser calls use the signed-in Microvac user’s current company access. Each call stays bound to its selected agent and task."}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Outgoing calls use your saved callback number and opt-in. For a private incoming call, enter the code spoken on the phone in signed-in Microvac and select a task to approve that live call. Incoming calls can start a new conversation task without sign-in, under a task-scoped low-trust policy. Private mode is optional and requires approval before accessing existing tasks."})]}),g==="access"&&r.provider==="agentmail"&&(0,e.jsx)(ra,{endpoint:r}),g==="access"&&r.provider!=="speko"&&r.provider!=="github"&&r.provider!=="agentmail"&&(0,e.jsx)(oa,{endpointId:r.id,allowUnlinked:r.allowUnlinkedPeople,endpoint:r}),g==="conversations"&&(0,e.jsx)(la,{endpointId:r.id,provider:r.provider}),g==="activity"&&(0,e.jsx)(ca,{endpointId:r.id,endpoint:r}),r.provider==="github"&&g==="settings"&&r.status==="active"&&r.setup?.step==="complete"&&i?.endpointId===r.id&&(0,e.jsx)(Jt,{endpoint:r,agent:f.data,runtimeChecks:i.runtimeChecks,onClose:t(()=>{const{githubConnectionComplete:T,...S}=h.state;m({pathname:h.pathname,search:h.search,hash:h.hash},{replace:!0,state:S})},"onClose"),onCloseAutoFocus:t(()=>k.current?.focus(),"onCloseAutoFocus")})]})]})}t(Na,"ChatEndpointDetail");function rs({endpoint:s}){const a=Y();return(0,e.jsx)("section",{className:"max-w-3xl py-5",children:(0,e.jsx)($e,{companyId:s.companyId,value:s.executionDefaults,onSave:t(async n=>{const l=await _.update(s.id,{executionDefaults:n});a.setQueryData($.chatEndpoints.detail(s.id),l)},"onSave")},s.id)})}t(rs,"EndpointExecutionDefaults");function ra({endpoint:s}){const a=U({queryKey:$.tools.connection(s.connectionId??""),queryFn:t(()=>Ds.getConnection(s.connectionId),"queryFn"),enabled:!!s.connectionId}),n=U({queryKey:$.agents.list(s.companyId),queryFn:t(()=>Ae.list(s.companyId),"queryFn")}),l=D(n),d=D(a);if(!s.connectionId)return(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Connection access could not be loaded."});if(l.kind==="error"||d.kind==="error")return(0,e.jsx)(G,{error:l.kind==="error"?n.error:a.error,action:"load connection access",onRetry:t(()=>{l.retry(),d.retry()},"onRetry"),retrying:n.isFetching||a.isFetching});if(n.isPending||a.isPending||l.kind==="reconnecting"||d.kind==="reconnecting")return(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading access…"});const x=a.data?.config?.credentialConnectionId,g=typeof x=="string"?x:s.connectionId;return(0,e.jsxs)("section",{className:"max-w-3xl space-y-4",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Access"}),g!==s.connectionId&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"These settings apply to the saved AgentMail account and all inboxes using it."}),(0,e.jsx)(vt,{companyId:s.companyId,connectionId:g,agents:n.data??[]},g)]})}t(ra,"EmailAccess");function ia({endpointId:s,endpoint:a}){const n=Y(),{pushToast:l}=Pe(),d=U({queryKey:$.chatEndpoints.resources(s),queryFn:t(()=>_.listResources(s),"queryFn"),enabled:a.provider!=="speko",...a.provider==="slack"?ee:{}}),x=D(d),g=Q({mutationFn:t(i=>_.updateResources(s,[i]),"mutationFn"),onSuccess:t(i=>n.setQueryData($.chatEndpoints.resources(s),i),"onSuccess"),onError:t(i=>l({title:"Couldn't update destination",body:F(i).body,tone:"error"}),"onError")}),m=Q({mutationFn:_.update.bind(null,s),onSuccess:t(i=>n.setQueryData($.chatEndpoints.detail(s),i),"onSuccess"),onError:t(i=>l({title:"Couldn't update settings",body:F(i).body,tone:"error"}),"onError")});if(a.provider==="speko")return null;const h=(d.data??[]).filter(i=>ta(a.provider,i.type)),k=t((i,u)=>g.mutate({id:i.id,enabled:u}),"toggleResource");return(0,e.jsxs)("section",{className:"max-w-3xl space-y-7",children:[a.provider==="imessage-photon"&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a.photonAllocation==="shared"?"Shared Photon project · direct messages only. Enroll senders in Photon and link their Messages identities in Access. Groups cannot be enabled.":"Enable each group individually. Agent replies are visible to everyone in that group; only authorized senders can start work."}),a.provider==="telegram"&&(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Telegram group command"}),(0,e.jsxs)("div",{className:"rounded-lg border border-border p-3 text-sm",children:[(0,e.jsxs)("code",{children:["/task@",a.botUsername?.replace(/^@/,"")??"bot_username"," ","<request>"]}),(0,e.jsx)("p",{className:"mt-2 text-muted-foreground",children:"Telegram's default privacy mode does not deliver ordinary mentions to bots. Use this command to start or continue group work, or reply directly to a message from the bot."})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:a.provider==="slack"?"Allowed Channels":"Destinations"}),x.kind==="error"?(0,e.jsx)(G,{size:"inline",error:d.error,action:a.provider==="slack"?"load the channels":"load the destinations",onRetry:x.retry,retrying:x.isFetching}):d.isLoading||x.kind==="reconnecting"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading destinations…"}):h.length===0&&a.provider!=="slack"?(0,e.jsx)("p",{className:"rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground",children:"No destinations yet."}):(0,e.jsxs)("div",{className:a.provider==="slack"?"space-y-1":"divide-y divide-border border-y border-border",children:[h.map(i=>(0,e.jsxs)("div",{className:"py-3 space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:z("min-w-0 flex-1",M),children:[(0,e.jsx)("p",{className:"truncate text-sm font-medium",children:i.label}),(i.availability!=="available"||i.detail)&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:i.availability==="available"?i.detail:"Unavailable at the provider"}),i.participants?.length?(0,e.jsxs)("p",{className:"mt-1 break-words text-xs text-muted-foreground",children:["Participants: ",i.participants.join(", ")]}):null]}),(0,e.jsx)(fe,{"aria-label":`Enable ${i.label}`,checked:i.enabled,disabled:a.photonAllocation==="shared"||i.availability!=="available"||g.isPending,onCheckedChange:t(u=>k(i,u),"onCheckedChange")})]}),(0,e.jsxs)("details",{className:"text-sm",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-muted-foreground",children:"Task defaults"}),(0,e.jsx)("div",{className:"pt-3",children:(0,e.jsx)($e,{companyId:a.companyId,value:i.executionDefaults,resource:!0,onSave:t(async u=>{const p=await _.updateResources(s,[{id:i.id,executionDefaults:u}]);n.setQueryData($.chatEndpoints.resources(s),p)},"onSave")})})]})]},i.id)),a.provider==="slack"&&(0,e.jsxs)("p",{className:"py-3 text-sm text-muted-foreground",children:["Invite ",a.assignedAgentName," to a channel to add it"]})]})]}),a.provider!=="github"&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(he,{label:"Allow direct messages",detail:a.provider==="discord"?"People must also enable Direct Messages in their shared Discord server’s Privacy Settings.":void 0,checked:a.allowDirectMessages??!1,pending:m.isPending,onChange:t(i=>m.mutate({allowDirectMessages:i}),"onChange")}),a.provider==="slack"&&(0,e.jsx)(he,{label:"Require at-mention in channels",detail:"In channels, require an @mention to start a conversation with this bot. Replies in existing threads and direct messages do not require an @mention. Direct messages must be allowed above.",checked:a.requireAtMention??!1,pending:m.isPending,onChange:t(i=>m.mutate({requireAtMention:i}),"onChange")}),a.provider==="microsoft-teams"&&(0,e.jsx)(he,{label:"Allow group chats",detail:"The bot may participate in group chats where it is installed.",checked:a.allowGroupChats??!1,pending:m.isPending,onChange:t(i=>m.mutate({allowGroupChats:i}),"onChange")})]}),a.provider==="slack"&&(0,e.jsx)(qt,{value:a.communicationInstructions??"",onSave:t(async i=>{const u=await _.update(s,{communicationInstructions:i});n.setQueryData($.chatEndpoints.detail(s),u)},"onSave")},a.id),a.provider==="slack"&&(0,e.jsx)(Ie,{label:"Slack tools",children:(0,e.jsx)($t,{companyId:a.companyId,endpointId:s})})]})}t(ia,"Settings");function he({label:s,detail:a,checked:n,pending:l,onChange:d}){return(0,e.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:s}),a&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]}),(0,e.jsx)(fe,{"aria-label":s,checked:n,disabled:l,onCheckedChange:d})]})}t(he,"SettingToggle");function oa({endpointId:s,allowUnlinked:a,endpoint:n}){const l=Y(),{pushToast:d}=Pe(),[x,g]=(0,b.useState)(null),[m,h]=(0,b.useState)(!1),[k,i]=(0,b.useState)(!1),[u,p]=(0,b.useState)(null),r=`${n.setup?.slackApp?.command??n.setup?.command??"/paperclip"} connect`,o=U({queryKey:$.chatEndpoints.principals(s),queryFn:t(()=>_.listPrincipals(s),"queryFn"),refetchInterval:5e3}),f=D(o),A=Q({mutationFn:t(j=>_.update(s,{allowUnlinkedPeople:j}),"mutationFn"),onSuccess:t(j=>l.setQueryData($.chatEndpoints.detail(s),j),"onSuccess"),onError:t(j=>d({title:"Couldn’t update access",body:F(j).body,tone:"error"}),"onError")}),w=Q({mutationFn:t(j=>_.createLinkIntent(s,j),"mutationFn"),onSuccess:t(({confirmationUrl:j})=>{g(new URL(j,window.location.origin).toString())},"onSuccess"),onError:t(j=>d({title:"Couldn't create identity link",body:F(j).body,tone:"error"}),"onError")}),I=Q({mutationFn:t(j=>_.revokeLink(s,j),"mutationFn"),onSuccess:t(()=>l.invalidateQueries({queryKey:$.chatEndpoints.principals(s)}),"onSuccess"),onError:t(j=>d({title:"Couldn't disconnect account",body:F(j).body,tone:"error"}),"onError")}),E=o.data??[];return(0,e.jsxs)("section",{className:"max-w-3xl space-y-7",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"People"}),n.provider==="slack"&&(0,e.jsxs)(ye,{children:[(0,e.jsx)(et,{asChild:!0,children:(0,e.jsx)(C,{children:"Invite people"})}),(0,e.jsxs)(be,{className:"ph-mask ph-sensitive",children:[(0,e.jsxs)(Re,{children:[(0,e.jsxs)(ve,{children:["Invite people to talk to ",n.assignedAgentName]}),(0,e.jsx)(Ee,{children:"Share these instructions with someone in your Slack workspace."})]}),(0,e.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,e.jsxs)("ol",{className:"list-decimal space-y-3 pl-5",children:[(0,e.jsxs)("li",{children:["Send ",(0,e.jsx)("code",{className:"font-mono",children:r})," in Slack."]}),(0,e.jsx)("li",{children:"Open the bot’s private link and sign in to Microvac to confirm your Slack account."}),(0,e.jsx)("li",{children:"If you’re new to this organization, request access and wait for an admin to approve."})]}),(0,e.jsx)("p",{className:"text-muted-foreground",children:"The confirmation link is personal and expires after 15 minutes."}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)(C,{variant:"ghost",onClick:t(()=>{oe(r).then(()=>h(!0),()=>d({title:"Couldn't copy the command",tone:"error"}))},"onClick"),children:[m?(0,e.jsx)(pe,{className:"size-4"}):(0,e.jsx)(X,{className:"size-4"}),m?"Copied":"Copy command"]}),(0,e.jsxs)(C,{onClick:t(()=>{const j=n.providerAccountId?`https://app.slack.com/client/${encodeURIComponent(n.providerAccountId)}`:"https://app.slack.com/";oe(`Talk to ${n.assignedAgentName} in Slack: ${j}
|