dorkos 0.127.1 → 0.128.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/THIRD-PARTY-NOTICES.md +61 -0
- package/dist/bin/cli.js +1387 -926
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CwNzli7O.js → AboutPage-CmQERFxo.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-D9UR9aYX.js → ActivityErrorState-Dw231W2w.js} +1 -1
- package/dist/client/assets/{ActivityPage-DeL7N0Rt.js → ActivityPage-DVfeyA9u.js} +1 -1
- package/dist/client/assets/{ActivityRow-DuuG4S5E.js → ActivityRow-DIBH4v9c.js} +1 -1
- package/dist/client/assets/{AdapterIcon-bYKCnumH.js → AdapterIcon-NqCDzgCI.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-ByQU3Ryd.js → AdapterSetupWizard-Dle_b9qc.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-CN9dDSeG.js → AgentOptionRow-BRJfZo2y.js} +1 -1
- package/dist/client/assets/{AgentPicker-Bbvnww9v.js → AgentPicker-B7upjYRk.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DmLUHbGa.js → AgentRequestCard-DXJnLk6q.js} +1 -1
- package/dist/client/assets/{AppearancePage-CS6bwH4x.js → AppearancePage-DXbhUt2e.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-DG6pYkhN.js → ApplyToOverridesDialog-C_QQhNIf.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-ByeDJweR.js → AttentionSignalRow-5E7TkG98.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CSaHAO1F.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js} +1 -1
- package/dist/client/assets/{BindingDialog-nNZW4-SF.js → BindingDialog-q--8SDJF.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-BXwncq3A.js → BlintzCanvas-DruVZcDU.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-Dt7ko9e1.js → CanvasCsvContent-CtLpZnTs.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-TO3VAFTI.js → CanvasFileContent-BThy5fjD.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-DNK3EY5W.js → CanvasModel3dContent-BbgR73jh.js} +2 -2
- package/dist/client/assets/ChannelComposer-qhk0KtW7.js +44 -0
- package/dist/client/assets/{ChatAppsOff-BxUf0caI.js → ChatAppsOff-CCZUzDIH.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-C78KCVkj.js → CodeMirrorDiff-BCpYdhgZ.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BWSTKK9s.js → CodeMirrorEditor-BeCubxHV.js} +1 -1
- package/dist/client/assets/{CommitmentList-oKrIigLt.js → CommitmentList-BZtfTnwg.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-DKtyvmFd.js → CommitmentsPage-DmurDgxV.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-DjtpGKRB.js → ComputerResourceView-Bik6GLKp.js} +1 -1
- package/dist/client/assets/{ComputerViewer-B7a77fXa.js → ComputerViewer-CksBDqdu.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-BxLNtKdv.js → ConnectionAccessLists-DRwO1v0V.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-DQEOL79u.js → ConnectionsPage-Cgg36gDY.js} +1 -1
- package/dist/client/assets/{ConventionPage-BJ1Fkt7H.js → ConventionPage-CNhpF6Z1.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-DMbNbOMW.js → ExtensionPageRoute-C2zue_Pw.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BmisG40-.js → FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-DdEYtIvk.js → ForwardConsentHost-Mbo0D-zk.js} +1 -1
- package/dist/client/assets/HandlePage-B4qbFi40.js +1 -0
- package/dist/client/assets/{HeartbeatPage-DsVZLbVN.js → HeartbeatPage-BnNbQLCW.js} +1 -1
- package/dist/client/assets/{KeyEntry-B9twGZOd.js → KeyEntry-C43vkwpA.js} +1 -1
- package/dist/client/assets/{LexicalField-CBm1TZpt.js → LexicalField-iAHcvRmI.js} +1 -1
- package/dist/client/assets/{ManagesPage-bAtPePVC.js → ManagesPage-BUIJvLmv.js} +1 -1
- package/dist/client/assets/{Marketplace-DRaPW5c2.js → Marketplace-DbdLWz0-.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-lYEkmUGJ.js → MarketplaceSourcesView-BZODwhxu.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BzZqyRxQ.js → McpAppFrame-D15nxVaI.js} +1 -1
- package/dist/client/assets/{McpSigninBody-oVPX3ZDZ.js → McpSigninBody-DmBxqgxN.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DrS3qYW1.js → Model3dViewer-RGXeJd6a.js} +1 -1
- package/dist/client/assets/NamePage-fhxyWDDY.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-BkPbuzx8.js → NewDirectMessageMenu-DBAdvv5p.js} +1 -1
- package/dist/client/assets/{NotificationsPage-CKU37E34.js → NotificationsPage-NRfyiinS.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-B7z7XHNR.js → OpenMeshSwitch-CgQ6uefo.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-BzZoS4KD.js → OperatorIdentityForm-Bls5Vo_u.js} +1 -1
- package/dist/client/assets/{PermissionHistory-D_WFGZtw.js → PermissionHistory-DPEPq8D9.js} +1 -1
- package/dist/client/assets/{PermissionsPage-15DeeKpE.js → PermissionsPage--k-xutbJ.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-CQ-iLQpo.js → PersonalityPopover-DMMptmPS.js} +1 -1
- package/dist/client/assets/PhotoPage-CNHcXbz4.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-DzvwQvMr.js → PreviewRefusedNotice-Ds4IO32o.js} +1 -1
- package/dist/client/assets/{ProfileFields-EgcVDViF.js → ProfileFields-DbPJ7fvN.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-zAOmdAo9.js → ProfilePanelContainer-CzwhrIlw.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-D5ScObov.js → ProfileRolePicker-CZEXvlJm.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-DlajKFMJ.js → PromptSuggestionChips-BXxC799Q.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BZBQY9rT.js → ReportsToPopover-YOwGLJy5.js} +1 -1
- package/dist/client/assets/{RoomSurface-YZW_jtGD.js → RoomSurface-DgH3a_Fv.js} +1 -1
- package/dist/client/assets/{RoomsPage-BY2Yzdxs.js → RoomsPage-CoXjZMWL.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-CeQJLljM.js → RunsOnPopover-CEkkjrGg.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-BgLzK2Pf.js → RuntimeConnectFlow-DXWGgvCW.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-B9dgB_DN.js → RuntimeSetupDialog-D6L1QhMF.js} +1 -1
- package/dist/client/assets/{SeenDevices-C-4m1c9h.js → SeenDevices-Bh2yh-PW.js} +1 -1
- package/dist/client/assets/{SessionsPage-B5PdbDLK.js → SessionsPage-CFvkbT9X.js} +1 -1
- package/dist/client/assets/{SettingsDialog-C8TP1x7g.js → SettingsDialog-BOOqWKcj.js} +1 -1
- package/dist/client/assets/{SkillsPage-D5GNx64I.js → SkillsPage-ntCEhUIM.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-DOpxfrLl.js → TaskDialogWrapper-vBWAWwTY.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-sW-pmnOm.js → TasksEmptyState-C_3UkAbA.js} +1 -1
- package/dist/client/assets/{TasksPage-BGtTF442.js → TasksPage-D0Zi6Mve.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-BCW51xMv.js → TeamComputerEntry-CY9eLVad.js} +1 -1
- package/dist/client/assets/{ToolsPage-Craa3-78.js → ToolsPage-0_vx5P-F.js} +1 -1
- package/dist/client/assets/{TopologyGraph-BVbPyC0W.js → TopologyGraph-DUZLZZrB.js} +1 -1
- package/dist/client/assets/{TourHost-ChgzKB0c.js → TourHost-B69XAKpE.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BtQvTzCP.js → UnlinkDialog-ptZy3IN4.js} +1 -1
- package/dist/client/assets/UnreadDivider-Ckey1IWn.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-DcsOHVds.js → WidgetErrorCard-BlqaIsPK.js} +7 -7
- package/dist/client/assets/{WithheldExtensionsNotice-Cts8hGJP.js → WithheldExtensionsNotice-7Vu1Jctn.js} +1 -1
- package/dist/client/assets/WorkView-BekLkR4O.js +51 -0
- package/dist/client/assets/{_shell-DOg4Lmhv.js → _shell-Du0F-5fK.js} +1 -1
- package/dist/client/assets/{_shell._home-BZpx4Mbk.js → _shell._home-BRIXhYLg.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-Dk3nKLHQ.js → _shell._home.activity-5rihXoYF.js} +1 -1
- package/dist/client/assets/{_shell._home.index-B9rvWnn_.js → _shell._home.index-BsLNqt4f.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-BCPd5sNc.js → _shell._home.tasks-Cxs5tLWA.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BVBkkkT0.js → _shell._home.workspaces-CEHDdfbP.js} +1 -1
- package/dist/client/assets/{_shell.channels-myIv11W5.js → _shell.channels-Bx6q9xVH.js} +1 -1
- package/dist/client/assets/{_shell.connections-DFZFVHNc.js → _shell.connections-Bm0WmgXH.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-tPcWZDaV.js → _shell.feedback-requests-DFznTGbN.js} +1 -1
- package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +1 -0
- package/dist/client/assets/_shell.session-BN42bV3w.js +1 -0
- package/dist/client/assets/{_shell.team-IofNRuKL.js → _shell.team-DmA09abY.js} +3 -3
- package/dist/client/assets/{_shell.threads-B-nWDy_6.js → _shell.threads-HH4EvufJ.js} +1 -1
- package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-COAdUrvu.js → abnfDiagram-WEYOIA3C-DxgtVd9I.js} +1 -1
- package/dist/client/assets/{access-copy-laAy9--H.js → access-copy-Dqct36mi.js} +1 -1
- package/dist/client/assets/{arc-2_zvZ-gp.js → arc-C-67Ef0p.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-D2vJp2ju.js → architectureDiagram-ZHVYKT53-B7TjdT-_.js} +1 -1
- package/dist/client/assets/{banner-Dq7DY4At.js → banner-C9qTs6-C.js} +1 -1
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CxjfUYKV.js → blockDiagram-RJAE7QA3-DNqxJ3Ww.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DBtTwidp.js → c4Diagram-XDPPPE54-D3jNLV0j.js} +1 -1
- package/dist/client/assets/{card-fYp8lOoT.js → card-DUmTNXJJ.js} +1 -1
- package/dist/client/assets/channel-B7zgJbnU.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BAzBaRVY.js → chunk-2E7WHVMD-C6OKx0ty.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-0_0KxG0G.js → chunk-2Q5K7J3B-Dr_6hHrZ.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-DmpZgXUr.js → chunk-4EMNKR2T-CSrZVDEt.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-DOa5mrA1.js → chunk-55XCU76K-CIazeRXO.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BqzmE_oJ.js → chunk-5VM5RSS4-C8IJ3zTR.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-C2F-qKzA.js → chunk-JWPE2WC7-D9DGXb79.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-Cj9J_zab.js → chunk-VQ5W62QI-B0LNYdif.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-Cyiza8Ap.js → chunk-XXDRQBXY-C7IAIbvZ.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-ITupr164.js → chunk-ZCHMQSOR-C79hvjlu.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-BH0_3wSx.js → classDiagram-v2-4MYWR3UA-0Di1C2ZB.js} +1 -1
- package/dist/client/assets/{command-tbegvEE8.js → command-BVQb6I3_.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-sZqlNAZ4.js → cose-bilkent-JH36ORCC-rZumaV4b.js} +1 -1
- package/dist/client/assets/{cpu-DDplcjVv.js → cpu-DeRuDMl4.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-6Kjz5H9v.js → cynefin-EF2NZ3EQ-CI9l9xhM.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-DK7-moDM.js → cynefinDiagram-WF24UDRP-C8CdorJJ.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-C---Yw3S.js → dagre-NK4GIZVX-AHpsTq1O.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-BZo3ih_3.js → diagram-CBK3MWTC-BpPLL30n.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-DsHN5Ikp.js → diagram-I5XIIV2D-D6loMn3G.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-CVtFfjkm.js → diagram-ODIL2UCW-BaGNd5eN.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-RrxvbTzz.js → diagram-PFBEJUXE-BnDdKu_g.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-T4vRcsqE.js → diagram-RJA3I4VV-UXagB0_c.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-DvgDENOh.js → diagram-TYUNFSNR-C-whBP-S.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CT_Ykhnb.js → ebnfDiagram-V4P3TTPT-BbG481iS.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-1cHLrAbL.js → elk-QONTBCTQ-FtssIxOc.js} +1 -1
- package/dist/client/assets/{empty-state-BuerUR2L.js → empty-state-CACt-76q.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-sKNWkMEB.js → erDiagram-KYQIGQAA-PpFgUf4C.js} +1 -1
- package/dist/client/assets/{execution-config-b_HoE2gl.js → execution-config-CGL73sRn.js} +1 -1
- package/dist/client/assets/{file-CG3ZGubn.js → file-D80JE_L0.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-CVXN_udI.js → file-exclamation-point-CcJ_e4_m.js} +1 -1
- package/dist/client/assets/{file-text-iUPjXTFV.js → file-text-Ds9edaTZ.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-DF1tpWBU.js → find-latest-widget-fence-BtqFMP_f.js} +1 -1
- package/dist/client/assets/{flowDiagram-IUGLLWBU-Dpro5XJ_.js → flowDiagram-IUGLLWBU-BIva66g9.js} +1 -1
- package/dist/client/assets/{form-CiD71zin.js → form-D93N5lrK.js} +1 -1
- package/dist/client/assets/{format-cron-B88ttX8j.js → format-cron-BpGrgPLu.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-CtR4oMUH.js → ganttDiagram-R7GPNTJY-CZqips_4.js} +1 -1
- package/dist/client/assets/{git-branch-DZBdAsc0.js → git-branch-B8JNwQ6q.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY--euaveVk.js → gitGraphDiagram-PDYL7XHY-DoIc3lda.js} +1 -1
- package/dist/client/assets/{graph-jzPQScij.js → graph-yizM0vwL.js} +1 -1
- package/dist/client/assets/{heart-CNrKCfIZ.js → heart-BavUIV45.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-3HmPoqzm.js → highlighted-body-KPVGNVTW-CGr3AgaU.js} +1 -1
- package/dist/client/assets/{image-lightbox-CV8y6iVA.js → image-lightbox-vgPEvSCc.js} +1 -1
- package/dist/client/assets/{image-off-0A5Y9ekR.js → image-off-C1uTDs9-.js} +1 -1
- package/dist/client/assets/{index-qgNv3Cxj.js → index-1QfQImuJ.js} +3 -3
- package/dist/client/assets/{index-BU6kskMP.js → index-56EOd-zy.js} +1 -1
- package/dist/client/assets/{index-COAKEYxS.js → index-7XeZCCDI.js} +1 -1
- package/dist/client/assets/{index-BLHGc7hd.js → index-B36osK_S.js} +1 -1
- package/dist/client/assets/{index-B_ScMg0T.js → index-B446r3dL.js} +1 -1
- package/dist/client/assets/{index-KUHF1hd1.js → index-BGo1YiUE.js} +1 -1
- package/dist/client/assets/{index-DloK7L_D.js → index-BJEt9R_G.js} +1 -1
- package/dist/client/assets/{index-DGl_kpd1.js → index-BKWJiERs.js} +1 -1
- package/dist/client/assets/{index-ZV77GAWw.js → index-BO3yPJt-.js} +1 -1
- package/dist/client/assets/{index-D7HEC8Yo.js → index-BOEPL6hN.js} +1 -1
- package/dist/client/assets/{index-DKxKfg7Y.js → index-BOhSPP-6.js} +1 -1
- package/dist/client/assets/{index-zQs7Z5os.js → index-BkJlIXqM.js} +1 -1
- package/dist/client/assets/{index-ClIWAc6a.js → index-Br6xDNvu.js} +1 -1
- package/dist/client/assets/{index-BL3de6b2.js → index-C4t0UTU-.js} +1 -1
- package/dist/client/assets/{index-B2dE15Nh.js → index-C8ZpJXTQ.js} +1 -1
- package/dist/client/assets/{index-DxYiYBCN.js → index-CJXMgnYp.js} +1 -1
- package/dist/client/assets/{index-D0wnu6mZ.js → index-CXBYgGja.js} +1 -1
- package/dist/client/assets/{index-Cu4ctkPn.js → index-Cdod8zEY.js} +1 -1
- package/dist/client/assets/{index-BBSooI6P.js → index-CeDn1Ak1.js} +1 -1
- package/dist/client/assets/{index-BwqobvEU.js → index-CiGYtR9O.js} +1 -1
- package/dist/client/assets/{index-DFSOBVsY.js → index-CoKNU2F9.js} +1 -1
- package/dist/client/assets/{index-DdLM7r4n.js → index-CoNMlH37.js} +1 -1
- package/dist/client/assets/{index-1z7QYB4x.js → index-CrTmY12y.js} +2 -2
- package/dist/client/assets/{index-CsGjmUNs.js → index-DE6uOpn4.js} +1 -1
- package/dist/client/assets/{index-C2NwvhhG.js → index-DEiSJbvu.js} +1 -1
- package/dist/client/assets/{index-BKDTRodW.js → index-DW4KUPHp.js} +1 -1
- package/dist/client/assets/{index-DjmZGH7V.js → index-DYEmUa5t.js} +1 -1
- package/dist/client/assets/index-Dag1qeZI.js +1 -0
- package/dist/client/assets/{index-CeqxJyr2.js → index-Dcd4NqFB.js} +1 -1
- package/dist/client/assets/{index-BZkrahcw.js → index-Dm0Tav7v.js} +1 -1
- package/dist/client/assets/{index-Bgo2UMWk.js → index-DqkFtcGQ.js} +1 -1
- package/dist/client/assets/{index-PQ9ky1pb.js → index-FI_y_dND.js} +1 -1
- package/dist/client/assets/{index-JGRdQWAP.js → index-FhWMRBQP.js} +1 -1
- package/dist/client/assets/{index-D6lfnwuN.js → index-LwL5BpE4.js} +1 -1
- package/dist/client/assets/{index-_8SHxs8S.js → index-OQuvRZTD.js} +241 -241
- package/dist/client/assets/{index-BihGQXHU.js → index-QSXJR98z.js} +1 -1
- package/dist/client/assets/{index-mG1tkeJL.js → index-SOKlO1zZ.js} +1 -1
- package/dist/client/assets/{index-DTmOp_1r.js → index-X282DRZf.js} +1 -1
- package/dist/client/assets/{index-DdHstbQU.js → index-YSHcMqHa.js} +1 -1
- package/dist/client/assets/{index-GPUOanO_.js → index-ZR5f82z2.js} +1 -1
- package/dist/client/assets/index-eVrGefuq.js +1 -0
- package/dist/client/assets/{index-BP95cLC1.js → index-n_pnc-CO.js} +1 -1
- package/dist/client/assets/{index-DyyjN4h7.js → index-tgbcsB6H.js} +1 -1
- package/dist/client/assets/{index.esm-C41qhCJ5.js → index.esm-CAeUe7uQ.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-DrdZIXXy.js → infoDiagram-MVDRKAX5-DweUdYSy.js} +1 -1
- package/dist/client/assets/{inline-code-AHNJTNEg.js → inline-code-SYHTKcle.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DUbSK1_E.js → ishikawaDiagram-HPEHV2GE-DKNQIv7P.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-BR52zXJU.js → journeyDiagram-BOSHW7O7-DPD7F4VO.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-_Wcjt7SY.js → kanban-definition-FNSA4HC5-B_uPSwxC.js} +1 -1
- package/dist/client/assets/{layers-IVPemhwp.js → layers-F4mvrI2l.js} +1 -1
- package/dist/client/assets/{lightbulb-DrVZQcOf.js → lightbulb-a6nNsrzy.js} +1 -1
- package/dist/client/assets/{link-2-Irbj23wB.js → link-2-yI2Tlm7Q.js} +1 -1
- package/dist/client/assets/{list-runtime-types-BtXx3u9w.js → list-runtime-types-CsGil5te.js} +1 -1
- package/dist/client/assets/{markdown-content-DBXaMyx0.js → markdown-content-Cjhsscbn.js} +1 -1
- package/dist/client/assets/{mention-pill-BjC9bceV.js → mention-pill-BsOeTJ2f.js} +1 -1
- package/dist/client/assets/{mermaid.core-BwsoL8Cm.js → mermaid.core-9PwG-9fN.js} +4 -4
- package/dist/client/assets/{message-square-off-CIYKFEKw.js → message-square-off-aV4NMCjd.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-1IqhYOl3.js → mindmap-definition-6OY57UG3-BRbWmQkj.js} +1 -1
- package/dist/client/assets/{more-details-CEMEkDUz.js → more-details-CRLU2HN4.js} +1 -1
- package/dist/client/assets/{owner-notice-BJY5v-87.js → owner-notice-CTJbhUak.js} +1 -1
- package/dist/client/assets/{package-CTn_hN2S.js → package-sPggO7Dr.js} +1 -1
- package/dist/client/assets/{page-container-Cde6fRTi.js → page-container-CnfDuiDC.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-CyT6JG8q.js → pane-resize-handle-63OC5vfI.js} +1 -1
- package/dist/client/assets/{paperclip-szlXSQSk.js → paperclip-WhPo3_WD.js} +1 -1
- package/dist/client/assets/{path-input-AlewPslD.js → path-input-C2KIXdON.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Djw-8h2r.js → pegDiagram-ECIUJNBX-Ct9Li_PA.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DsZyw9x9.js → pieDiagram-GNMPY74T-BAB5RA5v.js} +1 -1
- package/dist/client/assets/{plug-CgD9bf2Y.js → plug-_q5iqunq.js} +1 -1
- package/dist/client/assets/{primer-trigger-ZBFgqPeY.js → primer-trigger-B2tjuHBx.js} +1 -1
- package/dist/client/assets/{profile-errors-Lfs66dvr.js → profile-errors-COcBx7w5.js} +1 -1
- package/dist/client/assets/{progress-BKspNOdx.js → progress-77FCPL2y.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-D_Vi6U-2.js → quadrantDiagram-D57K4MC3-BqPJVmMS.js} +1 -1
- package/dist/client/assets/{query-error-state-B9bR1eRh.js → query-error-state-5236P3z0.js} +1 -1
- package/dist/client/assets/{radio-CmZ30mVT.js → radio-C8xmfoqO.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-C6PgeQHt.js → railroadDiagram-Y72NRBL7-B8U11nT6.js} +1 -1
- package/dist/client/assets/{registry-CSe_ncC2.js → registry-BzXBOE9h.js} +13 -13
- package/dist/client/assets/registry-sfhDu9q2.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-CdZnmG6_.js → relay-trace-schemas-B80E4EUn.js} +1 -1
- package/dist/client/assets/{repeat-DmCgFtjt.js → repeat-CHmB_vD7.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-CnNYn7qe.js → requirementDiagram-EQYSW5RA-CzJ1gzTh.js} +1 -1
- package/dist/client/assets/{room-files-source-BbEFTxX0.js → room-files-source-B0gc97Ri.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-k0vIMOao.js → rotate-ccw-clock-CCU6SVnv.js} +1 -1
- package/dist/client/assets/{rotate-cw-OJ7jzj3C.js → rotate-cw-B8WQa8O-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-0KFthF8u.js → sankeyDiagram-SY24JHO5-D4vQwyve.js} +1 -1
- package/dist/client/assets/{scroll-area-vYE-OvYe.js → scroll-area-FwZwM74Q.js} +1 -1
- package/dist/client/assets/{search-x-mbqB9SFV.js → search-x-Q18Wm-C5.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BD3TzBXD.js → sequenceDiagram-BLEHNHQU-BVnIsPQe.js} +1 -1
- package/dist/client/assets/{shield-x-By16ILlp.js → shield-x-ijIbRppV.js} +1 -1
- package/dist/client/assets/{signed-in-DNUF_3Fa.js → signed-in-DEOMBWVX.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-BIJvrYdE.js → sizeCapture-INFHLROL-DGb1rAJL.js} +1 -1
- package/dist/client/assets/{soul-file-C81l7z8x.js → soul-file-CXgYs25S.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-CtigYKfx.js → stateDiagram-v2-A6IESKWZ-DeX3IKTm.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-CPMK7lCN.js → swimlanes-B3ENRKFQ-DN5ljYhG.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +8 -0
- package/dist/client/assets/{table-jPIEjPov.js → table-D9ww_3Ij.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-CtihfrW4.js → timeline-definition-JXYKGLGB-DpRthC3r.js} +1 -1
- package/dist/client/assets/{trust-posture-olfknSP7.js → trust-posture-Dn2ciEE0.js} +1 -1
- package/dist/client/assets/{unplug-Bm7nHhBA.js → unplug-BZ8zSvfB.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DogkKIUJ.js → unverified-catalog-notice-CGy05tAO.js} +1 -1
- package/dist/client/assets/{use-bindings-C0bBY5jd.js → use-bindings-BLAWQRpe.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-V6vxLUUc.js → use-composer-prefs-ICOpilWK.js} +1 -1
- package/dist/client/assets/{use-connector-management-DLOJoz45.js → use-connector-management-DEMGZy9N.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-ODQAWdEP.js → use-deep-link-scroll-DxGYrks3.js} +1 -1
- package/dist/client/assets/{use-delete-binding-BL0OOgo0.js → use-delete-binding-Bnv3J5Fu.js} +1 -1
- package/dist/client/assets/{use-dev-links-DmzL_awM.js → use-dev-links-BOcktLiE.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-7DpsxnS_.js → use-direct-message-panel-D38tSozW.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-D7yXhN3U.js → use-external-adapter-catalog-9qiNBqpc.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-CnShEfSU.js → use-full-activity-feed-CtQquOBW.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +1 -0
- package/dist/client/assets/{use-local-browser-Ba-XDxE0.js → use-local-browser-B1huJhdg.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-DhUhzu7Y.js → use-mesh-topology-BTYAy6zc.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Vm8D40hS.js → use-mounted-ref-CaPc6Prv.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-Cjb26GhZ.js → use-notification-prefs-u76DPoP0.js} +1 -1
- package/dist/client/assets/use-pending-read-D0y6i7G9.js +1 -0
- package/dist/client/assets/{use-personality-commit-D1SSZI1q.js → use-personality-commit-C3h8upDo.js} +1 -1
- package/dist/client/assets/{use-promo-activation-D1DYLKS8.js → use-promo-activation-5HG08FlB.js} +1 -1
- package/dist/client/assets/{use-promo-dismissals-ByGIekeo.js → use-promo-dismissals-CO7-qhEl.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-CDqh0_k8.js → use-pulse-freshness-D07Mv-Sa.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-ysyr_uyD.js → use-room-follow-claim-DRQBuAIe.js} +1 -1
- package/dist/client/assets/{use-room-sessions-_zhdKcKj.js → use-room-sessions-Bzk7rM40.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-CoJ0aHCJ.js → use-roving-tab-list-CcznVldj.js} +1 -1
- package/dist/client/assets/use-session-canvas-CpgE7tFb.js +27 -0
- package/dist/client/assets/{use-status-budget-yYQ7GR9y.js → use-status-budget-Xn2sIeM1.js} +2 -2
- package/dist/client/assets/{use-transform-B5MsPCLG.js → use-transform-ByJGn3hq.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-CjOWILFh.js → use-unclaimed-chats-C-z5fstJ.js} +1 -1
- package/dist/client/assets/use-update-config-L5NCTj3t.js +1 -0
- package/dist/client/assets/{useMutationState-4dFTMb_f.js → useMutationState-BF1EFtIZ.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DD4D-089.js → usecaseDiagram-WPOLBNNX-efVKbRIX.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-DjVDYX3w.js → vennDiagram-Q3Y3IDCW-Bravmwce.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-bupKx7P8.js → wardleyDiagram-IVAIDKWA-fR77zByv.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-DoCyS7MC.js → xychartDiagram-4URNHDU4-BphORSLh.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +18120 -16039
- package/dist/server/index.js.map +2 -2
- package/package.json +7 -6
- package/dist/client/assets/ChannelComposer-Bfi3hAgy.js +0 -44
- package/dist/client/assets/HandlePage-rhsJ5LBy.js +0 -1
- package/dist/client/assets/NamePage-BvRDf9r1.js +0 -1
- package/dist/client/assets/PhotoPage-CDCmTcmR.js +0 -1
- package/dist/client/assets/UnreadDivider-qMUA2rFP.js +0 -1
- package/dist/client/assets/WorkView-ynqZVa-o.js +0 -51
- package/dist/client/assets/_shell.marketplace-DIC-vQZq.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-Dk7fKhJ6.js +0 -1
- package/dist/client/assets/_shell.session-BAq7SnHK.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-B9CWzm8d.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B9CWzm8d.js +0 -1
- package/dist/client/assets/channel-ByM_gaT3.js +0 -1
- package/dist/client/assets/index-BUTqV5Hw.js +0 -1
- package/dist/client/assets/index-BuLpfIsj.js +0 -1
- package/dist/client/assets/registry-D10b3VBA.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C24DKoiY.js +0 -8
- package/dist/client/assets/use-is-below-desktop-C1nTBNsP.js +0 -1
- package/dist/client/assets/use-pending-read-r81zBhY9.js +0 -1
- package/dist/client/assets/use-session-canvas-IKy8PO1l.js +0 -27
- package/dist/client/assets/use-update-config-B49bVEOw.js +0 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-DruVZcDU.js","assets/index-OQuvRZTD.js","assets/index-Dry_agqN.css","assets/index-QSXJR98z.js","assets/index-1QfQImuJ.js","assets/BlintzCanvas-DCXOV_yN.css","assets/CanvasFileContent-BThy5fjD.js","assets/rotate-cw-B8WQa8O-.js","assets/query-keys-DeYqUDia.js","assets/index.esm-CAeUe7uQ.js","assets/WidgetErrorCard-BlqaIsPK.js","assets/index-CoKNU2F9.js","assets/card-DUmTNXJJ.js","assets/progress-77FCPL2y.js","assets/markdown-content-Cjhsscbn.js","assets/table-D9ww_3Ij.js","assets/package-sPggO7Dr.js","assets/heart-BavUIV45.js","assets/git-branch-B8JNwQ6q.js","assets/file-text-Ds9edaTZ.js","assets/file-D80JE_L0.js","assets/McpAppFrame-D15nxVaI.js","assets/more-details-CRLU2HN4.js","assets/CanvasModel3dContent-BbgR73jh.js","assets/CanvasCsvContent-CtLpZnTs.js","assets/index-n_pnc-CO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var on=Object.defineProperty;var er=e=>{throw TypeError(e)};var an=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var $=(e,t,r)=>an(e,typeof t!="symbol"?t+"":t,r),wt=(e,t,r)=>t.has(e)||er("Cannot "+r);var Pe=(e,t,r)=>(wt(e,t,"read from private field"),r?r.call(e):t.get(e)),Be=(e,t,r)=>t.has(e)?er("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),be=(e,t,r,n)=>(wt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),ye=(e,t,r)=>(wt(e,t,"access private method"),r);import{O as gt,a1 as ae,a2 as cn,a3 as un,r as p,lb as vt,fH as K,fS as te,fL as Et,fO as $e,fI as le,oe as ln,of as dn,og as fn,aX as _e,ck as Lt,dV as hn,aW as Y,oh as pn,fG as tr,oi as Rr,oj as ct,ok as mn,o2 as Qe,ol as Pt,nW as gn,fK as ut,h9 as Q,om as vn,on as bn,j as h,oo as yn,ke as wn,i9 as xn,ia as kn,er as Cn,G as Bt,I as jn,fA as Rn,cr as On,op as En,jv as Sn,jz as _n,dD as Dn,oq as In,or as An,os as Nn,B as it,J as Or,gh as Er,C as Tn,aL as Mn,ot as rr}from"./index-OQuvRZTD.js";import{R as Fn}from"./rotate-cw-B8WQa8O-.js";import{d as St}from"./query-keys-DeYqUDia.js";import{T as zn,a as qn,u as Ln}from"./index.esm-CAeUe7uQ.js";import{v as Pn,a as Bn,W as Un}from"./WidgetErrorCard-BlqaIsPK.js";import{M as Wn}from"./McpAppFrame-D15nxVaI.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 Sr={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"}]]};Sr.node;const Jo=gt(Sr);/**
|
|
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 _r={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"}]]};_r.node;const $n=gt(_r);/**
|
|
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 Dr={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"}]]};Dr.node;const Hn=gt(Dr);/**
|
|
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 Ir={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"}]]};Ir.node;const Gn=gt(Ir);function Vn(e,t){const r=ae();return cn({queryKey:St.index(e??""),queryFn:()=>r.getDocIndex(e),enabled:t&&e!==null,refetchOnWindowFocus:!0})}function Jn(){const e=un();return p.useCallback(t=>{e.invalidateQueries({queryKey:t?St.index(t):St.all})},[e])}const Ie={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},lt=le().min(1).max(128),Fe={bridgeGeneration:lt},Xn=K({...Fe,__dorkosDevtools:te("capture-result"),requestId:lt,dataUrl:le().max(9e5).optional(),error:le().max(2048).optional()}),Zn=ln.omit({hostOutcome:!0}).extend({...Fe,__dorkosDevtools:te("act-result"),dataUrl:le().max(9e5).optional()}),Yn=dn.extend({status:$e().int().min(0).max(599),durationMs:$e().min(0),responseSize:$e().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:$e().min(0)}),Qn=fn.refine(e=>e.timestamp>=0),Kn=vt("__dorkosDevtools",[K({__dorkosDevtools:te("hello"),pageInstanceId:lt,bridgeVersion:te(2)}),K({...Fe,__dorkosDevtools:te("ready"),pageInstanceId:lt}),K({...Fe,__dorkosDevtools:te("navigated")}),K({...Fe,__dorkosDevtools:te("resource-error")}),K({...Fe,__dorkosDevtools:te("batch"),seq:$e().int().min(0).max(Number.MAX_SAFE_INTEGER),console:Et(Qn).max(500),network:Et(Yn).max(200)}),Xn,Zn]);function es(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 u=c.charCodeAt(o);if(u>=55296&&u<=56319&&o+1<c.length&&c.charCodeAt(o+1)>=56320&&c.charCodeAt(o+1)<=57343){if(!s(2))return!1;o++;continue}const d=u===34||u===92||[8,9,10,12,13].includes(u)?2:u<32||u>=55296&&u<=57343?6:1;if(!s(d))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 u=Object.getPrototypeOf(c);if(u!==Object.prototype&&u!==null&&u!==Array.prototype)return!1;const d=Array.isArray(c);if(d&&c.length>2048||Object.getOwnPropertySymbols(c).length||!s(2))return!1;t.add(c);let f=0;for(const l in c){if(!Object.prototype.hasOwnProperty.call(c,l))continue;if(++f>2048||d&&(!/^\d+$/.test(l)||Number(l)>=c.length))return!1;const g=Object.getOwnPropertyDescriptor(c,l);if(["__proto__","constructor","prototype"].includes(l)||!("value"in g)||!g.enumerable||f>1&&!s(1)||!d&&(!i(l)||!s(1))||!a(g.value,o+1))return!1}return t.delete(c),!d||f===c.length}try{return a(e,0)}catch{return!1}}function ts(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||!es(i)))return null}}const r=Kn.safeParse(e);if(!r.success)return null;const n=r.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!Ar(n.dataUrl)?null:n}catch{return null}}function Ar(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 xt=null;async function nr(){return xt===null&&(xt=(await _e(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),xt}let kt=null;async function rs(){if(kt===null){const e=await _e(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);kt={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return kt}async function sr(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 rs();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 u=s(o,256),d=n();for(let l=0;l<e.length;l++){r();const g=e[l];if(d.writeFrame(i(g.data,u),g.width,g.height,{...l===0?{palette:u,repeat:0}:{},delay:t.frameMs}),d.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.`}}d.finish();const f=d.bytes();return f.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:f}}async function ns(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(!Ar(o)){e[c]="";continue}const u=await is(o);e[c]="";try{if(r(),!u)continue;if(!i){const l=Math.min(1,Math.min(800,t)/Math.max(u.width,u.height,1));i=Math.max(1,Math.round(u.width*l)),a=Math.max(1,Math.round(u.height*l)),s.width=i,s.height=a}const d=s.getContext("2d",{willReadFrequently:!0});if(!d)return[];d.fillStyle="#ffffff",d.fillRect(0,0,i,a);const f=Math.min(i/u.width,a/u.height);d.drawImage(u,0,0,Math.round(u.width*f),Math.round(u.height*f)),r(),n.push({data:d.getImageData(0,0,i,a).data,width:i,height:a})}finally{u&&(u.src="")}}return n}catch(c){throw n.length=0,c}finally{e.length=0,s.width=0,s.height=0}}function ss(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 is(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 ir(e,t,r){const n=r.slice().buffer;return{name:e,type:t,size:r.byteLength,arrayBuffer:async()=>n}}function os(e){const t=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(t,r=>r.charCodeAt(0))}const as=8e3;function cs(e){const t=ae(),r=p.useRef(t);p.useLayoutEffect(()=>{r.current=t});const[n]=Lt(),[s,i]=p.useState(0),a=p.useRef(null),c=p.useRef(new Map),o=p.useRef(null),u=p.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),d=p.useRef(null),f=p.useRef(-1),l=p.useRef(null),g=p.useRef(null),b=p.useRef(!1),m=p.useRef(-1/0),v=p.useRef(!1),A=p.useRef(null),N=p.useRef(0),R=p.useRef(null),z=p.useRef(null),L=p.useRef(!1),B=p.useRef(null),H=p.useRef({...e,sessionId:n}),x=p.useRef(Promise.resolve()),I=p.useRef(()=>{}),M=p.useRef({initialize:k,retire:O,consume:se,register:U,eligiblePending:X,refuseRequest:C,live:w,captureFrame:yt,valid:fe,reportRecordingStart:je,cancelReservation:Re,finish:Gt});p.useLayoutEffect(()=>{M.current={initialize:k,retire:O,consume:se,register:U,eligiblePending:X,refuseRequest:C,live:w,captureFrame:yt,valid:fe,reportRecordingStart:je,cancelReservation:Re,finish:Gt}});const W=S=>B.current===S||Y.getState().openDocuments.some(y=>y.id===S&&y.openedHere);function j(S,{active:y,activation:_=!1,keepalive:E=!1,reset:F=!1}){if(!S.sessionId)return;const re={documentId:S.documentId,logicalUrl:S.logicalUrl,bridgeGeneration:S.generation,seq:Math.max(0,f.current),console:[],network:[],active:y,activation:_,instrumented:S.ready&&!S.retired,...F?{reset:!0}:{}};x.current=x.current.then(()=>r.current.ingestDevtoolsCapture(S.sessionId,re,E?{keepalive:!0}:void 0)).catch(()=>{})}function O(){var _;const S=a.current;S&&(S.retired=!0),a.current=null,d.current!==null&&clearTimeout(d.current),d.current=null,o.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0},f.current=-1,m.current=-1/0,v.current=!1;for(const[E,F]of c.current)F.life.sessionId&&F.deadline>Date.now()&&F.kind!=="frame"&&C(E,F.kind,F.life,"The frame changed while this request was pending."),clearTimeout(F.timer),(_=F.resolve)==null||_.call(F,null);c.current.clear(),S&&j(S,{active:!1});const y=A.current;y&&(clearTimeout(y.reservationTimer),y.cancelled=!0,y.abort.abort(),y.frames.length=0,y.finishing||(y.drawn.length=0,A.current=null)),R.current!==null&&cancelAnimationFrame(R.current),R.current=null,N.current=0,i(0)}function k({loadActivation:S,reset:y=!1}={}){var J,oe;const _=H.current,E=(J=_.iframeRef.current)==null?void 0:J.contentWindow;if(b.current||!E||!_.bridgeEligibility||!_.resolvedSource)return;const F={generation:crypto.randomUUID(),frame:E,sessionId:_.sessionId,documentId:_.documentId,logicalUrl:_.logicalUrl,source:_.resolvedSource,origin:_.bridgeEligibility==="served-document"?"null":_.previewOrigin,ready:!1,activation:!1,retired:!1};a.current=F;const re=S??(L.current||z.current!==F.documentId&&W(F.documentId));F.activation=re,L.current=!1,z.current=F.documentId,j(F,{active:!0,activation:re,reset:y}),((oe=l.current)==null?void 0:oe.frame)===E&&l.current.source===_.resolvedSource&&l.current.reload===_.reloadNonce&&l.current.documentId===_.documentId&&l.current.logicalUrl===_.logicalUrl&&E.postMessage({__dorkosDevtools:"init",bridgeGeneration:F.generation},"*")}p.useLayoutEffect(()=>{var E;H.current={...e,sessionId:n};const S={frame:(E=e.iframeRef.current)==null?void 0:E.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},y=g.current;if(!y||Object.keys(S).some(F=>S[F]!==y[F])){const F=!y||y.frame!==S.frame||y.documentId!==S.documentId||y.logicalUrl!==S.logicalUrl||y.source!==S.source||y.reload!==S.reload;g.current=S,b.current=!1,O(),k({reset:F})}});const T=p.useCallback(()=>{var re,J,oe;const{initialize:S,retire:y}=M.current,_=H.current,E=(re=_.iframeRef.current)==null?void 0:re.contentWindow,F=(J=a.current)!=null&&J.ready?!1:(oe=a.current)==null?void 0:oe.activation;E&&_.resolvedSource&&(l.current={frame:E,source:_.resolvedSource,reload:_.reloadNonce,documentId:_.documentId,logicalUrl:_.logicalUrl}),b.current=!1,y(),S({loadActivation:F,reset:!0})},[]),q=p.useCallback(()=>{const S=a.current;L.current=!0,B.current=H.current.documentId,S&&I.current({active:!0,activation:!0})},[]);p.useLayoutEffect(()=>{I.current=S=>{a.current&&j(a.current,S)}});function w(S){return a.current===S&&!S.retired}function C(S,y,_,E){if(!_.sessionId)return;const F={requestId:S,bridgeGeneration:_.generation,documentId:_.documentId,hostOutcome:"host",error:E};y==="action"?r.current.postDevtoolsAction(_.sessionId,{...F,ok:!1}).catch(()=>{}):r.current.ingestDevtoolsCapture(_.sessionId,{...F,logicalUrl:_.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],screenshot:{requestId:S,error:E}}).catch(()=>{})}function U(S,y,_,{capture:E=!1,resolve:F,timeoutMs:re=8e3}={}){if(c.current.size>=Ie.pending||c.current.has(S))return null;const J=setTimeout(()=>G(S,oe),re),oe={kind:y,life:_,capture:E,deadline:Date.now()+re,timer:J,resolve:F};return c.current.set(S,oe),oe}function G(S,y){var _;c.current.get(S)===y&&(c.current.delete(S),clearTimeout(y.timer),(_=y.resolve)==null||_.call(y,null))}function X(S,y,_){return c.current.get(S)!==y||y.life!==_||!w(_)?!1:Date.now()>=y.deadline?(G(S,y),!1):!0}function se(S,y,_){const E=c.current.get(S);return!E||E.life!==_||E.kind!==y&&!(y==="capture"&&E.kind==="frame")||!X(S,E,_)?null:(c.current.delete(S),clearTimeout(E.timer),E)}p.useEffect(()=>{const{initialize:S,retire:y,consume:_}=M.current;function E(){d.current=null;const he=o.current;o.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0};const D=a.current;he&&D&&!D.retired&&D.sessionId&&he.bridgeGeneration===D.generation&&r.current.ingestDevtoolsCapture(D.sessionId,he)}function F(he){var Jt,Xt,Zt,Yt;const D=a.current;if(!D||D.retired||he.source!==D.frame||he.origin!==D.origin||((Jt=l.current)==null?void 0:Jt.frame)!==D.frame||l.current.source!==D.source||l.current.reload!==H.current.reloadNonce||l.current.documentId!==D.documentId||l.current.logicalUrl!==D.logicalUrl)return;const P=he.data;if(!P||typeof P!="object"||typeof P.__dorkosDevtools!="string"||!["hello","ready","navigated","resource-error","batch","capture-result","act-result"].includes(P.__dorkosDevtools)||P.__dorkosDevtools!=="hello"&&P.bridgeGeneration!==D.generation)return;const ce=P.__dorkosDevtools==="batch";if(ce){if(!D.ready||!D.sessionId||P.bridgeGeneration!==D.generation||!Number.isSafeInteger(P.seq)||P.seq<0||P.seq<=f.current)return;const Z=Date.now();if(Z-m.current<Ie.batchMs){o.current?o.current.dropped=!0:v.current=!0;return}m.current=Z}const V=ts(P);if(!V){ce&&(v.current=!0);return}if(V.__dorkosDevtools==="hello"){D.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:D.generation},"*");return}if(V.bridgeGeneration!==D.generation)return;if(V.__dorkosDevtools==="ready"){D.ready||(D.ready=!0,D.activation=!1,j(D,{active:!0}));return}if(!D.ready)return;if(V.__dorkosDevtools==="navigated"){b.current=!0,y();return}if(V.__dorkosDevtools==="resource-error"){N.current=Math.min(Ie.resourceErrors,N.current+1),R.current===null&&(R.current=requestAnimationFrame(()=>{R.current=null,w(D)&&i(N.current)}));return}if(!D.sessionId)return;if(V.__dorkosDevtools==="batch"){if(V.seq<=f.current)return;f.current=V.seq;const Z=o.current??{documentId:D.documentId,logicalUrl:D.logicalUrl,bridgeGeneration:D.generation,seq:V.seq,console:[],network:[]};Z.seq=V.seq,v.current&&(Z.dropped=!0),v.current=!1;const Oe=u.current,Qt=new TextEncoder;if(o.current||(Oe.overheadBytes=Qt.encode(JSON.stringify({...Z,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),Oe.overheadBytes>Ie.queueBytes){o.current=null,u.current={console:[],network:[],entryBytes:0,overheadBytes:0},v.current=!0;return}for(const[Le,nn]of[["console",V.console],["network",V.network]])for(const sn of nn){const Kt=Qt.encode(JSON.stringify(sn)).length;Oe[Le].push(Kt),Oe.entryBytes+=Kt}Z.console.push(...V.console),Z.network.push(...V.network);const rn=()=>Oe.overheadBytes+Oe.entryBytes+Math.max(0,Z.console.length-1)+Math.max(0,Z.network.length-1);for(;Z.console.length>500||Z.network.length>200||rn()>Ie.queueBytes;){Z.dropped=!0;const Le=(((Xt=Z.console[0])==null?void 0:Xt.timestamp)??1/0)<=(((Zt=Z.network[0])==null?void 0:Zt.timestamp)??1/0)?"console":"network";if(!Z[Le].length)break;Z[Le].shift(),Oe.entryBytes-=Oe[Le].shift()}o.current=Z,d.current===null&&(d.current=setTimeout(E,Ie.batchMs));return}if(V.__dorkosDevtools==="capture-result"){const Z=_(V.requestId,"capture",D);if(!Z)return;if(Z.kind==="frame"){(Yt=Z.resolve)==null||Yt.call(Z,V.dataUrl??null);return}r.current.ingestDevtoolsCapture(D.sessionId,{bridgeGeneration:D.generation,documentId:D.documentId,logicalUrl:D.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:V.requestId,dataUrl:V.dataUrl,error:V.error}});return}const qe=_(V.requestId,"action",D);if(!qe)return;const De=A.current,Vt=qe.capture&&V.dataUrl!==void 0&&De!==null&&De.life===D&&De.activated&&!De.finishing&&!De.cancelled&&De.frames.length<61;Vt&&De.frames.push(V.dataUrl);const{__dorkosDevtools:Lo,dataUrl:Po,...tn}=V;r.current.postDevtoolsAction(D.sessionId,{...tn,hostOutcome:"page-reported",documentId:D.documentId,captured:Vt||void 0})}window.addEventListener("message",F);const re=setInterval(()=>I.current({active:!0}),15e3),J=()=>{a.current||S(),I.current({active:!0,activation:!0})},oe=()=>{I.current({active:!1,keepalive:!0}),y()},ue=()=>{document.visibilityState==="visible"&&J()};return window.addEventListener("focus",J),window.addEventListener("pagehide",oe),window.addEventListener("pageshow",J),document.addEventListener("visibilitychange",ue),()=>{window.removeEventListener("message",F),clearInterval(re),window.removeEventListener("focus",J),window.removeEventListener("pagehide",oe),window.removeEventListener("pageshow",J),document.removeEventListener("visibilitychange",ue),y()}},[]),p.useEffect(()=>hn.subscribeSessionEvent((S,y)=>{if(y.type!=="devtools_capture_request"&&y.type!=="devtools_action_request"&&y.type!=="devtools_recording_request")return;const{register:_,eligiblePending:E,refuseRequest:F,captureFrame:re,valid:J,finish:oe,reportRecordingStart:ue,cancelReservation:he}=M.current,D=a.current;if(!(!(D!=null&&D.ready)||!D.sessionId||D.retired||y.targetClientId!==r.current.clientId||y.documentId!==D.documentId||y.bridgeGeneration!==D.generation)){if(y.type==="devtools_capture_request"||y.type==="devtools_action_request"){const P=y.type==="devtools_action_request",ce=_(y.requestId,P?"action":"capture",D,{capture:P&&!!y.capture,timeoutMs:P&&y.command.action==="wait_for"?Math.min(1e4,y.command.timeoutMs)+2e3:8e3});if(!ce){c.current.has(y.requestId)||F(y.requestId,P?"action":"capture",D,"Too many browser requests are waiting. Try again when one finishes.");return}const V=qe=>{E(y.requestId,ce,D)&&D.frame.postMessage(P?{__dorkosDevtools:"act-request",bridgeGeneration:D.generation,requestId:y.requestId,documentId:D.documentId,command:y.command,...y.capture?{capture:!0,lib:qe}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:D.generation,requestId:y.requestId,lib:qe},"*")};!P||y.capture?nr().then(V,()=>V()):V()}if(y.type==="devtools_recording_request"){if(y.action==="cancel-start"){he(y.recordingId,y.requestId,D);return}if(y.action==="confirm-start"){const P=A.current;if(!P||P.id!==y.recordingId||P.startRequestId!==y.requestId||P.life!==D||P.finishing||!J(P))return;if(!P.activated){if(performance.now()>=P.reservationDeadline){he(P.id,P.startRequestId,D),ue(y,D,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(P.reservationTimer),P.activated=!0,P.startedAt=Date.now(),re(D).then(ce=>{ce&&J(P)&&P.frames.push(ce)})}ue(y,D,{phase:"started",ok:!0});return}if(y.action==="start"){const P=y.reservationTimeoutMs;if(!Number.isSafeInteger(P)||!P||P<1||P>as){ue(y,D,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(A.current){ue(y,D,{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 ce={id:y.recordingId,startRequestId:y.requestId,activated:!1,reservationDeadline:performance.now()+P,life:D,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};A.current=ce,ce.reservationTimer=setTimeout(()=>{A.current===ce&&!ce.activated&&he(ce.id,ce.startRequestId,D)},P),ue(y,D,{phase:"reserved",ok:!0})}else oe(y.requestId,y.recordingId,D)}}}),[]);function je(S,y,_){!w(y)||!y.sessionId||r.current.ingestDevtoolsCapture(y.sessionId,{hostOutcome:"host",documentId:y.documentId,bridgeGeneration:y.generation,seq:0,console:[],network:[],recordingStart:{..._,requestId:S.requestId,recordingId:S.recordingId}}).catch(()=>{})}function Re(S,y,_){var F;const E=A.current;if(!(!E||E.id!==S||E.startRequestId!==y||E.life!==_||E.finishing)){clearTimeout(E.reservationTimer),E.cancelled=!0,E.abort.abort(),E.frames.length=0,E.drawn.length=0;for(const[re,J]of c.current)J.life===_&&J.kind==="frame"&&(clearTimeout(J.timer),(F=J.resolve)==null||F.call(J,null),c.current.delete(re));A.current=null}}function fe(S){return A.current===S&&!S.cancelled&&w(S.life)}function yt(S){const y=`frame-${crypto.randomUUID()}`;return new Promise(_=>{const E=U(y,"frame",S,{resolve:_});if(!E){_(null);return}nr().then(F=>{X(y,E,S)&&S.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:S.generation,requestId:y,lib:F},"*")},()=>{G(y,E)})})}async function Gt(S,y,_){const E=A.current;if(!E||!E.activated||E.id!==y||E.life!==_){w(_)&&await r.current.uploadDevtoolsRecording(_.sessionId,{requestId:S,bridgeGeneration:_.generation,documentId:_.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(E.finishing)return;E.finishing=!0;const F=()=>{if(!fe(E))throw new Error("retired")},re={requestId:S,bridgeGeneration:_.generation,documentId:_.documentId};try{const J=await yt(_);F(),J&&E.frames.length<Ie.frames&&E.frames.push(J);const oe=E.frames.length?os(E.frames[E.frames.length-1]):new Uint8Array;E.drawn=await ns(E.frames,800,F),F();let ue=await sr(E.drawn,{frameMs:500,maxBytes:8*1024*1024},F);if(F(),!ue.ok&&E.drawn.length&&(ss(E.drawn,F),ue=await sr(E.drawn,{frameMs:500,maxBytes:8*1024*1024},F),F()),!ue.ok){await r.current.uploadDevtoolsRecording(_.sessionId,{...re,hostOutcome:"host",error:ue.error},{signal:E.abort.signal}),F();return}F(),await r.current.uploadDevtoolsRecording(_.sessionId,{...re,frames:E.drawn.length,durationMs:Date.now()-E.startedAt,recording:ir(`${y}.gif`,"image/gif",ue.bytes),keyframe:ir(`${y}.png`,"image/png",oe)},{signal:E.abort.signal}),F()}catch{fe(E)&&await r.current.uploadDevtoolsRecording(_.sessionId,{...re,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:E.abort.signal}).catch(()=>{})}finally{E.frames.length=0,E.drawn.length=0,A.current===E&&(A.current=null)}}return{resourceErrorCount:s,notePersonNavigated:q,noteFrameLoaded:T}}const ze=le().min(1).max(128),me={protocol:te("dorkos-doc"),v:te(1),nonce:ze,requestToken:ze,loadToken:ct,generation:Rr.shape.generation},us="dorkos-boot",or=vt("kind",[K({...me,kind:te("challenge")}).strict(),K({...me,kind:te("ack"),boot:ze.optional()}).strict(),K({...me,kind:te("connect")}).strict()]),ls=K({type:te("canvas_event"),docSeq:ct,event:mn}).strict(),ds=vt("kind",[K({...me,kind:te("emit"),requestId:ze,event:Qe}).strict(),K({...me,kind:te("retire")}).strict()]),fs=vt("kind",[K({...me,kind:te("receipt"),requestId:ze,receipt:Pt}).strict(),K({...me,kind:te("refused"),requestId:ze,outcome:tr(["cancelled","unconfirmed","refused"])}).strict(),K({...me,kind:te("state"),state:gn,stateRev:ct,docSeq:ct,reset:ut()}).strict(),K({...me,kind:te("event"),frame:ls}).strict(),K({...me,kind:te("status"),status:tr(["connecting","ready","offline","revoked"]),unconfirmed:ut()}).strict()]);function Je(e,t){try{if(pn(t,1048576)!==void 0)return null;const r=e.safeParse(t);return r.success?r.data:null}catch{return null}}var ve,_t,He;class dt{constructor(){Be(this,ve);$(this,"current",null);$(this,"token",0);$(this,"retiring",!1);$(this,"subscribers",new Set);$(this,"resources",new Map);$(this,"doc",null);$(this,"docClaims",new WeakMap);$(this,"retiringDoc",!1);$(this,"docResources",new Map);$(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 ye(this,ve,_t).call(this,t,r,n)}acquireDoc(t,r,n){const s=ye(this,ve,_t).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)&&ye(this,ve,He).call(this)))}})}disableDoc(){ye(this,ve,He).call(this)}retireDoc(t){this.doc===t&&this.bindings.has(t)&&ye(this,ve,He).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}}ve=new WeakSet,_t=function(t,r,n){const s=this.doc,i=this.token,a=Je(Rr,r);if(!a)throw this.disableDoc(),new Error("Established server Doc birth required.");const c=a,o=t.exactOrigin,u=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||!u||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(Q(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 d=Object.freeze({observation:t,incarnation:Object.freeze(c),scope:n});try{return this.doc=d,this.bindings.add(d),d}catch(f){throw this.doc===d&&ye(this,ve,He).call(this),f}},He=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 hs(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,u=Object.freeze({expectedGeneration:t.incarnation.generation}),d=()=>{try{return e.isCurrent(t)?i(n,s)===!0&&e.isCurrent(t):!1}catch{return!1}};if(!d())throw new Error("Doc binding unavailable.");const f=()=>{if(!d())throw new Error("Doc binding retired.")};return Object.freeze({binding:t,current:d,captureOriginal:l=>{f();const g=l.id;f();const b=l.bytes;f();const m=Reflect.apply(o,r,[Object.freeze({id:g,bytes:b})]);if(f(),!m)return null;const v=m.id;f();const A=m.bytes;f();const N=m.submit;f();const R=m.inspect;return f(),v!==g||A!==b||typeof N!="function"||typeof R!="function"?null:Object.freeze({id:g,bytes:b,submit:async z=>{f(),z.throwIfAborted();const L=await Reflect.apply(N,m,[z]);return f(),z.throwIfAborted(),L},inspect:async z=>{f(),z.throwIfAborted();const L=await Reflect.apply(R,m,[z]);return f(),z.throwIfAborted(),L}})},retireObservation:()=>{d()&&e.retire()},onRetire:l=>e.ownDoc(t,l),submit:(l,g)=>(f(),g.throwIfAborted(),a(l,u,g)),inspect:(l,g)=>(f(),g.throwIfAborted(),c(l,u,g))})}function ar(e,t){const r=Je(Pt,t);return r&&r.receipt.id===e&&r.receipt.docSeq>0?r:null}class ps{constructor(t,r){$(this,"entries",new Map);$(this,"bytes",0);$(this,"running",!1);$(this,"retired",!1);$(this,"abort",new AbortController);$(this,"timer");$(this,"wake",null);$(this,"detach");if(this.port=t,this.scheduler=r,!t.current()||!r||["schedule","cancel","random"].some(n=>typeof r[n]!="function"))throw new Error("Current bound Doc port and scheduler required.");this.detach=t.onRetire(()=>this.retire())}getStatus(){return Object.freeze({pending:[...this.entries.values()].filter(t=>!t.settled).length,bytes:this.bytes,unconfirmed:[...this.entries.values()].filter(t=>t.unconfirmed).length,retired:this.retired})}emit(t){if(!this.live())return Promise.resolve({kind:"cancelled"});const r=Qe.safeParse(t);if(!r.success)return Promise.resolve({kind:"refused"});if(!this.live())return Promise.resolve({kind:"cancelled"});const n=JSON.stringify(r.data),s=r.data.id,i=this.entries.get(s);if(i)return i.bytes===n?i.promise:Promise.resolve({kind:"refused"});const a=new TextEncoder().encode(JSON.stringify({bytes:n,id:s,birth:this.port.binding.incarnation,scope:this.port.binding.scope,loadToken:this.port.binding.observation.token,publisherEpoch:this.port.binding.observation.publisherEpoch,sent:!1,settled:!1,unconfirmed:!1,attempts:8,retryAfterMs:3e4})).byteLength+1024;for(const u of this.entries.values()){if(this.entries.size<100&&this.bytes+a<=1048576)break;u.settled&&!u.unconfirmed&&(this.entries.delete(u.id),this.bytes-=u.weight)}if(this.entries.size>=100||this.bytes+a>1048576)return Promise.resolve({kind:"refused"});let c;const o=new Promise(u=>{c=u});return this.entries.set(s,{id:s,bytes:n,weight:a,sent:!1,settled:!1,unconfirmed:!1,resolve:c,promise:o}),this.bytes+=a,this.pump(),o}retire(){var t,r;if(!this.retired){if(this.retired=!0,this.abort.abort(),this.timer!==void 0)try{this.scheduler.cancel(this.timer)}catch{}this.timer=void 0,(t=this.wake)==null||t.call(this),this.wake=null;for(const n of this.entries.values())this.settle(n,{kind:n.sent?"unconfirmed":"cancelled"});this.entries.clear(),this.bytes=0,(r=this.detach)==null||r.call(this)}}settle(t,r){t.settled||(t.settled=!0,t.unconfirmed=r.kind==="unconfirmed",t.resolve(r),r.kind!=="unconfirmed"&&r.kind!=="accepted"&&(this.entries.delete(t.id),this.bytes-=t.weight))}live(){return this.retired||this.abort.signal.aborted?!1:this.port.current()&&!this.retired&&!this.abort.signal.aborted}cancel(t){try{t!==void 0&&this.scheduler.cancel(t)}catch{}}async wait(t){if(!this.live()){this.retire();return}await new Promise(r=>{let n=!1,s;const i=()=>{n||(n=!0,this.wake===i&&(this.wake=null),r())};this.wake=i;try{if(s=this.scheduler.schedule(()=>{this.timer===s&&(this.timer=void 0),i()},t),!this.live()||n){this.cancel(s),i(),this.live()||this.retire();return}this.timer=s}catch{i(),this.retire()}})}async call(t,r){if(!this.live())return this.retire(),r;const n=new AbortController;let s=()=>{},i;const a=()=>{n.abort(),this.cancel(i),s(r)};this.abort.signal.addEventListener("abort",a,{once:!0});try{return await new Promise(c=>{let o=!1;if(s=u=>{o||(o=!0,c(u))},i=this.scheduler.schedule(()=>{n.abort(),s(r)},15e3),!this.live()||this.abort.signal.aborted||n.signal.aborted||o){a(),this.live()||this.retire();return}try{Promise.resolve(t(n.signal)).then(s,()=>s(r))}catch{s(r)}})}finally{this.abort.signal.removeEventListener("abort",a),this.cancel(i)}}async pump(){if(!this.running){this.running=!0;try{for(const t of this.entries.values()){if(t.settled)continue;let r=!1;for(let n=0;n<8&&!t.settled;n++){if(!this.live()){this.retire();break}if(!t.original&&(t.original=this.port.captureOriginal(Object.freeze({id:t.id,bytes:t.bytes}))??void 0,!t.original||!this.live())){this.settle(t,{kind:t.sent?"unconfirmed":"refused"});break}const s=t.original;if(r){let o;try{o=await this.call(u=>s.inspect(u),{kind:"unknown"})}catch{this.settle(t,{kind:"unconfirmed"});break}if(!this.live()){this.retire();break}if(o.kind==="accepted"){const u=ar(t.id,o.receipt);this.settle(t,u?{kind:"accepted",receipt:u}:{kind:"unconfirmed"});break}if(o.kind!=="absent"){this.settle(t,{kind:"unconfirmed"}),o.kind==="terminal"&&this.retire();break}}t.sent=!0;let i;try{i=await this.call(o=>s.submit(o),{kind:"uncertain"})}catch{i={kind:"uncertain"}}if(!this.live()){this.retire();break}if(i.kind==="accepted"){const o=ar(t.id,i.receipt);this.settle(t,o?{kind:"accepted",receipt:o}:{kind:"unconfirmed"});break}if(i.kind==="terminal"){this.settle(t,{kind:"unconfirmed"}),this.retire();break}r=!0;const a=this.scheduler.random();if(!this.live()||t.settled){this.retire();break}const c=i.kind==="retry"&&Number.isFinite(i.retryAfterMs)?Math.max(0,Math.min(3e4,i.retryAfterMs)):500;await this.wait(c+Math.floor(Math.max(0,Math.min(1,Number.isFinite(a)?a:0))*250))}t.settled||this.settle(t,{kind:"unconfirmed"})}}catch{this.retire()}finally{this.running=!1}}}}class ms{constructor(t,r){$(this,"challenge");$(this,"queue");$(this,"detach");$(this,"timer");$(this,"port",null);$(this,"connected",!1);$(this,"closed",!1);$(this,"started",!1);$(this,"pending",new Map);if(this.bound=t,this.ports=r,!t.current()||typeof(r==null?void 0:r.nonce)!="function"||typeof r.channel!="function"||typeof r.offline!="function")throw new Error("Current loaded Doc binding and explicit handshake ports required.");if(t.binding.observation.eligibility==="served-document"?typeof r.boot!="string"||r.boot.length===0:r.boot!==null)throw new Error("A served document needs its boot nonce; a preview has none.");this.challenge=or.parse({protocol:"dorkos-doc",v:1,kind:"challenge",nonce:r.nonce(),requestToken:r.nonce(),loadToken:t.binding.observation.token,generation:t.binding.incarnation.generation}),this.queue=new ps(t,r.scheduler),this.detach=t.onRetire(()=>this.close())}start(){if(!this.bound.current()||this.closed||this.started)return;this.started=!0;const t=this.bound.binding.observation;try{const r=this.ports.scheduler.schedule(()=>{this.close()},5e3);if(!this.bound.current()||this.closed){try{this.ports.scheduler.cancel(r)}finally{this.close()}return}this.timer=r,t.frame.postMessage(this.challenge,t.exactOrigin==="null"?"*":t.exactOrigin)}catch{this.close()}}receive(t){if(!this.started||this.closed||!this.bound.current()||t.source!==this.bound.binding.observation.frame||t.origin!==this.bound.binding.observation.exactOrigin||t.ports.length!==0)return!1;const r=Je(or,t.data);if(!r||r.kind!=="ack"||!this.matches(r)||!this.booted(r))return!1;if(this.connected)return!0;this.connected=!0;let n;const s=()=>this.bound.current()&&!this.closed,i=()=>{for(const a of["port1","port2"])try{n==null||n[a].close()}catch{}return this.close(),!1};try{if(this.timer!==void 0&&this.ports.scheduler.cancel(this.timer),this.timer=void 0,!s()||(n=this.ports.channel(),!s())||(this.port=n.port1,this.port.onmessage=a=>{a.ports.length||this.command(a.data)},!s())||(this.port.start(),!s())||(this.bound.binding.observation.frame.postMessage({...this.challenge,kind:"connect"},this.bound.binding.observation.exactOrigin==="null"?"*":this.bound.binding.observation.exactOrigin,[n.port2]),!s()))return i()}catch{return i()}return!0}publish(t){this.send({...t,...this.challenge,kind:t.kind})}close(t="offline"){var r,n,s;if(!this.closed){this.closed=!0;try{(r=this.port)==null||r.postMessage({...this.challenge,kind:"status",status:t,unconfirmed:!0})}catch{}try{this.queue.retire()}catch{}try{this.timer!==void 0&&this.ports.scheduler.cancel(this.timer)}catch{}this.timer=void 0;try{(n=this.port)==null||n.close()}catch{}this.port=null,this.pending.clear(),(s=this.detach)==null||s.call(this);try{this.ports.offline()}catch{}}}matches(t){return t.nonce===this.challenge.nonce&&t.requestToken===this.challenge.requestToken&&t.loadToken===this.challenge.loadToken&&t.generation===this.challenge.generation}booted(t){return this.ports.boot===null||t.boot===this.ports.boot}send(t){var r;if(!this.closed&&this.connected&&this.bound.current()){const n=Je(fs,t);if(n)try{(r=this.port)==null||r.postMessage(n)}catch{this.close()}}}command(t){if(this.closed||!this.connected||!this.bound.current())return;const r=Je(ds,t);if(!(!r||!this.matches(r))){if(r.kind==="retire"){this.bound.retireObservation(),this.close();return}this.pending.has(r.requestId)||this.pending.size>=100||(this.pending.set(r.requestId,r.event.id),this.queue.emit(r.event).then(n=>{!this.bound.current()||this.closed||this.pending.get(r.requestId)!==r.event.id||(this.pending.delete(r.requestId),this.send(n.kind==="accepted"?{...this.challenge,kind:"receipt",requestId:r.requestId,receipt:n.receipt}:{...this.challenge,kind:"refused",requestId:r.requestId,outcome:n.kind}))}))}}}class gs{constructor(){$(this,"contiguous",0);$(this,"through",0);$(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 Dt=new WeakMap,rt=new WeakMap,ke=new WeakMap,Xe=new WeakMap;function Se(e){Me(e);const t=Dt.get(e);if(!t)throw new Error("Replay owner lifetime is absent.");return t}function vs(e,t){const r=rt.get(t);if(!r||r.owner!==e)throw new Error("Replay run is foreign.");return r}function Nr(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const t of Object.values(e))Nr(t);Object.freeze(e)}return e}function bs(e){if(Me(e),Dt.has(e))throw new Error("Replay owner lifetime is already initialized.");Dt.set(e,new gs)}function Ut(e){const t=Se(e);return Object.freeze({highest:t.highest,through:t.catchUpThrough,pending:t.pendingCount})}function cr(e){Se(e).reset()}function ur(e,t){const r=rt.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 ys(e,t,r){const n=ke.get(r),s=rt.get(t);if(!(!s||s.owner!==e||!n||n.owner!==e||n.run!==t||n.phase!=="consuming"||n.admissionRead||!ie(e,t)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:s.targetBirth})}function ws(e,t,r){const n=vs(e,t),s=ke.get(r),i=qr(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 Tr(e,t,r,n){if(!ie(e,t))return;if(n){const i=Xe.get(r);return i&&i.owner===e&&i.run===t&&i.phase==="dispatching"&&!i.advanced?i.frame:void 0}const s=ke.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 xs(e,t,r,n){const s=Vs(e,t,r,n);if(!s||!ie(e,t))throw new Error("Replay cursor advance has no genuine core witness.");const i=n?Xe.get(r):ke.get(r);if(!i||i.advanced)throw new Error("Replay frame advance was consumed.");i.advanced=!0,Se(e).advance(s.docSeq)}function ks(e,t){const r=rt.get(t),n=(r==null?void 0:r.lastPage)&&ke.get(r.lastPage);if(!r||r.owner!==e||!ie(e,t)||r.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&Se(e).highest<r.target)return;const s=Se(e);return Object.freeze({highest:s.highest,through:s.catchUpThrough,target:r.target})}function Cs(e,t){const r=et(e,t);if(!r)throw new Error("Replay notice is foreign or stale.");const n=Se(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"&&oi(e,t)}return!1}function js(e,t){const r=et(e,t);if(!r||r.mode!=="event"||r.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");Se(e).advance(r.notification.docSeq)}function Rs(e){const t=de(e),r=Se(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};rt.set(n,s),Ys(e,n);const i=()=>ie(e,n),a=()=>de(e).live?i()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!i())return null;const c=de(e),o=r.highest,u=bt(e),d=u.getCanvasChannel;if(!i())return null;const f=await d.call(u,t.documentId,{since:o,limit:200});if(!i())return null;const l=Nr(vn.parse(f));if(!i())return null;const g=Object.freeze({});return ke.set(g,{owner:e,run:n,response:l,since:o,revision:c.revision,observation:c.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),g},consumePage(c){const o=ke.get(c);return!i()||!o||o.owner!==e||o.run!==n||o.phase!=="read"?{kind:"done"}:(o.phase="consuming",Qs(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(d=>d.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 u=ke.get(c);if(!i()||!u||u.owner!==e||u.run!==n||u.phase!=="frames"||o!==u.next||!u.frames[o])return!1;u.next=o+1,u.dispatching=o,u.advanced=!1;try{return dr(e,n,c,!1)&&i()}finally{u.dispatching=void 0}},finishPage(c){const o=ke.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()||(fr(e,n),!i())||(s.succeeded=!0),"done";if(r.highest<=o.since)throw new Error("Document replay made no progress.");return"again"},failed(){i()&&Ks(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 Xe.set(o,{owner:e,run:n,frame:c,phase:"taken",advanced:!1}),o},advancePending(c){const o=Xe.get(c);if(!i()||!o||o.owner!==e||o.run!==n||o.phase!=="taken")return!1;o.phase="dispatching";try{return dr(e,n,c,!0)&&i()}finally{o.phase="finished",Xe.delete(c)}},finishFinalization(){const c=a();if(c)return c;if(r.clearReachedTarget()){const o=a();if(o)return o;fr(e,n);const u=a();if(u)return u}if(r.pendingCount||r.catchUpThrough>r.highest){const o=de(e);if(r.highest>s.starting||o.revision>s.revision||o.observation>s.observation)return"restart";ei(e,n)}return a()??"stop"},current:i,end:()=>{s.ended=!0}})}class Os{constructor(){$(this,"revision",0);$(this,"draining",!1);$(this,"cleanup");$(this,"subscribers",new Set);$(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 Es(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 Ss(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 u=r.createPort(o);n()&&r.portCurrent(u)===!0&&n()&&e.install(t,s.release)&&(i=!0,a=u)}}catch(o){c={cause:o}}if(!i)try{s.release()}catch(o){c??(c={cause:o})}if(c)throw c.cause;return a}function _s(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=Pt.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=Qe.parse(JSON.parse(JSON.stringify(s))),c=a.id;r("submit",i);const o=await e.submit(a,i);r("read",i);const u=n(c,o);return r("read",i),u},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=Qe.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 u=!1;const d=f=>o.current(f)===!0;return Object.freeze({id:a,bytes:c,current:d,submit:async f=>{if(u||f.aborted||!d("submit"))throw t();u=!0;const l=await o.submit(JSON.parse(c),f);if(f.aborted||!d("read"))throw t();const g=n(a,l);if(f.aborted||!d("read"))throw t();return g},inspect:async f=>{if(f.aborted||!d("read"))throw t();const l=await o.inspect(a,f);if(f.aborted||!d("read"))throw t();const g=n(a,l);if(f.aborted||!d("read"))throw t();return g}})}})}function Ds(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 Is(e,t,r){const n=Qe.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:Ds(s)}const As=dt.prototype.acquireDoc,ft=new WeakMap,It=new WeakMap;function Ns(e,t){const r=bt(e),n=new WeakMap,s=(a,c)=>t.current(c)&&Ee(e,a,!0);return Object.freeze({prepareFrameLoad:(a,c)=>{var l;if(!(a instanceof dt)||c.loaded)return null;const o=lr(e),u=o?(l=Ae(e,o))==null?void 0:l.httpBaseline:void 0,d=t.begin();if(!o||!u||!t.current(d)||!Ee(e,o,!0)||a.getCurrent()!==c||c.transportOwner!==r||!s(o,d))return null;let f=null;return Es(t,d,{current:()=>{var g;return Ee(e,o,!0)&&((g=Ae(e,o))==null?void 0:g.httpBaseline)===u&&a.getCurrent()===(f??c)&&t.current(d)&&Ee(e,o,!0)},complete:()=>(f=a.observeLoaded(c),f),accept:g=>{var b,m;return!t.current(d)||!Ee(e,o,!0)||((b=Ae(e,o))==null?void 0:b.httpBaseline)!==u||a.getCurrent()!==g||!t.current(d)||!Ee(e,o,!0)||((m=Ae(e,o))==null?void 0:m.httpBaseline)!==u?!1:(n.set(g,{record:o,birth:u.birth}),!0)}})},subscribeInvalidation:a=>t.subscribe(a),attachFrame:(a,c)=>{if(!(a instanceof dt))return null;const o=lr(e),u=t.begin();if(!o||!t.current(u)||!Ee(e,o,!0)||a.getCurrent()!==c||c.transportOwner!==r||!s(o,u))return null;const d=n.get(c);return!d||d.record!==o||!Q(d.birth,Ae(e,o).birth)?null:Ss(t,u,{current:()=>s(o,u),acquire:()=>{const f=As.call(a,c,Ae(e,o).birth,Ae(e,o).birth.documentId);let l=!1,g=null,b;try{s(o,u)&&a.getCurrent()===c&&s(o,u)&&(g=Object.freeze({binding:f.binding,release:f.release}),l=!0)}catch(m){b={cause:m}}if(!l)try{f.release()}catch(m){b??(b={cause:m})}if(b)throw b.cause;return g},bindingCurrent:f=>a.isCurrent(f)&&s(o,u),createPort:f=>hs(a,f,{owner:r,publisherEpoch:c.publisherEpoch,isCurrentOwner:(l,g)=>l===r&&g===c.publisherEpoch&&t.current(u)&&Ee(e,o),captureOriginal:l=>Is(l,g=>{var b;return((b=Zs(e,o))==null?void 0:b.captureOriginal(g))??null},()=>s(o,u)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:f=>f.current()&&s(o,u)})}})}function Ts(e){if(Me(e),ft.has(e))throw new Error("Frame owner is already initialized.");const t=new Os,r=Ns(e,t);return ft.set(e,{frames:t,facade:r}),r}function Ms(e){var t;return Me(e),(t=ft.get(e))==null?void 0:t.facade}function Ge(e){Me(e);const t=ft.get(e);if(!t)return;const r=Object.freeze({});return It.set(r,{owner:e,frames:t.frames,ticket:t.frames.captureRetirement()}),r}function Ve(e,t){if(!t)return;const r=It.get(t);if(!r||r.owner!==e)throw new Error("Frame retirement is foreign or consumed.");It.delete(t),r.frames.drainRetirement(r.ticket)}function Mr(e,t){const r=xe(e,t),n=Gs(e,t);if(!(!r||!n))return{owner:t,verified:r.verified,..._s(n)}}function ge(e,t){return{documentId:e,transport:t,events:[],available:!1}}function Fs(e,t,r,n,s,i){var o,u;const a=e.documentId===r&&e.transport===n?e:ge(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(d=>d.receipt.docSeq>=t.receiptRetentionFloor).map(d=>[d.receipt.id,d]));for(const d of t.receipts)c.set(d.receipt.id,d);return{...a,available:i,snapshot:{...t,...s?{}:{routing:(u=a.snapshot)==null?void 0:u.routing},receipts:[...c.values()].sort((d,f)=>f.receipt.docSeq-d.receipt.docSeq).slice(0,400)},events:t.resetRequired?a.events.filter(d=>d.docSeq>=t.retentionFloor):a.events}}function zs(e){var r,n,s,i,a,c,o,u,d,f,l,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?((d=(u=e.snapshot)==null?void 0:u.routing)==null?void 0:d.destinationLabel)??"Actions unavailable":"Actions unavailable",...e.snapshot?{snapshot:e.snapshot}:{},submit:((f=e.binding)==null?void 0:f.submit)??t,inspect:((l=e.binding)==null?void 0:l.inspect)??t,captureOriginal:(g=e.binding)==null?void 0:g.captureOriginal}}function qs(e,t,r){return!!(e&&t&&r.incarnation&&Q(t,r.incarnation)&&(r.highWatermark<e.highWatermark||r.stateRev<e.stateRev))}function Fr(e,t,r,n){const s=e.documentId===r&&e.transport===n?e:ge(r,n);return{...s,events:[...s.events,t].slice(-200)}}function Ls(e,t){if(e.incarnation&&(e.incarnation.documentId!==t||e.events.some(r=>r.documentId!==t||!r.incarnation||!Q(e.incarnation,r.incarnation))))throw new Error("Document replay identity changed.")}const At=new WeakMap;function Ps(e,t,r){const n=ys(e,t,r);if(n)return At.set(r,{owner:e,run:t,witness:n}),n}const zr=new WeakMap,Ke=new WeakMap,Nt=new WeakMap,Tt=new WeakMap;function Ce(e,t){Me(e);const r=t??Ke.get(e),n=r&&zr.get(r);return n&&n.owner===e&&Ke.get(e)===r&&n.active?n:void 0}function ee(e){return Me(e),Ke.get(e)}function xe(e,t){const r=Ce(e,t);return r?Object.freeze({birth:r.birth,httpBaseline:r.httpBaseline,snapshot:r.snapshot,verified:r.verified}):void 0}function Ze(e,t,r=!1){var i,a;const n=Ce(e,t),s=de(e);return!!n&&s.live&&n.verified&&n.transport===bt(e)&&(!r||((a=(i=n.snapshot)==null?void 0:i.routing)==null?void 0:a.enabled)===!0)}function Bs(e){const t=Ce(e);Ke.delete(e),t&&(t.active=!1,t.verified=!1)}function Ct(e,t){const r=Ce(e,t);r&&(r.verified=!1)}function Us(e,t,r){const n=Ce(e,r);return!n||!ie(e,t)?!1:(n.verified=!0,ie(e,t))}function Ws(e,t,r){const n=At.get(r);At.delete(r);const s=(n==null?void 0:n.owner)===e&&n.run===t?n.witness:void 0;if(!s||!ie(e,t))return!1;const i=s.response.incarnation;let a=Ce(e);if(!a&&!i)return ie(e,t);if(!a&&i){const c=de(e),o=()=>{const b=de(e);return ie(e,t)&&b.epoch===c.epoch&&b.observation===c.observation&&ee(e)===c.subject},u=bt(e),d=u.ingestCanvasEvent;if(!o())return!1;const f=Function.prototype.bind.call(d,u),l=u.getCanvasEventReceipt;if(!o())return!1;const g=Function.prototype.bind.call(l,u);if(!o())return!1;a={owner:e,token:Object.freeze({}),birth:Object.freeze({...i}),active:!0,verified:!1,submit:f,inspect:g,transport:u},zr.set(a.token,a),Ke.set(e,a.token),a.httpBaseline=Object.freeze({birth:a.birth,floor:s.response.receiptRetentionFloor}),Nt.set(r,Object.freeze({owner:e,run:t,epoch:c.epoch,previous:c.subject,subject:a.token}));try{ws(e,t,r)}catch(b){throw Ce(e)===a&&ni(e,t,r),b}finally{Nt.delete(r)}if(!ie(e,t))return!1}else if(a){if(!i||!Q(a.birth,i))return!1;a.httpBaseline=Object.freeze({birth:a.birth,floor:s.response.receiptRetentionFloor})}return ie(e,t)?(a&&(a.verified=si(e)||a.verified),!0):!1}function Wt(e,t,r){const n=$t(e),s=n.subject,i=()=>Br(e,n,r);if(!s||!Ze(e,s)){const o=Ge(e);Ve(e,o)}if(!i())return;const a=s&&Mr(e,s),c=Ms(e);n.dispatch(o=>{var f;if(!i())return o;const u=((f=o.binding)==null?void 0:f.owner)===s?o:ge(n.documentId,n.transport),d=typeof t=="function"?t(u):t;return i()?{...d,...d.snapshot?{snapshot:Object.freeze({...d.snapshot})}:{},binding:a,frameAdmission:c}:o})}function $s(e,t,r,n,s){const i=$t(e),a=Ce(e);Br(e,i,s)&&(a&&(a.snapshot=t),Wt(e,c=>Fs(c,t,i.documentId,i.transport,r,n),s))}function Hs(e,t,r,n){const s=Tr(e,t,r,n);if(!ie(e,t)||!s)return!1;if(s.docSeq<=Ut(e).highest)return ie(e,t);Tt.set(r,{owner:e,run:t,pending:n,frame:s});try{xs(e,t,r,n)}finally{Tt.delete(r)}if(!ie(e,t))return!1;const i=$t(e);return Wt(e,a=>Fr(a,s,i.documentId,i.transport),t),ie(e,t)}function Gs(e,t){const r=Ce(e,t);if(!r)return;const n=de(e).documentId;return{current:s=>Ze(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||!Ze(e,t,!0)||!Q(s.birth,r.birth)?null:Object.freeze({current:i=>Ze(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 qr(e,t,r){const n=Nt.get(r),s=de(e);return n&&n.owner===e&&n.run===t&&s.epoch===n.epoch&&s.subject===n.subject&&s.live?n:void 0}function Vs(e,t,r,n){const s=Tt.get(r);return s&&s.owner===e&&s.run===t&&s.pending===n&&ie(e,t)?s.frame:void 0}const Lr=new WeakMap,ht=new WeakMap;function Js(e){const t=ht.get(e);if(!t)throw new Error("Document construction ticket is foreign or consumed.");return ht.delete(e),t}function Xs(e,t,r){const n=Object.freeze({});ht.set(n,Object.freeze({documentId:e,transport:t,dispatch:r}));try{const s=ii(n);return Lr.set(n,s),n}finally{ht.delete(n)}}function ne(e){const t=Lr.get(e);if(!t)throw new Error("Document owner is foreign.");return t}function Me(e){ne(e)}function de(e){return ne(e).facts()}function bt(e){return ne(e).transport()}function lr(e){return ne(e).subject()}function Ae(e,t){return ne(e).subjectFacts(t)}function Ee(e,t,r=!1){return ne(e).subjectCurrent(t,r)}function Zs(e,t){return ne(e).binding(t)}function Ys(e,t){ne(e).reserve(t)}function ie(e,t){return ne(e).current(t)}function Qs(e,t,r){return ne(e).admit(t,r)}function dr(e,t,r,n){return ne(e).frame(t,r,n)}function fr(e,t){return ne(e).qualify(t)}function Ks(e,t){ne(e).failed(t)}function ei(e,t){ne(e).unavailable(t)}function ti(e,t){ne(e).start(t)}function ri(e){ne(e).dispose()}const Pr=new WeakMap;function $t(e){const t=Object.freeze(ne(e).projection());return Pr.set(t,Object.freeze({custodyKey:e,capture:t})),t}function Br(e,t,r){const n=Pr.get(t);return(n==null?void 0:n.custodyKey)===e&&n.capture===t&&ne(e).projectionCurrent(t.epoch,t.subject,r)}function ni(e,t,r){ne(e).abortAdmission(t,r)}function si(e){return ne(e).qualified()}const Mt=new WeakMap;function ii(e){const{documentId:t,transport:r,dispatch:n}=Js(e);let s,i=!1,a;const c={live:!0};let o=0,u,d,f=!1,l,g,b=0;const m=()=>c.live,v=()=>Bs(e);let A=0;const N=()=>Ut(e),R=j=>{const O=ur(e,j);return!!O&&!O.ended&&m()&&s===j&&O.epoch===o&&O.subject===ee(e)},z=(j=!1)=>{const O=Ge(e);v(),o++,s=void 0,j&&cr(e),Ve(e,O)},L=(j,O)=>Wt(e,j,O),B=j=>{const O=ks(e,j),k=ee(e),T=k&&xe(e,k);return!R(j)||!O||O.through>O.highest||!l||!T||!Q(l,T.birth)||!Us(e,j,k)?!1:(l=void 0,L(q=>({...q,available:!0}),j),R(j))},H=(j,O,k)=>{const T=ee(e),q=T&&xe(e,T),w=o,C=()=>m()&&w===o&&ee(e)===T&&(!k||R(k));if(!C()||qs(q==null?void 0:q.snapshot,q==null?void 0:q.birth,j))return;const U=O?j.routing:d;j={...j,routing:U&&Object.freeze({enabled:U.enabled,destinationLabel:U.destinationLabel,approvedEventTypes:Object.freeze([...U.approvedEventTypes])})},O&&(d=j.routing),!T&&!j.incarnation&&(f=!0),C()&&$s(e,j,O,l===void 0,k)},x=(j,O)=>{var se;const k=Ps(e,j,O);if(!R(j)||!k)return"discard";const T=k.response;Ls(T,t);const q=T.incarnation;if((ee(e)||l||g)&&!q)throw new Error("Document replay identity is unavailable.");if(g&&q&&!Q(g,q))return z(!0),L(ge(t,r)),"restart";const w=ee(e),C=(w&&((se=xe(e,w))==null?void 0:se.birth))??l;if(q&&(C&&!Q(C,q)||!C&&f||k.targetBirth&&!Q(k.targetBirth,q)))return l=q,f=!1,d=void 0,u=void 0,z(!0),L(ge(t,r)),"restart";const{events:U,...G}=T,X=ee(e);return!X&&q&&(l=g??q),!Ws(e,j,O)||!R(j)?"discard":(!X&&q&&(g=void 0),H(G,k.revision===A,j),R(j)?"accepted":"discard")},I=(j,O,k)=>{var C;const T=Tr(e,j,O,k),q=ee(e),w=(q&&((C=xe(e,q))==null?void 0:C.birth))??l;return!R(j)||!T||T.documentId!==t||w&&(!T.incarnation||!Q(w,T.incarnation))?!1:Hs(e,j,O,k)},M=(j,O)=>{const k=Object.freeze({});Mt.set(k,Object.freeze({owner:e,revision:A,observation:b,epoch:o,notification:j,mode:O}));try{return Cs(e,k)}finally{Mt.delete(k)}},W=j=>{if(i||!m()||(i=!0,L(ge(t,r)),!m()))return;const O=bn(void 0,k=>{if(!m()||k.documentId!==t)return;const T=k.type==="canvas_channel_snapshot"?k.snapshot.incarnation:k.incarnation,q=ee(e);if(!q){if(l&&!g&&(!T||!Q(l,T))||!T||T.documentId!==t)return;if(!g||!Q(g,T)){const w=!!g||!!l;if(g=Object.freeze({...T}),b++,d=void 0,u=void 0,f=!1,w&&(z(!0),L(ge(t,r))),!m()||!g||!Q(g,T))return}M(k,"quarantine"),m()&&j();return}if(l&&(!T||!Q(l,T))){T&&j();return}if(T&&!Q(xe(e,q).birth,T)){l=T,f=!1,d=void 0,u=void 0,z(!0),L(ge(t,r)),m()&&j();return}if(T){if(u!==void 0&&u!==k.scope){const w=Ge(e);if(u=k.scope,Ct(e,q),o++,s=void 0,A++,Ve(e,w),ee(e)!==q||!m())return;L(C=>({...C,available:!1})),ee(e)===q&&m()&&j();return}u=k.scope,A++,k.type==="canvas_channel_snapshot"?H(k.snapshot,!0):k.docSeq>N().highest+1?(M(k,"gap")&&m()&&L(C=>({...C,available:!1})),m()&&j()):M(k,"event")}},r,()=>{if(!m())return;const k=Ge(e),T=ee(e);T&&Ct(e,T),o++,s=void 0,A++,Ve(e,k),L(q=>({...q,available:!1})),m()&&j()});m()?a=O:O(),m()&&j()};return Ur.set(e,j=>{const O=et(e,j);if(!O||O.notification.type==="canvas_channel_snapshot")return;const k=ee(e),T=o;!k||!O.notification.incarnation||!Q(xe(e,k).birth,O.notification.incarnation)||(L(q=>Fr(q,O.notification,t,r)),!m()||T!==o||ee(e))}),{facts:()=>Object.freeze({documentId:t,live:m(),epoch:o,revision:A,observation:b,subject:ee(e)}),transport:()=>r,subject:()=>ee(e),subjectFacts:j=>xe(e,j),subjectCurrent:(j,O)=>Ze(e,j,O),binding:j=>Mr(e,j),qualified:()=>l===void 0,projection:()=>({documentId:t,transport:r,dispatch:n,epoch:o,run:s,subject:ee(e)}),projectionCurrent:(j,O,k)=>m()&&j===o&&O===ee(e)&&(!k||s===k),abortAdmission:(j,O)=>{qr(e,j,O)&&z(!0)},reserve:j=>{const O=ur(e,j);if(!O||O.ended||!m()||O.epoch!==o||O.subject!==ee(e))throw new Error("Replay run is foreign or stale.");s=j},current:R,admit:x,frame:I,qualify:B,failed:j=>{if(!R(j))return;const O=ee(e);O&&Ct(e,O),L(k=>({...k,available:!1}),j)},unavailable:j=>{R(j)&&L(O=>({...O,available:!1}),j)},start:W,dispose:()=>{if(!m())return;const j=Ge(e);c.live=!1,s=void 0;const O=a;a=void 0,v(),o++,cr(e);try{Ve(e,j)}finally{O==null||O()}}}}function et(e,t){const r=Mt.get(t),n=de(e);if(!(!r||r.owner!==e||!n.live||n.epoch!==r.epoch||n.revision!==r.revision||n.observation!==r.observation))return r}function oi(e,t){var c;const r=et(e,t);if(!r||r.notification.type==="canvas_channel_snapshot")return;const n=r.notification,i=de(e).subject,a=i&&xe(e,i);!a||!n.incarnation||!Q(a.birth,n.incarnation)||n.docSeq<=Ut(e).highest||(js(e,t),!(!et(e,t)||de(e).subject!==i)&&((c=Ur.get(e))==null||c(t)))}const Ur=new WeakMap;function ai(e,t,r){const n=Xs(e,t,r);bs(n);const s=Ts(n);return Object.freeze({beginRun:()=>Rs(n),frameAdmission:s,start:i=>ti(n,i),dispose:()=>ri(n)})}function ci(e,t){let r,n=0;const s=f=>{try{t==null||t(f)}catch{}},i=f=>{r===f&&(r=void 0)},a=(f,l)=>{f.settled||(f.settled=!0,r||s(!1),l?f.reject(l.cause):f.resolve())},c=()=>{d().catch(()=>{})},o=(f,l)=>{const g=()=>n===f.revision;if(!g())return;const b=l.beginFinalization();if(g()){if(b==="restart"){c();return}if(b==="drain")for(;g();){const m=l.drainOne();if(!g())return;if(m!=="again"){if(m==="restart")c();else if(m==="tail"){const v=l.finishFinalization();g()&&v==="restart"&&c()}return}}}},u=async f=>{let l,g;try{l=e();try{for(;await l.page()==="again";);}catch(b){l.failed(b)}}catch(b){g={cause:b}}finally{i(f);try{l&&o(f,l)}catch(b){g={cause:b}}finally{a(f,g)}}},d=()=>{if(r)return r.promise;let f,l;const g=new Promise((m,v)=>{f=m,l=v}),b={revision:++n,promise:g,resolve:f,reject:l,settled:!1};return r=b,s(!0),u(b),g};return Object.freeze({request:d})}function ui(e,t,r,n){const s=ai(e,t,r);let i=!1;const a=ci(()=>{const c=s.beginRun();return{async page(){const o=await c.readPage();if(!o)return"done";const u=c.consumePage(o);if(u.kind!=="frames")return u.kind;for(let d=0;d<u.count;d++)if(!c.advancePageFrame(o,d))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 Wr(e){var u,d,f;const t=ae(),[r,n]=p.useState(()=>ge(e,t)),[s,i]=p.useState({documentId:e,transport:t,pending:!0});p.useLayoutEffect(()=>{const l=ui(e,t,n,g=>{i({documentId:e,transport:t,pending:g})});return()=>l.dispose()},[e,t]);const a=r.documentId===e&&r.transport===t?r:ge(e,t),c=p.useMemo(()=>zs(a),[a]),o=p.useMemo(()=>{var b;const l=(b=a.snapshot)==null?void 0:b.incarnation,g=a.binding;return l&&g?Object.freeze({incarnation:Object.freeze({...l}),current:()=>g.current("read")}):void 0},[(u=a.snapshot)==null?void 0:u.incarnation,a.binding]);return{channel:c,events:a.events,snapshot:a.snapshot,frameAdmission:a.frameAdmission,fileSaveBinding:o,fileSaveObservation:s.documentId!==e||s.transport!==t||s.pending?"pending":a.available&&((d=a.binding)!=null&&d.verified)&&((f=a.snapshot)!=null&&f.incarnation)?"ready":"unavailable"}}function li(e){return{type:e.type,docSeq:e.docSeq,event:e.event}}function di(e,t){const r=e.indexOf("#"),n=r<0?e:e.slice(0,r),s=r<0?"":e.slice(r);return`${n}${n.includes("?")?"&":"?"}${us}=${t}${s}`}const fi={random:()=>Math.random(),schedule:(e,t)=>setTimeout(e,t),cancel:e=>clearTimeout(e)};function hi(e){const t=ae(),r=Wr(e.documentId),[n]=p.useState(()=>new dt),[s,i]=p.useState(null),[,a]=p.useState(0),c=JSON.stringify([e.documentId,e.logicalUrl,e.resolvedSource,e.reloadNonce,e.bridgeEligibility,e.previewOrigin]),o=e.bridgeEligibility==="served-document",u=p.useMemo(()=>o?crypto.randomUUID():null,[o,c]),d=JSON.stringify([c,u]),f=e.resolvedSource===null||u===null?e.resolvedSource:di(e.resolvedSource,u),l=p.useRef(null),g=p.useRef({params:e,doc:r,key:d,transport:t}),b=p.useRef(!1),m=p.useRef(0),v=(x,I="offline")=>{const M=x.link;x.link=null,M&&(M.hostClosed=!0,M.handshake.close(I)),n.retire()},A=()=>{var M,W;const x=l.current,{doc:I}=g.current;!(x!=null&&x.link)||I.channel.enabled&&((W=(M=I.channel).current)!=null&&W.call(M,"read"))||(v(x,"revoked"),x.tried=null)},N=()=>{var W,j,O;const x=(W=l.current)==null?void 0:W.link,{doc:I}=g.current,M=I.snapshot;if(!(!(x!=null&&x.live)||!M||!((O=(j=I.channel).current)!=null&&O.call(j,"read")))){for(const k of I.events)k.docSeq<=x.load.delivered||(x.handshake.publish({kind:"event",frame:li(k)}),x.load.delivered=k.docSeq);M.stateRev>x.stateRev&&(x.handshake.publish({kind:"state",state:M.state,stateRev:M.stateRev,docSeq:M.highWatermark,reset:M.resetRequired}),x.stateRev=M.stateRev)}},R=()=>{var w,C,U,G;const x=l.current,{params:I,doc:M,key:W,transport:j}=g.current,O=I.iframeRef.current,k=x==null?void 0:x.load,T=M.frameAdmission;if(!(x!=null&&x.active)||x.link||!k||x.boot!==null&&k!==x.firstLoad||x.key!==W||x.transport!==j||!I.resolvedSource||!I.bridgeEligibility||!(O!=null&&O.isConnected)||O.contentWindow!==k.frame||!T||!M.snapshot||!M.channel.enabled||!((C=(w=M.channel).current)!=null&&C.call(w,"read")))return;const q=[k,T,M.snapshot,x.invalidations];if(!((U=x.tried)!=null&&U.every((X,se)=>X===q[se]))){x.tried=q,b.current=!0;try{const X=n.observeHostContext({frame:k.frame,documentId:I.documentId,resolvedSource:I.resolvedSource,logicalUrl:I.logicalUrl,reloadKey:`${I.reloadNonce}:${++m.current}`,sessionId:null,eligibility:I.bridgeEligibility,exactOrigin:I.bridgeEligibility==="served-document"?"null":I.previewOrigin,transportOwner:j,publisherEpoch:m.current}),se=X&&((G=T.prepareFrameLoad(n,X))==null?void 0:G.completeLoad()),je=se&&T.attachFrame(n,se);if(!je){n.retire();return}const Re={load:k,live:!1,hostClosed:!1,stateRev:-1,handshake:new ms(je,{nonce:()=>crypto.randomUUID(),channel:()=>new MessageChannel,scheduler:fi,boot:x.boot,offline:()=>{const fe=l.current;(fe==null?void 0:fe.link)!==Re||Re.hostClosed||!Re.live&&fe.everLive&&i({key:fe.key,transport:fe.transport})}})};x.link=Re,Re.handshake.start()}catch{x.link=null,n.retire()}finally{b.current=!1}}},z=(x,I,M)=>{let W=l.current;return(!W||W.key!==x||W.transport!==I)&&(W=l.current={key:x,transport:I,boot:M,active:!1,load:null,firstLoad:null,link:null,tried:null,invalidations:0,everLive:!1}),W.active=!0,R(),W},L=x=>{x.active=!1,v(x),x.tried=null},B=p.useRef({connect:R,disconnect:v,publish:N,enter:z,leave:L,revokeIfWithdrawn:A});p.useLayoutEffect(()=>{B.current={connect:R,disconnect:v,publish:N,enter:z,leave:L,revokeIfWithdrawn:A},g.current={params:e,doc:r,key:d,transport:t}}),p.useLayoutEffect(()=>{const x=B.current.enter(d,t,u);return()=>B.current.leave(x)},[d,t,u]),p.useLayoutEffect(()=>{const x=r.frameAdmission;if(x)return x.subscribeInvalidation(()=>{const I=l.current;b.current||!I||(B.current.disconnect(I),I.invalidations++,a(M=>M+1))})},[r.frameAdmission]),p.useLayoutEffect(()=>{const x=I=>{const M=l.current,W=M==null?void 0:M.link;!M||!W||W.hostClosed||!W.handshake.receive(I)||W.live||(W.live=!0,M.everLive=!0,i(null),B.current.publish())};return window.addEventListener("message",x),()=>window.removeEventListener("message",x)},[]),p.useLayoutEffect(()=>{B.current.revokeIfWithdrawn(),B.current.connect(),B.current.publish()});const H=p.useCallback(x=>{var O;const I=l.current,M=x.contentWindow;if(!I||!M||x!==g.current.params.iframeRef.current)return;B.current.disconnect(I);const W={frame:M,delivered:0},j=((O=I.firstLoad)==null?void 0:O.frame)===M;I.load=W,j||(I.firstLoad=W),I.tried=null,j&&I.everLive&&I.boot!==null?i({key:I.key,transport:I.transport}):i(null),B.current.connect()},[]);return{frameSource:f,requiresReload:(s==null?void 0:s.key)===d&&s.transport===t,noteFrameLoaded:H}}function pi(e,t,r){return r!=null&&r.bridgeEligibility?e.mode==="serve"?t===null?null:{kind:"serve",cwd:t,path:e.path}:e.mode==="proxy"?{kind:"proxy",port:e.port,path:e.path}:null:null}function mi({iframeRef:e,target:t,cwd:r,resolved:n,reloadNonce:s}){const i=ae(),a=p.useRef(i);p.useEffect(()=>{a.current=i});const c=pi(t,r,n),o=c?JSON.stringify(c):null,u=o?`${o}
|
|
25
|
+
${n==null?void 0:n.src}
|
|
26
|
+
${s}`:null,[d,f]=p.useState(null);return p.useLayoutEffect(()=>{if(u===null||o===null)return;const l=JSON.parse(o);let g=!0,b=0;const m=new WeakSet,v=A=>{const N=A.target;if(N===null||N!==e.current)return;const R=++b;if(m.has(N)){f(null);return}m.add(N),a.current.getFrameBridgeStatus(l).then(z=>{!g||R!==b||f(z.bridge==="refused"&&z.reason?{pageKey:u,reason:z.reason}:null)},()=>{})};return document.addEventListener("load",v,!0),()=>{g=!1,document.removeEventListener("load",v,!0)}},[u,o,e]),d!==null&&d.pageKey===u?d.reason:null}const gi=15e3;function vi(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 bi(e){const t=ae();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 yi(e,t){const r=ae(),n=Y(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),gi);return()=>{clearInterval(i),s(!1),n(e,null)}},[r,e,t,n])}const wi=400;function Xo(e,t){const r=ae(),n=Y(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)},wi);return()=>{clearTimeout(a),i&&s(null)}},[r,e,t,n])}const xi="allow-scripts allow-forms allow-popups allow-modals",jt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",ki=new Set(["javascript:","data:","blob:"]),Ci=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function Ht(e){return Ci.has(e)||e.endsWith(".localhost")}function ji(e){return Ht(e)?"direct":"server"}function Ri(e,t){let r;try{r=new URL(e)}catch{return null}const n=r.searchParams.get(hr),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(hr,n),s.toString()}const hr="__dorkos_preview",Oi="/__dorkos_preview/health";function Ei(e){return e==="https:"?443:80}function $r(e){let t;try{t=new URL(e)}catch{return{mode:"serve",path:e}}if(ki.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(Ht(t.hostname)){const r=t.port?Number(t.port):Ei(t.protocol);return{mode:"proxy",hostname:t.hostname,port:r,path:`${t.pathname}${t.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function Si(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`${Ht(s)?"http":"https"}://${t}`}function _i(e){const t=$r(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 Di=2e3;async function pr(e,t=globalThis.fetch,r=Di){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 Ii({target:e,currentUrl:t,strategy:r,cwd:n,reloadNonce:s}){const i=JSON.stringify([t,r,n,s]),[a,c]=p.useState(null),[o,u]=p.useState(null),[d,f]=p.useState(null),l=ae(),g=p.useRef(l);return p.useEffect(()=>{g.current=l}),p.useEffect(()=>{const b=g.current;let m=!1;const v=z=>{c(i),u(z)};async function A(z){if(n===null){f({kind:"no-session"});return}try{const L=await b.createServeUrl(n,z);if(m)return;L===null?f({kind:"unsupported"}):v({src:L,sandbox:xi,previewOrigin:null,bridgeEligibility:"served-document"})}catch{m||f({kind:"failed"})}}async function N(z,L){let B;try{const x=await b.probeLoopbackPort(z);B=x===null?"unknown":x.listening}catch{B="unknown"}if(m)return;let H=null;if(B!==!1){let x=null;try{x=await b.createProxyUrl(z)}catch{if(m)return;H={kind:"failed"}}if(m)return;if((x==null?void 0:x.unavailable)==="tunnel"){f({kind:"tunnel"});return}if((x==null?void 0:x.unavailable)==="no-port"&&(H={kind:"no-port"}),x!=null&&x.url){const I=new URL(x.url);if(await pr(`${I.origin}${Oi}`)){if(m)return;const M=Ri(x.url,L);if(M!==null){v({src:M,sandbox:jt,previewOrigin:I.origin,bridgeEligibility:"preview-listener"});return}}if(m)return;H={kind:"origin-unreachable",host:I.hostname,listenPort:I.port}}}if(r==="direct"&&await pr(t)){if(m)return;v({src:t,sandbox:jt,previewOrigin:null,bridgeEligibility:null});return}m||f(H??{kind:"no-upstream"})}async function R(){if(f(null),u(null),e.mode!=="blocked"){if(e.mode==="external"){v({src:e.url,sandbox:jt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?A(e.path):N(e.port,e.path)}}return R(),()=>{m=!0}},[e,t,r,n,s,i]),{resolved:a===i?o:null,resolveError:d}}const Ai=1e4;function Ni(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 Ti({target:e,resolved:t,frameSource:r,resolveError:n,reloadNonce:s,resourceErrorCount:i,title:a,onOpenExternally:c,onReload:o,iframeRef:u,onFrameLoad:d}){if(e.mode==="blocked")return h.jsx(Rt,{children:"This address is blocked for safety."});if(n!==null)return h.jsxs(Rt,{children:[h.jsx("p",{children:Ni(n,e)}),n.kind!=="no-session"&&n.kind!=="unsupported"&&h.jsx("button",{type:"button",onClick:o,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(t===null||r===null)return h.jsx(Rt,{children:"Loading…"});const f=e.mode==="external";return h.jsx(Mi,{src:r,sandbox:t.sandbox,title:a,iframeRef:u,onFrameLoad:d,watchLoadDeadline:!f,resourceErrorCount:i,showEmbedFallback:f,onOpenExternally:c,onReload:o},`${r}:${s}`)}function Mi({src:e,sandbox:t,title:r,iframeRef:n,onFrameLoad:s,watchLoadDeadline:i,resourceErrorCount:a,showEmbedFallback:c,onOpenExternally:o,onReload:u}){const[d,f]=p.useState(!1),[l,g]=p.useState(!1);return p.useEffect(()=>{if(!i)return;const b=setTimeout(()=>g(!0),Ai);return()=>clearTimeout(b)},[i]),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[l&&!d&&h.jsx(mr,{onOpenExternally:o,onReload:u,children:"This preview is slow to load."}),a>0&&h.jsxs(mr,{onOpenExternally:o,children:["This page hit ",a===1e4?"at least 10,000":a," ",a===1?"error":"errors"," while loading."]}),h.jsx("iframe",{ref:n,src:e,sandbox:t,onLoad:b=>{f(!0),s(b.currentTarget)},className:"min-h-0 w-full flex-1 border-0",title:r}),c&&h.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:[h.jsx("span",{children:"This site can’t always be embedded here."}),h.jsx("button",{type:"button",onClick:o,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function mr({children:e,onOpenExternally:t,onReload:r}){return h.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:[h.jsx("span",{children:e}),h.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[r&&h.jsx("button",{type:"button",onClick:r,className:"text-foreground hover:underline",children:"Reload"}),h.jsx("button",{type:"button",onClick:t,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function Rt({children:e}){return h.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 Fi=yn/(1024*1024),zi={csp:"This page’s security policy blocks added scripts, so it can’t talk to its agent.",encoding:"This page isn’t saved as UTF-8, so it can’t talk to its agent.",oversize:`This page is over ${Fi} MB, so it can’t talk to its agent.`,"no-head":"This page has no <head> tag, so it can’t talk to its agent.",markup:"DorkOS can’t safely read this page’s <head>, so it can’t talk to its agent.","fixed-source":"DorkOS couldn’t connect this page to its agent."};function qi({reason:e}){return h.jsx("p",{role:"status","data-bridge-refusal":e,className:"text-muted-foreground border-border/60 border-b px-2 py-1 text-xs",children:zi[e]})}function Li(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 Pi({documentId:e,content:t}){const r=Y(w=>w.selectedCwd),n=Y(w=>w.writeBrowserHistory),[s]=p.useState(()=>Li(Y.getState().browserHistories[e],t.url)),[i,a]=p.useState(s.stack),[c,o]=p.useState(s.cursor),[u,d]=p.useState(0);p.useEffect(()=>{n(e,{contentUrl:t.url,stack:i,cursor:c})},[e,t.url,i,c,n]);const f=i[c],l=p.useMemo(()=>$r(f),[f]),g=p.useMemo(()=>l.mode==="proxy"?ji(window.location.hostname):null,[l]),b=p.useRef(null),{resolved:m,resolveError:v}=Ii({target:l,currentUrl:f,strategy:g,cwd:r,reloadNonce:u}),{resourceErrorCount:A,notePersonNavigated:N,noteFrameLoaded:R}=cs({iframeRef:b,documentId:e,logicalUrl:f,reloadNonce:u,previewOrigin:(m==null?void 0:m.previewOrigin)??null,bridgeEligibility:(m==null?void 0:m.bridgeEligibility)??null,resolvedSource:(m==null?void 0:m.src)??null}),z=hi({iframeRef:b,documentId:e,logicalUrl:f,reloadNonce:u,previewOrigin:(m==null?void 0:m.previewOrigin)??null,bridgeEligibility:(m==null?void 0:m.bridgeEligibility)??null,resolvedSource:(m==null?void 0:m.src)??null}),L=mi({iframeRef:b,target:l,cwd:r,resolved:m,reloadNonce:u}),B=Y(w=>w.roomCanvasLiveRoomId),{open:H}=bi(B??""),[x,I]=p.useState(null),M=p.useCallback(w=>{a(C=>[...C.slice(0,c+1),w]),o(C=>C+1)},[c]),W=wn(B),j=Y(w=>B?w.roomCanvasEditing[B]??null:null);p.useEffect(()=>{if(W===null||j!==null||W.documentId!==e)return;const w=W.url;w===void 0||w===f||M(w)},[W,j,e,f,M]);const O=c>0,k=c<i.length-1,T=p.useCallback(w=>{const C=Si(w);if(!C||C===f){N(),d(U=>U+1);return}if(B){I(null),H({type:"browser",url:C}).catch(U=>{I({url:C,message:vi(U)})});return}N(),M(C)},[f,M,B,H,N]),q=()=>Rn(f);return h.jsxs("div",{className:"flex h-full flex-col",children:[h.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:[h.jsx(nt,{label:"Back",disabled:!O,onClick:()=>o(w=>w-1),children:h.jsx(xn,{className:"size-4"})}),h.jsx(nt,{label:"Forward",disabled:!k,onClick:()=>o(w=>w+1),children:h.jsx(kn,{className:"size-4"})}),h.jsx(nt,{label:"Reload",onClick:()=>d(w=>w+1),children:h.jsx(Fn,{className:"size-4"})}),h.jsx("div",{className:"order-first flex w-full min-w-0 lg:order-none lg:w-auto lg:flex-1",children:h.jsx(Bi,{url:(x==null?void 0:x.url)??f,startEditing:x!==null,onSubmit:T},x===null?"address":`retry:${x.url}`)}),h.jsx(nt,{label:"Open in system browser",onClick:q,children:h.jsx(Cn,{className:"size-4"})})]}),x!==null&&h.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:x.message}),z.requiresReload&&h.jsxs("div",{className:"text-muted-foreground border-border/60 flex items-center justify-between gap-2 border-b px-2 py-1 text-xs",children:[h.jsx("p",{role:"status",children:"Page is offline. Reload to reconnect."}),h.jsx("button",{type:"button","aria-label":"Reload to reconnect",onClick:()=>{N(),d(w=>w+1)},className:"text-foreground shrink-0 hover:underline",children:"Reload"})]}),L!==null&&h.jsx(qi,{reason:L}),h.jsx(Ti,{target:l,resolved:m,frameSource:z.frameSource,resolveError:v,reloadNonce:u,resourceErrorCount:A,title:t.title??"Embedded browser",onOpenExternally:q,onReload:()=>{N(),d(w=>w+1)},iframeRef:b,onFrameLoad:w=>{z.noteFrameLoaded(w),R()}})]})}function Bi({url:e,startEditing:t=!1,onSubmit:r}){const[n,s]=p.useState(t),[i,a]=p.useState(e);if(!n)return h.jsx(Wi,{url:e,onActivate:()=>{a(e),s(!0)}});const c=o=>{o.preventDefault(),s(!1),r(i)};return h.jsx("form",{onSubmit:c,className:"min-w-0 flex-1",children:h.jsx(jn,{"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 Ui(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function Wi({url:e,onActivate:t}){const r=p.useMemo(()=>_i(e),[e]);return h.jsxs("button",{type:"button","aria-label":`Address: ${Ui(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"&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"bg-muted-foreground/15 text-3xs rounded px-1 py-0.5 font-medium tracking-wide uppercase",children:"local"}),h.jsx("span",{className:"text-foreground truncate",children:r.path})]}),r.kind==="url"&&h.jsxs("span",{className:"truncate",children:[h.jsx("span",{className:"text-foreground",children:r.host}),h.jsx("span",{className:"text-muted-foreground",children:r.rest})]}),r.kind==="raw"&&h.jsx("span",{className:"truncate",children:r.text})]})}function nt({label:e,disabled:t,onClick:r,children:n}){return h.jsx("button",{type:"button","aria-label":e,disabled:t,onClick:r,className:Bt("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})}const $i=4096;function Hi(e){return e.toLowerCase().endsWith(".md")?e.slice(0,-3):e}function Gi(e){const t=e.trim(),r=/^(["'])(.*)\1$/.exec(t);return r?r[2].trim():/^[|>][+-]?\d*$/.test(t)?"":t.replace(/\s+#.*$/,"").trim()}function Vi(e,t){var i;const r=e.replace(/^\uFEFF/,"").split(/\r?\n/);let n=0;if(r[0]==="---"){for(n=1;n<r.length;n+=1){const a=r[n];if(a==="---"||a==="...")break;const c=/^title:(.*)$/.exec(a);if(c){const o=Gi(c[1]);if(o!=="")return o}}n+=1}let s=null;for(;n<r.length;n+=1){const a=r[n],c=(i=/^ {0,3}(`{3,}|~{3,})/.exec(a))==null?void 0:i[1];if(c){s===null?s=c[0]:c[0]===s&&(s=null);continue}if(s!==null)continue;const o=/^ {0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(a);if(o&&o[1].trim()!=="")return o[1].trim()}return Hi(t)}function Ji(e,t,r=$i){let n=new TextDecoder().decode(e.subarray(0,r));return e.length>=r&&(n=n.slice(0,Math.max(0,n.lastIndexOf(`
|
|
27
|
+
`)))),Vi(n,t)}function Xi(e,t){return Ji(new TextEncoder().encode(e),t)}const Hr=K({path:le().min(1),title:le(),slug:le()});K({root:le(),docs:Et(Hr),truncated:ut()});K({cwd:le().min(1)});K({cwd:le().min(1),target:le().min(1).max(1e3),from:le().min(1).optional()});K({doc:Hr.nullable(),complete:ut()});const Ft=".md";function we(e){return e.normalize("NFC").trim().toLowerCase()}function Gr(e){return we(e).replace(/\s+/g,"-")}function Ue(e){return e.toLowerCase().endsWith(Ft)?e.slice(0,-Ft.length):e}function gr(e){return e.slice(e.lastIndexOf("/")+1)}function ot(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function pt(e){return e===""?[]:e.split("/")}function Zi(e,t){const r=pt(e);for(const n of t.split("/"))if(!(n===""||n==="."))if(n===".."){if(r.length===0)return null;r.pop()}else r.push(n);return r.length===0?null:r.join("/")}function vr(e,t){const r=pt(e),n=pt(t);let s=0;for(;s<r.length&&s<n.length&&r[s]===n[s];)s+=1;return r.length-s+(n.length-s)}function Yi(e){return Gr(e).replace(/[^\p{L}\p{N}_-]/gu,"")}function Qi(e,t,r=null){const n=r&&r.trim()!==""?`#${Yi(r)}`:"",s=e===null?null:e.normalize("NFC"),i=t.normalize("NFC");if(s===i&&n)return n;const a=pt(s===null?"":ot(s)),c=i.split("/");let o=0;for(;o<a.length&&o<c.length-1&&a[o]===c[o];)o+=1;return[...Array.from({length:a.length-o},()=>".."),...c.slice(o)].map(encodeURIComponent).join("/")+n}const Ki=/[[\]|#\n\r]/,eo=20;function to(e){const t=e.map(c=>({doc:c,folder:ot(c.path),path:we(c.path),title:we(c.title),base:we(Ue(gr(c.path)))})),r=new Map(t.map(c=>[c.path,c])),n=c=>(o,u)=>vr(c,o.folder)-vr(c,u.folder)||o.doc.path.length-u.doc.path.length||(o.doc.path<u.doc.path?-1:o.doc.path>u.doc.path?1:0);function s(c,o){const u=Ue(c),d=c.startsWith("/")?[""]:[o,""];for(const f of d){const l=Zi(f,u);if(l===null)continue;const g=r.get(we(l+Ft));if(g)return g}}function i(c,o){const u=c.normalize("NFC").trim();if(u==="")return null;const d=o===null?"":ot(o);if(u.includes("/")){const m=s(u,d);if(m)return m}const f=we(u),l=we(Ue(u)),g=Gr(l),b=t.filter(m=>m.title===f||m.base===l||m.doc.slug===g);return b.length===0?null:b.sort(n(d))[0]??null}function a(c,o){const u=[c.doc.title.trim(),Ue(gr(c.doc.path)),`/${Ue(c.doc.path)}`];for(const d of u)if(!(d===""||Ki.test(d))&&i(d,o)===c)return d;return null}return{docs:e,resolve:(c,o)=>{var u;return((u=i(c,o))==null?void 0:u.doc)??null},search(c,o,u=eo){const d=we(c),f=o===null?"":ot(o),l=o===null?null:we(o),g=[];for(const v of t){if(v.path===l)continue;const A=d===""||v.title.startsWith(d)?0:v.title.split(/[\s\-_/]+/).some(N=>N.startsWith(d))?1:v.title.includes(d)?2:v.path.includes(d)?3:-1;A>=0&&g.push({entry:v,score:A})}const b=n(f);g.sort((v,A)=>v.score-A.score||b(v.entry,A.entry));const m=[];for(const{entry:v}of g){if(m.length>=u)break;const A=a(v,o);A!==null&&m.push({target:A,title:v.doc.title,description:v.doc.path})}return m}}}function br(e,t){const r=t.normalize("NFC").replaceAll("\\","/"),n=r.startsWith("/")||/^[A-Za-z]:\//.test(r);let s=r;if(n){const a=e.normalize("NFC").replaceAll("\\","/").replace(/\/+$/,"");if(!r.startsWith(`${a}/`))return null;s=r.slice(a.length+1)}const i=[];for(const a of s.split("/"))if(!(a===""||a==="."))if(a===".."){if(i.length===0)return null;i.pop()}else i.push(a);return i.length===0?null:i.join("/")}const yr="Links within this doc don’t open.",wr="This folder is too big to check this link.",xr="Couldn’t check this link.";function kr(e,t,r){return{exists:!0,href:Qi(e,t.path,r),title:t.title}}function ro(e){const{index:t,truncated:r,docPath:n,lookup:s,open:i,refuse:a}=e,c=new Map,o=f=>{const l=f.normalize("NFC").trim().toLowerCase();let g=c.get(l);return g||(g=s(f.trim()).catch(()=>null),c.set(l,g)),g};return{resolve:f=>{if(f.target.trim()==="")return{exists:!1,title:yr};const l=t.resolve(f.target,n);return l?kr(n,l,f.heading):r?o(f.target).then(g=>g===null?{exists:!0,title:xr}:g.doc?kr(n,g.doc,f.heading):g.complete?{exists:!1}:{exists:!0,title:wr}):{exists:!1}},search:f=>t.search(f,n),onOpen:f=>{const l=f.target.trim();if(l===""){a(yr);return}const g=`No doc called “${l}” yet.`,b=t.resolve(l,n);if(b){i(b.path);return}if(!r){a(g);return}o(l).then(m=>{m!=null&&m.doc?i(m.doc.path):a(m===null?xr:m.complete?g:wr)})}}}function no({cwd:e,sourcePath:t,content:r="",saved:n=!1}){const{enabled:s}=On(En),i=s&&!!e&&!!t,{data:a}=Vn(e,i),c=Jn(),o=ae(),{setTheme:u}=Sn(),d=i&&a&&e&&t?br(e,t)??br(a.root,t):null,f=p.useMemo(()=>a?to(a.docs):null,[a]),l=p.useRef({index:f,docPath:d,content:r,cwd:e});p.useEffect(()=>{l.current={index:f,docPath:d,content:r,cwd:e}}),p.useEffect(()=>{const{index:b,docPath:m,content:v,cwd:A}=l.current;if(!n||!b||m===null)return;const N=b.docs.find(z=>z.path.normalize("NFC").toLowerCase()===m.toLowerCase()),R=m.slice(m.lastIndexOf("/")+1);(!N||N.title!==Xi(v,R))&&c(A)},[n,c]);const g=p.useCallback(b=>{_n({getStore:Y.getState,setTheme:u,supportsTerminal:o.supportsTerminal},{action:"open_file",sourcePath:b},"user")},[u,o]);return p.useMemo(()=>{if(!(!f||!a||d===null||!e))return ro({index:f,truncated:a.truncated,docPath:d,lookup:b=>o.resolveDocLink(e,b,d),open:g,refuse:b=>Dn.info(b)})},[f,a,d,e,o,g])}function so(e){return typeof e=="object"&&e!==null&&e.status===404}function io({owner:e,getOwner:t,readTail:r,writeTail:n,transport:s,cwd:i,sourcePath:a,documentId:c,pending:o}){const u=()=>{var m,v;return((m=t())==null?void 0:m.recoveryGate)==="unsupported"||((v=t())==null?void 0:v.recoveryGate)==="observed_clear"},d=m=>{var N;const v=In.parse(m),A=(N=t())==null?void 0:N.recoveryBinding;if(!A||v.documentId!==c||!Q(v.incarnation,A.incarnation))throw new Error("Original save scope changed");return v},f=s.originalFileSaveRecovery,l=()=>{var m;try{const v=t();return(v==null?void 0:v.identity)===e&&v.active&&!!((m=v.recoveryBinding)!=null&&m.current())}catch{return!1}},g=(m,v,A=!1,N=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const R=t(),z={},L=()=>t()===R&&l()&&(!v||R.recoveryBinding===v)&&(!A||R.recoveryWork===z),B=R.discovery;let H=!1;R.recoveryWork=z,R.recoveryGate="pending",R.recoveryBusy=!0;const x=r().catch(()=>{}).then(async()=>{try{if(!L())return{status:"idle"};const I=await m();return L()?(A&&(R.recoveryGate="observed_clear"),H=!0,{status:"observed",value:I}):{status:"idle"}}catch(I){return L()?(R.recoveryGate="unavailable",{status:N&&so(I)?"refused":"unavailable"}):{status:"idle"}}finally{!H&&R.discovery===B&&(R.discovery=void 0),R.recoveryWork===z&&(R.recoveryBusy=!1,R.recoveryWork=void 0)}});return A||n(x.then(()=>{})),x};return{identity:e,supported:!!f,current:l,discover:(m=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const v=t(),A=v.recoveryBinding;if(v.discoveryBinding===A&&v.discovery&&(v.pendingDiscovery===v.discovery||!m&&v.recoveryGate==="observed_clear"))return v.discovery;const N=g(async()=>{const R=d(await f.discover(c));return t()===v&&v.recoveryBinding===A&&l()&&(v.recoveryGate=R.admission==="blocked"?"blocked":"observed_clear"),R},A,!1,!0);return v.discoveryBinding=A,v.discovery=N,v.pendingDiscovery=N,N.then(R=>{v.pendingDiscovery===N&&(v.pendingDiscovery=void 0),R.status==="idle"&&v.discovery===N&&(v.discovery=void 0)}),N},recover(m){if(o())return Promise.resolve({status:"local_uncertain"});const v=t();return g(async()=>{if(!v||o())throw new Error("Mounted original still uncertain");const A=v.recoveryBinding,N=An.parse(await f.recover(c,m,A.incarnation));if(t()!==v||!l()||N.documentId!==c||N.entry.eventId!==m||!Q(N.incarnation,A.incarnation))throw new Error("Original recovery scope changed");const R=d(await f.discover(c));return t()===v&&l()&&(v.recoveryGate=R.admission==="blocked"?"blocked":"observed_clear"),{result:N,discovery:R}})},inspectCurrent(){const m=t();return!m||!l()||o()||!u()?Promise.resolve({status:"local_uncertain"}):g(async()=>{const v=await s.readFileContent(i,a);if(!v||typeof v.content!="string"||typeof v.hash!="string"||!/^[a-f0-9]{64}$/u.test(v.hash))throw new Error("Current file evidence missing");return{content:v.content,hash:v.hash}},m.recoveryBinding,!0)}}}class Ne extends Error{constructor(){super("The original save is not confirmed. Retry it before saving another draft.")}}class Ye extends Error{}function oo(){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 ao(e){const t=e;return(t==null?void 0:t.status)===412&&t.code==="DOC_SAVE_FAILED"}var pe,Te,tt,zt;class co{constructor(){Be(this,tt);Be(this,pe);Be(this,Te)}get pending(){return Pe(this,pe)!==void 0}get receipt(){return Pe(this,Te)}async write(t,r,n,s,i,a,c=!1){if(Pe(this,pe))throw new Ne;if(be(this,Te,void 0),!a)return t.writeFile(r,n,s,i);if(!c&&!a.current())throw new Ye;const o=Object.freeze({cwd:r,path:n,content:s,options:Object.freeze({...i,documentSave:Object.freeze({documentId:a.incarnation.documentId,eventId:oo(),incarnation:Object.freeze({...a.incarnation})})})});return be(this,pe,o),ye(this,tt,zt).call(this,t,o)}async retry(t,r){const n=Pe(this,pe);if(!(n!=null&&n.options.documentSave)||!r.current()||!Q(n.options.documentSave.incarnation,r.incarnation))throw new Ye;return{result:await ye(this,tt,zt).call(this,t,n),content:n.content}}}pe=new WeakMap,Te=new WeakMap,tt=new WeakSet,zt=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 Ne;if(!n.ok){if(!n.conflict||typeof n.conflict.currentHash!="string"||!n.conflict.currentHash||typeof n.conflict.currentContent!="string")throw new Ne;return be(this,pe,void 0),n}if(typeof n.hash!="string"||!n.hash||n.effect!=="changed"&&n.effect!=="no_op")throw new Ne;const s="documentReceipt"in n?Nn.parse(n.documentReceipt):void 0,i=r.options.documentSave;if(!s&&n.effect!=="no_op")throw new Ne;if(s&&(s.documentId!==i.documentId||s.eventId!==i.eventId||!Q(s.incarnation,i.incarnation)||s.fileHash!==n.hash||(s.status==="accepted"?n.effect!=="changed":n.effect!=="no_op")))throw new Ne;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 Ne;if(a.hash!==s.fileHash||a.content!==r.content)return be(this,Te,s),be(this,pe,void 0),{ok:!1,conflict:{currentHash:a.hash,currentContent:a.content}}}return be(this,Te,s),be(this,pe,void 0),n}catch(n){throw ao(n)&&be(this,pe,void 0),n}};function uo({sourcePath:e,cwd:t,loadedContent:r,documentId:n,documentSaveBinding:s,documentRecoveryBinding:i}){const a=ae(),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,u=p.useRef(new co),d=p.useMemo(()=>({sourcePath:e,cwd:t,documentId:n,transport:a,birthKey:o}),[e,t,n,a,o]),f=p.useRef(null),l=p.useRef(null),g=p.useRef(Promise.resolve()),b=p.useCallback(()=>{var w;return((w=l.current)==null?void 0:w.identity)===d&&l.current.active},[d]);p.useLayoutEffect(()=>{var w;return((w=l.current)==null?void 0:w.identity)!==d?l.current={identity:d,baseHash:null,baseContent:r,active:!0,recoveryBinding:i,recoveryGate:i&&a.originalFileSaveRecovery?"pending":"unsupported"}:(l.current.active=!0,l.current.recoveryBinding=i),()=>{var C;((C=l.current)==null?void 0:C.identity)===d&&(l.current.active=!1)}},[d,r,i,a]);const[m,v]=p.useState({owner:d,status:"idle",conflict:null}),A=m.owner===d?m.status:"idle",N=m.owner===d?m.conflict:null,R=p.useCallback((w,C,U)=>{b()&&v(G=>({owner:d,status:w,documentReceipt:C,confirmedContent:U,conflict:G.owner===d?G.conflict:null}))},[d,b]),z=p.useCallback(w=>{b()&&v(C=>({owner:d,conflict:w,status:C.owner===d?C.status:"idle"}))},[d,b]),L=p.useCallback(()=>{var w,C;return((w=l.current)==null?void 0:w.recoveryGate)==="unsupported"||((C=l.current)==null?void 0:C.recoveryGate)==="observed_clear"},[]),B=p.useMemo(()=>{const w=()=>io({owner:d,getOwner:()=>l.current,readTail:()=>g.current,writeTail:C=>{g.current=C},transport:a,cwd:t,sourcePath:e,documentId:n,pending:()=>u.current.pending});return{identity:d,supported:!!a.originalFileSaveRecovery,current:()=>w().current(),discover:C=>w().discover(C),recover:C=>w().recover(C),inspectCurrent:()=>w().inspectCurrent()}},[d,a,t,e,n]),H=!!(e&&t),x=p.useCallback((w,C,U,G=!1)=>{const X=()=>b()&&l.current===w&&(!s||s.current());if(C.ok){if(typeof C.hash!="string"||!C.hash||C.effect!=="changed"&&C.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return w.baseHash=C.hash,w.baseContent=U,!G&&!X()?{status:"idle"}:(G||(z(null),R("saved",u.current.receipt,U)),{status:C.effect,confirmed:{hash:C.hash,content:U}})}return!G&&!X()?{status:"idle"}:(G||(z(C.conflict),R("conflict")),{status:"conflict"})},[b,s,z,R]),I=p.useCallback(async(w,C)=>{if(!b())return{status:"idle"};const U=l.current;s&&!u.current.pending&&(f.current=d);const G=await u.current.write(a,t,e,w,C,s);return x(U,G,w)},[b,a,t,e,s,x,d]),M=p.useCallback(w=>{var G;if(!H||!b())return Promise.resolve({status:"idle"});const C=((G=l.current.finalToken)==null?void 0:G.content)===w?l.current.finalToken:void 0,U=g.current.catch(()=>{}).then(async()=>{if(!b()||s&&!s.current())return{status:"idle"};if(u.current.pending)return R("uncertain"),{status:"uncertain"};if(!L())return R("error"),{status:"error"};l.current.finalToken===C&&(l.current.finalToken=void 0),R("saving");try{const X=l.current.baseHash!==null?{expectedHash:l.current.baseHash}:{expectedContent:l.current.baseContent};return await I(w,X)}catch(X){if(X instanceof Ye)return{status:"idle"};if(!b()||s&&!s.current())return{status:"idle"};const se=u.current.pending?"uncertain":"error";return R(se),{status:se}}});return g.current=U.then(()=>{}),U},[H,I,b,R,s,L]),W=p.useCallback(w=>{if(!H||!b()||s&&!s.current())return null;const C=l.current,U={content:w,id:Symbol("buffered canvas draft")};return C.finalToken=U,{cancel(){C.finalToken===U&&(C.finalToken=void 0)},flush(){if(C.finalToken!==U||l.current!==C||C.active)return Promise.resolve({status:"idle"});C.finalToken=void 0;const G=g.current.catch(()=>{}).then(async()=>{if(l.current!==C||C.active)return{status:"idle"};try{if(C.recoveryGate!=="unsupported"&&C.recoveryGate!=="observed_clear")return{status:"error"};const X=C.baseHash!==null?{expectedHash:C.baseHash}:{expectedContent:C.baseContent};s&&!u.current.pending&&(f.current=d);const se=await u.current.write(a,t,e,w,X,s,!0);return x(C,se,w,!0)}catch{return{status:"error"}}});return g.current=G.then(()=>{}),G}}},[H,b,a,t,e,s,x,d]),j=p.useCallback(async w=>{const C=l.current;return!C||C.identity!==d?!1:(await g.current.catch(()=>{}),l.current===C&&!u.current.pending&&C.baseContent===w)},[d]),O=p.useCallback(()=>{if(!b()||!s||f.current!==d)return Promise.resolve({status:"idle"});const w=l.current,C=g.current.catch(()=>{}).then(async()=>{if(!b()||l.current!==w||f.current!==d)return{status:"idle"};try{R("saving");const U=await u.current.retry(a,s);return x(w,U.result,U.content)}catch(U){if(U instanceof Ye||!b()||l.current!==w)return{status:"idle"};const G=u.current.pending?"uncertain":"error";return R(G),{status:G}}});return g.current=C.then(()=>{}),C},[b,s,a,x,R,d]),k=p.useCallback(w=>{var X;if(!H||!N||!b())return Promise.resolve({status:"idle"});const C=N.currentHash,U=((X=l.current.finalToken)==null?void 0:X.content)===w?l.current.finalToken:void 0,G=g.current.catch(()=>{}).then(async()=>{if(!b()||s&&!s.current())return{status:"idle"};if(u.current.pending)return R("uncertain"),{status:"uncertain"};if(!L())return R("error"),{status:"error"};l.current.finalToken===U&&(l.current.finalToken=void 0),R("saving");try{return await I(w,{expectedHash:C})}catch(se){if(se instanceof Ye)return{status:"idle"};if(!b()||s&&!s.current())return{status:"idle"};const je=u.current.pending?"uncertain":"error";return R(je),{status:je}}});return g.current=G.then(()=>{}),G},[H,N,I,b,R,s,L]),T=p.useCallback(()=>{var w;return((w=l.current)==null?void 0:w.identity)===d?{hash:l.current.baseHash,content:l.current.baseContent}:{hash:null,content:r}},[d,r]),q=p.useCallback(()=>{if(!N||!b()||s&&!s.current())return null;l.current.finalToken=void 0;const w=N.currentContent;return l.current.baseHash=N.currentHash,l.current.baseContent=w,z(null),R("idle"),w},[N,b,z,R,s]);return{recovery:B,status:A,conflict:N,canSave:H,save:M,overwrite:k,adoptDisk:q,getConfirmedBase:T,prepareFinalSave:W,retryUnconfirmed:O,waitForCloseDrain:j,documentReceipt:m.owner===d?m.documentReceipt:void 0,confirmedContent:m.owner===d?m.confirmedContent:void 0}}const lo=p.lazy(()=>_e(()=>import("./BlintzCanvas-DruVZcDU.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas}))),fo=500;function ho(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function po({content:e,documentId:t,onContentChange:r}){const[n,s]=p.useState(!1),[i,a]=p.useState(e.content),c=Y(k=>k.canvasSessionId),o=Y(k=>k.setDocumentEditing),u=Y(k=>{var T;return((T=k.openDocuments.find(q=>q.id===t))==null?void 0:T.editing)??!1}),d=Y(k=>k.selectedCwd),f=n&&u,l=uo({documentId:t,sourcePath:e.sourcePath,cwd:d,loadedContent:e.content}),g=l.canSave,b=no({cwd:d,sourcePath:g?e.sourcePath:null,content:i,saved:l.status==="saved"}),m=p.useRef(null),v=p.useRef(null),A=p.useRef(i),N=p.useRef(e),R=p.useRef(r),z=p.useRef(l.save),L=p.useRef(l.prepareFinalSave),B=p.useRef(null);p.useEffect(()=>{A.current=i,N.current=e,R.current=r,z.current=l.save,L.current=l.prepareFinalSave});const H=p.useCallback(k=>{Y.getState().canvasSessionId===m.current&&(R.current({...N.current,content:k}),z.current(k))},[]),x=p.useCallback(k=>{var T;a(k),A.current=k,(T=B.current)==null||T.cancel(),B.current=L.current(k),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,H(k)},fo)},[H]),I=()=>{m.current=Y.getState().canvasSessionId,a(e.content),s(!0),o(t,!0)},M=()=>{v.current&&(clearTimeout(v.current),v.current=null,H(A.current)),s(!1),o(t,!1)};p.useEffect(()=>{var k;f&&c!==m.current&&(v.current&&(clearTimeout(v.current),v.current=null),(k=B.current)==null||k.cancel(),B.current=null,s(!1),o(t,!1))},[c,f,t,o]),p.useEffect(()=>{var k;!n||f||(v.current&&clearTimeout(v.current),v.current=null,(k=B.current)==null||k.cancel(),B.current=null)},[f,n]),p.useEffect(()=>()=>{var k,T;v.current&&(clearTimeout(v.current),v.current=null,Y.getState().canvasSessionId===m.current&&R.current({...N.current,content:A.current})),Y.getState().canvasSessionId===m.current?(k=B.current)==null||k.flush():(T=B.current)==null||T.cancel(),B.current=null,o(t,!1)},[H,t,o]);const W=()=>{const k=l.adoptDisk();k!=null&&(r({...e,content:k}),a(k))},j=()=>{l.overwrite(A.current)},O=ho(l.status);return h.jsxs("div",{className:"relative flex h-full flex-col",children:[h.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[g&&O&&h.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:O}),g&&h.jsx(it,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:f?M:I,"aria-label":f?"Finish editing":"Edit document",children:f?h.jsx(Or,{className:"size-4"}):h.jsx(Er,{className:"size-4"})})]}),l.status==="conflict"&&h.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:[h.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),h.jsx(it,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:W,children:"Reload"}),h.jsx(it,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:j,children:"Overwrite"})]}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(p.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:h.jsx(lo,{value:f?i:e.content,editable:f,onChange:f?x:void 0,wikiLinks:b})})})]})}function mo({content:e}){return h.jsx("div",{className:"p-4 font-mono text-sm",children:h.jsx(Vr,{value:e.data,depth:0})})}const go=20;function Vr({value:e,depth:t,keyName:r}){const[n,s]=p.useState(t>2),i=p.useCallback(()=>s(d=>!d),[]);if(t>=go)return h.jsx(We,{keyName:r,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return h.jsx(We,{keyName:r,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return h.jsx(We,{keyName:r,value:String(e),className:"text-blue-500"});if(typeof e=="number")return h.jsx(We,{keyName:r,value:String(e),className:"text-green-500"});if(typeof e=="string")return h.jsx(We,{keyName:r,value:`"${e}"`,className:"text-amber-500"});const a=Array.isArray(e),c=a?e.map((d,f)=>[String(f),d]):Object.entries(e),o=a?"[":"{",u=a?"]":"}";return h.jsxs("div",{style:{paddingLeft:t>0?16:0},children:[h.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:[h.jsx(Tn,{className:Bt("size-3 transition-transform",!n&&"rotate-90")}),r!=null&&h.jsxs("span",{className:"text-foreground",children:[r,": "]}),h.jsxs("span",{className:"text-muted-foreground",children:[o,n&&` … ${c.length} items `,n&&u]})]}),!n&&h.jsxs(h.Fragment,{children:[c.map(([d,f])=>h.jsx(Vr,{keyName:a?void 0:d,value:f,depth:t+1},d)),h.jsx("div",{className:"text-muted-foreground",children:u})]})]})}function We({keyName:e,value:t,className:r}){return h.jsxs("div",{style:{paddingLeft:16},children:[e!=null&&h.jsxs("span",{className:"text-foreground",children:[e,": "]}),h.jsx("span",{className:r,children:t})]})}const vo=/^\/api\/rooms\/([A-Za-z0-9][A-Za-z0-9._-]*)\/canvas\/media\/([0-9a-f]{16}-[0-9a-f]{64}(?:\.[a-z0-9]{1,10})?)$/;function Jr(e,t){const r=vo.exec(e.trim());return r?t===void 0||r[1]===t:!1}const bo=new Set(["http:","https:"]);function yo(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const wo={image:"data:image/",pdf:"data:application/pdf"};function Xr(e,t,r){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(wo[t])?{url:n,error:null}:{url:null,error:"unsupported-data"};if(Jr(n))return{url:n,error:null};const s=yo(n);if(s!==null)return bo.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 Zr(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 xo({content:e}){const t=ae(),r=Y(d=>d.selectedCwd),n=p.useMemo(()=>Xr(e.src,"image",d=>t.mediaUrl(r??"",d)),[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 d=n.error?Zr(n.error,"image"):"";return h.jsx(Cr,{children:d})}const u=n.url;return h.jsxs("div",{className:"bg-muted/40 relative flex h-full items-center justify-center",children:[s==="loading"&&h.jsx("p",{className:"text-muted-foreground absolute text-sm","aria-live":"polite",children:"Loading image…"}),s==="error"?h.jsx(Cr,{children:"This image couldn’t be loaded."}):h.jsxs(zn,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[h.jsx(ko,{}),h.jsx(qn,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:h.jsx("img",{src:u,alt:o,onLoad:()=>i("loaded"),onError:()=>i("error"),className:Bt("max-h-full max-w-full object-contain transition-opacity",s==="loaded"?"opacity-100":"opacity-0")})})]})]})}function ko(){const{zoomIn:e,zoomOut:t,resetTransform:r}=Ln();return h.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[h.jsx(Ot,{label:"Zoom in",onClick:()=>e(),children:h.jsx(Hn,{className:"size-4"})}),h.jsx(Ot,{label:"Zoom out",onClick:()=>t(),children:h.jsx(Gn,{className:"size-4"})}),h.jsx(Ot,{label:"Reset zoom",onClick:()=>r(),children:h.jsx($n,{className:"size-4"})})]})}function Ot({label:e,onClick:t,children:r}){return h.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 Cr({children:e}){return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:e})})}function Co({content:e}){const t=ae(),r=Mn().data,n=Y(o=>o.selectedCwd),s=p.useMemo(()=>Xr(e.src,"pdf",o=>t.mediaUrl(n??"",o)),[e.src,t,n]);if(s.url===null){const o=s.error?Zr(s.error,"pdf"):"";return h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.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"?h.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[h.jsx("p",{children:"PDFs download here instead of opening."}),h.jsxs("a",{href:i,download:!0,className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Download ",a]})]}):h.jsx("object",{data:i,type:"application/pdf",title:a,className:"h-full w-full",children:h.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[h.jsx("p",{children:"This PDF can’t be shown here."}),h.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 jo(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const Ro=new Set(["http:","https:","data:"]);function Yr(e,t,r){const n=e.trim();if(Jr(n))return{url:n};const s=jo(n);return s!==null?Ro.has(s)?s==="data:"&&r!==void 0?n.toLowerCase().startsWith(r)?{url:n}:{url:null}:{url:n}:{url:null}:{url:t(n)}}function Oo({content:e}){const t=ae(),r=Y(i=>i.selectedCwd),n=p.useMemo(()=>Yr(e.src,i=>t.mediaUrl(r??"",i),"data:audio/"),[e.src,t,r]),s=e.title??"Canvas audio";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This audio can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center p-8",children:h.jsx("audio",{controls:!0,src:n.url,"aria-label":s,className:"w-full max-w-2xl",children:h.jsxs("p",{className:"text-muted-foreground text-sm",children:["Your browser can’t play this audio."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function Eo({content:e}){const t=ae(),r=Y(i=>i.selectedCwd),n=p.useMemo(()=>Yr(e.src,i=>t.mediaUrl(r??"",i),"data:video/"),[e.src,t,r]),s=e.title??"Canvas video";return n.url===null?h.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:h.jsx("p",{children:"This video can’t be played here."})}):h.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center",children:h.jsx("video",{controls:!0,src:n.url,"aria-label":s,className:"max-h-full w-full max-w-full object-contain",children:h.jsxs("p",{className:"text-muted-foreground p-8 text-sm",children:["Your browser can’t play this video."," ",h.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",s]}),"."]})})})}function Qr({content:e,documentId:t,channel:r}){const[n]=Lt(),s=Pn(e.definition),i=p.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return h.jsx("div",{className:"p-4",children:s.ok?h.jsx(Bn,{channel:r,document:s.document,sessionId:n??void 0},r?t??r.documentId:i):h.jsx(Un,{error:s.error,raw:s.raw})})}function So({content:e}){const[t]=Lt();return t?h.jsx("div",{className:"h-full w-full",children:h.jsx(Wn,{sessionId:t,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const _o=p.lazy(()=>_e(()=>import("./CanvasFileContent-BThy5fjD.js"),__vite__mapDeps([6,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])).then(e=>({default:e.CanvasFileContent}))),Do=p.lazy(()=>_e(()=>import("./CanvasModel3dContent-BbgR73jh.js"),__vite__mapDeps([23,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])).then(e=>({default:e.CanvasModel3dContent}))),Io=p.lazy(()=>_e(()=>import("./CanvasCsvContent-CtLpZnTs.js"),__vite__mapDeps([24,1,2,25,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])).then(e=>({default:e.CanvasCsvContent}))),Ao=p.lazy(()=>_e(()=>import("./index-OQuvRZTD.js").then(e=>e.vA),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function Zo({documentId:e,widgetChannel:t,content:r,onContentChange:n}){switch(r.type){case"url":case"browser":return h.jsx(Pi,{documentId:e,content:r},`${e}:${r.url}`);case"markdown":return h.jsx(po,{documentId:e,content:r,onContentChange:n},r.sourcePath??"generated");case"json":return h.jsx(mo,{content:r});case"image":return h.jsx(xo,{content:r});case"pdf":return h.jsx(Co,{content:r});case"audio":return h.jsx(Oo,{content:r});case"video":return h.jsx(Eo,{content:r});case"widget":return t?h.jsx(Qr,{content:r,documentId:e,channel:t}):h.jsx(No,{documentId:e,content:r});case"mcp_app":return h.jsx(So,{content:r});case"file":return h.jsx(p.Suspense,{fallback:h.jsx(st,{}),children:h.jsx(_o,{documentId:e,content:r})});case"model3d":return h.jsx(p.Suspense,{fallback:h.jsx(st,{}),children:h.jsx(Do,{content:r})});case"csv":return h.jsx(p.Suspense,{fallback:h.jsx(st,{}),children:h.jsx(Io,{content:r})});case"diff":return h.jsx(p.Suspense,{fallback:h.jsx(st,{}),children:h.jsx(Ao,{documentId:e,content:r},r.sourcePath)})}}function st(){return h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function No({documentId:e,content:t}){const{channel:r}=Wr(e);return h.jsx(Qr,{documentId:e,content:t,channel:r})}const To=p.lazy(()=>_e(()=>import("./BlintzCanvas-DruVZcDU.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas})));function Yo({roomId:e,document:t,content:r,onSave:n}){const[s,i]=p.useState(null),[a,c]=p.useState(!1),[o,u]=p.useState(null),d=s!==null,f=r.sourcePath===void 0;yi(e,d?t.id:null);const l=async()=>{if(s===null)return;if(s===r.content){i(null),u(null);return}c(!0),u(null);const g=await n(t.id,{...r,content:s});c(!1),g?i(null):u("Couldn’t save. Your words are still here. Try again.")};return h.jsxs("div",{className:"flex h-full flex-col",children:[f&&h.jsxs("div",{className:"flex items-center justify-end gap-2 border-b px-2 py-1",children:[d&&h.jsx("span",{className:"text-muted-foreground text-xs",children:a?"Saving…":"Everyone sees your save."}),h.jsx(it,{type:"button",size:"xs",variant:"ghost",disabled:a,"aria-label":d?"Save for the room":"Edit this document",onClick:()=>d?void l():i(r.content),children:d?h.jsx(Or,{className:"size-3.5"}):h.jsx(Er,{className:"size-3.5"})})]}),o!==null&&h.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:o}),h.jsx("div",{className:"flex-1 px-2 pb-6",children:h.jsx(p.Suspense,{fallback:h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"}),children:h.jsx(To,{value:s??r.content,editable:d,onChange:i},d?"editing":`rev-${t.rev}`)})})]})}const qt="dorkos-canvas-sessions",Mo=1440*60*60*1e3;function Kr(){try{const e=localStorage.getItem(qt);if(!e)return null;const t=JSON.parse(e);return t===null||typeof t!="object"?null:t}catch{return null}}function en(e){try{Object.keys(e).length===0?localStorage.removeItem(qt):localStorage.setItem(qt,JSON.stringify(e))}catch{}}function Fo(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 mt(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(mt).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)}:${mt(n)}`).join(",")}}`}function zo(e,t){const r=new Set,n=new Map;for(const i of e){const a=rr(i.content);if(a!==null){r.add(a);continue}const c=mt(i.content);n.set(c,(n.get(c)??0)+1)}const s=[];for(const i of t){const a=rr(i);if(a!==null){r.has(a)||s.push(i);continue}const c=mt(i),o=n.get(c)??0;o>0?n.set(c,o-1):s.push(i)}return s}const at=new Set;function Qo(){at.clear()}function Ko(e,t={}){const r=ae(),n=t.canonical??!0;p.useEffect(()=>{e&&Y.getState().loadCanvasForSession(e)},[e]),p.useEffect(()=>{if(!e||!n||at.has(e))return;const s=Kr();if(!s)return;const i=s[e];if(!i){qo(s);return}at.add(e),(async()=>{try{const a=Fo(i),c=zo(await r.listSessionCanvas(e),a);if(c.length===0){jr(e);return}for(const o of c)await r.openSessionCanvasDocument(e,o);jr(e),Y.getState().hydrateCanvasFromSnapshot(e,await r.listSessionCanvas(e))}catch{at.delete(e)}})()},[e,n,r])}function jr(e){const t=Kr();if(!t)return;const{[e]:r,...n}=t;en(n)}function qo(e){const t=Date.now()-Mo,r=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=t);r.length!==Object.keys(e).length&&en(Object.fromEntries(r))}export{Zo as C,Jo as F,Yo as R,no as a,Wr as b,bi as c,vi as d,Xo as e,Qr as f,Qo as g,cs as h,Jr as i,Ko as j,Yr as r,uo as u};
|