@marimo-team/frontend 0.25.3-dev5 → 0.25.3-dev51

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 (304) hide show
  1. package/dist/assets/CellStatus-RQxLjC9P.js +1 -0
  2. package/dist/assets/{ConnectedDataExplorerComponent-t8fH_TNc.js → ConnectedDataExplorerComponent-D9UK8o9A.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-B4n9EnHB.js → ErrorBoundary-DzEMMFh0.js} +2 -2
  4. package/dist/assets/JsonOutput-9IONH7hu.js +11 -0
  5. package/dist/assets/{LazyAnyLanguageCodeMirror-CKcCbG2G.js → LazyAnyLanguageCodeMirror-BPYE76jR.js} +2 -2
  6. package/dist/assets/MarimoErrorOutput-BT8Qy5wh.js +10 -0
  7. package/dist/assets/{RenderHTML-9bMgbYmo.js → RenderHTML-PyMU3fBB.js} +1 -1
  8. package/dist/assets/{RunButton-CFQUNN5c.js → RunButton-2p2uCp9U.js} +1 -1
  9. package/dist/assets/{add-cell-with-ai-C_SruRWS.js → add-cell-with-ai-CEQ8jvcR.js} +7 -7
  10. package/dist/assets/{add-connection-dialog-CoE_PhuD.js → add-connection-dialog-D9fnw-j0.js} +2 -2
  11. package/dist/assets/{agent-panel-0b3k4QzJ.js → agent-panel-DkTYXm6j.js} +3 -3
  12. package/dist/assets/ai-model-dropdown-Cv9fEAp9.js +13 -0
  13. package/dist/assets/{alert-dialog-BaPGzeOK.js → alert-dialog-C-sWmKva.js} +1 -1
  14. package/dist/assets/any-language-editor-DUMe1UCk.js +1 -0
  15. package/dist/assets/{app-config-button-iXdCWvfC.js → app-config-button-BZzwY1BU.js} +1 -1
  16. package/dist/assets/arrays-0R2reF2y.js +1 -0
  17. package/dist/assets/{blob-iOBwGaP9.js → blob-DmUUV8Xf.js} +1 -1
  18. package/dist/assets/{button-COI-NGrx.js → button-D8gVKwe-.js} +1 -1
  19. package/dist/assets/{cache-panel-DTY1dqvi.js → cache-panel-Byolv2ht.js} +1 -1
  20. package/dist/assets/{capabilities-BJvf-MD4.js → capabilities-Pq1YNPlK.js} +1 -1
  21. package/dist/assets/{cell-editor-CR-tZNnc.js → cell-editor-C6xeN3x0.js} +6 -6
  22. package/dist/assets/cell-link-BNDZZ97N.js +1 -0
  23. package/dist/assets/{cells-rA_jsZCj.js → cells-0e2dpq3z.js} +56 -56
  24. package/dist/assets/{chat-display-luF7psRA.js → chat-display-D6TNcsmz.js} +1 -1
  25. package/dist/assets/chat-panel-CN45Q9wF.js +4 -0
  26. package/dist/assets/{chat-ui-nV_m4Btr.js → chat-ui-BGl1jPPe.js} +1 -1
  27. package/dist/assets/{circle-DXf-VWZG.js → circle-B6D_6D8w.js} +1 -1
  28. package/dist/assets/code-visibility-CV3S4xuf.js +1 -0
  29. package/dist/assets/coerce-DWjFeXOY.js +1 -0
  30. package/dist/assets/{column-preview-uosAAL4X.js → column-preview-D7sTOokc.js} +1 -1
  31. package/dist/assets/command-palette-CP5KmR-S.js +1 -0
  32. package/dist/assets/{common-lisZ0l6a.js → common-GvwCMUGF.js} +1 -1
  33. package/dist/assets/{components-CP_UoFtT.js → components-DrU8dOzy.js} +1 -1
  34. package/dist/assets/{components-CXfO-F47.js → components-lDm0qi2t.js} +1 -1
  35. package/dist/assets/{components-S7ZwOrvO.js → components-nnFZuekV.js} +1 -1
  36. package/dist/assets/config-CjQ4WJnJ.js +1 -0
  37. package/dist/assets/config-DGX7JYor.js +1 -0
  38. package/dist/assets/config-DzdxZb17.js +1 -0
  39. package/dist/assets/{copy-D8O_CYCG.js → copy-KlhazlhB.js} +1 -1
  40. package/dist/assets/{copy-icon-BIiRXh_3.js → copy-icon-8-a5vovc.js} +1 -1
  41. package/dist/assets/{createReducer-DgRODTW6.js → createReducer-HKXUbqyz.js} +1 -1
  42. package/dist/assets/{datasource-V0-52XOh.js → datasource-BpMPWJoj.js} +1 -1
  43. package/dist/assets/{dates-CfmdTL6B.js → dates-CQMwFko2.js} +1 -1
  44. package/dist/assets/{dependency-graph-panel-B0uP-_id.js → dependency-graph-panel-lyJ3aygI.js} +1 -1
  45. package/dist/assets/{dist-iaThVDkA.js → dist-jlhMTKo_.js} +1 -1
  46. package/dist/assets/{documentation-panel-DVl_ebWy.js → documentation-panel-CTUWNQQy.js} +1 -1
  47. package/dist/assets/{download-Bx55LMki.js → download-Csw35OD4.js} +1 -1
  48. package/dist/assets/{dropdown-menu-C1rnl-0o.js → dropdown-menu-DS6umAnH.js} +1 -1
  49. package/dist/assets/{edit-page-CGyjT-CQ.js → edit-page-Dwf3-IB6.js} +6 -6
  50. package/dist/assets/{error-banner-Cd69vvyX.js → error-banner-B5kzVf_0.js} +1 -1
  51. package/dist/assets/{error-entries-DOWpdGvI.js → error-entries-D3H6JH3A.js} +1 -1
  52. package/dist/assets/{error-panel-C-uxLOHF.js → error-panel-CgpCPUEO.js} +1 -1
  53. package/dist/assets/{errors-DCrsa1nH.js → errors-CNsgAw6m.js} +1 -1
  54. package/dist/assets/{es-Cqst59WX.js → es-N9SHpmG7.js} +1 -1
  55. package/dist/assets/feedback-button-B8idT199.js +1 -0
  56. package/dist/assets/{feedback-button-B99ThNJW.js → feedback-button-BEBY1q2a.js} +2 -2
  57. package/dist/assets/file-explorer-panel-MnNgzxxE.js +1 -0
  58. package/dist/assets/{file-name-input-ChnBsDE_.js → file-name-input-DrtIQ1VP.js} +1 -1
  59. package/dist/assets/{floating-outline-MYqQW4Vp.js → floating-outline-Dtc8YhnE.js} +1 -1
  60. package/dist/assets/{formats-yZ06h1Pl.js → formats-zylfwejq.js} +1 -1
  61. package/dist/assets/{formatting-BqrP-n49.js → formatting-uom1es4b.js} +1 -1
  62. package/dist/assets/{fullscreen-B9tHcfpV.js → fullscreen-BWTs8pYZ.js} +1 -1
  63. package/dist/assets/{gallery-page-DSL0J4md.js → gallery-page-DL4SSfun.js} +1 -1
  64. package/dist/assets/{ganttDiagram-EL5Y4UJY-2n7Ig5Jm.js → ganttDiagram-EL5Y4UJY-CYqkCfFG.js} +1 -1
  65. package/dist/assets/{glide-data-editor-B1MWlKeM.js → glide-data-editor-BTlU9F_s.js} +2 -2
  66. package/dist/assets/{glide-utils-CIrAxdjv.js → glide-utils-HFqhvWHI.js} +2 -2
  67. package/dist/assets/{home-page-B1M3X9Yf.js → home-page-BOmrrw3X.js} +3 -3
  68. package/dist/assets/{hooks-Bj0C0zrZ.js → hooks-DRNEKPFW.js} +1 -1
  69. package/dist/assets/{html-to-image-DK9Zl1lU.js → html-to-image-D_0rd3_B.js} +1 -1
  70. package/dist/assets/index-BdCbOYjS.js +30 -0
  71. package/dist/assets/index-evFWHKmM.css +2 -0
  72. package/dist/assets/{input-BoBxR50a.js → input-ByHt6aoV.js} +1 -1
  73. package/dist/assets/{kiosk-mode-BZECfg9k.js → kiosk-mode-BGmMSc7A.js} +1 -1
  74. package/dist/assets/{layout-DBuMeWh0.js → layout-DY2TXsTM.js} +5 -5
  75. package/dist/assets/linear-Bma8J3iM.js +1 -0
  76. package/dist/assets/links-CXcpNIM0.js +1 -0
  77. package/dist/assets/{logs-panel-y0XnfulJ.js → logs-panel-9f0amGf0.js} +1 -1
  78. package/dist/assets/{markdown-renderer-Q5AhbRU3.js → markdown-renderer-BRDCZeXA.js} +1 -1
  79. package/dist/assets/{menu-items-BrwnTgyK.js → menu-items-BgUyNUpu.js} +1 -1
  80. package/dist/assets/{mermaid-a3xYymTy.js → mermaid-B6mqMm5_.js} +2 -2
  81. package/dist/assets/{name-cell-input-BNOnF6-0.js → name-cell-input-13mN6CiO.js} +1 -1
  82. package/dist/assets/numbers-CsZVw3Dc.js +1 -0
  83. package/dist/assets/{objects-snlMn4yk.js → objects-rLPlQ3X_.js} +1 -1
  84. package/dist/assets/{once-Haz_uxEL.js → once-6KNTRW0u.js} +1 -1
  85. package/dist/assets/{outline-panel-Be7stWwv.js → outline-panel-DxC82nfD.js} +1 -1
  86. package/dist/assets/{packages-panel-9Qs1npCZ.js → packages-panel-Bi_mcFbl.js} +1 -1
  87. package/dist/assets/{panel-accordion-state-GeMEdCPw.js → panel-accordion-state-D_2i5aDC.js} +1 -1
  88. package/dist/assets/panels-C-ygF1Rv.js +107 -0
  89. package/dist/assets/precisionRound-BxlUs8G4.js +1 -0
  90. package/dist/assets/process-output-DlZH3EId.js +1 -0
  91. package/dist/assets/{quadrantDiagram-AXDQQJYC-yBhCDI7E.js → quadrantDiagram-AXDQQJYC-D9KH5Zge.js} +1 -1
  92. package/dist/assets/react-vega-BTNeboR2.js +189 -0
  93. package/dist/assets/{readonly-code-display-YULOXf4h.js → readonly-code-display-C8kpTYRT.js} +1 -1
  94. package/dist/assets/{readonly-python-code-CadgXgRu.js → readonly-python-code-XeDpkiXX.js} +1 -1
  95. package/dist/assets/{renderShortcut-BkVJQ_Zh.js → renderShortcut-H60uiHBp.js} +1 -1
  96. package/dist/assets/{reveal-component-B9FLjTg_.js → reveal-component-DgYlZOla.js} +37 -37
  97. package/dist/assets/run-page-C_A8W1eR.js +1 -0
  98. package/dist/assets/{runs-BLp5jezv.js → runs-6lJxKV1w.js} +1 -1
  99. package/dist/assets/{runtime-details-state-DuChzsA6.js → runtime-details-state-BeyT-Z-4.js} +1 -1
  100. package/dist/assets/{schemas-Dv42wLFq.js → schemas-ChRqMOTL.js} +1 -1
  101. package/dist/assets/{scratchpad-panel-DtB0A8xj.js → scratchpad-panel-Fb-8g4-S.js} +1 -1
  102. package/dist/assets/{scroll-to-bottom-button-1FyowpWV.js → scroll-to-bottom-button-CIkON2WJ.js} +1 -1
  103. package/dist/assets/{secrets-panel-Bctbtkrp.js → secrets-panel-CmLZsNfp.js} +1 -1
  104. package/dist/assets/{select-DTBn5eTb.js → select-3CVGlYrC.js} +1 -1
  105. package/dist/assets/{session-DqoWmb7X.js → session-B8Y-GJnS.js} +1 -1
  106. package/dist/assets/{session-panel-B6tA28BD.js → session-panel-Cl85FUT5.js} +1 -1
  107. package/dist/assets/{snippets-panel-CQ1dn3lA.js → snippets-panel-1hl_ey1w.js} +1 -1
  108. package/dist/assets/{spec-BfSBcO5B.js → spec-uCpVvaAR.js} +1 -1
  109. package/dist/assets/{state-uwRvJLb8.js → state-BY4_P6ko.js} +1 -1
  110. package/dist/assets/{state-BAJYRhmO.js → state-C0irhlOZ.js} +1 -1
  111. package/dist/assets/{state-BUsmcyaT.js → state-CbjD81T1.js} +3 -3
  112. package/dist/assets/{state-DxQnC_1I.js → state-Ck7FMD5A.js} +1 -1
  113. package/dist/assets/{state-Bfh_2SLl.js → state-ClkxCKxQ.js} +1 -1
  114. package/dist/assets/{state-C3oDoyFe.js → state-DaWgt-rn.js} +1 -1
  115. package/dist/assets/{strings-B2vv-ENv.js → strings-C25fhMR_.js} +1 -1
  116. package/dist/assets/{swiper-component-a07domrZ.js → swiper-component-CRGRy5_O.js} +1 -1
  117. package/dist/assets/{switch-CTaiAjrz.js → switch-1h011wlH.js} +1 -1
  118. package/dist/assets/{tabs-BuQlZFbt.js → tabs-CY8E4r9U.js} +1 -1
  119. package/dist/assets/{terminal-Ck_vK-34.js → terminal-D__Z_QZ0.js} +1 -1
  120. package/dist/assets/{time-MgToa8VM.js → time-DswSXBDk.js} +1 -1
  121. package/dist/assets/{toast-BGzLGnvw.js → toast-Gzxi-le_.js} +1 -1
  122. package/dist/assets/tooltip-Brya4Ghn.js +61 -0
  123. package/dist/assets/{tooltip-C9TuY18o.js → tooltip-CkGm8X7m.js} +1 -1
  124. package/dist/assets/tracing-DcFczEy0.js +1 -0
  125. package/dist/assets/{tracing-panel-dgnr2fIN.js → tracing-panel-EWvfWPFQ.js} +2 -2
  126. package/dist/assets/{tree-actions-DAd80MbP.js → tree-actions-Dof5VISm.js} +1 -1
  127. package/dist/assets/{use-restore-focus-BxEGwIbk.js → use-restore-focus-DdS7Tl0F.js} +1 -1
  128. package/dist/assets/{useAddCell-DGstJK0S.js → useAddCell-CqnFgwhm.js} +1 -1
  129. package/dist/assets/useAsyncData-DhhdOGGd.js +1 -0
  130. package/dist/assets/useBoolean-CMgj9hnq.js +1 -0
  131. package/dist/assets/{useCellActionButton-DY9RlJTb.js → useCellActionButton--Sq8PDBs.js} +1 -1
  132. package/dist/assets/{useDeleteCell-DFBGlSQk.js → useDeleteCell-DNTqIwU8.js} +1 -1
  133. package/dist/assets/{useDependencyPanelTab-DydxsE5d.js → useDependencyPanelTab-C4_EiuVH.js} +1 -1
  134. package/dist/assets/{useEventListener-D9cftcHj.js → useEventListener-CjDeLqFC.js} +1 -1
  135. package/dist/assets/{useIframeCapabilities-CwTkczVN.js → useIframeCapabilities-Czr9e4uG.js} +1 -1
  136. package/dist/assets/{useInstallPackage-iX1eufdl.js → useInstallPackage-DDjpV5RE.js} +1 -1
  137. package/dist/assets/{useInterval--x3s1VpI.js → useInterval-DJdQmXnq.js} +1 -1
  138. package/dist/assets/{useNotebookActions-CupIPSlg.js → useNotebookActions-C00MOhyT.js} +1 -1
  139. package/dist/assets/{useRunCells-BFjFX3hz.js → useRunCells-DqLsZnRn.js} +1 -1
  140. package/dist/assets/{useSplitCell-Tqv5pPtL.js → useSplitCell-Daxc689Z.js} +1 -1
  141. package/dist/assets/{useTheme-COhSHkCj.js → useTheme-DLtPc-39.js} +1 -1
  142. package/dist/assets/{utils-CaQYvazl.js → utils-DfElfBpz.js} +1 -1
  143. package/dist/assets/vega-component-D7JFthDD.js +1 -0
  144. package/dist/assets/{vega-embed-container-DJPNkHPb.js → vega-embed-container-DtArSJz1.js} +1 -1
  145. package/dist/assets/vega-loader.browser-Bu25TKax.js +6 -0
  146. package/dist/assets/{write-secret-modal-DzKAInL2.js → write-secret-modal-usRSi1bb.js} +1 -1
  147. package/dist/assets/{xychartDiagram-S5SC5T6Z-KbGzG6-u.js → xychartDiagram-S5SC5T6Z-CeRnBS5e.js} +1 -1
  148. package/dist/index.html +73 -73
  149. package/package.json +4 -4
  150. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  151. package/src/__tests__/host-imports.test.ts +1 -0
  152. package/src/__tests__/mount.test.ts +8 -8
  153. package/src/components/app-config/ai-config.tsx +5 -1
  154. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  155. package/src/components/chat/chat-panel.tsx +3 -7
  156. package/src/components/chat/chat-utils.ts +4 -8
  157. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  158. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  159. package/src/components/data-table/__tests__/export-actions.test.tsx +417 -6
  160. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  161. package/src/components/data-table/columns.tsx +2 -1
  162. package/src/components/data-table/context-menu.tsx +36 -20
  163. package/src/components/data-table/date-popover.tsx +6 -4
  164. package/src/components/data-table/export-actions.tsx +263 -161
  165. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +2 -2
  166. package/src/components/data-table/schemas.ts +14 -36
  167. package/src/components/editor/Output.tsx +5 -1
  168. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  169. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  170. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  171. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  172. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  173. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  174. package/src/components/editor/cell/CreateCellButton.tsx +8 -10
  175. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  176. package/src/components/editor/cell/code/cell-editor.tsx +1 -1
  177. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  178. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +277 -78
  179. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +196 -41
  180. package/src/components/editor/connections/components.tsx +1 -1
  181. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  182. package/src/components/editor/controls/command-palette.tsx +22 -10
  183. package/src/components/editor/dynamic-favicon.tsx +21 -40
  184. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +139 -36
  185. package/src/components/editor/errors/send-error-report-button.tsx +10 -7
  186. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  187. package/src/components/editor/output/MarimoTracebackOutput.tsx +28 -22
  188. package/src/components/editor/output/console/ConsoleOutput.tsx +8 -18
  189. package/src/components/pages/home-page.tsx +4 -4
  190. package/src/components/slides/slide-cell-view.tsx +1 -1
  191. package/src/components/tracing/tracing.tsx +2 -2
  192. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  193. package/src/core/attachments/state.ts +5 -8
  194. package/src/core/attachments/toast.ts +15 -0
  195. package/src/core/cells/__tests__/error-report.test.ts +53 -3
  196. package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
  197. package/src/core/cells/__tests__/session.test.ts +18 -3
  198. package/src/core/cells/cells.ts +2 -1
  199. package/src/core/cells/error-report.ts +14 -6
  200. package/src/core/cells/pending-delete-service.ts +2 -6
  201. package/src/core/cells/session.ts +19 -1
  202. package/src/core/config/pair.ts +5 -3
  203. package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
  204. package/src/core/datasets/data-source-discovery.ts +4 -6
  205. package/src/core/edit-app.tsx +2 -2
  206. package/src/core/host/AGENTS.md +11 -2
  207. package/src/core/host/__tests__/attachments.test.ts +56 -0
  208. package/src/core/host/__tests__/document.test.ts +126 -0
  209. package/src/core/host/__tests__/events.test.ts +49 -0
  210. package/src/core/host/__tests__/fixtures.ts +41 -0
  211. package/src/core/host/__tests__/notebook-client.test.ts +496 -0
  212. package/src/core/host/connection.ts +81 -0
  213. package/src/core/host/events.ts +68 -0
  214. package/src/core/host/notebook-client.ts +316 -0
  215. package/src/core/host/resources/attachments.ts +19 -0
  216. package/src/core/host/resources/document.ts +101 -0
  217. package/src/core/hotkeys/actions.ts +2 -4
  218. package/src/core/islands/__tests__/bootstrap.test.ts +0 -26
  219. package/src/core/islands/bootstrap.ts +0 -1
  220. package/src/core/network/connection.ts +4 -2
  221. package/src/core/run-app.tsx +2 -2
  222. package/src/core/runtime/__tests__/runtime.test.ts +5 -12
  223. package/src/core/runtime/runtime.ts +5 -5
  224. package/src/core/static/files.ts +2 -0
  225. package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
  226. package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
  227. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +149 -0
  228. package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +168 -253
  229. package/src/core/websocket/connection-state.ts +70 -0
  230. package/src/core/websocket/state.ts +7 -0
  231. package/src/core/websocket/transports/__tests__/sse.test.ts +18 -4
  232. package/src/core/websocket/transports/create.ts +31 -0
  233. package/src/core/websocket/transports/sse.ts +14 -2
  234. package/src/core/websocket/transports/transport.ts +12 -23
  235. package/src/core/websocket/types.ts +9 -39
  236. package/src/core/websocket/useNotebookClient.ts +78 -0
  237. package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +53 -233
  238. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  239. package/src/hooks/useAsyncData.ts +3 -3
  240. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  241. package/src/hooks/useElapsedTime.ts +3 -3
  242. package/src/hooks/useInputHistory.ts +4 -7
  243. package/src/hooks/useResizeObserver.ts +4 -7
  244. package/src/mount.tsx +3 -3
  245. package/src/plugins/core/registerReactComponent.tsx +1 -1
  246. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  247. package/src/plugins/impl/FormPlugin.tsx +1 -1
  248. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  249. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +2 -0
  250. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  251. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  252. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  253. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  254. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  255. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  256. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  257. package/src/plugins/impl/panel/PanelPlugin.tsx +15 -16
  258. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  259. package/src/plugins/impl/panel/utils.ts +17 -0
  260. package/src/plugins/impl/vega/make-selectable.ts +3 -6
  261. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  262. package/src/stories/editor.stories.tsx +24 -17
  263. package/src/utils/__tests__/arrays.test.ts +35 -0
  264. package/src/utils/__tests__/numbers.test.ts +48 -1
  265. package/src/utils/__tests__/objects.test.ts +21 -0
  266. package/src/utils/arrays.ts +10 -0
  267. package/src/utils/numbers.ts +28 -17
  268. package/src/utils/objects.ts +3 -7
  269. package/src/utils/once.ts +19 -19
  270. package/dist/assets/CellStatus-nZpuDkm7.js +0 -1
  271. package/dist/assets/JsonOutput-d-k8v_17.js +0 -11
  272. package/dist/assets/MarimoErrorOutput-CLYUxiKW.js +0 -10
  273. package/dist/assets/ai-model-dropdown-C6GHHEdR.js +0 -5
  274. package/dist/assets/any-language-editor-BLCAD3yx.js +0 -1
  275. package/dist/assets/arrays-BqUx5USx.js +0 -1
  276. package/dist/assets/cell-link-1CynTVGQ.js +0 -1
  277. package/dist/assets/chat-panel-DDDTnLvB.js +0 -4
  278. package/dist/assets/code-visibility-B-_GvwR5.js +0 -1
  279. package/dist/assets/coerce-CpE6kUdX.js +0 -1
  280. package/dist/assets/command-palette-BZ13RKDJ.js +0 -1
  281. package/dist/assets/config-DX8Y2WbJ.js +0 -1
  282. package/dist/assets/config-FzDtjF1-.js +0 -1
  283. package/dist/assets/config-VPSq73n8.js +0 -1
  284. package/dist/assets/feedback-button-DlqZkJwz.js +0 -1
  285. package/dist/assets/file-explorer-panel-D3CphidS.js +0 -1
  286. package/dist/assets/index-CXIE-QEG.css +0 -2
  287. package/dist/assets/index-DnIgeCyQ.js +0 -29
  288. package/dist/assets/linear-0eij_aAG.js +0 -1
  289. package/dist/assets/links-DkkL9DVa.js +0 -1
  290. package/dist/assets/numbers-Mk3-CcoU.js +0 -1
  291. package/dist/assets/panels-B9x935By.js +0 -4
  292. package/dist/assets/precisionRound-Bq_nmf5u.js +0 -1
  293. package/dist/assets/process-output-DNFKMODr.js +0 -1
  294. package/dist/assets/react-vega-C3rYGtP6.js +0 -189
  295. package/dist/assets/run-page-CjdGaic3.js +0 -1
  296. package/dist/assets/tooltip-mT3CGest.js +0 -61
  297. package/dist/assets/tracing-BARlJ_Dk.js +0 -1
  298. package/dist/assets/useAsyncData-C7aJJz0Y.js +0 -1
  299. package/dist/assets/useBoolean-BDD6_xQQ.js +0 -1
  300. package/dist/assets/vega-component-CnadTgoE.js +0 -1
  301. package/dist/assets/vega-loader.browser-CLRkNgm7.js +0 -6
  302. package/src/core/host/__tests__/protocol.test.ts +0 -214
  303. package/src/core/host/protocol.ts +0 -1943
  304. package/src/core/websocket/useWebSocket.tsx +0 -88
@@ -1,10 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,r as a,t as o,u as s}from"./useEvent-Dfcbgjhg.js";import{t as c}from"./react-DVplv7_D.js";import{Ao as l,D as u,Kr as d,Oa as f,Q as p,Qr as m,Z as h,Za as g,ai as _,b as v,ka as y,no as b,qa as x,ut as S}from"./cells-rA_jsZCj.js";import{t as C}from"./compiler-runtime-BrajqUja.js";import{i as w,r as T,x as E}from"./config-VPSq73n8.js";import{g as D,p as O}from"./useEventListener-D9cftcHj.js";import{t as k}from"./invariant-Ci2dTZ72.js";import{a as A,i as j,o as M,p as ee,r as te,s as N,t as P}from"./config-FzDtjF1-.js";import{r as F,v as ne}from"./session-DqoWmb7X.js";import{O as I,v as re}from"./config-DX8Y2WbJ.js";import{t as ie}from"./cn-ldLVeaqm.js";import{t as ae}from"./jsx-runtime-B74pBk57.js";import{a as oe,p as se,r as ce,t as le}from"./dropdown-menu-C1rnl-0o.js";import{t as L}from"./tooltip-C9TuY18o.js";import{r as ue,t as R}from"./button-COI-NGrx.js";import{t as z}from"./createLucideIcon-DfJ2oMlA.js";import{t as de}from"./check-BQNapYaf.js";import{a as fe}from"./useNumberFormatter-D7O_26UI.js";import{t as pe}from"./chevron-right-eAtVhbNZ.js";import{t as me}from"./hat-glasses-C8RhSVii.js";import{p as B}from"./write-secret-modal-DzKAInL2.js";import{t as he}from"./package-GSoSTiIK.js";import{l as ge,r as _e}from"./datasource-V0-52XOh.js";import{t as V}from"./use-toast-Wu434mLr.js";import{n as ve}from"./strings-B2vv-ENv.js";import{a as ye}from"./dist-DusFODSa.js";import{t as be}from"./uuid-k9DpjH68.js";import{t as xe}from"./RenderHTML-9bMgbYmo.js";import{t as Se,u as Ce}from"./useInstallPackage-iX1eufdl.js";import{r as we}from"./errors-DCrsa1nH.js";import{t as Te}from"./kbd-pdKBv96t.js";import{t as Ee}from"./error-entries-DOWpdGvI.js";import{r as De,t as Oe}from"./alert-DTaqCu_d.js";import{n as ke,o as Ae}from"./state-Bfh_2SLl.js";import{n as H}from"./cell-link-1CynTVGQ.js";var je=z(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),U=z(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),Me=z(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),W=e(c(),1),G=C();function Ne(e,t){let n,r;return`errors`in t?(n=t.errors.map(Ee).join(`
2
- `),r=t.errors.flatMap(e=>`traceback`in e&&e.traceback?[h(S(e.traceback))]:[]).join(`
3
-
4
- `)):(r=h(S(t.traceback)),n=r.split(`
5
- `).findLast(e=>e.length>0)??``),{type:`cell-output`,cell_id:e,...t.code===void 0?{}:{code:t.code},output:{type:`error`,message:n,...r?{traceback:r}:{}}}}var Pe=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,Fe=String.raw`(?<!_)${Pe}`;RegExp(`^${Pe}$`);var Ie=new RegExp(Fe),K=new RegExp(Fe,`g`);function Le(e){let t=[];K.lastIndex=0;let n=0,r=K.exec(e);for(;r!==null;)r.index>n&&t.push(e.slice(n,r.index)),t.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=K.exec(e);return n<e.length&&t.push(e.slice(n)),t}function Re(e){return Ie.test(e)}function ze(e){let t=null,n=e.cursor();do n.name===`ExpressionStatement`&&(t=n.node);while(n.next());return t}function Be(e){let t=e.split(`
6
- `),n=` `,r=ze(ye.parse(e));if(!r)return[`def _():`,...q(t,n),`${n}return`,``,``,`_()`].join(`
7
- `);let i=e.slice(0,r.from).trim(),a=e.slice(r.from).trim(),o=i.split(`
8
- `),s=a.split(`
9
- `);return[`def _():`,...q(o,n),`${n}return ${s[0]}`,...q(s.slice(1),n),``,``,`_()`].join(`
10
- `)}function q(e,t){if(e.length===1&&e[0]===``)return[];let n=[];for(let r of e)r===``?n.push(``):n.push(t+r);return n}function Ve(e,t){if(e.type===`multiple-defs`)return[{title:`Fix: Wrap in a function`,description:`Make this cell's variables local by wrapping the cell in a function.`,fixType:`manual`,onFix:async e=>{k(e.editor,`Editor is null`);let t=Be(e.editor.state.doc.toString());e.editor.dispatch({changes:{from:0,to:e.editor.state.doc.length,insert:t}})}}];if(e.type===`exception`&&e.exception_type===`NameError`){let t=e.msg.match(/name '(.+)' is not defined/)?.[1];if(!t||!(t in Ue))return[];let n=He(t);return[{title:`Fix: Add '${n}'`,description:`Add a new cell for the missing import`,fixType:`manual`,onFix:async e=>{e.addCodeBelow(n)}}]}return e.type===`sql-error`&&t.aiEnabled?[{title:`Fix with AI`,description:`Fix the SQL statement`,fixType:`ai`,onFix:async t=>{let n=_e(t.cellId,a),r=`Fix the SQL statement: ${e.msg}.`;n&&(r+=`\nDatabase schema: ${n}`),t.aiFix?.setAiCompletionCell({cellId:t.cellId,initialPrompt:r,triggerImmediately:t.aiFix.triggerFix})}}]:[]}function He(e){let t=Ue[e];return t===e?`import ${t}`:`import ${t} as ${e}`}var Ue={mo:`marimo`,alt:`altair`,bokeh:`bokeh`,dask:`dask`,np:`numpy`,pd:`pandas`,pl:`polars`,plotly:`plotly`,plt:`matplotlib.pyplot`,px:`plotly.express`,scipy:`scipy`,sk:`sklearn`,sns:`seaborn`,stats:`scipy.stats`,tf:`tensorflow`,torch:`torch`,xr:`xarray`,dt:`datetime`,json:`json`,math:`math`,os:`os`,re:`re`,sys:`sys`},J=I(`marimo:acp:sessions:v1`,{sessions:[],activeTabId:null},m),We=r(e=>{let t=e(J);return t.activeTabId&&t.sessions.find(e=>e.tabId===t.activeTabId)||null},(e,t,n)=>{t(J,e=>({...e,activeTabId:n}))});function Ge(){return`tab_${be()}`}function Ke(e,t=20){return e.length<=t?e:`${e.slice(0,t-3)}...`}function qe(e,t){let n=tt(t.agentId),r=Date.now(),i=t.firstMessage?Ke(t.firstMessage.trim()):`New ${t.agentId} session`,a=Ge();if(n===`single`){let n=e.sessions.filter(e=>e.agentId===t.agentId),a=e.sessions.filter(e=>e.agentId!==t.agentId);if(n.length>0){let o=n[0],s={agentId:t.agentId,title:i,createdAt:r,lastUsedAt:r,tabId:o.tabId,externalAgentSessionId:null,selectedModel:t.model??o.selectedModel??null};return{...e,sessions:[...a.slice(0,0),s],activeTabId:s.tabId}}}return{...e,sessions:[...e.sessions.slice(0,0),{agentId:t.agentId,tabId:a,title:i,createdAt:r,lastUsedAt:r,externalAgentSessionId:null,selectedModel:t.model??null}],activeTabId:a}}function Je(e,t){let n=e.sessions.filter(e=>e.tabId!==t);return{sessions:n,activeTabId:e.activeTabId===t?n.length>0?n[n.length-1].tabId:null:e.activeTabId}}function Ye(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,title:Ke(t)}:e)}:e}function Xe(e,t){return{...e,sessions:e.sessions.map(e=>e.tabId===t?{...e,lastUsedAt:Date.now()}:e)}}function Ze(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,externalAgentSessionId:t,lastUsedAt:Date.now()}:e)}:e}function Qe(){return[`claude`,`gemini`,`codex`,`opencode`,`cursor`]}function $e(e){return ve(e)}function et(e){let t=Y[e].port,n=window.location.hostname;return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${n}:${t}/message`}var Y={claude:{port:3017,command:`npx @agentclientprotocol/claude-agent-acp`,sessionSupport:`single`},gemini:{port:3019,command:`npx @google/gemini-cli --experimental-acp`,sessionSupport:`single`},codex:{port:3021,command:`npx @zed-industries/codex-acp`,sessionSupport:`single`},opencode:{port:3023,command:`npx opencode-ai acp`,sessionSupport:`single`},cursor:{port:3025,command:`agent acp`,sessionSupport:`single`}};function tt(e){return Y[e].sessionSupport}function nt(e){let t=Y[e].port,n=Y[e].command;return`npx stdio-to-ws "${O()?`cmd /c ${n}`:n}" --port ${t}`}var rt=I(`marimo:chrome:ai-panel-tab`,`chat`,m);function it(){let e=(0,G.c)(3),[n,r]=t(rt),i;return e[0]!==n||e[1]!==r?(i={aiPanelTab:n,setAiPanelTab:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var at=`code_mode`;function ot(e,t){return e||(_(`external_agents`)?t:`chat`)}function st(){let e=(0,G.c)(6),{openApplication:t}=d(),{setAiPanelTab:r}=it(),{saveModeChange:i}=P(),a=s(Ae),c=n(),l;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==c?(l=async e=>{let n=ot(e.panel,c.get(rt)),o=c.get(w),s=_(`external_agents`)&&c.get(J).sessions.length>0;if(!(n===`agents`?s:o)){V({title:n===`agents`?`No agent session`:`AI not configured`,description:n===`agents`?`Start an agent session or switch to the chat panel.`:`Configure an AI provider and chat model to fix with AI.`,variant:`danger`});return}e.panel&&r(e.panel),n===`chat`&&await i(at).catch(ct),a({prompt:e.prompt,submit:e.submit??!1}),t(`ai`)},e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=l):l=e[5],o(l)}function ct(){return D.error(`Failed to save mode change`)}var lt=I(`marimo:ai-autofix-mode`,`autofix`,m);function ut(){let e=(0,G.c)(3),[n,r]=t(lt),i;return e[0]!==n||e[1]!==r?(i={fixMode:n,setFixMode:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var X=ae();function dt(e,t){if(e!=null)return`@error://${e}\n\nPlease fix this error.`;let n=t?.trim();return n?`My code gives the following error. Please fix it:\n\n${n}`:`Please fix this error.`}var Z=e=>{let t=(0,G.c)(25),{errors:r,cellId:a,className:o}=e,c=n(),{createNewCell:l}=u(),d=i(T),f;if(t[0]!==d||t[1]!==r){let e;t[3]===d?e=t[4]:(e=e=>Ve(e,{aiEnabled:d}),t[3]=d,t[4]=e),f=r.flatMap(e),t[0]=d,t[1]=r,t[2]=f}else f=t[2];let p=f,m=s(ke),h=st();if(p.length===0)return null;let g=p[0],_;t[5]!==a||t[6]!==l||t[7]!==g||t[8]!==m||t[9]!==c?(_=e=>{let t=c.get(v).cellHandles[a].current?.editorView;g.onFix({addCodeBelow:e=>{l({cellId:a,autoFocus:!1,before:!1,code:e})},editor:t,cellId:a,aiFix:{setAiCompletionCell:m,triggerFix:e}}),t?.focus()},t[5]=a,t[6]=l,t[7]=g,t[8]=m,t[9]=c,t[10]=_):_=t[10];let y=_,b;t[11]!==a||t[12]!==h?(b=()=>{h({prompt:dt(a)})},t[11]=a,t[12]=h,t[13]=b):b=t[13];let x=b,S;t[14]===o?S=t[15]:(S=ie(`my-2`,o),t[14]=o,t[15]=S);let C;t[16]!==g.description||t[17]!==g.fixType||t[18]!==g.title||t[19]!==y||t[20]!==x?(C=g.fixType===`ai`?(0,X.jsx)(mt,{tooltip:g.description,openPrompt:()=>y(!1),applyAutofix:()=>y(!0),openChat:x}):(0,X.jsx)(L,{content:g.description,align:`start`,children:(0,X.jsxs)(R,{size:`xs`,variant:`outline`,className:`font-normal`,onClick:()=>y(!1),children:[(0,X.jsx)(ge,{className:`h-3 w-3 mr-2`}),g.title]})}),t[16]=g.description,t[17]=g.fixType,t[18]=g.title,t[19]=y,t[20]=x,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,X.jsx)(`div`,{className:S,children:C}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w},ft={autofix:{Icon:ge,title:`Inline AI Fix`,description:`Apply AI fixes inline in the cell`},chat:{Icon:me,title:`Fix with AI assistant`,description:`Open the AI sidebar to fix`},prompt:{Icon:x,title:`Suggest a prompt`,description:`Edit the prompt before applying`}},pt=[`autofix`,`prompt`,`chat`],mt=e=>{let t=(0,G.c)(18),{tooltip:n,openPrompt:r,applyAutofix:i,openChat:a}=e,{fixMode:o,setFixMode:s}=ut(),c=r;o===`chat`?c=a:o===`autofix`&&(c=i);let{Icon:l,title:u}=ft[o],d;t[0]===l?d=t[1]:(d=(0,X.jsx)(l,{className:`h-3 w-3 mr-2 mb-0.5`}),t[0]=l,t[1]=d);let f;t[2]!==c||t[3]!==d||t[4]!==u?(f=(0,X.jsxs)(R,{size:`xs`,variant:`outline`,className:`font-normal rounded-r-none border-r-0`,onClick:c,children:[d,u]}),t[2]=c,t[3]=d,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==f||t[7]!==n?(p=(0,X.jsx)(L,{content:n,align:`start`,children:f}),t[6]=f,t[7]=n,t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(se,{asChild:!0,children:(0,X.jsx)(R,{size:`xs`,variant:`outline`,className:`rounded-l-none px-2`,"aria-label":`Fix options`,children:(0,X.jsx)(fe,{className:`h-3 w-3`})})}),t[9]=m):m=t[9];let h;t[10]!==o||t[11]!==s?(h=pt.map(e=>(0,X.jsx)(oe,{className:`flex items-center gap-2`,onClick:()=>s(e),children:(0,X.jsx)(ht,{mode:e,selected:e===o})},e)),t[10]=o,t[11]=s,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,X.jsxs)(le,{children:[m,(0,X.jsx)(ce,{align:`end`,className:`w-56`,children:h})]}),t[13]=h,t[14]=g);let _;return t[15]!==p||t[16]!==g?(_=(0,X.jsxs)(`div`,{className:`flex`,children:[p,g]}),t[15]=p,t[16]=g,t[17]=_):_=t[17],_},ht=e=>{let t=(0,G.c)(15),{mode:n,selected:r}=e,{Icon:i,title:a,description:o}=ft[n],s;t[0]===i?s=t[1]:(s=(0,X.jsx)(i,{className:`h-4 w-4 shrink-0`}),t[0]=i,t[1]=s);let c;t[2]===a?c=t[3]:(c=(0,X.jsx)(`span`,{className:`font-medium`,children:a}),t[2]=a,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,X.jsx)(de,{className:`h-4 w-4 ml-auto shrink-0`}),t[9]=r,t[10]=d);let f;return t[11]!==s||t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[s,u,d]}),t[11]=s,t[12]=u,t[13]=d,t[14]=f):f=t[14],f},gt=e=>{let t=(0,G.c)(12),{local:n}=e,r;t[0]===n.name?r=t[1]:(r=(0,X.jsx)(`span`,{className:`font-code`,children:n.name}),t[0]=n.name,t[1]=r);let i;t[2]===n.cellId?i=t[3]:(i=(0,X.jsx)(H,{cellId:n.cellId}),t[2]=n.cellId,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,X.jsxs)(`div`,{className:`max-w-xs`,children:[`Local variable `,r,` in cell`,` `,i,`.`]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o=a,s;t[7]===n.name?s=t[8]:(s=(0,X.jsx)(`span`,{className:`font-code cursor-help`,children:n.name}),t[7]=n.name,t[8]=s);let c;return t[9]!==s||t[10]!==o?(c=(0,X.jsx)(L,{content:o,children:s}),t[9]=s,t[10]=o,t[11]=c):c=t[11],c},_t=e=>{let t=(0,G.c)(4),{segments:n}=e,r;t[0]===n?r=t[1]:(r=n.map(vt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i};function vt(e,t){return typeof e==`string`?(0,X.jsx)(`span`,{children:e},t):(0,X.jsx)(gt,{local:e},t)}var yt=r([]),bt=r(e=>e(re)?e(yt).filter(e=>e.kind===`agent`):[]);function xt(e){return e.name||`Agent`}function St({getContent:e}){let t=i(ee),n=i(bt),r=i(F),[a,o]=(0,W.useState)(!1);return t?(0,X.jsxs)(R,{size:`xs`,variant:`outline`,disabled:a||n.length===0||!r,onClick:async()=>{if(!(a||n.length===0||!r)){o(!0);try{await N.post(`/pair/notebooks/${encodeURIComponent(r)}/messages`,e()),V({title:`Sent to ${n.map(xt).join(`, `)}`})}catch(e){V({variant:`danger`,title:e instanceof we&&e.status===409?`No agent attached`:`Could not send error`})}finally{o(!1)}}},children:[(0,X.jsx)(je,{className:`h-3 w-3 mr-2`}),`Send error to agent`]}):null}var Ct=new p,wt=e=>{let t=RegExp(`\x1B\\[[0-9;]*m`,`g`);return e.replaceAll(t,``)},Tt=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function Et(e){Tt.lastIndex=0;let t=Tt.exec(e);if(!t)return null;let n=t.index+t[0].length,r=e.slice(n).split(/\s+/),i=``,a=0;for(let e of r){let t=e.trim();if(!t)continue;if(t.startsWith(`-`)){a+=t.length+1;continue}let n=t.match(/^[\w,.[\]-]+/);if(n){i=n[0];break}break}if(!i)return null;let o=n+a+i.length;return{package:i,endIndex:o}}function Q(e,t=``){if(!e)return null;if(!/https?:\/\//.test(e))return e;let n=l(e);return n.length===1&&n[0].type===`text`?e:(0,X.jsx)(X.Fragment,{children:n.map((e,n)=>{let r=t?`${t}-${n}`:n;if(e.type===`url`){let t=wt(e.url);return(0,X.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ue.stopPropagation(),className:`text-link hover:underline`,children:t},r)}if(e.type===`image`){let t=wt(e.url);return(0,X.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ue.stopPropagation(),className:`text-link hover:underline`,children:t},r)}return(0,X.jsx)(W.Fragment,{children:e.value},r)})})}var Dt=e=>{let t=(0,G.c)(6),{packages:n,children:r}=e,{handleInstallPackages:i}=Se(),a;t[0]!==i||t[1]!==n?(a=e=>{i(n),e.preventDefault()},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==r||t[4]!==a?(o=(0,X.jsx)(`button`,{onClick:a,className:`text-link hover:underline`,type:`button`,children:r}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o},Ot=e=>{if(!(e instanceof y.Text))return;let t=wt(e.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(t))return;let n=[],r=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=r.exec(t))!==null;){let e=i.index,r=Et(t.slice(e));r&&n.push({match:i,result:r})}if(n.length===0)return;let a=[],o=0;if(n.forEach((e,n)=>{let{match:r,result:i}=e,s=r.index,c=s+i.endIndex;if(o<s){let e=t.slice(o,s);a.push((0,X.jsx)(W.Fragment,{children:Q(e,`before-${n}`)},`before-${n}`))}let l=t.slice(s,c);a.push((0,X.jsx)(Dt,{packages:[i.package],children:l},`install-${n}`)),o=c}),o<t.length){let e=t.slice(o);a.push((0,X.jsx)(W.Fragment,{children:Q(e,`after`)},`after`))}return(0,X.jsx)(X.Fragment,{children:a})},kt=e=>{if(!(e instanceof y.Text))return;let t=e.data;if(!/https?:\/\//.test(t))return;let n=Q(t);if(typeof n!=`string`)return(0,X.jsx)(X.Fragment,{children:n})},At=(...e)=>t=>{for(let n of e){let e=n(t);if(e!==void 0)return e}},jt=(e,t)=>{let n=Ct.ansi_to_html(e),r=f(n,{replace:e=>t(e)});return(0,X.jsx)(`span`,{children:r})},Mt=e=>{let t=(0,G.c)(2),{text:n}=e,r;return t[0]===n?r=t[1]:(r=jt(n,At(Ot,kt)),t[0]=n,t[1]=r),r},Nt=e=>{let t=(0,G.c)(16),{traceback:n}=e,[r,i]=(0,W.useState)(!0),a;t[0]===r?a=t[1]:(a=()=>i(!r),t[0]=r,t[1]=a);let o=r?`Collapse traceback`:`Expand traceback`,s;t[2]===r?s=t[3]:(s=r?(0,X.jsx)(fe,{className:`h-3 w-3`}):(0,X.jsx)(pe,{className:`h-3 w-3`}),t[2]=r,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(`span`,{className:`text-[0.6875rem] uppercase tracking-wider`,children:`Traceback`}),t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==s?(l=(0,X.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":r,"aria-label":o,className:`flex items-center gap-1 text-muted-foreground/70 hover:text-muted-foreground transition-colors`,children:[s,c]}),t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u;t[10]!==r||t[11]!==n?(u=r&&(0,X.jsx)(`div`,{className:`font-code text-sm mt-1 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text`,children:xe({html:n})}),t[10]=r,t[11]=n,t[12]=u):u=t[12];let d;return t[13]!==l||t[14]!==u?(d=(0,X.jsxs)(`div`,{className:`mt-2`,children:[l,u]}),t[13]=l,t[14]=u,t[15]=d):d=t[15],d},$=e=>{let t=(0,G.c)(10),n=e.title??`Tip`,r;t[0]===n?r=t[1]:(r=(0,X.jsx)(M,{className:`pt-2 pb-0 font-normal`,children:n}),t[0]=n,t[1]=r);let i;t[2]===e.children?i=t[3]:(i=(0,X.jsx)(j,{className:`mr-24 text-[0.84375rem]`,wrapperClassName:`pt-0 pb-2`,children:e.children}),t[2]=e.children,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,X.jsxs)(A,{value:`item-1`,className:`text-muted-foreground`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.className||t[8]!==a?(o=(0,X.jsx)(te,{type:`single`,collapsible:!0,className:e.className,children:a}),t[7]=e.className,t[8]=a,t[9]=o):o=t[9],o},Pt=e=>{let t=(0,G.c)(44),{errors:n,cellId:r,code:a,className:o}=e,s=d(),c=i(E).display.cell_output===`above`,l=i(ne).mode!==`edit`,u=`This cell wasn't run because it has errors`,f=`destructive`,p=`text-error`,m=null;if(n.some(Ft))u=`Interrupted`;else if(n.some(It))u=`An internal error occurred`;else if(n.some(Lt))u=`Ancestor prevented from running`,f=`default`,p=`text-secondary-foreground`;else if(n.some(Rt))u=`Ancestor stopped`,f=`default`,p=`text-secondary-foreground`;else if(n.some(zt))u=`SQL error`;else if(n.some(Bt))u=null,m=`Cell not run`;else{let e;t[0]===n?e=t[1]:(e=n.find(Vt),t[0]=n,t[1]=e);let r=e;r&&`exception_type`in r&&(u=r.exception_type)}let h,_,v,y,x,S;if(t[2]!==f||t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n||t[7]!==c||t[8]!==l||t[9]!==m||t[10]!==p||t[11]!==u){let e=n.filter(Ht),i=n.filter(Ut),a=n.filter(Wt),d=n.filter(Gt),C=n.filter(Kt),w=n.filter(qt),T=n.filter(Jt),E=n.filter(Yt),D=n.filter(Xt),O=n.filter(Zt),k=n.filter(Qt),A=n.filter($t),j=n.filter(en),M;t[18]===s?M=t[19]:(M=()=>{s.openApplication(`scratchpad`)},t[18]=s,t[19]=M);let ee=M,te=()=>{let t=[];if(k.length>0||A.length>0){let e=k.some(tn),n=!e&&k.some(nn);t.push((0,X.jsxs)(`div`,{children:[k.map(rn),A.map(an),e&&(0,X.jsxs)(R,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>Ce(s),children:[(0,X.jsx)(he,{className:`h-3.5 w-3.5 mr-1.5 mb-0.5`}),(0,X.jsx)(`span`,{children:`Open package manager`})]}),n&&(0,X.jsxs)(R,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>s.openApplication(`terminal`),children:[(0,X.jsx)(Me,{className:`h-3.5 w-3.5 mr-1.5`}),(0,X.jsx)(`span`,{children:`Open terminal`})]}),r&&(0,X.jsx)(Z,{errors:[...k,...A],cellId:r})]},`syntax-unknown`))}if(e.length>0&&t.push((0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`The setup cell cannot be run because it has references.`}),(0,X.jsx)(`ul`,{className:`list-disc`,children:e.flatMap(on)}),r&&(0,X.jsx)(Z,{errors:e,cellId:r}),(0,X.jsxs)($,{title:`Why can't the setup cell have references?`,className:`mb-2`,children:[(0,X.jsx)(`p`,{className:`pb-2`,children:`The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables.`}),(0,X.jsx)(`p`,{className:`py-2`,children:`Try simplifying the setup cell to only contain only necessary variables.`}),(0,X.jsxs)(`p`,{className:`py-2`,children:[(0,X.jsxs)(B,{href:`https://links.marimo.app/errors-setup`,children:[`Learn more at our docs`,` `,(0,X.jsx)(U,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`setup-refs`)),i.length>0&&t.push((0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell is in a cycle.`}),(0,X.jsx)(`ul`,{className:`list-disc`,children:i.flatMap(sn)}),r&&(0,X.jsx)(Z,{errors:i,cellId:r}),(0,X.jsxs)($,{title:`What are cycles and how do I resolve them?`,className:`mb-2`,children:[(0,X.jsx)(`p`,{className:`pb-2`,children:`An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug.`}),(0,X.jsx)(`p`,{className:`py-2`,children:`Try merging these cells into a single cell to eliminate the cycle.`}),(0,X.jsxs)(`p`,{className:`py-2`,children:[(0,X.jsxs)(B,{href:`https://links.marimo.app/errors-cycles`,children:[`Learn more at our docs`,` `,(0,X.jsx)(U,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`cycle`)),a.length>0){let e=a[0].name;t.push((0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell redefines variables from other cells.`}),a.map(ln),r&&(0,X.jsx)(Z,{errors:a,cellId:r}),(0,X.jsxs)($,{title:`Why can't I redefine variables?`,children:[(0,X.jsx)(`p`,{className:`pb-2`,children:`marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more.`}),(0,X.jsxs)(`p`,{className:`py-2`,children:[`Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., `,(0,X.jsxs)(Te,{className:`inline`,children:[`_`,e]}),`). to make them private to this cell.`]}),(0,X.jsxs)(`p`,{className:`py-2`,children:[(0,X.jsxs)(B,{href:`https://links.marimo.app/errors-multiple-definitions`,children:[`Learn more at our docs`,` `,(0,X.jsx)(U,{size:`0.75rem`,className:`inline`})]}),`.`]})]}),(0,X.jsx)($,{title:`Need a scratchpad?`,children:(0,X.jsxs)(`div`,{className:`flex flex-row gap-2 items-center`,children:[(0,X.jsxs)(R,{size:`xs`,variant:`link`,className:`my-2 font-normal mx-0 px-0`,onClick:ee,children:[(0,X.jsx)(g,{className:`h-3`}),(0,X.jsx)(`span`,{children:`Try the scratchpad`})]}),(0,X.jsx)(`span`,{children:`to experiment without restrictions on variable names.`})]})})]},`multiple-defs`))}return d.length>0&&t.push((0,X.jsxs)(`div`,{children:[d.map(un),r&&(0,X.jsx)(Z,{errors:d,cellId:r}),(0,X.jsxs)($,{title:"Why can't I use `import *`?",children:[(0,X.jsx)(`p`,{className:`pb-2`,children:`Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution.`}),(0,X.jsx)(`p`,{className:`py-2`,children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,X.jsx)(`p`,{className:`py-2`,children:`Star imports would also silently add names to globals, which would be incompatible with reactive execution.`}),(0,X.jsxs)(`p`,{className:`py-2`,children:[(0,X.jsxs)(B,{href:`https://links.marimo.app/errors-import-star`,children:[`Learn more at our docs`,` `,(0,X.jsx)(U,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`import-star`)),C.length>0&&t.push((0,X.jsxs)(`div`,{children:[C.map(dn),r&&(0,X.jsx)(Z,{errors:C,cellId:r})]},`interruption`)),w.length>0&&t.push((0,X.jsxs)(`ul`,{children:[w.map((e,t)=>{if(e.exception_type===`NameError`&&e.msg.startsWith(`name 'mo'`))return(0,X.jsx)(`li`,{className:`my-2`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:`name 'mo' is not defined.`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`The marimo module (imported as`,` `,(0,X.jsx)(Te,{className:`inline`,children:`mo`}),`) is required for Markdown, SQL, and UI elements.`]})]})},`exception-${t}`);if(e.exception_type===`NameError`&&e.msg.startsWith(`name '_`)){let n=Le(e.msg);return(0,X.jsx)(`li`,{className:`my-2`,children:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:(0,X.jsx)(_t,{segments:n})}),(0,X.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`Variables prefixed with an underscore are local to a cell`,` `,`(`,(0,X.jsxs)(B,{href:`https://links.marimo.app/local-variables`,children:[`docs`,` `,(0,X.jsx)(U,{size:`0.75rem`,className:`inline`})]}),`).`]}),c&&(0,X.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]})},`exception-${t}`)}return(0,X.jsx)(`li`,{className:`my-2`,children:e.raising_cell==null?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:Q(e.msg,`exception-${t}`)}),l&&`traceback`in e&&e.traceback?(0,X.jsx)(Nt,{traceback:e.traceback}):c&&(0,X.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]}):(0,X.jsxs)(`div`,{children:[Q(e.msg,`exception-${t}`),(0,X.jsx)(H,{cellId:e.raising_cell}),l&&`traceback`in e&&e.traceback&&(0,X.jsx)(Nt,{traceback:e.traceback})]})},`exception-${t}`)}),w.some(fn)&&(0,X.jsx)($,{children:`Fix the error in the mentioned cells, or handle the exceptions with try/except blocks.`}),r&&(0,X.jsx)(Z,{errors:w,cellId:r})]},`exception`)),T.length>0&&t.push((0,X.jsxs)(`ul`,{children:[T.map(pn),r&&(0,X.jsx)(Z,{errors:T,cellId:r}),(0,X.jsx)($,{children:T.some(mn)?`Ensure that the referenced cells define the required variables, or turn off strict execution.`:`Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution.`})]},`strict-exception`)),E.length>0&&t.push((0,X.jsxs)(`div`,{children:[E.map(hn),r&&(0,X.jsx)(Z,{errors:E,cellId:r})]},`internal`)),D.length>0&&t.push((0,X.jsxs)(`div`,{children:[D.map(gn),r&&(0,X.jsx)(Z,{errors:D,cellId:r})]},`ancestor-prevented`)),O.length>0&&t.push((0,X.jsxs)(`div`,{children:[O.map(_n),r&&(0,X.jsx)(Z,{errors:O,cellId:r})]},`ancestor-stopped`)),j.length>0&&t.push((0,X.jsxs)(`div`,{children:[j.map(vn),r&&(0,X.jsx)(Z,{errors:j,cellId:r,className:`mt-2.5`})]},`sql-errors`)),t},N;t[20]===m?N=t[21]:(N=m&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1 font-code text-[0.6875rem] uppercase tracking-wider text-muted-foreground/70`,children:[m,(0,X.jsx)(L,{content:`marimo didn't run this cell because it detected an error.`,delayDuration:200,children:(0,X.jsx)(b,{className:`size-3 cursor-help`})})]}),t[20]=m,t[21]=N);let P;t[22]!==p||t[23]!==u?(P=u&&(0,X.jsx)(De,{className:`font-code font-medium ${p}`,children:u}),t[22]=p,t[23]=u,t[24]=P):P=t[24];let F;t[25]!==N||t[26]!==P?(F=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[N,P]}),t[25]=N,t[26]=P,t[27]=F):F=t[27];let ne=F;h=Oe,y=f,t[28]===o?x=t[29]:(x=ie(`border-none font-code text-sm text-[0.84375rem] p-0 text-muted-foreground normal has-[svg]:pl-0 space-y-2`,o),t[28]=o,t[29]=x),S=ne,_=`flex flex-col gap-4`,v=te(),t[2]=f,t[3]=r,t[4]=s,t[5]=o,t[6]=n,t[7]=c,t[8]=l,t[9]=m,t[10]=p,t[11]=u,t[12]=h,t[13]=_,t[14]=v,t[15]=y,t[16]=x,t[17]=S}else h=t[12],_=t[13],v=t[14],y=t[15],x=t[16],S=t[17];let C;t[30]!==_||t[31]!==v?(C=(0,X.jsx)(`div`,{className:_,children:v}),t[30]=_,t[31]=v,t[32]=C):C=t[32];let w;t[33]!==r||t[34]!==a||t[35]!==n?(w=r&&n.length>0&&(0,X.jsx)(St,{getContent:()=>Ne(r,{code:a,errors:n})}),t[33]=r,t[34]=a,t[35]=n,t[36]=w):w=t[36];let T;return t[37]!==h||t[38]!==y||t[39]!==x||t[40]!==S||t[41]!==C||t[42]!==w?(T=(0,X.jsxs)(h,{variant:y,className:x,children:[S,C,w]}),t[37]=h,t[38]=y,t[39]=x,t[40]=S,t[41]=C,t[42]=w,t[43]=T):T=t[43],T};function Ft(e){return e.type===`interruption`}function It(e){return e.type===`internal`}function Lt(e){return e.type===`ancestor-prevented`}function Rt(e){return e.type===`ancestor-stopped`}function zt(e){return e.type===`sql-error`}function Bt(e){return e.type===`multiple-defs`||e.type===`cycle`||e.type===`setup-refs`||e.type===`import-star`}function Vt(e){return e.type===`exception`}function Ht(e){return e.type===`setup-refs`}function Ut(e){return e.type===`cycle`}function Wt(e){return e.type===`multiple-defs`}function Gt(e){return e.type===`import-star`}function Kt(e){return e.type===`interruption`}function qt(e){return e.type===`exception`}function Jt(e){return e.type===`strict-exception`}function Yt(e){return e.type===`internal`}function Xt(e){return e.type===`ancestor-prevented`}function Zt(e){return e.type===`ancestor-stopped`}function Qt(e){return e.type===`syntax`}function $t(e){return e.type===`unknown`}function en(e){return e.type===`sql-error`}function tn(e){return e.msg.includes(`!pip`)}function nn(e){return e.msg.includes(`use os.subprocess`)}function rn(e,t){return(0,X.jsx)(`pre`,{children:Q(e.msg,`syntax-${t}`)},`syntax-${t}`)}function an(e,t){return(0,X.jsx)(`pre`,{children:Q(e.msg,`unknown-${t}`)},`unknown-${t}`)}function on(e,t){return e.edges_with_vars.map((e,n)=>(0,X.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,X.jsx)(H,{cellId:e[0]}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,` `,e[1].length===1?e[1][0]:e[1].join(`, `)]})]},`setup-refs-${t}-${n}`))}function sn(e,t){return e.edges_with_vars.map((e,n)=>(0,X.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,X.jsx)(H,{cellId:e[0]}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[` -> `,e[1].length===1?e[1][0]:e[1].join(`, `),` -> `]}),(0,X.jsx)(H,{cellId:e[2]})]},`cycle-${t}-${n}`))}function cn(e,t){return(0,X.jsx)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:(0,X.jsx)(H,{cellId:e})},`cell-${t}`)}function ln(e,t){return(0,X.jsxs)(W.Fragment,{children:[(0,X.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`'${e.name}' was also defined by:`}),(0,X.jsx)(`ul`,{className:`list-disc`,children:e.cells.map(cn)})]},`multiple-defs-${t}`)}function un(e,t){return(0,X.jsx)(`p`,{className:`text-muted-foreground`,children:e.msg},`import-star-${t}`)}function dn(e,t){return(0,X.jsx)(`p`,{children:`This cell was interrupted and needs to be re-run.`},`interruption-${t}`)}function fn(e){return e.raising_cell!=null}function pn(e,t){return(0,X.jsx)(`li`,{className:`my-2`,children:e.blamed_cell==null?(0,X.jsx)(`p`,{children:e.msg}):(0,X.jsxs)(`div`,{children:[e.msg,(0,X.jsx)(H,{cellId:e.blamed_cell})]})},`strict-exception-${t}`)}function mn(e){return e.blamed_cell!=null}function hn(e,t){return(0,X.jsx)(`p`,{children:e.msg},`internal-${t}`)}function gn(e,t){return(0,X.jsxs)(`div`,{children:[e.msg,e.blamed_cell==null?(0,X.jsxs)(`span`,{children:[`(`,(0,X.jsx)(H,{cellId:e.raising_cell}),`)`]}):(0,X.jsxs)(`span`,{children:[`(`,(0,X.jsx)(H,{cellId:e.raising_cell}),`\xA0blames\xA0`,(0,X.jsx)(H,{cellId:e.blamed_cell}),`)`]})]},`ancestor-prevented-${t}`)}function _n(e,t){return(0,X.jsxs)(`div`,{children:[e.msg,(0,X.jsx)(H,{cellId:e.raising_cell})]},`ancestor-stopped-${t}`)}function vn(e,t){return(0,X.jsx)(`div`,{className:`space-y-2 mt-2`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground whitespace-pre-wrap`,children:e.msg})},`sql-error-${t}`)}export{Ye as C,Me as D,Ne as E,Xe as S,Le as T,et as _,xt as a,We as b,mt as c,it as d,qe as f,tt as g,$e as h,bt as i,dt as l,nt as m,Mt as n,yt as o,J as p,St as r,_t as s,Pt as t,st as u,Qe as v,Re as w,Ze as x,Je as y};