dorkos 0.119.0 → 0.120.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +3249 -2848
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DPEGtCwv.js → AboutPage-Y8O56Cz5.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-ENqFKw2l.js → ActivityErrorState-DlROxqde.js} +1 -1
- package/dist/client/assets/{ActivityPage-Bh3Fhkkr.js → ActivityPage-BdV90CV2.js} +1 -1
- package/dist/client/assets/{ActivityRow-Mj9YGZo2.js → ActivityRow-B5yiD_uD.js} +1 -1
- package/dist/client/assets/{AdapterIcon-BcejWkC-.js → AdapterIcon-Dyq92Eup.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-CEnUjD84.js → AdapterSetupWizard-D9tqz7Hl.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-DcKMOkUs.js → AgentOptionRow-BeRqDo7c.js} +1 -1
- package/dist/client/assets/{AgentPicker-W6XeKjz9.js → AgentPicker-BRyYVJZu.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-C8xPf4Ij.js → AgentRequestCard-xX6fAKgO.js} +4 -4
- package/dist/client/assets/{AppearancePage-uoWRNL1C.js → AppearancePage-DKF9BqRt.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-C5Nf8pjH.js → ApplyToOverridesDialog-CPvtr_-f.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-BI-uQ-ay.js → AttentionSignalRow-vBfioH1A.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Cpi-0c7y.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B50zNtwB.js} +1 -1
- package/dist/client/assets/{BindingDialog-B3vCYvfL.js → BindingDialog-CSNjws3F.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-D_HlpfZu.js → BlintzCanvas-ClOKWzws.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-DtZuAo03.js → CanvasCsvContent-0Mb7uOuA.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-g5wQR7yt.js → CanvasFileContent-B_8zsIas.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-BlYcTOLd.js → CanvasModel3dContent-UokbHY9i.js} +2 -2
- package/dist/client/assets/{ChatAppsOff-B996C06C.js → ChatAppsOff-CLRB0YU5.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-UfNeO6Wa.js → CodeMirrorDiff-B4uFJD6g.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BMSnTJnS.js → CodeMirrorEditor-rYOrBAZc.js} +1 -1
- package/dist/client/assets/{CommitmentList-LBnn140g.js → CommitmentList-i-IZ4gbr.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-BNEP939u.js → CommitmentsPage-ChO1JkrE.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-C97PoLhs.js → ComputerResourceView-pLuD2ie6.js} +1 -1
- package/dist/client/assets/{ComputerViewer-DVaP4S-x.js → ComputerViewer-D7tPmpY5.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-COotkMKW.js → ConnectionAccessLists-D6VH1vX3.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-DMqldmCl.js → ConnectionsPage-7x5olD9q.js} +1 -1
- package/dist/client/assets/{ConventionPage-DXcAUNjb.js → ConventionPage-BTYLWw6p.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-Cx-zCEnS.js → ExtensionPageRoute-A9AdBBbw.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-U9QmMzNM.js → FloatingTanStackRouterDevtools-CqogiFob-ayv0yz1C.js} +1 -1
- package/dist/client/assets/HandlePage-BdRWgke2.js +1 -0
- package/dist/client/assets/{HeartbeatPage-lS53N7qR.js → HeartbeatPage-Dh6W9Qg5.js} +1 -1
- package/dist/client/assets/KeyEntry-owhPGtw3.js +1 -0
- package/dist/client/assets/{LexicalField-NpV0yrX5.js → LexicalField-B1NFMLD6.js} +1 -1
- package/dist/client/assets/{ManagesPage-Dvjt_Ql0.js → ManagesPage-BAnBmBdo.js} +1 -1
- package/dist/client/assets/{Marketplace-BXrL6XrG.js → Marketplace-67maxdwz.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-Xm9UboIG.js → MarketplaceSourcesView-CzPBNJJj.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BOhSmDHb.js → McpAppFrame-CuObpQTg.js} +1 -1
- package/dist/client/assets/McpSigninBody-B-ayj6bQ.js +1 -0
- package/dist/client/assets/{Model3dViewer-B0efG9VW.js → Model3dViewer-DRVqxazk.js} +1 -1
- package/dist/client/assets/NamePage-DyH8JAqT.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-BOwmahin.js → NewDirectMessageMenu-B3DxayR2.js} +1 -1
- package/dist/client/assets/{NotificationsPage-pQg9DtG3.js → NotificationsPage-BavEo7VZ.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-C5dCRdqs.js → OpenMeshSwitch-BwkX2Toa.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-CgSvpX-s.js → OperatorIdentityForm-CtWgz2yi.js} +1 -1
- package/dist/client/assets/{PermissionHistory-ChEe8iYR.js → PermissionHistory-DvM0F2bS.js} +1 -1
- package/dist/client/assets/{PermissionsPage-C8gICIw9.js → PermissionsPage-D1DJHezV.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-DcuHjnIT.js → PersonalityPopover-BV-9wfIl.js} +1 -1
- package/dist/client/assets/PhotoPage-BHvRQnex.js +1 -0
- package/dist/client/assets/{PresetPicker-C-HcfktA.js → PresetPicker-BOQKgYAK.js} +2 -2
- package/dist/client/assets/{PreviewRefusedNotice-CgJeWKad.js → PreviewRefusedNotice-BdhUln2h.js} +1 -1
- package/dist/client/assets/{ProfileFields-Bpe71duM.js → ProfileFields-DFRnRR38.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-r2T2nLuy.js → ProfilePanelContainer-CkxX9Dps.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-B9as28eL.js → ProfileRolePicker-BSYi_luB.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-BjyRYcZH.js → PromptSuggestionChips-r08GqBH1.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-Bs59IbmP.js → ReportsToPopover-BcsM5Eia.js} +1 -1
- package/dist/client/assets/{RoomSurface-CcxCucEt.js → RoomSurface-DaRCf4og.js} +5 -5
- package/dist/client/assets/{RoomsPage-gAEppmDN.js → RoomsPage-CQqsdVvB.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-BYqbPh-k.js → RunsOnPopover-DFb4xEhP.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-BmMBE_ki.js → RuntimeConnectFlow-pKFJlNSJ.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-DsDi5RBn.js → RuntimeSetupDialog-DvBJbrmj.js} +1 -1
- package/dist/client/assets/{SessionsPage-Cid8fhdk.js → SessionsPage-CGgnEPh7.js} +1 -1
- package/dist/client/assets/SettingsDialog-D0cmzjrH.js +12 -0
- package/dist/client/assets/{SkillsPage-YiAaBf5n.js → SkillsPage-DDoPlsn2.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-BZ19n03x.js → TaskDialogWrapper-DoIVzbKU.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-RqhzTXZs.js → TasksEmptyState-B68O6dnT.js} +2 -2
- package/dist/client/assets/{TasksPage-CkaqOq26.js → TasksPage-BsBDphim.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-BFwHEcxT.js → TeamComputerEntry-CoQ4EsDm.js} +1 -1
- package/dist/client/assets/{ToolsPage-BnCLKQr8.js → ToolsPage-Cl1aOpev.js} +2 -2
- package/dist/client/assets/{TopologyGraph-CAkARLa1.js → TopologyGraph-D3CxaLGX.js} +2 -2
- package/dist/client/assets/{TourHost-D6Lclw6P.js → TourHost-4O6TJzc-.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-DqKrNRIZ.js → UnlinkDialog-DIMY60Fi.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-YpoGnbGt.js → WidgetErrorCard-CzWw_SPD.js} +23 -23
- package/dist/client/assets/_shell-BRH2Y-U-.js +80 -0
- package/dist/client/assets/{_shell._home-BcVOIprN.js → _shell._home-DG3Vw7S5.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-B-5keh6v.js → _shell._home.activity-COI96oAO.js} +1 -1
- package/dist/client/assets/{_shell._home.index-CeUO_fiS.js → _shell._home.index-CTwsTjcQ.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-DrghkSwu.js → _shell._home.tasks-DOVoPYaf.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-ClpXSXb7.js → _shell._home.workspaces-ApZhnjwy.js} +1 -1
- package/dist/client/assets/_shell.channels-CRkJHU5R.js +10 -0
- package/dist/client/assets/{_shell.connections-BAyaKCu0.js → _shell.connections-bhAK3jnE.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-C_0Cb9ew.js → _shell.feedback-requests-k43R8-rW.js} +1 -1
- package/dist/client/assets/_shell.marketplace-DGN_IdZY.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-2YMpLInp.js +1 -0
- package/dist/client/assets/{_shell.session-DAOicD3_.js → _shell.session-D871zZl3.js} +15 -15
- package/dist/client/assets/{_shell.team-C9JBEYch.js → _shell.team-DHCM1QoO.js} +6 -6
- package/dist/client/assets/_shell.x._extensionId-D3-n5IRW.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-D3-n5IRW.js +1 -0
- package/dist/client/assets/{access-copy-DBchOVu9.js → access-copy-BVzi1REx.js} +1 -1
- package/dist/client/assets/{banner-DyAc42ob.js → banner-3xXXsU5J.js} +1 -1
- package/dist/client/assets/{card-B1UFbnvJ.js → card-Bt6IU-Bh.js} +1 -1
- package/dist/client/assets/{command-EveETx4P.js → command-CWokzKS1.js} +1 -1
- package/dist/client/assets/{cpu-6HIzSTBv.js → cpu-BzByzE9V.js} +1 -1
- package/dist/client/assets/{empty-state-DK2Wg9m3.js → empty-state-BgnQDiMZ.js} +1 -1
- package/dist/client/assets/{execution-config-e5c_6oSg.js → execution-config-D5-SEt2t.js} +1 -1
- package/dist/client/assets/{file-CxdN5JO4.js → file-VHDTQub2.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-ID9vXo0l.js → file-exclamation-point-DbWvGys0.js} +1 -1
- package/dist/client/assets/{file-text-DtcloCeg.js → file-text-BAhi2zct.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-BGZDFnjV.js → find-latest-widget-fence-Z0HPVqeK.js} +1 -1
- package/dist/client/assets/{form-Bs1x_gSI.js → form-Blrb1xBU.js} +1 -1
- package/dist/client/assets/{format-cron-i_Bh2HP3.js → format-cron-lKWqEmle.js} +1 -1
- package/dist/client/assets/{git-branch-B3IXXOlG.js → git-branch-BObm8Rlz.js} +1 -1
- package/dist/client/assets/{heart-BKVGdKg5.js → heart-Du7nuefC.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-2S9TnGZL.js → highlighted-body-KPVGNVTW-B_GO7V1P.js} +1 -1
- package/dist/client/assets/{image-lightbox-D28E719A.js → image-lightbox-BZ1TV3mN.js} +1 -1
- package/dist/client/assets/{image-off-BuNZtQ_w.js → image-off-hnjcBIzN.js} +1 -1
- package/dist/client/assets/{index-CDBp2azY.js → index-1I8qHZDt.js} +1 -1
- package/dist/client/assets/{index-OTmqX-Xu.js → index-4GC2fkeO.js} +1 -1
- package/dist/client/assets/{index-CIxwv14l.js → index-4PAAWURd.js} +1 -1
- package/dist/client/assets/{index-CsUyZMaJ.js → index-B0tAedq7.js} +1 -1
- package/dist/client/assets/{index-BM9n-UZ_.js → index-BP68J4pb.js} +1 -1
- package/dist/client/assets/{index-Dr3MaxIU.js → index-BUOcbPfv.js} +3 -3
- package/dist/client/assets/{index-uukEE2As.js → index-BVKXIbLh.js} +1 -1
- package/dist/client/assets/{index-CHZfO-eM.js → index-BaRQVgiN.js} +1 -1
- package/dist/client/assets/{index-BUAYrK-t.js → index-BeVbHOwX.js} +2 -2
- package/dist/client/assets/{index-B-wVtE7g.js → index-BgzgdvDn.js} +1 -1
- package/dist/client/assets/{index-5081rTdO.js → index-Bm0z9mHt.js} +1 -1
- package/dist/client/assets/{index-Ce9sdGIU.js → index-BnNTKsbt.js} +1 -1
- package/dist/client/assets/{index-CAB4SfyK.js → index-BtbZpz4b.js} +1 -1
- package/dist/client/assets/{index-ClxqCDE6.js → index-BvjuGXcS.js} +1 -1
- package/dist/client/assets/{index-DrBU917j.js → index-C60RrnTd.js} +1 -1
- package/dist/client/assets/{index-Pcm0P4su.js → index-CBm3whA-.js} +1 -1
- package/dist/client/assets/{index-DVpRV8UX.js → index-CCg7yRe1.js} +1 -1
- package/dist/client/assets/{index-CxYD3BRB.js → index-CQCN6kWR.js} +1 -1
- package/dist/client/assets/index-Cdyszxoa.js +17 -0
- package/dist/client/assets/{index-LPr-pCZr.js → index-Ch-ON5gw.js} +1 -1
- package/dist/client/assets/{index-CfpVrvtk.js → index-Ci74HAFs.js} +1 -1
- package/dist/client/assets/{index-DP_WiQNC.js → index-CiQxS4Bn.js} +1 -1
- package/dist/client/assets/{index-ByUBGmdN.js → index-CqoIjNC2.js} +2 -2
- package/dist/client/assets/index-CrflCTqO.css +1 -0
- package/dist/client/assets/{index-5BVp-usS.js → index-D5TZCu8j.js} +1 -1
- package/dist/client/assets/{index-CtRknSis.js → index-D6y4WeTi.js} +1 -1
- package/dist/client/assets/{index-CJllc1_e.js → index-DB8TDRSm.js} +1 -1
- package/dist/client/assets/index-DCOOlbEt.js +1 -0
- package/dist/client/assets/{index-DIpkbx_g.js → index-DHYvT3nr.js} +7 -7
- package/dist/client/assets/{index-Cc5UdmnD.js → index-DRea_Gi0.js} +1 -1
- package/dist/client/assets/index-Dain_3cO.js +1 -0
- package/dist/client/assets/index-Dc5cpBoO.js +1023 -0
- package/dist/client/assets/{index-KONo3kU0.js → index-Df7a-2P5.js} +1 -1
- package/dist/client/assets/{index-CFo8WKHw.js → index-DkhM0fDi.js} +1 -1
- package/dist/client/assets/{index-V5Rn9SxH.js → index-DoMJUxt_.js} +1 -1
- package/dist/client/assets/{index-rROsmUvj.js → index-EZHlD3gf.js} +1 -1
- package/dist/client/assets/{index-DwKOsAwH.js → index-HxT_wkaZ.js} +1 -1
- package/dist/client/assets/{index-DaFf8fyv.js → index-Lh82Rz5C.js} +1 -1
- package/dist/client/assets/{index-7cQQSs20.js → index-WxtASL5_.js} +1 -1
- package/dist/client/assets/{index-CoMMwnLj.js → index-_5Dn0bFm.js} +1 -1
- package/dist/client/assets/{index-DVUGIueq.js → index-aXm0xP_2.js} +1 -1
- package/dist/client/assets/{index-CqcPXANi.js → index-ox3ce99A.js} +1 -1
- package/dist/client/assets/{index-CQ_s1Luo.js → index-r_O6CmXY.js} +1 -1
- package/dist/client/assets/{index.esm-C1I5Nd91.js → index.esm-DXsF3Bua.js} +1 -1
- package/dist/client/assets/{inline-code-BxjIkZsu.js → inline-code-DAEoWvTf.js} +1 -1
- package/dist/client/assets/{layers-CIuBDynf.js → layers-CsM34LRv.js} +1 -1
- package/dist/client/assets/{lightbulb-C75cqB7d.js → lightbulb-B8JAixK_.js} +1 -1
- package/dist/client/assets/{link-2-g7crG37S.js → link-2-Csc6okl3.js} +1 -1
- package/dist/client/assets/{list-runtime-types-GVPyyQUh.js → list-runtime-types-DQrZNB7x.js} +1 -1
- package/dist/client/assets/{markdown-content-siVxwwSU.js → markdown-content-DPc7aD1j.js} +1 -1
- package/dist/client/assets/{mention-pill-CjxBxD6M.js → mention-pill-8P_w4muj.js} +1 -1
- package/dist/client/assets/{message-square-off-BxuvD1QP.js → message-square-off-D5DXu2cY.js} +1 -1
- package/dist/client/assets/{more-details-DN_gIeya.js → more-details-DEeu2M-p.js} +1 -1
- package/dist/client/assets/{owner-notice-DnYrX3mh.js → owner-notice-BW4k1ycg.js} +1 -1
- package/dist/client/assets/{package-b8MxCYZr.js → package-BSwwAFVm.js} +1 -1
- package/dist/client/assets/{page-container-bbfE5uTV.js → page-container-CjPUNtNw.js} +1 -1
- package/dist/client/assets/{paperclip-BNBU7WUb.js → paperclip-DQaRz34E.js} +1 -1
- package/dist/client/assets/{path-input-BhzVuKWq.js → path-input-CgXSYNZn.js} +1 -1
- package/dist/client/assets/plug-BaUXMfIl.js +11 -0
- package/dist/client/assets/{primer-trigger-DHPWwwZl.js → primer-trigger-DHB0vilf.js} +1 -1
- package/dist/client/assets/{profile-errors-DDvyjpcQ.js → profile-errors-JW2XTgia.js} +1 -1
- package/dist/client/assets/{progress-DUKHwOZJ.js → progress-CErAw8zp.js} +1 -1
- package/dist/client/assets/{query-error-state-DOJRiizQ.js → query-error-state-BFWpEXsl.js} +1 -1
- package/dist/client/assets/{radio-kbMW2w1m.js → radio-Bkx216ga.js} +1 -1
- package/dist/client/assets/registry-Ce1VRIS3.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-3XV1_WMC.js → relay-trace-schemas-DiZj_AFV.js} +1 -1
- package/dist/client/assets/{room-files-source-CDA5V_Mw.js → room-files-source-BilZvdpf.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-BGYqHuYK.js → rotate-ccw-clock-D_SO1stN.js} +1 -1
- package/dist/client/assets/{rotate-cw-BdJrGLyp.js → rotate-cw-C68kM23F.js} +1 -1
- package/dist/client/assets/{scroll-area-D-CWiQov.js → scroll-area-CVWFUmJV.js} +1 -1
- package/dist/client/assets/{search-x-DNIPyXe6.js → search-x-BTFVvyA2.js} +1 -1
- package/dist/client/assets/{shield-check-zWzf9nt2.js → shield-check-Dpxi6WqO.js} +1 -1
- package/dist/client/assets/{shield-x-Bu5-LOse.js → shield-x-CdCCgyXk.js} +1 -1
- package/dist/client/assets/signed-in-BxAnDo0S.js +1 -0
- package/dist/client/assets/{soul-file-CoSSajv6.js → soul-file-CRfKVJX3.js} +1 -1
- package/dist/client/assets/{table-Bt_aJtoi.js → table-BL3xUC41.js} +1 -1
- package/dist/client/assets/{terminal-ub-ExeTA.js → terminal-u_UCRzSM.js} +1 -1
- package/dist/client/assets/{trust-posture-CWt3tUjL.js → trust-posture-B-v4BWo7.js} +1 -1
- package/dist/client/assets/{unplug-BCqRQfhH.js → unplug-CFbC-L5W.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-CgvUEO5t.js → unverified-catalog-notice-ZUqscVFM.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-ClW3m3Yz.js → use-adapter-catalog-Z4MDWZAZ.js} +1 -1
- package/dist/client/assets/{use-bindings-CFiTPDOx.js → use-bindings-CsTavmf-.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-B70wbKdU.js → use-composer-prefs-BY2dTvep.js} +1 -1
- package/dist/client/assets/{use-connector-management-B_mb2h8I.js → use-connector-management-L9l21yTi.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DuJW3UA9.js → use-deep-link-scroll-Bn2ZUtDY.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DWXownno.js → use-delete-binding-DLvdHtPD.js} +1 -1
- package/dist/client/assets/{use-dev-links-UPIkbIjA.js → use-dev-links-DFvL8mIg.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-x7pDUqmo.js → use-external-adapter-catalog-Be57G4tz.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-l9UhDUNU.js → use-full-activity-feed-Cp3lYXdi.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-DmekpHAF.js +1 -0
- package/dist/client/assets/use-is-hub-el7LTkg3.js +1 -0
- package/dist/client/assets/{use-jump-back-in-CKA3z2by.js → use-jump-back-in-ChH1FSEK.js} +1 -1
- package/dist/client/assets/{use-local-browser-DL5b5JIK.js → use-local-browser-zA8gMhcC.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-BYGYArKq.js → use-mesh-topology-CvoD-L1G.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-D_xUn22L.js → use-mounted-ref-Ch0wqQry.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-42ajom2z.js → use-notification-prefs-DeR05zhp.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-CLIDc7_z.js → use-panel-tab-placements-DdjrmaoK.js} +1 -1
- package/dist/client/assets/use-pending-read-DBpte0GI.js +1 -0
- package/dist/client/assets/{use-personality-commit-D7jyGUrF.js → use-personality-commit-qQfISO2-.js} +1 -1
- package/dist/client/assets/use-promo-activation-CwGoE7b-.js +11 -0
- package/dist/client/assets/{use-promo-dismissals-CsJELZ1_.js → use-promo-dismissals-BBqVN4hx.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-TqSBTrFT.js → use-pulse-freshness-BKW7tjvX.js} +1 -1
- package/dist/client/assets/{use-relay-config-CLeVWrpV.js → use-relay-config-D5iieBXl.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-C-zlw4nh.js → use-room-follow-claim-BwZh2ZPH.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-H2EzOl9b.js → use-roving-tab-list-Ct7yDAUE.js} +1 -1
- package/dist/client/assets/use-session-canvas-CJrfZrYG.js +24 -0
- package/dist/client/assets/{use-session-diagnostics-CDmiMYHx.js → use-session-diagnostics-Dn-Wnyhh.js} +3 -3
- package/dist/client/assets/{use-unclaimed-chats-Bd93jy-J.js → use-unclaimed-chats-M-c5tjXH.js} +1 -1
- package/dist/client/assets/use-update-config-DhlbZldm.js +1 -0
- package/dist/client/assets/{useMutationState-BZZ5TO4d.js → useMutationState-Cd-VqRAv.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261017113300_session_public_computer.sql +1 -0
- package/dist/drizzle/meta/20261017113300_snapshot.json +14020 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/server/index.js +22779 -19965
- package/dist/server/index.js.map +2 -2
- package/package.json +4 -4
- package/dist/client/assets/HandlePage-DUFrvuVy.js +0 -1
- package/dist/client/assets/KeyEntry-tKXV9D24.js +0 -6
- package/dist/client/assets/McpSigninBody-CRj8tXsh.js +0 -1
- package/dist/client/assets/NamePage-fiIXQig_.js +0 -1
- package/dist/client/assets/PhotoPage-BnxmY5mq.js +0 -1
- package/dist/client/assets/SettingsDialog-BZkPlifY.js +0 -12
- package/dist/client/assets/_shell-BQ7hvFsP.js +0 -90
- package/dist/client/assets/_shell.channels-DYNK-rbr.js +0 -10
- package/dist/client/assets/_shell.marketplace-B1CT9Y3y.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-DVHJ2s7a.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-B6Ccjrvp.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B6Ccjrvp.js +0 -1
- package/dist/client/assets/index-BONR--d7.css +0 -1
- package/dist/client/assets/index-BULRe04c.js +0 -1018
- package/dist/client/assets/index-C8NfFfij.js +0 -17
- package/dist/client/assets/index-CRMbYKMh.js +0 -1
- package/dist/client/assets/index-CidWt_HE.js +0 -1
- package/dist/client/assets/registry-BisJE2TH.js +0 -1
- package/dist/client/assets/use-is-below-desktop-ByiGZk3p.js +0 -1
- package/dist/client/assets/use-pending-read-Cy9OB3jX.js +0 -1
- package/dist/client/assets/use-promo-activation-Dw1KvykA.js +0 -11
- package/dist/client/assets/use-session-canvas-Bm_AzSm7.js +0 -24
- package/dist/client/assets/use-update-config-DjF61lwf.js +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-ClOKWzws.js","assets/index-Dc5cpBoO.js","assets/index-CrflCTqO.css","assets/index-BUOcbPfv.js","assets/BlintzCanvas-GgiCXV7C.css","assets/CanvasFileContent-B_8zsIas.js","assets/rotate-cw-C68kM23F.js","assets/index.esm-DXsF3Bua.js","assets/WidgetErrorCard-CzWw_SPD.js","assets/index-Ch-ON5gw.js","assets/card-Bt6IU-Bh.js","assets/progress-CErAw8zp.js","assets/markdown-content-DPc7aD1j.js","assets/table-BL3xUC41.js","assets/terminal-u_UCRzSM.js","assets/package-BSwwAFVm.js","assets/heart-Du7nuefC.js","assets/git-branch-BObm8Rlz.js","assets/file-text-BAhi2zct.js","assets/file-VHDTQub2.js","assets/McpAppFrame-CuObpQTg.js","assets/more-details-DEeu2M-p.js","assets/CanvasModel3dContent-UokbHY9i.js","assets/CanvasCsvContent-0Mb7uOuA.js","assets/index-4GC2fkeO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var Lr=Object.defineProperty;var Gt=e=>{throw TypeError(e)};var Pr=(e,t,r)=>t in e?Lr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ee=(e,t,r)=>Pr(e,typeof t!="symbol"?t+"":t,r),dt=(e,t,r)=>t.has(e)||Gt("Cannot "+r);var Te=(e,t,r)=>(dt(e,t,"read from private field"),r?r.call(e):t.get(e)),Me=(e,t,r)=>t.has(e)?Gt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ge=(e,t,r,n)=>(dt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ve=(e,t,r)=>(dt(e,t,"access private method"),r);import{W as at,lH as ct,fD as se,fO as Y,fH as $t,fK as qe,fE as $e,lI as Br,lJ as Ur,lK as Wr,aX as Ce,a1 as ue,r as p,c6 as St,lL as Gr,aW as J,iq as $r,j as d,hn as Hr,ho as Vr,e2 as Jr,G as Dt,I as Xr,fo as Zr,lM as Yr,lN as cr,lO as bt,lP as rt,lQ as ur,fC as Ht,lR as Qr,fF as Vt,lS as Kr,lT as en,gC as V,lU as tn,lV as rn,B as et,J as lr,go as dr,C as nn,as as sn,lW as on,lX as an,lY as Jt}from"./index-Dc5cpBoO.js";import{R as cn}from"./rotate-cw-C68kM23F.js";import{T as un,a as ln,u as dn}from"./index.esm-DXsF3Bua.js";import{v as fn,a as hn,W as pn}from"./WidgetErrorCard-CzWw_SPD.js";import{M as mn}from"./McpAppFrame-CuObpQTg.js";/**
|
|
3
|
+
* @license lucide-react v1.48.0 - ISC
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the ISC license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/const fr={name:"file-code",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:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};fr.node;const Bi=at(fr);/**
|
|
8
|
+
* @license lucide-react v1.48.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/const hr={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};hr.node;const gn=at(hr);/**
|
|
13
|
+
* @license lucide-react v1.48.0 - ISC
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the ISC license.
|
|
16
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/const pr={name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};pr.node;const vn=at(pr);/**
|
|
18
|
+
* @license lucide-react v1.48.0 - ISC
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the ISC license.
|
|
21
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
+
*/const mr={name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]};mr.node;const bn=at(mr),Oe={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},nt=$e().min(1).max(128),Ie={bridgeGeneration:nt},wn=se({...Ie,__dorkosDevtools:Y("capture-result"),requestId:nt,dataUrl:$e().max(9e5).optional(),error:$e().max(2048).optional()}),yn=Br.omit({hostOutcome:!0}).extend({...Ie,__dorkosDevtools:Y("act-result"),dataUrl:$e().max(9e5).optional()}),xn=Ur.extend({status:qe().int().min(0).max(599),durationMs:qe().min(0),responseSize:qe().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:qe().min(0)}),kn=Wr.refine(e=>e.timestamp>=0),jn=ct("__dorkosDevtools",[se({__dorkosDevtools:Y("hello"),pageInstanceId:nt,bridgeVersion:Y(2)}),se({...Ie,__dorkosDevtools:Y("ready"),pageInstanceId:nt}),se({...Ie,__dorkosDevtools:Y("navigated")}),se({...Ie,__dorkosDevtools:Y("resource-error")}),se({...Ie,__dorkosDevtools:Y("batch"),seq:qe().int().min(0).max(Number.MAX_SAFE_INTEGER),console:$t(kn).max(500),network:$t(xn).max(200)}),wn,yn]);function Cn(e){const t=new Set;let r=0,n=0;const s=c=>(n+=c)<=16384;function i(c){if(!s(2))return!1;for(let o=0;o<c.length;o++){const f=c.charCodeAt(o);if(f>=55296&&f<=56319&&o+1<c.length&&c.charCodeAt(o+1)>=56320&&c.charCodeAt(o+1)<=57343){if(!s(2))return!1;o++;continue}const l=f===34||f===92||[8,9,10,12,13].includes(f)?2:f<32||f>=55296&&f<=57343?6:1;if(!s(l))return!1}return!0}function a(c,o){if(++r>2048||o>8)return!1;if(c===null)return s(4);if(typeof c=="boolean")return s(c?4:5);if(typeof c=="string")return i(c);if(typeof c=="number")return Number.isFinite(c)&&s(String(c).length);if(typeof c!="object"||t.has(c))return!1;const f=Object.getPrototypeOf(c);if(f!==Object.prototype&&f!==null&&f!==Array.prototype)return!1;const l=Array.isArray(c);if(l&&c.length>2048||Object.getOwnPropertySymbols(c).length||!s(2))return!1;t.add(c);let h=0;for(const u in c){if(!Object.prototype.hasOwnProperty.call(c,u))continue;if(++h>2048||l&&(!/^\d+$/.test(u)||Number(u)>=c.length))return!1;const g=Object.getOwnPropertyDescriptor(c,u);if(["__proto__","constructor","prototype"].includes(u)||!("value"in g)||!g.enumerable||h>1&&!s(1)||!l&&(!i(u)||!s(1))||!a(g.value,o+1))return!1}return t.delete(c),!l||h===c.length}try{return a(e,0)}catch{return!1}}function Rn(e){try{if(!e||typeof e!="object")return null;const t=e;if(t.__dorkosDevtools==="capture-result"&&t.dataUrl===void 0&&t.error===void 0)return null;if(t.__dorkosDevtools==="batch"){if(!Array.isArray(t.console)||t.console.length>500||!Array.isArray(t.network)||t.network.length>200)return null;for(const s of t.console){if(!s||typeof s!="object")return null;const i=s.args;if(i!==void 0&&(!Array.isArray(i)||i.length>50||!Cn(i)))return null}}const r=jn.safeParse(e);if(!r.success)return null;const n=r.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!gr(n.dataUrl)?null:n}catch{return null}}function gr(e){if(e.length>9e5||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(e))return null;try{const t=atob(e.slice(e.indexOf(",")+1));if(t.length<24||t.slice(0,8)!==`PNG\r
|
|
23
|
+
|
|
24
|
+
`||t.slice(12,16)!=="IHDR")return null;const r=i=>t.charCodeAt(i)*2**24+(t.charCodeAt(i+1)<<16)+(t.charCodeAt(i+2)<<8)+t.charCodeAt(i+3),n=r(16),s=r(20);return n>0&&s>0&&n<=1568&&s<=1568?{width:n,height:s}:null}catch{return null}}let ft=null;async function Xt(){return ft===null&&(ft=(await Ce(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),ft}let ht=null;async function On(){if(ht===null){const e=await Ce(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);ht={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return ht}async function Zt(e,t,r=()=>{}){if(e.length===0)return{ok:!1,error:"The recording has no frames in it."};r();const{GIFEncoder:n,quantize:s,applyPalette:i}=await On();r();const a=e[0],c=e[e.length-1],o=new Uint8ClampedArray(a.data.length+c.data.length);o.set(a.data,0),o.set(c.data,a.data.length);const f=s(o,256),l=n();for(let u=0;u<e.length;u++){r();const g=e[u];if(l.writeFrame(i(g.data,f),g.width,g.height,{...u===0?{palette:f,repeat:0}:{},delay:t.frameMs}),l.bytesView().byteLength>t.maxBytes)return{ok:!1,error:`The recording came out bigger than ${Math.round(t.maxBytes/1024/1024)} MB, so it was not saved.`}}l.finish();const h=l.bytes();return h.byteLength>t.maxBytes?{ok:!1,error:`The recording came out bigger than ${Math.round(t.maxBytes/1024/1024)} MB, so it was not saved.`}:{ok:!0,bytes:h}}async function En(e,t,r=()=>{}){const n=[],s=document.createElement("canvas");let i=0,a=0;try{for(let c=0;c<Math.min(e.length,62);c++){r();const o=e[c];if(!gr(o)){e[c]="";continue}const f=await Sn(o);e[c]="";try{if(r(),!f)continue;if(!i){const u=Math.min(1,Math.min(800,t)/Math.max(f.width,f.height,1));i=Math.max(1,Math.round(f.width*u)),a=Math.max(1,Math.round(f.height*u)),s.width=i,s.height=a}const l=s.getContext("2d",{willReadFrequently:!0});if(!l)return[];l.fillStyle="#ffffff",l.fillRect(0,0,i,a);const h=Math.min(i/f.width,a/f.height);l.drawImage(f,0,0,Math.round(f.width*h),Math.round(f.height*h)),r(),n.push({data:l.getImageData(0,0,i,a).data,width:i,height:a})}finally{f&&(f.src="")}}return n}catch(c){throw n.length=0,c}finally{e.length=0,s.width=0,s.height=0}}function _n(e,t=()=>{}){const r=document.createElement("canvas"),n=document.createElement("canvas");try{for(let s=0;s<e.length;s++){t();const i=e[s];n.width=i.width,n.height=i.height,r.width=Math.max(1,Math.round(i.width/2)),r.height=Math.max(1,Math.round(i.height/2));const a=n.getContext("2d"),c=r.getContext("2d",{willReadFrequently:!0});if(!a||!c)throw new Error("Canvas pixels are unavailable");a.putImageData(new ImageData(new Uint8ClampedArray(i.data),i.width,i.height),0,0),c.drawImage(n,0,0,r.width,r.height),e[s]={data:c.getImageData(0,0,r.width,r.height).data,width:r.width,height:r.height}}}finally{n.width=n.height=r.width=r.height=0}}function Sn(e){return new Promise(t=>{const r=new Image;r.onload=()=>{r.onload=r.onerror=null,t(r)},r.onerror=()=>{r.onload=r.onerror=null,r.src="",t(null)},r.src=e})}function Yt(e,t,r){const n=r.slice().buffer;return{name:e,type:t,size:r.byteLength,arrayBuffer:async()=>n}}function Dn(e){const t=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(t,r=>r.charCodeAt(0))}const In=8e3;function An(e){const t=ue(),r=p.useRef(t);p.useLayoutEffect(()=>{r.current=t});const[n]=St(),[s,i]=p.useState(0),a=p.useRef(null),c=p.useRef(new Map),o=p.useRef(null),f=p.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),l=p.useRef(null),h=p.useRef(-1),u=p.useRef(null),g=p.useRef(null),w=p.useRef(!1),m=p.useRef(-1/0),y=p.useRef(!1),N=p.useRef(null),D=p.useRef(0),I=p.useRef(null),M=p.useRef(null),T=p.useRef(!1),U=p.useRef(null),P=p.useRef({...e,sessionId:n}),q=p.useRef(Promise.resolve()),$=p.useRef(()=>{}),te=p.useRef({initialize:S,retire:b,consume:ae,register:L,eligiblePending:K,refuseRequest:k,live:R,captureFrame:lt,valid:Ye,reportRecordingStart:Ae,cancelReservation:Tt,finish:Mt});p.useLayoutEffect(()=>{te.current={initialize:S,retire:b,consume:ae,register:L,eligiblePending:K,refuseRequest:k,live:R,captureFrame:lt,valid:Ye,reportRecordingStart:Ae,cancelReservation:Tt,finish:Mt}});const me=C=>U.current===C||J.getState().openDocuments.some(v=>v.id===C&&v.openedHere);function x(C,{active:v,activation:O=!1,keepalive:j=!1,reset:A=!1}){if(!C.sessionId)return;const Z={documentId:C.documentId,logicalUrl:C.logicalUrl,bridgeGeneration:C.generation,seq:Math.max(0,h.current),console:[],network:[],active:v,activation:O,instrumented:C.ready&&!C.retired,...A?{reset:!0}:{}};q.current=q.current.then(()=>r.current.ingestDevtoolsCapture(C.sessionId,Z,j?{keepalive:!0}:void 0)).catch(()=>{})}function b(){var O;const C=a.current;C&&(C.retired=!0),a.current=null,l.current!==null&&clearTimeout(l.current),l.current=null,o.current=null,f.current={console:[],network:[],entryBytes:0,overheadBytes:0},h.current=-1,m.current=-1/0,y.current=!1;for(const[j,A]of c.current)A.life.sessionId&&A.deadline>Date.now()&&A.kind!=="frame"&&k(j,A.kind,A.life,"The frame changed while this request was pending."),clearTimeout(A.timer),(O=A.resolve)==null||O.call(A,null);c.current.clear(),C&&x(C,{active:!1});const v=N.current;v&&(clearTimeout(v.reservationTimer),v.cancelled=!0,v.abort.abort(),v.frames.length=0,v.finishing||(v.drawn.length=0,N.current=null)),I.current!==null&&cancelAnimationFrame(I.current),I.current=null,D.current=0,i(0)}function S({loadActivation:C,reset:v=!1}={}){var G,ne;const O=P.current,j=(G=O.iframeRef.current)==null?void 0:G.contentWindow;if(w.current||!j||!O.bridgeEligibility||!O.resolvedSource)return;const A={generation:crypto.randomUUID(),frame:j,sessionId:O.sessionId,documentId:O.documentId,logicalUrl:O.logicalUrl,source:O.resolvedSource,origin:O.bridgeEligibility==="served-document"?"null":O.previewOrigin,ready:!1,activation:!1,retired:!1};a.current=A;const Z=C??(T.current||M.current!==A.documentId&&me(A.documentId));A.activation=Z,T.current=!1,M.current=A.documentId,x(A,{active:!0,activation:Z,reset:v}),((ne=u.current)==null?void 0:ne.frame)===j&&u.current.source===O.resolvedSource&&u.current.reload===O.reloadNonce&&u.current.documentId===O.documentId&&u.current.logicalUrl===O.logicalUrl&&j.postMessage({__dorkosDevtools:"init",bridgeGeneration:A.generation},"*")}p.useLayoutEffect(()=>{var j;P.current={...e,sessionId:n};const C={frame:(j=e.iframeRef.current)==null?void 0:j.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},v=g.current;if(!v||Object.keys(C).some(A=>C[A]!==v[A])){const A=!v||v.frame!==C.frame||v.documentId!==C.documentId||v.logicalUrl!==C.logicalUrl||v.source!==C.source||v.reload!==C.reload;g.current=C,w.current=!1,b(),S({reset:A})}});const _=p.useCallback(()=>{var Z,G,ne;const{initialize:C,retire:v}=te.current,O=P.current,j=(Z=O.iframeRef.current)==null?void 0:Z.contentWindow,A=(G=a.current)!=null&&G.ready?!1:(ne=a.current)==null?void 0:ne.activation;j&&O.resolvedSource&&(u.current={frame:j,source:O.resolvedSource,reload:O.reloadNonce,documentId:O.documentId,logicalUrl:O.logicalUrl}),w.current=!1,v(),C({loadActivation:A,reset:!0})},[]),z=p.useCallback(()=>{const C=a.current;T.current=!0,U.current=P.current.documentId,C&&$.current({active:!0,activation:!0})},[]);p.useLayoutEffect(()=>{$.current=C=>{a.current&&x(a.current,C)}});function R(C){return a.current===C&&!C.retired}function k(C,v,O,j){if(!O.sessionId)return;const A={requestId:C,bridgeGeneration:O.generation,documentId:O.documentId,hostOutcome:"host",error:j};v==="action"?r.current.postDevtoolsAction(O.sessionId,{...A,ok:!1}).catch(()=>{}):r.current.ingestDevtoolsCapture(O.sessionId,{...A,logicalUrl:O.logicalUrl,seq:Math.max(0,h.current),console:[],network:[],screenshot:{requestId:C,error:j}}).catch(()=>{})}function L(C,v,O,{capture:j=!1,resolve:A,timeoutMs:Z=8e3}={}){if(c.current.size>=Oe.pending||c.current.has(C))return null;const G=setTimeout(()=>W(C,ne),Z),ne={kind:v,life:O,capture:j,deadline:Date.now()+Z,timer:G,resolve:A};return c.current.set(C,ne),ne}function W(C,v){var O;c.current.get(C)===v&&(c.current.delete(C),clearTimeout(v.timer),(O=v.resolve)==null||O.call(v,null))}function K(C,v,O){return c.current.get(C)!==v||v.life!==O||!R(O)?!1:Date.now()>=v.deadline?(W(C,v),!1):!0}function ae(C,v,O){const j=c.current.get(C);return!j||j.life!==O||j.kind!==v&&!(v==="capture"&&j.kind==="frame")||!K(C,j,O)?null:(c.current.delete(C),clearTimeout(j.timer),j)}p.useEffect(()=>{const{initialize:C,retire:v,consume:O}=te.current;function j(){l.current=null;const le=o.current;o.current=null,f.current={console:[],network:[],entryBytes:0,overheadBytes:0};const E=a.current;le&&E&&!E.retired&&E.sessionId&&le.bridgeGeneration===E.generation&&r.current.ingestDevtoolsCapture(E.sessionId,le)}function A(le){var qt,Lt,Pt,Bt;const E=a.current;if(!E||E.retired||le.source!==E.frame||le.origin!==E.origin||((qt=u.current)==null?void 0:qt.frame)!==E.frame||u.current.source!==E.source||u.current.reload!==P.current.reloadNonce||u.current.documentId!==E.documentId||u.current.logicalUrl!==E.logicalUrl)return;const F=le.data;if(!F||typeof F!="object"||typeof F.__dorkosDevtools!="string"||!["hello","ready","navigated","resource-error","batch","capture-result","act-result"].includes(F.__dorkosDevtools)||F.__dorkosDevtools!=="hello"&&F.bridgeGeneration!==E.generation)return;const ie=F.__dorkosDevtools==="batch";if(ie){if(!E.ready||!E.sessionId||F.bridgeGeneration!==E.generation||!Number.isSafeInteger(F.seq)||F.seq<0||F.seq<=h.current)return;const H=Date.now();if(H-m.current<Oe.batchMs){o.current?o.current.dropped=!0:y.current=!0;return}m.current=H}const B=Rn(F);if(!B){ie&&(y.current=!0);return}if(B.__dorkosDevtools==="hello"){E.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:E.generation},"*");return}if(B.bridgeGeneration!==E.generation)return;if(B.__dorkosDevtools==="ready"){E.ready||(E.ready=!0,E.activation=!1,x(E,{active:!0}));return}if(!E.ready)return;if(B.__dorkosDevtools==="navigated"){w.current=!0,v();return}if(B.__dorkosDevtools==="resource-error"){D.current=Math.min(Oe.resourceErrors,D.current+1),I.current===null&&(I.current=requestAnimationFrame(()=>{I.current=null,R(E)&&i(D.current)}));return}if(!E.sessionId)return;if(B.__dorkosDevtools==="batch"){if(B.seq<=h.current)return;h.current=B.seq;const H=o.current??{documentId:E.documentId,logicalUrl:E.logicalUrl,bridgeGeneration:E.generation,seq:B.seq,console:[],network:[]};H.seq=B.seq,y.current&&(H.dropped=!0),y.current=!1;const xe=f.current,Ut=new TextEncoder;if(o.current||(xe.overheadBytes=Ut.encode(JSON.stringify({...H,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),xe.overheadBytes>Oe.queueBytes){o.current=null,f.current={console:[],network:[],entryBytes:0,overheadBytes:0},y.current=!0;return}for(const[ze,Fr]of[["console",B.console],["network",B.network]])for(const qr of Fr){const Wt=Ut.encode(JSON.stringify(qr)).length;xe[ze].push(Wt),xe.entryBytes+=Wt}H.console.push(...B.console),H.network.push(...B.network);const Mr=()=>xe.overheadBytes+xe.entryBytes+Math.max(0,H.console.length-1)+Math.max(0,H.network.length-1);for(;H.console.length>500||H.network.length>200||Mr()>Oe.queueBytes;){H.dropped=!0;const ze=(((Lt=H.console[0])==null?void 0:Lt.timestamp)??1/0)<=(((Pt=H.network[0])==null?void 0:Pt.timestamp)??1/0)?"console":"network";if(!H[ze].length)break;H[ze].shift(),xe.entryBytes-=xe[ze].shift()}o.current=H,l.current===null&&(l.current=setTimeout(j,Oe.batchMs));return}if(B.__dorkosDevtools==="capture-result"){const H=O(B.requestId,"capture",E);if(!H)return;if(H.kind==="frame"){(Bt=H.resolve)==null||Bt.call(H,B.dataUrl??null);return}r.current.ingestDevtoolsCapture(E.sessionId,{bridgeGeneration:E.generation,documentId:E.documentId,logicalUrl:E.logicalUrl,seq:Math.max(0,h.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:B.requestId,dataUrl:B.dataUrl,error:B.error}});return}const Ne=O(B.requestId,"action",E);if(!Ne)return;const Re=N.current,Ft=Ne.capture&&B.dataUrl!==void 0&&Re!==null&&Re.life===E&&Re.activated&&!Re.finishing&&!Re.cancelled&&Re.frames.length<61;Ft&&Re.frames.push(B.dataUrl);const{__dorkosDevtools:Ni,dataUrl:zi,...Tr}=B;r.current.postDevtoolsAction(E.sessionId,{...Tr,hostOutcome:"page-reported",documentId:E.documentId,captured:Ft||void 0})}window.addEventListener("message",A);const Z=setInterval(()=>$.current({active:!0}),15e3),G=()=>{a.current||C(),$.current({active:!0,activation:!0})},ne=()=>{$.current({active:!1,keepalive:!0}),v()},oe=()=>{document.visibilityState==="visible"&&G()};return window.addEventListener("focus",G),window.addEventListener("pagehide",ne),window.addEventListener("pageshow",G),document.addEventListener("visibilitychange",oe),()=>{window.removeEventListener("message",A),clearInterval(Z),window.removeEventListener("focus",G),window.removeEventListener("pagehide",ne),window.removeEventListener("pageshow",G),document.removeEventListener("visibilitychange",oe),v()}},[]),p.useEffect(()=>Gr.subscribeSessionEvent((C,v)=>{if(v.type!=="devtools_capture_request"&&v.type!=="devtools_action_request"&&v.type!=="devtools_recording_request")return;const{register:O,eligiblePending:j,refuseRequest:A,captureFrame:Z,valid:G,finish:ne,reportRecordingStart:oe,cancelReservation:le}=te.current,E=a.current;if(!(!(E!=null&&E.ready)||!E.sessionId||E.retired||v.targetClientId!==r.current.clientId||v.documentId!==E.documentId||v.bridgeGeneration!==E.generation)){if(v.type==="devtools_capture_request"||v.type==="devtools_action_request"){const F=v.type==="devtools_action_request",ie=O(v.requestId,F?"action":"capture",E,{capture:F&&!!v.capture,timeoutMs:F&&v.command.action==="wait_for"?Math.min(1e4,v.command.timeoutMs)+2e3:8e3});if(!ie){c.current.has(v.requestId)||A(v.requestId,F?"action":"capture",E,"Too many browser requests are waiting. Try again when one finishes.");return}const B=Ne=>{j(v.requestId,ie,E)&&E.frame.postMessage(F?{__dorkosDevtools:"act-request",bridgeGeneration:E.generation,requestId:v.requestId,documentId:E.documentId,command:v.command,...v.capture?{capture:!0,lib:Ne}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:E.generation,requestId:v.requestId,lib:Ne},"*")};!F||v.capture?Xt().then(B,()=>B()):B()}if(v.type==="devtools_recording_request"){if(v.action==="cancel-start"){le(v.recordingId,v.requestId,E);return}if(v.action==="confirm-start"){const F=N.current;if(!F||F.id!==v.recordingId||F.startRequestId!==v.requestId||F.life!==E||F.finishing||!G(F))return;if(!F.activated){if(performance.now()>=F.reservationDeadline){le(F.id,F.startRequestId,E),oe(v,E,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(F.reservationTimer),F.activated=!0,F.startedAt=Date.now(),Z(E).then(ie=>{ie&&G(F)&&F.frames.push(ie)})}oe(v,E,{phase:"started",ok:!0});return}if(v.action==="start"){const F=v.reservationTimeoutMs;if(!Number.isSafeInteger(F)||!F||F<1||F>In){oe(v,E,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(N.current){oe(v,E,{phase:"reserved",ok:!1,error:"Another recording in this window is still running or being saved. Wait for it to finish, then start again."});return}const ie={id:v.recordingId,startRequestId:v.requestId,activated:!1,reservationDeadline:performance.now()+F,life:E,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};N.current=ie,ie.reservationTimer=setTimeout(()=>{N.current===ie&&!ie.activated&&le(ie.id,ie.startRequestId,E)},F),oe(v,E,{phase:"reserved",ok:!0})}else ne(v.requestId,v.recordingId,E)}}}),[]);function Ae(C,v,O){!R(v)||!v.sessionId||r.current.ingestDevtoolsCapture(v.sessionId,{hostOutcome:"host",documentId:v.documentId,bridgeGeneration:v.generation,seq:0,console:[],network:[],recordingStart:{...O,requestId:C.requestId,recordingId:C.recordingId}}).catch(()=>{})}function Tt(C,v,O){var A;const j=N.current;if(!(!j||j.id!==C||j.startRequestId!==v||j.life!==O||j.finishing)){clearTimeout(j.reservationTimer),j.cancelled=!0,j.abort.abort(),j.frames.length=0,j.drawn.length=0;for(const[Z,G]of c.current)G.life===O&&G.kind==="frame"&&(clearTimeout(G.timer),(A=G.resolve)==null||A.call(G,null),c.current.delete(Z));N.current=null}}function Ye(C){return N.current===C&&!C.cancelled&&R(C.life)}function lt(C){const v=`frame-${crypto.randomUUID()}`;return new Promise(O=>{const j=L(v,"frame",C,{resolve:O});if(!j){O(null);return}Xt().then(A=>{K(v,j,C)&&C.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:C.generation,requestId:v,lib:A},"*")},()=>{W(v,j)})})}async function Mt(C,v,O){const j=N.current;if(!j||!j.activated||j.id!==v||j.life!==O){R(O)&&await r.current.uploadDevtoolsRecording(O.sessionId,{requestId:C,bridgeGeneration:O.generation,documentId:O.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(j.finishing)return;j.finishing=!0;const A=()=>{if(!Ye(j))throw new Error("retired")},Z={requestId:C,bridgeGeneration:O.generation,documentId:O.documentId};try{const G=await lt(O);A(),G&&j.frames.length<Oe.frames&&j.frames.push(G);const ne=j.frames.length?Dn(j.frames[j.frames.length-1]):new Uint8Array;j.drawn=await En(j.frames,800,A),A();let oe=await Zt(j.drawn,{frameMs:500,maxBytes:8*1024*1024},A);if(A(),!oe.ok&&j.drawn.length&&(_n(j.drawn,A),oe=await Zt(j.drawn,{frameMs:500,maxBytes:8*1024*1024},A),A()),!oe.ok){await r.current.uploadDevtoolsRecording(O.sessionId,{...Z,hostOutcome:"host",error:oe.error},{signal:j.abort.signal}),A();return}A(),await r.current.uploadDevtoolsRecording(O.sessionId,{...Z,frames:j.drawn.length,durationMs:Date.now()-j.startedAt,recording:Yt(`${v}.gif`,"image/gif",oe.bytes),keyframe:Yt(`${v}.png`,"image/png",ne)},{signal:j.abort.signal}),A()}catch{Ye(j)&&await r.current.uploadDevtoolsRecording(O.sessionId,{...Z,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:j.abort.signal}).catch(()=>{})}finally{j.frames.length=0,j.drawn.length=0,N.current===j&&(N.current=null)}}return{resourceErrorCount:s,notePersonNavigated:z,noteFrameLoaded:_}}const Nn=15e3;function zn(e){const t=e instanceof Error?e.message.trim():"";return t.length>0?t:"Couldn’t reach DorkOS. Check your network and try again."}function Tn(e){const t=ue();return{open:p.useCallback(async r=>{await t.openRoomCanvasDocument(e,r)},[t,e]),update:p.useCallback(async(r,n)=>{await t.updateRoomCanvasDocument(e,r,{content:n})},[t,e]),pin:p.useCallback(async(r,n)=>{await t.updateRoomCanvasDocument(e,r,{pinned:n})},[t,e]),close:p.useCallback(async r=>{await t.closeRoomCanvasDocument(e,r)},[t,e])}}function Mn(e,t){const r=ue(),n=J(s=>s.setRoomCanvasEditing);p.useEffect(()=>{if(n(e,t),t===null)return;const s=a=>{r.setRoomCanvasEditing(e,t,a).catch(c=>{console.warn("[room-canvas] edit lock failed",{roomId:e,documentId:t,err:c})})};s(!0);const i=setInterval(()=>s(!0),Nn);return()=>{clearInterval(i),s(!1),n(e,null)}},[r,e,t,n])}const Fn=400;function Ui(e,t){const r=ue(),n=J(s=>s.roomCanvasPresenceEpoch[e]??0);p.useEffect(()=>{const s=c=>{r.setRoomCanvasViewing(e,c).catch(o=>{console.warn("[room-canvas] could not say where we are looking",{roomId:e,err:o})})};let i=!1;const a=setTimeout(()=>{i=!0,s(t)},Fn);return()=>{clearTimeout(a),i&&s(null)}},[r,e,t,n])}const qn="allow-scripts allow-forms allow-popups allow-modals",pt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",Ln=new Set(["javascript:","data:","blob:"]),Pn=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function It(e){return Pn.has(e)||e.endsWith(".localhost")}function Bn(e){return It(e)?"direct":"server"}function Un(e,t){let r;try{r=new URL(e)}catch{return null}const n=r.searchParams.get(Qt),s=new URL(r.origin),i=t.indexOf("?");return s.pathname=(i===-1?t:t.slice(0,i))||"/",s.search=i===-1?"":t.slice(i),n!==null&&s.searchParams.set(Qt,n),s.toString()}const Qt="__dorkos_preview",Wn="/__dorkos_preview/health";function Gn(e){return e==="https:"?443:80}function vr(e){let t;try{t=new URL(e)}catch{return{mode:"serve",path:e}}if(Ln.has(t.protocol))return{mode:"blocked"};if(t.protocol==="file:")return{mode:"serve",path:decodeURIComponent(t.pathname)};if(t.protocol==="http:"||t.protocol==="https:"){if(It(t.hostname)){const r=t.port?Number(t.port):Gn(t.protocol);return{mode:"proxy",hostname:t.hostname,port:r,path:`${t.pathname}${t.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function $n(e){const t=e.trim();if(t===""||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)||t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))return t;const r=t.split("/")[0];if(t.includes("/")&&!r.includes(".")&&!r.includes(":"))return t;const s=r.split(":")[0];return`${It(s)?"http":"https"}://${t}`}function Hn(e){const t=vr(e);if(t.mode==="serve")return{kind:"local",path:t.path};if(t.mode==="blocked")return{kind:"raw",text:e};try{const r=new URL(e),n=r.host.replace(/^www\./,""),s=r.pathname==="/"&&r.search===""&&r.hash===""?"":`${r.pathname}${r.search}${r.hash}`;return{kind:"url",host:n,rest:s}}catch{return{kind:"raw",text:e}}}const Vn=2e3;async function Kt(e,t=globalThis.fetch,r=Vn){const n=new AbortController,s=setTimeout(()=>n.abort(),r);try{return await t(e,{mode:"no-cors",cache:"no-store",signal:n.signal}),!0}catch{return n.signal.aborted}finally{clearTimeout(s)}}function Jn({target:e,currentUrl:t,strategy:r,cwd:n,reloadNonce:s}){const i=JSON.stringify([t,r,n,s]),[a,c]=p.useState(null),[o,f]=p.useState(null),[l,h]=p.useState(null),u=ue(),g=p.useRef(u);return p.useEffect(()=>{g.current=u}),p.useEffect(()=>{const w=g.current;let m=!1;const y=M=>{c(i),f(M)};async function N(M){if(n===null){h({kind:"no-session"});return}try{const T=await w.createServeUrl(n,M);if(m)return;T===null?h({kind:"unsupported"}):y({src:T,sandbox:qn,previewOrigin:null,bridgeEligibility:"served-document"})}catch{m||h({kind:"failed"})}}async function D(M,T){let U;try{const q=await w.probeLoopbackPort(M);U=q===null?"unknown":q.listening}catch{U="unknown"}if(m)return;let P=null;if(U!==!1){let q=null;try{q=await w.createProxyUrl(M)}catch{if(m)return;P={kind:"failed"}}if(m)return;if((q==null?void 0:q.unavailable)==="tunnel"){h({kind:"tunnel"});return}if((q==null?void 0:q.unavailable)==="no-port"&&(P={kind:"no-port"}),q!=null&&q.url){const $=new URL(q.url);if(await Kt(`${$.origin}${Wn}`)){if(m)return;const te=Un(q.url,T);if(te!==null){y({src:te,sandbox:pt,previewOrigin:$.origin,bridgeEligibility:"preview-listener"});return}}if(m)return;P={kind:"origin-unreachable",host:$.hostname,listenPort:$.port}}}if(r==="direct"&&await Kt(t)){if(m)return;y({src:t,sandbox:pt,previewOrigin:null,bridgeEligibility:null});return}m||h(P??{kind:"no-upstream"})}async function I(){if(h(null),f(null),e.mode!=="blocked"){if(e.mode==="external"){y({src:e.url,sandbox:pt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?N(e.path):D(e.port,e.path)}}return I(),()=>{m=!0}},[e,t,r,n,s,i]),{resolved:a===i?o:null,resolveError:l}}const Xn=1e4;function Zn(e,t){if(e&&e.contentUrl===t&&e.stack.length>0){const r=Math.min(Math.max(e.cursor,0),e.stack.length-1);return{stack:e.stack,cursor:r}}return{stack:[t],cursor:0}}function Yn({documentId:e,content:t}){const r=J(_=>_.selectedCwd),n=J(_=>_.writeBrowserHistory),[s]=p.useState(()=>Zn(J.getState().browserHistories[e],t.url)),[i,a]=p.useState(s.stack),[c,o]=p.useState(s.cursor),[f,l]=p.useState(0);p.useEffect(()=>{n(e,{contentUrl:t.url,stack:i,cursor:c})},[e,t.url,i,c,n]);const h=i[c],u=p.useMemo(()=>vr(h),[h]),g=p.useMemo(()=>u.mode==="proxy"?Bn(window.location.hostname):null,[u]),w=p.useRef(null),{resolved:m,resolveError:y}=Jn({target:u,currentUrl:h,strategy:g,cwd:r,reloadNonce:f}),{resourceErrorCount:N,notePersonNavigated:D,noteFrameLoaded:I}=An({iframeRef:w,documentId:e,logicalUrl:h,reloadNonce:f,previewOrigin:(m==null?void 0:m.previewOrigin)??null,bridgeEligibility:(m==null?void 0:m.bridgeEligibility)??null,resolvedSource:(m==null?void 0:m.src)??null}),M=J(_=>_.roomCanvasLiveRoomId),{open:T}=Tn(M??""),[U,P]=p.useState(null),q=p.useCallback(_=>{a(z=>[...z.slice(0,c+1),_]),o(z=>z+1)},[c]),$=$r(M),te=J(_=>M?_.roomCanvasEditing[M]??null:null);p.useEffect(()=>{if($===null||te!==null||$.documentId!==e)return;const _=$.url;_===void 0||_===h||q(_)},[$,te,e,h,q]);const me=c>0,x=c<i.length-1,b=p.useCallback(_=>{const z=$n(_);if(!z||z===h){D(),l(R=>R+1);return}if(M){P(null),T({type:"browser",url:z}).catch(R=>{P({url:z,message:zn(R)})});return}D(),q(z)},[h,q,M,T,D]),S=()=>Zr(h);return d.jsxs("div",{className:"flex h-full flex-col",children:[d.jsxs("div",{className:"border-border/60 flex shrink-0 flex-wrap items-center gap-1 border-b px-2 py-1 lg:h-9 lg:flex-nowrap lg:py-0",children:[d.jsx(Qe,{label:"Back",disabled:!me,onClick:()=>o(_=>_-1),children:d.jsx(Hr,{className:"size-4"})}),d.jsx(Qe,{label:"Forward",disabled:!x,onClick:()=>o(_=>_+1),children:d.jsx(Vr,{className:"size-4"})}),d.jsx(Qe,{label:"Reload",onClick:()=>l(_=>_+1),children:d.jsx(cn,{className:"size-4"})}),d.jsx("div",{className:"order-first flex w-full min-w-0 lg:order-none lg:w-auto lg:flex-1",children:d.jsx(Qn,{url:(U==null?void 0:U.url)??h,startEditing:U!==null,onSubmit:b},U===null?"address":`retry:${U.url}`)}),d.jsx(Qe,{label:"Open in system browser",onClick:S,children:d.jsx(Jr,{className:"size-4"})})]}),U!==null&&d.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:U.message}),d.jsx(rs,{target:u,resolved:m,resolveError:y,reloadNonce:f,resourceErrorCount:N,title:t.title??"Embedded browser",onOpenExternally:S,onReload:()=>{D(),l(_=>_+1)},iframeRef:w,onFrameLoad:I})]})}function Qn({url:e,startEditing:t=!1,onSubmit:r}){const[n,s]=p.useState(t),[i,a]=p.useState(e);if(!n)return d.jsx(es,{url:e,onActivate:()=>{a(e),s(!0)}});const c=o=>{o.preventDefault(),s(!1),r(i)};return d.jsx("form",{onSubmit:c,className:"min-w-0 flex-1",children:d.jsx(Xr,{"aria-label":"Address",autoFocus:!0,value:i,onChange:o=>a(o.target.value),onFocus:o=>o.currentTarget.select(),onBlur:()=>s(!1),onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),s(!1))},spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:"h-11 w-full text-base lg:h-7 lg:text-sm"})})}function Kn(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function es({url:e,onActivate:t}){const r=p.useMemo(()=>Hn(e),[e]);return d.jsxs("button",{type:"button","aria-label":`Address: ${Kn(r)}`,onClick:t,className:"text-muted-foreground hover:bg-muted focus-ring flex h-11 min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 text-left text-sm transition-colors lg:h-7",children:[r.kind==="local"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"bg-muted-foreground/15 text-3xs rounded px-1 py-0.5 font-medium tracking-wide uppercase",children:"local"}),d.jsx("span",{className:"text-foreground truncate",children:r.path})]}),r.kind==="url"&&d.jsxs("span",{className:"truncate",children:[d.jsx("span",{className:"text-foreground",children:r.host}),d.jsx("span",{className:"text-muted-foreground",children:r.rest})]}),r.kind==="raw"&&d.jsx("span",{className:"truncate",children:r.text})]})}function ts(e,t){switch(e.kind){case"no-session":return"Open a chat to preview local files.";case"unsupported":return"Local previews aren’t available in this environment.";case"failed":return"Couldn’t load this preview. Reload, or open the app in your browser.";case"tunnel":return"Dev server previews don’t work remotely. Open DorkOS on the computer running it.";case"no-port":return"All preview ports are in use. Close a preview, then reload.";case"origin-unreachable":return`This view can’t reach port ${e.listenPort} on ${e.host}. Open DorkOS on the computer running it.`;case"no-upstream":return`Nothing is listening on ${t.mode==="proxy"?`${t.hostname}:${t.port}`:"that address"}. Start the dev server, then reload.`}}function rs({target:e,resolved:t,resolveError:r,reloadNonce:n,resourceErrorCount:s,title:i,onOpenExternally:a,onReload:c,iframeRef:o,onFrameLoad:f}){if(e.mode==="blocked")return d.jsx(mt,{children:"This address is blocked for safety."});if(r!==null)return d.jsxs(mt,{children:[d.jsx("p",{children:ts(r,e)}),r.kind!=="no-session"&&r.kind!=="unsupported"&&d.jsx("button",{type:"button",onClick:c,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(t===null)return d.jsx(mt,{children:"Loading…"});const l=e.mode==="external";return d.jsx(ns,{src:t.src,sandbox:t.sandbox,title:i,iframeRef:o,onFrameLoad:f,watchLoadDeadline:!l,resourceErrorCount:s,showEmbedFallback:l,onOpenExternally:a,onReload:c},`${t.src}:${n}`)}function ns({src:e,sandbox:t,title:r,iframeRef:n,onFrameLoad:s,watchLoadDeadline:i,resourceErrorCount:a,showEmbedFallback:c,onOpenExternally:o,onReload:f}){const[l,h]=p.useState(!1),[u,g]=p.useState(!1);return p.useEffect(()=>{if(!i)return;const w=setTimeout(()=>g(!0),Xn);return()=>clearTimeout(w)},[i]),d.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[u&&!l&&d.jsx(er,{onOpenExternally:o,onReload:f,children:"This preview is slow to load."}),a>0&&d.jsxs(er,{onOpenExternally:o,children:["This page hit ",a===1e4?"at least 10,000":a," ",a===1?"error":"errors"," while loading."]}),d.jsx("iframe",{ref:n,src:e,sandbox:t,onLoad:()=>{h(!0),s()},className:"min-h-0 w-full flex-1 border-0",title:r}),c&&d.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-t px-3 py-1.5 text-xs",children:[d.jsx("span",{children:"This site can’t always be embedded here."}),d.jsx("button",{type:"button",onClick:o,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function er({children:e,onOpenExternally:t,onReload:r}){return d.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5 text-xs",children:[d.jsx("span",{children:e}),d.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[r&&d.jsx("button",{type:"button",onClick:r,className:"text-foreground hover:underline",children:"Reload"}),d.jsx("button",{type:"button",onClick:t,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function Qe({label:e,disabled:t,onClick:r,children:n}){return d.jsx("button",{type:"button","aria-label":e,disabled:t,onClick:r,className:Dt("text-muted-foreground hover:text-foreground hover:bg-muted focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors lg:size-7",t&&"pointer-events-none opacity-40"),children:n})}function mt({children:e}){return d.jsx("div",{className:"text-muted-foreground flex min-h-0 flex-1 flex-col items-center justify-center p-8 text-center",children:e})}const He=$e().min(1).max(128),fe={protocol:Y("dorkos-doc"),v:Y(1),nonce:He,requestToken:He,loadToken:bt,generation:cr.shape.generation};ct("kind",[se({...fe,kind:Y("challenge")}).strict(),se({...fe,kind:Y("ack")}).strict(),se({...fe,kind:Y("connect")}).strict()]);ct("kind",[se({...fe,kind:Y("emit"),requestId:He,event:rt}).strict(),se({...fe,kind:Y("retire")}).strict()]);ct("kind",[se({...fe,kind:Y("receipt"),requestId:He,receipt:ur}).strict(),se({...fe,kind:Y("refused"),requestId:He,outcome:Ht(["cancelled","unconfirmed","refused"])}).strict(),se({...fe,kind:Y("state"),state:Qr,stateRev:bt,docSeq:bt,reset:Vt()}).strict(),se({...fe,kind:Y("event"),frame:Kr}).strict(),se({...fe,kind:Y("status"),status:Ht(["connecting","ready","offline","revoked"]),unconfirmed:Vt()}).strict()]);function ss(e,t){try{if(Yr(t,1048576)!==void 0)return null;const r=e.safeParse(t);return r.success?r.data:null}catch{return null}}function is({owner:e,getOwner:t,readTail:r,writeTail:n,transport:s,cwd:i,sourcePath:a,documentId:c,pending:o}){const f=()=>{var m,y;return((m=t())==null?void 0:m.recoveryGate)==="unsupported"||((y=t())==null?void 0:y.recoveryGate)==="observed_clear"},l=m=>{var D;const y=en.parse(m),N=(D=t())==null?void 0:D.recoveryBinding;if(!N||y.documentId!==c||!V(y.incarnation,N.incarnation))throw new Error("Original save scope changed");return y},h=s.originalFileSaveRecovery,u=()=>{var m;try{const y=t();return(y==null?void 0:y.identity)===e&&y.active&&!!((m=y.recoveryBinding)!=null&&m.current())}catch{return!1}},g=(m,y,N=!1)=>{if(!h||!u())return Promise.resolve({status:"idle"});const D=t(),I={},M=()=>t()===D&&u()&&(!y||D.recoveryBinding===y)&&(!N||D.recoveryWork===I),T=D.discovery;let U=!1;D.recoveryWork=I,D.recoveryGate="pending",D.recoveryBusy=!0;const P=r().catch(()=>{}).then(async()=>{try{if(!M())return{status:"idle"};const q=await m();return M()?(N&&(D.recoveryGate="observed_clear"),U=!0,{status:"observed",value:q}):{status:"idle"}}catch{return M()?(D.recoveryGate="unavailable",{status:"unavailable"}):{status:"idle"}}finally{!U&&D.discovery===T&&(D.discovery=void 0),D.recoveryWork===I&&(D.recoveryBusy=!1,D.recoveryWork=void 0)}});return N||n(P.then(()=>{})),P};return{identity:e,supported:!!h,current:u,discover:(m=!1)=>{if(!h||!u())return Promise.resolve({status:"idle"});const y=t(),N=y.recoveryBinding;if(y.discoveryBinding===N&&y.discovery&&(y.pendingDiscovery===y.discovery||!m&&y.recoveryGate==="observed_clear"))return y.discovery;const D=g(async()=>{const I=l(await h.discover(c));return t()===y&&y.recoveryBinding===N&&u()&&(y.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),I},N);return y.discoveryBinding=N,y.discovery=D,y.pendingDiscovery=D,D.then(I=>{y.pendingDiscovery===D&&(y.pendingDiscovery=void 0),I.status==="idle"&&y.discovery===D&&(y.discovery=void 0)}),D},recover(m){if(o())return Promise.resolve({status:"local_uncertain"});const y=t();return g(async()=>{if(!y||o())throw new Error("Mounted original still uncertain");const N=y.recoveryBinding,D=tn.parse(await h.recover(c,m,N.incarnation));if(t()!==y||!u()||D.documentId!==c||D.entry.eventId!==m||!V(D.incarnation,N.incarnation))throw new Error("Original recovery scope changed");const I=l(await h.discover(c));return t()===y&&u()&&(y.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),{result:D,discovery:I}})},inspectCurrent(){const m=t();return!m||!u()||o()||!f()?Promise.resolve({status:"local_uncertain"}):g(async()=>{const y=await s.readFileContent(i,a);if(!y||typeof y.content!="string"||typeof y.hash!="string"||!/^[a-f0-9]{64}$/u.test(y.hash))throw new Error("Current file evidence missing");return{content:y.content,hash:y.hash}},m.recoveryBinding,!0)}}}class Ee extends Error{constructor(){super("The original save is not confirmed. Retry it before saving another draft.")}}class Ue extends Error{}function os(){const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=[...e].map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function as(e){const t=e;return(t==null?void 0:t.status)===412&&t.code==="DOC_SAVE_FAILED"}var de,Se,Xe,wt;class cs{constructor(){Me(this,Xe);Me(this,de);Me(this,Se)}get pending(){return Te(this,de)!==void 0}get receipt(){return Te(this,Se)}async write(t,r,n,s,i,a,c=!1){if(Te(this,de))throw new Ee;if(ge(this,Se,void 0),!a)return t.writeFile(r,n,s,i);if(!c&&!a.current())throw new Ue;const o=Object.freeze({cwd:r,path:n,content:s,options:Object.freeze({...i,documentSave:Object.freeze({documentId:a.incarnation.documentId,eventId:os(),incarnation:Object.freeze({...a.incarnation})})})});return ge(this,de,o),ve(this,Xe,wt).call(this,t,o)}async retry(t,r){const n=Te(this,de);if(!(n!=null&&n.options.documentSave)||!r.current()||!V(n.options.documentSave.incarnation,r.incarnation))throw new Ue;return{result:await ve(this,Xe,wt).call(this,t,n),content:n.content}}}de=new WeakMap,Se=new WeakMap,Xe=new WeakSet,wt=async function(t,r){try{const n=await t.writeFile(r.cwd,r.path,r.content,r.options);if(!n||typeof n!="object"||typeof n.ok!="boolean")throw new Ee;if(!n.ok){if(!n.conflict||typeof n.conflict.currentHash!="string"||!n.conflict.currentHash||typeof n.conflict.currentContent!="string")throw new Ee;return ge(this,de,void 0),n}if(typeof n.hash!="string"||!n.hash||n.effect!=="changed"&&n.effect!=="no_op")throw new Ee;const s="documentReceipt"in n?rn.parse(n.documentReceipt):void 0,i=r.options.documentSave;if(!s&&n.effect!=="no_op")throw new Ee;if(s&&(s.documentId!==i.documentId||s.eventId!==i.eventId||!V(s.incarnation,i.incarnation)||s.fileHash!==n.hash||(s.status==="accepted"?n.effect!=="changed":n.effect!=="no_op")))throw new Ee;if((s==null?void 0:s.status)==="duplicate"){const a=await t.readFileContent(r.cwd,r.path);if(!a||typeof a!="object"||Array.isArray(a)||typeof a.hash!="string"||!a.hash||typeof a.content!="string")throw new Ee;if(a.hash!==s.fileHash||a.content!==r.content)return ge(this,Se,s),ge(this,de,void 0),{ok:!1,conflict:{currentHash:a.hash,currentContent:a.content}}}return ge(this,Se,s),ge(this,de,void 0),n}catch(n){throw as(n)&&ge(this,de,void 0),n}};function us({sourcePath:e,cwd:t,loadedContent:r,documentId:n,documentSaveBinding:s,documentRecoveryBinding:i}){const a=ue(),c=(s==null?void 0:s.incarnation)??(i==null?void 0:i.incarnation),o=c?JSON.stringify([c.documentId,c.physicalOpenedAt,c.channelCreatedAt,c.generation]):void 0,f=p.useRef(new cs),l=p.useMemo(()=>({sourcePath:e,cwd:t,documentId:n,transport:a,birthKey:o}),[e,t,n,a,o]),h=p.useRef(null),u=p.useRef(null),g=p.useRef(Promise.resolve()),w=p.useCallback(()=>{var R;return((R=u.current)==null?void 0:R.identity)===l&&u.current.active},[l]);p.useLayoutEffect(()=>{var R;return((R=u.current)==null?void 0:R.identity)!==l?u.current={identity:l,baseHash:null,baseContent:r,active:!0,recoveryBinding:i,recoveryGate:i&&a.originalFileSaveRecovery?"pending":"unsupported"}:(u.current.active=!0,u.current.recoveryBinding=i),()=>{var k;((k=u.current)==null?void 0:k.identity)===l&&(u.current.active=!1)}},[l,r,i,a]);const[m,y]=p.useState({owner:l,status:"idle",conflict:null}),N=m.owner===l?m.status:"idle",D=m.owner===l?m.conflict:null,I=p.useCallback((R,k,L)=>{w()&&y(W=>({owner:l,status:R,documentReceipt:k,confirmedContent:L,conflict:W.owner===l?W.conflict:null}))},[l,w]),M=p.useCallback(R=>{w()&&y(k=>({owner:l,conflict:R,status:k.owner===l?k.status:"idle"}))},[l,w]),T=p.useCallback(()=>{var R,k;return((R=u.current)==null?void 0:R.recoveryGate)==="unsupported"||((k=u.current)==null?void 0:k.recoveryGate)==="observed_clear"},[]),U=p.useMemo(()=>{const R=()=>is({owner:l,getOwner:()=>u.current,readTail:()=>g.current,writeTail:k=>{g.current=k},transport:a,cwd:t,sourcePath:e,documentId:n,pending:()=>f.current.pending});return{identity:l,supported:!!a.originalFileSaveRecovery,current:()=>R().current(),discover:k=>R().discover(k),recover:k=>R().recover(k),inspectCurrent:()=>R().inspectCurrent()}},[l,a,t,e,n]),P=!!(e&&t),q=p.useCallback((R,k,L,W=!1)=>{const K=()=>w()&&u.current===R&&(!s||s.current());if(k.ok){if(typeof k.hash!="string"||!k.hash||k.effect!=="changed"&&k.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return R.baseHash=k.hash,R.baseContent=L,!W&&!K()?{status:"idle"}:(W||(M(null),I("saved",f.current.receipt,L)),{status:k.effect,confirmed:{hash:k.hash,content:L}})}return!W&&!K()?{status:"idle"}:(W||(M(k.conflict),I("conflict")),{status:"conflict"})},[w,s,M,I]),$=p.useCallback(async(R,k)=>{if(!w())return{status:"idle"};const L=u.current;s&&!f.current.pending&&(h.current=l);const W=await f.current.write(a,t,e,R,k,s);return q(L,W,R)},[w,a,t,e,s,q,l]),te=p.useCallback(R=>{var W;if(!P||!w())return Promise.resolve({status:"idle"});const k=((W=u.current.finalToken)==null?void 0:W.content)===R?u.current.finalToken:void 0,L=g.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(f.current.pending)return I("uncertain"),{status:"uncertain"};if(!T())return I("error"),{status:"error"};u.current.finalToken===k&&(u.current.finalToken=void 0),I("saving");try{const K=u.current.baseHash!==null?{expectedHash:u.current.baseHash}:{expectedContent:u.current.baseContent};return await $(R,K)}catch(K){if(K instanceof Ue)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const ae=f.current.pending?"uncertain":"error";return I(ae),{status:ae}}});return g.current=L.then(()=>{}),L},[P,$,w,I,s,T]),me=p.useCallback(R=>{if(!P||!w()||s&&!s.current())return null;const k=u.current,L={content:R,id:Symbol("buffered canvas draft")};return k.finalToken=L,{cancel(){k.finalToken===L&&(k.finalToken=void 0)},flush(){if(k.finalToken!==L||u.current!==k||k.active)return Promise.resolve({status:"idle"});k.finalToken=void 0;const W=g.current.catch(()=>{}).then(async()=>{if(u.current!==k||k.active)return{status:"idle"};try{if(k.recoveryGate!=="unsupported"&&k.recoveryGate!=="observed_clear")return{status:"error"};const K=k.baseHash!==null?{expectedHash:k.baseHash}:{expectedContent:k.baseContent};s&&!f.current.pending&&(h.current=l);const ae=await f.current.write(a,t,e,R,K,s,!0);return q(k,ae,R,!0)}catch{return{status:"error"}}});return g.current=W.then(()=>{}),W}}},[P,w,a,t,e,s,q,l]),x=p.useCallback(async R=>{const k=u.current;return!k||k.identity!==l?!1:(await g.current.catch(()=>{}),u.current===k&&!f.current.pending&&k.baseContent===R)},[l]),b=p.useCallback(()=>{if(!w()||!s||h.current!==l)return Promise.resolve({status:"idle"});const R=u.current,k=g.current.catch(()=>{}).then(async()=>{if(!w()||u.current!==R||h.current!==l)return{status:"idle"};try{I("saving");const L=await f.current.retry(a,s);return q(R,L.result,L.content)}catch(L){if(L instanceof Ue||!w()||u.current!==R)return{status:"idle"};const W=f.current.pending?"uncertain":"error";return I(W),{status:W}}});return g.current=k.then(()=>{}),k},[w,s,a,q,I,l]),S=p.useCallback(R=>{var K;if(!P||!D||!w())return Promise.resolve({status:"idle"});const k=D.currentHash,L=((K=u.current.finalToken)==null?void 0:K.content)===R?u.current.finalToken:void 0,W=g.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(f.current.pending)return I("uncertain"),{status:"uncertain"};if(!T())return I("error"),{status:"error"};u.current.finalToken===L&&(u.current.finalToken=void 0),I("saving");try{return await $(R,{expectedHash:k})}catch(ae){if(ae instanceof Ue)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const Ae=f.current.pending?"uncertain":"error";return I(Ae),{status:Ae}}});return g.current=W.then(()=>{}),W},[P,D,$,w,I,s,T]),_=p.useCallback(()=>{var R;return((R=u.current)==null?void 0:R.identity)===l?{hash:u.current.baseHash,content:u.current.baseContent}:{hash:null,content:r}},[l,r]),z=p.useCallback(()=>{if(!D||!w()||s&&!s.current())return null;u.current.finalToken=void 0;const R=D.currentContent;return u.current.baseHash=D.currentHash,u.current.baseContent=R,M(null),I("idle"),R},[D,w,M,I,s]);return{recovery:U,status:N,conflict:D,canSave:P,save:te,overwrite:S,adoptDisk:z,getConfirmedBase:_,prepareFinalSave:me,retryUnconfirmed:b,waitForCloseDrain:x,documentReceipt:m.owner===l?m.documentReceipt:void 0,confirmedContent:m.owner===l?m.confirmedContent:void 0}}const ls=p.lazy(()=>Ce(()=>import("./BlintzCanvas-ClOKWzws.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas}))),ds=500;function fs(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function hs({content:e,documentId:t,onContentChange:r}){const[n,s]=p.useState(!1),[i,a]=p.useState(e.content),c=J(b=>b.canvasSessionId),o=J(b=>b.setDocumentEditing),f=J(b=>{var S;return((S=b.openDocuments.find(_=>_.id===t))==null?void 0:S.editing)??!1}),l=J(b=>b.selectedCwd),h=n&&f,u=us({documentId:t,sourcePath:e.sourcePath,cwd:l,loadedContent:e.content}),g=u.canSave,w=p.useRef(null),m=p.useRef(null),y=p.useRef(i),N=p.useRef(e),D=p.useRef(r),I=p.useRef(u.save),M=p.useRef(u.prepareFinalSave),T=p.useRef(null);p.useEffect(()=>{y.current=i,N.current=e,D.current=r,I.current=u.save,M.current=u.prepareFinalSave});const U=p.useCallback(b=>{J.getState().canvasSessionId===w.current&&(D.current({...N.current,content:b}),I.current(b))},[]),P=p.useCallback(b=>{var S;a(b),y.current=b,(S=T.current)==null||S.cancel(),T.current=M.current(b),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{m.current=null,U(b)},ds)},[U]),q=()=>{w.current=J.getState().canvasSessionId,a(e.content),s(!0),o(t,!0)},$=()=>{m.current&&(clearTimeout(m.current),m.current=null,U(y.current)),s(!1),o(t,!1)};p.useEffect(()=>{var b;h&&c!==w.current&&(m.current&&(clearTimeout(m.current),m.current=null),(b=T.current)==null||b.cancel(),T.current=null,s(!1),o(t,!1))},[c,h,t,o]),p.useEffect(()=>{var b;!n||h||(m.current&&clearTimeout(m.current),m.current=null,(b=T.current)==null||b.cancel(),T.current=null)},[h,n]),p.useEffect(()=>()=>{var b,S;m.current&&(clearTimeout(m.current),m.current=null,J.getState().canvasSessionId===w.current&&D.current({...N.current,content:y.current})),J.getState().canvasSessionId===w.current?(b=T.current)==null||b.flush():(S=T.current)==null||S.cancel(),T.current=null,o(t,!1)},[U,t,o]);const te=()=>{const b=u.adoptDisk();b!=null&&(r({...e,content:b}),a(b))},me=()=>{u.overwrite(y.current)},x=fs(u.status);return d.jsxs("div",{className:"relative flex h-full flex-col",children:[d.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[g&&x&&d.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:x}),g&&d.jsx(et,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:h?$:q,"aria-label":h?"Finish editing":"Edit document",children:h?d.jsx(lr,{className:"size-4"}):d.jsx(dr,{className:"size-4"})})]}),u.status==="conflict"&&d.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[d.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),d.jsx(et,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:te,children:"Reload"}),d.jsx(et,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:me,children:"Overwrite"})]}),d.jsx("div",{className:"flex-1 px-2 pb-6",children:d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:d.jsx(ls,{value:h?i:e.content,editable:h,onChange:h?P:void 0})})})]})}function ps({content:e}){return d.jsx("div",{className:"p-4 font-mono text-sm",children:d.jsx(br,{value:e.data,depth:0})})}const ms=20;function br({value:e,depth:t,keyName:r}){const[n,s]=p.useState(t>2),i=p.useCallback(()=>s(l=>!l),[]);if(t>=ms)return d.jsx(Fe,{keyName:r,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return d.jsx(Fe,{keyName:r,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return d.jsx(Fe,{keyName:r,value:String(e),className:"text-blue-500"});if(typeof e=="number")return d.jsx(Fe,{keyName:r,value:String(e),className:"text-green-500"});if(typeof e=="string")return d.jsx(Fe,{keyName:r,value:`"${e}"`,className:"text-amber-500"});const a=Array.isArray(e),c=a?e.map((l,h)=>[String(h),l]):Object.entries(e),o=a?"[":"{",f=a?"]":"}";return d.jsxs("div",{style:{paddingLeft:t>0?16:0},children:[d.jsxs("button",{type:"button",className:"hover:bg-muted -ml-0.5 inline-flex items-center gap-0.5 rounded px-0.5 transition-colors duration-150",onClick:i,children:[d.jsx(nn,{className:Dt("size-3 transition-transform",!n&&"rotate-90")}),r!=null&&d.jsxs("span",{className:"text-foreground",children:[r,": "]}),d.jsxs("span",{className:"text-muted-foreground",children:[o,n&&` … ${c.length} items `,n&&f]})]}),!n&&d.jsxs(d.Fragment,{children:[c.map(([l,h])=>d.jsx(br,{keyName:a?void 0:l,value:h,depth:t+1},l)),d.jsx("div",{className:"text-muted-foreground",children:f})]})]})}function Fe({keyName:e,value:t,className:r}){return d.jsxs("div",{style:{paddingLeft:16},children:[e!=null&&d.jsxs("span",{className:"text-foreground",children:[e,": "]}),d.jsx("span",{className:r,children:t})]})}const gs=new Set(["http:","https:"]);function vs(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const bs={image:"data:image/",pdf:"data:application/pdf"};function wr(e,t,r){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(bs[t])?{url:n,error:null}:{url:null,error:"unsupported-data"};const s=vs(n);if(s!==null)return gs.has(s)?{url:n,error:null}:{url:null,error:"blocked"};const i=r(n);return i?{url:i,error:null}:{url:null,error:"local-unavailable"}}function yr(e,t){switch(e){case"blocked":return`This ${t} source is blocked for safety.`;case"unsupported-data":return`This data URI isn’t a valid ${t} source.`;case"local-unavailable":return`Local ${t} files can’t be displayed here.`}}function ws({content:e}){const t=ue(),r=J(l=>l.selectedCwd),n=p.useMemo(()=>wr(e.src,"image",l=>t.mediaUrl(r??"",l)),[e.src,t,r]),[s,i]=p.useState("loading"),[a,c]=p.useState(e.src);a!==e.src&&(c(e.src),i("loading"));const o=e.alt??e.title??"Canvas image";if(n.url===null){const l=n.error?yr(n.error,"image"):"";return d.jsx(tr,{children:l})}const f=n.url;return d.jsxs("div",{className:"bg-muted/40 relative flex h-full items-center justify-center",children:[s==="loading"&&d.jsx("p",{className:"text-muted-foreground absolute text-sm","aria-live":"polite",children:"Loading image…"}),s==="error"?d.jsx(tr,{children:"This image couldn’t be loaded."}):d.jsxs(un,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[d.jsx(ys,{}),d.jsx(ln,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:d.jsx("img",{src:f,alt:o,onLoad:()=>i("loaded"),onError:()=>i("error"),className:Dt("max-h-full max-w-full object-contain transition-opacity",s==="loaded"?"opacity-100":"opacity-0")})})]})]})}function ys(){const{zoomIn:e,zoomOut:t,resetTransform:r}=dn();return d.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[d.jsx(gt,{label:"Zoom in",onClick:()=>e(),children:d.jsx(vn,{className:"size-4"})}),d.jsx(gt,{label:"Zoom out",onClick:()=>t(),children:d.jsx(bn,{className:"size-4"})}),d.jsx(gt,{label:"Reset zoom",onClick:()=>r(),children:d.jsx(gn,{className:"size-4"})})]})}function gt({label:e,onClick:t,children:r}){return d.jsx("button",{type:"button",onClick:t,"aria-label":e,className:"bg-background/80 text-muted-foreground hover:text-foreground focus-ring rounded-md border p-1.5 backdrop-blur transition-colors",children:r})}function tr({children:e}){return d.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:d.jsx("p",{children:e})})}function xs({content:e}){const t=ue(),r=sn().data,n=J(o=>o.selectedCwd),s=p.useMemo(()=>wr(e.src,"pdf",o=>t.mediaUrl(n??"",o)),[e.src,t,n]);if(s.url===null){const o=s.error?yr(s.error,"pdf"):"";return d.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:d.jsx("p",{children:o})})}const i=s.url,a=e.title??"PDF document",c=new URL(i,window.location.href).origin===window.location.origin;return c&&!r?null:c&&(r==null?void 0:r.serverRole)==="hub"?d.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[d.jsx("p",{children:"PDFs download here instead of opening."}),d.jsxs("a",{href:i,download:!0,className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Download ",a]})]}):d.jsx("object",{data:i,type:"application/pdf",title:a,className:"h-full w-full",children:d.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[d.jsx("p",{children:"This PDF can’t be shown here."}),d.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Open ",a," in a new tab"]})]})})}function ks(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const js=new Set(["http:","https:","data:"]);function xr(e,t,r){const n=e.trim(),s=ks(n);return s!==null?js.has(s)?s==="data:"&&r!==void 0?n.toLowerCase().startsWith(r)?{url:n}:{url:null}:{url:n}:{url:null}:{url:t(n)}}function Cs({content:e}){const t=ue(),r=J(i=>i.selectedCwd),n=p.useMemo(()=>xr(e.src,i=>t.mediaUrl(r??"",i),"data:audio/"),[e.src,t,r]),s=e.title??"Canvas audio";return n.url===null?d.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:d.jsx("p",{children:"This audio can’t be played here."})}):d.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center p-8",children:d.jsx("audio",{controls:!0,src:n.url,"aria-label":s,className:"w-full max-w-2xl",children:d.jsxs("p",{className:"text-muted-foreground text-sm",children:["Your browser can’t play this audio."," ",d.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function Rs({content:e}){const t=ue(),r=J(i=>i.selectedCwd),n=p.useMemo(()=>xr(e.src,i=>t.mediaUrl(r??"",i),"data:video/"),[e.src,t,r]),s=e.title??"Canvas video";return n.url===null?d.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:d.jsx("p",{children:"This video can’t be played here."})}):d.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center",children:d.jsx("video",{controls:!0,src:n.url,"aria-label":s,className:"max-h-full w-full max-w-full object-contain",children:d.jsxs("p",{className:"text-muted-foreground p-8 text-sm",children:["Your browser can’t play this video."," ",d.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function kr({content:e,documentId:t,channel:r}){const[n]=St(),s=fn(e.definition),i=p.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return d.jsx("div",{className:"p-4",children:s.ok?d.jsx(hn,{channel:r,document:s.document,sessionId:n??void 0},r?t??r.documentId:i):d.jsx(pn,{error:s.error,raw:s.raw})})}class Os{constructor(){ee(this,"contiguous",0);ee(this,"through",0);ee(this,"pending",new Map)}get highest(){return this.contiguous}get catchUpThrough(){return this.through}get pendingCount(){return this.pending.size}reset(){this.contiguous=0,this.through=0,this.pending.clear()}resetHighest(){this.contiguous=0}advance(t){this.contiguous=Math.max(this.contiguous,t)}markThrough(t){this.through=Math.max(this.through,t)}recordGap(t){return this.markThrough(t.docSeq),this.pending.set(t.docSeq,t),this.pending.size<=200?!1:(this.pending.clear(),!0)}takeNextContiguous(){for(const n of this.pending.keys())n<=this.contiguous&&this.pending.delete(n);const t=this.contiguous+1,r=this.pending.get(t);return r&&this.pending.delete(t),r}clearReachedTarget(){return this.contiguous<this.through?!1:(this.through=0,!0)}}const yt=new WeakMap,Ze=new WeakMap,we=new WeakMap,We=new WeakMap;function je(e){De(e);const t=yt.get(e);if(!t)throw new Error("Replay owner lifetime is absent.");return t}function Es(e,t){const r=Ze.get(t);if(!r||r.owner!==e)throw new Error("Replay run is foreign.");return r}function jr(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const t of Object.values(e))jr(t);Object.freeze(e)}return e}function _s(e){if(De(e),yt.has(e))throw new Error("Replay owner lifetime is already initialized.");yt.set(e,new Os)}function At(e){const t=je(e);return Object.freeze({highest:t.highest,through:t.catchUpThrough,pending:t.pendingCount})}function rr(e){je(e).reset()}function nr(e,t){const r=Ze.get(t);if(!(!r||r.owner!==e))return Object.freeze({subject:r.subject,epoch:r.epoch,revision:r.revision,observation:r.observation,ended:r.ended})}function Ss(e,t,r){const n=we.get(r),s=Ze.get(t);if(!(!s||s.owner!==e||!n||n.owner!==e||n.run!==t||n.phase!=="consuming"||n.admissionRead||!re(e,t)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:s.targetBirth})}function Ds(e,t,r){const n=Es(e,t),s=we.get(r),i=_r(e,t,r);if(!i||!s||s.owner!==e||s.run!==t||s.phase!=="consuming"||!s.admissionRead||n.ended||n.epoch!==i.epoch||n.subject!==i.previous)throw new Error("Replay own issuance is foreign or stale.");n.subject=i.subject}function Cr(e,t,r,n){if(!re(e,t))return;if(n){const i=We.get(r);return i&&i.owner===e&&i.run===t&&i.phase==="dispatching"&&!i.advanced?i.frame:void 0}const s=we.get(r);return s&&s.owner===e&&s.run===t&&s.phase==="frames"&&s.dispatching!==void 0&&!s.advanced?s.frames[s.dispatching]:void 0}function Is(e,t,r,n){const s=si(e,t,r,n);if(!s||!re(e,t))throw new Error("Replay cursor advance has no genuine core witness.");const i=n?We.get(r):we.get(r);if(!i||i.advanced)throw new Error("Replay frame advance was consumed.");i.advanced=!0,je(e).advance(s.docSeq)}function As(e,t){const r=Ze.get(t),n=(r==null?void 0:r.lastPage)&&we.get(r.lastPage);if(!r||r.owner!==e||!re(e,t)||r.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&je(e).highest<r.target)return;const s=je(e);return Object.freeze({highest:s.highest,through:s.catchUpThrough,target:r.target})}function Ns(e,t){const r=Je(e,t);if(!r)throw new Error("Replay notice is foreign or stale.");const n=je(e),s=r.notification;if(r.mode==="quarantine")n.markThrough(s.type==="canvas_channel_snapshot"?s.snapshot.highWatermark:s.docSeq),s.type!=="canvas_channel_snapshot"&&n.recordGap(s);else{if(r.mode==="gap"&&s.type!=="canvas_channel_snapshot")return n.recordGap(s);r.mode==="event"&&vi(e,t)}return!1}function zs(e,t){const r=Je(e,t);if(!r||r.mode!=="event"||r.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");je(e).advance(r.notification.docSeq)}function Ts(e){const t=ce(e),r=je(e),n=Object.freeze({}),s={owner:e,subject:t.subject,epoch:t.epoch,revision:t.revision,observation:t.observation,ended:!1,starting:r.highest,succeeded:!1};Ze.set(n,s),ci(e,n);const i=()=>re(e,n),a=()=>ce(e).live?i()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!i())return null;const c=ce(e),o=r.highest,f=ut(e),l=f.getCanvasChannel;if(!i())return null;const h=await l.call(f,t.documentId,{since:o,limit:200});if(!i())return null;const u=jr(on.parse(h));if(!i())return null;const g=Object.freeze({});return we.set(g,{owner:e,run:n,response:u,since:o,revision:c.revision,observation:c.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),g},consumePage(c){const o=we.get(c);return!i()||!o||o.owner!==e||o.run!==n||o.phase!=="read"?{kind:"done"}:(o.phase="consuming",ui(e,n,c)!=="accepted"||!i()?(o.phase="finished",{kind:"done"}):(s.target??(s.target=o.response.highWatermark),s.targetBirth=o.response.incarnation,o.frames=Object.freeze(o.response.events.filter(l=>l.docSeq<=s.target)),o.phase="frames",s.lastPage=c,o.response.resetRequired&&r.advance(o.response.retentionFloor-1),{kind:"frames",count:o.frames.length}))},advancePageFrame(c,o){const f=we.get(c);if(!i()||!f||f.owner!==e||f.run!==n||f.phase!=="frames"||o!==f.next||!f.frames[o])return!1;f.next=o+1,f.dispatching=o,f.advanced=!1;try{return ir(e,n,c,!1)&&i()}finally{f.dispatching=void 0}},finishPage(c){const o=we.get(c);if(!i()||!o||o.owner!==e||o.run!==n||o.phase!=="frames"||o.next!==o.frames.length||s.target===void 0)return"done";if(o.phase="finished",o.response.events.length<200||r.highest>=s.target)return r.advance(s.target),!i()||(or(e,n),!i())||(s.succeeded=!0),"done";if(r.highest<=o.since)throw new Error("Document replay made no progress.");return"again"},failed(){i()&&li(e,n)},beginFinalization(){return a()??(s.succeeded?"drain":"stop")},takePending(){if(!i())return null;const c=r.takeNextContiguous();if(!c||!i())return null;const o=Object.freeze({});return We.set(o,{owner:e,run:n,frame:c,phase:"taken",advanced:!1}),o},advancePending(c){const o=We.get(c);if(!i()||!o||o.owner!==e||o.run!==n||o.phase!=="taken")return!1;o.phase="dispatching";try{return ir(e,n,c,!0)&&i()}finally{o.phase="finished",We.delete(c)}},finishFinalization(){const c=a();if(c)return c;if(r.clearReachedTarget()){const o=a();if(o)return o;or(e,n);const f=a();if(f)return f}if(r.pendingCount||r.catchUpThrough>r.highest){const o=ce(e);if(r.highest>s.starting||o.revision>s.revision||o.observation>s.observation)return"restart";di(e,n)}return a()??"stop"},current:i,end:()=>{s.ended=!0}})}var pe,kt,Le;class xt{constructor(){Me(this,pe);ee(this,"current",null);ee(this,"token",0);ee(this,"retiring",!1);ee(this,"subscribers",new Set);ee(this,"resources",new Map);ee(this,"doc",null);ee(this,"docClaims",new WeakMap);ee(this,"retiringDoc",!1);ee(this,"docResources",new Map);ee(this,"bindings",new WeakSet)}getCurrent(){return this.current}observeHostContext(t){if(this.retiring)return null;if(!t.transportOwner||typeof t.transportOwner!="object"||!Number.isSafeInteger(t.publisherEpoch)||t.publisherEpoch<0)throw new Error("Explicit transport owner and epoch required.");const r=["frame","documentId","resolvedSource","logicalUrl","reloadKey","sessionId","eligibility","exactOrigin","transportOwner","publisherEpoch"];if(r.some(s=>!Object.hasOwn(t,s))||typeof t.documentId!="string"||!t.documentId||typeof t.logicalUrl!="string"||typeof t.reloadKey!="string")throw new Error("Complete host context required.");const n=this.current;return n&&r.every(s=>Object.is(n[s],t[s]))?n:(this.retire(),this.current=Object.freeze({...t,token:this.token,loaded:!1}),this.current)}observeLoaded(t){return this.retiring||this.current!==t||!t.frame?null:(this.retire(),this.current=Object.freeze({...t,token:this.token,loaded:!0}),this.current)}retire(){if(this.retiring)return;const t=this.current;this.current=null;const r=this.doc;this.doc=null,this.token++,this.retiring=!0;const n=[...t?this.resources.get(t)??[]:[],...r?this.docResources.get(r)??[]:[],...this.subscribers];r&&this.docResources.delete(r),t&&this.resources.delete(t);try{for(const s of n)try{const i=s();i&&typeof i.then=="function"&&Promise.resolve(i).catch(()=>{})}catch{}}finally{this.retiring=!1}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}own(t,r){if(this.retiring||this.current!==t)throw new Error("Frame observation retired.");const n=this.resources.get(t)??new Set;return n.add(r),this.resources.set(t,n),()=>{n.delete(r)}}bindDoc(t,r,n){return ve(this,pe,kt).call(this,t,r,n)}acquireDoc(t,r,n){const s=ve(this,pe,kt).call(this,t,r,n),i=Object.freeze({});this.docClaims.set(s,i);let a=!1;return Object.freeze({binding:s,release:()=>{a||(a=!0,this.docClaims.get(s)===i&&(this.docClaims.delete(s),this.doc===s&&this.bindings.has(s)&&ve(this,pe,Le).call(this)))}})}disableDoc(){ve(this,pe,Le).call(this)}retireDoc(t){this.doc===t&&this.bindings.has(t)&&ve(this,pe,Le).call(this)}ownDoc(t,r){if(!this.isCurrent(t))throw new Error("Doc binding retired.");const n=this.docResources.get(t)??new Set;return n.add(r),this.docResources.set(t,n),()=>{n.delete(r)}}isCurrent(t){return!this.retiring&&!this.retiringDoc&&this.doc===t&&this.bindings.has(t)&&this.current===t.observation}}pe=new WeakSet,kt=function(t,r,n){const s=this.doc,i=this.token,a=ss(cr,r);if(!a)throw this.disableDoc(),new Error("Established server Doc birth required.");const c=a,o=t.exactOrigin,f=t.eligibility==="served-document"?o==="null":t.eligibility==="preview-listener"&&o!==null&&new URL(o).origin===o;if(!t.loaded||!t.frame||typeof t.frame.postMessage!="function"||!t.resolvedSource||!f||t.documentId!==c.documentId||!n||n.length>200)throw new Error("Loaded eligible frame and established Doc birth required.");if(this.retiring||this.retiringDoc||this.current!==t||this.doc!==s||this.token!==i)throw new Error("Frame observation retired during Doc admission.");if(this.doc){if(this.doc.observation!==t)throw new Error("Doc binding belongs to another host load.");if(V(this.doc.incarnation,c)&&this.doc.scope===n)return this.doc;throw this.retire(),new Error("Doc birth changed; a fresh host load is required.")}const l=Object.freeze({observation:t,incarnation:Object.freeze(c),scope:n});try{return this.doc=l,this.bindings.add(l),l}catch(h){throw this.doc===l&&ve(this,pe,Le).call(this),h}},Le=function(){if(this.retiringDoc)return;const t=this.doc;this.doc=null,this.retiringDoc=!0;const r=[...t?this.docResources.get(t)??[]:[]];t&&this.docResources.delete(t);try{for(const n of r)try{const s=n();s&&typeof s.then=="function"&&Promise.resolve(s).catch(()=>{})}catch{}}finally{this.retiringDoc=!1}};function Ms(e,t,r){if(!r||typeof r.captureOriginal!="function"||typeof r.submit!="function"||typeof r.inspect!="function"||typeof r.isCurrentOwner!="function"||r.owner!==t.observation.transportOwner||r.publisherEpoch!==t.observation.publisherEpoch)throw new Error("Explicit current transport submit and inspect ports required.");const{owner:n,publisherEpoch:s,isCurrentOwner:i,submit:a,inspect:c,captureOriginal:o}=r,f=Object.freeze({expectedGeneration:t.incarnation.generation}),l=()=>{try{return e.isCurrent(t)?i(n,s)===!0&&e.isCurrent(t):!1}catch{return!1}};if(!l())throw new Error("Doc binding unavailable.");const h=()=>{if(!l())throw new Error("Doc binding retired.")};return Object.freeze({binding:t,current:l,captureOriginal:u=>{h();const g=u.id;h();const w=u.bytes;h();const m=Reflect.apply(o,r,[Object.freeze({id:g,bytes:w})]);if(h(),!m)return null;const y=m.id;h();const N=m.bytes;h();const D=m.submit;h();const I=m.inspect;return h(),y!==g||N!==w||typeof D!="function"||typeof I!="function"?null:Object.freeze({id:g,bytes:w,submit:async M=>{h(),M.throwIfAborted();const T=await Reflect.apply(D,m,[M]);return h(),M.throwIfAborted(),T},inspect:async M=>{h(),M.throwIfAborted();const T=await Reflect.apply(I,m,[M]);return h(),M.throwIfAborted(),T}})},retireObservation:()=>{l()&&e.retire()},onRetire:u=>e.ownDoc(t,u),submit:(u,g)=>(h(),g.throwIfAborted(),a(u,f,g)),inspect:(u,g)=>(h(),g.throwIfAborted(),c(u,f,g))})}class Fs{constructor(){ee(this,"revision",0);ee(this,"draining",!1);ee(this,"cleanup");ee(this,"subscribers",new Set);ee(this,"retirements",new WeakMap)}captureRetirement(){const t=Object.freeze({}),r=++this.revision,n=this.cleanup;return this.cleanup=void 0,this.retirements.set(t,{revision:r,cleanup:n,callbacks:this.draining?[]:[...this.subscribers]}),t}drainRetirement(t){const r=this.retirements.get(t);if(!r)throw new Error("Frame resource retirement is foreign or consumed.");this.retirements.delete(t);const n=this.draining;this.draining=!0;try{this.drain(r.cleanup);for(const s of r.callbacks)this.drain(s)}finally{this.draining=n}}begin(){const t=this.captureRetirement(),r=this.revision;return this.drainRetirement(t),r}once(t,r,n){let s=!1;return()=>{if(s||(s=!0,!this.current(t)||!r()||!this.current(t)))return null;const i=n();return!this.current(t)||!r()||!this.current(t)?null:i}}drain(t){try{Promise.resolve(t==null?void 0:t()).catch(()=>{})}catch{}}current(t){return this.revision===t}install(t,r){return this.current(t)?(this.cleanup=r,!0):!1}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}}function qs(e,t,r){const n=()=>e.current(t)&&r.current()===!0&&e.current(t),s=e.once(t,n,r.complete);return Object.freeze({completeLoad:()=>{const i=s();return!i||!n()||r.accept(i)!==!0||!n()?null:i}})}function Ls(e,t,r){const n=()=>e.current(t)&&r.current()===!0&&e.current(t);if(!n())return null;const s=r.acquire();if(!s)return null;let i=!1,a=null,c;try{const o=s.binding;if(n()&&r.bindingCurrent(o)===!0&&n()){const f=r.createPort(o);n()&&r.portCurrent(f)===!0&&n()&&e.install(t,s.release)&&(i=!0,a=f)}}catch(o){c={cause:o}}if(!i)try{s.release()}catch(o){c??(c={cause:o})}if(c)throw c.cause;return a}function Ps(e){const t=()=>Object.assign(new Error("Document actions are unavailable."),{status:409}),r=(s,i)=>{if(i.aborted||!e.current(s)||i.aborted)throw t()},n=(s,i)=>{const a=ur.parse(i);if(a.receipt.id!==s)throw new Error("Document receipt does not match this action.");return a};return Object.freeze({current:e.current,submit:async(s,i)=>{const a=rt.parse(JSON.parse(JSON.stringify(s))),c=a.id;r("submit",i);const o=await e.submit(a,i);r("read",i);const f=n(c,o);return r("read",i),f},inspect:async(s,i)=>{r("read",i);const a=await e.inspect(s,i);r("read",i);const c=n(s,a);return r("read",i),c},captureOriginal:s=>{const i=rt.parse(JSON.parse(JSON.stringify(s))),a=i.id,c=JSON.stringify(i);if(!e.current("submit"))return null;const o=e.capture(i,c);if(!o||!e.current("submit")||!o.current("submit"))return null;let f=!1;const l=h=>o.current(h)===!0;return Object.freeze({id:a,bytes:c,current:l,submit:async h=>{if(f||h.aborted||!l("submit"))throw t();f=!0;const u=await o.submit(JSON.parse(c),h);if(h.aborted||!l("read"))throw t();const g=n(a,u);if(h.aborted||!l("read"))throw t();return g},inspect:async h=>{if(h.aborted||!l("read"))throw t();const u=await o.inspect(a,h);if(h.aborted||!l("read"))throw t();const g=n(a,u);if(h.aborted||!l("read"))throw t();return g}})}})}function Bs(e){return Object.freeze({id:e.id,bytes:e.bytes,submit:async t=>{try{return{kind:"accepted",receipt:await e.submit(t)}}catch{return{kind:"uncertain"}}},inspect:async t=>{try{return{kind:"accepted",receipt:await e.inspect(t)}}catch{return{kind:"unknown"}}}})}function Us(e,t,r){const n=rt.parse(JSON.parse(e.bytes));if(n.id!==e.id||JSON.stringify(n)!==e.bytes||!r())return null;const s=t(n);return!r()||!s?null:Bs(s)}const Ws=xt.prototype.acquireDoc,st=new WeakMap,jt=new WeakMap;function Gs(e,t){const r=ut(e),n=new WeakMap,s=(a,c)=>t.current(c)&&ke(e,a,!0);return Object.freeze({prepareFrameLoad:(a,c)=>{var u;if(!(a instanceof xt)||c.loaded)return null;const o=sr(e),f=o?(u=_e(e,o))==null?void 0:u.httpBaseline:void 0,l=t.begin();if(!o||!f||!t.current(l)||!ke(e,o,!0)||a.getCurrent()!==c||c.transportOwner!==r||!s(o,l))return null;let h=null;return qs(t,l,{current:()=>{var g;return ke(e,o,!0)&&((g=_e(e,o))==null?void 0:g.httpBaseline)===f&&a.getCurrent()===(h??c)&&t.current(l)&&ke(e,o,!0)},complete:()=>(h=a.observeLoaded(c),h),accept:g=>{var w,m;return!t.current(l)||!ke(e,o,!0)||((w=_e(e,o))==null?void 0:w.httpBaseline)!==f||a.getCurrent()!==g||!t.current(l)||!ke(e,o,!0)||((m=_e(e,o))==null?void 0:m.httpBaseline)!==f?!1:(n.set(g,{record:o,birth:f.birth}),!0)}})},subscribeInvalidation:a=>t.subscribe(a),attachFrame:(a,c)=>{if(!(a instanceof xt))return null;const o=sr(e),f=t.begin();if(!o||!t.current(f)||!ke(e,o,!0)||a.getCurrent()!==c||c.transportOwner!==r||!s(o,f))return null;const l=n.get(c);return!l||l.record!==o||!V(l.birth,_e(e,o).birth)?null:Ls(t,f,{current:()=>s(o,f),acquire:()=>{const h=Ws.call(a,c,_e(e,o).birth,_e(e,o).birth.documentId);let u=!1,g=null,w;try{s(o,f)&&a.getCurrent()===c&&s(o,f)&&(g=Object.freeze({binding:h.binding,release:h.release}),u=!0)}catch(m){w={cause:m}}if(!u)try{h.release()}catch(m){w??(w={cause:m})}if(w)throw w.cause;return g},bindingCurrent:h=>a.isCurrent(h)&&s(o,f),createPort:h=>Ms(a,h,{owner:r,publisherEpoch:c.publisherEpoch,isCurrentOwner:(u,g)=>u===r&&g===c.publisherEpoch&&t.current(f)&&ke(e,o),captureOriginal:u=>Us(u,g=>{var w;return((w=ai(e,o))==null?void 0:w.captureOriginal(g))??null},()=>s(o,f)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:h=>h.current()&&s(o,f)})}})}function $s(e){if(De(e),st.has(e))throw new Error("Frame owner is already initialized.");const t=new Fs,r=Gs(e,t);return st.set(e,{frames:t,facade:r}),r}function Hs(e){var t;return De(e),(t=st.get(e))==null?void 0:t.facade}function Pe(e){De(e);const t=st.get(e);if(!t)return;const r=Object.freeze({});return jt.set(r,{owner:e,frames:t.frames,ticket:t.frames.captureRetirement()}),r}function Be(e,t){if(!t)return;const r=jt.get(t);if(!r||r.owner!==e)throw new Error("Frame retirement is foreign or consumed.");jt.delete(t),r.frames.drainRetirement(r.ticket)}function Rr(e,t){const r=be(e,t),n=ni(e,t);if(!(!r||!n))return{owner:t,verified:r.verified,...Ps(n)}}function he(e,t){return{documentId:e,transport:t,events:[],available:!1}}function Vs(e,t,r,n,s,i){var o,f;const a=e.documentId===r&&e.transport===n?e:he(r,n);if(a.snapshot&&(t.highWatermark<a.snapshot.highWatermark||t.stateRev<a.snapshot.stateRev))return a;const c=new Map((((o=a.snapshot)==null?void 0:o.receipts)??[]).filter(l=>l.receipt.docSeq>=t.receiptRetentionFloor).map(l=>[l.receipt.id,l]));for(const l of t.receipts)c.set(l.receipt.id,l);return{...a,available:i,snapshot:{...t,...s?{}:{routing:(f=a.snapshot)==null?void 0:f.routing},receipts:[...c.values()].sort((l,h)=>h.receipt.docSeq-l.receipt.docSeq).slice(0,400)},events:t.resetRequired?a.events.filter(l=>l.docSeq>=t.retentionFloor):a.events}}function Js(e){var r,n,s,i,a,c,o,f,l,h,u,g;const t=async()=>{throw Object.assign(new Error("Document actions are unavailable."),{status:409})};return{documentId:e.documentId,enabled:e.available&&((r=e.binding)==null?void 0:r.verified)===!0&&((s=(n=e.snapshot)==null?void 0:n.routing)==null?void 0:s.enabled)===!0,submissionOwner:(i=e.binding)==null?void 0:i.owner,current:((a=e.binding)==null?void 0:a.current)??(()=>!1),approvedEventTypes:e.available?((o=(c=e.snapshot)==null?void 0:c.routing)==null?void 0:o.approvedEventTypes)??[]:[],destinationLabel:e.available?((l=(f=e.snapshot)==null?void 0:f.routing)==null?void 0:l.destinationLabel)??"Actions unavailable":"Actions unavailable",...e.snapshot?{snapshot:e.snapshot}:{},submit:((h=e.binding)==null?void 0:h.submit)??t,inspect:((u=e.binding)==null?void 0:u.inspect)??t,captureOriginal:(g=e.binding)==null?void 0:g.captureOriginal}}function Xs(e,t,r){return!!(e&&t&&r.incarnation&&V(t,r.incarnation)&&(r.highWatermark<e.highWatermark||r.stateRev<e.stateRev))}function Or(e,t,r,n){const s=e.documentId===r&&e.transport===n?e:he(r,n);return{...s,events:[...s.events,t].slice(-200)}}function Zs(e,t){if(e.incarnation&&(e.incarnation.documentId!==t||e.events.some(r=>r.documentId!==t||!r.incarnation||!V(e.incarnation,r.incarnation))))throw new Error("Document replay identity changed.")}const Ct=new WeakMap;function Ys(e,t,r){const n=Ss(e,t,r);if(n)return Ct.set(r,{owner:e,run:t,witness:n}),n}const Er=new WeakMap,Ve=new WeakMap,Rt=new WeakMap,Ot=new WeakMap;function ye(e,t){De(e);const r=t??Ve.get(e),n=r&&Er.get(r);return n&&n.owner===e&&Ve.get(e)===r&&n.active?n:void 0}function X(e){return De(e),Ve.get(e)}function be(e,t){const r=ye(e,t);return r?Object.freeze({birth:r.birth,httpBaseline:r.httpBaseline,snapshot:r.snapshot,verified:r.verified}):void 0}function Ge(e,t,r=!1){var i,a;const n=ye(e,t),s=ce(e);return!!n&&s.live&&n.verified&&n.transport===ut(e)&&(!r||((a=(i=n.snapshot)==null?void 0:i.routing)==null?void 0:a.enabled)===!0)}function Qs(e){const t=ye(e);Ve.delete(e),t&&(t.active=!1,t.verified=!1)}function vt(e,t){const r=ye(e,t);r&&(r.verified=!1)}function Ks(e,t,r){const n=ye(e,r);return!n||!re(e,t)?!1:(n.verified=!0,re(e,t))}function ei(e,t,r){const n=Ct.get(r);Ct.delete(r);const s=(n==null?void 0:n.owner)===e&&n.run===t?n.witness:void 0;if(!s||!re(e,t))return!1;const i=s.response.incarnation;let a=ye(e);if(!a&&!i)return re(e,t);if(!a&&i){const c=ce(e),o=()=>{const w=ce(e);return re(e,t)&&w.epoch===c.epoch&&w.observation===c.observation&&X(e)===c.subject},f=ut(e),l=f.ingestCanvasEvent;if(!o())return!1;const h=Function.prototype.bind.call(l,f),u=f.getCanvasEventReceipt;if(!o())return!1;const g=Function.prototype.bind.call(u,f);if(!o())return!1;a={owner:e,token:Object.freeze({}),birth:Object.freeze({...i}),active:!0,verified:!1,submit:h,inspect:g,transport:f},Er.set(a.token,a),Ve.set(e,a.token),a.httpBaseline=Object.freeze({birth:a.birth,floor:s.response.receiptRetentionFloor}),Rt.set(r,Object.freeze({owner:e,run:t,epoch:c.epoch,previous:c.subject,subject:a.token}));try{Ds(e,t,r)}catch(w){throw ye(e)===a&&pi(e,t,r),w}finally{Rt.delete(r)}if(!re(e,t))return!1}else if(a){if(!i||!V(a.birth,i))return!1;a.httpBaseline=Object.freeze({birth:a.birth,floor:s.response.receiptRetentionFloor})}return re(e,t)?(a&&(a.verified=mi(e)||a.verified),!0):!1}function Nt(e,t,r){const n=zt(e),s=n.subject,i=()=>Ir(e,n,r);if(!s||!Ge(e,s)){const o=Pe(e);Be(e,o)}if(!i())return;const a=s&&Rr(e,s),c=Hs(e);n.dispatch(o=>{var h;if(!i())return o;const f=((h=o.binding)==null?void 0:h.owner)===s?o:he(n.documentId,n.transport),l=typeof t=="function"?t(f):t;return i()?{...l,...l.snapshot?{snapshot:Object.freeze({...l.snapshot})}:{},binding:a,frameAdmission:c}:o})}function ti(e,t,r,n,s){const i=zt(e),a=ye(e);Ir(e,i,s)&&(a&&(a.snapshot=t),Nt(e,c=>Vs(c,t,i.documentId,i.transport,r,n),s))}function ri(e,t,r,n){const s=Cr(e,t,r,n);if(!re(e,t)||!s)return!1;if(s.docSeq<=At(e).highest)return re(e,t);Ot.set(r,{owner:e,run:t,pending:n,frame:s});try{Is(e,t,r,n)}finally{Ot.delete(r)}if(!re(e,t))return!1;const i=zt(e);return Nt(e,a=>Or(a,s,i.documentId,i.transport),t),re(e,t)}function ni(e,t){const r=ye(e,t);if(!r)return;const n=ce(e).documentId;return{current:s=>Ge(e,t,s==="submit"),submit:(s,i)=>r.submit(n,s,{expectedGeneration:r.birth.generation},i),inspect:(s,i)=>r.inspect(n,s,{expectedGeneration:r.birth.generation},i),capture:()=>{const s=r.httpBaseline;return!s||!Ge(e,t,!0)||!V(s.birth,r.birth)?null:Object.freeze({current:i=>Ge(e,t,i==="submit")&&(i==="read"||r.httpBaseline===s),submit:(i,a)=>r.submit(n,i,{expectedGeneration:s.birth.generation},a),inspect:(i,a)=>r.inspect(n,i,{expectedGeneration:s.birth.generation},a)})}}}function _r(e,t,r){const n=Rt.get(r),s=ce(e);return n&&n.owner===e&&n.run===t&&s.epoch===n.epoch&&s.subject===n.subject&&s.live?n:void 0}function si(e,t,r,n){const s=Ot.get(r);return s&&s.owner===e&&s.run===t&&s.pending===n&&re(e,t)?s.frame:void 0}const Sr=new WeakMap,it=new WeakMap;function ii(e){const t=it.get(e);if(!t)throw new Error("Document construction ticket is foreign or consumed.");return it.delete(e),t}function oi(e,t,r){const n=Object.freeze({});it.set(n,Object.freeze({documentId:e,transport:t,dispatch:r}));try{const s=gi(n);return Sr.set(n,s),n}finally{it.delete(n)}}function Q(e){const t=Sr.get(e);if(!t)throw new Error("Document owner is foreign.");return t}function De(e){Q(e)}function ce(e){return Q(e).facts()}function ut(e){return Q(e).transport()}function sr(e){return Q(e).subject()}function _e(e,t){return Q(e).subjectFacts(t)}function ke(e,t,r=!1){return Q(e).subjectCurrent(t,r)}function ai(e,t){return Q(e).binding(t)}function ci(e,t){Q(e).reserve(t)}function re(e,t){return Q(e).current(t)}function ui(e,t,r){return Q(e).admit(t,r)}function ir(e,t,r,n){return Q(e).frame(t,r,n)}function or(e,t){return Q(e).qualify(t)}function li(e,t){Q(e).failed(t)}function di(e,t){Q(e).unavailable(t)}function fi(e,t){Q(e).start(t)}function hi(e){Q(e).dispose()}const Dr=new WeakMap;function zt(e){const t=Object.freeze(Q(e).projection());return Dr.set(t,Object.freeze({custodyKey:e,capture:t})),t}function Ir(e,t,r){const n=Dr.get(t);return(n==null?void 0:n.custodyKey)===e&&n.capture===t&&Q(e).projectionCurrent(t.epoch,t.subject,r)}function pi(e,t,r){Q(e).abortAdmission(t,r)}function mi(e){return Q(e).qualified()}const Et=new WeakMap;function gi(e){const{documentId:t,transport:r,dispatch:n}=ii(e);let s,i=!1,a;const c={live:!0};let o=0,f,l,h=!1,u,g,w=0;const m=()=>c.live,y=()=>Qs(e);let N=0;const D=()=>At(e),I=x=>{const b=nr(e,x);return!!b&&!b.ended&&m()&&s===x&&b.epoch===o&&b.subject===X(e)},M=(x=!1)=>{const b=Pe(e);y(),o++,s=void 0,x&&rr(e),Be(e,b)},T=(x,b)=>Nt(e,x,b),U=x=>{const b=As(e,x),S=X(e),_=S&&be(e,S);return!I(x)||!b||b.through>b.highest||!u||!_||!V(u,_.birth)||!Ks(e,x,S)?!1:(u=void 0,T(z=>({...z,available:!0}),x),I(x))},P=(x,b,S)=>{const _=X(e),z=_&&be(e,_),R=o,k=()=>m()&&R===o&&X(e)===_&&(!S||I(S));if(!k()||Xs(z==null?void 0:z.snapshot,z==null?void 0:z.birth,x))return;const L=b?x.routing:l;x={...x,routing:L&&Object.freeze({enabled:L.enabled,destinationLabel:L.destinationLabel,approvedEventTypes:Object.freeze([...L.approvedEventTypes])})},b&&(l=x.routing),!_&&!x.incarnation&&(h=!0),k()&&ti(e,x,b,u===void 0,S)},q=(x,b)=>{var ae;const S=Ys(e,x,b);if(!I(x)||!S)return"discard";const _=S.response;Zs(_,t);const z=_.incarnation;if((X(e)||u||g)&&!z)throw new Error("Document replay identity is unavailable.");if(g&&z&&!V(g,z))return M(!0),T(he(t,r)),"restart";const R=X(e),k=(R&&((ae=be(e,R))==null?void 0:ae.birth))??u;if(z&&(k&&!V(k,z)||!k&&h||S.targetBirth&&!V(S.targetBirth,z)))return u=z,h=!1,l=void 0,f=void 0,M(!0),T(he(t,r)),"restart";const{events:L,...W}=_,K=X(e);return!K&&z&&(u=g??z),!ei(e,x,b)||!I(x)?"discard":(!K&&z&&(g=void 0),P(W,S.revision===N,x),I(x)?"accepted":"discard")},$=(x,b,S)=>{var k;const _=Cr(e,x,b,S),z=X(e),R=(z&&((k=be(e,z))==null?void 0:k.birth))??u;return!I(x)||!_||_.documentId!==t||R&&(!_.incarnation||!V(R,_.incarnation))?!1:ri(e,x,b,S)},te=(x,b)=>{const S=Object.freeze({});Et.set(S,Object.freeze({owner:e,revision:N,observation:w,epoch:o,notification:x,mode:b}));try{return Ns(e,S)}finally{Et.delete(S)}},me=x=>{if(i||!m()||(i=!0,T(he(t,r)),!m()))return;const b=an(void 0,S=>{if(!m()||S.documentId!==t)return;const _=S.type==="canvas_channel_snapshot"?S.snapshot.incarnation:S.incarnation,z=X(e);if(!z){if(u&&!g&&(!_||!V(u,_))||!_||_.documentId!==t)return;if(!g||!V(g,_)){const R=!!g||!!u;if(g=Object.freeze({..._}),w++,l=void 0,f=void 0,h=!1,R&&(M(!0),T(he(t,r))),!m()||!g||!V(g,_))return}te(S,"quarantine"),m()&&x();return}if(u&&(!_||!V(u,_))){_&&x();return}if(_&&!V(be(e,z).birth,_)){u=_,h=!1,l=void 0,f=void 0,M(!0),T(he(t,r)),m()&&x();return}if(_){if(f!==void 0&&f!==S.scope){const R=Pe(e);if(f=S.scope,vt(e,z),o++,s=void 0,N++,Be(e,R),X(e)!==z||!m())return;T(k=>({...k,available:!1})),X(e)===z&&m()&&x();return}f=S.scope,N++,S.type==="canvas_channel_snapshot"?P(S.snapshot,!0):S.docSeq>D().highest+1?(te(S,"gap")&&m()&&T(k=>({...k,available:!1})),m()&&x()):te(S,"event")}},r,()=>{if(!m())return;const S=Pe(e),_=X(e);_&&vt(e,_),o++,s=void 0,N++,Be(e,S),T(z=>({...z,available:!1})),m()&&x()});m()?a=b:b(),m()&&x()};return Ar.set(e,x=>{const b=Je(e,x);if(!b||b.notification.type==="canvas_channel_snapshot")return;const S=X(e),_=o;!S||!b.notification.incarnation||!V(be(e,S).birth,b.notification.incarnation)||(T(z=>Or(z,b.notification,t,r)),!m()||_!==o||X(e))}),{facts:()=>Object.freeze({documentId:t,live:m(),epoch:o,revision:N,observation:w,subject:X(e)}),transport:()=>r,subject:()=>X(e),subjectFacts:x=>be(e,x),subjectCurrent:(x,b)=>Ge(e,x,b),binding:x=>Rr(e,x),qualified:()=>u===void 0,projection:()=>({documentId:t,transport:r,dispatch:n,epoch:o,run:s,subject:X(e)}),projectionCurrent:(x,b,S)=>m()&&x===o&&b===X(e)&&(!S||s===S),abortAdmission:(x,b)=>{_r(e,x,b)&&M(!0)},reserve:x=>{const b=nr(e,x);if(!b||b.ended||!m()||b.epoch!==o||b.subject!==X(e))throw new Error("Replay run is foreign or stale.");s=x},current:I,admit:q,frame:$,qualify:U,failed:x=>{if(!I(x))return;const b=X(e);b&&vt(e,b),T(S=>({...S,available:!1}),x)},unavailable:x=>{I(x)&&T(b=>({...b,available:!1}),x)},start:me,dispose:()=>{if(!m())return;const x=Pe(e);c.live=!1,s=void 0;const b=a;a=void 0,y(),o++,rr(e);try{Be(e,x)}finally{b==null||b()}}}}function Je(e,t){const r=Et.get(t),n=ce(e);if(!(!r||r.owner!==e||!n.live||n.epoch!==r.epoch||n.revision!==r.revision||n.observation!==r.observation))return r}function vi(e,t){var c;const r=Je(e,t);if(!r||r.notification.type==="canvas_channel_snapshot")return;const n=r.notification,i=ce(e).subject,a=i&&be(e,i);!a||!n.incarnation||!V(a.birth,n.incarnation)||n.docSeq<=At(e).highest||(zs(e,t),!(!Je(e,t)||ce(e).subject!==i)&&((c=Ar.get(e))==null||c(t)))}const Ar=new WeakMap;function bi(e,t,r){const n=oi(e,t,r);_s(n);const s=$s(n);return Object.freeze({beginRun:()=>Ts(n),frameAdmission:s,start:i=>fi(n,i),dispose:()=>hi(n)})}function wi(e,t){let r,n=0;const s=h=>{try{t==null||t(h)}catch{}},i=h=>{r===h&&(r=void 0)},a=(h,u)=>{h.settled||(h.settled=!0,r||s(!1),u?h.reject(u.cause):h.resolve())},c=()=>{l().catch(()=>{})},o=(h,u)=>{const g=()=>n===h.revision;if(!g())return;const w=u.beginFinalization();if(g()){if(w==="restart"){c();return}if(w==="drain")for(;g();){const m=u.drainOne();if(!g())return;if(m!=="again"){if(m==="restart")c();else if(m==="tail"){const y=u.finishFinalization();g()&&y==="restart"&&c()}return}}}},f=async h=>{let u,g;try{u=e();try{for(;await u.page()==="again";);}catch(w){u.failed(w)}}catch(w){g={cause:w}}finally{i(h);try{u&&o(h,u)}catch(w){g={cause:w}}finally{a(h,g)}}},l=()=>{if(r)return r.promise;let h,u;const g=new Promise((m,y)=>{h=m,u=y}),w={revision:++n,promise:g,resolve:h,reject:u,settled:!1};return r=w,s(!0),f(w),g};return Object.freeze({request:l})}function yi(e,t,r,n){const s=bi(e,t,r);let i=!1;const a=wi(()=>{const c=s.beginRun();return{async page(){const o=await c.readPage();if(!o)return"done";const f=c.consumePage(o);if(f.kind!=="frames")return f.kind;for(let l=0;l<f.count;l++)if(!c.advancePageFrame(o,l))return"done";return c.finishPage(o)},failed:()=>c.failed(),beginFinalization:()=>{const o=c.beginFinalization();return o!=="drain"&&c.end(),o},drainOne(){if(!c.current())return c.end(),"stop";const o=c.takePending();return o?c.advancePending(o)?"again":(c.end(),"stop"):"tail"},finishFinalization:()=>{try{return c.finishFinalization()}finally{c.end()}}}},c=>{i||n==null||n(c)});return s.start(()=>{a.request().catch(()=>{})}),Object.freeze({dispose(){i=!0,s.dispose()}})}function xi(e){var f,l,h;const t=ue(),[r,n]=p.useState(()=>he(e,t)),[s,i]=p.useState({documentId:e,transport:t,pending:!0});p.useLayoutEffect(()=>{const u=yi(e,t,n,g=>{i({documentId:e,transport:t,pending:g})});return()=>u.dispose()},[e,t]);const a=r.documentId===e&&r.transport===t?r:he(e,t),c=p.useMemo(()=>Js(a),[a]),o=p.useMemo(()=>{var w;const u=(w=a.snapshot)==null?void 0:w.incarnation,g=a.binding;return u&&g?Object.freeze({incarnation:Object.freeze({...u}),current:()=>g.current("read")}):void 0},[(f=a.snapshot)==null?void 0:f.incarnation,a.binding]);return{channel:c,events:a.events,frameAdmission:a.frameAdmission,fileSaveBinding:o,fileSaveObservation:s.documentId!==e||s.transport!==t||s.pending?"pending":a.available&&((l=a.binding)!=null&&l.verified)&&((h=a.snapshot)!=null&&h.incarnation)?"ready":"unavailable"}}function ki({content:e}){const[t]=St();return t?d.jsx("div",{className:"h-full w-full",children:d.jsx(mn,{sessionId:t,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const ji=p.lazy(()=>Ce(()=>import("./CanvasFileContent-B_8zsIas.js"),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>({default:e.CanvasFileContent}))),Ci=p.lazy(()=>Ce(()=>import("./CanvasModel3dContent-UokbHY9i.js"),__vite__mapDeps([22,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>({default:e.CanvasModel3dContent}))),Ri=p.lazy(()=>Ce(()=>import("./CanvasCsvContent-0Mb7uOuA.js"),__vite__mapDeps([23,1,2,24,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(e=>({default:e.CanvasCsvContent}))),Oi=p.lazy(()=>Ce(()=>import("./index-Dc5cpBoO.js").then(e=>e.us),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function Wi({documentId:e,widgetChannel:t,content:r,onContentChange:n}){switch(r.type){case"url":case"browser":return d.jsx(Yn,{documentId:e,content:r},`${e}:${r.url}`);case"markdown":return d.jsx(hs,{documentId:e,content:r,onContentChange:n},r.sourcePath??"generated");case"json":return d.jsx(ps,{content:r});case"image":return d.jsx(ws,{content:r});case"pdf":return d.jsx(xs,{content:r});case"audio":return d.jsx(Cs,{content:r});case"video":return d.jsx(Rs,{content:r});case"widget":return t?d.jsx(kr,{content:r,documentId:e,channel:t}):d.jsx(Ei,{documentId:e,content:r});case"mcp_app":return d.jsx(ki,{content:r});case"file":return d.jsx(p.Suspense,{fallback:d.jsx(Ke,{}),children:d.jsx(ji,{documentId:e,content:r})});case"model3d":return d.jsx(p.Suspense,{fallback:d.jsx(Ke,{}),children:d.jsx(Ci,{content:r})});case"csv":return d.jsx(p.Suspense,{fallback:d.jsx(Ke,{}),children:d.jsx(Ri,{content:r})});case"diff":return d.jsx(p.Suspense,{fallback:d.jsx(Ke,{}),children:d.jsx(Oi,{documentId:e,content:r},r.sourcePath)})}}function Ke(){return d.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function Ei({documentId:e,content:t}){const{channel:r}=xi(e);return d.jsx(kr,{documentId:e,content:t,channel:r})}const _i=p.lazy(()=>Ce(()=>import("./BlintzCanvas-ClOKWzws.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas})));function Gi({roomId:e,document:t,content:r,onSave:n}){const[s,i]=p.useState(null),[a,c]=p.useState(!1),[o,f]=p.useState(null),l=s!==null,h=r.sourcePath===void 0;Mn(e,l?t.id:null);const u=async()=>{if(s===null)return;if(s===r.content){i(null),f(null);return}c(!0),f(null);const g=await n(t.id,{...r,content:s});c(!1),g?i(null):f("Couldn’t save. Your words are still here. Try again.")};return d.jsxs("div",{className:"flex h-full flex-col",children:[h&&d.jsxs("div",{className:"flex items-center justify-end gap-2 border-b px-2 py-1",children:[l&&d.jsx("span",{className:"text-muted-foreground text-xs",children:a?"Saving…":"Everyone sees your save."}),d.jsx(et,{type:"button",size:"xs",variant:"ghost",disabled:a,"aria-label":l?"Save for the room":"Edit this document",onClick:()=>l?void u():i(r.content),children:l?d.jsx(lr,{className:"size-3.5"}):d.jsx(dr,{className:"size-3.5"})})]}),o!==null&&d.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:o}),d.jsx("div",{className:"flex-1 px-2 pb-6",children:d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"}),children:d.jsx(_i,{value:s??r.content,editable:l,onChange:i},l?"editing":`rev-${t.rev}`)})})]})}const _t="dorkos-canvas-sessions",Si=1440*60*60*1e3;function Nr(){try{const e=localStorage.getItem(_t);if(!e)return null;const t=JSON.parse(e);return t===null||typeof t!="object"?null:t}catch{return null}}function zr(e){try{Object.keys(e).length===0?localStorage.removeItem(_t):localStorage.setItem(_t,JSON.stringify(e))}catch{}}function Di(e){return Array.isArray(e.documents)?[...e.documents].sort((t,r)=>(t.openedAt??0)-(r.openedAt??0)).map(t=>t.content).filter(t=>!!t):e.content?[e.content]:[]}function ot(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(ot).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${ot(n)}`).join(",")}}`}function Ii(e,t){const r=new Set,n=new Map;for(const i of e){const a=Jt(i.content);if(a!==null){r.add(a);continue}const c=ot(i.content);n.set(c,(n.get(c)??0)+1)}const s=[];for(const i of t){const a=Jt(i);if(a!==null){r.has(a)||s.push(i);continue}const c=ot(i),o=n.get(c)??0;o>0?n.set(c,o-1):s.push(i)}return s}const tt=new Set;function $i(){tt.clear()}function Hi(e,t={}){const r=ue(),n=t.canonical??!0;p.useEffect(()=>{e&&J.getState().loadCanvasForSession(e)},[e]),p.useEffect(()=>{if(!e||!n||tt.has(e))return;const s=Nr();if(!s)return;const i=s[e];if(!i){Ai(s);return}tt.add(e),(async()=>{try{const a=Di(i),c=Ii(await r.listSessionCanvas(e),a);if(c.length===0){ar(e);return}for(const o of c)await r.openSessionCanvasDocument(e,o);ar(e),J.getState().hydrateCanvasFromSnapshot(e,await r.listSessionCanvas(e))}catch{tt.delete(e)}})()},[e,n,r])}function ar(e){const t=Nr();if(!t)return;const{[e]:r,...n}=t;zr(n)}function Ai(e){const t=Date.now()-Si,r=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=t);r.length!==Object.keys(e).length&&zr(Object.fromEntries(r))}export{Wi as C,Bi as F,Gi as R,xi as a,Tn as b,zn as c,Ui as d,kr as e,$i as f,An as g,Hi as h,xr as r,us as u};
|