@marimo-team/frontend 0.25.3-dev4 → 0.25.3-dev40

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 (288) hide show
  1. package/dist/assets/CellStatus-BGIWF94J.js +1 -0
  2. package/dist/assets/{ConnectedDataExplorerComponent-t8fH_TNc.js → ConnectedDataExplorerComponent-D9UK8o9A.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-Gl5nCA8C.js → ErrorBoundary-hliG40Pk.js} +2 -2
  4. package/dist/assets/JsonOutput-9tmC-p6h.js +11 -0
  5. package/dist/assets/{LazyAnyLanguageCodeMirror-CKcCbG2G.js → LazyAnyLanguageCodeMirror-BPYE76jR.js} +2 -2
  6. package/dist/assets/MarimoErrorOutput-BaHdbtck.js +10 -0
  7. package/dist/assets/{RenderHTML-BbOqmHy3.js → RenderHTML-B1FzB5NY.js} +1 -1
  8. package/dist/assets/{RunButton-CK3LhnP5.js → RunButton-DpGokdF1.js} +1 -1
  9. package/dist/assets/{add-cell-with-ai-8UBC0xwR.js → add-cell-with-ai-BYWG0iKO.js} +13 -13
  10. package/dist/assets/{add-connection-dialog-DXQnd6eB.js → add-connection-dialog-BWbUVPJk.js} +2 -2
  11. package/dist/assets/{agent-panel-DdkVL-Kx.js → agent-panel-DKNiQrAl.js} +5 -5
  12. package/dist/assets/ai-model-dropdown-CIg9eu47.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-BKEG4x9u.js → app-config-button-BvkL2eSY.js} +1 -1
  16. package/dist/assets/arrays-0R2reF2y.js +1 -0
  17. package/dist/assets/{blob-D5nfNHOo.js → blob-BQfLiwKr.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-32lVhib7.js → cell-editor-BKKUv4d5.js} +9 -9
  22. package/dist/assets/{cell-link-LSth_8hT.js → cell-link-B_QkRkm-.js} +1 -1
  23. package/dist/assets/{cells-BRkCaSsh.js → cells-CdH98VSn.js} +31 -31
  24. package/dist/assets/{chat-display-Dnagy4Nv.js → chat-display-CNbRSebo.js} +1 -1
  25. package/dist/assets/{chat-panel-DN9vsbgS.js → chat-panel-HbEKDf0c.js} +2 -2
  26. package/dist/assets/{chat-ui-Df8Vcj6n.js → chat-ui-BwMev8Bf.js} +1 -1
  27. package/dist/assets/{circle-DXf-VWZG.js → circle-B6D_6D8w.js} +1 -1
  28. package/dist/assets/code-visibility-sQ37CBNo.js +1 -0
  29. package/dist/assets/coerce-DWjFeXOY.js +1 -0
  30. package/dist/assets/{column-preview-CHK_DNrs.js → column-preview-CsEBzIUE.js} +1 -1
  31. package/dist/assets/command-palette-BzZ86pUz.js +1 -0
  32. package/dist/assets/{common-Cu6CDbuw.js → common-S2v8dsEy.js} +1 -1
  33. package/dist/assets/{components-CGw16R_N.js → components-D-TnFWjo.js} +1 -1
  34. package/dist/assets/{components-CP_UoFtT.js → components-DrU8dOzy.js} +1 -1
  35. package/dist/assets/{components-CXfO-F47.js → components-lDm0qi2t.js} +1 -1
  36. package/dist/assets/config-BoBwH7CU.js +1 -0
  37. package/dist/assets/config-CYsbZpwa.js +104 -0
  38. package/dist/assets/config-DGX7JYor.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-Cq6x_5ML.js → datasource-BA7YF4eo.js} +1 -1
  43. package/dist/assets/{dates-CfmdTL6B.js → dates-CQMwFko2.js} +1 -1
  44. package/dist/assets/{dependency-graph-panel--Kgtktcw.js → dependency-graph-panel-DsjI61Qa.js} +1 -1
  45. package/dist/assets/{dist-iaThVDkA.js → dist-jlhMTKo_.js} +1 -1
  46. package/dist/assets/{documentation-panel-BHmbeznw.js → documentation-panel-hk3IdeXy.js} +1 -1
  47. package/dist/assets/{download-DCJXy66H.js → download-CCZkq0y4.js} +1 -1
  48. package/dist/assets/{dropdown-menu-C1rnl-0o.js → dropdown-menu-DS6umAnH.js} +1 -1
  49. package/dist/assets/edit-page-BgS6tjth.js +9 -0
  50. package/dist/assets/{error-banner-Cd69vvyX.js → error-banner-B5kzVf_0.js} +1 -1
  51. package/dist/assets/{error-entries-Dk3VZ-OK.js → error-entries-BVXrGOTZ.js} +1 -1
  52. package/dist/assets/{error-panel-BPRYmC5J.js → error-panel-DYethUUR.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-DDzObtF2.js +1 -0
  56. package/dist/assets/{feedback-button-Bik2-e33.js → feedback-button-DaNc3uJa.js} +2 -2
  57. package/dist/assets/{file-explorer-panel-BmekFu7T.js → file-explorer-panel-CqnzSSYc.js} +1 -1
  58. package/dist/assets/{file-name-input-Cdc-TVqO.js → file-name-input-D4AvwZV9.js} +1 -1
  59. package/dist/assets/{floating-outline-XD9FAV-f.js → floating-outline-CTy-Iakk.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-Dm6mGwBi.js → gallery-page-ByjlvM6k.js} +1 -1
  64. package/dist/assets/{ganttDiagram-EL5Y4UJY-2n7Ig5Jm.js → ganttDiagram-EL5Y4UJY-CYqkCfFG.js} +1 -1
  65. package/dist/assets/{glide-data-editor-J9CAb70d.js → glide-data-editor-CABBj2b0.js} +2 -2
  66. package/dist/assets/{glide-utils-CIrAxdjv.js → glide-utils-HFqhvWHI.js} +2 -2
  67. package/dist/assets/{home-page-s3LUizSn.js → home-page-DejRSjeJ.js} +3 -3
  68. package/dist/assets/hooks-BJgCcVXZ.js +1 -0
  69. package/dist/assets/{html-to-image-DK9Zl1lU.js → html-to-image-D_0rd3_B.js} +1 -1
  70. package/dist/assets/index-ChfDZJzP.css +2 -0
  71. package/dist/assets/index-PDJQd7X6.js +30 -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-B_GMOySr.js → layout-Ct0rjb-5.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-ABM16htT.js → logs-panel-TyeqEvOY.js} +1 -1
  78. package/dist/assets/{markdown-renderer-BG3sp2rs.js → markdown-renderer-BFyD6Jhs.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-BgEBmqyL.js → name-cell-input-D-0VF3qd.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-DCXQ3_F6.js → outline-panel-DMTjk2WC.js} +1 -1
  86. package/dist/assets/{packages-panel-BMGOmZkR.js → packages-panel-DrT69k9L.js} +1 -1
  87. package/dist/assets/{panel-accordion-state-C1sdPp0m.js → panel-accordion-state-Ban6j---.js} +1 -1
  88. package/dist/assets/panels-BLYQRkEc.js +4 -0
  89. package/dist/assets/precisionRound-BxlUs8G4.js +1 -0
  90. package/dist/assets/process-output-DzpQYlpY.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-Do50PHI8.js → readonly-code-display-Cyn3k5TX.js} +1 -1
  94. package/dist/assets/{readonly-python-code-DCSMIsTX.js → readonly-python-code-DrXDDAnA.js} +1 -1
  95. package/dist/assets/{renderShortcut-BkVJQ_Zh.js → renderShortcut-H60uiHBp.js} +1 -1
  96. package/dist/assets/{reveal-component-CLE6vB1Z.js → reveal-component-_lKImPWP.js} +3 -3
  97. package/dist/assets/{run-page-Depd6lEE.js → run-page-7UNg--Rj.js} +1 -1
  98. package/dist/assets/{runs-BLp5jezv.js → runs-6lJxKV1w.js} +1 -1
  99. package/dist/assets/{runtime-details-state-CSPobEdR.js → runtime-details-state-CKOKhMhv.js} +1 -1
  100. package/dist/assets/{schemas-Dv42wLFq.js → schemas-ChRqMOTL.js} +1 -1
  101. package/dist/assets/{scratchpad-panel-lc6jmpjv.js → scratchpad-panel-C7h4MgqN.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-CLiWXc5y.js +1 -0
  107. package/dist/assets/{snippets-panel-Bh1oTw4m.js → snippets-panel-Wrqaorxa.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-DxQnC_1I.js → state-Ck7FMD5A.js} +1 -1
  112. package/dist/assets/{state-C3oDoyFe.js → state-DaWgt-rn.js} +1 -1
  113. package/dist/assets/state-TVREh4u4.js +3 -0
  114. package/dist/assets/{state-XsPO8hNi.js → state-_uXVmwuN.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-Dp5gyJ7l.js} +3 -3
  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-fUNLyKuj.js +1 -0
  125. package/dist/assets/{tracing-panel-PeRXHD8_.js → tracing-panel-Cx4OqOoP.js} +2 -2
  126. package/dist/assets/{tree-actions-GM5E_bUs.js → tree-actions-B1vsdenY.js} +1 -1
  127. package/dist/assets/{use-restore-focus-BxEGwIbk.js → use-restore-focus-DdS7Tl0F.js} +1 -1
  128. package/dist/assets/{useAddCell-GR7eEQrT.js → useAddCell-DZ-50qEG.js} +1 -1
  129. package/dist/assets/useAsyncData-DhhdOGGd.js +1 -0
  130. package/dist/assets/{useBoolean-BDD6_xQQ.js → useBoolean-5g-bBaYF.js} +1 -1
  131. package/dist/assets/{useCellActionButton-B-9eG5z_.js → useCellActionButton-DINnRstv.js} +1 -1
  132. package/dist/assets/{useDeleteCell-2_bMClHd.js → useDeleteCell-CREJXVNp.js} +1 -1
  133. package/dist/assets/{useDependencyPanelTab-k3C3M18S.js → useDependencyPanelTab-Cw5VT16Q.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-Cw0dVELh.js} +1 -1
  137. package/dist/assets/{useInterval--x3s1VpI.js → useInterval-DJdQmXnq.js} +1 -1
  138. package/dist/assets/useNotebookActions-B4av4mLc.js +1 -0
  139. package/dist/assets/{useRunCells-B2vUhREg.js → useRunCells-BHBMk9zW.js} +1 -1
  140. package/dist/assets/{useSplitCell-DEb03htp.js → useSplitCell-DAgwZV0q.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-pQE2mKc1.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 +76 -77
  149. package/package.json +4 -2
  150. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +3 -2
  151. package/src/__tests__/mount.test.ts +28 -8
  152. package/src/components/app-config/ai-config.tsx +5 -1
  153. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  154. package/src/components/data-table/__tests__/export-actions.test.tsx +329 -6
  155. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  156. package/src/components/data-table/columns.tsx +2 -1
  157. package/src/components/data-table/date-popover.tsx +6 -4
  158. package/src/components/data-table/export-actions.tsx +192 -116
  159. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +2 -2
  160. package/src/components/data-table/schemas.ts +14 -36
  161. package/src/components/editor/Output.tsx +9 -2
  162. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  163. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +80 -252
  164. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +186 -34
  165. package/src/components/editor/actions/pair-with-agent-commands.ts +42 -51
  166. package/src/components/editor/actions/pair-with-agent-modal.tsx +96 -36
  167. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  168. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  169. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +366 -0
  170. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  171. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  172. package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
  173. package/src/components/editor/connections/components.tsx +1 -1
  174. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  175. package/src/components/editor/controls/command-palette.tsx +22 -10
  176. package/src/components/editor/dynamic-favicon.tsx +21 -40
  177. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +537 -0
  178. package/src/components/editor/errors/send-error-report-button.tsx +69 -0
  179. package/src/components/editor/output/MarimoErrorOutput.tsx +21 -5
  180. package/src/components/editor/output/MarimoTracebackOutput.tsx +36 -21
  181. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  182. package/src/components/editor/output/ansi-reduce.ts +6 -0
  183. package/src/components/pages/home-page.tsx +4 -4
  184. package/src/components/tracing/tracing.tsx +2 -2
  185. package/src/core/attachments/__tests__/toast.test.tsx +58 -0
  186. package/src/core/attachments/state.ts +18 -0
  187. package/src/core/attachments/toast.ts +15 -0
  188. package/src/core/cells/__tests__/cells.test.ts +52 -0
  189. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  190. package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
  191. package/src/core/cells/__tests__/session.test.ts +50 -1
  192. package/src/core/cells/cells.ts +2 -1
  193. package/src/core/cells/error-report.ts +63 -0
  194. package/src/core/cells/pending-delete-service.ts +2 -6
  195. package/src/core/cells/session.ts +28 -1
  196. package/src/core/config/pair.ts +5 -3
  197. package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
  198. package/src/core/datasets/data-source-discovery.ts +4 -6
  199. package/src/core/edit-app.tsx +2 -2
  200. package/src/core/host/AGENTS.md +5 -0
  201. package/src/core/host/__tests__/attachments.test.ts +57 -0
  202. package/src/core/host/__tests__/document.test.ts +124 -0
  203. package/src/core/host/__tests__/events.test.ts +46 -0
  204. package/src/core/host/__tests__/fixtures.ts +39 -0
  205. package/src/core/host/__tests__/notebook-client.test.ts +433 -0
  206. package/src/core/host/__tests__/protocol.test.ts +15 -0
  207. package/src/core/host/__tests__/stream.test.ts +209 -0
  208. package/src/core/host/connection.ts +81 -0
  209. package/src/core/host/events.ts +61 -0
  210. package/src/core/host/notebook-client.ts +290 -0
  211. package/src/core/host/protocol.ts +11 -6
  212. package/src/core/host/resources/attachments.ts +19 -0
  213. package/src/core/host/resources/document.ts +101 -0
  214. package/src/core/host/resources/resource.ts +47 -0
  215. package/src/core/host/stream.ts +211 -0
  216. package/src/core/hotkeys/actions.ts +2 -4
  217. package/src/core/network/connection.ts +4 -2
  218. package/src/core/run-app.tsx +2 -2
  219. package/src/core/runtime/__tests__/runtime.test.ts +55 -11
  220. package/src/core/runtime/runtime.ts +18 -5
  221. package/src/core/runtime/types.ts +2 -0
  222. package/src/core/websocket/__tests__/{useMarimoKernelConnection.test.ts → connection-state.test.ts} +15 -17
  223. package/src/core/websocket/__tests__/{useWebSocket.test.ts → createConnectionTransport.test.ts} +1 -1
  224. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +170 -0
  225. package/src/core/websocket/__tests__/{useMarimoKernelConnection.hook.test.tsx → useNotebookSession.hook.test.tsx} +181 -65
  226. package/src/core/websocket/connection-state.ts +70 -0
  227. package/src/core/websocket/state.ts +7 -0
  228. package/src/core/websocket/transports/__tests__/sse.test.ts +1 -4
  229. package/src/core/websocket/transports/create.ts +31 -0
  230. package/src/core/websocket/transports/transport.ts +12 -23
  231. package/src/core/websocket/types.ts +9 -39
  232. package/src/core/websocket/useNotebookClient.ts +88 -0
  233. package/src/core/websocket/{useMarimoKernelConnection.tsx → useNotebookSession.tsx} +59 -225
  234. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  235. package/src/hooks/useAsyncData.ts +3 -3
  236. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  237. package/src/hooks/useElapsedTime.ts +3 -3
  238. package/src/mount.tsx +7 -3
  239. package/src/plugins/core/registerReactComponent.tsx +1 -1
  240. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  241. package/src/plugins/impl/FormPlugin.tsx +1 -1
  242. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +84 -0
  243. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  244. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  245. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  246. package/src/plugins/impl/vega/make-selectable.ts +3 -6
  247. package/src/utils/__tests__/arrays.test.ts +35 -0
  248. package/src/utils/__tests__/numbers.test.ts +48 -1
  249. package/src/utils/__tests__/objects.test.ts +21 -0
  250. package/src/utils/arrays.ts +10 -0
  251. package/src/utils/numbers.ts +28 -17
  252. package/src/utils/objects.ts +3 -7
  253. package/src/utils/once.ts +19 -19
  254. package/dist/assets/CellStatus-BP2mavAq.js +0 -1
  255. package/dist/assets/JsonOutput-DxHKOpPG.js +0 -11
  256. package/dist/assets/MarimoErrorOutput-D60XkCny.js +0 -6
  257. package/dist/assets/ai-model-dropdown-B0z6-zhp.js +0 -5
  258. package/dist/assets/any-language-editor-BLCAD3yx.js +0 -1
  259. package/dist/assets/api-BeC_VSGv.js +0 -1
  260. package/dist/assets/arrays-BqUx5USx.js +0 -1
  261. package/dist/assets/code-visibility-B-_GvwR5.js +0 -1
  262. package/dist/assets/coerce-CpE6kUdX.js +0 -1
  263. package/dist/assets/command-palette-Cf7WX-nr.js +0 -1
  264. package/dist/assets/config-BOKzA3tF.js +0 -1
  265. package/dist/assets/config-DX8Y2WbJ.js +0 -1
  266. package/dist/assets/config-VPSq73n8.js +0 -1
  267. package/dist/assets/edit-page-BT74CF4G.js +0 -9
  268. package/dist/assets/feedback-button-B2gKC5cn.js +0 -1
  269. package/dist/assets/hooks-RnjuFmEx.js +0 -1
  270. package/dist/assets/index-Bcdzex-3.css +0 -2
  271. package/dist/assets/index-D-kY3FU1.js +0 -29
  272. package/dist/assets/linear-0eij_aAG.js +0 -1
  273. package/dist/assets/links-DkkL9DVa.js +0 -1
  274. package/dist/assets/numbers-Mk3-CcoU.js +0 -1
  275. package/dist/assets/pair-CaQyK6En.js +0 -1
  276. package/dist/assets/panels-Dn59o8ay.js +0 -4
  277. package/dist/assets/precisionRound-Bq_nmf5u.js +0 -1
  278. package/dist/assets/process-output-D0KGq04R.js +0 -1
  279. package/dist/assets/react-vega-C3rYGtP6.js +0 -189
  280. package/dist/assets/session-panel-BxS5hiG2.js +0 -1
  281. package/dist/assets/state-_Qai_QyX.js +0 -3
  282. package/dist/assets/tooltip-mT3CGest.js +0 -61
  283. package/dist/assets/tracing-Di6pUmX8.js +0 -1
  284. package/dist/assets/useAsyncData-C7aJJz0Y.js +0 -1
  285. package/dist/assets/useNotebookActions-DIc4xTzY.js +0 -1
  286. package/dist/assets/vega-component-CnadTgoE.js +0 -1
  287. package/dist/assets/vega-loader.browser-CLRkNgm7.js +0 -6
  288. package/src/core/websocket/useWebSocket.tsx +0 -88
@@ -136,6 +136,90 @@ describe("LoadingDataTableComponent", () => {
136
136
  expect(downloadGeoJSON).toHaveBeenCalledTimes(1);
137
137
  });
138
138
 
139
+ it("refreshes export metadata when a dataframe transform changes the data", async () => {
140
+ const host = document.createElement("div");
141
+ const metadataFor = (name: string) => ({
142
+ geometry_columns: [{ name, encoding: "objects", crs: "EPSG:4326" }],
143
+ primary_geometry_column: name,
144
+ default_geometry_column: name,
145
+ formats: {
146
+ parquet: { available: true, reason: null, missing_packages: [] },
147
+ },
148
+ });
149
+ const getExportMetadata = vi
150
+ .fn()
151
+ .mockResolvedValueOnce(metadataFor("before"))
152
+ .mockResolvedValueOnce(metadataFor("after"));
153
+ const view = (data: string) => (
154
+ <Provider store={store}>
155
+ <TooltipProvider>
156
+ <LoadingDataTableComponent
157
+ label={null}
158
+ totalRows={1}
159
+ pagination={false}
160
+ pageSize={10}
161
+ selection={null}
162
+ showDownload={true}
163
+ showFilters={false}
164
+ showColumnSummaries={false}
165
+ showDataTypes={false}
166
+ showPageSizeSelector={false}
167
+ showColumnExplorer={false}
168
+ showRowExplorer={false}
169
+ showChartBuilder={false}
170
+ rowHeaders={[]}
171
+ fieldTypes={undefined}
172
+ totalColumns={1}
173
+ maxColumns="all"
174
+ hasStableRowId={false}
175
+ lazy={false}
176
+ host={host}
177
+ showSearch={false}
178
+ value={[]}
179
+ setValue={vi.fn()}
180
+ data={data}
181
+ search={vi.fn().mockResolvedValue({
182
+ data,
183
+ total_rows: 1,
184
+ cell_styles: null,
185
+ cell_hover_texts: null,
186
+ })}
187
+ download_as={vi.fn()}
188
+ download_geojson={vi.fn()}
189
+ get_export_metadata={getExportMetadata}
190
+ get_column_summaries={vi.fn()}
191
+ get_data_url={vi.fn() as GetDataUrl}
192
+ get_row_ids={vi.fn() as GetRowIds}
193
+ get_size_bytes={vi.fn().mockResolvedValue({ size_bytes: null })}
194
+ />
195
+ </TooltipProvider>
196
+ </Provider>
197
+ );
198
+ const { rerender } = render(
199
+ view(JSON.stringify([{ before: "POINT (1 2)" }])),
200
+ );
201
+ await waitFor(() =>
202
+ expect(
203
+ screen.getByRole("columnheader", { name: "before" }),
204
+ ).toBeInTheDocument(),
205
+ );
206
+ fireEvent.click(screen.getByTestId("export-button"));
207
+ await waitFor(() =>
208
+ expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
209
+ "before",
210
+ ),
211
+ );
212
+
213
+ rerender(view(JSON.stringify([{ after: "POINT (3 4)" }])));
214
+
215
+ await waitFor(() =>
216
+ expect(screen.getByTestId("export-summary-parquet")).toHaveTextContent(
217
+ "after",
218
+ ),
219
+ );
220
+ expect(getExportMetadata).toHaveBeenCalledTimes(2);
221
+ });
222
+
139
223
  it("does not log duplicate keys when a pivot becomes empty", async () => {
140
224
  const host = document.createElement("div");
141
225
  const consoleError = vi
@@ -53,14 +53,14 @@ const AnyLanguageCodeMirror: React.FC<
53
53
  extensions?: readonly Extension[];
54
54
  }
55
55
  > = ({
56
- language,
56
+ language: requestedLanguage,
57
57
  hideUnsupportedLanguageErrors,
58
58
  showCopyButton,
59
59
  extensions = EMPTY_EXTENSIONS,
60
60
  ...props
61
61
  }) => {
62
62
  // Maybe normalize the language to the extension
63
- language = LANGUAGE_MAP[language || ""] || language;
63
+ const language = LANGUAGE_MAP[requestedLanguage || ""] || requestedLanguage;
64
64
 
65
65
  const isSupported = isSupportedLanguage(language);
66
66
  if (!isSupported) {
@@ -73,12 +73,16 @@ export const GlideDataEditor = ({
73
73
  });
74
74
 
75
75
  const [columnWidths, setColumnWidths] = useState<Record<string, number>>({});
76
+ const editableColumnSet = useMemo(
77
+ () => (editableColumns === "all" ? null : new Set(editableColumns)),
78
+ [editableColumns],
79
+ );
76
80
 
77
81
  const columns: ModifiedGridColumn[] = useMemo(() => {
78
82
  const columns: ModifiedGridColumn[] = [];
79
83
  for (const [columnName, fieldType] of columnFields) {
80
84
  const editable =
81
- editableColumns === "all" || editableColumns.includes(columnName);
85
+ editableColumnSet === null || editableColumnSet.has(columnName);
82
86
 
83
87
  columns.push({
84
88
  id: columnName,
@@ -100,7 +104,7 @@ export const GlideDataEditor = ({
100
104
  }
101
105
 
102
106
  return columns;
103
- }, [columnFields, columnWidths, editableColumns, theme]);
107
+ }, [columnFields, columnWidths, editableColumnSet, theme]);
104
108
 
105
109
  const getCellContent = useCallback(
106
110
  (cell: Item): GridCell => {
@@ -110,8 +114,7 @@ export const GlideDataEditor = ({
110
114
  const dataItem = dataRow[columns[col].title];
111
115
  const columnKind = columns[col].kind;
112
116
  const editable =
113
- editableColumns === "all" ||
114
- editableColumns.includes(columns[col].title);
117
+ editableColumnSet === null || editableColumnSet.has(columns[col].title);
115
118
 
116
119
  if (columnKind === GridCellKind.Boolean) {
117
120
  const value = Boolean(dataItem);
@@ -141,7 +144,7 @@ export const GlideDataEditor = ({
141
144
  data: String(dataItem),
142
145
  };
143
146
  },
144
- [columns, data, editableColumns],
147
+ [columns, data, editableColumnSet],
145
148
  );
146
149
 
147
150
  const onCellEdited = useCallback(
@@ -147,6 +147,8 @@ export function pasteCells(options: {
147
147
  }
148
148
 
149
149
  const edits: Edits["edits"] = [];
150
+ const editableColumnSet =
151
+ editableColumns === "all" ? null : new Set(editableColumns);
150
152
 
151
153
  for (const [rowIndex, dataRow] of parsedData.entries()) {
152
154
  if (!dataRow) {
@@ -175,7 +177,7 @@ export function pasteCells(options: {
175
177
  const column = columns[targetColIdx];
176
178
  const columnType = column.dataType;
177
179
  const editable =
178
- editableColumns === "all" || editableColumns.includes(column.title);
180
+ editableColumnSet === null || editableColumnSet.has(column.title);
179
181
 
180
182
  if (!editable) {
181
183
  continue;
@@ -3,6 +3,7 @@
3
3
  import type { TopLevelSpec } from "vega-lite";
4
4
  import type { NonNormalizedSpec } from "vega-lite/types_unstable/spec/index.js";
5
5
  import type { TopLevelParameter } from "vega-lite/types_unstable/spec/toplevel.js";
6
+ import { Arrays } from "@/utils/arrays";
6
7
 
7
8
  import { findEncodedFields, makeEncodingInteractive } from "./encodings";
8
9
  import { Marks } from "./marks";
@@ -357,9 +358,7 @@ export function makeSelectable<T extends VegaLiteSpec>(
357
358
 
358
359
  // If fieldSelection is an array, filter the fields
359
360
  if (Array.isArray(fieldSelection)) {
360
- legendFields = legendFields.filter((field) =>
361
- fieldSelection.includes(field),
362
- );
361
+ legendFields = Arrays.intersection(legendFields, fieldSelection);
363
362
  }
364
363
  }
365
364
 
@@ -420,9 +419,7 @@ function makeLegendSelectable(
420
419
  let legendFields = findEncodedFields(spec);
421
420
  // If fieldSelection is an array, we filter the fields
422
421
  if (Array.isArray(fieldSelection)) {
423
- legendFields = legendFields.filter((field) =>
424
- fieldSelection.includes(field),
425
- );
422
+ legendFields = Arrays.intersection(legendFields, fieldSelection);
426
423
  }
427
424
 
428
425
  const legendParams = legendFields.map((field) => Params.legend(field));
@@ -16,6 +16,41 @@ import {
16
16
  } from "../arrays";
17
17
 
18
18
  describe("arrays", () => {
19
+ describe.each([
20
+ ["intersection", Arrays.intersection, [3, 3, 2], [Number.NaN]],
21
+ ["difference", Arrays.difference, [1], [1]],
22
+ ] as const)("%s", (_name, operation, expected, expectedWithNaN) => {
23
+ it("preserves order and duplicates without mutating readonly inputs", () => {
24
+ const values = Object.freeze([3, 1, 3, 2]);
25
+ const other = Object.freeze([2, 3, 3]);
26
+ expect(operation(values, other)).toEqual(expected);
27
+ expect(values).toEqual([3, 1, 3, 2]);
28
+ expect(other).toEqual([2, 3, 3]);
29
+ });
30
+
31
+ it("uses the same equality as array membership, including NaN", () => {
32
+ expect(operation([Number.NaN, 1], [Number.NaN])).toEqual(expectedWithNaN);
33
+ });
34
+
35
+ it("handles an empty source", () => {
36
+ expect(operation([], [1])).toEqual([]);
37
+ });
38
+ });
39
+
40
+ it("handles empty membership lists", () => {
41
+ expect(Arrays.intersection([1, 1, 2], [])).toEqual([]);
42
+ expect(Arrays.difference([1, 1, 2], [])).toEqual([1, 1, 2]);
43
+ });
44
+
45
+ it("compares objects by identity", () => {
46
+ const shared = { id: 1 };
47
+ const distinct = { id: 1 };
48
+ expect(Arrays.intersection([shared, distinct], [shared])).toEqual([shared]);
49
+ expect(Arrays.difference([shared, distinct], [shared])).toEqual([distinct]);
50
+ expect(Arrays.intersection([shared, distinct], [shared])[0]).toBe(shared);
51
+ expect(Arrays.difference([shared, distinct], [shared])[0]).toBe(distinct);
52
+ });
53
+
19
54
  describe("arrayDelete", () => {
20
55
  it("should delete an element at the specified index", () => {
21
56
  expect(arrayDelete([1, 2, 3], 1)).toEqual([1, 3]);
@@ -1,5 +1,5 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
- import { describe, expect, it } from "vitest";
2
+ import { describe, expect, it, vi } from "vitest";
3
3
  import {
4
4
  countFractionDigits,
5
5
  maxFractionDigitsForSteps,
@@ -20,6 +20,53 @@ describe("prettyNumber", () => {
20
20
 
21
21
  const options = { locale };
22
22
 
23
+ describe("formatter reuse", () => {
24
+ it.each([
25
+ {
26
+ name: "scientific",
27
+ value: 0.000_123_4,
28
+ format: (value: number, locale: string) =>
29
+ prettyScientificNumber(value, { locale }),
30
+ },
31
+ {
32
+ name: "rounded",
33
+ value: 1234.567,
34
+ format: (value: number, locale: string) =>
35
+ prettyScientificNumber(value, { locale, shouldRound: true }),
36
+ },
37
+ {
38
+ name: "engineering",
39
+ value: 12_345,
40
+ format: prettyEngineeringNumber,
41
+ },
42
+ ])(
43
+ "reuses the $name formatter until the locale changes",
44
+ ({ format, value }) => {
45
+ const NumberFormat = Intl.NumberFormat;
46
+ const constructor = vi
47
+ .spyOn(Intl, "NumberFormat")
48
+ .mockImplementation(function (locales, options) {
49
+ return new NumberFormat(locales, options);
50
+ });
51
+ try {
52
+ const first = format(value, "fr-FR");
53
+ expect(format(value, "fr-FR")).toBe(first);
54
+ format(value * 2, "fr-FR");
55
+ expect(constructor).toHaveBeenCalledTimes(1);
56
+
57
+ format(value, "de-DE");
58
+ expect(constructor).toHaveBeenCalledTimes(2);
59
+ expect(constructor).toHaveBeenLastCalledWith(
60
+ "de-DE",
61
+ expect.any(Object),
62
+ );
63
+ } finally {
64
+ constructor.mockRestore();
65
+ }
66
+ },
67
+ );
68
+ });
69
+
23
70
  describe("prettyScientificNumber", () => {
24
71
  it("should handle special cases", () => {
25
72
  expect(prettyScientificNumber(0, options)).toBe("0");
@@ -204,6 +204,27 @@ describe("Objects", () => {
204
204
  });
205
205
 
206
206
  describe("filter", () => {
207
+ it.each([42, { base_url: "https://example.com" }])(
208
+ "preserves an own __proto__ property with value %j",
209
+ (value) => {
210
+ const obj = { ["__proto__"]: value, removed: value };
211
+ const result = Objects.filter(obj, (_, key) => key !== "removed");
212
+
213
+ expect(Object.entries(result)).toEqual([["__proto__", value]]);
214
+ expect(Object.getPrototypeOf(result)).toBe(Object.prototype);
215
+ expect(Object.getOwnPropertyDescriptor(result, "__proto__")).toEqual({
216
+ value,
217
+ writable: true,
218
+ enumerable: true,
219
+ configurable: true,
220
+ });
221
+ expect(Object.keys(obj)).toEqual(["__proto__", "removed"]);
222
+ expect(Objects.filter(obj, (_, key) => key !== "__proto__")).toEqual({
223
+ removed: value,
224
+ });
225
+ },
226
+ );
227
+
207
228
  it("should filter object entries by predicate", () => {
208
229
  const obj = { a: 1, b: 2, c: 3, d: 4 };
209
230
  const result = Objects.filter(obj, (v) => v % 2 === 0);
@@ -55,6 +55,16 @@ export function arrayShallowEquals<T>(a: T[], b: T[]): boolean {
55
55
  export const Arrays = {
56
56
  // oxlint-disable-next-line typescript/no-explicit-any
57
57
  EMPTY: [] as any,
58
+ /** Keep values present in both arrays, preserving the first array's order and duplicates. */
59
+ intersection<T>(values: readonly T[], included: readonly T[]): T[] {
60
+ const includedSet = new Set(included);
61
+ return values.filter((value) => includedSet.has(value));
62
+ },
63
+ /** Remove values present in the second array, preserving order and duplicates. */
64
+ difference<T>(values: readonly T[], excluded: readonly T[]): T[] {
65
+ const excludedSet = new Set(excluded);
66
+ return values.filter((value) => !excludedSet.has(value));
67
+ },
58
68
  zip: <T, U>(a: T[], b: U[]): [T, U][] => {
59
69
  invariant(a.length === b.length, "Arrays must be the same length");
60
70
  return a.map((item, i) => [item, b[i]]);
@@ -23,6 +23,31 @@ export const maxFractionalDigits = memoizeLastValue((locale: string) => {
23
23
  return 0;
24
24
  });
25
25
 
26
+ const getScientificFormatter = memoizeLastValue(
27
+ (locale: string) =>
28
+ new Intl.NumberFormat(locale, {
29
+ minimumFractionDigits: 1,
30
+ maximumFractionDigits: 1,
31
+ notation: "scientific",
32
+ }),
33
+ );
34
+
35
+ const getRoundedFormatter = memoizeLastValue(
36
+ (locale: string) =>
37
+ new Intl.NumberFormat(locale, {
38
+ minimumFractionDigits: 0,
39
+ maximumFractionDigits: 2,
40
+ }),
41
+ );
42
+
43
+ const getEngineeringFormatter = memoizeLastValue(
44
+ (locale: string) =>
45
+ new Intl.NumberFormat(locale, {
46
+ notation: "engineering",
47
+ maximumSignificantDigits: 3,
48
+ }),
49
+ );
50
+
26
51
  /** Decimal places needed to display `n` without float noise. */
27
52
  export function countFractionDigits(n: number): number {
28
53
  if (!Number.isFinite(n) || n === 0) {
@@ -108,23 +133,14 @@ export function prettyScientificNumber(
108
133
  // Determine if the number should be in scientific notation
109
134
  const absValue = Math.abs(value);
110
135
  if (absValue < 1e-2 || absValue >= 1e6) {
111
- return new Intl.NumberFormat(opts.locale, {
112
- minimumFractionDigits: 1,
113
- maximumFractionDigits: 1,
114
- notation: "scientific",
115
- })
116
- .format(value)
117
- .toLowerCase();
136
+ return getScientificFormatter(opts.locale).format(value).toLowerCase();
118
137
  }
119
138
 
120
139
  const { shouldRound, locale } = opts;
121
140
 
122
141
  if (shouldRound) {
123
142
  // Number has an integer part, format with 2 decimal places
124
- return new Intl.NumberFormat(locale, {
125
- minimumFractionDigits: 0,
126
- maximumFractionDigits: 2,
127
- }).format(value);
143
+ return getRoundedFormatter(locale).format(value);
128
144
  }
129
145
 
130
146
  // Don't round
@@ -161,12 +177,7 @@ export function prettyEngineeringNumber(value: number, locale: string): string {
161
177
  return specialCase;
162
178
  }
163
179
 
164
- const [mant, exp] = new Intl.NumberFormat(locale, {
165
- notation: "engineering",
166
- maximumSignificantDigits: 3,
167
- })
168
- .format(value)
169
- .split("E");
180
+ const [mant, exp] = getEngineeringFormatter(locale).format(value).split("E");
170
181
 
171
182
  if (exp in prefixes) {
172
183
  return mant + prefixes[exp as keyof typeof prefixes];
@@ -89,13 +89,9 @@ export const Objects = {
89
89
  obj: Record<K, V>,
90
90
  predicate: (value: V, key: K) => boolean,
91
91
  ): Record<K, V> {
92
- const result: Record<K, V> = {} as Record<K, V>;
93
- for (const [key, value] of Objects.entries(obj)) {
94
- if (predicate(value, key)) {
95
- result[key] = obj[key];
96
- }
97
- }
98
- return result;
92
+ return Objects.fromEntries(
93
+ Objects.entries(obj).filter(([key, value]) => predicate(value, key)),
94
+ );
99
95
  },
100
96
 
101
97
  omit<V extends object, K extends keyof V>(
package/src/utils/once.ts CHANGED
@@ -2,36 +2,36 @@
2
2
 
3
3
  import { arrayShallowEquals } from "./arrays";
4
4
 
5
- // oxlint-disable-next-line typescript/no-explicit-any
6
- export function once<T extends (...args: any[]) => any>(fn: T): T {
7
- let result: ReturnType<T>;
5
+ export function once<F extends (...args: never[]) => unknown>(fn: F): F;
6
+ export function once<Args extends unknown[], Result, This>(
7
+ fn: (this: This, ...args: Args) => Result,
8
+ ): (this: This, ...args: Args) => Result {
9
+ let result: Result;
8
10
  let called = false;
9
- return function (
10
- this: ThisParameterType<T>,
11
- ...args: Parameters<T>
12
- ): ReturnType<T> {
11
+ return function (this: This, ...args: Args): Result {
13
12
  if (!called) {
14
13
  called = true;
15
- result = fn.apply(this, args) as ReturnType<T>;
14
+ result = fn.apply(this, args);
16
15
  }
17
16
  return result;
18
- } as T;
17
+ };
19
18
  }
20
19
 
21
- // oxlint-disable-next-line typescript/no-explicit-any
22
- export function memoizeLastValue<T extends (...args: any[]) => any>(fn: T): T {
23
- let result: ReturnType<T>;
24
- let lastArgs: Parameters<T> | undefined;
20
+ export function memoizeLastValue<F extends (...args: never[]) => unknown>(
21
+ fn: F,
22
+ ): F;
23
+ export function memoizeLastValue<Args extends unknown[], Result, This>(
24
+ fn: (this: This, ...args: Args) => Result,
25
+ ): (this: This, ...args: Args) => Result {
26
+ let result: Result;
27
+ let lastArgs: Args | undefined;
25
28
  let lastError: unknown;
26
29
  let hasError = false;
27
30
 
28
- return function (
29
- this: ThisParameterType<T>,
30
- ...args: Parameters<T>
31
- ): ReturnType<T> {
31
+ return function (this: This, ...args: Args): Result {
32
32
  if (lastArgs === undefined || !arrayShallowEquals(args, lastArgs)) {
33
33
  try {
34
- result = fn.apply(this, args) as ReturnType<T>;
34
+ result = fn.apply(this, args);
35
35
  hasError = false;
36
36
  lastError = undefined;
37
37
  } catch (error) {
@@ -45,5 +45,5 @@ export function memoizeLastValue<T extends (...args: any[]) => any>(fn: T): T {
45
45
  throw lastError;
46
46
  }
47
47
  return result;
48
- } as T;
48
+ };
49
49
  }
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{dr as n,ur as r}from"./cells-BRkCaSsh.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{g as a}from"./useEventListener-D9cftcHj.js";import{t as o}from"./jsx-runtime-B74pBk57.js";import{t as s}from"./tooltip-C9TuY18o.js";import{t as c}from"./ban-YzvUro5I.js";import{a as l,n as u,o as d,t as f}from"./toDate-DOj9Q6uC.js";import{t as p}from"./ellipsis-63DyBLHQ.js";import{t as m}from"./refresh-cw-Qw1f8Jhy.js";import{t as h}from"./workflow-cw-0b9g5.js";import{t as g}from"./useDateFormatter-DA-62E-Y.js";import{i as _,n as v,r as y,t as b}from"./en-US-Buu61juQ.js";import{t as x}from"./multi-icon-DL465pPF.js";function S(e,t){let n=+f(e)-f(t);return n<0?-1:n>0?1:n}function C(e){return u(e,Date.now())}function w(e,t,n){let[r,i]=v(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function T(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function E(e,t){return+f(e)-f(t)}function D(e,t){let n=f(e,t?.in);return n.setHours(23,59,59,999),n}function O(e,t){let n=f(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function k(e,t){let n=f(e,t?.in);return+D(n,t)==+O(n,t)}function A(e,t,n){let[r,i,a]=v(n?.in,e,e,t),o=S(i,a),s=Math.abs(w(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=S(i,a)===-o;k(r)&&s===1&&S(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function j(e,t,n){let r=E(e,t)/1e3;return T(n?.roundingMethod)(r)}function M(e,t,n){let r=_(),i=n?.locale??r.locale??b,a=S(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=v(n?.in,...a>0?[t,e]:[e,t]),u=j(c,s),f=(y(c)-y(s))/1e3,p=Math.round((u-f)/60),m;if(p<2)return n?.includeSeconds?u<5?i.formatDistance(`lessThanXSeconds`,5,o):u<10?i.formatDistance(`lessThanXSeconds`,10,o):u<20?i.formatDistance(`lessThanXSeconds`,20,o):u<40?i.formatDistance(`halfAMinute`,0,o):u<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):p===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,p,o);if(p<45)return i.formatDistance(`xMinutes`,p,o);if(p<90)return i.formatDistance(`aboutXHours`,1,o);if(p<1440){let e=Math.round(p/60);return i.formatDistance(`aboutXHours`,e,o)}if(p<2520)return i.formatDistance(`xDays`,1,o);if(p<43200){let e=Math.round(p/l);return i.formatDistance(`xDays`,e,o)}if(p<86400)return m=Math.round(p/d),i.formatDistance(`aboutXMonths`,m,o);if(m=A(c,s),m<12){let e=Math.round(p/d);return i.formatDistance(`xMonths`,e,o)}{let e=m%12,t=Math.trunc(m/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function N(e,t){return M(e,C(e),t)}var P=i(),F=e(t(),1);function I(e){let t=(0,F.useRef)(e),[n,i]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let e=setInterval(()=>{i(r.now().toMilliseconds())},17);return()=>clearInterval(e)},[]),n-t.current}var L=o(),R=e=>{let t=(0,P.c)(79),{editing:i,status:o,disabled:l,staleInputs:u,edited:d,interrupted:f,elapsedTime:g,runStartTimestamp:_,lastRunStartTimestamp:v,uninstantiated:y}=e;if(!i)return null;let b=_??v,S;t[0]===b?S=t[1]:(S=b?(0,L.jsx)(B,{lastRanTime:b}):null,t[0]=b,t[1]=S);let C=S;if(l&&o===`running`)return a.error(`CellStatusComponent: disabled and running`),null;if(l&&u){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but it's disabled and can't be run`}),t[2]=e):e=t[2];let n;t[3]===C?n=t[4]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[3]=C,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(x,{children:[(0,L.jsx)(c,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(m,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[5]=r):r=t[5];let i;return t[6]===n?i=t[7]:(i=(0,L.jsx)(s,{content:n,usePortal:!0,children:r}),t[6]=n,t[7]=i),i}if(l){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is disabled`}),t[8]=e):e=t[8];let n;t[9]===C?n=t[10]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[9]=C,t[10]=n);let r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-disabled`,"data-testid":`cell-status`,"data-status":`disabled`,children:(0,L.jsx)(c,{className:`h-5 w-5`,strokeWidth:1.5})}),t[11]=r):r=t[11];let i;return t[12]===n?i=t[13]:(i=(0,L.jsx)(s,{content:n,usePortal:!0,children:r}),t[12]=n,t[13]=i),i}if(!u&&o===`disabled-transitively`){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`An ancestor of this cell is disabled, so it can't be run`}),t[14]=e):e=t[14];let n;t[15]===C?n=t[16]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[15]=C,t[16]=n);let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`disabled-transitively`,children:(0,L.jsxs)(x,{layerTop:!0,children:[(0,L.jsx)(h,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(c,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[17]=r):r=t[17];let i;return t[18]===n?i=t[19]:(i=(0,L.jsx)(s,{content:n,usePortal:!0,children:r}),t[18]=n,t[19]=i),i}if(u&&o===`disabled-transitively`){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but an ancestor is disabled so it can't be run`}),t[20]=e):e=t[20];let n;t[21]===C?n=t[22]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[21]=C,t[22]=n);let r;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(x,{children:[(0,L.jsx)(m,{className:`h-5 w-5`,strokeWidth:1}),(0,L.jsx)(c,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[23]=r):r=t[23];let i;return t[24]===n?i=t[25]:(i=(0,L.jsx)(s,{content:n,usePortal:!0,children:r}),t[24]=n,t[25]=i),i}if(o===`running`){let e;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is running`}),t[26]=e):e=t[26];let n;t[27]===C?n=t[28]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[27]=C,t[28]=n);let i;t[29]===_?i=t[30]:(i=r.fromSeconds(_)||r.now(),t[29]=_,t[30]=i);let a;t[31]===i?a=t[32]:(a=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time running`,"data-testid":`cell-status`,"data-status":`running`,children:(0,L.jsx)(V,{startTime:i})}),t[31]=i,t[32]=a);let o;return t[33]!==n||t[34]!==a?(o=(0,L.jsx)(s,{content:n,usePortal:!0,children:a}),t[33]=n,t[34]=a,t[35]=o):o=t[35],o}if(o===`queued`){let e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is queued to run`}),t[36]=e):e=t[36];let n;t[37]===C?n=t[38]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,C]}),t[37]=C,t[38]=n);let r;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-queued`,"data-testid":`cell-status`,"data-status":`queued`,children:(0,L.jsx)(p,{className:`h-5 w-5`,strokeWidth:1.5})}),t[39]=r):r=t[39];let i;return t[40]===n?i=t[41]:(i=(0,L.jsx)(s,{content:n,usePortal:!0,children:r}),t[40]=n,t[41]=i),i}if(d||f||u||y){let e;t[42]===g?e=t[43]:(e=n(g),t[42]=g,t[43]=e);let r=e,i;t[44]!==g||t[45]!==r?(i=g?(0,L.jsx)(z,{elapsedTime:r}):null,t[44]=g,t[45]=r,t[46]=i):i=t[46];let a=i,o,c=``;if(y)o=`This cell has not yet been run`;else if(f){o=`This cell was interrupted when it was last run`;let e;t[47]===a?e=t[48]:(e=(0,L.jsxs)(`span`,{children:[`This cell ran for `,a,` before being interrupted`]}),t[47]=a,t[48]=e),c=e}else if(d){o=`This cell has been modified since it was last run`;let e;t[49]===a?e=t[50]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,a,` to run`]}),t[49]=a,t[50]=e),c=e}else{o=`This cell has not been run with the latest inputs`;let e;t[51]===a?e=t[52]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,a,` to run`]}),t[51]=a,t[52]=e),c=e}let l;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`div`,{className:`cell-status-stale`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(m,{className:`h-5 w-5`,strokeWidth:1.5})}),t[53]=l):l=t[53];let u;t[54]===o?u=t[55]:(u=(0,L.jsx)(s,{content:o,usePortal:!0,children:l}),t[54]=o,t[55]=u);let p;t[56]!==g||t[57]!==r||t[58]!==C||t[59]!==c?(p=g&&(0,L.jsx)(s,{content:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[c,C]}),usePortal:!0,children:(0,L.jsx)(`div`,{className:`elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(`span`,{children:r})})}),t[56]=g,t[57]=r,t[58]=C,t[59]=c,t[60]=p):p=t[60];let h;return t[61]!==u||t[62]!==p?(h=(0,L.jsxs)(`div`,{className:`cell-status-icon flex items-center gap-2`,children:[u,p]}),t[61]=u,t[62]=p,t[63]=h):h=t[63],h}if(g!==null){let e;t[64]===g?e=t[65]:(e=n(g),t[64]=g,t[65]=e);let r=e,i;t[66]!==g||t[67]!==r?(i=g?(0,L.jsx)(z,{elapsedTime:r}):null,t[66]=g,t[67]=r,t[68]=i):i=t[68];let a=i,o;t[69]===a?o=t[70]:(o=(0,L.jsxs)(`span`,{children:[`This cell took `,a,` to run`]}),t[69]=a,t[70]=o);let c;t[71]!==C||t[72]!==o?(c=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[o,C]}),t[71]=C,t[72]=o,t[73]=c):c=t[73];let l;t[74]===r?l=t[75]:(l=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`idle`,children:(0,L.jsx)(`span`,{children:r})}),t[74]=r,t[75]=l);let u;return t[76]!==c||t[77]!==l?(u=(0,L.jsx)(s,{content:c,usePortal:!0,children:l}),t[76]=c,t[77]=l,t[78]=u):u=t[78],u}return null},z=e=>{let t=(0,P.c)(2),n;return t[0]===e.elapsedTime?n=t[1]:(n=(0,L.jsx)(`span`,{className:`tracking-wide font-semibold`,children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n),n},B=e=>{let t=(0,P.c)(4),n=new Date(e.lastRanTime*1e3),r=new Date,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[0]=i):i=t[0];let a=g(i),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o={month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[1]=o):o=t[1];let s=g(o),c=n.toDateString()===r.toDateString()?a:s,l=N(n),u;return t[2]===l?u=t[3]:(u=(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,l,` ago)`]}),t[2]=l,t[3]=u),(0,L.jsxs)(`span`,{children:[`Ran at`,` `,(0,L.jsx)(`strong`,{className:`tracking-wide font-semibold`,children:c.format(n)}),` `,u]})},V=e=>{let t=(0,P.c)(6),r;t[0]===e.startTime?r=t[1]:(r=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=r);let i=I(r),a;t[2]===i?a=t[3]:(a=n(i),t[2]=i,t[3]=a);let o;return t[4]===a?o=t[5]:(o=(0,L.jsx)(`span`,{children:a}),t[4]=a,t[5]=o),o};export{z as n,R as t};