@marimo-team/islands 0.25.3-dev23 → 0.25.3-dev230
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ConnectedDataExplorerComponent-DfG3PRaJ.js → ConnectedDataExplorerComponent-BBihxHrr.js} +120 -116
- package/dist/{ErrorBoundary-h0Ea26dF.js → ErrorBoundary-DZwEkAT6.js} +16 -16
- package/dist/_baseSet-BfI5FjBM.js +328 -0
- package/dist/{abnfDiagram-VCTEODGH-B3w-XWX8.js → abnfDiagram-VCTEODGH-DBcJVxYP.js} +2 -2
- package/dist/any-language-editor-jGaR0EAo.js +75 -0
- package/dist/{architectureDiagram-5GKGNRK7-C18U9A6k.js → architectureDiagram-5GKGNRK7-BcHZXF4S.js} +1 -1
- package/dist/{arrays-CN1djC4k.js → arrays-DoQ-AILx.js} +15 -27
- package/dist/assets/__vite-browser-external-BKBpimif.js +1 -0
- package/dist/assets/worker-CgoMtD-_.js +113 -0
- package/dist/{blockDiagram-I7D4REHJ-Cg25UrxT.js → blockDiagram-I7D4REHJ-Dkhe6_PP.js} +1 -1
- package/dist/{button-CvjkwdSk.js → button-B6RjDKJx.js} +227 -217
- package/dist/{capabilities-CQ5IjhzL.js → capabilities-CkVzWJEX.js} +2 -2
- package/dist/{chat-ui-w8SVynkn.js → chat-ui-DljFsfWf.js} +1277 -1275
- package/dist/{check-BMKBBrdc.js → check-Z_vtI3OL.js} +1 -1
- package/dist/{chunk-IMKFNOWR-CrS5bzqW.js → chunk-IMKFNOWR-CTZlwBAA.js} +1 -1
- package/dist/{chunk-SHT3W25Y-StpvPvUG.js → chunk-SHT3W25Y-53g_RZHm.js} +1 -1
- package/dist/{chunk-SVP7TREG-CBXjbYZC.js → chunk-SVP7TREG-P6abNGV_.js} +1 -1
- package/dist/{chunk-TICWLB2K-Dp6bIb-q.js → chunk-TICWLB2K-BTJJqkyF.js} +1 -1
- package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-YOKDWASO-DKplTrBY.js} +20 -20
- package/dist/{classDiagram-ZZMXUADV-BFYuxV5g.js → classDiagram-ZZMXUADV-BUGqOrTm.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-D_tjXVMl.js → classDiagram-v2-VYDZK3BY-CXpQvO-s.js} +2 -2
- package/dist/code-visibility-BOmgV0Fh.js +134 -0
- package/dist/{common-DNPxRLm_.js → common-DdHcuklD.js} +9837 -9658
- package/dist/config-DbjzjwxX.js +636 -0
- package/dist/{copy-icon-BgUO8jsi.js → copy-icon-CG57cxwb.js} +3 -3
- package/dist/createReducer-DePYJ0F3.js +63 -0
- package/dist/{cynefinDiagram-5FMLGOSQ-DSgYrHB2.js → cynefinDiagram-5FMLGOSQ-DOcnl8wW.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-GYlruCBf.js → dagre-GXQ25YYZ-CuHR9QfG.js} +3 -3
- package/dist/{dagre-BGSfXNEb.js → dagre-mqiMAsFY.js} +531 -680
- package/dist/{data-grid-overlay-editor-B9QxYH-I.js → data-grid-overlay-editor-Dxdsrndd.js} +5 -5
- package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-0PJ-9N5n.js} +1 -1
- package/dist/{debounce-C3jyATpc.js → debounce-DrhhziJv.js} +2 -2
- package/dist/{diagram-S7CK7UJ4-DRu5LX5_.js → diagram-S7CK7UJ4-BPiG4kso.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DD7uiejP.js → diagram-UQ7AKVKN-_piBOvOC.js} +1 -1
- package/dist/{diagram-VX7I27RA-ByH9KAJJ.js → diagram-VX7I27RA-DCzVeJ8M.js} +1 -1
- package/dist/{diagram-Z3DM3KII-BsQHPRke.js → diagram-Z3DM3KII-D64CF1jQ.js} +1 -1
- package/dist/{dialog-Cc479ZEH.js → dialog-DsZ49mmU.js} +26 -26
- package/dist/{dist-Bvs24R_E.js → dist-11T5wq3_.js} +31 -30
- package/dist/{dist-F8Ep36rk.js → dist-17ugwGZc.js} +59 -58
- package/dist/{dist-BMQf5zIS.js → dist-7cRjf--y.js} +123 -122
- package/dist/{dist-diIx5qJW.js → dist-B8pkfkzc.js} +31 -30
- package/dist/{dist-CN_BeG2I.js → dist-B9UoM_wq.js} +58 -57
- package/dist/{dist-CLdpGQVr.js → dist-BGuMTs1i.js} +118 -117
- package/dist/{dist-BK4Oj99o.js → dist-BHW11fni.js} +18 -17
- package/dist/dist-BLY4m1Wi.js +850 -0
- package/dist/{dist-PXYI_yuP.js → dist-BNlcVoxs.js} +24 -23
- package/dist/{dist-D6d86eNJ.js → dist-BQYe5Bju.js} +47 -46
- package/dist/{dist-CkTTIdBe.js → dist-BX1mn8na.js} +337 -337
- package/dist/{dist-DiDibOYr.js → dist-Bh0PTKUW.js} +151 -150
- package/dist/{dist-CSJ0MDRw.js → dist-CKaXK92p.js} +56 -55
- package/dist/{dist-C8fAKSH1.js → dist-CLhwfhpJ.js} +53 -52
- package/dist/{dist-DoE4XJBC.js → dist-CYeqK4Xw.js} +9801 -10649
- package/dist/{dist-BLfKmR-l.js → dist-Cxlp3WH6.js} +16 -15
- package/dist/{dist-D-wwqlzJ.js → dist-DSJPGj42.js} +158 -157
- package/dist/{dist-BorMD-uX.js → dist-DU9ICsWZ.js} +75 -74
- package/dist/{dist-DBtSl3sf.js → dist-DWv0ALBi.js} +47 -46
- package/dist/{dist-OR1OnN-y.js → dist-DiBpWEsB.js} +31 -30
- package/dist/{dist-CrSP_H1M.js → dist-DiLFTlnl.js} +242 -242
- package/dist/{dist-DpBpA_n1.js → dist-Lm-D-Vr6.js} +3 -3
- package/dist/{dist-CSbh1PNP.js → dist-cVDV5IuI.js} +23 -22
- package/dist/{dist-BuaRHxOc.js → dist-fRfaOoq8.js} +44 -43
- package/dist/{dist-Cg7gzw-a.js → dist-gTTI-9Px.js} +78 -77
- package/dist/dropdown-menu-BRiE7Vnp.js +6083 -0
- package/dist/{ebnfDiagram-PWID7BFC-CQRK5_eT.js → ebnfDiagram-PWID7BFC-BapQPML-.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-BKtWrDVh.js → erDiagram-RLTQ6QDP-CNQvC2_Q.js} +1 -1
- package/dist/{error-banner-CFPHFw4h.js → error-banner-IsonnvA0.js} +84 -83
- package/dist/error-entries-CRPfxMqm.js +2505 -0
- package/dist/{esm-D2gTsXEV.js → esm-BgKjMvWw.js} +530 -529
- package/dist/{esm-AMFssoNp.js → esm-CHjVSexr.js} +328 -329
- package/dist/feedback-button-bkhTNCeV.js +374 -0
- package/dist/{flowDiagram-HODETNUW-1IN-ih2E.js → flowDiagram-HODETNUW-BBt6S6oe.js} +2 -2
- package/dist/{formats-X4mMQWzX.js → formats-BK4VefeF.js} +6 -6
- package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-Dh_4cBJZ.js} +2 -2
- package/dist/{glide-data-editor-BIYjd9hQ.js → glide-data-editor-Cd5G4gkf.js} +417 -415
- package/dist/{glide-utils-DM9zBO4W.js → glide-utils-CQddGpa-.js} +16 -16
- package/dist/{globals-BX22lYk2.js → globals-Cm5hDd9R.js} +3 -3
- package/dist/{graphlib-BmY_CCV9.js → graphlib-nlwT3Wvy.js} +177 -220
- package/dist/hasIn-C20JsQ2m.js +28 -0
- package/dist/{highlighted-body-KPVGNVTW-zwjq21tf.js → highlighted-body-KPVGNVTW-3Ziwfz-V.js} +2 -2
- package/dist/{error-entries-Damuuclv.js → html-to-image-0FooaKop.js} +26911 -26769
- package/dist/{infoDiagram-27XIBGKW-CkB-zr4p.js → infoDiagram-27XIBGKW-Hd8Ifz82.js} +1 -1
- package/dist/isArrayLikeObject-B-HXCsex.js +626 -0
- package/dist/isEmpty-CdX7MTE1.js +14 -0
- package/dist/{ishikawaDiagram-5VMMS53U-wlyLjBmM.js → ishikawaDiagram-5VMMS53U-CP7hnHWx.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-C2usY0i-.js → kanban-definition-UXKFOSKX-CX91sa9b.js} +1 -1
- package/dist/{linear-Cnaq3Tfb.js → linear-DWERh7eI.js} +121 -73
- package/dist/{loader-BQOfjTIJ.js → loader-BisjOLiW.js} +12 -12
- package/dist/main.js +10253 -8126
- package/dist/{mermaid-BA-Z6wGL.js → mermaid-Djb3Ni9t.js} +54 -54
- package/dist/mermaid-HWGCJPDP-Du3-HPQA.js +2 -0
- package/dist/{mindmap-definition-YA3MSWOX-nKOWS8RR.js → mindmap-definition-YA3MSWOX-DgCNo07O.js} +1 -1
- package/dist/{now-jM8-M7IR.js → now-BKZCLE5P.js} +12 -13
- package/dist/{number-overlay-editor-DK-HbLsV.js → number-overlay-editor-BLCXOIUf.js} +3 -3
- package/dist/{dist-CN8zI-XC.js → objectWithoutPropertiesLoose-ai5NUqGa.js} +262 -240
- package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
- package/dist/{once-BtE-wKRL.js → once-NnpX_HnX.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-Dac9EIKD.js → pegDiagram-XKGWAZYB-SGJhnIKo.js} +2 -2
- package/dist/pick-tCszMUbm.js +35 -0
- package/dist/{pieDiagram-E7YTZNPT-B7S-DsW_.js → pieDiagram-E7YTZNPT-1stXIWCQ.js} +1 -1
- package/dist/precisionRound-DhAzeRcm.js +49 -0
- package/dist/{process-output-CTPTtxXB.js → process-output-BOvkTEDt.js} +4 -4
- package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-Blrm7V7_.js} +1 -1
- package/dist/{railroadDiagram-O6MQD6OU-Cfa5Q-hr.js → railroadDiagram-O6MQD6OU-DY1mojzB.js} +2 -2
- package/dist/{react-vega-BED0DjiB.js → react-vega-C4T9Rb_w.js} +12284 -12270
- package/dist/{requirementDiagram-BXWQKSXE-d8zXCJIk.js → requirementDiagram-BXWQKSXE-gHzhUp0D.js} +1 -1
- package/dist/{reveal-component-Dl9ZugRb.js → reveal-component-BcLwP52P.js} +426 -403
- package/dist/schemas-CdscWNy_.js +4747 -0
- package/dist/select-BSxlITBo.js +1200 -0
- package/dist/{sequenceDiagram-WJ2MYXX4-b6pei3lJ.js → sequenceDiagram-WJ2MYXX4-rjPtD9fB.js} +1 -1
- package/dist/{spec-BJzgmvVa.js → spec-Dq8RNplp.js} +41 -11
- package/dist/{stateDiagram-D77RDMKH-Be-xSpaZ.js → stateDiagram-D77RDMKH-DMNxjUxV.js} +4 -4
- package/dist/{stateDiagram-v2-MP3YSRHH-5Y-FxesJ.js → stateDiagram-v2-MP3YSRHH-CumAaqGo.js} +2 -2
- package/dist/static-state-BldGd99T.js +72 -0
- package/dist/strings-BGW-fXVJ.js +507 -0
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-nRRl4NU0.js → swimlanes-42K2YHIH-BU14_Tej.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-BS79510V.js → swimlanesDiagram-VR7AAH4N-CieAnPqJ.js} +2 -2
- package/dist/{swiper-component-DKntyn8p.js → swiper-component-Dir1o8ml.js} +2 -2
- package/dist/{time-BieKwdYS.js → time-BaMbJs4z.js} +18 -18
- package/dist/{timeline-definition-24CTP7MA-Cfzf8WPf.js → timeline-definition-24CTP7MA-CrVj4E1K.js} +1 -1
- package/dist/toast-BWIPi3aF.js +491 -0
- package/dist/{tooltip-CtBZ5q8p.js → tooltip-C3UnvsRe.js} +329 -305
- package/dist/use-restore-focus-BWO0z1lo.js +1672 -0
- package/dist/{useAsyncData-BD534XmW.js → useAsyncData-DsZMvNXn.js} +15 -14
- package/dist/{useDateFormatter-DkajGwwd.js → useDateFormatter-ChB4eyim.js} +2 -2
- package/dist/{useDeepCompareMemoize-C72_RNsu.js → useDeepCompareMemoize-KMBBux8C.js} +1 -1
- package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-cMNQ80CK.js} +1 -1
- package/dist/useLifecycle-BquH9ET-.js +112 -0
- package/dist/useTheme-DgOLVISn.js +337 -0
- package/dist/utils-DXkj82sK.js +813 -0
- package/dist/{vega-component-DfcYgj-Y.js → vega-component-Bwg_Kuh-.js} +171 -170
- package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container--LYZqguO.js} +2 -2
- package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-B9Pz0EGP.js} +298 -507
- package/dist/{vennDiagram-4TSXK5OY-CeY6Z1xZ.js → vennDiagram-4TSXK5OY-ZLxQ8yhm.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-Cxs9NtVi.js → wardleyDiagram-VM6X3IG4-D88pcLY1.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-DNWbvPK7.js → xychartDiagram-S5SC5T6Z-_13d4g8g.js} +2 -2
- package/package.json +16 -20
- package/src/__mocks__/document.tsx +63 -0
- package/src/__mocks__/notebook.ts +3 -4
- package/src/__mocks__/partial.ts +26 -0
- package/src/__mocks__/requests.ts +1 -4
- package/src/__tests__/main.test.tsx +24 -1
- package/src/__tests__/module-entry.test.ts +44 -0
- package/src/__tests__/mount.test.ts +1 -21
- package/src/__tests__/{host-imports.test.ts → replica-imports.test.ts} +12 -11
- package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
- package/src/components/ai/ai-model-dropdown.tsx +11 -6
- package/src/components/app-config/ai-config.tsx +155 -149
- package/src/components/app-config/app-config-button.tsx +6 -5
- package/src/components/app-config/app-config-form.tsx +5 -9
- package/src/components/app-config/common.tsx +7 -9
- package/src/components/app-config/data-form.tsx +112 -113
- package/src/components/app-config/mcp-config.tsx +30 -53
- package/src/components/app-config/user-config-form.css +91 -0
- package/src/components/app-config/user-config-form.tsx +266 -349
- package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
- package/src/components/chat/__tests__/notebook-access-selector.test.tsx +64 -0
- package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
- package/src/components/chat/acp/__tests__/state.test.ts +2 -2
- package/src/components/chat/acp/blocks.tsx +3 -2
- package/src/components/chat/acp/session-tabs.tsx +8 -3
- package/src/components/chat/capabilities-popover.tsx +1 -5
- package/src/components/chat/chat-components.tsx +2 -0
- package/src/components/chat/chat-panel.tsx +23 -104
- package/src/components/chat/chat-utils.ts +4 -8
- package/src/components/chat/notebook-access-selector.stories.tsx +22 -0
- package/src/components/chat/notebook-access-selector.tsx +100 -0
- package/src/components/data-table/TableBottomBar.tsx +4 -1
- package/src/components/data-table/TableTopBar.tsx +2 -0
- package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
- package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
- package/src/components/data-table/__tests__/columns.test.tsx +105 -0
- package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
- package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
- package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
- package/src/components/data-table/__tests__/export-actions.test.tsx +105 -0
- package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
- package/src/components/data-table/__tests__/pagination.test.tsx +28 -1
- package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
- package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
- package/src/components/data-table/cell-selection/feature.ts +2 -2
- package/src/components/data-table/cell-selection/types.ts +2 -2
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
- package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
- package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
- package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
- package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
- package/src/components/data-table/charts/charts.tsx +40 -30
- package/src/components/data-table/charts/storage.ts +16 -5
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
- package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
- package/src/components/data-table/column-summary/column-summary.tsx +2 -4
- package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
- package/src/components/data-table/columns.tsx +45 -46
- package/src/components/data-table/context-menu.tsx +36 -20
- package/src/components/data-table/data-table.tsx +17 -1
- package/src/components/data-table/date-popover.tsx +6 -4
- package/src/components/data-table/export-actions.tsx +76 -48
- package/src/components/data-table/pagination.tsx +44 -33
- package/src/components/data-table/range-focus/atoms.ts +4 -6
- package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
- package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
- package/src/components/data-table/renderers.tsx +16 -7
- package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
- package/src/components/data-table/search-highlight.tsx +79 -0
- package/src/components/data-table/types.ts +1 -0
- package/src/components/data-table/url-detector.tsx +49 -9
- package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
- package/src/components/datasources/__tests__/column-preview.test.tsx +96 -5
- package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
- package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
- package/src/components/datasources/__tests__/utils.test.ts +57 -6
- package/src/components/datasources/column-preview.tsx +17 -12
- package/src/components/datasources/datasources.tsx +56 -43
- package/src/components/datasources/utils.ts +32 -23
- package/src/components/debugger/debugger-code.tsx +5 -0
- package/src/components/dependency-graph/custom-node.tsx +1 -1
- package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
- package/src/components/dependency-graph/elements.ts +24 -21
- package/src/components/dependency-graph/minimap-content.tsx +13 -19
- package/src/components/dependency-graph/panels.tsx +4 -2
- package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
- package/src/components/editor/SortableCell.tsx +1 -3
- package/src/components/editor/__tests__/Output.test.tsx +50 -32
- package/src/{core/attachments/__tests__/toast.test.tsx → components/editor/__tests__/agent-toast.test.tsx} +1 -1
- package/src/components/editor/__tests__/data-attributes.test.tsx +28 -14
- package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
- package/src/components/editor/__tests__/output-persistence.test.tsx +6 -2
- package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
- package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +69 -0
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +40 -10
- package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +6 -10
- package/src/components/editor/actions/__tests__/useCellActionButton.test.tsx +113 -0
- package/src/components/editor/actions/name-cell-input.tsx +4 -3
- package/src/components/editor/actions/pair-with-agent-commands.ts +2 -2
- package/src/components/editor/actions/pair-with-agent-modal.tsx +24 -21
- package/src/components/editor/actions/pair-with-agent.tsx +15 -10
- package/src/components/editor/actions/useCellActionButton.tsx +36 -31
- package/src/components/editor/actions/useConfigActions.tsx +3 -4
- package/src/components/editor/actions/useNotebookActions.tsx +19 -23
- package/src/components/editor/actions/useRestartKernel.tsx +1 -1
- package/src/components/editor/actions/useSetCodeVisibility.ts +11 -12
- package/src/components/editor/actions/useSetOutputsExpanded.ts +14 -19
- package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
- package/src/components/editor/ai/ai-completion-editor.tsx +1 -0
- package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +1 -1
- package/src/components/editor/alerts/connection-notice.tsx +1 -1
- package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
- package/src/components/editor/alerts/stdin-blocking-alert.tsx +1 -1
- package/src/components/editor/app-container.tsx +1 -1
- package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +1 -1
- package/src/components/editor/cell/CreateCellButton.tsx +15 -21
- package/src/components/editor/cell/DeleteButton.tsx +3 -2
- package/src/components/editor/cell/RunButton.tsx +2 -2
- package/src/components/editor/cell/StagedAICell.tsx +10 -2
- package/src/components/editor/cell/StopButton.tsx +2 -2
- package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +4 -2
- package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
- package/src/components/editor/cell/cell-actions.tsx +12 -1
- package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
- package/src/components/editor/cell/code/cell-editor.tsx +46 -165
- package/src/components/editor/cell/code/language-toggle.tsx +8 -7
- package/src/components/editor/cell/collapse.tsx +11 -4
- package/src/components/editor/cell/useAddCell.ts +4 -8
- package/src/components/editor/cell/useDeleteCell.tsx +10 -36
- package/src/components/editor/cell/useRunCells.ts +2 -5
- package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
- package/src/components/editor/cell/useSplitCell.tsx +10 -6
- package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +1 -1
- package/src/components/editor/chrome/components/feedback-button.tsx +2 -8
- package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +31 -2
- package/src/components/editor/chrome/panels/__tests__/runtime-details.test.tsx +1 -1
- package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +1 -1
- package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
- package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
- package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
- package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
- package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
- package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
- package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
- package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
- package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
- package/src/components/editor/chrome/panels/snippets-panel.tsx +10 -12
- package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
- package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +6 -9
- package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +92 -0
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +62 -3
- package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +4 -4
- package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
- package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -2
- package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
- package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +12 -2
- package/src/components/editor/chrome/wrapper/storage.ts +1 -1
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
- package/src/components/editor/columns/cell-column.tsx +1 -1
- package/src/components/editor/columns/sortable-column.tsx +2 -2
- package/src/components/editor/connections/components.tsx +5 -10
- package/src/components/editor/controls/Controls.tsx +4 -4
- package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
- package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
- package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +10 -4
- package/src/components/editor/controls/command-palette.tsx +22 -10
- package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
- package/src/components/editor/documentation.css +34 -11
- package/src/components/editor/dynamic-favicon.tsx +21 -40
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +25 -20
- package/src/components/editor/errors/auto-fix.tsx +4 -8
- package/src/components/editor/errors/send-error-report-button.tsx +3 -6
- package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
- package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
- package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
- package/src/components/editor/file-tree/file-explorer.tsx +48 -15
- package/src/components/editor/file-tree/file-name-input.tsx +1 -0
- package/src/components/editor/file-tree/file-viewer.tsx +4 -2
- package/src/components/editor/file-tree/use-file-search.ts +35 -21
- package/src/components/editor/header/__tests__/filename-form.test.tsx +1 -4
- package/src/components/editor/header/__tests__/status.test.tsx +5 -3
- package/src/components/editor/header/app-header.tsx +1 -1
- package/src/components/editor/header/filename-form.tsx +1 -1
- package/src/components/editor/header/status.tsx +40 -20
- package/src/components/editor/links/__tests__/cell-link.test.tsx +148 -0
- package/src/components/editor/links/cell-link-list.tsx +1 -1
- package/src/components/editor/links/cell-link.tsx +17 -7
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
- package/src/components/editor/navigation/__tests__/navigation.test.ts +108 -85
- package/src/components/editor/navigation/__tests__/selection.test.ts +43 -21
- package/src/components/editor/navigation/clipboard.ts +17 -14
- package/src/components/editor/navigation/focus-utils.ts +23 -4
- package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +17 -33
- package/src/components/editor/navigation/navigation.ts +71 -70
- package/src/components/editor/navigation/selection.ts +30 -29
- package/src/components/editor/notebook-banner.tsx +1 -0
- package/src/components/editor/notebook-cell.tsx +29 -32
- package/src/components/editor/output/MarimoErrorOutput.tsx +2 -1
- package/src/components/editor/output/MarimoTracebackOutput.tsx +19 -17
- package/src/components/editor/output/Outputs.css +8 -0
- package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
- package/src/components/editor/output/ansi-reduce.ts +33 -20
- package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
- package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
- package/src/components/editor/package-alert.tsx +14 -7
- package/src/components/editor/renderers/cell-array.tsx +22 -33
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +12 -6
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -1
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
- package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +4 -4
- package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
- package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +1 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +1 -1
- package/src/components/editor/stdin-blocking-alert.tsx +1 -1
- package/src/components/home/components.tsx +17 -31
- package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
- package/src/components/icons/large-spinner.tsx +3 -14
- package/src/components/icons/spinner.tsx +1 -1
- package/src/components/markdown/markdown-renderer.tsx +4 -8
- package/src/components/mcp/mcp-status-indicator.tsx +1 -1
- package/src/components/pages/__tests__/home-page.test.tsx +116 -0
- package/src/components/pages/edit-page.tsx +19 -17
- package/src/components/pages/home-page.tsx +164 -91
- package/src/components/scratchpad/scratchpad.test.tsx +89 -0
- package/src/components/scratchpad/scratchpad.tsx +43 -32
- package/src/components/scratchpad/state.ts +7 -0
- package/src/components/slides/__tests__/minimap-actions.test.tsx +22 -29
- package/src/components/slides/__tests__/minimap.test.ts +38 -19
- package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +37 -0
- package/src/components/slides/minimap.tsx +17 -12
- package/src/components/slides/reveal-component.tsx +58 -26
- package/src/components/slides/reveal-slides.css +5 -4
- package/src/components/slides/slide-cell-view.tsx +4 -5
- package/src/components/slides/slide-form.tsx +1 -0
- package/src/components/slides/slide-scroll-hint.tsx +3 -1
- package/src/components/sort/SortableCellsProvider.tsx +8 -25
- package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
- package/src/components/tracing/tracing.tsx +46 -42
- package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
- package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/draggable-popover.tsx +24 -2
- package/src/components/ui/range-slider.tsx +22 -9
- package/src/core/MarimoApp.tsx +1 -1
- package/src/core/ai/__tests__/staged-cells.test.ts +32 -33
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +8 -12
- package/src/core/ai/context/providers/cell-output.ts +2 -2
- package/src/core/ai/context/providers/datasource.ts +6 -2
- package/src/core/ai/staged-cells.ts +18 -19
- package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +40 -88
- package/src/core/ai/tools/__tests__/registry.test.ts +17 -0
- package/src/core/ai/tools/base.ts +18 -15
- package/src/core/ai/tools/edit-notebook-tool.ts +86 -80
- package/src/core/ai/tools/registry.ts +13 -10
- package/src/core/ai/tools/sample-tool.ts +6 -7
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -37
- package/src/core/cells/__tests__/actions.test.ts +624 -35
- package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
- package/src/core/cells/__tests__/arrange.test.ts +432 -0
- package/src/core/cells/__tests__/cell.test.ts +39 -0
- package/src/core/cells/__tests__/cells.test.ts +251 -2540
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
- package/src/core/cells/__tests__/document.test.ts +164 -0
- package/src/core/cells/__tests__/editor.test.ts +57 -0
- package/src/core/cells/__tests__/flush-document.test.ts +40 -0
- package/src/core/cells/__tests__/harness.ts +106 -0
- package/src/core/cells/__tests__/layout.test.ts +177 -0
- package/src/core/cells/__tests__/notebook-outline.test.ts +122 -0
- package/src/core/cells/__tests__/outputs.test.tsx +71 -53
- package/src/core/cells/__tests__/session.test.ts +445 -211
- package/src/core/cells/__tests__/utils.test.ts +9 -108
- package/src/core/cells/actions.ts +675 -6
- package/src/core/cells/add-missing-import.ts +47 -43
- package/src/core/cells/arrange.ts +529 -0
- package/src/core/cells/cell.ts +14 -3
- package/src/core/cells/cells.ts +126 -1363
- package/src/core/cells/columns.ts +38 -0
- package/src/core/cells/document.ts +178 -0
- package/src/core/cells/edit.ts +30 -0
- package/src/core/cells/editor.ts +82 -0
- package/src/core/cells/layout.ts +221 -0
- package/src/core/cells/outputs.ts +12 -28
- package/src/core/cells/pending-delete-service.ts +3 -7
- package/src/core/cells/session.ts +76 -53
- package/src/core/cells/types.ts +22 -6
- package/src/core/cells/utils.ts +10 -8
- package/src/core/codemirror/__tests__/format.test.ts +0 -34
- package/src/core/codemirror/__tests__/setup.test.ts +29 -29
- package/src/core/codemirror/ai/__tests__/resources.test.ts +117 -0
- package/src/core/codemirror/ai/resources.ts +1 -1
- package/src/core/codemirror/cells/__tests__/extensions.test.ts +2 -6
- package/src/core/codemirror/cells/extensions.ts +30 -28
- package/src/core/codemirror/cells/state.ts +1 -6
- package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +6 -7
- package/src/core/codemirror/copilot/getCodes.ts +2 -2
- package/src/core/codemirror/format.ts +6 -23
- package/src/core/codemirror/keymaps/vim.ts +4 -8
- package/src/core/codemirror/language/__tests__/sql.test.ts +22 -20
- package/src/core/codemirror/language/__tests__/utils.test.ts +187 -15
- package/src/core/codemirror/language/cell-code.ts +114 -0
- package/src/core/codemirror/language/extension.ts +52 -35
- package/src/core/codemirror/language/languages/markdown.ts +8 -6
- package/src/core/codemirror/language/languages/python.ts +16 -10
- package/src/core/codemirror/language/languages/sql/sql.ts +16 -24
- package/src/core/codemirror/language/panel/panel.tsx +1 -0
- package/src/core/codemirror/language/types.ts +7 -7
- package/src/core/codemirror/language/utils.ts +9 -39
- package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
- package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
- package/src/core/codemirror/lsp/utils.ts +1 -1
- package/src/core/codemirror/misc/__tests__/paste.test.ts +3 -1
- package/src/core/codemirror/misc/paste.ts +1 -1
- package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
- package/src/core/codemirror/readonly/extension.ts +2 -2
- package/src/core/codemirror/utils.ts +1 -0
- package/src/core/config/__tests__/app-config.test.ts +64 -0
- package/src/core/config/__tests__/config-schema.test.ts +56 -6
- package/src/core/config/config-schema.ts +17 -4
- package/src/core/config/config.ts +65 -20
- package/src/core/config/feature-flag.tsx +0 -2
- package/src/core/datasets/__tests__/data-source-discovery.test.ts +5 -5
- package/src/core/datasets/data-source-discovery.ts +4 -6
- package/src/core/documentation/doc-lookup.ts +1 -1
- package/src/core/edit-app.tsx +21 -28
- package/src/core/errors/error-entries.ts +4 -1
- package/src/core/export/hooks.ts +1 -1
- package/src/core/export/layout.ts +2 -2
- package/src/core/hotkeys/actions.ts +2 -4
- package/src/core/islands/__tests__/bootstrap.test.ts +69 -17
- package/src/core/islands/__tests__/bridge.test.ts +85 -27
- package/src/core/islands/bootstrap.ts +46 -53
- package/src/core/islands/bridge.ts +84 -25
- package/src/core/islands/components/__tests__/IslandControls.test.tsx +7 -5
- package/src/core/islands/components/web-components.tsx +1 -1
- package/src/core/islands/worker/__tests__/controller.test.ts +62 -4
- package/src/core/islands/worker/controller.ts +4 -10
- package/src/core/islands/worker/worker.tsx +33 -33
- package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
- package/src/core/kernel/__tests__/handlers.test.ts +7 -153
- package/src/core/kernel/handlers.ts +19 -72
- package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
- package/src/core/meta/code-visibility.ts +18 -9
- package/src/core/network/__tests__/connection.test.ts +1 -1
- package/src/core/network/__tests__/requests-lazy.test.ts +1 -3
- package/src/core/network/connection-notice.ts +1 -1
- package/src/core/network/connection.ts +1 -1
- package/src/core/network/requests-lazy.ts +2 -5
- package/src/core/network/requests-network.ts +5 -31
- package/src/core/network/requests-static.ts +1 -4
- package/src/core/network/requests-toasting.tsx +1 -4
- package/src/core/network/types.ts +6 -14
- package/src/core/network/useConnectionNotice.ts +8 -2
- package/src/core/notebook/__tests__/operations.test.ts +51 -0
- package/src/core/notebook/attachments.ts +38 -0
- package/src/core/notebook/document/__tests__/codemirror.test.ts +758 -0
- package/src/core/notebook/document/__tests__/draft.test.ts +363 -0
- package/src/core/notebook/document/__tests__/fixtures.ts +92 -0
- package/src/core/notebook/document/__tests__/hooks.test.tsx +391 -0
- package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +61 -0
- package/src/core/notebook/document/__tests__/model.test.ts +247 -0
- package/src/core/notebook/document/__tests__/protocol-fixtures.ts +38 -0
- package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +230 -0
- package/src/core/notebook/document/__tests__/scenario-fixture.ts +43 -0
- package/src/core/notebook/document/__tests__/scenarios.test.ts +205 -0
- package/src/core/notebook/document/__tests__/state.test.ts +459 -0
- package/src/core/notebook/document/__tests__/submission.test.ts +203 -0
- package/src/core/notebook/document/__tests__/test-host.test.ts +92 -0
- package/src/core/notebook/document/__tests__/test-host.ts +247 -0
- package/src/core/notebook/document/__tests__/test-notebook.ts +149 -0
- package/src/core/notebook/document/__tests__/user.ts +61 -0
- package/src/core/notebook/document/codemirror.ts +216 -0
- package/src/core/notebook/document/draft.ts +502 -0
- package/src/core/notebook/document/hooks.tsx +118 -0
- package/src/core/notebook/document/index.ts +24 -0
- package/src/core/notebook/document/model.ts +102 -0
- package/src/core/notebook/document/select.ts +41 -0
- package/src/core/notebook/document/state.ts +378 -0
- package/src/core/notebook/document/sync.ts +369 -0
- package/src/core/notebook/index.ts +19 -0
- package/src/core/notebook/operations.ts +30 -0
- package/src/core/notebook/replica/AGENTS.md +11 -0
- package/src/core/{host → notebook/replica}/__tests__/attachments.test.ts +9 -10
- package/src/core/{host → notebook/replica}/__tests__/document.test.ts +18 -16
- package/src/core/notebook/replica/__tests__/executions.test.ts +201 -0
- package/src/core/notebook/replica/__tests__/fixtures.ts +79 -0
- package/src/core/notebook/replica/__tests__/replica.test.ts +559 -0
- package/src/core/notebook/replica/__tests__/results.test.ts +193 -0
- package/src/core/notebook/replica/__tests__/runtime.test.ts +78 -0
- package/src/core/notebook/replica/backend.ts +19 -0
- package/src/core/notebook/replica/connection.ts +42 -0
- package/src/core/notebook/replica/index.ts +20 -0
- package/src/core/notebook/replica/replica.ts +336 -0
- package/src/core/{host → notebook/replica}/resources/attachments.ts +6 -3
- package/src/core/{host → notebook/replica}/resources/document.ts +4 -4
- package/src/core/notebook/replica/resources/executions.ts +157 -0
- package/src/core/notebook/replica/resources/results.ts +48 -0
- package/src/core/notebook/replica/resources/runtime.ts +14 -0
- package/src/core/packages/__tests__/useSandboxController.test.tsx +1 -1
- package/src/core/packages/useSandboxController.ts +1 -1
- package/src/core/run-app.tsx +48 -51
- package/src/core/runtime/__tests__/adapter.test.ts +1 -1
- package/src/core/runtime/__tests__/createWsUrl.test.ts +77 -7
- package/src/core/runtime/__tests__/runtime.test.ts +32 -74
- package/src/core/runtime/adapter.ts +1 -1
- package/src/core/runtime/config.ts +2 -2
- package/src/core/runtime/runtime.ts +33 -46
- package/src/core/runtime/types.ts +0 -2
- package/src/core/saving/__tests__/document.test.tsx +123 -0
- package/src/core/saving/__tests__/state.test.ts +111 -0
- package/src/core/saving/__tests__/useAutoSave.test.tsx +67 -0
- package/src/core/saving/document.ts +33 -0
- package/src/core/saving/filename.ts +1 -1
- package/src/core/saving/save-component.tsx +39 -60
- package/src/core/saving/state.ts +38 -39
- package/src/core/saving/useAutoSave.ts +17 -53
- package/src/core/session/__tests__/backend.test.ts +236 -0
- package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +184 -0
- package/src/core/{websocket → session}/__tests__/useNotebookSession.hook.test.tsx +213 -262
- package/src/core/session/active-notebook.ts +28 -0
- package/src/core/session/backend.ts +123 -0
- package/src/core/session/embedded.ts +7 -0
- package/src/core/{websocket → session}/types.ts +2 -2
- package/src/core/session/useNotebookReplica.ts +74 -0
- package/src/core/{websocket → session}/useNotebookSession.tsx +77 -64
- package/src/core/state/__tests__/jotai.test.tsx +108 -0
- package/src/core/state/jotai.ts +1 -1
- package/src/core/static/__tests__/files.test.ts +38 -10
- package/src/core/static/files.ts +2 -0
- package/src/core/{websocket → transports}/__tests__/connection-state.test.ts +1 -13
- package/src/core/transports/__tests__/server.test.ts +408 -0
- package/src/core/transports/__tests__/static.test.ts +306 -0
- package/src/core/transports/__tests__/wasm.test.ts +166 -0
- package/src/core/{websocket → transports}/connection-state.ts +9 -16
- package/src/core/transports/server.ts +152 -0
- package/src/core/transports/static.ts +166 -0
- package/src/core/transports/wasm.ts +97 -0
- package/src/core/wasm/__tests__/bridge.test.ts +105 -65
- package/src/core/wasm/__tests__/worker.test.ts +187 -0
- package/src/core/wasm/bridge.ts +69 -72
- package/src/core/wasm/rpc.ts +15 -3
- package/src/core/wasm/store.ts +3 -3
- package/src/core/wasm/worker/bootstrap.ts +55 -51
- package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
- package/src/core/wasm/worker/save-worker.ts +9 -10
- package/src/core/wasm/worker/types.ts +29 -18
- package/src/core/wasm/worker/worker.ts +89 -45
- package/src/css/app/codemirror.css +1 -1
- package/src/css/globals.css +66 -22
- package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
- package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
- package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
- package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
- package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
- package/src/hooks/__tests__/useScript.test.tsx +77 -0
- package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
- package/src/hooks/useAsyncData.ts +3 -3
- package/src/hooks/useDataSourceDiscovery.ts +6 -4
- package/src/hooks/useDebounce.ts +6 -10
- package/src/hooks/useDeepCompareMemoize.ts +1 -1
- package/src/hooks/useDelayElapsed.ts +14 -10
- package/src/hooks/useElapsedTime.ts +3 -3
- package/src/hooks/useEventListener.ts +1 -2
- package/src/hooks/useInputHistory.ts +4 -7
- package/src/hooks/useInternalStateWithSync.ts +6 -6
- package/src/hooks/useResizeObserver.ts +4 -7
- package/src/hooks/useScript.ts +67 -70
- package/src/hooks/useStateForKey.ts +93 -0
- package/src/mount.tsx +20 -15
- package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
- package/src/plugins/core/registerReactComponent.tsx +1 -1
- package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
- package/src/plugins/impl/DataEditorPlugin.tsx +1 -1
- package/src/plugins/impl/DataTablePlugin.tsx +69 -37
- package/src/plugins/impl/DropdownPlugin.tsx +2 -6
- package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
- package/src/plugins/impl/FormPlugin.tsx +1 -1
- package/src/plugins/impl/RangeSliderPlugin.tsx +16 -2
- package/src/plugins/impl/RefreshPlugin.tsx +1 -0
- package/src/plugins/impl/SliderPlugin.tsx +6 -8
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +387 -1
- package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
- package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
- package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +24 -3
- package/src/plugins/impl/anywidget/__tests__/registry.test.ts +153 -0
- package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
- package/src/plugins/impl/anywidget/model.ts +3 -1
- package/src/plugins/impl/anywidget/registry.ts +18 -14
- package/src/plugins/impl/anywidget/runtime.ts +21 -9
- package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
- package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
- package/src/plugins/impl/chat/chat-ui.tsx +14 -11
- package/src/plugins/impl/code/any-language-editor.tsx +2 -2
- package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
- package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
- package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
- package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
- package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
- package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
- package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
- package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
- package/src/plugins/impl/data-frames/panel.tsx +43 -16
- package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
- package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
- package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
- package/src/plugins/impl/panel/utils.ts +17 -0
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
- package/src/plugins/impl/plotly/selection.ts +25 -19
- package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
- package/src/plugins/impl/vega/make-selectable.ts +4 -7
- package/src/plugins/layout/RoutesPlugin.tsx +1 -1
- package/src/stories/__tests__/editor-story.test.tsx +33 -0
- package/src/stories/button.stories.tsx +1 -0
- package/src/stories/cell.stories.tsx +2 -5
- package/src/stories/data-table.stories.tsx +31 -0
- package/src/stories/editor.stories.tsx +24 -17
- package/src/stories/form-wrapper.stories.tsx +2 -2
- package/src/stories/layout/vertical/one-column.stories.tsx +28 -23
- package/src/stories/runtime-story.tsx +23 -17
- package/src/stories/select.stories.tsx +2 -2
- package/src/stories/switchable-multi-select.stories.tsx +1 -1
- package/src/utils/__tests__/arrays.test.ts +35 -0
- package/src/utils/__tests__/batch-requests.test.ts +3 -3
- package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +29 -0
- package/src/utils/__tests__/numbers.test.ts +105 -1
- package/src/utils/__tests__/objects.test.ts +21 -0
- package/src/utils/arrays.ts +11 -2
- package/src/utils/blob.ts +1 -1
- package/src/utils/createReducer.ts +53 -26
- package/src/utils/maps.ts +0 -3
- package/src/utils/numbers.ts +79 -18
- package/src/utils/objects.ts +4 -9
- package/src/utils/tracer.ts +9 -5
- package/src/utils/zod-utils.ts +1 -3
- package/dist/_baseMerge-BiGRwuqv.js +0 -165
- package/dist/any-language-editor-D4q-IFcM.js +0 -76
- package/dist/assets/__vite-browser-external-BXYkiFsk.js +0 -1
- package/dist/assets/worker-HPY9fbhz.js +0 -114
- package/dist/code-visibility-vqPDeo1_.js +0 -138
- package/dist/dropdown-menu-DHP9P4VE.js +0 -4678
- package/dist/feedback-button-BPcyKSZd.js +0 -379
- package/dist/hasIn-o2Us0uVx.js +0 -132
- package/dist/html-to-image-BdA59IUD.js +0 -3251
- package/dist/isArrayLikeObject-BZl-15ir.js +0 -450
- package/dist/isEmpty-BSZ1LaUo.js +0 -35
- package/dist/isSymbol-kQcfYbNX.js +0 -8
- package/dist/label-DoysmLMW.js +0 -281
- package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
- package/dist/objectWithoutPropertiesLoose-BRDcTsfB.js +0 -23
- package/dist/pick-CJeoxYOS.js +0 -51
- package/dist/precisionRound-DMIVQrt2.js +0 -97
- package/dist/select-DemoKT4G.js +0 -1344
- package/dist/toDate-B5mIgxwZ.js +0 -1185
- package/dist/toast-PkdZraM8.js +0 -1830
- package/dist/use-restore-focus-CKjfFjLM.js +0 -6369
- package/dist/useLifecycle-BGWzTwHK.js +0 -169
- package/dist/useTheme-BhQvec43.js +0 -904
- package/src/components/editor/cell/code/__tests__/rtc-editor-config.test.ts +0 -50
- package/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx +0 -65
- package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
- package/src/components/editor/navigation/state.ts +0 -65
- package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +0 -656
- package/src/core/ai/tools/run-cells-tool.ts +0 -303
- package/src/core/attachments/state.ts +0 -18
- package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
- package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
- package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
- package/src/core/cells/document-changes.ts +0 -944
- package/src/core/codemirror/rtc/extension.ts +0 -453
- package/src/core/codemirror/rtc/loro/__tests__/sync.test.ts +0 -52
- package/src/core/codemirror/rtc/loro/awareness.ts +0 -531
- package/src/core/codemirror/rtc/loro/colors.ts +0 -38
- package/src/core/codemirror/rtc/loro/sync.ts +0 -168
- package/src/core/host/AGENTS.md +0 -11
- package/src/core/host/__tests__/events.test.ts +0 -46
- package/src/core/host/__tests__/fixtures.ts +0 -39
- package/src/core/host/__tests__/notebook-client.test.ts +0 -433
- package/src/core/host/__tests__/protocol.test.ts +0 -214
- package/src/core/host/__tests__/stream.test.ts +0 -211
- package/src/core/host/connection.ts +0 -81
- package/src/core/host/events.ts +0 -61
- package/src/core/host/notebook-client.ts +0 -290
- package/src/core/host/protocol.ts +0 -1943
- package/src/core/host/resources/resource.ts +0 -59
- package/src/core/host/stream.ts +0 -213
- package/src/core/rtc/state.ts +0 -34
- package/src/core/state/__tests__/jotai.test.ts +0 -25
- package/src/core/wasm/worker/message-buffer.ts +0 -33
- package/src/core/websocket/__tests__/createConnectionTransport.test.ts +0 -49
- package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +0 -170
- package/src/core/websocket/state.ts +0 -7
- package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
- package/src/core/websocket/transports/__tests__/sse.test.ts +0 -335
- package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
- package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
- package/src/core/websocket/transports/basic.ts +0 -102
- package/src/core/websocket/transports/create.ts +0 -31
- package/src/core/websocket/transports/sse.ts +0 -308
- package/src/core/websocket/transports/transport.ts +0 -50
- package/src/core/websocket/transports/ws.ts +0 -98
- package/src/core/websocket/useNotebookClient.ts +0 -88
- package/src/utils/__tests__/id-tree.test.ts +0 -2145
- package/src/utils/id-tree.tsx +0 -1134
- /package/src/{core/attachments/toast.ts → components/editor/agent-toast.ts} +0 -0
- /package/src/core/{websocket → session}/connection-utils.ts +0 -0
|
@@ -0,0 +1,2505 @@
|
|
|
1
|
+
import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
|
+
import { g as t, h as n, p as r } from "./button-B6RjDKJx.js";
|
|
3
|
+
import { t as i } from "./react-sHtZdjeP.js";
|
|
4
|
+
import { t as a } from "./compiler-runtime-CldRdSsv.js";
|
|
5
|
+
import { i as o } from "./copy-icon-CG57cxwb.js";
|
|
6
|
+
import { d as s, m as c } from "./tooltip-C3UnvsRe.js";
|
|
7
|
+
import { t as l } from "./check-Z_vtI3OL.js";
|
|
8
|
+
import { i as u, t as d } from "./strings-BGW-fXVJ.js";
|
|
9
|
+
import { t as f } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
|
+
import { F as p, I as m, M as ee, N as h, j as g } from "./use-restore-focus-BWO0z1lo.js";
|
|
11
|
+
import { n as _ } from "./toast-BWIPi3aF.js";
|
|
12
|
+
import { _ as v, a as y, c as b, d as x, f as S, l as C, m as te, p as w, t as ne, v as re, w as T, x as E } from "./utils-DXkj82sK.js";
|
|
13
|
+
import { t as D } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as ie } from "./objects-DCmMvZtn.js";
|
|
15
|
+
import { t as ae } from "./createReducer-DePYJ0F3.js";
|
|
16
|
+
import { M as oe, N as se, V as ce, g as le } from "./dist-CYeqK4Xw.js";
|
|
17
|
+
import { t as ue } from "./purify.es-DMv5zIkJ.js";
|
|
18
|
+
import { a as de, i as fe, l as pe, m as me, u as he } from "./static-state-BldGd99T.js";
|
|
19
|
+
import { t as ge } from "./capabilities-CkVzWJEX.js";
|
|
20
|
+
var _e = c("external-link", [
|
|
21
|
+
["path", {
|
|
22
|
+
d: "M15 3h6v6",
|
|
23
|
+
key: "1q9fwt"
|
|
24
|
+
}],
|
|
25
|
+
["path", {
|
|
26
|
+
d: "M10 14 21 3",
|
|
27
|
+
key: "gplh6r"
|
|
28
|
+
}],
|
|
29
|
+
["path", {
|
|
30
|
+
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
31
|
+
key: "a6xqqp"
|
|
32
|
+
}]
|
|
33
|
+
]), ve = c("minus", [["path", {
|
|
34
|
+
d: "M5 12h14",
|
|
35
|
+
key: "1ays0h"
|
|
36
|
+
}]]), O = /* @__PURE__ */ e(i(), 1), k = f(), ye = Object.defineProperty, A = (e, t) => ye(e, "name", {
|
|
37
|
+
value: t,
|
|
38
|
+
configurable: !0
|
|
39
|
+
}), be = "Checkbox", [xe, Se] = p(be), [Ce, we] = xe(be);
|
|
40
|
+
function Te(e) {
|
|
41
|
+
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = ee({
|
|
42
|
+
prop: n,
|
|
43
|
+
defaultProp: i ?? !1,
|
|
44
|
+
onChange: c,
|
|
45
|
+
caller: be
|
|
46
|
+
}), [m, h] = O.useState(null), [g, _] = O.useState(null), [v, y] = O.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
47
|
+
checked: f,
|
|
48
|
+
disabled: a,
|
|
49
|
+
setChecked: p,
|
|
50
|
+
control: m,
|
|
51
|
+
setControl: h,
|
|
52
|
+
name: s,
|
|
53
|
+
form: o,
|
|
54
|
+
value: u,
|
|
55
|
+
userClick: v,
|
|
56
|
+
onUserClick: y,
|
|
57
|
+
required: l,
|
|
58
|
+
defaultChecked: !j(i) && i,
|
|
59
|
+
isFormControl: b,
|
|
60
|
+
bubbleInput: g,
|
|
61
|
+
setBubbleInput: _
|
|
62
|
+
};
|
|
63
|
+
return /* @__PURE__ */ (0, k.jsx)(Ce, {
|
|
64
|
+
scope: t,
|
|
65
|
+
...x,
|
|
66
|
+
children: Ne(d) ? d(x) : r
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
A(Te, "CheckboxProvider");
|
|
70
|
+
var Ee = "CheckboxTrigger", De = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
71
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: ee, bubbleInput: g } = we(Ee, e), _ = r(a, d), v = O.useRef(l);
|
|
72
|
+
return O.useEffect(() => {
|
|
73
|
+
let e = o?.form;
|
|
74
|
+
if (e) {
|
|
75
|
+
let t = /* @__PURE__ */ A(() => f(v.current), "reset");
|
|
76
|
+
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
77
|
+
}
|
|
78
|
+
}, [o, f]), /* @__PURE__ */ (0, k.jsx)(m.button, {
|
|
79
|
+
type: "button",
|
|
80
|
+
role: "checkbox",
|
|
81
|
+
"aria-checked": j(l) ? "mixed" : l,
|
|
82
|
+
"aria-required": u,
|
|
83
|
+
"data-state": Pe(l),
|
|
84
|
+
"data-disabled": c ? "" : void 0,
|
|
85
|
+
disabled: c,
|
|
86
|
+
value: s,
|
|
87
|
+
...i,
|
|
88
|
+
ref: _,
|
|
89
|
+
onKeyDown: h(t, (e) => {
|
|
90
|
+
e.key === "Enter" && e.preventDefault();
|
|
91
|
+
}),
|
|
92
|
+
onClick: h(n, (e) => {
|
|
93
|
+
let t = e.isPropagationStopped();
|
|
94
|
+
p({
|
|
95
|
+
requestedChecked: j(l) ? !0 : !l,
|
|
96
|
+
hasConsumerStoppedPropagation: t
|
|
97
|
+
}), f((e) => j(e) ? !0 : !e), g && ee && (t || e.stopPropagation());
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}, "CheckboxTrigger")), Oe = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function(e, t) {
|
|
101
|
+
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
102
|
+
return /* @__PURE__ */ (0, k.jsx)(Te, {
|
|
103
|
+
__scopeCheckbox: n,
|
|
104
|
+
checked: i,
|
|
105
|
+
defaultChecked: a,
|
|
106
|
+
disabled: s,
|
|
107
|
+
required: o,
|
|
108
|
+
onCheckedChange: l,
|
|
109
|
+
name: r,
|
|
110
|
+
form: u,
|
|
111
|
+
value: c,
|
|
112
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, k.jsxs)(k.Fragment, { children: [/* @__PURE__ */ (0, k.jsx)(De, {
|
|
113
|
+
...d,
|
|
114
|
+
ref: t,
|
|
115
|
+
__scopeCheckbox: n
|
|
116
|
+
}), e && /* @__PURE__ */ (0, k.jsx)(Me, { __scopeCheckbox: n })] })
|
|
117
|
+
});
|
|
118
|
+
}, "Checkbox")), ke = "CheckboxIndicator", Ae = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function(e, t) {
|
|
119
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = we(ke, n);
|
|
120
|
+
return /* @__PURE__ */ (0, k.jsx)(g, {
|
|
121
|
+
present: r || j(a.checked) || a.checked === !0,
|
|
122
|
+
children: /* @__PURE__ */ (0, k.jsx)(m.span, {
|
|
123
|
+
"data-state": Pe(a.checked),
|
|
124
|
+
"data-disabled": a.disabled ? "" : void 0,
|
|
125
|
+
...i,
|
|
126
|
+
ref: t,
|
|
127
|
+
style: {
|
|
128
|
+
pointerEvents: "none",
|
|
129
|
+
...e.style
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}, "CheckboxIndicator")), je = "CheckboxBubbleInput", Me = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
134
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: ee, bubbleInput: g, setBubbleInput: _ } = we(je, e), v = r(i, _), y = s(a), b = O.useRef(!1), x = O.useRef(c), S = O.useRef(o), C = O.useRef(null);
|
|
135
|
+
O.useEffect(() => {
|
|
136
|
+
let e = g;
|
|
137
|
+
if (!e) return;
|
|
138
|
+
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
139
|
+
if (!n) return;
|
|
140
|
+
let r = x.current !== c;
|
|
141
|
+
x.current = c;
|
|
142
|
+
let i = o !== null && o !== S.current;
|
|
143
|
+
if (S.current = o, i) C.current = r ? null : o, r && (e.indeterminate = j(c), n.call(e, !j(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
144
|
+
else if (r) {
|
|
145
|
+
let t = C.current;
|
|
146
|
+
C.current = null;
|
|
147
|
+
let r = t?.requestedChecked === c;
|
|
148
|
+
b.current = !0, e.indeterminate = j(c), n.call(e, !j(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), b.current = !1;
|
|
149
|
+
}
|
|
150
|
+
}, [
|
|
151
|
+
g,
|
|
152
|
+
c,
|
|
153
|
+
o
|
|
154
|
+
]);
|
|
155
|
+
let te = O.useRef(!j(c) && c);
|
|
156
|
+
return /* @__PURE__ */ (0, k.jsx)(m.input, {
|
|
157
|
+
type: "checkbox",
|
|
158
|
+
"aria-hidden": !0,
|
|
159
|
+
defaultChecked: l ?? te.current,
|
|
160
|
+
required: u,
|
|
161
|
+
disabled: d,
|
|
162
|
+
name: f,
|
|
163
|
+
value: p,
|
|
164
|
+
form: ee,
|
|
165
|
+
...n,
|
|
166
|
+
tabIndex: -1,
|
|
167
|
+
ref: v,
|
|
168
|
+
onClick: h(t, (e) => {
|
|
169
|
+
b.current && e.stopPropagation();
|
|
170
|
+
}),
|
|
171
|
+
style: {
|
|
172
|
+
...n.style,
|
|
173
|
+
...y,
|
|
174
|
+
position: "absolute",
|
|
175
|
+
pointerEvents: "none",
|
|
176
|
+
opacity: 0,
|
|
177
|
+
margin: 0,
|
|
178
|
+
transform: "translateX(-100%)"
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}, "CheckboxBubbleInput"));
|
|
182
|
+
function Ne(e) {
|
|
183
|
+
return typeof e == "function";
|
|
184
|
+
}
|
|
185
|
+
A(Ne, "isFunction");
|
|
186
|
+
function j(e) {
|
|
187
|
+
return e === "indeterminate";
|
|
188
|
+
}
|
|
189
|
+
A(j, "isIndeterminate");
|
|
190
|
+
function Pe(e) {
|
|
191
|
+
return j(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
192
|
+
}
|
|
193
|
+
A(Pe, "getState");
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/core/codemirror/editing/commands.ts
|
|
196
|
+
var Fe = a();
|
|
197
|
+
function Ie(e) {
|
|
198
|
+
return (t) => {
|
|
199
|
+
let n = !1;
|
|
200
|
+
for (let r of t) r && (n = e(r) || n);
|
|
201
|
+
return n;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
var Le = Ie(le), Re = Ie(se);
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/utils/schedule-task.ts
|
|
207
|
+
function ze() {
|
|
208
|
+
let e = globalThis.scheduler;
|
|
209
|
+
if (typeof e?.postTask == "function") return (t) => {
|
|
210
|
+
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
211
|
+
setTimeout(() => {
|
|
212
|
+
throw e;
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
if (typeof MessageChannel == "function") {
|
|
217
|
+
let e = [], t = new MessageChannel();
|
|
218
|
+
return t.port1.onmessage = () => {
|
|
219
|
+
e.shift()?.();
|
|
220
|
+
}, (n) => {
|
|
221
|
+
e.push(n), t.port2.postMessage(null);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return (e) => {
|
|
225
|
+
setTimeout(e, 0);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
var Be = ze();
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
231
|
+
function Ve(e = Be) {
|
|
232
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
233
|
+
function i() {
|
|
234
|
+
r || t.size === 0 || (r = !0, e(o));
|
|
235
|
+
}
|
|
236
|
+
function a() {
|
|
237
|
+
for (let e of n) {
|
|
238
|
+
if (t.has(e)) return e;
|
|
239
|
+
n.delete(e);
|
|
240
|
+
}
|
|
241
|
+
return t.keys().next().value;
|
|
242
|
+
}
|
|
243
|
+
function o() {
|
|
244
|
+
r = !1;
|
|
245
|
+
try {
|
|
246
|
+
let e = a();
|
|
247
|
+
if (e !== void 0) {
|
|
248
|
+
let r = t.get(e);
|
|
249
|
+
t.delete(e), n.delete(e), r?.();
|
|
250
|
+
}
|
|
251
|
+
} finally {
|
|
252
|
+
i();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
request(e, n) {
|
|
257
|
+
t.set(e, n), i();
|
|
258
|
+
},
|
|
259
|
+
promote(e) {
|
|
260
|
+
let r = t.get(e);
|
|
261
|
+
r && (t.delete(e), n.delete(e), r());
|
|
262
|
+
},
|
|
263
|
+
prioritize(e) {
|
|
264
|
+
t.has(e) && n.add(e);
|
|
265
|
+
},
|
|
266
|
+
deprioritize(e) {
|
|
267
|
+
n.delete(e);
|
|
268
|
+
},
|
|
269
|
+
cancel(e) {
|
|
270
|
+
t.delete(e), n.delete(e);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
var He = Ve();
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/plugins/core/sanitize-html.ts
|
|
277
|
+
if (typeof document < "u") {
|
|
278
|
+
let e = "data-temp-href-target";
|
|
279
|
+
ue.addHook("beforeSanitizeAttributes", (t) => {
|
|
280
|
+
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
281
|
+
}), ue.addHook("afterSanitizeAttributes", (t) => {
|
|
282
|
+
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function Ue(e) {
|
|
286
|
+
let t = {
|
|
287
|
+
USE_PROFILES: {
|
|
288
|
+
html: !0,
|
|
289
|
+
svg: !0,
|
|
290
|
+
mathMl: !0
|
|
291
|
+
},
|
|
292
|
+
ADD_TAGS: ["use"],
|
|
293
|
+
ADD_ATTR: ["href", "xlink:href"],
|
|
294
|
+
FORCE_BODY: !0,
|
|
295
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
296
|
+
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
297
|
+
attributeNameCheck: /^[A-Za-z][\w-]*$/
|
|
298
|
+
},
|
|
299
|
+
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
300
|
+
};
|
|
301
|
+
return ue.sanitize(e, t);
|
|
302
|
+
}
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/core/dom/outline.ts
|
|
305
|
+
var We = [
|
|
306
|
+
"marimo-carousel",
|
|
307
|
+
"marimo-tabs",
|
|
308
|
+
"marimo-accordion",
|
|
309
|
+
"marimo-sidebar"
|
|
310
|
+
], Ge = "h1, h2, h3, h4, h5, h6";
|
|
311
|
+
function Ke(e) {
|
|
312
|
+
if (typeof DOMParser > "u") return null;
|
|
313
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Ge);
|
|
314
|
+
for (let e of Array.from(n)) {
|
|
315
|
+
let n = e.textContent;
|
|
316
|
+
if (We.some((t) => e.closest(t)) || !n) continue;
|
|
317
|
+
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
318
|
+
name: n,
|
|
319
|
+
level: r,
|
|
320
|
+
by: Je(e)
|
|
321
|
+
};
|
|
322
|
+
i !== n && (a.html = Ue(i)), t.push(a);
|
|
323
|
+
}
|
|
324
|
+
return { items: t };
|
|
325
|
+
}
|
|
326
|
+
function qe(e) {
|
|
327
|
+
if (!e.includes("\"")) return `"${e}"`;
|
|
328
|
+
if (!e.includes("'")) return `'${e}'`;
|
|
329
|
+
let t = e.split("\""), n = [];
|
|
330
|
+
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
331
|
+
return `concat(${n.join(", ")})`;
|
|
332
|
+
}
|
|
333
|
+
function Je(e) {
|
|
334
|
+
let t = e.id;
|
|
335
|
+
if (t) return { id: t };
|
|
336
|
+
let n = e.textContent ?? "";
|
|
337
|
+
return { path: `//${e.tagName}[contains(., ${qe(n)})]` };
|
|
338
|
+
}
|
|
339
|
+
function Ye(e) {
|
|
340
|
+
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
341
|
+
}
|
|
342
|
+
function Xe(e) {
|
|
343
|
+
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
344
|
+
try {
|
|
345
|
+
return D(typeof e.data == "string", "expected string"), Ke(e.data);
|
|
346
|
+
} catch {
|
|
347
|
+
return t.error("Failed to parse outline"), null;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function Ze(e) {
|
|
351
|
+
return e != null && e.items.some((e) => e.level <= 3);
|
|
352
|
+
}
|
|
353
|
+
function Qe(e, n) {
|
|
354
|
+
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
355
|
+
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
356
|
+
let a = r(i), o = e + 1;
|
|
357
|
+
for (; o < n.length;) {
|
|
358
|
+
let t = n[o];
|
|
359
|
+
if (t && r(t) <= a) return [e, o - 1];
|
|
360
|
+
o++;
|
|
361
|
+
}
|
|
362
|
+
return [e, n.length - 1];
|
|
363
|
+
}
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/core/mime.ts
|
|
366
|
+
function $e(e) {
|
|
367
|
+
return e === "application/vnd.marimo+error";
|
|
368
|
+
}
|
|
369
|
+
function et(e) {
|
|
370
|
+
return e === "application/vnd.marimo+traceback";
|
|
371
|
+
}
|
|
372
|
+
function M(e) {
|
|
373
|
+
return $e(e) || et(e);
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/utils/time.ts
|
|
377
|
+
var tt = class e {
|
|
378
|
+
ms;
|
|
379
|
+
static fromMilliseconds(t) {
|
|
380
|
+
return t == null ? null : new e(t);
|
|
381
|
+
}
|
|
382
|
+
static fromSeconds(t) {
|
|
383
|
+
return t == null ? null : new e(t * 1e3);
|
|
384
|
+
}
|
|
385
|
+
static now() {
|
|
386
|
+
return new e(Date.now());
|
|
387
|
+
}
|
|
388
|
+
constructor(e) {
|
|
389
|
+
this.ms = e;
|
|
390
|
+
}
|
|
391
|
+
toMilliseconds() {
|
|
392
|
+
return this.ms;
|
|
393
|
+
}
|
|
394
|
+
toSeconds() {
|
|
395
|
+
return this.ms / 1e3;
|
|
396
|
+
}
|
|
397
|
+
}, nt = class e {
|
|
398
|
+
lines = [""];
|
|
399
|
+
cursor = {
|
|
400
|
+
row: 0,
|
|
401
|
+
col: 0
|
|
402
|
+
};
|
|
403
|
+
static ESCAPE_REGEX = new RegExp(String.raw`\u001B\[([0-9;]*)([A-DJKH])`, "u");
|
|
404
|
+
ensureLine(e) {
|
|
405
|
+
for (; this.lines.length <= e;) this.lines.push("");
|
|
406
|
+
}
|
|
407
|
+
moveCursor(e, t) {
|
|
408
|
+
this.cursor.row = Math.max(0, this.cursor.row + e), this.cursor.col = Math.max(0, this.cursor.col + t), this.ensureLine(this.cursor.row);
|
|
409
|
+
}
|
|
410
|
+
setCursor(e, t) {
|
|
411
|
+
this.cursor.row = Math.max(0, e), this.cursor.col = Math.max(0, t), this.ensureLine(this.cursor.row);
|
|
412
|
+
}
|
|
413
|
+
writeChar(e) {
|
|
414
|
+
this.ensureLine(this.cursor.row);
|
|
415
|
+
let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
|
|
416
|
+
this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + 1), this.cursor.col++;
|
|
417
|
+
}
|
|
418
|
+
writeString(e) {
|
|
419
|
+
if (e.length === 0) return;
|
|
420
|
+
this.ensureLine(this.cursor.row);
|
|
421
|
+
let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
|
|
422
|
+
this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + e.length), this.cursor.col += e.length;
|
|
423
|
+
}
|
|
424
|
+
control(e) {
|
|
425
|
+
switch (e) {
|
|
426
|
+
case "\n":
|
|
427
|
+
this.cursor.row++, this.cursor.col = 0, this.ensureLine(this.cursor.row);
|
|
428
|
+
break;
|
|
429
|
+
case "\r":
|
|
430
|
+
this.cursor.col = 0;
|
|
431
|
+
break;
|
|
432
|
+
case " ":
|
|
433
|
+
this.writeChar(" ");
|
|
434
|
+
break;
|
|
435
|
+
case "\b":
|
|
436
|
+
this.cursor.col = Math.max(0, this.cursor.col - 1);
|
|
437
|
+
break;
|
|
438
|
+
case "\v": this.cursor.row++, this.ensureLine(this.cursor.row);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
handleEscape(t) {
|
|
442
|
+
let n = e.ESCAPE_REGEX.exec(t);
|
|
443
|
+
if (!n) {
|
|
444
|
+
this.writeString(t);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
let r = n[1].split(";").map((e) => e === "" ? 1 : Number.parseInt(e, 10));
|
|
448
|
+
switch (n[2]) {
|
|
449
|
+
case "A":
|
|
450
|
+
this.moveCursor(-r[0], 0);
|
|
451
|
+
break;
|
|
452
|
+
case "B":
|
|
453
|
+
this.moveCursor(r[0], 0);
|
|
454
|
+
break;
|
|
455
|
+
case "C":
|
|
456
|
+
this.moveCursor(0, r[0]);
|
|
457
|
+
break;
|
|
458
|
+
case "D":
|
|
459
|
+
this.moveCursor(0, -r[0]);
|
|
460
|
+
break;
|
|
461
|
+
case "H":
|
|
462
|
+
this.setCursor(r[0] - 1 || 0, r[1] - 1 || 0);
|
|
463
|
+
break;
|
|
464
|
+
case "J":
|
|
465
|
+
r[0] === 2 && (this.lines = [""], this.setCursor(0, 0));
|
|
466
|
+
break;
|
|
467
|
+
case "K":
|
|
468
|
+
switch (this.ensureLine(this.cursor.row), r[0]) {
|
|
469
|
+
case 0:
|
|
470
|
+
this.lines[this.cursor.row] = this.lines[this.cursor.row].slice(0, this.cursor.col);
|
|
471
|
+
break;
|
|
472
|
+
case 1: {
|
|
473
|
+
let e = this.lines[this.cursor.row].length;
|
|
474
|
+
this.lines[this.cursor.row] = " ".repeat(this.cursor.col) + this.lines[this.cursor.row].slice(this.cursor.col, e);
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
case 2: this.lines[this.cursor.row] = "";
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
default: this.writeString(t);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
render() {
|
|
484
|
+
return this.lines.join("\n");
|
|
485
|
+
}
|
|
486
|
+
}, rt = class {
|
|
487
|
+
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
488
|
+
parse(e) {
|
|
489
|
+
let t = [], n = 0;
|
|
490
|
+
for (let r of e.matchAll(this.ESC_REGEX)) {
|
|
491
|
+
let i = r.index ?? 0;
|
|
492
|
+
i > n && t.push({
|
|
493
|
+
type: "text",
|
|
494
|
+
value: e.slice(n, i)
|
|
495
|
+
}), t.push({
|
|
496
|
+
type: "escape",
|
|
497
|
+
value: r[0]
|
|
498
|
+
}), n = i + r[0].length;
|
|
499
|
+
}
|
|
500
|
+
return n < e.length && t.push({
|
|
501
|
+
type: "text",
|
|
502
|
+
value: e.slice(n)
|
|
503
|
+
}), t;
|
|
504
|
+
}
|
|
505
|
+
}, it = class {
|
|
506
|
+
parser = new rt();
|
|
507
|
+
buffer = new nt();
|
|
508
|
+
reduce(e) {
|
|
509
|
+
return this.reset(), this.append(e), this.render();
|
|
510
|
+
}
|
|
511
|
+
append(e) {
|
|
512
|
+
let t = this.parser.parse(e);
|
|
513
|
+
if (t.length === 1 && t[0].type === "text") {
|
|
514
|
+
let e = t[0].value;
|
|
515
|
+
if (!this.hasControlChars(e)) {
|
|
516
|
+
this.buffer.writeString(e);
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
521
|
+
}
|
|
522
|
+
reset() {
|
|
523
|
+
this.buffer = new nt();
|
|
524
|
+
}
|
|
525
|
+
render() {
|
|
526
|
+
return this.buffer.render();
|
|
527
|
+
}
|
|
528
|
+
hasControlChars(e) {
|
|
529
|
+
for (let t of e) if (t < " ") return !0;
|
|
530
|
+
return !1;
|
|
531
|
+
}
|
|
532
|
+
processText(e) {
|
|
533
|
+
let t = 0, n = e.length;
|
|
534
|
+
for (let r = 0; r < n; r++) {
|
|
535
|
+
let n = e[r];
|
|
536
|
+
if (n === "\n" || n === "\r" || n === " " || n === "\b" || n === "\v") {
|
|
537
|
+
if (r > t) {
|
|
538
|
+
let n = e.slice(t, r), i = this.filterControlChars(n);
|
|
539
|
+
i.length > 0 && this.buffer.writeString(i);
|
|
540
|
+
}
|
|
541
|
+
this.buffer.control(n), t = r + 1;
|
|
542
|
+
} else if (n < " ") {
|
|
543
|
+
if (r > t) {
|
|
544
|
+
let n = e.slice(t, r);
|
|
545
|
+
n.length > 0 && this.buffer.writeString(n);
|
|
546
|
+
}
|
|
547
|
+
t = r + 1;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
if (t < n) {
|
|
551
|
+
let n = e.slice(t), r = this.filterControlChars(n);
|
|
552
|
+
r.length > 0 && this.buffer.writeString(r);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
filterControlChars(e) {
|
|
556
|
+
let t = !1;
|
|
557
|
+
for (let n of e) if (n < " ") {
|
|
558
|
+
t = !0;
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
if (!t) return e;
|
|
562
|
+
let n = "";
|
|
563
|
+
for (let t of e) t >= " " && (n += t);
|
|
564
|
+
return n;
|
|
565
|
+
}
|
|
566
|
+
}, N = class e {
|
|
567
|
+
mimetype;
|
|
568
|
+
channel;
|
|
569
|
+
timestamp;
|
|
570
|
+
code;
|
|
571
|
+
id;
|
|
572
|
+
ansiReducer = new it();
|
|
573
|
+
_data;
|
|
574
|
+
get data() {
|
|
575
|
+
return this._data;
|
|
576
|
+
}
|
|
577
|
+
static create(t) {
|
|
578
|
+
let n = new it();
|
|
579
|
+
return n.append(t.data), new e({
|
|
580
|
+
mimetype: t.mimetype,
|
|
581
|
+
channel: t.channel,
|
|
582
|
+
timestamp: t.timestamp,
|
|
583
|
+
ansiReducer: n,
|
|
584
|
+
code: t.code,
|
|
585
|
+
id: t.id
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
constructor({ mimetype: e, channel: t, timestamp: n, ansiReducer: r, code: i, id: a }) {
|
|
589
|
+
this.mimetype = e, this.channel = t, this.timestamp = n, this.code = i, this.id = a, this.ansiReducer = r, this._data = this.ansiReducer.render();
|
|
590
|
+
}
|
|
591
|
+
appendData(t) {
|
|
592
|
+
return this.ansiReducer.append(t), new e({
|
|
593
|
+
mimetype: this.mimetype,
|
|
594
|
+
channel: this.channel,
|
|
595
|
+
timestamp: this.timestamp,
|
|
596
|
+
ansiReducer: this.ansiReducer,
|
|
597
|
+
code: this.code,
|
|
598
|
+
id: this.id
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
toJSON() {
|
|
602
|
+
return {
|
|
603
|
+
mimetype: this.mimetype,
|
|
604
|
+
channel: this.channel,
|
|
605
|
+
timestamp: this.timestamp,
|
|
606
|
+
data: this.data,
|
|
607
|
+
...this.code === void 0 ? {} : { code: this.code }
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
613
|
+
function at(e, t = 5e3) {
|
|
614
|
+
let n = [...e];
|
|
615
|
+
if (n.length < 2) return ut(n.map(st), t);
|
|
616
|
+
let r = n[n.length - 1], i = n[n.length - 2];
|
|
617
|
+
return ot(r, i) && (lt(r), lt(i), n[n.length - 2] = ct(i, r), n.pop()), ut(n, t);
|
|
618
|
+
}
|
|
619
|
+
function ot(e, t) {
|
|
620
|
+
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
621
|
+
if (!n) return !1;
|
|
622
|
+
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
623
|
+
return n && r && i;
|
|
624
|
+
}
|
|
625
|
+
function st(e) {
|
|
626
|
+
return e instanceof N ? e : typeof e.data == "string" ? N.create(e) : e;
|
|
627
|
+
}
|
|
628
|
+
function ct(e, t) {
|
|
629
|
+
return e instanceof N ? e.appendData(t.data) : N.create(e).appendData(t.data);
|
|
630
|
+
}
|
|
631
|
+
function lt(e) {
|
|
632
|
+
D(typeof e.data == "string", "expected string output");
|
|
633
|
+
}
|
|
634
|
+
function ut(e, t) {
|
|
635
|
+
let n = 0, r;
|
|
636
|
+
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
637
|
+
let t = e[r];
|
|
638
|
+
t.mimetype === "text/plain" ? (D(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
|
|
639
|
+
}
|
|
640
|
+
if (n < t) return e;
|
|
641
|
+
let i = r + 1, a = {
|
|
642
|
+
channel: "stderr",
|
|
643
|
+
mimetype: "text/html",
|
|
644
|
+
data: `<pre>Streaming output truncated to last ${t} lines.\n</pre>`,
|
|
645
|
+
timestamp: -1
|
|
646
|
+
}, o = e[i];
|
|
647
|
+
if (o == null) return [a, ...e.slice(i + 1)];
|
|
648
|
+
if (o.mimetype === "text/plain") {
|
|
649
|
+
D(typeof o.data == "string", "expected string");
|
|
650
|
+
let r = o.data.split("\n"), s = t - (n - r.length);
|
|
651
|
+
return [
|
|
652
|
+
a,
|
|
653
|
+
{
|
|
654
|
+
...o,
|
|
655
|
+
data: r.slice(-s).join("\n")
|
|
656
|
+
},
|
|
657
|
+
...e.slice(i + 1)
|
|
658
|
+
];
|
|
659
|
+
}
|
|
660
|
+
return [a, ...e.slice(i + 1)];
|
|
661
|
+
}
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/core/cells/cell.ts
|
|
664
|
+
function dt(e) {
|
|
665
|
+
return (e.at(-1)?.id ?? 0) + 1;
|
|
666
|
+
}
|
|
667
|
+
function ft(e, t) {
|
|
668
|
+
let n = { ...e };
|
|
669
|
+
switch (t.status) {
|
|
670
|
+
case "queued":
|
|
671
|
+
n.interrupted = !1, n.errored = !1, n.runElapsedTimeMs = null, n.debuggerActive = !1;
|
|
672
|
+
break;
|
|
673
|
+
case "running":
|
|
674
|
+
n.interrupted = !1, e.stopped && (n.output = null), n.status === "queued" && (n.consoleOutputs = []), n.stopped = !1, n.runStartTimestamp = t.timestamp, n.lastRunStartTimestamp = t.timestamp;
|
|
675
|
+
break;
|
|
676
|
+
case "idle":
|
|
677
|
+
e.runStartTimestamp && (n.runElapsedTimeMs = tt.fromSeconds((t.timestamp ?? 0) - e.runStartTimestamp).toMilliseconds(), n.runStartTimestamp = null, n.staleInputs = !1), !e.lastRunStartTimestamp && t.timestamp && (n.lastRunStartTimestamp = t.timestamp), n.debuggerActive = !1;
|
|
678
|
+
break;
|
|
679
|
+
case null: break;
|
|
680
|
+
case "disabled-transitively": break;
|
|
681
|
+
case void 0: break;
|
|
682
|
+
default: u(t.status);
|
|
683
|
+
}
|
|
684
|
+
n.output = t.output ?? n.output, n.staleInputs = t.stale_inputs ?? n.staleInputs, n.status = t.status ?? n.status, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
685
|
+
let r = !1;
|
|
686
|
+
t.output != null && t.output.mimetype === "application/vnd.marimo+error" && ((n.status === "queued" || n.status === "running") && (n.status = "idle"), D(Array.isArray(t.output.data), "Expected error output data to be an array"), t.output.data.some((e) => e.type === "interruption") ? (n.interrupted = !0, r = !0) : t.output.data.some((e) => e.type.includes("ancestor")) ? n.stopped = !0 : n.errored = !0);
|
|
687
|
+
let i = e.consoleOutputs;
|
|
688
|
+
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
689
|
+
channel: e.channel,
|
|
690
|
+
mimetype: e.mimetype,
|
|
691
|
+
data: e.data,
|
|
692
|
+
timestamp: e.timestamp,
|
|
693
|
+
id: e.id,
|
|
694
|
+
response: e.response ?? ""
|
|
695
|
+
} : e));
|
|
696
|
+
let a = t.console;
|
|
697
|
+
a != null && (i = at(Array.isArray(a) ? a.map((e, t) => ({
|
|
698
|
+
...e,
|
|
699
|
+
id: t + 1
|
|
700
|
+
})) : [...i, {
|
|
701
|
+
...a,
|
|
702
|
+
id: dt(i)
|
|
703
|
+
}])), n.consoleOutputs = i, n.outline = Xe(n.output);
|
|
704
|
+
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
705
|
+
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
706
|
+
}
|
|
707
|
+
function pt(e) {
|
|
708
|
+
let t = { ...e };
|
|
709
|
+
return e.status !== "disabled-transitively" && (t.status = "queued"), t.interrupted = !1, t.errored = !1, t.runElapsedTimeMs = null, t.debuggerActive = !1, t;
|
|
710
|
+
}
|
|
711
|
+
function mt(e) {
|
|
712
|
+
return e === "running" || e === "queued";
|
|
713
|
+
}
|
|
714
|
+
function ht(e, t) {
|
|
715
|
+
let { status: n, output: r, runStartTimestamp: i, interrupted: a, staleInputs: o } = e;
|
|
716
|
+
if (a) return !1;
|
|
717
|
+
if (t) return !0;
|
|
718
|
+
let s = mt(n), c = n === "running" && r !== null && i !== null && (r.timestamp ?? 0) > i;
|
|
719
|
+
return s && !c ? !0 : o;
|
|
720
|
+
}
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region src/core/cells/columns.ts
|
|
723
|
+
function gt(e) {
|
|
724
|
+
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
725
|
+
for (let r of e.order) {
|
|
726
|
+
let i = e.cells.get(r)?.config.column;
|
|
727
|
+
i != null && i >= 0 && (n = i), t.set(r, n);
|
|
728
|
+
}
|
|
729
|
+
return t;
|
|
730
|
+
}
|
|
731
|
+
function _t(e) {
|
|
732
|
+
let t = [[]];
|
|
733
|
+
for (let [n, r] of gt(e)) {
|
|
734
|
+
for (; t.length <= r;) t.push([]);
|
|
735
|
+
t[r].push(n);
|
|
736
|
+
}
|
|
737
|
+
return t;
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/core/dom/ui-element-constants.ts
|
|
741
|
+
var vt = "object-id", yt = "random-id", bt = "abcdefghijklmnopqrstuvwxyz", xt = bt + bt.toUpperCase(), St = /* @__PURE__ */ new Set(), P = "__scratch__", Ct = "setup", wt = { create() {
|
|
742
|
+
let e = 0, t;
|
|
743
|
+
do {
|
|
744
|
+
let n = "";
|
|
745
|
+
for (let e = 0; e < 4; e++) n += xt[Math.floor(Math.random() * 52)];
|
|
746
|
+
t = n, e++;
|
|
747
|
+
} while (St.has(t) && e < 100);
|
|
748
|
+
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
749
|
+
return St.add(t), t;
|
|
750
|
+
} }, F = {
|
|
751
|
+
create(e) {
|
|
752
|
+
return D(e != null, "cellId is required"), `cell-${e}`;
|
|
753
|
+
},
|
|
754
|
+
parse(e) {
|
|
755
|
+
return e.slice(5);
|
|
756
|
+
},
|
|
757
|
+
findElement(e) {
|
|
758
|
+
return e.closest("div[id^=\"cell-\"]");
|
|
759
|
+
},
|
|
760
|
+
findElementThroughShadowDOMs(e) {
|
|
761
|
+
let t = e;
|
|
762
|
+
for (; t;) {
|
|
763
|
+
let e = F.findElement(t);
|
|
764
|
+
if (e) return e;
|
|
765
|
+
let n = t.getRootNode();
|
|
766
|
+
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
767
|
+
}
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
function Tt(e) {
|
|
772
|
+
let t = null, n = F.findElementThroughShadowDOMs(e);
|
|
773
|
+
return n && (t = F.parse(n.id)), t;
|
|
774
|
+
}
|
|
775
|
+
var I = {
|
|
776
|
+
parse(e) {
|
|
777
|
+
return e.getAttribute(vt);
|
|
778
|
+
},
|
|
779
|
+
parseOrThrow(e) {
|
|
780
|
+
let t = I.parse(e);
|
|
781
|
+
return D(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
782
|
+
}
|
|
783
|
+
}, Et = { create(e) {
|
|
784
|
+
return `output-${e}`;
|
|
785
|
+
} }, Dt = T(/* @__PURE__ */ new Set()), L = T([]), R = T([]);
|
|
786
|
+
function Ot() {
|
|
787
|
+
return `column-${wt.create()}`;
|
|
788
|
+
}
|
|
789
|
+
var kt = T(null, (e, t, n) => {
|
|
790
|
+
let r = _t(n).length, i = e(L);
|
|
791
|
+
if (i.length === r) return;
|
|
792
|
+
let a = e(R), o = [...i, ...a].slice(0, r);
|
|
793
|
+
for (; o.length < r;) o.push(Ot());
|
|
794
|
+
t(L, o), t(R, a.slice(Math.max(0, r - i.length)));
|
|
795
|
+
});
|
|
796
|
+
function At(e, t, n) {
|
|
797
|
+
return [...(e === null ? [[]] : _t(e)).map((e, n) => ({
|
|
798
|
+
id: t[n] ?? `column-${n}`,
|
|
799
|
+
ids: e
|
|
800
|
+
})), ...n.map((e) => ({
|
|
801
|
+
id: e,
|
|
802
|
+
ids: []
|
|
803
|
+
}))];
|
|
804
|
+
}
|
|
805
|
+
function jt(e, t, n) {
|
|
806
|
+
let r = /* @__PURE__ */ new Map();
|
|
807
|
+
return e.forEach((i, a) => {
|
|
808
|
+
let o = t[a];
|
|
809
|
+
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
810
|
+
let s = Qe(a, t);
|
|
811
|
+
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
812
|
+
}), r;
|
|
813
|
+
}
|
|
814
|
+
function Mt(e, t, n) {
|
|
815
|
+
return { columns: e.map(({ id: e, ids: r }) => {
|
|
816
|
+
let i = jt(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
817
|
+
return {
|
|
818
|
+
id: e,
|
|
819
|
+
ids: r,
|
|
820
|
+
visible: r.filter((e) => !a.has(e)),
|
|
821
|
+
folds: i
|
|
822
|
+
};
|
|
823
|
+
}) };
|
|
824
|
+
}
|
|
825
|
+
var z = T((e) => {
|
|
826
|
+
let t = e(y), n = t === null ? null : e(t.documentAtom), r = e(Pr);
|
|
827
|
+
return Mt(At(n, e(L), e(R)), (e) => r[e] ?? null, e(Dt));
|
|
828
|
+
}), Nt = () => E(z), Pt = T((e) => e(z).columns.length);
|
|
829
|
+
function Ft(e, t) {
|
|
830
|
+
return e.columns.find((e) => e.id === t);
|
|
831
|
+
}
|
|
832
|
+
function It(e, t) {
|
|
833
|
+
let n = e.columns.find((e) => e.ids.includes(t));
|
|
834
|
+
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
835
|
+
return n;
|
|
836
|
+
}
|
|
837
|
+
function Lt(e, t) {
|
|
838
|
+
for (let n of e.columns) {
|
|
839
|
+
let e = n.folds.get(t);
|
|
840
|
+
if (e !== void 0) return e;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
function Rt(e, t) {
|
|
844
|
+
let n = e.columns.find((e) => e.ids.includes(t));
|
|
845
|
+
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
846
|
+
}
|
|
847
|
+
function zt(e, t) {
|
|
848
|
+
let n = Rt(e, t);
|
|
849
|
+
return Lt(e, t) === void 0 ? n : [...n, t];
|
|
850
|
+
}
|
|
851
|
+
var Bt = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
|
|
852
|
+
function Vt(e, t = !0) {
|
|
853
|
+
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
854
|
+
}
|
|
855
|
+
function Ht(e, t) {
|
|
856
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Bt.has(e);
|
|
857
|
+
if (i(e)) return e;
|
|
858
|
+
let a = 1;
|
|
859
|
+
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
860
|
+
return r;
|
|
861
|
+
}
|
|
862
|
+
function Ut(e, t) {
|
|
863
|
+
return Wt(e) ? `cell-${t}` : e;
|
|
864
|
+
}
|
|
865
|
+
function Wt(e) {
|
|
866
|
+
return !e || e === "_" || e === "__";
|
|
867
|
+
}
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/core/cells/types.ts
|
|
870
|
+
function B(e, t) {
|
|
871
|
+
return e === null ? t.trim().length > 0 : e.trim() !== t.trim();
|
|
872
|
+
}
|
|
873
|
+
function Gt({ id: e, name: t = "_", code: n = "", lastCodeRun: r = null, lastExecutionTime: i = null, edited: a = !1, config: o }) {
|
|
874
|
+
return {
|
|
875
|
+
id: e,
|
|
876
|
+
config: o || {
|
|
877
|
+
hide_code: !1,
|
|
878
|
+
disabled: !1,
|
|
879
|
+
column: null,
|
|
880
|
+
expand_output: !1
|
|
881
|
+
},
|
|
882
|
+
name: t,
|
|
883
|
+
code: n,
|
|
884
|
+
edited: a,
|
|
885
|
+
lastCodeRun: r,
|
|
886
|
+
lastExecutionTime: i
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
function Kt(e) {
|
|
890
|
+
return {
|
|
891
|
+
hide_code: !1,
|
|
892
|
+
disabled: !1,
|
|
893
|
+
column: null,
|
|
894
|
+
expand_output: !1,
|
|
895
|
+
...e
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
function V(e) {
|
|
899
|
+
return {
|
|
900
|
+
outline: null,
|
|
901
|
+
output: null,
|
|
902
|
+
consoleOutputs: [],
|
|
903
|
+
status: "idle",
|
|
904
|
+
staleInputs: !1,
|
|
905
|
+
interrupted: !1,
|
|
906
|
+
errored: !1,
|
|
907
|
+
stopped: !1,
|
|
908
|
+
runElapsedTimeMs: null,
|
|
909
|
+
runStartTimestamp: null,
|
|
910
|
+
lastRunStartTimestamp: null,
|
|
911
|
+
debuggerActive: !1,
|
|
912
|
+
...e
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
//#endregion
|
|
916
|
+
//#region src/core/cells/document.ts
|
|
917
|
+
function qt(e, t) {
|
|
918
|
+
let n = t.code ?? e.code, r = S(e.config, t.config) ? e.config : Kt(t.config);
|
|
919
|
+
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
920
|
+
...e,
|
|
921
|
+
name: t.name,
|
|
922
|
+
config: r
|
|
923
|
+
} : {
|
|
924
|
+
...e,
|
|
925
|
+
code: n,
|
|
926
|
+
name: t.name,
|
|
927
|
+
config: r,
|
|
928
|
+
edited: B(e.lastCodeRun, n)
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
function Jt(e, t) {
|
|
932
|
+
let n = S(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
933
|
+
for (let o of n) {
|
|
934
|
+
let n = t.cells.get(o), s = e.cellData[o];
|
|
935
|
+
if (n === void 0) continue;
|
|
936
|
+
if (s === void 0) {
|
|
937
|
+
let e = n.code ?? "";
|
|
938
|
+
r = {
|
|
939
|
+
...r,
|
|
940
|
+
[o]: Gt({
|
|
941
|
+
id: o,
|
|
942
|
+
code: e,
|
|
943
|
+
name: n.name,
|
|
944
|
+
config: Kt(n.config),
|
|
945
|
+
edited: B(null, e)
|
|
946
|
+
})
|
|
947
|
+
}, i = {
|
|
948
|
+
...i,
|
|
949
|
+
[o]: i[o] ?? V()
|
|
950
|
+
}, a = {
|
|
951
|
+
...a,
|
|
952
|
+
[o]: (0, O.createRef)()
|
|
953
|
+
};
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
let c = qt(s, n);
|
|
957
|
+
c !== s && (r = {
|
|
958
|
+
...r,
|
|
959
|
+
[o]: c
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
let o = new Set(n), s = e.cellIds.filter((e) => !o.has(e));
|
|
963
|
+
if (s.length > 0) {
|
|
964
|
+
let e = new Set(s), t = (t) => Object.fromEntries(Object.entries(t).filter(([t]) => !e.has(t)));
|
|
965
|
+
r = t(r), i = t(i), a = t(a);
|
|
966
|
+
}
|
|
967
|
+
return n === e.cellIds && r === e.cellData && s.length === 0 ? e : {
|
|
968
|
+
...e,
|
|
969
|
+
cellIds: n,
|
|
970
|
+
cellData: r,
|
|
971
|
+
cellRuntime: i,
|
|
972
|
+
cellHandles: a
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
function Yt({ store: e, model: t, reconcile: n, signal: r }) {
|
|
976
|
+
let i = () => {
|
|
977
|
+
let r = e.get(t.documentAtom);
|
|
978
|
+
r !== null && (n(r), e.set(kt, r));
|
|
979
|
+
}, a = e.sub(t.documentAtom, i);
|
|
980
|
+
r.addEventListener("abort", a, { once: !0 }), i();
|
|
981
|
+
}
|
|
982
|
+
async function Xt() {
|
|
983
|
+
let e = C.get(y);
|
|
984
|
+
e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
985
|
+
}
|
|
986
|
+
//#endregion
|
|
987
|
+
//#region src/core/cells/editor.ts
|
|
988
|
+
var H = T(/* @__PURE__ */ new Set());
|
|
989
|
+
function Zt(e, t, n) {
|
|
990
|
+
return !!e && !t.has(n);
|
|
991
|
+
}
|
|
992
|
+
T(null, (e, t, { cellId: n }) => {
|
|
993
|
+
t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
994
|
+
}), T(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
|
|
995
|
+
let t = new Set(e);
|
|
996
|
+
return t.delete(n), t;
|
|
997
|
+
}), !0) : !1);
|
|
998
|
+
var Qt = T(/* @__PURE__ */ new Map());
|
|
999
|
+
T(null, (e, t, { cellId: n }) => {
|
|
1000
|
+
t(Qt, (e) => {
|
|
1001
|
+
let t = new Map(e);
|
|
1002
|
+
return t.delete(n), t;
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1007
|
+
function $t(e, t) {
|
|
1008
|
+
return he(e * 1e3, t?.in);
|
|
1009
|
+
}
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1012
|
+
var en = function(e, t) {
|
|
1013
|
+
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1014
|
+
}, U;
|
|
1015
|
+
(function(e) {
|
|
1016
|
+
e[e.EOS = 0] = "EOS", e[e.Text = 1] = "Text", e[e.Incomplete = 2] = "Incomplete", e[e.ESC = 3] = "ESC", e[e.Unknown = 4] = "Unknown", e[e.SGR = 5] = "SGR", e[e.OSCURL = 6] = "OSCURL";
|
|
1017
|
+
})(U ||= {});
|
|
1018
|
+
var tn = class {
|
|
1019
|
+
constructor() {
|
|
1020
|
+
this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = {
|
|
1021
|
+
http: 1,
|
|
1022
|
+
https: 1
|
|
1023
|
+
}, this._escape_html = !0, this.boldStyle = "font-weight:bold", this.faintStyle = "opacity:0.7", this.italicStyle = "font-style:italic", this.underlineStyle = "text-decoration:underline";
|
|
1024
|
+
}
|
|
1025
|
+
set use_classes(e) {
|
|
1026
|
+
this._use_classes = e;
|
|
1027
|
+
}
|
|
1028
|
+
get use_classes() {
|
|
1029
|
+
return this._use_classes;
|
|
1030
|
+
}
|
|
1031
|
+
set url_allowlist(e) {
|
|
1032
|
+
this._url_allowlist = e;
|
|
1033
|
+
}
|
|
1034
|
+
get url_allowlist() {
|
|
1035
|
+
return this._url_allowlist;
|
|
1036
|
+
}
|
|
1037
|
+
set escape_html(e) {
|
|
1038
|
+
this._escape_html = e;
|
|
1039
|
+
}
|
|
1040
|
+
get escape_html() {
|
|
1041
|
+
return this._escape_html;
|
|
1042
|
+
}
|
|
1043
|
+
set boldStyle(e) {
|
|
1044
|
+
this._boldStyle = e;
|
|
1045
|
+
}
|
|
1046
|
+
get boldStyle() {
|
|
1047
|
+
return this._boldStyle;
|
|
1048
|
+
}
|
|
1049
|
+
set faintStyle(e) {
|
|
1050
|
+
this._faintStyle = e;
|
|
1051
|
+
}
|
|
1052
|
+
get faintStyle() {
|
|
1053
|
+
return this._faintStyle;
|
|
1054
|
+
}
|
|
1055
|
+
set italicStyle(e) {
|
|
1056
|
+
this._italicStyle = e;
|
|
1057
|
+
}
|
|
1058
|
+
get italicStyle() {
|
|
1059
|
+
return this._italicStyle;
|
|
1060
|
+
}
|
|
1061
|
+
set underlineStyle(e) {
|
|
1062
|
+
this._underlineStyle = e;
|
|
1063
|
+
}
|
|
1064
|
+
get underlineStyle() {
|
|
1065
|
+
return this._underlineStyle;
|
|
1066
|
+
}
|
|
1067
|
+
setup_palettes() {
|
|
1068
|
+
this.ansi_colors = [[
|
|
1069
|
+
{
|
|
1070
|
+
rgb: [
|
|
1071
|
+
0,
|
|
1072
|
+
0,
|
|
1073
|
+
0
|
|
1074
|
+
],
|
|
1075
|
+
class_name: "ansi-black"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
rgb: [
|
|
1079
|
+
187,
|
|
1080
|
+
0,
|
|
1081
|
+
0
|
|
1082
|
+
],
|
|
1083
|
+
class_name: "ansi-red"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
rgb: [
|
|
1087
|
+
0,
|
|
1088
|
+
187,
|
|
1089
|
+
0
|
|
1090
|
+
],
|
|
1091
|
+
class_name: "ansi-green"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
rgb: [
|
|
1095
|
+
187,
|
|
1096
|
+
187,
|
|
1097
|
+
0
|
|
1098
|
+
],
|
|
1099
|
+
class_name: "ansi-yellow"
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
rgb: [
|
|
1103
|
+
0,
|
|
1104
|
+
0,
|
|
1105
|
+
187
|
|
1106
|
+
],
|
|
1107
|
+
class_name: "ansi-blue"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
rgb: [
|
|
1111
|
+
187,
|
|
1112
|
+
0,
|
|
1113
|
+
187
|
|
1114
|
+
],
|
|
1115
|
+
class_name: "ansi-magenta"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
rgb: [
|
|
1119
|
+
0,
|
|
1120
|
+
187,
|
|
1121
|
+
187
|
|
1122
|
+
],
|
|
1123
|
+
class_name: "ansi-cyan"
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
rgb: [
|
|
1127
|
+
255,
|
|
1128
|
+
255,
|
|
1129
|
+
255
|
|
1130
|
+
],
|
|
1131
|
+
class_name: "ansi-white"
|
|
1132
|
+
}
|
|
1133
|
+
], [
|
|
1134
|
+
{
|
|
1135
|
+
rgb: [
|
|
1136
|
+
85,
|
|
1137
|
+
85,
|
|
1138
|
+
85
|
|
1139
|
+
],
|
|
1140
|
+
class_name: "ansi-bright-black"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
rgb: [
|
|
1144
|
+
255,
|
|
1145
|
+
85,
|
|
1146
|
+
85
|
|
1147
|
+
],
|
|
1148
|
+
class_name: "ansi-bright-red"
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
rgb: [
|
|
1152
|
+
0,
|
|
1153
|
+
255,
|
|
1154
|
+
0
|
|
1155
|
+
],
|
|
1156
|
+
class_name: "ansi-bright-green"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
rgb: [
|
|
1160
|
+
255,
|
|
1161
|
+
255,
|
|
1162
|
+
85
|
|
1163
|
+
],
|
|
1164
|
+
class_name: "ansi-bright-yellow"
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
rgb: [
|
|
1168
|
+
85,
|
|
1169
|
+
85,
|
|
1170
|
+
255
|
|
1171
|
+
],
|
|
1172
|
+
class_name: "ansi-bright-blue"
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
rgb: [
|
|
1176
|
+
255,
|
|
1177
|
+
85,
|
|
1178
|
+
255
|
|
1179
|
+
],
|
|
1180
|
+
class_name: "ansi-bright-magenta"
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
rgb: [
|
|
1184
|
+
85,
|
|
1185
|
+
255,
|
|
1186
|
+
255
|
|
1187
|
+
],
|
|
1188
|
+
class_name: "ansi-bright-cyan"
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
rgb: [
|
|
1192
|
+
255,
|
|
1193
|
+
255,
|
|
1194
|
+
255
|
|
1195
|
+
],
|
|
1196
|
+
class_name: "ansi-bright-white"
|
|
1197
|
+
}
|
|
1198
|
+
]], this.palette_256 = [], this.ansi_colors.forEach((e) => {
|
|
1199
|
+
e.forEach((e) => {
|
|
1200
|
+
this.palette_256.push(e);
|
|
1201
|
+
});
|
|
1202
|
+
});
|
|
1203
|
+
let e = [
|
|
1204
|
+
0,
|
|
1205
|
+
95,
|
|
1206
|
+
135,
|
|
1207
|
+
175,
|
|
1208
|
+
215,
|
|
1209
|
+
255
|
|
1210
|
+
];
|
|
1211
|
+
for (let t = 0; t < 6; ++t) for (let n = 0; n < 6; ++n) for (let r = 0; r < 6; ++r) {
|
|
1212
|
+
let i = {
|
|
1213
|
+
rgb: [
|
|
1214
|
+
e[t],
|
|
1215
|
+
e[n],
|
|
1216
|
+
e[r]
|
|
1217
|
+
],
|
|
1218
|
+
class_name: "truecolor"
|
|
1219
|
+
};
|
|
1220
|
+
this.palette_256.push(i);
|
|
1221
|
+
}
|
|
1222
|
+
let t = 8;
|
|
1223
|
+
for (let e = 0; e < 24; ++e, t += 10) {
|
|
1224
|
+
let e = {
|
|
1225
|
+
rgb: [
|
|
1226
|
+
t,
|
|
1227
|
+
t,
|
|
1228
|
+
t
|
|
1229
|
+
],
|
|
1230
|
+
class_name: "truecolor"
|
|
1231
|
+
};
|
|
1232
|
+
this.palette_256.push(e);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
escape_txt_for_html(e) {
|
|
1236
|
+
return this._escape_html ? e.replace(/[&<>"']/gm, (e) => {
|
|
1237
|
+
if (e === "&") return "&";
|
|
1238
|
+
if (e === "<") return "<";
|
|
1239
|
+
if (e === ">") return ">";
|
|
1240
|
+
if (e === "\"") return """;
|
|
1241
|
+
if (e === "'") return "'";
|
|
1242
|
+
}) : e;
|
|
1243
|
+
}
|
|
1244
|
+
append_buffer(e) {
|
|
1245
|
+
var t = this._buffer + e;
|
|
1246
|
+
this._buffer = t;
|
|
1247
|
+
}
|
|
1248
|
+
get_next_packet() {
|
|
1249
|
+
var e = {
|
|
1250
|
+
kind: U.EOS,
|
|
1251
|
+
text: "",
|
|
1252
|
+
url: ""
|
|
1253
|
+
}, t = this._buffer.length;
|
|
1254
|
+
if (t == 0) return e;
|
|
1255
|
+
var n = this._buffer.indexOf("\x1B");
|
|
1256
|
+
if (n == -1) return e.kind = U.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1257
|
+
if (n > 0) return e.kind = U.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1258
|
+
if (n == 0) {
|
|
1259
|
+
if (t < 3) return e.kind = U.Incomplete, e;
|
|
1260
|
+
var r = this._buffer.charAt(1);
|
|
1261
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1262
|
+
if (r == "[") {
|
|
1263
|
+
this._csi_regex ||= nn(an ||= en(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
|
|
1264
|
+
let t = this._buffer.match(this._csi_regex);
|
|
1265
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1266
|
+
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1267
|
+
e.kind = t[1] != "" || t[3] != "m" ? U.Unknown : U.SGR, e.text = t[2];
|
|
1268
|
+
var i = t[0].length;
|
|
1269
|
+
return this._buffer = this._buffer.slice(i), e;
|
|
1270
|
+
}
|
|
1271
|
+
if (r == "]") {
|
|
1272
|
+
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1273
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1274
|
+
this._osc_st ||= rn(on ||= en(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
|
|
1275
|
+
{
|
|
1276
|
+
let t = this._osc_st.exec(this._buffer);
|
|
1277
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1278
|
+
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1279
|
+
}
|
|
1280
|
+
{
|
|
1281
|
+
let t = this._osc_st.exec(this._buffer);
|
|
1282
|
+
if (t === null) return e.kind = U.Incomplete, e;
|
|
1283
|
+
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1284
|
+
}
|
|
1285
|
+
this._osc_regex ||= nn(sn ||= en(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
|
|
1286
|
+
let n = this._buffer.match(this._osc_regex);
|
|
1287
|
+
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1288
|
+
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
1289
|
+
var i = n[0].length;
|
|
1290
|
+
return this._buffer = this._buffer.slice(i), e;
|
|
1291
|
+
}
|
|
1292
|
+
if (r == "(") return e.kind = U.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
ansi_to_html(e) {
|
|
1296
|
+
this.append_buffer(e);
|
|
1297
|
+
for (var t = [];;) {
|
|
1298
|
+
var n = this.get_next_packet();
|
|
1299
|
+
if (n.kind == U.EOS || n.kind == U.Incomplete) break;
|
|
1300
|
+
n.kind != U.ESC && n.kind != U.Unknown && (n.kind == U.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == U.SGR ? this.process_ansi(n) : n.kind == U.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1301
|
+
}
|
|
1302
|
+
return t.join("");
|
|
1303
|
+
}
|
|
1304
|
+
with_state(e) {
|
|
1305
|
+
return {
|
|
1306
|
+
bold: this.bold,
|
|
1307
|
+
faint: this.faint,
|
|
1308
|
+
italic: this.italic,
|
|
1309
|
+
underline: this.underline,
|
|
1310
|
+
fg: this.fg,
|
|
1311
|
+
bg: this.bg,
|
|
1312
|
+
text: e.text
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1315
|
+
process_ansi(e) {
|
|
1316
|
+
let t = e.text.split(";");
|
|
1317
|
+
for (; t.length > 0;) {
|
|
1318
|
+
let e = t.shift(), n = parseInt(e, 10);
|
|
1319
|
+
if (isNaN(n) || n === 0) this.fg = null, this.bg = null, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1;
|
|
1320
|
+
else if (n === 1) this.bold = !0;
|
|
1321
|
+
else if (n === 2) this.faint = !0;
|
|
1322
|
+
else if (n === 3) this.italic = !0;
|
|
1323
|
+
else if (n === 4) this.underline = !0;
|
|
1324
|
+
else if (n === 21) this.bold = !1;
|
|
1325
|
+
else if (n === 22) this.faint = !1, this.bold = !1;
|
|
1326
|
+
else if (n === 23) this.italic = !1;
|
|
1327
|
+
else if (n === 24) this.underline = !1;
|
|
1328
|
+
else if (n === 39) this.fg = null;
|
|
1329
|
+
else if (n === 49) this.bg = null;
|
|
1330
|
+
else if (n >= 30 && n < 38) this.fg = this.ansi_colors[0][n - 30];
|
|
1331
|
+
else if (n >= 40 && n < 48) this.bg = this.ansi_colors[0][n - 40];
|
|
1332
|
+
else if (n >= 90 && n < 98) this.fg = this.ansi_colors[1][n - 90];
|
|
1333
|
+
else if (n >= 100 && n < 108) this.bg = this.ansi_colors[1][n - 100];
|
|
1334
|
+
else if ((n === 38 || n === 48) && t.length > 0) {
|
|
1335
|
+
let e = n === 38, r = t.shift();
|
|
1336
|
+
if (r === "5" && t.length > 0) {
|
|
1337
|
+
let n = parseInt(t.shift(), 10);
|
|
1338
|
+
n >= 0 && n <= 255 && (e ? this.fg = this.palette_256[n] : this.bg = this.palette_256[n]);
|
|
1339
|
+
}
|
|
1340
|
+
if (r === "2" && t.length > 2) {
|
|
1341
|
+
let n = parseInt(t.shift(), 10), r = parseInt(t.shift(), 10), i = parseInt(t.shift(), 10);
|
|
1342
|
+
if (n >= 0 && n <= 255 && r >= 0 && r <= 255 && i >= 0 && i <= 255) {
|
|
1343
|
+
let t = {
|
|
1344
|
+
rgb: [
|
|
1345
|
+
n,
|
|
1346
|
+
r,
|
|
1347
|
+
i
|
|
1348
|
+
],
|
|
1349
|
+
class_name: "truecolor"
|
|
1350
|
+
};
|
|
1351
|
+
e ? this.fg = t : this.bg = t;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
transform_to_html(e) {
|
|
1358
|
+
let t = e.text;
|
|
1359
|
+
if (t.length === 0 || (t = this.escape_txt_for_html(t), !e.bold && !e.italic && !e.faint && !e.underline && e.fg === null && e.bg === null)) return t;
|
|
1360
|
+
let n = [], r = [], i = e.fg, a = e.bg;
|
|
1361
|
+
e.bold && n.push(this._boldStyle), e.faint && n.push(this._faintStyle), e.italic && n.push(this._italicStyle), e.underline && n.push(this._underlineStyle), this._use_classes ? (i && (i.class_name === "truecolor" ? n.push(`color:rgb(${i.rgb.join(",")})`) : r.push(`${i.class_name}-fg`)), a && (a.class_name === "truecolor" ? n.push(`background-color:rgb(${a.rgb.join(",")})`) : r.push(`${a.class_name}-bg`))) : (i && n.push(`color:rgb(${i.rgb.join(",")})`), a && n.push(`background-color:rgb(${a.rgb})`));
|
|
1362
|
+
let o = "", s = "";
|
|
1363
|
+
return r.length && (o = ` class="${r.join(" ")}"`), n.length && (s = ` style="${n.join(";")}"`), `<span${s}${o}>${t}</span>`;
|
|
1364
|
+
}
|
|
1365
|
+
process_hyperlink(e) {
|
|
1366
|
+
let t = e.url.split(":");
|
|
1367
|
+
return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
function nn(e, ...t) {
|
|
1371
|
+
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1372
|
+
return new RegExp(n);
|
|
1373
|
+
}
|
|
1374
|
+
function rn(e, ...t) {
|
|
1375
|
+
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1376
|
+
return new RegExp(n, "g");
|
|
1377
|
+
}
|
|
1378
|
+
var an, on, sn, cn = new tn();
|
|
1379
|
+
function W(e) {
|
|
1380
|
+
try {
|
|
1381
|
+
let t = document.createElement("div");
|
|
1382
|
+
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
1383
|
+
} catch (n) {
|
|
1384
|
+
return t.error("Error parsing HTML content:", n), e;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
function ln(e) {
|
|
1388
|
+
if (!e) return "";
|
|
1389
|
+
try {
|
|
1390
|
+
return W(cn.ansi_to_html(e));
|
|
1391
|
+
} catch (n) {
|
|
1392
|
+
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
//#endregion
|
|
1396
|
+
//#region src/core/errors/traceback-atom.ts
|
|
1397
|
+
var un = T(null);
|
|
1398
|
+
//#endregion
|
|
1399
|
+
//#region src/core/cells/logs.ts
|
|
1400
|
+
function dn(e) {
|
|
1401
|
+
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1402
|
+
}
|
|
1403
|
+
var fn = !1;
|
|
1404
|
+
function pn(e) {
|
|
1405
|
+
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1406
|
+
for (let r of n) {
|
|
1407
|
+
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
1408
|
+
if (n || i) {
|
|
1409
|
+
let n = r.channel === "stderr" || r.channel === "marimo-error";
|
|
1410
|
+
switch (r.channel) {
|
|
1411
|
+
case "stdout":
|
|
1412
|
+
case "stderr":
|
|
1413
|
+
case "marimo-error": {
|
|
1414
|
+
let a = d.asString(r.data), o = i ? W(a) : a;
|
|
1415
|
+
t.push({
|
|
1416
|
+
timestamp: r.timestamp || Date.now(),
|
|
1417
|
+
level: n ? "stderr" : "stdout",
|
|
1418
|
+
message: o,
|
|
1419
|
+
source: {
|
|
1420
|
+
type: "cell",
|
|
1421
|
+
cellId: e.cell_id
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
break;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
if (t.forEach(mn.log), n.length === 0 && M(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1430
|
+
e.output.data.forEach((t) => {
|
|
1431
|
+
mn.log({
|
|
1432
|
+
level: "stderr",
|
|
1433
|
+
source: {
|
|
1434
|
+
type: "cell",
|
|
1435
|
+
cellId: e.cell_id
|
|
1436
|
+
},
|
|
1437
|
+
timestamp: e.timestamp ?? 0,
|
|
1438
|
+
message: JSON.stringify(t)
|
|
1439
|
+
});
|
|
1440
|
+
});
|
|
1441
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(fe) === "read";
|
|
1442
|
+
if (t.length > 0 && !fn && n) {
|
|
1443
|
+
fn = !0;
|
|
1444
|
+
let e = t.find((e) => e.traceback);
|
|
1445
|
+
o(e ? {
|
|
1446
|
+
title: "An internal error occurred",
|
|
1447
|
+
description: e.msg || "Click 'View' to see traceback",
|
|
1448
|
+
variant: "danger",
|
|
1449
|
+
action: O.createElement(_, {
|
|
1450
|
+
altText: "View traceback",
|
|
1451
|
+
onClick: () => {
|
|
1452
|
+
C.set(un, {
|
|
1453
|
+
traceback: e.traceback,
|
|
1454
|
+
errorMessage: e.msg || "An internal error occurred"
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
}, "View")
|
|
1458
|
+
} : {
|
|
1459
|
+
title: "An internal error occurred",
|
|
1460
|
+
description: "See console for details.",
|
|
1461
|
+
variant: "danger"
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
return t;
|
|
1466
|
+
}
|
|
1467
|
+
var mn = { log: (e) => {
|
|
1468
|
+
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1469
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${hn(e.timestamp)}]`, `(${dn(e.source)}) ${e.message}`);
|
|
1470
|
+
} };
|
|
1471
|
+
function hn(e) {
|
|
1472
|
+
try {
|
|
1473
|
+
return $t(e).toLocaleTimeString(void 0, {
|
|
1474
|
+
hour12: !0,
|
|
1475
|
+
hour: "numeric",
|
|
1476
|
+
minute: "numeric",
|
|
1477
|
+
second: "numeric"
|
|
1478
|
+
});
|
|
1479
|
+
} catch {
|
|
1480
|
+
return "";
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
//#endregion
|
|
1484
|
+
//#region src/components/editor/navigation/focus-utils.ts
|
|
1485
|
+
function gn(e, n) {
|
|
1486
|
+
let r = document.getElementById(F.create(e));
|
|
1487
|
+
r ? vn(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1488
|
+
}
|
|
1489
|
+
function _n() {
|
|
1490
|
+
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1491
|
+
}
|
|
1492
|
+
function vn(e, n) {
|
|
1493
|
+
try {
|
|
1494
|
+
e.focus(n);
|
|
1495
|
+
} catch {
|
|
1496
|
+
t.warn("[CellFocusManager] element may not be focusable", e);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
//#endregion
|
|
1500
|
+
//#region src/utils/timeout.ts
|
|
1501
|
+
function yn(e, n) {
|
|
1502
|
+
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1503
|
+
if (o < r) {
|
|
1504
|
+
try {
|
|
1505
|
+
if (e()) return;
|
|
1506
|
+
} catch (e) {
|
|
1507
|
+
t.error(`Error executing function on attempt ${o + 1}, retrying`, { error: e });
|
|
1508
|
+
}
|
|
1509
|
+
o++, setTimeout(s, i);
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
a > 0 ? setTimeout(s, a) : s();
|
|
1513
|
+
}
|
|
1514
|
+
//#endregion
|
|
1515
|
+
//#region src/core/cells/utils.ts
|
|
1516
|
+
function bn(e) {
|
|
1517
|
+
return Object.values(e.cellRuntime).some((e) => e.status === "running");
|
|
1518
|
+
}
|
|
1519
|
+
function xn(e) {
|
|
1520
|
+
return Object.values(e.cellRuntime).filter((e) => e.status === "running" || e.status === "queued").length;
|
|
1521
|
+
}
|
|
1522
|
+
function Sn(e) {
|
|
1523
|
+
return On(e).length > 0;
|
|
1524
|
+
}
|
|
1525
|
+
function Cn(e) {
|
|
1526
|
+
return e.cellIds.map((t) => e.cellData[t]);
|
|
1527
|
+
}
|
|
1528
|
+
function wn(e) {
|
|
1529
|
+
let { cellIds: t, cellData: n } = e, r = [];
|
|
1530
|
+
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1531
|
+
return r;
|
|
1532
|
+
}
|
|
1533
|
+
function Tn(e) {
|
|
1534
|
+
let { cellIds: t, cellData: n } = e, r = [];
|
|
1535
|
+
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1536
|
+
return r;
|
|
1537
|
+
}
|
|
1538
|
+
function En(e) {
|
|
1539
|
+
return e.history.length > 0;
|
|
1540
|
+
}
|
|
1541
|
+
function Dn(e) {
|
|
1542
|
+
let t = e.history[e.history.length - 1];
|
|
1543
|
+
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1544
|
+
}
|
|
1545
|
+
function On(e) {
|
|
1546
|
+
let { cellIds: t, cellData: n, cellRuntime: r } = e;
|
|
1547
|
+
return t.filter((e) => kn({
|
|
1548
|
+
executionTime: r[e].runElapsedTimeMs ?? n[e].lastExecutionTime,
|
|
1549
|
+
status: r[e].status,
|
|
1550
|
+
errored: r[e].errored,
|
|
1551
|
+
interrupted: r[e].interrupted,
|
|
1552
|
+
stopped: r[e].stopped
|
|
1553
|
+
}) || n[e].edited || r[e].interrupted || r[e].staleInputs && !(r[e].status === "disabled-transitively" || n[e].config.disabled));
|
|
1554
|
+
}
|
|
1555
|
+
function kn({ executionTime: e, status: t, errored: n, interrupted: r, stopped: i }) {
|
|
1556
|
+
return e === null && t !== "queued" && t !== "running" && !(n || r || i);
|
|
1557
|
+
}
|
|
1558
|
+
function An({ errored: e, stopped: t }) {
|
|
1559
|
+
return {
|
|
1560
|
+
published: !0,
|
|
1561
|
+
"has-error": e,
|
|
1562
|
+
stopped: t
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
function jn({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1566
|
+
let a = M(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1567
|
+
return (e || t || n || a) && !o;
|
|
1568
|
+
}
|
|
1569
|
+
//#endregion
|
|
1570
|
+
//#region src/core/network/requests.ts
|
|
1571
|
+
var Mn = T(null);
|
|
1572
|
+
function Nn() {
|
|
1573
|
+
let e = E(Mn);
|
|
1574
|
+
return D(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1575
|
+
}
|
|
1576
|
+
function Pn() {
|
|
1577
|
+
let e = C.get(Mn);
|
|
1578
|
+
return D(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1579
|
+
}
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/utils/storage/storage.ts
|
|
1582
|
+
var Fn = class {
|
|
1583
|
+
store = /* @__PURE__ */ new Map();
|
|
1584
|
+
get length() {
|
|
1585
|
+
return this.store.size;
|
|
1586
|
+
}
|
|
1587
|
+
clear() {
|
|
1588
|
+
this.store.clear();
|
|
1589
|
+
}
|
|
1590
|
+
getItem(e) {
|
|
1591
|
+
return this.store.get(e) || null;
|
|
1592
|
+
}
|
|
1593
|
+
key(e) {
|
|
1594
|
+
return [...this.store.keys()][e] || null;
|
|
1595
|
+
}
|
|
1596
|
+
removeItem(e) {
|
|
1597
|
+
this.store.delete(e);
|
|
1598
|
+
}
|
|
1599
|
+
setItem(e, t) {
|
|
1600
|
+
this.store.set(e, t);
|
|
1601
|
+
}
|
|
1602
|
+
};
|
|
1603
|
+
function In() {
|
|
1604
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = ge();
|
|
1605
|
+
return e ? window.localStorage : t ? window.sessionStorage : new Fn();
|
|
1606
|
+
}
|
|
1607
|
+
var Ln = In(), Rn = /(https?:\/\/[^\s"<>`{}|\\^]+)/, zn = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Bn = /^data:image\//i, Vn = ["avatars.githubusercontent.com"];
|
|
1608
|
+
function Hn(e) {
|
|
1609
|
+
return Bn.test(e) ? [{
|
|
1610
|
+
type: "image",
|
|
1611
|
+
url: e
|
|
1612
|
+
}] : e.split(Rn).filter((e) => e !== "").map((e) => Rn.test(e) ? zn.test(e) || Bn.test(e) || Vn.some((t) => e.includes(t)) ? {
|
|
1613
|
+
type: "image",
|
|
1614
|
+
url: e
|
|
1615
|
+
} : {
|
|
1616
|
+
type: "url",
|
|
1617
|
+
url: e
|
|
1618
|
+
} : {
|
|
1619
|
+
type: "text",
|
|
1620
|
+
value: e
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
//#endregion
|
|
1624
|
+
//#region src/utils/json/json-parser.ts
|
|
1625
|
+
var Un = new RegExp(Rn.source, "g");
|
|
1626
|
+
BigInt.prototype.toJSON = function() {
|
|
1627
|
+
return JSON.rawJSON(this.toString());
|
|
1628
|
+
};
|
|
1629
|
+
function Wn(e) {
|
|
1630
|
+
try {
|
|
1631
|
+
return JSON.parse(e, (e, t) => Jn(t));
|
|
1632
|
+
} catch {}
|
|
1633
|
+
if (e == null || e === "") return {};
|
|
1634
|
+
try {
|
|
1635
|
+
return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : Jn(t) : Jn(t));
|
|
1636
|
+
} catch {
|
|
1637
|
+
return {};
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
function Gn(e) {
|
|
1641
|
+
if (e.length === 0) return "";
|
|
1642
|
+
let t = Object.keys(e[0]);
|
|
1643
|
+
return [
|
|
1644
|
+
`| ${t.join(" | ")} |`,
|
|
1645
|
+
`|${t.map(() => "---").join("|")}|`,
|
|
1646
|
+
...e.map((e) => `| ${t.map((t) => Kn(e[t])).join(" | ")} |`)
|
|
1647
|
+
].join("\n");
|
|
1648
|
+
}
|
|
1649
|
+
function Kn(e) {
|
|
1650
|
+
if (e == null) return "";
|
|
1651
|
+
if (Array.isArray(e) || typeof e == "object") return qn(JSON.stringify(e));
|
|
1652
|
+
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1653
|
+
t = t.replaceAll(n, (e) => {
|
|
1654
|
+
let t = `__MDLINK_${i++}__`;
|
|
1655
|
+
return r.set(t, e), t;
|
|
1656
|
+
}), t = t.replaceAll(Un, "[$1]($1)");
|
|
1657
|
+
for (let [e, n] of r) t = t.replace(e, n);
|
|
1658
|
+
return qn(t);
|
|
1659
|
+
}
|
|
1660
|
+
function qn(e) {
|
|
1661
|
+
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1662
|
+
}
|
|
1663
|
+
function Jn(e) {
|
|
1664
|
+
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1665
|
+
}
|
|
1666
|
+
var Yn = new class {
|
|
1667
|
+
getFilename() {
|
|
1668
|
+
return this.getSearchParam("filename");
|
|
1669
|
+
}
|
|
1670
|
+
setFilename(e) {
|
|
1671
|
+
this.setSearchParam("filename", e);
|
|
1672
|
+
}
|
|
1673
|
+
getCodeFromSearchParam() {
|
|
1674
|
+
return this.getSearchParam("code");
|
|
1675
|
+
}
|
|
1676
|
+
getCodeFromHash() {
|
|
1677
|
+
let e = window.location.hash;
|
|
1678
|
+
return e.startsWith("#code/") ? e.slice(6) : null;
|
|
1679
|
+
}
|
|
1680
|
+
setCodeForHash(e) {
|
|
1681
|
+
window.location.hash = `#code/${e}`;
|
|
1682
|
+
}
|
|
1683
|
+
setSearchParam(e, t) {
|
|
1684
|
+
let n = new URL(window.location.href);
|
|
1685
|
+
n.searchParams.set(e, t), window.history.replaceState({}, "", n.toString());
|
|
1686
|
+
}
|
|
1687
|
+
getSearchParam(e) {
|
|
1688
|
+
return new URL(window.location.href).searchParams.get(e);
|
|
1689
|
+
}
|
|
1690
|
+
}();
|
|
1691
|
+
//#endregion
|
|
1692
|
+
//#region src/core/dom/htmlUtils.ts
|
|
1693
|
+
function Xn(e) {
|
|
1694
|
+
return Wn(e ?? "");
|
|
1695
|
+
}
|
|
1696
|
+
function Zn(e) {
|
|
1697
|
+
return ie.mapValues(e.dataset, (e) => typeof e == "string" ? Xn(e) : e);
|
|
1698
|
+
}
|
|
1699
|
+
function Qn(e, t) {
|
|
1700
|
+
let n = e.parentElement ? I.parse(e.parentElement) : void 0;
|
|
1701
|
+
return n && t.has(n) ? t.lookupValue(n) : Xn(e.dataset.initialValue);
|
|
1702
|
+
}
|
|
1703
|
+
function $n() {
|
|
1704
|
+
if (ne()) return document.title || null;
|
|
1705
|
+
if (me()) {
|
|
1706
|
+
let e = Yn.getFilename();
|
|
1707
|
+
if (e) return e;
|
|
1708
|
+
}
|
|
1709
|
+
let e = document.querySelector("marimo-filename");
|
|
1710
|
+
pe(e, "marimo-filename tag not found");
|
|
1711
|
+
let t = e.innerHTML;
|
|
1712
|
+
return t.length === 0 ? null : t;
|
|
1713
|
+
}
|
|
1714
|
+
//#endregion
|
|
1715
|
+
//#region src/core/saving/file-state.ts
|
|
1716
|
+
var G = T($n());
|
|
1717
|
+
T(null);
|
|
1718
|
+
var er = T(null);
|
|
1719
|
+
T(void 0);
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/utils/storage/typed.ts
|
|
1722
|
+
var tr = class {
|
|
1723
|
+
defaultValue;
|
|
1724
|
+
storage;
|
|
1725
|
+
constructor(e, t = Ln) {
|
|
1726
|
+
this.defaultValue = e, this.storage = t;
|
|
1727
|
+
}
|
|
1728
|
+
get(e) {
|
|
1729
|
+
try {
|
|
1730
|
+
let t = this.storage.getItem(e);
|
|
1731
|
+
return t ? JSON.parse(t) : this.defaultValue;
|
|
1732
|
+
} catch {
|
|
1733
|
+
return this.defaultValue;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
set(e, t) {
|
|
1737
|
+
this.storage.setItem(e, JSON.stringify(t));
|
|
1738
|
+
}
|
|
1739
|
+
remove(e) {
|
|
1740
|
+
this.storage.removeItem(e);
|
|
1741
|
+
}
|
|
1742
|
+
}, nr = class {
|
|
1743
|
+
schema;
|
|
1744
|
+
getDefaultValue;
|
|
1745
|
+
storage;
|
|
1746
|
+
constructor(e, t, n = Ln) {
|
|
1747
|
+
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1748
|
+
}
|
|
1749
|
+
get(e) {
|
|
1750
|
+
try {
|
|
1751
|
+
let n = this.storage.getItem(e);
|
|
1752
|
+
if (n == null) return this.getDefaultValue();
|
|
1753
|
+
let r = this.schema.safeParse(JSON.parse(n));
|
|
1754
|
+
return r.success ? r.data : (t.warn("Error parsing zod local storage", r.error), this.getDefaultValue());
|
|
1755
|
+
} catch (e) {
|
|
1756
|
+
return t.warn("Error getting zod local storage", e), this.getDefaultValue();
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
set(e, t) {
|
|
1760
|
+
this.storage.setItem(e, JSON.stringify(t));
|
|
1761
|
+
}
|
|
1762
|
+
remove(e) {
|
|
1763
|
+
this.storage.removeItem(e);
|
|
1764
|
+
}
|
|
1765
|
+
}, rr = class extends nr {
|
|
1766
|
+
filename;
|
|
1767
|
+
unsubscribeFromFilename;
|
|
1768
|
+
constructor(e, t, n) {
|
|
1769
|
+
let r = C.get(G);
|
|
1770
|
+
super(t, n), this.filename = r;
|
|
1771
|
+
try {
|
|
1772
|
+
this.unsubscribeFromFilename = C.sub(G, () => {
|
|
1773
|
+
let t = C.get(G);
|
|
1774
|
+
this.handleFilenameChange(e, t);
|
|
1775
|
+
});
|
|
1776
|
+
} catch {
|
|
1777
|
+
this.unsubscribeFromFilename = null;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
get(e) {
|
|
1781
|
+
return super.get(this.createScopedKey(e, this.filename));
|
|
1782
|
+
}
|
|
1783
|
+
set(e, t) {
|
|
1784
|
+
super.set(this.createScopedKey(e, this.filename), t);
|
|
1785
|
+
}
|
|
1786
|
+
remove(e) {
|
|
1787
|
+
super.remove(this.createScopedKey(e, this.filename));
|
|
1788
|
+
}
|
|
1789
|
+
createScopedKey(e, t) {
|
|
1790
|
+
return t ? `${e}:${t}` : e;
|
|
1791
|
+
}
|
|
1792
|
+
handleFilenameChange(e, t) {
|
|
1793
|
+
if (t && t !== this.filename) {
|
|
1794
|
+
let n = this.get(e);
|
|
1795
|
+
this.remove(e), this.filename = t, this.set(e, n);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
dispose() {
|
|
1799
|
+
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
1800
|
+
}
|
|
1801
|
+
}, K = {
|
|
1802
|
+
VariableName: "VariableName",
|
|
1803
|
+
FunctionDefinition: "FunctionDefinition",
|
|
1804
|
+
ClassDefinition: "ClassDefinition",
|
|
1805
|
+
LambdaExpression: "LambdaExpression",
|
|
1806
|
+
ParamList: "ParamList",
|
|
1807
|
+
Decorator: "Decorator",
|
|
1808
|
+
AssignStatement: "AssignStatement",
|
|
1809
|
+
ForStatement: "ForStatement",
|
|
1810
|
+
ImportStatement: "ImportStatement",
|
|
1811
|
+
TryStatement: "TryStatement",
|
|
1812
|
+
WithStatement: "WithStatement",
|
|
1813
|
+
TupleExpression: "TupleExpression",
|
|
1814
|
+
ArrayExpression: "ArrayExpression",
|
|
1815
|
+
ParenthesizedExpression: "ParenthesizedExpression",
|
|
1816
|
+
CallExpression: "CallExpression",
|
|
1817
|
+
ArgList: "ArgList",
|
|
1818
|
+
AssignOp: "AssignOp",
|
|
1819
|
+
ArrayComprehensionExpression: "ArrayComprehensionExpression",
|
|
1820
|
+
SetComprehensionExpression: "SetComprehensionExpression",
|
|
1821
|
+
DictionaryComprehensionExpression: "DictionaryComprehensionExpression",
|
|
1822
|
+
ComprehensionExpression: "ComprehensionExpression",
|
|
1823
|
+
Comment: "Comment",
|
|
1824
|
+
String: "String",
|
|
1825
|
+
FormatString: "FormatString"
|
|
1826
|
+
}, q = {
|
|
1827
|
+
For: "for",
|
|
1828
|
+
In: "in",
|
|
1829
|
+
As: "as",
|
|
1830
|
+
Import: "import"
|
|
1831
|
+
}, ir = /* @__PURE__ */ new Set([
|
|
1832
|
+
K.FunctionDefinition,
|
|
1833
|
+
K.LambdaExpression,
|
|
1834
|
+
K.ArrayComprehensionExpression,
|
|
1835
|
+
K.SetComprehensionExpression,
|
|
1836
|
+
K.DictionaryComprehensionExpression,
|
|
1837
|
+
K.ComprehensionExpression,
|
|
1838
|
+
K.ClassDefinition
|
|
1839
|
+
]);
|
|
1840
|
+
K.Comment, K.String, K.FormatString;
|
|
1841
|
+
//#endregion
|
|
1842
|
+
//#region src/core/codemirror/utils.ts
|
|
1843
|
+
function ar(e) {
|
|
1844
|
+
e && e.dispatch({ selection: {
|
|
1845
|
+
anchor: e.state.doc.length,
|
|
1846
|
+
head: e.state.doc.length
|
|
1847
|
+
} });
|
|
1848
|
+
}
|
|
1849
|
+
function or(e) {
|
|
1850
|
+
let t = e.dom.closest(".marimo-cell");
|
|
1851
|
+
t && requestAnimationFrame(() => {
|
|
1852
|
+
t.scrollIntoView({
|
|
1853
|
+
behavior: "instant",
|
|
1854
|
+
block: "nearest",
|
|
1855
|
+
inline: "nearest"
|
|
1856
|
+
});
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1859
|
+
//#endregion
|
|
1860
|
+
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
1861
|
+
var sr = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
1862
|
+
function cr(e, t) {
|
|
1863
|
+
requestAnimationFrame(() => {
|
|
1864
|
+
e.focus(), e.dispatch({
|
|
1865
|
+
selection: {
|
|
1866
|
+
anchor: t,
|
|
1867
|
+
head: t
|
|
1868
|
+
},
|
|
1869
|
+
effects: ce.scrollIntoView(t, { y: "center" })
|
|
1870
|
+
});
|
|
1871
|
+
}), or(e);
|
|
1872
|
+
}
|
|
1873
|
+
function lr(e, t) {
|
|
1874
|
+
let n = oe(e), r = null;
|
|
1875
|
+
return n.iterate({ enter: (n) => {
|
|
1876
|
+
if (r !== null) return !1;
|
|
1877
|
+
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
1878
|
+
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
1879
|
+
} }), r;
|
|
1880
|
+
}
|
|
1881
|
+
function ur(e, t) {
|
|
1882
|
+
let n = [], r = e.resolveInner(t, 0);
|
|
1883
|
+
for (; r;) ir.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
1884
|
+
id: r.from,
|
|
1885
|
+
type: r.name
|
|
1886
|
+
})), r = r.parent;
|
|
1887
|
+
return n.push({
|
|
1888
|
+
id: -1,
|
|
1889
|
+
type: "global"
|
|
1890
|
+
}), n;
|
|
1891
|
+
}
|
|
1892
|
+
function J(e, t, n) {
|
|
1893
|
+
e.push({
|
|
1894
|
+
scopeId: t,
|
|
1895
|
+
from: n
|
|
1896
|
+
});
|
|
1897
|
+
}
|
|
1898
|
+
function dr(e, t) {
|
|
1899
|
+
if (e.firstChild()) do
|
|
1900
|
+
t(e.node);
|
|
1901
|
+
while (e.nextSibling());
|
|
1902
|
+
}
|
|
1903
|
+
function fr(e, t) {
|
|
1904
|
+
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
1905
|
+
switch (e.name) {
|
|
1906
|
+
case K.VariableName:
|
|
1907
|
+
n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
1908
|
+
break;
|
|
1909
|
+
case K.TupleExpression:
|
|
1910
|
+
case K.ArrayExpression: {
|
|
1911
|
+
let n = e.node.cursor();
|
|
1912
|
+
n.firstChild();
|
|
1913
|
+
do
|
|
1914
|
+
fr(n, t);
|
|
1915
|
+
while (n.nextSibling());
|
|
1916
|
+
break;
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
function pr(e, t) {
|
|
1921
|
+
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
1922
|
+
o.firstChild();
|
|
1923
|
+
do {
|
|
1924
|
+
if (o.name !== K.ParamList) continue;
|
|
1925
|
+
let e = o.node.cursor();
|
|
1926
|
+
e.firstChild();
|
|
1927
|
+
do
|
|
1928
|
+
e.name === K.VariableName && n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
1929
|
+
while (e.nextSibling());
|
|
1930
|
+
} while (o.nextSibling());
|
|
1931
|
+
}
|
|
1932
|
+
function mr(e, t) {
|
|
1933
|
+
let n = e.cursor();
|
|
1934
|
+
n.firstChild();
|
|
1935
|
+
let r = !1;
|
|
1936
|
+
do
|
|
1937
|
+
if (n.name === q.For) r = !0;
|
|
1938
|
+
else if (r && n.name === q.In) break;
|
|
1939
|
+
else r && fr(n, t);
|
|
1940
|
+
while (n.nextSibling());
|
|
1941
|
+
}
|
|
1942
|
+
function hr(e, t) {
|
|
1943
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = ir.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
1944
|
+
switch (s) {
|
|
1945
|
+
case K.FunctionDefinition:
|
|
1946
|
+
case K.ClassDefinition: {
|
|
1947
|
+
let t = e.cursor();
|
|
1948
|
+
t.firstChild();
|
|
1949
|
+
do
|
|
1950
|
+
if (t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
1951
|
+
J(a, i[i.length - 1] ?? -1, t.from);
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
while (t.nextSibling());
|
|
1955
|
+
s === K.FunctionDefinition && pr(e, {
|
|
1956
|
+
state: n,
|
|
1957
|
+
variableName: r,
|
|
1958
|
+
scopeId: c,
|
|
1959
|
+
declarations: a
|
|
1960
|
+
});
|
|
1961
|
+
break;
|
|
1962
|
+
}
|
|
1963
|
+
case K.LambdaExpression:
|
|
1964
|
+
pr(e, {
|
|
1965
|
+
state: n,
|
|
1966
|
+
variableName: r,
|
|
1967
|
+
scopeId: c,
|
|
1968
|
+
declarations: a
|
|
1969
|
+
});
|
|
1970
|
+
break;
|
|
1971
|
+
case K.ArrayComprehensionExpression:
|
|
1972
|
+
case K.DictionaryComprehensionExpression:
|
|
1973
|
+
case K.SetComprehensionExpression:
|
|
1974
|
+
case K.ComprehensionExpression:
|
|
1975
|
+
case K.ForStatement:
|
|
1976
|
+
mr(e, {
|
|
1977
|
+
state: n,
|
|
1978
|
+
variableName: r,
|
|
1979
|
+
scopeId: u,
|
|
1980
|
+
declarations: a
|
|
1981
|
+
});
|
|
1982
|
+
break;
|
|
1983
|
+
case K.AssignStatement: {
|
|
1984
|
+
let t = [], i = e.cursor();
|
|
1985
|
+
i.firstChild();
|
|
1986
|
+
do
|
|
1987
|
+
i.name === K.AssignOp && t.push(i.from);
|
|
1988
|
+
while (i.nextSibling());
|
|
1989
|
+
let o = t[t.length - 1];
|
|
1990
|
+
if (o === void 0) break;
|
|
1991
|
+
let s = e.cursor();
|
|
1992
|
+
s.firstChild();
|
|
1993
|
+
do
|
|
1994
|
+
s.from < o && fr(s, {
|
|
1995
|
+
state: n,
|
|
1996
|
+
variableName: r,
|
|
1997
|
+
scopeId: u,
|
|
1998
|
+
declarations: a
|
|
1999
|
+
});
|
|
2000
|
+
while (s.nextSibling());
|
|
2001
|
+
break;
|
|
2002
|
+
}
|
|
2003
|
+
case K.ImportStatement: {
|
|
2004
|
+
let t = e.cursor();
|
|
2005
|
+
t.firstChild();
|
|
2006
|
+
let i = !1, o = null, s = () => {
|
|
2007
|
+
o?.matches && J(a, u, o.from), o = null;
|
|
2008
|
+
};
|
|
2009
|
+
do {
|
|
2010
|
+
if (t.name === q.Import) {
|
|
2011
|
+
i = !0;
|
|
2012
|
+
continue;
|
|
2013
|
+
}
|
|
2014
|
+
if (i) {
|
|
2015
|
+
if (t.name === q.As) {
|
|
2016
|
+
o = null;
|
|
2017
|
+
continue;
|
|
2018
|
+
}
|
|
2019
|
+
t.name === K.VariableName ? (s(), o = {
|
|
2020
|
+
from: t.from,
|
|
2021
|
+
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2022
|
+
}) : t.name === "," && s();
|
|
2023
|
+
}
|
|
2024
|
+
} while (t.nextSibling());
|
|
2025
|
+
s();
|
|
2026
|
+
break;
|
|
2027
|
+
}
|
|
2028
|
+
case K.TryStatement:
|
|
2029
|
+
case K.WithStatement: {
|
|
2030
|
+
let t = e.cursor();
|
|
2031
|
+
t.firstChild();
|
|
2032
|
+
let i = !1;
|
|
2033
|
+
do
|
|
2034
|
+
t.name === q.As ? i = !0 : i && t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r && (J(a, u, t.from), i = !1);
|
|
2035
|
+
while (t.nextSibling());
|
|
2036
|
+
break;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
dr(o, (e) => {
|
|
2040
|
+
hr(e, {
|
|
2041
|
+
state: n,
|
|
2042
|
+
variableName: r,
|
|
2043
|
+
scopeStack: l,
|
|
2044
|
+
declarations: a
|
|
2045
|
+
});
|
|
2046
|
+
});
|
|
2047
|
+
}
|
|
2048
|
+
function gr(e, t, n) {
|
|
2049
|
+
let r = oe(e), i = [];
|
|
2050
|
+
hr(r, {
|
|
2051
|
+
state: e,
|
|
2052
|
+
variableName: t,
|
|
2053
|
+
scopeStack: [],
|
|
2054
|
+
declarations: i
|
|
2055
|
+
});
|
|
2056
|
+
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2057
|
+
for (let e of ur(r, a)) {
|
|
2058
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !sr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2059
|
+
if (t) return t.from;
|
|
2060
|
+
}
|
|
2061
|
+
return null;
|
|
2062
|
+
}
|
|
2063
|
+
function _r(e, t, n) {
|
|
2064
|
+
let { state: r } = e, i = n === void 0 ? lr(r, t) : gr(r, t, n);
|
|
2065
|
+
return i !== null && (cr(e, i), !0);
|
|
2066
|
+
}
|
|
2067
|
+
function vr(e, t) {
|
|
2068
|
+
return cr(e, e.state.doc.line(t).from), !0;
|
|
2069
|
+
}
|
|
2070
|
+
//#endregion
|
|
2071
|
+
//#region src/core/notebook/replica/connection.ts
|
|
2072
|
+
var Y = {
|
|
2073
|
+
NOT_STARTED: "NOT_STARTED",
|
|
2074
|
+
CONNECTING: "CONNECTING",
|
|
2075
|
+
OPEN: "OPEN",
|
|
2076
|
+
CLOSING: "CLOSING",
|
|
2077
|
+
CLOSED: "CLOSED"
|
|
2078
|
+
}, yr = {
|
|
2079
|
+
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
2080
|
+
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
2081
|
+
}, X = T({ state: Y.NOT_STARTED });
|
|
2082
|
+
te(null, (e, t) => t === null ? null : {
|
|
2083
|
+
phase: t.phase,
|
|
2084
|
+
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2085
|
+
});
|
|
2086
|
+
function br() {
|
|
2087
|
+
return x(X, (e) => e.state === Y.OPEN);
|
|
2088
|
+
}
|
|
2089
|
+
function xr() {
|
|
2090
|
+
return de() ? br() : Promise.resolve();
|
|
2091
|
+
}
|
|
2092
|
+
T((e) => e(X).state === Y.CONNECTING), T((e) => e(X).state === Y.OPEN), T((e) => {
|
|
2093
|
+
let t = e(X);
|
|
2094
|
+
return t.state === Y.OPEN || t.state === Y.NOT_STARTED;
|
|
2095
|
+
}), T((e) => e(X).state === Y.CLOSED), T((e) => e(X).state === Y.NOT_STARTED);
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region src/components/ui/checkbox.tsx
|
|
2098
|
+
var Sr = O.forwardRef((e, t) => {
|
|
2099
|
+
let r = (0, Fe.c)(13), i, a;
|
|
2100
|
+
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2101
|
+
let o;
|
|
2102
|
+
r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
|
|
2103
|
+
let s;
|
|
2104
|
+
r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
|
|
2105
|
+
let c;
|
|
2106
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, k.jsx)(Ae, {
|
|
2107
|
+
className: s,
|
|
2108
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, k.jsx)(ve, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, k.jsx)(l, { className: "h-4 w-4" })
|
|
2109
|
+
}), r[6] = a.checked, r[7] = c);
|
|
2110
|
+
let u;
|
|
2111
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, k.jsx)(Oe, {
|
|
2112
|
+
ref: t,
|
|
2113
|
+
className: o,
|
|
2114
|
+
...a,
|
|
2115
|
+
children: c
|
|
2116
|
+
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2117
|
+
});
|
|
2118
|
+
Sr.displayName = Oe.displayName;
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region src/core/cells/scrollCellIntoView.ts
|
|
2121
|
+
function Cr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2122
|
+
if (!n) return;
|
|
2123
|
+
let o = document.getElementById(F.create(e));
|
|
2124
|
+
if (!o) {
|
|
2125
|
+
t.warn("scrollCellIntoView: element not found");
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
if (_n()) {
|
|
2129
|
+
vn(o);
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
if (r) vn(o);
|
|
2133
|
+
else {
|
|
2134
|
+
He.promote(e);
|
|
2135
|
+
let r = n.current?.editorView;
|
|
2136
|
+
if (!r) {
|
|
2137
|
+
t.warn("scrollCellIntoView: editor not found", e);
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
if (r.hasFocus || !document.hasFocus()) return;
|
|
2141
|
+
if (yn(() => (r.focus(), r.hasFocus), {
|
|
2142
|
+
retries: 5,
|
|
2143
|
+
delay: 20
|
|
2144
|
+
}), i === "top") r.dispatch({ selection: {
|
|
2145
|
+
anchor: 0,
|
|
2146
|
+
head: 0
|
|
2147
|
+
} });
|
|
2148
|
+
else if (i === "bottom") {
|
|
2149
|
+
let e = r.state.doc.line(r.state.doc.lines);
|
|
2150
|
+
r.dispatch({ selection: {
|
|
2151
|
+
anchor: e.from,
|
|
2152
|
+
head: e.from
|
|
2153
|
+
} });
|
|
2154
|
+
} else a && _r(r, a);
|
|
2155
|
+
}
|
|
2156
|
+
o.scrollIntoView({
|
|
2157
|
+
behavior: "smooth",
|
|
2158
|
+
block: "nearest"
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
function wr() {
|
|
2162
|
+
let e = document.getElementById("App");
|
|
2163
|
+
e?.scrollTo({
|
|
2164
|
+
top: e.scrollHeight,
|
|
2165
|
+
behavior: "smooth"
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2168
|
+
function Tr() {
|
|
2169
|
+
document.getElementById("App")?.scrollTo({
|
|
2170
|
+
top: 0,
|
|
2171
|
+
behavior: "smooth"
|
|
2172
|
+
});
|
|
2173
|
+
}
|
|
2174
|
+
//#endregion
|
|
2175
|
+
//#region src/core/cells/cells.ts
|
|
2176
|
+
function Er(e) {
|
|
2177
|
+
let t = {
|
|
2178
|
+
column: 0,
|
|
2179
|
+
hide_code: !1,
|
|
2180
|
+
disabled: !1,
|
|
2181
|
+
expand_output: !1
|
|
2182
|
+
};
|
|
2183
|
+
return {
|
|
2184
|
+
...e,
|
|
2185
|
+
cellData: {
|
|
2186
|
+
[P]: Gt({
|
|
2187
|
+
id: P,
|
|
2188
|
+
config: t
|
|
2189
|
+
}),
|
|
2190
|
+
...e.cellData
|
|
2191
|
+
},
|
|
2192
|
+
cellRuntime: {
|
|
2193
|
+
[P]: V(),
|
|
2194
|
+
...e.cellRuntime
|
|
2195
|
+
},
|
|
2196
|
+
cellHandles: {
|
|
2197
|
+
[P]: (0, O.createRef)(),
|
|
2198
|
+
...e.cellHandles
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
}
|
|
2202
|
+
function Dr() {
|
|
2203
|
+
return Er({
|
|
2204
|
+
cellIds: [],
|
|
2205
|
+
cellData: {},
|
|
2206
|
+
cellRuntime: {},
|
|
2207
|
+
cellHandles: {},
|
|
2208
|
+
history: [],
|
|
2209
|
+
scrollKey: null,
|
|
2210
|
+
cellLogs: []
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
var { reducer: Or, createActions: kr, useActions: Ar, valueAtom: Z } = ae(Dr, {
|
|
2214
|
+
codeFormatted: (e, t) => {
|
|
2215
|
+
let { cellId: n, before: r, after: i } = t;
|
|
2216
|
+
return e.cellData[n] ? jr({
|
|
2217
|
+
state: e,
|
|
2218
|
+
cellId: n,
|
|
2219
|
+
cellReducer: (e) => {
|
|
2220
|
+
let t = B(e.lastCodeRun, r) ? e.lastCodeRun : i;
|
|
2221
|
+
return {
|
|
2222
|
+
...e,
|
|
2223
|
+
lastCodeRun: t,
|
|
2224
|
+
edited: B(t, e.code)
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
}) : e;
|
|
2228
|
+
},
|
|
2229
|
+
prepareForRun: (e, t) => jr({
|
|
2230
|
+
state: Q({
|
|
2231
|
+
state: e,
|
|
2232
|
+
cellId: t.cellId,
|
|
2233
|
+
cellReducer: (e) => pt(e)
|
|
2234
|
+
}),
|
|
2235
|
+
cellId: t.cellId,
|
|
2236
|
+
cellReducer: (e) => ({
|
|
2237
|
+
...e,
|
|
2238
|
+
edited: !1,
|
|
2239
|
+
lastCodeRun: e.code.trim()
|
|
2240
|
+
})
|
|
2241
|
+
}),
|
|
2242
|
+
handleCellMessage: (e, t) => {
|
|
2243
|
+
let n = t.cell_id, r = Q({
|
|
2244
|
+
state: e,
|
|
2245
|
+
cellId: n,
|
|
2246
|
+
cellReducer: (e) => ft(e, t)
|
|
2247
|
+
});
|
|
2248
|
+
return t.status === "queued" && (r = jr({
|
|
2249
|
+
state: r,
|
|
2250
|
+
cellId: n,
|
|
2251
|
+
cellReducer: (e) => ({
|
|
2252
|
+
...e,
|
|
2253
|
+
lastCodeRun: e.code.trim(),
|
|
2254
|
+
edited: !1
|
|
2255
|
+
})
|
|
2256
|
+
})), {
|
|
2257
|
+
...r,
|
|
2258
|
+
cellLogs: [...r.cellLogs, ...pn(t)]
|
|
2259
|
+
};
|
|
2260
|
+
},
|
|
2261
|
+
addLogs: (e, t) => ({
|
|
2262
|
+
...e,
|
|
2263
|
+
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2264
|
+
}),
|
|
2265
|
+
reconcileDocument: (e, t) => {
|
|
2266
|
+
let n = Jt(e, t);
|
|
2267
|
+
for (let t of e.cellIds) t in n.cellData || Kr(t);
|
|
2268
|
+
return n;
|
|
2269
|
+
},
|
|
2270
|
+
setStdinResponse: (e, n) => {
|
|
2271
|
+
let { cellId: r, response: i, outputIndex: a } = n;
|
|
2272
|
+
return Q({
|
|
2273
|
+
state: e,
|
|
2274
|
+
cellId: r,
|
|
2275
|
+
cellReducer: (e) => {
|
|
2276
|
+
let n = [...e.consoleOutputs], r = n[a];
|
|
2277
|
+
return r == null || r.channel !== "stdin" ? (t.warn("Expected stdin output"), e) : (n[a] = {
|
|
2278
|
+
channel: "stdin",
|
|
2279
|
+
mimetype: r.mimetype,
|
|
2280
|
+
data: r.data,
|
|
2281
|
+
timestamp: r.timestamp,
|
|
2282
|
+
id: r.id,
|
|
2283
|
+
response: r.mimetype === "text/password" ? "" : i
|
|
2284
|
+
}, {
|
|
2285
|
+
...e,
|
|
2286
|
+
interrupted: !1,
|
|
2287
|
+
consoleOutputs: n
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
});
|
|
2291
|
+
},
|
|
2292
|
+
setLastRun: (e, t) => {
|
|
2293
|
+
let n = { ...e.cellData };
|
|
2294
|
+
for (let r of e.cellIds) {
|
|
2295
|
+
let i = e.cellData[r], a = t.lastCodeRun[r] ?? null;
|
|
2296
|
+
n[r] = {
|
|
2297
|
+
...i,
|
|
2298
|
+
lastCodeRun: a,
|
|
2299
|
+
lastExecutionTime: t.lastExecutionTime[r] ?? null,
|
|
2300
|
+
edited: a !== null && B(a, i.code)
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
return {
|
|
2304
|
+
...e,
|
|
2305
|
+
cellData: n
|
|
2306
|
+
};
|
|
2307
|
+
},
|
|
2308
|
+
resetCellRuntimes: (e) => {
|
|
2309
|
+
let t = me(), n = { ...e.cellRuntime };
|
|
2310
|
+
for (let r of [...e.cellIds, P]) {
|
|
2311
|
+
let i = e.cellRuntime[r];
|
|
2312
|
+
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
|
|
2313
|
+
}
|
|
2314
|
+
return {
|
|
2315
|
+
...e,
|
|
2316
|
+
cellRuntime: n
|
|
2317
|
+
};
|
|
2318
|
+
},
|
|
2319
|
+
scrollToTarget: (e) => {
|
|
2320
|
+
let t = e.scrollKey;
|
|
2321
|
+
if (t === null) return e;
|
|
2322
|
+
let n = t;
|
|
2323
|
+
return Cr({
|
|
2324
|
+
cellId: n,
|
|
2325
|
+
cell: e.cellHandles[n],
|
|
2326
|
+
isCodeHidden: Zt(e.cellData[n]?.config.hide_code, C.get(H), n),
|
|
2327
|
+
codeFocus: void 0,
|
|
2328
|
+
variableName: void 0
|
|
2329
|
+
}), {
|
|
2330
|
+
...e,
|
|
2331
|
+
scrollKey: null
|
|
2332
|
+
};
|
|
2333
|
+
},
|
|
2334
|
+
foldAll: (e) => (Le(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2335
|
+
unfoldAll: (e) => (Re(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2336
|
+
clearLogs: (e) => ({
|
|
2337
|
+
...e,
|
|
2338
|
+
cellLogs: []
|
|
2339
|
+
}),
|
|
2340
|
+
clearCellOutput: (e, t) => {
|
|
2341
|
+
let { cellId: n } = t;
|
|
2342
|
+
return Q({
|
|
2343
|
+
state: e,
|
|
2344
|
+
cellId: n,
|
|
2345
|
+
cellReducer: (e) => ({
|
|
2346
|
+
...e,
|
|
2347
|
+
output: null,
|
|
2348
|
+
consoleOutputs: []
|
|
2349
|
+
})
|
|
2350
|
+
});
|
|
2351
|
+
},
|
|
2352
|
+
clearCellConsoleOutput: (e, t) => {
|
|
2353
|
+
let { cellId: n } = t;
|
|
2354
|
+
return Q({
|
|
2355
|
+
state: e,
|
|
2356
|
+
cellId: n,
|
|
2357
|
+
cellReducer: (e) => ({
|
|
2358
|
+
...e,
|
|
2359
|
+
consoleOutputs: e.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
|
|
2360
|
+
})
|
|
2361
|
+
});
|
|
2362
|
+
},
|
|
2363
|
+
clearAllCellOutputs: (e) => {
|
|
2364
|
+
let t = { ...e.cellRuntime };
|
|
2365
|
+
for (let n of e.cellIds) t[n] = {
|
|
2366
|
+
...t[n],
|
|
2367
|
+
output: null,
|
|
2368
|
+
consoleOutputs: []
|
|
2369
|
+
};
|
|
2370
|
+
return {
|
|
2371
|
+
...e,
|
|
2372
|
+
cellRuntime: t
|
|
2373
|
+
};
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2376
|
+
function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
2377
|
+
return n in e.cellRuntime ? {
|
|
2378
|
+
...e,
|
|
2379
|
+
cellRuntime: {
|
|
2380
|
+
...e.cellRuntime,
|
|
2381
|
+
[n]: r(e.cellRuntime[n])
|
|
2382
|
+
}
|
|
2383
|
+
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2384
|
+
}
|
|
2385
|
+
function jr({ state: e, cellId: n, cellReducer: r }) {
|
|
2386
|
+
return n in e.cellData ? {
|
|
2387
|
+
...e,
|
|
2388
|
+
cellData: {
|
|
2389
|
+
...e.cellData,
|
|
2390
|
+
[n]: r(e.cellData[n])
|
|
2391
|
+
}
|
|
2392
|
+
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2393
|
+
}
|
|
2394
|
+
var Mr = kr((e) => {
|
|
2395
|
+
C.set(Z, (t) => Or(t, e));
|
|
2396
|
+
}).addLogs, $ = T((e) => e(Z).cellIds);
|
|
2397
|
+
T((e) => e($).length === 1), T((e) => wn(e(Z)).length > 0), T((e) => Tn(e(Z)).length > 0), T((e) => En(e(Z))), T((e) => Dn(e(Z))), T((e) => Sn(e(Z)));
|
|
2398
|
+
var Nr = T((e) => {
|
|
2399
|
+
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2400
|
+
return t.map((e) => {
|
|
2401
|
+
let t = n[e], { name: i } = r[e];
|
|
2402
|
+
if (M(t.output?.mimetype)) {
|
|
2403
|
+
D(Array.isArray(t.output.data), "Expected array data");
|
|
2404
|
+
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2405
|
+
if (n.length > 0) return {
|
|
2406
|
+
output: {
|
|
2407
|
+
...t.output,
|
|
2408
|
+
data: n
|
|
2409
|
+
},
|
|
2410
|
+
cellId: e,
|
|
2411
|
+
cellName: i
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
return null;
|
|
2415
|
+
}).filter(Boolean);
|
|
2416
|
+
}), Pr = b(T((e) => {
|
|
2417
|
+
let t = {};
|
|
2418
|
+
for (let [n, r] of ie.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2419
|
+
return t;
|
|
2420
|
+
})), Fr = T((e) => {
|
|
2421
|
+
let t = e($), n = e(Hr);
|
|
2422
|
+
return Ye(t.map((e) => n[e].outline));
|
|
2423
|
+
});
|
|
2424
|
+
T((e) => e(Nr).length);
|
|
2425
|
+
var Ir = b(T((e) => {
|
|
2426
|
+
let { cellIds: t, cellData: n } = e(Z);
|
|
2427
|
+
return ie.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2428
|
+
}));
|
|
2429
|
+
T((e) => e(Z).scrollKey);
|
|
2430
|
+
var Lr = () => E($), Rr = () => E(Ir), zr = () => C.get(Z), Br = () => C.get(Z).cellIds, Vr = () => {
|
|
2431
|
+
let { cellIds: e, cellData: t } = C.get(Z);
|
|
2432
|
+
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2433
|
+
};
|
|
2434
|
+
re(v(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2435
|
+
var Hr = T((e) => e(Z).cellRuntime);
|
|
2436
|
+
T((e) => bn(e(Z))), T((e) => {
|
|
2437
|
+
let { cellRuntime: t } = e(Z);
|
|
2438
|
+
return Object.entries(t).every(([e, t]) => t.status !== "running" || e === "__scratch__");
|
|
2439
|
+
}), T((e) => xn(e(Z))), T((e) => e(Z).cellIds.length > 0);
|
|
2440
|
+
var Ur = w((e) => T((t) => t(Z).cellData[e])), Wr = w((e) => T((t) => t(Z).cellRuntime[e])), Gr = w((e) => T((t) => t(Z).cellHandles[e]));
|
|
2441
|
+
function Kr(e) {
|
|
2442
|
+
Ur.remove(e), Wr.remove(e), Gr.remove(e);
|
|
2443
|
+
}
|
|
2444
|
+
var qr = (e) => {
|
|
2445
|
+
let { cellHandles: t } = C.get(Z);
|
|
2446
|
+
return t[e].current?.editorView;
|
|
2447
|
+
}, Jr = (e) => (He.promote(e), qr(e));
|
|
2448
|
+
function Yr() {
|
|
2449
|
+
return Ar();
|
|
2450
|
+
}
|
|
2451
|
+
//#endregion
|
|
2452
|
+
//#region src/core/errors/error-entries.ts
|
|
2453
|
+
function Xr(e) {
|
|
2454
|
+
if ($e(e.mimetype)) {
|
|
2455
|
+
if (!Array.isArray(e.data)) return null;
|
|
2456
|
+
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2457
|
+
return t.length === 0 ? null : { errorData: t };
|
|
2458
|
+
}
|
|
2459
|
+
return et(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2460
|
+
errorData: [],
|
|
2461
|
+
tracebackHtml: e.data
|
|
2462
|
+
} : null;
|
|
2463
|
+
}
|
|
2464
|
+
function Zr(e) {
|
|
2465
|
+
return e.some((e) => "traceback" in e && e.traceback);
|
|
2466
|
+
}
|
|
2467
|
+
function Qr(e) {
|
|
2468
|
+
let t = e?.find((e) => et(e.mimetype));
|
|
2469
|
+
if (!(!t || typeof t.data != "string" || t.data.length === 0)) return t.data;
|
|
2470
|
+
}
|
|
2471
|
+
function $r(e, t) {
|
|
2472
|
+
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2473
|
+
if (!Zr(e.errorData)) return Qr(t);
|
|
2474
|
+
}
|
|
2475
|
+
function ei(e) {
|
|
2476
|
+
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2477
|
+
for (let [e, a] of t.entries()) {
|
|
2478
|
+
let t = n[a], o = t.output;
|
|
2479
|
+
if (!o || !M(o.mimetype)) continue;
|
|
2480
|
+
let s = Xr(o);
|
|
2481
|
+
if (!s) continue;
|
|
2482
|
+
let c = Ut(r[a].name, e), l = r[a].lastCodeRun ?? r[a].code;
|
|
2483
|
+
i.push({
|
|
2484
|
+
cellId: a,
|
|
2485
|
+
cellName: c,
|
|
2486
|
+
cellCode: l,
|
|
2487
|
+
errorData: s.errorData,
|
|
2488
|
+
tracebackHtml: $r(s, t.consoleOutputs)
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
return i;
|
|
2492
|
+
}
|
|
2493
|
+
function ti(e) {
|
|
2494
|
+
return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
2495
|
+
}
|
|
2496
|
+
function ni(e) {
|
|
2497
|
+
let t = ti(e);
|
|
2498
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
2499
|
+
}
|
|
2500
|
+
function ri(e) {
|
|
2501
|
+
let t = [e.cellName];
|
|
2502
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(ni).join("\n\n")), t.join("\n\n");
|
|
2503
|
+
}
|
|
2504
|
+
//#endregion
|
|
2505
|
+
export { ln as $, Y as A, vt as At, Qn as B, wr as C, wt as Ct, br as D, Ct as Dt, X as E, P as Et, nr as F, Ze as Ft, Pn as G, Gn as H, G as I, Je as It, kn as J, Mn as K, er as L, Ue as Lt, ar as M, gt as Mt, rr as N, mt as Nt, xr as O, I as Ot, tr as P, ht as Pt, gn as Q, Xn as R, ve as Rt, Cr as S, Nt as St, Sr as T, F as Tt, Hn as U, Wn as V, Ln as W, An as X, Cn as Y, jn as Z, Or as _, zt as _t, Mr as a, Xt as at, Rr as b, Ot as bt, kr as c, Ht as ct, Vr as d, Dt as dt, W as et, Br as f, L as ft, Fr as g, Lt as gt, Z as h, Ft as ht, ei as i, H as it, vr as j, yt as jt, yr as k, Tt as kt, Jr as l, Wt as lt, Dr as m, R as mt, ri as n, Zt as nt, Ur as o, Yt as ot, zr as p, It as pt, Nn as q, ni as r, Qt as rt, $ as s, Ut as st, ti as t, tn as tt, qr as u, Vt as ut, Kr as v, Rt as vt, Tr as w, Et as wt, Yr as x, Pt as xt, Lr as y, z as yt, Zn as z, _e as zt };
|