@marimo-team/islands 0.25.3-dev273 → 0.25.3-dev279
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-eLHPh6uu.js → ConnectedDataExplorerComponent-CErm132k.js} +25 -26
- package/dist/{ErrorBoundary-DBh-wUT9.js → ErrorBoundary-DmTMuDPR.js} +43 -44
- package/dist/{abnfDiagram-VCTEODGH-hqd0IBtX.js → abnfDiagram-VCTEODGH-d-Qn2fwb.js} +2 -2
- package/dist/{any-language-editor-DnG26QXh.js → any-language-editor-6k6F12Z3.js} +3 -3
- package/dist/{architectureDiagram-5GKGNRK7-BzLAFcc0.js → architectureDiagram-5GKGNRK7-DxragHYv.js} +1 -1
- package/dist/{assertNever-DIU3JJbt.js → assertNever-B-YzWzbL.js} +14 -14
- package/dist/{button-0-RqY1DW.js → button-DZuNnIZO.js} +220 -223
- package/dist/{capabilities-B6yy_CBN.js → capabilities-D9FskwsK.js} +1 -1
- package/dist/{chat-ui-BWIkve2R.js → chat-ui-v1Fdh0NA.js} +332 -333
- package/dist/{check-gUSZbRsl.js → check-XFzZeH-y.js} +1 -1
- package/dist/{chunk-IMKFNOWR-DOeVvuyE.js → chunk-IMKFNOWR-C0x0feFg.js} +1 -1
- package/dist/{chunk-SHT3W25Y-DZoFI8wR.js → chunk-SHT3W25Y-D0ZdASqB.js} +1 -1
- package/dist/{chunk-SVP7TREG-CWu86PSW.js → chunk-SVP7TREG-BHjL96zx.js} +1 -1
- package/dist/{chunk-TICWLB2K-BrM0GoP3.js → chunk-TICWLB2K-CzcrwGfp.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-DYi4V2bB.js → classDiagram-ZZMXUADV-BTqFAZTP.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-tN7FIk-m.js → classDiagram-v2-VYDZK3BY-EPXb0Elt.js} +2 -2
- package/dist/{code-visibility-M_dXDGp6.js → code-visibility-Dw4-TXN0.js} +20 -20
- package/dist/{common-DV0fvw_I.js → common-BXMFi4lr.js} +5399 -5397
- package/dist/{config-BsPruWMR.js → config-C8MFHQ2E.js} +23 -22
- package/dist/{copy-icon-C2I8sw4h.js → copy-icon-CtllOdmg.js} +3 -3
- package/dist/{createReducer-DdtT_7ji.js → createReducer-DRqwmaTc.js} +2 -2
- package/dist/{cynefinDiagram-5FMLGOSQ-D5nCnDc-.js → cynefinDiagram-5FMLGOSQ-CBSD344q.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-BHkd7f_i.js → dagre-GXQ25YYZ-JItjh3Ge.js} +1 -1
- package/dist/{data-grid-overlay-editor-Cd1zGKBt.js → data-grid-overlay-editor-hZzwX7Ia.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-D1ALppT2.js → diagram-S7CK7UJ4-CTD9xTVb.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DLv0b83L.js → diagram-UQ7AKVKN-DTfnFai8.js} +1 -1
- package/dist/{diagram-VX7I27RA-7XJ7J6qg.js → diagram-VX7I27RA-BcSnucV-.js} +1 -1
- package/dist/{diagram-Z3DM3KII-7M7zbHp_.js → diagram-Z3DM3KII-C2ATIE8A.js} +1 -1
- package/dist/{dialog-DzCj1qQv.js → dialog-CaYm5imE.js} +33 -33
- package/dist/{dropdown-menu-CdXE15an.js → dropdown-menu-Bb0bFOIk.js} +149 -149
- package/dist/{ebnfDiagram-PWID7BFC-DHH1qlmV.js → ebnfDiagram-PWID7BFC-B7B9JPxc.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-fI_0dGef.js → erDiagram-RLTQ6QDP-v6hDno1O.js} +1 -1
- package/dist/{error-banner-DPc9eIw5.js → error-banner-CHCdHVFB.js} +44 -45
- package/dist/{error-entries-CxN-Nq3V.js → error-entries-C1S-Rmyt.js} +563 -554
- package/dist/{feedback-button-CE2gPi4-.js → feedback-button-6Ui2TDLR.js} +12 -12
- package/dist/{flowDiagram-HODETNUW-Brg9MA6i.js → flowDiagram-HODETNUW-aIFlAtOy.js} +2 -2
- package/dist/{formats-DbSvAPY-.js → formats-PzBQMUnr.js} +3 -3
- package/dist/{glide-data-editor-BycATbgF.js → glide-data-editor-PZNlrSDI.js} +14 -16
- package/dist/{glide-utils-BSw3SSHF.js → glide-utils-BSQr4d90.js} +51 -59
- package/dist/{globals-CW6OvnI5.js → globals-DX6FPZYq.js} +3 -3
- package/dist/{html-to-image-Bc2AvXHG.js → html-to-image-CqGUd58T.js} +14529 -14531
- package/dist/{infoDiagram-27XIBGKW-E9e403YT.js → infoDiagram-27XIBGKW-D6YHLeCP.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-C-RlYDRo.js → ishikawaDiagram-5VMMS53U-D1ZvprOX.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CLFl_uqK.js → kanban-definition-UXKFOSKX-Bna_3BMr.js} +1 -1
- package/dist/{loader-BVEtQ4F3.js → loader-DZvtzQoD.js} +1 -1
- package/dist/main.js +7357 -7361
- package/dist/{mermaid-rd09e1JL.js → mermaid-A36unKXJ.js} +50 -50
- package/dist/{mindmap-definition-YA3MSWOX-BQ8TWtyB.js → mindmap-definition-YA3MSWOX-CyVCs__G.js} +1 -1
- package/dist/{number-overlay-editor-B_rR-LdM.js → number-overlay-editor-D0CsL3_R.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CN8UHFPi.js → pegDiagram-XKGWAZYB-9hNBD2wZ.js} +2 -2
- package/dist/{pencil-DcT8AE0h.js → pencil-DYUlSKxZ.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-DGuJ0EBd.js → pieDiagram-E7YTZNPT-8tr-NYo7.js} +1 -1
- package/dist/{process-output-qecD7Dk8.js → process-output-DskX9jLa.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-BPDA8wy8.js → railroadDiagram-O6MQD6OU-Dzg1dyyp.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-ChzLGbGW.js → requirementDiagram-BXWQKSXE-B7sNqwGG.js} +1 -1
- package/dist/{reveal-component-CngVwOSy.js → reveal-component-D7xeI1QR.js} +1003 -1003
- package/dist/{select-OxgozOC8.js → select-DsoP1qe8.js} +290 -290
- package/dist/{sequenceDiagram-WJ2MYXX4-DFX-bE6O.js → sequenceDiagram-WJ2MYXX4-oP9shbaG.js} +1 -1
- package/dist/{spec-oJn0RhpQ.js → spec-BZMDxAu7.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-BR7cI3wK.js → stateDiagram-D77RDMKH-CjCv4ogv.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-oGqB5UDI.js → stateDiagram-v2-MP3YSRHH-BW9X162a.js} +2 -2
- package/dist/{static-state-CuV6Pc3a.js → static-state-D-Q-Ajaa.js} +8 -8
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-DwSZl1yC.js → swimlanes-42K2YHIH-Ckfs9Wrn.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-BHlcd-Ri.js → swimlanesDiagram-VR7AAH4N-DpTNG9YP.js} +2 -2
- package/dist/{swiper-component-Dvj-goaD.js → swiper-component-DQbK_ZWm.js} +7 -7
- package/dist/{timeline-definition-24CTP7MA-DMmP-G2O.js → timeline-definition-24CTP7MA-BXaBlV6U.js} +1 -1
- package/dist/{toast-DbBHmxmB.js → toast-BhjIy3Tq.js} +158 -158
- package/dist/{tooltip-BfcDQd2j.js → tooltip-DMMiOn2f.js} +64 -64
- package/dist/use-restore-focus-CosX7-gx.js +7568 -0
- package/dist/{useAsyncData-BYIAoMqn.js → useAsyncData-Ci4AvJff.js} +4 -4
- package/dist/{useDateFormatter-ButWkdcK.js → useDateFormatter-CPlava52.js} +2 -2
- package/dist/{useDeepCompareMemoize-Bz0c5GN6.js → useDeepCompareMemoize-NaaWoFlX.js} +1 -1
- package/dist/useEvent-BRH-aCqi.js +19 -0
- package/dist/{useIframeCapabilities-BIolGsF1.js → useIframeCapabilities-BXhDDoCG.js} +1 -1
- package/dist/{useLifecycle-JjxCC7Vu.js → useLifecycle-SniivYmC.js} +2 -2
- package/dist/{vega-component-rxIxAAh9.js → vega-component-DIxaDQNs.js} +40 -40
- package/dist/{vennDiagram-4TSXK5OY-Db8GtH1G.js → vennDiagram-4TSXK5OY-C-hQ4iNJ.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DmIiC3FU.js → wardleyDiagram-VM6X3IG4-C2MQ_Umv.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-DS9OPrNq.js → xychartDiagram-S5SC5T6Z-BtTTBn7Q.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +4 -2
- package/src/__mocks__/notebook.ts +0 -2
- package/src/__tests__/CellStatus.test.tsx +6 -6
- package/src/components/editor/__tests__/data-attributes.test.tsx +0 -2
- package/src/components/editor/__tests__/output-persistence.test.tsx +20 -5
- package/src/components/editor/cell/CellStatus.tsx +6 -5
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +169 -0
- package/src/components/editor/cell/collapse.tsx +3 -4
- package/src/components/editor/cell/useRunCells.ts +32 -3
- package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +2 -3
- package/src/components/editor/notebook-cell.tsx +23 -37
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +4 -10
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -2
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +8 -5
- package/src/components/slides/minimap.tsx +3 -2
- package/src/components/slides/reveal-component.tsx +3 -2
- package/src/components/slides/slide-cell-view.tsx +8 -8
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +0 -101
- package/src/core/cells/__tests__/actions.test.ts +0 -1
- package/src/core/cells/__tests__/cell.test.ts +81 -17
- package/src/core/cells/__tests__/cells.test.ts +0 -100
- package/src/core/cells/__tests__/document.test.ts +2 -8
- package/src/core/cells/__tests__/utils.test.ts +93 -24
- package/src/core/cells/actions.ts +0 -1
- package/src/core/cells/cell.ts +37 -14
- package/src/core/cells/cells.ts +10 -99
- package/src/core/cells/document.ts +2 -13
- package/src/core/cells/types.ts +0 -23
- package/src/core/cells/utils.ts +44 -17
- package/src/core/codemirror/cells/extensions.ts +0 -14
- package/src/core/errors/__tests__/error-entries.test.ts +40 -1
- package/src/core/errors/error-entries.ts +2 -3
- package/src/core/executions/__tests__/freshness.test.ts +420 -0
- package/src/core/executions/__tests__/hooks.test.tsx +106 -0
- package/src/core/executions/atoms.ts +22 -0
- package/src/core/executions/freshness.ts +164 -0
- package/src/core/executions/hooks.ts +17 -1
- package/src/core/executions/index.ts +3 -1
- package/src/core/islands/bootstrap.ts +0 -1
- package/src/core/islands/components/__tests__/web-components.test.tsx +63 -0
- package/src/core/islands/components/web-components.tsx +11 -0
- package/src/core/kernel/handlers.ts +0 -4
- package/src/core/session/useNotebookSession.tsx +2 -7
- package/src/css/globals.css +6 -2
- package/src/plugins/impl/DataEditorPlugin.tsx +0 -4
- package/src/plugins/impl/data-editor/__tests__/column-types.test.ts +5 -0
- package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +9 -5
- package/src/plugins/impl/data-editor/column-types.ts +3 -0
- package/src/plugins/impl/data-editor/glide-data-editor.tsx +6 -5
- package/src/plugins/impl/data-editor/glide-utils.ts +10 -32
- package/src/plugins/impl/data-editor/types.ts +0 -2
- package/src/stories/cell-status.stories.tsx +12 -14
- package/src/stories/cell.stories.tsx +44 -10
- package/src/stories/layout/vertical/one-column.stories.tsx +0 -10
- package/src/theme/__tests__/islands-theme.test.tsx +276 -0
- package/src/theme/namespace.tsx +4 -3
- package/src/theme/useTheme.ts +71 -41
- package/dist/schemas-CdscWNy_.js +0 -4747
- package/dist/use-restore-focus-CmflVLWJ.js +0 -1672
- package/dist/useTheme-DPLobSFs.js +0 -339
- package/dist/utils-EBklsC5R.js +0 -813
- package/src/components/editor/cell/__tests__/useRunCells.test.ts +0 -45
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
|
-
import { g as t, h as n, p as r } from "./button-
|
|
2
|
+
import { g as t, h as n, p as r } from "./button-DZuNnIZO.js";
|
|
3
3
|
import { t as i } from "./react-sHtZdjeP.js";
|
|
4
4
|
import { t as a } from "./compiler-runtime-CldRdSsv.js";
|
|
5
|
-
import { i as o } from "./copy-icon-
|
|
6
|
-
import { f as s, h as c } from "./tooltip-
|
|
7
|
-
import { t as l } from "./check-
|
|
8
|
-
import { n as u, r as d } from "./assertNever-
|
|
5
|
+
import { i as o } from "./copy-icon-CtllOdmg.js";
|
|
6
|
+
import { f as s, h as c } from "./tooltip-DMMiOn2f.js";
|
|
7
|
+
import { t as l } from "./check-XFzZeH-y.js";
|
|
8
|
+
import { n as u, r as d } from "./assertNever-B-YzWzbL.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
|
-
import {
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
var _e = c("external-link", [
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as S, jt as C, ln as ee, mn as w, pn as te, un as ne, vt as re, xt as ie, yt as T } from "./use-restore-focus-CosX7-gx.js";
|
|
11
|
+
import { n as ae } from "./toast-BhjIy3Tq.js";
|
|
12
|
+
import { t as oe } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as E } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as se } from "./createReducer-DRqwmaTc.js";
|
|
15
|
+
import { M as ce, N as le, V as ue, g as de } from "./dist-CYeqK4Xw.js";
|
|
16
|
+
import { t as D } from "./purify.es-DMv5zIkJ.js";
|
|
17
|
+
import { a as fe, i as pe, l as me, m as he, u as ge } from "./static-state-D-Q-Ajaa.js";
|
|
18
|
+
import { t as _e } from "./capabilities-D9FskwsK.js";
|
|
19
|
+
var ve = c("external-link", [
|
|
21
20
|
["path", {
|
|
22
21
|
d: "M15 3h6v6",
|
|
23
22
|
key: "1q9fwt"
|
|
@@ -30,20 +29,20 @@ var _e = c("external-link", [
|
|
|
30
29
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
31
30
|
key: "a6xqqp"
|
|
32
31
|
}]
|
|
33
|
-
]),
|
|
32
|
+
]), ye = c("minus", [["path", {
|
|
34
33
|
d: "M5 12h14",
|
|
35
34
|
key: "1ays0h"
|
|
36
|
-
}]]),
|
|
35
|
+
}]]), O = /* @__PURE__ */ e(i(), 1), k = f(), be = Object.defineProperty, A = (e, t) => be(e, "name", {
|
|
37
36
|
value: t,
|
|
38
37
|
configurable: !0
|
|
39
|
-
}),
|
|
40
|
-
function
|
|
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] =
|
|
38
|
+
}), j = "Checkbox", [xe, Se] = te(j), [Ce, M] = xe(j);
|
|
39
|
+
function we(e) {
|
|
40
|
+
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] = ne({
|
|
42
41
|
prop: n,
|
|
43
42
|
defaultProp: i ?? !1,
|
|
44
43
|
onChange: c,
|
|
45
|
-
caller:
|
|
46
|
-
}), [m, h] =
|
|
44
|
+
caller: j
|
|
45
|
+
}), [m, h] = O.useState(null), [g, _] = O.useState(null), [v, y] = O.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
47
46
|
checked: f,
|
|
48
47
|
disabled: a,
|
|
49
48
|
setChecked: p,
|
|
@@ -55,51 +54,51 @@ function Te(e) {
|
|
|
55
54
|
userClick: v,
|
|
56
55
|
onUserClick: y,
|
|
57
56
|
required: l,
|
|
58
|
-
defaultChecked: !
|
|
57
|
+
defaultChecked: !N(i) && i,
|
|
59
58
|
isFormControl: b,
|
|
60
59
|
bubbleInput: g,
|
|
61
60
|
setBubbleInput: _
|
|
62
61
|
};
|
|
63
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, k.jsx)(Ce, {
|
|
64
63
|
scope: t,
|
|
65
64
|
...x,
|
|
66
|
-
children:
|
|
65
|
+
children: Me(d) ? d(x) : r
|
|
67
66
|
});
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl:
|
|
72
|
-
return
|
|
68
|
+
A(we, "CheckboxProvider");
|
|
69
|
+
var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = M(Te, e), g = r(a, d), _ = O.useRef(l);
|
|
71
|
+
return O.useEffect(() => {
|
|
73
72
|
let e = o?.form;
|
|
74
73
|
if (e) {
|
|
75
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ A(() => f(_.current), "reset");
|
|
76
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
77
76
|
}
|
|
78
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, k.jsx)(w.button, {
|
|
79
78
|
type: "button",
|
|
80
79
|
role: "checkbox",
|
|
81
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": N(l) ? "mixed" : l,
|
|
82
81
|
"aria-required": u,
|
|
83
|
-
"data-state":
|
|
82
|
+
"data-state": P(l),
|
|
84
83
|
"data-disabled": c ? "" : void 0,
|
|
85
84
|
disabled: c,
|
|
86
85
|
value: s,
|
|
87
86
|
...i,
|
|
88
|
-
ref:
|
|
89
|
-
onKeyDown:
|
|
87
|
+
ref: g,
|
|
88
|
+
onKeyDown: S(t, (e) => {
|
|
90
89
|
e.key === "Enter" && e.preventDefault();
|
|
91
90
|
}),
|
|
92
|
-
onClick:
|
|
91
|
+
onClick: S(n, (e) => {
|
|
93
92
|
let t = e.isPropagationStopped();
|
|
94
93
|
p({
|
|
95
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: N(l) ? !0 : !l,
|
|
96
95
|
hasConsumerStoppedPropagation: t
|
|
97
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => N(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
98
97
|
})
|
|
99
98
|
});
|
|
100
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), De = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function(e, t) {
|
|
101
100
|
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,
|
|
101
|
+
return /* @__PURE__ */ (0, k.jsx)(we, {
|
|
103
102
|
__scopeCheckbox: n,
|
|
104
103
|
checked: i,
|
|
105
104
|
defaultChecked: a,
|
|
@@ -109,18 +108,18 @@ var Ee = "CheckboxTrigger", De = /* @__PURE__ */ k.forwardRef(/* @__PURE__ */ j(
|
|
|
109
108
|
name: r,
|
|
110
109
|
form: u,
|
|
111
110
|
value: c,
|
|
112
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
111
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, k.jsxs)(k.Fragment, { children: [/* @__PURE__ */ (0, k.jsx)(Ee, {
|
|
113
112
|
...d,
|
|
114
113
|
ref: t,
|
|
115
114
|
__scopeCheckbox: n
|
|
116
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, k.jsx)(je, { __scopeCheckbox: n })] })
|
|
117
116
|
});
|
|
118
|
-
}, "Checkbox")),
|
|
119
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
120
|
-
return /* @__PURE__ */ (0,
|
|
121
|
-
present: r ||
|
|
122
|
-
children: /* @__PURE__ */ (0,
|
|
123
|
-
"data-state":
|
|
117
|
+
}, "Checkbox")), Oe = "CheckboxIndicator", ke = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = M(Oe, n);
|
|
119
|
+
return /* @__PURE__ */ (0, k.jsx)(ee, {
|
|
120
|
+
present: r || N(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, k.jsx)(w.span, {
|
|
122
|
+
"data-state": P(a.checked),
|
|
124
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
125
124
|
...i,
|
|
126
125
|
ref: t,
|
|
@@ -130,47 +129,47 @@ var Ee = "CheckboxTrigger", De = /* @__PURE__ */ k.forwardRef(/* @__PURE__ */ j(
|
|
|
130
129
|
}
|
|
131
130
|
})
|
|
132
131
|
});
|
|
133
|
-
}, "CheckboxIndicator")),
|
|
134
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form:
|
|
135
|
-
|
|
136
|
-
let e =
|
|
132
|
+
}, "CheckboxIndicator")), Ae = "CheckboxBubbleInput", je = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = M(Ae, e), _ = r(i, g), v = s(a), y = O.useRef(!1), b = O.useRef(c), x = O.useRef(o), C = O.useRef(null);
|
|
134
|
+
O.useEffect(() => {
|
|
135
|
+
let e = h;
|
|
137
136
|
if (!e) return;
|
|
138
137
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
139
138
|
if (!n) return;
|
|
140
|
-
let r =
|
|
141
|
-
|
|
142
|
-
let i = o !== null && o !==
|
|
143
|
-
if (
|
|
139
|
+
let r = b.current !== c;
|
|
140
|
+
b.current = c;
|
|
141
|
+
let i = o !== null && o !== x.current;
|
|
142
|
+
if (x.current = o, i) C.current = r ? null : o, r && (e.indeterminate = N(c), n.call(e, !N(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
144
143
|
else if (r) {
|
|
145
144
|
let t = C.current;
|
|
146
145
|
C.current = null;
|
|
147
146
|
let r = t?.requestedChecked === c;
|
|
148
|
-
|
|
147
|
+
y.current = !0, e.indeterminate = N(c), n.call(e, !N(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
|
|
149
148
|
}
|
|
150
149
|
}, [
|
|
151
|
-
|
|
150
|
+
h,
|
|
152
151
|
c,
|
|
153
152
|
o
|
|
154
153
|
]);
|
|
155
|
-
let
|
|
156
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let ee = O.useRef(!N(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, k.jsx)(w.input, {
|
|
157
156
|
type: "checkbox",
|
|
158
157
|
"aria-hidden": !0,
|
|
159
|
-
defaultChecked: l ??
|
|
158
|
+
defaultChecked: l ?? ee.current,
|
|
160
159
|
required: u,
|
|
161
160
|
disabled: d,
|
|
162
161
|
name: f,
|
|
163
162
|
value: p,
|
|
164
|
-
form:
|
|
163
|
+
form: m,
|
|
165
164
|
...n,
|
|
166
165
|
tabIndex: -1,
|
|
167
|
-
ref:
|
|
168
|
-
onClick:
|
|
169
|
-
|
|
166
|
+
ref: _,
|
|
167
|
+
onClick: S(t, (e) => {
|
|
168
|
+
y.current && e.stopPropagation();
|
|
170
169
|
}),
|
|
171
170
|
style: {
|
|
172
171
|
...n.style,
|
|
173
|
-
...
|
|
172
|
+
...v,
|
|
174
173
|
position: "absolute",
|
|
175
174
|
pointerEvents: "none",
|
|
176
175
|
opacity: 0,
|
|
@@ -179,21 +178,72 @@ var Ee = "CheckboxTrigger", De = /* @__PURE__ */ k.forwardRef(/* @__PURE__ */ j(
|
|
|
179
178
|
}
|
|
180
179
|
});
|
|
181
180
|
}, "CheckboxBubbleInput"));
|
|
182
|
-
function
|
|
181
|
+
function Me(e) {
|
|
183
182
|
return typeof e == "function";
|
|
184
183
|
}
|
|
185
|
-
|
|
186
|
-
function
|
|
184
|
+
A(Me, "isFunction");
|
|
185
|
+
function N(e) {
|
|
187
186
|
return e === "indeterminate";
|
|
188
187
|
}
|
|
189
|
-
|
|
188
|
+
A(N, "isIndeterminate");
|
|
189
|
+
function P(e) {
|
|
190
|
+
return N(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
|
+
}
|
|
192
|
+
A(P, "getState");
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/core/executions/freshness.ts
|
|
195
|
+
var Ne = {
|
|
196
|
+
sourceChanged: !1,
|
|
197
|
+
inputsChanged: !1
|
|
198
|
+
};
|
|
190
199
|
function Pe(e) {
|
|
191
|
-
|
|
200
|
+
let t = /* @__PURE__ */ new Map();
|
|
201
|
+
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
202
|
+
let n = t.get(e.name);
|
|
203
|
+
n === void 0 ? t.set(e.name, [e]) : n.push(e);
|
|
204
|
+
}
|
|
205
|
+
return t;
|
|
206
|
+
}
|
|
207
|
+
function Fe(e) {
|
|
208
|
+
let t = Pe(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
209
|
+
function i(e, n) {
|
|
210
|
+
let i = new Set(n).add(e.id);
|
|
211
|
+
for (let [n, a] of Object.entries(e.depends_on)) {
|
|
212
|
+
let s = t.get(n) ?? [];
|
|
213
|
+
if (a === null) {
|
|
214
|
+
if (s.some((t) => r(t.execution_id)?.runtime_id === e.runtime_id)) return !0;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
let c = s.find((e) => e.revision.execution === a.execution);
|
|
218
|
+
if (c === void 0 || c.revision.update !== a.update) return !0;
|
|
219
|
+
let l = r(c.execution_id);
|
|
220
|
+
if (l === void 0 || !i.has(l.id) && o(l, i).inputsChanged) return !0;
|
|
221
|
+
}
|
|
222
|
+
return !1;
|
|
223
|
+
}
|
|
224
|
+
function a(t, n) {
|
|
225
|
+
let i = e.executions.latest.get(t.id);
|
|
226
|
+
if (i === void 0 || i === n.id) return !1;
|
|
227
|
+
let a = r(i);
|
|
228
|
+
return a !== void 0 && a.status !== "completed" && a.code_fingerprint === t.code_fingerprint;
|
|
229
|
+
}
|
|
230
|
+
function o(t, r) {
|
|
231
|
+
let o = n.get(t.id);
|
|
232
|
+
if (o !== void 0) return o;
|
|
233
|
+
let s = t.cell_id === null ? void 0 : e.cells.get(t.cell_id), c = {
|
|
234
|
+
sourceChanged: s === void 0 || s.code_fingerprint !== t.code_fingerprint && !a(s, t),
|
|
235
|
+
inputsChanged: i(t, r)
|
|
236
|
+
};
|
|
237
|
+
return n.set(t.id, c), c;
|
|
238
|
+
}
|
|
239
|
+
return (t) => {
|
|
240
|
+
let n = e.results.get(t);
|
|
241
|
+
return n == null ? Ne : o(n, /* @__PURE__ */ new Set());
|
|
242
|
+
};
|
|
192
243
|
}
|
|
193
|
-
j(Pe, "getState");
|
|
194
244
|
//#endregion
|
|
195
245
|
//#region src/utils/time.ts
|
|
196
|
-
var
|
|
246
|
+
var Ie = class e {
|
|
197
247
|
ms;
|
|
198
248
|
static fromMilliseconds(t) {
|
|
199
249
|
return t == null ? null : new e(t);
|
|
@@ -222,56 +272,56 @@ var Fe = class e {
|
|
|
222
272
|
};
|
|
223
273
|
//#endregion
|
|
224
274
|
//#region src/core/executions/select.ts
|
|
225
|
-
function
|
|
275
|
+
function Le(e) {
|
|
226
276
|
let t = e.outcome;
|
|
227
277
|
return t === null ? null : t.kind;
|
|
228
278
|
}
|
|
229
|
-
function
|
|
230
|
-
return e === null ? null :
|
|
279
|
+
function Re(e) {
|
|
280
|
+
return e === null ? null : Ie.parse(e).toMilliseconds();
|
|
231
281
|
}
|
|
232
|
-
function
|
|
282
|
+
function ze(e, t) {
|
|
233
283
|
let n = e.latest.get(t);
|
|
234
284
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
235
285
|
}
|
|
236
|
-
function
|
|
286
|
+
function Be(e, t) {
|
|
237
287
|
return e.executions.latest.get(t) ?? e.results.get(t)?.id ?? null;
|
|
238
288
|
}
|
|
239
|
-
function
|
|
240
|
-
let n =
|
|
241
|
-
n !== null && n.record.status !== "completed" ? (a = n.record.status, o =
|
|
242
|
-
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ?
|
|
289
|
+
function Ve(e, t) {
|
|
290
|
+
let n = ze(e.executions, t), r = e.results.get(t) ?? null, i = e.submissions.has(t) && e.submissions.get(t) === Be(e, t), a = "idle", o = r === null ? null : Re(r.started_at), s = !1;
|
|
291
|
+
n !== null && n.record.status !== "completed" ? (a = n.record.status, o = Re(n.record.started_at) ?? o, s = n.record.outcome !== null) : i && (a = "queued");
|
|
292
|
+
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ? Ie.parse(r.completed_at).since(Ie.parse(r.started_at)) : null;
|
|
243
293
|
return {
|
|
244
294
|
status: a,
|
|
245
295
|
blocked: e.blocked.has(t),
|
|
246
|
-
outcome: c && r !== null ?
|
|
296
|
+
outcome: c && r !== null ? Le(r) : null,
|
|
247
297
|
startedAt: o,
|
|
248
298
|
duration: l,
|
|
249
299
|
rendered: s
|
|
250
300
|
};
|
|
251
301
|
}
|
|
252
|
-
function Ve(e) {
|
|
253
|
-
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
254
|
-
}
|
|
255
302
|
function He(e) {
|
|
256
|
-
return
|
|
303
|
+
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
257
304
|
}
|
|
258
305
|
function Ue(e) {
|
|
259
|
-
|
|
260
|
-
|
|
306
|
+
return He(e).some((e) => e.record.status === "running");
|
|
307
|
+
}
|
|
308
|
+
function We(e) {
|
|
309
|
+
let t = He(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = 0;
|
|
310
|
+
for (let [t, i] of e.submissions) !n.has(t) && i === Be(e, t) && (r += 1);
|
|
261
311
|
return t.length + r;
|
|
262
312
|
}
|
|
263
313
|
//#endregion
|
|
264
314
|
//#region src/core/executions/atoms.ts
|
|
265
|
-
var
|
|
315
|
+
var Ge = {
|
|
266
316
|
runs: /* @__PURE__ */ new Map(),
|
|
267
317
|
executions: /* @__PURE__ */ new Map(),
|
|
268
318
|
latest: /* @__PURE__ */ new Map()
|
|
269
|
-
},
|
|
270
|
-
function
|
|
319
|
+
}, Ke = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Map(), Je = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Set(), Xe = y(null), Ze = y(null);
|
|
320
|
+
function Qe(e, t, n, r) {
|
|
271
321
|
return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
|
|
272
322
|
}
|
|
273
|
-
function
|
|
274
|
-
let n = e.get(
|
|
323
|
+
function $e(e, t) {
|
|
324
|
+
let n = e.get(m), r = n === null ? null : e.get(n.notebookAtom);
|
|
275
325
|
return n === null || r === null ? null : {
|
|
276
326
|
notebook: {
|
|
277
327
|
replica: n,
|
|
@@ -280,51 +330,62 @@ function Ze(e, t) {
|
|
|
280
330
|
value: t
|
|
281
331
|
};
|
|
282
332
|
}
|
|
283
|
-
var
|
|
284
|
-
let t = e(
|
|
333
|
+
var F = y((e) => {
|
|
334
|
+
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
285
335
|
return {
|
|
286
|
-
executions: t === null ?
|
|
287
|
-
results: t === null ?
|
|
288
|
-
submissions:
|
|
289
|
-
blocked:
|
|
336
|
+
executions: t === null ? Ge : e(t.executionsAtom),
|
|
337
|
+
results: t === null ? Ke : e(t.resultsAtom),
|
|
338
|
+
submissions: Qe(e(Xe), t, n, Je),
|
|
339
|
+
blocked: Qe(e(Ze), t, n, Ye)
|
|
340
|
+
};
|
|
341
|
+
}), et = y((e) => {
|
|
342
|
+
let t = e(m), n = t === null ? null : e(t.documentAtom);
|
|
343
|
+
return t === null || n === null ? {
|
|
344
|
+
cells: qe,
|
|
345
|
+
executions: Ge,
|
|
346
|
+
results: Ke
|
|
347
|
+
} : {
|
|
348
|
+
cells: n.cells,
|
|
349
|
+
executions: e(t.executionsAtom),
|
|
350
|
+
results: e(t.resultsAtom)
|
|
290
351
|
};
|
|
291
|
-
}),
|
|
292
|
-
let t = e(
|
|
352
|
+
}), tt = y((e) => Fe(e(et))), nt = y((e) => {
|
|
353
|
+
let t = e(m);
|
|
293
354
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
294
355
|
});
|
|
295
|
-
|
|
296
|
-
function
|
|
297
|
-
e.set(
|
|
356
|
+
y((e) => Ue(e(F).executions)), y((e) => We(e(F)));
|
|
357
|
+
function rt(e, t) {
|
|
358
|
+
e.set(Xe, $e(e, t));
|
|
298
359
|
}
|
|
299
|
-
function
|
|
300
|
-
let n = new Map(e.get(
|
|
360
|
+
function it(e, t) {
|
|
361
|
+
let n = new Map(e.get(F).submissions);
|
|
301
362
|
for (let e of t) n.delete(e);
|
|
302
|
-
|
|
363
|
+
rt(e, n);
|
|
303
364
|
}
|
|
304
|
-
function
|
|
305
|
-
let r = e.get(
|
|
365
|
+
function at(e, t, n) {
|
|
366
|
+
let r = e.get(F).blocked;
|
|
306
367
|
if (r.has(t) === n) return;
|
|
307
368
|
let i = new Set(r);
|
|
308
|
-
n ? i.add(t) : i.delete(t), e.set(
|
|
369
|
+
n ? i.add(t) : i.delete(t), e.set(Ze, $e(e, i));
|
|
309
370
|
}
|
|
310
|
-
function
|
|
371
|
+
function ot(e, t) {
|
|
311
372
|
let n = t.cell_id, r = t.status === "disabled-transitively";
|
|
312
|
-
t.status != null &&
|
|
373
|
+
t.status != null && at(e, n, r), (r || t.output?.mimetype === "application/vnd.marimo+error") && it(e, [n]);
|
|
313
374
|
}
|
|
314
375
|
//#endregion
|
|
315
376
|
//#region src/core/codemirror/editing/commands.ts
|
|
316
|
-
var
|
|
317
|
-
function
|
|
377
|
+
var st = a();
|
|
378
|
+
function ct(e) {
|
|
318
379
|
return (t) => {
|
|
319
380
|
let n = !1;
|
|
320
381
|
for (let r of t) r && (n = e(r) || n);
|
|
321
382
|
return n;
|
|
322
383
|
};
|
|
323
384
|
}
|
|
324
|
-
var
|
|
385
|
+
var lt = ct(de), ut = ct(le);
|
|
325
386
|
//#endregion
|
|
326
387
|
//#region src/utils/schedule-task.ts
|
|
327
|
-
function
|
|
388
|
+
function dt() {
|
|
328
389
|
let e = globalThis.scheduler;
|
|
329
390
|
if (typeof e?.postTask == "function") return (t) => {
|
|
330
391
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -345,10 +406,10 @@ function st() {
|
|
|
345
406
|
setTimeout(e, 0);
|
|
346
407
|
};
|
|
347
408
|
}
|
|
348
|
-
var
|
|
409
|
+
var ft = dt();
|
|
349
410
|
//#endregion
|
|
350
411
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
351
|
-
function
|
|
412
|
+
function pt(e = ft) {
|
|
352
413
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
353
414
|
function i() {
|
|
354
415
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -391,18 +452,18 @@ function lt(e = ct) {
|
|
|
391
452
|
}
|
|
392
453
|
};
|
|
393
454
|
}
|
|
394
|
-
var
|
|
455
|
+
var mt = pt();
|
|
395
456
|
//#endregion
|
|
396
457
|
//#region src/plugins/core/sanitize-html.ts
|
|
397
458
|
if (typeof document < "u") {
|
|
398
459
|
let e = "data-temp-href-target";
|
|
399
|
-
|
|
460
|
+
D.addHook("beforeSanitizeAttributes", (t) => {
|
|
400
461
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
401
|
-
}),
|
|
462
|
+
}), D.addHook("afterSanitizeAttributes", (t) => {
|
|
402
463
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
403
464
|
});
|
|
404
465
|
}
|
|
405
|
-
function
|
|
466
|
+
function ht(e) {
|
|
406
467
|
let t = {
|
|
407
468
|
USE_PROFILES: {
|
|
408
469
|
html: !0,
|
|
@@ -418,59 +479,59 @@ function dt(e) {
|
|
|
418
479
|
},
|
|
419
480
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
420
481
|
};
|
|
421
|
-
return
|
|
482
|
+
return D.sanitize(e, t);
|
|
422
483
|
}
|
|
423
484
|
//#endregion
|
|
424
485
|
//#region src/core/dom/outline.ts
|
|
425
|
-
var
|
|
486
|
+
var gt = [
|
|
426
487
|
"marimo-carousel",
|
|
427
488
|
"marimo-tabs",
|
|
428
489
|
"marimo-accordion",
|
|
429
490
|
"marimo-sidebar"
|
|
430
|
-
],
|
|
431
|
-
function
|
|
491
|
+
], _t = "h1, h2, h3, h4, h5, h6";
|
|
492
|
+
function vt(e) {
|
|
432
493
|
if (typeof DOMParser > "u") return null;
|
|
433
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
494
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(_t);
|
|
434
495
|
for (let e of Array.from(n)) {
|
|
435
496
|
let n = e.textContent;
|
|
436
|
-
if (
|
|
497
|
+
if (gt.some((t) => e.closest(t)) || !n) continue;
|
|
437
498
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
438
499
|
name: n,
|
|
439
500
|
level: r,
|
|
440
|
-
by:
|
|
501
|
+
by: bt(e)
|
|
441
502
|
};
|
|
442
|
-
i !== n && (a.html =
|
|
503
|
+
i !== n && (a.html = ht(i)), t.push(a);
|
|
443
504
|
}
|
|
444
505
|
return { items: t };
|
|
445
506
|
}
|
|
446
|
-
function
|
|
507
|
+
function yt(e) {
|
|
447
508
|
if (!e.includes("\"")) return `"${e}"`;
|
|
448
509
|
if (!e.includes("'")) return `'${e}'`;
|
|
449
510
|
let t = e.split("\""), n = [];
|
|
450
511
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
451
512
|
return `concat(${n.join(", ")})`;
|
|
452
513
|
}
|
|
453
|
-
function
|
|
514
|
+
function bt(e) {
|
|
454
515
|
let t = e.id;
|
|
455
516
|
if (t) return { id: t };
|
|
456
517
|
let n = e.textContent ?? "";
|
|
457
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
518
|
+
return { path: `//${e.tagName}[contains(., ${yt(n)})]` };
|
|
458
519
|
}
|
|
459
|
-
function
|
|
520
|
+
function xt(e) {
|
|
460
521
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
461
522
|
}
|
|
462
|
-
function
|
|
523
|
+
function St(e) {
|
|
463
524
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
464
525
|
try {
|
|
465
|
-
return
|
|
526
|
+
return E(typeof e.data == "string", "expected string"), vt(e.data);
|
|
466
527
|
} catch {
|
|
467
528
|
return t.error("Failed to parse outline"), null;
|
|
468
529
|
}
|
|
469
530
|
}
|
|
470
|
-
function
|
|
531
|
+
function Ct(e) {
|
|
471
532
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
472
533
|
}
|
|
473
|
-
function
|
|
534
|
+
function wt(e, n) {
|
|
474
535
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
475
536
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
476
537
|
let a = r(i), o = e + 1;
|
|
@@ -483,18 +544,18 @@ function bt(e, n) {
|
|
|
483
544
|
}
|
|
484
545
|
//#endregion
|
|
485
546
|
//#region src/core/mime.ts
|
|
486
|
-
function
|
|
547
|
+
function Tt(e) {
|
|
487
548
|
return e === "application/vnd.marimo+error";
|
|
488
549
|
}
|
|
489
|
-
function
|
|
550
|
+
function Et(e) {
|
|
490
551
|
return e === "application/vnd.marimo+traceback";
|
|
491
552
|
}
|
|
492
|
-
function
|
|
493
|
-
return
|
|
553
|
+
function I(e) {
|
|
554
|
+
return Tt(e) || Et(e);
|
|
494
555
|
}
|
|
495
556
|
//#endregion
|
|
496
557
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
497
|
-
var
|
|
558
|
+
var Dt = class e {
|
|
498
559
|
lines = [""];
|
|
499
560
|
cursor = {
|
|
500
561
|
row: 0,
|
|
@@ -583,7 +644,7 @@ var St = class e {
|
|
|
583
644
|
render() {
|
|
584
645
|
return this.lines.join("\n");
|
|
585
646
|
}
|
|
586
|
-
},
|
|
647
|
+
}, Ot = class {
|
|
587
648
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
588
649
|
parse(e) {
|
|
589
650
|
let t = [], n = 0;
|
|
@@ -602,9 +663,9 @@ var St = class e {
|
|
|
602
663
|
value: e.slice(n)
|
|
603
664
|
}), t;
|
|
604
665
|
}
|
|
605
|
-
},
|
|
606
|
-
parser = new
|
|
607
|
-
buffer = new
|
|
666
|
+
}, kt = class {
|
|
667
|
+
parser = new Ot();
|
|
668
|
+
buffer = new Dt();
|
|
608
669
|
reduce(e) {
|
|
609
670
|
return this.reset(), this.append(e), this.render();
|
|
610
671
|
}
|
|
@@ -620,7 +681,7 @@ var St = class e {
|
|
|
620
681
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
621
682
|
}
|
|
622
683
|
reset() {
|
|
623
|
-
this.buffer = new
|
|
684
|
+
this.buffer = new Dt();
|
|
624
685
|
}
|
|
625
686
|
render() {
|
|
626
687
|
return this.buffer.render();
|
|
@@ -663,19 +724,19 @@ var St = class e {
|
|
|
663
724
|
for (let t of e) t >= " " && (n += t);
|
|
664
725
|
return n;
|
|
665
726
|
}
|
|
666
|
-
},
|
|
727
|
+
}, L = class e {
|
|
667
728
|
mimetype;
|
|
668
729
|
channel;
|
|
669
730
|
timestamp;
|
|
670
731
|
code;
|
|
671
732
|
id;
|
|
672
|
-
ansiReducer = new
|
|
733
|
+
ansiReducer = new kt();
|
|
673
734
|
_data;
|
|
674
735
|
get data() {
|
|
675
736
|
return this._data;
|
|
676
737
|
}
|
|
677
738
|
static create(t) {
|
|
678
|
-
let n = new
|
|
739
|
+
let n = new kt();
|
|
679
740
|
return n.append(t.data), new e({
|
|
680
741
|
mimetype: t.mimetype,
|
|
681
742
|
channel: t.channel,
|
|
@@ -710,32 +771,32 @@ var St = class e {
|
|
|
710
771
|
};
|
|
711
772
|
//#endregion
|
|
712
773
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
713
|
-
function
|
|
774
|
+
function At(e, t = 5e3) {
|
|
714
775
|
let n = [...e];
|
|
715
|
-
if (n.length < 2) return
|
|
776
|
+
if (n.length < 2) return Ft(n.map(Mt), t);
|
|
716
777
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
717
|
-
return
|
|
778
|
+
return jt(r, i) && (Pt(r), Pt(i), n[n.length - 2] = Nt(i, r), n.pop()), Ft(n, t);
|
|
718
779
|
}
|
|
719
|
-
function
|
|
780
|
+
function jt(e, t) {
|
|
720
781
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
721
782
|
if (!n) return !1;
|
|
722
783
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
723
784
|
return n && r && i;
|
|
724
785
|
}
|
|
725
|
-
function
|
|
726
|
-
return e instanceof
|
|
786
|
+
function Mt(e) {
|
|
787
|
+
return e instanceof L ? e : typeof e.data == "string" ? L.create(e) : e;
|
|
727
788
|
}
|
|
728
|
-
function
|
|
729
|
-
return e instanceof
|
|
789
|
+
function Nt(e, t) {
|
|
790
|
+
return e instanceof L ? e.appendData(t.data) : L.create(e).appendData(t.data);
|
|
730
791
|
}
|
|
731
|
-
function
|
|
732
|
-
|
|
792
|
+
function Pt(e) {
|
|
793
|
+
E(typeof e.data == "string", "expected string output");
|
|
733
794
|
}
|
|
734
|
-
function
|
|
795
|
+
function Ft(e, t) {
|
|
735
796
|
let n = 0, r;
|
|
736
797
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
737
798
|
let t = e[r];
|
|
738
|
-
t.mimetype === "text/plain" ? (
|
|
799
|
+
t.mimetype === "text/plain" ? (E(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
|
|
739
800
|
}
|
|
740
801
|
if (n < t) return e;
|
|
741
802
|
let i = r + 1, a = {
|
|
@@ -746,7 +807,7 @@ function At(e, t) {
|
|
|
746
807
|
}, o = e[i];
|
|
747
808
|
if (o == null) return [a, ...e.slice(i + 1)];
|
|
748
809
|
if (o.mimetype === "text/plain") {
|
|
749
|
-
|
|
810
|
+
E(typeof o.data == "string", "expected string");
|
|
750
811
|
let r = o.data.split("\n"), s = t - (n - r.length);
|
|
751
812
|
return [
|
|
752
813
|
a,
|
|
@@ -761,16 +822,16 @@ function At(e, t) {
|
|
|
761
822
|
}
|
|
762
823
|
//#endregion
|
|
763
824
|
//#region src/core/cells/cell.ts
|
|
764
|
-
function
|
|
825
|
+
function It(e) {
|
|
765
826
|
return (e.at(-1)?.id ?? 0) + 1;
|
|
766
827
|
}
|
|
767
|
-
function
|
|
828
|
+
function Lt(e) {
|
|
768
829
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
769
830
|
}
|
|
770
|
-
function
|
|
831
|
+
function Rt(e, t) {
|
|
771
832
|
let n = { ...e };
|
|
772
|
-
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" &&
|
|
773
|
-
let r =
|
|
833
|
+
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Lt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
834
|
+
let r = Lt(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
774
835
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
775
836
|
channel: e.channel,
|
|
776
837
|
mimetype: e.mimetype,
|
|
@@ -780,26 +841,26 @@ function Nt(e, t) {
|
|
|
780
841
|
response: e.response ?? ""
|
|
781
842
|
} : e));
|
|
782
843
|
let a = t.console;
|
|
783
|
-
a != null && (i =
|
|
844
|
+
a != null && (i = At(Array.isArray(a) ? a.map((e, t) => ({
|
|
784
845
|
...e,
|
|
785
846
|
id: t + 1
|
|
786
847
|
})) : [...i, {
|
|
787
848
|
...a,
|
|
788
|
-
id:
|
|
789
|
-
}])), n.consoleOutputs = i, n.outline =
|
|
849
|
+
id: It(i)
|
|
850
|
+
}])), n.consoleOutputs = i, n.outline = St(n.output);
|
|
790
851
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
791
852
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
792
853
|
}
|
|
793
|
-
function
|
|
854
|
+
function zt(e) {
|
|
794
855
|
return e === "running" || e === "queued";
|
|
795
856
|
}
|
|
796
|
-
function
|
|
857
|
+
function Bt(e, t, n) {
|
|
797
858
|
let { status: r, outcome: i, rendered: a } = e;
|
|
798
|
-
return
|
|
859
|
+
return zt(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
799
860
|
}
|
|
800
861
|
//#endregion
|
|
801
862
|
//#region src/core/cells/columns.ts
|
|
802
|
-
function
|
|
863
|
+
function Vt(e) {
|
|
803
864
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
804
865
|
for (let r of e.order) {
|
|
805
866
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -807,9 +868,9 @@ function It(e) {
|
|
|
807
868
|
}
|
|
808
869
|
return t;
|
|
809
870
|
}
|
|
810
|
-
function
|
|
871
|
+
function Ht(e) {
|
|
811
872
|
let t = [[]];
|
|
812
|
-
for (let [n, r] of
|
|
873
|
+
for (let [n, r] of Vt(e)) {
|
|
813
874
|
for (; t.length <= r;) t.push([]);
|
|
814
875
|
t[r].push(n);
|
|
815
876
|
}
|
|
@@ -817,18 +878,18 @@ function Lt(e) {
|
|
|
817
878
|
}
|
|
818
879
|
//#endregion
|
|
819
880
|
//#region src/core/dom/ui-element-constants.ts
|
|
820
|
-
var
|
|
881
|
+
var Ut = "object-id", Wt = "random-id", Gt = "abcdefghijklmnopqrstuvwxyz", Kt = Gt + Gt.toUpperCase(), qt = /* @__PURE__ */ new Set(), R = "__scratch__", Jt = "setup", Yt = { create() {
|
|
821
882
|
let e = 0, t;
|
|
822
883
|
do {
|
|
823
884
|
let n = "";
|
|
824
|
-
for (let e = 0; e < 4; e++) n +=
|
|
885
|
+
for (let e = 0; e < 4; e++) n += Kt[Math.floor(Math.random() * 52)];
|
|
825
886
|
t = n, e++;
|
|
826
|
-
} while (
|
|
887
|
+
} while (qt.has(t) && e < 100);
|
|
827
888
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
828
|
-
return
|
|
829
|
-
} },
|
|
889
|
+
return qt.add(t), t;
|
|
890
|
+
} }, z = {
|
|
830
891
|
create(e) {
|
|
831
|
-
return
|
|
892
|
+
return E(e != null, "cellId is required"), `cell-${e}`;
|
|
832
893
|
},
|
|
833
894
|
parse(e) {
|
|
834
895
|
return e.slice(5);
|
|
@@ -839,7 +900,7 @@ var Rt = "object-id", zt = "random-id", Bt = "abcdefghijklmnopqrstuvwxyz", Vt =
|
|
|
839
900
|
findElementThroughShadowDOMs(e) {
|
|
840
901
|
let t = e;
|
|
841
902
|
for (; t;) {
|
|
842
|
-
let e =
|
|
903
|
+
let e = z.findElement(t);
|
|
843
904
|
if (e) return e;
|
|
844
905
|
let n = t.getRootNode();
|
|
845
906
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -847,33 +908,33 @@ var Rt = "object-id", zt = "random-id", Bt = "abcdefghijklmnopqrstuvwxyz", Vt =
|
|
|
847
908
|
return null;
|
|
848
909
|
}
|
|
849
910
|
};
|
|
850
|
-
function
|
|
851
|
-
let t = null, n =
|
|
852
|
-
return n && (t =
|
|
911
|
+
function Xt(e) {
|
|
912
|
+
let t = null, n = z.findElementThroughShadowDOMs(e);
|
|
913
|
+
return n && (t = z.parse(n.id)), t;
|
|
853
914
|
}
|
|
854
|
-
var
|
|
915
|
+
var Zt = {
|
|
855
916
|
parse(e) {
|
|
856
|
-
return e.getAttribute(
|
|
917
|
+
return e.getAttribute(Ut);
|
|
857
918
|
},
|
|
858
919
|
parseOrThrow(e) {
|
|
859
|
-
let t =
|
|
860
|
-
return
|
|
920
|
+
let t = Zt.parse(e);
|
|
921
|
+
return E(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
861
922
|
}
|
|
862
|
-
},
|
|
923
|
+
}, Qt = { create(e) {
|
|
863
924
|
return `output-${e}`;
|
|
864
|
-
} },
|
|
865
|
-
function
|
|
866
|
-
return `column-${
|
|
925
|
+
} }, $t = y(/* @__PURE__ */ new Set()), B = y([]), V = y([]);
|
|
926
|
+
function en() {
|
|
927
|
+
return `column-${Yt.create()}`;
|
|
867
928
|
}
|
|
868
|
-
var
|
|
869
|
-
let r =
|
|
929
|
+
var tn = y(null, (e, t, n) => {
|
|
930
|
+
let r = Ht(n).length, i = e(B);
|
|
870
931
|
if (i.length === r) return;
|
|
871
|
-
let a = e(
|
|
872
|
-
for (; o.length < r;) o.push(
|
|
873
|
-
t(
|
|
932
|
+
let a = e(V), o = [...i, ...a].slice(0, r);
|
|
933
|
+
for (; o.length < r;) o.push(en());
|
|
934
|
+
t(B, o), t(V, a.slice(Math.max(0, r - i.length)));
|
|
874
935
|
});
|
|
875
|
-
function
|
|
876
|
-
return [...(e === null ? [[]] :
|
|
936
|
+
function nn(e, t, n) {
|
|
937
|
+
return [...(e === null ? [[]] : Ht(e)).map((e, n) => ({
|
|
877
938
|
id: t[n] ?? `column-${n}`,
|
|
878
939
|
ids: e
|
|
879
940
|
})), ...n.map((e) => ({
|
|
@@ -881,18 +942,18 @@ function Zt(e, t, n) {
|
|
|
881
942
|
ids: []
|
|
882
943
|
}))];
|
|
883
944
|
}
|
|
884
|
-
function
|
|
945
|
+
function rn(e, t, n) {
|
|
885
946
|
let r = /* @__PURE__ */ new Map();
|
|
886
947
|
return e.forEach((i, a) => {
|
|
887
948
|
let o = t[a];
|
|
888
949
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
889
|
-
let s =
|
|
950
|
+
let s = wt(a, t);
|
|
890
951
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
891
952
|
}), r;
|
|
892
953
|
}
|
|
893
|
-
function
|
|
954
|
+
function an(e, t, n) {
|
|
894
955
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
895
|
-
let i =
|
|
956
|
+
let i = rn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
896
957
|
return {
|
|
897
958
|
id: e,
|
|
898
959
|
ids: r,
|
|
@@ -901,70 +962,65 @@ function $t(e, t, n) {
|
|
|
901
962
|
};
|
|
902
963
|
}) };
|
|
903
964
|
}
|
|
904
|
-
var
|
|
905
|
-
let t = e(
|
|
906
|
-
return
|
|
907
|
-
}),
|
|
908
|
-
function
|
|
965
|
+
var on = y((e) => {
|
|
966
|
+
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(ci);
|
|
967
|
+
return an(nn(n, e(B), e(V)), (e) => r[e] ?? null, e($t));
|
|
968
|
+
}), sn = () => _(on), cn = y((e) => e(on).columns.length);
|
|
969
|
+
function ln(e, t) {
|
|
909
970
|
return e.columns.find((e) => e.id === t);
|
|
910
971
|
}
|
|
911
|
-
function
|
|
972
|
+
function un(e, t) {
|
|
912
973
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
913
974
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
914
975
|
return n;
|
|
915
976
|
}
|
|
916
|
-
function
|
|
977
|
+
function dn(e, t) {
|
|
917
978
|
for (let n of e.columns) {
|
|
918
979
|
let e = n.folds.get(t);
|
|
919
980
|
if (e !== void 0) return e;
|
|
920
981
|
}
|
|
921
982
|
}
|
|
922
|
-
function
|
|
983
|
+
function fn(e, t) {
|
|
923
984
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
924
985
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
925
986
|
}
|
|
926
|
-
function
|
|
927
|
-
let n =
|
|
928
|
-
return
|
|
987
|
+
function pn(e, t) {
|
|
988
|
+
let n = fn(e, t);
|
|
989
|
+
return dn(e, t) === void 0 ? n : [...n, t];
|
|
929
990
|
}
|
|
930
|
-
var
|
|
931
|
-
function
|
|
991
|
+
var mn = /* @__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("."));
|
|
992
|
+
function hn(e, t = !0) {
|
|
932
993
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
933
994
|
}
|
|
934
|
-
function
|
|
935
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
995
|
+
function gn(e, t) {
|
|
996
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !mn.has(e);
|
|
936
997
|
if (i(e)) return e;
|
|
937
998
|
let a = 1;
|
|
938
999
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
939
1000
|
return r;
|
|
940
1001
|
}
|
|
941
|
-
function
|
|
942
|
-
return
|
|
1002
|
+
function _n(e, t) {
|
|
1003
|
+
return vn(e) ? `cell-${t}` : e;
|
|
943
1004
|
}
|
|
944
|
-
function
|
|
1005
|
+
function vn(e) {
|
|
945
1006
|
return !e || e === "_" || e === "__";
|
|
946
1007
|
}
|
|
947
1008
|
//#endregion
|
|
948
1009
|
//#region src/core/cells/types.ts
|
|
949
|
-
function
|
|
950
|
-
return e === null ? t.trim().length > 0 : e.trim() !== t.trim();
|
|
951
|
-
}
|
|
952
|
-
function mn({ id: e, name: t = "_", code: n = "", lastCodeRun: r = null, edited: i = !1, config: a }) {
|
|
1010
|
+
function yn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
953
1011
|
return {
|
|
954
1012
|
id: e,
|
|
955
|
-
config:
|
|
1013
|
+
config: r || {
|
|
956
1014
|
hide_code: !1,
|
|
957
1015
|
disabled: !1,
|
|
958
1016
|
column: null,
|
|
959
1017
|
expand_output: !1
|
|
960
1018
|
},
|
|
961
1019
|
name: t,
|
|
962
|
-
code: n
|
|
963
|
-
edited: i,
|
|
964
|
-
lastCodeRun: r
|
|
1020
|
+
code: n
|
|
965
1021
|
};
|
|
966
1022
|
}
|
|
967
|
-
function
|
|
1023
|
+
function bn(e) {
|
|
968
1024
|
return {
|
|
969
1025
|
hide_code: !1,
|
|
970
1026
|
disabled: !1,
|
|
@@ -973,20 +1029,19 @@ function hn(e) {
|
|
|
973
1029
|
...e
|
|
974
1030
|
};
|
|
975
1031
|
}
|
|
976
|
-
function
|
|
1032
|
+
function xn(e) {
|
|
977
1033
|
return {
|
|
978
1034
|
outline: null,
|
|
979
1035
|
output: null,
|
|
980
1036
|
consoleOutputs: [],
|
|
981
|
-
staleInputs: !1,
|
|
982
1037
|
debuggerActive: !1,
|
|
983
1038
|
...e
|
|
984
1039
|
};
|
|
985
1040
|
}
|
|
986
1041
|
//#endregion
|
|
987
1042
|
//#region src/core/cells/document.ts
|
|
988
|
-
function
|
|
989
|
-
let n = t.code ?? e.code, r =
|
|
1043
|
+
function Sn(e, t) {
|
|
1044
|
+
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config : bn(t.config);
|
|
990
1045
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
991
1046
|
...e,
|
|
992
1047
|
name: t.name,
|
|
@@ -995,36 +1050,33 @@ function _n(e, t) {
|
|
|
995
1050
|
...e,
|
|
996
1051
|
code: n,
|
|
997
1052
|
name: t.name,
|
|
998
|
-
config: r
|
|
999
|
-
edited: V(e.lastCodeRun, n)
|
|
1053
|
+
config: r
|
|
1000
1054
|
};
|
|
1001
1055
|
}
|
|
1002
|
-
function
|
|
1003
|
-
let n =
|
|
1056
|
+
function Cn(e, t) {
|
|
1057
|
+
let n = v(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1004
1058
|
for (let o of n) {
|
|
1005
1059
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
1006
1060
|
if (n === void 0) continue;
|
|
1007
1061
|
if (s === void 0) {
|
|
1008
|
-
let e = n.code ?? "";
|
|
1009
1062
|
r = {
|
|
1010
1063
|
...r,
|
|
1011
|
-
[o]:
|
|
1064
|
+
[o]: yn({
|
|
1012
1065
|
id: o,
|
|
1013
|
-
code:
|
|
1066
|
+
code: n.code ?? "",
|
|
1014
1067
|
name: n.name,
|
|
1015
|
-
config:
|
|
1016
|
-
edited: V(null, e)
|
|
1068
|
+
config: bn(n.config)
|
|
1017
1069
|
})
|
|
1018
1070
|
}, i = {
|
|
1019
1071
|
...i,
|
|
1020
|
-
[o]: i[o] ??
|
|
1072
|
+
[o]: i[o] ?? xn()
|
|
1021
1073
|
}, a = {
|
|
1022
1074
|
...a,
|
|
1023
|
-
[o]: (0,
|
|
1075
|
+
[o]: (0, O.createRef)()
|
|
1024
1076
|
};
|
|
1025
1077
|
continue;
|
|
1026
1078
|
}
|
|
1027
|
-
let c =
|
|
1079
|
+
let c = Sn(s, n);
|
|
1028
1080
|
c !== s && (r = {
|
|
1029
1081
|
...r,
|
|
1030
1082
|
[o]: c
|
|
@@ -1043,50 +1095,50 @@ function vn(e, t) {
|
|
|
1043
1095
|
cellHandles: a
|
|
1044
1096
|
};
|
|
1045
1097
|
}
|
|
1046
|
-
function
|
|
1098
|
+
function wn({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1047
1099
|
let i = () => {
|
|
1048
1100
|
let r = e.get(t.documentAtom);
|
|
1049
|
-
r !== null && (n(r), e.set(
|
|
1101
|
+
r !== null && (n(r), e.set(tn, r));
|
|
1050
1102
|
}, a = e.sub(t.documentAtom, i);
|
|
1051
1103
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1052
1104
|
}
|
|
1053
|
-
async function
|
|
1054
|
-
let e =
|
|
1055
|
-
e !== null &&
|
|
1105
|
+
async function Tn() {
|
|
1106
|
+
let e = T.get(b);
|
|
1107
|
+
e !== null && T.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1056
1108
|
}
|
|
1057
1109
|
//#endregion
|
|
1058
1110
|
//#region src/core/cells/editor.ts
|
|
1059
|
-
var H =
|
|
1060
|
-
function
|
|
1111
|
+
var H = y(/* @__PURE__ */ new Set());
|
|
1112
|
+
function En(e, t, n) {
|
|
1061
1113
|
return !!e && !t.has(n);
|
|
1062
1114
|
}
|
|
1063
|
-
|
|
1115
|
+
y(null, (e, t, { cellId: n }) => {
|
|
1064
1116
|
t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
1065
|
-
}),
|
|
1117
|
+
}), y(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
|
|
1066
1118
|
let t = new Set(e);
|
|
1067
1119
|
return t.delete(n), t;
|
|
1068
1120
|
}), !0) : !1);
|
|
1069
|
-
var
|
|
1070
|
-
|
|
1071
|
-
t(
|
|
1121
|
+
var Dn = y(/* @__PURE__ */ new Map());
|
|
1122
|
+
y(null, (e, t, { cellId: n }) => {
|
|
1123
|
+
t(Dn, (e) => {
|
|
1072
1124
|
let t = new Map(e);
|
|
1073
1125
|
return t.delete(n), t;
|
|
1074
1126
|
});
|
|
1075
1127
|
});
|
|
1076
1128
|
//#endregion
|
|
1077
1129
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1078
|
-
function
|
|
1079
|
-
return
|
|
1130
|
+
function On(e, t) {
|
|
1131
|
+
return ge(e * 1e3, t?.in);
|
|
1080
1132
|
}
|
|
1081
1133
|
//#endregion
|
|
1082
1134
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1083
|
-
var
|
|
1135
|
+
var kn = function(e, t) {
|
|
1084
1136
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1085
1137
|
}, U;
|
|
1086
1138
|
(function(e) {
|
|
1087
1139
|
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";
|
|
1088
1140
|
})(U ||= {});
|
|
1089
|
-
var
|
|
1141
|
+
var An = class {
|
|
1090
1142
|
constructor() {
|
|
1091
1143
|
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 = {
|
|
1092
1144
|
http: 1,
|
|
@@ -1331,7 +1383,7 @@ var Tn = class {
|
|
|
1331
1383
|
var r = this._buffer.charAt(1);
|
|
1332
1384
|
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1333
1385
|
if (r == "[") {
|
|
1334
|
-
this._csi_regex ||=
|
|
1386
|
+
this._csi_regex ||= jn(Nn ||= kn(["\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 "]));
|
|
1335
1387
|
let t = this._buffer.match(this._csi_regex);
|
|
1336
1388
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1337
1389
|
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1342,7 +1394,7 @@ var Tn = class {
|
|
|
1342
1394
|
if (r == "]") {
|
|
1343
1395
|
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1344
1396
|
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;
|
|
1345
|
-
this._osc_st ||=
|
|
1397
|
+
this._osc_st ||= Mn(Pn ||= kn(["\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;
|
|
1346
1398
|
{
|
|
1347
1399
|
let t = this._osc_st.exec(this._buffer);
|
|
1348
1400
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
@@ -1353,7 +1405,7 @@ var Tn = class {
|
|
|
1353
1405
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1354
1406
|
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1355
1407
|
}
|
|
1356
|
-
this._osc_regex ||=
|
|
1408
|
+
this._osc_regex ||= jn(Fn ||= kn(["\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 "]));
|
|
1357
1409
|
let n = this._buffer.match(this._osc_regex);
|
|
1358
1410
|
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1359
1411
|
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -1438,15 +1490,15 @@ var Tn = class {
|
|
|
1438
1490
|
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>`;
|
|
1439
1491
|
}
|
|
1440
1492
|
};
|
|
1441
|
-
function
|
|
1493
|
+
function jn(e, ...t) {
|
|
1442
1494
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1443
1495
|
return new RegExp(n);
|
|
1444
1496
|
}
|
|
1445
|
-
function
|
|
1497
|
+
function Mn(e, ...t) {
|
|
1446
1498
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1447
1499
|
return new RegExp(n, "g");
|
|
1448
1500
|
}
|
|
1449
|
-
var
|
|
1501
|
+
var Nn, Pn, Fn, In = new An();
|
|
1450
1502
|
function W(e) {
|
|
1451
1503
|
try {
|
|
1452
1504
|
let t = document.createElement("div");
|
|
@@ -1455,24 +1507,24 @@ function W(e) {
|
|
|
1455
1507
|
return t.error("Error parsing HTML content:", n), e;
|
|
1456
1508
|
}
|
|
1457
1509
|
}
|
|
1458
|
-
function
|
|
1510
|
+
function Ln(e) {
|
|
1459
1511
|
if (!e) return "";
|
|
1460
1512
|
try {
|
|
1461
|
-
return W(
|
|
1513
|
+
return W(In.ansi_to_html(e));
|
|
1462
1514
|
} catch (n) {
|
|
1463
1515
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1464
1516
|
}
|
|
1465
1517
|
}
|
|
1466
1518
|
//#endregion
|
|
1467
1519
|
//#region src/core/errors/traceback-atom.ts
|
|
1468
|
-
var
|
|
1520
|
+
var Rn = y(null);
|
|
1469
1521
|
//#endregion
|
|
1470
1522
|
//#region src/core/cells/logs.ts
|
|
1471
|
-
function
|
|
1523
|
+
function zn(e) {
|
|
1472
1524
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1473
1525
|
}
|
|
1474
|
-
var
|
|
1475
|
-
function
|
|
1526
|
+
var Bn = !1;
|
|
1527
|
+
function Vn(e) {
|
|
1476
1528
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1477
1529
|
for (let r of n) {
|
|
1478
1530
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1497,9 +1549,9 @@ function In(e) {
|
|
|
1497
1549
|
}
|
|
1498
1550
|
}
|
|
1499
1551
|
}
|
|
1500
|
-
if (t.forEach(
|
|
1552
|
+
if (t.forEach(Hn.log), n.length === 0 && I(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1501
1553
|
e.output.data.forEach((t) => {
|
|
1502
|
-
|
|
1554
|
+
Hn.log({
|
|
1503
1555
|
level: "stderr",
|
|
1504
1556
|
source: {
|
|
1505
1557
|
type: "cell",
|
|
@@ -1509,18 +1561,18 @@ function In(e) {
|
|
|
1509
1561
|
message: JSON.stringify(t)
|
|
1510
1562
|
});
|
|
1511
1563
|
});
|
|
1512
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
1513
|
-
if (t.length > 0 && !
|
|
1514
|
-
|
|
1564
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = T.get(pe) === "read";
|
|
1565
|
+
if (t.length > 0 && !Bn && n) {
|
|
1566
|
+
Bn = !0;
|
|
1515
1567
|
let e = t.find((e) => e.traceback);
|
|
1516
1568
|
o(e ? {
|
|
1517
1569
|
title: "An internal error occurred",
|
|
1518
1570
|
description: e.msg || "Click 'View' to see traceback",
|
|
1519
1571
|
variant: "danger",
|
|
1520
|
-
action:
|
|
1572
|
+
action: O.createElement(ae, {
|
|
1521
1573
|
altText: "View traceback",
|
|
1522
1574
|
onClick: () => {
|
|
1523
|
-
|
|
1575
|
+
T.set(Rn, {
|
|
1524
1576
|
traceback: e.traceback,
|
|
1525
1577
|
errorMessage: e.msg || "An internal error occurred"
|
|
1526
1578
|
});
|
|
@@ -1535,13 +1587,13 @@ function In(e) {
|
|
|
1535
1587
|
}
|
|
1536
1588
|
return t;
|
|
1537
1589
|
}
|
|
1538
|
-
var
|
|
1590
|
+
var Hn = { log: (e) => {
|
|
1539
1591
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1540
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1592
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Un(e.timestamp)}]`, `(${zn(e.source)}) ${e.message}`);
|
|
1541
1593
|
} };
|
|
1542
|
-
function
|
|
1594
|
+
function Un(e) {
|
|
1543
1595
|
try {
|
|
1544
|
-
return
|
|
1596
|
+
return On(e).toLocaleTimeString(void 0, {
|
|
1545
1597
|
hour12: !0,
|
|
1546
1598
|
hour: "numeric",
|
|
1547
1599
|
minute: "numeric",
|
|
@@ -1553,14 +1605,14 @@ function Rn(e) {
|
|
|
1553
1605
|
}
|
|
1554
1606
|
//#endregion
|
|
1555
1607
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1556
|
-
function
|
|
1557
|
-
let r = document.getElementById(
|
|
1558
|
-
r ?
|
|
1608
|
+
function Wn(e, n) {
|
|
1609
|
+
let r = document.getElementById(z.create(e));
|
|
1610
|
+
r ? Kn(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1559
1611
|
}
|
|
1560
|
-
function
|
|
1612
|
+
function Gn() {
|
|
1561
1613
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1562
1614
|
}
|
|
1563
|
-
function
|
|
1615
|
+
function Kn(e, n) {
|
|
1564
1616
|
try {
|
|
1565
1617
|
e.focus(n);
|
|
1566
1618
|
} catch {
|
|
@@ -1569,7 +1621,7 @@ function Vn(e, n) {
|
|
|
1569
1621
|
}
|
|
1570
1622
|
//#endregion
|
|
1571
1623
|
//#region src/utils/timeout.ts
|
|
1572
|
-
function
|
|
1624
|
+
function qn(e, n) {
|
|
1573
1625
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1574
1626
|
if (o < r) {
|
|
1575
1627
|
try {
|
|
@@ -1584,64 +1636,76 @@ function Hn(e, n) {
|
|
|
1584
1636
|
}
|
|
1585
1637
|
//#endregion
|
|
1586
1638
|
//#region src/core/cells/utils.ts
|
|
1587
|
-
function
|
|
1588
|
-
return
|
|
1639
|
+
function Jn(e, t, n) {
|
|
1640
|
+
return er(e, t, n).length > 0;
|
|
1589
1641
|
}
|
|
1590
|
-
function
|
|
1642
|
+
function Yn(e) {
|
|
1591
1643
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1592
1644
|
}
|
|
1593
|
-
function
|
|
1645
|
+
function Xn(e) {
|
|
1594
1646
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1595
1647
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1596
1648
|
return r;
|
|
1597
1649
|
}
|
|
1598
|
-
function
|
|
1650
|
+
function Zn(e) {
|
|
1599
1651
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1600
1652
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1601
1653
|
return r;
|
|
1602
1654
|
}
|
|
1603
|
-
function
|
|
1655
|
+
function Qn(e) {
|
|
1604
1656
|
return e.history.length > 0;
|
|
1605
1657
|
}
|
|
1606
|
-
function
|
|
1658
|
+
function $n(e) {
|
|
1607
1659
|
let t = e.history[e.history.length - 1];
|
|
1608
1660
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1609
1661
|
}
|
|
1610
|
-
function
|
|
1611
|
-
let { cellIds:
|
|
1612
|
-
return
|
|
1613
|
-
let
|
|
1614
|
-
return
|
|
1662
|
+
function er(e, t, n) {
|
|
1663
|
+
let { cellIds: r, cellData: i } = e;
|
|
1664
|
+
return r.filter((e) => {
|
|
1665
|
+
let r = Ve(t, e);
|
|
1666
|
+
return r.status === "idle" ? nr(r) || rr({
|
|
1667
|
+
freshness: n(e),
|
|
1668
|
+
interrupted: r.outcome === "interrupted",
|
|
1669
|
+
disabled: i[e].config.disabled,
|
|
1670
|
+
blocked: r.blocked
|
|
1671
|
+
}) : tr(t.executions, e) && n(e).sourceChanged;
|
|
1615
1672
|
});
|
|
1616
1673
|
}
|
|
1617
|
-
function
|
|
1674
|
+
function tr(e, t) {
|
|
1675
|
+
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1676
|
+
return r !== void 0 && r.status !== "completed";
|
|
1677
|
+
}
|
|
1678
|
+
function nr({ status: e, outcome: t }) {
|
|
1618
1679
|
return t === null && e !== "queued" && e !== "running";
|
|
1619
1680
|
}
|
|
1620
|
-
function
|
|
1681
|
+
function rr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
|
|
1682
|
+
return e.sourceChanged || t || e.inputsChanged && !(n || r);
|
|
1683
|
+
}
|
|
1684
|
+
function ir({ errored: e, stopped: t }) {
|
|
1621
1685
|
return {
|
|
1622
1686
|
published: !0,
|
|
1623
1687
|
"has-error": e,
|
|
1624
1688
|
stopped: t
|
|
1625
1689
|
};
|
|
1626
1690
|
}
|
|
1627
|
-
function
|
|
1628
|
-
let a =
|
|
1691
|
+
function ar({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1692
|
+
let a = I(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1629
1693
|
return (e || t || n || a) && !o;
|
|
1630
1694
|
}
|
|
1631
1695
|
//#endregion
|
|
1632
1696
|
//#region src/core/network/requests.ts
|
|
1633
|
-
var
|
|
1634
|
-
function
|
|
1635
|
-
let e =
|
|
1636
|
-
return
|
|
1697
|
+
var or = y(null);
|
|
1698
|
+
function sr() {
|
|
1699
|
+
let e = _(or);
|
|
1700
|
+
return E(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1637
1701
|
}
|
|
1638
|
-
function
|
|
1639
|
-
let e =
|
|
1640
|
-
return
|
|
1702
|
+
function cr() {
|
|
1703
|
+
let e = T.get(or);
|
|
1704
|
+
return E(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1641
1705
|
}
|
|
1642
1706
|
//#endregion
|
|
1643
1707
|
//#region src/utils/storage/storage.ts
|
|
1644
|
-
var
|
|
1708
|
+
var lr = class {
|
|
1645
1709
|
store = /* @__PURE__ */ new Map();
|
|
1646
1710
|
get length() {
|
|
1647
1711
|
return this.store.size;
|
|
@@ -1662,16 +1726,16 @@ var nr = class {
|
|
|
1662
1726
|
this.store.set(e, t);
|
|
1663
1727
|
}
|
|
1664
1728
|
};
|
|
1665
|
-
function
|
|
1666
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
1667
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1729
|
+
function ur() {
|
|
1730
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = _e();
|
|
1731
|
+
return e ? window.localStorage : t ? window.sessionStorage : new lr();
|
|
1668
1732
|
}
|
|
1669
|
-
var
|
|
1670
|
-
function
|
|
1671
|
-
return
|
|
1733
|
+
var dr = ur(), fr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, pr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, mr = /^data:image\//i, hr = ["avatars.githubusercontent.com"];
|
|
1734
|
+
function gr(e) {
|
|
1735
|
+
return mr.test(e) ? [{
|
|
1672
1736
|
type: "image",
|
|
1673
1737
|
url: e
|
|
1674
|
-
}] : e.split(
|
|
1738
|
+
}] : e.split(fr).filter((e) => e !== "").map((e) => fr.test(e) ? pr.test(e) || mr.test(e) || hr.some((t) => e.includes(t)) ? {
|
|
1675
1739
|
type: "image",
|
|
1676
1740
|
url: e
|
|
1677
1741
|
} : {
|
|
@@ -1684,48 +1748,48 @@ function lr(e) {
|
|
|
1684
1748
|
}
|
|
1685
1749
|
//#endregion
|
|
1686
1750
|
//#region src/utils/json/json-parser.ts
|
|
1687
|
-
var
|
|
1751
|
+
var _r = new RegExp(fr.source, "g");
|
|
1688
1752
|
BigInt.prototype.toJSON = function() {
|
|
1689
1753
|
return JSON.rawJSON(this.toString());
|
|
1690
1754
|
};
|
|
1691
|
-
function
|
|
1755
|
+
function vr(e) {
|
|
1692
1756
|
try {
|
|
1693
|
-
return JSON.parse(e, (e, t) =>
|
|
1757
|
+
return JSON.parse(e, (e, t) => Sr(t));
|
|
1694
1758
|
} catch {}
|
|
1695
1759
|
if (e == null || e === "") return {};
|
|
1696
1760
|
try {
|
|
1697
|
-
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 :
|
|
1761
|
+
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 : Sr(t) : Sr(t));
|
|
1698
1762
|
} catch {
|
|
1699
1763
|
return {};
|
|
1700
1764
|
}
|
|
1701
1765
|
}
|
|
1702
|
-
function
|
|
1766
|
+
function yr(e) {
|
|
1703
1767
|
if (e.length === 0) return "";
|
|
1704
1768
|
let t = Object.keys(e[0]);
|
|
1705
1769
|
return [
|
|
1706
1770
|
`| ${t.join(" | ")} |`,
|
|
1707
1771
|
`|${t.map(() => "---").join("|")}|`,
|
|
1708
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
1772
|
+
...e.map((e) => `| ${t.map((t) => br(e[t])).join(" | ")} |`)
|
|
1709
1773
|
].join("\n");
|
|
1710
1774
|
}
|
|
1711
|
-
function
|
|
1775
|
+
function br(e) {
|
|
1712
1776
|
if (e == null) return "";
|
|
1713
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
1777
|
+
if (Array.isArray(e) || typeof e == "object") return xr(JSON.stringify(e));
|
|
1714
1778
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1715
1779
|
t = t.replaceAll(n, (e) => {
|
|
1716
1780
|
let t = `__MDLINK_${i++}__`;
|
|
1717
1781
|
return r.set(t, e), t;
|
|
1718
|
-
}), t = t.replaceAll(
|
|
1782
|
+
}), t = t.replaceAll(_r, "[$1]($1)");
|
|
1719
1783
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
1720
|
-
return
|
|
1784
|
+
return xr(t);
|
|
1721
1785
|
}
|
|
1722
|
-
function
|
|
1786
|
+
function xr(e) {
|
|
1723
1787
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1724
1788
|
}
|
|
1725
|
-
function
|
|
1789
|
+
function Sr(e) {
|
|
1726
1790
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1727
1791
|
}
|
|
1728
|
-
var
|
|
1792
|
+
var Cr = new class {
|
|
1729
1793
|
getFilename() {
|
|
1730
1794
|
return this.getSearchParam("filename");
|
|
1731
1795
|
}
|
|
@@ -1752,39 +1816,39 @@ var gr = new class {
|
|
|
1752
1816
|
}();
|
|
1753
1817
|
//#endregion
|
|
1754
1818
|
//#region src/core/dom/htmlUtils.ts
|
|
1755
|
-
function
|
|
1756
|
-
return
|
|
1819
|
+
function wr(e) {
|
|
1820
|
+
return vr(e ?? "");
|
|
1757
1821
|
}
|
|
1758
|
-
function
|
|
1759
|
-
return
|
|
1822
|
+
function Tr(e) {
|
|
1823
|
+
return oe.mapValues(e.dataset, (e) => typeof e == "string" ? wr(e) : e);
|
|
1760
1824
|
}
|
|
1761
|
-
function
|
|
1762
|
-
let n = e.parentElement ?
|
|
1763
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
1825
|
+
function Er(e, t) {
|
|
1826
|
+
let n = e.parentElement ? Zt.parse(e.parentElement) : void 0;
|
|
1827
|
+
return n && t.has(n) ? t.lookupValue(n) : wr(e.dataset.initialValue);
|
|
1764
1828
|
}
|
|
1765
|
-
function
|
|
1766
|
-
if (
|
|
1767
|
-
if (
|
|
1768
|
-
let e =
|
|
1829
|
+
function Dr() {
|
|
1830
|
+
if (x()) return document.title || null;
|
|
1831
|
+
if (he()) {
|
|
1832
|
+
let e = Cr.getFilename();
|
|
1769
1833
|
if (e) return e;
|
|
1770
1834
|
}
|
|
1771
1835
|
let e = document.querySelector("marimo-filename");
|
|
1772
|
-
|
|
1836
|
+
me(e, "marimo-filename tag not found");
|
|
1773
1837
|
let t = e.innerHTML;
|
|
1774
1838
|
return t.length === 0 ? null : t;
|
|
1775
1839
|
}
|
|
1776
1840
|
//#endregion
|
|
1777
1841
|
//#region src/core/saving/file-state.ts
|
|
1778
|
-
var G =
|
|
1779
|
-
|
|
1780
|
-
var
|
|
1781
|
-
|
|
1842
|
+
var G = y(Dr());
|
|
1843
|
+
y(null);
|
|
1844
|
+
var Or = y(null);
|
|
1845
|
+
y(void 0);
|
|
1782
1846
|
//#endregion
|
|
1783
1847
|
//#region src/utils/storage/typed.ts
|
|
1784
|
-
var
|
|
1848
|
+
var kr = class {
|
|
1785
1849
|
defaultValue;
|
|
1786
1850
|
storage;
|
|
1787
|
-
constructor(e, t =
|
|
1851
|
+
constructor(e, t = dr) {
|
|
1788
1852
|
this.defaultValue = e, this.storage = t;
|
|
1789
1853
|
}
|
|
1790
1854
|
get(e) {
|
|
@@ -1801,11 +1865,11 @@ var Sr = class {
|
|
|
1801
1865
|
remove(e) {
|
|
1802
1866
|
this.storage.removeItem(e);
|
|
1803
1867
|
}
|
|
1804
|
-
},
|
|
1868
|
+
}, Ar = class {
|
|
1805
1869
|
schema;
|
|
1806
1870
|
getDefaultValue;
|
|
1807
1871
|
storage;
|
|
1808
|
-
constructor(e, t, n =
|
|
1872
|
+
constructor(e, t, n = dr) {
|
|
1809
1873
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1810
1874
|
}
|
|
1811
1875
|
get(e) {
|
|
@@ -1824,15 +1888,15 @@ var Sr = class {
|
|
|
1824
1888
|
remove(e) {
|
|
1825
1889
|
this.storage.removeItem(e);
|
|
1826
1890
|
}
|
|
1827
|
-
},
|
|
1891
|
+
}, jr = class extends Ar {
|
|
1828
1892
|
filename;
|
|
1829
1893
|
unsubscribeFromFilename;
|
|
1830
1894
|
constructor(e, t, n) {
|
|
1831
|
-
let r =
|
|
1895
|
+
let r = T.get(G);
|
|
1832
1896
|
super(t, n), this.filename = r;
|
|
1833
1897
|
try {
|
|
1834
|
-
this.unsubscribeFromFilename =
|
|
1835
|
-
let t =
|
|
1898
|
+
this.unsubscribeFromFilename = T.sub(G, () => {
|
|
1899
|
+
let t = T.get(G);
|
|
1836
1900
|
this.handleFilenameChange(e, t);
|
|
1837
1901
|
});
|
|
1838
1902
|
} catch {
|
|
@@ -1890,7 +1954,7 @@ var Sr = class {
|
|
|
1890
1954
|
In: "in",
|
|
1891
1955
|
As: "as",
|
|
1892
1956
|
Import: "import"
|
|
1893
|
-
},
|
|
1957
|
+
}, Mr = /* @__PURE__ */ new Set([
|
|
1894
1958
|
K.FunctionDefinition,
|
|
1895
1959
|
K.LambdaExpression,
|
|
1896
1960
|
K.ArrayComprehensionExpression,
|
|
@@ -1902,13 +1966,13 @@ var Sr = class {
|
|
|
1902
1966
|
K.Comment, K.String, K.FormatString;
|
|
1903
1967
|
//#endregion
|
|
1904
1968
|
//#region src/core/codemirror/utils.ts
|
|
1905
|
-
function
|
|
1969
|
+
function Nr(e) {
|
|
1906
1970
|
e && e.dispatch({ selection: {
|
|
1907
1971
|
anchor: e.state.doc.length,
|
|
1908
1972
|
head: e.state.doc.length
|
|
1909
1973
|
} });
|
|
1910
1974
|
}
|
|
1911
|
-
function
|
|
1975
|
+
function Pr(e) {
|
|
1912
1976
|
let t = e.dom.closest(".marimo-cell");
|
|
1913
1977
|
t && requestAnimationFrame(() => {
|
|
1914
1978
|
t.scrollIntoView({
|
|
@@ -1920,29 +1984,29 @@ function Dr(e) {
|
|
|
1920
1984
|
}
|
|
1921
1985
|
//#endregion
|
|
1922
1986
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
1923
|
-
var
|
|
1924
|
-
function
|
|
1987
|
+
var Fr = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
1988
|
+
function Ir(e, t) {
|
|
1925
1989
|
requestAnimationFrame(() => {
|
|
1926
1990
|
e.focus(), e.dispatch({
|
|
1927
1991
|
selection: {
|
|
1928
1992
|
anchor: t,
|
|
1929
1993
|
head: t
|
|
1930
1994
|
},
|
|
1931
|
-
effects:
|
|
1995
|
+
effects: ue.scrollIntoView(t, { y: "center" })
|
|
1932
1996
|
});
|
|
1933
|
-
}),
|
|
1997
|
+
}), Pr(e);
|
|
1934
1998
|
}
|
|
1935
|
-
function
|
|
1936
|
-
let n =
|
|
1999
|
+
function Lr(e, t) {
|
|
2000
|
+
let n = ce(e), r = null;
|
|
1937
2001
|
return n.iterate({ enter: (n) => {
|
|
1938
2002
|
if (r !== null) return !1;
|
|
1939
2003
|
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
1940
2004
|
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
1941
2005
|
} }), r;
|
|
1942
2006
|
}
|
|
1943
|
-
function
|
|
2007
|
+
function Rr(e, t) {
|
|
1944
2008
|
let n = [], r = e.resolveInner(t, 0);
|
|
1945
|
-
for (; r;)
|
|
2009
|
+
for (; r;) Mr.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
1946
2010
|
id: r.from,
|
|
1947
2011
|
type: r.name
|
|
1948
2012
|
})), r = r.parent;
|
|
@@ -1957,12 +2021,12 @@ function J(e, t, n) {
|
|
|
1957
2021
|
from: n
|
|
1958
2022
|
});
|
|
1959
2023
|
}
|
|
1960
|
-
function
|
|
2024
|
+
function zr(e, t) {
|
|
1961
2025
|
if (e.firstChild()) do
|
|
1962
2026
|
t(e.node);
|
|
1963
2027
|
while (e.nextSibling());
|
|
1964
2028
|
}
|
|
1965
|
-
function
|
|
2029
|
+
function Br(e, t) {
|
|
1966
2030
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
1967
2031
|
switch (e.name) {
|
|
1968
2032
|
case K.VariableName:
|
|
@@ -1973,13 +2037,13 @@ function Nr(e, t) {
|
|
|
1973
2037
|
let n = e.node.cursor();
|
|
1974
2038
|
n.firstChild();
|
|
1975
2039
|
do
|
|
1976
|
-
|
|
2040
|
+
Br(n, t);
|
|
1977
2041
|
while (n.nextSibling());
|
|
1978
2042
|
break;
|
|
1979
2043
|
}
|
|
1980
2044
|
}
|
|
1981
2045
|
}
|
|
1982
|
-
function
|
|
2046
|
+
function Vr(e, t) {
|
|
1983
2047
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
1984
2048
|
o.firstChild();
|
|
1985
2049
|
do {
|
|
@@ -1991,18 +2055,18 @@ function Pr(e, t) {
|
|
|
1991
2055
|
while (e.nextSibling());
|
|
1992
2056
|
} while (o.nextSibling());
|
|
1993
2057
|
}
|
|
1994
|
-
function
|
|
2058
|
+
function Hr(e, t) {
|
|
1995
2059
|
let n = e.cursor();
|
|
1996
2060
|
n.firstChild();
|
|
1997
2061
|
let r = !1;
|
|
1998
2062
|
do
|
|
1999
2063
|
if (n.name === q.For) r = !0;
|
|
2000
2064
|
else if (r && n.name === q.In) break;
|
|
2001
|
-
else r &&
|
|
2065
|
+
else r && Br(n, t);
|
|
2002
2066
|
while (n.nextSibling());
|
|
2003
2067
|
}
|
|
2004
|
-
function
|
|
2005
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2068
|
+
function Ur(e, t) {
|
|
2069
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Mr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2006
2070
|
switch (s) {
|
|
2007
2071
|
case K.FunctionDefinition:
|
|
2008
2072
|
case K.ClassDefinition: {
|
|
@@ -2014,7 +2078,7 @@ function Ir(e, t) {
|
|
|
2014
2078
|
break;
|
|
2015
2079
|
}
|
|
2016
2080
|
while (t.nextSibling());
|
|
2017
|
-
s === K.FunctionDefinition &&
|
|
2081
|
+
s === K.FunctionDefinition && Vr(e, {
|
|
2018
2082
|
state: n,
|
|
2019
2083
|
variableName: r,
|
|
2020
2084
|
scopeId: c,
|
|
@@ -2023,7 +2087,7 @@ function Ir(e, t) {
|
|
|
2023
2087
|
break;
|
|
2024
2088
|
}
|
|
2025
2089
|
case K.LambdaExpression:
|
|
2026
|
-
|
|
2090
|
+
Vr(e, {
|
|
2027
2091
|
state: n,
|
|
2028
2092
|
variableName: r,
|
|
2029
2093
|
scopeId: c,
|
|
@@ -2035,7 +2099,7 @@ function Ir(e, t) {
|
|
|
2035
2099
|
case K.SetComprehensionExpression:
|
|
2036
2100
|
case K.ComprehensionExpression:
|
|
2037
2101
|
case K.ForStatement:
|
|
2038
|
-
|
|
2102
|
+
Hr(e, {
|
|
2039
2103
|
state: n,
|
|
2040
2104
|
variableName: r,
|
|
2041
2105
|
scopeId: u,
|
|
@@ -2053,7 +2117,7 @@ function Ir(e, t) {
|
|
|
2053
2117
|
let s = e.cursor();
|
|
2054
2118
|
s.firstChild();
|
|
2055
2119
|
do
|
|
2056
|
-
s.from < o &&
|
|
2120
|
+
s.from < o && Br(s, {
|
|
2057
2121
|
state: n,
|
|
2058
2122
|
variableName: r,
|
|
2059
2123
|
scopeId: u,
|
|
@@ -2098,8 +2162,8 @@ function Ir(e, t) {
|
|
|
2098
2162
|
break;
|
|
2099
2163
|
}
|
|
2100
2164
|
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2165
|
+
zr(o, (e) => {
|
|
2166
|
+
Ur(e, {
|
|
2103
2167
|
state: n,
|
|
2104
2168
|
variableName: r,
|
|
2105
2169
|
scopeStack: l,
|
|
@@ -2107,27 +2171,27 @@ function Ir(e, t) {
|
|
|
2107
2171
|
});
|
|
2108
2172
|
});
|
|
2109
2173
|
}
|
|
2110
|
-
function
|
|
2111
|
-
let r =
|
|
2112
|
-
|
|
2174
|
+
function Wr(e, t, n) {
|
|
2175
|
+
let r = ce(e), i = [];
|
|
2176
|
+
Ur(r, {
|
|
2113
2177
|
state: e,
|
|
2114
2178
|
variableName: t,
|
|
2115
2179
|
scopeStack: [],
|
|
2116
2180
|
declarations: i
|
|
2117
2181
|
});
|
|
2118
2182
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2119
|
-
for (let e of
|
|
2120
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2183
|
+
for (let e of Rr(r, a)) {
|
|
2184
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Fr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2121
2185
|
if (t) return t.from;
|
|
2122
2186
|
}
|
|
2123
2187
|
return null;
|
|
2124
2188
|
}
|
|
2125
|
-
function
|
|
2126
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2127
|
-
return i !== null && (
|
|
2189
|
+
function Gr(e, t, n) {
|
|
2190
|
+
let { state: r } = e, i = n === void 0 ? Lr(r, t) : Wr(r, t, n);
|
|
2191
|
+
return i !== null && (Ir(e, i), !0);
|
|
2128
2192
|
}
|
|
2129
|
-
function
|
|
2130
|
-
return
|
|
2193
|
+
function Kr(e, t) {
|
|
2194
|
+
return Ir(e, e.state.doc.line(t).from), !0;
|
|
2131
2195
|
}
|
|
2132
2196
|
//#endregion
|
|
2133
2197
|
//#region src/core/notebook/replica/connection.ts
|
|
@@ -2137,70 +2201,70 @@ var Y = {
|
|
|
2137
2201
|
OPEN: "OPEN",
|
|
2138
2202
|
CLOSING: "CLOSING",
|
|
2139
2203
|
CLOSED: "CLOSED"
|
|
2140
|
-
},
|
|
2204
|
+
}, qr = {
|
|
2141
2205
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
2142
2206
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
2143
|
-
}, X =
|
|
2144
|
-
|
|
2207
|
+
}, X = y({ state: Y.NOT_STARTED });
|
|
2208
|
+
h(null, (e, t) => t === null ? null : {
|
|
2145
2209
|
phase: t.phase,
|
|
2146
2210
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2147
2211
|
});
|
|
2148
|
-
function
|
|
2149
|
-
return
|
|
2212
|
+
function Jr() {
|
|
2213
|
+
return ie(X, (e) => e.state === Y.OPEN);
|
|
2150
2214
|
}
|
|
2151
|
-
function
|
|
2152
|
-
return
|
|
2215
|
+
function Yr() {
|
|
2216
|
+
return fe() ? Jr() : Promise.resolve();
|
|
2153
2217
|
}
|
|
2154
|
-
|
|
2218
|
+
y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) => {
|
|
2155
2219
|
let t = e(X);
|
|
2156
2220
|
return t.state === Y.OPEN || t.state === Y.NOT_STARTED;
|
|
2157
|
-
}),
|
|
2221
|
+
}), y((e) => e(X).state === Y.CLOSED), y((e) => e(X).state === Y.NOT_STARTED);
|
|
2158
2222
|
//#endregion
|
|
2159
2223
|
//#region src/components/ui/checkbox.tsx
|
|
2160
|
-
var
|
|
2161
|
-
let r = (0,
|
|
2224
|
+
var Xr = O.forwardRef((e, t) => {
|
|
2225
|
+
let r = (0, st.c)(13), i, a;
|
|
2162
2226
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2163
2227
|
let o;
|
|
2164
2228
|
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);
|
|
2165
2229
|
let s;
|
|
2166
2230
|
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];
|
|
2167
2231
|
let c;
|
|
2168
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2232
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, k.jsx)(ke, {
|
|
2169
2233
|
className: s,
|
|
2170
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2234
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, k.jsx)(ye, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, k.jsx)(l, { className: "h-4 w-4" })
|
|
2171
2235
|
}), r[6] = a.checked, r[7] = c);
|
|
2172
2236
|
let u;
|
|
2173
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2237
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, k.jsx)(De, {
|
|
2174
2238
|
ref: t,
|
|
2175
2239
|
className: o,
|
|
2176
2240
|
...a,
|
|
2177
2241
|
children: c
|
|
2178
2242
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2179
2243
|
});
|
|
2180
|
-
|
|
2244
|
+
Xr.displayName = De.displayName;
|
|
2181
2245
|
//#endregion
|
|
2182
2246
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2183
|
-
function
|
|
2247
|
+
function Zr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2184
2248
|
if (!n) return;
|
|
2185
|
-
let o = document.getElementById(
|
|
2249
|
+
let o = document.getElementById(z.create(e));
|
|
2186
2250
|
if (!o) {
|
|
2187
2251
|
t.warn("scrollCellIntoView: element not found");
|
|
2188
2252
|
return;
|
|
2189
2253
|
}
|
|
2190
|
-
if (
|
|
2191
|
-
|
|
2254
|
+
if (Gn()) {
|
|
2255
|
+
Kn(o);
|
|
2192
2256
|
return;
|
|
2193
2257
|
}
|
|
2194
|
-
if (r)
|
|
2258
|
+
if (r) Kn(o);
|
|
2195
2259
|
else {
|
|
2196
|
-
|
|
2260
|
+
mt.promote(e);
|
|
2197
2261
|
let r = n.current?.editorView;
|
|
2198
2262
|
if (!r) {
|
|
2199
2263
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2200
2264
|
return;
|
|
2201
2265
|
}
|
|
2202
2266
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2203
|
-
if (
|
|
2267
|
+
if (qn(() => (r.focus(), r.hasFocus), {
|
|
2204
2268
|
retries: 5,
|
|
2205
2269
|
delay: 20
|
|
2206
2270
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2213,28 +2277,28 @@ function Wr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2213
2277
|
anchor: e.from,
|
|
2214
2278
|
head: e.from
|
|
2215
2279
|
} });
|
|
2216
|
-
} else a &&
|
|
2280
|
+
} else a && Gr(r, a);
|
|
2217
2281
|
}
|
|
2218
2282
|
o.scrollIntoView({
|
|
2219
2283
|
behavior: "smooth",
|
|
2220
2284
|
block: "nearest"
|
|
2221
2285
|
});
|
|
2222
2286
|
}
|
|
2223
|
-
function
|
|
2287
|
+
function Qr() {
|
|
2224
2288
|
let e = document.getElementById("App");
|
|
2225
2289
|
e?.scrollTo({
|
|
2226
2290
|
top: e.scrollHeight,
|
|
2227
2291
|
behavior: "smooth"
|
|
2228
2292
|
});
|
|
2229
2293
|
}
|
|
2230
|
-
function
|
|
2294
|
+
function $r() {
|
|
2231
2295
|
document.getElementById("App")?.scrollTo({
|
|
2232
2296
|
top: 0,
|
|
2233
2297
|
behavior: "smooth"
|
|
2234
2298
|
});
|
|
2235
2299
|
}
|
|
2236
|
-
function
|
|
2237
|
-
let t = document.getElementById(
|
|
2300
|
+
function ei(e) {
|
|
2301
|
+
let t = document.getElementById(z.create(e));
|
|
2238
2302
|
return t?.scrollIntoView({
|
|
2239
2303
|
behavior: "smooth",
|
|
2240
2304
|
block: "center"
|
|
@@ -2242,7 +2306,7 @@ function qr(e) {
|
|
|
2242
2306
|
}
|
|
2243
2307
|
//#endregion
|
|
2244
2308
|
//#region src/core/cells/cells.ts
|
|
2245
|
-
function
|
|
2309
|
+
function ti(e) {
|
|
2246
2310
|
let t = {
|
|
2247
2311
|
column: 0,
|
|
2248
2312
|
hide_code: !1,
|
|
@@ -2252,24 +2316,24 @@ function Jr(e) {
|
|
|
2252
2316
|
return {
|
|
2253
2317
|
...e,
|
|
2254
2318
|
cellData: {
|
|
2255
|
-
[
|
|
2256
|
-
id:
|
|
2319
|
+
[R]: yn({
|
|
2320
|
+
id: R,
|
|
2257
2321
|
config: t
|
|
2258
2322
|
}),
|
|
2259
2323
|
...e.cellData
|
|
2260
2324
|
},
|
|
2261
2325
|
cellRuntime: {
|
|
2262
|
-
[
|
|
2326
|
+
[R]: xn(),
|
|
2263
2327
|
...e.cellRuntime
|
|
2264
2328
|
},
|
|
2265
2329
|
cellHandles: {
|
|
2266
|
-
[
|
|
2330
|
+
[R]: (0, O.createRef)(),
|
|
2267
2331
|
...e.cellHandles
|
|
2268
2332
|
}
|
|
2269
2333
|
};
|
|
2270
2334
|
}
|
|
2271
|
-
function
|
|
2272
|
-
return
|
|
2335
|
+
function ni() {
|
|
2336
|
+
return ti({
|
|
2273
2337
|
cellIds: [],
|
|
2274
2338
|
cellData: {},
|
|
2275
2339
|
cellRuntime: {},
|
|
@@ -2279,55 +2343,24 @@ function Yr() {
|
|
|
2279
2343
|
cellLogs: []
|
|
2280
2344
|
});
|
|
2281
2345
|
}
|
|
2282
|
-
var { reducer:
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
return e.cellData[n] ? $r({
|
|
2286
|
-
state: e,
|
|
2287
|
-
cellId: n,
|
|
2288
|
-
cellReducer: (e) => {
|
|
2289
|
-
let t = V(e.lastCodeRun, r) ? e.lastCodeRun : i;
|
|
2290
|
-
return {
|
|
2291
|
-
...e,
|
|
2292
|
-
lastCodeRun: t,
|
|
2293
|
-
edited: V(t, e.code)
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
}) : e;
|
|
2297
|
-
},
|
|
2298
|
-
prepareForRun: (e, t) => $r({
|
|
2299
|
-
state: Q({
|
|
2300
|
-
state: e,
|
|
2301
|
-
cellId: t.cellId,
|
|
2302
|
-
cellReducer: (e) => ({
|
|
2303
|
-
...e,
|
|
2304
|
-
debuggerActive: !1
|
|
2305
|
-
})
|
|
2306
|
-
}),
|
|
2346
|
+
var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
2347
|
+
prepareForRun: (e, t) => Q({
|
|
2348
|
+
state: e,
|
|
2307
2349
|
cellId: t.cellId,
|
|
2308
2350
|
cellReducer: (e) => ({
|
|
2309
2351
|
...e,
|
|
2310
|
-
|
|
2311
|
-
lastCodeRun: e.code.trim()
|
|
2352
|
+
debuggerActive: !1
|
|
2312
2353
|
})
|
|
2313
2354
|
}),
|
|
2314
2355
|
handleCellMessage: (e, t) => {
|
|
2315
2356
|
let n = t.cell_id, r = Q({
|
|
2316
2357
|
state: e,
|
|
2317
2358
|
cellId: n,
|
|
2318
|
-
cellReducer: (e) =>
|
|
2359
|
+
cellReducer: (e) => Rt(e, t)
|
|
2319
2360
|
});
|
|
2320
|
-
return
|
|
2321
|
-
state: r,
|
|
2322
|
-
cellId: n,
|
|
2323
|
-
cellReducer: (e) => ({
|
|
2324
|
-
...e,
|
|
2325
|
-
lastCodeRun: e.code.trim(),
|
|
2326
|
-
edited: !1
|
|
2327
|
-
})
|
|
2328
|
-
})), {
|
|
2361
|
+
return {
|
|
2329
2362
|
...r,
|
|
2330
|
-
cellLogs: [...r.cellLogs, ...
|
|
2363
|
+
cellLogs: [...r.cellLogs, ...Vn(t)]
|
|
2331
2364
|
};
|
|
2332
2365
|
},
|
|
2333
2366
|
addLogs: (e, t) => ({
|
|
@@ -2335,8 +2368,8 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ae(Yr, {
|
|
|
2335
2368
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2336
2369
|
}),
|
|
2337
2370
|
reconcileDocument: (e, t) => {
|
|
2338
|
-
let n =
|
|
2339
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2371
|
+
let n = Cn(e, t);
|
|
2372
|
+
for (let t of e.cellIds) t in n.cellData || bi(t);
|
|
2340
2373
|
return n;
|
|
2341
2374
|
},
|
|
2342
2375
|
setStdinResponse: (e, n) => {
|
|
@@ -2361,26 +2394,11 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ae(Yr, {
|
|
|
2361
2394
|
}
|
|
2362
2395
|
});
|
|
2363
2396
|
},
|
|
2364
|
-
setLastRun: (e, t) => {
|
|
2365
|
-
let n = { ...e.cellData };
|
|
2366
|
-
for (let r of e.cellIds) {
|
|
2367
|
-
let i = e.cellData[r], a = t.lastCodeRun[r] ?? null;
|
|
2368
|
-
n[r] = {
|
|
2369
|
-
...i,
|
|
2370
|
-
lastCodeRun: a,
|
|
2371
|
-
edited: a !== null && V(a, i.code)
|
|
2372
|
-
};
|
|
2373
|
-
}
|
|
2374
|
-
return {
|
|
2375
|
-
...e,
|
|
2376
|
-
cellData: n
|
|
2377
|
-
};
|
|
2378
|
-
},
|
|
2379
2397
|
resetCellRuntimes: (e) => {
|
|
2380
|
-
let t =
|
|
2381
|
-
for (let r of [...e.cellIds,
|
|
2398
|
+
let t = he(), n = { ...e.cellRuntime };
|
|
2399
|
+
for (let r of [...e.cellIds, R]) {
|
|
2382
2400
|
let i = e.cellRuntime[r];
|
|
2383
|
-
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i :
|
|
2401
|
+
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : xn();
|
|
2384
2402
|
}
|
|
2385
2403
|
return {
|
|
2386
2404
|
...e,
|
|
@@ -2391,10 +2409,10 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ae(Yr, {
|
|
|
2391
2409
|
let t = e.scrollKey;
|
|
2392
2410
|
if (t === null) return e;
|
|
2393
2411
|
let n = t;
|
|
2394
|
-
return
|
|
2412
|
+
return Zr({
|
|
2395
2413
|
cellId: n,
|
|
2396
2414
|
cell: e.cellHandles[n],
|
|
2397
|
-
isCodeHidden:
|
|
2415
|
+
isCodeHidden: En(e.cellData[n]?.config.hide_code, T.get(H), n),
|
|
2398
2416
|
codeFocus: void 0,
|
|
2399
2417
|
variableName: void 0
|
|
2400
2418
|
}), {
|
|
@@ -2402,8 +2420,8 @@ var { reducer: Xr, createActions: Zr, useActions: Qr, valueAtom: Z } = ae(Yr, {
|
|
|
2402
2420
|
scrollKey: null
|
|
2403
2421
|
};
|
|
2404
2422
|
},
|
|
2405
|
-
foldAll: (e) => (
|
|
2406
|
-
unfoldAll: (e) => (
|
|
2423
|
+
foldAll: (e) => (lt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2424
|
+
unfoldAll: (e) => (ut(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2407
2425
|
clearLogs: (e) => ({
|
|
2408
2426
|
...e,
|
|
2409
2427
|
cellLogs: []
|
|
@@ -2453,25 +2471,16 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2453
2471
|
}
|
|
2454
2472
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2455
2473
|
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
[n]: r(e.cellData[n])
|
|
2462
|
-
}
|
|
2463
|
-
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2464
|
-
}
|
|
2465
|
-
var ei = Zr((e) => {
|
|
2466
|
-
w.set(Z, (t) => Xr(t, e));
|
|
2467
|
-
}).addLogs, $ = T((e) => e(Z).cellIds);
|
|
2468
|
-
T((e) => e($).length === 1), T((e) => Gn(e(Z)).length > 0), T((e) => Kn(e(Z)).length > 0), T((e) => qn(e(Z))), T((e) => Jn(e(Z))), T((e) => Un(e(Z), e(N)));
|
|
2469
|
-
var ti = T((e) => {
|
|
2474
|
+
var oi = ii((e) => {
|
|
2475
|
+
T.set(Z, (t) => ri(t, e));
|
|
2476
|
+
}).addLogs, $ = y((e) => e(Z).cellIds);
|
|
2477
|
+
y((e) => e($).length === 1), y((e) => Xn(e(Z)).length > 0), y((e) => Zn(e(Z)).length > 0), y((e) => Qn(e(Z))), y((e) => $n(e(Z))), y((e) => Jn(e(Z), e(F), e(tt)));
|
|
2478
|
+
var si = y((e) => {
|
|
2470
2479
|
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2471
2480
|
return t.map((e) => {
|
|
2472
2481
|
let t = n[e], { name: i } = r[e];
|
|
2473
|
-
if (
|
|
2474
|
-
|
|
2482
|
+
if (I(t.output?.mimetype)) {
|
|
2483
|
+
E(Array.isArray(t.output.data), "Expected array data");
|
|
2475
2484
|
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2476
2485
|
if (n.length > 0) return {
|
|
2477
2486
|
output: {
|
|
@@ -2484,90 +2493,90 @@ var ti = T((e) => {
|
|
|
2484
2493
|
}
|
|
2485
2494
|
return null;
|
|
2486
2495
|
}).filter(Boolean);
|
|
2487
|
-
}),
|
|
2496
|
+
}), ci = re(y((e) => {
|
|
2488
2497
|
let t = {};
|
|
2489
|
-
for (let [n, r] of
|
|
2498
|
+
for (let [n, r] of oe.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2490
2499
|
return t;
|
|
2491
|
-
})),
|
|
2492
|
-
let t = e($), n = e(
|
|
2493
|
-
return
|
|
2500
|
+
})), li = y((e) => {
|
|
2501
|
+
let t = e($), n = e(gi);
|
|
2502
|
+
return xt(t.map((e) => n[e].outline));
|
|
2494
2503
|
});
|
|
2495
|
-
|
|
2496
|
-
var
|
|
2504
|
+
y((e) => e(si).length);
|
|
2505
|
+
var ui = re(y((e) => {
|
|
2497
2506
|
let { cellIds: t, cellData: n } = e(Z);
|
|
2498
|
-
return
|
|
2507
|
+
return oe.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2499
2508
|
}));
|
|
2500
|
-
|
|
2501
|
-
var
|
|
2502
|
-
let { cellIds: e, cellData: t } =
|
|
2509
|
+
y((e) => e(Z).scrollKey);
|
|
2510
|
+
var di = () => _($), fi = () => _(ui), pi = () => T.get(Z), mi = () => T.get(Z).cellIds, hi = () => {
|
|
2511
|
+
let { cellIds: e, cellData: t } = T.get(Z);
|
|
2503
2512
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2504
2513
|
};
|
|
2505
|
-
|
|
2506
|
-
var
|
|
2507
|
-
|
|
2508
|
-
var
|
|
2509
|
-
function
|
|
2510
|
-
|
|
2511
|
-
}
|
|
2512
|
-
var
|
|
2513
|
-
let { cellHandles: t } =
|
|
2514
|
+
C(p(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2515
|
+
var gi = y((e) => e(Z).cellRuntime);
|
|
2516
|
+
y((e) => e(Z).cellIds.length > 0);
|
|
2517
|
+
var _i = g((e) => y((t) => t(Z).cellData[e])), vi = g((e) => y((t) => t(Z).cellRuntime[e])), yi = g((e) => y((t) => t(Z).cellHandles[e]));
|
|
2518
|
+
function bi(e) {
|
|
2519
|
+
_i.remove(e), vi.remove(e), yi.remove(e), it(T, [e]);
|
|
2520
|
+
}
|
|
2521
|
+
var xi = (e) => {
|
|
2522
|
+
let { cellHandles: t } = T.get(Z);
|
|
2514
2523
|
return t[e].current?.editorView;
|
|
2515
|
-
},
|
|
2516
|
-
function
|
|
2517
|
-
return
|
|
2524
|
+
}, Si = (e) => (mt.promote(e), xi(e));
|
|
2525
|
+
function Ci() {
|
|
2526
|
+
return ai();
|
|
2518
2527
|
}
|
|
2519
2528
|
//#endregion
|
|
2520
2529
|
//#region src/core/errors/error-entries.ts
|
|
2521
|
-
function
|
|
2522
|
-
if (
|
|
2530
|
+
function wi(e) {
|
|
2531
|
+
if (Tt(e.mimetype)) {
|
|
2523
2532
|
if (!Array.isArray(e.data)) return null;
|
|
2524
2533
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2525
2534
|
return t.length === 0 ? null : { errorData: t };
|
|
2526
2535
|
}
|
|
2527
|
-
return
|
|
2536
|
+
return Et(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2528
2537
|
errorData: [],
|
|
2529
2538
|
tracebackHtml: e.data
|
|
2530
2539
|
} : null;
|
|
2531
2540
|
}
|
|
2532
|
-
function
|
|
2541
|
+
function Ti(e) {
|
|
2533
2542
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2534
2543
|
}
|
|
2535
|
-
function
|
|
2536
|
-
let t = e?.find((e) =>
|
|
2544
|
+
function Ei(e) {
|
|
2545
|
+
let t = e?.find((e) => Et(e.mimetype));
|
|
2537
2546
|
if (!(!t || typeof t.data != "string" || t.data.length === 0)) return t.data;
|
|
2538
2547
|
}
|
|
2539
|
-
function
|
|
2548
|
+
function Di(e, t) {
|
|
2540
2549
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2541
|
-
if (!
|
|
2550
|
+
if (!Ti(e.errorData)) return Ei(t);
|
|
2542
2551
|
}
|
|
2543
|
-
function
|
|
2552
|
+
function Oi(e) {
|
|
2544
2553
|
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2545
2554
|
for (let [e, a] of t.entries()) {
|
|
2546
2555
|
let t = n[a], o = t.output;
|
|
2547
|
-
if (!o || !
|
|
2548
|
-
let s =
|
|
2556
|
+
if (!o || !I(o.mimetype)) continue;
|
|
2557
|
+
let s = wi(o);
|
|
2549
2558
|
if (!s) continue;
|
|
2550
|
-
let c =
|
|
2559
|
+
let c = _n(r[a].name, e), l = o.code ?? r[a].code;
|
|
2551
2560
|
i.push({
|
|
2552
2561
|
cellId: a,
|
|
2553
2562
|
cellName: c,
|
|
2554
2563
|
cellCode: l,
|
|
2555
2564
|
errorData: s.errorData,
|
|
2556
|
-
tracebackHtml:
|
|
2565
|
+
tracebackHtml: Di(s, t.consoleOutputs)
|
|
2557
2566
|
});
|
|
2558
2567
|
}
|
|
2559
2568
|
return i;
|
|
2560
2569
|
}
|
|
2561
|
-
function
|
|
2570
|
+
function ki(e) {
|
|
2562
2571
|
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");
|
|
2563
2572
|
}
|
|
2564
|
-
function
|
|
2565
|
-
let t =
|
|
2573
|
+
function Ai(e) {
|
|
2574
|
+
let t = ki(e);
|
|
2566
2575
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
2567
2576
|
}
|
|
2568
|
-
function
|
|
2577
|
+
function ji(e) {
|
|
2569
2578
|
let t = [e.cellName];
|
|
2570
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
2579
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Ai).join("\n\n")), t.join("\n\n");
|
|
2571
2580
|
}
|
|
2572
2581
|
//#endregion
|
|
2573
|
-
export {
|
|
2582
|
+
export { Wn as $, qr as A, Xt as At, Tr as B, tt as Bt, Qr as C, sn as Ct, X as D, R as Dt, Xr as E, z as Et, kr as F, Bt as Ft, dr as G, ve as Gt, vr as H, nt as Ht, Ar as I, Ct as It, sr as J, cr as K, G as L, bt as Lt, Kr as M, Wt as Mt, Nr as N, Vt as Nt, Jr as O, Jt as Ot, jr as P, zt as Pt, ar as Q, Or as R, ht as Rt, Zr as S, cn as St, $r as T, Qt as Tt, yr as U, Ve as Ut, Er as V, ot as Vt, gr as W, ye as Wt, Yn as X, nr as Y, ir as Z, ri as _, dn as _t, oi as a, H as at, fi as b, on as bt, ii as c, _n as ct, hi as d, hn as dt, Ln as et, mi as f, $t as ft, li as g, ln as gt, Z as h, V as ht, Oi as i, Dn as it, Y as j, Ut as jt, Yr as k, Zt as kt, Si as l, gn as lt, ni as m, un as mt, ji as n, An as nt, _i as o, Tn as ot, pi as p, B as pt, or as q, Ai as r, En as rt, $ as s, wn as st, ki as t, W as tt, xi as u, vn as ut, bi as v, pn as vt, ei as w, Yt as wt, Ci as x, en as xt, di as y, fn as yt, wr as z, F as zt };
|