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,4 +1,4 @@
|
|
|
1
|
-
var tt=Object.defineProperty;var nt=(e,n,s)=>n in e?tt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var
|
|
1
|
+
var tt=Object.defineProperty;var nt=(e,n,s)=>n in e?tt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var Y=(e,n,s)=>nt(e,typeof n!="symbol"?n+"":n,s);import{O as A,a1 as D,j_ as st,r as h,aM as at,j$ as ue,aK as rt,j as t,ic as W,k0 as ot,g as Z,k1 as ee,k2 as te,G as O,k3 as it,jx as lt,X as ct,k4 as dt,B as b,e4 as ut,ar as $,aQ as mt,k5 as ht,a2 as ne,a3 as se,a4 as K,_ as ye,hp as pt,hq as ft,cy as F,x as xt,bz as be,bA as we,bB as je,bD as ke,b8 as gt,fD as vt,k6 as yt,k7 as bt,jD as wt,k8 as jt,k9 as kt,ka as me,J as Nt,h5 as Ne,aY as k,gv as Ct,gB as Rt,kb as Et,a7 as he,kc as Tt,kd as At,ke as Dt}from"./index-B6Scr7KJ.js";import{u as _t}from"./use-roving-tab-list-Nu-MIapD.js";import{F as Ce,c as It,d as pe,e as St,R as Ot,C as Re}from"./use-session-canvas-BfKGOpNy.js";import{f as ps,g as fs,h as xs,b as gs,i as vs}from"./use-session-canvas-BfKGOpNy.js";import{A as zt}from"./McpAppFrame-4JDJsrmg.js";import{F as Mt}from"./file-DXbyb23e.js";import{F as Ee}from"./file-text-CRTgqqkn.js";import{R as Ut}from"./rotate-cw-DNa7ENG3.js";import{a as $t}from"./use-room-follow-claim-B1QPFaUb.js";import{R as Lt}from"./rotate-ccw-clock-D9XRHj5E.js";import{c as Ft,F as Pt}from"./room-files-source-BFo0FEUP.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"./more-details-Bt9nlPmS.js";import"./file-exclamation-point-C8XqHyzY.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,12 +13,12 @@ var tt=Object.defineProperty;var nt=(e,n,s)=>n in e?tt(e,n,{enumerable:!0,config
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const _e={name:"file-headphone",size:24,node:[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],aliases:["file-audio","file-audio-2"]};_e.node;const
|
|
16
|
+
*/const _e={name:"file-headphone",size:24,node:[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],aliases:["file-audio","file-audio-2"]};_e.node;const Gt=A(_e);/**
|
|
17
17
|
* @license lucide-react v1.48.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Ie={name:"file-play",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],aliases:["file-video"]};Ie.node;const
|
|
21
|
+
*/const Ie={name:"file-play",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],aliases:["file-video"]};Ie.node;const Bt=A(Ie);/**
|
|
22
22
|
* @license lucide-react v1.48.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
@@ -33,11 +33,11 @@ var tt=Object.defineProperty;var nt=(e,n,s)=>n in e?tt(e,n,{enumerable:!0,config
|
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const ze={name:"table",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]};ze.node;const
|
|
36
|
+
*/const ze={name:"table",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]};ze.node;const Vt=A(ze);/**
|
|
37
37
|
* @license lucide-react v1.48.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Me={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};Me.node;const
|
|
41
|
+
*/const Me={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};Me.node;const Yt=A(Me);function qt(e){const n=D(),{roomId:s,viewerAuthorId:r,documentId:l,url:m,readScrollY:o,subscribe:i}=e,a=st(s,r),g=h.useRef({roomId:s,documentId:l,url:m,readScrollY:o});g.current={roomId:s,documentId:l,url:m,readScrollY:o};const p=h.useRef(null),d=h.useRef(0);h.useEffect(()=>{if(!a||s===null||l===null)return;const x=()=>{p.current=null,d.current=Date.now();const w=g.current;if(w.roomId===null||w.documentId===null)return;const E=w.roomId,I={documentId:w.documentId,...w.url!==void 0?{url:w.url}:{},...w.readScrollY?{scrollY:Math.max(0,Math.round(w.readScrollY()))}:{}};n.publishRoomView(E,I).then(z=>{!z.followed&&r!==null&&rt.getState().noteNobodyFollowing(E,r)}).catch(()=>{})},y=()=>{if(p.current!==null)return;const w=Date.now()-d.current;if(w>=ue){x();return}p.current=setTimeout(x,ue-w)};y();const c=i==null?void 0:i(y),R=setInterval(y,at);return()=>{clearInterval(R),c==null||c()}},[n,a,s,r,l,m,i]),h.useEffect(()=>()=>{p.current!==null&&clearTimeout(p.current)},[])}const Qt={url:W,markdown:Ee,json:De,image:Kt,pdf:Mt,widget:ot,mcp_app:zt,file:Ce,model3d:Ht,audio:Gt,video:Bt,csv:Vt,browser:W,diff:Wt},Xt="after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden";function ae(e){return e==="browser"?"browser-panel":"canvas-panel"}const Jt={canvas:"Open canvas documents",browser:"Open browser pages"};function re(e){return`canvas-tab-${e}`}const Zt=3;function en(e){const n=e.map(r=>r.displayName);if(n.length===0)return null;if(n.length===1)return`${n[0]} is looking at this.`;if(n.length===2)return`${n[0]} and ${n[1]} are looking at this.`;const s=n.length-2;return`${n[0]}, ${n[1]} and ${s} ${s===1?"other":"others"} are looking at this.`}function tn({watchers:e}){const n=en(e);if(n===null)return null;const s=e.slice(0,Zt),r=e.length-s.length;return t.jsxs(t.Fragment,{children:[t.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[s.map(l=>t.jsx(Z,{size:"xs",className:"ring-background text-3xs size-3.5 ring-1",kind:l.kind,color:l.color??te(l.id),emoji:l.emoji,imageUrl:l.imageUrl,badge:null,fallback:ee(l.displayName)},l.id)),r>0&&t.jsxs("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-3.5 shrink-0 items-center justify-center rounded-full ring-1",children:["+",r]})]}),t.jsx("span",{className:"sr-only",children:n})]})}function Ue({view:e,documents:n,activeDocumentId:s,onActivate:r,onClose:l,onPin:m}){const o=ae(e),{getTabProps:i}=_t({orderedIds:n.map(a=>a.id),activeId:s,onActivate:a=>r(a),onClose:a=>l(a),getFallbackFocus:()=>document.getElementById(o)});return n.length===0?null:t.jsx("div",{role:"tablist","aria-label":Jt[e],className:"flex items-stretch gap-1 overflow-x-auto border-b px-2 py-1",children:n.map(a=>{const g=Qt[a.contentType],p=a.id===s,d=a.author;return t.jsxs("div",{role:"presentation",className:"group relative flex shrink-0",children:[t.jsxs("button",{type:"button",role:"tab","aria-selected":p,id:re(a.id),"aria-controls":p?o:void 0,...i(a.id),className:O("focus-ring flex items-center gap-1.5 rounded-md py-3 pl-2 text-xs transition-colors md:py-1",m?"pr-12":"pr-7",p?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[d&&t.jsx(Z,{"aria-hidden":!0,size:"xs",className:"text-3xs size-3.5 shrink-0",kind:d.kind,color:d.color??te(d.id),emoji:d.emoji,imageUrl:d.imageUrl,badge:null,fallback:ee(d.displayName)}),t.jsx(g,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"max-w-40 truncate font-medium",children:a.sourceLabel}),a.watchers&&a.watchers.length>0&&t.jsx(tn,{watchers:a.watchers}),a.unread&&t.jsx("span",{"data-slot":"canvas-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"})]}),m&&t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(a.id,!a.pinned),"aria-label":a.pinned?`Unpin ${a.sourceLabel}`:`Pin ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-6 -translate-y-1/2 rounded-sm p-1.5 transition-opacity md:p-0.5",a.pinned?"opacity-100":"opacity-0 group-hover:opacity-60"),children:a.pinned?t.jsx(it,{className:"size-3"}):t.jsx(lt,{className:"size-3"})}),t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>l(a.id),"aria-label":`Close ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-1.5 opacity-60 transition-opacity group-hover:opacity-100 md:p-0.5",Xt),children:t.jsx(ct,{className:"size-3"})})]},a.id)})})}function nn({error:e,onRetry:n}){const s=dt(e);return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx("p",{children:"This tab hit a problem"}),s?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm",children:"The app may have updated. Reloading usually fixes it."}),t.jsx(b,{type:"button",size:"sm",onClick:()=>window.location.reload(),children:"Reload DorkOS"})]}):t.jsxs(b,{type:"button",variant:"outline",size:"sm",onClick:n,children:[t.jsx(Ut,{className:"size-4"}),"Try again"]})]})}class $e extends h.Component{constructor(){super(...arguments);Y(this,"state",{error:null,retryKey:0});Y(this,"handleRetry",()=>{this.setState(s=>({error:null,retryKey:s.retryKey+1}))})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error(`[Canvas] Document viewer error (${this.props.documentId}):`,s,r)}render(){const{error:s,retryKey:r}=this.state;return s?t.jsx(nn,{error:s,onRetry:this.handleRetry}):t.jsx(h.Fragment,{children:this.props.children},r)}}function sn({onReload:e,onKeepMine:n}){return t.jsxs("div",{role:"status",className:"border-border/60 bg-muted/40 mx-2 mt-2 space-y-2 rounded-md border px-3 py-2 text-sm",children:[t.jsx("p",{children:"Your agent changed this while you were editing. Your edit is safe."}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(b,{type:"button",variant:"outline",size:"sm",onClick:e,children:"Reload"}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Keep mine"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Reload shows its version and ends your edit. Keep mine discards it."})]})}const an={canvas:{heading:"A blank canvas",blurb:"Your agent can show documents, data and files here.",actions:[{icon:Ee,label:"Markdown",description:"Render a document",action:()=>({type:"markdown",content:`# Untitled
|
|
42
42
|
|
|
43
|
-
Start writing…`,title:"Document"})},{icon:De,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:W,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:ht.site,title:"Web Page"})}]}};function q(e,n,s,r){return e.split("").reduce((m,o)=>m+o.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function Le({view:e,onAction:n}){const s=ut(),r=h.useId(),l=an[e],m=h.useMemo(()=>Array.from({length:6},(o,i)=>({x:q(r,i*3,10,90),y:q(r,i*3+1,10,80),size:q(r,i*3+2,24,56),delay:i*.4})),[r]);return t.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&m.map((o,i)=>t.jsx($.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${o.x}%`,top:`${o.y}%`,width:o.size,height:o.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:o.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},i)),t.jsxs($.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[t.jsx($.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:e==="browser"?t.jsx(W,{className:"size-7"}):t.jsx(mt,{className:"size-7"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:l.heading}),t.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[l.blurb,t.jsx("br",{}),"Or pick a starting point below."]})]}),t.jsx($.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:l.actions.map(({icon:o,label:i,description:a,action:g})=>t.jsxs($.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(g()),children:[t.jsx(o,{className:"text-muted-foreground size-4 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"text-sm font-medium",children:i}),t.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},i))})]})]})}const Fe=[{value:"hour",label:"1 hour",ms:36e5},{value:"day",label:"1 day",ms:864e5},{value:"week",label:"1 week",ms:6048e5}];function fe(e,n=Date.now()){const s=Fe.find(r=>r.value===e).ms;return new Date(Math.ceil((n+s)/6e4)*6e4).toISOString()}const rn=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function G(e){return rn.format(new Date(e))}function L(e){switch(e.kind){case"log":return"Kept on this document";case"room":return e.agentName?`To ${e.agentName} in this room`:"To this room";case"owner":return e.agentName?`To ${e.agentName}`:"To the agent that opened this";case"agent":return e.agentName?`To ${e.agentName}`:"To an agent that’s gone"}}const on={no_grant:"Off",granted:"On",waiting:"Waiting for you",suspended:"Paused",revoked:"Turned off",expired:"Ended"};function Pe(e){return on[e]}function ln(e){const n=e.grant;switch(e.state){case"granted":return n!=null&&n.expiresAt?`Until ${G(n.expiresAt)}`:"On";case"waiting":return"An agent asked for this route.";case"suspended":return"The route or its app changed. Allow it again.";case"revoked":return n!=null&&n.revokedAt?`Turned off ${G(n.revokedAt)}`:"Turned off";case"expired":return n!=null&&n.expiresAt?`Ended ${G(n.expiresAt)}`:"Ended";case"no_grant":return e.needsPerson?"Needs your approval to start work.":"Off until someone allows it."}}function He(e){const n=`${e.turnsPerHour} ${e.turnsPerHour===1?"turn":"turns"} an hour`,s=`${e.eventsPerMinute} ${e.eventsPerMinute===1?"event":"events"} a minute`;return`${n} · ${s}`}function Be(e){return`${Pe(e.state)}: ${L(e.destination)}`}function cn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&un.has(n)}function dn(e){return{on:e.filter(n=>n.state==="granted").length,waiting:e.filter(n=>n.state==="waiting").length}}const P="This route changed. Review it again.",un=new Set(["ROUTE_CHANGED","GRANT_BINDING_CHANGED","DECLARATION_HASH_MISMATCH","MANIFEST_CHANGED"]),H="Only a signed-in person can change routes.",xe={ROUTE_CHANGED:P,GRANT_BINDING_CHANGED:P,DECLARATION_HASH_MISMATCH:P,MANIFEST_CHANGED:P,ROUTE_UNDECLARED:"This document no longer declares that route.",ROUTE_ALREADY_ON:"This route is already on.",ROUTE_ALREADY_GRANTED:"This route is already on.",APPROVAL_NOT_RECORDED:"Couldn’t record the approval. Nothing was allowed.",TARGET_UNAVAILABLE:"The agent for this route isn’t available.",TARGET_IDENTITY_MISMATCH:"The agent for this route isn’t available.",TARGET_SCOPE_MISMATCH:"The agent for this route isn’t available.",ROOM_ROUTE_UNAVAILABLE:"This room can’t take events right now.",ORIGIN_AUTHORITY_LOST:"The agent that opened this isn’t available.",GRANT_EXPIRED:"That end time has passed. Pick another.",AGENT_CANNOT_DECIDE:H,REQUESTER_CANNOT_DECIDE:H,PERSON_REQUIRED:H,operator_cookie_required:H,AUTH_REQUIRED:"Sign in to change routes."};function Q(e){const n=e==null?void 0:e.code;return typeof n=="string"&&xe[n]?xe[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this route. Try again."}const X=e=>["canvas-doc-routes",e];function mn(e,n){const s=D();return ne({queryKey:X(e),queryFn:()=>s.getCanvasDocRoutes(e),retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:n?15e3:6e4})}function hn(e,n,s){const r=D();return ne({queryKey:["canvas-doc-route-review",e,n,s],queryFn:()=>r.reviewCanvasDocRoute(e,n,{expiresAt:s}),enabled:s!==null,retry:!1,networkMode:"always",staleTime:1/0,gcTime:0})}function Ge(e){const n=D(),s=se(),r=o=>{s.setQueryData(X(e),i=>i&&{...i,routes:i.routes.map(a=>a.id===o.route.id?o.route:a)}),s.invalidateQueries({queryKey:X(e)})},l=K({mutationFn:o=>n.approveCanvasDocRoute(e,o.routeId,{expiresAt:o.expiresAt,reviewHash:o.reviewHash}),networkMode:"always",onSuccess:r}),m=K({mutationFn:o=>n.revokeCanvasDocRoute(e,o.routeId),networkMode:"always",onSuccess:r});return{approve:l,revoke:m}}function pn(e){return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}}function fn(){return h.useSyncExternalStore(pn,()=>navigator.onLine,()=>!0)}const xn={no_grant:"neutral",granted:"success",waiting:"warning",suspended:"warning",revoked:"neutral",expired:"neutral"};function gn({documentId:e,route:n,online:s,onDone:r,onAnnounce:l}){const m=h.useId(),[o,i]=h.useState("day"),[a,g]=h.useState(()=>fe("day")),p=hn(e,n.id,a),{approve:d}=Ge(e),x=p.data,y=()=>{x&&d.mutate({routeId:n.id,expiresAt:x.expiresAt,reviewHash:x.reviewHash},{onSuccess:c=>{l(Be(c.route)),r()},onError:c=>{cn(c)&&p.refetch()}})};return t.jsxs("section",{"aria-labelledby":m,"data-testid":`doc-route-review-${n.id}`,className:"bg-background space-y-3 rounded-md p-3",children:[t.jsx("h4",{id:m,className:"text-sm font-medium",children:"Allow this route?"}),t.jsx(pt,{"aria-label":"How long",value:o,onValueChange:c=>{i(c),g(fe(c))},children:Fe.map(c=>t.jsx(ft,{value:c.value,children:c.label},c.value))}),t.jsx("div",{className:"min-h-20 space-y-1.5 text-xs",children:x?t.jsxs(t.Fragment,{children:[t.jsx(F,{label:"Goes to",align:"start",wrap:!0,children:L(x.destination)}),t.jsx(F,{label:"Events",align:"start",wrap:!0,children:t.jsx("code",{className:"font-mono",children:x.allowedTypes.join(", ")})}),t.jsx(F,{label:"Limits",align:"start",wrap:!0,children:He(x.limits)}),t.jsx(F,{label:"Ends",align:"start",wrap:!0,children:G(x.expiresAt)})]}):p.isError?t.jsx("p",{role:"alert",className:"text-destructive",children:Q(p.error)}):t.jsxs("p",{className:"text-muted-foreground flex items-center gap-2",children:[t.jsx(xt,{size:"xs"}),"Checking details…"]})}),d.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(d.error)}),t.jsxs("div",{className:"flex justify-end gap-2",children:[p.isError&&t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void p.refetch(),children:"Try again"}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:r,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-route-allow-${n.id}`,disabled:!x||p.isFetching||!s||d.isPending,onClick:y,children:d.isPending?"Allowing…":"Allow route"})]})]})}function vn({documentId:e,route:n,online:s,onAnnounce:r}){const[l,m]=h.useState(!1),{revoke:o}=Ge(e),i=n.state==="granted"&&n.grant!==null,a=()=>{o.mutate({routeId:n.id},{onSuccess:g=>r(Be(g.route))})};return t.jsxs("li",{"data-testid":`doc-route-${n.id}`,"data-state":n.state,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:L(n.destination),children:L(n.destination)}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[t.jsx("code",{className:"font-mono",children:n.on})," · ",n.id]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:xn[n.state],"data-testid":`doc-route-state-${n.id}`,className:"shrink-0",children:Pe(n.state)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:ln(n)}),i&&n.grant&&t.jsx("p",{className:"text-muted-foreground text-xs",children:He(n.grant.limits)}),o.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(o.error)}),l?t.jsx(gn,{documentId:e,route:n,online:s,onAnnounce:r,onDone:()=>m(!1)}):t.jsx("div",{className:"flex justify-end",children:i?t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-turn-off-${n.id}`,disabled:!s||o.isPending,onClick:a,children:o.isPending?"Turning off…":"Turn off"}):t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-review-button-${n.id}`,disabled:!s,onClick:()=>m(!0),children:"Review"})})]})}function yn(e){return e==="expired"?"Never started":"May have run"}function bn(e){return e==="expired"?"It waited a day and never started.":"It reached the agent, but its result is unknown."}function wn(e){switch(e.replay){case"ready":return null;case"no_grant":return"This route is off. Allow it to run this again.";case"route_changed":return"The route changed, so this can’t run again.";case"inputs_gone":return"Some of its events are no longer kept.";case"still_running":return"It may still be running. Check back once it stops.";case"route_busy":return e.status==="in_doubt"?"Newer work is waiting behind this. Clear it to continue.":"Newer work is waiting on this route. Try again after it runs."}}function jn(e){return`${e} ${e===1?"event":"events"}`}function kn(e){return`${e} to review`}const B="Only a signed-in person can change this.",ge="This work changed. The list is up to date now.",ve={WORK_ALREADY_REVIEWED:"This was already run again or cleared.",WORK_STILL_RUNNING:"It may still be running. Try again once it stops.",WORK_NOT_FOUND:ge,WORK_NOT_REVIEWABLE:ge,CONFIRM_REPEAT_REQUIRED:"Confirm before running this again.",GRANT_REQUIRED:"This route is off. Allow it first.",GRANT_REVOKED:"This route is off. Allow it first.",GRANT_EXPIRED:"This route’s approval ended. Allow it again first.",MANIFEST_CHANGED:"The document’s app changed. Allow the route again.",ROUTE_CHANGED:"The route changed, so this can’t run again.",INPUTS_GONE:"Some of its events are no longer kept.",ROUTE_BUSY:"Newer work is waiting on this route.",AGENT_CANNOT_DECIDE:B,REQUESTER_CANNOT_DECIDE:B,PERSON_REQUIRED:B,operator_cookie_required:B,AUTH_REQUIRED:"Sign in to change this."};function Nn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&ve[n]?ve[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this work. Try again."}const J=e=>["canvas-doc-work",e];function Cn(e,n,s){const r=D();return ne({queryKey:J(e),queryFn:()=>r.getCanvasDocWork(e),enabled:n,retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:s?15e3:6e4})}function Rn(e){const n=D(),s=se(),r=i=>s.setQueryData(J(e),a=>a&&{...a,items:a.items.filter(g=>g.batchId!==i.batchId)}),l=()=>void s.invalidateQueries({queryKey:J(e)}),m=K({mutationFn:i=>n.replayCanvasDocWork(e,i.batchId,i.confirmRepeat?{confirmRepeat:!0}:{}),networkMode:"always",onSuccess:r,onSettled:l}),o=K({mutationFn:i=>n.clearCanvasDocWork(e,i.batchId),networkMode:"always",onSuccess:r,onSettled:l});return{replay:m,clear:o}}function En({documentId:e,item:n,route:s,online:r,onAnnounce:l}){const[m,o]=h.useState(!1),[i,a]=h.useState(null),g=h.useRef(null),p=h.useRef(null),{replay:d,clear:x}=Rn(e),y=d.isPending||x.isPending,c=n.replay==="still_running",R=wn(n),w=s?L(s.destination):n.routeId,E=n.status==="in_doubt",I=d.error??x.error;h.useEffect(()=>{var C,T;i==="cancel"&&((C=g.current)==null||C.focus()),i==="replay"&&((T=p.current)==null||T.focus())},[i,m]);const z=()=>{o(!0),a("cancel")},Y=()=>{o(!1),a("replay")},N=C=>{x.reset(),d.mutate({batchId:n.batchId,...C?{confirmRepeat:C}:{}},{onSuccess:()=>l(`Running again: ${w}`)})},_=()=>{d.reset(),x.mutate({batchId:n.batchId},{onSuccess:()=>l(`Cleared: ${w}`)})};return t.jsxs("li",{"data-testid":`doc-work-${n.batchId}`,"data-status":n.status,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:w,children:w}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[jn(n.eventCount)," · ",gt(n.since)]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:E?"warning":"neutral",className:"shrink-0",children:yn(n.status)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:bn(n.status)}),R&&t.jsx("p",{"data-testid":`doc-work-blocked-${n.batchId}`,className:"text-muted-foreground text-xs",children:R}),I&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Nn(I)}),m?t.jsxs("div",{"data-testid":`doc-work-confirm-${n.batchId}`,className:"bg-background space-y-2 rounded-md p-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Run this again?"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"It may repeat what the agent already did."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{ref:g,type:"button",variant:"ghost",size:"sm",onClick:Y,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-work-confirm-replay-${n.batchId}`,disabled:!r||y,onClick:()=>N(!0),children:d.isPending?"Starting…":"Run again"})]})]}):t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{type:"button",variant:"ghost",size:"sm","data-testid":`doc-work-clear-${n.batchId}`,disabled:!r||y||c,onClick:_,children:x.isPending?"Clearing…":"Clear"}),t.jsx(b,{ref:p,type:"button",variant:"outline",size:"sm","data-testid":`doc-work-replay-${n.batchId}`,disabled:!r||y||R!==null,onClick:()=>E?z():N(),children:d.isPending?"Starting…":"Run again"})]})]})}function Tn({documentId:e,routes:n,online:s}){var y;const[r,l]=h.useState(!1),[m,o]=h.useState(""),i=Cn(e,n.length>0,r),a=h.useCallback(c=>o(c),[]),g=((y=i.data)==null?void 0:y.items)??[],p=t.jsx("p",{"aria-live":"polite",className:"sr-only",children:m});if(g.length===0)return p;const d=kn(g.length),x=g.some(c=>c.status==="in_doubt");return t.jsxs(t.Fragment,{children:[p,t.jsxs(be,{open:r,onOpenChange:l,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-work-trigger","aria-label":`Unfinished work: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Lt,{className:"size-3.5"}),t.jsxs("span",{className:O("flex items-center gap-1",x?"text-status-warning-fg":"text-muted-foreground"),children:[x&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Unfinished work","data-testid":"doc-work-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(ke,{children:"Unfinished work"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Unfinished work"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing runs again until you choose."})]}),!s&&t.jsx("p",{className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),i.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh this list."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Work to review",children:g.map(c=>t.jsx(En,{documentId:e,item:c,route:n.find(R=>R.id===c.routeId),online:s,onAnnounce:a},c.batchId))})]})]})]})}function An(e,n){return n>0?`${n} waiting`:e>0?`${e} on`:"Off"}function We({documentId:e}){var x;const[n,s]=h.useState(!1),[r,l]=h.useState(""),m=fn(),o=mn(e,n),i=h.useCallback(y=>l(y),[]),a=((x=o.data)==null?void 0:x.routes)??[];if(a.length===0)return null;const{on:g,waiting:p}=dn(a),d=An(g,p);return t.jsxs("div",{"data-testid":"doc-routes-bar",className:"text-muted-foreground flex items-center justify-end gap-1 border-b px-3 py-1 text-xs",children:[t.jsx(Tn,{documentId:e,routes:a,online:m}),t.jsxs(be,{open:n,onOpenChange:s,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-routes-trigger","aria-label":`Event routes: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Vt,{className:"size-3.5"}),"Routes",t.jsxs("span",{className:O("flex items-center gap-1",p>0?"text-status-warning-fg":"text-muted-foreground"),children:[p>0&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Event routes","data-testid":"doc-routes-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(ke,{children:"Event routes"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Event routes"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"A route does nothing until it’s allowed."})]}),!m&&t.jsx("p",{"data-testid":"doc-routes-offline",className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),o.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh routes."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void o.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Declared routes",children:a.map(y=>t.jsx(vn,{documentId:e,route:y,online:m,onAnnounce:i},y.id))}),t.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:r})]})]})]})}function Dn({sourceLabel:e,people:n,following:s,onFollow:r,onStopFollowing:l,onDiscuss:m,discussing:o=!1}){const i=n.find(a=>a.id===s)??null;return e===void 0&&n.length===0&&m===void 0?null:t.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[e!==void 0&&t.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),e===void 0&&t.jsx("span",{className:"flex-1"}),m&&t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:o,onClick:m,children:[t.jsx(vt,{className:"size-3.5"}),"Discuss"]}),n.length>0&&t.jsxs(yt,{children:[t.jsx(bt,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:O("h-6 gap-1 px-1.5",i&&"text-foreground"),children:[t.jsx(wt,{className:"size-3.5"}),i?`Following ${i.displayName}`:"Follow"]})}),t.jsxs(jt,{align:"end",children:[t.jsx(kt,{children:"Follow somebody’s browser"}),n.map(a=>t.jsxs(me,{onSelect:()=>a.id===s?l():r(a.id),children:[t.jsx(Z,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??te(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:ee(a.displayName)}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&t.jsx(Nt,{className:"size-3.5 shrink-0"})]},a.id)),i&&t.jsx(me,{onSelect:l,children:"Stop following"})]})]})]})}function _n({roomId:e,document:n,reading:s}){const r=D(),l=se(),[m,o]=h.useState(null),i=h.useMemo(()=>Ft({transport:r,queryClient:l,roomId:e}),[r,l,e]);return t.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[t.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ce,{className:"text-muted-foreground size-4 shrink-0"}),t.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),t.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),t.jsx(b,{type:"button",size:"sm",onClick:()=>o(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&t.jsx(Pt,{source:i,path:m,onClose:()=>o(null)})]})}const In=["image","pdf","audio","video","csv","model3d"];function Sn(e){return/^(https?:|data:)/.test(e)}function On(e){if(e.type==="file"||e.type==="diff")return e.sourcePath;if(e.type==="markdown")return e.sourcePath??null;if(In.includes(e.type)){const n=e.src;return Sn(n)?null:n}return null}function zn(e){return e.type==="file"||e.type==="diff"||e.type==="markdown"}function Mn(e){const n=/^(?:in )?(.+?)['’]s /.exec(e.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function Un(e){const n=On(e.content);if(n===null)return{kind:"inline"};if(e.treeKind==="room-main"||e.treeKind===void 0)return zn(e.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(e.content.type==="diff"&&e.treeKind==="worktree"&&typeof e.aheadOfMain=="number"&&e.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:e.content};if(e.content.type==="markdown")return{kind:"inline"};const s=Mn(e);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function $n(e){return e.title||e.contentType}function Ln({roomId:e,document:n,onUpdate:s}){const r=Un(n);return r.kind==="worktree-diff"?t.jsx(At,{roomId:e,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?t.jsx(_n,{roomId:e,document:n,reading:r}):n.content.type==="markdown"?t.jsx(Ot,{roomId:e,document:n,content:n.content,onSave:s}):t.jsx(Re,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function Ke({roomId:e,view:n}){var le;const s=Ne(),r=k(u=>u.roomCanvasDocuments[e]),l=k(u=>{var f;return((f=u.roomCanvasActive[e])==null?void 0:f[n])??null}),m=k(u=>{var f;return(f=u.roomCanvasUnread[e])==null?void 0:f[n]}),o=k(u=>u.activateRoomCanvasDocument),i=k(u=>u.clearRoomCanvasUnread),a=k(u=>u.roomCanvasPresence[e]),g=It(e),p=Ct(e),d=D(),x=((le=p.data)==null?void 0:le.viewerAuthorId)??null,y=k(u=>u.roomCanvasEditing[e]??null),c=Rt(u=>u.openThread),[R,w]=h.useState(!1),E=n==="browser"?e:null,{following:I,follow:z,stop:Y}=$t(E),N=Et(E),_=h.useRef(null),C=h.useCallback(async(u,f)=>{try{return await f(),!0}catch(M){return he.error(u,{description:pe(M)}),!1}},[]),T=h.useMemo(()=>Tt(r??[],n),[r,n]),j=T.find(u=>u.id===l)??null,oe=(m==null?void 0:m.length)??0;h.useEffect(()=>{oe>0&&i(e,n)},[oe,i,e,n]);const Ve=h.useMemo(()=>{var ce;const u=new Map(((ce=p.data)==null?void 0:ce.members.map(v=>[v.author.id,v.author]))??[]),f=v=>({id:v.id,displayName:v.displayName,kind:v.kind,...v.emoji?{emoji:v.emoji}:{},...v.color?{color:v.color}:{},...v.imageUrl?{imageUrl:v.imageUrl}:{}}),M=new Map;for(const[v,U]of Object.entries(a??{})){if(v===x)continue;const S=u.get(v);if(!S)continue;const de=M.get(U);de?de.push(f(S)):M.set(U,[f(S)])}return T.map(v=>{const U=u.get(v.authorId),S=M.get(v.id);return{id:v.id,sourceLabel:$n(v),contentType:v.content.type,pinned:v.pinned,unread:(m==null?void 0:m.includes(v.id))??!1,...U?{author:f(U)}:{},...S?{watchers:S}:{}}})},[T,p.data,m,a,x]);St(e,(j==null?void 0:j.id)??null);const qe=h.useMemo(()=>{var u;return(((u=p.data)==null?void 0:u.members)??[]).map(f=>f.author).filter(f=>f.kind==="human"&&f.id!==x).map(f=>({id:f.id,displayName:f.displayName,kind:f.kind,emoji:f.emoji,color:f.color,imageUrl:f.imageUrl}))},[p.data,x]),Qe=k(u=>{if(l===null)return;const f=u.browserHistories[l];return f?f.stack[f.cursor]:void 0}),Xe=h.useCallback(()=>{var u;return((u=_.current)==null?void 0:u.scrollTop)??0},[]),Je=h.useCallback(u=>{const f=_.current;return f?(f.addEventListener("scroll",u,{passive:!0}),()=>f.removeEventListener("scroll",u)):()=>{}},[]);qt({roomId:E,viewerAuthorId:x,documentId:l,url:Qe,readScrollY:Xe,subscribe:Je});const ie=h.useMemo(()=>T.map(u=>u.id).join("\0"),[T]);h.useEffect(()=>{if(!(N===null||y!==null)&&ie.split("\0").includes(N.documentId)){if(N.documentId!==l){o(e,N.documentId);return}N.scrollY!==void 0&&_.current&&(_.current.scrollTop=N.scrollY)}},[N,y,l,ie,o,e]);const Ze=h.useCallback(()=>{j!==null&&(w(!0),d.discussCanvasDocument(e,j.id).then(u=>c(e,u.threadRootEntryId,!1)).catch(u=>{he.error("Couldn’t start a discussion.",{description:pe(u)})}).finally(()=>w(!1)))},[j,d,e,c]),et=ae(n);return t.jsxs(t.Fragment,{children:[!s&&t.jsx(Ue,{view:n,documents:Ve,activeDocumentId:l,onActivate:u=>o(e,u),onClose:u=>void C("Couldn’t take that off the canvas.",()=>g.close(u)),onPin:(u,f)=>void C(f?"Couldn’t pin that.":"Couldn’t unpin that.",()=>g.pin(u,f))}),t.jsx(Dn,{sourceLabel:j==null?void 0:j.sourceLabel,people:n==="browser"?qe:[],following:I,onFollow:z,onStopFollowing:Y,onDiscuss:j===null?void 0:Ze,discussing:R}),j&&t.jsx(We,{documentId:j.id},j.id),t.jsx("div",{id:et,ref:_,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&j?{role:"tabpanel","aria-labelledby":re(j.id)}:{},children:j?t.jsx($e,{documentId:j.id,children:t.jsx(Ln,{roomId:e,document:j,onUpdate:(u,f)=>C("Couldn’t save that for the room.",()=>g.update(u,f))})},j.id):t.jsx(Le,{view:n,onAction:u=>void C("Couldn’t put that on the canvas.",()=>g.open(u))})})]})}function Ye({view:e}){const n=Ne(),s=k(c=>c.openDocuments),r=k(c=>e==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),l=k(c=>c.activateCanvasDocument),m=k(c=>c.closeCanvasDocument),o=k(c=>c.setDocumentContent),i=k(c=>c.openCanvasDocument),a=k(c=>c.applyHeldUpdate),g=k(c=>c.discardHeldUpdate),p=Dt(s,e),d=p.find(c=>c.id===r)??null,x=p.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),y=ae(e);return t.jsxs(t.Fragment,{children:[!n&&t.jsx(Ue,{view:e,documents:x,activeDocumentId:r,onActivate:l,onClose:m}),d&&t.jsx(We,{documentId:d.id},d.id),(d==null?void 0:d.heldUpdate)&&t.jsx(sn,{onReload:()=>a(d.id),onKeepMine:()=>g(d.id)}),t.jsx("div",{id:y,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&d?{role:"tabpanel","aria-labelledby":re(d.id)}:{},children:d?t.jsx($e,{documentId:d.id,children:t.jsx(Re,{documentId:d.id,content:d.content,onContentChange:c=>o(d.id,c)})},d.id):t.jsx(Le,{view:e,onAction:i})})]})}function ds(){const e=k(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"canvas"}):t.jsx(Ye,{view:"canvas"})})}function us(){const e=k(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"browser"}):t.jsx(Ye,{view:"browser"})})}export{us as BrowserContent,ds as CanvasContent,ps as CanvasWidgetContent,fs as resetSessionCanvasImport,xs as useDevtoolsBridge,gs as useDocChannel,vs as useSessionCanvas};
|
|
43
|
+
Start writing…`,title:"Document"})},{icon:De,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:W,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:ht.site,title:"Web Page"})}]}};function q(e,n,s,r){return e.split("").reduce((m,o)=>m+o.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function Le({view:e,onAction:n}){const s=ut(),r=h.useId(),l=an[e],m=h.useMemo(()=>Array.from({length:6},(o,i)=>({x:q(r,i*3,10,90),y:q(r,i*3+1,10,80),size:q(r,i*3+2,24,56),delay:i*.4})),[r]);return t.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&m.map((o,i)=>t.jsx($.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${o.x}%`,top:`${o.y}%`,width:o.size,height:o.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:o.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},i)),t.jsxs($.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[t.jsx($.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:e==="browser"?t.jsx(W,{className:"size-7"}):t.jsx(mt,{className:"size-7"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:l.heading}),t.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[l.blurb,t.jsx("br",{}),"Or pick a starting point below."]})]}),t.jsx($.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:l.actions.map(({icon:o,label:i,description:a,action:g})=>t.jsxs($.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(g()),children:[t.jsx(o,{className:"text-muted-foreground size-4 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"text-sm font-medium",children:i}),t.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},i))})]})]})}const Fe=[{value:"hour",label:"1 hour",ms:36e5},{value:"day",label:"1 day",ms:864e5},{value:"week",label:"1 week",ms:6048e5}];function fe(e,n=Date.now()){const s=Fe.find(r=>r.value===e).ms;return new Date(Math.ceil((n+s)/6e4)*6e4).toISOString()}const rn=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function B(e){return rn.format(new Date(e))}function L(e){switch(e.kind){case"log":return"Kept on this document";case"room":return e.agentName?`To ${e.agentName} in this room`:"To this room";case"owner":return e.agentName?`To ${e.agentName}`:"To the agent that opened this";case"agent":return e.agentName?`To ${e.agentName}`:"To an agent that’s gone"}}const on={no_grant:"Off",granted:"On",waiting:"Waiting for you",suspended:"Paused",revoked:"Turned off",expired:"Ended"};function Pe(e){return on[e]}function ln(e){const n=e.grant;switch(e.state){case"granted":return n!=null&&n.expiresAt?`Until ${B(n.expiresAt)}`:"On";case"waiting":return"An agent asked for this route.";case"suspended":return"The route or its app changed. Allow it again.";case"revoked":return n!=null&&n.revokedAt?`Turned off ${B(n.revokedAt)}`:"Turned off";case"expired":return n!=null&&n.expiresAt?`Ended ${B(n.expiresAt)}`:"Ended";case"no_grant":return e.needsPerson?"Needs your approval to start work.":"Off until someone allows it."}}function He(e){const n=`${e.turnsPerHour} ${e.turnsPerHour===1?"turn":"turns"} an hour`,s=`${e.eventsPerMinute} ${e.eventsPerMinute===1?"event":"events"} a minute`;return`${n} · ${s}`}function Ge(e){return`${Pe(e.state)}: ${L(e.destination)}`}function cn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&un.has(n)}function dn(e){return{on:e.filter(n=>n.state==="granted").length,waiting:e.filter(n=>n.state==="waiting").length}}const P="This route changed. Review it again.",un=new Set(["ROUTE_CHANGED","GRANT_BINDING_CHANGED","DECLARATION_HASH_MISMATCH","MANIFEST_CHANGED"]),H="Only a signed-in person can change routes.",xe={ROUTE_CHANGED:P,GRANT_BINDING_CHANGED:P,DECLARATION_HASH_MISMATCH:P,MANIFEST_CHANGED:P,ROUTE_UNDECLARED:"This document no longer declares that route.",ROUTE_ALREADY_ON:"This route is already on.",ROUTE_ALREADY_GRANTED:"This route is already on.",APPROVAL_NOT_RECORDED:"Couldn’t record the approval. Nothing was allowed.",TARGET_UNAVAILABLE:"The agent for this route isn’t available.",TARGET_IDENTITY_MISMATCH:"The agent for this route isn’t available.",TARGET_SCOPE_MISMATCH:"The agent for this route isn’t available.",ROOM_ROUTE_UNAVAILABLE:"This room can’t take events right now.",ORIGIN_AUTHORITY_LOST:"The agent that opened this isn’t available.",GRANT_EXPIRED:"That end time has passed. Pick another.",AGENT_CANNOT_DECIDE:H,REQUESTER_CANNOT_DECIDE:H,PERSON_REQUIRED:H,operator_cookie_required:H,AUTH_REQUIRED:"Sign in to change routes."};function Q(e){const n=e==null?void 0:e.code;return typeof n=="string"&&xe[n]?xe[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this route. Try again."}const X=e=>["canvas-doc-routes",e];function mn(e,n){const s=D();return ne({queryKey:X(e),queryFn:()=>s.getCanvasDocRoutes(e),retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:n?15e3:6e4})}function hn(e,n,s){const r=D();return ne({queryKey:["canvas-doc-route-review",e,n,s],queryFn:()=>r.reviewCanvasDocRoute(e,n,{expiresAt:s}),enabled:s!==null,retry:!1,networkMode:"always",staleTime:1/0,gcTime:0})}function Be(e){const n=D(),s=se(),r=o=>{s.setQueryData(X(e),i=>i&&{...i,routes:i.routes.map(a=>a.id===o.route.id?o.route:a)}),s.invalidateQueries({queryKey:X(e)})},l=K({mutationFn:o=>n.approveCanvasDocRoute(e,o.routeId,{expiresAt:o.expiresAt,reviewHash:o.reviewHash}),networkMode:"always",onSuccess:r}),m=K({mutationFn:o=>n.revokeCanvasDocRoute(e,o.routeId),networkMode:"always",onSuccess:r});return{approve:l,revoke:m}}function pn(e){return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}}function fn(){return h.useSyncExternalStore(pn,()=>navigator.onLine,()=>!0)}const xn={no_grant:"neutral",granted:"success",waiting:"warning",suspended:"warning",revoked:"neutral",expired:"neutral"};function gn({documentId:e,route:n,online:s,onDone:r,onAnnounce:l}){const m=h.useId(),[o,i]=h.useState("day"),[a,g]=h.useState(()=>fe("day")),p=hn(e,n.id,a),{approve:d}=Be(e),x=p.data,y=()=>{x&&d.mutate({routeId:n.id,expiresAt:x.expiresAt,reviewHash:x.reviewHash},{onSuccess:c=>{l(Ge(c.route)),r()},onError:c=>{cn(c)&&p.refetch()}})};return t.jsxs("section",{"aria-labelledby":m,"data-testid":`doc-route-review-${n.id}`,className:"bg-background space-y-3 rounded-md p-3",children:[t.jsx("h4",{id:m,className:"text-sm font-medium",children:"Allow this route?"}),t.jsx(pt,{"aria-label":"How long",value:o,onValueChange:c=>{i(c),g(fe(c))},children:Fe.map(c=>t.jsx(ft,{value:c.value,children:c.label},c.value))}),t.jsx("div",{className:"min-h-20 space-y-1.5 text-xs",children:x?t.jsxs(t.Fragment,{children:[t.jsx(F,{label:"Goes to",align:"start",wrap:!0,children:L(x.destination)}),t.jsx(F,{label:"Events",align:"start",wrap:!0,children:t.jsx("code",{className:"font-mono",children:x.allowedTypes.join(", ")})}),t.jsx(F,{label:"Limits",align:"start",wrap:!0,children:He(x.limits)}),t.jsx(F,{label:"Ends",align:"start",wrap:!0,children:B(x.expiresAt)})]}):p.isError?t.jsx("p",{role:"alert",className:"text-destructive",children:Q(p.error)}):t.jsxs("p",{className:"text-muted-foreground flex items-center gap-2",children:[t.jsx(xt,{size:"xs"}),"Checking details…"]})}),d.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(d.error)}),t.jsxs("div",{className:"flex justify-end gap-2",children:[p.isError&&t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void p.refetch(),children:"Try again"}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:r,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-route-allow-${n.id}`,disabled:!x||p.isFetching||!s||d.isPending,onClick:y,children:d.isPending?"Allowing…":"Allow route"})]})]})}function vn({documentId:e,route:n,online:s,onAnnounce:r}){const[l,m]=h.useState(!1),{revoke:o}=Be(e),i=n.state==="granted"&&n.grant!==null,a=()=>{o.mutate({routeId:n.id},{onSuccess:g=>r(Ge(g.route))})};return t.jsxs("li",{"data-testid":`doc-route-${n.id}`,"data-state":n.state,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:L(n.destination),children:L(n.destination)}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[t.jsx("code",{className:"font-mono",children:n.on})," · ",n.id]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:xn[n.state],"data-testid":`doc-route-state-${n.id}`,className:"shrink-0",children:Pe(n.state)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:ln(n)}),i&&n.grant&&t.jsx("p",{className:"text-muted-foreground text-xs",children:He(n.grant.limits)}),o.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Q(o.error)}),l?t.jsx(gn,{documentId:e,route:n,online:s,onAnnounce:r,onDone:()=>m(!1)}):t.jsx("div",{className:"flex justify-end",children:i?t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-turn-off-${n.id}`,disabled:!s||o.isPending,onClick:a,children:o.isPending?"Turning off…":"Turn off"}):t.jsx(b,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-review-button-${n.id}`,disabled:!s,onClick:()=>m(!0),children:"Review"})})]})}function yn(e){return e==="expired"?"Never started":"May have run"}function bn(e){return e==="expired"?"It waited a day and never started.":"It reached the agent, but its result is unknown."}function wn(e){switch(e.replay){case"ready":return null;case"no_grant":return"This route is off. Allow it to run this again.";case"route_changed":return"The route changed, so this can’t run again.";case"inputs_gone":return"Some of its events are no longer kept.";case"still_running":return"It may still be running. Check back once it stops.";case"route_busy":return e.status==="in_doubt"?"Newer work is waiting behind this. Clear it to continue.":"Newer work is waiting on this route. Try again after it runs."}}function jn(e){return`${e} ${e===1?"event":"events"}`}function kn(e){return`${e} to review`}const G="Only a signed-in person can change this.",ge="This work changed. The list is up to date now.",ve={WORK_ALREADY_REVIEWED:"This was already run again or cleared.",WORK_STILL_RUNNING:"It may still be running. Try again once it stops.",WORK_NOT_FOUND:ge,WORK_NOT_REVIEWABLE:ge,CONFIRM_REPEAT_REQUIRED:"Confirm before running this again.",GRANT_REQUIRED:"This route is off. Allow it first.",GRANT_REVOKED:"This route is off. Allow it first.",GRANT_EXPIRED:"This route’s approval ended. Allow it again first.",MANIFEST_CHANGED:"The document’s app changed. Allow the route again.",ROUTE_CHANGED:"The route changed, so this can’t run again.",INPUTS_GONE:"Some of its events are no longer kept.",ROUTE_BUSY:"Newer work is waiting on this route.",AGENT_CANNOT_DECIDE:G,REQUESTER_CANNOT_DECIDE:G,PERSON_REQUIRED:G,operator_cookie_required:G,AUTH_REQUIRED:"Sign in to change this."};function Nn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&ve[n]?ve[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this work. Try again."}const J=e=>["canvas-doc-work",e];function Cn(e,n,s){const r=D();return ne({queryKey:J(e),queryFn:()=>r.getCanvasDocWork(e),enabled:n,retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:s?15e3:6e4})}function Rn(e){const n=D(),s=se(),r=i=>s.setQueryData(J(e),a=>a&&{...a,items:a.items.filter(g=>g.batchId!==i.batchId)}),l=()=>void s.invalidateQueries({queryKey:J(e)}),m=K({mutationFn:i=>n.replayCanvasDocWork(e,i.batchId,i.confirmRepeat?{confirmRepeat:!0}:{}),networkMode:"always",onSuccess:r,onSettled:l}),o=K({mutationFn:i=>n.clearCanvasDocWork(e,i.batchId),networkMode:"always",onSuccess:r,onSettled:l});return{replay:m,clear:o}}function En({documentId:e,item:n,route:s,online:r,onAnnounce:l}){const[m,o]=h.useState(!1),[i,a]=h.useState(null),g=h.useRef(null),p=h.useRef(null),{replay:d,clear:x}=Rn(e),y=d.isPending||x.isPending,c=n.replay==="still_running",R=wn(n),w=s?L(s.destination):n.routeId,E=n.status==="in_doubt",I=d.error??x.error;h.useEffect(()=>{var C,T;i==="cancel"&&((C=g.current)==null||C.focus()),i==="replay"&&((T=p.current)==null||T.focus())},[i,m]);const z=()=>{o(!0),a("cancel")},V=()=>{o(!1),a("replay")},N=C=>{x.reset(),d.mutate({batchId:n.batchId,...C?{confirmRepeat:C}:{}},{onSuccess:()=>l(`Running again: ${w}`)})},_=()=>{d.reset(),x.mutate({batchId:n.batchId},{onSuccess:()=>l(`Cleared: ${w}`)})};return t.jsxs("li",{"data-testid":`doc-work-${n.batchId}`,"data-status":n.status,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:w,children:w}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[jn(n.eventCount)," · ",gt(n.since)]})]}),t.jsx(ye,{shape:"pill",variant:"outline",size:"xs",tone:E?"warning":"neutral",className:"shrink-0",children:yn(n.status)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:bn(n.status)}),R&&t.jsx("p",{"data-testid":`doc-work-blocked-${n.batchId}`,className:"text-muted-foreground text-xs",children:R}),I&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:Nn(I)}),m?t.jsxs("div",{"data-testid":`doc-work-confirm-${n.batchId}`,className:"bg-background space-y-2 rounded-md p-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Run this again?"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"It may repeat what the agent already did."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{ref:g,type:"button",variant:"ghost",size:"sm",onClick:V,children:"Cancel"}),t.jsx(b,{type:"button",size:"sm","data-testid":`doc-work-confirm-replay-${n.batchId}`,disabled:!r||y,onClick:()=>N(!0),children:d.isPending?"Starting…":"Run again"})]})]}):t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(b,{type:"button",variant:"ghost",size:"sm","data-testid":`doc-work-clear-${n.batchId}`,disabled:!r||y||c,onClick:_,children:x.isPending?"Clearing…":"Clear"}),t.jsx(b,{ref:p,type:"button",variant:"outline",size:"sm","data-testid":`doc-work-replay-${n.batchId}`,disabled:!r||y||R!==null,onClick:()=>E?z():N(),children:d.isPending?"Starting…":"Run again"})]})]})}function Tn({documentId:e,routes:n,online:s}){var y;const[r,l]=h.useState(!1),[m,o]=h.useState(""),i=Cn(e,n.length>0,r),a=h.useCallback(c=>o(c),[]),g=((y=i.data)==null?void 0:y.items)??[],p=t.jsx("p",{"aria-live":"polite",className:"sr-only",children:m});if(g.length===0)return p;const d=kn(g.length),x=g.some(c=>c.status==="in_doubt");return t.jsxs(t.Fragment,{children:[p,t.jsxs(be,{open:r,onOpenChange:l,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-work-trigger","aria-label":`Unfinished work: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Lt,{className:"size-3.5"}),t.jsxs("span",{className:O("flex items-center gap-1",x?"text-status-warning-fg":"text-muted-foreground"),children:[x&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Unfinished work","data-testid":"doc-work-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(ke,{children:"Unfinished work"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Unfinished work"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing runs again until you choose."})]}),!s&&t.jsx("p",{className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),i.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh this list."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Work to review",children:g.map(c=>t.jsx(En,{documentId:e,item:c,route:n.find(R=>R.id===c.routeId),online:s,onAnnounce:a},c.batchId))})]})]})]})}function An(e,n){return n>0?`${n} waiting`:e>0?`${e} on`:"Off"}function We({documentId:e}){var x;const[n,s]=h.useState(!1),[r,l]=h.useState(""),m=fn(),o=mn(e,n),i=h.useCallback(y=>l(y),[]),a=((x=o.data)==null?void 0:x.routes)??[];if(a.length===0)return null;const{on:g,waiting:p}=dn(a),d=An(g,p);return t.jsxs("div",{"data-testid":"doc-routes-bar",className:"text-muted-foreground flex items-center justify-end gap-1 border-b px-3 py-1 text-xs",children:[t.jsx(Tn,{documentId:e,routes:a,online:m}),t.jsxs(be,{open:n,onOpenChange:s,modal:!0,fullHeight:!0,children:[t.jsx(we,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-routes-trigger","aria-label":`Event routes: ${d}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Yt,{className:"size-3.5"}),"Routes",t.jsxs("span",{className:O("flex items-center gap-1",p>0?"text-status-warning-fg":"text-muted-foreground"),children:[p>0&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),d]})]})}),t.jsxs(je,{align:"end","aria-label":"Event routes","data-testid":"doc-routes-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(ke,{children:"Event routes"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Event routes"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"A route does nothing until it’s allowed."})]}),!m&&t.jsx("p",{"data-testid":"doc-routes-offline",className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),o.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh routes."}),t.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:()=>void o.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Declared routes",children:a.map(y=>t.jsx(vn,{documentId:e,route:y,online:m,onAnnounce:i},y.id))}),t.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:r})]})]})]})}function Dn({sourceLabel:e,people:n,following:s,onFollow:r,onStopFollowing:l,onDiscuss:m,discussing:o=!1}){const i=n.find(a=>a.id===s)??null;return e===void 0&&n.length===0&&m===void 0?null:t.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[e!==void 0&&t.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),e===void 0&&t.jsx("span",{className:"flex-1"}),m&&t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:o,onClick:m,children:[t.jsx(vt,{className:"size-3.5"}),"Discuss"]}),n.length>0&&t.jsxs(yt,{children:[t.jsx(bt,{asChild:!0,children:t.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:O("h-6 gap-1 px-1.5",i&&"text-foreground"),children:[t.jsx(wt,{className:"size-3.5"}),i?`Following ${i.displayName}`:"Follow"]})}),t.jsxs(jt,{align:"end",children:[t.jsx(kt,{children:"Follow somebody’s browser"}),n.map(a=>t.jsxs(me,{onSelect:()=>a.id===s?l():r(a.id),children:[t.jsx(Z,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??te(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:ee(a.displayName)}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&t.jsx(Nt,{className:"size-3.5 shrink-0"})]},a.id)),i&&t.jsx(me,{onSelect:l,children:"Stop following"})]})]})]})}function _n({roomId:e,document:n,reading:s}){const r=D(),l=se(),[m,o]=h.useState(null),i=h.useMemo(()=>Ft({transport:r,queryClient:l,roomId:e}),[r,l,e]);return t.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[t.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Ce,{className:"text-muted-foreground size-4 shrink-0"}),t.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),t.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),t.jsx(b,{type:"button",size:"sm",onClick:()=>o(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&t.jsx(Pt,{source:i,path:m,onClose:()=>o(null)})]})}const In=["image","pdf","audio","video","csv","model3d"];function Sn(e){return/^(https?:|data:)/.test(e)}function On(e){if(e.type==="file"||e.type==="diff")return e.sourcePath;if(e.type==="markdown")return e.sourcePath??null;if(In.includes(e.type)){const n=e.src;return Sn(n)?null:n}return null}function zn(e){return e.type==="file"||e.type==="diff"||e.type==="markdown"}function Mn(e){const n=/^(?:in )?(.+?)['’]s /.exec(e.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function Un(e){const n=On(e.content);if(n===null)return{kind:"inline"};if(e.treeKind==="room-main"||e.treeKind===void 0)return zn(e.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(e.content.type==="diff"&&e.treeKind==="worktree"&&typeof e.aheadOfMain=="number"&&e.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:e.content};if(e.content.type==="markdown")return{kind:"inline"};const s=Mn(e);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function $n(e){return e.title||e.contentType}function Ln({roomId:e,document:n,onUpdate:s}){const r=Un(n);return r.kind==="worktree-diff"?t.jsx(At,{roomId:e,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?t.jsx(_n,{roomId:e,document:n,reading:r}):n.content.type==="markdown"?t.jsx(Ot,{roomId:e,document:n,content:n.content,onSave:s}):t.jsx(Re,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function Ke({roomId:e,view:n}){var le;const s=Ne(),r=k(u=>u.roomCanvasDocuments[e]),l=k(u=>{var f;return((f=u.roomCanvasActive[e])==null?void 0:f[n])??null}),m=k(u=>{var f;return(f=u.roomCanvasUnread[e])==null?void 0:f[n]}),o=k(u=>u.activateRoomCanvasDocument),i=k(u=>u.clearRoomCanvasUnread),a=k(u=>u.roomCanvasPresence[e]),g=It(e),p=Ct(e),d=D(),x=((le=p.data)==null?void 0:le.viewerAuthorId)??null,y=k(u=>u.roomCanvasEditing[e]??null),c=Rt(u=>u.openThread),[R,w]=h.useState(!1),E=n==="browser"?e:null,{following:I,follow:z,stop:V}=$t(E),N=Et(E),_=h.useRef(null),C=h.useCallback(async(u,f)=>{try{return await f(),!0}catch(M){return he.error(u,{description:pe(M)}),!1}},[]),T=h.useMemo(()=>Tt(r??[],n),[r,n]),j=T.find(u=>u.id===l)??null,oe=(m==null?void 0:m.length)??0;h.useEffect(()=>{oe>0&&i(e,n)},[oe,i,e,n]);const Ye=h.useMemo(()=>{var ce;const u=new Map(((ce=p.data)==null?void 0:ce.members.map(v=>[v.author.id,v.author]))??[]),f=v=>({id:v.id,displayName:v.displayName,kind:v.kind,...v.emoji?{emoji:v.emoji}:{},...v.color?{color:v.color}:{},...v.imageUrl?{imageUrl:v.imageUrl}:{}}),M=new Map;for(const[v,U]of Object.entries(a??{})){if(v===x)continue;const S=u.get(v);if(!S)continue;const de=M.get(U);de?de.push(f(S)):M.set(U,[f(S)])}return T.map(v=>{const U=u.get(v.authorId),S=M.get(v.id);return{id:v.id,sourceLabel:$n(v),contentType:v.content.type,pinned:v.pinned,unread:(m==null?void 0:m.includes(v.id))??!1,...U?{author:f(U)}:{},...S?{watchers:S}:{}}})},[T,p.data,m,a,x]);St(e,(j==null?void 0:j.id)??null);const qe=h.useMemo(()=>{var u;return(((u=p.data)==null?void 0:u.members)??[]).map(f=>f.author).filter(f=>f.kind==="human"&&f.id!==x).map(f=>({id:f.id,displayName:f.displayName,kind:f.kind,emoji:f.emoji,color:f.color,imageUrl:f.imageUrl}))},[p.data,x]),Qe=k(u=>{if(l===null)return;const f=u.browserHistories[l];return f?f.stack[f.cursor]:void 0}),Xe=h.useCallback(()=>{var u;return((u=_.current)==null?void 0:u.scrollTop)??0},[]),Je=h.useCallback(u=>{const f=_.current;return f?(f.addEventListener("scroll",u,{passive:!0}),()=>f.removeEventListener("scroll",u)):()=>{}},[]);qt({roomId:E,viewerAuthorId:x,documentId:l,url:Qe,readScrollY:Xe,subscribe:Je});const ie=h.useMemo(()=>T.map(u=>u.id).join("\0"),[T]);h.useEffect(()=>{if(!(N===null||y!==null)&&ie.split("\0").includes(N.documentId)){if(N.documentId!==l){o(e,N.documentId);return}N.scrollY!==void 0&&_.current&&(_.current.scrollTop=N.scrollY)}},[N,y,l,ie,o,e]);const Ze=h.useCallback(()=>{j!==null&&(w(!0),d.discussCanvasDocument(e,j.id).then(u=>c(e,u.threadRootEntryId,!1)).catch(u=>{he.error("Couldn’t start a discussion.",{description:pe(u)})}).finally(()=>w(!1)))},[j,d,e,c]),et=ae(n);return t.jsxs(t.Fragment,{children:[!s&&t.jsx(Ue,{view:n,documents:Ye,activeDocumentId:l,onActivate:u=>o(e,u),onClose:u=>void C("Couldn’t take that off the canvas.",()=>g.close(u)),onPin:(u,f)=>void C(f?"Couldn’t pin that.":"Couldn’t unpin that.",()=>g.pin(u,f))}),t.jsx(Dn,{sourceLabel:j==null?void 0:j.sourceLabel,people:n==="browser"?qe:[],following:I,onFollow:z,onStopFollowing:V,onDiscuss:j===null?void 0:Ze,discussing:R}),j&&t.jsx(We,{documentId:j.id},j.id),t.jsx("div",{id:et,ref:_,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&j?{role:"tabpanel","aria-labelledby":re(j.id)}:{},children:j?t.jsx($e,{documentId:j.id,children:t.jsx(Ln,{roomId:e,document:j,onUpdate:(u,f)=>C("Couldn’t save that for the room.",()=>g.update(u,f))})},j.id):t.jsx(Le,{view:n,onAction:u=>void C("Couldn’t put that on the canvas.",()=>g.open(u))})})]})}function Ve({view:e}){const n=Ne(),s=k(c=>c.openDocuments),r=k(c=>e==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),l=k(c=>c.activateCanvasDocument),m=k(c=>c.closeCanvasDocument),o=k(c=>c.setDocumentContent),i=k(c=>c.openCanvasDocument),a=k(c=>c.applyHeldUpdate),g=k(c=>c.discardHeldUpdate),p=Dt(s,e),d=p.find(c=>c.id===r)??null,x=p.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),y=ae(e);return t.jsxs(t.Fragment,{children:[!n&&t.jsx(Ue,{view:e,documents:x,activeDocumentId:r,onActivate:l,onClose:m}),d&&t.jsx(We,{documentId:d.id},d.id),(d==null?void 0:d.heldUpdate)&&t.jsx(sn,{onReload:()=>a(d.id),onKeepMine:()=>g(d.id)}),t.jsx("div",{id:y,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&d?{role:"tabpanel","aria-labelledby":re(d.id)}:{},children:d?t.jsx($e,{documentId:d.id,children:t.jsx(Re,{documentId:d.id,content:d.content,onContentChange:c=>o(d.id,c)})},d.id):t.jsx(Le,{view:e,onAction:i})})]})}function ds(){const e=k(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"canvas"}):t.jsx(Ve,{view:"canvas"})})}function us(){const e=k(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(Ke,{roomId:e,view:"browser"}):t.jsx(Ve,{view:"browser"})})}export{us as BrowserContent,ds as CanvasContent,ps as CanvasWidgetContent,fs as resetSessionCanvasImport,xs as useDevtoolsBridge,gs as useDocChannel,vs as useSessionCanvas};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{P as st,g as Z,h as v,X as it,N as Ee,s as Ie,T as H,p as ot,t as m,e as F,j as P,Y as z,a as fe,o as at,Z as lt,E as ht,_ as ft,$ as ut,a0 as dt,U as pt,a1 as ct,q as mt,f as Me,i as gt,a2 as kt,m as ue,a3 as Lt}from"./index-pQstFziR.js";import{html as bt,htmlCompletionSource as wt}from"./index-CYhf-E_N.js";import"./index-DwrBsA10.js";import"./index-D6NjBiAq.js";import"./index-BRyEtRBO.js";import"./index-DMfV6rUz.js";class _{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new _(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[v.contextHash,s]]}addChild(e,r){e.prop(v.contextHash)!=this.hash&&(e=new H(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new H(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new H(Z.none,s,i,o,this.hashProp)})}}var u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));class St{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class Ct{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return O(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}}function de(t,e,r){if(r.pos==r.text.length||t!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==u.OrderedList?oe:ie)(r,e,!1);return n>0&&(t.type!=u.BulletList||se(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const He={[u.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(k(u.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(A(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[u.ListItem](t,e,r){return r.indent<r.baseIndent+t.value&&r.next>-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[u.OrderedList]:de,[u.BulletList]:de,[u.Document](){return!0}};function A(t){return t==32||t==9||t==10||t==13}function O(t,e=0){for(;e<t.length&&A(t.charCodeAt(e));)e++;return e}function pe(t,e,r){for(;e>r&&A(t.charCodeAt(e-1));)e--;return e}function Pe(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let r=e;r<t.text.length;r++)if(t.text.charCodeAt(r)==96)return-1}return e}function ve(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function se(t,e,r){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let n=1;for(let s=t.pos+1;s<t.text.length;s++){let i=t.text.charCodeAt(s);if(i==t.next)n++;else if(!A(i))return-1}return r&&t.next==45&&Re(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(De.SetextHeading)>-1||n<3?-1:1}function Ne(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function ie(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||A(t.text.charCodeAt(t.pos+1)))&&(!r||Ne(e,u.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function oe(t,e,r){let n=t.pos,s=t.next;for(;s>=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||n<t.text.length-1&&!A(t.text.charCodeAt(n+1))||r&&!Ne(e,u.OrderedList)&&(t.skipSpace(n+1)==t.text.length||n>t.pos+1||t.next!=49)?-1:n+1-t.pos}function ye(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let r=e-t.pos;return r>6?-1:r}function Re(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let r=e;for(;e<t.text.length&&A(t.text.charCodeAt(e));)e++;return e==t.text.length?r:-1}const W=/^[ \t]*$/,Oe=/-->/,Te=/\?>/,ee=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Oe],[/^\s*<\?/,Te],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,W],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,W]];function ze(t,e,r){if(t.next!=60)return-1;let n=t.text.slice(t.pos);for(let s=0,i=ee.length-(r?1:0);s<i;s++)if(ee[s][0].test(n))return s;return-1}function ce(t,e){let r=t.countIndent(e,t.pos,t.indent),n=t.countIndent(t.skipSpace(e),e,r);return n>=r+5?r+1:n}function x(t,e,r){let n=t.length-1;n>=0&&t[n].to==e&&t[n].type==u.CodeText?t[n].to=r:t.push(k(u.CodeText,e,r))}const $={LinkReference:void 0,IndentedCode(t,e){let r=e.baseIndent+4;if(e.indent<r)return!1;let n=e.findColumn(r),s=t.lineStart+n,i=t.lineStart+e.text.length,o=[],a=[];for(x(o,s,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){x(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<r)break;{if(a.length){for(let h of a)h.type==u.CodeText?x(o,h.from,h.to):o.push(h);a=[]}x(o,t.lineStart-1,t.lineStart);for(let h of e.markers)o.push(h);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&x(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=u.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(u.CodeBlock,i-s),s),!0},FencedCode(t,e){let r=Pe(e);if(r<0)return!1;let n=t.lineStart+e.pos,s=e.next,i=r-e.pos,o=e.skipSpace(r),a=pe(e.text,e.text.length,o),l=[k(u.CodeMark,n,n+i)];o<a&&l.push(k(u.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0,f=!0,p=!1;t.nextLine()&&e.depth>=t.stack.length;h=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==s;)d++;if(d-e.pos>=i&&e.skipSpace(d)==e.text.length){for(let c of e.markers)l.push(c);f&&p&&x(l,t.lineStart-1,t.lineStart),l.push(k(u.CodeMark,t.lineStart+e.pos,t.lineStart+d)),t.nextLine();break}else{p=!0,h||(x(l,t.lineStart-1,t.lineStart),f=!1);for(let g of e.markers)l.push(g);let c=t.lineStart+e.basePos,L=t.lineStart+e.text.length;c<L&&(x(l,c,L),f=!1)}}return t.addNode(t.buffer.writeElements(l,-n).finish(u.FencedCode,t.prevLineEnd()-n),n),!0},Blockquote(t,e){let r=ve(e);return r<0?!1:(t.startContext(u.Blockquote,e.pos),t.addNode(u.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+r),null)},HorizontalRule(t,e){if(se(e,t,!1)<0)return!1;let r=t.lineStart+e.pos;return t.nextLine(),t.addNode(u.HorizontalRule,r),!0},BulletList(t,e){let r=ie(e,t,!1);if(r<0)return!1;t.block.type!=u.BulletList&&t.startContext(u.BulletList,e.basePos,e.next);let n=ce(e,e.pos+1);return t.startContext(u.ListItem,e.basePos,n-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},OrderedList(t,e){let r=oe(e,t,!1);if(r<0)return!1;t.block.type!=u.OrderedList&&t.startContext(u.OrderedList,e.basePos,e.text.charCodeAt(e.pos+r-1));let n=ce(e,e.pos+r);return t.startContext(u.ListItem,e.basePos,n-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},ATXHeading(t,e){let r=ye(e);if(r<0)return!1;let n=e.pos,s=t.lineStart+n,i=pe(e.text,e.text.length,n),o=i;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==n||!A(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(u.HeaderMark,0,r).writeElements(t.parser.parseInline(e.text.slice(n+r+1,o),s+r+1),-s);o<e.text.length&&a.write(u.HeaderMark,o-n,i-n);let l=a.finish(u.ATXHeading1-1+r,e.text.length-n);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let r=ze(e,t,!1);if(r<0)return!1;let n=t.lineStart+e.pos,s=ee[r][1],i=[],o=s!=W;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let h of e.markers)i.push(h)}o&&t.nextLine();let a=s==Oe?u.CommentBlock:s==Te?u.ProcessingInstructionBlock:u.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-n).finish(a,l-n),n),!0},SetextHeading:void 0};class At{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,r,n){if(this.stage==-1)return!1;let s=n.content+`
|
|
1
|
+
import{P as st,g as Z,h as v,X as it,N as Ee,s as Ie,T as H,p as ot,t as m,e as F,j as P,Y as z,a as fe,o as at,Z as lt,E as ht,_ as ft,$ as ut,a0 as dt,U as pt,a1 as ct,q as mt,f as Me,i as gt,a2 as kt,m as ue,a3 as Lt}from"./index-BSxkprTm.js";import{html as bt,htmlCompletionSource as wt}from"./index-DG13Cp5o.js";import"./index-B6Scr7KJ.js";import"./index-B-7P1Q9s.js";import"./index-LpaxG4VS.js";import"./index-C3swXqWW.js";class _{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new _(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.hashProp=[[v.contextHash,s]]}addChild(e,r){e.prop(v.contextHash)!=this.hash&&(e=new H(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new H(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new H(Z.none,s,i,o,this.hashProp)})}}var u;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(u||(u={}));class St{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}}class Ct{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return O(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s<e;s++)n+=this.text.charCodeAt(s)==9?4-n%4:1;return n}findColumn(e){let r=0;for(let n=0;r<this.text.length&&n<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return r}scrub(){if(!this.baseIndent)return this.text;let e="";for(let r=0;r<this.basePos;r++)e+=" ";return e+this.text.slice(this.basePos)}}function de(t,e,r){if(r.pos==r.text.length||t!=e.block&&r.indent>=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==u.OrderedList?oe:ie)(r,e,!1);return n>0&&(t.type!=u.BulletList||se(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}const He={[u.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(k(u.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(A(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[u.ListItem](t,e,r){return r.indent<r.baseIndent+t.value&&r.next>-1?!1:(r.moveBaseColumn(r.baseIndent+t.value),!0)},[u.OrderedList]:de,[u.BulletList]:de,[u.Document](){return!0}};function A(t){return t==32||t==9||t==10||t==13}function O(t,e=0){for(;e<t.length&&A(t.charCodeAt(e));)e++;return e}function pe(t,e,r){for(;e>r&&A(t.charCodeAt(e-1));)e--;return e}function Pe(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;if(e<t.pos+3)return-1;if(t.next==96){for(let r=e;r<t.text.length;r++)if(t.text.charCodeAt(r)==96)return-1}return e}function ve(t){return t.next!=62?-1:t.text.charCodeAt(t.pos+1)==32?2:1}function se(t,e,r){if(t.next!=42&&t.next!=45&&t.next!=95)return-1;let n=1;for(let s=t.pos+1;s<t.text.length;s++){let i=t.text.charCodeAt(s);if(i==t.next)n++;else if(!A(i))return-1}return r&&t.next==45&&Re(t)>-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(De.SetextHeading)>-1||n<3?-1:1}function Ne(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function ie(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||A(t.text.charCodeAt(t.pos+1)))&&(!r||Ne(e,u.BulletList)||t.skipSpace(t.pos+2)<t.text.length)?1:-1}function oe(t,e,r){let n=t.pos,s=t.next;for(;s>=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||n<t.text.length-1&&!A(t.text.charCodeAt(n+1))||r&&!Ne(e,u.OrderedList)&&(t.skipSpace(n+1)==t.text.length||n>t.pos+1||t.next!=49)?-1:n+1-t.pos}function ye(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==35;)e++;if(e<t.text.length&&t.text.charCodeAt(e)!=32)return-1;let r=e-t.pos;return r>6?-1:r}function Re(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e<t.text.length&&t.text.charCodeAt(e)==t.next;)e++;let r=e;for(;e<t.text.length&&A(t.text.charCodeAt(e));)e++;return e==t.text.length?r:-1}const W=/^[ \t]*$/,Oe=/-->/,Te=/\?>/,ee=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Oe],[/^\s*<\?/,Te],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,W],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,W]];function ze(t,e,r){if(t.next!=60)return-1;let n=t.text.slice(t.pos);for(let s=0,i=ee.length-(r?1:0);s<i;s++)if(ee[s][0].test(n))return s;return-1}function ce(t,e){let r=t.countIndent(e,t.pos,t.indent),n=t.countIndent(t.skipSpace(e),e,r);return n>=r+5?r+1:n}function x(t,e,r){let n=t.length-1;n>=0&&t[n].to==e&&t[n].type==u.CodeText?t[n].to=r:t.push(k(u.CodeText,e,r))}const $={LinkReference:void 0,IndentedCode(t,e){let r=e.baseIndent+4;if(e.indent<r)return!1;let n=e.findColumn(r),s=t.lineStart+n,i=t.lineStart+e.text.length,o=[],a=[];for(x(o,s,i);t.nextLine()&&e.depth>=t.stack.length;)if(e.pos==e.text.length){x(a,t.lineStart-1,t.lineStart);for(let l of e.markers)a.push(l)}else{if(e.indent<r)break;{if(a.length){for(let h of a)h.type==u.CodeText?x(o,h.from,h.to):o.push(h);a=[]}x(o,t.lineStart-1,t.lineStart);for(let h of e.markers)o.push(h);i=t.lineStart+e.text.length;let l=t.lineStart+e.findColumn(e.baseIndent+4);l<i&&x(o,l,i)}}return a.length&&(a=a.filter(l=>l.type!=u.CodeText),a.length&&(e.markers=a.concat(e.markers))),t.addNode(t.buffer.writeElements(o,-s).finish(u.CodeBlock,i-s),s),!0},FencedCode(t,e){let r=Pe(e);if(r<0)return!1;let n=t.lineStart+e.pos,s=e.next,i=r-e.pos,o=e.skipSpace(r),a=pe(e.text,e.text.length,o),l=[k(u.CodeMark,n,n+i)];o<a&&l.push(k(u.CodeInfo,t.lineStart+o,t.lineStart+a));for(let h=!0,f=!0,p=!1;t.nextLine()&&e.depth>=t.stack.length;h=!1){let d=e.pos;if(e.indent-e.baseIndent<4)for(;d<e.text.length&&e.text.charCodeAt(d)==s;)d++;if(d-e.pos>=i&&e.skipSpace(d)==e.text.length){for(let c of e.markers)l.push(c);f&&p&&x(l,t.lineStart-1,t.lineStart),l.push(k(u.CodeMark,t.lineStart+e.pos,t.lineStart+d)),t.nextLine();break}else{p=!0,h||(x(l,t.lineStart-1,t.lineStart),f=!1);for(let g of e.markers)l.push(g);let c=t.lineStart+e.basePos,L=t.lineStart+e.text.length;c<L&&(x(l,c,L),f=!1)}}return t.addNode(t.buffer.writeElements(l,-n).finish(u.FencedCode,t.prevLineEnd()-n),n),!0},Blockquote(t,e){let r=ve(e);return r<0?!1:(t.startContext(u.Blockquote,e.pos),t.addNode(u.QuoteMark,t.lineStart+e.pos,t.lineStart+e.pos+1),e.moveBase(e.pos+r),null)},HorizontalRule(t,e){if(se(e,t,!1)<0)return!1;let r=t.lineStart+e.pos;return t.nextLine(),t.addNode(u.HorizontalRule,r),!0},BulletList(t,e){let r=ie(e,t,!1);if(r<0)return!1;t.block.type!=u.BulletList&&t.startContext(u.BulletList,e.basePos,e.next);let n=ce(e,e.pos+1);return t.startContext(u.ListItem,e.basePos,n-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},OrderedList(t,e){let r=oe(e,t,!1);if(r<0)return!1;t.block.type!=u.OrderedList&&t.startContext(u.OrderedList,e.basePos,e.text.charCodeAt(e.pos+r-1));let n=ce(e,e.pos+r);return t.startContext(u.ListItem,e.basePos,n-e.baseIndent),t.addNode(u.ListMark,t.lineStart+e.pos,t.lineStart+e.pos+r),e.moveBaseColumn(n),null},ATXHeading(t,e){let r=ye(e);if(r<0)return!1;let n=e.pos,s=t.lineStart+n,i=pe(e.text,e.text.length,n),o=i;for(;o>n&&e.text.charCodeAt(o-1)==e.next;)o--;(o==i||o==n||!A(e.text.charCodeAt(o-1)))&&(o=e.text.length);let a=t.buffer.write(u.HeaderMark,0,r).writeElements(t.parser.parseInline(e.text.slice(n+r+1,o),s+r+1),-s);o<e.text.length&&a.write(u.HeaderMark,o-n,i-n);let l=a.finish(u.ATXHeading1-1+r,e.text.length-n);return t.nextLine(),t.addNode(l,s),!0},HTMLBlock(t,e){let r=ze(e,t,!1);if(r<0)return!1;let n=t.lineStart+e.pos,s=ee[r][1],i=[],o=s!=W;for(;!s.test(e.text)&&t.nextLine();){if(e.depth<t.stack.length){o=!1;break}for(let h of e.markers)i.push(h)}o&&t.nextLine();let a=s==Oe?u.CommentBlock:s==Te?u.ProcessingInstructionBlock:u.HTMLBlock,l=t.prevLineEnd();return t.addNode(t.buffer.writeElements(i,-n).finish(a,l-n),n),!0},SetextHeading:void 0};class At{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,r,n){if(this.stage==-1)return!1;let s=n.content+`
|
|
2
2
|
`+r.scrub(),i=this.advance(s);return i>-1&&i<s.length?this.complete(e,n,i):!1}finish(e,r){return(this.stage==2||this.stage==3)&&O(r.content,this.pos)==r.content.length?this.complete(e,r,r.content.length):!1}complete(e,r,n){return e.addLeafElement(r,k(u.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Qe(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(k(u.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(qe(e,O(e,this.pos),this.start)))return-1}else if(this.stage==2){let r=O(e,this.pos),n=0;if(r>this.pos){let s=Ze(e,r,this.start);if(s){let i=V(e,s.to-this.start);i>0&&(this.nextStage(s),n=i)}}return n||(n=V(e,this.pos)),n>0&&n<e.length?n:-1}else return V(e,this.pos)}}}function V(t,e){for(;e<t.length;e++){let r=t.charCodeAt(e);if(r==10)break;if(!A(r))return-1}return e}class xt{nextLine(e,r,n){let s=r.depth<e.stack.length?-1:Re(r),i=r.next;if(s<0)return!1;let o=k(u.HeaderMark,e.lineStart+r.pos,e.lineStart+s);return e.nextLine(),e.addLeafElement(n,k(i==61?u.SetextHeading1:u.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}}const De={LinkReference(t,e){return e.content.charCodeAt(0)==91?new At(e):null},SetextHeading(){return new xt}},Bt=[(t,e)=>ye(e)>=0,(t,e)=>Pe(e)>=0,(t,e)=>ve(e)>=0,(t,e)=>ie(e,t,!0)>=0,(t,e)=>oe(e,t,!0)>=0,(t,e)=>se(e,t,!0)>=0,(t,e)=>ze(e,t,!0)>=0],Et={text:"",end:0};class It{constructor(e,r,n,s){this.parser=e,this.input=r,this.ranges=s,this.line=new Ct,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=s[s.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=s[0].from,this.block=_.create(u.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Pt(n,r):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let s=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!s||e.markers[n].from<s.end);){let i=e.markers[n++];this.addNode(i.type,i.from,i.to)}if(!s)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let s=n(this,e);if(s!=!1){if(s==!0)return null;e.forward();continue e}}break}let r=new St(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let s=n(this,r);s&&r.parsers.push(s)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,r))break e}for(let n of r.parsers)if(n.nextLine(this,e,r))return null;r.content+=`
|
|
3
3
|
`+e.scrub();for(let n of e.markers)r.marks.push(n)}return this.finishLeaf(r),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let r=this.fragments.takeNodes(this);return r?(this.absoluteLineStart+=r,this.lineStart=Ve(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let r=Et;if(r.end=e,e>=this.to)r.text="";else if(r.text=this.lineChunkAt(e),r.end+=r.text.length,this.ranges.length>1){let n=this.absoluteLineStart,s=this.rangeI;for(;this.ranges[s].to<r.end;){s++;let i=this.ranges[s].from,o=this.lineChunkAt(i);r.end=i+o.length,r.text=r.text.slice(0,this.ranges[s-1].to-n)+o,n=r.end-r.text.length}}return r}readLine(){let{line:e}=this,{text:r,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(r);e.depth<this.stack.length;e.depth++){let s=this.stack[e.depth],i=this.parser.skipContextMarkup[s.type];if(!i)throw new Error("Unhandled block context "+u[s.type]);let o=this.line.markers.length;if(!i(s,this,e)){this.line.markers.length>o&&(s.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let r=this.input.chunk(e),n;if(this.input.lineChunks)n=r==`
|
|
4
4
|
`?"":r;else{let s=r.indexOf(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as z,er as B}from"./index-DwrBsA10.js";function N(r){return typeof r=="object"?r.key:r}function H(r,a){const t=r.length;return new Proxy(r,{get(s,e,n){if(typeof e=="string"){const l=e.charCodeAt(0);if(l>=48&&l<=57){const i=+e;if(Number.isInteger(i)&&i>=0&&i<t){let o=s[i];if(typeof o!="object"){const c=a[i*2];o=s[i]={index:i,key:o,start:c,size:a[i*2+1],end:c+a[i*2+1],lane:0}}return o}}if(e==="length")return t}return Reflect.get(s,e,n)}})}function A(r,a,t){let s=t.initialDeps??[],e,n=!0;function l(){const i=r();return(i.length!==s.length||i.some((c,g)=>s[g]!==c))&&(s=i,e=a(...i),t!=null&&t.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(e),n=!1),e}return l.updateDeps=i=>{s=i},l}function k(r,a){if(r===void 0)throw new Error("Unexpected undefined");return r}const V=(r,a)=>Math.abs(r-a)<1.01,J=(r,a,t)=>{let s;return Object.assign(function(...e){r.clearTimeout(s),s=r.setTimeout(()=>a.apply(this,e),t)},{cancel:()=>{r.clearTimeout(s)}})};let R;const L=()=>{if(R!==void 0)return R;if(typeof navigator>"u")return R=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return R=!0;const r=navigator.maxTouchPoints;return R=navigator.platform==="MacIntel"&&r!==void 0&&r>0},K=r=>{const{offsetWidth:a,offsetHeight:t}=r;return{width:a,height:t}},$=r=>r,q=r=>{const a=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-a+1,e=new Array(s);for(let n=0;n<s;n++)e[n]=a+n;return e},U=(r,a)=>{const t=r.scrollElement;if(!t)return;const s=r.targetWindow;if(!s)return;const e=l=>{const{width:i,height:o}=l;a({width:Math.round(i),height:Math.round(o)})};if(e(K(t)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(l=>{const i=()=>{const o=l[0];if(o!=null&&o.borderBoxSize){const c=o.borderBoxSize[0];if(c){e({width:c.inlineSize,height:c.blockSize});return}}e(K(t))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},j={passive:!0},X=typeof window>"u"?!0:"onscrollend"in window,G=(r,a,t)=>{const s=r.scrollElement;if(!s)return;const e=r.targetWindow;if(!e)return;const n=r.options.useScrollendEvent&&X;let l=0;const i=n?null:J(e,()=>a(t(s),!1),r.options.isScrollingResetDelay),o=h=>()=>{l=t(s),i==null||i(),a(l,h)},c=o(!0),g=o(!1);return s.addEventListener("scroll",c,j),n&&s.addEventListener("scrollend",g,j),()=>{s.removeEventListener("scroll",c),n&&s.removeEventListener("scrollend",g),i==null||i.cancel()}},Q=(r,a)=>G(r,a,t=>{const{horizontal:s,isRtl:e}=r.options;return s?t.scrollLeft*(e&&-1||1):t.scrollTop}),Y=(r,a,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(r),e=t.options.getItemKey(s);return t.itemSizeCache.get(e)??t.options.estimateSize(s)}if(a!=null&&a.borderBoxSize){const s=a.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!a){const s=t.indexFromElement(r),e=t.options.getItemKey(s),n=t.itemSizeCache.get(e);if(n!==void 0)return n}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},Z=(r,{adjustments:a=0,behavior:t},s)=>{var e,n;(n=(e=s.scrollElement)==null?void 0:e.scrollTo)==null||n.call(e,{[s.options.horizontal?"left":"top"]:r+a,behavior:t})},tt=Z;function et(r,a,t,s){if(a===0)return!1;const e=s(0),n=new Set;let l=0;for(;l<r;){const o=t(l);if(o===e)break;n.add(o),l++}const i=r-l;if(i===0||i>=a)return!1;for(let o=0;o<i;o++)if(s(o)!==t(l+o))return!1;for(let o=i;o<a;o++)if(n.has(s(o)))return!1;return!0}class st{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,s,e;return((e=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:e.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(e=>{e.forEach(n=>{const l=()=>{const i=n.target,o=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(const[c,g]of this.elementsCache)if(g===i){this.elementsCache.delete(c);break}return}this.isIndexInRange(o)&&this.shouldMeasureDuringScroll(o)&&this.resizeItem(o,this.options.measureElement(i,n,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var e;(e=s())==null||e.disconnect(),t=null},observe:e=>{var n;return(n=s())==null?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return(n=s())==null?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=t=>{var s;const e={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$,rangeExtractor:q,onChange:()=>{},measureElement:Y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in t){const d=t[h];d!==void 0&&(e[h]=d)}const n=this.options;let l=null,i=null,o=!1;if(n!==void 0&&n.enabled&&e.enabled&&e.anchorTo==="end"&&this.scrollElement!==null){const h=n.count,d=e.count,u=this.getMeasurements(),S=((s=this._singleLaneMeasurements)==null?void 0:s.items)??u,p=E=>N(S[E]),v=h>0?p(0):null,b=h>0?p(h-1):null;if(d!==h||h>0&&d>0&&(e.getItemKey(0)!==v||e.getItemKey(d-1)!==b)){o=!0;const E=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??u[0]:null;E&&(l=[E.key,this.getScrollOffset()-E.start]);const _=e.followOnAppend===!0?"auto":e.followOnAppend||null;_&&d>0&&this.isAtEnd(n.scrollEndThreshold)&&(h===0||e.getItemKey(d-1)!==b)&&(d>h||et(h,d,p,e.getItemKey))&&(i=_)}}this.options=e,o&&(this.pendingMin=0,this.itemSizeCacheVersion++);let c=!1,g=0;if(l&&this.scrollOffset!==null){const[h,d]=l,u=this.getMeasurements(),{count:S,getItemKey:p}=this.options;let v=0;for(;v<S&&p(v)!==h;)v++;if(v<S){const b=u[v];if(b){const f=Math.max(0,b.start+d);!i&&f!==this.scrollOffset&&(g=f-this.scrollOffset,this.scrollOffset=f,c=!0)}}}(c||i)&&(this.pendingScrollAnchor=[c?l[0]:null,c?l[1]:0,i,g])},this.notify=t=>{var s,e;(e=(s=this.options).onChange)==null||e.call(s,this,t)},this.maybeNotify=A(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,s;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,i)=>{if(i&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(l-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=i?o===l?this.scrollDirection:o<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!L()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",i,j),l.addEventListener("touchend",o,j),this.unsubs.push(()=>{l.removeEventListener("touchstart",i),l.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[l,i,o,c]=n;l!==null&&!o&&(L()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):((s=this.scrollState)==null?void 0:s.behavior)==="smooth"&&!V(this.getScrollOffset()-c,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:s}=this._clampedAdjustment,e=this.getMaxScrollOffset();e>s+.5&&(this._clampedAdjustment=t>e+.5?{target:t,maxAtWrite:e}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;if(this._iosDeferredAdjustment<0&&t>=s-1){this._iosDeferredAdjustment=0;return}const e=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=e,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=A(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,e,n,l,i,o,c)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:l,lanes:i,laneAssignmentMode:o,gap:c}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=A(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:l,lanes:i,laneAssignmentMode:o,gap:c},g)=>{var h;const d=this.itemSizeCache;if(!l)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const f of this.laneAssignments.keys())f>=t&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),i===1){const f=t*2;let m=(h=this._singleLaneMeasurements)==null?void 0:h.flat;if(!m||m.length<f){const O=new Float64Array(f);m&&u>0&&O.set(m.subarray(0,u*2)),m=O}const E=u===0?new Array(t):this._singleLaneMeasurements.items.slice();let _;if(u===0)_=s+e;else{const O=u-1;_=m[O*2]+m[O*2+1]+c}for(let O=u;O<t;O++){const M=n(O);E[O]=M;const T=d.get(M),w=typeof T=="number"?T:this.options.estimateSize(O);m[O*2]=_,m[O*2+1]=w,_+=w+c}this._singleLaneMeasurements={flat:m,items:E};const x=H(E,m);return this.measurementsCache=x,x}const S=this.measurementsCache.slice(0,u),p=new Array(i).fill(void 0),v=new Float64Array(i);let b=0;for(let f=0;f<u;f++){const m=S[f];m&&(p[m.lane]===void 0&&b++,p[m.lane]=f,v[m.lane]=m.end)}for(let f=u;f<t;f++){const m=n(f),E=this.laneAssignments.get(f);let _,x;const O=o==="estimate"||d.has(m);if(E!==void 0&&this.options.lanes>1){_=E;const C=p[_],I=C!==void 0?S[C]:void 0;x=I?I.end+c:s+e}else if(b===i){let C=0,I=v[0],W=p[0];for(let y=1;y<i;y++){const F=v[y];(F<I||F===I&&p[y]<W)&&(C=y,I=F,W=p[y])}_=C,x=I+c,O&&this.laneAssignments.set(f,_)}else _=f%this.options.lanes,x=s+e,O&&this.laneAssignments.set(f,_);const M=d.get(m),T=typeof M=="number"?M:this.options.estimateSize(f),w=x+T;S[f]={index:f,start:x,size:T,end:w,key:m,lane:_},p[_]===void 0&&b++,p[_]=f,v[_]=w}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=A(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,e,n)=>t.length===0||s===0?(this.range=null,null):(this.range=it(t,s,e,n,n===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=A(()=>{let t=null,s=null;const e=this.calculateRange();return e&&(t=e.startIndex,s=e.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,e,n,l)=>n===null||l===null?[]:t({startIndex:n,endIndex:l,overscan:s,count:e}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,e=t.getAttribute(s);return e?parseInt(e,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const e=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(e!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,e-n),i=Math.min(this.options.count-1,e+n);return t>=l&&t<=i}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,i)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(i))});return}const s=this.indexFromElement(t);if(!this.isIndexInRange(s))return;const e=this.options.getItemKey(s),n=this.elementsCache.get(e);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(e,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var e,n,l;if(!this.isIndexInRange(t))return;let i,o,c;const g=(e=this._singleLaneMeasurements)==null?void 0:e.flat;if(this.options.lanes===1&&g!=null)c=this.options.getItemKey(t),o=g[t*2],i=g[t*2+1];else{const u=this.measurementsCache[t];if(!u)return;c=u.key,o=u.start,i=u.size}const h=this.itemSizeCache.get(c)??i,d=s-h;if(d!==0){const u=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=u?this.getTotalSize():0,p=this.getScrollOffset()+this.scrollAdjustments,b=!this.itemSizeCache.has(c)?o<p:o+h<=p&&this.scrollDirection!=="backward",f=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:c,start:o,size:i,end:o+i,lane:0},d,this):b);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++;let m=!1;u?m=this.applyScrollAdjustment(this.getTotalSize()-S):f&&(m=this.applyScrollAdjustment(d)),this.notify(m),this._retryClampedAdjustment()}},this.getVirtualItems=A(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const e=[];for(let n=0,l=t.length;n<l;n++){const i=t[n],o=s[i];e.push(o)}return e},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var s;const e=this.getMeasurements();if(e.length===0)return;const n=(s=this._singleLaneMeasurements)==null?void 0:s.flat,l=this.options.lanes===1&&n!=null,i=P(0,e.length-1,l?o=>n[o*2]:o=>k(e[o]).start,t);return k(e[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,e=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+n?"end":"start"),s==="center"?t+=(e-n)/2:s==="end"&&(t-=n);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const e=this.getSize(),n=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=n+e-this.options.scrollPaddingEnd)s="end";else if(l.start<=n+this.options.scrollPaddingStart)s="start";else return[n,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const i=s==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,l.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0;const n=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:e,startedAt:l,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getOffsetForIndex(t,s);if(!n)return;const[l,i]=n,o=this.now();this.scrollState={index:t,align:i,behavior:e,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const e=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:n,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,s;const e=this.getMeasurements();let n;if(e.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const l=e.length-1,i=(t=this._singleLaneMeasurements)==null?void 0:t.flat;i!=null?n=i[l*2]+i[l*2+1]:n=((s=e[l])==null?void 0:s.end)??0}else{const l=Array(this.options.lanes).fill(null);let i=e.length-1;for(;i>=0&&l.some(o=>o===null);){const o=e[i];l[o.lane]===null&&(l[o.lane]=o.end),i--}n=Math.max(...l.filter(o=>o!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const e of s)e&&this.itemSizeCache.has(e.key)&&t.push({index:e.index,key:e.key,start:e.start,size:e.size,end:e.end,lane:e.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:e})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:e,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,t){if(a===0)return!1;if(L()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=a,!1;{const s=this.getScrollOffset()+this.scrollAdjustments+a,e=this.scrollElement,n=e!==null&&("scrollHeight"in e||"document"in e)?this.getMaxScrollOffset():null;return this._clampedAdjustment=n!==null&&s>n+.5?{target:s,maxAtWrite:n}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=s?s[0]:this.scrollState.lastTargetOffset,n=1,l=e!==this.scrollState.lastTargetOffset;if(!l&&V(e,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const i=this.getSize()||600,o=Math.abs(e-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&o>i;this.scrollState.lastTargetOffset=e,c||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const P=(r,a,t,s)=>{for(;r<=a;){const e=(r+a)/2|0,n=t(e);if(n<s)r=e+1;else if(n>s)a=e-1;else return e}return r>0?r-1:0};function nt(r,a,t){let s=0;for(;s<=a;){const e=(s+a)/2|0,n=r[e*2];if(n<t)s=e+1;else if(n>t)a=e-1;else return e}return s>0?s-1:0}function it(r,a,t,s,e){const n=r.length-1;if(r.length<=s)return{startIndex:0,endIndex:n};if(s===1&&e!==null){const c=nt(e,n,t);let g=c;const h=t+a;for(;g<n&&e[g*2]+e[g*2+1]<h;)g++;return{startIndex:c,endIndex:g}}let i=P(0,n,c=>r[c].start,t),o=i;if(s===1)for(;o<n&&r[o].end<t+a;)o++;else if(s>1){const c=Array(s).fill(0);for(;o<n&&c.some(h=>h<t+a);){const h=r[o];c[h.lane]=h.end,o++}const g=Array(s).fill(t+a);for(;i>=0&&g.some(h=>h>=t);){const h=r[i];g[h.lane]=h.start,i--}i=Math.max(0,i-i%s),o=Math.min(n,o+(s-1-o%s))}return{startIndex:i,endIndex:o}}const D=typeof document<"u"?z.useLayoutEffect:z.useEffect;function lt({useFlushSync:r=!0,directDomUpdates:a=!1,directDomUpdatesMode:t="transform",...s}){const e=z.useReducer(h=>h+1,0)[1],n=z.useRef({enabled:a,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});n.current.enabled=a,n.current.mode=t;const l=z.useRef(!1),i=h=>{const d=n.current;if(!d.enabled||!d.container)return;const u=h.getTotalSize();if(u!==d.lastSize){d.lastSize=u;const S=h.options.horizontal?"width":"height";d.container.style[S]=`${u}px`}},o=h=>{const d=n.current;if(!d.enabled||!d.container)return;i(h);const u=!!h.options.horizontal,S=d.mode==="transform",p=u?"left":"top",v=h.options.scrollMargin,b=h.getVirtualItems();for(const f of b){const m=f.start-v,E=h.elementsCache.get(f.key);E&&d.lastPositions.get(E)!==m&&(d.lastPositions.set(E,m),S?E.style.transform=u?`translate3d(${m}px, 0, 0)`:`translate3d(0, ${m}px, 0)`:E.style[p]=`${m}px`)}},c={...s,onChange:(h,d)=>{var u;const S=n.current;let p=!0;if(S.enabled){o(h);const v=h.range,b=S.prevRange;p=!b||b.isScrolling!==h.isScrolling||b.startIndex!==(v==null?void 0:v.startIndex)||b.endIndex!==(v==null?void 0:v.endIndex),p&&(S.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:h.isScrolling}:null)}p&&(r&&d&&!l.current?B.flushSync(e):e()),(u=s.onChange)==null||u.call(s,h,d)}},[g]=z.useState(()=>{const h=new st(c),d=h.measureElement;return h.measureElement=u=>{l.current=!0;try{d(u)}finally{l.current=!1}},Object.assign(h,{containerRef:u=>{const S=n.current;if(S.container=u,S.lastSize=null,u&&S.enabled){const p=h.getTotalSize();S.lastSize=p;const v=h.options.horizontal?"width":"height";u.style[v]=`${p}px`}}})});return g.setOptions(c),D(()=>g._didMount(),[]),D(()=>(i(g),g._willUpdate())),D(()=>{o(g)}),g}function rt(r){return lt({observeElementRect:U,observeElementOffset:Q,scrollToFn:tt,...r})}export{rt as u};
|
|
1
|
+
import{r as z,et as B}from"./index-B6Scr7KJ.js";function N(r){return typeof r=="object"?r.key:r}function H(r,a){const t=r.length;return new Proxy(r,{get(s,e,n){if(typeof e=="string"){const l=e.charCodeAt(0);if(l>=48&&l<=57){const i=+e;if(Number.isInteger(i)&&i>=0&&i<t){let o=s[i];if(typeof o!="object"){const c=a[i*2];o=s[i]={index:i,key:o,start:c,size:a[i*2+1],end:c+a[i*2+1],lane:0}}return o}}if(e==="length")return t}return Reflect.get(s,e,n)}})}function A(r,a,t){let s=t.initialDeps??[],e,n=!0;function l(){const i=r();return(i.length!==s.length||i.some((c,g)=>s[g]!==c))&&(s=i,e=a(...i),t!=null&&t.onChange&&!(n&&t.skipInitialOnChange)&&t.onChange(e),n=!1),e}return l.updateDeps=i=>{s=i},l}function k(r,a){if(r===void 0)throw new Error("Unexpected undefined");return r}const V=(r,a)=>Math.abs(r-a)<1.01,J=(r,a,t)=>{let s;return Object.assign(function(...e){r.clearTimeout(s),s=r.setTimeout(()=>a.apply(this,e),t)},{cancel:()=>{r.clearTimeout(s)}})};let R;const L=()=>{if(R!==void 0)return R;if(typeof navigator>"u")return R=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return R=!0;const r=navigator.maxTouchPoints;return R=navigator.platform==="MacIntel"&&r!==void 0&&r>0},K=r=>{const{offsetWidth:a,offsetHeight:t}=r;return{width:a,height:t}},$=r=>r,q=r=>{const a=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-a+1,e=new Array(s);for(let n=0;n<s;n++)e[n]=a+n;return e},U=(r,a)=>{const t=r.scrollElement;if(!t)return;const s=r.targetWindow;if(!s)return;const e=l=>{const{width:i,height:o}=l;a({width:Math.round(i),height:Math.round(o)})};if(e(K(t)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(l=>{const i=()=>{const o=l[0];if(o!=null&&o.borderBoxSize){const c=o.borderBoxSize[0];if(c){e({width:c.inlineSize,height:c.blockSize});return}}e(K(t))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(t,{box:"border-box"}),()=>{n.unobserve(t)}},j={passive:!0},X=typeof window>"u"?!0:"onscrollend"in window,G=(r,a,t)=>{const s=r.scrollElement;if(!s)return;const e=r.targetWindow;if(!e)return;const n=r.options.useScrollendEvent&&X;let l=0;const i=n?null:J(e,()=>a(t(s),!1),r.options.isScrollingResetDelay),o=h=>()=>{l=t(s),i==null||i(),a(l,h)},c=o(!0),g=o(!1);return s.addEventListener("scroll",c,j),n&&s.addEventListener("scrollend",g,j),()=>{s.removeEventListener("scroll",c),n&&s.removeEventListener("scrollend",g),i==null||i.cancel()}},Q=(r,a)=>G(r,a,t=>{const{horizontal:s,isRtl:e}=r.options;return s?t.scrollLeft*(e&&-1||1):t.scrollTop}),Y=(r,a,t)=>{if(t.options.useCachedMeasurements){const s=t.indexFromElement(r),e=t.options.getItemKey(s);return t.itemSizeCache.get(e)??t.options.estimateSize(s)}if(a!=null&&a.borderBoxSize){const s=a.borderBoxSize[0];if(s)return Math.round(s[t.options.horizontal?"inlineSize":"blockSize"])}if(!a){const s=t.indexFromElement(r),e=t.options.getItemKey(s),n=t.itemSizeCache.get(e);if(n!==void 0)return n}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},Z=(r,{adjustments:a=0,behavior:t},s)=>{var e,n;(n=(e=s.scrollElement)==null?void 0:e.scrollTo)==null||n.call(e,{[s.options.horizontal?"left":"top"]:r+a,behavior:t})},tt=Z;function et(r,a,t,s){if(a===0)return!1;const e=s(0),n=new Set;let l=0;for(;l<r;){const o=t(l);if(o===e)break;n.add(o),l++}const i=r-l;if(i===0||i>=a)return!1;for(let o=0;o<i;o++)if(s(o)!==t(l+o))return!1;for(let o=i;o<a;o++)if(n.has(s(o)))return!1;return!0}class st{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,s,e;return((e=(s=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:s.now)==null?void 0:e.call(s))??Date.now()},this.observer=(()=>{let t=null;const s=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(e=>{e.forEach(n=>{const l=()=>{const i=n.target,o=this.indexFromElement(i);if(!i.isConnected){this.observer.unobserve(i);for(const[c,g]of this.elementsCache)if(g===i){this.elementsCache.delete(c);break}return}this.isIndexInRange(o)&&this.shouldMeasureDuringScroll(o)&&this.resizeItem(o,this.options.measureElement(i,n,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var e;(e=s())==null||e.disconnect(),t=null},observe:e=>{var n;return(n=s())==null?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return(n=s())==null?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=t=>{var s;const e={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:$,rangeExtractor:q,onChange:()=>{},measureElement:Y,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const h in t){const d=t[h];d!==void 0&&(e[h]=d)}const n=this.options;let l=null,i=null,o=!1;if(n!==void 0&&n.enabled&&e.enabled&&e.anchorTo==="end"&&this.scrollElement!==null){const h=n.count,d=e.count,u=this.getMeasurements(),S=((s=this._singleLaneMeasurements)==null?void 0:s.items)??u,p=E=>N(S[E]),v=h>0?p(0):null,b=h>0?p(h-1):null;if(d!==h||h>0&&d>0&&(e.getItemKey(0)!==v||e.getItemKey(d-1)!==b)){o=!0;const E=h>0?this.getVirtualItemForOffset(this.getScrollOffset())??u[0]:null;E&&(l=[E.key,this.getScrollOffset()-E.start]);const _=e.followOnAppend===!0?"auto":e.followOnAppend||null;_&&d>0&&this.isAtEnd(n.scrollEndThreshold)&&(h===0||e.getItemKey(d-1)!==b)&&(d>h||et(h,d,p,e.getItemKey))&&(i=_)}}this.options=e,o&&(this.pendingMin=0,this.itemSizeCacheVersion++);let c=!1,g=0;if(l&&this.scrollOffset!==null){const[h,d]=l,u=this.getMeasurements(),{count:S,getItemKey:p}=this.options;let v=0;for(;v<S&&p(v)!==h;)v++;if(v<S){const b=u[v];if(b){const f=Math.max(0,b.start+d);!i&&f!==this.scrollOffset&&(g=f-this.scrollOffset,this.scrollOffset=f,c=!0)}}}(c||i)&&(this.pendingScrollAnchor=[c?l[0]:null,c?l[1]:0,i,g])},this.notify=t=>{var s,e;(e=(s=this.options).onChange)==null||e.call(s,this,t)},this.maybeNotify=A(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,s;const e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,i)=>{if(i&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(l-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const o=this.getScrollOffset();this.scrollDirection=i?o===l?this.scrollDirection:o<l?"forward":"backward":null,this.scrollOffset=l,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const l=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},o=()=>{this._iosTouching=!1,!(!L()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",i,j),l.addEventListener("touchend",o,j),this.unsubs.push(()=>{l.removeEventListener("touchstart",i),l.removeEventListener("touchend",o),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[l,i,o,c]=n;l!==null&&!o&&(L()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?c!==0&&(this._iosDeferredAdjustment+=c):((s=this.scrollState)==null?void 0:s.behavior)==="smooth"&&!V(this.getScrollOffset()-c,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),o&&this.scrollToEnd({behavior:o})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:s}=this._clampedAdjustment,e=this.getMaxScrollOffset();e>s+.5&&(this._clampedAdjustment=t>e+.5?{target:t,maxAtWrite:e}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),s=this.getMaxScrollOffset();if(t<0||t>s)return;if(this._iosDeferredAdjustment<0&&t>=s-1){this._iosDeferredAdjustment=0;return}const e=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=e,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=A(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,s,e,n,l,i,o,c)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:l,lanes:i,laneAssignmentMode:o,gap:c}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=A(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:s,scrollMargin:e,getItemKey:n,enabled:l,lanes:i,laneAssignmentMode:o,gap:c},g)=>{var h;const d=this.itemSizeCache;if(!l)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const f of this.laneAssignments.keys())f>=t&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),i===1){const f=t*2;let m=(h=this._singleLaneMeasurements)==null?void 0:h.flat;if(!m||m.length<f){const O=new Float64Array(f);m&&u>0&&O.set(m.subarray(0,u*2)),m=O}const E=u===0?new Array(t):this._singleLaneMeasurements.items.slice();let _;if(u===0)_=s+e;else{const O=u-1;_=m[O*2]+m[O*2+1]+c}for(let O=u;O<t;O++){const M=n(O);E[O]=M;const T=d.get(M),w=typeof T=="number"?T:this.options.estimateSize(O);m[O*2]=_,m[O*2+1]=w,_+=w+c}this._singleLaneMeasurements={flat:m,items:E};const x=H(E,m);return this.measurementsCache=x,x}const S=this.measurementsCache.slice(0,u),p=new Array(i).fill(void 0),v=new Float64Array(i);let b=0;for(let f=0;f<u;f++){const m=S[f];m&&(p[m.lane]===void 0&&b++,p[m.lane]=f,v[m.lane]=m.end)}for(let f=u;f<t;f++){const m=n(f),E=this.laneAssignments.get(f);let _,x;const O=o==="estimate"||d.has(m);if(E!==void 0&&this.options.lanes>1){_=E;const C=p[_],I=C!==void 0?S[C]:void 0;x=I?I.end+c:s+e}else if(b===i){let C=0,I=v[0],W=p[0];for(let y=1;y<i;y++){const F=v[y];(F<I||F===I&&p[y]<W)&&(C=y,I=F,W=p[y])}_=C,x=I+c,O&&this.laneAssignments.set(f,_)}else _=f%this.options.lanes,x=s+e,O&&this.laneAssignments.set(f,_);const M=d.get(m),T=typeof M=="number"?M:this.options.estimateSize(f),w=x+T;S[f]={index:f,start:x,size:T,end:w,key:m,lane:_},p[_]===void 0&&b++,p[_]=f,v[_]=w}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=A(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,s,e,n)=>t.length===0||s===0?(this.range=null,null):(this.range=it(t,s,e,n,n===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=A(()=>{let t=null,s=null;const e=this.calculateRange();return e&&(t=e.startIndex,s=e.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,s]},(t,s,e,n,l)=>n===null||l===null?[]:t({startIndex:n,endIndex:l,overscan:s,count:e}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const s=this.options.indexAttribute,e=t.getAttribute(s);return e?parseInt(e,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const e=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(e!==void 0&&this.range){const n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,e-n),i=Math.min(this.options.count-1,e+n);return t>=l&&t<=i}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((l,i)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(i))});return}const s=this.indexFromElement(t);if(!this.isIndexInRange(s))return;const e=this.options.getItemKey(s),n=this.elementsCache.get(e);n!==t&&(n&&this.observer.unobserve(n),this.observer.observe(t),this.elementsCache.set(e,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,s)=>{var e,n,l;if(!this.isIndexInRange(t))return;let i,o,c;const g=(e=this._singleLaneMeasurements)==null?void 0:e.flat;if(this.options.lanes===1&&g!=null)c=this.options.getItemKey(t),o=g[t*2],i=g[t*2+1];else{const u=this.measurementsCache[t];if(!u)return;c=u.key,o=u.start,i=u.size}const h=this.itemSizeCache.get(c)??i,d=s-h;if(d!==0){const u=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,S=u?this.getTotalSize():0,p=this.getScrollOffset()+this.scrollAdjustments,b=!this.itemSizeCache.has(c)?o<p:o+h<=p&&this.scrollDirection!=="backward",f=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:c,start:o,size:i,end:o+i,lane:0},d,this):b);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++;let m=!1;u?m=this.applyScrollAdjustment(this.getTotalSize()-S):f&&(m=this.applyScrollAdjustment(d)),this.notify(m),this._retryClampedAdjustment()}},this.getVirtualItems=A(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,s)=>{const e=[];for(let n=0,l=t.length;n<l;n++){const i=t[n],o=s[i];e.push(o)}return e},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var s;const e=this.getMeasurements();if(e.length===0)return;const n=(s=this._singleLaneMeasurements)==null?void 0:s.flat,l=this.options.lanes===1&&n!=null,i=P(0,e.length-1,l?o=>n[o*2]:o=>k(e[o]).start,t);return k(e[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,s,e=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),l=this.getScrollOffset();s==="auto"&&(s=t>=l+n?"end":"start"),s==="center"?t+=(e-n)/2:s==="end"&&(t-=n);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,t),0)},this.getOffsetForIndex=(t,s="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const e=this.getSize(),n=this.getScrollOffset(),l=this.measurementsCache[t];if(!l)return;if(s==="auto")if(l.end>=n+e-this.options.scrollPaddingEnd)s="end";else if(l.start<=n+this.options.scrollPaddingStart)s="start";else return[n,s];if(s==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),s];const i=s==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,l.size),s]},this.scrollToOffset=(t,{align:s="start",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0;const n=this.getOffsetForAlignment(t,s),l=this.now();this.scrollState={index:null,align:s,behavior:e,startedAt:l,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:s="auto",behavior:e="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const n=this.getOffsetForIndex(t,s);if(!n)return;const[l,i]=n,o=this.now();this.scrollState={index:t,align:i,behavior:e,startedAt:o,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:e}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:s="auto"}={})=>{const e=this.getScrollOffset()+t,n=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:n,lastTargetOffset:e,stableFrames:0},this._scrollToOffset(e,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,s;const e=this.getMeasurements();let n;if(e.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const l=e.length-1,i=(t=this._singleLaneMeasurements)==null?void 0:t.flat;i!=null?n=i[l*2]+i[l*2+1]:n=((s=e[l])==null?void 0:s.end)??0}else{const l=Array(this.options.lanes).fill(null);let i=e.length-1;for(;i>=0&&l.some(o=>o===null);){const o=e[i];l[o.lane]===null&&(l[o.lane]=o.end),i--}n=Math.max(...l.filter(o=>o!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const s=this.getMeasurements();for(const e of s)e&&this.itemSizeCache.has(e.key)&&t.push({index:e.index,key:e.key,start:e.start,size:e.size,end:e.end,lane:e.lane});return t},this._scrollToOffset=(t,{adjustments:s,behavior:e})=>{this._intendedScrollOffset=t+(s??0),this.options.scrollToFn(t,{behavior:e,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}applyScrollAdjustment(a,t){if(a===0)return!1;if(L()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=a,!1;{const s=this.getScrollOffset()+this.scrollAdjustments+a,e=this.scrollElement,n=e!==null&&("scrollHeight"in e||"document"in e)?this.getMaxScrollOffset():null;return this._clampedAdjustment=n!==null&&s>n+.5?{target:s,maxAtWrite:n}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,e=s?s[0]:this.scrollState.lastTargetOffset,n=1,l=e!==this.scrollState.lastTargetOffset;if(!l&&V(e,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==e&&this._scrollToOffset(e,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const i=this.getSize()||600,o=Math.abs(e-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&o>i;this.scrollState.lastTargetOffset=e,c||(this.scrollState.behavior="auto"),this._scrollToOffset(e,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}}const P=(r,a,t,s)=>{for(;r<=a;){const e=(r+a)/2|0,n=t(e);if(n<s)r=e+1;else if(n>s)a=e-1;else return e}return r>0?r-1:0};function nt(r,a,t){let s=0;for(;s<=a;){const e=(s+a)/2|0,n=r[e*2];if(n<t)s=e+1;else if(n>t)a=e-1;else return e}return s>0?s-1:0}function it(r,a,t,s,e){const n=r.length-1;if(r.length<=s)return{startIndex:0,endIndex:n};if(s===1&&e!==null){const c=nt(e,n,t);let g=c;const h=t+a;for(;g<n&&e[g*2]+e[g*2+1]<h;)g++;return{startIndex:c,endIndex:g}}let i=P(0,n,c=>r[c].start,t),o=i;if(s===1)for(;o<n&&r[o].end<t+a;)o++;else if(s>1){const c=Array(s).fill(0);for(;o<n&&c.some(h=>h<t+a);){const h=r[o];c[h.lane]=h.end,o++}const g=Array(s).fill(t+a);for(;i>=0&&g.some(h=>h>=t);){const h=r[i];g[h.lane]=h.start,i--}i=Math.max(0,i-i%s),o=Math.min(n,o+(s-1-o%s))}return{startIndex:i,endIndex:o}}const D=typeof document<"u"?z.useLayoutEffect:z.useEffect;function lt({useFlushSync:r=!0,directDomUpdates:a=!1,directDomUpdatesMode:t="transform",...s}){const e=z.useReducer(h=>h+1,0)[1],n=z.useRef({enabled:a,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});n.current.enabled=a,n.current.mode=t;const l=z.useRef(!1),i=h=>{const d=n.current;if(!d.enabled||!d.container)return;const u=h.getTotalSize();if(u!==d.lastSize){d.lastSize=u;const S=h.options.horizontal?"width":"height";d.container.style[S]=`${u}px`}},o=h=>{const d=n.current;if(!d.enabled||!d.container)return;i(h);const u=!!h.options.horizontal,S=d.mode==="transform",p=u?"left":"top",v=h.options.scrollMargin,b=h.getVirtualItems();for(const f of b){const m=f.start-v,E=h.elementsCache.get(f.key);E&&d.lastPositions.get(E)!==m&&(d.lastPositions.set(E,m),S?E.style.transform=u?`translate3d(${m}px, 0, 0)`:`translate3d(0, ${m}px, 0)`:E.style[p]=`${m}px`)}},c={...s,onChange:(h,d)=>{var u;const S=n.current;let p=!0;if(S.enabled){o(h);const v=h.range,b=S.prevRange;p=!b||b.isScrolling!==h.isScrolling||b.startIndex!==(v==null?void 0:v.startIndex)||b.endIndex!==(v==null?void 0:v.endIndex),p&&(S.prevRange=v?{startIndex:v.startIndex,endIndex:v.endIndex,isScrolling:h.isScrolling}:null)}p&&(r&&d&&!l.current?B.flushSync(e):e()),(u=s.onChange)==null||u.call(s,h,d)}},[g]=z.useState(()=>{const h=new st(c),d=h.measureElement;return h.measureElement=u=>{l.current=!0;try{d(u)}finally{l.current=!1}},Object.assign(h,{containerRef:u=>{const S=n.current;if(S.container=u,S.lastSize=null,u&&S.enabled){const p=h.getTotalSize();S.lastSize=p;const v=h.options.horizontal?"width":"height";u.style[v]=`${p}px`}}})});return g.setOptions(c),D(()=>g._didMount(),[]),D(()=>(i(g),g._willUpdate())),D(()=>{o(g)}),g}function rt(r){return lt({observeElementRect:U,observeElementOffset:Q,scrollToFn:tt,...r})}export{rt as u};
|