dorkos 0.111.0 → 0.114.0
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/core-extensions/hello-world/index.ts +2 -2
- package/dist/bin/cli.js +13549 -1698
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BKzqcz_A.js → AboutPage-mErbIY0l.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BXOZg9ve.js → ActivityErrorState-AlI4F82u.js} +1 -1
- package/dist/client/assets/{ActivityPage-CFN2MEAV.js → ActivityPage-CHUqb-8c.js} +1 -1
- package/dist/client/assets/{ActivityRow-CujXx04u.js → ActivityRow-Baqdr6cP.js} +1 -1
- package/dist/client/assets/AdapterIcon-C_fBZXHQ.js +1 -0
- package/dist/client/assets/{AdapterSetupWizard-3Bt9HEWF.js → AdapterSetupWizard-BL70qy2J.js} +2 -2
- package/dist/client/assets/{AgentRequestCard-CAaBGC0L.js → AgentRequestCard-CcMh6JyE.js} +3 -3
- package/dist/client/assets/{AppearancePage-BEe-Gssu.js → AppearancePage-t9SnSRs-.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-Cp0AJs73.js → AttentionSignalRow-jlgWaSSd.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CN1iW2cB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DHr_AhUv.js} +3 -3
- package/dist/client/assets/{BlintzCanvas-B7qs2dxW.js → BlintzCanvas-Bq4e7n__.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-DiB5zXOC.js → CanvasCsvContent-OR226CLS.js} +2 -2
- package/dist/client/assets/CanvasFileContent-BejM-9Wg.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-BD-eCVsX.js +2 -0
- package/dist/client/assets/{CodeMirrorDiff-BJhflpbC.js → CodeMirrorDiff-D7BWMOim.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-SkdXRKSN.js → CodeMirrorEditor-BodwsIG7.js} +1 -1
- package/dist/client/assets/{CommitmentList-DsEn6iK1.js → CommitmentList-YVb3yTvO.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-W5h0GjRr.js → CommitmentsPage-DL_jJQbw.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-DVFqelmV.js → ConnectionAccessLists-BPsgToSR.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-CZhSh2mO.js → ConnectionsPage-D7vlYnjf.js} +2 -2
- package/dist/client/assets/{ConventionPage-DcDBP-vR.js → ConventionPage-BR7I3AdE.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-mKN8Jqyx.js → ExtensionPageRoute-CzXGvVRm.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CGXG-x9g.js → FloatingTanStackRouterDevtools-CqogiFob-BV3h0rFa.js} +1 -1
- package/dist/client/assets/HandlePage-B33P0oh0.js +1 -0
- package/dist/client/assets/{HeartbeatPage-DFf7Udem.js → HeartbeatPage-CfjZuvtQ.js} +1 -1
- package/dist/client/assets/{LexicalField-vJ284m2H.js → LexicalField-Cc6wFZAZ.js} +2 -2
- package/dist/client/assets/{ManagesPage-mDuaA2JT.js → ManagesPage-BxHSb65X.js} +1 -1
- package/dist/client/assets/{Marketplace-BoiupH2Z.js → Marketplace-EgG6JmBG.js} +4 -4
- package/dist/client/assets/{MarketplaceSourcesView-krw9hUyu.js → MarketplaceSourcesView-D9kq9hl6.js} +1 -1
- package/dist/client/assets/{McpAppFrame-DmHduNgp.js → McpAppFrame-6zxszx9A.js} +2 -2
- package/dist/client/assets/{McpSigninBody-DoY09n4J.js → McpSigninBody-DBWSc6bm.js} +1 -1
- package/dist/client/assets/{Model3dViewer-BZEdR7-9.js → Model3dViewer-CgeJ2v-F.js} +1 -1
- package/dist/client/assets/NamePage-MfybpnwN.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-BnBO4aGI.js +1 -0
- package/dist/client/assets/{NotificationsPage-CybW1eIb.js → NotificationsPage-C5aRITCd.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-DrmjsCDY.js → OpenMeshSwitch-UKMQeS7-.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-byU2FeSU.js → OperatorIdentityForm-DH2au7QU.js} +1 -1
- package/dist/client/assets/{PermissionsPage-CP3kbqyJ.js → PermissionsPage-BgLLmdg2.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BLsjgaum.js → PersonalityPopover-vLDfndfo.js} +1 -1
- package/dist/client/assets/PhotoPage-BgyB3B2_.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-fTN8MJ1h.js → PreviewRefusedNotice-Dh3SCC_A.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-BZOaY5Tx.js → PromptSuggestionChips-EO_0zbzq.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-B6JvfRt3.js → ReportsToPopover-C9Ceg1AW.js} +1 -1
- package/dist/client/assets/{RoomSurface-BM0QO_av.js → RoomSurface-B8ec3_at.js} +8 -8
- package/dist/client/assets/{RoomsPage-B-NOCLXC.js → RoomsPage-pPw8vrsB.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-D1jQQatj.js → RunsOnPopover-CJoSj8w7.js} +1 -1
- package/dist/client/assets/RuntimeSetupDialog-Cqn_Grel.js +1 -0
- package/dist/client/assets/SessionsPage-BASybh9v.js +1 -0
- package/dist/client/assets/{SkillsPage-CPTFjEUe.js → SkillsPage-DL0909et.js} +1 -1
- package/dist/client/assets/{TasksPage-BRUqs3v5.js → TasksPage-BwUW6dia.js} +1 -1
- package/dist/client/assets/{ToolsPage-C25kL822.js → ToolsPage-C3xfGWdb.js} +2 -2
- package/dist/client/assets/{TopologyGraph-of6Cp5Kj.js → TopologyGraph-D7Ik1Xt6.js} +1 -1
- package/dist/client/assets/{TourHost-zwSilkjm.js → TourHost-Db0fxAXo.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BgwHAqdW.js → UnlinkDialog-TTK5Z_QD.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-BQwrR6PJ.js → WidgetErrorCard-D--KcgW1.js} +24 -29
- package/dist/client/assets/_shell-CGWsN6Gs.js +88 -0
- package/dist/client/assets/{_shell._home-BkP0NafS.js → _shell._home-CzpVyTzo.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BO_2ciGK.js → _shell._home.activity-BbWquOK0.js} +1 -1
- package/dist/client/assets/_shell._home.index-Cg0nRFMN.js +3 -0
- package/dist/client/assets/_shell._home.tasks-BpoOVihw.js +1 -0
- package/dist/client/assets/{_shell._home.workspaces-B34Uk1SP.js → _shell._home.workspaces-DVF1rM3t.js} +1 -1
- package/dist/client/assets/_shell.channels-CCGSs0Bn.js +10 -0
- package/dist/client/assets/{_shell.connections-BNbeBrxQ.js → _shell.connections-0_34lXIQ.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-B71l48KB.js → _shell.feedback-requests-C6alx2ox.js} +1 -1
- package/dist/client/assets/_shell.marketplace-Dp-p8E3V.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-SN2Fb1eb.js +1 -0
- package/dist/client/assets/{_shell.session-ybAc0bwn.js → _shell.session-Bt3jdQdD.js} +15 -15
- package/dist/client/assets/_shell.team-BIwJNdkd.js +28 -0
- package/dist/client/assets/_shell.x._extensionId-Bjn-MKsP.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-Bjn-MKsP.js +1 -0
- package/dist/client/assets/{agent-browser-Cs8abkZs.js → agent-browser-CO5haI5Y.js} +1 -1
- package/dist/client/assets/{banner-CU2Nh3Kv.js → banner-Dh5mO27l.js} +2 -2
- package/dist/client/assets/{card-BTgwskmX.js → card-CKZCX8ol.js} +1 -1
- package/dist/client/assets/{file-DlQX-hKl.js → file-CMPbZedq.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-Dg2iCyPM.js → file-exclamation-point-emLeXvmw.js} +1 -1
- package/dist/client/assets/file-text-9a0DChCq.js +6 -0
- package/dist/client/assets/{find-latest-widget-fence-BGiexm6r.js → find-latest-widget-fence--3kWMT1F.js} +3 -3
- package/dist/client/assets/{git-branch-Dq_w3Iyx.js → git-branch-hfu8isLA.js} +1 -1
- package/dist/client/assets/{heart-Bp14wOx6.js → heart-SRafwnSd.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-kD1HK_wk.js → highlighted-body-KPVGNVTW-Dxwd3mxT.js} +1 -1
- package/dist/client/assets/index-3GDQSKet.js +1 -0
- package/dist/client/assets/{index-BA-nPsLw.js → index-BB18IeC2.js} +1 -1
- package/dist/client/assets/index-BBQMqcO_.js +1 -0
- package/dist/client/assets/{index-CcV9S7cO.js → index-BDfoFNcA.js} +1 -1
- package/dist/client/assets/{index-DNglWRBB.js → index-BNn3-chz.js} +1 -1
- package/dist/client/assets/{index-Dm53S0up.js → index-BRGOMmOM.js} +1 -1
- package/dist/client/assets/{index-5OyUurJr.js → index-BTXBESRm.js} +1 -1
- package/dist/client/assets/{index-B8R78Nnj.js → index-BTreBsWa.js} +2 -2
- package/dist/client/assets/{index-kHXlTLUx.js → index-BUVKya1M.js} +8 -8
- package/dist/client/assets/{index-aDNEGBTK.js → index-BYp9xcmS.js} +1 -1
- package/dist/client/assets/{index-DnmtTIUB.js → index-BokDvdOG.js} +1 -1
- package/dist/client/assets/{index-BxrZwUJp.js → index-C3xuhmPa.js} +2 -2
- package/dist/client/assets/{index-B6_ikFYj.js → index-C4nEz6I-.js} +1 -1
- package/dist/client/assets/{index-Dr-0P6rd.js → index-C63bLSO4.js} +267 -262
- package/dist/client/assets/{index-Cc280M3V.js → index-C7BTAdSc.js} +1 -1
- package/dist/client/assets/{index-knGXyHhh.js → index-CAlXjm0N.js} +1 -1
- package/dist/client/assets/index-CTxEG5rD.js +1 -0
- package/dist/client/assets/{index-gu2JYnOq.js → index-CbFo-7kM.js} +1 -1
- package/dist/client/assets/{index-DKlxz3u7.js → index-Ch41JOI2.js} +1 -1
- package/dist/client/assets/{index-BxUoa3yn.js → index-CkknQ52Q.js} +5 -5
- package/dist/client/assets/{index-C-DN0Vg_.js → index-Cow815Qa.js} +1 -1
- package/dist/client/assets/{index-DO6a5Hey.js → index-Cp7oifSs.js} +1 -1
- package/dist/client/assets/{index--3UwFg2s.js → index-CpYs0Lli.js} +1 -1
- package/dist/client/assets/{index-C99173Ze.js → index-D0Nd2LA-.js} +1 -1
- package/dist/client/assets/{index-BeBmUxo_.js → index-D67aFWxz.js} +1 -1
- package/dist/client/assets/index-DFEF2MFy.css +1 -0
- package/dist/client/assets/{index-CAhJGlSW.js → index-DIlV08Vw.js} +1 -1
- package/dist/client/assets/{index-BHsZlKfx.js → index-DLNwEM2Q.js} +1 -1
- package/dist/client/assets/{index-PxSRtDpP.js → index-DLZi_nae.js} +1 -1
- package/dist/client/assets/{index-LszRbEbX.js → index-DRqEM5Wb.js} +1 -1
- package/dist/client/assets/{index-B0OZehWe.js → index-DX-j3Ul0.js} +1 -1
- package/dist/client/assets/{index-CKCMjqcu.js → index-DX7V94qe.js} +1 -1
- package/dist/client/assets/{index-C_uYJzKi.js → index-D_Wc_qTa.js} +3 -3
- package/dist/client/assets/{index-DW6zqLoM.js → index-DdsKmfEH.js} +1 -1
- package/dist/client/assets/{index-DHUToGjI.js → index-DmTI5Hye.js} +1 -1
- package/dist/client/assets/{index-DKQDBIWq.js → index-YswfjpmW.js} +1 -1
- package/dist/client/assets/{index-DSPs6GF4.js → index-g_5oOlG6.js} +1 -1
- package/dist/client/assets/{index-DS-thlE8.js → index-iD0epmn3.js} +1 -1
- package/dist/client/assets/{index-CDWsIVX7.js → index-lJc8v0Z3.js} +1 -1
- package/dist/client/assets/index-t7gsOfUI.js +1 -0
- package/dist/client/assets/kickoff-xkt4LpIP.js +3 -0
- package/dist/client/assets/{layers-B0oCOfxz.js → layers-Cy8Tme6i.js} +1 -1
- package/dist/client/assets/{lightbulb-D80IzMqz.js → lightbulb-tNm7gLYi.js} +1 -1
- package/dist/client/assets/{markdown-content-aNzh-54y.js → markdown-content-CoK3F0c0.js} +1 -1
- package/dist/client/assets/{mention-pill-BxMK0xuY.js → mention-pill-Bgs_yujj.js} +1 -1
- package/dist/client/assets/{message-square-off-D-CJXmTq.js → message-square-off-CF2Bzen3.js} +1 -1
- package/dist/client/assets/{owner-notice-BkrTEMDm.js → owner-notice-cgCWG4hG.js} +1 -1
- package/dist/client/assets/{package-CoTlAnXZ.js → package-DE8sQpId.js} +1 -1
- package/dist/client/assets/{page-container-CPxW5T9E.js → page-container-BoXmmBSs.js} +1 -1
- package/dist/client/assets/{paperclip-Cj1P85mz.js → paperclip-IgDeVFea.js} +1 -1
- package/dist/client/assets/{radio-DICkTr_p.js → radio-BzTkFBDD.js} +1 -1
- package/dist/client/assets/{room-files-source-BywWQPBN.js → room-files-source-CIIDTSTA.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-cx5RyP4l.js → rotate-ccw-clock-CGcSqHnk.js} +1 -1
- package/dist/client/assets/{rotate-cw-DrGRGSwy.js → rotate-cw-DaduzRfP.js} +1 -1
- package/dist/client/assets/{scroll-area-XlDz8u4m.js → scroll-area-DW0-Liri.js} +1 -1
- package/dist/client/assets/{search-x-LIKnWE64.js → search-x-Sme5ElYi.js} +1 -1
- package/dist/client/assets/{shield-x-DioB6qH_.js → shield-x-Bh5xap8N.js} +1 -1
- package/dist/client/assets/{soul-file-C7YgkNET.js → soul-file-NcuTUIiB.js} +1 -1
- package/dist/client/assets/{table-P4N5xQn2.js → table-BEtvgYmW.js} +1 -1
- package/dist/client/assets/{use-connector-management-pgVHbXoO.js → use-connector-management-Cohvs7jD.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DxEiOjjh.js → use-delete-binding-C19umm_i.js} +1 -1
- package/dist/client/assets/{use-dev-links-BImQrE6g.js → use-dev-links-DRnLdl--.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-D8KHMSZU.js → use-external-adapter-catalog-BOn9aj72.js} +1 -1
- package/dist/client/assets/use-full-activity-feed-BpQANbns.js +1 -0
- package/dist/client/assets/use-is-below-desktop-5LlietdR.js +1 -0
- package/dist/client/assets/{use-jump-back-in-D9tBJ4v5.js → use-jump-back-in-CkFErfWY.js} +3 -3
- package/dist/client/assets/{use-mesh-topology-DBeqzUoy.js → use-mesh-topology-CIsDeAY0.js} +1 -1
- package/dist/client/assets/use-panel-tab-placements-AFrWTQ0a.js +1 -0
- package/dist/client/assets/use-pending-read-Dol8yvIx.js +1 -0
- package/dist/client/assets/{use-personality-commit-Gfoi__sT.js → use-personality-commit-fUtuc2lC.js} +1 -1
- package/dist/client/assets/{use-promo-activation-Bv1gnqKq.js → use-promo-activation-Dxt-1yuT.js} +3 -3
- package/dist/client/assets/{use-pulse-freshness-SFRdnugS.js → use-pulse-freshness-DRRM5Hza.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-Cf20JiJ_.js → use-room-follow-claim-huRfaa4e.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-3Pb7ps4E.js → use-roving-tab-list-BZIBAGgJ.js} +1 -1
- package/dist/client/assets/{use-session-canvas-BaXuEhw8.js → use-session-canvas-CZIsr9qL.js} +4 -4
- package/dist/client/assets/{use-session-diagnostics-7xxJ6zQQ.js → use-session-diagnostics-C41hV7rK.js} +4 -4
- package/dist/client/assets/{use-unclaimed-chats-D4k-EK_f.js → use-unclaimed-chats-BMlFQ2v1.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +123677 -118335
- package/dist/server/index.js.map +2 -2
- package/package.json +7 -8
- package/dist/client/assets/AdapterIcon-BdM7K69W.js +0 -1
- package/dist/client/assets/CanvasFileContent-CDNfnWMW.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-C7EINmuq.js +0 -2
- package/dist/client/assets/HandlePage-Bun58ePo.js +0 -1
- package/dist/client/assets/NamePage-CXyClUPJ.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-BjqYwnXW.js +0 -1
- package/dist/client/assets/PhotoPage-hn5b42qN.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-ufwCvCJB.js +0 -1
- package/dist/client/assets/SessionsPage-CBE1KHYg.js +0 -1
- package/dist/client/assets/_shell-bcx2y7VT.js +0 -88
- package/dist/client/assets/_shell._home.index-B-OFwU9u.js +0 -3
- package/dist/client/assets/_shell._home.tasks-jAQczH7j.js +0 -1
- package/dist/client/assets/_shell.channels-CGzsxvXD.js +0 -10
- package/dist/client/assets/_shell.marketplace-3YAsNaRk.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-cI3nNBXr.js +0 -1
- package/dist/client/assets/_shell.team-BE_60YS4.js +0 -28
- package/dist/client/assets/_shell.x._extensionId-jiyP599c.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-jiyP599c.js +0 -1
- package/dist/client/assets/index-B2JJZXsq.js +0 -1
- package/dist/client/assets/index-BAjUSKoJ.js +0 -1
- package/dist/client/assets/index-BpDY3eoD.js +0 -1
- package/dist/client/assets/index-ExcAk4pE.css +0 -1
- package/dist/client/assets/index-F7Lcwnfm.js +0 -1
- package/dist/client/assets/kickoff-Btbza7bw.js +0 -3
- package/dist/client/assets/use-full-activity-feed-2o7GNAMe.js +0 -1
- package/dist/client/assets/use-is-below-desktop-DBet5zg_.js +0 -1
- package/dist/client/assets/use-pending-read-DmrlNHS0.js +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j1 as be,j2 as ye,j as t,gL as $,gM as F,gN as L,gO as B,gP as q,aa as I,j3 as Se,as as A,cA as Ne,cB as ke,C as we,cC as Re,j4 as z,B as b,j5 as Ce,j6 as Ie,bV as H,e as C,Z as y,x as W,r as m,$ as Ae,j7 as Pe,iC as De,g7 as Oe,db as Me,j8 as oe,aN as Te,X as ie,j9 as Ee,ja as $e,aL as Fe,dc as ae,hv as Le,bl as V,a3 as R,df as Be,jb as qe,jc as ze,jd as He,eH as We,eI as _e,je as Ue,jf as Ke,jg as Ve,jh as Ge,eB as re,eD as Qe,ji as Ye,ci as le,dJ as Je,eE as Xe,jj as Ze,l as de,jk as ce,jl as ue,ho as et,jm as _,eC as tt,b8 as st,aS as nt,gB as ot,h9 as it,jn as at,dK as rt,jo as me,g as lt,fy as he,jp as G,iB as Q,jq as dt,jr as ct,js as ut,jt as mt,ae as ht,ju as gt,fB as ft,bz as xt,ie as pt,eJ as jt,jv as vt,eN as M,iE as bt,w as Y,dv as yt,hK as St,jw as Nt,n as kt}from"./index-Dr-0P6rd.js";import{I as wt,i as Rt,a as Ct}from"./RoomSurface-BM0QO_av.js";import{u as It}from"./index-kHXlTLUx.js";import{P as ge}from"./PromptSuggestionChips-BZOaY5Tx.js";import{S as U}from"./scroll-area-XlDz8u4m.js";import{u as At}from"./use-mesh-topology-DBeqzUoy.js";import{A as Pt}from"./AttentionSignalRow-Cp0AJs73.js";import{u as Dt,s as Ot,P as Mt,a as Tt}from"./use-promo-activation-Bv1gnqKq.js";import"./use-jump-back-in-D9tBJ4v5.js";import"./use-room-follow-claim-Cf20JiJ_.js";import"./WidgetErrorCard-BQwrR6PJ.js";import"./card-BTgwskmX.js";import"./markdown-content-aNzh-54y.js";import"./table-P4N5xQn2.js";import"./package-CoTlAnXZ.js";import"./heart-Bp14wOx6.js";import"./git-branch-Dq_w3Iyx.js";import"./file-DlQX-hKl.js";import"./find-latest-widget-fence-BGiexm6r.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-ufwCvCJB.js";import"./mention-pill-BxMK0xuY.js";import"./rotate-ccw-clock-cx5RyP4l.js";import"./message-square-off-D-CJXmTq.js";import"./use-connector-management-pgVHbXoO.js";import"./AgentRequestCard-CAaBGC0L.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-Cj1P85mz.js";import"./index-CcV9S7cO.js";function Et({open:e,itemId:n,onClose:o}){const{data:s}=be(),i=ye(),a=(n==null?void 0:n.indexOf("::"))??-1,r=a>=0?n.slice(0,a):void 0,l=a>=0?n.slice(a+2):void 0,d=s==null?void 0:s.find(h=>h.source===r&&h.reason===l),c=()=>{!r||!l||i.mutate({source:r,reason:l},{onSuccess:o})};return t.jsx($,{open:e,onOpenChange:h=>!h&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Messages that never arrived"}),t.jsx(q,{children:r??"Source unknown"})]}),t.jsx(U,{className:"flex-1 px-4",children:d?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"These never reached an agent. Clearing them doesn’t send them."}),t.jsxs("p",{className:"text-foreground text-sm",children:[d.count," message",d.count===1?"":"s"," couldn’t be delivered"]}),t.jsx(I,{variant:"secondary",children:Se(d.reason)})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[t.jsxs("p",{className:"text-muted-foreground",children:["First happened ",A(d.firstSeen)," ago"]}),t.jsxs("p",{className:"text-muted-foreground",children:["Last happened ",A(d.lastSeen)," ago"]})]}),d.sample!=null&&t.jsxs(Ne,{children:[t.jsxs(ke,{className:"text-muted-foreground hover:text-foreground group flex items-center gap-1 text-xs font-medium transition-colors",children:[t.jsx(we,{className:"size-3 transition-transform group-data-[state=open]:rotate-90"}),"What one of them looked like"]}),t.jsx(Re,{children:t.jsx("pre",{className:"bg-muted mt-1 overflow-x-auto rounded-md p-3 font-mono text-xs",children:JSON.stringify(d.sample,null,2)})})]})]}):t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"These are cleared already."})}),t.jsxs(z,{children:[d&&t.jsx(b,{variant:"destructive",onClick:c,disabled:i.isPending,children:i.isPending?"Clearing…":"Clear these"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function $t(e){const n=Math.floor(e/1e3);if(n<60)return`${n}s`;const o=Math.floor(n/60),s=n%60;if(o<60)return`${o}m ${s}s`;const i=Math.floor(o/60),a=o%60;return`${i}h ${a}m`}function Ft(e){switch(e){case"blocked":return{label:"Blocked",badge:"outline",tone:"warning",heading:"What it needed",title:"Run that couldn’t use its tools"};case"failed":return{label:"Didn’t finish",badge:"destructive",tone:"error",heading:"Error",title:"Run that didn’t finish"};case"cancelled":return{label:"Cancelled",badge:"secondary",tone:"neutral",heading:"Stopped",title:"Run that was stopped"};case"skipped":return{label:"Skipped",badge:"secondary",tone:"neutral",heading:"Why",title:"Run that never started"};case"running":return{label:"Running",badge:"secondary",tone:"neutral",heading:"Latest",title:"Run that is still going"};default:return{label:"Completed",badge:"secondary",tone:"neutral",heading:"Note",title:"Run that finished"}}}const Lt={error:{box:"bg-destructive/10 border-destructive/20",heading:"text-destructive",body:"text-destructive"},warning:{box:"bg-status-warning-bg border-status-warning-border",heading:"text-status-warning-fg",body:"text-status-warning-fg"},neutral:{box:"bg-muted border-border",heading:"text-foreground",body:"text-foreground/80"}};function Bt({open:e,itemId:n,onClose:o}){const{data:s,isLoading:i,isError:a}=Ce(e?n??null:null),r=Ie(),l=H(),d=()=>{s!=null&&s.sessionId&&l(W({session:s.sessionId}))},c=()=>{s&&r.mutate(s.id)},h=s?Ft(s.status):null,g=h?Lt[h.tone]:null;return t.jsx($,{open:e,onOpenChange:f=>!f&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:(h==null?void 0:h.title)??"Run that needs a look"}),t.jsx(q,{children:n?n.slice(0,8):"Unknown"})]}),t.jsxs(U,{className:"flex-1 px-4",children:[i&&t.jsxs("div",{className:"space-y-4",children:[t.jsx(C,{className:"h-6 w-24"}),t.jsx(C,{className:"h-4 w-48"}),t.jsx(C,{className:"h-20 w-full"})]}),a&&t.jsx("p",{className:"text-destructive py-8 text-center text-sm",children:"Couldn’t load this run."}),!i&&!a&&!s&&t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"Already resolved."}),s&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(I,{variant:h.badge,children:h.label}),t.jsx(I,{variant:"secondary",children:s.trigger==="scheduled"?"Scheduled":"Manual"})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[s.startedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Started: ",A(s.startedAt)," ago"]}),s.finishedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Finished: ",A(s.finishedAt)," ago"]}),s.durationMs!=null&&t.jsxs("p",{className:"text-muted-foreground",children:["Duration: ",$t(s.durationMs)]})]}),s.error&&t.jsxs("div",{className:y("rounded-md border p-3",g.box),children:[t.jsx("p",{className:y("text-sm font-medium",g.heading),children:h.heading}),t.jsx("p",{className:y("mt-1 text-sm",g.body),children:s.error})]}),s.outputSummary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Output"}),t.jsx("pre",{className:"bg-muted max-h-48 overflow-auto rounded-md p-3 font-mono text-xs",children:s.outputSummary})]})]})]}),t.jsxs(z,{children:[(s==null?void 0:s.sessionId)&&t.jsx(b,{variant:"default",onClick:d,children:"View chat"}),(s==null?void 0:s.status)==="running"&&t.jsx(b,{variant:"destructive",onClick:c,disabled:r.isPending,children:r.isPending?"Cancelling…":"Cancel run"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function qt({agent:e}){const n=Pe(e,e.projectPath??"");return t.jsxs("div",{className:"flex items-center gap-3 py-2",children:[t.jsx(De,{color:n.color,emoji:n.emoji,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:Oe(e)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I,{variant:"destructive",children:"Unreachable"}),e.runtime&&t.jsx(I,{variant:"secondary",children:Me(e.runtime).label})]})]}),e.lastSeenAt&&t.jsxs("span",{className:"text-muted-foreground shrink-0 text-xs",children:[A(e.lastSeenAt)," ago"]})]})}function zt({open:e,onClose:n}){const{data:o}=At(void 0,e),s=m.useMemo(()=>o?o.namespaces.flatMap(i=>i.agents).filter(i=>i.healthStatus==="unreachable"):[],[o]);return t.jsx($,{open:e,onOpenChange:i=>!i&&n(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Agents that aren’t answering"}),t.jsxs(q,{children:["DorkOS can’t reach ",s.length," agent",s.length===1?"":"s"," right now"]})]}),t.jsx(U,{className:"flex-1 px-4",children:s.length>0?t.jsx("div",{className:"divide-y",children:s.map(i=>t.jsx(qt,{agent:i},i.id))}):t.jsxs("div",{className:"flex flex-col items-center gap-2 py-8",children:[t.jsx(Ae,{className:"text-status-success size-6"}),t.jsx("p",{className:"text-muted-foreground text-sm",children:"All agents are online"})]})}),t.jsx(z,{children:t.jsx(b,{variant:"outline",onClick:n,children:"Close"})})]})})}function Ht(e){return e.content.suggestion!==void 0}function Wt(){const e=Dt(),{dismissedIds:n}=oe(),o=Te(s=>s.promoEnabled);return m.useMemo(()=>{if(!o)return null;const[s]=Ot(Mt.filter(Ht),e,n,1);return s??null},[e,n,o])}function _t({suggestion:e,promoTitle:n,onAccept:o,onDismiss:s}){return t.jsxs("p",{"data-slot":"quiet-suggestion",className:"text-muted-foreground/70 text-2xs mt-1",children:[e.question," ",t.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm font-medium underline-offset-4 transition-colors hover:underline focus-visible:underline",children:e.action}),t.jsx("button",{type:"button","aria-label":`Dismiss suggestion: ${n}`,onClick:s,className:"text-muted-foreground/60 hover:text-foreground focus-ring -my-1.5 ml-0.5 inline-flex translate-y-[3px] items-center justify-center rounded-sm p-1.5 align-baseline transition-colors",children:t.jsx(ie,{className:"size-3"})})]})}function Ut({promo:e}){const{dismissPromo:n}=oe(),{activate:o,dialog:s}=Tt(e);return t.jsxs(t.Fragment,{children:[t.jsx(_t,{suggestion:e.content.suggestion,promoTitle:e.content.title,onAccept:o,onDismiss:()=>n(e.id)}),s]})}function Kt(){const e=Wt();return e===null?null:t.jsx(Ut,{promo:e},e.id)}const Vt=["report.daily"];function fe(){const{notifications:e}=Ee({kinds:Vt,unread:!0});return m.useMemo(()=>e[0],[e])}function Gt({questions:e,requests:n,schedules:o,approvalsUnavailable:s,attention:i}){const a=[],r=[],l=e+n+o;return l>0?(a.push(`${$e(e,n,o)} ${l===1?"is":"are"} waiting on you.`),r.push(`${l} waiting`)):s&&(a.push("Couldn’t read approvals."),r.push("Couldn’t read approvals")),i===1?(a.push("1 thing needs attention."),r.push("1 needs attention")):i>1&&(a.push(`${i} things need attention.`),r.push(`${i} need attention`)),{spoken:a.join(" "),compact:r.join(" · ")}}function Qt({notification:e,onDismiss:n}){return t.jsxs("div",{"data-slot":"shift-report-card",className:"border-border/60 bg-background/60 relative rounded-lg border p-3 pr-8",children:[t.jsxs("div",{className:"flex items-start gap-2.5",children:[t.jsx(Fe,{"aria-hidden":!0,className:"text-muted-foreground mt-0.5 size-3.5 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground text-xs font-medium",children:e.title}),e.body!==void 0&&t.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:e.body})]})]}),t.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"text-muted-foreground hover:text-foreground focus-ring absolute top-2 right-2 rounded-md p-1 transition-colors",children:t.jsx(ie,{className:"size-3.5"})})]})}const Yt="max-h-[40svh] sm:max-h-[50svh]",Jt={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}};function T({title:e,tone:n="waiting",children:o}){const s=m.useId();return t.jsxs("section",{"aria-labelledby":s,className:"min-w-0",children:[t.jsx("h2",{id:s,className:y("mb-2 text-xs font-medium",n==="waiting"?"text-status-warning-fg":"text-muted-foreground"),children:e}),o]})}function J({edge:e}){return t.jsx("div",{"aria-hidden":"true","data-slot":`pinned-triage-fade-${e}`,className:y("from-background/95 via-background/65 pointer-events-none absolute inset-x-0 h-6 to-transparent",e==="bottom"?"bottom-0 bg-gradient-to-t":"top-0 bg-gradient-to-b")})}const X={animate:{transition:{staggerChildren:.04}}};function Xt(e){return e?0:.18}function Zt({approvals:e,asks:n,settlingAsks:o,askAgentNames:s,onOpenSession:i,approvalsUnavailable:a,onRetryApprovals:r,scheduleApprovals:l,errorSignals:d,activityItems:c,onOpenActivity:h,shiftReport:g,presence:f,condensed:j,onExpand:p,className:u}){const x=ae(),v=m.useRef(null),N=Le(v),k=e.length>0||n.length>0||o.length>0||l.length>0||a,P=d.length>0,w=c.length>0,je=k||P||w||g!==void 0||(f==null?void 0:f.occupied)===!0,O=Gt({questions:n.length,requests:e.length,schedules:l.length,approvalsUnavailable:a,attention:d.length+c.length}),ve=j===!0&&O.compact!=="";return t.jsxs(t.Fragment,{children:[t.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:O.spoken}),t.jsxs(V,{initial:!1,children:[ve&&t.jsx(R.div,{"data-slot":"pinned-triage-summary",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:Xt(x===!0)},className:y("bg-background/95 border-border/60 shrink-0 border-b backdrop-blur-sm",u),children:t.jsxs("button",{type:"button",onClick:p,className:"text-muted-foreground hover:text-foreground flex min-h-11 w-full min-w-0 items-center gap-2 px-[var(--msg-padding-x)] text-left text-xs",children:[t.jsx("span",{className:"bg-status-warning-dot size-1.5 shrink-0 rounded-full","aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.compact}),t.jsx(Be,{className:"size-3.5 shrink-0","aria-hidden":!0})]})},"triage-summary"),je&&j!==!0&&t.jsxs(R.div,{"data-slot":"pinned-triage-header",...Jt,transition:{duration:x?0:.25,ease:[0,0,.2,1]},className:y("bg-background/95 border-border/60 relative shrink-0 overflow-hidden border-b backdrop-blur-sm",u),children:[t.jsxs("div",{ref:v,onScroll:N.onScroll,"data-slot":"pinned-triage-scroller",className:y("flex w-full min-w-0 scroll-py-6 flex-col gap-3 overflow-y-auto overscroll-contain px-[var(--msg-padding-x)] py-3",Yt),children:[k&&t.jsxs(T,{title:"Waiting on you",children:[(n.length>0||o.length>0)&&t.jsx(qe,{asks:n,agentNames:s,onOpenSession:i,emptyState:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing needs you"})}),e.length>0&&t.jsx(ze,{approvals:e}),e.length===0&&a&&t.jsx(He,{onRetry:r}),t.jsx(V,{initial:!1,children:l.map(S=>t.jsx(We,{task:S,className:"mt-2"},S.id))})]}),P&&t.jsx(T,{title:"Needs attention",children:t.jsx("div",{className:"border-status-warning-border/40 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:X,initial:"initial",animate:"animate",children:d.map(S=>t.jsx(Pt,{signal:S},S.id))})})}),g&&t.jsx(Qt,{notification:g.notification,onDismiss:g.onDismiss}),w&&t.jsx(T,{title:"Recent activity",tone:"neutral",children:t.jsx("div",{className:"border-border/60 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:X,initial:"initial",animate:"animate",children:c.map(S=>t.jsx(_e,{notification:S,onOpen:()=>h(S)},S.id))})})}),f==null?void 0:f.node]}),N.start&&t.jsx(J,{edge:"top"}),N.end&&t.jsx(J,{edge:"bottom"})]},"triage-header")]})]})}function es({presence:e,composerFocused:n,onExpand:o,className:s}){const{approvals:i,isError:a,retry:r}=Ue(),{interactions:l}=Ke(),d=Ve(),c=Ge(l),{schedules:h,errors:g,activity:f}=re(),j=Qe(),p=fe(),{mutate:u}=Ye(),x=le({strict:!1}),v=H(),N=Je(),k=Xe(h),P=Ze(i),w=m.useCallback(()=>{v({...de.home(),search:{}})},[v]);return t.jsxs(t.Fragment,{children:[t.jsx(Zt,{approvals:P,asks:l,settlingAsks:d,askAgentNames:c,onOpenSession:K=>{v(W({session:K}))},approvalsUnavailable:a&&i.length===0,onRetryApprovals:r,scheduleApprovals:k,errorSignals:g,activityItems:f,onOpenActivity:j,shiftReport:p===void 0?void 0:{notification:p,onDismiss:()=>u(p.id)},presence:e,condensed:N&&n===!0,onExpand:o,className:s}),t.jsx(Et,{open:x.detail==="dead-letter",itemId:x.itemId,onClose:w}),t.jsx(Bt,{open:x.detail==="failed-run",itemId:x.itemId,onClose:w}),t.jsx(zt,{open:x.detail==="offline-agent",onClose:w})]})}const ts=["What can you help with?","Make my first agent","What’s in this project?","Set up a daily run"];function ss({roomId:e}){const n=m.useCallback(o=>{ce.getState().set(e,o),ue.getState().requestFocus(e)},[e]);return t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1",children:t.jsx(ge,{suggestions:ts,onChipClick:n,ariaLabel:"Ways to start",size:"comfortable"})})}function ns(e){var a;const{data:n}=et(e),o=((a=n==null?void 0:n.members.find(r=>r.author.id===n.viewerAuthorId))==null?void 0:a.lastReadSeq)??null,[s,i]=m.useState({roomId:null,seq:null});return s.roomId===e?s.seq:o===null?null:(i({roomId:e,seq:o}),o)}function os(e,n){if(e===void 0)return null;let o=null,s=1/0;for(const i of e){if(!i.enabled||i.status!=="active")continue;const a=i.nextRun;if(a==null)continue;const r=Date.parse(a);Number.isNaN(r)||r<=n||r>=s||(s=r,o={name:i.displayName??i.name,at:a})}return o}function is(e,n){const o=new Date(e),s=o.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),i=as(new Date(n),o);return i===0?`today at ${s}`:i===1?`tomorrow at ${s}`:`on ${o.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})} at ${s}`}function as(e,n){const o=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime();return Math.round((o(n)-o(e))/864e5)}function rs(e,n){return e===null?null:`Next up: ${e.name} runs ${is(e.at,n)}.`}function ls({forwardLook:e,suggestion:n}){return t.jsx(R.div,{"data-slot":"home-quiet-state",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"border-border/60 shrink-0 border-b",children:t.jsxs("div",{className:"w-full px-[var(--msg-padding-x)] py-2",children:[t.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.jsx("span",{className:"text-foreground/80 font-medium",children:"All quiet."}),e!==null&&t.jsxs(t.Fragment,{children:[" ",e]})]}),n]})})}function ds({roomId:e,presenceOccupied:n}){const o=_(e),s=ns(e),{items:i,isLoading:a,isAnyError:r}=tt(),{total:l}=re(),d=fe(),c=o!==void 0&&o.length>0,h=s!==null&&o!==void 0&&o.every(k=>k.seq<=s),g=i.length>0||a||r||l>0||d!==void 0||n,f=c&&h&&!g,[j,p]=m.useState("waiting");f&&j==="waiting"?p("shown"):!f&&j==="shown"&&p("retired");const u=f&&j!=="retired",x=st(),{data:v}=nt(x&&u),N=ot();return u?t.jsx(ls,{forwardLook:rs(os(v,N),N),suggestion:t.jsx(Kt,{})}):null}const xe="dorkos:home-opened-on";function Z(){const e=new Date,n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${n}-${o}`}function cs(){try{return localStorage.getItem(xe)}catch{return null}}function us(e){try{localStorage.setItem(xe,e)}catch{}}function ms(){const[e]=m.useState(()=>cs()!==Z());return m.useEffect(()=>{e&&us(Z())},[e]),e}function hs({children:e}){const n=ms(),o=ae(),s=n&&o!==!0;return t.jsx(R.div,{className:"h-full",initial:s?{opacity:0}:!1,animate:{opacity:1},transition:{duration:.45,ease:[0,0,.2,1]},children:e})}const ee="@dorkbot",gs="Build me a tracker for my customers",fs="Make a daily plan board",pe="Something else",xs=[gs,fs,pe];function ps({roomId:e,mode:n}){const o=It(),s=it(),i=m.useCallback(a=>{if(a===pe){ce.getState().set(e,`${ee} `),ue.getState().requestFocus(e);return}o.mutate({roomId:e,text:`${ee} ${a}`,clientId:at()})},[e,o]);return n==="starters"?t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-chips",children:t.jsx(ge,{suggestions:xs,onChipClick:i,ariaLabel:"First jobs for DorkBot",size:"comfortable"})}):t.jsxs("div",{className:"flex w-full flex-wrap gap-2 px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-connect-chips",children:[t.jsx(b,{size:"sm",onClick:()=>s.open("account"),children:"Continue with DorkOS"}),t.jsx(b,{size:"sm",variant:"outline",onClick:()=>s.open("runtimes"),children:"Use my own AI"})]})}function js(e){var r,l;const{data:n}=rt(),o=_(e),s=me(e,null),i=((r=n==null?void 0:n.onboarding)==null?void 0:r.welcomeEntryId)??null;if(e===null||i===null||!o||s.length>0)return null;const a=o.reduce((d,c)=>d===void 0||c.seq>d.seq?c:d,void 0);return(a==null?void 0:a.id)!==i?null:((l=n==null?void 0:n.onboarding)==null?void 0:l.firstRunPath)==="none"?"connect":"starters"}const vs=5,bs="relative after:absolute after:-inset-x-1 after:-inset-y-2.5 md:after:hidden";function ys(e,n){return e===null||n===null?null:Math.max(0,n-Date.parse(e))}function Ss({row:e,onFollow:n,onViewProfile:o}){const[s,i]=m.useState(null),a=ys(e.since,s),r=e.profileMemberId,l=o===void 0||r===null?void 0:()=>o(r);return t.jsx(wt,{onViewProfile:l,identity:{kind:e.face.kind,displayName:e.name,...e.handle!==null?{handle:e.handle}:{},color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},...e.face.kind==="agent"?{agent:{...e.runtime!==null?{runtime:e.runtime}:{},...a!==null?{working:{...e.roomTitle!==null?{room:e.roomTitle}:{},forMs:a}}:{}}}:{}},children:t.jsxs("button",{type:"button","aria-label":e.detail===null?`Watch ${e.name}`:`Watch ${e.name}: ${e.detail}`,onClick:()=>n(e.follow),onPointerEnter:()=>i(Date.now()),onPointerLeave:()=>i(null),onFocus:()=>i(Date.now()),onBlur:()=>i(null),className:y("focus-ring group/identity hover:bg-muted/60 flex min-w-0 items-center gap-1.5 rounded-full py-1 pr-2.5 pl-1 text-xs transition-colors",bs),children:[t.jsx(lt,{size:"xs",kind:e.face.kind,color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},fallback:e.face.fallback,status:"working"}),t.jsx("span",{className:"text-foreground shrink-0 font-medium",children:e.name}),e.detail!==null&&t.jsxs("span",{"aria-hidden":!0,className:"text-muted-foreground truncate",children:["· ",e.detail]})]})})}function Ns({rows:e,onFollow:n,onViewProfile:o,className:s}){if(e.length===0)return null;const i=e.slice(0,vs),a=e.length-i.length;return t.jsxs("ul",{"data-testid":"presence-strip","aria-label":"Working right now",className:y("flex items-center gap-x-2 overflow-hidden",s),children:[i.map(r=>t.jsx("li",{className:"min-w-0",children:t.jsx(Ss,{row:r,onFollow:n,onViewProfile:o})},r.id)),a>0&&t.jsx("li",{"aria-label":a===1?"1 more agent is working":`${a} more agents are working`,className:"text-muted-foreground shrink-0 text-xs",children:t.jsxs("span",{"aria-hidden":!0,children:["+",a," more"]})})]})}function ks(e){return`replying in ${e}`}const ws="working in a chat";function Rs(e,n){var i;const o=n.rosters[e];if(o!==void 0)return o.members.map(a=>({author:a.author,origin:a.origin}));const s=(i=n.rooms[e])==null?void 0:i.participants;return s==null?[]:s.map(a=>({author:a}))}function Cs(e){const n=new Map;for(const[o,s]of Object.entries(e))s!==null&&n.set(dt(o),{path:o,manifest:s});return n}function te(e){return{...e,line:ut(e.name,e.binding,e.state),detail:ct(e.binding,e.state)}}function Is(e){const n=Cs(e.agents),o=new Set(e.excludeRoomIds??[]),s=[],i=new Set;for(const l of e.claims){const d=Rs(l.roomId,e).find(f=>f.author.id===l.authorId);if(d===void 0)continue;const c=d.author.agentRef===void 0?void 0:n.get(d.author.agentRef);if(c!==void 0&&i.add(c.path),o.has(l.roomId))continue;const h=e.rooms[l.roomId],g=h===void 0?null:he(h);s.push(te({id:`room:${l.roomId}:${l.authorId}`,name:d.author.displayName,handle:d.author.handle,face:G({record:d.author,override:c===void 0?null:Q(c.manifest),...d.origin!==void 0?{origin:d.origin}:{}}),binding:g===null?null:ks(g),state:l.state,since:l.since,roomTitle:g,runtime:(c==null?void 0:c.manifest.runtime)??null,profileMemberId:c===void 0?null:e.meshIdByPath[c.path]??null,follow:{kind:"room",roomId:l.roomId}}))}const a=new Set(i),r=[];for(const l of e.sessions){if(a.has(l.cwd))continue;const d=e.agents[l.cwd];if(d==null)continue;a.add(l.cwd);const c=d.displayName??d.name;r.push(te({id:`session:${l.sessionId}`,name:c,handle:null,face:G({record:{id:d.id,kind:"agent",displayName:c},override:Q(d)}),binding:ws,state:"working",since:null,roomTitle:null,runtime:d.runtime,profileMemberId:e.meshIdByPath[l.cwd]??null,follow:{kind:"session",sessionId:l.sessionId,cwd:l.cwd}}))}return r.sort((l,d)=>l.name.localeCompare(d.name)||l.id.localeCompare(d.id)),[...s,...r]}function As(e,n,o){var a;const s=new Set(mt(Object.keys(n),Object.values(o))),i=[];for(const[r,l]of Object.entries(n))((a=e[r])==null?void 0:a.lifecycle)==="streaming"&&s.has(r)&&i.push({sessionId:r,cwd:l});return i}const se=[],Ps=[],ne="\0",D="";function Ds(){const e=M(m.useCallback(i=>i.statuses,[])),n=M(m.useCallback(i=>i.statusCwds,[])),o=M(m.useCallback(i=>i.sessions,[])),s=m.useMemo(()=>As(e,n,o).map(i=>`${i.sessionId}${ne}${i.cwd}`).sort().join(D),[e,n,o]);return m.useMemo(()=>s.length===0?Ps:s.split(D).map(i=>{const[a,r]=i.split(ne);return{sessionId:a,cwd:r}}),[s])}function Os(e=[]){const n=ht(),o=gt(),s=Ds(),{data:i}=ft(),{data:a}=xt(),r=m.useMemo(()=>[...new Set(o.map(u=>u.roomId))].sort().join(`
|
|
2
|
-
`),[o]),l=m.useMemo(()=>r.length===0?[]:r.split(`
|
|
3
|
-
`),[r]),d=pt({queries:l.map(u=>({queryKey:jt.detail(u),queryFn:()=>n.getRoom(u)})),combine:u=>{const x={};for(const v of u)v.data!==void 0&&(x[v.data.id]=v.data);return x}}),c=m.useMemo(()=>{const u={};for(const x of i??[])u[x.id]=x;return u},[i]),h=m.useMemo(()=>((a==null?void 0:a.agents)??[]).map(u=>u.projectPath),[a]),{data:g}=vt(h),f=m.useMemo(()=>g??{},[g]),j=m.useMemo(()=>{const u={};for(const x of(a==null?void 0:a.agents)??[])u[x.projectPath]=x.id;return u},[a]),p=e.join(D);return m.useMemo(()=>{if(o.length===0&&s.length===0)return se;const u=Is({claims:o,rosters:d,rooms:c,sessions:s,agents:f,meshIdByPath:j,excludeRoomIds:p.length===0?[]:p.split(D)});return u.length===0?se:u},[o,d,c,s,f,j,p])}function Ms(e=[]){const n=Os(e),o=H(),{open:s}=bt(),i=m.useCallback(r=>{if(r.kind==="room"){Y.getState().recordOpened("room",r.roomId),o({...de.channels(),search:{id:r.roomId}});return}r.cwd&&Y.getState().recordOpened("agent",r.cwd),o(W({session:r.sessionId,dir:r.cwd}))},[o]),a=m.useMemo(()=>t.jsx(Ns,{rows:n,onFollow:i,onViewProfile:s}),[n,i,s]);return{occupied:n.length>0,node:a}}function E({title:e,children:n,action:o}){return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(kt,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:e}),t.jsx("p",{className:"max-w-sm",children:n}),o]})}function Ts(){return t.jsxs(t.Fragment,{children:[t.jsx(yt,{children:"Home"}),t.jsx(Es,{})]})}function Es(){var f,j,p;const e=St(),[n,o]=m.useState(!1),s=m.useCallback(()=>{const u=document.activeElement;Rt(u)&&u.blur()},[]),{thread:i,entry:a}=le({strict:!1}),r=Nt(),l=Ms(e.room===null?[]:[e.room.id]),d=_(((f=e.room)==null?void 0:f.id)??null),c=me(((j=e.room)==null?void 0:j.id)??null,null),h=d!==void 0&&d.length===0&&c.length===0,g=js(((p=e.room)==null?void 0:p.id)??null);if(e.status==="loading")return t.jsxs("div",{className:"flex h-full flex-col","aria-busy":!0,children:[t.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[t.jsx(C,{className:"size-7 rounded-full"}),t.jsx(C,{className:"h-4 w-40"})]}),t.jsx("div",{className:"flex-1"})]});if(e.status==="error")return t.jsx(E,{title:"Couldn’t load your team room",action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",onClick:e.retry,children:"Try again"}),children:"Its messages are safe."});if(e.status==="missing")return t.jsx(E,{title:"Your team room isn’t open yet",children:"DorkOS opens it at startup. Still missing? Restart DorkOS."});if(e.status==="archived"){const u=e.room;return t.jsx(E,{title:`${he(u)} is archived`,action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",disabled:r.isPending,onClick:()=>r.mutate({roomId:u.id}),children:r.isPending?"Bringing it back…":"Bring it back"}),children:"Its messages are safe."})}return t.jsx(hs,{children:t.jsx(Ct,{roomId:e.room.id,threadId:i,entrySeq:a,threadRoute:"/",offerJumpBackIn:!0,onComposerFocusChange:o,aboveTimeline:t.jsxs(t.Fragment,{children:[t.jsx(es,{presence:l,composerFocused:n,onExpand:s}),t.jsx(ds,{roomId:e.room.id,presenceOccupied:l.occupied})]}),aboveComposer:g?t.jsx(ps,{roomId:e.room.id,mode:g}):h?t.jsx(ss,{roomId:e.room.id}):void 0})})}const mn=Ts;export{mn as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dn as k,r as n,dp as I,dq as C,dr as E,j as e,e as D,ds as l,dt as R,a3 as x,B as M,du as B,dv as _,b8 as L,aS as z,dw as W,aW as G,dx as H,dy as K,a6 as U,dz as V,dA as q}from"./index-Dr-0P6rd.js";import{P as A}from"./page-container-CPxW5T9E.js";import{u as Q,S as X}from"./search-x-LIKnWE64.js";import{S as $}from"./scroll-area-XlDz8u4m.js";const J=8,Y={visible:{transition:{staggerChildren:.04}},hidden:{}},Z={hidden:{opacity:0,y:8},visible:{opacity:1,y:0}};function ee({tasks:o,isLoading:c,agentMap:u,onEditTask:j,agentId:h}){const t=Q(k,{debounce:{search:200}}),[r]=n.useState(0),[f,d]=n.useState(null),i=n.useMemo(()=>h?o.filter(s=>s.agentId===h):o,[o,h]),m=n.useMemo(()=>[...new Set(i.map(s=>s.agentId).filter(s=>!!s))],[i]),p=n.useMemo(()=>I(i,k,t.values,E,{field:t.sortField||C,direction:t.sortDirection}),[i,t.values,t.sortField,t.sortDirection]);return c?e.jsx("div",{className:"space-y-3 py-4",children:Array.from({length:3}).map((s,g)=>e.jsx(D,{className:"h-14 w-full rounded-xl"},g))}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs(l,{state:t,className:"px-0",children:[e.jsx(l.Search,{placeholder:"Filter tasks…"}),e.jsx(l.Primary,{name:"status"}),e.jsx(l.AddFilter,{dynamicOptions:{agent:m}}),e.jsx(l.Sort,{options:E,defaultField:C}),e.jsx(l.ResultCount,{count:p.length,total:i.length,noun:"task"}),e.jsx(l.ActiveFilters,{})]}),e.jsx($,{className:"min-h-0 flex-1","data-testid":R.tasksList,children:e.jsx("div",{className:"space-y-2 pb-4",children:p.length===0&&i.length>0?e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[e.jsx(X,{className:"text-muted-foreground/50 size-10"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.describeActive()?`No tasks match ${t.describeActive()}`:"No tasks match your filters"}),e.jsx(M,{variant:"outline",size:"sm",onClick:t.clearAll,children:"Clear filters"})]}):e.jsx(x.div,{initial:"hidden",animate:"visible",variants:Y,className:"space-y-2",children:p.map((s,g)=>e.jsx(x.div,{variants:g<J?Z:void 0,transition:{duration:.15},children:e.jsx(B,{task:s,agent:(s.agentId?u.get(s.agentId):void 0)??null,expanded:f===s.id,onToggleExpand:()=>d(f===s.id?null:s.id),onEdit:()=>j(s)})},s.id))},r)})})]})}function se(){return e.jsxs(e.Fragment,{children:[e.jsx(_,{children:"Schedules"}),e.jsx(te,{})]})}function te(){const o=L(),{data:c=[],isLoading:u,isError:j,refetch:h}=z(o),[t,r]=n.useState(!1),[f,d]=n.useState(),[i,m]=n.useState(null),p=c.some(a=>a.agentId),{data:s}=W(void 0,p||!u),g=n.useMemo(()=>{const a=new Map;for(const S of(s==null?void 0:s.agents)??[])a.set(S.id,S);return a},[s]),{externalTrigger:v,clear:N}=G(),[y,T]=n.useState(!1);v&&!y&&!t?(T(!0),d(void 0),r(!0),N()):!v&&y&&T(!1);const F=a=>{m(a),d(void 0),r(!0)},b=()=>{m(null),d(void 0),r(!0)},O=a=>{d(a),r(!0)},P=a=>{r(a),a||m(null)};if(!o)return e.jsx(H,{icon:K.tasks,name:"Scheduling",description:"Agents run tasks on a schedule, even while you’re away.",command:"dorkos --tasks"});if(j)return e.jsx(U,{className:"h-full",title:"Couldn’t load your scheduled tasks",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void h()});const w=c.length>0;return e.jsxs(e.Fragment,{children:[!w&&!u?e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(A,{width:"full",children:e.jsx(V,{onCreateWithPreset:F,onCreateBlank:b})})}):e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(A,{width:"full",scroll:!1,children:e.jsx(ee,{tasks:c,isLoading:u,agentMap:g,onEditTask:O})})}),e.jsx(q,{open:t,onOpenChange:P,editTask:f,initialPreset:i})]})}const le=se;export{le as component};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a4 as ht,r as d,j as t,hG as pt,ae as te,af as he,hH as pe,hI as B,hJ as Q,hK as gt,bV as be,l as je,aj as xt,ag as ke,hL as yt,hM as vt,hN as jt,hO as ye,hP as Re,B as w,hQ as Ct,dw as Rt,e3 as fe,dY as Nt,dZ as wt,d_ as St,d$ as bt,e0 as kt,I as He,fR as Qe,hR as Dt,fS as Je,fT as Be,fU as Ge,fV as We,fW as Ve,fX as Xe,fY as At,cV as De,cW as Ae,cX as Te,cY as Ee,cZ as Me,da as Oe,c_ as Ke,cQ as Ze,hS as Tt,hT as Et,gJ as Mt,hU as Ot,hV as Ue,hW as et,hX as Kt,hY as Ut,hZ as tt,h_ as _t,h$ as It,dv as st,i0 as $t,i1 as Lt,i2 as Pt,i3 as zt,at as qt,e7 as Ft,fn as Yt,ci as nt,i4 as Ht,i5 as Qt,dJ as Jt,n as ze}from"./index-Dr-0P6rd.js";import{T as Bt,R as Gt,a as Wt}from"./RoomSurface-BM0QO_av.js";import{M as me,C as Ne}from"./index-kHXlTLUx.js";import{M as Vt}from"./markdown-content-aNzh-54y.js";import{o as Xt,a as Zt,c as es}from"./owner-notice-BkrTEMDm.js";import"./use-jump-back-in-D9tBJ4v5.js";import"./use-room-follow-claim-Cf20JiJ_.js";import"./WidgetErrorCard-BQwrR6PJ.js";import"./card-BTgwskmX.js";import"./table-P4N5xQn2.js";import"./package-CoTlAnXZ.js";import"./heart-Bp14wOx6.js";import"./git-branch-Dq_w3Iyx.js";import"./file-DlQX-hKl.js";import"./find-latest-widget-fence-BGiexm6r.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-ufwCvCJB.js";import"./mention-pill-BxMK0xuY.js";import"./rotate-ccw-clock-cx5RyP4l.js";import"./message-square-off-D-CJXmTq.js";import"./use-connector-management-pgVHbXoO.js";import"./AgentRequestCard-CAaBGC0L.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-Cj1P85mz.js";import"./index-CcV9S7cO.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const rt={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};rt.node;const ts=ht(rt),ss=5e3;function ns({connection:e}){var h;const s=e.official===!0&&e.status==="connected"&&((h=e.access)==null?void 0:h.state)==="unverified",n=d.useMemo(()=>s?{}:null,[s]),[r,o]=d.useState(null);return d.useEffect(()=>{if(!n)return;const l=setTimeout(()=>o(n),ss);return()=>clearTimeout(l)},[n]),n===null||r!==n?null:t.jsx(pt,{tone:"info",role:"status",className:"m-3","data-testid":"official-space-unreachable",children:"The DorkOS community isn’t reachable right now. Try again in a few minutes."})}const rs=500,ie=new Map;function at(e,s){return e.id!==s.id||e.community!==s.community||e.roomId!==s.roomId||e.text===s.text&&e.authorDisplayName===s.authorDisplayName&&JSON.stringify(e.mentions)===JSON.stringify(s.mentions)&&JSON.stringify(e.attachments)===JSON.stringify(s.attachments)?e:{...e,text:s.text,mentions:s.mentions,attachments:s.attachments,authorDisplayName:s.authorDisplayName}}function Se(e,s){if(s.size===0)return e;let n=!1;const r=e.map(o=>{const h=s.get(o.id),l=h?at(o,h):o;return l!==o&&(n=!0),l});return n?r:e}function ve(e,s,...n){const r=new Map;for(const o of n)for(const h of o){if(h.community!==e||h.roomId!==s)throw new Error("Community history contains a different room.");r.set(h.id,h)}return[...r.values()].sort((o,h)=>o.remoteSeq-h.remoteSeq)}function as(e,s,n=!0,r=0,o="legacy",h=!1,l){const i=te(),a=d.useRef(l);d.useEffect(()=>{a.current=l},[l]);const c=he(),u=pe(!0,o,e),g=JSON.stringify([u==null?void 0:u.ownerKey,u==null?void 0:u.epoch,u==null?void 0:u.route.epoch,u==null?void 0:u.accessFingerprint,e,s]),[k,S]=d.useState(()=>({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}));return d.useEffect(()=>{if(!u||!n)return;const y=u,N=new AbortController;let E,P=0,O,q,z=!1;S({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"});function A(){z=!0,O=void 0,q=void 0,c.removeQueries({queryKey:Q.remote(y,e)}),S({address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"})}async function $(){try{await i.subscribeRemoteCommunityRoom(e,s,x=>{var T;if(!(N.signal.aborted||z||!B(y))){if(x.type==="closed"){(x.reason==="removed"||x.reason==="revoked")&&A();return}if(P=0,x.type==="snapshot")O=x.cursor??void 0,x.redactionCursor&&(q=x.redactionCursor),c.setQueryData(Q.room(y,e,s),x.room),S(p=>({address:g,room:x.room,entries:Se(ve(e,s,p.address===g?p.entries:[],x.entries).slice(-500),p.address===g?p.revisions:ie),revisions:p.address===g?p.revisions:ie,deliveries:p.deliveries.filter(C=>!x.entries.some(R=>R.originIdempotencyKey===C.idempotencyKey)),status:x.stale?"offline":"live"}));else if(x.type==="revision"){const p=x.entry;x.redactionCursor&&(q=x.redactionCursor);const C=[...Q.room(y,e,s),"entries"],_=c.getQueriesData({queryKey:C}).some(([,D])=>D==null?void 0:D.pages.some(I=>I.entries.some(J=>J.id===p.id)))||c.isFetching({queryKey:C})>0||((T=a.current)==null?void 0:T.call(a,p.id))===!0;c.setQueriesData({queryKey:C},D=>{if(!D)return D;let I=!1;const J=D.pages.map(W=>{const V=W.entries.map(se=>at(se,p));return V.some((se,oe)=>se!==W.entries[oe])?(I=!0,{...W,entries:V}):W});return I?{...D,pages:J}:D}),S(D=>{if(!_&&!D.entries.some(J=>J.id===p.id))return D;const I=new Map(D.revisions);for(I.delete(p.id),I.set(p.id,p);I.size>rs;)I.delete(I.keys().next().value);return{...D,entries:Se(D.entries,I),revisions:I}})}else x.type==="deliveries"?S(p=>({...p,deliveries:x.deliveries.filter(C=>!p.entries.some(R=>R.originIdempotencyKey===C.idempotencyKey))})):(O=x.entry.cursor,S(p=>({...p,entries:ve(e,s,p.entries,[x.entry]).slice(-500),deliveries:p.deliveries.filter(C=>C.idempotencyKey!==x.entry.originIdempotencyKey),status:"live"})))}},{since:O,redactions:q,signal:N.signal})}catch(x){if(N.signal.aborted||!B(y))return;const T=x&&typeof x=="object"&&"status"in x?x.status:void 0,p=x&&typeof x=="object"&&"code"in x?x.code:void 0;p==="COMMUNITY_DELETED"||p==="COMMUNITY_TAKEN_DOWN"?(A(),c.invalidateQueries({queryKey:Q.connections(y)})):T===401||T===403||T===404?A():T===410&&p==="COMMUNITY_CURSOR_STALE"&&(O=void 0)}if(N.signal.aborted||z||!B(y))return;const K=c.getQueryData(Q.room(y,e,s));K&&c.setQueryData(Q.room(y,e,s),{...K,stale:!0,writable:!1}),S(x=>({...x,room:x.room?{...x.room,stale:!0,writable:!1}:null,status:"offline"})),E=setTimeout(()=>{$()},Math.min(3e4,1e3*2**Math.min(P++,5)))}return $(),()=>{N.abort(),clearTimeout(E)}},[g,e,s,n,r,c,i,u,h]),k.address!==g||!u?{address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"connecting"}:n?k:h?{...k,room:k.room?{...k.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:g,room:null,entries:[],revisions:ie,deliveries:[],status:"removed"}}function is(e,s,n){var i;const r=gt(),o=be(),h=e!==void 0&&((i=r.room)==null?void 0:i.id)===e,l=r.status!=="loading";return d.useEffect(()=>{h&&o({...je.home(),search:{...s===void 0?{}:{thread:s},...n===void 0?{}:{entry:n}},replace:!0})},[h,s,n,o]),e===void 0?"show":h?"redirecting":l?"show":"pending"}const os=new Set(["COMMUNITY_MUTED","COMMUNITY_SLOW_MODE","COMMUNITY_RULES_NOT_ACCEPTED"]);function ls(e){const s=e==null?void 0:e.code;return typeof s=="string"&&os.has(s)}function cs(e,s=new Date){return e.kind==="muted"?`You’re muted here until ${yt(e.until,s)??"later"}.`:e.kind==="rules"?"Accept this space’s rules to post.":`Slow mode. Post again in ${e.secondsLeft}s.`}function us(e,s){if(!e)return null;if(e.mutedUntil&&Date.parse(e.mutedUntil)>s)return{kind:"muted",until:e.mutedUntil};const{rules:n}=e;return n.text!==null&&n.version>0&&n.acceptedVersion<n.version?{kind:"rules"}:null}function ds({community:e,roomId:s,enabled:n,accessFingerprint:r}){var z;const o=te(),h=he(),l=pe(n,r,e),i=l?[...Q.room(l,e,s),"standing"]:[...Q.all,"owner","unresolved",e,"room",s,"standing"],a=xt({queryKey:i,queryFn:()=>vt(l,()=>o.getRemoteCommunityStanding(e,s)),enabled:n&&l!==null,staleTime:3e4,retry:!1,refetchInterval:A=>{var $;return($=A.state.data)!=null&&$.mutedUntil&&Date.parse(A.state.data.mutedUntil)>Date.now()?6e4:!1}}),[c,u]=d.useState(null),[g,k]=d.useState(()=>Date.now()),S=(z=a.data)!=null&&z.mutedUntil?Date.parse(a.data.mutedUntil):null;d.useEffect(()=>{if(c!==null&&c>g){const A=setTimeout(()=>k(Date.now()),1e3);return()=>clearTimeout(A)}if(S!==null&&S>g){const A=setTimeout(()=>k(Date.now()),Math.min(S-g+50,1073741824));return()=>clearTimeout(A)}},[S,g,c]);const y=a.refetch,N=d.useCallback(A=>{if((A==null?void 0:A.code)==="COMMUNITY_SLOW_MODE"){const K=A.retryAfterMs;typeof K=="number"&&K>0&&(k(Date.now()),u(Date.now()+K));return}y()},[y]),E=ke({meta:{suppressErrorToast:!0},mutationFn:A=>o.acceptRemoteCommunityRules(e,A),onSuccess:A=>{h.setQueryData(i,$=>$&&{...$,rules:A})},onError:()=>void y()}),P=us(a.data,g),O=c===null?0:Math.ceil((c-g)/1e3),q=P??(O>0?{kind:"slow",secondsLeft:O}:null);return{standing:a.data,hold:q,noteHold:N,accept:E}}const ms=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]);function qe(e){return e.filter(s=>s.trim()).join(`
|
|
7
|
-
|
|
8
|
-
`)}function fs(e){const s=e==null?void 0:e.code;return typeof s=="string"&&ms.has(s)}function we(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function hs({ref:e,roomId:s,canSend:n,entries:r,onReceipt:o,draft:h,ownerKey:l,contextKey:i=l,onHold:a}){const c=te(),u=JSON.stringify([l,e,s,i]),g=jt(h),k=g.text,S=d.useMemo(()=>we(g.files),[g.files]),y=d.useRef(h);d.useLayoutEffect(()=>{y.current=h},[h]);function N(f){const v=y.current;if(!v)return;const j=ye.getState(),U=j.drafts[Re(v)],M=f({text:(U==null?void 0:U.text)??"",files:we((U==null?void 0:U.files)??[])});j.write(v,{text:M.text,files:M.files.map(({id:G,file:Y})=>({id:G,file:Y}))})}function E(f){N(v=>({...v,text:f}))}function P(f){N(v=>({...v,files:f(v.files)}))}const[O,q]=d.useState(null);function z(f){q(f===null?null:{address:u,context:i,message:f})}const[A,$]=d.useState([]),K=d.useRef(new Map),x=d.useRef(0),T=d.useRef(new Map),p=d.useRef(new Set),C=d.useRef(u),R=d.useRef(i),_=d.useRef(!0),D=d.useRef(n),I=d.useRef(o),J=d.useRef(a);d.useLayoutEffect(()=>{C.current=u,R.current=i,D.current=n,I.current=o,J.current=a},[u,n,i,o,a]),d.useEffect(()=>(_.current=!0,()=>{_.current=!1}),[]),d.useEffect(()=>{let f=!1;for(const v of r){if(!v.originIdempotencyKey)continue;const j=K.current.get(v.originIdempotencyKey);(j==null?void 0:j.address)===C.current&&j.context===R.current&&K.current.delete(v.originIdempotencyKey)&&(f=!0)}f&&$([...K.current.values()])},[r]);function W(){_.current&&$([...K.current.values()].filter(f=>f.address===C.current&&f.context===R.current).map(f=>({...f})))}async function V(f){var v;if(!(p.current.has(f.key)||!D.current||!_.current||f.address!==C.current)){p.current.add(f.key),f.status="sending",f.error=void 0,W();try{for(let U=f.attachmentIds.length;U<f.files.length;U++){if(!D.current||!_.current||f.address!==C.current)throw new Error("Reconnect to this channel, then try again.");const M=await c.uploadRemoteCommunityAttachment(f.ref,f.roomId,f.files[U].file,`${f.key}:file:${U}`);f.attachmentIds.push(M.id)}if(!D.current||!_.current||f.address!==C.current)throw new Error("Reconnect to this channel, then try again.");const j=await c.postRemoteCommunityEntry(f.ref,f.roomId,{text:f.text,parentEntryId:f.parentEntryId,attachmentIds:f.attachmentIds,idempotencyKey:f.key});K.current.delete(f.key),_.current&&f.address===C.current&&f.context===R.current&&I.current(j)}catch(j){if(fs(j)&&se(f)){K.current.delete(f.key);return}if(ls(j)&&se(f)){K.current.delete(f.key),_.current&&f.address===C.current&&((v=J.current)==null||v.call(J,j));return}f.status="failed",f.error=j instanceof Error?j.message:"Not confirmed. Try this message again."}finally{p.current.delete(f.key),W()}}}function se(f){const{draft:v}=f.origin,j=Re(v),U=ye.getState(),M=U.drafts[j],G=(M==null?void 0:M.text)??"";let Y=T.current.get(j)??[];const X=qe(Y.map(H=>H.origin.typed));let Z=G;X&&G.startsWith(X)?Z=G.slice(X.length).replace(/^\n+/,""):Y=[];const re=[...Y,f].sort((H,ee)=>H.origin.seq-ee.origin.seq),ae=new Set(re.flatMap(H=>H.files.map(ee=>ee.id))),ge=[...re.flatMap(H=>H.files.map(({id:ee,file:de})=>({id:ee,file:de}))),...((M==null?void 0:M.files)??[]).filter(H=>!ae.has(H.id))];return U.write(v,{text:qe([...re.map(H=>H.origin.typed),Z]),files:ge}),j in ye.getState().drafts?(T.current.set(j,re),!0):!1}function oe(f){const v=y.current;if(!v||!D.current)return;const j=ye.getState(),U=j.drafts[Re(v)];if(!U||!U.text.trim()&&U.files.length===0)return;if(K.current.size>=30){z("Too many messages waiting. Let them send, or retry them first.");return}const M=j.take(v),G=we(M.files),Y={address:u,context:i,ref:e,roomId:s,key:crypto.randomUUID(),text:M.text.trim()?M.text:G.map(X=>X.file.name).join(", "),parentEntryId:f,files:G,attachmentIds:[],status:"sending",origin:{draft:v,typed:M.text,seq:x.current+=1}};K.current.set(Y.key,Y),z(null),V(Y)}return{text:k,setText:E,attachments:{staged:S,add(f){if(f.some(v=>v.size>25*1024*1024)){z("Each file must be 25 MB or smaller.");return}P(v=>v.length+f.length>8?(z("Attach up to eight files to one message."),v):[...v,...f.map(j=>({id:crypto.randomUUID(),file:j,status:"pending",progress:0}))])},remove(f){P(v=>v.filter(j=>j.id!==f))},retry(){},cancel(){P(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:A.filter(f=>f.address===u&&f.context===i),error:(O==null?void 0:O.address)===u&&O.context===i?O.message:null,send:oe,retry(f){const v=K.current.get(f);v&&V(v)}}}function ps({entry:e,onThread:s,onReport:n}){const r=te(),o=d.useId(),[h,l]=d.useState(null),[i,a]=d.useState(null),c={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function u(g,k){if(i)return;a(g),l(null);let S;try{const y=await r.downloadRemoteCommunityAttachment(e.community,e.roomId,g);S=URL.createObjectURL(y);const N=document.createElement("a");N.href=S,N.download=Array.from(k,E=>E==="/"||E==="\\"||E.charCodeAt(0)<32?"_":E).join(""),document.body.append(N),N.click(),N.remove()}catch(y){l(y instanceof Error?y.message:"Couldn’t download the file. Try again.")}finally{S&&setTimeout(()=>URL.revokeObjectURL(S),1e3),a(null)}}return t.jsxs(me.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":o,children:[t.jsx(me.Gutter,{author:c,at:e.createdAt}),t.jsxs(me.Body,{children:[t.jsx(me.Author,{id:o,author:c,at:e.createdAt}),t.jsxs(me.Content,{children:[t.jsx(Vt,{content:e.text}),e.attachments.map(g=>t.jsx(w,{variant:"outline",size:"sm",disabled:i!==null,onClick:()=>void u(g.id,g.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:i===g.id?"Downloading…":g.name})},g.id)),h&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:h}),t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(w,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function gs({community:e,roomId:s,online:n,canEnroll:r,accessFingerprint:o}){var T,p,C;const h=te(),l=he(),i=pe(!0,o,e),a=Ct(e,r,o),c=Rt(),[u,g]=d.useState(""),[k,S]=d.useState(""),[y,N]=d.useState(!1),[E,P]=d.useState(null),[O,q]=d.useState(null),z=d.useId(),A=((T=a.data)==null?void 0:T.filter(R=>R.active))??[],$=((p=c.data)==null?void 0:p.agents.filter(R=>!A.some(_=>_.localAgentId===R.id)))??[];async function K(){i&&B(i)&&await l.invalidateQueries({queryKey:Q.remote(i,e)})}async function x(R){if(R.preventDefault(),!u||y||!n||!r||!i)return;const _=i;N(!0),P(null);try{if(await h.enrollRemoteCommunityAgent(e,u,k.trim()?{handle:k.trim()}:{}),!B(_))return;g(""),S(""),await K()}catch(D){B(_)&&P(D instanceof Error?D.message:"Couldn’t add the agent. Try again.")}finally{B(_)&&N(!1)}}return t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-label":"Your agents in this space",children:[t.jsx("h3",{className:"text-sm font-medium",children:"My agents"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Add an agent from here, then choose whether it joins this channel."}),a.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),(C=a.data)==null?void 0:C.map(R=>t.jsx(xs,{agent:R,roomId:s,online:n,canEnroll:r,onChanged:K,onNotice:q},R.localAgentId)),c.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),r&&$.length>0&&t.jsxs("form",{onSubmit:R=>void x(R),className:"flex flex-wrap items-end gap-2",children:[t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(fe,{htmlFor:`${z}-agent`,children:"Local agent"}),t.jsxs(Nt,{value:u,onValueChange:g,disabled:!n||y,children:[t.jsx(wt,{id:`${z}-agent`,children:t.jsx(St,{placeholder:"Choose an agent"})}),t.jsx(bt,{children:$.map(R=>t.jsx(kt,{value:R.id,children:R.name},R.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(fe,{htmlFor:`${z}-handle`,children:"Space handle (optional)"}),t.jsx(He,{id:`${z}-handle`,value:k,onChange:R=>S(R.target.value),disabled:!n||y,placeholder:"Use the agent’s handle"})]}),t.jsx(w,{type:"submit",disabled:!u||!n||y,children:y?"Adding…":"Add to space"})]}),O&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:O}),E&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:E})]})}function xs({agent:e,roomId:s,online:n,canEnroll:r,onChanged:o,onNotice:h}){const l=te(),[i,a]=d.useState(null),[c,u]=d.useState(null),g=e.roomIds.includes(s);async function k(y,N){if(!i){a(y),u(null);try{await N(),await o()}catch(E){u(E instanceof Error?E.message:"Couldn’t finish that. Try again.")}finally{a(null)}}}function S(y){h(y.remoteRevoked?"Stopped taking part.":"Stopped here, but the space wasn’t told. Try again when it’s reachable.")}return t.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.displayName,!e.active&&" · stopped here"," ",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["· owned by ",e.ownerDisplayName]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(w,{variant:"outline",size:"sm",disabled:i!==null||!r||!e.active||!g&&!n,onClick:()=>void k("membership",async()=>{g?S(await l.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await l.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:g?"Leave channel":"Join channel"}),t.jsx(w,{variant:"ghost",size:"sm",disabled:i!==null||!r,onClick:()=>void k("stop",()=>l.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(Qe,{children:[t.jsx(Dt,{asChild:!0,children:t.jsx(w,{variant:"ghost",size:"sm",disabled:i!==null||!r,children:"Remove from space"})}),t.jsxs(Je,{children:[t.jsxs(Be,{children:[t.jsxs(Ge,{children:["Remove ",e.displayName,"?"]}),t.jsx(We,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(Ve,{children:[t.jsx(Xe,{children:"Cancel"}),t.jsx(At,{onClick:()=>void k("remove",async()=>S(await l.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),c&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:c})]})}function ys({roster:e,failed:s,canMention:n,onMention:r,community:o,roomId:h,online:l,canEnroll:i,agentsKey:a,accessFingerprint:c}){return t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[s&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),(e==null?void 0:e.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),e==null?void 0:e.members.map(u=>{var g;return t.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[t.jsxs("span",{children:[u.displayName,u.kind==="agent"?" · Agent":"",u.ownerMemberId&&` · owned by ${((g=e.members.find(k=>k.memberId===u.ownerMemberId))==null?void 0:g.displayName)??"a space member"}`]}),u.handle&&t.jsxs(w,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>r(u.handle),children:["Mention @",u.handle]})]},u.memberId)}),i&&t.jsx(gs,{community:o,roomId:h,online:l,canEnroll:!0,accessFingerprint:c},a)]})}function it(e,s){return e instanceof Error&&e.message?e.message:s}function vs({conduct:e,staff:s,onReadRules:n}){const{hold:r,standing:o}=e;return(r==null?void 0:r.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(w,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):r||s||!(o!=null&&o.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",o.slowModeSeconds,"s."]})}function js({conduct:e,open:s,onOpenChange:n}){var h;const r=(h=e.standing)==null?void 0:h.rules,o=r?r.acceptedVersion>=r.version:!1;return t.jsx(De,{open:s,onOpenChange:n,children:t.jsxs(Ae,{className:"sm:max-w-lg",children:[t.jsxs(Te,{children:[t.jsx(Ee,{children:"Space rules"}),t.jsx(Me,{children:o?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Oe,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(r==null?void 0:r.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:it(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(w,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(r==null?void 0:r.text)&&!o&&t.jsx(w,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(r.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function Cs({community:e,accessFingerprint:s,currentName:n,open:r,onOpenChange:o}){return t.jsx(De,{open:r,onOpenChange:o,children:t.jsx(Ae,{className:"sm:max-w-md",children:r&&t.jsx(Rs,{community:e,accessFingerprint:s,currentName:n,onDone:()=>o(!1)})})})}function Rs({community:e,accessFingerprint:s,currentName:n,onDone:r}){const o=te(),h=he(),l=pe(!0,s,e),[i,a]=d.useState(n),c=ke({meta:{suppressErrorToast:!0},mutationFn:g=>o.setRemoteCommunityDisplayName(e,g),onSuccess:async()=>{l&&await h.invalidateQueries({queryKey:Q.content(l,e)}),r()}}),u=i.trim();return t.jsxs("form",{onSubmit:g=>{g.preventDefault(),u&&u!==n&&c.mutate(u)},children:[t.jsxs(Te,{children:[t.jsx(Ee,{children:"Your name in this space"}),t.jsx(Me,{children:"Other spaces keep the name they show."})]}),t.jsxs(Oe,{className:"space-y-2",children:[t.jsx(fe,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(He,{id:"remote-community-display-name",value:i,maxLength:128,autoComplete:"nickname",onChange:g=>a(g.target.value)}),c.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:it(c.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(w,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),t.jsx(w,{type:"submit",disabled:!u||u===n||c.isPending,children:c.isPending?"Saving…":"Save name"})]})]})}const Ns=[{value:"spam",label:"Spam"},{value:"harassment",label:"Harassment"},{value:"off_topic",label:"Off topic"},{value:"illegal",label:"Against the law"},{value:"other",label:"Something else"}];function ws({entry:e,onClose:s}){return t.jsx(De,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx(Ae,{className:"sm:max-w-md",children:e&&t.jsx(Ss,{entry:e,onClose:s},e.id)})})}function Ss({entry:e,onClose:s}){const n=te(),r=d.useId(),[o,h]=d.useState(null),[l,i]=d.useState(""),a=ke({meta:{suppressErrorToast:!0},mutationFn:c=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,c),onSuccess:()=>{Ze("Message reported"),s()}});return t.jsxs("form",{onSubmit:c=>{c.preventDefault(),o&&a.mutate({reason:o,...l.trim()?{note:l.trim()}:{}})},children:[t.jsxs(Te,{children:[t.jsx(Ee,{children:"Report message"}),t.jsx(Me,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Oe,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Tt,{"aria-label":"Reason",value:o??"",onValueChange:c=>h(c),children:Ns.map(c=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Et,{value:c.value,id:`${r}-${c.value}`}),t.jsx(fe,{htmlFor:`${r}-${c.value}`,children:c.label})]},c.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(fe,{htmlFor:`${r}-note`,children:"Note (optional)"}),t.jsx(Mt,{id:`${r}-note`,value:l,maxLength:Ot,onChange:c=>i(c.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),a.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:a.error instanceof Error&&a.error.message?a.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ke,{children:[t.jsx(w,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(w,{type:"submit",disabled:!o||a.isPending,children:a.isPending?"Sending…":"Send report"})]})]})}function bs({agentDeliveries:e,drafts:s,entries:n,threadId:r,canSend:o,action:h,onRetryAgent:l,onRetryDraft:i}){return t.jsxs(t.Fragment,{children:[e.filter(a=>a.parentEntryId===(r??null)&&!n.some(c=>c.originIdempotencyKey===a.idempotencyKey)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[a.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.attachments.map((c,u)=>t.jsx("span",{className:"mr-2",children:c.name},u)),t.jsx("p",{className:"text-muted-foreground",children:a.state==="pending"?"Waiting for the space to confirm…":a.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),a.state==="pending"&&a.retryable&&t.jsx(w,{variant:"outline",size:"sm",disabled:!o||h!==null,onClick:()=>l(a.idempotencyKey),children:h===`retry:${a.idempotencyKey}`?"Retrying…":"Retry now"})]},a.idempotencyKey)),s.filter(a=>a.parentEntryId===r&&!n.some(c=>c.originIdempotencyKey===a.key)).map(a=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:a.text}),a.files.map(c=>t.jsx("span",{className:"mr-2",children:c.file.name},c.id)),t.jsx("p",{className:"text-muted-foreground",children:a.status==="sending"?"Sending…":"Delivery not confirmed."}),a.error&&t.jsx("p",{children:a.error}),a.status==="failed"&&t.jsx(w,{variant:"outline",size:"sm",disabled:!o,onClick:()=>i(a.key),children:"Retry message"})]},a.key))]})}function ks(e,s){var h;const n=new Map;for(const l of e)l.thread&&n.set(l.id,{count:l.thread.replyCount,lastAt:l.thread.lastReplyAt,through:l.threadLastReplySeq});const r=new Map;for(const l of s){const i=l.threadRootEntryId;if(l.depth===0||i===null)continue;const a=(h=n.get(i))==null?void 0:h.through;if(a!==void 0&&l.remoteSeq<=a)continue;const c=r.get(i);r.set(i,{count:((c==null?void 0:c.count)??0)+1,newest:c&&c.newest.remoteSeq>l.remoteSeq?c.newest:l})}const o=new Map;for(const l of new Set([...n.keys(),...r.keys()])){const i=n.get(l),a=r.get(l),c=i===void 0?a.count:i.through===void 0?Math.max(i.count,(a==null?void 0:a.count)??0):i.count+((a==null?void 0:a.count)??0);o.set(l,{count:c,lastAt:(a==null?void 0:a.newest.createdAt)??i.lastAt,unread:0})}return o}const Ds={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function As({community:e,roomId:s,threadId:n,onThread:r}){var Ie,$e,Le,Pe;const o=te(),l=(Ie=Ue().data)==null?void 0:Ie.find(m=>m.ref===e),i=et(l==null?void 0:l.access),a=pe(!0,i.fingerprint,e),c=a?JSON.stringify([a.ownerKey,a.epoch]):"",u=a?JSON.stringify([a.ownerKey,a.epoch,a.route.epoch,a.accessFingerprint]):"",g=he(),k=Kt(),S=Ut(),y=($e=k.data)==null?void 0:$e.destinations.find(m=>m.ref===e&&m.roomId===s),N=d.useRef(null),E=d.useRef(void 0),P=(y==null?void 0:y.scrollAnchorEntryId)??null,O=d.useCallback(m=>{if(!a||n)return;N.current&&clearTimeout(N.current),N.current=null;const b=m??null,L=E.current===void 0?P:E.current;b===null&&L===null||(N.current=setTimeout(()=>{N.current=null,E.current=b,S.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:b})},400))},[a,e,S,P,s,n]);d.useEffect(()=>()=>{N.current&&clearTimeout(N.current)},[]),d.useEffect(()=>{(l==null?void 0:l.status)==="reconnect-required"&&a&&g.removeQueries({queryKey:Q.remote(a,e)})},[a,e,l==null?void 0:l.status,g]);const q=tt(e,s,i.capabilities.read,i.fingerprint),[z,A]=d.useState(0),$=d.useRef([]),K=d.useCallback(m=>$.current.some(b=>b.id===m),[]),x=as(e,s,i.capabilities.stream,z,i.fingerprint,i.cacheReadable,K),T=x.status==="removed",p=T?null:x.room??q.data,C=_t(e,s,n,!T&&i.capabilities.read&&(p==null?void 0:p.readable)===!0,i.fingerprint),R=It(e,s,!T&&i.capabilities.read&&(p==null?void 0:p.readable)===!0,i.fingerprint),[_,D]=d.useState(()=>({address:u,entries:[]})),I=d.useMemo(()=>_.address===u?_.entries:[],[u,_]);d.useEffect(()=>{$.current=I},[I]);const[J,W]=d.useState(0),[V,se]=d.useState(!1),[oe,le]=d.useState(null),[f,v]=d.useState(null),j=ds({community:e,roomId:s,enabled:!T&&i.capabilities.read&&(p==null?void 0:p.readable)===!0,accessFingerprint:i.fingerprint}),U=(l==null?void 0:l.connectedHumanMemberId)??null,M=(Le=R.data)==null?void 0:Le.members.find(m=>m.memberId===U),G=m=>{var b;return m===U||((b=R.data)==null?void 0:b.members.some(L=>L.memberId===m&&L.ownerMemberId===U))===!0},[Y,X]=d.useState({address:"",name:null,error:null}),Z=Y.address===u?Y.name:null,re=Y.address===u?Y.error:null,ae=d.useRef(null),ge=d.useRef(null),H=d.useRef(null),ee=!T&&i.capabilities.post&&x.status==="live"&&(p==null?void 0:p.writable)===!0,de=ee&&j.hold===null,ce=d.useMemo(()=>{var m;return T?[]:Se(ve(e,s,...((m=C.data)==null?void 0:m.pages.map(b=>b.entries))??[],x.entries,I),x.revisions)},[e,s,C.data,x.entries,x.revisions,I,T]),lt=d.useCallback(m=>{D(b=>({address:u,entries:ve(e,s,b.address===u?b.entries:[],[m]).slice(-500)})),W(b=>b+1)},[u,e,s]);d.useLayoutEffect(()=>{var m;J>0&&((m=H.current)==null||m.scrollToBottom())},[J]);const ct=d.useMemo(()=>{var m;return a?{ownerKey:a.ownerKey,epoch:a.epoch,ref:e,generation:((m=a.connection)==null?void 0:m.generation)??0,roomId:s,threadId:n}:null},[a,e,s,n]),F=hs({ref:e,roomId:s,canSend:de,entries:ce,onReceipt:lt,draft:ct,ownerKey:c||"unresolved",contextKey:u||"unresolved",onHold:j.noteHold}),ut=ce.filter(m=>n?m.id===n||m.threadRootEntryId===n:m.depth===0),dt=d.useMemo(()=>{var m;return n?new Map:ks(((m=C.data)==null?void 0:m.pages.flatMap(b=>b.entries))??[],ce)},[n,C.data,ce]),_e=ut.flatMap(m=>{const b=dt.get(m.id);return b?[{kind:"message",entry:m},{kind:"replies",rootId:m.id,summary:b}]:[{kind:"message",entry:m}]}),mt=_e.map(m=>m.kind==="replies"?{kind:"thread-reply",id:`${m.rootId}:replies`,rootId:m.rootId,replyCount:m.summary.count,lastAt:m.summary.lastAt}:{kind:"message",id:m.entry.id,payload:m.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,m.entry.authorId]),kind:m.entry.authorKind,displayName:m.entry.authorDisplayName},at:m.entry.createdAt}),Ce={kind:"room",id:JSON.stringify([e,s,n]),placeholder:n?"Reply in thread…":`Message ${(p==null?void 0:p.title)??"this channel"}…`,canSend:de,canSendReason:T?"You no longer have access to this channel.":j.hold?cs(j.hold):!i.capabilities.post&&i.cacheReadable?"This space is read-only.":p!=null&&p.archived?"This channel is archived.":p!=null&&p.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:F.attachments,async send(){F.send(n)}};async function xe(m,b){if(Z||!a)return;const L=a,ue=u;X({address:ue,name:m,error:null});try{if(await b(),!B(L))return;(m==="join"||m==="leave"||m.startsWith("retry:"))&&A(ne=>ne+1),await g.invalidateQueries({queryKey:Q.remote(L,e)})}catch(ne){B(L)&&X({address:ue,name:m,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{B(L)&&X(ne=>ne.address===ue?{...ne,name:null}:ne)}}function ft(){var L;const m=ce.at(-1);if(n||C.hasNextPage||!m||x.status!=="live"||((L=ae.current)==null?void 0:L.address)===u&&ae.current.cursor===m.cursor||!a)return;const b=a;ae.current={address:u,cursor:m.cursor},o.setRemoteCommunityReadCursor(e,s,m.cursor).then(()=>{B(b)&&g.invalidateQueries({queryKey:Q.rooms(b,e)})}).catch(()=>{var ue;((ue=ae.current)==null?void 0:ue.address)===u&&(ae.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:Ds,target:Ce,children:[t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(p==null?void 0:p.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[n&&t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>r(),children:"Back to channel"}),!T&&i.capabilities.post&&p&&!p.joined&&!p.stale&&t.jsx(w,{size:"sm",disabled:Z!==null,onClick:()=>void xe("join",()=>o.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),i.cacheReadable&&t.jsx(w,{variant:"ghost",size:"sm",disabled:T,onClick:()=>se(!V),children:V?"Hide members":"Members"}),((Pe=j.standing)==null?void 0:Pe.rules.text)&&t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>le("rules"),children:"Rules"}),i.capabilities.post&&t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>le("name"),children:"Your name"}),i.capabilities.enrollAgent&&t.jsx(w,{variant:"outline",size:"sm",disabled:Z!==null,onClick:()=>void xe("stop",()=>o.haltRemoteCommunityRoom(e,s)),children:Z==="stop"?"Stopping…":"Stop my agents"}),i.capabilities.post&&(p==null?void 0:p.joined)&&t.jsx(w,{variant:"ghost",size:"sm",disabled:Z!==null||!ee,onClick:()=>void xe("leave",async()=>{await o.leaveRemoteCommunityRoom(e,s),a&&g.removeQueries({queryKey:Q.room(a,e,s)})}),children:"Leave channel"})]}),re&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:re}),T?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[x.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:x.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),q.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),V&&t.jsx(ys,{roster:R.data,failed:R.isError,canMention:ee,onMention:m=>{var b;F.setText(`${F.text}${F.text&&!F.text.endsWith(" ")?" ":""}@${m} `),(b=ge.current)==null||b.focus()},community:e,roomId:s,online:x.status==="live",canEnroll:i.capabilities.enrollAgent,agentsKey:u,accessFingerprint:i.fingerprint}),C.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(w,{variant:"ghost",size:"sm",onClick:()=>void C.refetch(),children:"Retry"})]}),C.hasNextPage&&t.jsx(w,{variant:"ghost",size:"sm",disabled:C.isFetchingNextPage,onClick:()=>void C.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:H,conversationId:Ce.id,rows:mt,label:n?"Space thread":"Space messages",busy:C.isFetching,resumeRow:()=>n?void 0:P??void 0,onTopRow:O,onReachedBottom:ft,onOpenThread:r,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:C.isPending?"Loading messages…":"No messages here yet."}),renderRow:(m,b)=>{const L=_e[b.index];return L.kind==="message"?t.jsx(ps,{entry:L.entry,onThread:r,onReport:i.capabilities.post&&R.data&&!G(L.entry.authorId)?()=>v(L.entry):void 0}):t.jsx(Bt,{summary:L.summary,open:!1,onOpen:()=>r(L.rootId)})}}),t.jsx(bs,{agentDeliveries:x.deliveries,drafts:F.deliveries,entries:ce,threadId:n,canSend:de,action:Z,onRetryAgent:m=>void xe(`retry:${m}`,()=>o.retryRemoteCommunityDelivery(e,s,m)),onRetryDraft:F.retry}),F.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:F.error}),t.jsx(Ne.Composer,{inputRef:ge,aboveInput:t.jsx(vs,{conduct:j,staff:["owner","admin"].includes((M==null?void 0:M.role)??""),onReadRules:()=>le("rules")}),className:"m-3",value:F.text,onChange:F.setText,onSubmit:()=>F.send(n),input:{isStreaming:!1,contextKey:Ce.id,canSubmit:F.text.trim().length>0||F.attachments.staged.length>0}})]})]}),t.jsx(js,{conduct:j,open:oe==="rules",onOpenChange:m=>le(m?"rules":null)}),t.jsx(Cs,{community:e,accessFingerprint:i.fingerprint,currentName:(M==null?void 0:M.displayName)??"",open:oe==="name",onOpenChange:m=>le(m?"name":null)}),t.jsx(ws,{entry:f,onClose:()=>v(null)})]})}function Ts({community:e,roomId:s}){var c,u;const n=Ue(),r=(c=n.data)==null?void 0:c.find(g=>g.ref===e),o=et(r==null?void 0:r.access),h=tt(e,s??"",!!s&&o.capabilities.read,o.fingerprint),l=(r==null?void 0:r.label)??"Space",i=s?(u=h.data)==null?void 0:u.title:void 0,a=r===void 0&&n.fetchStatus==="fetching"||s!==void 0&&i===void 0&&h.fetchStatus==="fetching";return t.jsx(st,{pending:a,children:i?`${l} · ${i}`:l})}function ot(e){var s,n,r,o;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((o=(r=e.access)==null?void 0:r.lastKnown)==null?void 0:o.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Fe(e,s,n){return`${e} ${e===1?s:n}`}function Es(e,s){const n=[e>0?Fe(e,"message from your agents","messages from your agents"):null,s>0?Fe(s,"draft of yours","drafts of yours"):null].filter(o=>o!==null);if(n.length===0)return null;const r=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${r?"wasn’t":"weren’t"} sent.`}function Ms({connection:e,onRemoved:s}){const n=ot(e),r=$t(),[o,h]=d.useState(!1),{ownerKey:l}=Lt(),i=Pt(l,e.ref),{copied:a,failed:c,copy:u}=zt(),g=e.label,k=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function S(){r.mutate(e,{onSuccess:()=>{h(!1),Ze.success(`${g} is removed from DorkOS.`),s()}})}const y=n==="deleted"||n==="taken-down",N=n==="taken-down"?"This space was taken down":n==="deleted"?"This space was deleted":"This space seems to be gone",E=n==="taken-down"?`DorkOS removed its copy here. If ${g} returns, you can connect again.`:n==="deleted"?"DorkOS removed its copy from this computer.":`Since ${k}, ${g} says it doesn’t exist. Its channels, messages and files are still here.`,P=Es(y?e.undeliveredAgentMessages??0:0,i.length),O=i.length===0?null:i.length===1?"Your unsent draft is cleared too.":`Your ${i.length} unsent drafts are cleared too.`;return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-10 text-center text-sm","data-testid":"community-gone",children:[t.jsx(ts,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:N}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:E}),P&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:P}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:a?"Copied.":c?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i.length>0&&t.jsx(w,{variant:"outline",onClick:()=>void u(i.join(`
|
|
9
|
-
|
|
10
|
-
`)),children:a?"Copied":c?"Couldn’t copy":i.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(w,{variant:y?"outline":"destructive",onClick:()=>h(!0),children:y?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(Qe,{open:o,onOpenChange:q=>{q||r.reset(),h(q)},children:t.jsxs(Je,{children:[t.jsxs(Be,{children:[t.jsx(Ge,{children:y?`Remove ${g} from DorkOS?`:`Remove your copy of ${g}?`}),t.jsx(We,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:y?`${g} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!y&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),O&&t.jsx("p",{children:O})]})})]}),r.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t remove it. Check that DorkOS is running, then try again."}),t.jsxs(Ve,{children:[t.jsx(Xe,{disabled:r.isPending,children:"Cancel"}),t.jsx(w,{variant:"destructive",disabled:r.isPending,onClick:S,children:r.isPending?"Removing…":y?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function Os({connection:e,dateFormat:s}){var h,l;const n=Xt(e);if(!n)return null;const[r,...o]=Zt(n,(l=(h=e.access)==null?void 0:h.lastKnown)==null?void 0:l.lifecycle,s);return t.jsxs("section",{"aria-label":"Request to take over this space",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg flex flex-wrap items-start gap-x-3 gap-y-2 border-b px-4 py-3 text-sm",children:[t.jsx(qt,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1 basis-60 space-y-1",children:[t.jsx("p",{className:"text-foreground font-medium",children:r}),o.map(i=>t.jsx("p",{children:i},i))]}),t.jsxs(w,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>Yt(es(e)),children:["Open space",t.jsx(Ft,{className:"size-3.5","aria-hidden":!0})]})]})}function Ks(){const{id:e,community:s}=nt({from:"/_shell/channels"}),n=Ht(s);return s&&!n.visible?n.isLoading?null:t.jsx(Qt,{...je.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(Ts,{community:s,roomId:e}):e===void 0&&t.jsx(st,{children:"Channels"}),t.jsx(Us,{})]})}function Us(){const{id:e,thread:s,entry:n,community:r}=nt({from:"/_shell/channels"}),o=be(),h=is(r?void 0:e,s,n),l=Jt();return r&&e?t.jsx(Ye,{community:r,children:t.jsx(As,{community:r,roomId:e,threadId:s,onThread:i=>{o({...je.channels(),search:{community:r,id:e,thread:i}})}},JSON.stringify([r,e]))}):r?t.jsx(Ye,{community:r,children:t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(ze,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"No channel selected"}),t.jsx("p",{className:"max-w-sm",children:"Choose a channel from this space."})]})}):h==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Gt,{})}):h==="redirecting"?null:e===void 0?t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(ze,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a channel or DM"}),t.jsx("p",{className:"max-w-sm",children:l?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(Wt,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Ye({community:e,children:s}){var o;const n=be(),r=(o=Ue().data)==null?void 0:o.find(h=>h.ref===e);return r&&ot(r)?t.jsx(Ms,{connection:r,onRemoved:()=>void n({...je.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r&&t.jsx(Os,{connection:r}),r&&t.jsx(ns,{connection:r}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const ln=Ks;export{ln as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./index-Dr-0P6rd.js";import{M as o}from"./Marketplace-BoiupH2Z.js";import{P as r}from"./page-container-CPxW5T9E.js";import"./PreviewRefusedNotice-fTN8MJ1h.js";import"./shield-x-DioB6qH_.js";import"./card-BTgwskmX.js";import"./markdown-content-aNzh-54y.js";import"./use-unclaimed-chats-D4k-EK_f.js";import"./UnlinkDialog-BgwHAqdW.js";import"./use-dev-links-BImQrE6g.js";import"./file-DlQX-hKl.js";import"./file-exclamation-point-Dg2iCyPM.js";import"./rotate-ccw-clock-cx5RyP4l.js";function i(){return t.jsx(r,{width:"wide",children:t.jsx(o,{})})}const M=i;export{M as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Dr-0P6rd.js";import{P as r}from"./page-container-CPxW5T9E.js";import{M as e}from"./MarketplaceSourcesView-krw9hUyu.js";import"./use-pending-read-DmrlNHS0.js";function t(){return o.jsx(r,{width:"reading",children:o.jsx(e,{})})}const s=t;export{s as component};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TopologyGraph-of6Cp5Kj.js","assets/index-Dr-0P6rd.js","assets/index-ExcAk4pE.css","assets/heart-Bp14wOx6.js","assets/AdapterIcon-BdM7K69W.js","assets/session-strategy-labels-C7Wduch3.js","assets/use-mesh-topology-DBeqzUoy.js","assets/use-delete-binding-DxEiOjjh.js","assets/use-pending-read-DmrlNHS0.js","assets/search-x-LIKnWE64.js","assets/scroll-area-XlDz8u4m.js","assets/OpenMeshSwitch-DrmjsCDY.js","assets/table-P4N5xQn2.js","assets/page-container-CPxW5T9E.js","assets/CommitmentList-DsEn6iK1.js","assets/TopologyGraph-C7eadB24.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a4 as Rt,r as w,dJ as Ue,j as r,Z as k,a3 as $,c0 as yt,B as E,g7 as G,iz as Ke,b1 as ce,aa as I,a7 as jt,iA as _t,iB as Nt,db as Ye,iC as Ft,iD as Mt,at as Xe,bV as Qe,ae as Pt,iE as Se,iF as $t,V as We,iG as te,dp as It,aj as At,hE as Vt,iH as Ze,iI as K,bC as Je,iJ as Et,iK as Dt,iL as zt,e as V,ds as H,iM as _e,iN as kt,iO as Tt,iP as bt,iQ as Lt,F as J,A as et,e5 as Ht,eQ as Ne,iR as Gt,df as Ot,C as Bt,iS as tt,b3 as qt,eX as Ut,e3 as Fe,dY as Me,dZ as Pe,d_ as $e,d$ as Ie,e0 as Ae,f as Kt,iT as ne,bv as Yt,X as Ce,t as nt,fj as Xt,g as st,iU as Qt,iV as Wt,dc as Zt,iW as Jt,dt as en,bl as ge,iX as tn,iY as nn,I as sn,iZ as on,bU as rn,d as an,a6 as ot,bT as ln,dv as un,ci as dn,g4 as cn,gf as gn,i_ as fn,l as Y,i$ as mn,j0 as pn,aQ as hn}from"./index-Dr-0P6rd.js";import{u as it}from"./use-pending-read-DmrlNHS0.js";import{u as rt}from"./use-mesh-topology-DBeqzUoy.js";import{S as xn,u as vn}from"./search-x-LIKnWE64.js";import{S as Sn}from"./scroll-area-XlDz8u4m.js";import{u as Cn,a as wn,O as Ve,b as Rn}from"./OpenMeshSwitch-DrmjsCDY.js";import{T as yn,d as jn,b as X,e as Ee,a as _n,c as De}from"./table-P4N5xQn2.js";import{P as Nn}from"./page-container-CPxW5T9E.js";import{r as Fn,C as Mn}from"./CommitmentList-DsEn6iK1.js";/**
|
|
3
|
-
* @license lucide-react v1.48.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const at={name:"scan-search",size:24,node:[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]};at.node;const Pn=Rt(at);/**
|
|
8
|
-
* table-core
|
|
9
|
-
*
|
|
10
|
-
* Copyright (c) TanStack
|
|
11
|
-
*
|
|
12
|
-
* This source code is licensed under the MIT license found in the
|
|
13
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
14
|
-
*
|
|
15
|
-
* @license MIT
|
|
16
|
-
*/function T(e,s){return typeof e=="function"?e(s):e}function P(e,s){return t=>{s.setState(n=>({...n,[e]:T(t,n[e])}))}}function ee(e){return e instanceof Function}function $n(e){return Array.isArray(e)&&e.every(s=>typeof s=="number")}function In(e,s){const t=[],n=o=>{o.forEach(i=>{t.push(i);const a=s(i);a!=null&&a.length&&n(a)})};return n(e),t}function S(e,s,t){let n=[],o;return i=>{let a;t.key&&t.debug&&(a=Date.now());const l=e(i);if(!(l.length!==n.length||l.some((g,h)=>n[h]!==g)))return o;n=l;let d;if(t.key&&t.debug&&(d=Date.now()),o=s(...l),t==null||t.onChange==null||t.onChange(o),t.key&&t.debug&&t!=null&&t.debug()){const g=Math.round((Date.now()-a)*100)/100,h=Math.round((Date.now()-d)*100)/100,f=h/16,c=(p,m)=>{for(p=String(p);p.length<m;)p=" "+p;return p};console.info(`%c⏱ ${c(h,5)} /${c(g,5)} ms`,`
|
|
17
|
-
font-size: .6rem;
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,t==null?void 0:t.key)}return o}}function C(e,s,t,n){return{debug:()=>{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[s]},key:!1,onChange:n}}function An(e,s,t,n){const o=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${s.id}_${t.id}`,row:s,column:t,getValue:()=>s.getValue(n),renderValue:o,getContext:S(()=>[e,t,s,i],(a,l,u,d)=>({table:a,column:l,row:u,cell:d,getValue:d.getValue,renderValue:d.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,s,e)},{}),i}function Vn(e,s,t,n){var o,i;const l={...e._getDefaultColumnDef(),...s},u=l.accessorKey;let d=(o=(i=l.id)!=null?i:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?o:typeof l.header=="string"?l.header:void 0,g;if(l.accessorFn?g=l.accessorFn:u&&(u.includes(".")?g=f=>{let c=f;for(const m of u.split(".")){var p;c=(p=c)==null?void 0:p[m]}return c}:g=f=>f[l.accessorKey]),!d)throw new Error;let h={id:`${String(d)}`,accessorFn:g,parent:n,depth:t,columnDef:l,columns:[],getFlatColumns:S(()=>[!0],()=>{var f;return[h,...(f=h.columns)==null?void 0:f.flatMap(c=>c.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:S(()=>[e._getOrderColumnsFn()],f=>{var c;if((c=h.columns)!=null&&c.length){let p=h.columns.flatMap(m=>m.getLeafColumns());return f(p)}return[h]},C(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(h,e);return h}const M="debugHeaders";function ze(e,s,t){var n;let i={id:(n=t.id)!=null?n:s.id,column:s,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],l=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(l),a.push(u)};return l(i),a},getContext:()=>({table:e,header:i,column:s})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const En={createTable:e=>{e.getHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n,o)=>{var i,a;const l=(i=n==null?void 0:n.map(h=>t.find(f=>f.id===h)).filter(Boolean))!=null?i:[],u=(a=o==null?void 0:o.map(h=>t.find(f=>f.id===h)).filter(Boolean))!=null?a:[],d=t.filter(h=>!(n!=null&&n.includes(h.id))&&!(o!=null&&o.includes(h.id)));return Q(s,[...l,...d,...u],e)},C(e.options,M)),e.getCenterHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n,o)=>(t=t.filter(i=>!(n!=null&&n.includes(i.id))&&!(o!=null&&o.includes(i.id))),Q(s,t,e,"center")),C(e.options,M)),e.getLeftHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(s,t,n)=>{var o;const i=(o=n==null?void 0:n.map(a=>t.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Q(s,i,e,"left")},C(e.options,M)),e.getRightHeaderGroups=S(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(s,t,n)=>{var o;const i=(o=n==null?void 0:n.map(a=>t.find(l=>l.id===a)).filter(Boolean))!=null?o:[];return Q(s,i,e,"right")},C(e.options,M)),e.getFooterGroups=S(()=>[e.getHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getLeftFooterGroups=S(()=>[e.getLeftHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getCenterFooterGroups=S(()=>[e.getCenterHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getRightFooterGroups=S(()=>[e.getRightHeaderGroups()],s=>[...s].reverse(),C(e.options,M)),e.getFlatHeaders=S(()=>[e.getHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getLeftFlatHeaders=S(()=>[e.getLeftHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getCenterFlatHeaders=S(()=>[e.getCenterHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getRightFlatHeaders=S(()=>[e.getRightHeaderGroups()],s=>s.map(t=>t.headers).flat(),C(e.options,M)),e.getCenterLeafHeaders=S(()=>[e.getCenterFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getLeftLeafHeaders=S(()=>[e.getLeftFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getRightLeafHeaders=S(()=>[e.getRightFlatHeaders()],s=>s.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,M)),e.getLeafHeaders=S(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(s,t,n)=>{var o,i,a,l,u,d;return[...(o=(i=s[0])==null?void 0:i.headers)!=null?o:[],...(a=(l=t[0])==null?void 0:l.headers)!=null?a:[],...(u=(d=n[0])==null?void 0:d.headers)!=null?u:[]].map(g=>g.getLeafHeaders()).flat()},C(e.options,M))}};function Q(e,s,t,n){var o,i;let a=0;const l=function(f,c){c===void 0&&(c=1),a=Math.max(a,c),f.filter(p=>p.getIsVisible()).forEach(p=>{var m;(m=p.columns)!=null&&m.length&&l(p.columns,c+1)},0)};l(e);let u=[];const d=(f,c)=>{const p={depth:c,id:[n,`${c}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(v=>{const x=[...m].reverse()[0],R=v.column.depth===p.depth;let j,y=!1;if(R&&v.column.parent?j=v.column.parent:(j=v.column,y=!0),x&&(x==null?void 0:x.column)===j)x.subHeaders.push(v);else{const _=ze(t,j,{id:[n,c,j.id,v==null?void 0:v.id].filter(Boolean).join("_"),isPlaceholder:y,placeholderId:y?`${m.filter(A=>A.column===j).length}`:void 0,depth:c,index:m.length});_.subHeaders.push(v),m.push(_)}p.headers.push(v),v.headerGroup=p}),u.push(p),c>0&&d(m,c-1)},g=s.map((f,c)=>ze(t,f,{depth:a,index:c}));d(g,a-1),u.reverse();const h=f=>f.filter(p=>p.column.getIsVisible()).map(p=>{let m=0,v=0,x=[0];p.subHeaders&&p.subHeaders.length?(x=[],h(p.subHeaders).forEach(j=>{let{colSpan:y,rowSpan:_}=j;m+=y,x.push(_)})):m=1;const R=Math.min(...x);return v=v+R,p.colSpan=m,p.rowSpan=v,{colSpan:m,rowSpan:v}});return h((o=(i=u[0])==null?void 0:i.headers)!=null?o:[]),u}const Dn=(e,s,t,n,o,i,a)=>{let l={id:s,index:n,original:t,depth:o,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(l._valuesCache.hasOwnProperty(u))return l._valuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return l._valuesCache[u]=d.accessorFn(l.original,n),l._valuesCache[u]},getUniqueValues:u=>{if(l._uniqueValuesCache.hasOwnProperty(u))return l._uniqueValuesCache[u];const d=e.getColumn(u);if(d!=null&&d.accessorFn)return d.columnDef.getUniqueValues?(l._uniqueValuesCache[u]=d.columnDef.getUniqueValues(l.original,n),l._uniqueValuesCache[u]):(l._uniqueValuesCache[u]=[l.getValue(u)],l._uniqueValuesCache[u])},renderValue:u=>{var d;return(d=l.getValue(u))!=null?d:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>In(l.subRows,u=>u.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let u=[],d=l;for(;;){const g=d.getParentRow();if(!g)break;u.push(g),d=g}return u.reverse()},getAllCells:S(()=>[e.getAllLeafColumns()],u=>u.map(d=>An(e,l,d,d.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:S(()=>[l.getAllCells()],u=>u.reduce((d,g)=>(d[g.column.id]=g,d),{}),C(e.options,"debugRows"))};for(let u=0;u<e._features.length;u++){const d=e._features[u];d==null||d.createRow==null||d.createRow(l,e)}return l},zn={createColumn:(e,s)=>{e._getFacetedRowModel=s.options.getFacetedRowModel&&s.options.getFacetedRowModel(s,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():s.getPreFilteredRowModel(),e._getFacetedUniqueValues=s.options.getFacetedUniqueValues&&s.options.getFacetedUniqueValues(s,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=s.options.getFacetedMinMaxValues&&s.options.getFacetedMinMaxValues(s,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},lt=(e,s,t)=>{var n,o;const i=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((o=e.getValue(s))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};lt.autoRemove=e=>D(e);const ut=(e,s,t)=>{var n;return!!(!((n=e.getValue(s))==null||(n=n.toString())==null)&&n.includes(t))};ut.autoRemove=e=>D(e);const dt=(e,s,t)=>{var n;return((n=e.getValue(s))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};dt.autoRemove=e=>D(e);const ct=(e,s,t)=>{var n;return(n=e.getValue(s))==null?void 0:n.includes(t)};ct.autoRemove=e=>D(e);const gt=(e,s,t)=>!t.some(n=>{var o;return!((o=e.getValue(s))!=null&&o.includes(n))});gt.autoRemove=e=>D(e)||!(e!=null&&e.length);const ft=(e,s,t)=>t.some(n=>{var o;return(o=e.getValue(s))==null?void 0:o.includes(n)});ft.autoRemove=e=>D(e)||!(e!=null&&e.length);const mt=(e,s,t)=>e.getValue(s)===t;mt.autoRemove=e=>D(e);const pt=(e,s,t)=>e.getValue(s)==t;pt.autoRemove=e=>D(e);const we=(e,s,t)=>{let[n,o]=t;const i=e.getValue(s);return i>=n&&i<=o};we.resolveFilterValue=e=>{let[s,t]=e,n=typeof s!="number"?parseFloat(s):s,o=typeof t!="number"?parseFloat(t):t,i=s===null||Number.isNaN(n)?-1/0:n,a=t===null||Number.isNaN(o)?1/0:o;if(i>a){const l=i;i=a,a=l}return[i,a]};we.autoRemove=e=>D(e)||D(e[0])&&D(e[1]);const z={includesString:lt,includesStringSensitive:ut,equalsString:dt,arrIncludes:ct,arrIncludesAll:gt,arrIncludesSome:ft,equals:mt,weakEquals:pt,inNumberRange:we};function D(e){return e==null||e===""}const kn={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:P("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,s)=>{e.getAutoFilterFn=()=>{const t=s.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?z.includesString:typeof n=="number"?z.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?z.equals:Array.isArray(n)?z.arrIncludes:z.weakEquals},e.getFilterFn=()=>{var t,n;return ee(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=s.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:z[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,o;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=s.options.enableColumnFilters)!=null?n:!0)&&((o=s.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=s.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=s.getState().columnFilters)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?t:-1},e.setFilterValue=t=>{s.setColumnFilters(n=>{const o=e.getFilterFn(),i=n==null?void 0:n.find(g=>g.id===e.id),a=T(t,i?i.value:void 0);if(ke(o,a,e)){var l;return(l=n==null?void 0:n.filter(g=>g.id!==e.id))!=null?l:[]}const u={id:e.id,value:a};if(i){var d;return(d=n==null?void 0:n.map(g=>g.id===e.id?u:g))!=null?d:[]}return n!=null&&n.length?[...n,u]:[u]})}},createRow:(e,s)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=s=>{const t=e.getAllLeafColumns(),n=o=>{var i;return(i=T(s,o))==null?void 0:i.filter(a=>{const l=t.find(u=>u.id===a.id);if(l){const u=l.getFilterFn();if(ke(u,a.value,l))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=s=>{var t,n;e.setColumnFilters(s?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function ke(e,s,t){return(e&&e.autoRemove?e.autoRemove(s,t):!1)||typeof s>"u"||typeof s=="string"&&!s}const Tn=(e,s,t)=>t.reduce((n,o)=>{const i=o.getValue(e);return n+(typeof i=="number"?i:0)},0),bn=(e,s,t)=>{let n;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}),n},Ln=(e,s,t)=>{let n;return t.forEach(o=>{const i=o.getValue(e);i!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}),n},Hn=(e,s,t)=>{let n,o;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(n===void 0?a>=a&&(n=o=a):(n>a&&(n=a),o<a&&(o=a)))}),[n,o]},Gn=(e,s)=>{let t=0,n=0;if(s.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++t,n+=i)}),t)return n/t},On=(e,s)=>{if(!s.length)return;const t=s.map(i=>i.getValue(e));if(!$n(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),o=t.sort((i,a)=>i-a);return t.length%2!==0?o[n]:(o[n-1]+o[n])/2},Bn=(e,s)=>Array.from(new Set(s.map(t=>t.getValue(e))).values()),qn=(e,s)=>new Set(s.map(t=>t.getValue(e))).size,Un=(e,s)=>s.length,se={sum:Tn,min:bn,max:Ln,extent:Hn,mean:Gn,median:On,unique:Bn,uniqueCount:qn,count:Un},Kn={getDefaultColumnDef:()=>({aggregatedCell:e=>{var s,t;return(s=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?s:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:P("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,s)=>{e.toggleGrouping=()=>{s.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=s.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=s.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=s.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=s.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return se.sum;if(Object.prototype.toString.call(n)==="[object Date]")return se.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return ee(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=s.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:se[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=s=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(s),e.resetGrouping=s=>{var t,n;e.setGrouping(s?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,s)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=s.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,s,t,n)=>{e.getIsGrouped=()=>s.getIsGrouped()&&s.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&s.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=t.subRows)!=null&&o.length)}}};function Yn(e,s,t){if(!(s!=null&&s.length)||!t)return e;const n=e.filter(i=>!s.includes(i.id));return t==="remove"?n:[...s.map(i=>e.find(a=>a.id===i)).filter(Boolean),...n]}const Xn={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:P("columnOrder",e)}),createColumn:(e,s)=>{e.getIndex=S(t=>[U(s,t)],t=>t.findIndex(n=>n.id===e.id),C(s.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=U(s,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const o=U(s,t);return((n=o[o.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=s=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(s),e.resetColumnOrder=s=>{var t;e.setColumnOrder(s?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=S(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(s,t,n)=>o=>{let i=[];if(!(s!=null&&s.length))i=o;else{const a=[...s],l=[...o];for(;l.length&&a.length;){const u=a.shift(),d=l.findIndex(g=>g.id===u);d>-1&&i.push(l.splice(d,1)[0])}i=[...i,...l]}return Yn(i,t,n)},C(e.options,"debugTable"))}},oe=()=>({left:[],right:[]}),Qn={getInitialState:e=>({columnPinning:oe(),...e}),getDefaultOptions:e=>({onColumnPinningChange:P("columnPinning",e)}),createColumn:(e,s)=>{e.pin=t=>{const n=e.getLeafColumns().map(o=>o.id).filter(Boolean);s.setColumnPinning(o=>{var i,a;if(t==="right"){var l,u;return{left:((l=o==null?void 0:o.left)!=null?l:[]).filter(h=>!(n!=null&&n.includes(h))),right:[...((u=o==null?void 0:o.right)!=null?u:[]).filter(h=>!(n!=null&&n.includes(h))),...n]}}if(t==="left"){var d,g;return{left:[...((d=o==null?void 0:o.left)!=null?d:[]).filter(h=>!(n!=null&&n.includes(h))),...n],right:((g=o==null?void 0:o.right)!=null?g:[]).filter(h=>!(n!=null&&n.includes(h)))}}return{left:((i=o==null?void 0:o.left)!=null?i:[]).filter(h=>!(n!=null&&n.includes(h))),right:((a=o==null?void 0:o.right)!=null?a:[]).filter(h=>!(n!=null&&n.includes(h)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var o,i,a;return((o=n.columnDef.enablePinning)!=null?o:!0)&&((i=(a=s.options.enableColumnPinning)!=null?a:s.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(l=>l.id),{left:n,right:o}=s.getState().columnPinning,i=t.some(l=>n==null?void 0:n.includes(l)),a=t.some(l=>o==null?void 0:o.includes(l));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,n;const o=e.getIsPinned();return o?(t=(n=s.getState().columnPinning)==null||(n=n[o])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,s)=>{e.getCenterVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.left,s.getState().columnPinning.right],(t,n,o)=>{const i=[...n??[],...o??[]];return t.filter(a=>!i.includes(a.column.id))},C(s.options,"debugRows")),e.getLeftVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.left],(t,n)=>(n??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),C(s.options,"debugRows")),e.getRightVisibleCells=S(()=>[e._getAllVisibleCells(),s.getState().columnPinning.right],(t,n)=>(n??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),C(s.options,"debugRows"))},createTable:e=>{e.setColumnPinning=s=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(s),e.resetColumnPinning=s=>{var t,n;return e.setColumnPinning(s?oe():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:oe())},e.getIsSomeColumnsPinned=s=>{var t;const n=e.getState().columnPinning;if(!s){var o,i;return!!((o=n.left)!=null&&o.length||(i=n.right)!=null&&i.length)}return!!((t=n[s])!=null&&t.length)},e.getLeftLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(s,t)=>(t??[]).map(n=>s.find(o=>o.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(s,t)=>(t??[]).map(n=>s.find(o=>o.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=S(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(s,t,n)=>{const o=[...t??[],...n??[]];return s.filter(i=>!o.includes(i.id))},C(e.options,"debugColumns"))}};function Wn(e){return e||(typeof document<"u"?document:null)}const W={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ie=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Zn={getDefaultColumnDef:()=>W,getInitialState:e=>({columnSizing:{},columnSizingInfo:ie(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:P("columnSizing",e),onColumnSizingInfoChange:P("columnSizingInfo",e)}),createColumn:(e,s)=>{e.getSize=()=>{var t,n,o;const i=s.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:W.minSize,(n=i??e.columnDef.size)!=null?n:W.size),(o=e.columnDef.maxSize)!=null?o:W.maxSize)},e.getStart=S(t=>[t,U(s,t),s.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((o,i)=>o+i.getSize(),0),C(s.options,"debugColumns")),e.getAfter=S(t=>[t,U(s,t),s.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((o,i)=>o+i.getSize(),0),C(s.options,"debugColumns")),e.resetSize=()=>{s.setColumnSizing(t=>{let{[e.id]:n,...o}=t;return o})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=s.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>s.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,s)=>{e.getSize=()=>{let t=0;const n=o=>{if(o.subHeaders.length)o.subHeaders.forEach(n);else{var i;t+=(i=o.column.getSize())!=null?i:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=s.getColumn(e.column.id),o=n==null?void 0:n.getCanResize();return i=>{if(!n||!o||(i.persist==null||i.persist(),re(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),l=e?e.getLeafHeaders().map(x=>[x.column.id,x.column.getSize()]):[[n.id,n.getSize()]],u=re(i)?Math.round(i.touches[0].clientX):i.clientX,d={},g=(x,R)=>{typeof R=="number"&&(s.setColumnSizingInfo(j=>{var y,_;const A=s.options.columnResizeDirection==="rtl"?-1:1,O=(R-((y=j==null?void 0:j.startOffset)!=null?y:0))*A,N=Math.max(O/((_=j==null?void 0:j.startSize)!=null?_:0),-.999999);return j.columnSizingStart.forEach(F=>{let[L,je]=F;d[L]=Math.round(Math.max(je+je*N,0)*100)/100}),{...j,deltaOffset:O,deltaPercentage:N}}),(s.options.columnResizeMode==="onChange"||x==="end")&&s.setColumnSizing(j=>({...j,...d})))},h=x=>g("move",x),f=x=>{g("end",x),s.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},c=Wn(t),p={moveHandler:x=>h(x.clientX),upHandler:x=>{c==null||c.removeEventListener("mousemove",p.moveHandler),c==null||c.removeEventListener("mouseup",p.upHandler),f(x.clientX)}},m={moveHandler:x=>(x.cancelable&&(x.preventDefault(),x.stopPropagation()),h(x.touches[0].clientX),!1),upHandler:x=>{var R;c==null||c.removeEventListener("touchmove",m.moveHandler),c==null||c.removeEventListener("touchend",m.upHandler),x.cancelable&&(x.preventDefault(),x.stopPropagation()),f((R=x.touches[0])==null?void 0:R.clientX)}},v=Jn()?{passive:!1}:!1;re(i)?(c==null||c.addEventListener("touchmove",m.moveHandler,v),c==null||c.addEventListener("touchend",m.upHandler,v)):(c==null||c.addEventListener("mousemove",p.moveHandler,v),c==null||c.addEventListener("mouseup",p.upHandler,v)),s.setColumnSizingInfo(x=>({...x,startOffset:u,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=s=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(s),e.setColumnSizingInfo=s=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(s),e.resetColumnSizing=s=>{var t;e.setColumnSizing(s?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=s=>{var t;e.setColumnSizingInfo(s?ie():(t=e.initialState.columnSizingInfo)!=null?t:ie())},e.getTotalSize=()=>{var s,t;return(s=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getLeftTotalSize=()=>{var s,t;return(s=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getCenterTotalSize=()=>{var s,t;return(s=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0},e.getRightTotalSize=()=>{var s,t;return(s=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,o)=>n+o.getSize(),0))!=null?s:0}}};let Z=null;function Jn(){if(typeof Z=="boolean")return Z;let e=!1;try{const s={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,s),window.removeEventListener("test",t)}catch{e=!1}return Z=e,Z}function re(e){return e.type==="touchstart"}const es={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:P("columnVisibility",e)}),createColumn:(e,s)=>{e.toggleVisibility=t=>{e.getCanHide()&&s.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const o=e.columns;return(t=o.length?o.some(i=>i.getIsVisible()):(n=s.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=s.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,s)=>{e._getAllVisibleCells=S(()=>[e.getAllCells(),s.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(s.options,"debugRows")),e.getVisibleCells=S(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,o)=>[...t,...n,...o],C(s.options,"debugRows"))},createTable:e=>{const s=(t,n)=>S(()=>[n(),n().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),C(e.options,"debugColumns"));e.getVisibleFlatColumns=s("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=s("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=s("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=s("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=s("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function U(e,s){return s?s==="center"?e.getCenterVisibleLeafColumns():s==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const ts={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},ns={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:P("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:s=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[s.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,s)=>{e.getCanGlobalFilter=()=>{var t,n,o,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=s.options.enableGlobalFilter)!=null?n:!0)&&((o=s.options.enableFilters)!=null?o:!0)&&((i=s.options.getColumnCanGlobalFilter==null?void 0:s.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>z.includesString,e.getGlobalFilterFn=()=>{var s,t;const{globalFilterFn:n}=e.options;return ee(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(s=(t=e.options.filterFns)==null?void 0:t[n])!=null?s:z[n]},e.setGlobalFilter=s=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(s)},e.resetGlobalFilter=s=>{e.setGlobalFilter(s?void 0:e.initialState.globalFilter)}}},ss={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:P("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let s=!1,t=!1;e._autoResetExpanded=()=>{var n,o;if(!s){e._queue(()=>{s=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var o,i;e.setExpanded(n?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");n=Math.max(n,a.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,s)=>{e.toggleExpanded=t=>{s.setExpanded(n=>{var o;const i=n===!0?!0:!!(n!=null&&n[e.id]);let a={};if(n===!0?Object.keys(s.getRowModel().rowsById).forEach(l=>{a[l]=!0}):a=n,t=(o=t)!=null?o:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:l,...u}=a;return u}return n})},e.getIsExpanded=()=>{var t;const n=s.getState().expanded;return!!((t=s.options.getIsRowExpanded==null?void 0:s.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,o;return(t=s.options.getRowCanExpand==null?void 0:s.options.getRowCanExpand(e))!=null?t:((n=s.options.enableExpanding)!=null?n:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=s.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},fe=0,me=10,ae=()=>({pageIndex:fe,pageSize:me}),os={getInitialState:e=>({...e,pagination:{...ae(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:P("pagination",e)}),createTable:e=>{let s=!1,t=!1;e._autoResetPageIndex=()=>{var n,o;if(!s){e._queue(()=>{s=!0});return}if((n=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const o=i=>T(n,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=n=>{var o;e.setPagination(n?ae():(o=e.initialState.pagination)!=null?o:ae())},e.setPageIndex=n=>{e.setPagination(o=>{let i=T(n,o.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...o,pageIndex:i}})},e.resetPageIndex=n=>{var o,i;e.setPageIndex(n?fe:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:fe)},e.resetPageSize=n=>{var o,i;e.setPageSize(n?me:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:me)},e.setPageSize=n=>{e.setPagination(o=>{const i=Math.max(1,T(n,o.pageSize)),a=o.pageSize*o.pageIndex,l=Math.floor(a/i);return{...o,pageIndex:l,pageSize:i}})},e.setPageCount=n=>e.setPagination(o=>{var i;let a=T(n,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...o,pageCount:a}}),e.getPageOptions=S(()=>[e.getPageCount()],n=>{let o=[];return n&&n>0&&(o=[...new Array(n)].fill(null).map((i,a)=>a)),o},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:n<o-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},le=()=>({top:[],bottom:[]}),is={getInitialState:e=>({rowPinning:le(),...e}),getDefaultOptions:e=>({onRowPinningChange:P("rowPinning",e)}),createRow:(e,s)=>{e.pin=(t,n,o)=>{const i=n?e.getLeafRows().map(u=>{let{id:d}=u;return d}):[],a=o?e.getParentRows().map(u=>{let{id:d}=u;return d}):[],l=new Set([...a,e.id,...i]);s.setRowPinning(u=>{var d,g;if(t==="bottom"){var h,f;return{top:((h=u==null?void 0:u.top)!=null?h:[]).filter(m=>!(l!=null&&l.has(m))),bottom:[...((f=u==null?void 0:u.bottom)!=null?f:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)]}}if(t==="top"){var c,p;return{top:[...((c=u==null?void 0:u.top)!=null?c:[]).filter(m=>!(l!=null&&l.has(m))),...Array.from(l)],bottom:((p=u==null?void 0:u.bottom)!=null?p:[]).filter(m=>!(l!=null&&l.has(m)))}}return{top:((d=u==null?void 0:u.top)!=null?d:[]).filter(m=>!(l!=null&&l.has(m))),bottom:((g=u==null?void 0:u.bottom)!=null?g:[]).filter(m=>!(l!=null&&l.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:o}=s.options;return typeof n=="function"?n(e):(t=n??o)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:o}=s.getState().rowPinning,i=t.some(l=>n==null?void 0:n.includes(l)),a=t.some(l=>o==null?void 0:o.includes(l));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const o=e.getIsPinned();if(!o)return-1;const i=(t=o==="top"?s.getTopRows():s.getBottomRows())==null?void 0:t.map(a=>{let{id:l}=a;return l});return(n=i==null?void 0:i.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=s=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(s),e.resetRowPinning=s=>{var t,n;return e.setRowPinning(s?le():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:le())},e.getIsSomeRowsPinned=s=>{var t;const n=e.getState().rowPinning;if(!s){var o,i;return!!((o=n.top)!=null&&o.length||(i=n.bottom)!=null&&i.length)}return!!((t=n[s])!=null&&t.length)},e._getPinnedRows=(s,t,n)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(t??[]).map(a=>{const l=e.getRow(a,!0);return l.getIsAllParentsExpanded()?l:null}):(t??[]).map(a=>s.find(l=>l.id===a))).filter(Boolean).map(a=>({...a,position:n}))},e.getTopRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(s,t)=>e._getPinnedRows(s,t,"top"),C(e.options,"debugRows")),e.getBottomRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(s,t)=>e._getPinnedRows(s,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=S(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(s,t,n)=>{const o=new Set([...t??[],...n??[]]);return s.filter(i=>!o.has(i.id))},C(e.options,"debugRows"))}},rs={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:P("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=s=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(s),e.resetRowSelection=s=>{var t;return e.setRowSelection(s?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=s=>{e.setRowSelection(t=>{s=typeof s<"u"?s:!e.getIsAllRowsSelected();const n={...t},o=e.getPreGroupedRowModel().flatRows;return s?o.forEach(i=>{i.getCanSelect()&&(n[i.id]=!0)}):o.forEach(i=>{delete n[i.id]}),n})},e.toggleAllPageRowsSelected=s=>e.setRowSelection(t=>{const n=typeof s<"u"?s:!e.getIsAllPageRowsSelected(),o={...t};return e.getRowModel().rows.forEach(i=>{pe(o,i.id,n,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=S(()=>[e.getState().rowSelection,e.getCoreRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=S(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=S(()=>[e.getState().rowSelection,e.getSortedRowModel()],(s,t)=>Object.keys(s).length?ue(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const s=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(s.length&&Object.keys(t).length);return n&&s.some(o=>o.getCanSelect()&&!t[o.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const s=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:t}=e.getState();let n=!!s.length;return n&&s.some(o=>!t[o.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var s;const t=Object.keys((s=e.getState().rowSelection)!=null?s:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const s=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:s.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>s=>{e.toggleAllRowsSelected(s.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>s=>{e.toggleAllPageRowsSelected(s.target.checked)}},createRow:(e,s)=>{e.toggleSelected=(t,n)=>{const o=e.getIsSelected();s.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!o,e.getCanSelect()&&o===t)return i;const l={...i};return pe(l,e.id,t,(a=n==null?void 0:n.selectChildren)!=null?a:!0,s),l})},e.getIsSelected=()=>{const{rowSelection:t}=s.getState();return Re(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=s.getState();return he(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=s.getState();return he(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof s.options.enableRowSelection=="function"?s.options.enableRowSelection(e):(t=s.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof s.options.enableSubRowSelection=="function"?s.options.enableSubRowSelection(e):(t=s.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof s.options.enableMultiRowSelection=="function"?s.options.enableMultiRowSelection(e):(t=s.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var o;t&&e.toggleSelected((o=n.target)==null?void 0:o.checked)}}}},pe=(e,s,t,n,o)=>{var i;const a=o.getRow(s,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(l=>delete e[l]),a.getCanSelect()&&(e[s]=!0)):delete e[s],n&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(l=>pe(e,l.id,t,n,o))};function ue(e,s){const t=e.getState().rowSelection,n=[],o={},i=function(a,l){return a.map(u=>{var d;const g=Re(u,t);if(g&&(n.push(u),o[u.id]=u),(d=u.subRows)!=null&&d.length&&(u={...u,subRows:i(u.subRows)}),g)return u}).filter(Boolean)};return{rows:i(s.rows),flatRows:n,rowsById:o}}function Re(e,s){var t;return(t=s[e.id])!=null?t:!1}function he(e,s,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let o=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!o)&&(a.getCanSelect()&&(Re(a,s)?i=!0:o=!1),a.subRows&&a.subRows.length)){const l=he(a,s);l==="all"?i=!0:(l==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const xe=/([0-9]+)/gm,as=(e,s,t)=>ht(b(e.getValue(t)).toLowerCase(),b(s.getValue(t)).toLowerCase()),ls=(e,s,t)=>ht(b(e.getValue(t)),b(s.getValue(t))),us=(e,s,t)=>ye(b(e.getValue(t)).toLowerCase(),b(s.getValue(t)).toLowerCase()),ds=(e,s,t)=>ye(b(e.getValue(t)),b(s.getValue(t))),cs=(e,s,t)=>{const n=e.getValue(t),o=s.getValue(t);return n>o?1:n<o?-1:0},gs=(e,s,t)=>ye(e.getValue(t),s.getValue(t));function ye(e,s){return e===s?0:e>s?1:-1}function b(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function ht(e,s){const t=e.split(xe).filter(Boolean),n=s.split(xe).filter(Boolean);for(;t.length&&n.length;){const o=t.shift(),i=n.shift(),a=parseInt(o,10),l=parseInt(i,10),u=[a,l].sort();if(isNaN(u[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(u[1]))return isNaN(a)?-1:1;if(a>l)return 1;if(l>a)return-1}return t.length-n.length}const B={alphanumeric:as,alphanumericCaseSensitive:ls,text:us,textCaseSensitive:ds,datetime:cs,basic:gs},fs={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:P("sorting",e),isMultiSortEvent:s=>s.shiftKey}),createColumn:(e,s)=>{e.getAutoSortingFn=()=>{const t=s.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const o of t){const i=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return B.datetime;if(typeof i=="string"&&(n=!0,i.split(xe).length>1))return B.alphanumeric}return n?B.text:B.basic},e.getAutoSortDir=()=>{const t=s.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return ee(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=s.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:B[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const o=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;s.setSorting(a=>{const l=a==null?void 0:a.find(c=>c.id===e.id),u=a==null?void 0:a.findIndex(c=>c.id===e.id);let d=[],g,h=i?t:o==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&n?l?g="toggle":g="add":a!=null&&a.length&&u!==a.length-1?g="replace":l?g="toggle":g="replace",g==="toggle"&&(i||o||(g="remove")),g==="add"){var f;d=[...a,{id:e.id,desc:h}],d.splice(0,d.length-((f=s.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else g==="toggle"?d=a.map(c=>c.id===e.id?{...c,desc:h}:c):g==="remove"?d=a.filter(c=>c.id!==e.id):d=[{id:e.id,desc:h}];return d})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:s.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,o;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((n=s.options.enableSortingRemoval)==null||n)&&(!(t&&(o=s.options.enableMultiRemove)!=null)||o)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=s.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:s.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=s.getState().sorting)==null?void 0:t.find(o=>o.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=s.getState().sorting)==null?void 0:n.findIndex(o=>o.id===e.id))!=null?t:-1},e.clearSorting=()=>{s.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?s.options.isMultiSortEvent==null?void 0:s.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=s=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(s),e.resetSorting=s=>{var t,n;e.setSorting(s?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},ms=[En,es,Xn,Qn,zn,kn,ts,ns,fs,Kn,ss,os,is,rs,Zn];function ps(e){var s,t;const n=[...ms,...(s=e._features)!=null?s:[]];let o={_features:n};const i=o._features.reduce((f,c)=>Object.assign(f,c.getDefaultOptions==null?void 0:c.getDefaultOptions(o)),{}),a=f=>o.options.mergeOptions?o.options.mergeOptions(i,f):{...i,...f};let u={...{},...(t=e.initialState)!=null?t:{}};o._features.forEach(f=>{var c;u=(c=f.getInitialState==null?void 0:f.getInitialState(u))!=null?c:u});const d=[];let g=!1;const h={_features:n,options:{...i,...e},initialState:u,_queue:f=>{d.push(f),g||(g=!0,Promise.resolve().then(()=>{for(;d.length;)d.shift()();g=!1}).catch(c=>setTimeout(()=>{throw c})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const c=T(f,o.options);o.options=a(c)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,c,p)=>{var m;return(m=o.options.getRowId==null?void 0:o.options.getRowId(f,c,p))!=null?m:`${p?[p.id,c].join("."):c}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,c)=>{let p=(c?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!p&&(p=o.getCoreRowModel().rowsById[f],!p))throw new Error;return p},_getDefaultColumnDef:S(()=>[o.options.defaultColumn],f=>{var c;return f=(c=f)!=null?c:{},{header:p=>{const m=p.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:p=>{var m,v;return(m=(v=p.renderValue())==null||v.toString==null?void 0:v.toString())!=null?m:null},...o._features.reduce((p,m)=>Object.assign(p,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},C(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:S(()=>[o._getColumnDefs()],f=>{const c=function(p,m,v){return v===void 0&&(v=0),p.map(x=>{const R=Vn(o,x,v,m),j=x;return R.columns=j.columns?c(j.columns,R,v+1):[],R})};return c(f)},C(e,"debugColumns")),getAllFlatColumns:S(()=>[o.getAllColumns()],f=>f.flatMap(c=>c.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:S(()=>[o.getAllFlatColumns()],f=>f.reduce((c,p)=>(c[p.id]=p,c),{}),C(e,"debugColumns")),getAllLeafColumns:S(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,c)=>{let p=f.flatMap(m=>m.getLeafColumns());return c(p)},C(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,h);for(let f=0;f<o._features.length;f++){const c=o._features[f];c==null||c.createTable==null||c.createTable(o)}return o}function hs(){return e=>S(()=>[e.options.data],s=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(o,i,a){i===void 0&&(i=0);const l=[];for(let d=0;d<o.length;d++){const g=Dn(e,e._getRowId(o[d],d,a),o[d],d,i,void 0,a==null?void 0:a.id);if(t.flatRows.push(g),t.rowsById[g.id]=g,l.push(g),e.options.getSubRows){var u;g.originalSubRows=e.options.getSubRows(o[d],d),(u=g.originalSubRows)!=null&&u.length&&(g.subRows=n(g.originalSubRows,i+1,g))}}return l};return t.rows=n(s),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}/**
|
|
20
|
-
* react-table
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) TanStack
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
26
|
-
*
|
|
27
|
-
* @license MIT
|
|
28
|
-
*/function Te(e,s){return e?xs(e)?w.createElement(e,s):e:null}function xs(e){return vs(e)||typeof e=="function"||Ss(e)}function vs(e){return typeof e=="function"&&(()=>{const s=Object.getPrototypeOf(e);return s.prototype&&s.prototype.isReactComponent})()}function Ss(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Cs(e){const s={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=w.useState(()=>({current:ps(s)})),[n,o]=w.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...n,...e.state},onStateChange:a=>{o(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}function ws(e){if("id"in e&&e.id)return e.id;if("accessorKey"in e&&typeof e.accessorKey=="string")return e.accessorKey}function Rs({columns:e,data:s,emptyMessage:t="No results.",tableOptions:n,groupBy:o,className:i,tableClassName:a}){var p;const l=Ue(),u=w.useMemo(()=>{var v;if(!l)return{};const m={};for(const x of e){const R=ws(x);R&&((v=x.meta)!=null&&v.hideOnMobile)&&(m[R]=!1)}return m},[e,l]),d=w.useMemo(()=>{var m;return{...u,...((m=n==null?void 0:n.state)==null?void 0:m.columnVisibility)??{}}},[u,(p=n==null?void 0:n.state)==null?void 0:p.columnVisibility]),g=Cs({data:s,columns:e,getCoreRowModel:hs(),...n,state:{...n==null?void 0:n.state,columnVisibility:d}}),h=g.getRowModel().rows,f=g.getVisibleLeafColumns().length,c=w.useMemo(()=>{if(!o)return new Map;const m=new Map;for(const v of h){const x=o.key(v.original);m.set(x,(m.get(x)??0)+1)}return m},[o,h]);return r.jsx("div",{"data-slot":"data-table",className:k("rounded-md border",i),children:r.jsxs(yn,{className:a,children:[r.jsx(jn,{children:g.getHeaderGroups().map(m=>r.jsx(X,{children:m.headers.map(v=>{var x;return r.jsx(Ee,{className:(x=v.column.columnDef.meta)==null?void 0:x.headClassName,children:v.isPlaceholder?null:Te(v.column.columnDef.header,v.getContext())},v.id)})},m.id))}),r.jsx(_n,{children:h.length?h.map((m,v)=>{const x=o==null?void 0:o.key(m.original),R=v>0?o==null?void 0:o.key(h[v-1].original):void 0,j=x!==void 0&&x!==R;return r.jsxs(w.Fragment,{children:[j&&r.jsx(X,{"data-slot":"data-table-group-header",className:"bg-muted/40 hover:bg-muted/40",children:r.jsx(Ee,{colSpan:f,className:"h-8",children:o==null?void 0:o.header(x,c.get(x)??0)})}),r.jsx(X,{"data-state":m.getIsSelected()?"selected":void 0,children:m.getVisibleCells().map(y=>{var _;return r.jsx(De,{className:(_=y.column.columnDef.meta)==null?void 0:_.cellClassName,children:Te(y.column.columnDef.cell,y.getContext())},y.id)})})]},m.id)}):r.jsx(X,{children:r.jsx(De,{colSpan:f,className:"h-24 text-center",children:t})})})]})})}function ys({onClearFilters:e,filterDescription:s}){return r.jsxs($.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[r.jsx(xn,{className:"text-muted-foreground/50 size-10"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:s?`No agents match ${s}`:"No agents match your filters"}),r.jsx(E,{variant:"outline",size:"sm",onClick:e,children:"Clear filters"})]})}function js({peopleOnly:e}){return r.jsxs($.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-2 py-12 text-center","data-slot":"agent-roster-filter-empty",children:[r.jsx(yt,{className:"text-muted-foreground/50 size-10"}),r.jsx("p",{className:"text-muted-foreground max-w-xs text-sm",children:e?"This table lists agents. Switch to Cards to see people.":"No agents match this filter. Change it in Cards."})]})}const be=["needs-you","working","quiet"],_s=1440*60*1e3;function Ns(e,s=Date.now()){const t=Date.parse(e);return Number.isNaN(t)?!0:s-t>=_s}const Fs=30,Ms=25,Ps=20,$s=20,Is=10,As=0;function ve(e){const{healthStatus:s,taskCount:t,chatState:n}=e;return s==="unreachable"?{group:"needs-you",severity:Fs}:n==="needs-attention"?{group:"needs-you",severity:Ms}:s==="stale"&&t>0&&e.isPastOnboardingGrace?{group:"needs-you",severity:Ps}:n==="active"?{group:"working",severity:$s}:s==="active"?{group:"working",severity:Is}:{group:"quiet",severity:As}}function Le(e){if(!e)return Number.NEGATIVE_INFINITY;const s=Date.parse(e);return Number.isNaN(s)?Number.NEGATIVE_INFINITY:s}function Vs(e,s){const t=ve(e),n=ve(s),o=be.indexOf(t.group)-be.indexOf(n.group);if(o!==0)return o;const i=n.severity-t.severity;if(i!==0)return i;const a=Le(s.lastSeenAt)-Le(e.lastSeenAt);return a!==0?a:G(e).localeCompare(G(s))}function Es(e,s="asc"){const t=s==="desc"?-1:1;return[...e].sort((n,o)=>t*Vs(n,o))}const Ds={"needs-you":{label:"Needs you",toneClass:"text-destructive"},working:{label:"Working",toneClass:"text-foreground"},quiet:{label:"Quiet",toneClass:"text-muted-foreground"}};function zs(e,s,t){if(!t)return e;if(t.kind==="people")return[];if(!(t.owner!==void 0||(t.q??"").trim()!==""))return e;const o=s.filter(a=>a.kind==="agent");if(o.length===0)return e;const i=new Set(Ke(o,t).map(a=>a.id));return e.filter(a=>i.has(a.id))}const He=32,ks=5,xt="Checked in",Ts={heartbeat:"Checked in",message_sent:"Got a message",response_complete:"Finished a reply"};function bs(e,s){return s===null&&e==="stale"}function Ge(e){return e.length<2||e.length>ks?!1:e===e.toUpperCase()&&new RegExp("\\p{Lu}","u").test(e)}function Ls(e){const s=Ts[e.trim().toLowerCase()];if(s)return s;const t=e.replace(/[^\p{L}\p{N}]+/gu," ").trim().split(" ").filter(Boolean).map(a=>Ge(a)?a:a.toLowerCase());if(t.length===0)return xt;const n=t[0];t[0]=Ge(n)?n:n.replace(/^./u,a=>a.toUpperCase());const o=t.join(" "),i=Array.from(o);return i.length<=He?o:`${i.slice(0,He-1).join("").trimEnd()}…`}function Oe(e){const s=e.filter(t=>!!t);return s.length>0?s.join(" · "):null}function Hs(e){const{healthStatus:s,lastSeenAt:t,lastSeenEvent:n,chatState:o}=e,i=t?ce(t):null,a=n?Ls(n):null;return s==="unreachable"?{primary:"Can’t be reached",secondary:Oe([a,i??"never seen"]),toneClass:"text-destructive"}:o==="needs-attention"?{primary:"A chat needs you",secondary:Oe([a,i]),toneClass:"text-destructive"}:bs(s,t)?o==="active"?{primary:"Active in a chat",secondary:null,toneClass:"text-foreground"}:{primary:"Not used yet",secondary:null,toneClass:"text-muted-foreground"}:{primary:a??xt,secondary:i,toneClass:s==="active"?"text-foreground":"text-muted-foreground"}}function Gs(e){if(!e)return null;const s=e.split("/").filter(Boolean);return s.length<=2?e:s.slice(-2).join("/")}function Os({row:e,onOpen:s}){const{color:t,emoji:n}=Nt(e),o=Gs(e.projectPath),i=Ye(e.runtime).label;return r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-2 text-left",onClick:s,children:[r.jsx(Ft,{color:t,emoji:n,size:"xs"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate text-sm font-medium hover:underline",children:G(e)}),r.jsxs("span",{className:"text-muted-foreground block truncate text-xs",children:[o??i,o&&r.jsxs("span",{className:"hidden md:inline",children:[" · ",i]})]})]}),e.isDefault&&r.jsxs(I,{size:"xs",variant:"outline",className:"shrink-0 max-md:border-0 max-md:px-0 max-md:py-0",children:[r.jsx(Mt,{className:"size-2.5 fill-current md:mr-0.5"}),r.jsx("span",{className:"sr-only md:not-sr-only",children:"Default"})]})]})}function Bs({row:e}){const{primary:s,secondary:t,toneClass:n}=Hs(e);return r.jsxs("span",{className:"block min-w-0",children:[r.jsx("span",{className:k("block truncate text-sm",n),children:s}),t&&r.jsx("span",{className:"text-muted-foreground block truncate text-xs tabular-nums",children:t})]})}function qs(e){return[{accessorKey:"name",header:"Agent",meta:{headClassName:"w-[42%] md:w-[38%]",cellClassName:"overflow-hidden"},cell:({row:s})=>r.jsx(Os,{row:s.original,onOpen:()=>e.onNavigate(s.original.projectPath??"")})},{accessorKey:"lastSeenEvent",header:"Activity",meta:{headClassName:"truncate",cellClassName:"truncate"},cell:({row:s})=>r.jsx(Bs,{row:s.original})},{id:"managedBy",header:"Managed by",meta:{hideOnMobile:!0,headClassName:"w-[140px]",cellClassName:"overflow-hidden"},cell:({row:s})=>{const t=s.original.managedBy;return r.jsx("span",{"data-slot":"agent-managed-by",className:"text-muted-foreground block truncate text-xs",children:t??"—"})}},{accessorKey:"taskCount",header:"Scheduled",meta:{hideOnMobile:!0,headClassName:"w-[110px]"},cell:({row:s})=>{const t=s.original.taskCount;return t===0?r.jsx("span",{className:"text-muted-foreground text-xs",children:"—"}):r.jsxs(I,{variant:"outline",className:"whitespace-nowrap",children:[t," ",t===1?"schedule":"schedules"]})}},{id:"actions",header:"",meta:{headClassName:"w-[88px]"},cell:({row:s})=>{const t=s.original;return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(E,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:n=>{n.stopPropagation(),e.onNavigate(t.projectPath??"")},"aria-label":`Open chat with ${G(t)}`,children:r.jsx(jt,{className:"size-4"})}),r.jsx(E,{variant:"ghost",size:"sm",className:"size-8 p-0",onClick:n=>{n.stopPropagation(),e.onViewProfile(t.projectPath??"")},"aria-label":`Open ${G(t)}’s profile`,children:r.jsx(_t,{className:"size-4"})})]})}}]}function Us({group:e,count:s}){const{label:t,toneClass:n}=Ds[e];return r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-semibold tracking-wide uppercase",children:[e==="needs-you"&&r.jsx(Xe,{className:k("size-3.5",n)}),r.jsx("span",{className:n,children:t}),r.jsx("span",{className:"text-muted-foreground font-normal tabular-nums",children:s})]})}function Ks({rows:e,grouped:s,callbacks:t}){const n=w.useMemo(()=>qs(t),[t]),o=w.useMemo(()=>s?{key:i=>ve(i).group,header:(i,a)=>r.jsx(Us,{group:i,count:a})}:void 0,[s]);return r.jsx(Rs,{columns:n,data:e,groupBy:o,emptyMessage:"No agents registered.",className:"border-0",tableClassName:"table-fixed"})}function Ys({agents:e,isLoading:s,rosterFilters:t}){var O;const n=Qe(),o=Pt(),{open:i}=Se(),a=$t(),l=vn(te,{debounce:{search:200}}),{data:u}=We(),d=w.useMemo(()=>(u==null?void 0:u.members)??[],[u]),g=w.useMemo(()=>zs(e,d,t),[e,d,t]),h=w.useMemo(()=>[...new Set(g.map(N=>N.namespace).filter(N=>!!N))],[g]),f=!l.sortField||l.sortField===_e,c=w.useMemo(()=>f?te.applyFilters(g,l.values):It(g,te,l.values,Tt,{field:l.sortField,direction:l.sortDirection}),[g,f,l.values,l.sortField,l.sortDirection]),p=w.useMemo(()=>e.map(N=>N.projectPath).filter(N=>!!N),[e]),m=Cn(p),{data:v}=At({queryKey:Vt.current(),queryFn:()=>o.getConfig(),staleTime:3e4}),x=w.useMemo(()=>{const N=new Map;for(const F of d){if(F.kind!=="agent")continue;const L=Ze(F,d);L&&N.set(F.id,K(L))}return N},[d]),R=w.useMemo(()=>{const N=c.map(F=>{var L;return{...F,chatState:(F.projectPath?m[F.projectPath]:void 0)??"fresh",isPastOnboardingGrace:Ns(F.registeredAt),isDefault:((L=v==null?void 0:v.agents)==null?void 0:L.defaultAgent)===F.name,managedBy:x.get(F.id)??null}});return f?Es(N,l.sortDirection):N},[c,m,(O=v==null?void 0:v.agents)==null?void 0:O.defaultAgent,x,f,l.sortDirection]),j=w.useCallback(N=>{const F=a.get(N);if(F===void 0){Je.getState().openProfileDocked(N);return}i(F)},[a,i]),y=w.useCallback(N=>{Et(o,N).then(F=>n(F)).catch(F=>{Dt(o,F),zt(N)})},[n,o]),_=w.useMemo(()=>({onNavigate:y,onViewProfile:j}),[y,j]);function A(){return g.length===0&&e.length>0?r.jsx(js,{peopleOnly:(t==null?void 0:t.kind)==="people"}):c.length===0&&g.length>0?r.jsx(ys,{onClearFilters:l.clearAll,filterDescription:l.describeActive()}):r.jsx(Ks,{rows:R,grouped:f,callbacks:_})}return s?r.jsx("div",{className:"space-y-3 p-4 sm:px-6",children:Array.from({length:3}).map((N,F)=>r.jsx(V,{className:"h-14 w-full rounded-xl"},F))}):r.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[r.jsxs(H,{state:l,className:"sm:px-6",children:[r.jsx(H.Search,{placeholder:"Filter agents…"}),r.jsx(H.Primary,{name:"status"}),r.jsx(H.AddFilter,{dynamicOptions:{namespace:h}}),r.jsx(H.Sort,{options:kt,defaultField:_e}),r.jsx(H.ResultCount,{count:c.length,total:g.length,noun:"agent"}),r.jsx(H.ActiveFilters,{})]}),r.jsx(Sn,{className:"min-h-0 flex-1",children:r.jsx("div",{className:"px-4 pb-4 sm:px-6",children:A()})})]})}const Xs={animate:{transition:{staggerChildren:.1}}},Qs={initial:{opacity:0},animate:{opacity:.2,transition:{duration:.3}}};function de(){return r.jsxs($.div,{variants:Qs,className:"rounded-xl border border-dashed px-4 py-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[r.jsx(V,{className:"size-3 rounded-full"}),r.jsx(V,{className:"h-3 w-32"}),r.jsx(V,{className:"h-3 w-16"}),r.jsx(V,{className:"ml-auto h-3 w-10"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(V,{className:"h-2.5 w-48"}),r.jsx(V,{className:"h-2.5 w-20"})]})]})}function vt(){const e=bt(s=>s.open);return r.jsxs("div",{className:"relative w-full max-w-2xl px-4",children:[r.jsxs($.div,{variants:Xs,initial:"initial",animate:"animate",className:"space-y-3",children:[r.jsx(de,{}),r.jsx(de,{}),r.jsx(de,{})]}),r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-4",children:[r.jsx("p",{className:"text-lg font-semibold",children:"Bring in existing projects"}),r.jsxs(E,{size:"sm",className:"gap-1.5",onClick:e,children:[r.jsx(Pn,{className:"size-3.5"}),"Search for projects"]})]})]})}function Ws(){const{data:e,isLoading:s}=Lt(),t=(e==null?void 0:e.denied)??[];return s?r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(J,{size:"md",className:"text-muted-foreground",label:"Loading blocked paths"})}):t.length===0?r.jsx(et,{icon:Ht,headline:"No blocked paths",description:"Folders you block from scans show up here."}):r.jsx("div",{className:"space-y-2 p-4",children:t.map(n=>r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate font-mono text-sm",title:n.path,children:n.path}),n.reason&&r.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n.reason,children:n.reason})]}),r.jsx(I,{variant:"outline",className:"shrink-0",children:n.deniedBy})]},n.path))})}function Zs({namespace:e,agentCount:s,agents:t}){const[n,o]=w.useState(!1);return r.jsxs("div",{className:"rounded-xl border",children:[r.jsxs("button",{type:"button",onClick:()=>o(!n),className:"hover:bg-muted/50 flex w-full items-center gap-2 px-4 py-3 text-left transition-colors duration-150",children:[n?r.jsx(Ot,{className:"size-4"}):r.jsx(Bt,{className:"size-4"}),r.jsx("span",{className:"text-sm font-medium",children:e}),r.jsxs(I,{variant:"secondary",className:"ml-auto",children:[s," agent",s!==1?"s":""]})]}),n&&r.jsx("div",{className:"space-y-2 border-t px-4 py-2",children:t.map(i=>r.jsx("div",{className:"flex items-center justify-between py-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm",children:G(i)}),r.jsx(I,{variant:"outline",children:tt(i.runtime)})]})},i.id))})]})}function Js({sourceNamespace:e,targetNamespace:s,action:t,origin:n,onRemove:o}){const i=n==="default";return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border px-3 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"font-mono",children:e}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsx("span",{className:"font-mono",children:s}),r.jsx(I,{variant:t==="allow"?"default":"destructive",children:t}),i&&r.jsx(I,{tone:"neutral",variant:"outline",children:"built-in"})]}),i?r.jsx("span",{className:"text-muted-foreground flex size-8 items-center justify-center",title:"Built-in rule, always enforced. Not removable",children:r.jsx(qt,{className:"size-4","aria-hidden":"true"})}):r.jsx(E,{type:"button",variant:"ghost",size:"icon-sm",onClick:o,className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove access from ${e} to ${s}`,children:r.jsx(Ut,{})})]})}const St="acl-open-mesh-explanation";function eo({namespaces:e,onAdd:s,isPending:t,inert:n}){const[o,i]=w.useState(""),[a,l]=w.useState("");function u(g){g.preventDefault(),!n&&o&&a&&o!==a&&(s(o,a),i(""),l(""))}const d=n?{"aria-disabled":!0,"aria-describedby":St}:{};return r.jsxs("form",{onSubmit:u,className:"flex items-end gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Fe,{htmlFor:"acl-source",className:"text-muted-foreground text-xs font-medium",children:"Source"}),r.jsxs(Me,{value:o,onValueChange:n?()=>{}:i,children:[r.jsx(Pe,{id:"acl-source",className:"w-full aria-disabled:pointer-events-none aria-disabled:opacity-50",...d,children:r.jsx($e,{placeholder:"Pick a project"})}),r.jsx(Ie,{children:e.map(g=>r.jsx(Ae,{value:g,children:g},g))})]})]}),r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx(Fe,{htmlFor:"acl-target",className:"text-muted-foreground text-xs font-medium",children:"Target"}),r.jsxs(Me,{value:a,onValueChange:n?()=>{}:l,children:[r.jsx(Pe,{id:"acl-target",className:"w-full aria-disabled:pointer-events-none aria-disabled:opacity-50",...d,children:r.jsx($e,{placeholder:"Pick a project"})}),r.jsx(Ie,{children:e.map(g=>r.jsx(Ae,{value:g,children:g},g))})]})]}),r.jsxs(E,{type:"submit",className:"aria-disabled:pointer-events-none aria-disabled:opacity-50",disabled:!n&&(t||!o||!a||o===a),...d,children:[t?r.jsx(J,{}):r.jsx(Kt,{}),"Allow access"]})]})}function to({onGoToDiscovery:e}={}){const{data:s,isLoading:t}=rt(),{mutate:n,isPending:o}=wn();if(t)return r.jsx("div",{className:"flex items-center justify-center p-8",children:r.jsx(J,{size:"md",className:"text-muted-foreground"})});const i=(s==null?void 0:s.namespaces)??[],a=(s==null?void 0:s.openMesh)??!1,l=((s==null?void 0:s.accessRules)??[]).filter(d=>!(d.origin==="explicit"&&d.sourceNamespace===Ne&&d.targetNamespace===Ne)),u=i.map(d=>d.namespace);return i.length===0?r.jsxs("div",{className:"space-y-6 p-4",children:[r.jsx(Ve,{}),r.jsx(et,{icon:Gt,headline:"You need agents in more than one project",description:"Add agents from a second folder to let two projects talk.",action:e?{label:"Go to Discovery",onClick:e}:void 0})]}):r.jsxs("div",{className:"space-y-6 p-4",children:[r.jsx(Ve,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Projects"}),i.map(d=>r.jsx(Zs,{namespace:d.namespace,agentCount:d.agentCount,agents:d.agents},d.namespace))]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Cross-project access rules"}),l.length===0?r.jsx("p",{className:"text-muted-foreground text-xs",children:"No rules yet. Agents only talk within their own project."}):r.jsx("div",{className:"space-y-1",children:l.map(d=>r.jsx(Js,{sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:d.action,origin:d.origin,onRemove:()=>n({sourceNamespace:d.sourceNamespace,targetNamespace:d.targetNamespace,action:"deny"})},`${d.sourceNamespace}-${d.targetNamespace}-${d.action}-${d.origin}`))})]}),u.length>=2&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Allow cross-project access"}),a&&r.jsx("p",{id:St,className:"text-muted-foreground text-xs",children:"Already allowed by the switch above. Turn it off to pick pairs."}),r.jsx(eo,{namespaces:u,isPending:o,inert:a,onAdd:(d,g)=>n({sourceNamespace:d,targetNamespace:g,action:"allow"})})]})]})}const Ct={active:{label:"Active",dot:ne.working},inactive:{label:"Inactive",dot:ne["needs-you"]},stale:{label:"Stale",dot:"bg-muted-foreground/50"},unreachable:{label:"Unreachable",dot:ne.error}};function no(e){return e in Ct}function Be({onClick:e}){return r.jsx("button",{type:"button",onClick:e,"aria-label":"Close detail panel",className:"text-muted-foreground hover:text-foreground",children:r.jsx(Ce,{className:"size-(--size-icon-sm)"})})}function qe({agentId:e,onClose:s}){const{data:t,isLoading:n}=Rn(e),{open:o}=Se();if(n)return r.jsx("div",{className:"flex w-64 items-center justify-center border-l p-4",children:r.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})});if(!t)return r.jsxs("div",{className:"w-64 border-l p-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsx(Be,{onClick:s})}),r.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Agent not found"})]});const i=no(t.status)?t.status:"stale",a=Ct[i];return r.jsxs("div",{className:"w-64 overflow-y-auto border-l p-4",children:[r.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:t.name}),r.jsx(Be,{onClick:s})]}),r.jsxs("div",{className:"space-y-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:k("h-2.5 w-2.5 rounded-full",a.dot),"aria-hidden":"true"}),r.jsx("span",{children:a.label})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Last seen: "}),r.jsx("span",{children:t.lastSeenAt?ce(t.lastSeenAt):"Never"})]}),t.lastSeenEvent&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Last event: "}),r.jsx("span",{children:t.lastSeenEvent})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Runs on: "}),r.jsx(I,{size:"xs",variant:"secondary",children:tt(t.runtime)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Registered: "}),r.jsx("span",{children:t.registeredAt?ce(t.registeredAt):"Unknown"})]}),Array.isArray(t.capabilities)&&t.capabilities.length>0&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground mb-1 block",children:"Capabilities:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:t.capabilities.map(l=>r.jsx(I,{size:"xs",variant:"outline",children:l},l))})]})]}),r.jsx("div",{className:"mt-4 space-y-2 border-t pt-3",children:r.jsxs("button",{type:"button",onClick:()=>o(e),className:"hover:bg-muted inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-1.5 text-xs font-medium transition-colors duration-150",children:[r.jsx(Yt,{className:"size-3.5"}),"View profile"]})})]})}function so(){return r.jsx(to,{})}function oo(e){var s;if(e.agent){const t=Ye(e.agent.runtime).label;return e.agent.model?`${t} · ${e.agent.model}`:t}return(s=e.person)!=null&&s.role?e.person.role:e.origin==="local"?"On this machine":`On ${Wt(e.origin.platform)}`}const io={layout:"position",initial:{opacity:0,scale:.97},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.97,transition:{duration:.15}},transition:{layout:{type:"spring",stiffness:280,damping:32},duration:.2,ease:[0,0,.2,1]}};function ro({member:e,owner:s,onSelectOwner:t,onOpenProfile:n,onSetLinkedToMe:o,linkPending:i=!1,linkError:a,ownedAgentCount:l,layoutAnimated:u=!1,ref:d,className:g}){var p,m,v;const h=nt(e),f=Xt(e),c=(p=e.person)==null?void 0:p.linkedToYou;return r.jsxs($.article,{ref:d,...u?io:{},"data-slot":"team-member-card","data-member-id":e.id,"data-layout-animated":String(u),style:{"--identity-color":h.color},className:k("bg-card shadow-soft relative flex items-start gap-3 rounded-lg border p-4","border-[color-mix(in_oklch,var(--identity-color)_var(--identity-border-strength),hsl(var(--border)))]","[--identity-border-strength:0%]",n&&["transition-[box-shadow,border-color,translate,scale] duration-(--identity-settle) ease-(--identity-ease-standard)","hover:shadow-elevated hover:-translate-y-px","hover:[--identity-border-strength:var(--identity-border-mix)]","has-[[data-slot=team-member-open]:focus-visible]:shadow-elevated has-[[data-slot=team-member-open]:focus-visible]:-translate-y-px","has-[[data-slot=team-member-open]:focus-visible]:[--identity-border-strength:var(--identity-border-mix)]","active:translate-y-0 active:scale-[0.99] active:duration-(--identity-press)",Qt,"has-[[data-card-aside]:hover]:shadow-soft has-[[data-card-aside]:hover]:translate-y-0 has-[[data-card-aside]:hover]:[--identity-border-strength:0%]","has-[[data-card-aside]:focus-visible]:shadow-soft has-[[data-card-aside]:focus-visible]:translate-y-0 has-[[data-card-aside]:focus-visible]:[--identity-border-strength:0%]","[&:has([data-card-aside]:hover)_[data-slot=identity-badge]]:scale-100 [&:has([data-card-aside]:hover)_[data-slot=identity-badge]]:rotate-0","[&:has([data-card-aside]:focus-visible)_[data-slot=identity-badge]]:scale-100 [&:has([data-card-aside]:focus-visible)_[data-slot=identity-badge]]:rotate-0","has-[[data-card-aside]:active]:scale-100"],g),children:[r.jsx(st,{size:"md",kind:h.kind,color:h.color,emoji:h.emoji,imageUrl:h.imageUrl,fallback:h.fallback,origin:h.origin}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1",children:[r.jsx("h3",{className:"min-w-0 truncate text-sm font-medium",children:n?r.jsx("button",{type:"button","data-slot":"team-member-open",onClick:()=>n(e.id),"aria-label":`Open ${e.displayName}’s profile`,className:"focus-ring max-w-full truncate rounded text-left after:absolute after:inset-0 after:rounded-lg after:content-['']",children:e.displayName}):e.displayName}),e.isSelf&&r.jsx(I,{size:"xs",variant:"secondary",children:"you"}),((m=e.agent)==null?void 0:m.isDefault)&&r.jsx(I,{size:"xs",variant:"outline",children:"default"}),c&&r.jsx(I,{size:"xs",variant:"secondary",children:"also you"})]}),e.handle!==null&&r.jsxs("p",{"data-slot":"team-member-handle",className:"text-muted-foreground truncate text-xs",children:["@",e.handle]}),f&&r.jsx("p",{"data-slot":"team-member-name-source",className:"text-muted-foreground truncate text-xs",children:f}),r.jsx("p",{className:"text-muted-foreground mt-1.5 truncate text-xs",children:oo(e)}),((v=e.agent)==null?void 0:v.recentlyActive)&&r.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Active in the last hour"}),c!==void 0&&o&&r.jsx("button",{type:"button","data-slot":"team-member-link-to-me","data-card-aside":"",disabled:i,onClick:()=>o(e.id,!c),"aria-label":c?`Stop treating ${e.displayName} as you`:`Tell DorkOS that ${e.displayName} is you`,className:"text-muted-foreground hover:text-foreground focus-visible:text-foreground focus-ring relative mt-1.5 block w-fit max-w-full truncate rounded text-xs underline-offset-2 transition-[color] duration-(--identity-answer) ease-(--identity-ease-standard) hover:underline focus-visible:underline disabled:pointer-events-none disabled:opacity-60",children:c?"Not me":"This is me"}),a&&r.jsx("p",{role:"alert","data-slot":"team-member-link-error",className:"text-destructive relative mt-1 text-xs",children:a}),s&&t&&r.jsxs("div",{className:"relative mt-1.5 flex w-fit max-w-full items-baseline",children:[r.jsxs("button",{type:"button","data-slot":"team-member-owner","data-card-aside":"",onClick:()=>t(s.id),"aria-label":`Show only ${s.displayName} and their agents`,className:"text-muted-foreground hover:text-foreground focus-visible:text-foreground focus-ring peer/owner relative min-w-0 truncate rounded text-xs underline-offset-2 transition-[color] duration-(--identity-answer) ease-(--identity-ease-standard) hover:underline focus-visible:underline",children:["by ",K(s)]}),l!==void 0&&l>0&&r.jsxs("span",{"aria-hidden":!0,"data-slot":"team-member-owner-count",className:"text-muted-foreground pointer-events-none absolute top-0 left-full ml-1 hidden text-xs whitespace-nowrap opacity-0 transition-opacity duration-(--identity-answer) ease-(--identity-ease-standard) peer-hover/owner:opacity-100 peer-focus-visible/owner:opacity-100 [@media(hover:hover)]:block",children:["· ",l," ",l===1?"agent":"agents"]})]})]})]})}const ao=120;function lo({memberCount:e,reducedMotion:s}){return!s&&e<=ao}const wt="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3";function uo({owner:e,onSelectOwner:s,ref:t}){const n=nt(e),o="col-span-full mt-3 flex min-w-0 items-center first:mt-0",i=r.jsxs(r.Fragment,{children:[r.jsx(st,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),r.jsx("span",{className:"truncate text-sm font-medium",children:e.displayName}),r.jsx("span",{className:"text-muted-foreground truncate text-xs",children:K(e)})]});return s?r.jsx("h2",{ref:t,className:o,children:r.jsx("button",{type:"button",onClick:()=>s(e.id),className:"focus-ring flex min-w-0 items-center gap-2 rounded",children:i})}):r.jsx("h2",{ref:t,className:k(o,"gap-2"),children:i})}function co({members:e,roster:s,grouped:t,onSelectOwner:n,onOpenProfile:o,onSetLinkedToMe:i,identityLinkState:a,className:l}){const u=Zt(),d=lo({memberCount:e.length,reducedMotion:u===!0}),g=(f,c)=>{const p=c?Ze(f,s):void 0;return r.jsx(ro,{member:f,owner:p,ownedAgentCount:p?tn(p.id,s):void 0,onSelectOwner:c?n:void 0,onOpenProfile:o,onSetLinkedToMe:i,linkPending:(a==null?void 0:a.pendingId)===f.id,...(a==null?void 0:a.errorId)===f.id&&a.errorMessage?{linkError:a.errorMessage}:{},layoutAnimated:d},f.id)},h=t?Jt(e,s).flatMap(f=>[f.owner?r.jsx(uo,{owner:f.owner,onSelectOwner:n},`cluster:${f.owner.id}`):r.jsx("h2",{className:"text-muted-foreground col-span-full mt-3 text-sm font-medium first:mt-0",children:"No owner"},"cluster:__unowned"),...f.members.map(c=>g(c,!1))]):e.map(f=>g(f,!0));return r.jsx("div",{"data-slot":t?"team-roster-groups":"team-roster-grid","data-testid":en.teamRoster,"data-layout-animated":String(d),className:k(wt,l),children:r.jsx(ge,{mode:"popLayout",initial:!1,children:h})})}const go=6;function fo({count:e=go}={}){return r.jsx("div",{className:wt,"aria-busy":"true","aria-label":"Loading the team",children:Array.from({length:e}).map((s,t)=>r.jsxs("div",{className:"bg-card shadow-soft flex items-start gap-3 rounded-lg border p-4",children:[r.jsx(V,{className:"size-9 shrink-0 rounded-full"}),r.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[r.jsx(V,{className:"h-4 w-24"}),r.jsx(V,{className:"h-3 w-16"}),r.jsx(V,{className:"h-3 w-32"})]})]},t))})}const mo=[{value:"all",label:"All"},{value:"people",label:"People"},{value:"agents",label:"Agents"}];function po({filters:e,onFiltersChange:s,people:t,className:n}){const o=e.owner?t.find(i=>i.id===e.owner):void 0;return r.jsxs("div",{className:k("space-y-3",n),children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto pb-0.5",children:[r.jsx("div",{role:"group","aria-label":"Filter by kind",className:"flex items-center gap-1.5",children:mo.map(i=>r.jsx(E,{type:"button",size:"xs",variant:e.kind===i.value?"default":"outline","aria-pressed":e.kind===i.value,onClick:()=>s({kind:i.value}),className:"shrink-0",children:i.label},i.value))}),t.length>1&&r.jsx("div",{role:"group","aria-label":"Filter by person",className:"flex items-center gap-1.5",children:t.map(i=>r.jsx(E,{type:"button",size:"xs",variant:e.owner===i.id?"default":"outline","aria-pressed":e.owner===i.id,"aria-label":`Show only ${i.displayName} and their agents`,onClick:()=>s({owner:e.owner===i.id?void 0:i.id}),className:"max-w-40 shrink-0 truncate",children:K(i)},i.id))})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(E,{type:"button",size:"xs",variant:e.group==="manager"?"default":"outline","aria-pressed":e.group==="manager",onClick:()=>s({group:e.group==="manager"?"none":"manager"}),className:"shrink-0",children:"Group by owner"}),r.jsxs("div",{className:"relative flex-1 sm:w-56 sm:flex-none",children:[r.jsx(nn,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2"}),r.jsx(sn,{type:"search","aria-label":"Search the team",placeholder:"Search",value:e.q??"",onChange:i=>s({q:i.target.value===""?void 0:i.target.value}),className:"h-8 pl-8 text-xs"})]})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("p",{className:"text-muted-foreground text-xs",children:["Showing ",K(o)," and their agents"]}),r.jsxs(E,{type:"button",size:"xs",variant:"ghost",onClick:()=>s({owner:void 0}),children:[r.jsx(Ce,{"aria-hidden":!0,className:"size-3"}),"Clear"]})]})]})}const ho={agents:"Couldn’t read all your agents. Showing the rest.",authors:"Couldn’t read everyone on this install. Showing the rest.",account:"Couldn’t read your account, so your own name may be missing.",claims:"Couldn’t tell which of your agents are working right now.",rooms:"Couldn’t read your rooms, so where agents work may be missing.",sessions:"Couldn’t read recent chats, so “last active” may be missing."};function xo(e){return ho[e]??"Some of your team couldn’t be loaded."}function vo({warnings:e,className:s}){const[t,n]=w.useState(!1);return!e||e.length===0||t?null:r.jsxs("div",{role:"status","data-slot":"team-roster-warnings",className:k("border-status-warning/40 bg-status-warning/10 flex items-start gap-2 rounded-lg border px-3 py-2",s),children:[r.jsx(Xe,{"aria-hidden":!0,className:"text-status-warning mt-0.5 size-4 shrink-0"}),r.jsx("ul",{className:"min-w-0 flex-1 space-y-0.5 text-xs",children:e.map(o=>r.jsx("li",{children:xo(o.source)},o.source))}),r.jsx(E,{type:"button",size:"xs",variant:"ghost","aria-label":"Dismiss",onClick:()=>n(!0),className:"-my-0.5 shrink-0",children:r.jsx(Ce,{"aria-hidden":!0,className:"size-3"})})]})}function So({filters:e,onFiltersChange:s}){const[t,n]=w.useState(on),o=e??t,i=y=>{e!==void 0?s(y):n(_=>({..._,...y}))},{open:a}=Se(),l=rn(),{data:u,isLoading:d,isError:g,refetch:h}=We(),f=it(d),c=w.useMemo(()=>(u==null?void 0:u.members)??[],[u]),p=w.useMemo(()=>Ke(c,o),[c,o]),m=w.useMemo(()=>c.filter(y=>y.kind==="human"),[c]),v=c.some(y=>y.kind==="agent"),x=w.useMemo(()=>Fn(c),[c]),R=w.useMemo(()=>{const y=new Set(c.filter(_=>{const A=an(_,c);return A==="managed"||A==="system"}).flatMap(_=>{var A;return(A=_.agent)!=null&&A.manifestId?[_.agent.manifestId]:[]}));return _=>y.has(_.agentId)},[c]),j=o.kind!=="all"||o.owner!==void 0||(o.q??"")!=="";return g?r.jsx(ot,{className:"h-full",title:"Couldn’t load your team",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void h()}):r.jsxs(Nn,{width:"full",className:"flex flex-col gap-4",children:[r.jsx(vo,{warnings:u==null?void 0:u.warnings}),r.jsx(po,{filters:o,onFiltersChange:i,people:m}),f?r.jsx(fo,{}):p.length>0?r.jsx(co,{members:p,roster:c,grouped:o.group==="manager",onSelectOwner:y=>i({owner:y}),onOpenProfile:a,onSetLinkedToMe:(y,_)=>l.mutate({memberId:y,linked:_}),identityLinkState:{...l.isPending&&l.variables?{pendingId:l.variables.memberId}:{},...l.isError&&l.variables?{errorId:l.variables.memberId,errorMessage:ln(l.error,l.variables.linked)}:{}}}):r.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:j?"Nobody here matches that.":"Nobody to show yet."}),!f&&c.length>0&&!v&&r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(vt,{})}),!f&&v&&r.jsxs("section",{"aria-labelledby":"team-commitments",className:"flex flex-col gap-2 pt-2",children:[r.jsx("h2",{id:"team-commitments",className:"text-sm font-medium",children:"Commitments"}),r.jsx(Mn,{nameOf:x,canChange:R})]})]})}const Co=w.lazy(()=>hn(()=>import("./TopologyGraph-of6Cp5Kj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])).then(e=>({default:e.TopologyGraph}))),wo=.15,q={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:wo}};function Ro(){return r.jsxs(r.Fragment,{children:[r.jsx(un,{children:"Team"}),r.jsx(yo,{})]})}function yo(){const e=dn({from:"/_shell/team"}),s=Qe(),t=Ue(),n=cn(),[,o]=gn(),{data:i,isLoading:a,isError:l,refetch:u}=rt(),d=it(a),g=fn(e.view),h=e.agent,f=w.useMemo(()=>({kind:e.kind,owner:e.owner,group:e.group,q:e.q}),[e.kind,e.owner,e.group,e.q]);function c(x){s({...Y.team(),search:R=>({...R,...x})})}function p(){s({...Y.team(),search:x=>({...x,agent:void 0})})}const m=w.useMemo(()=>(i==null?void 0:i.namespaces.flatMap(x=>x.agents))??[],[i]),v=m.length===0&&!d&&!l&&(g==="table"||g==="topology");return l&&g!=="cards"?r.jsx(ot,{className:"h-full",title:"Couldn’t load agents",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void u()}):v?r.jsx("div",{className:"flex h-full flex-col items-center justify-center",children:r.jsx(vt,{})}):r.jsx("div",{className:"flex h-full flex-col",children:r.jsxs(ge,{mode:"wait",initial:!1,children:[g==="cards"&&r.jsx($.div,{...q,className:"flex h-full flex-col",children:r.jsx(So,{filters:f,onFiltersChange:c})},"view-cards"),g==="table"&&r.jsx($.div,{...q,className:"flex h-full flex-col",children:r.jsx(Ys,{agents:m,isLoading:d,rosterFilters:f})},"view-table"),g==="topology"&&r.jsx($.div,{...q,className:"relative flex-1 overflow-hidden",children:r.jsxs("div",{className:"flex h-full",children:[r.jsx($.div,{layout:!0,className:"min-w-0 flex-1",transition:{type:"spring",stiffness:300,damping:30},children:r.jsx("div",{className:"absolute inset-0",children:r.jsx(w.Suspense,{fallback:r.jsxs("div",{className:"text-muted-foreground flex h-full items-center justify-center text-sm",children:[r.jsx(J,{className:"mr-2"}),"Loading topology…"]}),children:r.jsx(Co,{onSelectAgent:x=>void s({...Y.team(),search:R=>({...R,agent:x})}),onViewProfile:(x,R)=>{Je.getState().openProfileDocked(R)},onOpenChat:x=>o(x),onOpenAdapterCatalog:()=>n(),onGoToDiscovery:()=>void s({...Y.team(),search:x=>({...x,view:"table"})})})})})}),t?r.jsx(mn,{open:!!h,onOpenChange:x=>!x&&p(),children:r.jsx(pn,{children:h&&r.jsx(qe,{agentId:h,onClose:p})})}):r.jsx(ge,{children:h&&r.jsx($.div,{initial:{width:0,opacity:0},animate:{width:256,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:300,damping:30},className:"bg-background overflow-y-auto border-l",children:r.jsx(qe,{agentId:h,onClose:p})})})]})},"view-topology"),g==="denied"&&r.jsx($.div,{...q,children:r.jsx(Ws,{})},"view-denied"),g==="access"&&r.jsx($.div,{...q,children:r.jsx(so,{})},"view-access")]})})}const jo=Ro,Eo=Object.freeze(Object.defineProperty({__proto__:null,component:jo},Symbol.toStringTag,{value:"Module"}));export{Ct as H,Eo as _};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as o}from"./ExtensionPageRoute-mKN8Jqyx.js";import"./index-Dr-0P6rd.js";import"./page-container-CPxW5T9E.js";import"./use-dev-links-BImQrE6g.js";import"./UnlinkDialog-BgwHAqdW.js";const r=o;export{r as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as o}from"./ExtensionPageRoute-mKN8Jqyx.js";import"./index-Dr-0P6rd.js";import"./page-container-CPxW5T9E.js";import"./use-dev-links-BImQrE6g.js";import"./UnlinkDialog-BgwHAqdW.js";const r=o;export{r as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{au as c,r as u,av as l,j as e,e as a,aw as i,ax as m}from"./index-Dr-0P6rd.js";import{ay as R,az as N,aA as g,aB as h,aC as j,aD as w}from"./index-Dr-0P6rd.js";import{C as P,N as I,O as y,o as D,a as S}from"./NewDirectMessageMenu-BjqYwnXW.js";function f(){const s=c(),o=s.status==="ready"?s.roomId:null,t=u.useRef(null);return u.useEffect(()=>{const n=t.current;if(t.current=o,n===null||n===o)return;const r=l.getState().request;r!==null&&r.roomId!==o&&l.getState().consume()},[o]),s.status==="loading"?e.jsxs("div",{className:"space-y-4 p-4","aria-busy":!0,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(a,{className:"size-9 rounded-full"}),e.jsx(a,{className:"h-4 w-32"})]}),e.jsx(a,{className:"h-3 w-48"}),e.jsx(a,{className:"h-24 w-full"})]}):s.status==="none"?e.jsx(i,{title:"No room open",body:"Open a channel or direct message to see who’s in it."}):e.jsx(m,{roomId:s.roomId},s.roomId)}export{R as AgentChipPicker,N as AgentRosterPicker,P as ChannelCreateDialog,I as NewDirectMessageMenu,y as ONE_DOOR_HINT,g as ROOM_PANEL_ID,f as RoomPanel,m as RoomPanelBody,h as facesOfRoster,D as oneDoorSubmitLabel,j as openRoomPanel,S as opensAgentSession,w as useRoomFaces,l as useRoomPanelFocusStore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as B,e9 as O,ea as V,eb as A,j as e,at as Y,b6 as q,ec as F,ed as H,ee as U,ef as X,eg as G,eh as K,df as Q,Z as R,e5 as Z,ei as D,ej as J,ek as W,B as $,aa as _,ad as ee,el as se,em as te,cP as z,en as ne,eo as ae,ep as re,eq as ie,er as I,dd as oe,cQ as N,es as de,et as P}from"./index-Dr-0P6rd.js";import{eu as Se,ev as Ee,ew as we,ex as ke,ey as Ce,ez as _e}from"./index-Dr-0P6rd.js";import{C as le}from"./card-BTgwskmX.js";const ce=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],ue={server_crashed:s=>`${s} stopped unexpectedly 3 times. Reload it to try again.`,server_out_of_memory:s=>`${s} ran out of memory and stopped. Reload it to try again.`,server_unresponsive:s=>`${s} stopped responding, so DorkOS stopped it.`,isolation_unavailable:s=>`${s} can’t run with its limits on this computer.`,server_start_failed:s=>`${s} couldn’t start. Reload it to try again.`,server_start_timeout:s=>`${s} took too long to start. Reload it to try again.`};function T(s){return ce.includes(s)}function me(s,l){return T(s)?ue[s](l):null}function xe(s){return`Restarting ${s}…`}const he=new Set(["disabled","discovered","incompatible","invalid"]),pe="/marketplace?view=installed";function ge({extension:s,onToggle:l,isToggling:h,onSetRunApproval:r,isSettingApproval:c,onReload:f,isReloading:v}){const{manifest:n,status:x,scope:E,error:p,serverError:i,origin:b,approvedToRun:y}=s,[g,t]=B.useState(!1),o=!he.has(x),m=x==="incompatible",a=x==="invalid",d=x==="compile_error"||x==="activate_error",u=!m&&!a,S=!(b==="core"&&n.canDisable===!1),w=s.hasServerEntry||s.hasDataProxy,j=O(s),M=V(s.id,A(j)),k=d?"Not working":m?"Incompatible":a?"Can’t load":null;return e.jsx(le,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,radius:"lg",gap:"none",className:R(d&&"border-amber-500/50",(m||a)&&"opacity-70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&e.jsx(Y,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(m||a)&&!d&&e.jsx(q,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!d&&!m&&!a&&e.jsx(F,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",n.version]}),s.devLink&&e.jsx(H,{})]}),s.devLink&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-dev-link-${s.id}`,children:[e.jsx(U,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void X(pe),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),n.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:n.description}),e.jsx(G,{gifts:K(s),"data-testid":`extension-agent-gifts-${s.id}`}),m&&n.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",n.minHostVersion," or newer"]}),d&&p&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[x==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",p.message]}),p.details&&e.jsxs("button",{type:"button",onClick:()=>t(C=>!C),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":g,children:[e.jsx(Q,{className:R("size-3 transition-transform",g&&"rotate-180")}),g?"Hide details":"Show details"]}),g&&p.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:p.details})]}),i&&T(i.code)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-server-status-${s.id}`,children:[e.jsx("p",{className:"text-status-warning-fg text-sm",children:i.message||me(i.code,n.name)}),e.jsx("button",{type:"button",onClick:f,disabled:v,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!i&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:xe(n.name)}),i&&!T(i.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",i.message,". The last version still runs."]}),b==="user"&&(y?e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs","data-testid":`extension-run-allowed-${s.id}`,children:[e.jsx(Z,{className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"You allowed this to run."}),s.originProblem==="changed"&&e.jsx("span",{children:"You approved its changed files. Any further change asks again."}),e.jsx("button",{type:"button",onClick:()=>r(s.id,!1),disabled:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(D,{permissions:j,className:"basis-full","data-testid":`extension-permissions-${s.id}`})]}):e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/40 bg-amber-500/5 p-3","data-testid":`extension-needs-approval-${s.id}`,children:[e.jsx("p",{className:"text-sm font-medium",children:"This extension is waiting for you"}),s.originProblem&&e.jsx("p",{className:"text-status-warning-fg text-sm","data-testid":`extension-origin-problem-${s.id}`,children:s.originProblem==="changed"?"Its files changed after install, so DorkOS can’t vouch for it. Look it over first.":s.originProblem==="dev-link"?"It runs from your folder, so DorkOS can’t vouch for its source.":"Its plugin links to files elsewhere, so DorkOS can’t vouch for its source."}),e.jsx(D,{permissions:j,added:M,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:J(w,(j==null?void 0:j.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:W}),e.jsx($,{size:"sm",onClick:()=>r(s.id,!0),disabled:c,"data-testid":`extension-approve-run-${s.id}`,children:"Turn it on"})]})),e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(_,{variant:"outline",children:E}),k&&e.jsx(_,{variant:k==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:k}),n.author&&e.jsx("span",{children:n.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:S?e.jsx(ee,{checked:o,onCheckedChange:C=>l(s.id,C),disabled:!u||h,"aria-label":`${o?"Disable":"Enable"} ${n.name}`}):e.jsx(_,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function L(s){const l=new Date(s);return Number.isNaN(l.getTime())?"":l.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function fe(){const{data:s=[]}=se(),{stop:l,pendingSource:h}=te();return s.length===0?null:e.jsxs("section",{className:"space-y-3","data-testid":"trusted-sources-section",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Trusted sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Extensions from these sources turn on without asking."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Stop trusting one, and extensions already on keep running."}),e.jsx(z,{className:"text-muted-foreground text-sm",label:"If you stop trusting one",openLabel:"If you stop trusting one",children:e.jsx("p",{children:"Newer versions and new extensions from it wait for your yes."})})]}),e.jsx("ul",{className:"divide-y rounded-xl border",children:s.map(({source:r,trustedAt:c})=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-mono text-sm",children:r}),L(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",L(c)]})]}),e.jsx($,{type:"button",variant:"outline",size:"sm",disabled:h===r,onClick:()=>l(r),children:"Stop trusting"})]},r))})]})}function Ne(){const{data:s=[],isLoading:l}=ne(),h=ae(),r=re(),c=ie(),f=I(!0),v=I(!1),n=new Set([...h.variables?[h.variables]:[],...r.variables?[r.variables]:[]]),x=new Set([...f.isPending&&f.variables?[f.variables.id]:[],...v.isPending&&v.variables?[v.variables.id]:[]]);function E(t,o){const m=o?f:v,a=s.find(u=>u.id===t);if(!a)return;const d=o?A(O(a)):void 0;m.mutate({id:t,version:a.manifest.version,plugin:a.sourcePlugin??null,...d?{permissions:d}:{}},{onSuccess:u=>{o&&P.getState().forget(t);const S=u.extension.manifest.name,w=u.extension.isolation?"":" inside DorkOS";N.success(o?`${S} can now run${w}`:`${S} stopped running`)},onError:u=>{if(u instanceof de&&u.stale){d&&P.getState().remember(t,d),N.error(`${a.manifest.name} changed since you saw it. Check it again.`);return}N.error(o?"Couldn’t let it run.":"Couldn’t stop it running.",{description:u.message})}})}async function p(t,o){(o?h:r).mutate(t,{onError:a=>{N.error(o?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:a.message})}})}function i(){c.mutate(void 0,{onSuccess:t=>{N.success(`Reloaded ${t.length} extension${t.length===1?"":"s"}`)},onError:t=>{N.error("Couldn’t reload your extensions.",{description:t.message})}})}if(l)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const b=s.filter(t=>t.origin==="core"),y=s.filter(t=>t.origin==="user"),g=t=>e.jsx(ge,{extension:t,onToggle:p,isToggling:n.has(t.id),onSetRunApproval:E,isSettingApproval:x.has(t.id),onReload:i,isReloading:c.isPending},t.id);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Extensions add new screens and tools to DorkOS."}),e.jsxs(z,{children:[e.jsx("p",{children:"Core extensions come with DorkOS."}),e.jsxs("p",{children:["Installed ones live in"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:"~/.dork/extensions/"})," or your project’s"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:".dork/extensions/"}),"."]})]})]}),s.length===0?e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm","data-testid":"no-extensions",children:e.jsx("p",{children:"No extensions installed."})}):e.jsxs(e.Fragment,{children:[b.length>0&&e.jsxs("section",{className:"space-y-3","data-testid":"core-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Core extensions"}),e.jsx("div",{className:"space-y-3",children:b.map(g)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),y.length>0?e.jsx("div",{className:"space-y-3",children:y.map(g)}):e.jsxs("div",{className:"text-muted-foreground rounded-xl border border-dashed p-4 text-sm","data-testid":"no-installed-extensions",children:["No extensions installed yet. Browse"," ",e.jsx("span",{className:"text-foreground font-medium",children:"Marketplace"})," to add some."]})]})]}),e.jsx(fe,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs($,{variant:"outline",size:"sm",onClick:i,disabled:c.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(oe,{className:R("mr-2 size-4",c.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{Se as ExtensionEventBridge,Ee as ExtensionLoader,we as ExtensionProvider,Ne as ExtensionsSettingsTab,ke as createExtensionAPI,Ce as createExtensionEventBridge,_e as useExtensions};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as M,M as S}from"./Marketplace-BoiupH2Z.js";import{M as u,P as x,m as P,u as d,a as g}from"./index-Dr-0P6rd.js";import{M as h}from"./MarketplaceSourcesView-krw9hUyu.js";import{U as I}from"./UnlinkDialog-BgwHAqdW.js";import"./PreviewRefusedNotice-fTN8MJ1h.js";import"./shield-x-DioB6qH_.js";import"./card-BTgwskmX.js";import"./markdown-content-aNzh-54y.js";import"./use-unclaimed-chats-D4k-EK_f.js";import"./use-dev-links-BImQrE6g.js";import"./file-DlQX-hKl.js";import"./file-exclamation-point-Dg2iCyPM.js";import"./rotate-ccw-clock-cx5RyP4l.js";import"./use-pending-read-DmrlNHS0.js";export{M as InstalledPackagesView,S as Marketplace,u as MarketplaceSidebar,h as MarketplaceSourcesView,x as PackageCard,I as UnlinkDialog,P as marketplaceSearchSchema,d as useMarketplaceParams,g as useMarketplaceStore};
|