dorkos 0.126.0 → 0.126.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1225 -562
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-2c9n8B32.js → AboutPage-BQ66xWcJ.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-muwC_jif.js → ActivityErrorState-CPbfgXjw.js} +1 -1
- package/dist/client/assets/{ActivityPage-2aUz3zv0.js → ActivityPage-CesljfZn.js} +1 -1
- package/dist/client/assets/{ActivityRow-nQBqDCak.js → ActivityRow-DzhwE0ht.js} +1 -1
- package/dist/client/assets/{AdapterIcon-ChpyilnO.js → AdapterIcon-BXJkyF5g.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-DRKQp5Gh.js → AdapterSetupWizard-CwKYl1vG.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-CeVPhvTq.js → AgentOptionRow-0VdNzXCF.js} +1 -1
- package/dist/client/assets/{AgentPicker-D8YX1P_q.js → AgentPicker-Ldh64iOA.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-refCLvuV.js → AgentRequestCard-CmAlDGTr.js} +3 -3
- package/dist/client/assets/{AppearancePage-BDTIp3j0.js → AppearancePage-DmsZPHst.js} +1 -1
- package/dist/client/assets/ApplyToOverridesDialog-Ct1W283T.js +1 -0
- package/dist/client/assets/{AttentionSignalRow-Dn4rP542.js → AttentionSignalRow-B7gezgzA.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B0sy0nRk.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Nqvr65_g.js} +1 -1
- package/dist/client/assets/{BindingDialog-DMYB-vWm.js → BindingDialog-CpBZoSZU.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-D9ZLEDXc.js → BlintzCanvas-BCtfZPrs.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-DMqGpNWm.js → CanvasCsvContent-DYksqzaf.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-Bxhc86lv.js → CanvasFileContent-CqEqSxuJ.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-D783Ql7m.js → CanvasModel3dContent-vR6ze4IR.js} +2 -2
- package/dist/client/assets/{ChannelComposer-BNlD-d2W.js → ChannelComposer-BVACOdph.js} +5 -5
- package/dist/client/assets/{ChatAppsOff-eRAfqzJR.js → ChatAppsOff-VsPP2Hye.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-CqEUAG6G.js → CodeMirrorDiff-CmKjH03N.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BM1ANude.js → CodeMirrorEditor-BtNgazuc.js} +1 -1
- package/dist/client/assets/{CommitmentList-C3QvbbGF.js → CommitmentList-D9I-CmNy.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-bmqKNd-Z.js → CommitmentsPage-BORMYDZb.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-78falOZG.js → ComputerResourceView-BZ9BxgOi.js} +1 -1
- package/dist/client/assets/{ComputerViewer-DZ2RiDbn.js → ComputerViewer-CbuU9tXK.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-CXsNyR4U.js → ConnectionAccessLists-uE-Fzp6Y.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-bpkRfRRK.js → ConnectionsPage-D7QTHeQQ.js} +1 -1
- package/dist/client/assets/{ConventionPage-rYtICYjS.js → ConventionPage-PS2WWCyB.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-DXTqUrR4.js → ExtensionPageRoute-Cn7bYxGB.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CCNB3_Gb.js → FloatingTanStackRouterDevtools-CqogiFob-DKGNSXVz.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-BfVnJ6oD.js → ForwardConsentHost-CLIHtWwq.js} +1 -1
- package/dist/client/assets/HandlePage-BjlcYr_l.js +1 -0
- package/dist/client/assets/{HeartbeatPage-DdAfcR81.js → HeartbeatPage-7MTowke-.js} +1 -1
- package/dist/client/assets/{KeyEntry-CR7GBqXf.js → KeyEntry-Cf7D0Oo6.js} +1 -1
- package/dist/client/assets/{LexicalField-RAoub3wq.js → LexicalField-DqvzeMr3.js} +1 -1
- package/dist/client/assets/{ManagesPage-CEhYj9ov.js → ManagesPage-DxR4zWMf.js} +1 -1
- package/dist/client/assets/{Marketplace-DtxHDbF4.js → Marketplace-V_92jKOn.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-CSFvFtV_.js → MarketplaceSourcesView-CjCVMP_d.js} +1 -1
- package/dist/client/assets/{McpAppFrame-1mPdRK9p.js → McpAppFrame-4JDJsrmg.js} +2 -2
- package/dist/client/assets/{McpSigninBody--HfjMnE1.js → McpSigninBody-DG1XX7XT.js} +1 -1
- package/dist/client/assets/{Model3dViewer-BT2SY67i.js → Model3dViewer-DedBFHsl.js} +1 -1
- package/dist/client/assets/NamePage-A8X09lY7.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-QUtJTzKI.js → NewDirectMessageMenu-C8t7x-sB.js} +1 -1
- package/dist/client/assets/{NotificationsPage-D3fleW0i.js → NotificationsPage-DwGFE3F6.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-8WEn0WrA.js → OpenMeshSwitch-DPmTA9eg.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-Cu0h8Xqy.js +1 -0
- package/dist/client/assets/{PermissionHistory-5stLHBu8.js → PermissionHistory-zD6ksrl2.js} +1 -1
- package/dist/client/assets/PermissionsPage-Durcnmie.js +1 -0
- package/dist/client/assets/{PersonalityPopover-DIbsJ6HP.js → PersonalityPopover-DuRjJuLj.js} +1 -1
- package/dist/client/assets/PhotoPage-DP5WoeFd.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CjT7jQ45.js → PreviewRefusedNotice-hlYrFDQM.js} +1 -1
- package/dist/client/assets/{ProfileFields-gZNaFBow.js → ProfileFields-x-x8vgNo.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-DYf7L8xJ.js → ProfilePanelContainer-8WxopRj2.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-DclYXFSP.js → ProfileRolePicker-BfciiNpr.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-k9HolS90.js → PromptSuggestionChips-D34Zeaq_.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-Bh5KrFbJ.js → ReportsToPopover-BhqA5qXi.js} +1 -1
- package/dist/client/assets/{RoomSurface-32U7Wl6Z.js → RoomSurface-BlMNuQsT.js} +1 -1
- package/dist/client/assets/{RoomsPage-sdMZgHla.js → RoomsPage-C52AOHIE.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-B5_Jz7ir.js → RunsOnPopover-DLhEKwXF.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-C_6ozpAK.js → RuntimeConnectFlow-D3H5Fpkc.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-BDvzruM4.js → RuntimeSetupDialog-DPU4QIY9.js} +1 -1
- package/dist/client/assets/{SeenDevices-CZ--8ljN.js → SeenDevices-CDSHTsL7.js} +2 -2
- package/dist/client/assets/{SessionsPage-BKyrJh1O.js → SessionsPage-Crh3D3Jj.js} +1 -1
- package/dist/client/assets/{SettingsDialog-E5hPag3F.js → SettingsDialog-D0Oh-ku1.js} +4 -4
- package/dist/client/assets/{SkillsPage-BeL6zfgw.js → SkillsPage-BPexZwnJ.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-B-IP5hYv.js → TaskDialogWrapper-D6RB8E59.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-BcftWVbk.js → TasksEmptyState-Di3SbhJM.js} +2 -2
- package/dist/client/assets/{TasksPage-CmroTI1v.js → TasksPage-CDLsY1Ww.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-DbfoZrZz.js → TeamComputerEntry-B_q-oVSs.js} +1 -1
- package/dist/client/assets/{ToolsPage-h-PS45fZ.js → ToolsPage-gvIVTnwf.js} +1 -1
- package/dist/client/assets/{TopologyGraph-Bk_0y0Yy.js → TopologyGraph-Bp8aL_qw.js} +1 -1
- package/dist/client/assets/{TourHost-D4La-1-E.js → TourHost-Cg8EHvod.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-CWd4fhT4.js → UnlinkDialog-Ddd1Yxfk.js} +1 -1
- package/dist/client/assets/{UnreadDivider-Bvg9QLn9.js → UnreadDivider-LL4_YtF0.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-DictdlWO.js → WidgetErrorCard-BA3P7hNv.js} +6 -6
- package/dist/client/assets/WithheldExtensionsNotice-quqWNbus.js +1 -0
- package/dist/client/assets/{WorkView-DxThzZ0w.js → WorkView-C_h8sclU.js} +1 -1
- package/dist/client/assets/_shell-D9q8zLfr.js +80 -0
- package/dist/client/assets/{_shell._home-CBNsPEH4.js → _shell._home-CrTxBB3h.js} +1 -1
- package/dist/client/assets/_shell._home.activity-2M0BJkbQ.js +1 -0
- package/dist/client/assets/_shell._home.index-BTJhhEWN.js +3 -0
- package/dist/client/assets/_shell._home.tasks-Dfrqv2nl.js +1 -0
- package/dist/client/assets/{_shell._home.workspaces-3R3VtH7x.js → _shell._home.workspaces-DPLQXDdH.js} +1 -1
- package/dist/client/assets/{_shell.channels-DRslcaiA.js → _shell.channels-CJqfUTZ1.js} +1 -1
- package/dist/client/assets/{_shell.connections-BPQxNUPD.js → _shell.connections-Cpe1hru3.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-DkXEk3qm.js → _shell.feedback-requests-BeWCqScf.js} +2 -2
- package/dist/client/assets/_shell.marketplace-CzLqm8iR.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DtraxnMx.js +1 -0
- package/dist/client/assets/_shell.session-72JEfodU.js +1 -0
- package/dist/client/assets/{_shell.team-CZu-l34d.js → _shell.team-EPvcS7RS.js} +3 -3
- package/dist/client/assets/{_shell.threads-Cz-EZQXr.js → _shell.threads-NJDzq9dv.js} +1 -1
- package/dist/client/assets/_shell.x._extensionId-CcJi8pKR.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-CcJi8pKR.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-4hI8_uRi.js → abnfDiagram-WEYOIA3C-DUHshdrR.js} +1 -1
- package/dist/client/assets/{access-copy-BegDAoeR.js → access-copy-DHfPjN3G.js} +1 -1
- package/dist/client/assets/{arc-DgydwPM5.js → arc-sP6zNsGB.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-4kexDkbn.js → architectureDiagram-ZHVYKT53-C8PTjsPx.js} +1 -1
- package/dist/client/assets/{banner-CYV5jQI0.js → banner-CVrzHqOT.js} +1 -1
- package/dist/client/assets/{blockDiagram-RJAE7QA3-BUP4L5_m.js → blockDiagram-RJAE7QA3-Cydde2fz.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-B4HK3S3o.js → c4Diagram-XDPPPE54-DbM6KAK7.js} +1 -1
- package/dist/client/assets/{card-6VNSI3kT.js → card-DA_Z-FYX.js} +1 -1
- package/dist/client/assets/channel-DMgpNBDz.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-Bhw5hCVI.js → chunk-2E7WHVMD-CEbspaNh.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-CeUgfCvO.js → chunk-2Q5K7J3B-DDP1SiE0.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-DqSZunXx.js → chunk-4EMNKR2T-BFjozJqd.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-Bigp9-bU.js → chunk-55XCU76K-0JSp6acZ.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-DF1L8DrH.js → chunk-5VM5RSS4-DswTXnmp.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-lcFap_43.js → chunk-JWPE2WC7-D0PYncYV.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-Bgmsy9NF.js → chunk-VQ5W62QI-r5T-ZVBs.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-DFFzLm_u.js → chunk-XXDRQBXY-D8kkjktE.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-B4aJwBdo.js → chunk-ZCHMQSOR-D6XtRzln.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-BdUAMGnS.js → classDiagram-v2-4MYWR3UA-DUPDMGfm.js} +1 -1
- package/dist/client/assets/{command-Dz2pZLle.js → command-BvXBgZfv.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-BdJxQmWe.js → cose-bilkent-JH36ORCC-tiQpE-Q8.js} +1 -1
- package/dist/client/assets/{cpu-CjKJ8pVl.js → cpu-mx7zDf7k.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-BvnDWKe0.js → cynefin-EF2NZ3EQ-BjAUxFfb.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-DKL8UyvS.js → cynefinDiagram-WF24UDRP-PmlyltXR.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-CCuJpxlY.js → dagre-NK4GIZVX-DDePjPkn.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-C1jeuv8r.js → diagram-CBK3MWTC-D7N3T4Fx.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-CSnTyOU0.js → diagram-I5XIIV2D-BfZHSbR2.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-9w6q1YKi.js → diagram-ODIL2UCW-sXAa9bzN.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-BMFBmD0P.js → diagram-PFBEJUXE-Dfd_61WO.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-D9Utl6qX.js → diagram-RJA3I4VV-BCzdEfnM.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-u_ogc51l.js → diagram-TYUNFSNR-BMqtz6sZ.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bg_smbFH.js → ebnfDiagram-V4P3TTPT-CyWj1615.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-CtuwbIK2.js → elk-QONTBCTQ-BkQMBXse.js} +1 -1
- package/dist/client/assets/{empty-state-CbFKhqwB.js → empty-state-Dv5iV4jb.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-MlvYHdZ7.js → erDiagram-KYQIGQAA-DiPsX7uU.js} +1 -1
- package/dist/client/assets/{execution-config-BjNjQoBp.js → execution-config-Bej0Ot8e.js} +1 -1
- package/dist/client/assets/{file-JokR8lB2.js → file-DXbyb23e.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-sl45DZYe.js → file-exclamation-point-C8XqHyzY.js} +1 -1
- package/dist/client/assets/{file-text-C4PxLfBm.js → file-text-CRTgqqkn.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Bc1LICCy.js → find-latest-widget-fence-D1i7qNny.js} +5 -5
- package/dist/client/assets/{flowDiagram-IUGLLWBU-BlrKbUnh.js → flowDiagram-IUGLLWBU-BSM44aJP.js} +1 -1
- package/dist/client/assets/{form-1NlezfMg.js → form-DYSiVEri.js} +1 -1
- package/dist/client/assets/{format-cron-C57sE3sK.js → format-cron-DYYwmo-o.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-BhCCQ-d7.js → ganttDiagram-R7GPNTJY-BWCjYexX.js} +1 -1
- package/dist/client/assets/{git-branch-BXEb1Sqq.js → git-branch-1zYKSuur.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-Chl1aqHg.js → gitGraphDiagram-PDYL7XHY-ULC7Zunc.js} +1 -1
- package/dist/client/assets/{graph-DIIpUxLd.js → graph-BsZzo5TN.js} +1 -1
- package/dist/client/assets/{heart-CUs7jdhV.js → heart-C4CSHUW7.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DlDHGjld.js → highlighted-body-KPVGNVTW-CFECg7iB.js} +1 -1
- package/dist/client/assets/{image-lightbox-BczXKBTZ.js → image-lightbox-M9t3Wulc.js} +1 -1
- package/dist/client/assets/{image-off-Ch98GGBJ.js → image-off-c01kxBAm.js} +1 -1
- package/dist/client/assets/{index-D6NjBiAq.js → index-B-7P1Q9s.js} +1 -1
- package/dist/client/assets/{index-BAnl5kwm.js → index-B3xeyV6n.js} +1 -1
- package/dist/client/assets/{index-DwrBsA10.js → index-B6Scr7KJ.js} +213 -213
- package/dist/client/assets/{index-Ev7FZl9a.js → index-BIVIHPoe.js} +1 -1
- package/dist/client/assets/{index-hyqRnlFg.js → index-BRH6C3LJ.js} +1 -1
- package/dist/client/assets/{index-CQTeDD0B.js → index-BScgHCO_.js} +1 -1
- package/dist/client/assets/{index-pQstFziR.js → index-BSxkprTm.js} +3 -3
- package/dist/client/assets/{index-DaZdDh7o.js → index-BTGRc0hC.js} +1 -1
- package/dist/client/assets/{index-CaVP52c1.js → index-BYY8HEOz.js} +1 -1
- package/dist/client/assets/{index-Cn1ZEy3S.js → index-B_he44rF.js} +1 -1
- package/dist/client/assets/{index-rKEUwjq8.js → index-BnXWm8Db.js} +1 -1
- package/dist/client/assets/{index-BQlnEL5t.js → index-BqwCOIbF.js} +1 -1
- package/dist/client/assets/{index-8FrM4Unx.js → index-Br35Gqfz.js} +1 -1
- package/dist/client/assets/{index-BC41bN42.js → index-C1XazYWZ.js} +1 -1
- package/dist/client/assets/{index-DMfV6rUz.js → index-C3swXqWW.js} +1 -1
- package/dist/client/assets/{index-B0p2_o3r.js → index-CAAsqmfP.js} +1 -1
- package/dist/client/assets/{index-DzLIbXMR.js → index-CAjKQnAd.js} +1 -1
- package/dist/client/assets/{index-vU7itvE8.js → index-Ce3HZQem.js} +1 -1
- package/dist/client/assets/{index-CnNGTb8f.js → index-CnltS8ym.js} +1 -1
- package/dist/client/assets/{index-ByIDaFWv.js → index-D847rJXW.js} +1 -1
- package/dist/client/assets/{index-CYhf-E_N.js → index-DG13Cp5o.js} +1 -1
- package/dist/client/assets/{index-CoHeCySh.js → index-DIDUjTkq.js} +1 -1
- package/dist/client/assets/{index-slBSiB-H.js → index-DQTTC52E.js} +1 -1
- package/dist/client/assets/{index-BiyMpL0z.js → index-DhYnXLRT.js} +1 -1
- package/dist/client/assets/{index-HnW-eS5i.js → index-DhkfALZp.js} +1 -1
- package/dist/client/assets/{index-BVjrgWDa.js → index-DhoaVQXu.js} +1 -1
- package/dist/client/assets/{index-D1Be28yK.js → index-DrENuQdJ.js} +1 -1
- package/dist/client/assets/{index-B0q1o1JU.js → index-DrQqkQq_.js} +1 -1
- package/dist/client/assets/{index-0MDZSAdr.js → index-DsasLE1l.js} +1 -1
- package/dist/client/assets/{index-CSOhBvPV.js → index-Dt7RONID.js} +1 -1
- package/dist/client/assets/{index-Czar7aPT.js → index-Du4HX97h.js} +2 -2
- package/dist/client/assets/{index-37h1E-65.js → index-DyN65ufd.js} +1 -1
- package/dist/client/assets/{index-BNJa5z6K.js → index-DzHj8lCz.js} +6 -6
- package/dist/client/assets/{index-BwHCH3tE.js → index-FwAvbbet.js} +1 -1
- package/dist/client/assets/{index-DlZ77Qfj.js → index-JG_0k1NX.js} +1 -1
- package/dist/client/assets/{index-BRyEtRBO.js → index-LpaxG4VS.js} +1 -1
- package/dist/client/assets/{index-D_9H4FdK.js → index-UJq1qaku.js} +1 -1
- package/dist/client/assets/{index-Cnjpi7ar.js → index-XEE1k4cl.js} +1 -1
- package/dist/client/assets/{index-BzqkXlms.js → index-YXyEu3Ia.js} +1 -1
- package/dist/client/assets/index-e6oawwKv.js +1 -0
- package/dist/client/assets/index-j30EyYIU.js +1 -0
- package/dist/client/assets/{index-Cw0QRsnv.js → index-jLIoULQt.js} +1 -1
- package/dist/client/assets/{index-CFJcOzPD.js → index-uLbyd6YP.js} +1 -1
- package/dist/client/assets/{index.esm-DM8Bqi3n.js → index.esm-CZ68Qd2t.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-C0p1eP9j.js → infoDiagram-MVDRKAX5-BCjhXqIT.js} +1 -1
- package/dist/client/assets/{inline-code-CNmpgW3O.js → inline-code-BKPMIXZR.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-COdxgYUT.js → ishikawaDiagram-HPEHV2GE-C9rsv2nh.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-C84Ny9n9.js → journeyDiagram-BOSHW7O7-BRYr1XL1.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-ECSXhFX0.js → kanban-definition-FNSA4HC5-2ey8FXEn.js} +1 -1
- package/dist/client/assets/{layers-JgRwJGyf.js → layers-DE3wjQuk.js} +1 -1
- package/dist/client/assets/{lightbulb-BhQB8sFP.js → lightbulb-BXJIRUdm.js} +1 -1
- package/dist/client/assets/{link-2-B4byjdgg.js → link-2-DzWm9OxA.js} +1 -1
- package/dist/client/assets/{list-runtime-types-M5_gxIg1.js → list-runtime-types-BhkZkTrB.js} +1 -1
- package/dist/client/assets/{markdown-content-C3qWcii6.js → markdown-content-Bk9lCksw.js} +1 -1
- package/dist/client/assets/{mention-pill-DUbgdKmA.js → mention-pill-os_7QQu2.js} +1 -1
- package/dist/client/assets/{mermaid.core-BQiwaVjZ.js → mermaid.core-BcRUBvZd.js} +4 -4
- package/dist/client/assets/{message-square-off-AjtFFe_u.js → message-square-off-DuOiETNI.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-BfA6EqgP.js → mindmap-definition-6OY57UG3-DBhXkS2i.js} +1 -1
- package/dist/client/assets/{more-details-itSF4Fah.js → more-details-Bt9nlPmS.js} +1 -1
- package/dist/client/assets/{owner-notice-B6JRjE_c.js → owner-notice-4ZSBxa2K.js} +1 -1
- package/dist/client/assets/{package-5YQSitlR.js → package-BmOMrNwc.js} +1 -1
- package/dist/client/assets/{page-container-DBPUOYYM.js → page-container-LomhzyuS.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-Kwb3zKa6.js → pane-resize-handle-BOtzx5Q4.js} +1 -1
- package/dist/client/assets/{paperclip-IRKZTEQw.js → paperclip-C1tkiT74.js} +1 -1
- package/dist/client/assets/{path-input-BHkA4fFw.js → path-input-JHTlL97W.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-CqIy9WDe.js → pegDiagram-ECIUJNBX-B01fb3t0.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-C5yI3cvV.js → pieDiagram-GNMPY74T-BJ7JYrTk.js} +1 -1
- package/dist/client/assets/{plug-CupdBXaG.js → plug-CsqfQsYq.js} +1 -1
- package/dist/client/assets/{primer-trigger-Ci_XRRfX.js → primer-trigger-DLdK7lVr.js} +2 -2
- package/dist/client/assets/{profile-errors-aEsWNifs.js → profile-errors-CpvSy5wY.js} +1 -1
- package/dist/client/assets/{progress-Bpmb837n.js → progress-qB87L0zJ.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-DyCDNvk7.js → quadrantDiagram-D57K4MC3-mJYGGmOV.js} +1 -1
- package/dist/client/assets/{query-error-state-s6AJaHa3.js → query-error-state-MyJ1ivia.js} +1 -1
- package/dist/client/assets/{radio-Ci6Ghks8.js → radio-DJV7l0fv.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-B3u1B937.js → railroadDiagram-Y72NRBL7-BlXWwQe2.js} +1 -1
- package/dist/client/assets/registry-BrjQCdmG.js +1 -0
- package/dist/client/assets/{registry-NGfn1R2_.js → registry-tJrGs7kB.js} +4 -4
- package/dist/client/assets/{relay-trace-schemas-hOFIzdY-.js → relay-trace-schemas-TH0-GYCB.js} +2 -2
- package/dist/client/assets/{repeat-B1S2ceC2.js → repeat-CBnopqBr.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-CdG-unip.js → requirementDiagram-EQYSW5RA-Dqr1Y74x.js} +1 -1
- package/dist/client/assets/{room-files-source-J7gnN1gx.js → room-files-source-BFo0FEUP.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-7Q2akPFi.js → rotate-ccw-clock-D9XRHj5E.js} +1 -1
- package/dist/client/assets/{rotate-cw-DK3Rzmlh.js → rotate-cw-DNa7ENG3.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-D3Z4Qk2b.js → sankeyDiagram-SY24JHO5-DGYZs_kW.js} +1 -1
- package/dist/client/assets/{scroll-area-6Gelypei.js → scroll-area-Bf6IGziJ.js} +1 -1
- package/dist/client/assets/search-x-DFBBEouE.js +6 -0
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-RXPgeLr6.js → sequenceDiagram-BLEHNHQU-BW3u4L9y.js} +1 -1
- package/dist/client/assets/{shield-x-D8lJ0Op0.js → shield-x-WGxwrtNV.js} +1 -1
- package/dist/client/assets/{signed-in-NOeTLLso.js → signed-in-eV4_EXuv.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-q7qki1pK.js → sizeCapture-INFHLROL-C1TpueOu.js} +1 -1
- package/dist/client/assets/{soul-file-DTEcjDxP.js → soul-file-e1iYX9IV.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DFs6IVbj.js → stateDiagram-v2-A6IESKWZ-DvrHUauN.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-D1A-3JE-.js → swimlanes-B3ENRKFQ-BUbTcoId.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-wkooBe_N.js +8 -0
- package/dist/client/assets/{table-CuBPM_bg.js → table-DsxLk3Gx.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-CLHy0rAb.js → timeline-definition-JXYKGLGB-CzbVpGxn.js} +1 -1
- package/dist/client/assets/{trust-posture-BXXe8F8n.js → trust-posture-Blofy7eE.js} +1 -1
- package/dist/client/assets/{unplug-Cuej6sM6.js → unplug-B6dUhqA7.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-BbK4SCJp.js → unverified-catalog-notice-6pwZtIjx.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Cy7ENVZN.js → use-adapter-catalog-J43bUHJu.js} +1 -1
- package/dist/client/assets/{use-bindings-Tj0BcF4m.js → use-bindings-BgXZ0D7k.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-BrQVpwRi.js → use-composer-prefs--zO2mm_M.js} +1 -1
- package/dist/client/assets/{use-connector-management-CLZQXgln.js → use-connector-management-9Q7wHb06.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-BeqtUhj2.js → use-deep-link-scroll-CXqwdwGr.js} +1 -1
- package/dist/client/assets/{use-delete-binding-d7ii9iFQ.js → use-delete-binding-BBQNMtUY.js} +1 -1
- package/dist/client/assets/{use-dev-links-MYOV3h2q.js → use-dev-links-C643CCcq.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-C_lXDYnB.js → use-direct-message-panel-BD_daG2E.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-kMFSEJGV.js → use-external-adapter-catalog-BjbC1V6t.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-MFSkvnza.js → use-full-activity-feed-DUH8r8jx.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-DAZnwJGB.js +1 -0
- package/dist/client/assets/{use-local-browser-1oVtlmXD.js → use-local-browser-P93oA-F5.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-BJs6M6kh.js → use-mesh-topology-B0k0gLoW.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-DitdlmSI.js → use-mounted-ref-DE7EQsBF.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-CXbRTRLF.js → use-notification-prefs-B8JtshQ0.js} +1 -1
- package/dist/client/assets/use-pending-read-DeGO1wGC.js +1 -0
- package/dist/client/assets/{use-personality-commit-DQrWyVGT.js → use-personality-commit-Dh5Sejj_.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CgdBHk2f.js → use-promo-activation-C9FWA7ru.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-DprcDmfs.js → use-promo-dismissals-BIfafj9f.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BtMzHCs3.js → use-pulse-freshness-CxzVMmVK.js} +1 -1
- package/dist/client/assets/{use-relay-config-CGBlgXC2.js → use-relay-config-DQE3dmJ2.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-Db5U7kWT.js → use-room-follow-claim-B1QPFaUb.js} +1 -1
- package/dist/client/assets/{use-room-sessions-K6mdH-Tb.js → use-room-sessions-CdjzO67_.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-B2zxa_F_.js → use-roving-tab-list-Nu-MIapD.js} +1 -1
- package/dist/client/assets/{use-session-canvas-D4G5fO_a.js → use-session-canvas-BfKGOpNy.js} +8 -8
- package/dist/client/assets/{use-status-budget-UccdTZ7o.js → use-status-budget-DgeTxC3h.js} +3 -3
- package/dist/client/assets/{use-transform-BBj2pwbo.js → use-transform-CiJqtMBf.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-BidDnyt8.js → use-unclaimed-chats-Blkq6U4D.js} +1 -1
- package/dist/client/assets/use-update-config-BFFW_6Mc.js +1 -0
- package/dist/client/assets/{useMutationState-RYxTf1aD.js → useMutationState-lbcdmnfE.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Bjmcc2gK.js → usecaseDiagram-WPOLBNNX-BM36oESm.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Cd6C9CxW.js → vennDiagram-Q3Y3IDCW-Zrybcs91.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-CzWWmwUL.js → wardleyDiagram-IVAIDKWA-CO4pzGG0.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-DSUn9rhA.js → xychartDiagram-4URNHDU4-pi_wF1CM.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +70428 -68011
- package/dist/server/index.js.map +2 -2
- package/package.json +4 -4
- package/dist/client/assets/ApplyToOverridesDialog-C-XL9N4W.js +0 -1
- package/dist/client/assets/HandlePage-BH_G4sMV.js +0 -1
- package/dist/client/assets/NamePage-CaJsVRhh.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-BRKAQS0D.js +0 -1
- package/dist/client/assets/PermissionsPage-C2pB1TCJ.js +0 -1
- package/dist/client/assets/PhotoPage-33Xh8sq1.js +0 -1
- package/dist/client/assets/_shell-CX_gaQPE.js +0 -80
- package/dist/client/assets/_shell._home.activity-DpSGWVSW.js +0 -1
- package/dist/client/assets/_shell._home.index-BWH93iWg.js +0 -3
- package/dist/client/assets/_shell._home.tasks-Ive4UW8c.js +0 -1
- package/dist/client/assets/_shell.marketplace-D8deZF5L.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BHG9MqWR.js +0 -1
- package/dist/client/assets/_shell.session-CkdA2hgF.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-Cry6E5KK.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-Cry6E5KK.js +0 -1
- package/dist/client/assets/channel-Bf4e4rlX.js +0 -1
- package/dist/client/assets/index-BThp0Av1.js +0 -1
- package/dist/client/assets/index-Dv6HjbCS.js +0 -1
- package/dist/client/assets/registry-DatwH4jj.js +0 -1
- package/dist/client/assets/search-x-Be8VetKs.js +0 -6
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-hZFkkqUb.js +0 -8
- package/dist/client/assets/use-is-below-desktop-CJJ4zMQO.js +0 -1
- package/dist/client/assets/use-pending-read-CvX1lOb8.js +0 -1
- package/dist/client/assets/use-update-config-D8g4P42J.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
2
|
-
var E7=Object.defineProperty;var S1=r=>{throw TypeError(r)};var D7=(r,e,t)=>e in r?E7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ce=(r,e,t)=>D7(r,typeof e!="symbol"?e+"":e,t),nd=(r,e,t)=>e.has(r)||S1("Cannot "+t);var C=(r,e,t)=>(nd(r,e,"read from private field"),t?t.call(r):e.get(r)),_=(r,e,t)=>e.has(r)?S1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(nd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Wi=(r,e,t)=>(nd(r,e,"access private method"),t);import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-BcRUBvZd.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css","assets/transform-BqqRT-Iy.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var E7=Object.defineProperty;var S1=r=>{throw TypeError(r)};var D7=(r,e,t)=>e in r?E7(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ce=(r,e,t)=>D7(r,typeof e!="symbol"?e+"":e,t),nd=(r,e,t)=>e.has(r)||S1("Cannot "+t);var C=(r,e,t)=>(nd(r,e,"read from private field"),t?t.call(r):e.get(r)),_=(r,e,t)=>e.has(r)?S1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),F=(r,e,t,n)=>(nd(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),Wi=(r,e,t)=>(nd(r,e,"access private method"),t);import{p_ as C1,p$ as O7,q0 as _2,q1 as gh,q2 as R7,q3 as I7,q4 as z7,r as R,R as j2,et as bc,q5 as yh,q6 as vh,q7 as qs,q8 as M1,q9 as V2,qa as L7,qb as ol,qc as al,qd as T1,qe as es,qf as B7,qg as P7,qh as F7,qi as f0,qj as W2,qk as Ua,gC as q7,ql as $7,qm as ns,qn as Tr,qo as Ui,qp as Hc,qq as je,f4 as H7,qr as _7,qs as j7,qt as Wr,qu as tu,qv as Mi,qw as U2,qx as A1,j as L,ha as V7,G as W7,aZ as U7}from"./index-B6Scr7KJ.js";import{p as zf}from"./index-DsasLE1l.js";import{aw as K7,ax as G7,ab as J7,ac as Y7,ad as X7,ae as Z7,af as Q7,ag as K2,ah as eb,q as p0,ai as tb,aj as G2,ar as rb,ak as nb,al as ib,am as sb,an as ob,ao as ab,ap as lb,aq as cb,Z as Lf,a4 as ub,a5 as J2,a6 as db,a7 as hb,a8 as fb,a9 as pb,aa as mb,m as gb,a as yb,ay as vb,E as Fa,as as bb,t as ht,n as wb,at as kb,C as N1,az as xb}from"./index-BSxkprTm.js";const Sb={}.hasOwnProperty;function Y2(r,e){let t=-1,n;if(e.extensions)for(;++t<e.extensions.length;)Y2(r,e.extensions[t]);for(n in e)if(Sb.call(e,n))switch(n){case"extensions":break;case"unsafe":{E1(r[n],e[n]);break}case"join":{E1(r[n],e[n]);break}case"handlers":{Cb(r[n],e[n]);break}default:r.options[n]=e[n]}return r}function E1(r,e){e&&r.push(...e)}function Cb(r,e){e&&Object.assign(r,e)}const Mb=[Tb];function Tb(r,e,t,n){if(e.type==="code"&&C1(e,n)&&(r.type==="list"||r.type===e.type&&C1(r,n)))return!1;if("spread"in t&&typeof t.spread=="boolean")return r.type==="paragraph"&&(r.type===e.type||e.type==="definition"||e.type==="heading"&&O7(e,n))?void 0:t.spread?1:0}const Ki=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],Ab=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
|
|
3
3
|
`,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:Ki},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
|
|
4
4
|
]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:Ki},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
|
|
5
5
|
*])`},{character:"*",inConstruct:"phrasing",notInConstruct:Ki},{atBreak:!0,character:"+",after:`(?:[ \r
|
|
@@ -1228,4 +1228,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1228
1228
|
fill: hsl(var(--muted-foreground)) !important;
|
|
1229
1229
|
stroke: hsl(var(--muted-foreground)) !important;
|
|
1230
1230
|
}
|
|
1231
|
-
`,hz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:dz},fz=()=>U7(()=>import("./mermaid.core-
|
|
1231
|
+
`,hz={look:"classic",fontFamily:"var(--font-sans)",themeCSS:dz},fz=()=>U7(()=>import("./mermaid.core-BcRUBvZd.js").then(r=>r.bm),__vite__mapDeps([0,1,2,3])).then(r=>(r.default.initialize(hz),r));function pz({value:r,editable:e,onChange:t,className:n,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l}){const c=V7();return L.jsx("div",{"data-theme":c,className:"dorkos-markdown contents",children:L.jsx(cz,{value:r,theme:c,editable:e,onChange:t,sourceRevision:i,onSourceReady:s,onSourceSelection:o,onTaskToggleRequest:a,wikiLinks:l,mermaid:fz,className:W7("desktop:select-text",n)})})}const bz=Object.freeze(Object.defineProperty({__proto__:null,BlintzCanvas:pz},Symbol.toStringTag,{value:"Module"}));export{bz as B,G0 as S,nD as a,rD as b,sD as c,UE as f,J0 as i,Iv as p,wv as r,J4 as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f4 as Ee,a1 as xe,aY as Re,r as ve,a2 as Se,j,G as Ce}from"./index-B6Scr7KJ.js";import{u as Oe}from"./index-JG_0k1NX.js";import{r as Te}from"./use-session-canvas-BfKGOpNy.js";import"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";var he={exports:{}};/* @license
|
|
2
2
|
Papa Parse
|
|
3
3
|
v5.7.0
|
|
4
4
|
https://github.com/mholt/PapaParse
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-
|
|
2
|
-
import{r as a,aY as z,h5 as ce,j as t,G as O,f$ as oe,g0 as le,B as D,g1 as ue,g2 as de,g3 as Z,h6 as fe,dj as he,dk as pe,J as me,gf as ve,dl as xe,a3 as ge,h7 as be,aZ as ee,a1 as ye,h8 as je,a2 as Ce}from"./index-DwrBsA10.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-D4G5fO_a.js";import{R as Te}from"./rotate-cw-DK3Rzmlh.js";import"./query-keys-DeYqUDia.js";import"./index.esm-DM8Bqi3n.js";import"./WidgetErrorCard-DictdlWO.js";import"./index-BAnl5kwm.js";import"./card-6VNSI3kT.js";import"./progress-Bpmb837n.js";import"./markdown-content-C3qWcii6.js";import"./table-CuBPM_bg.js";import"./package-5YQSitlR.js";import"./heart-CUs7jdhV.js";import"./git-branch-BXEb1Sqq.js";import"./file-text-C4PxLfBm.js";import"./file-JokR8lB2.js";import"./McpAppFrame-1mPdRK9p.js";import"./more-details-itSF4Fah.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function X({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(Z,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(Z,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(X,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(X,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-BM1ANude.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-D9ZLEDXc.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),Y=a.useRef(C),$=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,Y.current=C});const V=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=$.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),Y.current(!1)}},[r,y,$]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},J=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),W=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&J&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:J}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:W,editable:s,onChange:s?V:void 0,wikiLinks:c})}):t.jsx(Ee,{value:W,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?V:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BtNgazuc.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css","assets/index-BIVIHPoe.js","assets/index-BSxkprTm.js","assets/BlintzCanvas-BCtfZPrs.js","assets/index-DsasLE1l.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as a,aY as z,h7 as ce,j as t,G as O,g1 as oe,g2 as le,B as D,g3 as ue,g4 as de,g5 as Z,h8 as fe,dl as he,dm as pe,J as me,gh as ve,dn as xe,a3 as ge,h9 as be,aZ as ee,a1 as ye,ha as je,a2 as Ce}from"./index-B6Scr7KJ.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-BfKGOpNy.js";import{R as Te}from"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function X({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(Z,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(Z,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(X,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(X,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-BtNgazuc.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-BCtfZPrs.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),Y=a.useRef(C),V=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,Y.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=V.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),Y.current(!1)}},[r,y,V]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},J=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),W=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&J&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:J}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:W,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:W,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
|
package/dist/client/assets/{CanvasModel3dContent-D783Ql7m.js → CanvasModel3dContent-vR6ze4IR.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-
|
|
2
|
-
import{a1 as m,aY as n,r as s,j as t,aZ as p}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-DedBFHsl.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a1 as m,aY as n,r as s,j as t,aZ as p}from"./index-B6Scr7KJ.js";import{r as u}from"./use-session-canvas-BfKGOpNy.js";import"./rotate-cw-DNa7ENG3.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CZ68Qd2t.js";import"./WidgetErrorCard-BA3P7hNv.js";import"./index-B3xeyV6n.js";import"./card-DA_Z-FYX.js";import"./progress-qB87L0zJ.js";import"./markdown-content-Bk9lCksw.js";import"./table-DsxLk3Gx.js";import"./package-BmOMrNwc.js";import"./heart-C4CSHUW7.js";import"./git-branch-1zYKSuur.js";import"./file-text-CRTgqqkn.js";import"./file-DXbyb23e.js";import"./McpAppFrame-4JDJsrmg.js";import"./more-details-Bt9nlPmS.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-DedBFHsl.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{O as F,r as i,j as l,B as ue,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-XEE1k4cl.js","assets/index-B6Scr7KJ.js","assets/index-CujX3mpY.css","assets/room-files-source-BFo0FEUP.js","assets/markdown-content-Bk9lCksw.js","assets/file-exclamation-point-C8XqHyzY.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-JG_0k1NX.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-DNa7ENG3.js","assets/link-2-DzWm9OxA.js","assets/file-DXbyb23e.js","assets/git-branch-1zYKSuur.js","assets/more-details-Bt9nlPmS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{O as F,r as i,j as l,B as ue,h4 as bn,mS as vn,g as kn,k1 as wn,G as te,a1 as fe,a3 as De,a4 as Pe,aP as H,cj as Fe,ck as Nn,cZ as In,mT as Rn,ly as Cn,mU as An,h as Mn,ax as jn,cq as Le,gw as se,q as Z,a7 as Be,s as pe,lY as Sn,mV as _n,mC as On,mW as En,eS as Tn,g9 as $n,e3 as Dn,mQ as Pn,mX as Fn,mY as Ln,a0 as Bn,bx as Un,mZ as Hn,m_ as Kn,jr as Wn,iq as qn,gB as Vn,kS as Ne,m$ as Ue,bW as zn,kR as Q,kV as He,n0 as Gn,ci as ge,ai as Jn,b_ as he,ij as Ke,n1 as Yn,cu as We,n2 as Qn,ff as Xn,ki as qe,n3 as Ve,aZ as Zn,gy as ze,kU as et,n4 as Ge,n5 as nt,n6 as tt,n7 as st,n8 as Ie,eU as ot,n9 as at,na as rt,nb as it,nc as ct,nd as lt,ne as dt,l as ut,hh as mt,ar as Je,kJ as ft,aj as pt,nf as gt,ng as ht,nh as xt,b8 as yt,c6 as bt,ni as vt,nj as kt,nk as wt,nl as Nt,by as Re,f3 as It}from"./index-B6Scr7KJ.js";import{g as Ce,m as Ae,h as xe,f as Ye,M as Rt,a as Ct,E as At,i as Mt,j as jt,c as P,k as St,b as _t,l as Ot,u as Et,C as Tt}from"./registry-tJrGs7kB.js";import"./WidgetErrorCard-BA3P7hNv.js";import{R as $t,A as Qe}from"./repeat-CBnopqBr.js";import{u as Dt}from"./use-room-sessions-CdjzO67_.js";import{M as Pt}from"./markdown-content-Bk9lCksw.js";import{W as Ft,a as Lt}from"./find-latest-widget-fence-D1i7qNny.js";import{f as Bt}from"./format-duration-BCr6uzby.js";import{H as Ut,a as Ht,b as Kt}from"./RuntimeSetupDialog-DPU4QIY9.js";import{M as Me}from"./mention-pill-os_7QQu2.js";import{R as Wt}from"./rotate-ccw-clock-D9XRHj5E.js";import{U as qt}from"./unplug-B6dUhqA7.js";import{M as Vt}from"./message-square-off-DuOiETNI.js";import{i as zt}from"./registry-BrjQCdmG.js";/**
|
|
3
3
|
* @license lucide-react v1.48.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -39,6 +39,6 @@ import{O as F,r as i,j as l,B as ue,h2 as bn,mQ as vn,g as kn,j$ as wn,G as te,a
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const es=F(an),ns='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ts(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(ns);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ss({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function os({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const as=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:_,contentHandlers:O}=ts({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ut,{open:I,onOpenChange:b,openDelay:as,children:[l.jsx(Ht,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:_}:{},children:t}),l.jsxs(Kt,{ref:j,...O,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ss,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Bt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(os,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function rs(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function is(e){return W(e)??e.id}function cs(e,t){return Math.max(t??0,e)}function zo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:cs(e.length,s),lastAt:n.createdAt,unread:o}}function ls(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ds({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=ls({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function us(e){return l.jsx(Lt,{code:e.code,isIncomplete:e.isIncomplete})}const ms=[{language:Ft,component:us}],fs={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:es,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Qe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Qt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:zt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Gt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:On},cascade_stopped:{Icon:_n},addressing_changed:{Icon:Yt},bridge_blocked:{Icon:qt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Zt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Jt},bridge_agent_swapped:{Icon:$t},bridge_history_note:{Icon:Wt}},ps={Icon:Un},le=80;function gs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function hs(e,t,s){const n=xs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function xs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function ys({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&fs[e.body.notice])??ps;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":gs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?hs(e.body.text,n,o):e.body.text})]})}const bs=Vt.moment;function vs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(bs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function ks(e,t){const s=Q.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
-
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function ws({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=is(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Wn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Xt,run:()=>{zn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:qn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Vn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Qe,run:()=>{ks(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function Ns(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Vo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Go(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Is(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Jo(e){const t=new Set;for(const a of e)W(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Rs(e){return`thread-${e}`}function Cs(e){return`thread-row-${e}`}function Yo(e){return`thread-panel-entry-${e}`}function As(e){return`room-entry-${e}`}function Ms(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:As(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:Rs(n),domId:Cs(n)}:o}function Qo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ms(e,s.id)}const Se=48;function Xo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function js(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Jn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ss(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const _s={info:new Map,faces:new Map},be=i.createContext(_s);function Zo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function ea(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>js(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>Ss(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function Os(){return i.useContext(be).faces}function Es({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const X=120,Ts="code block";function $s(e){if(e.length<=X&&!e.includes("```"))return null;const t=Ds(e);return t.length===0?null:t}function Ds(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ts} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=X)return t;const s=Ps(t,X),n=s.lastIndexOf(" ");return`${(n>X/2?s.slice(0,n):s).trimEnd()}…`}function Ps(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Fs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=rs(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ls({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Bs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Yn.includes(n),a=Dt(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Qn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Xn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Us={[ne]:[ve]},Hs=[ne];function Ks(e,t){if(!t||t.length===0)return e;const s=Ws(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function Ws(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const qs=new Map,rn=i.createContext(qs);function zs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function Vs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const _e=new WeakMap;function Gs(e){const t=_e.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return _e.set(e,s),s}function Js(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Gs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Js(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ds,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ys={kind:"human",displayName:""};function Qs(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xs({authorId:e,children:t}){const s=Vs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?ze(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Ys,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Qs(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Zs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Xs,{authorId:n,children:t.children})}}}function eo({entry:e,authors:t}){const s=i.useMemo(()=>Ks(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Zs(n),[n]);return l.jsx(zs,{authors:t,children:l.jsx(Pt,{content:s,className:"msg-prose",allowedTags:Us,literalTagContent:Hs,components:o,renderers:ms})})}function no(e){return function(s){return l.jsx(eo,{entry:s,authors:e})}}const ln="the top folder";function Oe(e){return e.slice(e.lastIndexOf("/")+1)}function to(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function so(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:so(to(e.paths[0]??""))}function oo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Oe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Oe(s)} from the chat to ${de(e)}`}}const ao=i.lazy(()=>Zn(()=>import("./index-Cnjpi7ar.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(t.createdAt),h=i.useMemo(()=>{const L=$s(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Fs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),_=ee(n==null?void 0:n.agentRef),{open:O}=qe(),k=n===void 0?void 0:ze(n,_==null?void 0:_.memberId),D=i.useCallback(()=>{k!==void 0&&O(k)},[O,k]),T=k===void 0?void 0:D,q=ws({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),z=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:z,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,z,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Ls({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>no(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(ao,{roomId:e,attachment:L})}),[e]),hn=Os(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),xn=Bs(e,t),re=Ns(t);if(re.kind==="notice")return l.jsx(ys,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(vs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Is(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:V&&{runtime:V.runtime,...V.model&&{model:V.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,...Es({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(St,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:oo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const ta={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ro(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function sa(e){const{room:t,threadRootId:s}=e,n=_t(),o=Ot(),a=ro((t==null?void 0:t.id)??""),r=t!==void 0&&Ve(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),_=await I.uploadAndGetIds();I.clearFiles(b);const O=y.parentEntryId??N;if(O!==void 0){C.mutate({roomId:A.id,rootEntryId:O,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function io(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function co(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:io(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function lo(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[J(t[lo(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function uo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function mo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function fo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function po({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=uo(n),g=[...a.map(Ee),...t.filter(u=>fo(u,s)).map(co)].sort(d);return{items:mo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const go=3,ho=rt;function xo({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*go,ho),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>po({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const yo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const bo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(bo)}function vo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=We(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=xo({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,yo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,_=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),O=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),z=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:_,handleBlur:k,handlePointerDown:O,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:z}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function ko({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function wo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function No({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(ko,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(wo,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},Io=["people","agents"];function Ro(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Co(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ao(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ao(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Mo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const jo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function So({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Io}){var O;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Ro(e,t),[e,t]),f=i.useMemo(()=>o?Co(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(jo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Mo(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),_=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:_,rows:f,selectedIndex:y,activeDescendantId:o&&((O=f[y])==null?void 0:O.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function _o({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function oa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=Et(),g=kt(),u=wt(r),x=i.useRef(null),v=Ve(e.members,e.viewerAuthorId),f=i.useRef(!1),m=So({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=vo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>Q.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=Q.getState().take(r).trim();if(b==="")return;const _=a.pendingFiles.length>0;_&&(f.current=!0),d.send({text:b}).catch(()=>{const O=Q.getState(),k=O.drafts[r]??"";O.set(r,k===""?b:`${b}
|
|
44
|
-
${k}`)}).finally(()=>{_&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Tt.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(_o,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(No,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Zo as A,oa as C,ye as I,ta as R,
|
|
42
|
+
*/const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const es=F(an),ns='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ts(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(ns);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ss({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function os({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const as=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:_,contentHandlers:O}=ts({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ut,{open:I,onOpenChange:b,openDelay:as,children:[l.jsx(Ht,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:_}:{},children:t}),l.jsxs(Kt,{ref:j,...O,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ss,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Bt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(os,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function rs(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function is(e){return W(e)??e.id}function cs(e,t){return Math.max(t??0,e)}function Vo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:cs(e.length,s),lastAt:n.createdAt,unread:o}}function ls(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ds({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=ls({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function us(e){return l.jsx(Lt,{code:e.code,isIncomplete:e.isIncomplete})}const ms=[{language:Ft,component:us}],fs={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:es,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Qe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Qt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:Vt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Gt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:On},cascade_stopped:{Icon:_n},addressing_changed:{Icon:Yt},bridge_blocked:{Icon:qt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Zt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Jt},bridge_agent_swapped:{Icon:$t},bridge_history_note:{Icon:Wt}},ps={Icon:Un},le=80;function gs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function hs(e,t,s){const n=xs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function xs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function ys({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&fs[e.body.notice])??ps;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":gs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?hs(e.body.text,n,o):e.body.text})]})}const bs=zt.moment;function vs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(bs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function ks(e,t){const s=Q.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
+
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function ws({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=is(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Wn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Xt,run:()=>{Vn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:qn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:zn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Qe,run:()=>{ks(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function Ns(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function zo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Go(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Is(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Jo(e){const t=new Set;for(const a of e)W(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Rs(e){return`thread-${e}`}function Cs(e){return`thread-row-${e}`}function Yo(e){return`thread-panel-entry-${e}`}function As(e){return`room-entry-${e}`}function Ms(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:As(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:Rs(n),domId:Cs(n)}:o}function Qo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ms(e,s.id)}const Se=48;function Xo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function js(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Jn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ss(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const _s={info:new Map,faces:new Map},be=i.createContext(_s);function Zo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function ea(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>js(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>Ss(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function Os(){return i.useContext(be).faces}function Es({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const X=120,Ts="code block";function $s(e){if(e.length<=X&&!e.includes("```"))return null;const t=Ds(e);return t.length===0?null:t}function Ds(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ts} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=X)return t;const s=Ps(t,X),n=s.lastIndexOf(" ");return`${(n>X/2?s.slice(0,n):s).trimEnd()}…`}function Ps(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Fs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=rs(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ls({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Bs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Yn.includes(n),a=Dt(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Qn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Xn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Us={[ne]:[ve]},Hs=[ne];function Ks(e,t){if(!t||t.length===0)return e;const s=Ws(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function Ws(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const qs=new Map,rn=i.createContext(qs);function Vs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function zs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const _e=new WeakMap;function Gs(e){const t=_e.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return _e.set(e,s),s}function Js(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Gs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Js(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ds,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ys={kind:"human",displayName:""};function Qs(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xs({authorId:e,children:t}){const s=zs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?Ve(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Ys,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Qs(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Zs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Xs,{authorId:n,children:t.children})}}}function eo({entry:e,authors:t}){const s=i.useMemo(()=>Ks(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Zs(n),[n]);return l.jsx(Vs,{authors:t,children:l.jsx(Pt,{content:s,className:"msg-prose",allowedTags:Us,literalTagContent:Hs,components:o,renderers:ms})})}function no(e){return function(s){return l.jsx(eo,{entry:s,authors:e})}}const ln="the top folder";function Oe(e){return e.slice(e.lastIndexOf("/")+1)}function to(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function so(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:so(to(e.paths[0]??""))}function oo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Oe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Oe(s)} from the chat to ${de(e)}`}}const ao=i.lazy(()=>Zn(()=>import("./index-XEE1k4cl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(t.createdAt),h=i.useMemo(()=>{const L=$s(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Fs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),_=ee(n==null?void 0:n.agentRef),{open:O}=qe(),k=n===void 0?void 0:Ve(n,_==null?void 0:_.memberId),D=i.useCallback(()=>{k!==void 0&&O(k)},[O,k]),T=k===void 0?void 0:D,q=ws({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),V=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:V,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,V,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Ls({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>no(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(ao,{roomId:e,attachment:L})}),[e]),hn=Os(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),z=ee(E==null?void 0:E.agentRef),xn=Bs(e,t),re=Ns(t);if(re.kind==="notice")return l.jsx(ys,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(vs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Is(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:z&&{runtime:z.runtime,...z.model&&{model:z.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,...Es({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(St,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:oo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const ta={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ro(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function sa(e){const{room:t,threadRootId:s}=e,n=_t(),o=Ot(),a=ro((t==null?void 0:t.id)??""),r=t!==void 0&&ze(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),_=await I.uploadAndGetIds();I.clearFiles(b);const O=y.parentEntryId??N;if(O!==void 0){C.mutate({roomId:A.id,rootEntryId:O,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function io(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function co(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:io(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function lo(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[J(t[lo(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function uo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function mo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function fo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function po({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=uo(n),g=[...a.map(Ee),...t.filter(u=>fo(u,s)).map(co)].sort(d);return{items:mo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const go=3,ho=rt;function xo({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*go,ho),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>po({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const yo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const bo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(bo)}function vo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=We(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=xo({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,yo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,_=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),O=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),V=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:_,handleBlur:k,handlePointerDown:O,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:V}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function ko({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function wo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function No({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(ko,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(wo,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},Io=["people","agents"];function Ro(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Co(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ao(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ao(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Mo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const jo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function So({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Io}){var O;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Ro(e,t),[e,t]),f=i.useMemo(()=>o?Co(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(jo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Mo(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),_=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:_,rows:f,selectedIndex:y,activeDescendantId:o&&((O=f[y])==null?void 0:O.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function _o({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function oa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=Et(),g=kt(),u=wt(r),x=i.useRef(null),v=ze(e.members,e.viewerAuthorId),f=i.useRef(!1),m=So({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=vo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>Q.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=Q.getState().take(r).trim();if(b==="")return;const _=a.pendingFiles.length>0;_&&(f.current=!0),d.send({text:b}).catch(()=>{const O=Q.getState(),k=O.drafts[r]??"";O.set(r,k===""?b:`${b}
|
|
44
|
+
${k}`)}).finally(()=>{_&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Tt.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(_o,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(No,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Zo as A,oa as C,ye as I,ta as R,zo as a,na as b,Is as c,Go as d,ea as e,Xo as f,Jo as g,Rs as h,cs as i,Vo as j,Cs as k,As as l,Ms as m,Yo as n,Qo as o,K as p,is as r,W as t,sa as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as m,a1 as x,aY as k,r as v,j as t,B as d,G as p,a7 as y}from"./index-
|
|
1
|
+
import{O as m,a1 as x,aY as k,r as v,j as t,B as d,G as p,a7 as y}from"./index-B6Scr7KJ.js";import{u as O}from"./use-update-config-BFFW_6Mc.js";import{I as R}from"./inline-code-BKPMIXZR.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as J,r as T}from"./index-DwrBsA10.js";import{R as lt}from"./index-Ev7FZl9a.js";import{o as Q,E as B,q as ne,C as Ge,S as G,r as Ne,u as Fe,v as st,w as H,x as M,F as Ve,R as N,W as Y,G as oe,y as ot,z as at,A as je,B as Ie,H as ft,V as dt,m as ht,n as ct}from"./index-pQstFziR.js";class v{constructor(e,n,l,i){this.fromA=e,this.toA=n,this.fromB=l,this.toB=i}offset(e,n=e){return new v(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function y(t,e,n,l,i,r){if(t==l)return[];let s=fe(t,e,n,l,i,r),o=de(t,e+s,n,l,i+s,r);e+=s,n-=o,i+=s,r-=o;let f=n-e,h=r-i;if(!f||!h)return[new v(e,n,i,r)];if(f>h){let d=t.slice(e,n).indexOf(l.slice(i,r));if(d>-1)return[new v(e,e+d,i,i),new v(e+d+h,n,r,r)]}else if(h>f){let d=l.slice(i,r).indexOf(t.slice(e,n));if(d>-1)return[new v(e,e,i,i+d),new v(n,n,i+d+f,r)]}if(f==1||h==1)return[new v(e,n,i,r)];let a=He(t,e,n,l,i,r);if(a){let[d,c,u]=a;return y(t,e,d,l,i,c).concat(y(t,d+u,n,l,c+u,r))}return ut(t,e,n,l,i,r)}let I=1e9,U=0,ae=!1;function ut(t,e,n,l,i,r){let s=n-e,o=r-i;if(I<1e9&&Math.min(s,o)>I*16||U>0&&Date.now()>U)return Math.min(s,o)>I*64?[new v(e,n,i,r)]:ge(t,e,n,l,i,r);let f=Math.ceil((s+o)/2);ee.reset(f),te.reset(f);let h=(u,m)=>t.charCodeAt(e+u)==l.charCodeAt(i+m),a=(u,m)=>t.charCodeAt(n-u-1)==l.charCodeAt(r-m-1),d=(s-o)%2!=0?te:null,c=d?null:ee;for(let u=0;u<f;u++){if(u>I||U>0&&!(u&63)&&Date.now()>U)return ge(t,e,n,l,i,r);let m=ee.advance(u,s,o,f,d,!1,h)||te.advance(u,s,o,f,c,!0,a);if(m)return mt(t,e,n,e+m[0],l,i,r,i+m[1])}return[new v(e,n,i,r)]}class Ue{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,l,i,r,s,o){for(let f=-e+this.start;f<=e-this.end;f+=2){let h=i+f,a=f==-e||f!=e&&this.vec[h-1]<this.vec[h+1]?this.vec[h+1]:this.vec[h-1]+1,d=a-f;for(;a<n&&d<l&&o(a,d);)a++,d++;if(this.vec[h]=a,a>n)this.end+=2;else if(d>l)this.start+=2;else if(r){let c=i+(n-l)-f;if(c>=0&&c<this.len&&r.vec[c]!=-1)if(s){let u=r.vec[c];if(u>=n-a)return[u,i+u-c]}else{let u=n-r.vec[c];if(a>=u)return[a,d]}}}return null}}const ee=new Ue,te=new Ue;function mt(t,e,n,l,i,r,s,o){let f=!1;return!F(t,l)&&++l==n&&(f=!0),!F(i,o)&&++o==s&&(f=!0),f?[new v(e,n,r,s)]:y(t,e,l,i,r,o).concat(y(t,l,n,i,o,s))}function We(t,e){let n=1,l=Math.min(t,e);for(;n<l;)n=n<<1;return n}function fe(t,e,n,l,i,r){if(e==n||e==r||t.charCodeAt(e)!=l.charCodeAt(i))return 0;let s=We(n-e,r-i);for(let o=e,f=i;;){let h=o+s,a=f+s;if(h>n||a>r||t.slice(o,h)!=l.slice(f,a)){if(s==1)return o-e-(F(t,o)?0:1);s=s>>1}else{if(h==n||a==r)return h-e;o=h,f=a}}}function de(t,e,n,l,i,r){if(e==n||i==r||t.charCodeAt(n-1)!=l.charCodeAt(r-1))return 0;let s=We(n-e,r-i);for(let o=n,f=r;;){let h=o-s,a=f-s;if(h<e||a<i||t.slice(h,o)!=l.slice(a,f)){if(s==1)return n-o-(F(t,o)?0:1);s=s>>1}else{if(h==e||a==i)return n-h;o=h,f=a}}}function re(t,e,n,l,i,r,s,o){let f=l.slice(i,r),h=null;for(;;){if(h||s<o)return h;for(let a=e+s;;){F(t,a)||a++;let d=a+s;if(F(t,d)||(d+=d==a+1?1:-1),d>=n)break;let c=t.slice(a,d),u=-1;for(;(u=f.indexOf(c,u+1))!=-1;){let m=fe(t,d,n,l,i+u+c.length,r),p=de(t,e,a,l,i,i+u),g=c.length+m+p;(!h||h[2]<g)&&(h=[a-p,i+u-p,g])}a=d}if(o<0)return h;s=s>>1}}function He(t,e,n,l,i,r){let s=n-e,o=r-i;if(s<o){let f=He(l,i,r,t,e,n);return f&&[f[1],f[0],f[2]]}return s<4||o*2<s?null:re(t,e,n,l,i,r,Math.floor(s/4),-1)}function ge(t,e,n,l,i,r){ae=!0;let s=n-e,o=r-i,f;if(s<o){let c=re(l,i,r,t,e,n,Math.floor(s/6),50);f=c&&[c[1],c[0],c[2]]}else f=re(t,e,n,l,i,r,Math.floor(o/6),50);if(!f)return[new v(e,n,i,r)];let[h,a,d]=f;return y(t,e,h,l,i,a).concat(y(t,h+d,n,l,a+d,r))}function ze(t,e){for(let n=1;n<t.length;n++){let l=t[n-1],i=t[n];l.toA>i.fromA-e&&l.toB>i.fromB-e&&(t[n-1]=new v(l.fromA,i.toA,l.fromB,i.toB),t.splice(n--,1))}}function gt(t,e,n){for(;;){ze(n,1);let l=!1;for(let i=0;i<n.length;i++){let r=n[i],s,o;(s=fe(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA+s,r.toA,r.fromB+s,r.toB)),(o=de(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA,r.toA-o,r.fromB,r.toB-o));let f=r.toA-r.fromA,h=r.toB-r.fromB;if(f&&h)continue;let a=r.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:t.length)-r.toA;if(!a||!d)continue;let c=f?t.slice(r.fromA,r.toA):e.slice(r.fromB,r.toB);a<=c.length&&t.slice(r.fromA-a,r.fromA)==c.slice(c.length-a)?(n[i]=new v(r.fromA-a,r.toA-a,r.fromB-a,r.toB-a),l=!0):d<=c.length&&t.slice(r.toA,r.toA+d)==c.slice(0,d)&&(n[i]=new v(r.fromA+d,r.toA+d,r.fromB+d,r.toB+d),l=!0)}if(!l)break}return n}function pt(t,e,n){for(let l=0,i=0;i<t.length;i++){let r=t[i],s=r.toA-r.fromA,o=r.toB-r.fromB;if(s&&o||s>3||o>3){let f=i==t.length-1?e.length:t[i+1].fromA,h=r.fromA-l,a=f-r.toA,d=Ce(e,r.fromA,h),c=pe(e,r.toA,a),u=r.fromA-d,m=c-r.toA;if((!s||!o)&&u&&m){let p=Math.max(s,o),[g,C,S]=s?[e,r.fromA,r.toA]:[n,r.fromB,r.toB];p>u&&e.slice(d,r.fromA)==g.slice(S-u,S)?(r=t[i]=new v(d,d+s,r.fromB-u,r.toB-u),d=r.fromA,c=pe(e,r.toA,f-r.toA)):p>m&&e.slice(r.toA,c)==g.slice(C,C+m)&&(r=t[i]=new v(c-s,c,r.fromB+m,r.toB+m),c=r.toA,d=Ce(e,r.fromA,r.fromA-l)),u=r.fromA-d,m=c-r.toA}if(u||m)r=t[i]=new v(r.fromA-u,r.toA+m,r.fromB-u,r.toB+m);else if(s){if(!o){let p=Ae(e,r.fromA,r.toA),g,C=p<0?-1:ve(e,r.toA,r.fromA);p>-1&&(g=p-r.fromA)<=a&&e.slice(r.fromA,p)==e.slice(r.toA,r.toA+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toA-C)<=h&&e.slice(r.fromA-g,r.fromA)==e.slice(C,r.toA)&&(r=t[i]=r.offset(-g))}}else{let p=Ae(n,r.fromB,r.toB),g,C=p<0?-1:ve(n,r.toB,r.fromB);p>-1&&(g=p-r.fromB)<=a&&n.slice(r.fromB,p)==n.slice(r.toB,r.toB+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toB-C)<=h&&n.slice(r.fromB-g,r.fromB)==n.slice(C,r.toB)&&(r=t[i]=r.offset(-g))}}l=r.toA}return ze(t,3),t}let E;try{E=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Pe(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function qe(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Pe(n)?1:0:E?!Je(n)||e==t.length-1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e,e+2))?2:0:0}function _e(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Pe(n)?1:0:E?!Ke(n)||e==1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e-2,e))?2:0:0}const $e=8;function pe(t,e,n){if(e==t.length||!_e(t,e))return e;for(let l=e,i=e+n,r=0;r<$e;r++){let s=qe(t,l);if(!s||l+s>i)return l;l+=s}return e}function Ce(t,e,n){if(!e||!qe(t,e))return e;for(let l=e,i=e-n,r=0;r<$e;r++){let s=_e(t,l);if(!s||l-s<i)return l;l-=s}return e}function ve(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Ae(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Je=t=>t>=55296&&t<=56319,Ke=t=>t>=56320&&t<=57343;function F(t,e){return!e||e==t.length||!Je(t.charCodeAt(e-1))||!Ke(t.charCodeAt(e))}function Ct(t,e,n){var l;let i=n==null?void 0:n.override;return i?i(t,e):(I=((l=n==null?void 0:n.scanLimit)!==null&&l!==void 0?l:1e9)>>1,U=n!=null&&n.timeout?Date.now()+n.timeout:0,ae=!1,gt(t,e,y(t,0,t.length,e,0,e.length)))}function Qe(){return!ae}function Ye(t,e,n){return pt(Ct(t,e,n),t,e)}const b=Ve.define({combine:t=>t[0]}),ie=G.define(),Ze=Ve.define(),k=H.define({create(t){return null},update(t,e){for(let n of e.effects)n.is(ie)&&(t=n.value);for(let n of e.state.facet(Ze))t=n(t,e);return t}});function vt(t){let e=t.field(k,!1);if(!e)return null;let n=t.facet(b);return{chunks:e,side:n?n.side:null}}class O{constructor(e,n,l,i,r,s=!0){this.changes=e,this.fromA=n,this.toA=l,this.fromB=i,this.toB=r,this.precise=s}offset(e,n){return e||n?new O(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,l){let i=Ye(e.toString(),n.toString(),l);return Xe(i,e,n,0,0,Qe())}static updateA(e,n,l,i,r){return be(Be(e,i,!0,l.length),e,n,l,r)}static updateB(e,n,l,i,r){return be(Be(e,i,!1,n.length),e,n,l,r)}}function xe(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.to==t&&r.to==e&&t<n.length&&e<l.length?[t+1,e+1]:[i.from,r.from]}function we(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.from==t&&r.from==e?[t,e]:[i.to+1,r.to+1]}function Xe(t,e,n,l,i,r){let s=[];for(let o=0;o<t.length;o++){let f=t[o],[h,a]=xe(f.fromA+l,f.fromB+i,e,n),[d,c]=we(f.toA+l,f.toB+i,e,n),u=[f.offset(-h+l,-a+i)];for(;o<t.length-1;){let m=t[o+1],[p,g]=xe(m.fromA+l,m.fromB+i,e,n);if(p>d+1&&g>c+1)break;u.push(m.offset(-h+l,-a+i)),[d,c]=we(m.toA+l,m.toB+i,e,n),o++}s.push(new O(u,h,Math.max(h,d),a,Math.max(a,c),r))}return s}const z=1e3;function ke(t,e,n,l){let i=0,r=t.length;for(;;){if(i==r){let a=0,d=0;i&&({toA:a,toB:d}=t[i-1]);let c=e-(n?a:d);return[a+c,d+c]}let s=i+r>>1,o=t[s],[f,h]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(f>e)r=s;else if(h<=e)i=s+1;else return l?[o.fromA,o.fromB]:[o.toA,o.toB]}}function Be(t,e,n,l){let i=[];return e.iterChangedRanges((r,s,o,f)=>{let h=0,a=n?e.length:l,d=0,c=n?l:e.length;r>z&&([h,d]=ke(t,r-z,n,!0)),s<e.length-z&&([a,c]=ke(t,s+z,n,!1));let u=f-o-(s-r),m,[p,g]=n?[u,0]:[0,u];i.length&&(m=i[i.length-1]).toA>=h?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:a,toB:c,diffA:m.diffA+p,diffB:m.diffB+g}:i.push({fromA:h,toA:a,fromB:d,toB:c,diffA:p,diffB:g})}),i}function be(t,e,n,l,i){if(!t.length)return e;let r=[];for(let s=0,o=0,f=0,h=0;;s++){let a=s==t.length?null:t[s],d=a?a.fromA+o:n.length,c=a?a.fromB+f:l.length;for(;h<e.length;){let g=e[h];if(a&&(g.toA+o>d||g.toB+f>c))break;r.push(g.offset(o,f)),h++}if(!a)break;let u=a.toA+o+a.diffA,m=a.toB+f+a.diffB,p=Ye(n.sliceString(d,u),l.sliceString(c,m),i);for(let g of Xe(p,n,l,d,c,Qe()))r.push(g);for(o+=a.diffA,f+=a.diffB;h<e.length;){let g=e[h];if(g.fromA+o>u&&g.fromB+f>m)break;h++}}return r}const et={scanLimit:500},Z=dt.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Le(t))}update(t){(t.docChanged||t.viewportChanged||At(t.startState,t.state)||xt(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Le(t.view))}},{decorations:t=>t.deco}),P=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty}}));function At(t,e){return t.field(k,!1)!=e.field(k,!1)}function xt(t,e){return t.facet(b)!=e.facet(b)}const Me=M.line({class:"cm-changedLine"}),tt=M.mark({class:"cm-changedText"}),wt=M.mark({tagName:"ins",class:"cm-insertedLine"}),kt=M.mark({tagName:"del",class:"cm-deletedLine"}),De=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Bt(t,e,n,l,i,r){let s=n?t.fromA:t.fromB,o=n?t.toA:t.toB,f=0;if(s!=o){i.add(s,s,Me),i.add(s,o,n?kt:wt),r&&r.add(s,s,De);for(let h=e.iterRange(s,o-1),a=s;!h.next().done;){if(h.lineBreak){a++,i.add(a,a,Me),r&&r.add(a,a,De);continue}let d=a+h.value.length;if(l)for(;f<t.changes.length;){let c=t.changes[f],u=s+(n?c.fromA:c.fromB),m=s+(n?c.toA:c.toB),p=Math.max(a,u),g=Math.min(d,m);if(p<g&&i.add(p,g,tt),m<d)f++;else break}a=d}}}function Le(t){let e=t.state.field(k),{side:n,highlightChanges:l,markGutter:i,overrideChunk:r}=t.state.facet(b),s=n=="a",o=new N,f=i?new N:null,{from:h,to:a}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=a)break;(s?d.toA:d.toB)>h&&(!r||!r(t.state,d,o,f))&&Bt(d,t.state.doc,s,l,o,f)}return{deco:o.finish(),gutter:f&&f.finish()}}class q extends Y{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const K=G.define({map:(t,e)=>t.map(e)}),W=H.define({create:()=>M.none,update:(t,e)=>{for(let n of e.effects)if(n.is(K))return n.value;return t.map(e.changes)},provide:t=>B.decorations.from(t)}),_=.01;function Se(t,e){if(t.size!=e.size)return!1;let n=t.iter(),l=e.iter();for(;n.value;){if(n.from!=l.from||Math.abs(n.value.spec.widget.height-l.value.spec.widget.height)>1)return!1;n.next(),l.next()}return!0}function bt(t,e,n){let l=new N,i=new N,r=t.state.field(W).iter(),s=e.state.field(W).iter(),o=0,f=0,h=0,a=0,d=t.viewport,c=e.viewport;for(let g=0;;g++){let C=g<n.length?n[g]:null,S=C?C.fromA:t.state.doc.length,R=C?C.fromB:e.state.doc.length;if(o<S){let x=t.lineBlockAt(o).top+h,D=e.lineBlockAt(f).top+a,w=x-D;w<-_?(h-=w,l.add(o,o,M.widget({widget:new q(-w),block:!0,side:-1}))):w>_&&(a+=w,i.add(f,f,M.widget({widget:new q(w),block:!0,side:-1})))}if(S>o+1e3&&o<d.from&&S>d.from&&f<c.from&&R>c.from){let x=Math.min(d.from-o,c.from-f);o+=x,f+=x,g--}else if(C)o=C.toA,f=C.toB;else break;for(;r.value&&r.from<o;)h-=r.value.spec.widget.height,r.next();for(;s.value&&s.from<f;)a-=s.value.spec.widget.height,s.next()}for(;r.value;)h-=r.value.spec.widget.height,r.next();for(;s.value;)a-=s.value.spec.widget.height,s.next();let u=t.contentHeight+h-(e.contentHeight+a);u<_?l.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new q(-u),block:!0,side:1})):u>_&&i.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new q(u),block:!0,side:1}));let m=l.finish(),p=i.finish();Se(m,t.state.field(W))||t.dispatch({effects:K.of(m)}),Se(p,e.state.field(W))||e.dispatch({effects:K.of(p)})}const le=G.define({map:(t,e)=>e.mapPos(t)});class Mt extends Y{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",l=>{let i=e.posAtDOM(l.target);e.dispatch({effects:le.of(i)});let{side:r,sibling:s}=e.state.facet(b);s&&s().dispatch({effects:le.of(Dt(i,e.state.field(k),r=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Dt(t,e,n){let l=0,i=0;for(let r=0;;r++){let s=r<e.length?e[r]:null;if(!s||(n?s.fromA:s.fromB)>=t)return i+(t-l);[l,i]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const Lt=H.define({create(t){return M.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(le)&&(t=t.update({filter:l=>l!=n.value}));if(t.size&&e.state.field(k)!=e.startState.field(k,!1)){let n=e.state.facet(b).side=="a",l=[];for(let i of e.state.field(k))t.between(n?i.fromA:i.fromB,n?i.toA:i.toB,r=>{l.push(r)});l.length&&(t=t.update({filter:i=>l.indexOf(i)<0}))}return t},provide:t=>B.decorations.from(t)});function se({margin:t=3,minSize:e=4}){return Lt.init(n=>St(n,t,e))}function St(t,e,n){let l=new N,i=t.facet(b).side=="a",r=t.field(k),s=1;for(let o=0;;o++){let f=o<r.length?r[o]:null,h=o?s+e:1,a=f?t.doc.lineAt(i?f.fromA:f.fromB).number-1-e:t.doc.lines,d=a-h+1;if(d>=n&&l.add(t.doc.line(h).from,t.doc.line(a).to,M.replace({widget:new Mt(d),block:!0})),!f)break;s=t.doc.lineAt(Math.min(t.doc.length,i?f.toA:f.toB)).number}return l.finish()}const Ot=B.styleModule.of(new st({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),nt=B.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Oe=new Ge,$=new Ge;class Et{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||et;let n=[Q.low(Z),nt,Ot,W,B.updateListener.of(d=>{this.measuring<0&&(d.heightChanged||d.viewportChanged)&&!d.transactions.some(c=>c.effects.some(u=>u.is(K)))&&this.measure()})],l=[b.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&l.push(P);let i=ne.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],B.editorAttributes.of({class:"cm-merge-a"}),$.of(l),n]}),r=[b.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(P);let s=ne.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],B.editorAttributes.of({class:"cm-merge-b"}),$.of(r),n]});this.chunks=O.build(i.doc,s.doc,this.diffConf);let o=[k.init(()=>this.chunks),Oe.of(e.collapseUnchanged?se(e.collapseUnchanged):[])];i=i.update({effects:G.appendConfig.of(o)}).state,s=s.update({effects:G.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let f=e.orientation||"a-b",h=document.createElement("div");h.className="cm-mergeViewEditor";let a=document.createElement("div");a.className="cm-mergeViewEditor",this.editorDOM.appendChild(f=="a-b"?h:a),this.editorDOM.appendChild(f=="a-b"?a:h),this.a=new B({state:i,parent:h,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.a)}),this.b=new B({state:s,parent:a,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(l=>l.docChanged)){let l=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Ne.empty(e[0].startState.doc.length));this.chunks=n==this.a?O.updateA(this.chunks,l.newDoc,this.b.state.doc,i,this.diffConf):O.updateB(this.chunks,this.a.state.doc,l.newDoc,i,this.diffConf),n.update([...e,l.state.update({effects:ie.of(this.chunks)})]);let r=n==this.a?this.b:this.a;r.update([r.state.update({effects:ie.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let r=e.orientation!="b-a";if(r!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(r?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(r?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let r=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(r=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(r,s,o)}let n="highlightChanges"in e,l="gutter"in e,i="collapseUnchanged"in e;if(n||l||i){let r=[],s=[];if(n||l){let o=this.a.state.facet(b),f=l?e.gutter!==!1:o.markGutter,h=n?e.highlightChanges!==!1:o.highlightChanges;r.push($.reconfigure([b.of({side:"a",sibling:()=>this.b,highlightChanges:h,markGutter:f}),f?P:[]])),s.push($.reconfigure([b.of({side:"b",sibling:()=>this.a,highlightChanges:h,markGutter:f}),f?P:[]]))}if(i){let o=Oe.reconfigure(e.collapseUnchanged?se(e.collapseUnchanged):[]);r.push(o),s.push(o)}this.a.dispatch({effects:r}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,l){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=l,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bt(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,l=this.a.viewport,i=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let s=this.chunks[r];if(s.fromA>l.to||s.fromB>i.to)break;if(s.fromA<l.from||s.fromB<i.from)continue;let o=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<r;)n=Ee(n);n&&n.dataset.chunk==String(r)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):e.insertBefore(this.renderRevertButton(o,r),n)}for(;n;)n=Ee(n)}renderRevertButton(e,n){let l;if(this.renderRevert)l=this.renderRevert();else{l=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");l.setAttribute("aria-label",i),l.setAttribute("title",i),l.textContent=this.revertToLeft?"⇜":"⇝"}return l.style.top=e,l.setAttribute("data-chunk",String(n)),l}revertClicked(e){let n=e.target,l;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(l=this.chunks[n.dataset.chunk])){let[i,r,s,o,f,h]=this.revertToA?[this.b,this.a,l.fromB,l.toB,l.fromA,l.toA]:[this.a,this.b,l.fromA,l.toA,l.fromB,l.toB],a=i.state.sliceDoc(s,Math.max(s,o-1));s!=o&&h<=r.state.doc.length&&(a+=i.state.lineBreak),r.dispatch({changes:{from:f,to:Math.min(r.state.doc.length,h),insert:a},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Ee(t){let e=t.nextSibling;return t.remove(),e}const yt=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Rt=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty},widgetMarker:(t,e)=>e instanceof rt?yt:null}));function Tt(t){var e;let n=typeof t.original=="string"?Fe.of(t.original.split(/\r?\n/)):t.original,l=t.diffConfig||et;return[Q.low(Z),Vt,nt,B.editorAttributes.of({class:"cm-merge-b"}),Ze.of((i,r)=>{let s=r.effects.find(o=>o.is(he));return s&&(i=O.updateA(i,s.value.doc,r.startState.doc,s.value.changes,l)),r.docChanged&&(i=O.updateB(i,r.state.field(V),r.newDoc,r.changes,l)),i}),b.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(e=t.mergeControls)!==null&&e!==void 0?e:!0,overrideChunk:t.allowInlineDiffs?Wt:void 0,side:"b"}),V.init(()=>n),t.gutter!==!1?Rt:[],t.collapseUnchanged?se(t.collapseUnchanged):[],k.init(i=>O.build(n,i.doc,l))]}const he=G.define(),V=H.define({create:()=>Fe.empty,update(t,e){for(let n of e.effects)n.is(he)&&(t=n.value.doc);return t}}),ye=new WeakMap;class rt extends Y{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||(this.dom=this.buildDOM(e))}}function Gt(t,e,n){let l=ye.get(e.changes);if(l)return l;let i=s=>{let{highlightChanges:o,syntaxHighlightDeletions:f,syntaxHighlightDeletionsMaxLength:h,mergeControls:a}=t.facet(b),d=document.createElement("div");if(d.className="cm-deletedChunk",a){let x=d.appendChild(document.createElement("div"));x.className="cm-chunkButtons";let D=A=>{A.preventDefault(),Nt(s,s.posAtDOM(d))},w=A=>{A.preventDefault(),Ft(s,s.posAtDOM(d))};if(typeof a=="function")x.appendChild(a("accept",D)),x.appendChild(a("reject",w));else{let A=x.appendChild(document.createElement("button"));A.name="accept",A.textContent=t.phrase("Accept"),A.onmousedown=D;let L=x.appendChild(document.createElement("button"));L.name="reject",L.textContent=t.phrase("Reject"),L.onmousedown=w}}if(n||e.fromA>=e.toA)return d;let c=s.state.field(V).sliceString(e.fromA,e.endA),u=f&&t.facet(ot),m=S(),p=e.changes,g=0,C=!1;function S(){let x=d.appendChild(document.createElement("div"));return x.className="cm-deletedLine",x.appendChild(document.createElement("del"))}function R(x,D,w){for(let A=x;A<D;){if(c.charAt(A)==`
|
|
1
|
+
import{j as J,r as T}from"./index-B6Scr7KJ.js";import{R as lt}from"./index-BIVIHPoe.js";import{o as Q,E as B,q as ne,C as Ge,S as G,r as Ne,u as Fe,v as st,w as H,x as M,F as Ve,R as N,W as Y,G as oe,y as ot,z as at,A as je,B as Ie,H as ft,V as dt,m as ht,n as ct}from"./index-BSxkprTm.js";class v{constructor(e,n,l,i){this.fromA=e,this.toA=n,this.fromB=l,this.toB=i}offset(e,n=e){return new v(this.fromA+e,this.toA+e,this.fromB+n,this.toB+n)}}function y(t,e,n,l,i,r){if(t==l)return[];let s=fe(t,e,n,l,i,r),o=de(t,e+s,n,l,i+s,r);e+=s,n-=o,i+=s,r-=o;let f=n-e,h=r-i;if(!f||!h)return[new v(e,n,i,r)];if(f>h){let d=t.slice(e,n).indexOf(l.slice(i,r));if(d>-1)return[new v(e,e+d,i,i),new v(e+d+h,n,r,r)]}else if(h>f){let d=l.slice(i,r).indexOf(t.slice(e,n));if(d>-1)return[new v(e,e,i,i+d),new v(n,n,i+d+f,r)]}if(f==1||h==1)return[new v(e,n,i,r)];let a=He(t,e,n,l,i,r);if(a){let[d,c,u]=a;return y(t,e,d,l,i,c).concat(y(t,d+u,n,l,c+u,r))}return ut(t,e,n,l,i,r)}let I=1e9,U=0,ae=!1;function ut(t,e,n,l,i,r){let s=n-e,o=r-i;if(I<1e9&&Math.min(s,o)>I*16||U>0&&Date.now()>U)return Math.min(s,o)>I*64?[new v(e,n,i,r)]:ge(t,e,n,l,i,r);let f=Math.ceil((s+o)/2);ee.reset(f),te.reset(f);let h=(u,m)=>t.charCodeAt(e+u)==l.charCodeAt(i+m),a=(u,m)=>t.charCodeAt(n-u-1)==l.charCodeAt(r-m-1),d=(s-o)%2!=0?te:null,c=d?null:ee;for(let u=0;u<f;u++){if(u>I||U>0&&!(u&63)&&Date.now()>U)return ge(t,e,n,l,i,r);let m=ee.advance(u,s,o,f,d,!1,h)||te.advance(u,s,o,f,c,!0,a);if(m)return mt(t,e,n,e+m[0],l,i,r,i+m[1])}return[new v(e,n,i,r)]}class Ue{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let n=0;n<this.len;n++)this.vec[n]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,n,l,i,r,s,o){for(let f=-e+this.start;f<=e-this.end;f+=2){let h=i+f,a=f==-e||f!=e&&this.vec[h-1]<this.vec[h+1]?this.vec[h+1]:this.vec[h-1]+1,d=a-f;for(;a<n&&d<l&&o(a,d);)a++,d++;if(this.vec[h]=a,a>n)this.end+=2;else if(d>l)this.start+=2;else if(r){let c=i+(n-l)-f;if(c>=0&&c<this.len&&r.vec[c]!=-1)if(s){let u=r.vec[c];if(u>=n-a)return[u,i+u-c]}else{let u=n-r.vec[c];if(a>=u)return[a,d]}}}return null}}const ee=new Ue,te=new Ue;function mt(t,e,n,l,i,r,s,o){let f=!1;return!F(t,l)&&++l==n&&(f=!0),!F(i,o)&&++o==s&&(f=!0),f?[new v(e,n,r,s)]:y(t,e,l,i,r,o).concat(y(t,l,n,i,o,s))}function We(t,e){let n=1,l=Math.min(t,e);for(;n<l;)n=n<<1;return n}function fe(t,e,n,l,i,r){if(e==n||e==r||t.charCodeAt(e)!=l.charCodeAt(i))return 0;let s=We(n-e,r-i);for(let o=e,f=i;;){let h=o+s,a=f+s;if(h>n||a>r||t.slice(o,h)!=l.slice(f,a)){if(s==1)return o-e-(F(t,o)?0:1);s=s>>1}else{if(h==n||a==r)return h-e;o=h,f=a}}}function de(t,e,n,l,i,r){if(e==n||i==r||t.charCodeAt(n-1)!=l.charCodeAt(r-1))return 0;let s=We(n-e,r-i);for(let o=n,f=r;;){let h=o-s,a=f-s;if(h<e||a<i||t.slice(h,o)!=l.slice(a,f)){if(s==1)return n-o-(F(t,o)?0:1);s=s>>1}else{if(h==e||a==i)return n-h;o=h,f=a}}}function re(t,e,n,l,i,r,s,o){let f=l.slice(i,r),h=null;for(;;){if(h||s<o)return h;for(let a=e+s;;){F(t,a)||a++;let d=a+s;if(F(t,d)||(d+=d==a+1?1:-1),d>=n)break;let c=t.slice(a,d),u=-1;for(;(u=f.indexOf(c,u+1))!=-1;){let m=fe(t,d,n,l,i+u+c.length,r),p=de(t,e,a,l,i,i+u),g=c.length+m+p;(!h||h[2]<g)&&(h=[a-p,i+u-p,g])}a=d}if(o<0)return h;s=s>>1}}function He(t,e,n,l,i,r){let s=n-e,o=r-i;if(s<o){let f=He(l,i,r,t,e,n);return f&&[f[1],f[0],f[2]]}return s<4||o*2<s?null:re(t,e,n,l,i,r,Math.floor(s/4),-1)}function ge(t,e,n,l,i,r){ae=!0;let s=n-e,o=r-i,f;if(s<o){let c=re(l,i,r,t,e,n,Math.floor(s/6),50);f=c&&[c[1],c[0],c[2]]}else f=re(t,e,n,l,i,r,Math.floor(o/6),50);if(!f)return[new v(e,n,i,r)];let[h,a,d]=f;return y(t,e,h,l,i,a).concat(y(t,h+d,n,l,a+d,r))}function ze(t,e){for(let n=1;n<t.length;n++){let l=t[n-1],i=t[n];l.toA>i.fromA-e&&l.toB>i.fromB-e&&(t[n-1]=new v(l.fromA,i.toA,l.fromB,i.toB),t.splice(n--,1))}}function gt(t,e,n){for(;;){ze(n,1);let l=!1;for(let i=0;i<n.length;i++){let r=n[i],s,o;(s=fe(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA+s,r.toA,r.fromB+s,r.toB)),(o=de(t,r.fromA,r.toA,e,r.fromB,r.toB))&&(r=n[i]=new v(r.fromA,r.toA-o,r.fromB,r.toB-o));let f=r.toA-r.fromA,h=r.toB-r.fromB;if(f&&h)continue;let a=r.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:t.length)-r.toA;if(!a||!d)continue;let c=f?t.slice(r.fromA,r.toA):e.slice(r.fromB,r.toB);a<=c.length&&t.slice(r.fromA-a,r.fromA)==c.slice(c.length-a)?(n[i]=new v(r.fromA-a,r.toA-a,r.fromB-a,r.toB-a),l=!0):d<=c.length&&t.slice(r.toA,r.toA+d)==c.slice(0,d)&&(n[i]=new v(r.fromA+d,r.toA+d,r.fromB+d,r.toB+d),l=!0)}if(!l)break}return n}function pt(t,e,n){for(let l=0,i=0;i<t.length;i++){let r=t[i],s=r.toA-r.fromA,o=r.toB-r.fromB;if(s&&o||s>3||o>3){let f=i==t.length-1?e.length:t[i+1].fromA,h=r.fromA-l,a=f-r.toA,d=Ce(e,r.fromA,h),c=pe(e,r.toA,a),u=r.fromA-d,m=c-r.toA;if((!s||!o)&&u&&m){let p=Math.max(s,o),[g,C,S]=s?[e,r.fromA,r.toA]:[n,r.fromB,r.toB];p>u&&e.slice(d,r.fromA)==g.slice(S-u,S)?(r=t[i]=new v(d,d+s,r.fromB-u,r.toB-u),d=r.fromA,c=pe(e,r.toA,f-r.toA)):p>m&&e.slice(r.toA,c)==g.slice(C,C+m)&&(r=t[i]=new v(c-s,c,r.fromB+m,r.toB+m),c=r.toA,d=Ce(e,r.fromA,r.fromA-l)),u=r.fromA-d,m=c-r.toA}if(u||m)r=t[i]=new v(r.fromA-u,r.toA+m,r.fromB-u,r.toB+m);else if(s){if(!o){let p=Ae(e,r.fromA,r.toA),g,C=p<0?-1:ve(e,r.toA,r.fromA);p>-1&&(g=p-r.fromA)<=a&&e.slice(r.fromA,p)==e.slice(r.toA,r.toA+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toA-C)<=h&&e.slice(r.fromA-g,r.fromA)==e.slice(C,r.toA)&&(r=t[i]=r.offset(-g))}}else{let p=Ae(n,r.fromB,r.toB),g,C=p<0?-1:ve(n,r.toB,r.fromB);p>-1&&(g=p-r.fromB)<=a&&n.slice(r.fromB,p)==n.slice(r.toB,r.toB+g)?r=t[i]=r.offset(g):C>-1&&(g=r.toB-C)<=h&&n.slice(r.fromB-g,r.fromB)==n.slice(C,r.toB)&&(r=t[i]=r.offset(-g))}}l=r.toA}return ze(t,3),t}let E;try{E=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch{}function Pe(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function qe(t,e){if(e==t.length)return 0;let n=t.charCodeAt(e);return n<192?Pe(n)?1:0:E?!Je(n)||e==t.length-1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e,e+2))?2:0:0}function _e(t,e){if(!e)return 0;let n=t.charCodeAt(e-1);return n<192?Pe(n)?1:0:E?!Ke(n)||e==1?E.test(String.fromCharCode(n))?1:0:E.test(t.slice(e-2,e))?2:0:0}const $e=8;function pe(t,e,n){if(e==t.length||!_e(t,e))return e;for(let l=e,i=e+n,r=0;r<$e;r++){let s=qe(t,l);if(!s||l+s>i)return l;l+=s}return e}function Ce(t,e,n){if(!e||!qe(t,e))return e;for(let l=e,i=e-n,r=0;r<$e;r++){let s=_e(t,l);if(!s||l-s<i)return l;l-=s}return e}function ve(t,e,n){for(;e!=n;e--)if(t.charCodeAt(e-1)==10)return e;return-1}function Ae(t,e,n){for(;e!=n;e++)if(t.charCodeAt(e)==10)return e;return-1}const Je=t=>t>=55296&&t<=56319,Ke=t=>t>=56320&&t<=57343;function F(t,e){return!e||e==t.length||!Je(t.charCodeAt(e-1))||!Ke(t.charCodeAt(e))}function Ct(t,e,n){var l;let i=n==null?void 0:n.override;return i?i(t,e):(I=((l=n==null?void 0:n.scanLimit)!==null&&l!==void 0?l:1e9)>>1,U=n!=null&&n.timeout?Date.now()+n.timeout:0,ae=!1,gt(t,e,y(t,0,t.length,e,0,e.length)))}function Qe(){return!ae}function Ye(t,e,n){return pt(Ct(t,e,n),t,e)}const b=Ve.define({combine:t=>t[0]}),ie=G.define(),Ze=Ve.define(),k=H.define({create(t){return null},update(t,e){for(let n of e.effects)n.is(ie)&&(t=n.value);for(let n of e.state.facet(Ze))t=n(t,e);return t}});function vt(t){let e=t.field(k,!1);if(!e)return null;let n=t.facet(b);return{chunks:e,side:n?n.side:null}}class O{constructor(e,n,l,i,r,s=!0){this.changes=e,this.fromA=n,this.toA=l,this.fromB=i,this.toB=r,this.precise=s}offset(e,n){return e||n?new O(this.changes,this.fromA+e,this.toA+e,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,n,l){let i=Ye(e.toString(),n.toString(),l);return Xe(i,e,n,0,0,Qe())}static updateA(e,n,l,i,r){return be(Be(e,i,!0,l.length),e,n,l,r)}static updateB(e,n,l,i,r){return be(Be(e,i,!1,n.length),e,n,l,r)}}function xe(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.to==t&&r.to==e&&t<n.length&&e<l.length?[t+1,e+1]:[i.from,r.from]}function we(t,e,n,l){let i=n.lineAt(t),r=l.lineAt(e);return i.from==t&&r.from==e?[t,e]:[i.to+1,r.to+1]}function Xe(t,e,n,l,i,r){let s=[];for(let o=0;o<t.length;o++){let f=t[o],[h,a]=xe(f.fromA+l,f.fromB+i,e,n),[d,c]=we(f.toA+l,f.toB+i,e,n),u=[f.offset(-h+l,-a+i)];for(;o<t.length-1;){let m=t[o+1],[p,g]=xe(m.fromA+l,m.fromB+i,e,n);if(p>d+1&&g>c+1)break;u.push(m.offset(-h+l,-a+i)),[d,c]=we(m.toA+l,m.toB+i,e,n),o++}s.push(new O(u,h,Math.max(h,d),a,Math.max(a,c),r))}return s}const z=1e3;function ke(t,e,n,l){let i=0,r=t.length;for(;;){if(i==r){let a=0,d=0;i&&({toA:a,toB:d}=t[i-1]);let c=e-(n?a:d);return[a+c,d+c]}let s=i+r>>1,o=t[s],[f,h]=n?[o.fromA,o.toA]:[o.fromB,o.toB];if(f>e)r=s;else if(h<=e)i=s+1;else return l?[o.fromA,o.fromB]:[o.toA,o.toB]}}function Be(t,e,n,l){let i=[];return e.iterChangedRanges((r,s,o,f)=>{let h=0,a=n?e.length:l,d=0,c=n?l:e.length;r>z&&([h,d]=ke(t,r-z,n,!0)),s<e.length-z&&([a,c]=ke(t,s+z,n,!1));let u=f-o-(s-r),m,[p,g]=n?[u,0]:[0,u];i.length&&(m=i[i.length-1]).toA>=h?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:a,toB:c,diffA:m.diffA+p,diffB:m.diffB+g}:i.push({fromA:h,toA:a,fromB:d,toB:c,diffA:p,diffB:g})}),i}function be(t,e,n,l,i){if(!t.length)return e;let r=[];for(let s=0,o=0,f=0,h=0;;s++){let a=s==t.length?null:t[s],d=a?a.fromA+o:n.length,c=a?a.fromB+f:l.length;for(;h<e.length;){let g=e[h];if(a&&(g.toA+o>d||g.toB+f>c))break;r.push(g.offset(o,f)),h++}if(!a)break;let u=a.toA+o+a.diffA,m=a.toB+f+a.diffB,p=Ye(n.sliceString(d,u),l.sliceString(c,m),i);for(let g of Xe(p,n,l,d,c,Qe()))r.push(g);for(o+=a.diffA,f+=a.diffB;h<e.length;){let g=e[h];if(g.fromA+o>u&&g.fromB+f>m)break;h++}}return r}const et={scanLimit:500},Z=dt.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=Le(t))}update(t){(t.docChanged||t.viewportChanged||At(t.startState,t.state)||xt(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=Le(t.view))}},{decorations:t=>t.deco}),P=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty}}));function At(t,e){return t.field(k,!1)!=e.field(k,!1)}function xt(t,e){return t.facet(b)!=e.facet(b)}const Me=M.line({class:"cm-changedLine"}),tt=M.mark({class:"cm-changedText"}),wt=M.mark({tagName:"ins",class:"cm-insertedLine"}),kt=M.mark({tagName:"del",class:"cm-deletedLine"}),De=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Bt(t,e,n,l,i,r){let s=n?t.fromA:t.fromB,o=n?t.toA:t.toB,f=0;if(s!=o){i.add(s,s,Me),i.add(s,o,n?kt:wt),r&&r.add(s,s,De);for(let h=e.iterRange(s,o-1),a=s;!h.next().done;){if(h.lineBreak){a++,i.add(a,a,Me),r&&r.add(a,a,De);continue}let d=a+h.value.length;if(l)for(;f<t.changes.length;){let c=t.changes[f],u=s+(n?c.fromA:c.fromB),m=s+(n?c.toA:c.toB),p=Math.max(a,u),g=Math.min(d,m);if(p<g&&i.add(p,g,tt),m<d)f++;else break}a=d}}}function Le(t){let e=t.state.field(k),{side:n,highlightChanges:l,markGutter:i,overrideChunk:r}=t.state.facet(b),s=n=="a",o=new N,f=i?new N:null,{from:h,to:a}=t.viewport;for(let d of e){if((s?d.fromA:d.fromB)>=a)break;(s?d.toA:d.toB)>h&&(!r||!r(t.state,d,o,f))&&Bt(d,t.state.doc,s,l,o,f)}return{deco:o.finish(),gutter:f&&f.finish()}}class q extends Y{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}const K=G.define({map:(t,e)=>t.map(e)}),W=H.define({create:()=>M.none,update:(t,e)=>{for(let n of e.effects)if(n.is(K))return n.value;return t.map(e.changes)},provide:t=>B.decorations.from(t)}),_=.01;function Se(t,e){if(t.size!=e.size)return!1;let n=t.iter(),l=e.iter();for(;n.value;){if(n.from!=l.from||Math.abs(n.value.spec.widget.height-l.value.spec.widget.height)>1)return!1;n.next(),l.next()}return!0}function bt(t,e,n){let l=new N,i=new N,r=t.state.field(W).iter(),s=e.state.field(W).iter(),o=0,f=0,h=0,a=0,d=t.viewport,c=e.viewport;for(let g=0;;g++){let C=g<n.length?n[g]:null,S=C?C.fromA:t.state.doc.length,R=C?C.fromB:e.state.doc.length;if(o<S){let x=t.lineBlockAt(o).top+h,D=e.lineBlockAt(f).top+a,w=x-D;w<-_?(h-=w,l.add(o,o,M.widget({widget:new q(-w),block:!0,side:-1}))):w>_&&(a+=w,i.add(f,f,M.widget({widget:new q(w),block:!0,side:-1})))}if(S>o+1e3&&o<d.from&&S>d.from&&f<c.from&&R>c.from){let x=Math.min(d.from-o,c.from-f);o+=x,f+=x,g--}else if(C)o=C.toA,f=C.toB;else break;for(;r.value&&r.from<o;)h-=r.value.spec.widget.height,r.next();for(;s.value&&s.from<f;)a-=s.value.spec.widget.height,s.next()}for(;r.value;)h-=r.value.spec.widget.height,r.next();for(;s.value;)a-=s.value.spec.widget.height,s.next();let u=t.contentHeight+h-(e.contentHeight+a);u<_?l.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new q(-u),block:!0,side:1})):u>_&&i.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new q(u),block:!0,side:1}));let m=l.finish(),p=i.finish();Se(m,t.state.field(W))||t.dispatch({effects:K.of(m)}),Se(p,e.state.field(W))||e.dispatch({effects:K.of(p)})}const le=G.define({map:(t,e)=>e.mapPos(t)});class Mt extends Y{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let n=document.createElement("div");return n.className="cm-collapsedLines",n.textContent=e.state.phrase("$ unchanged lines",this.lines),n.addEventListener("click",l=>{let i=e.posAtDOM(l.target);e.dispatch({effects:le.of(i)});let{side:r,sibling:s}=e.state.facet(b);s&&s().dispatch({effects:le.of(Dt(i,e.state.field(k),r=="a"))})}),n}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}}function Dt(t,e,n){let l=0,i=0;for(let r=0;;r++){let s=r<e.length?e[r]:null;if(!s||(n?s.fromA:s.fromB)>=t)return i+(t-l);[l,i]=n?[s.toA,s.toB]:[s.toB,s.toA]}}const Lt=H.define({create(t){return M.none},update(t,e){t=t.map(e.changes);for(let n of e.effects)n.is(le)&&(t=t.update({filter:l=>l!=n.value}));if(t.size&&e.state.field(k)!=e.startState.field(k,!1)){let n=e.state.facet(b).side=="a",l=[];for(let i of e.state.field(k))t.between(n?i.fromA:i.fromB,n?i.toA:i.toB,r=>{l.push(r)});l.length&&(t=t.update({filter:i=>l.indexOf(i)<0}))}return t},provide:t=>B.decorations.from(t)});function se({margin:t=3,minSize:e=4}){return Lt.init(n=>St(n,t,e))}function St(t,e,n){let l=new N,i=t.facet(b).side=="a",r=t.field(k),s=1;for(let o=0;;o++){let f=o<r.length?r[o]:null,h=o?s+e:1,a=f?t.doc.lineAt(i?f.fromA:f.fromB).number-1-e:t.doc.lines,d=a-h+1;if(d>=n&&l.add(t.doc.line(h).from,t.doc.line(a).to,M.replace({widget:new Mt(d),block:!0})),!f)break;s=t.doc.lineAt(Math.min(t.doc.length,i?f.toA:f.toB)).number}return l.finish()}const Ot=B.styleModule.of(new st({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),nt=B.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"⦚"',marginInlineEnd:"7px"},"&:after":{content:'"⦚"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),Oe=new Ge,$=new Ge;class Et{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||et;let n=[Q.low(Z),nt,Ot,W,B.updateListener.of(d=>{this.measuring<0&&(d.heightChanged||d.viewportChanged)&&!d.transactions.some(c=>c.effects.some(u=>u.is(K)))&&this.measure()})],l=[b.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&l.push(P);let i=ne.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],B.editorAttributes.of({class:"cm-merge-a"}),$.of(l),n]}),r=[b.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&r.push(P);let s=ne.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],B.editorAttributes.of({class:"cm-merge-b"}),$.of(r),n]});this.chunks=O.build(i.doc,s.doc,this.diffConf);let o=[k.init(()=>this.chunks),Oe.of(e.collapseUnchanged?se(e.collapseUnchanged):[])];i=i.update({effects:G.appendConfig.of(o)}).state,s=s.update({effects:G.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let f=e.orientation||"a-b",h=document.createElement("div");h.className="cm-mergeViewEditor";let a=document.createElement("div");a.className="cm-mergeViewEditor",this.editorDOM.appendChild(f=="a-b"?h:a),this.editorDOM.appendChild(f=="a-b"?a:h),this.a=new B({state:i,parent:h,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.a)}),this.b=new B({state:s,parent:a,root:e.root,dispatchTransactions:d=>this.dispatch(d,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,n){if(e.some(l=>l.docChanged)){let l=e[e.length-1],i=e.reduce((s,o)=>s.compose(o.changes),Ne.empty(e[0].startState.doc.length));this.chunks=n==this.a?O.updateA(this.chunks,l.newDoc,this.b.state.doc,i,this.diffConf):O.updateB(this.chunks,this.a.state.doc,l.newDoc,i,this.diffConf),n.update([...e,l.state.update({effects:ie.of(this.chunks)})]);let r=n==this.a?this.b:this.a;r.update([r.state.update({effects:ie.of(this.chunks)})]),this.scheduleMeasure()}else n.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let r=e.orientation!="b-a";if(r!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let s=this.a.dom.parentNode,o=this.b.dom.parentNode;s.remove(),o.remove(),this.editorDOM.insertBefore(r?s:o,this.editorDOM.firstChild),this.editorDOM.appendChild(r?o:s),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let r=!!this.revertDOM,s=this.revertToA,o=this.renderRevert;"revertControls"in e&&(r=!!e.revertControls,s=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(r,s,o)}let n="highlightChanges"in e,l="gutter"in e,i="collapseUnchanged"in e;if(n||l||i){let r=[],s=[];if(n||l){let o=this.a.state.facet(b),f=l?e.gutter!==!1:o.markGutter,h=n?e.highlightChanges!==!1:o.highlightChanges;r.push($.reconfigure([b.of({side:"a",sibling:()=>this.b,highlightChanges:h,markGutter:f}),f?P:[]])),s.push($.reconfigure([b.of({side:"b",sibling:()=>this.a,highlightChanges:h,markGutter:f}),f?P:[]]))}if(i){let o=Oe.reconfigure(e.collapseUnchanged?se(e.collapseUnchanged):[]);r.push(o),s.push(o)}this.a.dispatch({effects:r}),this.b.dispatch({effects:s})}this.scheduleMeasure()}setupRevertControls(e,n,l){this.revertToA=n,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=l,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",i=>this.revertClicked(i)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bt(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,n=e.firstChild,l=this.a.viewport,i=this.b.viewport;for(let r=0;r<this.chunks.length;r++){let s=this.chunks[r];if(s.fromA>l.to||s.fromB>i.to)break;if(s.fromA<l.from||s.fromB<i.from)continue;let o=this.a.lineBlockAt(s.fromA).top+"px";for(;n&&+n.dataset.chunk<r;)n=Ee(n);n&&n.dataset.chunk==String(r)?(n.style.top!=o&&(n.style.top=o),n=n.nextSibling):e.insertBefore(this.renderRevertButton(o,r),n)}for(;n;)n=Ee(n)}renderRevertButton(e,n){let l;if(this.renderRevert)l=this.renderRevert();else{l=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");l.setAttribute("aria-label",i),l.setAttribute("title",i),l.textContent=this.revertToLeft?"⇜":"⇝"}return l.style.top=e,l.setAttribute("data-chunk",String(n)),l}revertClicked(e){let n=e.target,l;for(;n&&n.parentNode!=this.revertDOM;)n=n.parentNode;if(n&&(l=this.chunks[n.dataset.chunk])){let[i,r,s,o,f,h]=this.revertToA?[this.b,this.a,l.fromB,l.toB,l.fromA,l.toA]:[this.a,this.b,l.fromA,l.toA,l.fromB,l.toB],a=i.state.sliceDoc(s,Math.max(s,o-1));s!=o&&h<=r.state.doc.length&&(a+=i.state.lineBreak),r.dispatch({changes:{from:f,to:Math.min(r.state.doc.length,h),insert:a},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}}function Ee(t){let e=t.nextSibling;return t.remove(),e}const yt=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-deletedLineGutter"}},Rt=Q.low(je({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(Z))===null||e===void 0?void 0:e.gutter)||Ie.empty},widgetMarker:(t,e)=>e instanceof rt?yt:null}));function Tt(t){var e;let n=typeof t.original=="string"?Fe.of(t.original.split(/\r?\n/)):t.original,l=t.diffConfig||et;return[Q.low(Z),Vt,nt,B.editorAttributes.of({class:"cm-merge-b"}),Ze.of((i,r)=>{let s=r.effects.find(o=>o.is(he));return s&&(i=O.updateA(i,s.value.doc,r.startState.doc,s.value.changes,l)),r.docChanged&&(i=O.updateB(i,r.state.field(V),r.newDoc,r.changes,l)),i}),b.of({highlightChanges:t.highlightChanges!==!1,markGutter:t.gutter!==!1,syntaxHighlightDeletions:t.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:(e=t.mergeControls)!==null&&e!==void 0?e:!0,overrideChunk:t.allowInlineDiffs?Wt:void 0,side:"b"}),V.init(()=>n),t.gutter!==!1?Rt:[],t.collapseUnchanged?se(t.collapseUnchanged):[],k.init(i=>O.build(n,i.doc,l))]}const he=G.define(),V=H.define({create:()=>Fe.empty,update(t,e){for(let n of e.effects)n.is(he)&&(t=n.value.doc);return t}}),ye=new WeakMap;class rt extends Y{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||(this.dom=this.buildDOM(e))}}function Gt(t,e,n){let l=ye.get(e.changes);if(l)return l;let i=s=>{let{highlightChanges:o,syntaxHighlightDeletions:f,syntaxHighlightDeletionsMaxLength:h,mergeControls:a}=t.facet(b),d=document.createElement("div");if(d.className="cm-deletedChunk",a){let x=d.appendChild(document.createElement("div"));x.className="cm-chunkButtons";let D=A=>{A.preventDefault(),Nt(s,s.posAtDOM(d))},w=A=>{A.preventDefault(),Ft(s,s.posAtDOM(d))};if(typeof a=="function")x.appendChild(a("accept",D)),x.appendChild(a("reject",w));else{let A=x.appendChild(document.createElement("button"));A.name="accept",A.textContent=t.phrase("Accept"),A.onmousedown=D;let L=x.appendChild(document.createElement("button"));L.name="reject",L.textContent=t.phrase("Reject"),L.onmousedown=w}}if(n||e.fromA>=e.toA)return d;let c=s.state.field(V).sliceString(e.fromA,e.endA),u=f&&t.facet(ot),m=S(),p=e.changes,g=0,C=!1;function S(){let x=d.appendChild(document.createElement("div"));return x.className="cm-deletedLine",x.appendChild(document.createElement("del"))}function R(x,D,w){for(let A=x;A<D;){if(c.charAt(A)==`
|
|
2
2
|
`){m.firstChild||m.appendChild(document.createElement("br")),m=S(),A++;continue}let L=D,ce=w+(C?" cm-deletedText":""),ue=!1,X=c.indexOf(`
|
|
3
3
|
`,A);if(X>-1&&X<D&&(L=X),o&&g<p.length){let j=Math.max(0,C?p[g].toA:p[g].fromA);j<=L&&(L=j,C&&g++,ue=!0)}if(L>A){let j=document.createTextNode(c.slice(A,L));if(ce){let me=m.appendChild(document.createElement("span"));me.className=ce,me.appendChild(j)}else m.appendChild(j);A=L}ue&&(C=!C)}}if(u&&e.toA-e.fromA<=h){let x=u.parser.parse(c),D=0;at(x,{style:w=>ft(t,w)},(w,A,L)=>{w>D&&R(D,w,""),R(w,A,L),D=A}),R(D,c.length,"")}else R(0,c.length,"");return m.firstChild||m.appendChild(document.createElement("br")),d},r=M.widget({block:!0,side:-1,widget:new rt(i)});return ye.set(e.changes,r),r}function Nt(t,e){let{state:n}=t,l=e??n.selection.main.head,i=t.state.field(k).find(f=>f.fromB<=l&&f.endB>=l);if(!i)return!1;let r=t.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),s=t.state.field(V);i.fromB!=i.toB&&i.toA<=s.length&&(r+=t.state.lineBreak);let o=Ne.of({from:i.fromA,to:Math.min(s.length,i.toA),insert:r},s.length);return t.dispatch({effects:he.of({doc:o.apply(s),changes:o}),userEvent:"accept"}),!0}function Ft(t,e){let{state:n}=t,l=e??n.selection.main.head,i=n.field(k).find(o=>o.fromB<=l&&o.endB>=l);if(!i)return!1;let s=n.field(V).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(s+=n.lineBreak),t.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:s},userEvent:"revert"}),!0}function Re(t){let e=new N;for(let n of t.field(k)){let l=t.facet(b).overrideChunk&&it(t,n);e.add(n.fromB,n.fromB,Gt(t,n,!!l))}return e.finish()}const Vt=H.define({create:t=>Re(t),update(t,e){return e.state.field(k,!1)!=e.startState.field(k,!1)?Re(e.state):t},provide:t=>B.decorations.from(t)}),Te=new WeakMap;function it(t,e){let n=Te.get(e);if(n!==void 0)return n;n=null;let l=t.field(V),i=t.doc,r=l.lineAt(e.endA).number-l.lineAt(e.fromA).number+1,s=i.lineAt(e.endB).number-i.lineAt(e.fromB).number+1;e:if(r==s&&r<10){let o=[],f=0,h=e.fromA,a=e.fromB;for(let d of e.changes){if(d.fromA<d.toA){f+=d.toA-d.fromA;let c=l.sliceString(h+d.fromA,h+d.toA);if(/\n/.test(c))break e;o.push(M.widget({widget:new jt(c),side:-1}).range(a+d.fromB))}d.fromB<d.toB&&o.push(tt.range(a+d.fromB,a+d.toB))}f<e.endA-e.fromA-r*2&&(n=o)}return Te.set(e,n),n}class jt extends Y{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let n=document.createElement("del");return n.className="cm-deletedText",n.textContent=this.text,n}}const It=new class extends oe{constructor(){super(...arguments),this.elementClass="cm-inlineChangedLineGutter"}},Ut=M.line({class:"cm-inlineChangedLine"});function Wt(t,e,n,l){let i=it(t,e),r=0;if(!i)return!1;for(let s=t.doc.lineAt(e.fromB);;){for(l&&l.add(s.from,s.from,It),n.add(s.from,s.from,Ut);r<i.length&&i[r].to<=s.to;){let o=i[r++];n.add(o.from,o.to,o.value)}if(s.to>=e.endB)break;s=t.doc.lineAt(s.to+1)}return!0}function Ht(t){const[e,n]=T.useState([]);return T.useEffect(()=>{let l=!1;const i=ht.matchFilename(ct,t);if(!i){n([]);return}return i.load().then(r=>{l||n([r])}).catch(()=>{l||n([])}),()=>{l=!0}},[t]),e}function Kt({baseline:t,current:e,theme:n,filename:l,sideBySide:i,onRejectHunk:r,onHunkCountChange:s}){const o=Ht(l);return i?J.jsx(Pt,{baseline:t,current:e,theme:n,languageExtension:o}):J.jsx(zt,{baseline:t,current:e,theme:n,languageExtension:o,onRejectHunk:r,onHunkCountChange:s})}function zt({baseline:t,current:e,theme:n,languageExtension:l,onRejectHunk:i,onHunkCountChange:r}){const s=T.useRef(-1),o=T.useMemo(()=>[B.lineWrapping,Tt({original:t,gutter:!0,mergeControls:!0,collapseUnchanged:{margin:3,minSize:4}}),...l],[t,l]);return J.jsx(lt,{value:e,editable:!1,readOnly:!0,theme:n,height:"100%",className:"desktop:select-text h-full text-sm",extensions:o,basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},onChange:f=>i(f),onUpdate:f=>{var a;const h=((a=vt(f.state))==null?void 0:a.chunks.length)??null;h!==null&&h!==s.current&&(s.current=h,r(h))}})}function Pt({baseline:t,current:e,theme:n,languageExtension:l}){const i=T.useRef(null);return T.useEffect(()=>{const r=i.current;if(!r)return;const s=[B.editable.of(!1),ne.readOnly.of(!0),B.lineWrapping,...n==="dark"?[qt()]:[],...l],o=new Et({a:{doc:t,extensions:s},b:{doc:e,extensions:s},parent:r,collapseUnchanged:{margin:3,minSize:4},highlightChanges:!0,gutter:!0});return()=>o.destroy()},[t,e,n,l]),J.jsx("div",{ref:i,className:"cm-diff-split h-full overflow-auto text-sm"})}function qt(){return B.theme({"&":{backgroundColor:"transparent",color:"inherit"}},{dark:!0})}export{Kt as CodeMirrorDiff};
|