dorkos 0.121.0 → 0.123.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 (309) hide show
  1. package/dist/bin/cli.js +532 -373
  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-CtI8gbER.js → AboutPage-BmtoPqP9.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-CHTXfBS7.js → ActivityErrorState-CEzdFJiR.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-B8p4yYJL.js → ActivityPage-mFYgTr3e.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-CSuSz-92.js → ActivityRow-Bkc0kkim.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Qnxn0cE5.js → AdapterIcon-DVgTrgnM.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-BG8H-Lld.js → AdapterSetupWizard-I03EluU5.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-BWFQFynn.js → AgentOptionRow-DI1TzLaR.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CL93SET3.js → AgentPicker-CBYeBzjf.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CamX7Tvr.js → AgentRequestCard-DQ6GYoeE.js} +3 -3
  13. package/dist/client/assets/{AppearancePage-rN70_7ih.js → AppearancePage-62xIPNPn.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-DeWaXbgm.js → ApplyToOverridesDialog-CrqkeHQb.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-CKcSWExi.js → AttentionSignalRow-Coe5pYX6.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BwYaLf2P.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-D07cg75s.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DqPDLYbF.js → BindingDialog-DVyxVXZM.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-DoAZs5bz.js → BlintzCanvas-BmfkiUQJ.js} +3 -3
  19. package/dist/client/assets/{BlintzCanvas-xZ3u3nk7.css → BlintzCanvas-DCXOV_yN.css} +1 -1
  20. package/dist/client/assets/{CanvasCsvContent-ViqRJuhW.js → CanvasCsvContent-CRTr-AI7.js} +2 -2
  21. package/dist/client/assets/CanvasFileContent-rOmY1s3T.js +2 -0
  22. package/dist/client/assets/CanvasModel3dContent-D7oRT6ey.js +2 -0
  23. package/dist/client/assets/{ChatAppsOff-D0PbHYqF.js → ChatAppsOff-BmuOTq83.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-DFNSXeuV.js → CodeMirrorDiff-DidSWwYJ.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-AgkgsSqN.js → CodeMirrorEditor-BUAWGbRo.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-0V6QivXH.js → CommitmentList-uK4CKaz0.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-i3XoHwBj.js → CommitmentsPage-BWITH1r2.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-RPoBc-km.js → ComputerResourceView-adgF_EZU.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-2ugaCd0H.js → ComputerViewer-D87LhxwL.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-DaPP4U96.js → ConnectionAccessLists-BFEFqcSZ.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-BVqYvfk5.js → ConnectionsPage-Cd_cLoSY.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-BoqncrFd.js → ConventionPage-BSztD-gU.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-BrOEeNX3.js → ExtensionPageRoute-BSge6XRv.js} +1 -1
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DLwix3K7.js → FloatingTanStackRouterDevtools-CqogiFob-TO2CUPG0.js} +1 -1
  35. package/dist/client/assets/HandlePage-BKiqymRF.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-DgXhbaBJ.js → HeartbeatPage-DIJzdOhj.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-CRr32Ae5.js → KeyEntry-DJnzW3Mu.js} +1 -1
  38. package/dist/client/assets/{LexicalField-DeAoA6yr.js → LexicalField-BxzNvIjJ.js} +1 -1
  39. package/dist/client/assets/{ManagesPage-ZBWYLTZx.js → ManagesPage-BQj8KbYA.js} +1 -1
  40. package/dist/client/assets/{Marketplace-iL5p8Omt.js → Marketplace-CIG5_a_H.js} +4 -4
  41. package/dist/client/assets/{MarketplaceSourcesView-CsNLVOdP.js → MarketplaceSourcesView-16HKvFK-.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-B1WPswgk.js → McpAppFrame-5xlga1jD.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-CJ28yu0o.js → McpSigninBody-COIHpHq_.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BIZWdK8g.js → Model3dViewer-CQ0sA_kr.js} +1 -1
  45. package/dist/client/assets/NamePage-D7W6VMYd.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-DRx9e9kM.js → NewDirectMessageMenu-D092y0K9.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-cfqgSuVy.js → NotificationsPage-CskOPdhh.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-BIIuKDku.js → OpenMeshSwitch-BHRm328L.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-BKUSGrs6.js → OperatorIdentityForm-C3op6BIC.js} +1 -1
  50. package/dist/client/assets/{PermissionHistory-Ctdqhib6.js → PermissionHistory-CKebTVkq.js} +1 -1
  51. package/dist/client/assets/{PermissionsPage-CYA_zdrV.js → PermissionsPage-XuPOSYll.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BR4Cpr2C.js → PersonalityPopover-BrZjxakx.js} +1 -1
  53. package/dist/client/assets/PhotoPage-Ch1at4A6.js +1 -0
  54. package/dist/client/assets/{PreviewRefusedNotice-D1Tl265t.js → PreviewRefusedNotice-BANdpT9O.js} +1 -1
  55. package/dist/client/assets/{ProfileFields-T3vVbHRC.js → ProfileFields-Dp68ebW9.js} +1 -1
  56. package/dist/client/assets/{ProfilePanelContainer-CParzTPA.js → ProfilePanelContainer-BKwGdI90.js} +1 -1
  57. package/dist/client/assets/{ProfileRolePicker-BU4eiMKn.js → ProfileRolePicker-ClOdfLda.js} +1 -1
  58. package/dist/client/assets/{PromptSuggestionChips-CGNQc2Tf.js → PromptSuggestionChips-zcW4UJ_O.js} +1 -1
  59. package/dist/client/assets/{ReportsToPopover-Dj5U_Ppi.js → ReportsToPopover-BwDVGqFg.js} +1 -1
  60. package/dist/client/assets/RoomSurface-CSKIvyHH.js +44 -0
  61. package/dist/client/assets/{RoomsPage-Cvs3h6f0.js → RoomsPage-CAvrRbPk.js} +1 -1
  62. package/dist/client/assets/{RunsOnPopover-BUlYwRW4.js → RunsOnPopover-CQ4t9EZ-.js} +1 -1
  63. package/dist/client/assets/{RuntimeConnectFlow-ChrvjC84.js → RuntimeConnectFlow--fVpIf0B.js} +1 -1
  64. package/dist/client/assets/{RuntimeSetupDialog-BK9yo7YF.js → RuntimeSetupDialog-COpyPrqL.js} +1 -1
  65. package/dist/client/assets/SeenDevices-BPw3UgjX.js +19 -0
  66. package/dist/client/assets/{SessionsPage-CWUwU3US.js → SessionsPage-FDyYzuXs.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-BApzy0J8.js → SettingsDialog-Bdws5dbS.js} +4 -4
  68. package/dist/client/assets/{SkillsPage-z3XnApNX.js → SkillsPage-PLXEY0LB.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-BEWUpAlk.js → TaskDialogWrapper-CTcW70s8.js} +1 -1
  70. package/dist/client/assets/{TasksEmptyState-CLwpLnIO.js → TasksEmptyState-8RZxhRh6.js} +1 -1
  71. package/dist/client/assets/{TasksPage-CyHjr9OZ.js → TasksPage-C-EtQXKb.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-BHHIofx3.js → TeamComputerEntry-qx_19Htj.js} +1 -1
  73. package/dist/client/assets/{ToolsPage-CckCco8x.js → ToolsPage-D5-fx1EA.js} +1 -1
  74. package/dist/client/assets/{TopologyGraph-Dox7aWP3.js → TopologyGraph-1wtG1BE9.js} +1 -1
  75. package/dist/client/assets/{TourHost-CTBewD-a.js → TourHost-C664E8OY.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-CFRgExId.js → UnlinkDialog-Di1oBFA_.js} +1 -1
  77. package/dist/client/assets/{WidgetErrorCard-Dx5oPMlF.js → WidgetErrorCard-BfgGzyqg.js} +1 -1
  78. package/dist/client/assets/_shell-BLTSXXDw.js +80 -0
  79. package/dist/client/assets/{_shell._home-DnBkgWs4.js → _shell._home-Hz78BY6-.js} +1 -1
  80. package/dist/client/assets/{_shell._home.activity-CVCC-EEI.js → _shell._home.activity-BxvI0gkw.js} +1 -1
  81. package/dist/client/assets/{_shell._home.index-Ck6jxwIx.js → _shell._home.index-Cqq81f3P.js} +1 -1
  82. package/dist/client/assets/{_shell._home.tasks-B7QQAZnA.js → _shell._home.tasks-Cth56CwC.js} +1 -1
  83. package/dist/client/assets/{_shell._home.workspaces-DlrRd9tv.js → _shell._home.workspaces-DkoOJSWz.js} +1 -1
  84. package/dist/client/assets/{_shell.channels-CiWehoyl.js → _shell.channels-D_GQU4RB.js} +4 -4
  85. package/dist/client/assets/{_shell.connections-CGP5hZHq.js → _shell.connections-DZrlxs4G.js} +1 -1
  86. package/dist/client/assets/{_shell.feedback-requests-BxxNvw6j.js → _shell.feedback-requests-BTxHdsfb.js} +1 -1
  87. package/dist/client/assets/_shell.marketplace-CZxkAmFz.js +1 -0
  88. package/dist/client/assets/_shell.marketplace_.sources-Q0BTQIuE.js +1 -0
  89. package/dist/client/assets/_shell.session-DvGL0DoX.js +63 -0
  90. package/dist/client/assets/{_shell.team-CsXH3NkS.js → _shell.team-ZxGwa39m.js} +3 -3
  91. package/dist/client/assets/_shell.x._extensionId-B6Tm5KuT.js +1 -0
  92. package/dist/client/assets/_shell.x._extensionId_._-B6Tm5KuT.js +1 -0
  93. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CMdkyiQ3.js → abnfDiagram-WEYOIA3C-CzqPVMdw.js} +1 -1
  94. package/dist/client/assets/{access-copy-CW-z1oMH.js → access-copy-Dj09Xk4b.js} +1 -1
  95. package/dist/client/assets/{arc-Bw7tftQk.js → arc-Bgy7ExYl.js} +1 -1
  96. package/dist/client/assets/{architectureDiagram-ZHVYKT53-BhpXALtX.js → architectureDiagram-ZHVYKT53-DYfb2p9r.js} +1 -1
  97. package/dist/client/assets/{banner-EomQNDOH.js → banner-dlsHTWSf.js} +1 -1
  98. package/dist/client/assets/{blockDiagram-RJAE7QA3-Bxk_BuZv.js → blockDiagram-RJAE7QA3-BkOzLL8s.js} +1 -1
  99. package/dist/client/assets/{c4Diagram-XDPPPE54-CYN0FwR8.js → c4Diagram-XDPPPE54-CsZm4qpD.js} +1 -1
  100. package/dist/client/assets/{card-ww4ebz8h.js → card-Dj6ZfRgu.js} +1 -1
  101. package/dist/client/assets/channel-CGffcDRq.js +1 -0
  102. package/dist/client/assets/{chunk-2E7WHVMD-IPDvYcPa.js → chunk-2E7WHVMD-GA96Jfps.js} +1 -1
  103. package/dist/client/assets/{chunk-2Q5K7J3B-DZ5bU5Ax.js → chunk-2Q5K7J3B-CW2i0IkT.js} +1 -1
  104. package/dist/client/assets/{chunk-4EMNKR2T-DrsWxa6Y.js → chunk-4EMNKR2T-BwFvnPZg.js} +1 -1
  105. package/dist/client/assets/{chunk-55XCU76K-CiBbKG0b.js → chunk-55XCU76K-MOezzAAB.js} +1 -1
  106. package/dist/client/assets/{chunk-5VM5RSS4-B3K3MUav.js → chunk-5VM5RSS4-woru6zOC.js} +1 -1
  107. package/dist/client/assets/{chunk-JWPE2WC7-CjV5RcIh.js → chunk-JWPE2WC7-CUrKlP2M.js} +1 -1
  108. package/dist/client/assets/{chunk-VQ5W62QI-CWoRr0H2.js → chunk-VQ5W62QI-CqZ2cdEu.js} +1 -1
  109. package/dist/client/assets/{chunk-XXDRQBXY-E0nvzXiG.js → chunk-XXDRQBXY-ByAcvWaE.js} +1 -1
  110. package/dist/client/assets/{chunk-ZCHMQSOR-DFop6Lvt.js → chunk-ZCHMQSOR-3nkba9kj.js} +2 -2
  111. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-B7JJfc9z.js → classDiagram-v2-4MYWR3UA-B-zZKAmI.js} +1 -1
  112. package/dist/client/assets/{command-D4fLpJxA.js → command-BAOEURY7.js} +1 -1
  113. package/dist/client/assets/{cose-bilkent-JH36ORCC-BjNppl29.js → cose-bilkent-JH36ORCC-sCKxRv1H.js} +1 -1
  114. package/dist/client/assets/{cpu-DCe0Yyml.js → cpu-TtYQqONc.js} +1 -1
  115. package/dist/client/assets/{cynefin-EF2NZ3EQ-PmRntJwW.js → cynefin-EF2NZ3EQ-CXzvL5Cg.js} +1 -1
  116. package/dist/client/assets/{cynefinDiagram-WF24UDRP-Ctdbp_Vg.js → cynefinDiagram-WF24UDRP-C0wjhu9X.js} +1 -1
  117. package/dist/client/assets/{dagre-NK4GIZVX-5tvLY2ZW.js → dagre-NK4GIZVX-Doi2IPkY.js} +1 -1
  118. package/dist/client/assets/{diagram-CBK3MWTC-DZO-XBOO.js → diagram-CBK3MWTC-11TVuPel.js} +1 -1
  119. package/dist/client/assets/{diagram-I5XIIV2D-CWBbA1Pv.js → diagram-I5XIIV2D-CJq7fHFM.js} +1 -1
  120. package/dist/client/assets/{diagram-ODIL2UCW-hP5A1tGl.js → diagram-ODIL2UCW-2Ae6unuU.js} +1 -1
  121. package/dist/client/assets/{diagram-PFBEJUXE-EI_-RoN7.js → diagram-PFBEJUXE-BXza6_iz.js} +1 -1
  122. package/dist/client/assets/{diagram-RJA3I4VV-TrYq9A4Z.js → diagram-RJA3I4VV-Z0i3uBW9.js} +1 -1
  123. package/dist/client/assets/{diagram-TYUNFSNR-BAQq2OM5.js → diagram-TYUNFSNR-Dq_-g1oP.js} +1 -1
  124. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-cKbeW9dQ.js → ebnfDiagram-V4P3TTPT-vxzIvg-W.js} +1 -1
  125. package/dist/client/assets/{elk-QONTBCTQ-wpfNPp0q.js → elk-QONTBCTQ-BBIXXtg_.js} +1 -1
  126. package/dist/client/assets/{empty-state-DXWQsHMf.js → empty-state-kISAAp0z.js} +1 -1
  127. package/dist/client/assets/{erDiagram-KYQIGQAA-Dk0OrvjE.js → erDiagram-KYQIGQAA-Bk2MeLBx.js} +1 -1
  128. package/dist/client/assets/{execution-config-CAyT2Qoo.js → execution-config-DYFe-VNC.js} +1 -1
  129. package/dist/client/assets/{file-Bf7D_47y.js → file-DEt4KgZG.js} +1 -1
  130. package/dist/client/assets/{file-exclamation-point-DZXE9_8o.js → file-exclamation-point-QqXJhXD9.js} +1 -1
  131. package/dist/client/assets/{file-text-C1ougnBY.js → file-text-CRw31ZWd.js} +1 -1
  132. package/dist/client/assets/{find-latest-widget-fence-B1_-pC-Z.js → find-latest-widget-fence-B3aaiBNI.js} +1 -1
  133. package/dist/client/assets/{flowDiagram-IUGLLWBU-CdlOoRZV.js → flowDiagram-IUGLLWBU-B53m4r8u.js} +1 -1
  134. package/dist/client/assets/{form-D7kF-U0d.js → form-Bjhk9zOn.js} +1 -1
  135. package/dist/client/assets/{format-cron-ZtliseYi.js → format-cron-9tmNIcgl.js} +1 -1
  136. package/dist/client/assets/{ganttDiagram-R7GPNTJY-x0MJLv5d.js → ganttDiagram-R7GPNTJY-CS6TN3R1.js} +1 -1
  137. package/dist/client/assets/{git-branch-B2k77X3Q.js → git-branch-DWerghmw.js} +1 -1
  138. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-CruCvk7w.js → gitGraphDiagram-PDYL7XHY-D096ZtqE.js} +1 -1
  139. package/dist/client/assets/{graph-5PBe05F8.js → graph-DQpTuPmX.js} +1 -1
  140. package/dist/client/assets/{heart-CmqGJPDc.js → heart-CRkjVW7-.js} +1 -1
  141. package/dist/client/assets/{highlighted-body-KPVGNVTW-Bqu2cQDj.js → highlighted-body-KPVGNVTW-DoVCXOMU.js} +1 -1
  142. package/dist/client/assets/{image-lightbox-BBbz-ThL.js → image-lightbox-BXzbN27o.js} +1 -1
  143. package/dist/client/assets/{image-off-BCtWIY4q.js → image-off-VyMBVwgK.js} +1 -1
  144. package/dist/client/assets/{index-8IAr9b71.js → index-1qv8ldHx.js} +1 -1
  145. package/dist/client/assets/{index-ClBIPuLA.js → index-2EaVZrJe.js} +1 -1
  146. package/dist/client/assets/{index-DcZPWi_I.js → index-8-iQ6PnT.js} +252 -247
  147. package/dist/client/assets/{index-CJ5v2_Cz.js → index-B2rBVMNl.js} +1 -1
  148. package/dist/client/assets/{index-BpmmNapD.js → index-BBcAekWE.js} +1 -1
  149. package/dist/client/assets/index-BFitbVs4.js +1 -0
  150. package/dist/client/assets/{index-xmk9Ohv9.js → index-BLkXoquZ.js} +1 -1
  151. package/dist/client/assets/{index-xaMF1mrN.js → index-BcFMs7lK.js} +1 -1
  152. package/dist/client/assets/{index-EdJm7ZN-.js → index-BiFJIg4n.js} +1 -1
  153. package/dist/client/assets/{index-BuGQxHrf.js → index-BpjEclkM.js} +1 -1
  154. package/dist/client/assets/{index-CtycM8wY.js → index-C24HfJir.js} +1 -1
  155. package/dist/client/assets/{index-DAdo_yIq.js → index-C3sW6rkN.js} +1 -1
  156. package/dist/client/assets/{index-JxeBJIuE.js → index-C6Fo2htT.js} +1 -1
  157. package/dist/client/assets/{index-B5rRtvWx.js → index-C6udJCgz.js} +1 -1
  158. package/dist/client/assets/{index-ChwNEkM8.js → index-CDuYKaGY.js} +1 -1
  159. package/dist/client/assets/{index-Cml5572f.js → index-CEVwhauU.js} +1 -1
  160. package/dist/client/assets/index-CI84yP-g.js +1 -0
  161. package/dist/client/assets/{index-BzPgsdPn.js → index-COMRALJO.js} +1 -1
  162. package/dist/client/assets/index-CiVeycsn.js +17 -0
  163. package/dist/client/assets/{index-BXZlDqvy.js → index-Cs3WB8yn.js} +1 -1
  164. package/dist/client/assets/{index-BrQGZ6iF.js → index-Csr_C1sk.js} +1 -1
  165. package/dist/client/assets/{index-CMNc_OrC.js → index-Ctqe81qr.js} +1 -1
  166. package/dist/client/assets/{index-Dmn03xST.js → index-CvhR1oZB.js} +1 -1
  167. package/dist/client/assets/{index-B6dEbNhI.js → index-CyGRWyhV.js} +1 -1
  168. package/dist/client/assets/{index-mFOJXyAE.js → index-Czm6C7FZ.js} +3 -3
  169. package/dist/client/assets/{index-1ShgR_xt.js → index-D5zUdnZM.js} +1 -1
  170. package/dist/client/assets/{index-Cv0GsC4n.js → index-DBo2XfNv.js} +1 -1
  171. package/dist/client/assets/{index-DIxzqCwG.js → index-DKWpwwxo.js} +1 -1
  172. package/dist/client/assets/{index-BXMxoWrk.js → index-DN2sTT2U.js} +1 -1
  173. package/dist/client/assets/index-DNzk9m1D.js +23 -0
  174. package/dist/client/assets/{index-CrflCTqO.css → index-DUZrTFYD.css} +1 -1
  175. package/dist/client/assets/{index-t4Ud6YTX.js → index-DX_2Mxwv.js} +1 -1
  176. package/dist/client/assets/{index-C11Ssk2u.js → index-Dgrk2udV.js} +2 -2
  177. package/dist/client/assets/{index-BCk4wW-T.js → index-DgyhdQnI.js} +1 -1
  178. package/dist/client/assets/{index-CQ0VLZf-.js → index-DmFNztTX.js} +1 -1
  179. package/dist/client/assets/{index-rWZWP3Wh.js → index-TnoaFCrj.js} +1 -1
  180. package/dist/client/assets/{index-DbDI5BAA.js → index-_emDKzsu.js} +1 -1
  181. package/dist/client/assets/{index-BIIH5CXj.js → index-b9p_y2Ql.js} +1 -1
  182. package/dist/client/assets/{index-yI1r4pSP.js → index-gIQ7FrL9.js} +1 -1
  183. package/dist/client/assets/{index-DsJWzmWw.js → index-igLqtuoO.js} +1 -1
  184. package/dist/client/assets/{index-Do6eeFps.js → index-n3-zWcH-.js} +2 -2
  185. package/dist/client/assets/{index-8TfzCkKR.js → index-rCvQat0D.js} +1 -1
  186. package/dist/client/assets/{index-BfRW2WTx.js → index-setKr4xl.js} +1 -1
  187. package/dist/client/assets/{index-DrA03bMq.js → index-t3eRSGcT.js} +1 -1
  188. package/dist/client/assets/{index.esm-CZZtbPRj.js → index.esm-bLeQzVWT.js} +1 -1
  189. package/dist/client/assets/{infoDiagram-MVDRKAX5-Bj9DD77n.js → infoDiagram-MVDRKAX5-nN_N76Fn.js} +1 -1
  190. package/dist/client/assets/{inline-code-g9PVHZI2.js → inline-code-D9bLKHjY.js} +1 -1
  191. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DckI6dhS.js → ishikawaDiagram-HPEHV2GE-CiLFbWXd.js} +1 -1
  192. package/dist/client/assets/{journeyDiagram-BOSHW7O7-Ce1GAVa0.js → journeyDiagram-BOSHW7O7-Dn3yOv96.js} +1 -1
  193. package/dist/client/assets/{kanban-definition-FNSA4HC5-Kq5O9rZa.js → kanban-definition-FNSA4HC5-JxiBdBQC.js} +1 -1
  194. package/dist/client/assets/{layers-D3lEdRF0.js → layers-DTnLoRvE.js} +1 -1
  195. package/dist/client/assets/{lightbulb-BFE-KkFU.js → lightbulb-CRKLr5q3.js} +1 -1
  196. package/dist/client/assets/{link-2-Dvb6g-2Q.js → link-2-hgHg-lyw.js} +1 -1
  197. package/dist/client/assets/{list-runtime-types-8YGEK3Al.js → list-runtime-types-Bb33QiMC.js} +1 -1
  198. package/dist/client/assets/{markdown-content-Cqq_QMXA.js → markdown-content-D0FpU2cz.js} +1 -1
  199. package/dist/client/assets/{mention-pill-Bnzt4u2l.js → mention-pill-uuaUvwSW.js} +1 -1
  200. package/dist/client/assets/{mermaid.core-dpp59v7L.js → mermaid.core-x3Hh6iut.js} +4 -4
  201. package/dist/client/assets/{message-square-off-BX2XnEDx.js → message-square-off-B8N6YF9R.js} +1 -1
  202. package/dist/client/assets/{mindmap-definition-6OY57UG3-CFdfJO6g.js → mindmap-definition-6OY57UG3-D0SEv5Re.js} +1 -1
  203. package/dist/client/assets/{more-details-B4lBMpKi.js → more-details-CadxnGyH.js} +1 -1
  204. package/dist/client/assets/{owner-notice-ByjrIRmX.js → owner-notice-CJHyha58.js} +1 -1
  205. package/dist/client/assets/{package-6Rbxg35g.js → package-B8G7jQm-.js} +1 -1
  206. package/dist/client/assets/{page-container-DoZzad36.js → page-container-Bb-_N7lw.js} +1 -1
  207. package/dist/client/assets/{paperclip-B-jDXtxw.js → paperclip-BDeYGKqh.js} +1 -1
  208. package/dist/client/assets/{path-input-DpqUD8hN.js → path-input-BIfexEKz.js} +1 -1
  209. package/dist/client/assets/{pegDiagram-ECIUJNBX-eVnSw2Ma.js → pegDiagram-ECIUJNBX-7ivMd0-b.js} +1 -1
  210. package/dist/client/assets/{pieDiagram-GNMPY74T-BYG7LY5Q.js → pieDiagram-GNMPY74T-DGDkbFvu.js} +1 -1
  211. package/dist/client/assets/{plug-DnaAhcy4.js → plug-wP1d6OUX.js} +1 -1
  212. package/dist/client/assets/{primer-trigger-Da5ECjY8.js → primer-trigger-CEli_z4n.js} +1 -1
  213. package/dist/client/assets/{profile-errors-GbTNc2-M.js → profile-errors-C1qSJkiG.js} +1 -1
  214. package/dist/client/assets/{progress-DlIRjXIA.js → progress-DmUieXLn.js} +1 -1
  215. package/dist/client/assets/{quadrantDiagram-D57K4MC3-CRgNKuHR.js → quadrantDiagram-D57K4MC3-AFQRVSsK.js} +1 -1
  216. package/dist/client/assets/{query-error-state-DB-Jby7_.js → query-error-state--8AnWSSn.js} +1 -1
  217. package/dist/client/assets/query-keys-DeYqUDia.js +1 -0
  218. package/dist/client/assets/{radio-CaaE60ws.js → radio-mkA-Sqe0.js} +1 -1
  219. package/dist/client/assets/{railroadDiagram-Y72NRBL7-DGL-Hqz9.js → railroadDiagram-Y72NRBL7-3QBa2d3j.js} +1 -1
  220. package/dist/client/assets/registry-Bnd-HFt3.js +1 -0
  221. package/dist/client/assets/{relay-trace-schemas-CcCqyOrA.js → relay-trace-schemas-fScydQ3A.js} +1 -1
  222. package/dist/client/assets/{requirementDiagram-EQYSW5RA-DKsFpU3l.js → requirementDiagram-EQYSW5RA-BVBqcASy.js} +1 -1
  223. package/dist/client/assets/{room-files-source-CbbVpvSW.js → room-files-source-BhkPUTiP.js} +1 -1
  224. package/dist/client/assets/{rotate-ccw-clock-CeY00nlZ.js → rotate-ccw-clock-DiuTseKz.js} +1 -1
  225. package/dist/client/assets/{rotate-cw-Djl5J_x9.js → rotate-cw-DvoxWwSx.js} +1 -1
  226. package/dist/client/assets/{sankeyDiagram-SY24JHO5-BFRkDxic.js → sankeyDiagram-SY24JHO5-DFjfOD38.js} +1 -1
  227. package/dist/client/assets/{scroll-area-BOqrziJf.js → scroll-area-DYyyRqW_.js} +1 -1
  228. package/dist/client/assets/{search-x-B_mHjnlo.js → search-x-CA-FzEqZ.js} +1 -1
  229. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-fHea3KOI.js → sequenceDiagram-BLEHNHQU-Cr9LzoSF.js} +1 -1
  230. package/dist/client/assets/{shield-check-Csnr5rFy.js → shield-check-CpUB_Ju1.js} +1 -1
  231. package/dist/client/assets/{shield-x-Dhl4YvvW.js → shield-x-B0W_7qwR.js} +1 -1
  232. package/dist/client/assets/{signed-in-BMqAss8c.js → signed-in-X2utDqQS.js} +1 -1
  233. package/dist/client/assets/{sizeCapture-INFHLROL-CztsD3qF.js → sizeCapture-INFHLROL-Do_jfNyT.js} +1 -1
  234. package/dist/client/assets/{soul-file-DOfamgB5.js → soul-file-DgfhKQIK.js} +1 -1
  235. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-CWyOqZ9S.js → stateDiagram-v2-A6IESKWZ-BCi9yk_0.js} +1 -1
  236. package/dist/client/assets/{swimlanes-B3ENRKFQ-0EfOxSAX.js → swimlanes-B3ENRKFQ-3SSAw2av.js} +1 -1
  237. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-jpZCGfva.js +8 -0
  238. package/dist/client/assets/{table-L7FvN6Or.js → table-DvU_oS4E.js} +1 -1
  239. package/dist/client/assets/{terminal-C9M5a_PS.js → terminal-Dw2QZ7Dh.js} +1 -1
  240. package/dist/client/assets/{timeline-definition-JXYKGLGB-sFyYvZ20.js → timeline-definition-JXYKGLGB-DTLPXTMA.js} +1 -1
  241. package/dist/client/assets/{trust-posture-dl6qwDtI.js → trust-posture-2MR0ap9o.js} +1 -1
  242. package/dist/client/assets/{unplug-CFUEVRbc.js → unplug-CAVOLB2R.js} +1 -1
  243. package/dist/client/assets/{unverified-catalog-notice-CdYU3WEJ.js → unverified-catalog-notice-u4ikVg8J.js} +1 -1
  244. package/dist/client/assets/{use-adapter-catalog-YTofdqDJ.js → use-adapter-catalog-BQKfRxXC.js} +1 -1
  245. package/dist/client/assets/{use-bindings-CpyT6kNu.js → use-bindings-BV6HA0MD.js} +1 -1
  246. package/dist/client/assets/{use-composer-prefs-CK_EK_QJ.js → use-composer-prefs-DCSzOnEO.js} +1 -1
  247. package/dist/client/assets/{use-connector-management-DwoK8kon.js → use-connector-management-fr1tx-GZ.js} +1 -1
  248. package/dist/client/assets/{use-deep-link-scroll-CgRjt48R.js → use-deep-link-scroll-v02TbidQ.js} +1 -1
  249. package/dist/client/assets/{use-delete-binding-CfsnMXrL.js → use-delete-binding-CnziYpXo.js} +1 -1
  250. package/dist/client/assets/{use-dev-links-B3I-ZK34.js → use-dev-links-k4YWFO1v.js} +1 -1
  251. package/dist/client/assets/{use-external-adapter-catalog-aGlZNRrp.js → use-external-adapter-catalog-DoGUfa2F.js} +1 -1
  252. package/dist/client/assets/{use-full-activity-feed-B61Olhdw.js → use-full-activity-feed-CQNxgxnw.js} +1 -1
  253. package/dist/client/assets/use-is-below-desktop-DR8FEbRW.js +1 -0
  254. package/dist/client/assets/use-is-hub-BmpgFnFp.js +1 -0
  255. package/dist/client/assets/{use-jump-back-in-C39GOTHa.js → use-jump-back-in-BuO6A0P7.js} +1 -1
  256. package/dist/client/assets/{use-local-browser-DCwzB4D8.js → use-local-browser-BNzN5O1P.js} +1 -1
  257. package/dist/client/assets/{use-mesh-topology-LRYxFuZp.js → use-mesh-topology-CpIDE8lD.js} +1 -1
  258. package/dist/client/assets/{use-mounted-ref-CZaegwTr.js → use-mounted-ref-BAO3qunF.js} +1 -1
  259. package/dist/client/assets/{use-notification-prefs-FtOiUS5H.js → use-notification-prefs-CtqeH5Pk.js} +1 -1
  260. package/dist/client/assets/{use-panel-tab-placements-Dv2OPvKh.js → use-panel-tab-placements-DFobGBRm.js} +1 -1
  261. package/dist/client/assets/use-pending-read-Do0_vZ2I.js +1 -0
  262. package/dist/client/assets/{use-personality-commit-BB5aeh6p.js → use-personality-commit-BvqCwzAC.js} +1 -1
  263. package/dist/client/assets/{use-promo-activation-BW0u7n7m.js → use-promo-activation-Dz5cYm-X.js} +1 -1
  264. package/dist/client/assets/{use-promo-dismissals-BOXzW4kD.js → use-promo-dismissals-CuOsnqnZ.js} +1 -1
  265. package/dist/client/assets/{use-pulse-freshness-ClW-MLMo.js → use-pulse-freshness-qcTH6PM7.js} +1 -1
  266. package/dist/client/assets/{use-relay-config-hItHtkSr.js → use-relay-config-1mAMDNbc.js} +1 -1
  267. package/dist/client/assets/{use-room-follow-claim-wotzxUWc.js → use-room-follow-claim-CCGhsyH3.js} +1 -1
  268. package/dist/client/assets/{use-roving-tab-list-DkbO6xSs.js → use-roving-tab-list-Bsg2dfUx.js} +1 -1
  269. package/dist/client/assets/use-session-canvas-awPngMKg.js +25 -0
  270. package/dist/client/assets/{use-session-diagnostics-DmxvD-wy.js → use-session-diagnostics-D5g8Mc52.js} +2 -2
  271. package/dist/client/assets/{use-unclaimed-chats-DKpexDm3.js → use-unclaimed-chats-Db_wuzt0.js} +1 -1
  272. package/dist/client/assets/use-update-config-DwtH_H9Z.js +1 -0
  273. package/dist/client/assets/{useMutationState-Btf2Hp1a.js → useMutationState-BvwBDXKc.js} +1 -1
  274. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DRngjDUq.js → usecaseDiagram-WPOLBNNX-1zKygEKR.js} +1 -1
  275. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-iK-dlS1-.js → vennDiagram-Q3Y3IDCW-BR2EbgGY.js} +1 -1
  276. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-sOS67Cks.js → wardleyDiagram-IVAIDKWA-D0OwouJc.js} +1 -1
  277. package/dist/client/assets/{xychartDiagram-4URNHDU4-EgnLiIao.js → xychartDiagram-4URNHDU4-BM-7_FQQ.js} +1 -1
  278. package/dist/client/index.html +2 -2
  279. package/dist/drizzle/20261018123612_session_route.sql +1 -0
  280. package/dist/drizzle/meta/20261018123612_snapshot.json +14027 -0
  281. package/dist/drizzle/meta/_journal.json +7 -0
  282. package/dist/server/index.js +31594 -28878
  283. package/dist/server/index.js.map +2 -2
  284. package/package.json +6 -6
  285. package/dist/client/assets/CanvasFileContent-ClcHZ_l-.js +0 -2
  286. package/dist/client/assets/CanvasModel3dContent-Cm3msNdQ.js +0 -2
  287. package/dist/client/assets/HandlePage-B_5GLHsp.js +0 -1
  288. package/dist/client/assets/NamePage-0nr288eM.js +0 -1
  289. package/dist/client/assets/PhotoPage-C3Ir3wlA.js +0 -1
  290. package/dist/client/assets/PresetPicker-zGvDOqTf.js +0 -19
  291. package/dist/client/assets/RoomSurface-BIyjtxKD.js +0 -44
  292. package/dist/client/assets/_shell-BHUZq_8C.js +0 -80
  293. package/dist/client/assets/_shell.marketplace-BoAmyvPt.js +0 -1
  294. package/dist/client/assets/_shell.marketplace_.sources-BpqWjkGL.js +0 -1
  295. package/dist/client/assets/_shell.session-KyPj3OxK.js +0 -61
  296. package/dist/client/assets/_shell.x._extensionId-CfiAgtoq.js +0 -1
  297. package/dist/client/assets/_shell.x._extensionId_._-CfiAgtoq.js +0 -1
  298. package/dist/client/assets/channel-DZpRF3QJ.js +0 -1
  299. package/dist/client/assets/index-Cl8trmnL.js +0 -1
  300. package/dist/client/assets/index-Cp3yShS8.js +0 -23
  301. package/dist/client/assets/index-DKDK-3KH.js +0 -17
  302. package/dist/client/assets/index-DPNBHwcQ.js +0 -1
  303. package/dist/client/assets/registry-DS1Ghdft.js +0 -1
  304. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C7fkUKrq.js +0 -8
  305. package/dist/client/assets/use-is-below-desktop-Qwyg-mFb.js +0 -1
  306. package/dist/client/assets/use-is-hub-CSz6NDaP.js +0 -1
  307. package/dist/client/assets/use-pending-read-DBOl1ee_.js +0 -1
  308. package/dist/client/assets/use-session-canvas-C_fuAgW_.js +0 -24
  309. package/dist/client/assets/use-update-config-CSYwg557.js +0 -1
@@ -1 +1 @@
1
- import{eG as J,j as e,eH as Q,eI as Z,eJ as C,eK as ee,eL as z,ct as se,eM as te,r as O,ak as A,eN as D,H as V,aS as Y,X as ne,eO as ae,eP as ie,eQ as re,eR as oe,B as E,f as de,eS as le,eT as U,eU as ce,eV as X,a0 as me,bb as ue,eW as xe,eX as he,eY as ge,eZ as pe,e_ as fe,e$ as ve,T as je,G as I,f0 as M,f1 as Ne,f2 as be,_ as T,$ as we,f3 as ye,f4 as Se,f5 as ke,f6 as Ce,f7 as Ee,f8 as $e,f9 as Pe,fa as B,dz as Te,a7 as S,fb as Re,fc as F}from"./index-DcZPWi_I.js";import{fd as ms,fe as us,ff as xs,fg as hs,fh as gs,fi as ps}from"./index-DcZPWi_I.js";import{u as _e}from"./use-deep-link-scroll-CgRjt48R.js";import{M as K}from"./more-details-B4lBMpKi.js";import{C as Ae}from"./card-ww4ebz8h.js";import{u as De,a as Ie}from"./use-panel-tab-placements-Dv2OPvKh.js";import{C as Le,a as Oe,b as ze,c as Me,d as R,e as _}from"./command-D4fLpJxA.js";import{F as q}from"./file-text-C1ougnBY.js";import{S as Be}from"./shield-check-Csnr5rFy.js";const Fe=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],He={server_crashed:s=>`${s} stopped unexpectedly 3 times. Reload it to try again.`,server_out_of_memory:s=>`${s} ran out of memory and stopped. Reload it to try again.`,server_unresponsive:s=>`${s} stopped responding, so DorkOS stopped it.`,isolation_unavailable:s=>`${s} can’t run with its limits on this computer.`,server_start_failed:s=>`${s} couldn’t start. Reload it to try again.`,server_start_timeout:s=>`${s} took too long to start. Reload it to try again.`};function L(s){return Fe.includes(s)}function Ge(s,r){return L(s)?He[s](r):null}function Ve(s){return`Restarting ${s}…`}function Ye({extensionId:s}){const r=J("right-panel").filter(d=>d.extensionId===s);return r.length===0?null:e.jsx("div",{className:"space-y-3 pt-1","data-testid":`panel-tab-placement-${s}`,children:r.map(d=>e.jsx(Xe,{tab:d,labelled:r.length>1},d.id))})}function Ue(){var d;const s=(d=se().data)==null?void 0:d.agents,r=te().data;return O.useMemo(()=>{const l=new Map((s??[]).map(a=>[a.id,A(a)])),c=new Map((r??[]).map(a=>[a.id,D(a)]));return{agents:s??[],rooms:r??[],agentNames:l,roomNames:c}},[s,r])}function Xe({tab:s,labelled:r}){const d=Q(De(),s.id),{setPlacement:l}=Ie(),c=Ue(),a=Z(d,s.declaredPlacement),g=a.show.pages.includes(C),o=t=>l(s.id,{show:t.show,hide:t.hide}),m=t=>t.kind==="agents"?c.agentNames.get(t.id)??"An agent that is gone":t.kind==="rooms"?c.roomNames.get(t.id)??"A channel that is gone":ae(t.id),v=(t,u)=>["agents","rooms","pages"].flatMap(j=>t[j].filter(i=>u||i!==C).map(i=>({kind:j,id:i}))),n=(t,u)=>({...t,[u.kind]:t[u.kind].filter(j=>j!==u.id)}),p=v(a.show,!1),N=v(a.hide,!0);return e.jsxs("div",{className:"space-y-2","data-testid":`panel-tab-placement-${s.id}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:r?`${s.title} tab shows`:"Panel tab shows"}),e.jsxs(ee,{value:g?"everywhere":"only",onValueChange:t=>o({hide:a.hide,show:t==="everywhere"?{...a.show,pages:[C]}:{...a.show,pages:a.show.pages.filter(u=>u!==C)}}),"aria-label":`Where the ${s.title} tab shows`,children:[e.jsx(z,{value:"everywhere",children:"Everywhere"}),e.jsx(z,{value:"only",children:"Only in…"})]}),d&&e.jsx("button",{type:"button",onClick:()=>l(s.id,null),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:s.declaredPlacement?"Use its default":"Reset"})]}),!g&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Remove ${m(t)}`,onRemove:()=>o({...a,show:n(a.show,t)})},`${t.kind}:${t.id}`)),e.jsx(qe,{tabTitle:s.title,names:c,taken:a.show,onAdd:t=>o({show:{...a.show,[t.kind]:[...a.show[t.kind],t.id]},hide:n(a.hide,t)})}),p.length===0&&e.jsx("span",{className:"text-muted-foreground text-xs",children:"Shows nowhere yet. Add a place."})]}),N.length>0&&e.jsxs("div",{role:"group","aria-labelledby":`${s.id}-hidden-in`,className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{id:`${s.id}-hidden-in`,className:"text-muted-foreground text-xs",children:"Hidden in"}),N.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Show in ${m(t)} again`,onRemove:()=>o({...a,hide:n(a.hide,t)})},`${t.kind}:${t.id}`))]})]})}const Ke={agents:Y,rooms:V,pages:q};function H({place:s,name:r,removeLabel:d,onRemove:l}){const c=Ke[s.kind];return e.jsxs("span",{className:"bg-muted inline-flex h-6 items-center gap-1 rounded-md pr-0.5 pl-1.5 text-xs",children:[e.jsx(c,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:r}),e.jsx("button",{type:"button",onClick:l,"aria-label":d,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(ne,{className:"size-3"})})]})}function qe({tabTitle:s,names:r,taken:d,onAdd:l}){const[c,a]=O.useState(!1),g=n=>{l(n),a(!1)},o=ie.filter(n=>!d.pages.includes(n.key)),m=r.agents.filter(n=>!d.agents.includes(n.id)),v=r.rooms.filter(n=>!d.rooms.includes(n.id));return e.jsxs(re,{open:c,onOpenChange:a,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs","aria-label":`Add a place for the ${s} tab`,children:[e.jsx(de,{className:"size-3"}),"Add"]})}),e.jsx(le,{align:"start",className:"w-64 p-0",children:e.jsxs(Le,{children:[e.jsx(Oe,{placeholder:"Find an agent, channel or page"}),e.jsxs(ze,{className:"max-h-64",children:[e.jsx(Me,{children:"Nothing matches."}),m.length>0&&e.jsx(R,{heading:"Agents",children:m.map(n=>e.jsxs(_,{value:`agent ${A(n)} ${n.id}`,onSelect:()=>g({kind:"agents",id:n.id}),children:[e.jsx(Y,{className:"size-3.5"}),A(n)]},n.id))}),v.length>0&&e.jsx(R,{heading:"Channels and DMs",children:v.map(n=>e.jsxs(_,{value:`room ${D(n)} ${n.id}`,onSelect:()=>g({kind:"rooms",id:n.id}),children:[e.jsx(V,{className:"size-3.5"}),D(n)]},n.id))}),o.length>0&&e.jsx(R,{heading:"Pages",children:o.map(n=>e.jsxs(_,{value:`page ${n.label}`,onSelect:()=>g({kind:"pages",id:n.key}),children:[e.jsx(q,{className:"size-3.5"}),n.label]},n.key))})]})]})})]})}const We=new Set(["disabled","discovered","incompatible","invalid"]),Je="/marketplace?view=installed";function Qe({extension:s,onToggle:r,isToggling:d,onSetRunApproval:l,isSettingApproval:c,onReload:a,isReloading:g}){const{manifest:o,status:m,scope:v,error:n,serverError:p,origin:N,approvedToRun:t}=s,[u,j]=O.useState(!1),i=!We.has(m),x=m==="incompatible",b=m==="invalid",h=m==="compile_error"||m==="activate_error",y=!x&&!b,f=!(N==="core"&&o.canDisable===!1),k=s.hasServerEntry||s.hasDataProxy,w=U(s),W=ce(s.id,X(w)),$=h?"Not working":x?"Incompatible":b?"Can’t load":null;return e.jsx(Ae,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,"data-section":s.id,radius:"lg",gap:"none",className:I(h&&"border-amber-500/50",(x||b)&&"opacity-70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h&&e.jsx(me,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(x||b)&&!h&&e.jsx(ue,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!h&&!x&&!b&&e.jsx(xe,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:o.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",o.version]}),s.devLink&&e.jsx(he,{})]}),s.devLink&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-dev-link-${s.id}`,children:[e.jsx(ge,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void pe(Je),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),o.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:o.description}),e.jsx(fe,{gifts:ve(s),"data-testid":`extension-agent-gifts-${s.id}`}),i&&e.jsx(Ye,{extensionId:s.id}),x&&o.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",o.minHostVersion," or newer"]}),h&&n&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[m==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",n.message]}),n.details&&e.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":u,children:[e.jsx(je,{className:I("size-3 transition-transform",u&&"rotate-180")}),u?"Hide details":"Show details"]}),u&&n.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:n.details})]}),p&&L(p.code)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-server-status-${s.id}`,children:[e.jsx("p",{className:"text-status-warning-fg text-sm",children:p.message||Ge(p.code,o.name)}),e.jsx("button",{type:"button",onClick:a,disabled:g,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!p&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:Ve(o.name)}),p&&!L(p.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",p.message,". The last version still runs."]}),N==="user"&&(t?e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs","data-testid":`extension-run-allowed-${s.id}`,children:[e.jsx(Be,{className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"You allowed this to run."}),s.originProblem==="changed"&&e.jsx("span",{children:"You approved its changed files. Any further change asks again."}),e.jsx("button",{type:"button",onClick:()=>l(s.id,!1),disabled:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(M,{permissions:w,className:"basis-full","data-testid":`extension-permissions-${s.id}`})]}):e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/40 bg-amber-500/5 p-3","data-testid":`extension-needs-approval-${s.id}`,children:[e.jsx("p",{className:"text-sm font-medium",children:"This extension is waiting for you"}),s.originProblem&&e.jsx("p",{className:"text-status-warning-fg text-sm","data-testid":`extension-origin-problem-${s.id}`,children:s.originProblem==="changed"?"Its files changed after install, so DorkOS can’t vouch for it. Look it over first.":s.originProblem==="dev-link"?"It runs from your folder, so DorkOS can’t vouch for its source.":"Its plugin links to files elsewhere, so DorkOS can’t vouch for its source."}),e.jsx(M,{permissions:w,added:W,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Ne(k,(w==null?void 0:w.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:be}),e.jsx(E,{size:"sm",onClick:()=>l(s.id,!0),disabled:c,"data-testid":`extension-approve-run-${s.id}`,children:"Turn it on"})]})),e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(T,{variant:"outline",children:v}),$&&e.jsx(T,{variant:$==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:$}),o.author&&e.jsx("span",{children:o.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:f?e.jsx(we,{checked:i,onCheckedChange:P=>r(s.id,P),disabled:!y||d,"aria-label":`${i?"Disable":"Enable"} ${o.name}`}):e.jsx(T,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function G(s){const r=new Date(s);return Number.isNaN(r.getTime())?"":r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ze(){const{data:s=[]}=ye(),{stop:r,pendingSource:d}=Se();return s.length===0?null:e.jsxs("section",{className:"space-y-3","data-testid":"trusted-sources-section",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Trusted sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Extensions from these sources turn on without asking."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Stop trusting one, and extensions already on keep running."}),e.jsx(K,{className:"text-muted-foreground text-sm",label:"If you stop trusting one",openLabel:"If you stop trusting one",children:e.jsx("p",{children:"Newer versions and new extensions from it wait for your yes."})})]}),e.jsx("ul",{className:"divide-y rounded-xl border",children:s.map(({source:l,trustedAt:c})=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-mono text-sm",children:l}),G(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",G(c)]})]}),e.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:d===l,onClick:()=>r(l),children:"Stop trusting"})]},l))})]})}function ds(){const{data:s=[],isLoading:r}=ke(),{section:d}=Ce();_e(r?null:d);const l=Ee(),c=$e(),a=Pe(),g=B(!0),o=B(!1),m=new Set([...l.variables?[l.variables]:[],...c.variables?[c.variables]:[]]),v=new Set([...g.isPending&&g.variables?[g.variables.id]:[],...o.isPending&&o.variables?[o.variables.id]:[]]);function n(i,x){const b=x?g:o,h=s.find(f=>f.id===i);if(!h)return;const y=x?X(U(h)):void 0;b.mutate({id:i,version:h.manifest.version,plugin:h.sourcePlugin??null,...y?{permissions:y}:{}},{onSuccess:f=>{x&&F.getState().forget(i);const k=f.extension.manifest.name,w=f.extension.isolation?"":" inside DorkOS";S.success(x?`${k} can now run${w}`:`${k} stopped running`)},onError:f=>{if(f instanceof Re&&f.stale){y&&F.getState().remember(i,y),S.error(`${h.manifest.name} changed since you saw it. Check it again.`);return}S.error(x?"Couldn’t let it run.":"Couldn’t stop it running.",{description:f.message})}})}async function p(i,x){(x?l:c).mutate(i,{onError:h=>{S.error(x?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:h.message})}})}function N(){a.mutate(void 0,{onSuccess:i=>{S.success(`Reloaded ${i.length} extension${i.length===1?"":"s"}`)},onError:i=>{S.error("Couldn’t reload your extensions.",{description:i.message})}})}if(r)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const t=s.filter(i=>i.origin==="core"),u=s.filter(i=>i.origin==="user"),j=i=>e.jsx(Qe,{extension:i,onToggle:p,isToggling:m.has(i.id),onSetRunApproval:n,isSettingApproval:v.has(i.id),onReload:N,isReloading:a.isPending},i.id);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Extensions add new screens and tools to DorkOS."}),e.jsxs(K,{children:[e.jsx("p",{children:"Core extensions come with DorkOS."}),e.jsxs("p",{children:["Installed ones live in"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:"~/.dork/extensions/"})," or your project’s"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:".dork/extensions/"}),"."]})]})]}),s.length===0?e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm","data-testid":"no-extensions",children:e.jsx("p",{children:"No extensions installed."})}):e.jsxs(e.Fragment,{children:[t.length>0&&e.jsxs("section",{className:"space-y-3","data-testid":"core-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Core extensions"}),e.jsx("div",{className:"space-y-3",children:t.map(j)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(j)}):e.jsxs("div",{className:"text-muted-foreground rounded-xl border border-dashed p-4 text-sm","data-testid":"no-installed-extensions",children:["No extensions installed yet. Browse"," ",e.jsx("span",{className:"text-foreground font-medium",children:"Marketplace"})," to add some."]})]})]}),e.jsx(Ze,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(E,{variant:"outline",size:"sm",onClick:N,disabled:a.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(Te,{className:I("mr-2 size-4",a.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{ms as ExtensionEventBridge,us as ExtensionLoader,xs as ExtensionProvider,ds as ExtensionsSettingsTab,hs as createExtensionAPI,gs as createExtensionEventBridge,ps as useExtensions};
1
+ import{eG as J,j as e,eH as Q,eI as Z,eJ as C,eK as ee,eL as z,ct as se,eM as te,r as O,ak as A,eN as D,H as V,aS as Y,X as ne,eO as ae,eP as ie,eQ as re,eR as oe,B as E,f as de,eS as le,eT as U,eU as ce,eV as X,a0 as me,bb as ue,eW as xe,eX as he,eY as ge,eZ as pe,e_ as fe,e$ as ve,T as je,G as I,f0 as M,f1 as Ne,f2 as be,_ as T,$ as we,f3 as ye,f4 as Se,f5 as ke,f6 as Ce,f7 as Ee,f8 as $e,f9 as Pe,fa as B,dz as Te,a7 as S,fb as Re,fc as F}from"./index-8-iQ6PnT.js";import{fd as ms,fe as us,ff as xs,fg as hs,fh as gs,fi as ps}from"./index-8-iQ6PnT.js";import{u as _e}from"./use-deep-link-scroll-v02TbidQ.js";import{M as K}from"./more-details-CadxnGyH.js";import{C as Ae}from"./card-Dj6ZfRgu.js";import{u as De,a as Ie}from"./use-panel-tab-placements-DFobGBRm.js";import{C as Le,a as Oe,b as ze,c as Me,d as R,e as _}from"./command-BAOEURY7.js";import{F as q}from"./file-text-CRw31ZWd.js";import{S as Be}from"./shield-check-CpUB_Ju1.js";const Fe=["server_crashed","server_out_of_memory","server_unresponsive","isolation_unavailable","server_start_failed","server_start_timeout"],He={server_crashed:s=>`${s} stopped unexpectedly 3 times. Reload it to try again.`,server_out_of_memory:s=>`${s} ran out of memory and stopped. Reload it to try again.`,server_unresponsive:s=>`${s} stopped responding, so DorkOS stopped it.`,isolation_unavailable:s=>`${s} can’t run with its limits on this computer.`,server_start_failed:s=>`${s} couldn’t start. Reload it to try again.`,server_start_timeout:s=>`${s} took too long to start. Reload it to try again.`};function L(s){return Fe.includes(s)}function Ge(s,r){return L(s)?He[s](r):null}function Ve(s){return`Restarting ${s}…`}function Ye({extensionId:s}){const r=J("right-panel").filter(d=>d.extensionId===s);return r.length===0?null:e.jsx("div",{className:"space-y-3 pt-1","data-testid":`panel-tab-placement-${s}`,children:r.map(d=>e.jsx(Xe,{tab:d,labelled:r.length>1},d.id))})}function Ue(){var d;const s=(d=se().data)==null?void 0:d.agents,r=te().data;return O.useMemo(()=>{const l=new Map((s??[]).map(a=>[a.id,A(a)])),c=new Map((r??[]).map(a=>[a.id,D(a)]));return{agents:s??[],rooms:r??[],agentNames:l,roomNames:c}},[s,r])}function Xe({tab:s,labelled:r}){const d=Q(De(),s.id),{setPlacement:l}=Ie(),c=Ue(),a=Z(d,s.declaredPlacement),g=a.show.pages.includes(C),o=t=>l(s.id,{show:t.show,hide:t.hide}),m=t=>t.kind==="agents"?c.agentNames.get(t.id)??"An agent that is gone":t.kind==="rooms"?c.roomNames.get(t.id)??"A channel that is gone":ae(t.id),v=(t,u)=>["agents","rooms","pages"].flatMap(j=>t[j].filter(i=>u||i!==C).map(i=>({kind:j,id:i}))),n=(t,u)=>({...t,[u.kind]:t[u.kind].filter(j=>j!==u.id)}),p=v(a.show,!1),N=v(a.hide,!0);return e.jsxs("div",{className:"space-y-2","data-testid":`panel-tab-placement-${s.id}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm",children:r?`${s.title} tab shows`:"Panel tab shows"}),e.jsxs(ee,{value:g?"everywhere":"only",onValueChange:t=>o({hide:a.hide,show:t==="everywhere"?{...a.show,pages:[C]}:{...a.show,pages:a.show.pages.filter(u=>u!==C)}}),"aria-label":`Where the ${s.title} tab shows`,children:[e.jsx(z,{value:"everywhere",children:"Everywhere"}),e.jsx(z,{value:"only",children:"Only in…"})]}),d&&e.jsx("button",{type:"button",onClick:()=>l(s.id,null),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:s.declaredPlacement?"Use its default":"Reset"})]}),!g&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[p.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Remove ${m(t)}`,onRemove:()=>o({...a,show:n(a.show,t)})},`${t.kind}:${t.id}`)),e.jsx(qe,{tabTitle:s.title,names:c,taken:a.show,onAdd:t=>o({show:{...a.show,[t.kind]:[...a.show[t.kind],t.id]},hide:n(a.hide,t)})}),p.length===0&&e.jsx("span",{className:"text-muted-foreground text-xs",children:"Shows nowhere yet. Add a place."})]}),N.length>0&&e.jsxs("div",{role:"group","aria-labelledby":`${s.id}-hidden-in`,className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{id:`${s.id}-hidden-in`,className:"text-muted-foreground text-xs",children:"Hidden in"}),N.map(t=>e.jsx(H,{place:t,name:m(t),removeLabel:`Show in ${m(t)} again`,onRemove:()=>o({...a,hide:n(a.hide,t)})},`${t.kind}:${t.id}`))]})]})}const Ke={agents:Y,rooms:V,pages:q};function H({place:s,name:r,removeLabel:d,onRemove:l}){const c=Ke[s.kind];return e.jsxs("span",{className:"bg-muted inline-flex h-6 items-center gap-1 rounded-md pr-0.5 pl-1.5 text-xs",children:[e.jsx(c,{className:"text-muted-foreground size-3","aria-hidden":!0}),e.jsx("span",{className:"max-w-40 truncate",children:r}),e.jsx("button",{type:"button",onClick:l,"aria-label":d,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-0.5",children:e.jsx(ne,{className:"size-3"})})]})}function qe({tabTitle:s,names:r,taken:d,onAdd:l}){const[c,a]=O.useState(!1),g=n=>{l(n),a(!1)},o=ie.filter(n=>!d.pages.includes(n.key)),m=r.agents.filter(n=>!d.agents.includes(n.id)),v=r.rooms.filter(n=>!d.rooms.includes(n.id));return e.jsxs(re,{open:c,onOpenChange:a,children:[e.jsx(oe,{asChild:!0,children:e.jsxs(E,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs","aria-label":`Add a place for the ${s} tab`,children:[e.jsx(de,{className:"size-3"}),"Add"]})}),e.jsx(le,{align:"start",className:"w-64 p-0",children:e.jsxs(Le,{children:[e.jsx(Oe,{placeholder:"Find an agent, channel or page"}),e.jsxs(ze,{className:"max-h-64",children:[e.jsx(Me,{children:"Nothing matches."}),m.length>0&&e.jsx(R,{heading:"Agents",children:m.map(n=>e.jsxs(_,{value:`agent ${A(n)} ${n.id}`,onSelect:()=>g({kind:"agents",id:n.id}),children:[e.jsx(Y,{className:"size-3.5"}),A(n)]},n.id))}),v.length>0&&e.jsx(R,{heading:"Channels and DMs",children:v.map(n=>e.jsxs(_,{value:`room ${D(n)} ${n.id}`,onSelect:()=>g({kind:"rooms",id:n.id}),children:[e.jsx(V,{className:"size-3.5"}),D(n)]},n.id))}),o.length>0&&e.jsx(R,{heading:"Pages",children:o.map(n=>e.jsxs(_,{value:`page ${n.label}`,onSelect:()=>g({kind:"pages",id:n.key}),children:[e.jsx(q,{className:"size-3.5"}),n.label]},n.key))})]})]})})]})}const We=new Set(["disabled","discovered","incompatible","invalid"]),Je="/marketplace?view=installed";function Qe({extension:s,onToggle:r,isToggling:d,onSetRunApproval:l,isSettingApproval:c,onReload:a,isReloading:g}){const{manifest:o,status:m,scope:v,error:n,serverError:p,origin:N,approvedToRun:t}=s,[u,j]=O.useState(!1),i=!We.has(m),x=m==="incompatible",b=m==="invalid",h=m==="compile_error"||m==="activate_error",y=!x&&!b,f=!(N==="core"&&o.canDisable===!1),k=s.hasServerEntry||s.hasDataProxy,w=U(s),W=ce(s.id,X(w)),$=h?"Not working":x?"Incompatible":b?"Can’t load":null;return e.jsx(Ae,{"data-slot":"extension-card","data-testid":`extension-card-${s.id}`,"data-section":s.id,radius:"lg",gap:"none",className:I(h&&"border-amber-500/50",(x||b)&&"opacity-70"),children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h&&e.jsx(me,{className:"text-status-warning-dot size-4 shrink-0","aria-hidden":"true"}),(x||b)&&!h&&e.jsx(ue,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),!h&&!x&&!b&&e.jsx(xe,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),e.jsx("span",{className:"font-medium",children:o.name}),e.jsxs("span",{className:"text-muted-foreground text-sm",children:["v",o.version]}),s.devLink&&e.jsx(he,{})]}),s.devLink&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-dev-link-${s.id}`,children:[e.jsx(ge,{path:s.devLink.path,className:"min-w-0"}),e.jsx("button",{type:"button",onClick:()=>void pe(Je),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2",children:"Unlink or switch"})]}),o.description&&e.jsx("p",{className:"text-muted-foreground text-sm",children:o.description}),e.jsx(fe,{gifts:ve(s),"data-testid":`extension-agent-gifts-${s.id}`}),i&&e.jsx(Ye,{extensionId:s.id}),x&&o.minHostVersion&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Needs DorkOS ",o.minHostVersion," or newer"]}),h&&n&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-status-warning-fg text-sm",children:[m==="compile_error"?"Couldn’t build: ":"Couldn’t start: ",n.message]}),n.details&&e.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-xs transition-colors","aria-expanded":u,children:[e.jsx(je,{className:I("size-3 transition-transform",u&&"rotate-180")}),u?"Hide details":"Show details"]}),u&&n.details&&e.jsx("pre",{className:"bg-muted mt-1 max-h-32 overflow-auto rounded-md p-2 text-xs",children:n.details})]}),p&&L(p.code)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1","data-testid":`extension-server-status-${s.id}`,children:[e.jsx("p",{className:"text-status-warning-fg text-sm",children:p.message||Ge(p.code,o.name)}),e.jsx("button",{type:"button",onClick:a,disabled:g,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm text-xs underline underline-offset-2 disabled:opacity-50",children:"Reload"})]}),s.restartingAt&&!p&&e.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:Ve(o.name)}),p&&!L(p.code)&&e.jsxs("p",{className:"text-status-warning-fg text-sm",children:["Couldn’t rebuild its server part: ",p.message,". The last version still runs."]}),N==="user"&&(t?e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs","data-testid":`extension-run-allowed-${s.id}`,children:[e.jsx(Be,{className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"You allowed this to run."}),s.originProblem==="changed"&&e.jsx("span",{children:"You approved its changed files. Any further change asks again."}),e.jsx("button",{type:"button",onClick:()=>l(s.id,!1),disabled:c,className:"hover:text-foreground underline underline-offset-2 disabled:opacity-50",children:"Stop it"}),e.jsx(M,{permissions:w,className:"basis-full","data-testid":`extension-permissions-${s.id}`})]}):e.jsxs("div",{className:"space-y-2 rounded-lg border border-amber-500/40 bg-amber-500/5 p-3","data-testid":`extension-needs-approval-${s.id}`,children:[e.jsx("p",{className:"text-sm font-medium",children:"This extension is waiting for you"}),s.originProblem&&e.jsx("p",{className:"text-status-warning-fg text-sm","data-testid":`extension-origin-problem-${s.id}`,children:s.originProblem==="changed"?"Its files changed after install, so DorkOS can’t vouch for it. Look it over first.":s.originProblem==="dev-link"?"It runs from your folder, so DorkOS can’t vouch for its source.":"Its plugin links to files elsewhere, so DorkOS can’t vouch for its source."}),e.jsx(M,{permissions:w,added:W,"data-testid":`extension-permissions-${s.id}`}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Ne(k,(w==null?void 0:w.runtime)==="subprocess")}),e.jsx("p",{className:"text-muted-foreground text-sm",children:be}),e.jsx(E,{size:"sm",onClick:()=>l(s.id,!0),disabled:c,"data-testid":`extension-approve-run-${s.id}`,children:"Turn it on"})]})),e.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(T,{variant:"outline",children:v}),$&&e.jsx(T,{variant:$==="Not working"?"destructive":"secondary","data-testid":`extension-health-${s.id}`,children:$}),o.author&&e.jsx("span",{children:o.author})]})]}),e.jsx("div",{className:"flex shrink-0 items-center pt-0.5",children:f?e.jsx(we,{checked:i,onCheckedChange:P=>r(s.id,P),disabled:!y||d,"aria-label":`${i?"Disable":"Enable"} ${o.name}`}):e.jsx(T,{variant:"secondary",title:"This extension is always on","data-testid":`extension-required-${s.id}`,children:"Required"})})]})})}function G(s){const r=new Date(s);return Number.isNaN(r.getTime())?"":r.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ze(){const{data:s=[]}=ye(),{stop:r,pendingSource:d}=Se();return s.length===0?null:e.jsxs("section",{className:"space-y-3","data-testid":"trusted-sources-section",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Trusted sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Extensions from these sources turn on without asking."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Stop trusting one, and extensions already on keep running."}),e.jsx(K,{className:"text-muted-foreground text-sm",label:"If you stop trusting one",openLabel:"If you stop trusting one",children:e.jsx("p",{children:"Newer versions and new extensions from it wait for your yes."})})]}),e.jsx("ul",{className:"divide-y rounded-xl border",children:s.map(({source:l,trustedAt:c})=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-mono text-sm",children:l}),G(c)&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Trusted ",G(c)]})]}),e.jsx(E,{type:"button",variant:"outline",size:"sm",disabled:d===l,onClick:()=>r(l),children:"Stop trusting"})]},l))})]})}function ds(){const{data:s=[],isLoading:r}=ke(),{section:d}=Ce();_e(r?null:d);const l=Ee(),c=$e(),a=Pe(),g=B(!0),o=B(!1),m=new Set([...l.variables?[l.variables]:[],...c.variables?[c.variables]:[]]),v=new Set([...g.isPending&&g.variables?[g.variables.id]:[],...o.isPending&&o.variables?[o.variables.id]:[]]);function n(i,x){const b=x?g:o,h=s.find(f=>f.id===i);if(!h)return;const y=x?X(U(h)):void 0;b.mutate({id:i,version:h.manifest.version,plugin:h.sourcePlugin??null,...y?{permissions:y}:{}},{onSuccess:f=>{x&&F.getState().forget(i);const k=f.extension.manifest.name,w=f.extension.isolation?"":" inside DorkOS";S.success(x?`${k} can now run${w}`:`${k} stopped running`)},onError:f=>{if(f instanceof Re&&f.stale){y&&F.getState().remember(i,y),S.error(`${h.manifest.name} changed since you saw it. Check it again.`);return}S.error(x?"Couldn’t let it run.":"Couldn’t stop it running.",{description:f.message})}})}async function p(i,x){(x?l:c).mutate(i,{onError:h=>{S.error(x?"Couldn’t turn that on.":"Couldn’t turn that off.",{description:h.message})}})}function N(){a.mutate(void 0,{onSuccess:i=>{S.success(`Reloaded ${i.length} extension${i.length===1?"":"s"}`)},onError:i=>{S.error("Couldn’t reload your extensions.",{description:i.message})}})}if(r)return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading extensions…"});const t=s.filter(i=>i.origin==="core"),u=s.filter(i=>i.origin==="user"),j=i=>e.jsx(Qe,{extension:i,onToggle:p,isToggling:m.has(i.id),onSetRunApproval:n,isSettingApproval:v.has(i.id),onReload:N,isReloading:a.isPending},i.id);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Extensions add new screens and tools to DorkOS."}),e.jsxs(K,{children:[e.jsx("p",{children:"Core extensions come with DorkOS."}),e.jsxs("p",{children:["Installed ones live in"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:"~/.dork/extensions/"})," or your project’s"," ",e.jsx("code",{className:"bg-muted rounded px-1",children:".dork/extensions/"}),"."]})]})]}),s.length===0?e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm","data-testid":"no-extensions",children:e.jsx("p",{children:"No extensions installed."})}):e.jsxs(e.Fragment,{children:[t.length>0&&e.jsxs("section",{className:"space-y-3","data-testid":"core-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Core extensions"}),e.jsx("div",{className:"space-y-3",children:t.map(j)})]}),e.jsxs("section",{className:"space-y-3","data-testid":"installed-extensions-section",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Installed extensions"}),u.length>0?e.jsx("div",{className:"space-y-3",children:u.map(j)}):e.jsxs("div",{className:"text-muted-foreground rounded-xl border border-dashed p-4 text-sm","data-testid":"no-installed-extensions",children:["No extensions installed yet. Browse"," ",e.jsx("span",{className:"text-foreground font-medium",children:"Marketplace"})," to add some."]})]})]}),e.jsx(Ze,{}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(E,{variant:"outline",size:"sm",onClick:N,disabled:a.isPending,"data-testid":"reload-extensions-button",children:[e.jsx(Te,{className:I("mr-2 size-4",a.isPending&&"animate-spin")}),"Reload extensions"]})})]})}export{ms as ExtensionEventBridge,us as ExtensionLoader,xs as ExtensionProvider,ds as ExtensionsSettingsTab,hs as createExtensionAPI,gs as createExtensionEventBridge,ps as useExtensions};
@@ -1,4 +1,4 @@
1
- var De=Object.defineProperty;var Ie=(t,n,s)=>n in t?De(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var U=(t,n,s)=>Ie(t,typeof n!="symbol"?n+"":n,s);import{W as N,a1 as P,i9 as ze,r as f,aM as Me,ia as X,aK as Se,j as e,hJ as O,ib as Te,g as B,ic as H,id as V,G as A,ie as Fe,ig as Ae,X as Oe,ih as _e,B as C,dy as Ee,ar as T,aN as Le,ii as Ue,fr as $e,ij as Pe,ik as Be,il as He,im as Ve,io as Ye,ip as Z,J as Ke,a3 as We,h3 as ne,aW as y,iq as qe,ir as Je,is as Ge,a7 as ee,it as Qe,iu as Xe,iv as Ze}from"./index-DcZPWi_I.js";import{u as et}from"./use-roving-tab-list-DkbO6xSs.js";import{F as se,b as tt,c as te,d as nt,R as st,C as ae}from"./use-session-canvas-C_fuAgW_.js";import{e as dn,f as un,g as mn,a as pn,h as hn}from"./use-session-canvas-C_fuAgW_.js";import{A as at}from"./McpAppFrame-B1WPswgk.js";import{F as ot}from"./file-Bf7D_47y.js";import{F as oe}from"./file-text-C1ougnBY.js";import{R as rt}from"./rotate-cw-Djl5J_x9.js";import{u as it}from"./use-room-follow-claim-wotzxUWc.js";import{c as lt,F as ct}from"./room-files-source-CbbVpvSW.js";import"./index.esm-CZZtbPRj.js";import"./WidgetErrorCard-Dx5oPMlF.js";import"./index-1ShgR_xt.js";import"./card-ww4ebz8h.js";import"./progress-DlIRjXIA.js";import"./markdown-content-Cqq_QMXA.js";import"./table-L7FvN6Or.js";import"./terminal-C9M5a_PS.js";import"./package-6Rbxg35g.js";import"./heart-CmqGJPDc.js";import"./git-branch-B2k77X3Q.js";import"./more-details-B4lBMpKi.js";import"./file-exclamation-point-DZXE9_8o.js";/**
1
+ var De=Object.defineProperty;var Ie=(t,n,s)=>n in t?De(t,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[n]=s;var U=(t,n,s)=>Ie(t,typeof n!="symbol"?n+"":n,s);import{W as N,a1 as P,i9 as ze,r as f,aM as Me,ia as X,aK as Se,j as e,hJ as O,ib as Te,g as B,ic as H,id as V,G as A,ie as Fe,ig as Ae,X as Oe,ih as _e,B as C,dy as Ee,ar as T,aN as Le,ii as Ue,fr as $e,ij as Pe,ik as Be,il as He,im as Ve,io as Ye,ip as Z,J as Ke,a3 as We,h3 as ne,aW as y,iq as qe,ir as Je,is as Ge,a7 as ee,it as Qe,iu as Xe,iv as Ze}from"./index-8-iQ6PnT.js";import{u as et}from"./use-roving-tab-list-Bsg2dfUx.js";import{F as se,c as tt,d as te,e as nt,R as st,C as ae}from"./use-session-canvas-awPngMKg.js";import{f as un,g as mn,h as pn,b as hn,i as fn}from"./use-session-canvas-awPngMKg.js";import{A as at}from"./McpAppFrame-5xlga1jD.js";import{F as ot}from"./file-DEt4KgZG.js";import{F as oe}from"./file-text-CRw31ZWd.js";import{R as rt}from"./rotate-cw-DvoxWwSx.js";import{u as it}from"./use-room-follow-claim-CCGhsyH3.js";import{c as lt,F as ct}from"./room-files-source-BhkPUTiP.js";import"./query-keys-DeYqUDia.js";import"./index.esm-bLeQzVWT.js";import"./WidgetErrorCard-BfgGzyqg.js";import"./index-D5zUdnZM.js";import"./card-Dj6ZfRgu.js";import"./progress-DmUieXLn.js";import"./markdown-content-D0FpU2cz.js";import"./table-DvU_oS4E.js";import"./terminal-Dw2QZ7Dh.js";import"./package-B8G7jQm-.js";import"./heart-CRkjVW7-.js";import"./git-branch-DWerghmw.js";import"./more-details-CadxnGyH.js";import"./file-exclamation-point-QqXJhXD9.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -35,4 +35,4 @@ var De=Object.defineProperty;var Ie=(t,n,s)=>n in t?De(t,n,{enumerable:!0,config
35
35
  * See the LICENSE file in the root directory of this source tree.
36
36
  */const pe={name:"table",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]};pe.node;const ft=N(pe);function xt(t){const n=P(),{roomId:s,viewerAuthorId:r,documentId:i,url:u,readScrollY:m,subscribe:d}=t,a=ze(s,r),b=f.useRef({roomId:s,documentId:i,url:u,readScrollY:m});b.current={roomId:s,documentId:i,url:u,readScrollY:m};const x=f.useRef(null),p=f.useRef(0);f.useEffect(()=>{if(!a||s===null||i===null)return;const j=()=>{x.current=null,p.current=Date.now();const g=b.current;if(g.roomId===null||g.documentId===null)return;const R=g.roomId,E={documentId:g.documentId,...g.url!==void 0?{url:g.url}:{},...g.readScrollY?{scrollY:Math.max(0,Math.round(g.readScrollY()))}:{}};n.publishRoomView(R,E).then(L=>{!L.followed&&r!==null&&Se.getState().noteNobodyFollowing(R,r)}).catch(()=>{})},k=()=>{if(x.current!==null)return;const g=Date.now()-p.current;if(g>=X){j();return}x.current=setTimeout(j,X-g)};k();const c=d==null?void 0:d(k),_=setInterval(k,Me);return()=>{clearInterval(_),c==null||c()}},[n,a,s,r,i,u,d]),f.useEffect(()=>()=>{x.current!==null&&clearTimeout(x.current)},[])}const yt={url:O,markdown:oe,json:le,image:ht,pdf:ot,widget:Te,mcp_app:at,file:se,model3d:dt,audio:ut,video:mt,csv:ft,browser:O,diff:pt},vt="after:absolute after:inset-x-0 after:-inset-y-2 md:after:hidden";function Y(t){return t==="browser"?"browser-panel":"canvas-panel"}const gt={canvas:"Open canvas documents",browser:"Open browser pages"};function K(t){return`canvas-tab-${t}`}const bt=3;function jt(t){const n=t.map(r=>r.displayName);if(n.length===0)return null;if(n.length===1)return`${n[0]} is looking at this.`;if(n.length===2)return`${n[0]} and ${n[1]} are looking at this.`;const s=n.length-2;return`${n[0]}, ${n[1]} and ${s} ${s===1?"other":"others"} are looking at this.`}function kt({watchers:t}){const n=jt(t);if(n===null)return null;const s=t.slice(0,bt),r=t.length-s.length;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-slot":"canvas-tab-watchers","aria-hidden":!0,className:"flex shrink-0 -space-x-1",children:[s.map(i=>e.jsx(B,{size:"xs",className:"ring-background text-3xs size-3.5 ring-1",kind:i.kind,color:i.color??V(i.id),emoji:i.emoji,imageUrl:i.imageUrl,badge:null,fallback:H(i.displayName)},i.id)),r>0&&e.jsxs("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-3.5 shrink-0 items-center justify-center rounded-full ring-1",children:["+",r]})]}),e.jsx("span",{className:"sr-only",children:n})]})}function he({view:t,documents:n,activeDocumentId:s,onActivate:r,onClose:i,onPin:u}){const m=Y(t),{getTabProps:d}=et({orderedIds:n.map(a=>a.id),activeId:s,onActivate:a=>r(a),onClose:a=>i(a),getFallbackFocus:()=>document.getElementById(m)});return n.length===0?null:e.jsx("div",{role:"tablist","aria-label":gt[t],className:"flex items-stretch gap-1 overflow-x-auto border-b px-2 py-1",children:n.map(a=>{const b=yt[a.contentType],x=a.id===s,p=a.author;return e.jsxs("div",{role:"presentation",className:"group relative flex shrink-0",children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":x,id:K(a.id),"aria-controls":x?m:void 0,...d(a.id),className:A("focus-ring flex items-center gap-1.5 rounded-md py-3 pl-2 text-xs transition-colors md:py-1",u?"pr-12":"pr-7",x?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[p&&e.jsx(B,{"aria-hidden":!0,size:"xs",className:"text-3xs size-3.5 shrink-0",kind:p.kind,color:p.color??V(p.id),emoji:p.emoji,imageUrl:p.imageUrl,badge:null,fallback:H(p.displayName)}),e.jsx(b,{className:"size-3.5 shrink-0"}),e.jsx("span",{className:"max-w-40 truncate font-medium",children:a.sourceLabel}),a.watchers&&a.watchers.length>0&&e.jsx(kt,{watchers:a.watchers}),a.unread&&e.jsx("span",{"data-slot":"canvas-tab-unread","aria-hidden":!0,className:"bg-primary size-1.5 shrink-0 rounded-full"})]}),u&&e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>u(a.id,!a.pinned),"aria-label":a.pinned?`Unpin ${a.sourceLabel}`:`Pin ${a.sourceLabel}`,className:A("focus-ring hover:bg-background/80 absolute top-1/2 right-6 -translate-y-1/2 rounded-sm p-1.5 transition-opacity md:p-0.5",a.pinned?"opacity-100":"opacity-0 group-hover:opacity-60"),children:a.pinned?e.jsx(Fe,{className:"size-3"}):e.jsx(Ae,{className:"size-3"})}),e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>i(a.id),"aria-label":`Close ${a.sourceLabel}`,className:A("focus-ring hover:bg-background/80 absolute top-1/2 right-1 -translate-y-1/2 rounded-sm p-1.5 opacity-60 transition-opacity group-hover:opacity-100 md:p-0.5",vt),children:e.jsx(Oe,{className:"size-3"})})]},a.id)})})}function wt({error:t,onRetry:n}){const s=_e(t);return e.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-3 p-8 text-center",children:[e.jsx("p",{children:"This tab hit a problem"}),s?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"The app may have updated. Reloading usually fixes it."}),e.jsx(C,{type:"button",size:"sm",onClick:()=>window.location.reload(),children:"Reload DorkOS"})]}):e.jsxs(C,{type:"button",variant:"outline",size:"sm",onClick:n,children:[e.jsx(rt,{className:"size-4"}),"Try again"]})]})}class fe extends f.Component{constructor(){super(...arguments);U(this,"state",{error:null,retryKey:0});U(this,"handleRetry",()=>{this.setState(s=>({error:null,retryKey:s.retryKey+1}))})}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,r){console.error(`[Canvas] Document viewer error (${this.props.documentId}):`,s,r)}render(){const{error:s,retryKey:r}=this.state;return s?e.jsx(wt,{error:s,onRetry:this.handleRetry}):e.jsx(f.Fragment,{children:this.props.children},r)}}function Ct({onReload:t,onKeepMine:n}){return e.jsxs("div",{role:"status",className:"border-border/60 bg-muted/40 mx-2 mt-2 space-y-2 rounded-md border px-3 py-2 text-sm",children:[e.jsx("p",{children:"Your agent changed this while you were editing. Your edit is safe."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(C,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Reload"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",onClick:n,children:"Keep mine"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Reload shows its version and ends your edit. Keep mine discards it."})]})}const Nt={canvas:{heading:"A blank canvas",blurb:"Your agent can show documents, data and files here.",actions:[{icon:oe,label:"Markdown",description:"Render a document",action:()=>({type:"markdown",content:`# Untitled
37
37
 
38
- Start writing…`,title:"Document"})},{icon:le,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:O,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:Ue.site,title:"Web Page"})}]}};function $(t,n,s,r){return t.split("").reduce((u,m)=>u+m.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function xe({view:t,onAction:n}){const s=Ee(),r=f.useId(),i=Nt[t],u=f.useMemo(()=>Array.from({length:6},(m,d)=>({x:$(r,d*3,10,90),y:$(r,d*3+1,10,80),size:$(r,d*3+2,24,56),delay:d*.4})),[r]);return e.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&u.map((m,d)=>e.jsx(T.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${m.x}%`,top:`${m.y}%`,width:m.size,height:m.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:m.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},d)),e.jsxs(T.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[e.jsx(T.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:t==="browser"?e.jsx(O,{className:"size-7"}):e.jsx(Le,{className:"size-7"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:i.heading}),e.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[i.blurb,e.jsx("br",{}),"Or pick a starting point below."]})]}),e.jsx(T.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:i.actions.map(({icon:m,label:d,description:a,action:b})=>e.jsxs(T.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(b()),children:[e.jsx(m,{className:"text-muted-foreground size-4 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-sm font-medium",children:d}),e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},d))})]})]})}function Rt({sourceLabel:t,people:n,following:s,onFollow:r,onStopFollowing:i,onDiscuss:u,discussing:m=!1}){const d=n.find(a=>a.id===s)??null;return t===void 0&&n.length===0&&u===void 0?null:e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[t!==void 0&&e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),t===void 0&&e.jsx("span",{className:"flex-1"}),u&&e.jsxs(C,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:m,onClick:u,children:[e.jsx($e,{className:"size-3.5"}),"Discuss"]}),n.length>0&&e.jsxs(Pe,{children:[e.jsx(Be,{asChild:!0,children:e.jsxs(C,{type:"button",variant:"ghost",size:"sm",className:A("h-6 gap-1 px-1.5",d&&"text-foreground"),children:[e.jsx(He,{className:"size-3.5"}),d?`Following ${d.displayName}`:"Follow"]})}),e.jsxs(Ve,{align:"end",children:[e.jsx(Ye,{children:"Follow somebody’s browser"}),n.map(a=>e.jsxs(Z,{onSelect:()=>a.id===s?i():r(a.id),children:[e.jsx(B,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??V(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:H(a.displayName)}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&e.jsx(Ke,{className:"size-3.5 shrink-0"})]},a.id)),d&&e.jsx(Z,{onSelect:i,children:"Stop following"})]})]})]})}function Dt({roomId:t,document:n,reading:s}){const r=P(),i=We(),[u,m]=f.useState(null),d=f.useMemo(()=>lt({transport:r,queryClient:i,roomId:t}),[r,i,t]);return e.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[e.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"text-muted-foreground size-4 shrink-0"}),e.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),e.jsx(C,{type:"button",size:"sm",onClick:()=>m(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&e.jsx(ct,{source:d,path:u,onClose:()=>m(null)})]})}const It=["image","pdf","audio","video","csv","model3d"];function zt(t){return/^(https?:|data:)/.test(t)}function Mt(t){if(t.type==="file"||t.type==="diff")return t.sourcePath;if(t.type==="markdown")return t.sourcePath??null;if(It.includes(t.type)){const n=t.src;return zt(n)?null:n}return null}function St(t){return t.type==="file"||t.type==="diff"||t.type==="markdown"}function Tt(t){const n=/^(?:in )?(.+?)['’]s /.exec(t.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function Ft(t){const n=Mt(t.content);if(n===null)return{kind:"inline"};if(t.treeKind==="room-main"||t.treeKind===void 0)return St(t.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(t.content.type==="diff"&&t.treeKind==="worktree"&&typeof t.aheadOfMain=="number"&&t.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:t.content};if(t.content.type==="markdown")return{kind:"inline"};const s=Tt(t);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function At(t){return t.title||t.contentType}function Ot({roomId:t,document:n,onUpdate:s}){const r=Ft(n);return r.kind==="worktree-diff"?e.jsx(Xe,{roomId:t,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?e.jsx(Dt,{roomId:t,document:n,reading:r}):n.content.type==="markdown"?e.jsx(st,{roomId:t,document:n,content:n.content,onSave:s}):e.jsx(ae,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function ye({roomId:t,view:n}){var J;const s=ne(),r=y(o=>o.roomCanvasDocuments[t]),i=y(o=>{var l;return((l=o.roomCanvasActive[t])==null?void 0:l[n])??null}),u=y(o=>{var l;return(l=o.roomCanvasUnread[t])==null?void 0:l[n]}),m=y(o=>o.activateRoomCanvasDocument),d=y(o=>o.clearRoomCanvasUnread),a=y(o=>o.roomCanvasPresence[t]),b=tt(t),x=qe(t),p=P(),j=((J=x.data)==null?void 0:J.viewerAuthorId)??null,k=y(o=>o.roomCanvasEditing[t]??null),c=Je(o=>o.openThread),[_,g]=f.useState(!1),R=n==="browser"?t:null,{following:E,follow:L,stop:ge}=it(R),w=Ge(R),I=f.useRef(null),F=f.useCallback(async(o,l)=>{try{return await l(),!0}catch(M){return ee.error(o,{description:te(M)}),!1}},[]),z=f.useMemo(()=>Qe(r??[],n),[r,n]),v=z.find(o=>o.id===i)??null,W=(u==null?void 0:u.length)??0;f.useEffect(()=>{W>0&&d(t,n)},[W,d,t,n]);const be=f.useMemo(()=>{var G;const o=new Map(((G=x.data)==null?void 0:G.members.map(h=>[h.author.id,h.author]))??[]),l=h=>({id:h.id,displayName:h.displayName,kind:h.kind,...h.emoji?{emoji:h.emoji}:{},...h.color?{color:h.color}:{},...h.imageUrl?{imageUrl:h.imageUrl}:{}}),M=new Map;for(const[h,S]of Object.entries(a??{})){if(h===j)continue;const D=o.get(h);if(!D)continue;const Q=M.get(S);Q?Q.push(l(D)):M.set(S,[l(D)])}return z.map(h=>{const S=o.get(h.authorId),D=M.get(h.id);return{id:h.id,sourceLabel:At(h),contentType:h.content.type,pinned:h.pinned,unread:(u==null?void 0:u.includes(h.id))??!1,...S?{author:l(S)}:{},...D?{watchers:D}:{}}})},[z,x.data,u,a,j]);nt(t,(v==null?void 0:v.id)??null);const je=f.useMemo(()=>{var o;return(((o=x.data)==null?void 0:o.members)??[]).map(l=>l.author).filter(l=>l.kind==="human"&&l.id!==j).map(l=>({id:l.id,displayName:l.displayName,kind:l.kind,emoji:l.emoji,color:l.color,imageUrl:l.imageUrl}))},[x.data,j]),ke=y(o=>{if(i===null)return;const l=o.browserHistories[i];return l?l.stack[l.cursor]:void 0}),we=f.useCallback(()=>{var o;return((o=I.current)==null?void 0:o.scrollTop)??0},[]),Ce=f.useCallback(o=>{const l=I.current;return l?(l.addEventListener("scroll",o,{passive:!0}),()=>l.removeEventListener("scroll",o)):()=>{}},[]);xt({roomId:R,viewerAuthorId:j,documentId:i,url:ke,readScrollY:we,subscribe:Ce});const q=f.useMemo(()=>z.map(o=>o.id).join("\0"),[z]);f.useEffect(()=>{if(!(w===null||k!==null)&&q.split("\0").includes(w.documentId)){if(w.documentId!==i){m(t,w.documentId);return}w.scrollY!==void 0&&I.current&&(I.current.scrollTop=w.scrollY)}},[w,k,i,q,m,t]);const Ne=f.useCallback(()=>{v!==null&&(g(!0),p.discussCanvasDocument(t,v.id).then(o=>c(t,o.threadRootEntryId,!1)).catch(o=>{ee.error("Couldn’t start a discussion.",{description:te(o)})}).finally(()=>g(!1)))},[v,p,t,c]),Re=Y(n);return e.jsxs(e.Fragment,{children:[!s&&e.jsx(he,{view:n,documents:be,activeDocumentId:i,onActivate:o=>m(t,o),onClose:o=>void F("Couldn’t take that off the canvas.",()=>b.close(o)),onPin:(o,l)=>void F(l?"Couldn’t pin that.":"Couldn’t unpin that.",()=>b.pin(o,l))}),e.jsx(Rt,{sourceLabel:v==null?void 0:v.sourceLabel,people:n==="browser"?je:[],following:E,onFollow:L,onStopFollowing:ge,onDiscuss:v===null?void 0:Ne,discussing:_}),e.jsx("div",{id:Re,ref:I,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&v?{role:"tabpanel","aria-labelledby":K(v.id)}:{},children:v?e.jsx(fe,{documentId:v.id,children:e.jsx(Ot,{roomId:t,document:v,onUpdate:(o,l)=>F("Couldn’t save that for the room.",()=>b.update(o,l))})},v.id):e.jsx(xe,{view:n,onAction:o=>void F("Couldn’t put that on the canvas.",()=>b.open(o))})})]})}function ve({view:t}){const n=ne(),s=y(c=>c.openDocuments),r=y(c=>t==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),i=y(c=>c.activateCanvasDocument),u=y(c=>c.closeCanvasDocument),m=y(c=>c.setDocumentContent),d=y(c=>c.openCanvasDocument),a=y(c=>c.applyHeldUpdate),b=y(c=>c.discardHeldUpdate),x=Ze(s,t),p=x.find(c=>c.id===r)??null,j=x.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),k=Y(t);return e.jsxs(e.Fragment,{children:[!n&&e.jsx(he,{view:t,documents:j,activeDocumentId:r,onActivate:i,onClose:u}),(p==null?void 0:p.heldUpdate)&&e.jsx(Ct,{onReload:()=>a(p.id),onKeepMine:()=>b(p.id)}),e.jsx("div",{id:k,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&p?{role:"tabpanel","aria-labelledby":K(p.id)}:{},children:p?e.jsx(fe,{documentId:p.id,children:e.jsx(ae,{documentId:p.id,content:p.content,onContentChange:c=>m(p.id,c)})},p.id):e.jsx(xe,{view:t,onAction:d})})]})}function on(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(ye,{roomId:t,view:"canvas"}):e.jsx(ve,{view:"canvas"})})}function rn(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(ye,{roomId:t,view:"browser"}):e.jsx(ve,{view:"browser"})})}export{rn as BrowserContent,on as CanvasContent,dn as CanvasWidgetContent,un as resetSessionCanvasImport,mn as useDevtoolsBridge,pn as useDocChannel,hn as useSessionCanvas};
38
+ Start writing…`,title:"Document"})},{icon:le,label:"JSON",description:"Inspect structured data",action:()=>({type:"json",data:{message:"Your data here"},title:"JSON data"})}]},browser:{heading:"No page open",blurb:"This tab shows web pages: your files, dev servers, or sites from your agent.",actions:[{icon:O,label:"Web page",description:"Open a page, then type any address",action:()=>({type:"url",url:Ue.site,title:"Web Page"})}]}};function $(t,n,s,r){return t.split("").reduce((u,m)=>u+m.charCodeAt(0),0)*(n+1)*7%(r-s)+s}function xe({view:t,onAction:n}){const s=Ee(),r=f.useId(),i=Nt[t],u=f.useMemo(()=>Array.from({length:6},(m,d)=>({x:$(r,d*3,10,90),y:$(r,d*3+1,10,80),size:$(r,d*3+2,24,56),delay:d*.4})),[r]);return e.jsxs("div",{className:"relative flex h-full flex-col items-center justify-center overflow-hidden px-6",children:[!s&&u.map((m,d)=>e.jsx(T.div,{className:"border-border/40 absolute rounded-lg border",style:{left:`${m.x}%`,top:`${m.y}%`,width:m.size,height:m.size},initial:{opacity:0,scale:.6,rotate:-10},animate:{opacity:[0,.15,.08,.15],scale:[.6,1,.9,1],rotate:[-10,0,5,0]},transition:{duration:8,delay:m.delay,repeat:1/0,repeatType:"reverse",ease:"easeInOut"}},d)),e.jsxs(T.div,{className:"relative z-10 flex max-w-sm flex-col items-center gap-6 text-center",initial:s?!1:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.4,ease:"easeOut"},children:[e.jsx(T.div,{className:"bg-muted/50 text-muted-foreground flex size-14 items-center justify-center rounded-2xl",initial:s?!1:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.3,delay:.1},children:t==="browser"?e.jsx(O,{className:"size-7"}):e.jsx(Le,{className:"size-7"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:i.heading}),e.jsxs("p",{className:"text-muted-foreground text-sm leading-relaxed",children:[i.blurb,e.jsx("br",{}),"Or pick a starting point below."]})]}),e.jsx(T.div,{className:"mt-2 flex w-full flex-col gap-2",initial:"hidden",animate:"visible",variants:s?{}:{visible:{transition:{staggerChildren:.08,delayChildren:.25}}},children:i.actions.map(({icon:m,label:d,description:a,action:b})=>e.jsxs(T.button,{variants:s?{}:{hidden:{opacity:0,y:8},visible:{opacity:1,y:0}},transition:{duration:.25},className:"border-border hover:bg-accent/50 flex items-center gap-3 rounded-lg border px-4 py-3 text-left transition-colors",onClick:()=>n(b()),children:[e.jsx(m,{className:"text-muted-foreground size-4 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-sm font-medium",children:d}),e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:a})]})]},d))})]})]})}function Rt({sourceLabel:t,people:n,following:s,onFollow:r,onStopFollowing:i,onDiscuss:u,discussing:m=!1}){const d=n.find(a=>a.id===s)??null;return t===void 0&&n.length===0&&u===void 0?null:e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1 text-xs",children:[t!==void 0&&e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t}),t===void 0&&e.jsx("span",{className:"flex-1"}),u&&e.jsxs(C,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1 px-1.5",disabled:m,onClick:u,children:[e.jsx($e,{className:"size-3.5"}),"Discuss"]}),n.length>0&&e.jsxs(Pe,{children:[e.jsx(Be,{asChild:!0,children:e.jsxs(C,{type:"button",variant:"ghost",size:"sm",className:A("h-6 gap-1 px-1.5",d&&"text-foreground"),children:[e.jsx(He,{className:"size-3.5"}),d?`Following ${d.displayName}`:"Follow"]})}),e.jsxs(Ve,{align:"end",children:[e.jsx(Ye,{children:"Follow somebody’s browser"}),n.map(a=>e.jsxs(Z,{onSelect:()=>a.id===s?i():r(a.id),children:[e.jsx(B,{"aria-hidden":!0,size:"xs",className:"size-4 shrink-0 text-[9px]",kind:a.kind,color:a.color??V(a.id),emoji:a.emoji,imageUrl:a.imageUrl,badge:null,fallback:H(a.displayName)}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:a.displayName}),a.id===s&&e.jsx(Ke,{className:"size-3.5 shrink-0"})]},a.id)),d&&e.jsx(Z,{onSelect:i,children:"Stop following"})]})]})]})}function Dt({roomId:t,document:n,reading:s}){const r=P(),i=We(),[u,m]=f.useState(null),d=f.useMemo(()=>lt({transport:r,queryClient:i,roomId:t}),[r,i,t]);return e.jsxs("div",{className:"flex h-full items-start justify-center p-6",children:[e.jsxs("div",{className:"bg-card shadow-soft w-full max-w-md space-y-3 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"text-muted-foreground size-4 shrink-0"}),e.jsx("span",{className:"truncate text-sm font-medium",children:n.title||s.sourcePath})]}),e.jsx("p",{className:"text-muted-foreground font-mono text-xs break-all",children:s.sourcePath}),s.kind==="elsewhere"?e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:s.sentence}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm leading-relaxed",children:"A room file. Each save is recorded with your name."}),e.jsx(C,{type:"button",size:"sm",onClick:()=>m(s.sourcePath),children:"Open file"})]})]}),s.kind==="room-file"&&e.jsx(ct,{source:d,path:u,onClose:()=>m(null)})]})}const It=["image","pdf","audio","video","csv","model3d"];function zt(t){return/^(https?:|data:)/.test(t)}function Mt(t){if(t.type==="file"||t.type==="diff")return t.sourcePath;if(t.type==="markdown")return t.sourcePath??null;if(It.includes(t.type)){const n=t.src;return zt(n)?null:n}return null}function St(t){return t.type==="file"||t.type==="diff"||t.type==="markdown"}function Tt(t){const n=/^(?:in )?(.+?)['’]s /.exec(t.sourceLabel??"");return(n==null?void 0:n[1])??"another member"}function Ft(t){const n=Mt(t.content);if(n===null)return{kind:"inline"};if(t.treeKind==="room-main"||t.treeKind===void 0)return St(t.content)?{kind:"room-file",sourcePath:n}:{kind:"elsewhere",sourcePath:n,sentence:"This file is in the room’s files. Open it from Files in the Room tab."};if(t.content.type==="diff"&&t.treeKind==="worktree"&&typeof t.aheadOfMain=="number"&&t.aheadOfMain>0)return{kind:"worktree-diff",sourcePath:n,content:t.content};if(t.content.type==="markdown")return{kind:"inline"};const s=Tt(t);return{kind:"elsewhere",sourcePath:n,sentence:`${s.charAt(0).toUpperCase()}${s.slice(1)}’s project isn’t open to you. Ask them to share it, or open your copy.`}}function At(t){return t.title||t.contentType}function Ot({roomId:t,document:n,onUpdate:s}){const r=Ft(n);return r.kind==="worktree-diff"?e.jsx(Xe,{roomId:t,content:r.content,documentId:n.id,authorId:n.authorId}):r.kind!=="inline"?e.jsx(Dt,{roomId:t,document:n,reading:r}):n.content.type==="markdown"?e.jsx(st,{roomId:t,document:n,content:n.content,onSave:s}):e.jsx(ae,{documentId:n.id,content:n.content,onContentChange:()=>{}})}function ye({roomId:t,view:n}){var J;const s=ne(),r=y(o=>o.roomCanvasDocuments[t]),i=y(o=>{var l;return((l=o.roomCanvasActive[t])==null?void 0:l[n])??null}),u=y(o=>{var l;return(l=o.roomCanvasUnread[t])==null?void 0:l[n]}),m=y(o=>o.activateRoomCanvasDocument),d=y(o=>o.clearRoomCanvasUnread),a=y(o=>o.roomCanvasPresence[t]),b=tt(t),x=qe(t),p=P(),j=((J=x.data)==null?void 0:J.viewerAuthorId)??null,k=y(o=>o.roomCanvasEditing[t]??null),c=Je(o=>o.openThread),[_,g]=f.useState(!1),R=n==="browser"?t:null,{following:E,follow:L,stop:ge}=it(R),w=Ge(R),I=f.useRef(null),F=f.useCallback(async(o,l)=>{try{return await l(),!0}catch(M){return ee.error(o,{description:te(M)}),!1}},[]),z=f.useMemo(()=>Qe(r??[],n),[r,n]),v=z.find(o=>o.id===i)??null,W=(u==null?void 0:u.length)??0;f.useEffect(()=>{W>0&&d(t,n)},[W,d,t,n]);const be=f.useMemo(()=>{var G;const o=new Map(((G=x.data)==null?void 0:G.members.map(h=>[h.author.id,h.author]))??[]),l=h=>({id:h.id,displayName:h.displayName,kind:h.kind,...h.emoji?{emoji:h.emoji}:{},...h.color?{color:h.color}:{},...h.imageUrl?{imageUrl:h.imageUrl}:{}}),M=new Map;for(const[h,S]of Object.entries(a??{})){if(h===j)continue;const D=o.get(h);if(!D)continue;const Q=M.get(S);Q?Q.push(l(D)):M.set(S,[l(D)])}return z.map(h=>{const S=o.get(h.authorId),D=M.get(h.id);return{id:h.id,sourceLabel:At(h),contentType:h.content.type,pinned:h.pinned,unread:(u==null?void 0:u.includes(h.id))??!1,...S?{author:l(S)}:{},...D?{watchers:D}:{}}})},[z,x.data,u,a,j]);nt(t,(v==null?void 0:v.id)??null);const je=f.useMemo(()=>{var o;return(((o=x.data)==null?void 0:o.members)??[]).map(l=>l.author).filter(l=>l.kind==="human"&&l.id!==j).map(l=>({id:l.id,displayName:l.displayName,kind:l.kind,emoji:l.emoji,color:l.color,imageUrl:l.imageUrl}))},[x.data,j]),ke=y(o=>{if(i===null)return;const l=o.browserHistories[i];return l?l.stack[l.cursor]:void 0}),we=f.useCallback(()=>{var o;return((o=I.current)==null?void 0:o.scrollTop)??0},[]),Ce=f.useCallback(o=>{const l=I.current;return l?(l.addEventListener("scroll",o,{passive:!0}),()=>l.removeEventListener("scroll",o)):()=>{}},[]);xt({roomId:R,viewerAuthorId:j,documentId:i,url:ke,readScrollY:we,subscribe:Ce});const q=f.useMemo(()=>z.map(o=>o.id).join("\0"),[z]);f.useEffect(()=>{if(!(w===null||k!==null)&&q.split("\0").includes(w.documentId)){if(w.documentId!==i){m(t,w.documentId);return}w.scrollY!==void 0&&I.current&&(I.current.scrollTop=w.scrollY)}},[w,k,i,q,m,t]);const Ne=f.useCallback(()=>{v!==null&&(g(!0),p.discussCanvasDocument(t,v.id).then(o=>c(t,o.threadRootEntryId,!1)).catch(o=>{ee.error("Couldn’t start a discussion.",{description:te(o)})}).finally(()=>g(!1)))},[v,p,t,c]),Re=Y(n);return e.jsxs(e.Fragment,{children:[!s&&e.jsx(he,{view:n,documents:be,activeDocumentId:i,onActivate:o=>m(t,o),onClose:o=>void F("Couldn’t take that off the canvas.",()=>b.close(o)),onPin:(o,l)=>void F(l?"Couldn’t pin that.":"Couldn’t unpin that.",()=>b.pin(o,l))}),e.jsx(Rt,{sourceLabel:v==null?void 0:v.sourceLabel,people:n==="browser"?je:[],following:E,onFollow:L,onStopFollowing:ge,onDiscuss:v===null?void 0:Ne,discussing:_}),e.jsx("div",{id:Re,ref:I,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!s&&v?{role:"tabpanel","aria-labelledby":K(v.id)}:{},children:v?e.jsx(fe,{documentId:v.id,children:e.jsx(Ot,{roomId:t,document:v,onUpdate:(o,l)=>F("Couldn’t save that for the room.",()=>b.update(o,l))})},v.id):e.jsx(xe,{view:n,onAction:o=>void F("Couldn’t put that on the canvas.",()=>b.open(o))})})]})}function ve({view:t}){const n=ne(),s=y(c=>c.openDocuments),r=y(c=>t==="browser"?c.activeBrowserDocumentId:c.activeCanvasDocumentId),i=y(c=>c.activateCanvasDocument),u=y(c=>c.closeCanvasDocument),m=y(c=>c.setDocumentContent),d=y(c=>c.openCanvasDocument),a=y(c=>c.applyHeldUpdate),b=y(c=>c.discardHeldUpdate),x=Ze(s,t),p=x.find(c=>c.id===r)??null,j=x.map(c=>({id:c.id,sourceLabel:c.sourceLabel,contentType:c.content.type})),k=Y(t);return e.jsxs(e.Fragment,{children:[!n&&e.jsx(he,{view:t,documents:j,activeDocumentId:r,onActivate:i,onClose:u}),(p==null?void 0:p.heldUpdate)&&e.jsx(Ct,{onReload:()=>a(p.id),onKeepMine:()=>b(p.id)}),e.jsx("div",{id:k,tabIndex:-1,className:"min-h-0 flex-1 overflow-auto focus-visible:outline-none",...!n&&p?{role:"tabpanel","aria-labelledby":K(p.id)}:{},children:p?e.jsx(fe,{documentId:p.id,children:e.jsx(ae,{documentId:p.id,content:p.content,onContentChange:c=>m(p.id,c)})},p.id):e.jsx(xe,{view:t,onAction:d})})]})}function rn(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"canvas",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(ye,{roomId:t,view:"canvas"}):e.jsx(ve,{view:"canvas"})})}function ln(){const t=y(n=>n.roomCanvasLiveRoomId);return e.jsx("div",{"data-slot":"browser",className:"flex h-full flex-col overflow-hidden",children:t?e.jsx(ye,{roomId:t,view:"browser"}):e.jsx(ve,{view:"browser"})})}export{ln as BrowserContent,rn as CanvasContent,un as CanvasWidgetContent,mn as resetSessionCanvasImport,pn as useDevtoolsBridge,hn as useDocChannel,fn as useSessionCanvas};
@@ -1 +1 @@
1
- import{P as L,N as $,g as E,D as j,h as y,T as S,I as G}from"./index-mFOJXyAE.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};
1
+ import{P as L,N as $,g as E,D as j,h as y,T as S,I as G}from"./index-Czm6C7FZ.js";var N={};class v{constructor(t,e,s,i,h,r,n,o,a,u=0,f){this.p=t,this.stack=e,this.state=s,this.reducePos=i,this.pos=h,this.score=r,this.buffer=n,this.bufferBase=o,this.curContext=a,this.lookAhead=u,this.parent=f}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,e,s=0){let i=t.parser.context;return new v(t,[],e,s,s,0,[],0,i?new R(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let s=t>>19,i=t&65535,{parser:h}=this.p,r=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),n=h.dynamicPrecedence(i);if(n&&(this.score+=n),s==0){i<h.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(h.getGoto(this.state,i,!0),this.reducePos),i<h.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,r?8:4,!0),this.reduceContext(i,this.reducePos);return}let o=this.stack.length-(s-1)*3-(t&262144?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from;i<h.minRepeatTerm&&a==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let u=this.reducePos-a;u>=2e3&&!(!((e=this.p.parser.nodeSet.types[i])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=u));let f=o?this.stack[o-1]:0,d=this.bufferBase+this.buffer.length-f;if(i<h.minRepeatTerm||t&131072){let c=h.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,c,d+4,!0)}if(t&262144)this.state=this.stack[o];else{let c=this.stack[o-3];this.state=h.getGoto(c,i,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(i,a)}storeNode(t,e,s,i=4,h=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let r=this.buffer.length;if(r>0&&this.buffer[r-4]==0&&this.buffer[r-1]>-1){if(e==s)return;if(this.buffer[r-2]>=e){this.buffer[r-2]=s;return}}}if(!h||this.pos==s)this.buffer.push(t,e,s,i);else{let r=this.buffer.length;if(r>0&&(this.buffer[r-4]!=0||this.buffer[r-1]<0)){let n=!1;for(let o=r;o>0&&this.buffer[o-2]>s;o-=4)if(this.buffer[o-1]>=0){n=!0;break}if(n)for(;r>0&&this.buffer[r-2]>s;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=t,this.buffer[r+1]=e,this.buffer[r+2]=s,this.buffer[r+3]=i}}shift(t,e,s,i){if(t&131072)this.pushState(t&65535,this.pos);else if((t&262144)==0){let h=t,{parser:r}=this.p;this.pos=i;let n=r.stateFlag(h,1);!n&&(i>s||e<=r.maxNode)&&(this.reducePos=i),this.pushState(h,n?s:Math.min(s,this.reducePos)),this.shiftContext(e,s),e<=r.maxNode&&this.buffer.push(e,s,i,4)}else this.pos=i,this.shiftContext(e,s),e<=this.p.parser.maxNode&&this.buffer.push(e,s,i,4)}apply(t,e,s,i){t&65536?this.reduce(t):this.shift(t,e,s,i)}useNode(t,e){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=t)&&(this.p.reused.push(t),s++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(s,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(e&&t.buffer[e-4]==0&&(e-=4);e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let s=t.buffer.slice(e),i=t.bufferBase+e;for(;t&&i==t.bufferBase;)t=t.parent;return new v(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,s,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let s=t<=this.p.parser.maxNode;s&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,s?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new U(this);;){let s=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(s==0)return!1;if((s&65536)==0)return!0;e.reduce(s)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let i=[];for(let h=0,r;h<e.length;h+=2)(r=e[h+1])!=this.state&&this.p.parser.hasAction(r,t)&&i.push(e[h],r);if(this.stack.length<120)for(let h=0;i.length<8&&h<e.length;h+=2){let r=e[h+1];i.some((n,o)=>o&1&&n==r)||i.push(e[h],r)}e=i}let s=[];for(let i=0;i<e.length&&s.length<4;i+=2){let h=e[i+1];if(h==this.state)continue;let r=this.split();r.pushState(h,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(e[i],this.pos),r.reducePos=this.pos,r.score-=200,s.push(r)}return s}forceReduce(){let{parser:t}=this.p,e=t.stateSlot(this.state,5);if((e&65536)==0)return!1;if(!t.validAction(this.state,e)){let s=e>>19,i=e&65535,h=this.stack.length-s*3;if(h<0||t.getGoto(this.stack[h],i,!1)<0){let r=this.findForcedReduction();if(r==null)return!1;e=r}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],s=(i,h)=>{if(!e.includes(i))return e.push(i),t.allActions(i,r=>{if(!(r&393216))if(r&65536){let n=(r>>19)-h;if(n>1){let o=r&65535,a=this.stack.length-n*3;if(a>=0&&t.getGoto(this.stack[a],o,!1)>=0)return n<<19|65536|o}}else{let n=s(r,h+1);if(n!=null)return n}})};return s(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;e<this.stack.length;e+=3)if(this.stack[e]!=t.stack[e])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(t){return this.p.parser.dialect.flags[t]}shiftContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,t,this,this.p.stream.reset(e)))}reduceContext(t,e){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,t,this,this.p.stream.reset(e)))}emitContext(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let t=this.buffer.length-1;(t<0||this.buffer[t]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(t){if(t!=this.curContext.context){let e=new R(this.curContext.tracker,t);e.hash!=this.curContext.hash&&this.emitContext(),this.curContext=e}}setLookAhead(t){return t<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=t,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class R{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}}class U{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,s=t>>19;s==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(s-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}class A{constructor(t,e,s){this.stack=t,this.pos=e,this.index=s,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new A(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new A(this.stack,this.pos,this.index)}}function x(l,t=Uint16Array){if(typeof l!="string")return l;let e=null;for(let s=0,i=0;s<l.length;){let h=0;for(;;){let r=l.charCodeAt(s++),n=!1;if(r==126){h=65535;break}r>=92&&r--,r>=34&&r--;let o=r-32;if(o>=46&&(o-=46,n=!0),h+=o,n)break;h*=46}e?e[i++]=h:e=new t(h)}return e}class P{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const z=new P;class H{constructor(t,e){this.input=t,this.ranges=e,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=z,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let s=this.range,i=this.rangeIndex,h=this.pos+t;for(;h<s.from;){if(!i)return null;let r=this.ranges[--i];h-=s.from-r.to,s=r}for(;e<0?h>s.to:h>=s.to;){if(i==this.ranges.length-1)return null;let r=this.ranges[++i];h+=r.from-s.to,s=r}return h}clipPos(t){if(t>=this.range.from&&t<this.range.to)return t;for(let e of this.ranges)if(e.to>t)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,s,i;if(e>=0&&e<this.chunk.length)s=this.pos+t,i=this.chunk.charCodeAt(e);else{let h=this.resolveOffset(t,1);if(h==null)return-1;if(s=h,s>=this.chunk2Pos&&s<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(s-this.chunk2Pos);else{let r=this.rangeIndex,n=this.range;for(;n.to<=s;)n=this.ranges[++r];this.chunk2=this.input.chunk(this.chunk2Pos=s),s+this.chunk2.length>n.to&&(this.chunk2=this.chunk2.slice(0,n.to-s)),i=this.chunk2.charCodeAt(0)}}return s>=this.token.lookAhead&&(this.token.lookAhead=s+1),i}acceptToken(t,e=0){let s=e?this.resolveOffset(e,-1):this.pos;if(s==null||s<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=t,this.token.end=s}acceptTokenTo(t,e){this.token.value=t,this.token.end=e}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:t,chunkPos:e}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=t,this.chunk2Pos=e,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let t=this.input.chunk(this.pos),e=this.pos+t.length;this.chunk=e>this.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=z,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;t>=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t<this.chunkPos+this.chunk.length?this.chunkOff=t-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(t,e){if(t>=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let s="";for(let i of this.ranges){if(i.from>=e)break;i.to>t&&(s+=this.input.read(Math.max(i.from,t),Math.min(i.to,e)))}return s}}class m{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:s}=e.p;O(this.data,t,e,this.id,s.data,s.tokenPrecTable)}}m.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class W{constructor(t,e,s){this.precTable=e,this.elseToken=s,this.data=typeof t=="string"?x(t):t}token(t,e){let s=t.pos,i=0;for(;;){let h=t.next<0,r=t.resolveOffset(1,1);if(O(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(h||i++,r==null)break;t.reset(r,t.token)}i&&(t.reset(s,t.token),t.acceptToken(this.elseToken,i))}}W.prototype.contextual=m.prototype.fallback=m.prototype.extend=!1;class Z{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}}function O(l,t,e,s,i,h){let r=0,n=1<<s,{dialect:o}=e.p.parser;t:for(;(n&l[r])!=0;){let a=l[r+1];for(let c=r+3;c<a;c+=2)if((l[c+1]&n)>0){let p=l[c];if(o.allows(p)&&(t.token.value==-1||t.token.value==p||q(p,t.token.value,i,h))){t.acceptToken(p);break}}let u=t.next,f=0,d=l[r+2];if(t.next<0&&d>f&&l[a+d*3-3]==65535){r=l[a+d*3-1];continue t}for(;f<d;){let c=f+d>>1,p=a+c+(c<<1),b=l[p],M=l[p+1]||65536;if(u<b)d=c;else if(u>=M)f=c+1;else{r=l[p+2],t.advance();continue t}}break}}function I(l,t,e){for(let s=t,i;(i=l[s])!=65535;s++)if(i==e)return s-t;return-1}function q(l,t,e,s){let i=I(e,s,t);return i<0||I(e,s,l)<i}const g=typeof process<"u"&&N&&/\bparse\b/.test(N.LOG);let T=null;function D(l,t,e){let s=l.cursor(G.IncludeAnonymous);for(s.moveTo(t);;)if(!(e<0?s.childBefore(t):s.childAfter(t)))for(;;){if((e<0?s.to<t:s.from>t)&&!s.type.isError)return e<0?Math.max(0,Math.min(s.to-1,t-25)):Math.min(l.length,Math.max(s.from+1,t+25));if(e<0?s.prevSibling():s.nextSibling())break;if(!s.parent())return e<0?0:l.length}}class J{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?D(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?D(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(t<this.nextStart)return null;for(;this.fragment&&this.safeTo<=t;)this.nextFragment();if(!this.fragment)return null;for(;;){let e=this.trees.length-1;if(e<0)return this.nextFragment(),null;let s=this.trees[e],i=this.index[e];if(i==s.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let h=s.children[i],r=this.start[e]+s.positions[i];if(r>t)return this.nextStart=r,null;if(h instanceof S){if(r==t){if(r<this.safeFrom)return null;let n=r+h.length;if(n<=this.safeTo){let o=h.prop(y.lookAhead);if(!o||n+o<this.fragment.to)return h}}this.index[e]++,r+h.length>=Math.max(this.safeFrom,t)&&(this.trees.push(h),this.start.push(r),this.index.push(0))}else this.index[e]++,this.nextStart=r+h.length}}}class K{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(s=>new P)}getActions(t){let e=0,s=null,{parser:i}=t.p,{tokenizers:h}=i,r=i.stateSlot(t.state,3),n=t.curContext?t.curContext.hash:0,o=0;for(let a=0;a<h.length;a++){if((1<<a&r)==0)continue;let u=h[a],f=this.tokens[a];if(!(s&&!u.fallback)&&((u.contextual||f.start!=t.pos||f.mask!=r||f.context!=n)&&(this.updateCachedToken(f,u,t),f.mask=r,f.context=n),f.lookAhead>f.end+25&&(o=Math.max(f.lookAhead,o)),f.value!=0)){let d=e;if(f.extended>-1&&(e=this.addActions(t,f.extended,f.end,e)),e=this.addActions(t,f.value,f.end,e),!u.extend&&(s=f,e>d))break}}for(;this.actions.length>e;)this.actions.pop();return o&&t.setLookAhead(o),!s&&t.pos==this.stream.end&&(s=new P,s.value=t.p.parser.eofTerm,s.start=s.end=t.pos,e=this.addActions(t,s.value,s.end,e)),this.mainToken=s,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new P,{pos:s,p:i}=t;return e.start=s,e.end=Math.min(s+1,i.stream.end),e.value=s==i.stream.end?i.parser.eofTerm:0,e}updateCachedToken(t,e,s){let i=this.stream.clipPos(s.pos);if(e.token(this.stream.reset(i,t),s),t.value>-1){let{parser:h}=s.p;for(let r=0;r<h.specialized.length;r++)if(h.specialized[r]==t.value){let n=h.specializers[r](this.stream.read(t.start,t.end),s);if(n>=0&&s.p.parser.dialect.allows(n>>1)){(n&1)==0?t.value=n>>1:t.extended=n>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,e,s,i){for(let h=0;h<i;h+=3)if(this.actions[h]==t)return i;return this.actions[i++]=t,this.actions[i++]=e,this.actions[i++]=s,i}addActions(t,e,s,i){let{state:h}=t,{parser:r}=t.p,{data:n}=r;for(let o=0;o<2;o++)for(let a=r.stateSlot(h,o?2:1);;a+=3){if(n[a]==65535)if(n[a+1]==1)a=k(n,a+2);else{i==0&&n[a+1]==2&&(i=this.putAction(k(n,a+2),e,s,i));break}n[a]==e&&(i=this.putAction(k(n,a+1),e,s,i))}return i}}class Q{constructor(t,e,s,i){this.parser=t,this.input=e,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new H(e,i),this.tokens=new K(t,this.stream),this.topTerm=t.top[1];let{from:h}=i[0];this.stacks=[v.start(this,t.top[0],h)],this.fragments=s.length&&this.stream.end-h>t.bufferLength*4?new J(s,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,s=this.stacks=[],i,h;if(this.bigReductionCount>300&&t.length==1){let[r]=t;for(;r.forceReduce()&&r.stack.length&&r.stack[r.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<t.length;r++){let n=t[r];for(;;){if(this.tokens.mainToken=null,n.pos>e)s.push(n);else{if(this.advanceStack(n,s,t))continue;{i||(i=[],h=[]),i.push(n);let o=this.tokens.getMainToken(n);h.push(o.value,o.end)}}break}}if(!s.length){let r=i&&X(i);if(r)return g&&console.log("Finish with "+this.stackID(r)),this.stackToTree(r);if(this.parser.strict)throw g&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+e);this.recovering||(this.recovering=5)}if(this.recovering&&i){let r=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,h,s);if(r)return g&&console.log("Force-finish "+this.stackID(r)),this.stackToTree(r.forceAll())}if(this.recovering){let r=this.recovering==1?1:this.recovering*3;if(s.length>r)for(s.sort((n,o)=>o.score-n.score);s.length>r;)s.pop();s.some(n=>n.reducePos>e)&&this.recovering--}else if(s.length>1){t:for(let r=0;r<s.length-1;r++){let n=s[r];for(let o=r+1;o<s.length;o++){let a=s[o];if(n.sameState(a)||n.buffer.length>500&&a.buffer.length>500)if((n.score-a.score||n.buffer.length-a.buffer.length)>0)s.splice(o--,1);else{s.splice(r--,1);continue t}}}s.length>12&&(s.sort((r,n)=>n.score-r.score),s.splice(12,s.length-12))}this.minStackPos=s[0].pos;for(let r=1;r<s.length;r++)s[r].pos<this.minStackPos&&(this.minStackPos=s[r].pos);return null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}advanceStack(t,e,s){let i=t.pos,{parser:h}=this,r=g?this.stackID(t)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let a=t.curContext&&t.curContext.tracker.strict,u=a?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let d=this.parser.nodeSet.types[f.type.id]==f.type?h.getGoto(t.state,f.type.id):-1;if(d>-1&&f.length&&(!a||(f.prop(y.contextHash)||0)==u))return t.useNode(f,d),g&&console.log(r+this.stackID(t)+` (via reuse of ${h.getName(f.type.id)})`),!0;if(!(f instanceof S)||f.children.length==0||f.positions[0]>0)break;let c=f.children[0];if(c instanceof S&&f.positions[0]==0)f=c;else break}}let n=h.stateSlot(t.state,4);if(n>0)return t.reduce(n),g&&console.log(r+this.stackID(t)+` (via always-reduce ${h.getName(n&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let o=this.tokens.getActions(t);for(let a=0;a<o.length;){let u=o[a++],f=o[a++],d=o[a++],c=a==o.length||!s,p=c?t:t.split(),b=this.tokens.mainToken;if(p.apply(u,f,b?b.start:p.pos,d),g&&console.log(r+this.stackID(p)+` (via ${(u&65536)==0?"shift":`reduce of ${h.getName(u&65535)}`} for ${h.getName(f)} @ ${i}${p==t?"":", split"})`),c)return!0;p.pos>i?e.push(p):s.push(p)}return!1}advanceFully(t,e){let s=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>s)return B(t,e),!0}}runRecovery(t,e,s){let i=null,h=!1;for(let r=0;r<t.length;r++){let n=t[r],o=e[r<<1],a=e[(r<<1)+1],u=g?this.stackID(n)+" -> ":"";if(n.deadEnd&&(h||(h=!0,n.restart(),g&&console.log(u+this.stackID(n)+" (restarted)"),this.advanceFully(n,s))))continue;let f=n.split(),d=u;for(let c=0;c<10&&f.forceReduce()&&(g&&console.log(d+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,s));c++)g&&(d=this.stackID(f)+" -> ");for(let c of n.recoverByInsert(o))g&&console.log(u+this.stackID(c)+" (via recover-insert)"),this.advanceFully(c,s);this.stream.end>n.pos?(a==n.pos&&(a++,o=0),n.recoverByDelete(o,a),g&&console.log(u+this.stackID(n)+` (via recover-delete ${this.parser.getName(o)})`),B(n,s)):(!i||i.score<f.score)&&(i=f)}return i}stackToTree(t){return t.close(),S.build({buffer:A.create(t),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:t.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(t){let e=(T||(T=new WeakMap)).get(t);return e||T.set(t,e=String.fromCodePoint(this.nextStackID++)),e+t}}function B(l,t){for(let e=0;e<t.length;e++){let s=t[e];if(s.pos==l.pos&&s.sameState(l)){t[e].score<l.score&&(t[e]=l);return}}t.push(l)}class V{constructor(t,e,s){this.source=t,this.flags=e,this.disabled=s}allows(t){return!this.disabled||this.disabled[t]==0}}const C=l=>l;class _{constructor(t){this.start=t.start,this.shift=t.shift||C,this.reduce=t.reduce||C,this.reuse=t.reuse||C,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class w extends L{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(" ");this.minRepeatTerm=e.length;for(let n=0;n<t.repeatNodeCount;n++)e.push("");let s=Object.keys(t.topRules).map(n=>t.topRules[n][1]),i=[];for(let n=0;n<e.length;n++)i.push([]);function h(n,o,a){i[n].push([o,o.deserialize(String(a))])}if(t.nodeProps)for(let n of t.nodeProps){let o=n[0];typeof o=="string"&&(o=y[o]);for(let a=1;a<n.length;){let u=n[a++];if(u>=0)h(u,o,n[a++]);else{let f=n[a+-u];for(let d=-u;d>0;d--)h(n[a++],o,f);a++}}}this.nodeSet=new $(e.map((n,o)=>E.define({name:o>=this.minRepeatTerm?void 0:n,id:o,props:i[o],top:s.indexOf(o)>-1,error:o==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(o)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=j;let r=x(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let n=0;n<this.specializerSpecs.length;n++)this.specialized[n]=this.specializerSpecs[n].term;this.specializers=this.specializerSpecs.map(F),this.states=x(t.states,Uint32Array),this.data=x(t.stateData),this.goto=x(t.goto),this.maxTerm=t.maxTerm,this.tokenizers=t.tokenizers.map(n=>typeof n=="number"?new m(r,n):n),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,s){let i=new Q(this,t,e,s);for(let h of this.wrappers)i=h(i,t,e,s);return i}getGoto(t,e,s=!1){let i=this.goto;if(e>=i[0])return-1;for(let h=i[e+1];;){let r=i[h++],n=r&1,o=i[h++];if(n&&s)return o;for(let a=h+(r>>1);h<a;h++)if(i[h]==t)return o;if(n)return-1}}hasAction(t,e){let s=this.data;for(let i=0;i<2;i++)for(let h=this.stateSlot(t,i?2:1),r;;h+=3){if((r=s[h])==65535)if(s[h+1]==1)r=s[h=k(s,h+2)];else{if(s[h+1]==2)return k(s,h+2);break}if(r==e||r==0)return k(s,h+1)}return 0}stateSlot(t,e){return this.states[t*6+e]}stateFlag(t,e){return(this.stateSlot(t,0)&e)>0}validAction(t,e){return!!this.allActions(t,s=>s==e?!0:null)}allActions(t,e){let s=this.stateSlot(t,4),i=s?e(s):void 0;for(let h=this.stateSlot(t,1);i==null;h+=3){if(this.data[h]==65535)if(this.data[h+1]==1)h=k(this.data,h+2);else break;i=e(k(this.data,h+1))}return i}nextStates(t){let e=[];for(let s=this.stateSlot(t,1);;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=k(this.data,s+2);else break;if((this.data[s+2]&1)==0){let i=this.data[s+1];e.some((h,r)=>r&1&&h==i)||e.push(this.data[s],i)}}return e}configure(t){let e=Object.assign(Object.create(w.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let s=this.topRules[t.top];if(!s)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=s}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(s=>{let i=t.tokenizers.find(h=>h.from==s);return i?i.to:s})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((s,i)=>{let h=t.specializers.find(n=>n.from==s.external);if(!h)return s;let r=Object.assign(Object.assign({},s),{external:h.to});return e.specializers[i]=F(r),r})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),s=e.map(()=>!1);if(t)for(let h of t.split(" ")){let r=e.indexOf(h);r>=0&&(s[r]=!0)}let i=null;for(let h=0;h<e.length;h++)if(!s[h])for(let r=this.dialects[e[h]],n;(n=this.data[r++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new V(t,s,i)}static deserialize(t){return new w(t)}}function k(l,t){return l[t]|l[t+1]<<16}function X(l){let t=null;for(let e of l){let s=e.p.stoppedAt;(e.pos==e.p.stream.end||s!=null&&e.pos>s)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.score<e.score)&&(t=e)}return t}function F(l){if(l.external){let t=l.extend?1:0;return(e,s)=>l.external(e,s)<<1|t}return l.get}export{_ as C,Z as E,w as L,W as a};