dorkos 0.117.0 → 0.118.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/bin/cli.js +1266 -938
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-H-acF3Uh.js → AboutPage-BOS59p1y.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-DHDeFsXG.js → ActivityErrorState-DOmV85tr.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-xyMrmAY2.js → ActivityPage-DbsBpb6N.js} +1 -1
  7. package/dist/client/assets/ActivityRow-B1ZeL7Jb.js +1 -0
  8. package/dist/client/assets/AdapterIcon-XPLZ-NAi.js +1 -0
  9. package/dist/client/assets/AdapterSetupWizard-DfNJz5SD.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BgPnj-jY.js → AgentOptionRow-C15RQsub.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-3POlE_TY.js → AgentPicker-CydNJYi_.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CL5bwXYH.js → AgentRequestCard-BBSbluBs.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-D3z40f_b.js → AppearancePage-8ALtWGZZ.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-GafmL5mr.js → ApplyToOverridesDialog-Cv3KEf7T.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-4ZSIhmin.js → AttentionSignalRow-c-u1cE1l.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CD8bGnb5.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Re2CfOlC.js} +3 -3
  17. package/dist/client/assets/BindingDialog-8xnsM47D.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-B-PoJThg.js → BlintzCanvas-DUDSNxlM.js} +1 -1
  19. package/dist/client/assets/{CanvasCsvContent-CgiQWBJA.js → CanvasCsvContent-D697P3sa.js} +6 -6
  20. package/dist/client/assets/CanvasFileContent-BJ39nHuR.js +2 -0
  21. package/dist/client/assets/{CanvasModel3dContent-BXCQRGHN.js → CanvasModel3dContent-TaunlbT2.js} +2 -2
  22. package/dist/client/assets/{ChatAppsOff-C60EWHju.js → ChatAppsOff-CFEmPGm1.js} +1 -1
  23. package/dist/client/assets/{CodeMirrorDiff-B5dKqE-I.js → CodeMirrorDiff-B7VUevZG.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorEditor-BzB4Bznz.js → CodeMirrorEditor-BX1bJlnT.js} +1 -1
  25. package/dist/client/assets/CommitmentList-CDocwl5K.js +1 -0
  26. package/dist/client/assets/{CommitmentsPage-ChzV2lIP.js → CommitmentsPage-Cr_MvU96.js} +1 -1
  27. package/dist/client/assets/{ComputerResourceView-mF8l9rkm.js → ComputerResourceView-CJMUZPDy.js} +1 -1
  28. package/dist/client/assets/{ComputerViewer-CKR_ZSO1.js → ComputerViewer-BA-9lBBN.js} +1 -1
  29. package/dist/client/assets/ConnectionAccessLists-BLLpxhn3.js +1 -0
  30. package/dist/client/assets/{ConnectionsPage-6PEoOCSe.js → ConnectionsPage-BWVfAPd1.js} +2 -2
  31. package/dist/client/assets/ConventionPage-EK3WUWVa.js +11 -0
  32. package/dist/client/assets/{ExtensionPageRoute-Bv2i-Pqm.js → ExtensionPageRoute-C9hsJNX2.js} +2 -2
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-C5S-Mncm.js → FloatingTanStackRouterDevtools-CqogiFob-BeyAgBfh.js} +1 -1
  34. package/dist/client/assets/HandlePage-CfeEzfDk.js +1 -0
  35. package/dist/client/assets/HeartbeatPage-DfbNenFv.js +1 -0
  36. package/dist/client/assets/{KeyEntry-IgIIE1HE.js → KeyEntry-CEbe5Xvn.js} +2 -2
  37. package/dist/client/assets/{LexicalField-B3neANKd.js → LexicalField-DC_6Z-Ye.js} +1 -1
  38. package/dist/client/assets/{ManagesPage-gDDvLXjS.js → ManagesPage-CYnGvNM2.js} +1 -1
  39. package/dist/client/assets/{Marketplace-DAe-slPr.js → Marketplace-CWiiq8of.js} +1 -1
  40. package/dist/client/assets/{MarketplaceSourcesView-jhoKlyGb.js → MarketplaceSourcesView-DF3cHMR0.js} +1 -1
  41. package/dist/client/assets/{McpAppFrame-BQxyYB23.js → McpAppFrame-D5Muf5Sf.js} +2 -2
  42. package/dist/client/assets/{McpSigninBody-DNB9IVJs.js → McpSigninBody-CLZFoQgC.js} +1 -1
  43. package/dist/client/assets/{Model3dViewer-CZYCij-x.js → Model3dViewer-C9ODHy5I.js} +1 -1
  44. package/dist/client/assets/NamePage-B4YrH-ug.js +1 -0
  45. package/dist/client/assets/NewDirectMessageMenu-Co9Uv5t5.js +1 -0
  46. package/dist/client/assets/{NotificationsPage-BZIME3p9.js → NotificationsPage-ldulSpVu.js} +1 -1
  47. package/dist/client/assets/{OpenMeshSwitch-C1E_5NM2.js → OpenMeshSwitch-BfEvR7s7.js} +2 -2
  48. package/dist/client/assets/{OperatorIdentityForm-BV0aT5IX.js → OperatorIdentityForm-ZM_zDnjM.js} +1 -1
  49. package/dist/client/assets/{PermissionHistory-Btciwm3c.js → PermissionHistory-liL_pJDR.js} +1 -1
  50. package/dist/client/assets/{PermissionsPage-CdLK-g0S.js → PermissionsPage-DFMjDQby.js} +1 -1
  51. package/dist/client/assets/{PersonalityPopover-D7hczXpC.js → PersonalityPopover-CITFG0_N.js} +1 -1
  52. package/dist/client/assets/PhotoPage-DYDJPBfu.js +1 -0
  53. package/dist/client/assets/{PresetPicker-Cw2jlFQM.js → PresetPicker-CpYu7nb6.js} +2 -2
  54. package/dist/client/assets/{PreviewRefusedNotice-CcoKHPsy.js → PreviewRefusedNotice-CF3bzfSe.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-xAsiq8Mz.js → ProfileFields-D4p6bhIa.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-DM8F3Evu.js → ProfilePanelContainer-XCuCnd1t.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-CJYZpLNj.js → ProfileRolePicker-qRf3DSdk.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-CHWGhlr1.js → PromptSuggestionChips-CUwLk83h.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-D781EUfA.js → ReportsToPopover-Cu-Cnzij.js} +1 -1
  60. package/dist/client/assets/{RoomSurface-CT_OGVWw.js → RoomSurface-CsAifwp2.js} +7 -7
  61. package/dist/client/assets/{RoomsPage-DcoGt4-A.js → RoomsPage-DZYMR2in.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-6PnPqbut.js → RunsOnPopover-CTBEMstG.js} +1 -1
  63. package/dist/client/assets/RuntimeConnectFlow-DY4sjRgN.js +1 -0
  64. package/dist/client/assets/RuntimeSetupDialog-DJu_-eNa.js +1 -0
  65. package/dist/client/assets/{SessionsPage-Cnai5quH.js → SessionsPage-thndqcpY.js} +1 -1
  66. package/dist/client/assets/{SettingsDialog-DUWvCqf_.js → SettingsDialog-CKmcLF66.js} +3 -3
  67. package/dist/client/assets/SkillsPage-CmXyAw3J.js +1 -0
  68. package/dist/client/assets/{TaskDialogWrapper-CepIueBg.js → TaskDialogWrapper-Boxr_hgF.js} +1 -1
  69. package/dist/client/assets/{TasksEmptyState-CCPObBmm.js → TasksEmptyState-CQf1YroK.js} +2 -2
  70. package/dist/client/assets/{TasksPage-CqoHRhDG.js → TasksPage-DGNXrDAk.js} +1 -1
  71. package/dist/client/assets/{TeamComputerEntry-mHbMrj9_.js → TeamComputerEntry-CIfFRo6-.js} +1 -1
  72. package/dist/client/assets/ToolsPage-BKZkSarf.js +2 -0
  73. package/dist/client/assets/{TopologyGraph-Br4qaSXn.js → TopologyGraph-og2tlLj7.js} +1 -1
  74. package/dist/client/assets/{TourHost-BNT2J0zS.js → TourHost-DzEG8bZP.js} +1 -1
  75. package/dist/client/assets/{UnlinkDialog-CPtwQ55a.js → UnlinkDialog-BTYC_Sit.js} +1 -1
  76. package/dist/client/assets/{WidgetErrorCard-BeQ2x8Ar.js → WidgetErrorCard-CT4sl_T6.js} +8 -8
  77. package/dist/client/assets/_shell-BDlkTSin.js +90 -0
  78. package/dist/client/assets/{_shell._home-DzhKFHpd.js → _shell._home-CP7HQ7Cs.js} +1 -1
  79. package/dist/client/assets/_shell._home.activity-DGXa_ouh.js +1 -0
  80. package/dist/client/assets/_shell._home.index-D5kOfqnL.js +3 -0
  81. package/dist/client/assets/_shell._home.tasks-BSMD-atB.js +1 -0
  82. package/dist/client/assets/_shell._home.workspaces-Cdsw2-jI.js +1 -0
  83. package/dist/client/assets/_shell.channels-B4VQ7tiZ.js +10 -0
  84. package/dist/client/assets/_shell.connections-sF5vS-Lm.js +1 -0
  85. package/dist/client/assets/{_shell.feedback-requests-dFRmIBE1.js → _shell.feedback-requests-hu21WXyA.js} +2 -2
  86. package/dist/client/assets/_shell.marketplace-B-T-ALMv.js +1 -0
  87. package/dist/client/assets/_shell.marketplace_.sources-Chu-9-Vi.js +1 -0
  88. package/dist/client/assets/{_shell.session-DnREJ52s.js → _shell.session-Bz6wvDBp.js} +3 -3
  89. package/dist/client/assets/{_shell.team-B1hbq8aH.js → _shell.team-raG7wRwF.js} +4 -4
  90. package/dist/client/assets/_shell.x._extensionId-DSqMu6Ey.js +1 -0
  91. package/dist/client/assets/_shell.x._extensionId_._-DSqMu6Ey.js +1 -0
  92. package/dist/client/assets/{access-copy-BLfnVgF5.js → access-copy-CcG3wpsK.js} +1 -1
  93. package/dist/client/assets/{banner-Cqt8YzUW.js → banner-nt7EFLr6.js} +2 -2
  94. package/dist/client/assets/card-B_zeSZiU.js +1 -0
  95. package/dist/client/assets/{command-C9CeOcFB.js → command-CDfYcQI6.js} +1 -1
  96. package/dist/client/assets/{cpu-D0mdP6ki.js → cpu-D861493C.js} +1 -1
  97. package/dist/client/assets/empty-state-CQ1oXLFa.js +1 -0
  98. package/dist/client/assets/{execution-config-AW7ORH0Y.js → execution-config-on8kVvnW.js} +1 -1
  99. package/dist/client/assets/{file-D3iv2i0G.js → file-Bwo21EVR.js} +1 -1
  100. package/dist/client/assets/{file-exclamation-point-zZf2-mqw.js → file-exclamation-point-BedYLbs2.js} +1 -1
  101. package/dist/client/assets/{file-text-CwK7EV60.js → file-text-BTj3WyHS.js} +1 -1
  102. package/dist/client/assets/{find-latest-widget-fence-DW1zqXSL.js → find-latest-widget-fence-B8fM5rIs.js} +3 -3
  103. package/dist/client/assets/form-lSBktWDn.js +1 -0
  104. package/dist/client/assets/{format-cron-BtOOA5e7.js → format-cron-W7G0In8e.js} +1 -1
  105. package/dist/client/assets/{git-branch-DPgttvPa.js → git-branch-CKlZ81Bg.js} +1 -1
  106. package/dist/client/assets/{heart-BwQb2EFQ.js → heart-BSVjeGLA.js} +1 -1
  107. package/dist/client/assets/{highlighted-body-KPVGNVTW-GGvkvk_S.js → highlighted-body-KPVGNVTW-Ct8vmPkj.js} +1 -1
  108. package/dist/client/assets/index-09EqfhW0.js +1 -0
  109. package/dist/client/assets/{index-C7BvPaXV.js → index-6pYWHTBx.js} +1 -1
  110. package/dist/client/assets/{index-ukv5t1cK.js → index-7Fd_Eeda.js} +1 -1
  111. package/dist/client/assets/{index-CkluSB9W.js → index-B-C_A3lP.js} +2 -2
  112. package/dist/client/assets/index-BDCqg2iM.css +1 -0
  113. package/dist/client/assets/index-BHt5KOZA.js +1 -0
  114. package/dist/client/assets/{index-2MwCJp-O.js → index-BVedye9r.js} +1 -1
  115. package/dist/client/assets/{index-C1zEos_1.js → index-BdrbKBym.js} +1 -1
  116. package/dist/client/assets/index-BjTJ6p2k.js +1 -0
  117. package/dist/client/assets/{index-DUvx8VEa.js → index-C0TknRcB.js} +1 -1
  118. package/dist/client/assets/index-C8-dwIPp.js +1018 -0
  119. package/dist/client/assets/{index-BCwnroTw.js → index-C96eZrOR.js} +1 -1
  120. package/dist/client/assets/index-CAv_6Po4.js +1 -0
  121. package/dist/client/assets/index-CCWSicoJ.js +1 -0
  122. package/dist/client/assets/{index-DvpWMPrj.js → index-CF73kwtO.js} +36 -36
  123. package/dist/client/assets/{index-DxU-VkDj.js → index-CNnnXzI4.js} +1 -1
  124. package/dist/client/assets/{index-Dk05g-u9.js → index-CQrM6oF9.js} +1 -1
  125. package/dist/client/assets/{index-6TyLF_Kz.js → index-CaKe9EaL.js} +1 -1
  126. package/dist/client/assets/{index-obbYyK_q.js → index-CeZ13dpH.js} +1 -1
  127. package/dist/client/assets/{index-DylucJZe.js → index-CeeHkxIC.js} +1 -1
  128. package/dist/client/assets/index-ClELcMX1.js +1 -0
  129. package/dist/client/assets/{index-B-032E-J.js → index-CrEyJcPM.js} +3 -3
  130. package/dist/client/assets/{index-CmELWXLL.js → index-D7kjWnlR.js} +1 -1
  131. package/dist/client/assets/{index-8XbUBB9y.js → index-DEOzZEcu.js} +3 -3
  132. package/dist/client/assets/{index-2kcIgMts.js → index-DOuj--Yi.js} +1 -1
  133. package/dist/client/assets/{index-DsRVcCEI.js → index-DQJM5kjJ.js} +1 -1
  134. package/dist/client/assets/{index-D09-6MJl.js → index-DShrfGYE.js} +1 -1
  135. package/dist/client/assets/{index-BSGR71VY.js → index-DURo45pu.js} +1 -1
  136. package/dist/client/assets/{index-mPmWFWvR.js → index-DeNVXdMl.js} +1 -1
  137. package/dist/client/assets/{index-CYRBybyy.js → index-DgRqCuFH.js} +1 -1
  138. package/dist/client/assets/{index-BzHf9H2D.js → index-Dh8D-3Sb.js} +1 -1
  139. package/dist/client/assets/{index-5jiMMwFO.js → index-DjI5vH_U.js} +1 -1
  140. package/dist/client/assets/{index-BBKtLMOE.js → index-Dq4bx2np.js} +1 -1
  141. package/dist/client/assets/{index-BtUom5gL.js → index-GINKfP45.js} +1 -1
  142. package/dist/client/assets/{index-DhWcN0iH.js → index-KaSZDcGa.js} +1 -1
  143. package/dist/client/assets/{index-Xmzz0kKG.js → index-RFknyjho.js} +1 -1
  144. package/dist/client/assets/{index-BYRhWLhr.js → index-SdTS2P3x.js} +1 -1
  145. package/dist/client/assets/{index-aRrsIRtW.js → index-UNxDevG6.js} +1 -1
  146. package/dist/client/assets/{index-D_bIHF5l.js → index-V_EcsvR4.js} +1 -1
  147. package/dist/client/assets/{index--IvDgnWz.js → index-bvqpTKLz.js} +1 -1
  148. package/dist/client/assets/{index-Bw9sMeWJ.js → index-gbNK9zj5.js} +3 -3
  149. package/dist/client/assets/{index-aqnG9V3q.js → index-sfSRuIXm.js} +6 -6
  150. package/dist/client/assets/{inline-code-BDPvCbUE.js → inline-code-Beal0546.js} +1 -1
  151. package/dist/client/assets/{layers-C0fTjhD3.js → layers-DUfQMkMa.js} +1 -1
  152. package/dist/client/assets/{lightbulb-CauvTp1H.js → lightbulb-DTSn-mNB.js} +2 -2
  153. package/dist/client/assets/{link-2-BFWagtwF.js → link-2-CHr2s4m2.js} +2 -2
  154. package/dist/client/assets/{list-runtime-types-DWuilOeW.js → list-runtime-types-CwEp9Lg4.js} +1 -1
  155. package/dist/client/assets/{markdown-content-irJMN3oI.js → markdown-content-GoymYcRL.js} +1 -1
  156. package/dist/client/assets/mention-pill-XE9mX9G8.js +1 -0
  157. package/dist/client/assets/{message-square-off-CEgJ9mPa.js → message-square-off-DUkKSITA.js} +1 -1
  158. package/dist/client/assets/more-details-3dDtVYc6.js +1 -0
  159. package/dist/client/assets/{owner-notice-D0r6ZH_Y.js → owner-notice-BKmuWRki.js} +1 -1
  160. package/dist/client/assets/{package-DzrvXxqm.js → package-DM7e-GVa.js} +1 -1
  161. package/dist/client/assets/page-container-nGewlFnj.js +1 -0
  162. package/dist/client/assets/{paperclip-C_2eggQt.js → paperclip-BgXlvBBI.js} +1 -1
  163. package/dist/client/assets/{path-input-ExHSfE6J.js → path-input-RzOiTE45.js} +1 -1
  164. package/dist/client/assets/primer-trigger-B60oEVY7.js +3 -0
  165. package/dist/client/assets/{profile-errors-C-4JXW0u.js → profile-errors-CFZN0y6a.js} +1 -1
  166. package/dist/client/assets/{progress--zm5Rh4c.js → progress-Cvnh4Qcr.js} +1 -1
  167. package/dist/client/assets/{query-error-state-CPMymRkX.js → query-error-state-CfJfYpa3.js} +1 -1
  168. package/dist/client/assets/{radio-oT4bYZ-T.js → radio-BOcAjXVO.js} +1 -1
  169. package/dist/client/assets/registry-B9wsS5De.js +1 -0
  170. package/dist/client/assets/{relay-trace-schemas-CfXA97kO.js → relay-trace-schemas-Cvb7RGjg.js} +2 -2
  171. package/dist/client/assets/{room-files-source-BgBqLMLB.js → room-files-source-B-ZJA_NM.js} +2 -2
  172. package/dist/client/assets/{rotate-ccw-clock-CrElPm6O.js → rotate-ccw-clock-vRQP4hWE.js} +1 -1
  173. package/dist/client/assets/{rotate-cw-CdW7VTvV.js → rotate-cw-DD2nOAQ-.js} +2 -2
  174. package/dist/client/assets/{scroll-area-BqDwmAjQ.js → scroll-area-DTvv8_DS.js} +1 -1
  175. package/dist/client/assets/search-x-Ig8nk-DU.js +6 -0
  176. package/dist/client/assets/{shield-check-B7JJvCBE.js → shield-check-DjnWx7aT.js} +1 -1
  177. package/dist/client/assets/{shield-x-DvFRtrsO.js → shield-x-BrtccpM7.js} +1 -1
  178. package/dist/client/assets/{soul-file-BDthDhZW.js → soul-file-C5mMIP4v.js} +1 -1
  179. package/dist/client/assets/{table-CK_OyzSy.js → table-Rll_Jxd8.js} +1 -1
  180. package/dist/client/assets/{terminal-CqyyqODz.js → terminal-Bjss9oke.js} +1 -1
  181. package/dist/client/assets/{trust-posture-JGG7FWhE.js → trust-posture-Dmk2WlZv.js} +1 -1
  182. package/dist/client/assets/{unplug-D2Avzz6s.js → unplug-BHYMc4ND.js} +1 -1
  183. package/dist/client/assets/{unverified-catalog-notice-BgsW86t7.js → unverified-catalog-notice-BmIVQhjE.js} +1 -1
  184. package/dist/client/assets/{use-adapter-catalog-NFvlYTrH.js → use-adapter-catalog-RzlxX2Wa.js} +1 -1
  185. package/dist/client/assets/{use-bindings-Ofq1UjvW.js → use-bindings-Ds_MAC67.js} +1 -1
  186. package/dist/client/assets/{use-composer-prefs-Cr3bdM7x.js → use-composer-prefs-ckA_eZQS.js} +1 -1
  187. package/dist/client/assets/{use-connector-management-Dz2D5qIt.js → use-connector-management-oEqok0QG.js} +1 -1
  188. package/dist/client/assets/{use-deep-link-scroll-wwMMFsmG.js → use-deep-link-scroll-Clu9Sz2-.js} +1 -1
  189. package/dist/client/assets/use-delete-binding-B_zHPcy8.js +1 -0
  190. package/dist/client/assets/{use-dev-links-Buq6rA0h.js → use-dev-links-BO7-IHe9.js} +1 -1
  191. package/dist/client/assets/{use-external-adapter-catalog-DXgiQHcR.js → use-external-adapter-catalog-7lRWtn7J.js} +1 -1
  192. package/dist/client/assets/{use-full-activity-feed-FN5AfUr-.js → use-full-activity-feed-DrcMJL9m.js} +1 -1
  193. package/dist/client/assets/use-is-below-desktop-BhzXZsbH.js +1 -0
  194. package/dist/client/assets/{use-jump-back-in-CF-nu5zW.js → use-jump-back-in-Dav0ttfs.js} +3 -3
  195. package/dist/client/assets/use-local-browser-CtltDlof.js +1 -0
  196. package/dist/client/assets/{use-mesh-topology-BdnC6sCG.js → use-mesh-topology-CiS9XQsg.js} +1 -1
  197. package/dist/client/assets/{use-mounted-ref-B5J2da-A.js → use-mounted-ref-DuK0vm9N.js} +1 -1
  198. package/dist/client/assets/{use-notification-prefs-B1iYUOEO.js → use-notification-prefs-Chf4UNbq.js} +1 -1
  199. package/dist/client/assets/{use-panel-tab-placements-J6Ed141H.js → use-panel-tab-placements-C5y831aL.js} +1 -1
  200. package/dist/client/assets/use-pending-read-i6TB4gGQ.js +1 -0
  201. package/dist/client/assets/use-personality-commit-KKJ2ve1V.js +1 -0
  202. package/dist/client/assets/{use-promo-activation-CZfM_gjU.js → use-promo-activation-D45fuXdT.js} +3 -3
  203. package/dist/client/assets/{use-promo-dismissals-DlSguZS3.js → use-promo-dismissals-8-hGry_v.js} +1 -1
  204. package/dist/client/assets/{use-pulse-freshness-Bxf5sc_M.js → use-pulse-freshness-CWudgqNc.js} +1 -1
  205. package/dist/client/assets/{use-relay-config-BwMES9xB.js → use-relay-config-8mXfegbP.js} +1 -1
  206. package/dist/client/assets/{use-room-follow-claim-lzWFVGRY.js → use-room-follow-claim-DgEWUsoP.js} +1 -1
  207. package/dist/client/assets/{use-roving-tab-list-0RaD5Yyr.js → use-roving-tab-list-CXy0Hv5J.js} +1 -1
  208. package/dist/client/assets/use-session-canvas-CUvHGgMf.js +64 -0
  209. package/dist/client/assets/{use-session-diagnostics-gBgn5q2r.js → use-session-diagnostics-LKiXub1H.js} +3 -3
  210. package/dist/client/assets/{use-unclaimed-chats-DOqEolFt.js → use-unclaimed-chats-Cr812OTh.js} +1 -1
  211. package/dist/client/assets/use-update-config-Bad4g6mB.js +1 -0
  212. package/dist/client/assets/useMutationState-BnXJ-0A_.js +1 -0
  213. package/dist/client/index.html +2 -2
  214. package/dist/drizzle/20261015190907_bored_skreet.sql +30 -0
  215. package/dist/drizzle/20261016144104_remote_command_hub_kinds.sql +21 -0
  216. package/dist/drizzle/meta/20261015190907_snapshot.json +14012 -0
  217. package/dist/drizzle/meta/20261016144104_snapshot.json +14012 -0
  218. package/dist/drizzle/meta/_journal.json +14 -0
  219. package/dist/server/index.js +130465 -126661
  220. package/dist/server/index.js.map +2 -2
  221. package/package.json +4 -4
  222. package/dist/client/assets/ActivityRow-CXLwJ28E.js +0 -1
  223. package/dist/client/assets/AdapterIcon-DsMXg2AE.js +0 -1
  224. package/dist/client/assets/AdapterSetupWizard-CuKhSucd.js +0 -2
  225. package/dist/client/assets/BindingDialog-DUqmAWDb.js +0 -1
  226. package/dist/client/assets/CanvasFileContent-D5egw6o3.js +0 -2
  227. package/dist/client/assets/CommitmentList-EjCcpBJ1.js +0 -1
  228. package/dist/client/assets/ConnectionAccessLists-BkFNTeLh.js +0 -1
  229. package/dist/client/assets/ConventionPage-Cc1bx5BQ.js +0 -11
  230. package/dist/client/assets/HandlePage-B0l9YTdO.js +0 -1
  231. package/dist/client/assets/HeartbeatPage-COV5M0c_.js +0 -1
  232. package/dist/client/assets/NamePage-BaS8zqwG.js +0 -1
  233. package/dist/client/assets/NewDirectMessageMenu-Dvmoevnh.js +0 -1
  234. package/dist/client/assets/PhotoPage-Copz-uyh.js +0 -1
  235. package/dist/client/assets/RuntimeConnectFlow-COnfwsEa.js +0 -1
  236. package/dist/client/assets/RuntimeSetupDialog-cfZVbgJJ.js +0 -1
  237. package/dist/client/assets/SkillsPage-BVt3zxB-.js +0 -1
  238. package/dist/client/assets/ToolsPage-IYUQ8OGL.js +0 -2
  239. package/dist/client/assets/_shell-TKho4VPJ.js +0 -90
  240. package/dist/client/assets/_shell._home.activity-DyrGuSto.js +0 -1
  241. package/dist/client/assets/_shell._home.index-jWJ7womG.js +0 -3
  242. package/dist/client/assets/_shell._home.tasks-tOBxVLcL.js +0 -1
  243. package/dist/client/assets/_shell._home.workspaces-B0ovWo_a.js +0 -1
  244. package/dist/client/assets/_shell.channels-Cs-s7a-W.js +0 -10
  245. package/dist/client/assets/_shell.connections-BXVkOfW_.js +0 -1
  246. package/dist/client/assets/_shell.marketplace-CuTHl0Cy.js +0 -1
  247. package/dist/client/assets/_shell.marketplace_.sources-UWbdjpMd.js +0 -1
  248. package/dist/client/assets/_shell.x._extensionId-DdiN22Ga.js +0 -1
  249. package/dist/client/assets/_shell.x._extensionId_._-DdiN22Ga.js +0 -1
  250. package/dist/client/assets/agent-browser-BkFCE19g.js +0 -1
  251. package/dist/client/assets/card-BaRHWQF1.js +0 -1
  252. package/dist/client/assets/empty-state-C0Xjezko.js +0 -1
  253. package/dist/client/assets/form-CwnBnnFI.js +0 -1
  254. package/dist/client/assets/index-CMaIfS_G.js +0 -1018
  255. package/dist/client/assets/index-CTxREsg3.js +0 -1
  256. package/dist/client/assets/index-D5QS-i8I.css +0 -1
  257. package/dist/client/assets/index-DLE5hltn.js +0 -1
  258. package/dist/client/assets/index-DaWx8Mly.js +0 -1
  259. package/dist/client/assets/index-GvMV_K0T.js +0 -1
  260. package/dist/client/assets/index-lbAGzLtf.js +0 -1
  261. package/dist/client/assets/mention-pill-C0AzfrQH.js +0 -1
  262. package/dist/client/assets/more-details-CwkthrCT.js +0 -1
  263. package/dist/client/assets/page-container-CH8mJ_Yk.js +0 -1
  264. package/dist/client/assets/primer-trigger-CgHlhMZL.js +0 -3
  265. package/dist/client/assets/registry-DLUlxXR7.js +0 -1
  266. package/dist/client/assets/search-x-DqLtufOG.js +0 -6
  267. package/dist/client/assets/use-delete-binding-j0PZzvHt.js +0 -1
  268. package/dist/client/assets/use-is-below-desktop-BudV2uCQ.js +0 -1
  269. package/dist/client/assets/use-pending-read-BNKrtv93.js +0 -1
  270. package/dist/client/assets/use-personality-commit-CWBNZX4E.js +0 -1
  271. package/dist/client/assets/use-session-canvas-CAxswuAf.js +0 -64
  272. package/dist/client/assets/use-update-config-9fndji1c.js +0 -1
  273. package/dist/client/assets/useMutationState-CtolUzjw.js +0 -1
@@ -0,0 +1,64 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BlintzCanvas-DUDSNxlM.js","assets/index-C8-dwIPp.js","assets/index-BDCqg2iM.css","assets/index-gbNK9zj5.js","assets/BlintzCanvas-GgiCXV7C.css","assets/CanvasFileContent-BJ39nHuR.js","assets/rotate-cw-DD2nOAQ-.js","assets/WidgetErrorCard-CT4sl_T6.js","assets/card-B_zeSZiU.js","assets/progress-Cvnh4Qcr.js","assets/markdown-content-GoymYcRL.js","assets/table-Rll_Jxd8.js","assets/terminal-Bjss9oke.js","assets/package-DM7e-GVa.js","assets/heart-BSVjeGLA.js","assets/git-branch-CKlZ81Bg.js","assets/file-text-BTj3WyHS.js","assets/file-Bwo21EVR.js","assets/McpAppFrame-D5Muf5Sf.js","assets/more-details-3dDtVYc6.js","assets/CanvasModel3dContent-TaunlbT2.js","assets/CanvasCsvContent-D697P3sa.js","assets/index-CeZ13dpH.js"])))=>i.map(i=>d[i]);
2
+ var In=Object.defineProperty;var Tr=e=>{throw TypeError(e)};var ei=(e,r,t)=>r in e?In(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ie=(e,r,t)=>ei(e,typeof r!="symbol"?r+"":r,t),Yt=(e,r,t)=>r.has(e)||Tr("Cannot "+t);var Qe=(e,r,t)=>(Yt(e,r,"read from private field"),t?t.call(e):r.get(e)),Ke=(e,r,t)=>r.has(e)?Tr("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,t),Se=(e,r,t,n)=>(Yt(e,r,"write to private field"),n?n.call(e,t):r.set(e,t),t),ke=(e,r,t)=>(Yt(e,r,"access private method"),t);import{W as Ot,l3 as Rt,fq as le,fB as re,fu as _r,fx as et,fr as st,l4 as ti,l5 as ri,l6 as ni,aW as ze,a1 as ve,r as g,c7 as lr,l7 as ii,aV as ee,hP as oi,j as m,h7 as ai,h8 as si,dZ as li,G as ur,I as ui,fj as ci,l8 as di,l9 as Kr,la as Gt,lb as Et,lc as Ir,fp as jr,ld as fi,fs as Ar,le as pi,lf as hi,gm as I,lg as vi,lh as mi,B as kt,J as en,gb as tn,C as gi,hX as xt,li as bi,lj as wi,lk as Or}from"./index-C8-dwIPp.js";import{R as yi}from"./rotate-cw-DD2nOAQ-.js";import{v as Ci,a as Si,W as ki}from"./WidgetErrorCard-CT4sl_T6.js";import{M as Pi}from"./McpAppFrame-D5Muf5Sf.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 rn={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"}]]};rn.node;const Nl=Ot(rn);/**
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 nn={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"}]]};nn.node;const Ei=Ot(nn);/**
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 on={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"}]]};on.node;const Ti=Ot(on);/**
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 an={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"}]]};an.node;const _i=Ot(an),Me={pending:64,queueBytes:1048576,batchMs:300,frames:62,imageChars:9e5,imageEdge:1568,resourceErrors:1e4},Tt=st().min(1).max(128),Ue={bridgeGeneration:Tt},ji=le({...Ue,__dorkosDevtools:re("capture-result"),requestId:Tt,dataUrl:st().max(9e5).optional(),error:st().max(2048).optional()}),Ai=ti.omit({hostOutcome:!0}).extend({...Ue,__dorkosDevtools:re("act-result"),dataUrl:st().max(9e5).optional()}),Oi=ri.extend({status:et().int().min(0).max(599),durationMs:et().min(0),responseSize:et().int().min(0).max(Number.MAX_SAFE_INTEGER).optional(),timestamp:et().min(0)}),Ri=ni.refine(e=>e.timestamp>=0),xi=Rt("__dorkosDevtools",[le({__dorkosDevtools:re("hello"),pageInstanceId:Tt,bridgeVersion:re(2)}),le({...Ue,__dorkosDevtools:re("ready"),pageInstanceId:Tt}),le({...Ue,__dorkosDevtools:re("navigated")}),le({...Ue,__dorkosDevtools:re("resource-error")}),le({...Ue,__dorkosDevtools:re("batch"),seq:et().int().min(0).max(Number.MAX_SAFE_INTEGER),console:_r(Ri).max(500),network:_r(Oi).max(200)}),ji,Ai]);function zi(e){const r=new Set;let t=0,n=0;const i=s=>(n+=s)<=16384;function o(s){if(!i(2))return!1;for(let l=0;l<s.length;l++){const c=s.charCodeAt(l);if(c>=55296&&c<=56319&&l+1<s.length&&s.charCodeAt(l+1)>=56320&&s.charCodeAt(l+1)<=57343){if(!i(2))return!1;l++;continue}const u=c===34||c===92||[8,9,10,12,13].includes(c)?2:c<32||c>=55296&&c<=57343?6:1;if(!i(u))return!1}return!0}function a(s,l){if(++t>2048||l>8)return!1;if(s===null)return i(4);if(typeof s=="boolean")return i(s?4:5);if(typeof s=="string")return o(s);if(typeof s=="number")return Number.isFinite(s)&&i(String(s).length);if(typeof s!="object"||r.has(s))return!1;const c=Object.getPrototypeOf(s);if(c!==Object.prototype&&c!==null&&c!==Array.prototype)return!1;const u=Array.isArray(s);if(u&&s.length>2048||Object.getOwnPropertySymbols(s).length||!i(2))return!1;r.add(s);let d=0;for(const f in s){if(!Object.prototype.hasOwnProperty.call(s,f))continue;if(++d>2048||u&&(!/^\d+$/.test(f)||Number(f)>=s.length))return!1;const p=Object.getOwnPropertyDescriptor(s,f);if(["__proto__","constructor","prototype"].includes(f)||!("value"in p)||!p.enumerable||d>1&&!i(1)||!u&&(!o(f)||!i(1))||!a(p.value,l+1))return!1}return r.delete(s),!u||d===s.length}try{return a(e,0)}catch{return!1}}function Di(e){try{if(!e||typeof e!="object")return null;const r=e;if(r.__dorkosDevtools==="capture-result"&&r.dataUrl===void 0&&r.error===void 0)return null;if(r.__dorkosDevtools==="batch"){if(!Array.isArray(r.console)||r.console.length>500||!Array.isArray(r.network)||r.network.length>200)return null;for(const i of r.console){if(!i||typeof i!="object")return null;const o=i.args;if(o!==void 0&&(!Array.isArray(o)||o.length>50||!zi(o)))return null}}const t=xi.safeParse(e);if(!t.success)return null;const n=t.data;return"dataUrl"in n&&n.dataUrl!==void 0&&!sn(n.dataUrl)?null:n}catch{return null}}function sn(e){if(e.length>9e5||!/^data:image\/png;base64,[A-Za-z0-9+/]+={0,2}$/.test(e))return null;try{const r=atob(e.slice(e.indexOf(",")+1));if(r.length<24||r.slice(0,8)!==`‰PNG\r
23
+ 
24
+ `||r.slice(12,16)!=="IHDR")return null;const t=o=>r.charCodeAt(o)*2**24+(r.charCodeAt(o+1)<<16)+(r.charCodeAt(o+2)<<8)+r.charCodeAt(o+3),n=t(16),i=t(20);return n>0&&i>0&&n<=1568&&i<=1568?{width:n,height:i}:null}catch{return null}}let Xt=null;async function Rr(){return Xt===null&&(Xt=(await ze(()=>import("./html-to-image-cl8bZGTj.js"),[])).default),Xt}let Wt=null;async function Ni(){if(Wt===null){const e=await ze(()=>import("./gifenc.esm-sOOlYEo8.js"),[]);Wt={GIFEncoder:e.GIFEncoder,quantize:e.quantize,applyPalette:e.applyPalette}}return Wt}async function xr(e,r,t=()=>{}){if(e.length===0)return{ok:!1,error:"The recording has no frames in it."};t();const{GIFEncoder:n,quantize:i,applyPalette:o}=await Ni();t();const a=e[0],s=e[e.length-1],l=new Uint8ClampedArray(a.data.length+s.data.length);l.set(a.data,0),l.set(s.data,a.data.length);const c=i(l,256),u=n();for(let f=0;f<e.length;f++){t();const p=e[f];if(u.writeFrame(o(p.data,c),p.width,p.height,{...f===0?{palette:c,repeat:0}:{},delay:r.frameMs}),u.bytesView().byteLength>r.maxBytes)return{ok:!1,error:`The recording came out bigger than ${Math.round(r.maxBytes/1024/1024)} MB, so it was not saved.`}}u.finish();const d=u.bytes();return d.byteLength>r.maxBytes?{ok:!1,error:`The recording came out bigger than ${Math.round(r.maxBytes/1024/1024)} MB, so it was not saved.`}:{ok:!0,bytes:d}}async function Mi(e,r,t=()=>{}){const n=[],i=document.createElement("canvas");let o=0,a=0;try{for(let s=0;s<Math.min(e.length,62);s++){t();const l=e[s];if(!sn(l)){e[s]="";continue}const c=await Xi(l);e[s]="";try{if(t(),!c)continue;if(!o){const f=Math.min(1,Math.min(800,r)/Math.max(c.width,c.height,1));o=Math.max(1,Math.round(c.width*f)),a=Math.max(1,Math.round(c.height*f)),i.width=o,i.height=a}const u=i.getContext("2d",{willReadFrequently:!0});if(!u)return[];u.fillStyle="#ffffff",u.fillRect(0,0,o,a);const d=Math.min(o/c.width,a/c.height);u.drawImage(c,0,0,Math.round(c.width*d),Math.round(c.height*d)),t(),n.push({data:u.getImageData(0,0,o,a).data,width:o,height:a})}finally{c&&(c.src="")}}return n}catch(s){throw n.length=0,s}finally{e.length=0,i.width=0,i.height=0}}function Yi(e,r=()=>{}){const t=document.createElement("canvas"),n=document.createElement("canvas");try{for(let i=0;i<e.length;i++){r();const o=e[i];n.width=o.width,n.height=o.height,t.width=Math.max(1,Math.round(o.width/2)),t.height=Math.max(1,Math.round(o.height/2));const a=n.getContext("2d"),s=t.getContext("2d",{willReadFrequently:!0});if(!a||!s)throw new Error("Canvas pixels are unavailable");a.putImageData(new ImageData(new Uint8ClampedArray(o.data),o.width,o.height),0,0),s.drawImage(n,0,0,t.width,t.height),e[i]={data:s.getImageData(0,0,t.width,t.height).data,width:t.width,height:t.height}}}finally{n.width=n.height=t.width=t.height=0}}function Xi(e){return new Promise(r=>{const t=new Image;t.onload=()=>{t.onload=t.onerror=null,r(t)},t.onerror=()=>{t.onload=t.onerror=null,t.src="",r(null)},t.src=e})}function zr(e,r,t){const n=t.slice().buffer;return{name:e,type:r,size:t.byteLength,arrayBuffer:async()=>n}}function Wi(e){const r=atob(e.slice(e.indexOf(",")+1));return Uint8Array.from(r,t=>t.charCodeAt(0))}const Li=8e3;function Fi(e){const r=ve(),t=g.useRef(r);g.useLayoutEffect(()=>{t.current=r});const[n]=lr(),[i,o]=g.useState(0),a=g.useRef(null),s=g.useRef(new Map),l=g.useRef(null),c=g.useRef({console:[],network:[],entryBytes:0,overheadBytes:0}),u=g.useRef(null),d=g.useRef(-1),f=g.useRef(null),p=g.useRef(null),v=g.useRef(!1),h=g.useRef(-1/0),b=g.useRef(!1),y=g.useRef(null),k=g.useRef(0),S=g.useRef(null),_=g.useRef(null),D=g.useRef(!1),X=g.useRef(null),N=g.useRef({...e,sessionId:n}),Y=g.useRef(Promise.resolve()),L=g.useRef(()=>{}),Z=g.useRef({initialize:O,retire:C,consume:ae,register:B,eligiblePending:$,refuseRequest:E,live:j,captureFrame:Ge,valid:He,reportRecordingStart:Ce,cancelReservation:qe,finish:bt});g.useLayoutEffect(()=>{Z.current={initialize:O,retire:C,consume:ae,register:B,eligiblePending:$,refuseRequest:E,live:j,captureFrame:Ge,valid:He,reportRecordingStart:Ce,cancelReservation:qe,finish:bt}});const Q=A=>X.current===A||ee.getState().openDocuments.some(w=>w.id===A&&w.openedHere);function P(A,{active:w,activation:x=!1,keepalive:T=!1,reset:M=!1}){if(!A.sessionId)return;const K={documentId:A.documentId,logicalUrl:A.logicalUrl,bridgeGeneration:A.generation,seq:Math.max(0,d.current),console:[],network:[],active:w,activation:x,instrumented:A.ready&&!A.retired,...M?{reset:!0}:{}};Y.current=Y.current.then(()=>t.current.ingestDevtoolsCapture(A.sessionId,K,T?{keepalive:!0}:void 0)).catch(()=>{})}function C(){var x;const A=a.current;A&&(A.retired=!0),a.current=null,u.current!==null&&clearTimeout(u.current),u.current=null,l.current=null,c.current={console:[],network:[],entryBytes:0,overheadBytes:0},d.current=-1,h.current=-1/0,b.current=!1;for(const[T,M]of s.current)M.life.sessionId&&M.deadline>Date.now()&&M.kind!=="frame"&&E(T,M.kind,M.life,"The frame changed while this request was pending."),clearTimeout(M.timer),(x=M.resolve)==null||x.call(M,null);s.current.clear(),A&&P(A,{active:!1});const w=y.current;w&&(clearTimeout(w.reservationTimer),w.cancelled=!0,w.abort.abort(),w.frames.length=0,w.finishing||(w.drawn.length=0,y.current=null)),S.current!==null&&cancelAnimationFrame(S.current),S.current=null,k.current=0,o(0)}function O({loadActivation:A,reset:w=!1}={}){var V,se;const x=N.current,T=(V=x.iframeRef.current)==null?void 0:V.contentWindow;if(v.current||!T||!x.bridgeEligibility||!x.resolvedSource)return;const M={generation:crypto.randomUUID(),frame:T,sessionId:x.sessionId,documentId:x.documentId,logicalUrl:x.logicalUrl,source:x.resolvedSource,origin:x.bridgeEligibility==="served-document"?"null":x.previewOrigin,ready:!1,activation:!1,retired:!1};a.current=M;const K=A??(D.current||_.current!==M.documentId&&Q(M.documentId));M.activation=K,D.current=!1,_.current=M.documentId,P(M,{active:!0,activation:K,reset:w}),((se=f.current)==null?void 0:se.frame)===T&&f.current.source===x.resolvedSource&&f.current.reload===x.reloadNonce&&f.current.documentId===x.documentId&&f.current.logicalUrl===x.logicalUrl&&T.postMessage({__dorkosDevtools:"init",bridgeGeneration:M.generation},"*")}g.useLayoutEffect(()=>{var T;N.current={...e,sessionId:n};const A={frame:(T=e.iframeRef.current)==null?void 0:T.contentWindow,sessionId:n,documentId:e.documentId,logicalUrl:e.logicalUrl,source:e.resolvedSource,eligibility:e.bridgeEligibility,origin:e.previewOrigin,reload:e.reloadNonce},w=p.current;if(!w||Object.keys(A).some(M=>A[M]!==w[M])){const M=!w||w.frame!==A.frame||w.documentId!==A.documentId||w.logicalUrl!==A.logicalUrl||w.source!==A.source||w.reload!==A.reload;p.current=A,v.current=!1,C(),O({reset:M})}});const R=g.useCallback(()=>{var K,V,se;const{initialize:A,retire:w}=Z.current,x=N.current,T=(K=x.iframeRef.current)==null?void 0:K.contentWindow,M=(V=a.current)!=null&&V.ready?!1:(se=a.current)==null?void 0:se.activation;T&&x.resolvedSource&&(f.current={frame:T,source:x.resolvedSource,reload:x.reloadNonce,documentId:x.documentId,logicalUrl:x.logicalUrl}),v.current=!1,w(),A({loadActivation:M,reset:!0})},[]),W=g.useCallback(()=>{const A=a.current;D.current=!0,X.current=N.current.documentId,A&&L.current({active:!0,activation:!0})},[]);g.useLayoutEffect(()=>{L.current=A=>{a.current&&P(a.current,A)}});function j(A){return a.current===A&&!A.retired}function E(A,w,x,T){if(!x.sessionId)return;const M={requestId:A,bridgeGeneration:x.generation,documentId:x.documentId,hostOutcome:"host",error:T};w==="action"?t.current.postDevtoolsAction(x.sessionId,{...M,ok:!1}).catch(()=>{}):t.current.ingestDevtoolsCapture(x.sessionId,{...M,logicalUrl:x.logicalUrl,seq:Math.max(0,d.current),console:[],network:[],screenshot:{requestId:A,error:T}}).catch(()=>{})}function B(A,w,x,{capture:T=!1,resolve:M,timeoutMs:K=8e3}={}){if(s.current.size>=Me.pending||s.current.has(A))return null;const V=setTimeout(()=>H(A,se),K),se={kind:w,life:x,capture:T,deadline:Date.now()+K,timer:V,resolve:M};return s.current.set(A,se),se}function H(A,w){var x;s.current.get(A)===w&&(s.current.delete(A),clearTimeout(w.timer),(x=w.resolve)==null||x.call(w,null))}function $(A,w,x){return s.current.get(A)!==w||w.life!==x||!j(x)?!1:Date.now()>=w.deadline?(H(A,w),!1):!0}function ae(A,w,x){const T=s.current.get(A);return!T||T.life!==x||T.kind!==w&&!(w==="capture"&&T.kind==="frame")||!$(A,T,x)?null:(s.current.delete(A),clearTimeout(T.timer),T)}g.useEffect(()=>{const{initialize:A,retire:w,consume:x}=Z.current;function T(){u.current=null;const me=l.current;l.current=null,c.current={console:[],network:[],entryBytes:0,overheadBytes:0};const z=a.current;me&&z&&!z.retired&&z.sessionId&&me.bridgeGeneration===z.generation&&t.current.ingestDevtoolsCapture(z.sessionId,me)}function M(me){var yr,Cr,Sr,kr;const z=a.current;if(!z||z.retired||me.source!==z.frame||me.origin!==z.origin||((yr=f.current)==null?void 0:yr.frame)!==z.frame||f.current.source!==z.source||f.current.reload!==N.current.reloadNonce||f.current.documentId!==z.documentId||f.current.logicalUrl!==z.logicalUrl)return;const F=me.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!==z.generation)return;const ue=F.__dorkosDevtools==="batch";if(ue){if(!z.ready||!z.sessionId||F.bridgeGeneration!==z.generation||!Number.isSafeInteger(F.seq)||F.seq<0||F.seq<=d.current)return;const J=Date.now();if(J-h.current<Me.batchMs){l.current?l.current.dropped=!0:b.current=!0;return}h.current=J}const G=Di(F);if(!G){ue&&(b.current=!0);return}if(G.__dorkosDevtools==="hello"){z.frame.postMessage({__dorkosDevtools:"init",bridgeGeneration:z.generation},"*");return}if(G.bridgeGeneration!==z.generation)return;if(G.__dorkosDevtools==="ready"){z.ready||(z.ready=!0,z.activation=!1,P(z,{active:!0}));return}if(!z.ready)return;if(G.__dorkosDevtools==="navigated"){v.current=!0,w();return}if(G.__dorkosDevtools==="resource-error"){k.current=Math.min(Me.resourceErrors,k.current+1),S.current===null&&(S.current=requestAnimationFrame(()=>{S.current=null,j(z)&&o(k.current)}));return}if(!z.sessionId)return;if(G.__dorkosDevtools==="batch"){if(G.seq<=d.current)return;d.current=G.seq;const J=l.current??{documentId:z.documentId,logicalUrl:z.logicalUrl,bridgeGeneration:z.generation,seq:G.seq,console:[],network:[]};J.seq=G.seq,b.current&&(J.dropped=!0),b.current=!1;const je=c.current,Pr=new TextEncoder;if(l.current||(je.overheadBytes=Pr.encode(JSON.stringify({...J,seq:Number.MAX_SAFE_INTEGER,dropped:!0,console:[],network:[]})).length),je.overheadBytes>Me.queueBytes){l.current=null,c.current={console:[],network:[],entryBytes:0,overheadBytes:0},b.current=!0;return}for(const[Je,Qn]of[["console",G.console],["network",G.network]])for(const Kn of Qn){const Er=Pr.encode(JSON.stringify(Kn)).length;je[Je].push(Er),je.entryBytes+=Er}J.console.push(...G.console),J.network.push(...G.network);const Jn=()=>je.overheadBytes+je.entryBytes+Math.max(0,J.console.length-1)+Math.max(0,J.network.length-1);for(;J.console.length>500||J.network.length>200||Jn()>Me.queueBytes;){J.dropped=!0;const Je=(((Cr=J.console[0])==null?void 0:Cr.timestamp)??1/0)<=(((Sr=J.network[0])==null?void 0:Sr.timestamp)??1/0)?"console":"network";if(!J[Je].length)break;J[Je].shift(),je.entryBytes-=je[Je].shift()}l.current=J,u.current===null&&(u.current=setTimeout(T,Me.batchMs));return}if(G.__dorkosDevtools==="capture-result"){const J=x(G.requestId,"capture",z);if(!J)return;if(J.kind==="frame"){(kr=J.resolve)==null||kr.call(J,G.dataUrl??null);return}t.current.ingestDevtoolsCapture(z.sessionId,{bridgeGeneration:z.generation,documentId:z.documentId,logicalUrl:z.logicalUrl,seq:Math.max(0,d.current),console:[],network:[],hostOutcome:"page-reported",screenshot:{requestId:G.requestId,dataUrl:G.dataUrl,error:G.error}});return}const $e=x(G.requestId,"action",z);if(!$e)return;const Ne=y.current,wr=$e.capture&&G.dataUrl!==void 0&&Ne!==null&&Ne.life===z&&Ne.activated&&!Ne.finishing&&!Ne.cancelled&&Ne.frames.length<61;wr&&Ne.frames.push(G.dataUrl);const{__dorkosDevtools:jl,dataUrl:Al,...$n}=G;t.current.postDevtoolsAction(z.sessionId,{...$n,hostOutcome:"page-reported",documentId:z.documentId,captured:wr||void 0})}window.addEventListener("message",M);const K=setInterval(()=>L.current({active:!0}),15e3),V=()=>{a.current||A(),L.current({active:!0,activation:!0})},se=()=>{L.current({active:!1,keepalive:!0}),w()},ce=()=>{document.visibilityState==="visible"&&V()};return window.addEventListener("focus",V),window.addEventListener("pagehide",se),window.addEventListener("pageshow",V),document.addEventListener("visibilitychange",ce),()=>{window.removeEventListener("message",M),clearInterval(K),window.removeEventListener("focus",V),window.removeEventListener("pagehide",se),window.removeEventListener("pageshow",V),document.removeEventListener("visibilitychange",ce),w()}},[]),g.useEffect(()=>ii.subscribeSessionEvent((A,w)=>{if(w.type!=="devtools_capture_request"&&w.type!=="devtools_action_request"&&w.type!=="devtools_recording_request")return;const{register:x,eligiblePending:T,refuseRequest:M,captureFrame:K,valid:V,finish:se,reportRecordingStart:ce,cancelReservation:me}=Z.current,z=a.current;if(!(!(z!=null&&z.ready)||!z.sessionId||z.retired||w.targetClientId!==t.current.clientId||w.documentId!==z.documentId||w.bridgeGeneration!==z.generation)){if(w.type==="devtools_capture_request"||w.type==="devtools_action_request"){const F=w.type==="devtools_action_request",ue=x(w.requestId,F?"action":"capture",z,{capture:F&&!!w.capture,timeoutMs:F&&w.command.action==="wait_for"?Math.min(1e4,w.command.timeoutMs)+2e3:8e3});if(!ue){s.current.has(w.requestId)||M(w.requestId,F?"action":"capture",z,"Too many browser requests are waiting. Try again when one finishes.");return}const G=$e=>{T(w.requestId,ue,z)&&z.frame.postMessage(F?{__dorkosDevtools:"act-request",bridgeGeneration:z.generation,requestId:w.requestId,documentId:z.documentId,command:w.command,...w.capture?{capture:!0,lib:$e}:{}}:{__dorkosDevtools:"capture-request",bridgeGeneration:z.generation,requestId:w.requestId,lib:$e},"*")};!F||w.capture?Rr().then(G,()=>G()):G()}if(w.type==="devtools_recording_request"){if(w.action==="cancel-start"){me(w.recordingId,w.requestId,z);return}if(w.action==="confirm-start"){const F=y.current;if(!F||F.id!==w.recordingId||F.startRequestId!==w.requestId||F.life!==z||F.finishing||!V(F))return;if(!F.activated){if(performance.now()>=F.reservationDeadline){me(F.id,F.startRequestId,z),ce(w,z,{phase:"started",ok:!1,error:"This recording reservation expired before capture could start."});return}clearTimeout(F.reservationTimer),F.activated=!0,F.startedAt=Date.now(),K(z).then(ue=>{ue&&V(F)&&F.frames.push(ue)})}ce(w,z,{phase:"started",ok:!0});return}if(w.action==="start"){const F=w.reservationTimeoutMs;if(!Number.isSafeInteger(F)||!F||F<1||F>Li){ce(w,z,{phase:"reserved",ok:!1,error:"This recording request has no valid reservation timeout."});return}if(y.current){ce(w,z,{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 ue={id:w.recordingId,startRequestId:w.requestId,activated:!1,reservationDeadline:performance.now()+F,life:z,startedAt:Date.now(),frames:[],drawn:[],finishing:!1,cancelled:!1,abort:new AbortController};y.current=ue,ue.reservationTimer=setTimeout(()=>{y.current===ue&&!ue.activated&&me(ue.id,ue.startRequestId,z)},F),ce(w,z,{phase:"reserved",ok:!0})}else se(w.requestId,w.recordingId,z)}}}),[]);function Ce(A,w,x){!j(w)||!w.sessionId||t.current.ingestDevtoolsCapture(w.sessionId,{hostOutcome:"host",documentId:w.documentId,bridgeGeneration:w.generation,seq:0,console:[],network:[],recordingStart:{...x,requestId:A.requestId,recordingId:A.recordingId}}).catch(()=>{})}function qe(A,w,x){var M;const T=y.current;if(!(!T||T.id!==A||T.startRequestId!==w||T.life!==x||T.finishing)){clearTimeout(T.reservationTimer),T.cancelled=!0,T.abort.abort(),T.frames.length=0,T.drawn.length=0;for(const[K,V]of s.current)V.life===x&&V.kind==="frame"&&(clearTimeout(V.timer),(M=V.resolve)==null||M.call(V,null),s.current.delete(K));y.current=null}}function He(A){return y.current===A&&!A.cancelled&&j(A.life)}function Ge(A){const w=`frame-${crypto.randomUUID()}`;return new Promise(x=>{const T=B(w,"frame",A,{resolve:x});if(!T){x(null);return}Rr().then(M=>{$(w,T,A)&&A.frame.postMessage({__dorkosDevtools:"capture-request",bridgeGeneration:A.generation,requestId:w,lib:M},"*")},()=>{H(w,T)})})}async function bt(A,w,x){const T=y.current;if(!T||!T.activated||T.id!==w||T.life!==x){j(x)&&await t.current.uploadDevtoolsRecording(x.sessionId,{requestId:A,bridgeGeneration:x.generation,documentId:x.documentId,hostOutcome:"host",error:"The window showing that page stopped recording before it could be saved."}).catch(()=>{});return}if(T.finishing)return;T.finishing=!0;const M=()=>{if(!He(T))throw new Error("retired")},K={requestId:A,bridgeGeneration:x.generation,documentId:x.documentId};try{const V=await Ge(x);M(),V&&T.frames.length<Me.frames&&T.frames.push(V);const se=T.frames.length?Wi(T.frames[T.frames.length-1]):new Uint8Array;T.drawn=await Mi(T.frames,800,M),M();let ce=await xr(T.drawn,{frameMs:500,maxBytes:8*1024*1024},M);if(M(),!ce.ok&&T.drawn.length&&(Yi(T.drawn,M),ce=await xr(T.drawn,{frameMs:500,maxBytes:8*1024*1024},M),M()),!ce.ok){await t.current.uploadDevtoolsRecording(x.sessionId,{...K,hostOutcome:"host",error:ce.error},{signal:T.abort.signal}),M();return}M(),await t.current.uploadDevtoolsRecording(x.sessionId,{...K,frames:T.drawn.length,durationMs:Date.now()-T.startedAt,recording:zr(`${w}.gif`,"image/gif",ce.bytes),keyframe:zr(`${w}.png`,"image/png",se)},{signal:T.abort.signal}),M()}catch{He(T)&&await t.current.uploadDevtoolsRecording(x.sessionId,{...K,hostOutcome:"host",error:"This window could not turn that recording into a file."},{signal:T.abort.signal}).catch(()=>{})}finally{T.frames.length=0,T.drawn.length=0,y.current===T&&(y.current=null)}}return{resourceErrorCount:i,notePersonNavigated:W,noteFrameLoaded:R}}const Bi=15e3;function qi(e){const r=e instanceof Error?e.message.trim():"";return r.length>0?r:"Couldn’t reach DorkOS. Check your network and try again."}function Hi(e){const r=ve();return{open:g.useCallback(async t=>{await r.openRoomCanvasDocument(e,t)},[r,e]),update:g.useCallback(async(t,n)=>{await r.updateRoomCanvasDocument(e,t,{content:n})},[r,e]),pin:g.useCallback(async(t,n)=>{await r.updateRoomCanvasDocument(e,t,{pinned:n})},[r,e]),close:g.useCallback(async t=>{await r.closeRoomCanvasDocument(e,t)},[r,e])}}function Ui(e,r){const t=ve(),n=ee(i=>i.setRoomCanvasEditing);g.useEffect(()=>{if(n(e,r),r===null)return;const i=a=>{t.setRoomCanvasEditing(e,r,a).catch(s=>{console.warn("[room-canvas] edit lock failed",{roomId:e,documentId:r,err:s})})};i(!0);const o=setInterval(()=>i(!0),Bi);return()=>{clearInterval(o),i(!1),n(e,null)}},[t,e,r,n])}const Zi=400;function Ml(e,r){const t=ve(),n=ee(i=>i.roomCanvasPresenceEpoch[e]??0);g.useEffect(()=>{const i=s=>{t.setRoomCanvasViewing(e,s).catch(l=>{console.warn("[room-canvas] could not say where we are looking",{roomId:e,err:l})})};let o=!1;const a=setTimeout(()=>{o=!0,i(r)},Zi);return()=>{clearTimeout(a),o&&i(null)}},[t,e,r,n])}const Vi="allow-scripts allow-forms allow-popups allow-modals",Lt="allow-scripts allow-same-origin allow-popups allow-forms allow-modals allow-downloads",Gi=new Set(["javascript:","data:","blob:"]),$i=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","::1"]);function cr(e){return $i.has(e)||e.endsWith(".localhost")}function Ji(e){return cr(e)?"direct":"server"}function Qi(e,r){let t;try{t=new URL(e)}catch{return null}const n=t.searchParams.get(Dr),i=new URL(t.origin),o=r.indexOf("?");return i.pathname=(o===-1?r:r.slice(0,o))||"/",i.search=o===-1?"":r.slice(o),n!==null&&i.searchParams.set(Dr,n),i.toString()}const Dr="__dorkos_preview",Ki="/__dorkos_preview/health";function Ii(e){return e==="https:"?443:80}function ln(e){let r;try{r=new URL(e)}catch{return{mode:"serve",path:e}}if(Gi.has(r.protocol))return{mode:"blocked"};if(r.protocol==="file:")return{mode:"serve",path:decodeURIComponent(r.pathname)};if(r.protocol==="http:"||r.protocol==="https:"){if(cr(r.hostname)){const t=r.port?Number(r.port):Ii(r.protocol);return{mode:"proxy",hostname:r.hostname,port:t,path:`${r.pathname}${r.search}`}}return{mode:"external",url:e}}return{mode:"blocked"}}function eo(e){const r=e.trim();if(r===""||/^[a-z][a-z0-9+.-]*:\/\//i.test(r)||r.startsWith("/")||r.startsWith("./")||r.startsWith("../"))return r;const t=r.split("/")[0];if(r.includes("/")&&!t.includes(".")&&!t.includes(":"))return r;const i=t.split(":")[0];return`${cr(i)?"http":"https"}://${r}`}function to(e){const r=ln(e);if(r.mode==="serve")return{kind:"local",path:r.path};if(r.mode==="blocked")return{kind:"raw",text:e};try{const t=new URL(e),n=t.host.replace(/^www\./,""),i=t.pathname==="/"&&t.search===""&&t.hash===""?"":`${t.pathname}${t.search}${t.hash}`;return{kind:"url",host:n,rest:i}}catch{return{kind:"raw",text:e}}}const ro=2e3;async function Nr(e,r=globalThis.fetch,t=ro){const n=new AbortController,i=setTimeout(()=>n.abort(),t);try{return await r(e,{mode:"no-cors",cache:"no-store",signal:n.signal}),!0}catch{return n.signal.aborted}finally{clearTimeout(i)}}function no({target:e,currentUrl:r,strategy:t,cwd:n,reloadNonce:i}){const o=JSON.stringify([r,t,n,i]),[a,s]=g.useState(null),[l,c]=g.useState(null),[u,d]=g.useState(null),f=ve(),p=g.useRef(f);return g.useEffect(()=>{p.current=f}),g.useEffect(()=>{const v=p.current;let h=!1;const b=_=>{s(o),c(_)};async function y(_){if(n===null){d({kind:"no-session"});return}try{const D=await v.createServeUrl(n,_);if(h)return;D===null?d({kind:"unsupported"}):b({src:D,sandbox:Vi,previewOrigin:null,bridgeEligibility:"served-document"})}catch{h||d({kind:"failed"})}}async function k(_,D){let X;try{const Y=await v.probeLoopbackPort(_);X=Y===null?"unknown":Y.listening}catch{X="unknown"}if(h)return;let N=null;if(X!==!1){let Y=null;try{Y=await v.createProxyUrl(_)}catch{if(h)return;N={kind:"failed"}}if(h)return;if((Y==null?void 0:Y.unavailable)==="tunnel"){d({kind:"tunnel"});return}if((Y==null?void 0:Y.unavailable)==="no-port"&&(N={kind:"no-port"}),Y!=null&&Y.url){const L=new URL(Y.url);if(await Nr(`${L.origin}${Ki}`)){if(h)return;const Z=Qi(Y.url,D);if(Z!==null){b({src:Z,sandbox:Lt,previewOrigin:L.origin,bridgeEligibility:"preview-listener"});return}}if(h)return;N={kind:"origin-unreachable",host:L.hostname,listenPort:L.port}}}if(t==="direct"&&await Nr(r)){if(h)return;b({src:r,sandbox:Lt,previewOrigin:null,bridgeEligibility:null});return}h||d(N??{kind:"no-upstream"})}async function S(){if(d(null),c(null),e.mode!=="blocked"){if(e.mode==="external"){b({src:e.url,sandbox:Lt,previewOrigin:null,bridgeEligibility:null});return}return e.mode==="serve"?y(e.path):k(e.port,e.path)}}return S(),()=>{h=!0}},[e,r,t,n,i,o]),{resolved:a===o?l:null,resolveError:u}}const io=1e4;function oo(e,r){if(e&&e.contentUrl===r&&e.stack.length>0){const t=Math.min(Math.max(e.cursor,0),e.stack.length-1);return{stack:e.stack,cursor:t}}return{stack:[r],cursor:0}}function ao({documentId:e,content:r}){const t=ee(R=>R.selectedCwd),n=ee(R=>R.writeBrowserHistory),[i]=g.useState(()=>oo(ee.getState().browserHistories[e],r.url)),[o,a]=g.useState(i.stack),[s,l]=g.useState(i.cursor),[c,u]=g.useState(0);g.useEffect(()=>{n(e,{contentUrl:r.url,stack:o,cursor:s})},[e,r.url,o,s,n]);const d=o[s],f=g.useMemo(()=>ln(d),[d]),p=g.useMemo(()=>f.mode==="proxy"?Ji(window.location.hostname):null,[f]),v=g.useRef(null),{resolved:h,resolveError:b}=no({target:f,currentUrl:d,strategy:p,cwd:t,reloadNonce:c}),{resourceErrorCount:y,notePersonNavigated:k,noteFrameLoaded:S}=Fi({iframeRef:v,documentId:e,logicalUrl:d,reloadNonce:c,previewOrigin:(h==null?void 0:h.previewOrigin)??null,bridgeEligibility:(h==null?void 0:h.bridgeEligibility)??null,resolvedSource:(h==null?void 0:h.src)??null}),_=ee(R=>R.roomCanvasLiveRoomId),{open:D}=Hi(_??""),[X,N]=g.useState(null),Y=g.useCallback(R=>{a(W=>[...W.slice(0,s+1),R]),l(W=>W+1)},[s]),L=oi(_),Z=ee(R=>_?R.roomCanvasEditing[_]??null:null);g.useEffect(()=>{if(L===null||Z!==null||L.documentId!==e)return;const R=L.url;R===void 0||R===d||Y(R)},[L,Z,e,d,Y]);const Q=s>0,P=s<o.length-1,C=g.useCallback(R=>{const W=eo(R);if(!W||W===d){k(),u(j=>j+1);return}if(_){N(null),D({type:"browser",url:W}).catch(j=>{N({url:W,message:qi(j)})});return}k(),Y(W)},[d,Y,_,D,k]),O=()=>ci(d);return m.jsxs("div",{className:"flex h-full flex-col",children:[m.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:[m.jsx(wt,{label:"Back",disabled:!Q,onClick:()=>l(R=>R-1),children:m.jsx(ai,{className:"size-4"})}),m.jsx(wt,{label:"Forward",disabled:!P,onClick:()=>l(R=>R+1),children:m.jsx(si,{className:"size-4"})}),m.jsx(wt,{label:"Reload",onClick:()=>u(R=>R+1),children:m.jsx(yi,{className:"size-4"})}),m.jsx("div",{className:"order-first flex w-full min-w-0 lg:order-none lg:w-auto lg:flex-1",children:m.jsx(so,{url:(X==null?void 0:X.url)??d,startEditing:X!==null,onSubmit:C},X===null?"address":`retry:${X.url}`)}),m.jsx(wt,{label:"Open in system browser",onClick:O,children:m.jsx(li,{className:"size-4"})})]}),X!==null&&m.jsx("p",{role:"status",className:"text-destructive border-border/60 border-b px-2 py-1 text-xs",children:X.message}),m.jsx(fo,{target:f,resolved:h,resolveError:b,reloadNonce:c,resourceErrorCount:y,title:r.title??"Embedded browser",onOpenExternally:O,onReload:()=>{k(),u(R=>R+1)},iframeRef:v,onFrameLoad:S})]})}function so({url:e,startEditing:r=!1,onSubmit:t}){const[n,i]=g.useState(r),[o,a]=g.useState(e);if(!n)return m.jsx(uo,{url:e,onActivate:()=>{a(e),i(!0)}});const s=l=>{l.preventDefault(),i(!1),t(o)};return m.jsx("form",{onSubmit:s,className:"min-w-0 flex-1",children:m.jsx(ui,{"aria-label":"Address",autoFocus:!0,value:o,onChange:l=>a(l.target.value),onFocus:l=>l.currentTarget.select(),onBlur:()=>i(!1),onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),i(!1))},spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",className:"h-11 w-full text-base lg:h-7 lg:text-sm"})})}function lo(e){return e.kind==="local"?e.path:e.kind==="url"?`${e.host}${e.rest}`:e.text}function uo({url:e,onActivate:r}){const t=g.useMemo(()=>to(e),[e]);return m.jsxs("button",{type:"button","aria-label":`Address: ${lo(t)}`,onClick:r,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:[t.kind==="local"&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"bg-muted-foreground/15 text-3xs rounded px-1 py-0.5 font-medium tracking-wide uppercase",children:"local"}),m.jsx("span",{className:"text-foreground truncate",children:t.path})]}),t.kind==="url"&&m.jsxs("span",{className:"truncate",children:[m.jsx("span",{className:"text-foreground",children:t.host}),m.jsx("span",{className:"text-muted-foreground",children:t.rest})]}),t.kind==="raw"&&m.jsx("span",{className:"truncate",children:t.text})]})}function co(e,r){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 ${r.mode==="proxy"?`${r.hostname}:${r.port}`:"that address"}. Start the dev server, then reload.`}}function fo({target:e,resolved:r,resolveError:t,reloadNonce:n,resourceErrorCount:i,title:o,onOpenExternally:a,onReload:s,iframeRef:l,onFrameLoad:c}){if(e.mode==="blocked")return m.jsx(Ft,{children:"This address is blocked for safety."});if(t!==null)return m.jsxs(Ft,{children:[m.jsx("p",{children:co(t,e)}),t.kind!=="no-session"&&t.kind!=="unsupported"&&m.jsx("button",{type:"button",onClick:s,className:"text-foreground mt-3 hover:underline",children:"Reload"})]});if(r===null)return m.jsx(Ft,{children:"Loading…"});const u=e.mode==="external";return m.jsx(po,{src:r.src,sandbox:r.sandbox,title:o,iframeRef:l,onFrameLoad:c,watchLoadDeadline:!u,resourceErrorCount:i,showEmbedFallback:u,onOpenExternally:a,onReload:s},`${r.src}:${n}`)}function po({src:e,sandbox:r,title:t,iframeRef:n,onFrameLoad:i,watchLoadDeadline:o,resourceErrorCount:a,showEmbedFallback:s,onOpenExternally:l,onReload:c}){const[u,d]=g.useState(!1),[f,p]=g.useState(!1);return g.useEffect(()=>{if(!o)return;const v=setTimeout(()=>p(!0),io);return()=>clearTimeout(v)},[o]),m.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[f&&!u&&m.jsx(Mr,{onOpenExternally:l,onReload:c,children:"This preview is slow to load."}),a>0&&m.jsxs(Mr,{onOpenExternally:l,children:["This page hit ",a===1e4?"at least 10,000":a," ",a===1?"error":"errors"," while loading."]}),m.jsx("iframe",{ref:n,src:e,sandbox:r,onLoad:()=>{d(!0),i()},className:"min-h-0 w-full flex-1 border-0",title:t}),s&&m.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:[m.jsx("span",{children:"This site can’t always be embedded here."}),m.jsx("button",{type:"button",onClick:l,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function Mr({children:e,onOpenExternally:r,onReload:t}){return m.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:[m.jsx("span",{children:e}),m.jsxs("span",{className:"flex shrink-0 items-center gap-3",children:[t&&m.jsx("button",{type:"button",onClick:t,className:"text-foreground hover:underline",children:"Reload"}),m.jsx("button",{type:"button",onClick:r,className:"text-foreground hover:underline",children:"Open in system browser"})]})]})}function wt({label:e,disabled:r,onClick:t,children:n}){return m.jsx("button",{type:"button","aria-label":e,disabled:r,onClick:t,className:ur("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",r&&"pointer-events-none opacity-40"),children:n})}function Ft({children:e}){return m.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 lt=st().min(1).max(128),be={protocol:re("dorkos-doc"),v:re(1),nonce:lt,requestToken:lt,loadToken:Gt,generation:Kr.shape.generation};Rt("kind",[le({...be,kind:re("challenge")}).strict(),le({...be,kind:re("ack")}).strict(),le({...be,kind:re("connect")}).strict()]);Rt("kind",[le({...be,kind:re("emit"),requestId:lt,event:Et}).strict(),le({...be,kind:re("retire")}).strict()]);Rt("kind",[le({...be,kind:re("receipt"),requestId:lt,receipt:Ir}).strict(),le({...be,kind:re("refused"),requestId:lt,outcome:jr(["cancelled","unconfirmed","refused"])}).strict(),le({...be,kind:re("state"),state:fi,stateRev:Gt,docSeq:Gt,reset:Ar()}).strict(),le({...be,kind:re("event"),frame:pi}).strict(),le({...be,kind:re("status"),status:jr(["connecting","ready","offline","revoked"]),unconfirmed:Ar()}).strict()]);function ho(e,r){try{if(di(r,1048576)!==void 0)return null;const t=e.safeParse(r);return t.success?t.data:null}catch{return null}}function vo({owner:e,getOwner:r,readTail:t,writeTail:n,transport:i,cwd:o,sourcePath:a,documentId:s,pending:l}){const c=()=>{var h,b;return((h=r())==null?void 0:h.recoveryGate)==="unsupported"||((b=r())==null?void 0:b.recoveryGate)==="observed_clear"},u=h=>{var k;const b=hi.parse(h),y=(k=r())==null?void 0:k.recoveryBinding;if(!y||b.documentId!==s||!I(b.incarnation,y.incarnation))throw new Error("Original save scope changed");return b},d=i.originalFileSaveRecovery,f=()=>{var h;try{const b=r();return(b==null?void 0:b.identity)===e&&b.active&&!!((h=b.recoveryBinding)!=null&&h.current())}catch{return!1}},p=(h,b,y=!1)=>{if(!d||!f())return Promise.resolve({status:"idle"});const k=r(),S={},_=()=>r()===k&&f()&&(!b||k.recoveryBinding===b)&&(!y||k.recoveryWork===S),D=k.discovery;let X=!1;k.recoveryWork=S,k.recoveryGate="pending",k.recoveryBusy=!0;const N=t().catch(()=>{}).then(async()=>{try{if(!_())return{status:"idle"};const Y=await h();return _()?(y&&(k.recoveryGate="observed_clear"),X=!0,{status:"observed",value:Y}):{status:"idle"}}catch{return _()?(k.recoveryGate="unavailable",{status:"unavailable"}):{status:"idle"}}finally{!X&&k.discovery===D&&(k.discovery=void 0),k.recoveryWork===S&&(k.recoveryBusy=!1,k.recoveryWork=void 0)}});return y||n(N.then(()=>{})),N};return{identity:e,supported:!!d,current:f,discover:(h=!1)=>{if(!d||!f())return Promise.resolve({status:"idle"});const b=r(),y=b.recoveryBinding;if(b.discoveryBinding===y&&b.discovery&&(b.pendingDiscovery===b.discovery||!h&&b.recoveryGate==="observed_clear"))return b.discovery;const k=p(async()=>{const S=u(await d.discover(s));return r()===b&&b.recoveryBinding===y&&f()&&(b.recoveryGate=S.admission==="blocked"?"blocked":"observed_clear"),S},y);return b.discoveryBinding=y,b.discovery=k,b.pendingDiscovery=k,k.then(S=>{b.pendingDiscovery===k&&(b.pendingDiscovery=void 0),S.status==="idle"&&b.discovery===k&&(b.discovery=void 0)}),k},recover(h){if(l())return Promise.resolve({status:"local_uncertain"});const b=r();return p(async()=>{if(!b||l())throw new Error("Mounted original still uncertain");const y=b.recoveryBinding,k=vi.parse(await d.recover(s,h,y.incarnation));if(r()!==b||!f()||k.documentId!==s||k.entry.eventId!==h||!I(k.incarnation,y.incarnation))throw new Error("Original recovery scope changed");const S=u(await d.discover(s));return r()===b&&f()&&(b.recoveryGate=S.admission==="blocked"?"blocked":"observed_clear"),{result:k,discovery:S}})},inspectCurrent(){const h=r();return!h||!f()||l()||!c()?Promise.resolve({status:"local_uncertain"}):p(async()=>{const b=await i.readFileContent(o,a);if(!b||typeof b.content!="string"||typeof b.hash!="string"||!/^[a-f0-9]{64}$/u.test(b.hash))throw new Error("Current file evidence missing");return{content:b.content,hash:b.hash}},h.recoveryBinding,!0)}}}class Ye extends Error{constructor(){super("The original save is not confirmed. Retry it before saving another draft.")}}class it extends Error{}function mo(){const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=[...e].map(t=>t.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function go(e){const r=e;return(r==null?void 0:r.status)===412&&r.code==="DOC_SAVE_FAILED"}var ge,Le,vt,$t;class bo{constructor(){Ke(this,vt);Ke(this,ge);Ke(this,Le)}get pending(){return Qe(this,ge)!==void 0}get receipt(){return Qe(this,Le)}async write(r,t,n,i,o,a,s=!1){if(Qe(this,ge))throw new Ye;if(Se(this,Le,void 0),!a)return r.writeFile(t,n,i,o);if(!s&&!a.current())throw new it;const l=Object.freeze({cwd:t,path:n,content:i,options:Object.freeze({...o,documentSave:Object.freeze({documentId:a.incarnation.documentId,eventId:mo(),incarnation:Object.freeze({...a.incarnation})})})});return Se(this,ge,l),ke(this,vt,$t).call(this,r,l)}async retry(r,t){const n=Qe(this,ge);if(!(n!=null&&n.options.documentSave)||!t.current()||!I(n.options.documentSave.incarnation,t.incarnation))throw new it;return{result:await ke(this,vt,$t).call(this,r,n),content:n.content}}}ge=new WeakMap,Le=new WeakMap,vt=new WeakSet,$t=async function(r,t){try{const n=await r.writeFile(t.cwd,t.path,t.content,t.options);if(!n||typeof n!="object"||typeof n.ok!="boolean")throw new Ye;if(!n.ok){if(!n.conflict||typeof n.conflict.currentHash!="string"||!n.conflict.currentHash||typeof n.conflict.currentContent!="string")throw new Ye;return Se(this,ge,void 0),n}if(typeof n.hash!="string"||!n.hash||n.effect!=="changed"&&n.effect!=="no_op")throw new Ye;const i="documentReceipt"in n?mi.parse(n.documentReceipt):void 0,o=t.options.documentSave;if(!i&&n.effect!=="no_op")throw new Ye;if(i&&(i.documentId!==o.documentId||i.eventId!==o.eventId||!I(i.incarnation,o.incarnation)||i.fileHash!==n.hash||(i.status==="accepted"?n.effect!=="changed":n.effect!=="no_op")))throw new Ye;if((i==null?void 0:i.status)==="duplicate"){const a=await r.readFileContent(t.cwd,t.path);if(!a||typeof a!="object"||Array.isArray(a)||typeof a.hash!="string"||!a.hash||typeof a.content!="string")throw new Ye;if(a.hash!==i.fileHash||a.content!==t.content)return Se(this,Le,i),Se(this,ge,void 0),{ok:!1,conflict:{currentHash:a.hash,currentContent:a.content}}}return Se(this,Le,i),Se(this,ge,void 0),n}catch(n){throw go(n)&&Se(this,ge,void 0),n}};function wo({sourcePath:e,cwd:r,loadedContent:t,documentId:n,documentSaveBinding:i,documentRecoveryBinding:o}){const a=ve(),s=(i==null?void 0:i.incarnation)??(o==null?void 0:o.incarnation),l=s?JSON.stringify([s.documentId,s.physicalOpenedAt,s.channelCreatedAt,s.generation]):void 0,c=g.useRef(new bo),u=g.useMemo(()=>({sourcePath:e,cwd:r,documentId:n,transport:a,birthKey:l}),[e,r,n,a,l]),d=g.useRef(null),f=g.useRef(null),p=g.useRef(Promise.resolve()),v=g.useCallback(()=>{var j;return((j=f.current)==null?void 0:j.identity)===u&&f.current.active},[u]);g.useLayoutEffect(()=>{var j;return((j=f.current)==null?void 0:j.identity)!==u?f.current={identity:u,baseHash:null,baseContent:t,active:!0,recoveryBinding:o,recoveryGate:o&&a.originalFileSaveRecovery?"pending":"unsupported"}:(f.current.active=!0,f.current.recoveryBinding=o),()=>{var E;((E=f.current)==null?void 0:E.identity)===u&&(f.current.active=!1)}},[u,t,o,a]);const[h,b]=g.useState({owner:u,status:"idle",conflict:null}),y=h.owner===u?h.status:"idle",k=h.owner===u?h.conflict:null,S=g.useCallback((j,E,B)=>{v()&&b(H=>({owner:u,status:j,documentReceipt:E,confirmedContent:B,conflict:H.owner===u?H.conflict:null}))},[u,v]),_=g.useCallback(j=>{v()&&b(E=>({owner:u,conflict:j,status:E.owner===u?E.status:"idle"}))},[u,v]),D=g.useCallback(()=>{var j,E;return((j=f.current)==null?void 0:j.recoveryGate)==="unsupported"||((E=f.current)==null?void 0:E.recoveryGate)==="observed_clear"},[]),X=g.useMemo(()=>{const j=()=>vo({owner:u,getOwner:()=>f.current,readTail:()=>p.current,writeTail:E=>{p.current=E},transport:a,cwd:r,sourcePath:e,documentId:n,pending:()=>c.current.pending});return{identity:u,supported:!!a.originalFileSaveRecovery,current:()=>j().current(),discover:E=>j().discover(E),recover:E=>j().recover(E),inspectCurrent:()=>j().inspectCurrent()}},[u,a,r,e,n]),N=!!(e&&r),Y=g.useCallback((j,E,B,H=!1)=>{const $=()=>v()&&f.current===j&&(!i||i.current());if(E.ok){if(typeof E.hash!="string"||!E.hash||E.effect!=="changed"&&E.effect!=="no_op")throw new Error("Invalid file save acknowledgement");return j.baseHash=E.hash,j.baseContent=B,!H&&!$()?{status:"idle"}:(H||(_(null),S("saved",c.current.receipt,B)),{status:E.effect,confirmed:{hash:E.hash,content:B}})}return!H&&!$()?{status:"idle"}:(H||(_(E.conflict),S("conflict")),{status:"conflict"})},[v,i,_,S]),L=g.useCallback(async(j,E)=>{if(!v())return{status:"idle"};const B=f.current;i&&!c.current.pending&&(d.current=u);const H=await c.current.write(a,r,e,j,E,i);return Y(B,H,j)},[v,a,r,e,i,Y,u]),Z=g.useCallback(j=>{var H;if(!N||!v())return Promise.resolve({status:"idle"});const E=((H=f.current.finalToken)==null?void 0:H.content)===j?f.current.finalToken:void 0,B=p.current.catch(()=>{}).then(async()=>{if(!v()||i&&!i.current())return{status:"idle"};if(c.current.pending)return S("uncertain"),{status:"uncertain"};if(!D())return S("error"),{status:"error"};f.current.finalToken===E&&(f.current.finalToken=void 0),S("saving");try{const $=f.current.baseHash!==null?{expectedHash:f.current.baseHash}:{expectedContent:f.current.baseContent};return await L(j,$)}catch($){if($ instanceof it)return{status:"idle"};if(!v()||i&&!i.current())return{status:"idle"};const ae=c.current.pending?"uncertain":"error";return S(ae),{status:ae}}});return p.current=B.then(()=>{}),B},[N,L,v,S,i,D]),Q=g.useCallback(j=>{if(!N||!v()||i&&!i.current())return null;const E=f.current,B={content:j,id:Symbol("buffered canvas draft")};return E.finalToken=B,{cancel(){E.finalToken===B&&(E.finalToken=void 0)},flush(){if(E.finalToken!==B||f.current!==E||E.active)return Promise.resolve({status:"idle"});E.finalToken=void 0;const H=p.current.catch(()=>{}).then(async()=>{if(f.current!==E||E.active)return{status:"idle"};try{if(E.recoveryGate!=="unsupported"&&E.recoveryGate!=="observed_clear")return{status:"error"};const $=E.baseHash!==null?{expectedHash:E.baseHash}:{expectedContent:E.baseContent};i&&!c.current.pending&&(d.current=u);const ae=await c.current.write(a,r,e,j,$,i,!0);return Y(E,ae,j,!0)}catch{return{status:"error"}}});return p.current=H.then(()=>{}),H}}},[N,v,a,r,e,i,Y,u]),P=g.useCallback(async j=>{const E=f.current;return!E||E.identity!==u?!1:(await p.current.catch(()=>{}),f.current===E&&!c.current.pending&&E.baseContent===j)},[u]),C=g.useCallback(()=>{if(!v()||!i||d.current!==u)return Promise.resolve({status:"idle"});const j=f.current,E=p.current.catch(()=>{}).then(async()=>{if(!v()||f.current!==j||d.current!==u)return{status:"idle"};try{S("saving");const B=await c.current.retry(a,i);return Y(j,B.result,B.content)}catch(B){if(B instanceof it||!v()||f.current!==j)return{status:"idle"};const H=c.current.pending?"uncertain":"error";return S(H),{status:H}}});return p.current=E.then(()=>{}),E},[v,i,a,Y,S,u]),O=g.useCallback(j=>{var $;if(!N||!k||!v())return Promise.resolve({status:"idle"});const E=k.currentHash,B=(($=f.current.finalToken)==null?void 0:$.content)===j?f.current.finalToken:void 0,H=p.current.catch(()=>{}).then(async()=>{if(!v()||i&&!i.current())return{status:"idle"};if(c.current.pending)return S("uncertain"),{status:"uncertain"};if(!D())return S("error"),{status:"error"};f.current.finalToken===B&&(f.current.finalToken=void 0),S("saving");try{return await L(j,{expectedHash:E})}catch(ae){if(ae instanceof it)return{status:"idle"};if(!v()||i&&!i.current())return{status:"idle"};const Ce=c.current.pending?"uncertain":"error";return S(Ce),{status:Ce}}});return p.current=H.then(()=>{}),H},[N,k,L,v,S,i,D]),R=g.useCallback(()=>{var j;return((j=f.current)==null?void 0:j.identity)===u?{hash:f.current.baseHash,content:f.current.baseContent}:{hash:null,content:t}},[u,t]),W=g.useCallback(()=>{if(!k||!v()||i&&!i.current())return null;f.current.finalToken=void 0;const j=k.currentContent;return f.current.baseHash=k.currentHash,f.current.baseContent=j,_(null),S("idle"),j},[k,v,_,S,i]);return{recovery:X,status:y,conflict:k,canSave:N,save:Z,overwrite:O,adoptDisk:W,getConfirmedBase:R,prepareFinalSave:Q,retryUnconfirmed:C,waitForCloseDrain:P,documentReceipt:h.owner===u?h.documentReceipt:void 0,confirmedContent:h.owner===u?h.confirmedContent:void 0}}const yo=g.lazy(()=>ze(()=>import("./BlintzCanvas-DUDSNxlM.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas}))),Co=500;function So(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";default:return null}}function ko({content:e,documentId:r,onContentChange:t}){const[n,i]=g.useState(!1),[o,a]=g.useState(e.content),s=ee(C=>C.canvasSessionId),l=ee(C=>C.setDocumentEditing),c=ee(C=>{var O;return((O=C.openDocuments.find(R=>R.id===r))==null?void 0:O.editing)??!1}),u=ee(C=>C.selectedCwd),d=n&&c,f=wo({documentId:r,sourcePath:e.sourcePath,cwd:u,loadedContent:e.content}),p=f.canSave,v=g.useRef(null),h=g.useRef(null),b=g.useRef(o),y=g.useRef(e),k=g.useRef(t),S=g.useRef(f.save),_=g.useRef(f.prepareFinalSave),D=g.useRef(null);g.useEffect(()=>{b.current=o,y.current=e,k.current=t,S.current=f.save,_.current=f.prepareFinalSave});const X=g.useCallback(C=>{ee.getState().canvasSessionId===v.current&&(k.current({...y.current,content:C}),S.current(C))},[]),N=g.useCallback(C=>{var O;a(C),b.current=C,(O=D.current)==null||O.cancel(),D.current=_.current(C),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,X(C)},Co)},[X]),Y=()=>{v.current=ee.getState().canvasSessionId,a(e.content),i(!0),l(r,!0)},L=()=>{h.current&&(clearTimeout(h.current),h.current=null,X(b.current)),i(!1),l(r,!1)};g.useEffect(()=>{var C;d&&s!==v.current&&(h.current&&(clearTimeout(h.current),h.current=null),(C=D.current)==null||C.cancel(),D.current=null,i(!1),l(r,!1))},[s,d,r,l]),g.useEffect(()=>{var C;!n||d||(h.current&&clearTimeout(h.current),h.current=null,(C=D.current)==null||C.cancel(),D.current=null)},[d,n]),g.useEffect(()=>()=>{var C,O;h.current&&(clearTimeout(h.current),h.current=null,ee.getState().canvasSessionId===v.current&&k.current({...y.current,content:b.current})),ee.getState().canvasSessionId===v.current?(C=D.current)==null||C.flush():(O=D.current)==null||O.cancel(),D.current=null,l(r,!1)},[X,r,l]);const Z=()=>{const C=f.adoptDisk();C!=null&&(t({...e,content:C}),a(C))},Q=()=>{f.overwrite(b.current)},P=So(f.status);return m.jsxs("div",{className:"relative flex h-full flex-col",children:[m.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[p&&P&&m.jsx("span",{className:"text-muted-foreground mt-3 text-xs","aria-live":"polite",children:P}),p&&m.jsx(kt,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:d?L:Y,"aria-label":d?"Finish editing":"Edit document",children:d?m.jsx(en,{className:"size-4"}):m.jsx(tn,{className:"size-4"})})]}),f.status==="conflict"&&m.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:[m.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),m.jsx(kt,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:Z,children:"Reload"}),m.jsx(kt,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:Q,children:"Overwrite"})]}),m.jsx("div",{className:"flex-1 px-2 pb-6",children:m.jsx(g.Suspense,{fallback:m.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:m.jsx(yo,{value:d?o:e.content,editable:d,onChange:d?N:void 0})})})]})}function Po({content:e}){return m.jsx("div",{className:"p-4 font-mono text-sm",children:m.jsx(un,{value:e.data,depth:0})})}const Eo=20;function un({value:e,depth:r,keyName:t}){const[n,i]=g.useState(r>2),o=g.useCallback(()=>i(u=>!u),[]);if(r>=Eo)return m.jsx(Ie,{keyName:t,value:"[max depth]",className:"text-muted-foreground"});if(e===null)return m.jsx(Ie,{keyName:t,value:"null",className:"text-muted-foreground"});if(typeof e=="boolean")return m.jsx(Ie,{keyName:t,value:String(e),className:"text-blue-500"});if(typeof e=="number")return m.jsx(Ie,{keyName:t,value:String(e),className:"text-green-500"});if(typeof e=="string")return m.jsx(Ie,{keyName:t,value:`"${e}"`,className:"text-amber-500"});const a=Array.isArray(e),s=a?e.map((u,d)=>[String(d),u]):Object.entries(e),l=a?"[":"{",c=a?"]":"}";return m.jsxs("div",{style:{paddingLeft:r>0?16:0},children:[m.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:[m.jsx(gi,{className:ur("size-3 transition-transform",!n&&"rotate-90")}),t!=null&&m.jsxs("span",{className:"text-foreground",children:[t,": "]}),m.jsxs("span",{className:"text-muted-foreground",children:[l,n&&` … ${s.length} items `,n&&c]})]}),!n&&m.jsxs(m.Fragment,{children:[s.map(([u,d])=>m.jsx(un,{keyName:a?void 0:u,value:d,depth:r+1},u)),m.jsx("div",{className:"text-muted-foreground",children:c})]})]})}function Ie({keyName:e,value:r,className:t}){return m.jsxs("div",{style:{paddingLeft:16},children:[e!=null&&m.jsxs("span",{className:"text-foreground",children:[e,": "]}),m.jsx("span",{className:t,children:r})]})}var Ee=function(e,r){return Number(e.toFixed(r))},To=function(e,r){return typeof e=="number"?e:r},U=function(e,r,t){t&&typeof t=="function"&&t(e,r)},_o=function(e){return-Math.cos(e*Math.PI)/2+.5},jo=function(e){return e},Ao=function(e){return e*e},Oo=function(e){return e*(2-e)},Ro=function(e){return e<.5?2*e*e:-1+(4-2*e)*e},xo=function(e){return e*e*e},zo=function(e){return--e*e*e+1},Do=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1},No=function(e){return e*e*e*e},Mo=function(e){return 1- --e*e*e*e},Yo=function(e){return e<.5?8*e*e*e*e:1-8*--e*e*e*e},Xo=function(e){return e*e*e*e*e},Wo=function(e){return 1+--e*e*e*e*e},Lo=function(e){return e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e},cn={easeOut:_o,linear:jo,easeInQuad:Ao,easeOutQuad:Oo,easeInOutQuad:Ro,easeInCubic:xo,easeOutCubic:zo,easeInOutCubic:Do,easeInQuart:No,easeOutQuart:Mo,easeInOutQuart:Yo,easeInQuint:Xo,easeOutQuint:Wo,easeInOutQuint:Lo},Fo=function(e){var r=e.animationResolve;e.animationResolve=null,r==null||r()},de=function(e){e.animationFrame!==null&&cancelAnimationFrame(e.animationFrame),e.animationFrame=null,e.isAnimating=!1,e.animation=null,e.velocity=null,Fo(e)};function dn(e,r,t,n,i){if(!e.mounted){i==null||i();return}var o=new Date().getTime(),a=1;de(e);var s=function(){if(!(!e.mounted||e.animation!==s)){var l=new Date().getTime()-o,c=l/t,u=cn[r],d=u(c);if(l>=t){e.animation=null,e.animationFrame=null;var f=e.animationResolve;e.animationResolve=null,n(a),f==null||f(),e.flushResizeAlignment()}else n(d),e.animationFrame=requestAnimationFrame(s)}};e.animation=s,e.animationResolve=i??null,e.animationFrame=requestAnimationFrame(s)}function Bo(e){var r=e.scale,t=e.positionX,n=e.positionY;return!(Number.isNaN(r)||Number.isNaN(t)||Number.isNaN(n))}function De(e,r,t,n){var i=Bo(r);if(!e.mounted||!i)return Promise.resolve();var o=e.setState,a=e.state,s=a.scale,l=a.positionX,c=a.positionY,u=r.scale-s,d=r.positionX-l,f=r.positionY-c;return t===0?(o(r.scale,r.positionX,r.positionY),Promise.resolve()):new Promise(function(p){dn(e,n,t,function(v){v!==1?e.isAnimating=!0:e.isAnimating=!1;var h=s+u*v,b=l+d*v,y=c+f*v;o(h,b,y)},p)})}function qo(e,r,t){var n=e.clientWidth,i=e.clientHeight,o=r.offsetWidth,a=r.offsetHeight,s=o*t,l=a*t,c=n-s,u=i-l;return{wrapperWidth:n,wrapperHeight:i,newContentWidth:s,newDiffWidth:c,newContentHeight:l,newDiffHeight:u}}var Ho=function(e,r,t,n,i,o,a){var s=e>r?t*(a?.5:1):0,l=n>i?o*(a?.5:1):0,c=e-r-s,u=s,d=n-i-l,f=l;return{minPositionX:c,maxPositionX:u,minPositionY:d,maxPositionY:f,scaleWidthFactor:s,scaleHeightFactor:l}},dr=function(e,r){var t=e.wrapperComponent,n=e.contentComponent,i=e.setup,o=i.centerZoomedOut,a=i.disablePadding;if(!t||!n)throw new Error("Components are not mounted");var s=qo(t,n,r),l=s.wrapperWidth,c=s.wrapperHeight,u=s.newContentWidth,d=s.newContentHeight,f=s.newDiffWidth,p=s.newDiffHeight,v=Ho(l,u,f,c,d,p,!!o),h=l>=u&&c>=d;a&&h&&!o&&(v.minPositionX=0,v.maxPositionX=0,v.minPositionY=0,v.maxPositionY=0);var b=e.setup,y=b.minPositionX,k=b.maxPositionX,S=b.minPositionY,_=b.maxPositionY;return y!=null&&(v.minPositionX=l*(1-r)+y*r),k!=null&&(v.maxPositionX=k*r),S!=null&&(v.minPositionY=c*(1-r)+S*r),_!=null&&(v.maxPositionY=_*r),v},ut=function(e,r,t,n){return n?e<r?Ee(r,2):e>t?Ee(t,2):Ee(e,2):Ee(e,2)},fe=function(e,r){var t=dr(e,r);return e.bounds=t,t};function Fe(e,r,t,n,i,o,a){var s=t.minPositionX,l=t.minPositionY,c=t.maxPositionX,u=t.maxPositionY,d=0,f=0;a&&(d=i,f=o);var p=ut(e,s-d,c+d,n),v=ut(r,l-f,u+f,n);return{x:p,y:v}}function zt(e,r,t,n,i,o){var a=e.state,s=a.scale,l=a.positionX,c=a.positionY,u=n-s;if(!Number.isFinite(r)||!Number.isFinite(t))return console.error("Mouse X and Y position were not provided!"),{x:l,y:c};var d=l-r*u,f=c-t*u,p=Fe(d,f,i,o,0,0,null);return p}var Yr=1e-7;function Ze(e,r,t,n,i){var o=i?n:0,a=Math.max(r-o,Yr),s=t+o;return!Number.isNaN(t)&&e>=s?s:!Number.isNaN(r)&&e<=a?a:Math.max(e,Yr)}var Xr=function(e,r){var t=e.setup.panning.excluded,n=e.isInitialized,i=e.wrapperComponent,o=r.target,a=function(u){return!!u&&typeof u=="object"&&u.nodeType===1&&typeof u.contains=="function"},s=typeof r.composedPath=="function"?r.composedPath().some(function(u){return a(u)&&!!(i!=null&&i.contains(u))}):!!(i!=null&&i.contains(o)),l=n&&o&&s;if(!l)return!1;var c=Ve(o,t);return!(c||ka(o)||hr(o))},Wr=function(e){var r=e.isInitialized,t=e.isPanning,n=e.setup,i=n.panning.disabled,o=r&&t&&!i;return!!o},Uo=function(e,r){var t=e.state,n=t.positionX,i=t.positionY;e.isPanning=!0;var o=r.clientX,a=r.clientY;e.startCoords={x:o-n,y:a-i}},Zo=function(e,r){var t=r.touches,n=e.state,i=n.positionX,o=n.positionY;e.isPanning=!0;var a=t.length===1;if(a){var s=t[0].clientX,l=t[0].clientY;e.startCoords={x:s-i,y:l-o}}};function Vo(e){var r=e.state,t=r.positionX,n=r.positionY,i=r.scale,o=e.setup,a=o.disabled,s=o.limitToBounds,l=o.centerZoomedOut,c=e.wrapperComponent;if(!(a||!c||!e.bounds)){var u=e.bounds,d=u.maxPositionX,f=u.minPositionX,p=u.maxPositionY,v=u.minPositionY,h=t>d||t<f,b=n>p||n<v,y=t>d?c.clientWidth:e.setup.minPositionX||0,k=n>p?c.clientHeight:e.setup.minPositionY||0,S=zt(e,y,k,i,e.bounds,s||l),_=S.x,D=S.y;return{scale:i,positionX:h?_:t,positionY:b?D:n}}}function fn(e,r,t,n,i){var o=e.setup.limitToBounds,a=e.wrapperComponent,s=e.bounds,l=e.state,c=l.scale,u=l.positionX,d=l.positionY;if(!(a===null||s===null||r===u&&t===d)){var f=Fe(r,t,s,o,n,i,a),p=f.x,v=f.y;e.setState(c,p,v)}}var Go=function(e,r,t){var n=e.startCoords,i=e.state,o=e.setup.panning,a=o.lockAxisX,s=o.lockAxisY,l=i.positionX,c=i.positionY;if(!n)return{x:l,y:c};var u=r-n.x,d=t-n.y,f=a?l:u,p=s?c:d;return{x:f,y:p}},Re=function(e,r,t){var n=e.setup,i=e.state,o=n.minScale,a=n.disablePadding,s=n.centerZoomedOut,l=t??i.scale;return r>0&&l>=o&&!a&&!s?r:0},Oe;(function(e){e.TRACK_PAD="track_pad",e.MOUSE="mouse",e.TOUCH="touch"})(Oe||(Oe={}));var $o=function(e){var r=e.mounted,t=e.wrapperComponent,n=e.contentComponent,i=e.setup,o=i.disabled,a=i.velocityAnimation,s=i.limitToBounds,l=e.state.scale,c=a.disabled;if(c||o||!r||!t||!n)return!1;if(!s)return!0;var u=t.clientWidth<n.offsetWidth*l||t.clientHeight<n.offsetHeight*l;return u},Jo=function(e){var r=e.mounted,t=e.velocity,n=e.bounds,i=e.setup,o=i.disabled,a=i.velocityAnimation,s=a.disabled,l=!s&&!o&&r;return!(!l||!t||!n)};function Qo(e,r){var t=e.setup.velocityAnimation,n=t.animationTime,i=t.maxAnimationTime,o=t.inertia;return Math.min(n*Math.max(1,Math.abs(r/o)),i)}function Lr(e,r,t,n,i,o,a,s,l,c){if(i){if(r>a&&t>a){var u=a+(e-a)*c;return u>l?l:u<a?a:u}if(r<o&&t<o){var u=o+(e-o)*c;return u<s?s:u>o?o:u}}return n?r:ut(e,o,a,i)}function Ko(e){var r=1,t=e.clientWidth/window.innerWidth;return Number.isNaN(t)?r:Math.min(r,t)}var Bt=function(e,r,t){var n=0,i=e*t;return Number.isNaN(i)?n:e<0?Math.max(i,-r):Math.min(i,r)};function Io(e,r,t){var n,i,o=$o(e);if(o){var a=e.lastMousePosition,s=e.velocityTime,l=e.setup,c=e.wrapperComponent,u=l.velocityAnimation,d=u.maxStrengthMouse,f=u.maxStrengthTouch,p=u.sensitivityTouch,v=u.sensitivityMouse,h=Date.now();if(a&&s&&c){var b=Ko(c),y=(n={},n[Oe.TOUCH]=p,n[Oe.MOUSE]=v,n)[t],k=(i={},i[Oe.TOUCH]=f,i[Oe.MOUSE]=d,i)[t],S=r.x-a.x,_=r.y-a.y,D=Bt(S/b,k,y),X=Bt(_/b,k,y),N=h-s,Y=S*S+_*_,L=Bt(Math.sqrt(Y)/N,k,y);e.velocity={velocityX:D,velocityY:X,total:L}}e.lastMousePosition=r,e.velocityTime=h}}function ea(e){var r=e.velocity,t=e.bounds,n=e.setup,i=e.wrapperComponent,o=Jo(e);if(!(!o||!r||!t||!i)){var a=r.velocityX,s=r.velocityY,l=r.total,c=t.maxPositionX,u=t.minPositionX,d=t.maxPositionY,f=t.minPositionY,p=n.limitToBounds,v=n.autoAlignment,h=n.zoomAnimation,b=n.panning,y=b.lockAxisY,k=b.lockAxisX,S=h.animationType,_=v.sizeX,D=v.sizeY,X=v.velocityAlignmentTime,N=X,Y=Qo(e,l),L=Math.max(Y,N),Z=Re(e,_),Q=Re(e,D),P=Z*i.clientWidth/100,C=Q*i.clientHeight/100,O=c+P,R=u-P,W=d+C,j=f-C,E=e.state,B=new Date().getTime();dn(e,S,L,function(H){var $=e.state,ae=$.scale,Ce=$.positionX,qe=$.positionY,He=new Date().getTime()-B,Ge=He/N,bt=cn[v.animationType],A=1-bt(Math.min(1,Ge)),w=1-H,x=Ce+a*w,T=qe+s*w,M=Lr(x,E.positionX,Ce,k,p,u,c,R,O,A),K=Lr(T,E.positionY,qe,y,p,f,d,j,W,A);if(Ce!==x||qe!==T){e.setState(ae,M,K);var V=e.props.onPanning;V&&V(q(e),{})}})}}function Fr(e,r){var t=e.state,n=t.scale,i=t.positionX,o=t.positionY;e.panStartPosition={x:i,y:o},de(e),fe(e,n),"touches"in r?Zo(e,r):Uo(e,r)}function pn(e,r){var t=e.state.scale,n=e.setup,i=n.minScale,o=n.autoAlignment,a=o.disabled,s=o.sizeX,l=o.sizeY,c=o.animationTime,u=o.animationType,d=a||t<i||!s&&!l;if(!d){e.isResizeAlignmentPending&&fe(e,t);var f=Vo(e);if(f){var p=e.state,v=p.positionX,h=p.positionY,b=f.positionX===v&&f.positionY===h;b||De(e,f,c,u)}}}function Br(e,r,t,n){var i=e.startCoords,o=e.setup,a=o.autoAlignment,s=a.sizeX,l=a.sizeY;if(i){var c=Go(e,r,t),u=c.x,d=c.y,f=Re(e,s),p=Re(e,l);Io(e,{x:u,y:d},n),fn(e,u,d,f,p)}}function ta(e,r){if(e.isPanning){var t=e.velocity,n=e.wrapperComponent,i=e.contentComponent;e.isPanning=!1;var o=e.state,a=o.positionX,s=o.positionY,l=o.scale,c=e.panStartPosition;if(e.panStartPosition=null,c){var u=a-c.x,d=s-c.y;if(u*u+d*d<=25)return}e.isAnimating=!1,e.animation=null,e.isResizeAlignmentPending&&fe(e,l);var f=(n==null?void 0:n.clientWidth)||0,p=(n==null?void 0:n.clientHeight)||0,v=((i==null?void 0:i.offsetWidth)||0)*l,h=((i==null?void 0:i.offsetHeight)||0)*l,b=!e.setup.limitToBounds||f<v||p<h,y=!r&&t&&t.total>.1&&b;y?ea(e):pn(e)}}function Dt(e,r,t,n){var i=e.setup,o=i.minScale,a=i.maxScale,s=i.limitToBounds,l=Ze(Ee(r,2),o,a,0,!1),c=fe(e,l),u=zt(e,t,n,l,c,s),d=u.x,f=u.y;return{scale:l,positionX:d,positionY:f}}function fr(e,r,t){var n=e.state.scale,i=e.wrapperComponent,o=e.setup,a=o.minScale,s=o.maxScale,l=o.limitToBounds,c=o.zoomAnimation,u=c.disabled,d=c.animationTime,f=c.animationType,p=n>=a&&n<=s,v=u||p;if((n>=1||l)&&pn(e),!(v||!i||!e.mounted)){var h=r||i.clientWidth/2,b=t||i.clientHeight/2,y=n<a?a:s,k=Dt(e,y,h,b);k&&De(e,k,d,f)}}var pe=function(){return pe=Object.assign||function(r){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])}return r},pe.apply(this,arguments)};function qr(e,r,t){for(var n=0,i=r.length,o;n<i;n++)(o||!(n in r))&&(o||(o=Array.prototype.slice.call(r,0,n)),o[n]=r[n]);return e.concat(o||Array.prototype.slice.call(r))}var qt={scale:1,positionX:0,positionY:0},We={disabled:!1,minPositionX:null,maxPositionX:null,minPositionY:null,maxPositionY:null,minScale:1,maxScale:8,limitToBounds:!0,centerZoomedOut:!1,centerOnInit:!1,fitOnInit:!1,disablePadding:!1,smooth:!0,detached:!1,wheel:{step:.015,disabled:!1,wheelDisabled:!1,touchPadDisabled:!1,activationKeys:[],excluded:[]},trackPadPanning:{disabled:!0,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,activationKeys:[],excluded:[]},panning:{disabled:!1,velocityDisabled:!1,lockAxisX:!1,lockAxisY:!1,allowLeftClickPan:!0,allowMiddleClickPan:!0,allowRightClickPan:!0,activationKeys:[],excluded:[]},pinch:{step:5,disabled:!1,allowPanning:!0,excluded:[]},keyboard:{disabled:!0,panStep:50,zoomStep:.25,animationTime:100,animationType:"easeOut",excluded:[]},doubleClick:{disabled:!1,step:.7,mode:"zoomIn",animationType:"easeOut",animationTime:200,excluded:[]},zoomAnimation:{disabled:!1,size:.4,animationTime:200,animationType:"easeOut"},autoAlignment:{disabled:!1,sizeX:100,sizeY:100,animationTime:200,velocityAlignmentTime:400,animationType:"easeOut"},velocityAnimation:{disabled:!1,sensitivityMouse:1,sensitivityTouch:1.2,maxStrengthMouse:20,maxStrengthTouch:40,inertia:1,animationTime:300,maxAnimationTime:800,animationType:"easeOut"}},Jt={wrapperClass:"react-transform-wrapper",contentClass:"react-transform-component"},hn=function(e){var r,t,n,i,o,a,s,l,c,u=Math.max((r=e.minScale)!==null&&r!==void 0?r:We.minScale,1e-7),d=(t=e.maxScale)!==null&&t!==void 0?t:We.maxScale,f=(n=e.initialScale)!==null&&n!==void 0?n:qt.scale,p=Math.min(Math.max(f,u),d),v=ut((i=e.initialPositionX)!==null&&i!==void 0?i:qt.positionX,(o=e.minPositionX)!==null&&o!==void 0?o:-1/0,(a=e.maxPositionX)!==null&&a!==void 0?a:1/0,e.minPositionX!=null||e.maxPositionX!=null),h=ut((s=e.initialPositionY)!==null&&s!==void 0?s:qt.positionY,(l=e.minPositionY)!==null&&l!==void 0?l:-1/0,(c=e.maxPositionY)!==null&&c!==void 0?c:1/0,e.minPositionY!=null||e.maxPositionY!=null);return{previousScale:p,scale:p,positionX:v,positionY:h}},Hr=function(e){var r=pe({},We);return Object.keys(e).forEach(function(t){var n=t,i=typeof e[n]<"u",o=typeof We[n]<"u";if(o&&i){var a=Object.prototype.toString.call(We[n]),s=a==="[object Object]",l=a==="[object Array]";s?r[n]=pe(pe({},We[n]),e[n]):l?r[n]=qr(qr([],We[n],!0),e[n]):r[n]=e[n]}}),r.minScale<=0&&(r.minScale=1e-7),r},vn=function(e,r,t){var n=e.state.scale,i=e.wrapperComponent,o=e.setup,a=o.maxScale,s=o.minScale,l=o.zoomAnimation,c=l.size;if(!i)throw new Error("Wrapper is not mounted");var u=n+r*t,d=Ze(Ee(u,3),s,a,c,!1);return d};function ct(e,r,t,n){var i,o,a=e.wrapperComponent,s=e.props,l=s.onZoomStart,c=s.onZoom,u=s.onZoomStop,d=new MouseEvent("mousemove",{bubbles:!0}),f=q(e);U(f,d,l),U(f,d,c);var p=De(e,r,t,n),v=(o=(i=a==null?void 0:a.ownerDocument)===null||i===void 0?void 0:i.defaultView)!==null&&o!==void 0?o:typeof window<"u"?window:null;return v&&v.setTimeout(function(){e.mounted&&U(q(e),d,u)},t),p}function mn(e,r,t,n,i){var o=e.wrapperComponent,a=e.state,s=a.scale,l=a.positionX,c=a.positionY,u=e.setup.zoomAnimation;if(!o)return console.error("No WrapperComponent found"),Promise.resolve();var d=u.disabled?0:n,f=o.clientWidth,p=o.clientHeight,v=(f/2-l)/s,h=(p/2-c)/s,b=vn(e,r,t),y=Dt(e,b,v,h);return y?ct(e,y,d,i):(console.error("Error during zoom event. New transformation state was not calculated."),Promise.resolve())}function ra(e,r,t,n){var i,o,a=e.wrapperComponent,s=e.props,l=s.onPanningStart,c=s.onPanning,u=s.onPanningStop,d=new MouseEvent("mousemove",{bubbles:!0}),f=q(e);U(f,d,l),U(f,d,c);var p=De(e,r,t,n),v=(o=(i=a==null?void 0:a.ownerDocument)===null||i===void 0?void 0:i.defaultView)!==null&&o!==void 0?o:typeof window<"u"?window:null;return v&&v.setTimeout(function(){e.mounted&&U(q(e),d,u)},t),p}function pr(e,r,t,n){r===void 0&&(r="contain");var i=e.wrapperComponent,o=e.contentComponent,a=e.setup;if(!i||!o)return null;var s=o.offsetWidth,l=o.offsetHeight,c=i.clientWidth,u=i.clientHeight;if(!s||!l||!c||!u)return null;var d=c/s,f=u/l,p=r==="cover"?Math.max(d,f):Math.min(d,f);return n!==void 0&&(p=Math.min(p,n)),t!==void 0&&(p=Math.max(p,t)),p=Ze(p,a.minScale,a.maxScale,0,!1),Nt(p,i,o)}function gn(e,r,t,n){var i=e.setup,o=e.wrapperComponent,a=e.contentComponent,s=i.limitToBounds,l=i.centerOnInit,c=i.fitOnInit,u=hn(e.props),d=e.state,f=d.scale,p=d.positionX,v=d.positionY;if(!o)return Promise.resolve();if(c){var h=pr(e,c==="cover"?"cover":"contain");if(h)return f===h.scale&&p===h.positionX&&v===h.positionY?Promise.resolve():(n==null||n(),ct(e,h,r,t))}var b=u.positionX,y=u.positionY;if(l&&a){var k=Nt(u.scale,o,a);b=k.positionX,y=k.positionY}var S=dr(e,u.scale),_=Fe(b,y,S,s,0,0,o),D={scale:u.scale,positionX:_.x,positionY:_.y};return f===u.scale&&p===u.positionX&&v===u.positionY?Promise.resolve():(n==null||n(),ct(e,D,r,t))}var bn=function(e){if("getBoundingClientRect"in e){var r=e.getBoundingClientRect();return{x:r.left,y:r.top,width:r.width,height:r.height}}return e};function na(e){var r=e.map(bn),t=Math.min.apply(Math,r.map(function(a){return a.x})),n=Math.min.apply(Math,r.map(function(a){return a.y})),i=Math.max.apply(Math,r.map(function(a){return a.x+a.width})),o=Math.max.apply(Math,r.map(function(a){return a.y+a.height}));return{x:t,y:n,width:i-t,height:o-n}}function ia(e,r,t,n){var i=bn(e),o=r.getBoundingClientRect(),a=t.getBoundingClientRect(),s=o.x*n.scale,l=o.y*n.scale;return{x:(i.x-a.x+s)/n.scale,y:(i.y-a.y+l)/n.scale}}function oa(e,r,t,n,i,o,a){n===void 0&&(n=0),i===void 0&&(i=0);var s=e.wrapperComponent,l=e.contentComponent,c=e.state,u=e.setup,d=u.limitToBounds,f=u.minScale,p=u.maxScale;if(!s||!l)return c;var v=s.getBoundingClientRect(),h=ia(r,s,l,c),b=h.x,y=h.y,k=r.width/c.scale,S=r.height/c.scale,_=s.clientWidth/k,D=s.clientHeight/S,X=t||Math.min(_,D);a!==void 0&&(X=Math.min(X,a)),o!==void 0&&(X=Math.max(X,o));var N=Ze(X,f,p,0,!1),Y=(v.width-k*N)/2,L=(v.height-S*N)/2,Z=(v.left-b)*N+Y+n,Q=(v.top-y)*N+L+i,P=dr(e,N),C=Fe(Z,Q,P,d,0,0,s),O=C.x,R=C.y;return{positionX:O,positionY:R,scale:N}}function wn(e,r,t){var n=e.wrapperComponent,i=e.state;if(!n)return{x:0,y:0};var o=n.getBoundingClientRect();return{x:(r-o.left-i.positionX)/i.scale,y:(t-o.top-i.positionY)/i.scale}}function aa(e,r,t){var n=e.wrapperComponent,i=e.state;if(!n)return{x:0,y:0};var o=n.getBoundingClientRect();return{x:o.left+i.positionX+r*i.scale,y:o.top+i.positionY+t*i.scale}}var sa=function(e){return function(r,t,n){return r===void 0&&(r=.5),t===void 0&&(t=300),n===void 0&&(n="easeOut"),mn(e,1,r,t,n)}},la=function(e){return function(r,t,n){return r===void 0&&(r=.5),t===void 0&&(t=300),n===void 0&&(n="easeOut"),mn(e,-1,r,t,n)}},ua=function(e){return function(r,t,n,i,o){i===void 0&&(i=300),o===void 0&&(o="easeOut");var a=e.state,s=a.positionX,l=a.positionY,c=a.scale,u=e.wrapperComponent,d=e.contentComponent,f=e.setup.disabled;if(f||!u||!d)return Promise.resolve();var p={positionX:Number.isNaN(r)?s:r,positionY:Number.isNaN(t)?l:t,scale:Number.isNaN(n)?c:n};return De(e,p,i,o)}},ca=function(e){return function(r,t){return r===void 0&&(r=200),t===void 0&&(t="easeOut"),gn(e,r,t)}},da=function(e){return function(r,t,n){t===void 0&&(t=200),n===void 0&&(n="easeOut");var i=e.state,o=e.wrapperComponent,a=e.contentComponent;if(o&&a){var s=Nt(r||i.scale,o,a);return De(e,s,t,n)}return Promise.resolve()}},fa=function(e){return function(r,t,n,i,o){i===void 0&&(i=300),o===void 0&&(o="easeOut");var a=e.wrapperComponent,s=e.contentComponent,l=e.setup;if(l.disabled||!a||!s)return Promise.resolve();var c=wn(e,t,n),u=Dt(e,r,c.x,c.y);if(!u)return Promise.resolve();var d=l.zoomAnimation.disabled?0:i;return ct(e,u,d,o)}},pa=function(e){return function(r,t){return wn(e,r,t)}},ha=function(e){return function(r,t){return aa(e,r,t)}},va=function(e,r){var t,n=e.wrapperComponent;if(!n)return[];var i=n.getRootNode(),o=i&&"getElementById"in i?i:(t=n.ownerDocument)!==null&&t!==void 0?t:typeof document<"u"?document:null,a=Array.isArray(r)?r:[r];return a.map(function(s){return typeof s=="string"?o==null?void 0:o.getElementById(s):s}).filter(function(s){return!!s&&n.contains(s)})},ma=function(e){return function(r,t,n,i,o,a){var s,l,c,u;n===void 0&&(n=600),i===void 0&&(i="easeOut"),o===void 0&&(o=0),a===void 0&&(a=0),de(e);var d=typeof t=="object"&&t!==null?t:{scale:t},f=va(e,r);if(!e.wrapperComponent||f.length===0)return Promise.resolve();var p=oa(e,na(f),d.scale,(s=d.offsetX)!==null&&s!==void 0?s:o,(l=d.offsetY)!==null&&l!==void 0?l:a,d.minScale,d.maxScale);return De(e,p,(c=d.animationTime)!==null&&c!==void 0?c:n,(u=d.animationType)!==null&&u!==void 0?u:i)}},ga=function(e){return function(r){var t,n,i;r===void 0&&(r={});var o=e.wrapperComponent,a=e.contentComponent,s=e.setup;if(s.disabled||!o||!a)return Promise.resolve();var l=pr(e,(t=r.mode)!==null&&t!==void 0?t:"contain",r.minScale,r.maxScale);if(!l)return Promise.resolve();var c=s.zoomAnimation.disabled?0:(n=r.animationTime)!==null&&n!==void 0?n:200;return ct(e,l,c,(i=r.animationType)!==null&&i!==void 0?i:"easeOut")}},ba=function(e){return function(r,t,n,i){n===void 0&&(n=200),i===void 0&&(i="easeOut");var o=e.wrapperComponent,a=e.contentComponent,s=e.setup,l=e.state;if(s.disabled||!o||!a||!Number.isFinite(r)||!Number.isFinite(t))return Promise.resolve();var c=fe(e,l.scale),u=Fe(l.positionX+r,l.positionY+t,c,s.limitToBounds,0,0,o),d=u.x,f=u.y;return d===l.positionX&&f===l.positionY?Promise.resolve():ra(e,{scale:l.scale,positionX:d,positionY:f},n,i)}},dt=function(e){return{instance:e,state:e.state,zoomIn:sa(e),zoomOut:la(e),setTransform:ua(e),resetTransform:ca(e),centerView:da(e),zoomToElement:ma(e),zoomToPoint:fa(e),clientToContent:pa(e),contentToClient:ha(e),fitToView:ga(e),panBy:ba(e)}},wa=function(e){return{instance:e,state:e.state}},q=function(e){var r={};return Object.assign(r,wa(e)),Object.assign(r,dt(e)),r},Ht=!1;function yt(){try{var e={get passive(){return Ht=!0,!1}};return e}catch{return Ht=!1,Ht}}var Ct=".".concat(Jt.wrapperClass),Ve=function(e,r){return r.some(function(t){return e.matches("".concat(Ct," ").concat(t,", ").concat(Ct," .").concat(t,", ").concat(Ct," ").concat(t," *, ").concat(Ct," .").concat(t," *"))})},ya=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]),Ca='[contenteditable=""], [contenteditable="true"], [contenteditable="plaintext-only"]',Sa='[draggable="true"]',yn=function(e){return!e||typeof e.closest!="function"?null:e},hr=function(e){var r=yn(e);return r?ya.has(r.tagName)||r.isContentEditable?!0:r.closest(Ca)!==null:!1},ka=function(e){var r=yn(e);return r?r.closest(Sa)!==null:!1},ft=function(e){e&&clearTimeout(e)},Pa=function(e){return Number.parseFloat(e.toFixed(8))},Cn=function(e,r,t){var n=Pa(t);return"translate(".concat(e,"px, ").concat(r,"px) scale(").concat(n,")")},Nt=function(e,r,t){var n=t.offsetWidth*e,i=t.offsetHeight*e,o=(r.clientWidth-n)/2,a=(r.clientHeight-i)/2;return{scale:e,positionX:o,positionY:a}};function Ea(e,r){e!=null&&(typeof e=="function"?e(r):e.current=r)}function Ta(e){return function(r){e.forEach(function(t){typeof t=="function"?t(r):t!=null&&(t.current=r)})}}var vr=typeof window<"u"?g.useLayoutEffect:g.useEffect,_a={panLeft:["ArrowLeft"],panRight:["ArrowRight"],panUp:["ArrowUp"],panDown:["ArrowDown"],zoomIn:["+","="],zoomOut:["-","_"],reset:["0"]},ja=function(e){return Object.values(_a).some(function(r){return r.includes(e)})};function Aa(e,r){var t=e.setup,n=t.disabled,i=t.keyboard,o=t.panning;if(n||i.disabled||r.defaultPrevented||r.ctrlKey||r.metaKey||r.altKey||!ja(r.key))return!1;var a=r.target;if(hr(a)||a&&typeof a.matches=="function"&&Ve(a,i.excluded))return!1;var s=i.panStep,l=i.zoomStep,c=i.animationTime,u=i.animationType,d=dt(e),f=r.key,p=o.lockAxisX?0:s,v=o.lockAxisY?0:s;return f==="ArrowLeft"?d.panBy(p,0,c,u):f==="ArrowRight"?d.panBy(-p,0,c,u):f==="ArrowUp"?d.panBy(0,v,c,u):f==="ArrowDown"?d.panBy(0,-v,c,u):f==="+"||f==="="?d.zoomIn(l,c,u):f==="-"||f==="_"?d.zoomOut(l,c,u):f==="0"&&d.resetTransform(c,u),r.cancelable&&r.preventDefault(),r.stopPropagation(),!0}var Qt=function(e,r){return{wrapperWidth:e.offsetWidth,wrapperHeight:e.offsetHeight,contentWidth:r.offsetWidth,contentHeight:r.offsetHeight}},Oa=function(e,r){return!e||e.wrapperWidth!==r.wrapperWidth||e.wrapperHeight!==r.wrapperHeight||e.contentWidth!==r.contentWidth||e.contentHeight!==r.contentHeight},Sn=function(e){return e.isPanning||e.isPinching},Ra=function(e){return Sn(e)||e.wheelStopEventTimer!==null||e.wheelAnimationTimer!==null};function kn(e){var r=e.wrapperComponent,t=e.contentComponent,n=e.setup,i=e.state;if(!r||!t)return null;var o=fe(e,i.scale),a=n.limitToBounds,s=n.centerZoomedOut;if(!a&&!s)return null;var l=Fe(i.positionX,i.positionY,o,!0,0,0,r),c=l.x,u=l.y,d=c===Ee(i.positionX,2)&&u===Ee(i.positionY,2);return d?null:{scale:i.scale,positionX:c,positionY:u}}var Kt=function(e){e.animation=null,e.animationFrame=null,e.isAnimating=!1,e.resizeAnimation=null};function xa(e){var r=e.setup.autoAlignment.animationTime,t=Math.max(r/5,1);de(e);var n=Date.now(),i=function(){if(!(!e.mounted||e.animation!==i)){var o=Date.now(),a=Math.max(o-n,1);n=o;var s=kn(e);if(!s){Kt(e);return}var l=e.state,c=l.scale,u=l.positionX,d=l.positionY,f=1-Math.exp(-a/t),p=u+(s.positionX-u)*f,v=d+(s.positionY-d)*f,h=Math.abs(s.positionX-p)<.5&&Math.abs(s.positionY-v)<.5;if(h&&(p=s.positionX,v=s.positionY),e.isAnimating=!h,e.setState(c,p,v),h){Kt(e);return}e.animationFrame=requestAnimationFrame(i)}};e.animation=i,e.resizeAnimation=i,e.animationResolve=null,e.animationFrame=requestAnimationFrame(i)}function Pn(e){if(e.setup.disabled){fe(e,e.state.scale);return}if(Sn(e)){e.isResizeAlignmentPending=!0;return}var r=e.animation!==null&&e.animation===e.resizeAnimation;if(e.animation&&!r){var t=e.state.scale,n=e.setup,i=n.minScale,o=n.maxScale;if(t<i||t>o){e.isResizeAlignmentPending=!0;return}de(e)}var a=kn(e);if(!a){r&&Kt(e);return}if(!r){if(e.setup.autoAlignment.animationTime===0){e.setState(a.scale,a.positionX,a.positionY);return}xa(e)}}function za(e){var r=e.wrapperComponent,t=e.contentComponent;if(!(!r||!t)){var n=Qt(r,t);Oa(e.measuredSizes,n)&&(e.measuredSizes=n,Pn(e))}}var En=function(e,r){var t=e.setup.wheel,n=t.disabled,i=t.wheelDisabled,o=t.touchPadDisabled,a=t.excluded,s=e.isInitialized,l=e.isPanning,c=r.target,u=s&&!l&&!n&&c;if(!u||r.deltaY===0||i&&!r.ctrlKey||o&&r.ctrlKey)return!1;var d=Ve(c,a);if(d)return!1;var f=e.isPressingKeys(e.setup.wheel.activationKeys);return!!f},Da=function(e,r){var t=e.setup,n=t.disabled,i=t.trackPadPanning,o=i.activationKeys,a=i.excluded;if(!e.wrapperComponent||!e.contentComponent||n||i.disabled||r.ctrlKey)return!1;var s=En(e,r);if(s)return!1;var l=r.target,c=Ve(l,a);if(c)return!1;var u=e.isPressingKeys(o);return!!u},Na=function(e){return e?e.deltaY<0?1:-1:0};function Ma(e,r){var t=Na(e),n=To(r,t);return n}function Tn(e,r,t){var n=r.getBoundingClientRect(),i=0,o=0;if("clientX"in e)i=(e.clientX-n.left)/t,o=(e.clientY-n.top)/t;else{var a=e.touches[0];i=(a.clientX-n.left)/t,o=(a.clientY-n.top)/t}return Number.isNaN(i)||Number.isNaN(o)?(console.error("No mouse or touch offset found"),{x:0,y:0}):{x:i,y:o}}var Ya=function(e,r,t,n,i){var o=e.state.scale,a=e.wrapperComponent,s=e.setup,l=s.maxScale,c=s.minScale,u=s.zoomAnimation,d=s.disablePadding,f=u.size,p=u.disabled;if(!a)throw new Error("Wrapper is not mounted");var v=o+r*t,h=n?!1:!p,b=Ze(v,c,l,f,h&&!d);return b},_n=function(e,r){var t=e.previousWheelEvent,n=e.state.scale,i=e.setup,o=i.maxScale,a=i.minScale;return t?n<o||n>a||Math.sign(t.deltaY)!==Math.sign(r.deltaY)||t.deltaY>0&&t.deltaY<r.deltaY||t.deltaY<0&&t.deltaY>r.deltaY||Math.sign(t.deltaY)!==Math.sign(r.deltaY):!1},Xa=function(e,r){var t=e.setup.pinch,n=t.disabled,i=t.excluded,o=e.isInitialized,a=r.target,s=o&&!n&&a;if(!s)return!1;var l=Ve(a,i);return!l},Wa=function(e){var r=e.setup.pinch.disabled,t=e.isInitialized,n=e.pinchStartDistance,i=t&&!r&&n!==null;return!!i},La=function(e,r,t){var n=t.getBoundingClientRect(),i=e.touches,o=i[0].clientX-n.left,a=i[0].clientY-n.top,s=i[1].clientX-n.left,l=i[1].clientY-n.top;return{x:(o+s)/2/r,y:(a+l)/2/r}},jn=function(e){return Math.sqrt(Math.pow(e.touches[0].pageX-e.touches[1].pageX,2)+Math.pow(e.touches[0].pageY-e.touches[1].pageY,2))},Fa=5,Ba=function(e,r){var t=e.pinchStartScale,n=e.pinchStartDistance,i=e.setup,o=i.maxScale,a=i.minScale,s=i.zoomAnimation,l=i.disablePadding,c=i.pinch,u=s.size,d=s.disabled,f=c.step;if(!t||n===null)throw new Error("Pinch touches distance was not provided");if(r<0)return e.state.scale;var p=r/n,v=p*t,h=(v-t)*(f/Fa),b=t+h,y=b===1/0?0:Ee(b,10);return Ze(y,a,o,u,!d&&!l)},An=160,On=100,qa=function(e,r){var t=e.props,n=t.onWheelStart,i=t.onZoomStart;de(e),e.wheelStopEventTimer||(U(q(e),r,n),U(q(e),r,i))},Ha=function(e,r){var t=e.props,n=t.onWheel,i=t.onZoom,o=e.contentComponent,a=e.setup,s=e.state,l=s.scale,c=a.limitToBounds,u=a.centerZoomedOut,d=a.zoomAnimation,f=a.wheel,p=a.disablePadding,v=a.smooth,h=d.size,b=d.disabled,y=f.step;if(!o)throw new Error("Component not mounted");r.cancelable&&r.preventDefault(),r.stopPropagation();var k=Ma(r,null),S=v?y*Math.abs(r.deltaY):y,_=Ya(e,k,S,!r.ctrlKey);if(l!==_){var D=fe(e,_),X=Tn(r,o,l),N=b||h===0||u||p,Y=c&&N,L=zt(e,X.x,X.y,_,D,Y),Z=L.x,Q=L.y;e.previousWheelEvent=r,e.setState(_,Z,Q),U(q(e),r,n),U(q(e),r,i)}},Ua=function(e,r){var t=e.props,n=t.onWheelStop,i=t.onZoomStop;ft(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(fr(e,r.x,r.y),e.wheelAnimationTimer=null,e.flushResizeAlignment())},On);var o=_n(e,r);o&&(ft(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,U(q(e),r,n),U(q(e),r,i),e.flushResizeAlignment())},An))},Za=function(e,r){var t=e.props,n=t.onWheelStart,i=t.onPanningStart;de(e),e.wheelStopEventTimer||(e.wheelAnimationTimer||fe(e,e.state.scale),U(q(e),r,n),U(q(e),r,i))},Va=function(e,r){var t=e.props,n=t.onWheelStop,i=t.onPanningStop;ft(e.wheelAnimationTimer),e.wheelAnimationTimer=setTimeout(function(){e.mounted&&(fr(e,r.x,r.y),e.wheelAnimationTimer=null,e.flushResizeAlignment())},On);var o=_n(e,r);o&&(ft(e.wheelStopEventTimer),e.wheelStopEventTimer=setTimeout(function(){e.mounted&&(e.wheelStopEventTimer=null,U(q(e),r,n),U(q(e),r,i),e.flushResizeAlignment())},An))},Rn=function(e){for(var r=0,t=0,n=0;n<2;n+=1)r+=e.touches[n].clientX,t+=e.touches[n].clientY;var i=r/2,o=t/2;return{x:i,y:o}},Ga=function(e,r){var t=jn(r);e.pinchStartDistance=t,e.lastDistance=t,e.pinchStartScale=e.state.scale,e.isPanning=!1,e.isPinching=!0,e.pinchPreviousCenter=Rn(r),de(e)},$a=function(e,r){var t=e.contentComponent,n=e.pinchStartDistance,i=e.wrapperComponent,o=e.pinchPreviousCenter,a=e.state.scale,s=e.setup,l=s.limitToBounds,c=s.centerZoomedOut,u=s.zoomAnimation,d=s.autoAlignment,f=s.pinch,p=s.panning,v=u.disabled,h=u.size,b=f.allowPanning;if(!(n===null||!t)){var y=La(r,a,t);if(!(!Number.isFinite(y.x)||!Number.isFinite(y.y))){var k=jn(r),S=Ba(e,k),_=Rn(r),D=a/S,X=(_.x-((o==null?void 0:o.x)||0))*D,N=(_.y-((o==null?void 0:o.y)||0))*D;if(!(S===a&&X===0&&N===0)){e.pinchPreviousCenter=_;var Y=fe(e,S),L=v||h===0||c,Z=l&&L,Q=zt(e,y.x,y.y,S,Y,Z),P=Q.x,C=Q.y;if(e.pinchMidpoint=y,e.lastDistance=k,p.disabled||!b)e.setState(S,P,C);else{var O=d.sizeX,R=d.sizeY,W=Re(e,O,S),j=Re(e,R,S),E=P+X,B=C+N,H=Fe(E,B,Y,l,W,j,i),$=H.x,ae=H.y;e.setState(S,$,ae)}}}}},Ja=function(e){var r=e.pinchMidpoint;e.velocity=null,e.lastDistance=null,e.pinchMidpoint=null,e.pinchStartScale=null,e.pinchStartDistance=null,e.isPinching=!1,fr(e,r==null?void 0:r.x,r==null?void 0:r.y)},xn=function(e,r){var t=e.props.onZoomStop,n=e.setup.doubleClick.animationTime;ft(e.doubleClickStopEventTimer),e.doubleClickStopEventTimer=setTimeout(function(){e.doubleClickStopEventTimer=null,e.mounted&&U(q(e),r,t)},n)},Qa=function(e,r){var t=e.props,n=t.onZoomStart,i=t.onZoom,o=e.setup.doubleClick,a=o.animationTime,s=o.animationType;U(q(e),r,n),gn(e,a,s,function(){return U(q(e),r,i)}),xn(e,r)};function Ka(e,r){return e==="toggle"?r===1?1:-1:e==="zoomOut"?-1:1}function Ia(e,r){var t=e.setup,n=e.doubleClickStopEventTimer,i=e.state,o=e.contentComponent,a=i.scale,s=e.props,l=s.onZoomStart,c=s.onZoom,u=t.doubleClick,d=u.disabled,f=u.mode,p=u.step,v=u.animationTime,h=u.animationType;if(!d&&!n){if(f==="reset")return Qa(e,r);if(!o)return console.error("No ContentComponent found");var b=Ka(f,e.state.scale),y=vn(e,b,p);if(a!==y){U(q(e),r,l);var k=Tn(r,o,a),S=Dt(e,y,k.x,k.y);if(!S)return console.error("Error during zoom event. New transformation state was not calculated.");U(q(e),r,c),De(e,S,v,h),xn(e,r)}}}var es=function(e,r){var t=e.isInitialized,n=e.setup,i=e.wrapperComponent,o=n.doubleClick,a=o.disabled,s=o.excluded,l=r.target,c=i==null?void 0:i.contains(l),u=t&&l&&c&&!a;if(!u)return!1;var d=Ve(l,s);return!(d||hr(l))},ts=(function(){function e(r){var t=this;this.mounted=!0,this.onChangeCallbacks=new Set,this.onInitCallbacks=new Set,this.onTransformCallbacks=new Set,this.wrapperComponent=null,this.contentComponent=null,this.isInitialized=!1,this.bounds=null,this.previousWheelEvent=null,this.wheelStopEventTimer=null,this.wheelAnimationTimer=null,this.isPanning=!1,this.isWheelPanning=!1,this.startCoords=null,this.panStartPosition=null,this.lastTouch=null,this.isPinching=!1,this.distance=null,this.lastDistance=null,this.pinchStartDistance=null,this.pinchStartScale=null,this.pinchMidpoint=null,this.pinchPreviousCenter=null,this.doubleClickStopEventTimer=null,this.velocity=null,this.velocityTime=null,this.lastMousePosition=null,this.isAnimating=!1,this.animation=null,this.animationFrame=null,this.animationResolve=null,this.initObserverTimer=null,this.isInitialLayoutPending=!1,this.measuredSizes=null,this.isResizeAlignmentPending=!1,this.resizeAnimation=null,this.pressedKeys={},this.selectionLock=null,this.mount=function(){t.mounted=!0,t.initializeWindowEvents()},this.unmount=function(){t.mounted=!1,t.cleanupWindowEvents()},this.update=function(n){t.props=n,t.setup=Hr(n),t.wrapperComponent&&t.contentComponent&&!Ra(t)&&fe(t,t.state.scale)},this.clearTimers=function(){t.wheelStopEventTimer&&clearTimeout(t.wheelStopEventTimer),t.wheelAnimationTimer&&clearTimeout(t.wheelAnimationTimer),t.doubleClickStopEventTimer&&clearTimeout(t.doubleClickStopEventTimer),t.initObserverTimer&&clearTimeout(t.initObserverTimer),t.wheelStopEventTimer=null,t.wheelAnimationTimer=null,t.doubleClickStopEventTimer=null,t.initObserverTimer=null},this.initializeWindowEvents=function(){var n,i,o,a,s=yt(),l=(n=t.wrapperComponent)===null||n===void 0?void 0:n.ownerDocument,c=l==null?void 0:l.defaultView;(i=t.wrapperComponent)===null||i===void 0||i.addEventListener("wheel",t.onWheelPanning,s),(o=t.wrapperComponent)===null||o===void 0||o.addEventListener("keyup",t.setKeyUnPressed,s),(a=t.wrapperComponent)===null||a===void 0||a.addEventListener("keydown",t.setKeyPressed,s),c==null||c.addEventListener("mousedown",t.onPanningStart,s),c==null||c.addEventListener("mousemove",t.onPanning,s),c==null||c.addEventListener("mouseup",t.onPanningStop,s),l==null||l.addEventListener("mouseleave",t.clearPanning,s),c==null||c.addEventListener("keyup",t.setKeyUnPressed,s),c==null||c.addEventListener("keydown",t.setKeyPressed,s),c==null||c.addEventListener("blur",t.handleWindowBlur)},this.cleanupWindowEvents=function(){var n,i,o,a,s,l=yt(),c=(n=t.wrapperComponent)===null||n===void 0?void 0:n.ownerDocument,u=c==null?void 0:c.defaultView;u==null||u.removeEventListener("mousedown",t.onPanningStart,l),u==null||u.removeEventListener("mousemove",t.onPanning,l),u==null||u.removeEventListener("mouseup",t.onPanningStop,l),c==null||c.removeEventListener("mouseleave",t.clearPanning,l),u==null||u.removeEventListener("keyup",t.setKeyUnPressed,l),u==null||u.removeEventListener("keydown",t.setKeyPressed,l),u==null||u.removeEventListener("blur",t.handleWindowBlur),(i=t.wrapperComponent)===null||i===void 0||i.removeEventListener("wheel",t.onWheelPanning,l),(o=t.wrapperComponent)===null||o===void 0||o.removeEventListener("keyup",t.setKeyUnPressed,l),(a=t.wrapperComponent)===null||a===void 0||a.removeEventListener("keydown",t.setKeyPressed,l),t.cleanupWrapperEvents(),t.clearTimers(),de(t),t.unlockTextSelection(),(s=t.observer)===null||s===void 0||s.disconnect(),t.observer=void 0,t.isInitialLayoutPending=!1,t.isResizeAlignmentPending=!1,t.resizeAnimation=null},this.cleanupWrapperEvents=function(){var n=t.wrapperComponent;if(n){var i=yt();n.removeEventListener("wheel",t.onWheelZoom,i),n.removeEventListener("dblclick",t.onDoubleClick,i),n.removeEventListener("keydown",t.onKeyboardNavigation,i),n.removeEventListener("touchstart",t.onTouchPanningStart,i),n.removeEventListener("touchmove",t.onTouchPanning,i),n.removeEventListener("touchend",t.onTouchPanningStop,i)}},this.handleInitializeWrapperEvents=function(n){var i=yt();n.addEventListener("wheel",t.onWheelZoom,i),n.addEventListener("dblclick",t.onDoubleClick,i),n.addEventListener("keydown",t.onKeyboardNavigation,i),n.addEventListener("touchstart",t.onTouchPanningStart,i),n.addEventListener("touchmove",t.onTouchPanning,i),n.addEventListener("touchend",t.onTouchPanningStop,i)},this.handleInitialize=function(){var n=t.setup,i=n.centerOnInit,o=n.fitOnInit;if(t.applyTransformation(),t.onInitCallbacks.forEach(function(s){return s(q(t))}),i||o){var a=t.applyInitialLayout();t.isInitialLayoutPending=!0,t.initObserverTimer&&clearTimeout(t.initObserverTimer),a&&(t.initObserverTimer=setTimeout(function(){t.initObserverTimer=null,t.isInitialLayoutPending=!1},5e3))}},this.observeSizes=function(n,i){var o;(o=t.observer)===null||o===void 0||o.disconnect(),t.observer=void 0,t.measuredSizes=Qt(n,i),!(typeof ResizeObserver>"u")&&(t.observer=new ResizeObserver(t.onSizeChange),t.observer.observe(n),t.observer.observe(i))},this.onSizeChange=function(){var n=t,i=n.wrapperComponent,o=n.contentComponent;if(!(!t.mounted||!i||!o)){if(t.isInitialLayoutPending){var a=(o.offsetWidth>0||o.offsetHeight>0)&&i.clientWidth>0&&i.clientHeight>0;if(!a)return;t.isInitialLayoutPending=!1,t.initObserverTimer&&clearTimeout(t.initObserverTimer),t.initObserverTimer=null,t.onInitCallbacks.forEach(function(s){return s(q(t))}),t.applyInitialLayout(),t.measuredSizes=Qt(i,o),fe(t,t.state.scale);return}za(t)}},this.flushResizeAlignment=function(){t.isResizeAlignmentPending&&(t.isResizeAlignmentPending=!1,Pn(t))},this.onWheelZoom=function(n){var i=t.setup.disabled;if(!i){t.syncModifierKeys(n);var o=En(t,n);o&&(qa(t,n),Ha(t,n),Ua(t,n))}},this.onWheelPanning=function(n){var i=t.props.onPanning,o=t.setup.trackPadPanning,a=o.lockAxisX,s=o.lockAxisY;t.syncModifierKeys(n);var l=Da(t,n);if(l){n.cancelable&&n.preventDefault(),n.stopPropagation();var c=t.state,u=c.positionX,d=c.positionY,f=u-n.deltaX,p=d-n.deltaY,v=a?u:f,h=s?d:p,b=t.setup.autoAlignment,y=b.sizeX,k=b.sizeY,S=Re(t,y),_=Re(t,k);v===u&&h===d||(Za(t,n),fn(t,v,h,S,_),U(q(t),n,i),Va(t,n))}},this.onPanningStart=function(n){var i=t.setup,o=i.disabled,a=i.panning,s=t.props.onPanningStart;if(!(o||a.disabled)){t.syncModifierKeys(n);var l=Xr(t,n);if(l){var c=t.isPressingKeys(t.setup.panning.activationKeys);c&&(n.button===0&&!t.setup.panning.allowLeftClickPan||n.button===1&&!t.setup.panning.allowMiddleClickPan||n.button===2&&!t.setup.panning.allowRightClickPan||(n.cancelable&&n.preventDefault(),n.stopPropagation(),de(t),Fr(t,n),t.lockTextSelection(),t.focusForKeyboard(),U(q(t),n,s)))}}},this.onPanning=function(n){var i=t.setup.disabled,o=t.props.onPanning;if(!i){if(t.syncModifierKeys(n),t.isPanning&&n.buttons===0){t.clearPanning(n);return}var a=Wr(t);if(a){var s=t.isPressingKeys(t.setup.panning.activationKeys);s&&(n.cancelable&&n.preventDefault(),n.stopPropagation(),Br(t,n.clientX,n.clientY,Oe.MOUSE),U(q(t),n,o))}}},this.onPanningStop=function(n){var i=t.setup.panning.velocityDisabled,o=t.props.onPanningStop;t.isPanning&&(t.unlockTextSelection(),ta(t,i),U(q(t),n,o),t.flushResizeAlignment())},this.onPinchStart=function(n){var i=t.setup.disabled,o=t.props.onPinchStart;if(!i){var a=Xa(t,n);a&&(Ga(t,n),de(t),U(q(t),n,o))}},this.onPinch=function(n){var i=t.setup.disabled,o=t.props.onPinch;if(!i){var a=Wa(t);a&&(n.cancelable&&n.preventDefault(),n.stopPropagation(),$a(t,n),U(q(t),n,o))}},this.onPinchStop=function(n){var i=t.props.onPinchStop;t.pinchStartScale&&(Ja(t),U(q(t),n,i),t.flushResizeAlignment())},this.onTouchPanningStart=function(n){var i=t.setup,o=i.disabled,a=i.doubleClick,s=t.props.onPanningStart;if(!o){var l=!(a!=null&&a.disabled),c=t.lastTouch&&+new Date-t.lastTouch<200;if(l&&c&&n.touches.length===1)t.lastTouch=null,t.onDoubleClick(n);else{t.lastTouch=+new Date,de(t);var u=n.touches,d=u.length===1,f=u.length===2,p=Xr(t,n);if(d){if(!p||t.setup.panning.disabled)return;de(t),Fr(t,n),t.lockTextSelection(),t.focusForKeyboard(),U(q(t),n,s)}f&&t.onPinchStart(n)}}},this.onTouchPanning=function(n){var i=t.setup.disabled,o=t.props.onPanning;if(t.isPanning&&n.touches.length===1){if(i)return;var a=Wr(t);if(!a)return;n.cancelable&&n.preventDefault(),n.stopPropagation();var s=n.touches[0];Br(t,s.clientX,s.clientY,Oe.TOUCH),U(q(t),n,o)}else n.touches.length>1&&t.onPinch(n)},this.onTouchPanningStop=function(n){t.onPanningStop(n),t.onPinchStop(n)},this.onDoubleClick=function(n){var i=t.setup.disabled;if(!i){var o=es(t,n);o&&Ia(t,n)}},this.clearPanning=function(n){t.isPanning&&t.onPanningStop(n)},this.handleWindowBlur=function(){t.pressedKeys={},t.isPanning&&(t.isPanning=!1,t.startCoords=null),t.unlockTextSelection(),t.flushResizeAlignment()},this.syncModifierKeys=function(n){var i=n.ctrlKey,o=n.metaKey,a=n.shiftKey,s=n.altKey;typeof i=="boolean"&&(t.pressedKeys.Control=i),typeof o=="boolean"&&(t.pressedKeys.Meta=o),typeof a=="boolean"&&(t.pressedKeys.Shift=a),typeof s=="boolean"&&(t.pressedKeys.Alt=s)},this.setKeyPressed=function(n){t.pressedKeys[n.key]=!0},this.setKeyUnPressed=function(n){t.pressedKeys[n.key]=!1},this.isPressingKeys=function(n){return typeof n=="function"?n(Object.entries(t.pressedKeys).filter(function(i){var o=i[1];return o}).map(function(i){var o=i[0];return o})):n.length?!!n.every(function(i){return t.pressedKeys[i]}):!0},this.onKeyboardNavigation=function(n){Aa(t,n)},this.focusForKeyboard=function(){var n,i=t.wrapperComponent;if(!(!i||t.setup.keyboard.disabled)){var o=(n=i.ownerDocument)===null||n===void 0?void 0:n.activeElement;o&&i.contains(o)||typeof i.focus=="function"&&i.focus({preventScroll:!0})}},this.lockTextSelection=function(){var n=t.wrapperComponent;!n||t.selectionLock||(t.selectionLock={userSelect:n.style.userSelect,webkitUserSelect:n.style.webkitUserSelect},n.style.userSelect="none",n.style.webkitUserSelect="none")},this.unlockTextSelection=function(){var n=t.selectionLock;t.selectionLock=null;var i=t.wrapperComponent;!i||!n||(i.style.userSelect=n.userSelect,i.style.webkitUserSelect=n.webkitUserSelect)},this.applyInitialLayout=function(){var n=t.setup.fitOnInit,i=t,o=i.wrapperComponent,a=i.contentComponent,s=!!o&&!!a&&o.clientWidth>0&&o.clientHeight>0&&(a.offsetWidth>0||a.offsetHeight>0);if(n){var l=pr(t,n==="cover"?"cover":"contain");if(l)return t.setState(l.scale,l.positionX,l.positionY),s}return t.setCenter(),s},this.setCenter=function(){if(t.wrapperComponent&&t.contentComponent){var n=Nt(t.state.scale,t.wrapperComponent,t.contentComponent);t.setState(n.scale,n.positionX,n.positionY)}},this.handleTransformStyles=function(n,i,o){return t.props.customTransform?t.props.customTransform(n,i,o):Cn(n,i,o)},this.getContext=function(){return q(t)},this.applyTransformation=function(){if(!(!t.mounted||!t.contentComponent)){var n=t.state,i=n.scale,o=n.positionX,a=n.positionY,s=t.handleTransformStyles(o,a,i);t.props.detached||(t.contentComponent.style.transform=s),t.onTransformCallbacks.forEach(function(l){return l({scale:i,positionX:o,positionY:a,previousScale:t.state.previousScale,ref:q(t)})})}},this.setState=function(n,i,o){var a=t.props.onTransform;if(!Number.isNaN(n)&&!Number.isNaN(i)&&!Number.isNaN(o)){var s=Math.max(n,1e-7);s!==t.state.scale&&(t.state.previousScale=t.state.scale,t.state.scale=s),t.state.positionX=i,t.state.positionY=o,t.applyTransformation();var l=q(t);t.onChangeCallbacks.forEach(function(c){return c(l)}),U(l,{scale:t.state.scale,positionX:i,positionY:o},a)}else console.error("Detected NaN set state values")},this.onTransform=function(n){return t.onTransformCallbacks.has(n)||t.onTransformCallbacks.add(n),function(){t.onTransformCallbacks.delete(n)}},this.onChange=function(n){return t.onChangeCallbacks.has(n)||t.onChangeCallbacks.add(n),function(){t.onChangeCallbacks.delete(n)}},this.onInit=function(n){return t.onInitCallbacks.has(n)||t.onInitCallbacks.add(n),function(){t.onInitCallbacks.delete(n)}},this.init=function(n,i){t.mounted=!0,t.cleanupWindowEvents(),t.wrapperComponent=n,t.contentComponent=i,fe(t,t.state.scale),t.handleInitializeWrapperEvents(n),t.handleInitialize(),t.observeSizes(n,i),t.initializeWindowEvents(),t.isInitialized=!0;var o=q(t);U(o,void 0,t.props.onInit),Ea(t.props.ref,o)},this.props=r,this.setup=Hr(this.props),this.state=hn(this.props)}return e})(),mt=xt.createContext(null),rs=function(e,r){return typeof e=="function"?e(r):e},ns=xt.forwardRef(function(e,r){var t=g.useRef(null);t.current===null&&(t.current=new ts(e));var n=t.current,i=rs(e.children,dt(n));return g.useImperativeHandle(r,function(){return dt(n)},[n]),g.useEffect(function(){return n.mount(),function(){n.unmount()}},[n]),g.useEffect(function(){n.update(e)},[n,e]),m.jsx(mt.Provider,pe({value:n},{children:i}))});xt.forwardRef(function(e,r){var t=g.useRef(null),n=g.useContext(mt);return vr(function(){var i=function(o){if(t.current){var a=0,s=0;t.current.style.transform=n.handleTransformStyles(a,s,1/o)}};return i(n.state.scale),n.onChange(function(o){i(o.instance.state.scale)})},[n]),m.jsx("div",pe({},e,{ref:Ta([t,r])}))});function is(e,r){r===void 0&&(r={});var t=r.insertAt;if(!(typeof document>"u")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var os=`.transform-component-module_wrapper__SPB86 {
25
+ position: relative;
26
+ width: -moz-fit-content;
27
+ width: fit-content;
28
+ height: -moz-fit-content;
29
+ height: fit-content;
30
+ overflow: hidden;
31
+ -webkit-touch-callout: none; /* iOS Safari */
32
+ /* Text stays selectable (#467); the instance applies an inline lock
33
+ only while a pan gesture is active. */
34
+ margin: 0;
35
+ padding: 0;
36
+ transform: translate3d(0, 0, 0);
37
+ }
38
+ .transform-component-module_content__FBWxo {
39
+ display: flex;
40
+ flex-wrap: wrap;
41
+ width: -moz-fit-content;
42
+ width: fit-content;
43
+ height: -moz-fit-content;
44
+ height: fit-content;
45
+ margin: 0;
46
+ padding: 0;
47
+ transform-origin: 0% 0%;
48
+ }
49
+ .transform-component-module_content__FBWxo img {
50
+ pointer-events: none;
51
+ }
52
+ .transform-component-module_infiniteGrid__Z-aP3 {
53
+ position: absolute;
54
+ inset: 0;
55
+ pointer-events: none;
56
+ background-image: radial-gradient(
57
+ circle,
58
+ rgba(0, 0, 0, 0.12) 1px,
59
+ transparent 1px
60
+ );
61
+ background-size: 20px 20px;
62
+ background-position: 0 0;
63
+ }
64
+ `,Ut={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo",infiniteGrid:"transform-component-module_infiniteGrid__Z-aP3"};is(os);var as=function(e){var r,t=e.children,n=e.wrapperClass,i=n===void 0?"":n,o=e.contentClass,a=o===void 0?"":o,s=e.wrapperStyle,l=e.contentStyle,c=e.wrapperProps,u=c===void 0?{}:c,d=e.contentProps,f=d===void 0?{}:d,p=e.infinite,v=p===void 0?!1:p,h=g.useContext(mt),b=h.init,y=h.cleanupWindowEvents,k=g.useRef(null),S=g.useRef(null),_=g.useRef(null);vr(function(){var X=k.current,N=S.current;return X!==null&&N!==null&&b&&(b==null||b(X,N)),function(){y==null||y()}},[]),g.useEffect(function(){if(v){var X=_.current;if(X){var N=function(){var Y=h.state,L=Y.positionX,Z=Y.positionY;X.style.backgroundPosition="".concat(L,"px ").concat(Z,"px")};return N(),h.onChange(N)}}},[v,h]);var D=!(!((r=h.setup.keyboard)===null||r===void 0)&&r.disabled);return m.jsxs("div",pe({tabIndex:D?0:void 0},u,{ref:k,className:"".concat(Jt.wrapperClass," ").concat(Ut.wrapper," ").concat(i),style:s},{children:[v&&m.jsx("div",{ref:_,className:Ut.infiniteGrid,"aria-hidden":!0}),m.jsx("div",pe({},f,{ref:S,className:"".concat(Jt.contentClass," ").concat(Ut.content," ").concat(a),style:pe(pe({transformOrigin:"0 0"},l),{transform:Cn(h.state.positionX,h.state.positionY,h.state.scale)})},{children:t}))]}))};function ss(e,r){var t=Math.max(0,Math.min(e.x+e.width,r.x+r.width)-Math.max(e.x,r.x)),n=Math.max(0,Math.min(e.y+e.height,r.y+r.height)-Math.max(e.y,r.y));return t*n}function ls(e){var r=e.elementX,t=e.elementY,n=e.elementWidth,i=e.elementHeight,o=e.scale,a=e.positionX,s=e.positionY,l=e.viewportWidth,c=e.viewportHeight,u=e.margin,d=u===void 0?0:u,f=e.threshold,p=f===void 0?0:f,v={x:-d,y:-d,width:l+2*d,height:c+2*d},h={x:r*o+a,y:t*o+s,width:n*o,height:i*o};if(p<=0){var b=h.x<v.x+v.width&&h.x+h.width>v.x,y=h.y<v.y+v.height&&h.y+h.height>v.y;return b&&y}var k=h.width*h.height;if(k<=0)return!1;var S=ss(v,h);return S/k>=p}xt.forwardRef(function(e,r){var t=e.x,n=e.y,i=e.width,o=e.height,a=e.margin,s=a===void 0?0:a,l=e.threshold,c=l===void 0?0:l,u=e.placeholder,d=u===void 0?null:u,f=e.onShow,p=e.onHide,v=e.children,h=e.className,b=e.style,y=g.useContext(mt),k=function(){var L=y.wrapperComponent;return L?ls({elementX:t,elementY:n,elementWidth:i,elementHeight:o,scale:y.state.scale,positionX:y.state.positionX,positionY:y.state.positionY,viewportWidth:L.clientWidth,viewportHeight:L.clientHeight,margin:s,threshold:c}):!1},S=g.useState(k),_=S[0],D=S[1],X=g.useRef(!1),N=g.useRef(f),Y=g.useRef(p);return N.current=f,Y.current=p,vr(function(){var L=function(){var P,C;if(y.wrapperComponent){var O=k();O!==X.current&&(X.current=O,D(O),O?(P=N.current)===null||P===void 0||P.call(N):(C=Y.current)===null||C===void 0||C.call(Y))}};L();var Z=y.onChange(L),Q;return y.wrapperComponent||(Q=y.onInit(function(){return L()})),function(){Z(),Q==null||Q()}},[y,t,n,i,o,s,c]),_?m.jsx("div",pe({ref:r,className:h,style:b},{children:v})):d?m.jsx(m.Fragment,{children:d}):null});var us=function(){var e=g.useContext(mt);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},cs=function(){var e=us();return dt(e)};const ds=new Set(["http:","https:"]);function fs(e){const r=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!r||r[1].length===1?null:`${r[1].toLowerCase()}:`}const ps={image:"data:image/",pdf:"data:application/pdf"};function zn(e,r,t){const n=e.trim();if(n.startsWith("data:"))return n.toLowerCase().startsWith(ps[r])?{url:n,error:null}:{url:null,error:"unsupported-data"};const i=fs(n);if(i!==null)return ds.has(i)?{url:n,error:null}:{url:null,error:"blocked"};const o=t(n);return o?{url:o,error:null}:{url:null,error:"local-unavailable"}}function Dn(e,r){switch(e){case"blocked":return`This ${r} source is blocked for safety.`;case"unsupported-data":return`This data URI isn’t a valid ${r} source.`;case"local-unavailable":return`Local ${r} files can’t be displayed here.`}}function hs({content:e}){const r=ve(),t=ee(u=>u.selectedCwd),n=g.useMemo(()=>zn(e.src,"image",u=>r.mediaUrl(t??"",u)),[e.src,r,t]),[i,o]=g.useState("loading"),[a,s]=g.useState(e.src);a!==e.src&&(s(e.src),o("loading"));const l=e.alt??e.title??"Canvas image";if(n.url===null){const u=n.error?Dn(n.error,"image"):"";return m.jsx(Ur,{children:u})}const c=n.url;return m.jsxs("div",{className:"bg-muted/40 relative flex h-full items-center justify-center",children:[i==="loading"&&m.jsx("p",{className:"text-muted-foreground absolute text-sm","aria-live":"polite",children:"Loading image…"}),i==="error"?m.jsx(Ur,{children:"This image couldn’t be loaded."}):m.jsxs(ns,{centerOnInit:!0,doubleClick:{mode:"toggle"},wheel:{step:.15},children:[m.jsx(vs,{}),m.jsx(as,{wrapperClass:"!h-full !w-full",contentClass:"!h-full !w-full flex items-center justify-center",children:m.jsx("img",{src:c,alt:l,onLoad:()=>o("loaded"),onError:()=>o("error"),className:ur("max-h-full max-w-full object-contain transition-opacity",i==="loaded"?"opacity-100":"opacity-0")})})]})]})}function vs(){const{zoomIn:e,zoomOut:r,resetTransform:t}=cs();return m.jsxs("div",{className:"absolute top-2 right-2 z-10 flex gap-1",children:[m.jsx(Zt,{label:"Zoom in",onClick:()=>e(),children:m.jsx(Ti,{className:"size-4"})}),m.jsx(Zt,{label:"Zoom out",onClick:()=>r(),children:m.jsx(_i,{className:"size-4"})}),m.jsx(Zt,{label:"Reset zoom",onClick:()=>t(),children:m.jsx(Ei,{className:"size-4"})})]})}function Zt({label:e,onClick:r,children:t}){return m.jsx("button",{type:"button",onClick:r,"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:t})}function Ur({children:e}){return m.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:m.jsx("p",{children:e})})}function ms({content:e}){const r=ve(),t=ee(a=>a.selectedCwd),n=g.useMemo(()=>zn(e.src,"pdf",a=>r.mediaUrl(t??"",a)),[e.src,r,t]);if(n.url===null){const a=n.error?Dn(n.error,"pdf"):"";return m.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:m.jsx("p",{children:a})})}const i=n.url,o=e.title??"PDF document";return m.jsx("object",{data:i,type:"application/pdf",title:o,className:"h-full w-full",children:m.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[m.jsx("p",{children:"This PDF can’t be shown here."}),m.jsxs("a",{href:i,target:"_blank",rel:"noreferrer",className:"text-foreground focus-ring rounded-md underline underline-offset-4",children:["Open ",o," in a new tab"]})]})})}function gs(e){const r=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!r||r[1].length===1?null:`${r[1].toLowerCase()}:`}const bs=new Set(["http:","https:","data:"]);function Nn(e,r,t){const n=e.trim(),i=gs(n);return i!==null?bs.has(i)?i==="data:"&&t!==void 0?n.toLowerCase().startsWith(t)?{url:n}:{url:null}:{url:n}:{url:null}:{url:r(n)}}function ws({content:e}){const r=ve(),t=ee(o=>o.selectedCwd),n=g.useMemo(()=>Nn(e.src,o=>r.mediaUrl(t??"",o),"data:audio/"),[e.src,r,t]),i=e.title??"Canvas audio";return n.url===null?m.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:m.jsx("p",{children:"This audio can’t be played here."})}):m.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center p-8",children:m.jsx("audio",{controls:!0,src:n.url,"aria-label":i,className:"w-full max-w-2xl",children:m.jsxs("p",{className:"text-muted-foreground text-sm",children:["Your browser can’t play this audio."," ",m.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",i]}),"."]})})})}function ys({content:e}){const r=ve(),t=ee(o=>o.selectedCwd),n=g.useMemo(()=>Nn(e.src,o=>r.mediaUrl(t??"",o),"data:video/"),[e.src,r,t]),i=e.title??"Canvas video";return n.url===null?m.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:m.jsx("p",{children:"This video can’t be played here."})}):m.jsx("div",{className:"bg-muted/40 flex h-full w-full items-center justify-center",children:m.jsx("video",{controls:!0,src:n.url,"aria-label":i,className:"max-h-full w-full max-w-full object-contain",children:m.jsxs("p",{className:"text-muted-foreground p-8 text-sm",children:["Your browser can’t play this video."," ",m.jsxs("a",{href:n.url,className:"text-foreground underline underline-offset-4",children:["Download ",i]}),"."]})})})}function Mn({content:e,documentId:r,channel:t}){const[n]=lr(),i=Ci(e.definition),o=g.useMemo(()=>JSON.stringify(e.definition),[e.definition]);return m.jsx("div",{className:"p-4",children:i.ok?m.jsx(Si,{channel:t,document:i.document,sessionId:n??void 0},t?r??t.documentId:o):m.jsx(ki,{error:i.error,raw:i.raw})})}class Cs{constructor(){ie(this,"contiguous",0);ie(this,"through",0);ie(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(r){this.contiguous=Math.max(this.contiguous,r)}markThrough(r){this.through=Math.max(this.through,r)}recordGap(r){return this.markThrough(r.docSeq),this.pending.set(r.docSeq,r),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 r=this.contiguous+1,t=this.pending.get(r);return t&&this.pending.delete(r),t}clearReachedTarget(){return this.contiguous<this.through?!1:(this.through=0,!0)}}const It=new WeakMap,gt=new WeakMap,Te=new WeakMap,ot=new WeakMap;function xe(e){Be(e);const r=It.get(e);if(!r)throw new Error("Replay owner lifetime is absent.");return r}function Ss(e,r){const t=gt.get(r);if(!t||t.owner!==e)throw new Error("Replay run is foreign.");return t}function Yn(e){if(e&&typeof e=="object"&&!Object.isFrozen(e)){for(const r of Object.values(e))Yn(r);Object.freeze(e)}return e}function ks(e){if(Be(e),It.has(e))throw new Error("Replay owner lifetime is already initialized.");It.set(e,new Cs)}function mr(e){const r=xe(e);return Object.freeze({highest:r.highest,through:r.catchUpThrough,pending:r.pendingCount})}function Zr(e){xe(e).reset()}function Vr(e,r){const t=gt.get(r);if(!(!t||t.owner!==e))return Object.freeze({subject:t.subject,epoch:t.epoch,revision:t.revision,observation:t.observation,ended:t.ended})}function Ps(e,r,t){const n=Te.get(t),i=gt.get(r);if(!(!i||i.owner!==e||!n||n.owner!==e||n.run!==r||n.phase!=="consuming"||n.admissionRead||!oe(e,r)))return n.admissionRead=!0,Object.freeze({response:n.response,since:n.since,revision:n.revision,observation:n.observation,targetBirth:i.targetBirth})}function Es(e,r,t){const n=Ss(e,r),i=Te.get(t),o=Bn(e,r,t);if(!o||!i||i.owner!==e||i.run!==r||i.phase!=="consuming"||!i.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 Xn(e,r,t,n){if(!oe(e,r))return;if(n){const o=ot.get(t);return o&&o.owner===e&&o.run===r&&o.phase==="dispatching"&&!o.advanced?o.frame:void 0}const i=Te.get(t);return i&&i.owner===e&&i.run===r&&i.phase==="frames"&&i.dispatching!==void 0&&!i.advanced?i.frames[i.dispatching]:void 0}function Ts(e,r,t,n){const i=Is(e,r,t,n);if(!i||!oe(e,r))throw new Error("Replay cursor advance has no genuine core witness.");const o=n?ot.get(t):Te.get(t);if(!o||o.advanced)throw new Error("Replay frame advance was consumed.");o.advanced=!0,xe(e).advance(i.docSeq)}function _s(e,r){const t=gt.get(r),n=(t==null?void 0:t.lastPage)&&Te.get(t.lastPage);if(!t||t.owner!==e||!oe(e,r)||t.target===void 0||!n||n.phase!=="finished"||n.next!==n.frames.length||n.response.events.length>=200&&xe(e).highest<t.target)return;const i=xe(e);return Object.freeze({highest:i.highest,through:i.catchUpThrough,target:t.target})}function js(e,r){const t=ht(e,r);if(!t)throw new Error("Replay notice is foreign or stale.");const n=xe(e),i=t.notification;if(t.mode==="quarantine")n.markThrough(i.type==="canvas_channel_snapshot"?i.snapshot.highWatermark:i.docSeq),i.type!=="canvas_channel_snapshot"&&n.recordGap(i);else{if(t.mode==="gap"&&i.type!=="canvas_channel_snapshot")return n.recordGap(i);t.mode==="event"&&fl(e,r)}return!1}function As(e,r){const t=ht(e,r);if(!t||t.mode!=="event"||t.notification.type==="canvas_channel_snapshot")throw new Error("Notice cursor advance is foreign.");xe(e).advance(t.notification.docSeq)}function Os(e){const r=he(e),t=xe(e),n=Object.freeze({}),i={owner:e,subject:r.subject,epoch:r.epoch,revision:r.revision,observation:r.observation,ended:!1,starting:t.highest,succeeded:!1};gt.set(n,i),nl(e,n);const o=()=>oe(e,n),a=()=>he(e).live?o()?void 0:"restart":"stop";return Object.freeze({async readPage(){if(!o())return null;const s=he(e),l=t.highest,c=Mt(e),u=c.getCanvasChannel;if(!o())return null;const d=await u.call(c,r.documentId,{since:l,limit:200});if(!o())return null;const f=Yn(bi.parse(d));if(!o())return null;const p=Object.freeze({});return Te.set(p,{owner:e,run:n,response:f,since:l,revision:s.revision,observation:s.observation,phase:"read",admissionRead:!1,frames:[],next:0,advanced:!1}),p},consumePage(s){const l=Te.get(s);return!o()||!l||l.owner!==e||l.run!==n||l.phase!=="read"?{kind:"done"}:(l.phase="consuming",il(e,n,s)!=="accepted"||!o()?(l.phase="finished",{kind:"done"}):(i.target??(i.target=l.response.highWatermark),i.targetBirth=l.response.incarnation,l.frames=Object.freeze(l.response.events.filter(u=>u.docSeq<=i.target)),l.phase="frames",i.lastPage=s,l.response.resetRequired&&t.advance(l.response.retentionFloor-1),{kind:"frames",count:l.frames.length}))},advancePageFrame(s,l){const c=Te.get(s);if(!o()||!c||c.owner!==e||c.run!==n||c.phase!=="frames"||l!==c.next||!c.frames[l])return!1;c.next=l+1,c.dispatching=l,c.advanced=!1;try{return $r(e,n,s,!1)&&o()}finally{c.dispatching=void 0}},finishPage(s){const l=Te.get(s);if(!o()||!l||l.owner!==e||l.run!==n||l.phase!=="frames"||l.next!==l.frames.length||i.target===void 0)return"done";if(l.phase="finished",l.response.events.length<200||t.highest>=i.target)return t.advance(i.target),!o()||(Jr(e,n),!o())||(i.succeeded=!0),"done";if(t.highest<=l.since)throw new Error("Document replay made no progress.");return"again"},failed(){o()&&ol(e,n)},beginFinalization(){return a()??(i.succeeded?"drain":"stop")},takePending(){if(!o())return null;const s=t.takeNextContiguous();if(!s||!o())return null;const l=Object.freeze({});return ot.set(l,{owner:e,run:n,frame:s,phase:"taken",advanced:!1}),l},advancePending(s){const l=ot.get(s);if(!o()||!l||l.owner!==e||l.run!==n||l.phase!=="taken")return!1;l.phase="dispatching";try{return $r(e,n,s,!0)&&o()}finally{l.phase="finished",ot.delete(s)}},finishFinalization(){const s=a();if(s)return s;if(t.clearReachedTarget()){const l=a();if(l)return l;Jr(e,n);const c=a();if(c)return c}if(t.pendingCount||t.catchUpThrough>t.highest){const l=he(e);if(t.highest>i.starting||l.revision>i.revision||l.observation>i.observation)return"restart";al(e,n)}return a()??"stop"},current:o,end:()=>{i.ended=!0}})}var ye,tr,tt;class er{constructor(){Ke(this,ye);ie(this,"current",null);ie(this,"token",0);ie(this,"retiring",!1);ie(this,"subscribers",new Set);ie(this,"resources",new Map);ie(this,"doc",null);ie(this,"docClaims",new WeakMap);ie(this,"retiringDoc",!1);ie(this,"docResources",new Map);ie(this,"bindings",new WeakSet)}getCurrent(){return this.current}observeHostContext(r){if(this.retiring)return null;if(!r.transportOwner||typeof r.transportOwner!="object"||!Number.isSafeInteger(r.publisherEpoch)||r.publisherEpoch<0)throw new Error("Explicit transport owner and epoch required.");const t=["frame","documentId","resolvedSource","logicalUrl","reloadKey","sessionId","eligibility","exactOrigin","transportOwner","publisherEpoch"];if(t.some(i=>!Object.hasOwn(r,i))||typeof r.documentId!="string"||!r.documentId||typeof r.logicalUrl!="string"||typeof r.reloadKey!="string")throw new Error("Complete host context required.");const n=this.current;return n&&t.every(i=>Object.is(n[i],r[i]))?n:(this.retire(),this.current=Object.freeze({...r,token:this.token,loaded:!1}),this.current)}observeLoaded(r){return this.retiring||this.current!==r||!r.frame?null:(this.retire(),this.current=Object.freeze({...r,token:this.token,loaded:!0}),this.current)}retire(){if(this.retiring)return;const r=this.current;this.current=null;const t=this.doc;this.doc=null,this.token++,this.retiring=!0;const n=[...r?this.resources.get(r)??[]:[],...t?this.docResources.get(t)??[]:[],...this.subscribers];t&&this.docResources.delete(t),r&&this.resources.delete(r);try{for(const i of n)try{const o=i();o&&typeof o.then=="function"&&Promise.resolve(o).catch(()=>{})}catch{}}finally{this.retiring=!1}}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}own(r,t){if(this.retiring||this.current!==r)throw new Error("Frame observation retired.");const n=this.resources.get(r)??new Set;return n.add(t),this.resources.set(r,n),()=>{n.delete(t)}}bindDoc(r,t,n){return ke(this,ye,tr).call(this,r,t,n)}acquireDoc(r,t,n){const i=ke(this,ye,tr).call(this,r,t,n),o=Object.freeze({});this.docClaims.set(i,o);let a=!1;return Object.freeze({binding:i,release:()=>{a||(a=!0,this.docClaims.get(i)===o&&(this.docClaims.delete(i),this.doc===i&&this.bindings.has(i)&&ke(this,ye,tt).call(this)))}})}disableDoc(){ke(this,ye,tt).call(this)}retireDoc(r){this.doc===r&&this.bindings.has(r)&&ke(this,ye,tt).call(this)}ownDoc(r,t){if(!this.isCurrent(r))throw new Error("Doc binding retired.");const n=this.docResources.get(r)??new Set;return n.add(t),this.docResources.set(r,n),()=>{n.delete(t)}}isCurrent(r){return!this.retiring&&!this.retiringDoc&&this.doc===r&&this.bindings.has(r)&&this.current===r.observation}}ye=new WeakSet,tr=function(r,t,n){const i=this.doc,o=this.token,a=ho(Kr,t);if(!a)throw this.disableDoc(),new Error("Established server Doc birth required.");const s=a,l=r.exactOrigin,c=r.eligibility==="served-document"?l==="null":r.eligibility==="preview-listener"&&l!==null&&new URL(l).origin===l;if(!r.loaded||!r.frame||typeof r.frame.postMessage!="function"||!r.resolvedSource||!c||r.documentId!==s.documentId||!n||n.length>200)throw new Error("Loaded eligible frame and established Doc birth required.");if(this.retiring||this.retiringDoc||this.current!==r||this.doc!==i||this.token!==o)throw new Error("Frame observation retired during Doc admission.");if(this.doc){if(this.doc.observation!==r)throw new Error("Doc binding belongs to another host load.");if(I(this.doc.incarnation,s)&&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:r,incarnation:Object.freeze(s),scope:n});try{return this.doc=u,this.bindings.add(u),u}catch(d){throw this.doc===u&&ke(this,ye,tt).call(this),d}},tt=function(){if(this.retiringDoc)return;const r=this.doc;this.doc=null,this.retiringDoc=!0;const t=[...r?this.docResources.get(r)??[]:[]];r&&this.docResources.delete(r);try{for(const n of t)try{const i=n();i&&typeof i.then=="function"&&Promise.resolve(i).catch(()=>{})}catch{}}finally{this.retiringDoc=!1}};function Rs(e,r,t){if(!t||typeof t.captureOriginal!="function"||typeof t.submit!="function"||typeof t.inspect!="function"||typeof t.isCurrentOwner!="function"||t.owner!==r.observation.transportOwner||t.publisherEpoch!==r.observation.publisherEpoch)throw new Error("Explicit current transport submit and inspect ports required.");const{owner:n,publisherEpoch:i,isCurrentOwner:o,submit:a,inspect:s,captureOriginal:l}=t,c=Object.freeze({expectedGeneration:r.incarnation.generation}),u=()=>{try{return e.isCurrent(r)?o(n,i)===!0&&e.isCurrent(r):!1}catch{return!1}};if(!u())throw new Error("Doc binding unavailable.");const d=()=>{if(!u())throw new Error("Doc binding retired.")};return Object.freeze({binding:r,current:u,captureOriginal:f=>{d();const p=f.id;d();const v=f.bytes;d();const h=Reflect.apply(l,t,[Object.freeze({id:p,bytes:v})]);if(d(),!h)return null;const b=h.id;d();const y=h.bytes;d();const k=h.submit;d();const S=h.inspect;return d(),b!==p||y!==v||typeof k!="function"||typeof S!="function"?null:Object.freeze({id:p,bytes:v,submit:async _=>{d(),_.throwIfAborted();const D=await Reflect.apply(k,h,[_]);return d(),_.throwIfAborted(),D},inspect:async _=>{d(),_.throwIfAborted();const D=await Reflect.apply(S,h,[_]);return d(),_.throwIfAborted(),D}})},retireObservation:()=>{u()&&e.retire()},onRetire:f=>e.ownDoc(r,f),submit:(f,p)=>(d(),p.throwIfAborted(),a(f,c,p)),inspect:(f,p)=>(d(),p.throwIfAborted(),s(f,c,p))})}class xs{constructor(){ie(this,"revision",0);ie(this,"draining",!1);ie(this,"cleanup");ie(this,"subscribers",new Set);ie(this,"retirements",new WeakMap)}captureRetirement(){const r=Object.freeze({}),t=++this.revision,n=this.cleanup;return this.cleanup=void 0,this.retirements.set(r,{revision:t,cleanup:n,callbacks:this.draining?[]:[...this.subscribers]}),r}drainRetirement(r){const t=this.retirements.get(r);if(!t)throw new Error("Frame resource retirement is foreign or consumed.");this.retirements.delete(r);const n=this.draining;this.draining=!0;try{this.drain(t.cleanup);for(const i of t.callbacks)this.drain(i)}finally{this.draining=n}}begin(){const r=this.captureRetirement(),t=this.revision;return this.drainRetirement(r),t}once(r,t,n){let i=!1;return()=>{if(i||(i=!0,!this.current(r)||!t()||!this.current(r)))return null;const o=n();return!this.current(r)||!t()||!this.current(r)?null:o}}drain(r){try{Promise.resolve(r==null?void 0:r()).catch(()=>{})}catch{}}current(r){return this.revision===r}install(r,t){return this.current(r)?(this.cleanup=t,!0):!1}subscribe(r){return this.subscribers.add(r),()=>{this.subscribers.delete(r)}}}function zs(e,r,t){const n=()=>e.current(r)&&t.current()===!0&&e.current(r),i=e.once(r,n,t.complete);return Object.freeze({completeLoad:()=>{const o=i();return!o||!n()||t.accept(o)!==!0||!n()?null:o}})}function Ds(e,r,t){const n=()=>e.current(r)&&t.current()===!0&&e.current(r);if(!n())return null;const i=t.acquire();if(!i)return null;let o=!1,a=null,s;try{const l=i.binding;if(n()&&t.bindingCurrent(l)===!0&&n()){const c=t.createPort(l);n()&&t.portCurrent(c)===!0&&n()&&e.install(r,i.release)&&(o=!0,a=c)}}catch(l){s={cause:l}}if(!o)try{i.release()}catch(l){s??(s={cause:l})}if(s)throw s.cause;return a}function Ns(e){const r=()=>Object.assign(new Error("Document actions are unavailable."),{status:409}),t=(i,o)=>{if(o.aborted||!e.current(i)||o.aborted)throw r()},n=(i,o)=>{const a=Ir.parse(o);if(a.receipt.id!==i)throw new Error("Document receipt does not match this action.");return a};return Object.freeze({current:e.current,submit:async(i,o)=>{const a=Et.parse(JSON.parse(JSON.stringify(i))),s=a.id;t("submit",o);const l=await e.submit(a,o);t("read",o);const c=n(s,l);return t("read",o),c},inspect:async(i,o)=>{t("read",o);const a=await e.inspect(i,o);t("read",o);const s=n(i,a);return t("read",o),s},captureOriginal:i=>{const o=Et.parse(JSON.parse(JSON.stringify(i))),a=o.id,s=JSON.stringify(o);if(!e.current("submit"))return null;const l=e.capture(o,s);if(!l||!e.current("submit")||!l.current("submit"))return null;let c=!1;const u=d=>l.current(d)===!0;return Object.freeze({id:a,bytes:s,current:u,submit:async d=>{if(c||d.aborted||!u("submit"))throw r();c=!0;const f=await l.submit(JSON.parse(s),d);if(d.aborted||!u("read"))throw r();const p=n(a,f);if(d.aborted||!u("read"))throw r();return p},inspect:async d=>{if(d.aborted||!u("read"))throw r();const f=await l.inspect(a,d);if(d.aborted||!u("read"))throw r();const p=n(a,f);if(d.aborted||!u("read"))throw r();return p}})}})}function Ms(e){return Object.freeze({id:e.id,bytes:e.bytes,submit:async r=>{try{return{kind:"accepted",receipt:await e.submit(r)}}catch{return{kind:"uncertain"}}},inspect:async r=>{try{return{kind:"accepted",receipt:await e.inspect(r)}}catch{return{kind:"unknown"}}}})}function Ys(e,r,t){const n=Et.parse(JSON.parse(e.bytes));if(n.id!==e.id||JSON.stringify(n)!==e.bytes||!t())return null;const i=r(n);return!t()||!i?null:Ms(i)}const Xs=er.prototype.acquireDoc,_t=new WeakMap,rr=new WeakMap;function Ws(e,r){const t=Mt(e),n=new WeakMap,i=(a,s)=>r.current(s)&&Ae(e,a,!0);return Object.freeze({prepareFrameLoad:(a,s)=>{var f;if(!(a instanceof er)||s.loaded)return null;const l=Gr(e),c=l?(f=Xe(e,l))==null?void 0:f.httpBaseline:void 0,u=r.begin();if(!l||!c||!r.current(u)||!Ae(e,l,!0)||a.getCurrent()!==s||s.transportOwner!==t||!i(l,u))return null;let d=null;return zs(r,u,{current:()=>{var p;return Ae(e,l,!0)&&((p=Xe(e,l))==null?void 0:p.httpBaseline)===c&&a.getCurrent()===(d??s)&&r.current(u)&&Ae(e,l,!0)},complete:()=>(d=a.observeLoaded(s),d),accept:p=>{var v,h;return!r.current(u)||!Ae(e,l,!0)||((v=Xe(e,l))==null?void 0:v.httpBaseline)!==c||a.getCurrent()!==p||!r.current(u)||!Ae(e,l,!0)||((h=Xe(e,l))==null?void 0:h.httpBaseline)!==c?!1:(n.set(p,{record:l,birth:c.birth}),!0)}})},subscribeInvalidation:a=>r.subscribe(a),attachFrame:(a,s)=>{if(!(a instanceof er))return null;const l=Gr(e),c=r.begin();if(!l||!r.current(c)||!Ae(e,l,!0)||a.getCurrent()!==s||s.transportOwner!==t||!i(l,c))return null;const u=n.get(s);return!u||u.record!==l||!I(u.birth,Xe(e,l).birth)?null:Ds(r,c,{current:()=>i(l,c),acquire:()=>{const d=Xs.call(a,s,Xe(e,l).birth,Xe(e,l).birth.documentId);let f=!1,p=null,v;try{i(l,c)&&a.getCurrent()===s&&i(l,c)&&(p=Object.freeze({binding:d.binding,release:d.release}),f=!0)}catch(h){v={cause:h}}if(!f)try{d.release()}catch(h){v??(v={cause:h})}if(v)throw v.cause;return p},bindingCurrent:d=>a.isCurrent(d)&&i(l,c),createPort:d=>Rs(a,d,{owner:t,publisherEpoch:s.publisherEpoch,isCurrentOwner:(f,p)=>f===t&&p===s.publisherEpoch&&r.current(c)&&Ae(e,l),captureOriginal:f=>Ys(f,p=>{var v;return((v=rl(e,l))==null?void 0:v.captureOriginal(p))??null},()=>i(l,c)),submit:async()=>({kind:"terminal"}),inspect:async()=>({kind:"unknown"})}),portCurrent:d=>d.current()&&i(l,c)})}})}function Ls(e){if(Be(e),_t.has(e))throw new Error("Frame owner is already initialized.");const r=new xs,t=Ws(e,r);return _t.set(e,{frames:r,facade:t}),t}function Fs(e){var r;return Be(e),(r=_t.get(e))==null?void 0:r.facade}function rt(e){Be(e);const r=_t.get(e);if(!r)return;const t=Object.freeze({});return rr.set(t,{owner:e,frames:r.frames,ticket:r.frames.captureRetirement()}),t}function nt(e,r){if(!r)return;const t=rr.get(r);if(!t||t.owner!==e)throw new Error("Frame retirement is foreign or consumed.");rr.delete(r),t.frames.drainRetirement(t.ticket)}function Wn(e,r){const t=Pe(e,r),n=Ks(e,r);if(!(!t||!n))return{owner:r,verified:t.verified,...Ns(n)}}function we(e,r){return{documentId:e,transport:r,events:[],available:!1}}function Bs(e,r,t,n,i,o){var l,c;const a=e.documentId===t&&e.transport===n?e:we(t,n);if(a.snapshot&&(r.highWatermark<a.snapshot.highWatermark||r.stateRev<a.snapshot.stateRev))return a;const s=new Map((((l=a.snapshot)==null?void 0:l.receipts)??[]).filter(u=>u.receipt.docSeq>=r.receiptRetentionFloor).map(u=>[u.receipt.id,u]));for(const u of r.receipts)s.set(u.receipt.id,u);return{...a,available:o,snapshot:{...r,...i?{}:{routing:(c=a.snapshot)==null?void 0:c.routing},receipts:[...s.values()].sort((u,d)=>d.receipt.docSeq-u.receipt.docSeq).slice(0,400)},events:r.resetRequired?a.events.filter(u=>u.docSeq>=r.retentionFloor):a.events}}function qs(e){var t,n,i,o,a,s,l,c,u,d,f,p;const r=async()=>{throw Object.assign(new Error("Document actions are unavailable."),{status:409})};return{documentId:e.documentId,enabled:e.available&&((t=e.binding)==null?void 0:t.verified)===!0&&((i=(n=e.snapshot)==null?void 0:n.routing)==null?void 0:i.enabled)===!0,submissionOwner:(o=e.binding)==null?void 0:o.owner,current:((a=e.binding)==null?void 0:a.current)??(()=>!1),approvedEventTypes:e.available?((l=(s=e.snapshot)==null?void 0:s.routing)==null?void 0:l.approvedEventTypes)??[]:[],destinationLabel:e.available?((u=(c=e.snapshot)==null?void 0:c.routing)==null?void 0:u.destinationLabel)??"Actions unavailable":"Actions unavailable",...e.snapshot?{snapshot:e.snapshot}:{},submit:((d=e.binding)==null?void 0:d.submit)??r,inspect:((f=e.binding)==null?void 0:f.inspect)??r,captureOriginal:(p=e.binding)==null?void 0:p.captureOriginal}}function Hs(e,r,t){return!!(e&&r&&t.incarnation&&I(r,t.incarnation)&&(t.highWatermark<e.highWatermark||t.stateRev<e.stateRev))}function Ln(e,r,t,n){const i=e.documentId===t&&e.transport===n?e:we(t,n);return{...i,events:[...i.events,r].slice(-200)}}function Us(e,r){if(e.incarnation&&(e.incarnation.documentId!==r||e.events.some(t=>t.documentId!==r||!t.incarnation||!I(e.incarnation,t.incarnation))))throw new Error("Document replay identity changed.")}const nr=new WeakMap;function Zs(e,r,t){const n=Ps(e,r,t);if(n)return nr.set(t,{owner:e,run:r,witness:n}),n}const Fn=new WeakMap,pt=new WeakMap,ir=new WeakMap,or=new WeakMap;function _e(e,r){Be(e);const t=r??pt.get(e),n=t&&Fn.get(t);return n&&n.owner===e&&pt.get(e)===t&&n.active?n:void 0}function te(e){return Be(e),pt.get(e)}function Pe(e,r){const t=_e(e,r);return t?Object.freeze({birth:t.birth,httpBaseline:t.httpBaseline,snapshot:t.snapshot,verified:t.verified}):void 0}function at(e,r,t=!1){var o,a;const n=_e(e,r),i=he(e);return!!n&&i.live&&n.verified&&n.transport===Mt(e)&&(!t||((a=(o=n.snapshot)==null?void 0:o.routing)==null?void 0:a.enabled)===!0)}function Vs(e){const r=_e(e);pt.delete(e),r&&(r.active=!1,r.verified=!1)}function Vt(e,r){const t=_e(e,r);t&&(t.verified=!1)}function Gs(e,r,t){const n=_e(e,t);return!n||!oe(e,r)?!1:(n.verified=!0,oe(e,r))}function $s(e,r,t){const n=nr.get(t);nr.delete(t);const i=(n==null?void 0:n.owner)===e&&n.run===r?n.witness:void 0;if(!i||!oe(e,r))return!1;const o=i.response.incarnation;let a=_e(e);if(!a&&!o)return oe(e,r);if(!a&&o){const s=he(e),l=()=>{const v=he(e);return oe(e,r)&&v.epoch===s.epoch&&v.observation===s.observation&&te(e)===s.subject},c=Mt(e),u=c.ingestCanvasEvent;if(!l())return!1;const d=Function.prototype.bind.call(u,c),f=c.getCanvasEventReceipt;if(!l())return!1;const p=Function.prototype.bind.call(f,c);if(!l())return!1;a={owner:e,token:Object.freeze({}),birth:Object.freeze({...o}),active:!0,verified:!1,submit:d,inspect:p,transport:c},Fn.set(a.token,a),pt.set(e,a.token),a.httpBaseline=Object.freeze({birth:a.birth,floor:i.response.receiptRetentionFloor}),ir.set(t,Object.freeze({owner:e,run:r,epoch:s.epoch,previous:s.subject,subject:a.token}));try{Es(e,r,t)}catch(v){throw _e(e)===a&&ul(e,r,t),v}finally{ir.delete(t)}if(!oe(e,r))return!1}else if(a){if(!o||!I(a.birth,o))return!1;a.httpBaseline=Object.freeze({birth:a.birth,floor:i.response.receiptRetentionFloor})}return oe(e,r)?(a&&(a.verified=cl(e)||a.verified),!0):!1}function gr(e,r,t){const n=br(e),i=n.subject,o=()=>Un(e,n,t);if(!i||!at(e,i)){const l=rt(e);nt(e,l)}if(!o())return;const a=i&&Wn(e,i),s=Fs(e);n.dispatch(l=>{var d;if(!o())return l;const c=((d=l.binding)==null?void 0:d.owner)===i?l:we(n.documentId,n.transport),u=typeof r=="function"?r(c):r;return o()?{...u,...u.snapshot?{snapshot:Object.freeze({...u.snapshot})}:{},binding:a,frameAdmission:s}:l})}function Js(e,r,t,n,i){const o=br(e),a=_e(e);Un(e,o,i)&&(a&&(a.snapshot=r),gr(e,s=>Bs(s,r,o.documentId,o.transport,t,n),i))}function Qs(e,r,t,n){const i=Xn(e,r,t,n);if(!oe(e,r)||!i)return!1;if(i.docSeq<=mr(e).highest)return oe(e,r);or.set(t,{owner:e,run:r,pending:n,frame:i});try{Ts(e,r,t,n)}finally{or.delete(t)}if(!oe(e,r))return!1;const o=br(e);return gr(e,a=>Ln(a,i,o.documentId,o.transport),r),oe(e,r)}function Ks(e,r){const t=_e(e,r);if(!t)return;const n=he(e).documentId;return{current:i=>at(e,r,i==="submit"),submit:(i,o)=>t.submit(n,i,{expectedGeneration:t.birth.generation},o),inspect:(i,o)=>t.inspect(n,i,{expectedGeneration:t.birth.generation},o),capture:()=>{const i=t.httpBaseline;return!i||!at(e,r,!0)||!I(i.birth,t.birth)?null:Object.freeze({current:o=>at(e,r,o==="submit")&&(o==="read"||t.httpBaseline===i),submit:(o,a)=>t.submit(n,o,{expectedGeneration:i.birth.generation},a),inspect:(o,a)=>t.inspect(n,o,{expectedGeneration:i.birth.generation},a)})}}}function Bn(e,r,t){const n=ir.get(t),i=he(e);return n&&n.owner===e&&n.run===r&&i.epoch===n.epoch&&i.subject===n.subject&&i.live?n:void 0}function Is(e,r,t,n){const i=or.get(t);return i&&i.owner===e&&i.run===r&&i.pending===n&&oe(e,r)?i.frame:void 0}const qn=new WeakMap,jt=new WeakMap;function el(e){const r=jt.get(e);if(!r)throw new Error("Document construction ticket is foreign or consumed.");return jt.delete(e),r}function tl(e,r,t){const n=Object.freeze({});jt.set(n,Object.freeze({documentId:e,transport:r,dispatch:t}));try{const i=dl(n);return qn.set(n,i),n}finally{jt.delete(n)}}function ne(e){const r=qn.get(e);if(!r)throw new Error("Document owner is foreign.");return r}function Be(e){ne(e)}function he(e){return ne(e).facts()}function Mt(e){return ne(e).transport()}function Gr(e){return ne(e).subject()}function Xe(e,r){return ne(e).subjectFacts(r)}function Ae(e,r,t=!1){return ne(e).subjectCurrent(r,t)}function rl(e,r){return ne(e).binding(r)}function nl(e,r){ne(e).reserve(r)}function oe(e,r){return ne(e).current(r)}function il(e,r,t){return ne(e).admit(r,t)}function $r(e,r,t,n){return ne(e).frame(r,t,n)}function Jr(e,r){return ne(e).qualify(r)}function ol(e,r){ne(e).failed(r)}function al(e,r){ne(e).unavailable(r)}function sl(e,r){ne(e).start(r)}function ll(e){ne(e).dispose()}const Hn=new WeakMap;function br(e){const r=Object.freeze(ne(e).projection());return Hn.set(r,Object.freeze({custodyKey:e,capture:r})),r}function Un(e,r,t){const n=Hn.get(r);return(n==null?void 0:n.custodyKey)===e&&n.capture===r&&ne(e).projectionCurrent(r.epoch,r.subject,t)}function ul(e,r,t){ne(e).abortAdmission(r,t)}function cl(e){return ne(e).qualified()}const ar=new WeakMap;function dl(e){const{documentId:r,transport:t,dispatch:n}=el(e);let i,o=!1,a;const s={live:!0};let l=0,c,u,d=!1,f,p,v=0;const h=()=>s.live,b=()=>Vs(e);let y=0;const k=()=>mr(e),S=P=>{const C=Vr(e,P);return!!C&&!C.ended&&h()&&i===P&&C.epoch===l&&C.subject===te(e)},_=(P=!1)=>{const C=rt(e);b(),l++,i=void 0,P&&Zr(e),nt(e,C)},D=(P,C)=>gr(e,P,C),X=P=>{const C=_s(e,P),O=te(e),R=O&&Pe(e,O);return!S(P)||!C||C.through>C.highest||!f||!R||!I(f,R.birth)||!Gs(e,P,O)?!1:(f=void 0,D(W=>({...W,available:!0}),P),S(P))},N=(P,C,O)=>{const R=te(e),W=R&&Pe(e,R),j=l,E=()=>h()&&j===l&&te(e)===R&&(!O||S(O));if(!E()||Hs(W==null?void 0:W.snapshot,W==null?void 0:W.birth,P))return;const B=C?P.routing:u;P={...P,routing:B&&Object.freeze({enabled:B.enabled,destinationLabel:B.destinationLabel,approvedEventTypes:Object.freeze([...B.approvedEventTypes])})},C&&(u=P.routing),!R&&!P.incarnation&&(d=!0),E()&&Js(e,P,C,f===void 0,O)},Y=(P,C)=>{var ae;const O=Zs(e,P,C);if(!S(P)||!O)return"discard";const R=O.response;Us(R,r);const W=R.incarnation;if((te(e)||f||p)&&!W)throw new Error("Document replay identity is unavailable.");if(p&&W&&!I(p,W))return _(!0),D(we(r,t)),"restart";const j=te(e),E=(j&&((ae=Pe(e,j))==null?void 0:ae.birth))??f;if(W&&(E&&!I(E,W)||!E&&d||O.targetBirth&&!I(O.targetBirth,W)))return f=W,d=!1,u=void 0,c=void 0,_(!0),D(we(r,t)),"restart";const{events:B,...H}=R,$=te(e);return!$&&W&&(f=p??W),!$s(e,P,C)||!S(P)?"discard":(!$&&W&&(p=void 0),N(H,O.revision===y,P),S(P)?"accepted":"discard")},L=(P,C,O)=>{var E;const R=Xn(e,P,C,O),W=te(e),j=(W&&((E=Pe(e,W))==null?void 0:E.birth))??f;return!S(P)||!R||R.documentId!==r||j&&(!R.incarnation||!I(j,R.incarnation))?!1:Qs(e,P,C,O)},Z=(P,C)=>{const O=Object.freeze({});ar.set(O,Object.freeze({owner:e,revision:y,observation:v,epoch:l,notification:P,mode:C}));try{return js(e,O)}finally{ar.delete(O)}},Q=P=>{if(o||!h()||(o=!0,D(we(r,t)),!h()))return;const C=wi(void 0,O=>{if(!h()||O.documentId!==r)return;const R=O.type==="canvas_channel_snapshot"?O.snapshot.incarnation:O.incarnation,W=te(e);if(!W){if(f&&!p&&(!R||!I(f,R))||!R||R.documentId!==r)return;if(!p||!I(p,R)){const j=!!p||!!f;if(p=Object.freeze({...R}),v++,u=void 0,c=void 0,d=!1,j&&(_(!0),D(we(r,t))),!h()||!p||!I(p,R))return}Z(O,"quarantine"),h()&&P();return}if(f&&(!R||!I(f,R))){R&&P();return}if(R&&!I(Pe(e,W).birth,R)){f=R,d=!1,u=void 0,c=void 0,_(!0),D(we(r,t)),h()&&P();return}if(R){if(c!==void 0&&c!==O.scope){const j=rt(e);if(c=O.scope,Vt(e,W),l++,i=void 0,y++,nt(e,j),te(e)!==W||!h())return;D(E=>({...E,available:!1})),te(e)===W&&h()&&P();return}c=O.scope,y++,O.type==="canvas_channel_snapshot"?N(O.snapshot,!0):O.docSeq>k().highest+1?(Z(O,"gap")&&h()&&D(E=>({...E,available:!1})),h()&&P()):Z(O,"event")}},t,()=>{if(!h())return;const O=rt(e),R=te(e);R&&Vt(e,R),l++,i=void 0,y++,nt(e,O),D(W=>({...W,available:!1})),h()&&P()});h()?a=C:C(),h()&&P()};return Zn.set(e,P=>{const C=ht(e,P);if(!C||C.notification.type==="canvas_channel_snapshot")return;const O=te(e),R=l;!O||!C.notification.incarnation||!I(Pe(e,O).birth,C.notification.incarnation)||(D(W=>Ln(W,C.notification,r,t)),!h()||R!==l||te(e))}),{facts:()=>Object.freeze({documentId:r,live:h(),epoch:l,revision:y,observation:v,subject:te(e)}),transport:()=>t,subject:()=>te(e),subjectFacts:P=>Pe(e,P),subjectCurrent:(P,C)=>at(e,P,C),binding:P=>Wn(e,P),qualified:()=>f===void 0,projection:()=>({documentId:r,transport:t,dispatch:n,epoch:l,run:i,subject:te(e)}),projectionCurrent:(P,C,O)=>h()&&P===l&&C===te(e)&&(!O||i===O),abortAdmission:(P,C)=>{Bn(e,P,C)&&_(!0)},reserve:P=>{const C=Vr(e,P);if(!C||C.ended||!h()||C.epoch!==l||C.subject!==te(e))throw new Error("Replay run is foreign or stale.");i=P},current:S,admit:Y,frame:L,qualify:X,failed:P=>{if(!S(P))return;const C=te(e);C&&Vt(e,C),D(O=>({...O,available:!1}),P)},unavailable:P=>{S(P)&&D(C=>({...C,available:!1}),P)},start:Q,dispose:()=>{if(!h())return;const P=rt(e);s.live=!1,i=void 0;const C=a;a=void 0,b(),l++,Zr(e);try{nt(e,P)}finally{C==null||C()}}}}function ht(e,r){const t=ar.get(r),n=he(e);if(!(!t||t.owner!==e||!n.live||n.epoch!==t.epoch||n.revision!==t.revision||n.observation!==t.observation))return t}function fl(e,r){var s;const t=ht(e,r);if(!t||t.notification.type==="canvas_channel_snapshot")return;const n=t.notification,o=he(e).subject,a=o&&Pe(e,o);!a||!n.incarnation||!I(a.birth,n.incarnation)||n.docSeq<=mr(e).highest||(As(e,r),!(!ht(e,r)||he(e).subject!==o)&&((s=Zn.get(e))==null||s(r)))}const Zn=new WeakMap;function pl(e,r,t){const n=tl(e,r,t);ks(n);const i=Ls(n);return Object.freeze({beginRun:()=>Os(n),frameAdmission:i,start:o=>sl(n,o),dispose:()=>ll(n)})}function hl(e,r){let t,n=0;const i=d=>{try{r==null||r(d)}catch{}},o=d=>{t===d&&(t=void 0)},a=(d,f)=>{d.settled||(d.settled=!0,t||i(!1),f?d.reject(f.cause):d.resolve())},s=()=>{u().catch(()=>{})},l=(d,f)=>{const p=()=>n===d.revision;if(!p())return;const v=f.beginFinalization();if(p()){if(v==="restart"){s();return}if(v==="drain")for(;p();){const h=f.drainOne();if(!p())return;if(h!=="again"){if(h==="restart")s();else if(h==="tail"){const b=f.finishFinalization();p()&&b==="restart"&&s()}return}}}},c=async d=>{let f,p;try{f=e();try{for(;await f.page()==="again";);}catch(v){f.failed(v)}}catch(v){p={cause:v}}finally{o(d);try{f&&l(d,f)}catch(v){p={cause:v}}finally{a(d,p)}}},u=()=>{if(t)return t.promise;let d,f;const p=new Promise((h,b)=>{d=h,f=b}),v={revision:++n,promise:p,resolve:d,reject:f,settled:!1};return t=v,i(!0),c(v),p};return Object.freeze({request:u})}function vl(e,r,t,n){const i=pl(e,r,t);let o=!1;const a=hl(()=>{const s=i.beginRun();return{async page(){const l=await s.readPage();if(!l)return"done";const c=s.consumePage(l);if(c.kind!=="frames")return c.kind;for(let u=0;u<c.count;u++)if(!s.advancePageFrame(l,u))return"done";return s.finishPage(l)},failed:()=>s.failed(),beginFinalization:()=>{const l=s.beginFinalization();return l!=="drain"&&s.end(),l},drainOne(){if(!s.current())return s.end(),"stop";const l=s.takePending();return l?s.advancePending(l)?"again":(s.end(),"stop"):"tail"},finishFinalization:()=>{try{return s.finishFinalization()}finally{s.end()}}}},s=>{o||n==null||n(s)});return i.start(()=>{a.request().catch(()=>{})}),Object.freeze({dispose(){o=!0,i.dispose()}})}function ml(e){var c,u,d;const r=ve(),[t,n]=g.useState(()=>we(e,r)),[i,o]=g.useState({documentId:e,transport:r,pending:!0});g.useLayoutEffect(()=>{const f=vl(e,r,n,p=>{o({documentId:e,transport:r,pending:p})});return()=>f.dispose()},[e,r]);const a=t.documentId===e&&t.transport===r?t:we(e,r),s=g.useMemo(()=>qs(a),[a]),l=g.useMemo(()=>{var v;const f=(v=a.snapshot)==null?void 0:v.incarnation,p=a.binding;return f&&p?Object.freeze({incarnation:Object.freeze({...f}),current:()=>p.current("read")}):void 0},[(c=a.snapshot)==null?void 0:c.incarnation,a.binding]);return{channel:s,events:a.events,frameAdmission:a.frameAdmission,fileSaveBinding:l,fileSaveObservation:i.documentId!==e||i.transport!==r||i.pending?"pending":a.available&&((u=a.binding)!=null&&u.verified)&&((d=a.snapshot)!=null&&d.incarnation)?"ready":"unavailable"}}function gl({content:e}){const[r]=lr();return r?m.jsx("div",{className:"h-full w-full",children:m.jsx(Pi,{sessionId:r,serverName:e.serverName,uri:e.uri,title:e.title})}):null}const bl=g.lazy(()=>ze(()=>import("./CanvasFileContent-BJ39nHuR.js"),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasFileContent}))),wl=g.lazy(()=>ze(()=>import("./CanvasModel3dContent-TaunlbT2.js"),__vite__mapDeps([20,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasModel3dContent}))),yl=g.lazy(()=>ze(()=>import("./CanvasCsvContent-D697P3sa.js"),__vite__mapDeps([21,1,2,22,6,7,8,9,10,11,12,13,14,15,16,17,18,19])).then(e=>({default:e.CanvasCsvContent}))),Cl=g.lazy(()=>ze(()=>import("./index-C8-dwIPp.js").then(e=>e.u9),__vite__mapDeps([1,2])).then(e=>({default:e.CanvasDiffContent})));function Yl({documentId:e,widgetChannel:r,content:t,onContentChange:n}){switch(t.type){case"url":case"browser":return m.jsx(ao,{documentId:e,content:t},`${e}:${t.url}`);case"markdown":return m.jsx(ko,{documentId:e,content:t,onContentChange:n},t.sourcePath??"generated");case"json":return m.jsx(Po,{content:t});case"image":return m.jsx(hs,{content:t});case"pdf":return m.jsx(ms,{content:t});case"audio":return m.jsx(ws,{content:t});case"video":return m.jsx(ys,{content:t});case"widget":return r?m.jsx(Mn,{content:t,documentId:e,channel:r}):m.jsx(Sl,{documentId:e,content:t});case"mcp_app":return m.jsx(gl,{content:t});case"file":return m.jsx(g.Suspense,{fallback:m.jsx(St,{}),children:m.jsx(bl,{documentId:e,content:t})});case"model3d":return m.jsx(g.Suspense,{fallback:m.jsx(St,{}),children:m.jsx(wl,{content:t})});case"csv":return m.jsx(g.Suspense,{fallback:m.jsx(St,{}),children:m.jsx(yl,{content:t})});case"diff":return m.jsx(g.Suspense,{fallback:m.jsx(St,{}),children:m.jsx(Cl,{documentId:e,content:t},t.sourcePath)})}}function St(){return m.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"})}function Sl({documentId:e,content:r}){const{channel:t}=ml(e);return m.jsx(Mn,{documentId:e,content:r,channel:t})}const kl=g.lazy(()=>ze(()=>import("./BlintzCanvas-DUDSNxlM.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.BlintzCanvas})));function Xl({roomId:e,document:r,content:t,onSave:n}){const[i,o]=g.useState(null),[a,s]=g.useState(!1),[l,c]=g.useState(null),u=i!==null,d=t.sourcePath===void 0;Ui(e,u?r.id:null);const f=async()=>{if(i===null)return;if(i===t.content){o(null),c(null);return}s(!0),c(null);const p=await n(r.id,{...t,content:i});s(!1),p?o(null):c("Couldn’t save. Your words are still here. Try again.")};return m.jsxs("div",{className:"flex h-full flex-col",children:[d&&m.jsxs("div",{className:"flex items-center justify-end gap-2 border-b px-2 py-1",children:[u&&m.jsx("span",{className:"text-muted-foreground text-xs",children:a?"Saving…":"Everyone sees your save."}),m.jsx(kt,{type:"button",size:"xs",variant:"ghost",disabled:a,"aria-label":u?"Save for the room":"Edit this document",onClick:()=>u?void f():o(t.content),children:u?m.jsx(en,{className:"size-3.5"}):m.jsx(tn,{className:"size-3.5"})})]}),l!==null&&m.jsx("p",{role:"status",className:"text-destructive border-b px-2 py-1 text-xs",children:l}),m.jsx("div",{className:"flex-1 px-2 pb-6",children:m.jsx(g.Suspense,{fallback:m.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading…"}),children:m.jsx(kl,{value:i??t.content,editable:u,onChange:o},u?"editing":`rev-${r.rev}`)})})]})}const sr="dorkos-canvas-sessions",Pl=1440*60*60*1e3;function Vn(){try{const e=localStorage.getItem(sr);if(!e)return null;const r=JSON.parse(e);return r===null||typeof r!="object"?null:r}catch{return null}}function Gn(e){try{Object.keys(e).length===0?localStorage.removeItem(sr):localStorage.setItem(sr,JSON.stringify(e))}catch{}}function El(e){return Array.isArray(e.documents)?[...e.documents].sort((r,t)=>(r.openedAt??0)-(t.openedAt??0)).map(r=>r.content).filter(r=>!!r):e.content?[e.content]:[]}function At(e){return e===null||typeof e!="object"?JSON.stringify(e)??"null":Array.isArray(e)?`[${e.map(At).join(",")}]`:`{${Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[n])=>t<n?-1:t>n?1:0).map(([t,n])=>`${JSON.stringify(t)}:${At(n)}`).join(",")}}`}function Tl(e,r){const t=new Set,n=new Map;for(const o of e){const a=Or(o.content);if(a!==null){t.add(a);continue}const s=At(o.content);n.set(s,(n.get(s)??0)+1)}const i=[];for(const o of r){const a=Or(o);if(a!==null){t.has(a)||i.push(o);continue}const s=At(o),l=n.get(s)??0;l>0?n.set(s,l-1):i.push(o)}return i}const Pt=new Set;function Wl(){Pt.clear()}function Ll(e,r={}){const t=ve(),n=r.canonical??!0;g.useEffect(()=>{e&&ee.getState().loadCanvasForSession(e)},[e]),g.useEffect(()=>{if(!e||!n||Pt.has(e))return;const i=Vn();if(!i)return;const o=i[e];if(!o){_l(i);return}Pt.add(e),(async()=>{try{const a=El(o),s=Tl(await t.listSessionCanvas(e),a);if(s.length===0){Qr(e);return}for(const l of s)await t.openSessionCanvasDocument(e,l);Qr(e),ee.getState().hydrateCanvasFromSnapshot(e,await t.listSessionCanvas(e))}catch{Pt.delete(e)}})()},[e,n,t])}function Qr(e){const r=Vn();if(!r)return;const{[e]:t,...n}=r;Gn(n)}function _l(e){const r=Date.now()-Pl,t=Object.entries(e).filter(([,n])=>n.accessedAt===void 0||n.accessedAt>=r);t.length!==Object.keys(e).length&&Gn(Object.fromEntries(t))}export{Yl as C,Nl as F,Xl as R,ml as a,Hi as b,qi as c,Ml as d,Mn as e,Wl as f,Fi as g,Ll as h,Nn as r,wo as u};