dorkos 0.124.1 → 0.125.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1418 -956
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DHaZvsJE.js → AboutPage-DNNSr3b2.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BP-qFk2S.js → ActivityErrorState-CXDzOpkQ.js} +1 -1
- package/dist/client/assets/{ActivityPage-Bme3TzdQ.js → ActivityPage-BXp-o5SB.js} +1 -1
- package/dist/client/assets/{ActivityRow-BRZyW9MA.js → ActivityRow-DDhj9QxV.js} +1 -1
- package/dist/client/assets/{AdapterIcon-BcfquTja.js → AdapterIcon-CXXdDfkv.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-B4I23pBg.js → AdapterSetupWizard-BLljbUjj.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-Cb34LtmH.js → AgentOptionRow-BcNFNeXa.js} +1 -1
- package/dist/client/assets/{AgentPicker-ouNRFSDh.js → AgentPicker-D4o66W3h.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-B6MHIsxa.js → AgentRequestCard-C6aBR2TD.js} +4 -4
- package/dist/client/assets/{AppearancePage-CutehigK.js → AppearancePage-BbXPYAzg.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-B-wIUI27.js → ApplyToOverridesDialog-DG2dhgC7.js} +1 -1
- package/dist/client/assets/AttentionSignalRow-DQpV3YrI.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BZReuFC7.js} +3 -3
- package/dist/client/assets/{BindingDialog-BAdueON5.js → BindingDialog-dKfunEtT.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-b30dG4gx.js → BlintzCanvas-D4mpLc0Z.js} +4 -4
- package/dist/client/assets/{CanvasCsvContent-DGHgSikG.js → CanvasCsvContent-DgUpsa5s.js} +4 -4
- package/dist/client/assets/CanvasFileContent-CfHHO1iy.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-BZBPeTnP.js +2 -0
- package/dist/client/assets/ChannelComposer-Fmb-x_zK.js +44 -0
- package/dist/client/assets/{ChatAppsOff-DiObvmJS.js → ChatAppsOff-B8Afyn-8.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-BncI1OY1.js → CodeMirrorDiff-046sCUyi.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-DV6psv19.js → CodeMirrorEditor-gqpifORb.js} +1 -1
- package/dist/client/assets/{CommitmentList-Dx_Ek_Gl.js → CommitmentList-DIO5Qd5w.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-Bca8NMUa.js → CommitmentsPage-DDYSjVdN.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-DNVNFTdn.js → ComputerResourceView-nLfGu6HH.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D8SxJdMm.js → ComputerViewer-Cmw-5KwO.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-Bhj1YT15.js → ConnectionAccessLists-DNjf06tk.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-B20JZxoK.js → ConnectionsPage-Cshv0nqL.js} +2 -2
- package/dist/client/assets/{ConventionPage-De645wxU.js → ConventionPage-CWpUQZsc.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-nTeiOBRQ.js → ExtensionPageRoute-D4d8hWqD.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js → FloatingTanStackRouterDevtools-CqogiFob-D8MtiBS3.js} +1 -1
- package/dist/client/assets/HandlePage-BFp054RW.js +1 -0
- package/dist/client/assets/{HeartbeatPage-CBoUxz6t.js → HeartbeatPage-DcQd3crO.js} +1 -1
- package/dist/client/assets/{KeyEntry-Cug8ocpX.js → KeyEntry-B1M6Cb_W.js} +1 -1
- package/dist/client/assets/{LexicalField-Bv_ogmAq.js → LexicalField-DglxKbVV.js} +2 -2
- package/dist/client/assets/{ManagesPage-DfJBQKK3.js → ManagesPage-CHnWwBcn.js} +1 -1
- package/dist/client/assets/{Marketplace-swCVUbdY.js → Marketplace-nlAKYRdC.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-CDZDChpV.js → MarketplaceSourcesView-Co53MiW9.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BM9cNPPd.js → McpAppFrame-L2zafUSH.js} +1 -1
- package/dist/client/assets/{McpSigninBody-DKyUKrEE.js → McpSigninBody-DRxPP8Zc.js} +1 -1
- package/dist/client/assets/{Model3dViewer-rXSL5y2P.js → Model3dViewer-Bjxhkabj.js} +1 -1
- package/dist/client/assets/NamePage-CaA8-GZa.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-GCEMS5oV.js → NewDirectMessageMenu-BjCp-d3D.js} +1 -1
- package/dist/client/assets/{NotificationsPage-DSWsOVLa.js → NotificationsPage-DwkL4gtE.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BTuctDj4.js → OpenMeshSwitch-BLE-N5Jb.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-ODDMd2YN.js → OperatorIdentityForm-Bl5rL-MI.js} +1 -1
- package/dist/client/assets/{PermissionHistory-41a58Se7.js → PermissionHistory-T4I64dJP.js} +1 -1
- package/dist/client/assets/{PermissionsPage-DefmymZ6.js → PermissionsPage-CU2ztV8O.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-7zPVBI1I.js → PersonalityPopover-A50oTbpT.js} +1 -1
- package/dist/client/assets/PhotoPage-B-aM0VI7.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CwGlBJ7U.js → PreviewRefusedNotice-B6hvUBqt.js} +1 -1
- package/dist/client/assets/ProfileFields-BIDZHo11.js +1 -0
- package/dist/client/assets/{ProfilePanelContainer-RrhoPD3T.js → ProfilePanelContainer-IHMOmga2.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-CXRVBCAu.js → ProfileRolePicker-Bg_Tf8eF.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-bBroJdTi.js → PromptSuggestionChips-BItU6w6K.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-CfPatsWM.js → ReportsToPopover-CohliF94.js} +1 -1
- package/dist/client/assets/RoomSurface-CAbD4wVy.js +1 -0
- package/dist/client/assets/{RoomsPage-C3dDp1Mb.js → RoomsPage-D8kdi2T4.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-BcKjfQi-.js → RunsOnPopover-BCCxm2Mk.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-CXAcX8bE.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-Bg-0b-LC.js → RuntimeSetupDialog-Cof6tku2.js} +1 -1
- package/dist/client/assets/SeenDevices-DVjFyFfQ.js +19 -0
- package/dist/client/assets/{SessionsPage-Cqfx4FGW.js → SessionsPage-DkThEA16.js} +1 -1
- package/dist/client/assets/SettingsDialog-DqaBWDI4.js +12 -0
- package/dist/client/assets/{SkillsPage-BleHQavF.js → SkillsPage-D8eM04tW.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-b6z6wcEV.js +1 -0
- package/dist/client/assets/{TasksEmptyState-Bprx1k8M.js → TasksEmptyState-D4XWi20k.js} +2 -2
- package/dist/client/assets/{TasksPage-Dub39yEJ.js → TasksPage-TK0pCu-r.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CJ-NG0u5.js → TeamComputerEntry-BxNRBuRo.js} +1 -1
- package/dist/client/assets/{ToolsPage-IsD6M-ZW.js → ToolsPage-DpcUQDHa.js} +2 -2
- package/dist/client/assets/TopologyGraph-CFdwWKhT.js +30 -0
- package/dist/client/assets/{TourHost-BYfztuPb.js → TourHost-CViLk6JM.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BKhgxVdF.js → UnlinkDialog-CHiFjqy9.js} +1 -1
- package/dist/client/assets/UnreadDivider-CNjRFpAY.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-1NyzIJBj.js → WidgetErrorCard-D9LKAbNg.js} +3 -3
- package/dist/client/assets/WorkView-CDLKDo74.js +63 -0
- package/dist/client/assets/_shell-x_WZg6D7.js +80 -0
- package/dist/client/assets/{_shell._home-xWj7wO5z.js → _shell._home-eVhoIWNB.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BqcLoaB1.js → _shell._home.activity-Btyz_JXC.js} +1 -1
- package/dist/client/assets/_shell._home.index-mdspCjhm.js +3 -0
- package/dist/client/assets/{_shell._home.tasks--UhQB6h3.js → _shell._home.tasks-C1zBEy4f.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BPFD8Of2.js → _shell._home.workspaces-B7eLLMZo.js} +1 -1
- package/dist/client/assets/{_shell.channels-CnFdvRzc.js → _shell.channels-KC-oi383.js} +4 -4
- package/dist/client/assets/{_shell.connections-Ik01wS5M.js → _shell.connections-FwwnIiVq.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-Czu42kzo.js → _shell.feedback-requests-BiagdWVc.js} +1 -1
- package/dist/client/assets/_shell.marketplace-D5vPAK8b.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DKXolkMK.js +1 -0
- package/dist/client/assets/_shell.session-CRLQUxCR.js +1 -0
- package/dist/client/assets/{_shell.team-UfaJqohh.js → _shell.team-B3A__-1w.js} +5 -5
- package/dist/client/assets/_shell.threads-C-eFVUo7.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-Cy2JYMPv.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-Cy2JYMPv.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-oxkfGyl6.js → abnfDiagram-WEYOIA3C-RjxMmLSp.js} +1 -1
- package/dist/client/assets/{access-copy-Dggxx2cX.js → access-copy-robDo1S-.js} +1 -1
- package/dist/client/assets/{arc-CqQdP0Qe.js → arc-De3porJy.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-89xM7zJD.js → architectureDiagram-ZHVYKT53-U4UN3Fwb.js} +2 -2
- package/dist/client/assets/{banner-DqJ2pM0Y.js → banner-Bb9qmJFV.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CcxwDmZC.js → blockDiagram-RJAE7QA3-CckMUzCn.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DCIhIyXa.js → c4Diagram-XDPPPE54-4IXkmK3u.js} +1 -1
- package/dist/client/assets/{card-DT-vFAns.js → card-CHG8Y8EA.js} +1 -1
- package/dist/client/assets/channel-DT-ECQUE.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BfWEXcCj.js → chunk-2E7WHVMD-DtPOfWfp.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-KLXLZXlR.js → chunk-2Q5K7J3B-Dk44yc47.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CL5Gttmj.js → chunk-4EMNKR2T-K_Oa4h2U.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-cfAl84Mv.js → chunk-55XCU76K-CBCR5VUz.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BqUyGgoH.js → chunk-5VM5RSS4-o7pQ4Ip8.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BWr2ST9i.js → chunk-JWPE2WC7-DnjGyJd7.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-V5zYx50O.js → chunk-VQ5W62QI-C2_U7FnB.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-gnvheN_J.js → chunk-XXDRQBXY-BEWhI2hh.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-ClGxxZvV.js → chunk-ZCHMQSOR-B4HhT1sq.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DvmHzDb5.js → classDiagram-v2-4MYWR3UA-DhCJ3JPo.js} +1 -1
- package/dist/client/assets/{command-CNx4L11m.js → command-BiVO_CS1.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Df8nXBRj.js → cose-bilkent-JH36ORCC-xZpEDSd4.js} +1 -1
- package/dist/client/assets/{cpu-D8KJEkdh.js → cpu-DDZTaXtb.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CAn6ufHs.js → cynefin-EF2NZ3EQ-Cgz_Z2on.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Cep_NrRw.js → cynefinDiagram-WF24UDRP-BJFrcql_.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-sWD3z9wf.js → dagre-NK4GIZVX-BYAx5Cie.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-CUpaBATr.js → diagram-CBK3MWTC-DZ9R9gqz.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BejWB2ry.js → diagram-I5XIIV2D--bivdwUI.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BGKJfNk9.js → diagram-ODIL2UCW-9hvkubLT.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-V0dP8H8k.js → diagram-PFBEJUXE-hVLmub11.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-Bf5dVsFX.js → diagram-RJA3I4VV-BB5ttZ9z.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-CLrMSqb4.js → diagram-TYUNFSNR-B_FkQUUF.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BGG4CWA0.js → ebnfDiagram-V4P3TTPT-TS7ZNoLc.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-bf9D6f0w.js → elk-QONTBCTQ-BRCKNiM7.js} +1 -1
- package/dist/client/assets/{empty-state-CDoXnrKn.js → empty-state-BO-UXPQj.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-fEUv-33P.js → erDiagram-KYQIGQAA-DycIeIib.js} +1 -1
- package/dist/client/assets/{execution-config-Ca9MDOtV.js → execution-config-DEYWqx9f.js} +1 -1
- package/dist/client/assets/{file-CiyVL55_.js → file-DQJ4ncBH.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DaFRIKco.js → file-exclamation-point-3K4for51.js} +1 -1
- package/dist/client/assets/{file-text-DsnD-A8g.js → file-text-3tteNtIM.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-CNsnCgbB.js → find-latest-widget-fence-C2e-pGhG.js} +2 -2
- package/dist/client/assets/{flowDiagram-IUGLLWBU-CRbeSDod.js → flowDiagram-IUGLLWBU-4-MVKKj-.js} +1 -1
- package/dist/client/assets/{form-Cru78aT-.js → form-DJvcnZrN.js} +1 -1
- package/dist/client/assets/{format-cron-9K38-tn1.js → format-cron-B6RtTy4x.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-Mkk7zgs_.js → ganttDiagram-R7GPNTJY-DXZ9M_09.js} +3 -3
- package/dist/client/assets/{git-branch-CONwEYiR.js → git-branch-B5MdRp1u.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-Drre0vyA.js → gitGraphDiagram-PDYL7XHY-CXZBvZz1.js} +1 -1
- package/dist/client/assets/{graph-BJlnKWgo.js → graph-Ok4GTm1i.js} +1 -1
- package/dist/client/assets/{heart-CqwUlIUG.js → heart-WdIkTWht.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-e4LXC_pS.js → highlighted-body-KPVGNVTW-BnvI3qHd.js} +1 -1
- package/dist/client/assets/image-lightbox-DSFIEDOy.js +1 -0
- package/dist/client/assets/{image-off-DZuLkaRJ.js → image-off-SpOmtTU2.js} +2 -2
- package/dist/client/assets/{index-DzwZJuO1.js → index-0TLaDwd7.js} +1 -1
- package/dist/client/assets/index-5kYaIjI6.js +1 -0
- package/dist/client/assets/{index-BTjZIgFn.js → index-8N601Ptt.js} +1 -1
- package/dist/client/assets/{index-BKp2B9JS.js → index-B5tjSdoa.js} +1 -1
- package/dist/client/assets/index-BAAZ_Afo.js +1 -0
- package/dist/client/assets/{index-x1yAu9zJ.js → index-BAP0wpId.js} +1 -1
- package/dist/client/assets/{index-CyVH876g.js → index-BBfQSvDI.js} +1 -1
- package/dist/client/assets/index-BDJuvXMG.js +1053 -0
- package/dist/client/assets/index-BFyPYiSk.js +1 -0
- package/dist/client/assets/index-BHnCpgC9.js +1 -0
- package/dist/client/assets/{index-CVuEUzi5.js → index-BPEGncOX.js} +1 -1
- package/dist/client/assets/{index-DDNwNOHF.js → index-BUlGEVe6.js} +1 -1
- package/dist/client/assets/index-Beqi9bTa.js +43 -0
- package/dist/client/assets/{index-DL8ISRMH.js → index-BwZrircO.js} +1 -1
- package/dist/client/assets/{index-Bd7vUYhr.js → index-C1t_dxLe.js} +1 -1
- package/dist/client/assets/{index-vJy88bwb.js → index-CA3lyhQr.js} +1 -1
- package/dist/client/assets/index-CGvU4pGg.js +23 -0
- package/dist/client/assets/{index-B_0LYi32.js → index-CO8DgOi_.js} +1 -1
- package/dist/client/assets/{index-1yEXEZiH.js → index-CS1S0apl.js} +1 -1
- package/dist/client/assets/{index-DAlpmAIA.js → index-CXyeZWZE.js} +1 -1
- package/dist/client/assets/{index-DijWcSDZ.js → index-C_mZH9d1.js} +3 -3
- package/dist/client/assets/{index-A41zxoWk.js → index-CebrNsDE.js} +1 -1
- package/dist/client/assets/{index-B25gvCK_.js → index-CejscP7D.js} +1 -1
- package/dist/client/assets/{index-BtDxwJsM.js → index-CjNQaSIo.js} +1 -1
- package/dist/client/assets/{index-skAhJyIF.js → index-Cjqqoh6c.js} +1 -1
- package/dist/client/assets/{index-HR8BYVRQ.js → index-CzUbn74z.js} +1 -1
- package/dist/client/assets/index-D2ZFfqZZ.css +1 -0
- package/dist/client/assets/{index-DabU6r9W.js → index-D6y63gKa.js} +3 -3
- package/dist/client/assets/{index-BV2Ezdxv.js → index-D8KycDT8.js} +1 -1
- package/dist/client/assets/{index-Bo7x9IkO.js → index-DG-QaLdS.js} +1 -1
- package/dist/client/assets/index-DN4ppujx.js +1 -0
- package/dist/client/assets/{index-cI2u8WZS.js → index-DYc5kmwr.js} +1 -1
- package/dist/client/assets/{index-pVFjKNjX.js → index-DZ9FOOp-.js} +1 -1
- package/dist/client/assets/{index-BIB-maE5.js → index-DaAe-kkp.js} +1 -1
- package/dist/client/assets/{index-mZqojApH.js → index-DlJvYygP.js} +1 -1
- package/dist/client/assets/{index-BBmkfbXd.js → index-DncDh-DQ.js} +1 -1
- package/dist/client/assets/index-Dy7lfs5H.js +2 -0
- package/dist/client/assets/{index-DdJBZE0H.js → index-F1p3rnVP.js} +1 -1
- package/dist/client/assets/{index-By58MgcZ.js → index-PXtYLHfj.js} +1 -1
- package/dist/client/assets/{index-BFNy-Yp3.js → index-Uuq_anEw.js} +1 -1
- package/dist/client/assets/{index-BDD2EyoW.js → index-VsLUphXS.js} +1 -1
- package/dist/client/assets/{index-LEcodwyW.js → index-Z7RWysQU.js} +1 -1
- package/dist/client/assets/index-elechdSH.js +1 -0
- package/dist/client/assets/{index-Vz7VUm9l.js → index-mYbSzZYJ.js} +1 -1
- package/dist/client/assets/index-qqbs2gqN.js +1 -0
- package/dist/client/assets/{index.esm-BUPoRUaG.js → index.esm-Cl_dMJjM.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-B_Wyzufh.js → infoDiagram-MVDRKAX5-BLyKorfr.js} +1 -1
- package/dist/client/assets/{inline-code-BIzGDx6z.js → inline-code-hmEz0OM4.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js → ishikawaDiagram-HPEHV2GE-BrnGHajs.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-7qf9KWEQ.js → journeyDiagram-BOSHW7O7-BQft6X3_.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-CFYDQmXn.js → kanban-definition-FNSA4HC5-l4Lwd6a7.js} +1 -1
- package/dist/client/assets/{layers-C9tVVcXg.js → layers-DHQ_aTAp.js} +1 -1
- package/dist/client/assets/{lightbulb-f4jtsAh0.js → lightbulb-qcE7kdo5.js} +1 -1
- package/dist/client/assets/{link-2-ZNlK1BG1.js → link-2-DBDnK6MQ.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CqO-QFYD.js → list-runtime-types-CaJn2_14.js} +1 -1
- package/dist/client/assets/{markdown-content-DaEVxezf.js → markdown-content-NzXgwE2G.js} +1 -1
- package/dist/client/assets/{mention-pill-BiCPflY-.js → mention-pill-CumFsu3I.js} +1 -1
- package/dist/client/assets/{mermaid.core-SX8SzrsU.js → mermaid.core-DP7EozpQ.js} +4 -4
- package/dist/client/assets/{message-square-off-_qbedNGF.js → message-square-off-Zgzm0pcy.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-BloJIArH.js → mindmap-definition-6OY57UG3-DXfFlXJZ.js} +1 -1
- package/dist/client/assets/{more-details-CdJT0Ehl.js → more-details-XSn-_PbH.js} +1 -1
- package/dist/client/assets/{owner-notice-BDafFD_I.js → owner-notice-C0ArQJdp.js} +1 -1
- package/dist/client/assets/{package-Cb7lEm7t.js → package-DAjaMh-O.js} +1 -1
- package/dist/client/assets/{page-container-DsRgIMAL.js → page-container-CGXX9atD.js} +1 -1
- package/dist/client/assets/pane-resize-handle-DAB3TvrY.js +1 -0
- package/dist/client/assets/{paperclip-DNu1VtoX.js → paperclip-C6yKmauj.js} +1 -1
- package/dist/client/assets/{path-input-D3O71b-X.js → path-input-mDIpl2-x.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Di48kPNu.js → pegDiagram-ECIUJNBX-PjvGQ3d5.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DY8B_SPD.js → pieDiagram-GNMPY74T-BRtspcrq.js} +1 -1
- package/dist/client/assets/{plug-IIS_cL9-.js → plug-BEjxxorV.js} +1 -1
- package/dist/client/assets/primer-trigger-BiiSNY7s.js +3 -0
- package/dist/client/assets/profile-errors-XchEnatB.js +1 -0
- package/dist/client/assets/{progress-g5kkqvlR.js → progress-BF25Vgvc.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-Depv_dON.js → quadrantDiagram-D57K4MC3--heUvlvX.js} +1 -1
- package/dist/client/assets/{query-error-state-PuLGD7Jp.js → query-error-state-C2EyJ_cl.js} +1 -1
- package/dist/client/assets/{radio-QOLZSBz1.js → radio-BTlBepzs.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-BfD2AiZM.js → railroadDiagram-Y72NRBL7-DI8BFDIm.js} +1 -1
- package/dist/client/assets/registry-ZygbjV-M.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DF_DfZ7s.js → relay-trace-schemas-V7JmDMFe.js} +2 -2
- package/dist/client/assets/repeat-Dl9Z6gcw.js +11 -0
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-B1iTjrkD.js → requirementDiagram-EQYSW5RA-BocwQwBX.js} +1 -1
- package/dist/client/assets/{room-files-source-g1th8mWs.js → room-files-source-4I4JJamw.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-BGwYMaGL.js → rotate-ccw-clock-Cvx7qMiL.js} +1 -1
- package/dist/client/assets/{rotate-cw-B4Y0q4GY.js → rotate-cw-BS2tU5V-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-D5TzVJrQ.js → sankeyDiagram-SY24JHO5-ezcikI89.js} +1 -1
- package/dist/client/assets/{scroll-area-BvScZKSa.js → scroll-area-CkX9hs5p.js} +1 -1
- package/dist/client/assets/{search-x-CqN5twBj.js → search-x-BqiSsIfJ.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BhUahaNf.js → sequenceDiagram-BLEHNHQU-CoGhkN3M.js} +1 -1
- package/dist/client/assets/{shield-x-DHJrwtKp.js → shield-x-DxL97yUb.js} +1 -1
- package/dist/client/assets/signed-in-BPaLzWUS.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-D2Vi1Kq9.js → sizeCapture-INFHLROL-CqWfeZMY.js} +1 -1
- package/dist/client/assets/{soul-file-BMpVFN7U.js → soul-file-BgdRcA9b.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-b9gSbZnF.js → stateDiagram-v2-A6IESKWZ-FWPmI7hi.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-i47jxLY6.js → swimlanes-B3ENRKFQ-BmnK0GaI.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CPB9ed5R.js +8 -0
- package/dist/client/assets/{table-CN2HCi4p.js → table-C5zpnw52.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-eY5gj0js.js → timeline-definition-JXYKGLGB-BJRYVT6z.js} +1 -1
- package/dist/client/assets/{trust-posture-Bcyy5Fub.js → trust-posture-DxR7JKit.js} +1 -1
- package/dist/client/assets/{unplug-lkD35Rwp.js → unplug-Cbp9pPvY.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DiCIrrhU.js → unverified-catalog-notice-v-qMrtTV.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-BrqVd-47.js → use-adapter-catalog-B3wTq44G.js} +1 -1
- package/dist/client/assets/{use-bindings-CU2RSXOy.js → use-bindings-BAKvriCK.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-Dy2oTM8Y.js → use-composer-prefs-BLOdXw95.js} +1 -1
- package/dist/client/assets/{use-connector-management-5oRqzydY.js → use-connector-management-CApx-e1Z.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bg5nW8qq.js → use-deep-link-scroll-DjC3PUqZ.js} +1 -1
- package/dist/client/assets/{use-delete-binding-qeyRkvR1.js → use-delete-binding-DIu3LTuB.js} +1 -1
- package/dist/client/assets/{use-dev-links-FY4J_PjA.js → use-dev-links-D5AXy-P_.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-CzUy0Vi1.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-HiWFZZrW.js → use-external-adapter-catalog-CzMLWn_7.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-K1uk9Wya.js → use-full-activity-feed-Ce5XvGGR.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-OolRlRyZ.js +1 -0
- package/dist/client/assets/use-is-hub-CCn7X2nA.js +1 -0
- package/dist/client/assets/{use-local-browser-CTFiF0wf.js → use-local-browser-Bw7S_z6h.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CafidaIH.js → use-mesh-topology-42Fa1F-V.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-B38uSLCx.js → use-mounted-ref-NbCy8N-y.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-m9XSNB6W.js → use-notification-prefs-DAokZCgt.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-D9n6rNJ1.js → use-panel-tab-placements-Dbjj1FO5.js} +1 -1
- package/dist/client/assets/use-pending-read-BBA4gaxj.js +1 -0
- package/dist/client/assets/{use-personality-commit-ChLQfLrK.js → use-personality-commit-mY_GJ7u5.js} +1 -1
- package/dist/client/assets/{use-promo-activation-DbJDgp4_.js → use-promo-activation-CzAU3S9F.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-Csw0j0N0.js → use-promo-dismissals-gDFH0Uhg.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BIZ7daHW.js → use-pulse-freshness-C6m4sn2E.js} +1 -1
- package/dist/client/assets/{use-relay-config-hUB3lVFv.js → use-relay-config-COZDw_jc.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BpKzhniV.js → use-room-follow-claim-CTPdEUnW.js} +1 -1
- package/dist/client/assets/use-room-sessions-DiysSClf.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-BtM0bZL7.js → use-roving-tab-list-PltEsGcU.js} +1 -1
- package/dist/client/assets/use-session-canvas-pL8waI_Q.js +27 -0
- package/dist/client/assets/use-status-budget-D-MyG_Pd.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-BbMZtNG9.js → use-unclaimed-chats-BrLVSVmS.js} +1 -1
- package/dist/client/assets/use-update-config-Cjq60G6n.js +1 -0
- package/dist/client/assets/{useMutationState-CVpvw27W.js → useMutationState-BwG8hXiA.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-CHcpeLg4.js → usecaseDiagram-WPOLBNNX-57NgEVRV.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-gQbZL_A6.js → vennDiagram-Q3Y3IDCW-CRKzxbya.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BFH_WHzZ.js → wardleyDiagram-IVAIDKWA-wRMWM1mn.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-B0QpyqeZ.js → xychartDiagram-4URNHDU4-Bm6K2W58.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
- package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
- package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
- package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/extension-child.cjs +27 -1
- package/dist/server/index.js +12079 -9480
- package/dist/server/index.js.map +2 -2
- package/package.json +11 -11
- package/dist/client/assets/AttentionSignalRow-B1aMjgX_.js +0 -1
- package/dist/client/assets/CanvasFileContent-D1bFaUeh.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-dST7g1v2.js +0 -2
- package/dist/client/assets/HandlePage-B08V-om7.js +0 -1
- package/dist/client/assets/NamePage-JwMDK1JD.js +0 -1
- package/dist/client/assets/PhotoPage-DlOVhkW9.js +0 -1
- package/dist/client/assets/ProfileFields-DVMkpJSb.js +0 -1
- package/dist/client/assets/RoomSurface-CdgCdV6h.js +0 -44
- package/dist/client/assets/RuntimeConnectFlow-DCIRnvOH.js +0 -1
- package/dist/client/assets/SeenDevices-nMsGUQTv.js +0 -19
- package/dist/client/assets/SettingsDialog-C8r2igJ_.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-BhTEvf-u.js +0 -1
- package/dist/client/assets/TopologyGraph-CwyasvFI.js +0 -30
- package/dist/client/assets/_shell-Ct2Bz7D0.js +0 -80
- package/dist/client/assets/_shell._home.index-D4sQsKKk.js +0 -3
- package/dist/client/assets/_shell.marketplace-Cezv-i16.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +0 -1
- package/dist/client/assets/_shell.session-BjevHF_O.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +0 -1
- package/dist/client/assets/channel-Ngk70nQZ.js +0 -1
- package/dist/client/assets/image-lightbox-DHDtzoja.js +0 -1
- package/dist/client/assets/index-B9bZYNKR.js +0 -1
- package/dist/client/assets/index-BLP5O7X9.js +0 -1
- package/dist/client/assets/index-C3cvP8Fo.js +0 -1033
- package/dist/client/assets/index-CoWJD3Jg.js +0 -2
- package/dist/client/assets/index-D67Kfy-M.js +0 -1
- package/dist/client/assets/index-DyRGZyur.css +0 -1
- package/dist/client/assets/index-UPF8suf2.js +0 -1
- package/dist/client/assets/index-YW-v746p.js +0 -1
- package/dist/client/assets/index-iTQUa_b2.js +0 -23
- package/dist/client/assets/index-wY5OcS4a.js +0 -43
- package/dist/client/assets/index-xAgihCJ7.js +0 -1
- package/dist/client/assets/primer-trigger-DurKYe8C.js +0 -3
- package/dist/client/assets/profile-errors-BdhZfdvZ.js +0 -1
- package/dist/client/assets/registry-Ck8p6n1T.js +0 -1
- package/dist/client/assets/signed-in-BmywDpR5.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +0 -8
- package/dist/client/assets/terminal-BORQniao.js +0 -6
- package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +0 -1
- package/dist/client/assets/use-is-hub-BX7ypNRJ.js +0 -1
- package/dist/client/assets/use-jump-back-in-BjZ8EswV.js +0 -11
- package/dist/client/assets/use-pending-read-BoV-UI1E.js +0 -1
- package/dist/client/assets/use-session-canvas-DRrkNRcL.js +0 -25
- package/dist/client/assets/use-session-diagnostics-BTNgouum.js +0 -16
- package/dist/client/assets/use-update-config-CkWwKNkY.js +0 -1
- /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var Ye=Object.defineProperty;var Ke=(e,n,s)=>n in e?Ye(e,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[n]=s;var V=(e,n,s)=>Ke(e,typeof n!="symbol"?n+"":n,s);import{W as C,a1 as E,io as qe,r as p,aM as We,ip as oe,aK as Qe,j as t,hP as U,iq as Je,g as W,ir as Q,is as J,G as O,it as Xe,iu as Ze,X as et,iv as tt,B as N,dA as nt,ar as I,aN as st,iw as at,a2 as me,a3 as he,a4 as re,_ as ot,eN as rt,eO as it,ca as z,x as lt,by as ct,bz as dt,bA as ut,bC as mt,fu as ht,ix as pt,iy as ft,iz as xt,iA as gt,iB as vt,iC as ie,J as yt,h7 as pe,aW as b,iD as bt,iE as jt,iF as wt,a7 as le,iG as Nt,iH as Ct,iI as kt}from"./index-C3cvP8Fo.js";import{u as Rt}from"./use-roving-tab-list-BtM0bZL7.js";import{F as fe,c as Tt,d as ce,e as Et,R as At,C as xe}from"./use-session-canvas-DRrkNRcL.js";import{f as Xn,g as Zn,h as es,b as ts,i as ns}from"./use-session-canvas-DRrkNRcL.js";import{A as Dt}from"./McpAppFrame-BM9cNPPd.js";import{F as St}from"./file-CiyVL55_.js";import{F as ge}from"./file-text-DsnD-A8g.js";import{R as _t}from"./rotate-cw-B4Y0q4GY.js";import{u as It}from"./use-room-follow-claim-BpKzhniV.js";import{c as Ot,F as Mt}from"./room-files-source-g1th8mWs.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BUPoRUaG.js";import"./WidgetErrorCard-1NyzIJBj.js";import"./index-xAgihCJ7.js";import"./card-DT-vFAns.js";import"./progress-g5kkqvlR.js";import"./markdown-content-DaEVxezf.js";import"./table-CN2HCi4p.js";import"./terminal-BORQniao.js";import"./package-Cb7lEm7t.js";import"./heart-CqwUlIUG.js";import"./git-branch-CONwEYiR.js";import"./more-details-CdJT0Ehl.js";import"./file-exclamation-point-DaFRIKco.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ve={name:"box",size:24,node:[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]};ve.node;const zt=C(ve);/**
|
|
7
|
-
* @license lucide-react v1.48.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ye={name:"braces",size:24,node:[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],aliases:["curly-braces"]};ye.node;const be=C(ye);/**
|
|
12
|
-
* @license lucide-react v1.48.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const je={name:"file-headphone",size:24,node:[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]],aliases:["file-audio","file-audio-2"]};je.node;const Lt=C(je);/**
|
|
17
|
-
* @license lucide-react v1.48.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const we={name:"file-play",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]],aliases:["file-video"]};we.node;const Ft=C(we);/**
|
|
22
|
-
* @license lucide-react v1.48.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Ne={name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]};Ne.node;const $t=C(Ne);/**
|
|
27
|
-
* @license lucide-react v1.48.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Ce={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};Ce.node;const Ut=C(Ce);/**
|
|
32
|
-
* @license lucide-react v1.48.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const ke={name:"table",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]};ke.node;const Ht=C(ke);/**
|
|
37
|
-
* @license lucide-react v1.48.0 - ISC
|
|
38
|
-
*
|
|
39
|
-
* This source code is licensed under the ISC license.
|
|
40
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const Re={name:"waypoints",size:24,node:[["path",{d:"m10.586 5.414-5.172 5.172",key:"4mc350"}],["path",{d:"m18.586 13.414-5.172 5.172",key:"8c96vv"}],["path",{d:"M6 12h12",key:"8npq4p"}],["circle",{cx:"12",cy:"20",r:"2",key:"144qzu"}],["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["circle",{cx:"20",cy:"12",r:"2",key:"1xzzfp"}],["circle",{cx:"4",cy:"12",r:"2",key:"1hvhnz"}]]};Re.node;const Pt=C(Re);function Bt(e){const n=E(),{roomId:s,viewerAuthorId:o,documentId:l,url:m,readScrollY:i,subscribe:d}=e,a=qe(s,o),v=p.useRef({roomId:s,documentId:l,url:m,readScrollY:i});v.current={roomId:s,documentId:l,url:m,readScrollY:i};const f=p.useRef(null),u=p.useRef(0);p.useEffect(()=>{if(!a||s===null||l===null)return;const x=()=>{f.current=null,u.current=Date.now();const w=v.current;if(w.roomId===null||w.documentId===null)return;const R=w.roomId,B={documentId:w.documentId,...w.url!==void 0?{url:w.url}:{},...w.readScrollY?{scrollY:Math.max(0,Math.round(w.readScrollY()))}:{}};n.publishRoomView(R,B).then(G=>{!G.followed&&o!==null&&Qe.getState().noteNobodyFollowing(R,o)}).catch(()=>{})},j=()=>{if(f.current!==null)return;const w=Date.now()-u.current;if(w>=oe){x();return}f.current=setTimeout(x,oe-w)};j();const c=d==null?void 0:d(j),P=setInterval(j,We);return()=>{clearInterval(P),c==null||c()}},[n,a,s,o,l,m,d]),p.useEffect(()=>()=>{f.current!==null&&clearTimeout(f.current)},[])}const Gt={url:U,markdown:ge,json:be,image:Ut,pdf:St,widget:Je,mcp_app:Dt,file:fe,model3d:zt,audio:Lt,video:Ft,csv:Ht,browser:U,diff:$t},Vt="after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden";function X(e){return e==="browser"?"browser-panel":"canvas-panel"}const Yt={canvas:"Open canvas documents",browser:"Open browser pages"};function Z(e){return`canvas-tab-${e}`}const Kt=3;function qt(e){const n=e.map(o=>o.displayName);if(n.length===0)return null;if(n.length===1)return`${n[0]} is looking at this.`;if(n.length===2)return`${n[0]} and ${n[1]} are looking at this.`;const s=n.length-2;return`${n[0]}, ${n[1]} and ${s} ${s===1?"other":"others"} are looking at this.`}function Wt({watchers:e}){const n=qt(e);if(n===null)return null;const s=e.slice(0,Kt),o=e.length-s.length;return t.jsxs(t.Fragment,{children:[t.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[s.map(l=>t.jsx(W,{size:"xs",className:"ring-background text-3xs size-3.5 ring-1",kind:l.kind,color:l.color??J(l.id),emoji:l.emoji,imageUrl:l.imageUrl,badge:null,fallback:Q(l.displayName)},l.id)),o>0&&t.jsxs("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-3.5 shrink-0 items-center justify-center rounded-full ring-1",children:["+",o]})]}),t.jsx("span",{className:"sr-only",children:n})]})}function Te({view:e,documents:n,activeDocumentId:s,onActivate:o,onClose:l,onPin:m}){const i=X(e),{getTabProps:d}=Rt({orderedIds:n.map(a=>a.id),activeId:s,onActivate:a=>o(a),onClose:a=>l(a),getFallbackFocus:()=>document.getElementById(i)});return n.length===0?null:t.jsx("div",{role:"tablist","aria-label":Yt[e],className:"flex items-stretch gap-1 overflow-x-auto border-b px-2 py-1",children:n.map(a=>{const v=Gt[a.contentType],f=a.id===s,u=a.author;return t.jsxs("div",{role:"presentation",className:"group relative flex shrink-0",children:[t.jsxs("button",{type:"button",role:"tab","aria-selected":f,id:Z(a.id),"aria-controls":f?i:void 0,...d(a.id),className:O("focus-ring flex items-center gap-1.5 rounded-md py-3 pl-2 text-xs transition-colors md:py-1",m?"pr-12":"pr-7",f?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[u&&t.jsx(W,{"aria-hidden":!0,size:"xs",className:"text-3xs size-3.5 shrink-0",kind:u.kind,color:u.color??J(u.id),emoji:u.emoji,imageUrl:u.imageUrl,badge:null,fallback:Q(u.displayName)}),t.jsx(v,{className:"size-3.5 shrink-0"}),t.jsx("span",{className:"max-w-40 truncate font-medium",children:a.sourceLabel}),a.watchers&&a.watchers.length>0&&t.jsx(Wt,{watchers:a.watchers}),a.unread&&t.jsx("span",{"data-slot":"canvas-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"})]}),m&&t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(a.id,!a.pinned),"aria-label":a.pinned?`Unpin ${a.sourceLabel}`:`Pin ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-6 -translate-y-1/2 rounded-sm p-1.5 transition-opacity md:p-0.5",a.pinned?"opacity-100":"opacity-0 group-hover:opacity-60"),children:a.pinned?t.jsx(Xe,{className:"size-3"}):t.jsx(Ze,{className:"size-3"})}),t.jsx("button",{type:"button",tabIndex:-1,onClick:()=>l(a.id),"aria-label":`Close ${a.sourceLabel}`,className:O("focus-ring hover:bg-background/80 absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-1.5 opacity-60 transition-opacity group-hover:opacity-100 md:p-0.5",Vt),children:t.jsx(et,{className:"size-3"})})]},a.id)})})}function Qt({error:e,onRetry:n}){const s=tt(e);return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[t.jsx("p",{children:"This tab hit a problem"}),s?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm",children:"The app may have updated. Reloading usually fixes it."}),t.jsx(N,{type:"button",size:"sm",onClick:()=>window.location.reload(),children:"Reload DorkOS"})]}):t.jsxs(N,{type:"button",variant:"outline",size:"sm",onClick:n,children:[t.jsx(_t,{className:"size-4"}),"Try again"]})]})}class Ee extends p.Component{constructor(){super(...arguments);V(this,"state",{error:null,retryKey:0});V(this,"handleRetry",()=>{this.setState(s=>({error:null,retryKey:s.retryKey+1}))})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,o){console.error(`[Canvas] Document viewer error (${this.props.documentId}):`,s,o)}render(){const{error:s,retryKey:o}=this.state;return s?t.jsx(Qt,{error:s,onRetry:this.handleRetry}):t.jsx(p.Fragment,{children:this.props.children},o)}}function Jt({onReload:e,onKeepMine:n}){return t.jsxs("div",{role:"status",className:"border-border/60 bg-muted/40 mx-2 mt-2 space-y-2 rounded-md border px-3 py-2 text-sm",children:[t.jsx("p",{children:"Your agent changed this while you were editing. Your edit is safe."}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(N,{type:"button",variant:"outline",size:"sm",onClick:e,children:"Reload"}),t.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Keep mine"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Reload shows its version and ends your edit. Keep mine discards it."})]})}const Xt={canvas:{heading:"A blank canvas",blurb:"Your agent can show documents, data and files here.",actions:[{icon:ge,label:"Markdown",description:"Render a document",action:()=>({type:"markdown",content:`# Untitled
|
|
42
|
-
|
|
43
|
-
Start writing…`,title:"Document"})},{icon:be,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:U,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:at.site,title:"Web Page"})}]}};function Y(e,n,s,o){return e.split("").reduce((m,i)=>m+i.charCodeAt(0),0)*(n+1)*7%(o-s)+s}function Ae({view:e,onAction:n}){const s=nt(),o=p.useId(),l=Xt[e],m=p.useMemo(()=>Array.from({length:6},(i,d)=>({x:Y(o,d*3,10,90),y:Y(o,d*3+1,10,80),size:Y(o,d*3+2,24,56),delay:d*.4})),[o]);return t.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&m.map((i,d)=>t.jsx(I.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${i.x}%`,top:`${i.y}%`,width:i.size,height:i.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:i.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},d)),t.jsxs(I.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[t.jsx(I.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:e==="browser"?t.jsx(U,{className:"size-7"}):t.jsx(st,{className:"size-7"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:l.heading}),t.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[l.blurb,t.jsx("br",{}),"Or pick a starting point below."]})]}),t.jsx(I.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:l.actions.map(({icon:i,label:d,description:a,action:v})=>t.jsxs(I.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(v()),children:[t.jsx(i,{className:"text-muted-foreground size-4 shrink-0"}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"text-sm font-medium",children:d}),t.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},d))})]})]})}const De=[{value:"hour",label:"1 hour",ms:36e5},{value:"day",label:"1 day",ms:864e5},{value:"week",label:"1 week",ms:6048e5}];function de(e,n=Date.now()){const s=De.find(o=>o.value===e).ms;return new Date(Math.ceil((n+s)/6e4)*6e4).toISOString()}const Zt=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function $(e){return Zt.format(new Date(e))}function H(e){switch(e.kind){case"log":return"Kept on this document";case"room":return e.agentName?`To ${e.agentName} in this room`:"To this room";case"owner":return e.agentName?`To ${e.agentName}`:"To the agent that opened this";case"agent":return e.agentName?`To ${e.agentName}`:"To an agent that’s gone"}}const en={no_grant:"Off",granted:"On",waiting:"Waiting for you",suspended:"Paused",revoked:"Turned off",expired:"Ended"};function Se(e){return en[e]}function tn(e){const n=e.grant;switch(e.state){case"granted":return n!=null&&n.expiresAt?`Until ${$(n.expiresAt)}`:"On";case"waiting":return"An agent asked for this route.";case"suspended":return"The route or its app changed. Allow it again.";case"revoked":return n!=null&&n.revokedAt?`Turned off ${$(n.revokedAt)}`:"Turned off";case"expired":return n!=null&&n.expiresAt?`Ended ${$(n.expiresAt)}`:"Ended";case"no_grant":return e.needsPerson?"Needs your approval to start work.":"Off until someone allows it."}}function _e(e){const n=`${e.turnsPerHour} ${e.turnsPerHour===1?"turn":"turns"} an hour`,s=`${e.eventsPerMinute} ${e.eventsPerMinute===1?"event":"events"} a minute`;return`${n} · ${s}`}function Ie(e){return`${Se(e.state)}: ${H(e.destination)}`}function nn(e){const n=e==null?void 0:e.code;return typeof n=="string"&&an.has(n)}function sn(e){return{on:e.filter(n=>n.state==="granted").length,waiting:e.filter(n=>n.state==="waiting").length}}const L="This route changed. Review it again.",an=new Set(["ROUTE_CHANGED","GRANT_BINDING_CHANGED","DECLARATION_HASH_MISMATCH","MANIFEST_CHANGED"]),F="Only a signed-in person can change routes.",ue={ROUTE_CHANGED:L,GRANT_BINDING_CHANGED:L,DECLARATION_HASH_MISMATCH:L,MANIFEST_CHANGED:L,ROUTE_UNDECLARED:"This document no longer declares that route.",ROUTE_ALREADY_ON:"This route is already on.",ROUTE_ALREADY_GRANTED:"This route is already on.",APPROVAL_NOT_RECORDED:"Couldn’t record the approval. Nothing was allowed.",TARGET_UNAVAILABLE:"The agent for this route isn’t available.",TARGET_IDENTITY_MISMATCH:"The agent for this route isn’t available.",TARGET_SCOPE_MISMATCH:"The agent for this route isn’t available.",ROOM_ROUTE_UNAVAILABLE:"This room can’t take events right now.",ORIGIN_AUTHORITY_LOST:"The agent that opened this isn’t available.",GRANT_EXPIRED:"That end time has passed. Pick another.",AGENT_CANNOT_DECIDE:F,REQUESTER_CANNOT_DECIDE:F,PERSON_REQUIRED:F,operator_cookie_required:F,AUTH_REQUIRED:"Sign in to change routes."};function K(e){const n=e==null?void 0:e.code;return typeof n=="string"&&ue[n]?ue[n]:e instanceof TypeError?"Couldn’t reach DorkOS. Check your connection.":"Couldn’t change this route. Try again."}const q=e=>["canvas-doc-routes",e];function on(e,n){const s=E();return me({queryKey:q(e),queryFn:()=>s.getCanvasDocRoutes(e),retry:!1,networkMode:"always",staleTime:5e3,refetchInterval:n?15e3:6e4})}function rn(e,n,s){const o=E();return me({queryKey:["canvas-doc-route-review",e,n,s],queryFn:()=>o.reviewCanvasDocRoute(e,n,{expiresAt:s}),enabled:s!==null,retry:!1,networkMode:"always",staleTime:1/0,gcTime:0})}function Oe(e){const n=E(),s=he(),o=i=>{s.setQueryData(q(e),d=>d&&{...d,routes:d.routes.map(a=>a.id===i.route.id?i.route:a)}),s.invalidateQueries({queryKey:q(e)})},l=re({mutationFn:i=>n.approveCanvasDocRoute(e,i.routeId,{expiresAt:i.expiresAt,reviewHash:i.reviewHash}),networkMode:"always",onSuccess:o}),m=re({mutationFn:i=>n.revokeCanvasDocRoute(e,i.routeId),networkMode:"always",onSuccess:o});return{approve:l,revoke:m}}function ln(e){return window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}}function cn(){return p.useSyncExternalStore(ln,()=>navigator.onLine,()=>!0)}const dn={no_grant:"neutral",granted:"success",waiting:"warning",suspended:"warning",revoked:"neutral",expired:"neutral"};function un({documentId:e,route:n,online:s,onDone:o,onAnnounce:l}){const m=p.useId(),[i,d]=p.useState("day"),[a,v]=p.useState(()=>de("day")),f=rn(e,n.id,a),{approve:u}=Oe(e),x=f.data,j=()=>{x&&u.mutate({routeId:n.id,expiresAt:x.expiresAt,reviewHash:x.reviewHash},{onSuccess:c=>{l(Ie(c.route)),o()},onError:c=>{nn(c)&&f.refetch()}})};return t.jsxs("section",{"aria-labelledby":m,"data-testid":`doc-route-review-${n.id}`,className:"bg-background space-y-3 rounded-md p-3",children:[t.jsx("h4",{id:m,className:"text-sm font-medium",children:"Allow this route?"}),t.jsx(rt,{"aria-label":"How long",value:i,onValueChange:c=>{d(c),v(de(c))},children:De.map(c=>t.jsx(it,{value:c.value,children:c.label},c.value))}),t.jsx("div",{className:"min-h-20 space-y-1.5 text-xs",children:x?t.jsxs(t.Fragment,{children:[t.jsx(z,{label:"Goes to",align:"start",wrap:!0,children:H(x.destination)}),t.jsx(z,{label:"Events",align:"start",wrap:!0,children:t.jsx("code",{className:"font-mono",children:x.allowedTypes.join(", ")})}),t.jsx(z,{label:"Limits",align:"start",wrap:!0,children:_e(x.limits)}),t.jsx(z,{label:"Ends",align:"start",wrap:!0,children:$(x.expiresAt)})]}):f.isError?t.jsx("p",{role:"alert",className:"text-destructive",children:K(f.error)}):t.jsxs("p",{className:"text-muted-foreground flex items-center gap-2",children:[t.jsx(lt,{size:"xs"}),"Checking details…"]})}),u.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:K(u.error)}),t.jsxs("div",{className:"flex justify-end gap-2",children:[f.isError&&t.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>void f.refetch(),children:"Try again"}),t.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:o,children:"Cancel"}),t.jsx(N,{type:"button",size:"sm","data-testid":`doc-route-allow-${n.id}`,disabled:!x||f.isFetching||!s||u.isPending,onClick:j,children:u.isPending?"Allowing…":"Allow route"})]})]})}function mn({documentId:e,route:n,online:s,onAnnounce:o}){const[l,m]=p.useState(!1),{revoke:i}=Oe(e),d=n.state==="granted"&&n.grant!==null,a=()=>{i.mutate({routeId:n.id},{onSuccess:v=>o(Ie(v.route))})};return t.jsxs("li",{"data-testid":`doc-route-${n.id}`,"data-state":n.state,className:"bg-muted/40 space-y-2 rounded-md p-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:H(n.destination),children:H(n.destination)}),t.jsxs("p",{className:"text-muted-foreground truncate text-xs",children:[t.jsx("code",{className:"font-mono",children:n.on})," · ",n.id]})]}),t.jsx(ot,{shape:"pill",variant:"outline",size:"xs",tone:dn[n.state],"data-testid":`doc-route-state-${n.id}`,className:"shrink-0",children:Se(n.state)})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:tn(n)}),d&&n.grant&&t.jsx("p",{className:"text-muted-foreground text-xs",children:_e(n.grant.limits)}),i.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:K(i.error)}),l?t.jsx(un,{documentId:e,route:n,online:s,onAnnounce:o,onDone:()=>m(!1)}):t.jsx("div",{className:"flex justify-end",children:d?t.jsx(N,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-turn-off-${n.id}`,disabled:!s||i.isPending,onClick:a,children:i.isPending?"Turning off…":"Turn off"}):t.jsx(N,{type:"button",variant:"outline",size:"sm","data-testid":`doc-route-review-button-${n.id}`,disabled:!s,onClick:()=>m(!0),children:"Review"})})]})}function hn(e,n){return n>0?`${n} waiting`:e>0?`${e} on`:"Off"}function Me({documentId:e}){var x;const[n,s]=p.useState(!1),[o,l]=p.useState(""),m=cn(),i=on(e,n),d=p.useCallback(j=>l(j),[]),a=((x=i.data)==null?void 0:x.routes)??[];if(a.length===0)return null;const{on:v,waiting:f}=sn(a),u=hn(v,f);return t.jsx("div",{"data-testid":"doc-routes-bar",className:"text-muted-foreground flex items-center justify-end border-b px-3 py-1 text-xs",children:t.jsxs(ct,{open:n,onOpenChange:s,modal:!0,fullHeight:!0,children:[t.jsx(dt,{asChild:!0,children:t.jsxs(N,{type:"button",variant:"ghost",size:"sm","data-testid":"doc-routes-trigger","aria-label":`Event routes: ${u}`,className:"h-6 gap-1.5 px-1.5",children:[t.jsx(Pt,{className:"size-3.5"}),"Routes",t.jsxs("span",{className:O("flex items-center gap-1",f>0?"text-status-warning-fg":"text-muted-foreground"),children:[f>0&&t.jsx("span",{"aria-hidden":!0,className:"bg-status-warning size-1.5 rounded-full"}),u]})]})}),t.jsxs(ut,{align:"end","aria-label":"Event routes","data-testid":"doc-routes-panel",className:"flex max-h-[min(70vh,36rem)] w-[min(24rem,calc(100vw-2rem))] flex-col gap-3 overflow-y-auto p-3",children:[t.jsx(mt,{children:"Event routes"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("h3",{className:"hidden text-sm font-medium md:block",children:"Event routes"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"A route does nothing until it’s allowed."})]}),!m&&t.jsx("p",{"data-testid":"doc-routes-offline",className:"bg-status-warning-bg text-status-warning-fg rounded-md px-2 py-1.5 text-xs",children:"Offline. Changes wait until you reconnect."}),i.isError&&t.jsxs("div",{role:"alert",className:"flex items-center justify-between gap-2 text-xs",children:[t.jsx("span",{className:"text-destructive",children:"Couldn’t refresh routes."}),t.jsx(N,{type:"button",variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]}),t.jsx("ul",{className:"space-y-2","aria-label":"Declared routes",children:a.map(j=>t.jsx(mn,{documentId:e,route:j,online:m,onAnnounce:d},j.id))}),t.jsx("p",{role:"status","aria-live":"polite",className:"sr-only",children:o})]})]})})}function pn({sourceLabel:e,people:n,following:s,onFollow:o,onStopFollowing:l,onDiscuss:m,discussing:i=!1}){const d=n.find(a=>a.id===s)??null;return e===void 0&&n.length===0&&m===void 0?null:t.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[e!==void 0&&t.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),e===void 0&&t.jsx("span",{className:"flex-1"}),m&&t.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:i,onClick:m,children:[t.jsx(ht,{className:"size-3.5"}),"Discuss"]}),n.length>0&&t.jsxs(pt,{children:[t.jsx(ft,{asChild:!0,children:t.jsxs(N,{type:"button",variant:"ghost",size:"sm",className:O("h-6 gap-1 px-1.5",d&&"text-foreground"),children:[t.jsx(xt,{className:"size-3.5"}),d?`Following ${d.displayName}`:"Follow"]})}),t.jsxs(gt,{align:"end",children:[t.jsx(vt,{children:"Follow somebody’s browser"}),n.map(a=>t.jsxs(ie,{onSelect:()=>a.id===s?l():o(a.id),children:[t.jsx(W,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??J(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:Q(a.displayName)}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&t.jsx(yt,{className:"size-3.5 shrink-0"})]},a.id)),d&&t.jsx(ie,{onSelect:l,children:"Stop following"})]})]})]})}function fn({roomId:e,document:n,reading:s}){const o=E(),l=he(),[m,i]=p.useState(null),d=p.useMemo(()=>Ot({transport:o,queryClient:l,roomId:e}),[o,l,e]);return t.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[t.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(fe,{className:"text-muted-foreground size-4 shrink-0"}),t.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),t.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),t.jsx(N,{type:"button",size:"sm",onClick:()=>i(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&t.jsx(Mt,{source:d,path:m,onClose:()=>i(null)})]})}const xn=["image","pdf","audio","video","csv","model3d"];function gn(e){return/^(https?:|data:)/.test(e)}function vn(e){if(e.type==="file"||e.type==="diff")return e.sourcePath;if(e.type==="markdown")return e.sourcePath??null;if(xn.includes(e.type)){const n=e.src;return gn(n)?null:n}return null}function yn(e){return e.type==="file"||e.type==="diff"||e.type==="markdown"}function bn(e){const n=/^(?:in )?(.+?)['’]s /.exec(e.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function jn(e){const n=vn(e.content);if(n===null)return{kind:"inline"};if(e.treeKind==="room-main"||e.treeKind===void 0)return yn(e.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(e.content.type==="diff"&&e.treeKind==="worktree"&&typeof e.aheadOfMain=="number"&&e.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:e.content};if(e.content.type==="markdown")return{kind:"inline"};const s=bn(e);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function wn(e){return e.title||e.contentType}function Nn({roomId:e,document:n,onUpdate:s}){const o=jn(n);return o.kind==="worktree-diff"?t.jsx(Ct,{roomId:e,content:o.content,documentId:n.id,authorId:n.authorId}):o.kind!=="inline"?t.jsx(fn,{roomId:e,document:n,reading:o}):n.content.type==="markdown"?t.jsx(At,{roomId:e,document:n,content:n.content,onSave:s}):t.jsx(xe,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function ze({roomId:e,view:n}){var ne;const s=pe(),o=b(r=>r.roomCanvasDocuments[e]),l=b(r=>{var h;return((h=r.roomCanvasActive[e])==null?void 0:h[n])??null}),m=b(r=>{var h;return(h=r.roomCanvasUnread[e])==null?void 0:h[n]}),i=b(r=>r.activateRoomCanvasDocument),d=b(r=>r.clearRoomCanvasUnread),a=b(r=>r.roomCanvasPresence[e]),v=Tt(e),f=bt(e),u=E(),x=((ne=f.data)==null?void 0:ne.viewerAuthorId)??null,j=b(r=>r.roomCanvasEditing[e]??null),c=jt(r=>r.openThread),[P,w]=p.useState(!1),R=n==="browser"?e:null,{following:B,follow:G,stop:Fe}=It(R),k=wt(R),A=p.useRef(null),M=p.useCallback(async(r,h)=>{try{return await h(),!0}catch(S){return le.error(r,{description:ce(S)}),!1}},[]),D=p.useMemo(()=>Nt(o??[],n),[o,n]),y=D.find(r=>r.id===l)??null,ee=(m==null?void 0:m.length)??0;p.useEffect(()=>{ee>0&&d(e,n)},[ee,d,e,n]);const $e=p.useMemo(()=>{var se;const r=new Map(((se=f.data)==null?void 0:se.members.map(g=>[g.author.id,g.author]))??[]),h=g=>({id:g.id,displayName:g.displayName,kind:g.kind,...g.emoji?{emoji:g.emoji}:{},...g.color?{color:g.color}:{},...g.imageUrl?{imageUrl:g.imageUrl}:{}}),S=new Map;for(const[g,_]of Object.entries(a??{})){if(g===x)continue;const T=r.get(g);if(!T)continue;const ae=S.get(_);ae?ae.push(h(T)):S.set(_,[h(T)])}return D.map(g=>{const _=r.get(g.authorId),T=S.get(g.id);return{id:g.id,sourceLabel:wn(g),contentType:g.content.type,pinned:g.pinned,unread:(m==null?void 0:m.includes(g.id))??!1,..._?{author:h(_)}:{},...T?{watchers:T}:{}}})},[D,f.data,m,a,x]);Et(e,(y==null?void 0:y.id)??null);const Ue=p.useMemo(()=>{var r;return(((r=f.data)==null?void 0:r.members)??[]).map(h=>h.author).filter(h=>h.kind==="human"&&h.id!==x).map(h=>({id:h.id,displayName:h.displayName,kind:h.kind,emoji:h.emoji,color:h.color,imageUrl:h.imageUrl}))},[f.data,x]),He=b(r=>{if(l===null)return;const h=r.browserHistories[l];return h?h.stack[h.cursor]:void 0}),Pe=p.useCallback(()=>{var r;return((r=A.current)==null?void 0:r.scrollTop)??0},[]),Be=p.useCallback(r=>{const h=A.current;return h?(h.addEventListener("scroll",r,{passive:!0}),()=>h.removeEventListener("scroll",r)):()=>{}},[]);Bt({roomId:R,viewerAuthorId:x,documentId:l,url:He,readScrollY:Pe,subscribe:Be});const te=p.useMemo(()=>D.map(r=>r.id).join("\0"),[D]);p.useEffect(()=>{if(!(k===null||j!==null)&&te.split("\0").includes(k.documentId)){if(k.documentId!==l){i(e,k.documentId);return}k.scrollY!==void 0&&A.current&&(A.current.scrollTop=k.scrollY)}},[k,j,l,te,i,e]);const Ge=p.useCallback(()=>{y!==null&&(w(!0),u.discussCanvasDocument(e,y.id).then(r=>c(e,r.threadRootEntryId,!1)).catch(r=>{le.error("Couldn’t start a discussion.",{description:ce(r)})}).finally(()=>w(!1)))},[y,u,e,c]),Ve=X(n);return t.jsxs(t.Fragment,{children:[!s&&t.jsx(Te,{view:n,documents:$e,activeDocumentId:l,onActivate:r=>i(e,r),onClose:r=>void M("Couldn’t take that off the canvas.",()=>v.close(r)),onPin:(r,h)=>void M(h?"Couldn’t pin that.":"Couldn’t unpin that.",()=>v.pin(r,h))}),t.jsx(pn,{sourceLabel:y==null?void 0:y.sourceLabel,people:n==="browser"?Ue:[],following:B,onFollow:G,onStopFollowing:Fe,onDiscuss:y===null?void 0:Ge,discussing:P}),y&&t.jsx(Me,{documentId:y.id},y.id),t.jsx("div",{id:Ve,ref:A,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&y?{role:"tabpanel","aria-labelledby":Z(y.id)}:{},children:y?t.jsx(Ee,{documentId:y.id,children:t.jsx(Nn,{roomId:e,document:y,onUpdate:(r,h)=>M("Couldn’t save that for the room.",()=>v.update(r,h))})},y.id):t.jsx(Ae,{view:n,onAction:r=>void M("Couldn’t put that on the canvas.",()=>v.open(r))})})]})}function Le({view:e}){const n=pe(),s=b(c=>c.openDocuments),o=b(c=>e==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),l=b(c=>c.activateCanvasDocument),m=b(c=>c.closeCanvasDocument),i=b(c=>c.setDocumentContent),d=b(c=>c.openCanvasDocument),a=b(c=>c.applyHeldUpdate),v=b(c=>c.discardHeldUpdate),f=kt(s,e),u=f.find(c=>c.id===o)??null,x=f.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),j=X(e);return t.jsxs(t.Fragment,{children:[!n&&t.jsx(Te,{view:e,documents:x,activeDocumentId:o,onActivate:l,onClose:m}),u&&t.jsx(Me,{documentId:u.id},u.id),(u==null?void 0:u.heldUpdate)&&t.jsx(Jt,{onReload:()=>a(u.id),onKeepMine:()=>v(u.id)}),t.jsx("div",{id:j,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&u?{role:"tabpanel","aria-labelledby":Z(u.id)}:{},children:u?t.jsx(Ee,{documentId:u.id,children:t.jsx(xe,{documentId:u.id,content:u.content,onContentChange:c=>i(u.id,c)})},u.id):t.jsx(Ae,{view:e,onAction:d})})]})}function qn(){const e=b(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(ze,{roomId:e,view:"canvas"}):t.jsx(Le,{view:"canvas"})})}function Wn(){const e=b(n=>n.roomCanvasLiveRoomId);return t.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:e?t.jsx(ze,{roomId:e,view:"browser"}):t.jsx(Le,{view:"browser"})})}export{Wn as BrowserContent,qn as CanvasContent,Xn as CanvasWidgetContent,Zn as resetSessionCanvasImport,es as useDevtoolsBridge,ts as useDocChannel,ns as useSessionCanvas};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hW as ft,hX as mt,hY as ht,hZ as pt,h_ as dt,h$ as st,i0 as at,i1 as gt,i2 as yt,i3 as At,i4 as St,i5 as Et,i6 as vt,i7 as Vt,i8 as Mt,i9 as Dt,ia as Tt,ib as bt,ic as L,id as Ot,ie as xt,fy as wt,ig as Ft}from"./index-C3cvP8Fo.js";const Gt=(e,t,n)=>{const i=t-e;return((n-e)%i+i)%i+e};function rt(e,t){return ft(e)?e[Gt(0,e.length,t)]:e}class It{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=n}attachTimeline(t){const n=this.animations.map(i=>i.attachTimeline(t));return()=>{n.forEach((i,s)=>{i&&i(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return tt(this.animations,"duration")}get iterationDuration(){return tt(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(n=>n[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function tt(e,t){let n=0;for(let i=0;i<e.length;i++){const s=e[i][t];s!==null&&s>n&&(n=s)}return n}class Kt extends It{then(t,n){return this.finished.finally(t).then(()=>{})}}function Ct(e,t){return e in t}class Nt extends mt{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,n){if(Ct(n,t)){const i=t[n];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(t,n){delete n.output[t]}measureInstanceViewportBox(){return ht()}build(t,n){Object.assign(t.output,n)}renderInstance(t,{output:n}){Object.assign(t,n)}sortInstanceNodePosition(){return 0}}function P(e){return typeof e=="object"&&!Array.isArray(e)}function ot(e,t,n,i){return e==null?[]:typeof e=="string"&&P(t)?pt(e,n,i):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(s=>s!=null):[e]}function Bt(e,t,n){return e*(t+1)+n*t}function et(e,t,n,i){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?n:t.startsWith("<")?Math.max(0,n+parseFloat(t.slice(1))):i.get(t)??e}function Lt(e,t,n){for(let i=0;i<e.length;i++){const s=e[i];s.at>t&&s.at<n&&(st(e,s),i--)}}function Wt(e,t,n,i,s,c){Lt(e,s,c);for(let a=0;a<t.length;a++)e.push({value:t[a],at:dt(s,c,i[a]),easing:rt(n,a)})}function jt(e,t,n=0){const i=t+1+t*n;for(let s=0;s<e.length;s++)e[s]=e[s]/i}function Pt(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const Rt="easeInOut",_t=20;function kt(e,{defaultTransition:t={},...n}={},i,s){const c=t.duration||.3,a=new Map,u=new Map,l={},m=new Map;let d=0,o=0,g=0;for(let y=0;y<e.length;y++){const A=e[y];if(typeof A=="string"){m.set(A,o);continue}else if(!Array.isArray(A)){m.set(A.name,et(o,A.at,d,m));continue}let[T,S,f={}]=A;f.at!==void 0&&(o=et(o,f.at,d,m));let h=0;const O=(v,x,M,b=0,G=0)=>{const r=zt(v),{delay:I=0,times:E=gt(r),type:W=t.type||"keyframes",repeat:K,repeatType:j,repeatDelay:R=0,...ut}=x;let{ease:V=t.ease||"easeOut",duration:p}=x;const _=typeof I=="function"?I(b,G):I,k=r.length,z=Et(W)?W:s==null?void 0:s[W||"keyframes"];if(k<=2&&z){let w=100;if(k===2&&qt(r)){const C=r[1]-r[0];w=Math.abs(C)}const F={...t,...ut};p!==void 0&&(F.duration=vt(p));const B=yt(F,w,z);V=B.ease,p=B.duration}p??(p=c);const U=o+_;E.length===1&&E[0]===0&&(E[1]=1);const X=E.length-r.length;if(X>0&&At(E,X),r.length===1&&r.unshift(null),K&&K<_t){const w=p>0?R/p:0;p=Bt(p,K,R);const F=[...r],B=[...E];V=Array.isArray(V)?[...V]:[V];const C=[...V],H=j==="reverse"||j==="mirror";let Y=F,Z=C;H&&(Y=[...F].reverse(),j==="reverse"&&(Z=[...C].reverse().map(D=>typeof D=="function"?St(D):D)));for(let D=0;D<K;D++){const $=H&&D%2===0,J=$?Y:F,ct=$?Z:C,Q=(D+1)*(1+w);w>0&&(r.push(r[r.length-1]),E.push(Q),V.push("linear")),r.push(...J);for(let N=0;N<J.length;N++)E.push(B[N]+Q),V.push(N===0?"linear":rt(ct,N-1))}jt(E,K,w)}const q=U+p;Wt(M,r,V,E,U,q),h=Math.max(_+p,h),g=Math.max(q,g)};if(at(T)){const v=nt(T,u);O(S,f,it("default",v))}else{const v=ot(T,S,i,l),x=v.length;for(let M=0;M<x;M++){S=S,f=f;const b=v[M],G=nt(b,u);for(const r in S)O(S[r],Ut(f,r),it(r,G),M,x)}}d=o,o+=h}return u.forEach((y,A)=>{for(const T in y){const S=y[T];S.sort(Pt);const f=[],h=[],O=[];for(let b=0;b<S.length;b++){const{at:G,value:r,easing:I}=S[b];f.push(r),h.push(Vt(0,g,G)),O.push(I||"easeOut")}h[0]!==0&&(h.unshift(0),f.unshift(f[0]),O.unshift(Rt)),h[h.length-1]!==1&&(h.push(1),f.push(null)),a.has(A)||a.set(A,{keyframes:{},transition:{}});const v=a.get(A);v.keyframes[T]=f;const{type:x,...M}=t;v.transition[T]={...M,duration:g,ease:O,times:h,...n}}}),a}function nt(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function it(e,t){return t[e]||(t[e]=[]),t[e]}function zt(e){return Array.isArray(e)?e:[e]}function Ut(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const Xt=e=>typeof e=="number",qt=e=>e.every(Xt);function Ht(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Mt(e)&&!Dt(e)?new Tt(t):new bt(t);n.mount(e),L.set(e,n)}function Yt(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new Nt(t);n.mount(e),L.set(e,n)}function Zt(e,t){return at(e)||typeof e=="number"||typeof e=="string"&&!P(t)}function lt(e,t,n,i){const s=[];if(Zt(e,t))s.push(Ot(e,P(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return s;const c=ot(e,t,i),a=c.length;for(let u=0;u<a;u++){const l=c[u],m=l instanceof Element?Ht:Yt;L.has(l)||m(l);const d=L.get(l),o={...n};"delay"in o&&typeof o.delay=="function"&&(o.delay=o.delay(u,a)),s.push(...xt(d,{...t,transition:o},{}))}}return s}function $t(e,t,n){const i=[],s=e.map(a=>{if(Array.isArray(a)&&typeof a[0]=="function"){const u=a[0],l=wt(0);return l.on("change",u),a.length===1?[l,[0,1]]:a.length===2?[l,[0,1],a[1]]:[l,a[1],a[2]]}return a});return kt(s,t,n,{spring:Ft}).forEach(({keyframes:a,transition:u},l)=>{i.push(...lt(l,a,u))}),i}function Jt(e){return Array.isArray(e)&&e.some(Array.isArray)}function Qt(e={}){const{scope:t,reduceMotion:n,skipAnimations:i}=e;function s(c,a,u){let l=[],m;const d={};if(n!==void 0&&(d.reduceMotion=n),i!==void 0&&(d.skipAnimations=i),Jt(c)){const{onComplete:g,...y}=a||{};typeof g=="function"&&(m=g),l=$t(c,{...d,...y},t)}else{const{onComplete:g,...y}=u||{};typeof g=="function"&&(m=g),l=lt(c,a,{...d,...y},t)}const o=new Kt(l);return m&&o.finished.then(m),t&&(t.animations.push(o),o.finished.then(()=>{st(t.animations,o)})),o}return s}const ee=Qt();export{ee as a};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{dA as C,ad as I,r,j as u,bx as P,ar as b,G as A,gv as M,gw as N,gt as O,aW as S,a1 as x,a2 as v,aR as p,gx as w}from"./index-C3cvP8Fo.js";import{u as _}from"./use-is-below-desktop-Cu_jKnft.js";import{u as G}from"./use-notification-prefs-m9XSNB6W.js";const D=.16,K=`[&_button]:${M}`;function Q({candidates:t,ready:e,name:o="sidebar-bottom-slot",className:s}){const i=C(),a=I(),n=e?t.find(g=>g.show):void 0,[c,y]=r.useState(void 0),d=r.useRef(!1);r.useEffect(()=>{!e||d.current||(d.current=!0,y((n==null?void 0:n.id)??null))},[e,n]);const R=c!==void 0&&(n==null?void 0:n.id)!==c&&!i;return u.jsx("div",{"data-slot":o,className:A("shrink-0 px-2 pb-2 empty:p-0",a&&K,s),children:u.jsx(P,{initial:!1,children:n!==void 0&&u.jsx(b.div,{initial:R?{height:0,opacity:0}:!1,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:i?0:D,ease:[0,0,.2,1]},className:"overflow-hidden",children:n.render()},n.id)})})}const U={knock:"/knock.wav",settle:"/settle.wav","turn-end":"/notification.wav"},m=new Map;function L(t){try{let e=m.get(t);e||(e=new Audio(U[t]),m.set(t,e)),e.currentTime=0,e.play().catch(()=>{})}catch{}}function Y(){const t=S(s=>s.loadRightPanelState),e=_(),o=r.useRef(!e);r.useEffect(()=>{t({restoreOpen:o.current})},[t])}const h=Symbol("right-panel-layout-key-pending");function z(){const[t]=N(),{data:e,isPending:o}=O(t),s=S(c=>c.loadRightPanelForAgent),i=_(),a=r.useRef(i);r.useEffect(()=>{a.current=i},[i]);let n;t?o?n=h:n=(e==null?void 0:e.id)??t:n=null,r.useEffect(()=>{n!==h&&s(n,t,{inherit:!a.current})},[n,t,s]),r.useEffect(()=>()=>s(null),[s])}function J(t,e,o){const s=x();return v({queryKey:["commands",{cwd:t??null,sessionId:e??null,runtime:o??null}],queryFn:()=>s.getCommands(!1,t??void 0,{sessionId:e,runtime:o}),staleTime:p.COMMANDS_STALE_TIME_MS,gcTime:p.COMMANDS_GC_TIME_MS})}const k="dork-kickoff",E=`<${k}>`,T=`</${k}>`;function V(t){return`${E}
|
|
2
|
-
${t.trim()}
|
|
3
|
-
${T}`}function j(t){const e=w(t);return e.startsWith(E)&&e.endsWith(T)}function X(t){const e=t.findIndex(o=>o.role==="user");return e===-1||!j(t[e].content)?t:t.filter((o,s)=>s!==e)}const F={knock:"knock",settle:"allClear","turn-end":"turnEnd"};function Z(){const{prefs:t}=G(),{sounds:e}=t;return{play:r.useCallback(s=>{e[F[s]]&&L(s)},[e])}}const tt=3e4;let l=!1;const f=new Set;function et(){if(!l){l=!0;for(const t of f)t()}}function W(t){return f.add(t),()=>{f.delete(t)}}function $(){return l}function nt(){return r.useSyncExternalStore(W,$,()=>!1)}export{Q as B,tt as L,et as a,Z as b,J as c,z as d,Y as e,X as f,nt as u,V as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as s,a3 as r,a4 as i,bj as h,bk as f}from"./index-C3cvP8Fo.js";function u(e){e.invalidateQueries({queryKey:[...h]}),e.invalidateQueries({queryKey:f.details()})}function l(e){return e!=null&&e.isShownInline?{isShownInline:e.isShownInline}:void 0}function T(e){const n=s(),t=r();return i({mutationFn:a=>n.updateProfile(a),onSuccess:()=>u(t),meta:l(e)})}function A(){const e=s(),n=r();return i({mutationFn:({file:t})=>e.uploadProfileAvatar(t,t.name),onSuccess:()=>u(n)})}function E(){const e=s(),n=r();return i({mutationFn:()=>e.deleteProfileAvatar(),onSuccess:()=>u(n)})}function m(){const e=s(),n=r();return i({mutationFn:({memberId:t,linked:a})=>e.setIdentityLinkedToMe(t,a),onSuccess:()=>u(n)})}function O(e){const n=s(),t=r();return i({mutationFn:({authorId:a,handle:d})=>n.setAuthorHandle(a,d),onSuccess:()=>u(t),meta:l(e)})}function c(e){return typeof e=="object"&&e!==null&&"code"in e?e.code:void 0}function o(e){const n=e instanceof Error?e.message.trim():"";return n.length>0?n:void 0}function P(e,n){const t=`@${n}`;switch(c(e)){case"HANDLE_TAKEN":return`${t} belongs to someone else. Pick a different one.`;case"HANDLE_RESERVED":return`${t} is spoken for. Either you used it before, or it is a word DorkOS uses to reach everyone. Pick a different one.`;case"INVALID_HANDLE":return o(e)??"That handle won’t work. Use lowercase letters, numbers, dots, underscores or hyphens.";default:return o(e)??"Couldn’t save your handle. Try again."}}function k(e){switch(c(e)){case"AVATAR_TOO_LARGE":return"That photo is over 2 MB. Pick a smaller one.";case"AVATAR_TYPE_UNSUPPORTED":return"That file isn’t a photo DorkOS can use. Pick a PNG, JPEG or WebP.";case"AVATAR_MISSING":return"No photo came through. Pick the file again.";case"OPERATOR_ONLY":return"Only the person at the keyboard can change this photo.";default:return o(e)??"Couldn’t save your photo. Try again."}}function v(e){return c(e)==="OPERATOR_ONLY"?"Only the person at the keyboard can change this name.":o(e)??"Couldn’t save your name. Try again."}function g(e,n){switch(c(e)){case"IDENTITY_NOT_EXTERNAL":return"Only an account on another chat platform can be linked to you.";case"OPERATOR_ONLY":return"Only this install’s owner can link accounts.";default:return o(e)??(n?"Couldn’t link that account. Try again.":"Couldn’t remove that link. Try again.")}}export{E as a,k as b,O as c,T as d,m as e,P as h,g as i,v as n,A as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aN as a,aO as s}from"./index-C3cvP8Fo.js";const t={tasks:s,moment:a};export{t as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as l,a2 as g,a4 as j,j as t,dA as m,ar as u,G as x,J as k,X as b,x as p,r as o,b7 as N,B as d,gy as w,l as v,Y as O,gz as S,gA as C}from"./index-C3cvP8Fo.js";import{P as L,M as R}from"./plug-IIS_cL9-.js";import{R as T}from"./rotate-cw-B4Y0q4GY.js";function E(e,s){const n=e.serviceName;if(e.status==="connected")return{heading:`Signed in to ${n}`,body:D(e,s)};switch(e.reason){case"cancelled":return{heading:"Sign-in cancelled",body:"Nothing changed. Try again when you’re ready."};case"expired":return{heading:"This sign-in link expired",body:"Sign-in links last a few minutes. Start a fresh one."};default:return{heading:"Couldn’t finish signing in",body:`${n||"The service"} didn’t complete the sign-in. Try again.`}}}function D(e,s){return e.resumesConversation?`${s??"Your agent"} is picking up where it left off.`:e.service==="openrouter"?"OpenRouter models are ready to use.":s?`${s} can use ${e.serviceName} now.`:`${e.serviceName} is ready to use.`}const z={heading:"This page expired",body:"Check DorkOS to see how the sign-in went."},P={heading:"Couldn’t reach DorkOS",body:"Make sure DorkOS is running, then reload this page."},M="Couldn’t start a new sign-in. Try again from DorkOS.";function A(e){return e==="desktop"?"You can close this tab.":"Or close this tab."}const F="dorkos://";function U(e){return/^\/(?![/\\])[^\s\\]*$/.test(e)}function _(e){const s=e.returnPath!==void 0&&U(e.returnPath)?e.returnPath:void 0;return e.returnSurface==="desktop"?{surface:"desktop",href:s?`dorkos:/${s}`:F}:{surface:"browser",href:s??"/"}}function $(e){return e.returnSurface==="desktop"&&e.status==="connected"}function B(e){const s=l();return g({queryKey:["sign-in-landing",e],queryFn:()=>s.getSignInLanding(e),enabled:e.length>0,retry:!1,staleTime:1/0,refetchOnWindowFocus:!1})}function H(e){var r,i;const s=l(),n=g({queryKey:["sign-in-landing","agent",e],queryFn:()=>s.getMeshAgent(e),enabled:e!==void 0,retry:!1,staleTime:6e4});return((r=n.data)==null?void 0:r.displayName)||((i=n.data)==null?void 0:i.name)||void 0}function I(e){try{const s=new URL(e);return s.protocol==="https:"?!0:s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}function Y(e,s=n=>window.location.assign(n)){const n=l();return j({mutationFn:async()=>{const r=await n.retrySignIn(e);if(r.kind==="authorize"&&!I(r.authorizeUrl))throw new Error("Unexpected sign-in link.");return r},onSuccess:r=>{r.kind==="authorize"&&s(r.authorizeUrl)}})}function G({size:e=18,className:s}){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 799 799",fill:"none",className:s,"aria-hidden":"true","data-mark":"dorkos",children:[t.jsx("rect",{x:"50",y:"50",width:"699",height:"699",stroke:"currentColor",strokeWidth:"100"}),t.jsx("path",{d:"M492.333 199.627L599.833 295.627L600 295.776V491.707L492.207 599.5H199.5V199.5H492.19L492.333 199.627ZM334 347.5V448.5H435V347.5H334Z",fill:"currentColor"})]})}function W(e){var s;return(s=/[\p{L}\p{N}]/u.exec(e))==null?void 0:s[0].toUpperCase()}const q={connected:"bg-status-success-bg border-status-success-border text-status-success-fg",neutral:"bg-muted border-border text-muted-foreground",error:"bg-status-error-bg border-status-error-border text-status-error-fg"};function K({serviceName:e,tone:s}){const n=s==="connected",r=W(e),i=m()??!1,a="bg-muted text-foreground flex size-12 items-center justify-center rounded-xl border text-lg font-semibold";return t.jsxs("div",{className:"flex items-center justify-center","aria-hidden":"true",children:[t.jsx("div",{className:a,children:r??t.jsx(L,{className:"text-muted-foreground size-5"})}),t.jsxs("div",{className:"relative mx-1 flex h-12 w-16 items-center",children:[t.jsx(u.div,{className:x("w-full origin-left",n?"bg-status-success h-px":"border-border h-0 border-t border-dashed"),initial:i?!1:{scaleX:0},animate:{scaleX:1},transition:{duration:.45,ease:[.22,1,.36,1]}}),t.jsxs(u.div,{className:x("absolute top-1/2 left-1/2 flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border",q[s]),initial:i?!1:{scale:.4,opacity:0},animate:{scale:1,opacity:1},transition:i?{duration:0}:{delay:.35,type:"spring",stiffness:420,damping:22},children:[s==="connected"&&t.jsx(k,{className:"size-3.5",strokeWidth:3}),s==="neutral"&&t.jsx(R,{className:"size-3.5",strokeWidth:3}),s==="error"&&t.jsx(b,{className:"size-3.5",strokeWidth:3})]})]}),t.jsx("div",{className:a,children:t.jsx(G,{size:22})})]})}const V=2500;function X({landingId:e}){var n;const s=B(e);if(s.isPending&&e.length>0)return t.jsx(f,{title:"Finishing sign-in",children:t.jsx("div",{className:"flex justify-center py-10",children:t.jsx(p,{size:"md",label:"Finishing sign-in",className:"text-muted-foreground"})})});if(!s.data){const r=(n=s.error)==null?void 0:n.status,i=e.length===0||r===404;return t.jsx(Z,{copy:i?z:P})}return t.jsx(J,{landing:s.data})}function Z({copy:e}){return t.jsxs(f,{title:e.heading,children:[t.jsx("div",{className:"bg-muted mx-auto flex size-12 items-center justify-center rounded-xl border",children:t.jsx(N,{className:"text-muted-foreground size-5"})}),t.jsx(y,{copy:e}),t.jsx("div",{className:"mt-6 flex flex-col gap-2",children:t.jsx(d,{asChild:!0,variant:"outline",children:t.jsx(w,{...v.home(),children:"Back to DorkOS"})})})]})}function J({landing:e}){var h;const s=H(e.agentId),n=Y(e.id),r=_(e),i=e.status==="connected"||((h=n.data)==null?void 0:h.kind)==="connected",a=E(i?{...e,status:"connected",reason:void 0}:e,s),c=Q(e,r);return t.jsxs(f,{title:a.heading,children:[t.jsx(K,{serviceName:e.serviceName,tone:i?"connected":e.reason==="failed"?"error":"neutral"}),t.jsx(y,{copy:a}),t.jsxs("div",{className:"mt-6 flex flex-col gap-2",children:[!i&&e.canRetry&&t.jsxs(d,{onClick:()=>n.mutate(),disabled:n.isPending,children:[n.isPending?t.jsx(p,{}):t.jsx(T,{}),"Try again"]}),t.jsx(d,{asChild:!0,variant:i?"default":"outline",children:t.jsxs("a",{href:r.href,children:[r.surface==="desktop"?"Open DorkOS":"Back to DorkOS",r.surface==="desktop"&&t.jsx(O,{})]})})]}),n.isError&&t.jsx(S,{tone:"error",className:"mt-4 text-left",children:M}),t.jsx("p",{className:"text-muted-foreground mt-4 text-xs","aria-live":"polite",children:c?"Opening DorkOS…":A(r.surface)})]})}function Q(e,s){const n=o.useRef(!1),r=$(e),[i,a]=o.useState(r);return o.useEffect(()=>{if(!r)return;n.current||(n.current=!0,window.location.href=s.href);const c=window.setTimeout(()=>a(!1),V);return()=>window.clearTimeout(c)},[r,s.href]),i}function y({copy:e}){return t.jsxs("div",{className:"mt-6 flex flex-col gap-1.5",children:[t.jsx("h1",{className:"text-lg font-semibold tracking-tight text-balance",children:e.heading}),t.jsx("p",{className:"text-muted-foreground text-sm text-pretty",children:e.body})]})}function f({title:e,children:s}){const n=m()??!1;return o.useEffect(()=>{document.title=`${e} · DorkOS`},[e]),t.jsx("main",{className:"bg-background flex min-h-dvh w-full items-center justify-center p-4 sm:p-6",children:t.jsx(u.div,{className:"bg-card shadow-elevated w-full max-w-sm rounded-2xl border px-6 py-8 text-center sm:px-8",initial:n?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},children:s})})}function ne(){const{landing:e}=C.useSearch();return t.jsx(X,{landingId:e??""})}export{ne as component};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-IUGLLWBU-CRbeSDod.js";import{_ as o}from"./mermaid.core-SX8SzrsU.js";import"./transform-BqqRT-Iy.js";import"./chunk-5VM5RSS4-BqUyGgoH.js";import"./chunk-XXDRQBXY-gnvheN_J.js";import"./chunk-VQ5W62QI-V5zYx50O.js";import"./chunk-55XCU76K-cfAl84Mv.js";import"./BlintzCanvas-b30dG4gx.js";import"./index-C3cvP8Fo.js";import"./index-BIB-maE5.js";import"./index-DabU6r9W.js";import"./channel-Ngk70nQZ.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,v=r({styles:m});export{v as diagram};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{W as a}from"./index-C3cvP8Fo.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const e={name:"terminal",size:24,node:[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]};e.node;const o=a(e);export{o as T};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aw as e}from"./index-C3cvP8Fo.js";const o=1024;function t(){return e(`(max-width: ${o-1}px)`)}export{t as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{as as r}from"./index-C3cvP8Fo.js";function u(){var e;return((e=r().data)==null?void 0:e.serverRole)==="hub"}export{u};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{r as p,W as v,j as d,fV as N,G as _,fW as x,fX as M,eQ as S,fY as L,fZ as m,el as T,eP as C,f_ as E,f$ as D}from"./index-C3cvP8Fo.js";function J(){const[e,t]=p.useState(()=>y());return p.useEffect(()=>{const n=window.visualViewport;if(!n)return;const s=()=>{const r=y();t(i=>i===r?i:r)};return n.addEventListener("resize",s),n.addEventListener("scroll",s),()=>{n.removeEventListener("resize",s),n.removeEventListener("scroll",s)}},[]),e}function y(){const e=typeof window<"u"?window.visualViewport:void 0;return!e||e.scale>1?0:Math.max(0,Math.round(window.innerHeight-(e.height+e.offsetTop)))}/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const A={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};A.node;const Y=v(A);/**
|
|
7
|
-
* @license lucide-react v1.48.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const g={name:"repeat",size:24,node:[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]};g.node;const Q=v(g),O=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"]);function R({gripStyle:e,onDragging:t,onResizeEnd:n,disabled:s=!1,...r}){const i=a=>{!s&&O.has(a.key)&&(n==null||n())};return d.jsx(N,{...r,disabled:s,tabIndex:s?-1:0,"aria-disabled":s||void 0,onDragging:a=>{t==null||t(a),a||n==null||n()},onKeyDown:i,className:"group relative outline-none",style:{width:0,overflow:"visible"},children:d.jsx("div",{className:"absolute inset-y-0 -left-1 z-10 flex w-2 items-center justify-center",style:e,children:d.jsx("div",{"data-slot":"pane-resize-line",className:_("h-full w-px transition-colors duration-500",!s&&"group-hover:bg-ring/50 group-focus-visible:bg-ring group-focus-visible:transition-none")})})})}const k=8;function I(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function W(e){if(L(e)){const n=e.unreadCount??0;return n===1?"1 new message":`${n} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:I(e.topic)}function w(e){return{kind:"session",id:e.id,name:M(e.title),summary:I(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function B(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:S(e),summary:W(e),lastActivityAt:e.lastActivityAt,room:e}}function l(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function H(e){return e.kind==="session"?m("session",e.id):m("room",e.id)}function h(e,t){const n=[l(t[H(e)]),...e.kind==="session"?[l(e.session.lastTouchedByYouAt),l(e.session.userLastMessageAt)]:[]].filter(s=>s!==null);return n.length>0?Math.max(...n):l(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function j(e){return(t,n)=>h(n,e)-h(t,e)||n.id.localeCompare(t.id)}function K(e){const t=new Set;return e.filter(n=>{const s=`${n.kind}:${n.id}`;return t.has(s)?!1:(t.add(s),!0)})}function P(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function V({sessions:e,rooms:t,mutedRoomIds:n=new Set,interactions:s={},limit:r=k}){const{yours:i,spinOffs:a,automated:o}=x(e),f=j(s),u=[...i.map(w),...t.filter(c=>P(c,n)).map(B)].sort(f);return{items:K(u).slice(0,r),automated:[...a,...o].map(w).sort(f).slice(0,r)}}const $=3,b=D;function U({limit:e=k,mutedRoomIds:t,enabled:n=!0}={}){var u,c;const s=T(Math.max(e*$,b),{enabled:n}),r=C({enabled:n}),i=E(),a=(u=s.data)==null?void 0:u.sessions,o=r.data;return{...p.useMemo(()=>V({sessions:a??[],rooms:o??[],mutedRoomIds:t,interactions:i,limit:e}),[a,o,t,i,e]),isLoading:n&&(s.isLoading||r.isLoading),warnings:((c=s.data)==null?void 0:c.warnings)??[]}}export{Y as A,R as P,Q as R,J as a,U as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ac as n}from"./index-C3cvP8Fo.js";function r(s){const e=n();return s||e}export{r as u};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-b30dG4gx.js","assets/index-C3cvP8Fo.js","assets/index-DyRGZyur.css","assets/index-BIB-maE5.js","assets/index-DabU6r9W.js","assets/BlintzCanvas-DCXOV_yN.css","assets/CanvasFileContent-D1bFaUeh.js","assets/rotate-cw-B4Y0q4GY.js","assets/query-keys-DeYqUDia.js","assets/index.esm-BUPoRUaG.js","assets/WidgetErrorCard-1NyzIJBj.js","assets/index-xAgihCJ7.js","assets/card-DT-vFAns.js","assets/progress-g5kkqvlR.js","assets/markdown-content-DaEVxezf.js","assets/table-CN2HCi4p.js","assets/terminal-BORQniao.js","assets/package-Cb7lEm7t.js","assets/heart-CqwUlIUG.js","assets/git-branch-CONwEYiR.js","assets/file-text-DsnD-A8g.js","assets/file-CiyVL55_.js","assets/McpAppFrame-BM9cNPPd.js","assets/more-details-CdJT0Ehl.js","assets/CanvasModel3dContent-dST7g1v2.js","assets/CanvasCsvContent-DGHgSikG.js","assets/index-pVFjKNjX.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var en=Object.defineProperty;var Qt=e=>{throw TypeError(e)};var tn=(e,t,r)=>t in e?en(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var te=(e,t,r)=>tn(e,typeof t!="symbol"?t+"":t,r),gt=(e,t,r)=>t.has(e)||Qt("Cannot "+r);var Me=(e,t,r)=>(gt(e,t,"read from private field"),r?r.call(e):t.get(e)),qe=(e,t,r)=>t.has(e)?Qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),ve=(e,t,r,n)=>(gt(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),be=(e,t,r)=>(gt(e,t,"access private method"),r);import{W as ft,a1 as ae,a2 as rn,a3 as nn,r as p,kO as ht,fH as Z,fS as Q,fL as jt,fO as Be,fI as ce,mx as sn,my as on,mz as an,aX as Re,c8 as Mt,mA as cn,aW as V,iF as un,j as h,hy as ln,hz as dn,e5 as fn,G as qt,I as hn,fs as pn,fJ as it,c5 as mn,mB as gn,iQ as vn,iU as bn,a7 as wn,mC as xn,mD as yr,mE as Ct,mF as ot,mG as kr,fG as Kt,mH as yn,mI as kn,mJ as jn,gC as J,mK as Cn,mL as On,B as rt,J as jr,go as Cr,C as Rn,as as En,mM as _n,mN as Sn,mO as er}from"./index-C3cvP8Fo.js";import{R as Dn}from"./rotate-cw-B4Y0q4GY.js";import{d as Ot}from"./query-keys-DeYqUDia.js";import{T as In,a as Nn,u as Tn}from"./index.esm-BUPoRUaG.js";import{v as An,a as zn,W as Fn}from"./WidgetErrorCard-1NyzIJBj.js";import{M as Mn}from"./McpAppFrame-BM9cNPPd.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 Or={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"}]]};Or.node;const Eo=ft(Or);/**
|
|
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 Rr={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"}]]};Rr.node;const qn=ft(Rr);/**
|
|
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 Er={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"}]]};Er.node;const Ln=ft(Er);/**
|
|
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 _r={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"}]]};_r.node;const Pn=ft(_r);function Bn(e,t){const r=ae();return rn({queryKey:Ot.index(e??""),queryFn:()=>r.getDocIndex(e),enabled:t&&e!==null,refetchOnWindowFocus:!0})}function Wn(){const e=nn();return p.useCallback(t=>{e.invalidateQueries({queryKey:t?Ot.index(t):Ot.all})},[e])}const _e={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},at=ce().min(1).max(128),Te={bridgeGeneration:at},Un=Z({...Te,__dorkosDevtools:Q("capture-result"),requestId:at,dataUrl:ce().max(9e5).optional(),error:ce().max(2048).optional()}),$n=sn.omit({hostOutcome:!0}).extend({...Te,__dorkosDevtools:Q("act-result"),dataUrl:ce().max(9e5).optional()}),Gn=on.extend({status:Be().int().min(0).max(599),durationMs:Be().min(0),responseSize:Be().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:Be().min(0)}),Hn=an.refine(e=>e.timestamp>=0),Vn=ht("__dorkosDevtools",[Z({__dorkosDevtools:Q("hello"),pageInstanceId:at,bridgeVersion:Q(2)}),Z({...Te,__dorkosDevtools:Q("ready"),pageInstanceId:at}),Z({...Te,__dorkosDevtools:Q("navigated")}),Z({...Te,__dorkosDevtools:Q("resource-error")}),Z({...Te,__dorkosDevtools:Q("batch"),seq:Be().int().min(0).max(Number.MAX_SAFE_INTEGER),console:jt(Hn).max(500),network:jt(Gn).max(200)}),Un,$n]);function Jn(e){const t=new Set;let r=0,n=0;const s=a=>(n+=a)<=16384;function o(a){if(!s(2))return!1;for(let i=0;i<a.length;i++){const d=a.charCodeAt(i);if(d>=55296&&d<=56319&&i+1<a.length&&a.charCodeAt(i+1)>=56320&&a.charCodeAt(i+1)<=57343){if(!s(2))return!1;i++;continue}const u=d===34||d===92||[8,9,10,12,13].includes(d)?2:d<32||d>=55296&&d<=57343?6:1;if(!s(u))return!1}return!0}function c(a,i){if(++r>2048||i>8)return!1;if(a===null)return s(4);if(typeof a=="boolean")return s(a?4:5);if(typeof a=="string")return o(a);if(typeof a=="number")return Number.isFinite(a)&&s(String(a).length);if(typeof a!="object"||t.has(a))return!1;const d=Object.getPrototypeOf(a);if(d!==Object.prototype&&d!==null&&d!==Array.prototype)return!1;const u=Array.isArray(a);if(u&&a.length>2048||Object.getOwnPropertySymbols(a).length||!s(2))return!1;t.add(a);let f=0;for(const l in a){if(!Object.prototype.hasOwnProperty.call(a,l))continue;if(++f>2048||u&&(!/^\d+$/.test(l)||Number(l)>=a.length))return!1;const m=Object.getOwnPropertyDescriptor(a,l);if(["__proto__","constructor","prototype"].includes(l)||!("value"in m)||!m.enumerable||f>1&&!s(1)||!u&&(!o(l)||!s(1))||!c(m.value,i+1))return!1}return t.delete(a),!u||f===a.length}try{return c(e,0)}catch{return!1}}function Xn(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 o=s.args;if(o!==void 0&&(!Array.isArray(o)||o.length>50||!Jn(o)))return null}}const r=Vn.safeParse(e);if(!r.success)return null;const n=r.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!Sr(n.dataUrl)?null:n}catch{return null}}function Sr(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=o=>t.charCodeAt(o)*2**24+(t.charCodeAt(o+1)<<16)+(t.charCodeAt(o+2)<<8)+t.charCodeAt(o+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 vt=null;async function tr(){return vt===null&&(vt=(await Re(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),vt}let bt=null;async function Zn(){if(bt===null){const e=await Re(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);bt={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return bt}async function rr(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:o}=await Zn();r();const c=e[0],a=e[e.length-1],i=new Uint8ClampedArray(c.data.length+a.data.length);i.set(c.data,0),i.set(a.data,c.data.length);const d=s(i,256),u=n();for(let l=0;l<e.length;l++){r();const m=e[l];if(u.writeFrame(o(m.data,d),m.width,m.height,{...l===0?{palette:d,repeat:0}:{},delay:t.frameMs}),u.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.`}}u.finish();const f=u.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 Yn(e,t,r=()=>{}){const n=[],s=document.createElement("canvas");let o=0,c=0;try{for(let a=0;a<Math.min(e.length,62);a++){r();const i=e[a];if(!Sr(i)){e[a]="";continue}const d=await Kn(i);e[a]="";try{if(r(),!d)continue;if(!o){const l=Math.min(1,Math.min(800,t)/Math.max(d.width,d.height,1));o=Math.max(1,Math.round(d.width*l)),c=Math.max(1,Math.round(d.height*l)),s.width=o,s.height=c}const u=s.getContext("2d",{willReadFrequently:!0});if(!u)return[];u.fillStyle="#ffffff",u.fillRect(0,0,o,c);const f=Math.min(o/d.width,c/d.height);u.drawImage(d,0,0,Math.round(d.width*f),Math.round(d.height*f)),r(),n.push({data:u.getImageData(0,0,o,c).data,width:o,height:c})}finally{d&&(d.src="")}}return n}catch(a){throw n.length=0,a}finally{e.length=0,s.width=0,s.height=0}}function Qn(e,t=()=>{}){const r=document.createElement("canvas"),n=document.createElement("canvas");try{for(let s=0;s<e.length;s++){t();const o=e[s];n.width=o.width,n.height=o.height,r.width=Math.max(1,Math.round(o.width/2)),r.height=Math.max(1,Math.round(o.height/2));const c=n.getContext("2d"),a=r.getContext("2d",{willReadFrequently:!0});if(!c||!a)throw new Error("Canvas pixels are unavailable");c.putImageData(new ImageData(new Uint8ClampedArray(o.data),o.width,o.height),0,0),a.drawImage(n,0,0,r.width,r.height),e[s]={data:a.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 Kn(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 nr(e,t,r){const n=r.slice().buffer;return{name:e,type:t,size:r.byteLength,arrayBuffer:async()=>n}}function es(e){const t=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(t,r=>r.charCodeAt(0))}const ts=8e3;function rs(e){const t=ae(),r=p.useRef(t);p.useLayoutEffect(()=>{r.current=t});const[n]=Mt(),[s,o]=p.useState(0),c=p.useRef(null),a=p.useRef(new Map),i=p.useRef(null),d=p.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),u=p.useRef(null),f=p.useRef(-1),l=p.useRef(null),m=p.useRef(null),w=p.useRef(!1),g=p.useRef(-1/0),v=p.useRef(!1),N=p.useRef(null),S=p.useRef(0),I=p.useRef(null),z=p.useRef(null),M=p.useRef(!1),L=p.useRef(null),P=p.useRef({...e,sessionId:n}),q=p.useRef(Promise.resolve()),G=p.useRef(()=>{}),re=p.useRef({initialize:x,retire:D,consume:ue,register:B,eligiblePending:ee,refuseRequest:k,live:R,captureFrame:mt,valid:Ke,reportRecordingStart:Ae,cancelReservation:Ut,finish:$t});p.useLayoutEffect(()=>{re.current={initialize:x,retire:D,consume:ue,register:B,eligiblePending:ee,refuseRequest:k,live:R,captureFrame:mt,valid:Ke,reportRecordingStart:Ae,cancelReservation:Ut,finish:$t}});const ge=O=>L.current===O||V.getState().openDocuments.some(b=>b.id===O&&b.openedHere);function y(O,{active:b,activation:E=!1,keepalive:j=!1,reset:T=!1}){if(!O.sessionId)return;const Y={documentId:O.documentId,logicalUrl:O.logicalUrl,bridgeGeneration:O.generation,seq:Math.max(0,f.current),console:[],network:[],active:b,activation:E,instrumented:O.ready&&!O.retired,...T?{reset:!0}:{}};q.current=q.current.then(()=>r.current.ingestDevtoolsCapture(O.sessionId,Y,j?{keepalive:!0}:void 0)).catch(()=>{})}function D(){var E;const O=c.current;O&&(O.retired=!0),c.current=null,u.current!==null&&clearTimeout(u.current),u.current=null,i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0},f.current=-1,g.current=-1/0,v.current=!1;for(const[j,T]of a.current)T.life.sessionId&&T.deadline>Date.now()&&T.kind!=="frame"&&k(j,T.kind,T.life,"The frame changed while this request was pending."),clearTimeout(T.timer),(E=T.resolve)==null||E.call(T,null);a.current.clear(),O&&y(O,{active:!1});const b=N.current;b&&(clearTimeout(b.reservationTimer),b.cancelled=!0,b.abort.abort(),b.frames.length=0,b.finishing||(b.drawn.length=0,N.current=null)),I.current!==null&&cancelAnimationFrame(I.current),I.current=null,S.current=0,o(0)}function x({loadActivation:O,reset:b=!1}={}){var $,se;const E=P.current,j=($=E.iframeRef.current)==null?void 0:$.contentWindow;if(w.current||!j||!E.bridgeEligibility||!E.resolvedSource)return;const T={generation:crypto.randomUUID(),frame:j,sessionId:E.sessionId,documentId:E.documentId,logicalUrl:E.logicalUrl,source:E.resolvedSource,origin:E.bridgeEligibility==="served-document"?"null":E.previewOrigin,ready:!1,activation:!1,retired:!1};c.current=T;const Y=O??(M.current||z.current!==T.documentId&&ge(T.documentId));T.activation=Y,M.current=!1,z.current=T.documentId,y(T,{active:!0,activation:Y,reset:b}),((se=l.current)==null?void 0:se.frame)===j&&l.current.source===E.resolvedSource&&l.current.reload===E.reloadNonce&&l.current.documentId===E.documentId&&l.current.logicalUrl===E.logicalUrl&&j.postMessage({__dorkosDevtools:"init",bridgeGeneration:T.generation},"*")}p.useLayoutEffect(()=>{var j;P.current={...e,sessionId:n};const O={frame:(j=e.iframeRef.current)==null?void 0:j.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},b=m.current;if(!b||Object.keys(O).some(T=>O[T]!==b[T])){const T=!b||b.frame!==O.frame||b.documentId!==O.documentId||b.logicalUrl!==O.logicalUrl||b.source!==O.source||b.reload!==O.reload;m.current=O,w.current=!1,D(),x({reset:T})}});const C=p.useCallback(()=>{var Y,$,se;const{initialize:O,retire:b}=re.current,E=P.current,j=(Y=E.iframeRef.current)==null?void 0:Y.contentWindow,T=($=c.current)!=null&&$.ready?!1:(se=c.current)==null?void 0:se.activation;j&&E.resolvedSource&&(l.current={frame:j,source:E.resolvedSource,reload:E.reloadNonce,documentId:E.documentId,logicalUrl:E.logicalUrl}),w.current=!1,b(),O({loadActivation:T,reset:!0})},[]),A=p.useCallback(()=>{const O=c.current;M.current=!0,L.current=P.current.documentId,O&&G.current({active:!0,activation:!0})},[]);p.useLayoutEffect(()=>{G.current=O=>{c.current&&y(c.current,O)}});function R(O){return c.current===O&&!O.retired}function k(O,b,E,j){if(!E.sessionId)return;const T={requestId:O,bridgeGeneration:E.generation,documentId:E.documentId,hostOutcome:"host",error:j};b==="action"?r.current.postDevtoolsAction(E.sessionId,{...T,ok:!1}).catch(()=>{}):r.current.ingestDevtoolsCapture(E.sessionId,{...T,logicalUrl:E.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],screenshot:{requestId:O,error:j}}).catch(()=>{})}function B(O,b,E,{capture:j=!1,resolve:T,timeoutMs:Y=8e3}={}){if(a.current.size>=_e.pending||a.current.has(O))return null;const $=setTimeout(()=>U(O,se),Y),se={kind:b,life:E,capture:j,deadline:Date.now()+Y,timer:$,resolve:T};return a.current.set(O,se),se}function U(O,b){var E;a.current.get(O)===b&&(a.current.delete(O),clearTimeout(b.timer),(E=b.resolve)==null||E.call(b,null))}function ee(O,b,E){return a.current.get(O)!==b||b.life!==E||!R(E)?!1:Date.now()>=b.deadline?(U(O,b),!1):!0}function ue(O,b,E){const j=a.current.get(O);return!j||j.life!==E||j.kind!==b&&!(b==="capture"&&j.kind==="frame")||!ee(O,j,E)?null:(a.current.delete(O),clearTimeout(j.timer),j)}p.useEffect(()=>{const{initialize:O,retire:b,consume:E}=re.current;function j(){u.current=null;const de=i.current;i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0};const _=c.current;de&&_&&!_.retired&&_.sessionId&&de.bridgeGeneration===_.generation&&r.current.ingestDevtoolsCapture(_.sessionId,de)}function T(de){var Ht,Vt,Jt,Xt;const _=c.current;if(!_||_.retired||de.source!==_.frame||de.origin!==_.origin||((Ht=l.current)==null?void 0:Ht.frame)!==_.frame||l.current.source!==_.source||l.current.reload!==P.current.reloadNonce||l.current.documentId!==_.documentId||l.current.logicalUrl!==_.logicalUrl)return;const F=de.data;if(!F||typeof F!="object"||typeof F.__dorkosDevtools!="string"||!["hello","ready","navigated","resource-error","batch","capture-result","act-result"].includes(F.__dorkosDevtools)||F.__dorkosDevtools!=="hello"&&F.bridgeGeneration!==_.generation)return;const ie=F.__dorkosDevtools==="batch";if(ie){if(!_.ready||!_.sessionId||F.bridgeGeneration!==_.generation||!Number.isSafeInteger(F.seq)||F.seq<0||F.seq<=f.current)return;const H=Date.now();if(H-g.current<_e.batchMs){i.current?i.current.dropped=!0:v.current=!0;return}g.current=H}const W=Xn(F);if(!W){ie&&(v.current=!0);return}if(W.__dorkosDevtools==="hello"){_.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:_.generation},"*");return}if(W.bridgeGeneration!==_.generation)return;if(W.__dorkosDevtools==="ready"){_.ready||(_.ready=!0,_.activation=!1,y(_,{active:!0}));return}if(!_.ready)return;if(W.__dorkosDevtools==="navigated"){w.current=!0,b();return}if(W.__dorkosDevtools==="resource-error"){S.current=Math.min(_e.resourceErrors,S.current+1),I.current===null&&(I.current=requestAnimationFrame(()=>{I.current=null,R(_)&&o(S.current)}));return}if(!_.sessionId)return;if(W.__dorkosDevtools==="batch"){if(W.seq<=f.current)return;f.current=W.seq;const H=i.current??{documentId:_.documentId,logicalUrl:_.logicalUrl,bridgeGeneration:_.generation,seq:W.seq,console:[],network:[]};H.seq=W.seq,v.current&&(H.dropped=!0),v.current=!1;const je=d.current,Zt=new TextEncoder;if(i.current||(je.overheadBytes=Zt.encode(JSON.stringify({...H,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),je.overheadBytes>_e.queueBytes){i.current=null,d.current={console:[],network:[],entryBytes:0,overheadBytes:0},v.current=!0;return}for(const[Fe,Qr]of[["console",W.console],["network",W.network]])for(const Kr of Qr){const Yt=Zt.encode(JSON.stringify(Kr)).length;je[Fe].push(Yt),je.entryBytes+=Yt}H.console.push(...W.console),H.network.push(...W.network);const Yr=()=>je.overheadBytes+je.entryBytes+Math.max(0,H.console.length-1)+Math.max(0,H.network.length-1);for(;H.console.length>500||H.network.length>200||Yr()>_e.queueBytes;){H.dropped=!0;const Fe=(((Vt=H.console[0])==null?void 0:Vt.timestamp)??1/0)<=(((Jt=H.network[0])==null?void 0:Jt.timestamp)??1/0)?"console":"network";if(!H[Fe].length)break;H[Fe].shift(),je.entryBytes-=je[Fe].shift()}i.current=H,u.current===null&&(u.current=setTimeout(j,_e.batchMs));return}if(W.__dorkosDevtools==="capture-result"){const H=E(W.requestId,"capture",_);if(!H)return;if(H.kind==="frame"){(Xt=H.resolve)==null||Xt.call(H,W.dataUrl??null);return}r.current.ingestDevtoolsCapture(_.sessionId,{bridgeGeneration:_.generation,documentId:_.documentId,logicalUrl:_.logicalUrl,seq:Math.max(0,f.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:W.requestId,dataUrl:W.dataUrl,error:W.error}});return}const ze=E(W.requestId,"action",_);if(!ze)return;const Ee=N.current,Gt=ze.capture&&W.dataUrl!==void 0&&Ee!==null&&Ee.life===_&&Ee.activated&&!Ee.finishing&&!Ee.cancelled&&Ee.frames.length<61;Gt&&Ee.frames.push(W.dataUrl);const{__dorkosDevtools:bo,dataUrl:wo,...Zr}=W;r.current.postDevtoolsAction(_.sessionId,{...Zr,hostOutcome:"page-reported",documentId:_.documentId,captured:Gt||void 0})}window.addEventListener("message",T);const Y=setInterval(()=>G.current({active:!0}),15e3),$=()=>{c.current||O(),G.current({active:!0,activation:!0})},se=()=>{G.current({active:!1,keepalive:!0}),b()},oe=()=>{document.visibilityState==="visible"&&$()};return window.addEventListener("focus",$),window.addEventListener("pagehide",se),window.addEventListener("pageshow",$),document.addEventListener("visibilitychange",oe),()=>{window.removeEventListener("message",T),clearInterval(Y),window.removeEventListener("focus",$),window.removeEventListener("pagehide",se),window.removeEventListener("pageshow",$),document.removeEventListener("visibilitychange",oe),b()}},[]),p.useEffect(()=>cn.subscribeSessionEvent((O,b)=>{if(b.type!=="devtools_capture_request"&&b.type!=="devtools_action_request"&&b.type!=="devtools_recording_request")return;const{register:E,eligiblePending:j,refuseRequest:T,captureFrame:Y,valid:$,finish:se,reportRecordingStart:oe,cancelReservation:de}=re.current,_=c.current;if(!(!(_!=null&&_.ready)||!_.sessionId||_.retired||b.targetClientId!==r.current.clientId||b.documentId!==_.documentId||b.bridgeGeneration!==_.generation)){if(b.type==="devtools_capture_request"||b.type==="devtools_action_request"){const F=b.type==="devtools_action_request",ie=E(b.requestId,F?"action":"capture",_,{capture:F&&!!b.capture,timeoutMs:F&&b.command.action==="wait_for"?Math.min(1e4,b.command.timeoutMs)+2e3:8e3});if(!ie){a.current.has(b.requestId)||T(b.requestId,F?"action":"capture",_,"Too many browser requests are waiting. Try again when one finishes.");return}const W=ze=>{j(b.requestId,ie,_)&&_.frame.postMessage(F?{__dorkosDevtools:"act-request",bridgeGeneration:_.generation,requestId:b.requestId,documentId:_.documentId,command:b.command,...b.capture?{capture:!0,lib:ze}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:_.generation,requestId:b.requestId,lib:ze},"*")};!F||b.capture?tr().then(W,()=>W()):W()}if(b.type==="devtools_recording_request"){if(b.action==="cancel-start"){de(b.recordingId,b.requestId,_);return}if(b.action==="confirm-start"){const F=N.current;if(!F||F.id!==b.recordingId||F.startRequestId!==b.requestId||F.life!==_||F.finishing||!$(F))return;if(!F.activated){if(performance.now()>=F.reservationDeadline){de(F.id,F.startRequestId,_),oe(b,_,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(F.reservationTimer),F.activated=!0,F.startedAt=Date.now(),Y(_).then(ie=>{ie&&$(F)&&F.frames.push(ie)})}oe(b,_,{phase:"started",ok:!0});return}if(b.action==="start"){const F=b.reservationTimeoutMs;if(!Number.isSafeInteger(F)||!F||F<1||F>ts){oe(b,_,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(N.current){oe(b,_,{phase:"reserved",ok:!1,error:"Another recording in this window is still running or being saved. Wait for it to finish, then start again."});return}const ie={id:b.recordingId,startRequestId:b.requestId,activated:!1,reservationDeadline:performance.now()+F,life:_,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};N.current=ie,ie.reservationTimer=setTimeout(()=>{N.current===ie&&!ie.activated&&de(ie.id,ie.startRequestId,_)},F),oe(b,_,{phase:"reserved",ok:!0})}else se(b.requestId,b.recordingId,_)}}}),[]);function Ae(O,b,E){!R(b)||!b.sessionId||r.current.ingestDevtoolsCapture(b.sessionId,{hostOutcome:"host",documentId:b.documentId,bridgeGeneration:b.generation,seq:0,console:[],network:[],recordingStart:{...E,requestId:O.requestId,recordingId:O.recordingId}}).catch(()=>{})}function Ut(O,b,E){var T;const j=N.current;if(!(!j||j.id!==O||j.startRequestId!==b||j.life!==E||j.finishing)){clearTimeout(j.reservationTimer),j.cancelled=!0,j.abort.abort(),j.frames.length=0,j.drawn.length=0;for(const[Y,$]of a.current)$.life===E&&$.kind==="frame"&&(clearTimeout($.timer),(T=$.resolve)==null||T.call($,null),a.current.delete(Y));N.current=null}}function Ke(O){return N.current===O&&!O.cancelled&&R(O.life)}function mt(O){const b=`frame-${crypto.randomUUID()}`;return new Promise(E=>{const j=B(b,"frame",O,{resolve:E});if(!j){E(null);return}tr().then(T=>{ee(b,j,O)&&O.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:O.generation,requestId:b,lib:T},"*")},()=>{U(b,j)})})}async function $t(O,b,E){const j=N.current;if(!j||!j.activated||j.id!==b||j.life!==E){R(E)&&await r.current.uploadDevtoolsRecording(E.sessionId,{requestId:O,bridgeGeneration:E.generation,documentId:E.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(j.finishing)return;j.finishing=!0;const T=()=>{if(!Ke(j))throw new Error("retired")},Y={requestId:O,bridgeGeneration:E.generation,documentId:E.documentId};try{const $=await mt(E);T(),$&&j.frames.length<_e.frames&&j.frames.push($);const se=j.frames.length?es(j.frames[j.frames.length-1]):new Uint8Array;j.drawn=await Yn(j.frames,800,T),T();let oe=await rr(j.drawn,{frameMs:500,maxBytes:8*1024*1024},T);if(T(),!oe.ok&&j.drawn.length&&(Qn(j.drawn,T),oe=await rr(j.drawn,{frameMs:500,maxBytes:8*1024*1024},T),T()),!oe.ok){await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,hostOutcome:"host",error:oe.error},{signal:j.abort.signal}),T();return}T(),await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,frames:j.drawn.length,durationMs:Date.now()-j.startedAt,recording:nr(`${b}.gif`,"image/gif",oe.bytes),keyframe:nr(`${b}.png`,"image/png",se)},{signal:j.abort.signal}),T()}catch{Ke(j)&&await r.current.uploadDevtoolsRecording(E.sessionId,{...Y,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:j.abort.signal}).catch(()=>{})}finally{j.frames.length=0,j.drawn.length=0,N.current===j&&(N.current=null)}}return{resourceErrorCount:s,notePersonNavigated:A,noteFrameLoaded:C}}const ns=15e3;function ss(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 is(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 os(e,t){const r=ae(),n=V(s=>s.setRoomCanvasEditing);p.useEffect(()=>{if(n(e,t),t===null)return;const s=c=>{r.setRoomCanvasEditing(e,t,c).catch(a=>{console.warn("[room-canvas] edit lock failed",{roomId:e,documentId:t,err:a})})};s(!0);const o=setInterval(()=>s(!0),ns);return()=>{clearInterval(o),s(!1),n(e,null)}},[r,e,t,n])}const as=400;function _o(e,t){const r=ae(),n=V(s=>s.roomCanvasPresenceEpoch[e]??0);p.useEffect(()=>{const s=a=>{r.setRoomCanvasViewing(e,a).catch(i=>{console.warn("[room-canvas] could not say where we are looking",{roomId:e,err:i})})};let o=!1;const c=setTimeout(()=>{o=!0,s(t)},as);return()=>{clearTimeout(c),o&&s(null)}},[r,e,t,n])}const cs="allow-scripts allow-forms allow-popups allow-modals",wt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",us=new Set(["javascript:","data:","blob:"]),ls=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function Lt(e){return ls.has(e)||e.endsWith(".localhost")}function ds(e){return Lt(e)?"direct":"server"}function fs(e,t){let r;try{r=new URL(e)}catch{return null}const n=r.searchParams.get(sr),s=new URL(r.origin),o=t.indexOf("?");return s.pathname=(o===-1?t:t.slice(0,o))||"/",s.search=o===-1?"":t.slice(o),n!==null&&s.searchParams.set(sr,n),s.toString()}const sr="__dorkos_preview",hs="/__dorkos_preview/health";function ps(e){return e==="https:"?443:80}function Dr(e){let t;try{t=new URL(e)}catch{return{mode:"serve",path:e}}if(us.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(Lt(t.hostname)){const r=t.port?Number(t.port):ps(t.protocol);return{mode:"proxy",hostname:t.hostname,port:r,path:`${t.pathname}${t.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function ms(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`${Lt(s)?"http":"https"}://${t}`}function gs(e){const t=Dr(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 vs=2e3;async function ir(e,t=globalThis.fetch,r=vs){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 bs({target:e,currentUrl:t,strategy:r,cwd:n,reloadNonce:s}){const o=JSON.stringify([t,r,n,s]),[c,a]=p.useState(null),[i,d]=p.useState(null),[u,f]=p.useState(null),l=ae(),m=p.useRef(l);return p.useEffect(()=>{m.current=l}),p.useEffect(()=>{const w=m.current;let g=!1;const v=z=>{a(o),d(z)};async function N(z){if(n===null){f({kind:"no-session"});return}try{const M=await w.createServeUrl(n,z);if(g)return;M===null?f({kind:"unsupported"}):v({src:M,sandbox:cs,previewOrigin:null,bridgeEligibility:"served-document"})}catch{g||f({kind:"failed"})}}async function S(z,M){let L;try{const q=await w.probeLoopbackPort(z);L=q===null?"unknown":q.listening}catch{L="unknown"}if(g)return;let P=null;if(L!==!1){let q=null;try{q=await w.createProxyUrl(z)}catch{if(g)return;P={kind:"failed"}}if(g)return;if((q==null?void 0:q.unavailable)==="tunnel"){f({kind:"tunnel"});return}if((q==null?void 0:q.unavailable)==="no-port"&&(P={kind:"no-port"}),q!=null&&q.url){const G=new URL(q.url);if(await ir(`${G.origin}${hs}`)){if(g)return;const re=fs(q.url,M);if(re!==null){v({src:re,sandbox:wt,previewOrigin:G.origin,bridgeEligibility:"preview-listener"});return}}if(g)return;P={kind:"origin-unreachable",host:G.hostname,listenPort:G.port}}}if(r==="direct"&&await ir(t)){if(g)return;v({src:t,sandbox:wt,previewOrigin:null,bridgeEligibility:null});return}g||f(P??{kind:"no-upstream"})}async function I(){if(f(null),d(null),e.mode!=="blocked"){if(e.mode==="external"){v({src:e.url,sandbox:wt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?N(e.path):S(e.port,e.path)}}return I(),()=>{g=!0}},[e,t,r,n,s,o]),{resolved:c===o?i:null,resolveError:u}}const ws=1e4;function xs(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 ys({documentId:e,content:t}){const r=V(C=>C.selectedCwd),n=V(C=>C.writeBrowserHistory),[s]=p.useState(()=>xs(V.getState().browserHistories[e],t.url)),[o,c]=p.useState(s.stack),[a,i]=p.useState(s.cursor),[d,u]=p.useState(0);p.useEffect(()=>{n(e,{contentUrl:t.url,stack:o,cursor:a})},[e,t.url,o,a,n]);const f=o[a],l=p.useMemo(()=>Dr(f),[f]),m=p.useMemo(()=>l.mode==="proxy"?ds(window.location.hostname):null,[l]),w=p.useRef(null),{resolved:g,resolveError:v}=bs({target:l,currentUrl:f,strategy:m,cwd:r,reloadNonce:d}),{resourceErrorCount:N,notePersonNavigated:S,noteFrameLoaded:I}=rs({iframeRef:w,documentId:e,logicalUrl:f,reloadNonce:d,previewOrigin:(g==null?void 0:g.previewOrigin)??null,bridgeEligibility:(g==null?void 0:g.bridgeEligibility)??null,resolvedSource:(g==null?void 0:g.src)??null}),z=V(C=>C.roomCanvasLiveRoomId),{open:M}=is(z??""),[L,P]=p.useState(null),q=p.useCallback(C=>{c(A=>[...A.slice(0,a+1),C]),i(A=>A+1)},[a]),G=un(z),re=V(C=>z?C.roomCanvasEditing[z]??null:null);p.useEffect(()=>{if(G===null||re!==null||G.documentId!==e)return;const C=G.url;C===void 0||C===f||q(C)},[G,re,e,f,q]);const ge=a>0,y=a<o.length-1,D=p.useCallback(C=>{const A=ms(C);if(!A||A===f){S(),u(R=>R+1);return}if(z){P(null),M({type:"browser",url:A}).catch(R=>{P({url:A,message:ss(R)})});return}S(),q(A)},[f,q,z,M,S]),x=()=>pn(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(et,{label:"Back",disabled:!ge,onClick:()=>i(C=>C-1),children:h.jsx(ln,{className:"size-4"})}),h.jsx(et,{label:"Forward",disabled:!y,onClick:()=>i(C=>C+1),children:h.jsx(dn,{className:"size-4"})}),h.jsx(et,{label:"Reload",onClick:()=>u(C=>C+1),children:h.jsx(Dn,{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(ks,{url:(L==null?void 0:L.url)??f,startEditing:L!==null,onSubmit:D},L===null?"address":`retry:${L.url}`)}),h.jsx(et,{label:"Open in system browser",onClick:x,children:h.jsx(fn,{className:"size-4"})})]}),L!==null&&h.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:L.message}),h.jsx(Rs,{target:l,resolved:g,resolveError:v,reloadNonce:d,resourceErrorCount:N,title:t.title??"Embedded browser",onOpenExternally:x,onReload:()=>{S(),u(C=>C+1)},iframeRef:w,onFrameLoad:I})]})}function ks({url:e,startEditing:t=!1,onSubmit:r}){const[n,s]=p.useState(t),[o,c]=p.useState(e);if(!n)return h.jsx(Cs,{url:e,onActivate:()=>{c(e),s(!0)}});const a=i=>{i.preventDefault(),s(!1),r(o)};return h.jsx("form",{onSubmit:a,className:"min-w-0 flex-1",children:h.jsx(hn,{"aria-label":"Address",autoFocus:!0,value:o,onChange:i=>c(i.target.value),onFocus:i=>i.currentTarget.select(),onBlur:()=>s(!1),onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),s(!1))},spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:"h-11 w-full text-base lg:h-7 lg:text-sm"})})}function js(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function Cs({url:e,onActivate:t}){const r=p.useMemo(()=>gs(e),[e]);return h.jsxs("button",{type:"button","aria-label":`Address: ${js(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 Os(e,t){switch(e.kind){case"no-session":return"Open a chat to preview local files.";case"unsupported":return"Local previews aren’t available in this environment.";case"failed":return"Couldn’t load this preview. Reload, or open the app in your browser.";case"tunnel":return"Dev server previews don’t work remotely. Open DorkOS on the computer running it.";case"no-port":return"All preview ports are in use. Close a preview, then reload.";case"origin-unreachable":return`This view can’t reach port ${e.listenPort} on ${e.host}. Open DorkOS on the computer running it.`;case"no-upstream":return`Nothing is listening on ${t.mode==="proxy"?`${t.hostname}:${t.port}`:"that address"}. Start the dev server, then reload.`}}function Rs({target:e,resolved:t,resolveError:r,reloadNonce:n,resourceErrorCount:s,title:o,onOpenExternally:c,onReload:a,iframeRef:i,onFrameLoad:d}){if(e.mode==="blocked")return h.jsx(xt,{children:"This address is blocked for safety."});if(r!==null)return h.jsxs(xt,{children:[h.jsx("p",{children:Os(r,e)}),r.kind!=="no-session"&&r.kind!=="unsupported"&&h.jsx("button",{type:"button",onClick:a,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(t===null)return h.jsx(xt,{children:"Loading…"});const u=e.mode==="external";return h.jsx(Es,{src:t.src,sandbox:t.sandbox,title:o,iframeRef:i,onFrameLoad:d,watchLoadDeadline:!u,resourceErrorCount:s,showEmbedFallback:u,onOpenExternally:c,onReload:a},`${t.src}:${n}`)}function Es({src:e,sandbox:t,title:r,iframeRef:n,onFrameLoad:s,watchLoadDeadline:o,resourceErrorCount:c,showEmbedFallback:a,onOpenExternally:i,onReload:d}){const[u,f]=p.useState(!1),[l,m]=p.useState(!1);return p.useEffect(()=>{if(!o)return;const w=setTimeout(()=>m(!0),ws);return()=>clearTimeout(w)},[o]),h.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[l&&!u&&h.jsx(or,{onOpenExternally:i,onReload:d,children:"This preview is slow to load."}),c>0&&h.jsxs(or,{onOpenExternally:i,children:["This page hit ",c===1e4?"at least 10,000":c," ",c===1?"error":"errors"," while loading."]}),h.jsx("iframe",{ref:n,src:e,sandbox:t,onLoad:()=>{f(!0),s()},className:"min-h-0 w-full flex-1 border-0",title:r}),a&&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:i,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function or({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 et({label:e,disabled:t,onClick:r,children:n}){return h.jsx("button",{type:"button","aria-label":e,disabled:t,onClick:r,className:qt("text-muted-foreground hover:text-foreground hover:bg-muted focus-ring flex size-11 shrink-0 items-center justify-center rounded-md transition-colors lg:size-7",t&&"pointer-events-none opacity-40"),children:n})}function xt({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 _s=4096;function Ss(e){return e.toLowerCase().endsWith(".md")?e.slice(0,-3):e}function Ds(e){const t=e.trim(),r=/^(["'])(.*)\1$/.exec(t);return r?r[2].trim():/^[|>][+-]?\d*$/.test(t)?"":t.replace(/\s+#.*$/,"").trim()}function Is(e,t){var o;const r=e.replace(/^\uFEFF/,"").split(/\r?\n/);let n=0;if(r[0]==="---"){for(n=1;n<r.length;n+=1){const c=r[n];if(c==="---"||c==="...")break;const a=/^title:(.*)$/.exec(c);if(a){const i=Ds(a[1]);if(i!=="")return i}}n+=1}let s=null;for(;n<r.length;n+=1){const c=r[n],a=(o=/^ {0,3}(`{3,}|~{3,})/.exec(c))==null?void 0:o[1];if(a){s===null?s=a[0]:a[0]===s&&(s=null);continue}if(s!==null)continue;const i=/^ {0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*$/.exec(c);if(i&&i[1].trim()!=="")return i[1].trim()}return Ss(t)}function Ns(e,t,r=_s){let n=new TextDecoder().decode(e.subarray(0,r));return e.length>=r&&(n=n.slice(0,Math.max(0,n.lastIndexOf(`
|
|
25
|
-
`)))),Is(n,t)}function Ts(e,t){return Ns(new TextEncoder().encode(e),t)}const Ir=Z({path:ce().min(1),title:ce(),slug:ce()});Z({root:ce(),docs:jt(Ir),truncated:it()});Z({cwd:ce().min(1)});Z({cwd:ce().min(1),target:ce().min(1).max(1e3),from:ce().min(1).optional()});Z({doc:Ir.nullable(),complete:it()});const Rt=".md";function we(e){return e.normalize("NFC").trim().toLowerCase()}function Nr(e){return we(e).replace(/\s+/g,"-")}function Le(e){return e.toLowerCase().endsWith(Rt)?e.slice(0,-Rt.length):e}function ar(e){return e.slice(e.lastIndexOf("/")+1)}function nt(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function ct(e){return e===""?[]:e.split("/")}function As(e,t){const r=ct(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 cr(e,t){const r=ct(e),n=ct(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 zs(e){return Nr(e).replace(/[^\p{L}\p{N}_-]/gu,"")}function Fs(e,t,r=null){const n=r&&r.trim()!==""?`#${zs(r)}`:"",s=e===null?null:e.normalize("NFC"),o=t.normalize("NFC");if(s===o&&n)return n;const c=ct(s===null?"":nt(s)),a=o.split("/");let i=0;for(;i<c.length&&i<a.length-1&&c[i]===a[i];)i+=1;return[...Array.from({length:c.length-i},()=>".."),...a.slice(i)].map(encodeURIComponent).join("/")+n}const Ms=/[[\]|#\n\r]/,qs=20;function Ls(e){const t=e.map(a=>({doc:a,folder:nt(a.path),path:we(a.path),title:we(a.title),base:we(Le(ar(a.path)))})),r=new Map(t.map(a=>[a.path,a])),n=a=>(i,d)=>cr(a,i.folder)-cr(a,d.folder)||i.doc.path.length-d.doc.path.length||(i.doc.path<d.doc.path?-1:i.doc.path>d.doc.path?1:0);function s(a,i){const d=Le(a),u=a.startsWith("/")?[""]:[i,""];for(const f of u){const l=As(f,d);if(l===null)continue;const m=r.get(we(l+Rt));if(m)return m}}function o(a,i){const d=a.normalize("NFC").trim();if(d==="")return null;const u=i===null?"":nt(i);if(d.includes("/")){const g=s(d,u);if(g)return g}const f=we(d),l=we(Le(d)),m=Nr(l),w=t.filter(g=>g.title===f||g.base===l||g.doc.slug===m);return w.length===0?null:w.sort(n(u))[0]??null}function c(a,i){const d=[a.doc.title.trim(),Le(ar(a.doc.path)),`/${Le(a.doc.path)}`];for(const u of d)if(!(u===""||Ms.test(u))&&o(u,i)===a)return u;return null}return{docs:e,resolve:(a,i)=>{var d;return((d=o(a,i))==null?void 0:d.doc)??null},search(a,i,d=qs){const u=we(a),f=i===null?"":nt(i),l=i===null?null:we(i),m=[];for(const v of t){if(v.path===l)continue;const N=u===""||v.title.startsWith(u)?0:v.title.split(/[\s\-_/]+/).some(S=>S.startsWith(u))?1:v.title.includes(u)?2:v.path.includes(u)?3:-1;N>=0&&m.push({entry:v,score:N})}const w=n(f);m.sort((v,N)=>v.score-N.score||w(v.entry,N.entry));const g=[];for(const{entry:v}of m){if(g.length>=d)break;const N=c(v,i);N!==null&&g.push({target:N,title:v.doc.title,description:v.doc.path})}return g}}}function ur(e,t){const r=t.normalize("NFC").replaceAll("\\","/"),n=r.startsWith("/")||/^[A-Za-z]:\//.test(r);let s=r;if(n){const c=e.normalize("NFC").replaceAll("\\","/").replace(/\/+$/,"");if(!r.startsWith(`${c}/`))return null;s=r.slice(c.length+1)}const o=[];for(const c of s.split("/"))if(!(c===""||c==="."))if(c===".."){if(o.length===0)return null;o.pop()}else o.push(c);return o.length===0?null:o.join("/")}const lr="Links within this doc don’t open.",dr="This folder is too big to check this link.",fr="Couldn’t check this link.";function hr(e,t,r){return{exists:!0,href:Fs(e,t.path,r),title:t.title}}function Ps(e){const{index:t,truncated:r,docPath:n,lookup:s,open:o,refuse:c}=e,a=new Map,i=f=>{const l=f.normalize("NFC").trim().toLowerCase();let m=a.get(l);return m||(m=s(f.trim()).catch(()=>null),a.set(l,m)),m};return{resolve:f=>{if(f.target.trim()==="")return{exists:!1,title:lr};const l=t.resolve(f.target,n);return l?hr(n,l,f.heading):r?i(f.target).then(m=>m===null?{exists:!0,title:fr}:m.doc?hr(n,m.doc,f.heading):m.complete?{exists:!1}:{exists:!0,title:dr}):{exists:!1}},search:f=>t.search(f,n),onOpen:f=>{const l=f.target.trim();if(l===""){c(lr);return}const m=`No doc called “${l}” yet.`,w=t.resolve(l,n);if(w){o(w.path);return}if(!r){c(m);return}i(l).then(g=>{g!=null&&g.doc?o(g.doc.path):c(g===null?fr:g.complete?m:dr)})}}}function Bs({cwd:e,sourcePath:t,content:r="",saved:n=!1}){const{enabled:s}=mn(gn),o=s&&!!e&&!!t,{data:c}=Bn(e,o),a=Wn(),i=ae(),{setTheme:d}=vn(),u=o&&c&&e&&t?ur(e,t)??ur(c.root,t):null,f=p.useMemo(()=>c?Ls(c.docs):null,[c]),l=p.useRef({index:f,docPath:u,content:r,cwd:e});p.useEffect(()=>{l.current={index:f,docPath:u,content:r,cwd:e}}),p.useEffect(()=>{const{index:w,docPath:g,content:v,cwd:N}=l.current;if(!n||!w||g===null)return;const S=w.docs.find(z=>z.path.normalize("NFC").toLowerCase()===g.toLowerCase()),I=g.slice(g.lastIndexOf("/")+1);(!S||S.title!==Ts(v,I))&&a(N)},[n,a]);const m=p.useCallback(w=>{bn({getStore:V.getState,setTheme:d,supportsTerminal:i.supportsTerminal},{action:"open_file",sourcePath:w},"user")},[d,i]);return p.useMemo(()=>{if(!(!f||!c||u===null||!e))return Ps({index:f,truncated:c.truncated,docPath:u,lookup:w=>i.resolveDocLink(e,w,u),open:m,refuse:w=>wn.info(w)})},[f,c,u,e,i,m])}const Je=ce().min(1).max(128),he={protocol:Q("dorkos-doc"),v:Q(1),nonce:Je,requestToken:Je,loadToken:Ct,generation:yr.shape.generation};ht("kind",[Z({...he,kind:Q("challenge")}).strict(),Z({...he,kind:Q("ack")}).strict(),Z({...he,kind:Q("connect")}).strict()]);ht("kind",[Z({...he,kind:Q("emit"),requestId:Je,event:ot}).strict(),Z({...he,kind:Q("retire")}).strict()]);ht("kind",[Z({...he,kind:Q("receipt"),requestId:Je,receipt:kr}).strict(),Z({...he,kind:Q("refused"),requestId:Je,outcome:Kt(["cancelled","unconfirmed","refused"])}).strict(),Z({...he,kind:Q("state"),state:yn,stateRev:Ct,docSeq:Ct,reset:it()}).strict(),Z({...he,kind:Q("event"),frame:kn}).strict(),Z({...he,kind:Q("status"),status:Kt(["connecting","ready","offline","revoked"]),unconfirmed:it()}).strict()]);function Ws(e,t){try{if(xn(t,1048576)!==void 0)return null;const r=e.safeParse(t);return r.success?r.data:null}catch{return null}}function Us({owner:e,getOwner:t,readTail:r,writeTail:n,transport:s,cwd:o,sourcePath:c,documentId:a,pending:i}){const d=()=>{var g,v;return((g=t())==null?void 0:g.recoveryGate)==="unsupported"||((v=t())==null?void 0:v.recoveryGate)==="observed_clear"},u=g=>{var S;const v=jn.parse(g),N=(S=t())==null?void 0:S.recoveryBinding;if(!N||v.documentId!==a||!J(v.incarnation,N.incarnation))throw new Error("Original save scope changed");return v},f=s.originalFileSaveRecovery,l=()=>{var g;try{const v=t();return(v==null?void 0:v.identity)===e&&v.active&&!!((g=v.recoveryBinding)!=null&&g.current())}catch{return!1}},m=(g,v,N=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const S=t(),I={},z=()=>t()===S&&l()&&(!v||S.recoveryBinding===v)&&(!N||S.recoveryWork===I),M=S.discovery;let L=!1;S.recoveryWork=I,S.recoveryGate="pending",S.recoveryBusy=!0;const P=r().catch(()=>{}).then(async()=>{try{if(!z())return{status:"idle"};const q=await g();return z()?(N&&(S.recoveryGate="observed_clear"),L=!0,{status:"observed",value:q}):{status:"idle"}}catch{return z()?(S.recoveryGate="unavailable",{status:"unavailable"}):{status:"idle"}}finally{!L&&S.discovery===M&&(S.discovery=void 0),S.recoveryWork===I&&(S.recoveryBusy=!1,S.recoveryWork=void 0)}});return N||n(P.then(()=>{})),P};return{identity:e,supported:!!f,current:l,discover:(g=!1)=>{if(!f||!l())return Promise.resolve({status:"idle"});const v=t(),N=v.recoveryBinding;if(v.discoveryBinding===N&&v.discovery&&(v.pendingDiscovery===v.discovery||!g&&v.recoveryGate==="observed_clear"))return v.discovery;const S=m(async()=>{const I=u(await f.discover(a));return t()===v&&v.recoveryBinding===N&&l()&&(v.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),I},N);return v.discoveryBinding=N,v.discovery=S,v.pendingDiscovery=S,S.then(I=>{v.pendingDiscovery===S&&(v.pendingDiscovery=void 0),I.status==="idle"&&v.discovery===S&&(v.discovery=void 0)}),S},recover(g){if(i())return Promise.resolve({status:"local_uncertain"});const v=t();return m(async()=>{if(!v||i())throw new Error("Mounted original still uncertain");const N=v.recoveryBinding,S=Cn.parse(await f.recover(a,g,N.incarnation));if(t()!==v||!l()||S.documentId!==a||S.entry.eventId!==g||!J(S.incarnation,N.incarnation))throw new Error("Original recovery scope changed");const I=u(await f.discover(a));return t()===v&&l()&&(v.recoveryGate=I.admission==="blocked"?"blocked":"observed_clear"),{result:S,discovery:I}})},inspectCurrent(){const g=t();return!g||!l()||i()||!d()?Promise.resolve({status:"local_uncertain"}):m(async()=>{const v=await s.readFileContent(o,c);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}},g.recoveryBinding,!0)}}}class Se extends Error{constructor(){super("The original save is not confirmed. Retry it before saving another draft.")}}class Ge extends Error{}function $s(){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 Gs(e){const t=e;return(t==null?void 0:t.status)===412&&t.code==="DOC_SAVE_FAILED"}var fe,Ie,Ye,Et;class Hs{constructor(){qe(this,Ye);qe(this,fe);qe(this,Ie)}get pending(){return Me(this,fe)!==void 0}get receipt(){return Me(this,Ie)}async write(t,r,n,s,o,c,a=!1){if(Me(this,fe))throw new Se;if(ve(this,Ie,void 0),!c)return t.writeFile(r,n,s,o);if(!a&&!c.current())throw new Ge;const i=Object.freeze({cwd:r,path:n,content:s,options:Object.freeze({...o,documentSave:Object.freeze({documentId:c.incarnation.documentId,eventId:$s(),incarnation:Object.freeze({...c.incarnation})})})});return ve(this,fe,i),be(this,Ye,Et).call(this,t,i)}async retry(t,r){const n=Me(this,fe);if(!(n!=null&&n.options.documentSave)||!r.current()||!J(n.options.documentSave.incarnation,r.incarnation))throw new Ge;return{result:await be(this,Ye,Et).call(this,t,n),content:n.content}}}fe=new WeakMap,Ie=new WeakMap,Ye=new WeakSet,Et=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 Se;if(!n.ok){if(!n.conflict||typeof n.conflict.currentHash!="string"||!n.conflict.currentHash||typeof n.conflict.currentContent!="string")throw new Se;return ve(this,fe,void 0),n}if(typeof n.hash!="string"||!n.hash||n.effect!=="changed"&&n.effect!=="no_op")throw new Se;const s="documentReceipt"in n?On.parse(n.documentReceipt):void 0,o=r.options.documentSave;if(!s&&n.effect!=="no_op")throw new Se;if(s&&(s.documentId!==o.documentId||s.eventId!==o.eventId||!J(s.incarnation,o.incarnation)||s.fileHash!==n.hash||(s.status==="accepted"?n.effect!=="changed":n.effect!=="no_op")))throw new Se;if((s==null?void 0:s.status)==="duplicate"){const c=await t.readFileContent(r.cwd,r.path);if(!c||typeof c!="object"||Array.isArray(c)||typeof c.hash!="string"||!c.hash||typeof c.content!="string")throw new Se;if(c.hash!==s.fileHash||c.content!==r.content)return ve(this,Ie,s),ve(this,fe,void 0),{ok:!1,conflict:{currentHash:c.hash,currentContent:c.content}}}return ve(this,Ie,s),ve(this,fe,void 0),n}catch(n){throw Gs(n)&&ve(this,fe,void 0),n}};function Vs({sourcePath:e,cwd:t,loadedContent:r,documentId:n,documentSaveBinding:s,documentRecoveryBinding:o}){const c=ae(),a=(s==null?void 0:s.incarnation)??(o==null?void 0:o.incarnation),i=a?JSON.stringify([a.documentId,a.physicalOpenedAt,a.channelCreatedAt,a.generation]):void 0,d=p.useRef(new Hs),u=p.useMemo(()=>({sourcePath:e,cwd:t,documentId:n,transport:c,birthKey:i}),[e,t,n,c,i]),f=p.useRef(null),l=p.useRef(null),m=p.useRef(Promise.resolve()),w=p.useCallback(()=>{var R;return((R=l.current)==null?void 0:R.identity)===u&&l.current.active},[u]);p.useLayoutEffect(()=>{var R;return((R=l.current)==null?void 0:R.identity)!==u?l.current={identity:u,baseHash:null,baseContent:r,active:!0,recoveryBinding:o,recoveryGate:o&&c.originalFileSaveRecovery?"pending":"unsupported"}:(l.current.active=!0,l.current.recoveryBinding=o),()=>{var k;((k=l.current)==null?void 0:k.identity)===u&&(l.current.active=!1)}},[u,r,o,c]);const[g,v]=p.useState({owner:u,status:"idle",conflict:null}),N=g.owner===u?g.status:"idle",S=g.owner===u?g.conflict:null,I=p.useCallback((R,k,B)=>{w()&&v(U=>({owner:u,status:R,documentReceipt:k,confirmedContent:B,conflict:U.owner===u?U.conflict:null}))},[u,w]),z=p.useCallback(R=>{w()&&v(k=>({owner:u,conflict:R,status:k.owner===u?k.status:"idle"}))},[u,w]),M=p.useCallback(()=>{var R,k;return((R=l.current)==null?void 0:R.recoveryGate)==="unsupported"||((k=l.current)==null?void 0:k.recoveryGate)==="observed_clear"},[]),L=p.useMemo(()=>{const R=()=>Us({owner:u,getOwner:()=>l.current,readTail:()=>m.current,writeTail:k=>{m.current=k},transport:c,cwd:t,sourcePath:e,documentId:n,pending:()=>d.current.pending});return{identity:u,supported:!!c.originalFileSaveRecovery,current:()=>R().current(),discover:k=>R().discover(k),recover:k=>R().recover(k),inspectCurrent:()=>R().inspectCurrent()}},[u,c,t,e,n]),P=!!(e&&t),q=p.useCallback((R,k,B,U=!1)=>{const ee=()=>w()&&l.current===R&&(!s||s.current());if(k.ok){if(typeof k.hash!="string"||!k.hash||k.effect!=="changed"&&k.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return R.baseHash=k.hash,R.baseContent=B,!U&&!ee()?{status:"idle"}:(U||(z(null),I("saved",d.current.receipt,B)),{status:k.effect,confirmed:{hash:k.hash,content:B}})}return!U&&!ee()?{status:"idle"}:(U||(z(k.conflict),I("conflict")),{status:"conflict"})},[w,s,z,I]),G=p.useCallback(async(R,k)=>{if(!w())return{status:"idle"};const B=l.current;s&&!d.current.pending&&(f.current=u);const U=await d.current.write(c,t,e,R,k,s);return q(B,U,R)},[w,c,t,e,s,q,u]),re=p.useCallback(R=>{var U;if(!P||!w())return Promise.resolve({status:"idle"});const k=((U=l.current.finalToken)==null?void 0:U.content)===R?l.current.finalToken:void 0,B=m.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(d.current.pending)return I("uncertain"),{status:"uncertain"};if(!M())return I("error"),{status:"error"};l.current.finalToken===k&&(l.current.finalToken=void 0),I("saving");try{const ee=l.current.baseHash!==null?{expectedHash:l.current.baseHash}:{expectedContent:l.current.baseContent};return await G(R,ee)}catch(ee){if(ee instanceof Ge)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const ue=d.current.pending?"uncertain":"error";return I(ue),{status:ue}}});return m.current=B.then(()=>{}),B},[P,G,w,I,s,M]),ge=p.useCallback(R=>{if(!P||!w()||s&&!s.current())return null;const k=l.current,B={content:R,id:Symbol("buffered canvas draft")};return k.finalToken=B,{cancel(){k.finalToken===B&&(k.finalToken=void 0)},flush(){if(k.finalToken!==B||l.current!==k||k.active)return Promise.resolve({status:"idle"});k.finalToken=void 0;const U=m.current.catch(()=>{}).then(async()=>{if(l.current!==k||k.active)return{status:"idle"};try{if(k.recoveryGate!=="unsupported"&&k.recoveryGate!=="observed_clear")return{status:"error"};const ee=k.baseHash!==null?{expectedHash:k.baseHash}:{expectedContent:k.baseContent};s&&!d.current.pending&&(f.current=u);const ue=await d.current.write(c,t,e,R,ee,s,!0);return q(k,ue,R,!0)}catch{return{status:"error"}}});return m.current=U.then(()=>{}),U}}},[P,w,c,t,e,s,q,u]),y=p.useCallback(async R=>{const k=l.current;return!k||k.identity!==u?!1:(await m.current.catch(()=>{}),l.current===k&&!d.current.pending&&k.baseContent===R)},[u]),D=p.useCallback(()=>{if(!w()||!s||f.current!==u)return Promise.resolve({status:"idle"});const R=l.current,k=m.current.catch(()=>{}).then(async()=>{if(!w()||l.current!==R||f.current!==u)return{status:"idle"};try{I("saving");const B=await d.current.retry(c,s);return q(R,B.result,B.content)}catch(B){if(B instanceof Ge||!w()||l.current!==R)return{status:"idle"};const U=d.current.pending?"uncertain":"error";return I(U),{status:U}}});return m.current=k.then(()=>{}),k},[w,s,c,q,I,u]),x=p.useCallback(R=>{var ee;if(!P||!S||!w())return Promise.resolve({status:"idle"});const k=S.currentHash,B=((ee=l.current.finalToken)==null?void 0:ee.content)===R?l.current.finalToken:void 0,U=m.current.catch(()=>{}).then(async()=>{if(!w()||s&&!s.current())return{status:"idle"};if(d.current.pending)return I("uncertain"),{status:"uncertain"};if(!M())return I("error"),{status:"error"};l.current.finalToken===B&&(l.current.finalToken=void 0),I("saving");try{return await G(R,{expectedHash:k})}catch(ue){if(ue instanceof Ge)return{status:"idle"};if(!w()||s&&!s.current())return{status:"idle"};const Ae=d.current.pending?"uncertain":"error";return I(Ae),{status:Ae}}});return m.current=U.then(()=>{}),U},[P,S,G,w,I,s,M]),C=p.useCallback(()=>{var R;return((R=l.current)==null?void 0:R.identity)===u?{hash:l.current.baseHash,content:l.current.baseContent}:{hash:null,content:r}},[u,r]),A=p.useCallback(()=>{if(!S||!w()||s&&!s.current())return null;l.current.finalToken=void 0;const R=S.currentContent;return l.current.baseHash=S.currentHash,l.current.baseContent=R,z(null),I("idle"),R},[S,w,z,I,s]);return{recovery:L,status:N,conflict:S,canSave:P,save:re,overwrite:x,adoptDisk:A,getConfirmedBase:C,prepareFinalSave:ge,retryUnconfirmed:D,waitForCloseDrain:y,documentReceipt:g.owner===u?g.documentReceipt:void 0,confirmedContent:g.owner===u?g.confirmedContent:void 0}}const Js=p.lazy(()=>Re(()=>import("./BlintzCanvas-b30dG4gx.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas}))),Xs=500;function Zs(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function Ys({content:e,documentId:t,onContentChange:r}){const[n,s]=p.useState(!1),[o,c]=p.useState(e.content),a=V(x=>x.canvasSessionId),i=V(x=>x.setDocumentEditing),d=V(x=>{var C;return((C=x.openDocuments.find(A=>A.id===t))==null?void 0:C.editing)??!1}),u=V(x=>x.selectedCwd),f=n&&d,l=Vs({documentId:t,sourcePath:e.sourcePath,cwd:u,loadedContent:e.content}),m=l.canSave,w=Bs({cwd:u,sourcePath:m?e.sourcePath:null,content:o,saved:l.status==="saved"}),g=p.useRef(null),v=p.useRef(null),N=p.useRef(o),S=p.useRef(e),I=p.useRef(r),z=p.useRef(l.save),M=p.useRef(l.prepareFinalSave),L=p.useRef(null);p.useEffect(()=>{N.current=o,S.current=e,I.current=r,z.current=l.save,M.current=l.prepareFinalSave});const P=p.useCallback(x=>{V.getState().canvasSessionId===g.current&&(I.current({...S.current,content:x}),z.current(x))},[]),q=p.useCallback(x=>{var C;c(x),N.current=x,(C=L.current)==null||C.cancel(),L.current=M.current(x),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{v.current=null,P(x)},Xs)},[P]),G=()=>{g.current=V.getState().canvasSessionId,c(e.content),s(!0),i(t,!0)},re=()=>{v.current&&(clearTimeout(v.current),v.current=null,P(N.current)),s(!1),i(t,!1)};p.useEffect(()=>{var x;f&&a!==g.current&&(v.current&&(clearTimeout(v.current),v.current=null),(x=L.current)==null||x.cancel(),L.current=null,s(!1),i(t,!1))},[a,f,t,i]),p.useEffect(()=>{var x;!n||f||(v.current&&clearTimeout(v.current),v.current=null,(x=L.current)==null||x.cancel(),L.current=null)},[f,n]),p.useEffect(()=>()=>{var x,C;v.current&&(clearTimeout(v.current),v.current=null,V.getState().canvasSessionId===g.current&&I.current({...S.current,content:N.current})),V.getState().canvasSessionId===g.current?(x=L.current)==null||x.flush():(C=L.current)==null||C.cancel(),L.current=null,i(t,!1)},[P,t,i]);const ge=()=>{const x=l.adoptDisk();x!=null&&(r({...e,content:x}),c(x))},y=()=>{l.overwrite(N.current)},D=Zs(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:[m&&D&&h.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:D}),m&&h.jsx(rt,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:f?re:G,"aria-label":f?"Finish editing":"Edit document",children:f?h.jsx(jr,{className:"size-4"}):h.jsx(Cr,{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(rt,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ge,children:"Reload"}),h.jsx(rt,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:y,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(Js,{value:f?o:e.content,editable:f,onChange:f?q:void 0,wikiLinks:w})})})]})}function Qs({content:e}){return h.jsx("div",{className:"p-4 font-mono text-sm",children:h.jsx(Tr,{value:e.data,depth:0})})}const Ks=20;function Tr({value:e,depth:t,keyName:r}){const[n,s]=p.useState(t>2),o=p.useCallback(()=>s(u=>!u),[]);if(t>=Ks)return h.jsx(Pe,{keyName:r,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return h.jsx(Pe,{keyName:r,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return h.jsx(Pe,{keyName:r,value:String(e),className:"text-blue-500"});if(typeof e=="number")return h.jsx(Pe,{keyName:r,value:String(e),className:"text-green-500"});if(typeof e=="string")return h.jsx(Pe,{keyName:r,value:`"${e}"`,className:"text-amber-500"});const c=Array.isArray(e),a=c?e.map((u,f)=>[String(f),u]):Object.entries(e),i=c?"[":"{",d=c?"]":"}";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:o,children:[h.jsx(Rn,{className:qt("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:[i,n&&` … ${a.length} items `,n&&d]})]}),!n&&h.jsxs(h.Fragment,{children:[a.map(([u,f])=>h.jsx(Tr,{keyName:c?void 0:u,value:f,depth:t+1},u)),h.jsx("div",{className:"text-muted-foreground",children:d})]})]})}function Pe({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 ei=new Set(["http:","https:"]);function ti(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const ri={image:"data:image/",pdf:"data:application/pdf"};function Ar(e,t,r){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(ri[t])?{url:n,error:null}:{url:null,error:"unsupported-data"};const s=ti(n);if(s!==null)return ei.has(s)?{url:n,error:null}:{url:null,error:"blocked"};const o=r(n);return o?{url:o,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 ni({content:e}){const t=ae(),r=V(u=>u.selectedCwd),n=p.useMemo(()=>Ar(e.src,"image",u=>t.mediaUrl(r??"",u)),[e.src,t,r]),[s,o]=p.useState("loading"),[c,a]=p.useState(e.src);c!==e.src&&(a(e.src),o("loading"));const i=e.alt??e.title??"Canvas image";if(n.url===null){const u=n.error?zr(n.error,"image"):"";return h.jsx(pr,{children:u})}const d=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(pr,{children:"This image couldn’t be loaded."}):h.jsxs(In,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[h.jsx(si,{}),h.jsx(Nn,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:h.jsx("img",{src:d,alt:i,onLoad:()=>o("loaded"),onError:()=>o("error"),className:qt("max-h-full max-w-full object-contain transition-opacity",s==="loaded"?"opacity-100":"opacity-0")})})]})]})}function si(){const{zoomIn:e,zoomOut:t,resetTransform:r}=Tn();return h.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[h.jsx(yt,{label:"Zoom in",onClick:()=>e(),children:h.jsx(Ln,{className:"size-4"})}),h.jsx(yt,{label:"Zoom out",onClick:()=>t(),children:h.jsx(Pn,{className:"size-4"})}),h.jsx(yt,{label:"Reset zoom",onClick:()=>r(),children:h.jsx(qn,{className:"size-4"})})]})}function yt({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 pr({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 ii({content:e}){const t=ae(),r=En().data,n=V(i=>i.selectedCwd),s=p.useMemo(()=>Ar(e.src,"pdf",i=>t.mediaUrl(n??"",i)),[e.src,t,n]);if(s.url===null){const i=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:i})})}const o=s.url,c=e.title??"PDF document",a=new URL(o,window.location.href).origin===window.location.origin;return a&&!r?null:a&&(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:o,download:!0,className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Download ",c]})]}):h.jsx("object",{data:o,type:"application/pdf",title:c,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:o,target:"_blank",rel:"noreferrer",className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Open ",c," in a new tab"]})]})})}function oi(e){const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||t[1].length===1?null:`${t[1].toLowerCase()}:`}const ai=new Set(["http:","https:","data:"]);function Fr(e,t,r){const n=e.trim(),s=oi(n);return s!==null?ai.has(s)?s==="data:"&&r!==void 0?n.toLowerCase().startsWith(r)?{url:n}:{url:null}:{url:n}:{url:null}:{url:t(n)}}function ci({content:e}){const t=ae(),r=V(o=>o.selectedCwd),n=p.useMemo(()=>Fr(e.src,o=>t.mediaUrl(r??"",o),"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 ui({content:e}){const t=ae(),r=V(o=>o.selectedCwd),n=p.useMemo(()=>Fr(e.src,o=>t.mediaUrl(r??"",o),"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 Mr({content:e,documentId:t,channel:r}){const[n]=Mt(),s=An(e.definition),o=p.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return h.jsx("div",{className:"p-4",children:s.ok?h.jsx(zn,{channel:r,document:s.document,sessionId:n??void 0},r?t??r.documentId:o):h.jsx(Fn,{error:s.error,raw:s.raw})})}class li{constructor(){te(this,"contiguous",0);te(this,"through",0);te(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 _t=new WeakMap,Qe=new WeakMap,ye=new WeakMap,He=new WeakMap;function Oe(e){Ne(e);const t=_t.get(e);if(!t)throw new Error("Replay owner lifetime is absent.");return t}function di(e,t){const r=Qe.get(t);if(!r||r.owner!==e)throw new Error("Replay run is foreign.");return r}function qr(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const t of Object.values(e))qr(t);Object.freeze(e)}return e}function fi(e){if(Ne(e),_t.has(e))throw new Error("Replay owner lifetime is already initialized.");_t.set(e,new li)}function Pt(e){const t=Oe(e);return Object.freeze({highest:t.highest,through:t.catchUpThrough,pending:t.pendingCount})}function mr(e){Oe(e).reset()}function gr(e,t){const r=Qe.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 hi(e,t,r){const n=ye.get(r),s=Qe.get(t);if(!(!s||s.owner!==e||!n||n.owner!==e||n.run!==t||n.phase!=="consuming"||n.admissionRead||!ne(e,t)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:s.targetBirth})}function pi(e,t,r){const n=di(e,t),s=ye.get(r),o=Ur(e,t,r);if(!o||!s||s.owner!==e||s.run!==t||s.phase!=="consuming"||!s.admissionRead||n.ended||n.epoch!==o.epoch||n.subject!==o.previous)throw new Error("Replay own issuance is foreign or stale.");n.subject=o.subject}function Lr(e,t,r,n){if(!ne(e,t))return;if(n){const o=He.get(r);return o&&o.owner===e&&o.run===t&&o.phase==="dispatching"&&!o.advanced?o.frame:void 0}const s=ye.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 mi(e,t,r,n){const s=Wi(e,t,r,n);if(!s||!ne(e,t))throw new Error("Replay cursor advance has no genuine core witness.");const o=n?He.get(r):ye.get(r);if(!o||o.advanced)throw new Error("Replay frame advance was consumed.");o.advanced=!0,Oe(e).advance(s.docSeq)}function gi(e,t){const r=Qe.get(t),n=(r==null?void 0:r.lastPage)&&ye.get(r.lastPage);if(!r||r.owner!==e||!ne(e,t)||r.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&Oe(e).highest<r.target)return;const s=Oe(e);return Object.freeze({highest:s.highest,through:s.catchUpThrough,target:r.target})}function vi(e,t){const r=Ze(e,t);if(!r)throw new Error("Replay notice is foreign or stale.");const n=Oe(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"&&to(e,t)}return!1}function bi(e,t){const r=Ze(e,t);if(!r||r.mode!=="event"||r.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");Oe(e).advance(r.notification.docSeq)}function wi(e){const t=le(e),r=Oe(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};Qe.set(n,s),Hi(e,n);const o=()=>ne(e,n),c=()=>le(e).live?o()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!o())return null;const a=le(e),i=r.highest,d=pt(e),u=d.getCanvasChannel;if(!o())return null;const f=await u.call(d,t.documentId,{since:i,limit:200});if(!o())return null;const l=qr(_n.parse(f));if(!o())return null;const m=Object.freeze({});return ye.set(m,{owner:e,run:n,response:l,since:i,revision:a.revision,observation:a.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),m},consumePage(a){const i=ye.get(a);return!o()||!i||i.owner!==e||i.run!==n||i.phase!=="read"?{kind:"done"}:(i.phase="consuming",Vi(e,n,a)!=="accepted"||!o()?(i.phase="finished",{kind:"done"}):(s.target??(s.target=i.response.highWatermark),s.targetBirth=i.response.incarnation,i.frames=Object.freeze(i.response.events.filter(u=>u.docSeq<=s.target)),i.phase="frames",s.lastPage=a,i.response.resetRequired&&r.advance(i.response.retentionFloor-1),{kind:"frames",count:i.frames.length}))},advancePageFrame(a,i){const d=ye.get(a);if(!o()||!d||d.owner!==e||d.run!==n||d.phase!=="frames"||i!==d.next||!d.frames[i])return!1;d.next=i+1,d.dispatching=i,d.advanced=!1;try{return br(e,n,a,!1)&&o()}finally{d.dispatching=void 0}},finishPage(a){const i=ye.get(a);if(!o()||!i||i.owner!==e||i.run!==n||i.phase!=="frames"||i.next!==i.frames.length||s.target===void 0)return"done";if(i.phase="finished",i.response.events.length<200||r.highest>=s.target)return r.advance(s.target),!o()||(wr(e,n),!o())||(s.succeeded=!0),"done";if(r.highest<=i.since)throw new Error("Document replay made no progress.");return"again"},failed(){o()&&Ji(e,n)},beginFinalization(){return c()??(s.succeeded?"drain":"stop")},takePending(){if(!o())return null;const a=r.takeNextContiguous();if(!a||!o())return null;const i=Object.freeze({});return He.set(i,{owner:e,run:n,frame:a,phase:"taken",advanced:!1}),i},advancePending(a){const i=He.get(a);if(!o()||!i||i.owner!==e||i.run!==n||i.phase!=="taken")return!1;i.phase="dispatching";try{return br(e,n,a,!0)&&o()}finally{i.phase="finished",He.delete(a)}},finishFinalization(){const a=c();if(a)return a;if(r.clearReachedTarget()){const i=c();if(i)return i;wr(e,n);const d=c();if(d)return d}if(r.pendingCount||r.catchUpThrough>r.highest){const i=le(e);if(r.highest>s.starting||i.revision>s.revision||i.observation>s.observation)return"restart";Xi(e,n)}return c()??"stop"},current:o,end:()=>{s.ended=!0}})}var me,Dt,We;class St{constructor(){qe(this,me);te(this,"current",null);te(this,"token",0);te(this,"retiring",!1);te(this,"subscribers",new Set);te(this,"resources",new Map);te(this,"doc",null);te(this,"docClaims",new WeakMap);te(this,"retiringDoc",!1);te(this,"docResources",new Map);te(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 o=s();o&&typeof o.then=="function"&&Promise.resolve(o).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 be(this,me,Dt).call(this,t,r,n)}acquireDoc(t,r,n){const s=be(this,me,Dt).call(this,t,r,n),o=Object.freeze({});this.docClaims.set(s,o);let c=!1;return Object.freeze({binding:s,release:()=>{c||(c=!0,this.docClaims.get(s)===o&&(this.docClaims.delete(s),this.doc===s&&this.bindings.has(s)&&be(this,me,We).call(this)))}})}disableDoc(){be(this,me,We).call(this)}retireDoc(t){this.doc===t&&this.bindings.has(t)&&be(this,me,We).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}}me=new WeakSet,Dt=function(t,r,n){const s=this.doc,o=this.token,c=Ws(yr,r);if(!c)throw this.disableDoc(),new Error("Established server Doc birth required.");const a=c,i=t.exactOrigin,d=t.eligibility==="served-document"?i==="null":t.eligibility==="preview-listener"&&i!==null&&new URL(i).origin===i;if(!t.loaded||!t.frame||typeof t.frame.postMessage!="function"||!t.resolvedSource||!d||t.documentId!==a.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!==o)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(J(this.doc.incarnation,a)&&this.doc.scope===n)return this.doc;throw this.retire(),new Error("Doc birth changed; a fresh host load is required.")}const u=Object.freeze({observation:t,incarnation:Object.freeze(a),scope:n});try{return this.doc=u,this.bindings.add(u),u}catch(f){throw this.doc===u&&be(this,me,We).call(this),f}},We=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 xi(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:o,submit:c,inspect:a,captureOriginal:i}=r,d=Object.freeze({expectedGeneration:t.incarnation.generation}),u=()=>{try{return e.isCurrent(t)?o(n,s)===!0&&e.isCurrent(t):!1}catch{return!1}};if(!u())throw new Error("Doc binding unavailable.");const f=()=>{if(!u())throw new Error("Doc binding retired.")};return Object.freeze({binding:t,current:u,captureOriginal:l=>{f();const m=l.id;f();const w=l.bytes;f();const g=Reflect.apply(i,r,[Object.freeze({id:m,bytes:w})]);if(f(),!g)return null;const v=g.id;f();const N=g.bytes;f();const S=g.submit;f();const I=g.inspect;return f(),v!==m||N!==w||typeof S!="function"||typeof I!="function"?null:Object.freeze({id:m,bytes:w,submit:async z=>{f(),z.throwIfAborted();const M=await Reflect.apply(S,g,[z]);return f(),z.throwIfAborted(),M},inspect:async z=>{f(),z.throwIfAborted();const M=await Reflect.apply(I,g,[z]);return f(),z.throwIfAborted(),M}})},retireObservation:()=>{u()&&e.retire()},onRetire:l=>e.ownDoc(t,l),submit:(l,m)=>(f(),m.throwIfAborted(),c(l,d,m)),inspect:(l,m)=>(f(),m.throwIfAborted(),a(l,d,m))})}class yi{constructor(){te(this,"revision",0);te(this,"draining",!1);te(this,"cleanup");te(this,"subscribers",new Set);te(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 o=n();return!this.current(t)||!r()||!this.current(t)?null:o}}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 ki(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 o=s();return!o||!n()||r.accept(o)!==!0||!n()?null:o}})}function ji(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 o=!1,c=null,a;try{const i=s.binding;if(n()&&r.bindingCurrent(i)===!0&&n()){const d=r.createPort(i);n()&&r.portCurrent(d)===!0&&n()&&e.install(t,s.release)&&(o=!0,c=d)}}catch(i){a={cause:i}}if(!o)try{s.release()}catch(i){a??(a={cause:i})}if(a)throw a.cause;return c}function Ci(e){const t=()=>Object.assign(new Error("Document actions are unavailable."),{status:409}),r=(s,o)=>{if(o.aborted||!e.current(s)||o.aborted)throw t()},n=(s,o)=>{const c=kr.parse(o);if(c.receipt.id!==s)throw new Error("Document receipt does not match this action.");return c};return Object.freeze({current:e.current,submit:async(s,o)=>{const c=ot.parse(JSON.parse(JSON.stringify(s))),a=c.id;r("submit",o);const i=await e.submit(c,o);r("read",o);const d=n(a,i);return r("read",o),d},inspect:async(s,o)=>{r("read",o);const c=await e.inspect(s,o);r("read",o);const a=n(s,c);return r("read",o),a},captureOriginal:s=>{const o=ot.parse(JSON.parse(JSON.stringify(s))),c=o.id,a=JSON.stringify(o);if(!e.current("submit"))return null;const i=e.capture(o,a);if(!i||!e.current("submit")||!i.current("submit"))return null;let d=!1;const u=f=>i.current(f)===!0;return Object.freeze({id:c,bytes:a,current:u,submit:async f=>{if(d||f.aborted||!u("submit"))throw t();d=!0;const l=await i.submit(JSON.parse(a),f);if(f.aborted||!u("read"))throw t();const m=n(c,l);if(f.aborted||!u("read"))throw t();return m},inspect:async f=>{if(f.aborted||!u("read"))throw t();const l=await i.inspect(c,f);if(f.aborted||!u("read"))throw t();const m=n(c,l);if(f.aborted||!u("read"))throw t();return m}})}})}function Oi(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 Ri(e,t,r){const n=ot.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:Oi(s)}const Ei=St.prototype.acquireDoc,ut=new WeakMap,It=new WeakMap;function _i(e,t){const r=pt(e),n=new WeakMap,s=(c,a)=>t.current(a)&&Ce(e,c,!0);return Object.freeze({prepareFrameLoad:(c,a)=>{var l;if(!(c instanceof St)||a.loaded)return null;const i=vr(e),d=i?(l=De(e,i))==null?void 0:l.httpBaseline:void 0,u=t.begin();if(!i||!d||!t.current(u)||!Ce(e,i,!0)||c.getCurrent()!==a||a.transportOwner!==r||!s(i,u))return null;let f=null;return ki(t,u,{current:()=>{var m;return Ce(e,i,!0)&&((m=De(e,i))==null?void 0:m.httpBaseline)===d&&c.getCurrent()===(f??a)&&t.current(u)&&Ce(e,i,!0)},complete:()=>(f=c.observeLoaded(a),f),accept:m=>{var w,g;return!t.current(u)||!Ce(e,i,!0)||((w=De(e,i))==null?void 0:w.httpBaseline)!==d||c.getCurrent()!==m||!t.current(u)||!Ce(e,i,!0)||((g=De(e,i))==null?void 0:g.httpBaseline)!==d?!1:(n.set(m,{record:i,birth:d.birth}),!0)}})},subscribeInvalidation:c=>t.subscribe(c),attachFrame:(c,a)=>{if(!(c instanceof St))return null;const i=vr(e),d=t.begin();if(!i||!t.current(d)||!Ce(e,i,!0)||c.getCurrent()!==a||a.transportOwner!==r||!s(i,d))return null;const u=n.get(a);return!u||u.record!==i||!J(u.birth,De(e,i).birth)?null:ji(t,d,{current:()=>s(i,d),acquire:()=>{const f=Ei.call(c,a,De(e,i).birth,De(e,i).birth.documentId);let l=!1,m=null,w;try{s(i,d)&&c.getCurrent()===a&&s(i,d)&&(m=Object.freeze({binding:f.binding,release:f.release}),l=!0)}catch(g){w={cause:g}}if(!l)try{f.release()}catch(g){w??(w={cause:g})}if(w)throw w.cause;return m},bindingCurrent:f=>c.isCurrent(f)&&s(i,d),createPort:f=>xi(c,f,{owner:r,publisherEpoch:a.publisherEpoch,isCurrentOwner:(l,m)=>l===r&&m===a.publisherEpoch&&t.current(d)&&Ce(e,i),captureOriginal:l=>Ri(l,m=>{var w;return((w=Gi(e,i))==null?void 0:w.captureOriginal(m))??null},()=>s(i,d)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:f=>f.current()&&s(i,d)})}})}function Si(e){if(Ne(e),ut.has(e))throw new Error("Frame owner is already initialized.");const t=new yi,r=_i(e,t);return ut.set(e,{frames:t,facade:r}),r}function Di(e){var t;return Ne(e),(t=ut.get(e))==null?void 0:t.facade}function Ue(e){Ne(e);const t=ut.get(e);if(!t)return;const r=Object.freeze({});return It.set(r,{owner:e,frames:t.frames,ticket:t.frames.captureRetirement()}),r}function $e(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 Pr(e,t){const r=xe(e,t),n=Bi(e,t);if(!(!r||!n))return{owner:t,verified:r.verified,...Ci(n)}}function pe(e,t){return{documentId:e,transport:t,events:[],available:!1}}function Ii(e,t,r,n,s,o){var i,d;const c=e.documentId===r&&e.transport===n?e:pe(r,n);if(c.snapshot&&(t.highWatermark<c.snapshot.highWatermark||t.stateRev<c.snapshot.stateRev))return c;const a=new Map((((i=c.snapshot)==null?void 0:i.receipts)??[]).filter(u=>u.receipt.docSeq>=t.receiptRetentionFloor).map(u=>[u.receipt.id,u]));for(const u of t.receipts)a.set(u.receipt.id,u);return{...c,available:o,snapshot:{...t,...s?{}:{routing:(d=c.snapshot)==null?void 0:d.routing},receipts:[...a.values()].sort((u,f)=>f.receipt.docSeq-u.receipt.docSeq).slice(0,400)},events:t.resetRequired?c.events.filter(u=>u.docSeq>=t.retentionFloor):c.events}}function Ni(e){var r,n,s,o,c,a,i,d,u,f,l,m;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:(o=e.binding)==null?void 0:o.owner,current:((c=e.binding)==null?void 0:c.current)??(()=>!1),approvedEventTypes:e.available?((i=(a=e.snapshot)==null?void 0:a.routing)==null?void 0:i.approvedEventTypes)??[]:[],destinationLabel:e.available?((u=(d=e.snapshot)==null?void 0:d.routing)==null?void 0:u.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:(m=e.binding)==null?void 0:m.captureOriginal}}function Ti(e,t,r){return!!(e&&t&&r.incarnation&&J(t,r.incarnation)&&(r.highWatermark<e.highWatermark||r.stateRev<e.stateRev))}function Br(e,t,r,n){const s=e.documentId===r&&e.transport===n?e:pe(r,n);return{...s,events:[...s.events,t].slice(-200)}}function Ai(e,t){if(e.incarnation&&(e.incarnation.documentId!==t||e.events.some(r=>r.documentId!==t||!r.incarnation||!J(e.incarnation,r.incarnation))))throw new Error("Document replay identity changed.")}const Nt=new WeakMap;function zi(e,t,r){const n=hi(e,t,r);if(n)return Nt.set(r,{owner:e,run:t,witness:n}),n}const Wr=new WeakMap,Xe=new WeakMap,Tt=new WeakMap,At=new WeakMap;function ke(e,t){Ne(e);const r=t??Xe.get(e),n=r&&Wr.get(r);return n&&n.owner===e&&Xe.get(e)===r&&n.active?n:void 0}function X(e){return Ne(e),Xe.get(e)}function xe(e,t){const r=ke(e,t);return r?Object.freeze({birth:r.birth,httpBaseline:r.httpBaseline,snapshot:r.snapshot,verified:r.verified}):void 0}function Ve(e,t,r=!1){var o,c;const n=ke(e,t),s=le(e);return!!n&&s.live&&n.verified&&n.transport===pt(e)&&(!r||((c=(o=n.snapshot)==null?void 0:o.routing)==null?void 0:c.enabled)===!0)}function Fi(e){const t=ke(e);Xe.delete(e),t&&(t.active=!1,t.verified=!1)}function kt(e,t){const r=ke(e,t);r&&(r.verified=!1)}function Mi(e,t,r){const n=ke(e,r);return!n||!ne(e,t)?!1:(n.verified=!0,ne(e,t))}function qi(e,t,r){const n=Nt.get(r);Nt.delete(r);const s=(n==null?void 0:n.owner)===e&&n.run===t?n.witness:void 0;if(!s||!ne(e,t))return!1;const o=s.response.incarnation;let c=ke(e);if(!c&&!o)return ne(e,t);if(!c&&o){const a=le(e),i=()=>{const w=le(e);return ne(e,t)&&w.epoch===a.epoch&&w.observation===a.observation&&X(e)===a.subject},d=pt(e),u=d.ingestCanvasEvent;if(!i())return!1;const f=Function.prototype.bind.call(u,d),l=d.getCanvasEventReceipt;if(!i())return!1;const m=Function.prototype.bind.call(l,d);if(!i())return!1;c={owner:e,token:Object.freeze({}),birth:Object.freeze({...o}),active:!0,verified:!1,submit:f,inspect:m,transport:d},Wr.set(c.token,c),Xe.set(e,c.token),c.httpBaseline=Object.freeze({birth:c.birth,floor:s.response.receiptRetentionFloor}),Tt.set(r,Object.freeze({owner:e,run:t,epoch:a.epoch,previous:a.subject,subject:c.token}));try{pi(e,t,r)}catch(w){throw ke(e)===c&&Qi(e,t,r),w}finally{Tt.delete(r)}if(!ne(e,t))return!1}else if(c){if(!o||!J(c.birth,o))return!1;c.httpBaseline=Object.freeze({birth:c.birth,floor:s.response.receiptRetentionFloor})}return ne(e,t)?(c&&(c.verified=Ki(e)||c.verified),!0):!1}function Bt(e,t,r){const n=Wt(e),s=n.subject,o=()=>Hr(e,n,r);if(!s||!Ve(e,s)){const i=Ue(e);$e(e,i)}if(!o())return;const c=s&&Pr(e,s),a=Di(e);n.dispatch(i=>{var f;if(!o())return i;const d=((f=i.binding)==null?void 0:f.owner)===s?i:pe(n.documentId,n.transport),u=typeof t=="function"?t(d):t;return o()?{...u,...u.snapshot?{snapshot:Object.freeze({...u.snapshot})}:{},binding:c,frameAdmission:a}:i})}function Li(e,t,r,n,s){const o=Wt(e),c=ke(e);Hr(e,o,s)&&(c&&(c.snapshot=t),Bt(e,a=>Ii(a,t,o.documentId,o.transport,r,n),s))}function Pi(e,t,r,n){const s=Lr(e,t,r,n);if(!ne(e,t)||!s)return!1;if(s.docSeq<=Pt(e).highest)return ne(e,t);At.set(r,{owner:e,run:t,pending:n,frame:s});try{mi(e,t,r,n)}finally{At.delete(r)}if(!ne(e,t))return!1;const o=Wt(e);return Bt(e,c=>Br(c,s,o.documentId,o.transport),t),ne(e,t)}function Bi(e,t){const r=ke(e,t);if(!r)return;const n=le(e).documentId;return{current:s=>Ve(e,t,s==="submit"),submit:(s,o)=>r.submit(n,s,{expectedGeneration:r.birth.generation},o),inspect:(s,o)=>r.inspect(n,s,{expectedGeneration:r.birth.generation},o),capture:()=>{const s=r.httpBaseline;return!s||!Ve(e,t,!0)||!J(s.birth,r.birth)?null:Object.freeze({current:o=>Ve(e,t,o==="submit")&&(o==="read"||r.httpBaseline===s),submit:(o,c)=>r.submit(n,o,{expectedGeneration:s.birth.generation},c),inspect:(o,c)=>r.inspect(n,o,{expectedGeneration:s.birth.generation},c)})}}}function Ur(e,t,r){const n=Tt.get(r),s=le(e);return n&&n.owner===e&&n.run===t&&s.epoch===n.epoch&&s.subject===n.subject&&s.live?n:void 0}function Wi(e,t,r,n){const s=At.get(r);return s&&s.owner===e&&s.run===t&&s.pending===n&&ne(e,t)?s.frame:void 0}const $r=new WeakMap,lt=new WeakMap;function Ui(e){const t=lt.get(e);if(!t)throw new Error("Document construction ticket is foreign or consumed.");return lt.delete(e),t}function $i(e,t,r){const n=Object.freeze({});lt.set(n,Object.freeze({documentId:e,transport:t,dispatch:r}));try{const s=eo(n);return $r.set(n,s),n}finally{lt.delete(n)}}function K(e){const t=$r.get(e);if(!t)throw new Error("Document owner is foreign.");return t}function Ne(e){K(e)}function le(e){return K(e).facts()}function pt(e){return K(e).transport()}function vr(e){return K(e).subject()}function De(e,t){return K(e).subjectFacts(t)}function Ce(e,t,r=!1){return K(e).subjectCurrent(t,r)}function Gi(e,t){return K(e).binding(t)}function Hi(e,t){K(e).reserve(t)}function ne(e,t){return K(e).current(t)}function Vi(e,t,r){return K(e).admit(t,r)}function br(e,t,r,n){return K(e).frame(t,r,n)}function wr(e,t){return K(e).qualify(t)}function Ji(e,t){K(e).failed(t)}function Xi(e,t){K(e).unavailable(t)}function Zi(e,t){K(e).start(t)}function Yi(e){K(e).dispose()}const Gr=new WeakMap;function Wt(e){const t=Object.freeze(K(e).projection());return Gr.set(t,Object.freeze({custodyKey:e,capture:t})),t}function Hr(e,t,r){const n=Gr.get(t);return(n==null?void 0:n.custodyKey)===e&&n.capture===t&&K(e).projectionCurrent(t.epoch,t.subject,r)}function Qi(e,t,r){K(e).abortAdmission(t,r)}function Ki(e){return K(e).qualified()}const zt=new WeakMap;function eo(e){const{documentId:t,transport:r,dispatch:n}=Ui(e);let s,o=!1,c;const a={live:!0};let i=0,d,u,f=!1,l,m,w=0;const g=()=>a.live,v=()=>Fi(e);let N=0;const S=()=>Pt(e),I=y=>{const D=gr(e,y);return!!D&&!D.ended&&g()&&s===y&&D.epoch===i&&D.subject===X(e)},z=(y=!1)=>{const D=Ue(e);v(),i++,s=void 0,y&&mr(e),$e(e,D)},M=(y,D)=>Bt(e,y,D),L=y=>{const D=gi(e,y),x=X(e),C=x&&xe(e,x);return!I(y)||!D||D.through>D.highest||!l||!C||!J(l,C.birth)||!Mi(e,y,x)?!1:(l=void 0,M(A=>({...A,available:!0}),y),I(y))},P=(y,D,x)=>{const C=X(e),A=C&&xe(e,C),R=i,k=()=>g()&&R===i&&X(e)===C&&(!x||I(x));if(!k()||Ti(A==null?void 0:A.snapshot,A==null?void 0:A.birth,y))return;const B=D?y.routing:u;y={...y,routing:B&&Object.freeze({enabled:B.enabled,destinationLabel:B.destinationLabel,approvedEventTypes:Object.freeze([...B.approvedEventTypes])})},D&&(u=y.routing),!C&&!y.incarnation&&(f=!0),k()&&Li(e,y,D,l===void 0,x)},q=(y,D)=>{var ue;const x=zi(e,y,D);if(!I(y)||!x)return"discard";const C=x.response;Ai(C,t);const A=C.incarnation;if((X(e)||l||m)&&!A)throw new Error("Document replay identity is unavailable.");if(m&&A&&!J(m,A))return z(!0),M(pe(t,r)),"restart";const R=X(e),k=(R&&((ue=xe(e,R))==null?void 0:ue.birth))??l;if(A&&(k&&!J(k,A)||!k&&f||x.targetBirth&&!J(x.targetBirth,A)))return l=A,f=!1,u=void 0,d=void 0,z(!0),M(pe(t,r)),"restart";const{events:B,...U}=C,ee=X(e);return!ee&&A&&(l=m??A),!qi(e,y,D)||!I(y)?"discard":(!ee&&A&&(m=void 0),P(U,x.revision===N,y),I(y)?"accepted":"discard")},G=(y,D,x)=>{var k;const C=Lr(e,y,D,x),A=X(e),R=(A&&((k=xe(e,A))==null?void 0:k.birth))??l;return!I(y)||!C||C.documentId!==t||R&&(!C.incarnation||!J(R,C.incarnation))?!1:Pi(e,y,D,x)},re=(y,D)=>{const x=Object.freeze({});zt.set(x,Object.freeze({owner:e,revision:N,observation:w,epoch:i,notification:y,mode:D}));try{return vi(e,x)}finally{zt.delete(x)}},ge=y=>{if(o||!g()||(o=!0,M(pe(t,r)),!g()))return;const D=Sn(void 0,x=>{if(!g()||x.documentId!==t)return;const C=x.type==="canvas_channel_snapshot"?x.snapshot.incarnation:x.incarnation,A=X(e);if(!A){if(l&&!m&&(!C||!J(l,C))||!C||C.documentId!==t)return;if(!m||!J(m,C)){const R=!!m||!!l;if(m=Object.freeze({...C}),w++,u=void 0,d=void 0,f=!1,R&&(z(!0),M(pe(t,r))),!g()||!m||!J(m,C))return}re(x,"quarantine"),g()&&y();return}if(l&&(!C||!J(l,C))){C&&y();return}if(C&&!J(xe(e,A).birth,C)){l=C,f=!1,u=void 0,d=void 0,z(!0),M(pe(t,r)),g()&&y();return}if(C){if(d!==void 0&&d!==x.scope){const R=Ue(e);if(d=x.scope,kt(e,A),i++,s=void 0,N++,$e(e,R),X(e)!==A||!g())return;M(k=>({...k,available:!1})),X(e)===A&&g()&&y();return}d=x.scope,N++,x.type==="canvas_channel_snapshot"?P(x.snapshot,!0):x.docSeq>S().highest+1?(re(x,"gap")&&g()&&M(k=>({...k,available:!1})),g()&&y()):re(x,"event")}},r,()=>{if(!g())return;const x=Ue(e),C=X(e);C&&kt(e,C),i++,s=void 0,N++,$e(e,x),M(A=>({...A,available:!1})),g()&&y()});g()?c=D:D(),g()&&y()};return Vr.set(e,y=>{const D=Ze(e,y);if(!D||D.notification.type==="canvas_channel_snapshot")return;const x=X(e),C=i;!x||!D.notification.incarnation||!J(xe(e,x).birth,D.notification.incarnation)||(M(A=>Br(A,D.notification,t,r)),!g()||C!==i||X(e))}),{facts:()=>Object.freeze({documentId:t,live:g(),epoch:i,revision:N,observation:w,subject:X(e)}),transport:()=>r,subject:()=>X(e),subjectFacts:y=>xe(e,y),subjectCurrent:(y,D)=>Ve(e,y,D),binding:y=>Pr(e,y),qualified:()=>l===void 0,projection:()=>({documentId:t,transport:r,dispatch:n,epoch:i,run:s,subject:X(e)}),projectionCurrent:(y,D,x)=>g()&&y===i&&D===X(e)&&(!x||s===x),abortAdmission:(y,D)=>{Ur(e,y,D)&&z(!0)},reserve:y=>{const D=gr(e,y);if(!D||D.ended||!g()||D.epoch!==i||D.subject!==X(e))throw new Error("Replay run is foreign or stale.");s=y},current:I,admit:q,frame:G,qualify:L,failed:y=>{if(!I(y))return;const D=X(e);D&&kt(e,D),M(x=>({...x,available:!1}),y)},unavailable:y=>{I(y)&&M(D=>({...D,available:!1}),y)},start:ge,dispose:()=>{if(!g())return;const y=Ue(e);a.live=!1,s=void 0;const D=c;c=void 0,v(),i++,mr(e);try{$e(e,y)}finally{D==null||D()}}}}function Ze(e,t){const r=zt.get(t),n=le(e);if(!(!r||r.owner!==e||!n.live||n.epoch!==r.epoch||n.revision!==r.revision||n.observation!==r.observation))return r}function to(e,t){var a;const r=Ze(e,t);if(!r||r.notification.type==="canvas_channel_snapshot")return;const n=r.notification,o=le(e).subject,c=o&&xe(e,o);!c||!n.incarnation||!J(c.birth,n.incarnation)||n.docSeq<=Pt(e).highest||(bi(e,t),!(!Ze(e,t)||le(e).subject!==o)&&((a=Vr.get(e))==null||a(t)))}const Vr=new WeakMap;function ro(e,t,r){const n=$i(e,t,r);fi(n);const s=Si(n);return Object.freeze({beginRun:()=>wi(n),frameAdmission:s,start:o=>Zi(n,o),dispose:()=>Yi(n)})}function no(e,t){let r,n=0;const s=f=>{try{t==null||t(f)}catch{}},o=f=>{r===f&&(r=void 0)},c=(f,l)=>{f.settled||(f.settled=!0,r||s(!1),l?f.reject(l.cause):f.resolve())},a=()=>{u().catch(()=>{})},i=(f,l)=>{const m=()=>n===f.revision;if(!m())return;const w=l.beginFinalization();if(m()){if(w==="restart"){a();return}if(w==="drain")for(;m();){const g=l.drainOne();if(!m())return;if(g!=="again"){if(g==="restart")a();else if(g==="tail"){const v=l.finishFinalization();m()&&v==="restart"&&a()}return}}}},d=async f=>{let l,m;try{l=e();try{for(;await l.page()==="again";);}catch(w){l.failed(w)}}catch(w){m={cause:w}}finally{o(f);try{l&&i(f,l)}catch(w){m={cause:w}}finally{c(f,m)}}},u=()=>{if(r)return r.promise;let f,l;const m=new Promise((g,v)=>{f=g,l=v}),w={revision:++n,promise:m,resolve:f,reject:l,settled:!1};return r=w,s(!0),d(w),m};return Object.freeze({request:u})}function so(e,t,r,n){const s=ro(e,t,r);let o=!1;const c=no(()=>{const a=s.beginRun();return{async page(){const i=await a.readPage();if(!i)return"done";const d=a.consumePage(i);if(d.kind!=="frames")return d.kind;for(let u=0;u<d.count;u++)if(!a.advancePageFrame(i,u))return"done";return a.finishPage(i)},failed:()=>a.failed(),beginFinalization:()=>{const i=a.beginFinalization();return i!=="drain"&&a.end(),i},drainOne(){if(!a.current())return a.end(),"stop";const i=a.takePending();return i?a.advancePending(i)?"again":(a.end(),"stop"):"tail"},finishFinalization:()=>{try{return a.finishFinalization()}finally{a.end()}}}},a=>{o||n==null||n(a)});return s.start(()=>{c.request().catch(()=>{})}),Object.freeze({dispose(){o=!0,s.dispose()}})}function io(e){var d,u,f;const t=ae(),[r,n]=p.useState(()=>pe(e,t)),[s,o]=p.useState({documentId:e,transport:t,pending:!0});p.useLayoutEffect(()=>{const l=so(e,t,n,m=>{o({documentId:e,transport:t,pending:m})});return()=>l.dispose()},[e,t]);const c=r.documentId===e&&r.transport===t?r:pe(e,t),a=p.useMemo(()=>Ni(c),[c]),i=p.useMemo(()=>{var w;const l=(w=c.snapshot)==null?void 0:w.incarnation,m=c.binding;return l&&m?Object.freeze({incarnation:Object.freeze({...l}),current:()=>m.current("read")}):void 0},[(d=c.snapshot)==null?void 0:d.incarnation,c.binding]);return{channel:a,events:c.events,frameAdmission:c.frameAdmission,fileSaveBinding:i,fileSaveObservation:s.documentId!==e||s.transport!==t||s.pending?"pending":c.available&&((u=c.binding)!=null&&u.verified)&&((f=c.snapshot)!=null&&f.incarnation)?"ready":"unavailable"}}function oo({content:e}){const[t]=Mt();return t?h.jsx("div",{className:"h-full w-full",children:h.jsx(Mn,{sessionId:t,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const ao=p.lazy(()=>Re(()=>import("./CanvasFileContent-D1bFaUeh.js"),__vite__mapDeps([6,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasFileContent}))),co=p.lazy(()=>Re(()=>import("./CanvasModel3dContent-dST7g1v2.js"),__vite__mapDeps([24,1,2,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasModel3dContent}))),uo=p.lazy(()=>Re(()=>import("./CanvasCsvContent-DGHgSikG.js"),__vite__mapDeps([25,1,2,26,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(e=>({default:e.CanvasCsvContent}))),lo=p.lazy(()=>Re(()=>import("./index-C3cvP8Fo.js").then(e=>e.u_),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function So({documentId:e,widgetChannel:t,content:r,onContentChange:n}){switch(r.type){case"url":case"browser":return h.jsx(ys,{documentId:e,content:r},`${e}:${r.url}`);case"markdown":return h.jsx(Ys,{documentId:e,content:r,onContentChange:n},r.sourcePath??"generated");case"json":return h.jsx(Qs,{content:r});case"image":return h.jsx(ni,{content:r});case"pdf":return h.jsx(ii,{content:r});case"audio":return h.jsx(ci,{content:r});case"video":return h.jsx(ui,{content:r});case"widget":return t?h.jsx(Mr,{content:r,documentId:e,channel:t}):h.jsx(fo,{documentId:e,content:r});case"mcp_app":return h.jsx(oo,{content:r});case"file":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(ao,{documentId:e,content:r})});case"model3d":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(co,{content:r})});case"csv":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(uo,{content:r})});case"diff":return h.jsx(p.Suspense,{fallback:h.jsx(tt,{}),children:h.jsx(lo,{documentId:e,content:r},r.sourcePath)})}}function tt(){return h.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function fo({documentId:e,content:t}){const{channel:r}=io(e);return h.jsx(Mr,{documentId:e,content:t,channel:r})}const ho=p.lazy(()=>Re(()=>import("./BlintzCanvas-b30dG4gx.js").then(e=>e.B),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.BlintzCanvas})));function Do({roomId:e,document:t,content:r,onSave:n}){const[s,o]=p.useState(null),[c,a]=p.useState(!1),[i,d]=p.useState(null),u=s!==null,f=r.sourcePath===void 0;os(e,u?t.id:null);const l=async()=>{if(s===null)return;if(s===r.content){o(null),d(null);return}a(!0),d(null);const m=await n(t.id,{...r,content:s});a(!1),m?o(null):d("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:[u&&h.jsx("span",{className:"text-muted-foreground text-xs",children:c?"Saving…":"Everyone sees your save."}),h.jsx(rt,{type:"button",size:"xs",variant:"ghost",disabled:c,"aria-label":u?"Save for the room":"Edit this document",onClick:()=>u?void l():o(r.content),children:u?h.jsx(jr,{className:"size-3.5"}):h.jsx(Cr,{className:"size-3.5"})})]}),i!==null&&h.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:i}),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(ho,{value:s??r.content,editable:u,onChange:o},u?"editing":`rev-${t.rev}`)})})]})}const Ft="dorkos-canvas-sessions",po=1440*60*60*1e3;function Jr(){try{const e=localStorage.getItem(Ft);if(!e)return null;const t=JSON.parse(e);return t===null||typeof t!="object"?null:t}catch{return null}}function Xr(e){try{Object.keys(e).length===0?localStorage.removeItem(Ft):localStorage.setItem(Ft,JSON.stringify(e))}catch{}}function mo(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 dt(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(dt).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)}:${dt(n)}`).join(",")}}`}function go(e,t){const r=new Set,n=new Map;for(const o of e){const c=er(o.content);if(c!==null){r.add(c);continue}const a=dt(o.content);n.set(a,(n.get(a)??0)+1)}const s=[];for(const o of t){const c=er(o);if(c!==null){r.has(c)||s.push(o);continue}const a=dt(o),i=n.get(a)??0;i>0?n.set(a,i-1):s.push(o)}return s}const st=new Set;function Io(){st.clear()}function No(e,t={}){const r=ae(),n=t.canonical??!0;p.useEffect(()=>{e&&V.getState().loadCanvasForSession(e)},[e]),p.useEffect(()=>{if(!e||!n||st.has(e))return;const s=Jr();if(!s)return;const o=s[e];if(!o){vo(s);return}st.add(e),(async()=>{try{const c=mo(o),a=go(await r.listSessionCanvas(e),c);if(a.length===0){xr(e);return}for(const i of a)await r.openSessionCanvasDocument(e,i);xr(e),V.getState().hydrateCanvasFromSnapshot(e,await r.listSessionCanvas(e))}catch{st.delete(e)}})()},[e,n,r])}function xr(e){const t=Jr();if(!t)return;const{[e]:r,...n}=t;Xr(n)}function vo(e){const t=Date.now()-po,r=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=t);r.length!==Object.keys(e).length&&Xr(Object.fromEntries(r))}export{So as C,Eo as F,Do as R,Bs as a,io as b,is as c,ss as d,_o as e,Mr as f,Io as g,rs as h,No as i,Fr as r,Vs as u};
|