@marimo-team/islands 0.25.3-dev308 → 0.25.3-dev310
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-DJnSxHJB.js → ConnectedDataExplorerComponent-DieU6L4x.js} +1 -1
- package/dist/{ErrorBoundary-flfhLFje.js → ErrorBoundary-DjoeT4kv.js} +1 -1
- package/dist/{abnfDiagram-VCTEODGH-CR0U5hup.js → abnfDiagram-VCTEODGH-LOVrjbdp.js} +2 -2
- package/dist/{any-language-editor-C5dsTpeB.js → any-language-editor-DMC2JE9_.js} +1 -1
- package/dist/{architectureDiagram-5GKGNRK7-Bc_fbI1Q.js → architectureDiagram-5GKGNRK7-RZsm312h.js} +1 -1
- package/dist/assets/__vite-browser-external-BSp9tJ_k.js +1 -0
- package/dist/assets/worker-BdfPA0g5.js +171 -0
- package/dist/{chat-ui-C4iLRzY0.js → chat-ui-DkuxGEDp.js} +418 -418
- package/dist/{chunk-IMKFNOWR-y9z5oeAY.js → chunk-IMKFNOWR-B6agbLjo.js} +1 -1
- package/dist/{chunk-SHT3W25Y-Tu-V-e_v.js → chunk-SHT3W25Y-CfULafYG.js} +1 -1
- package/dist/{chunk-SVP7TREG-CJFxs5R_.js → chunk-SVP7TREG-DEOpPMJp.js} +1 -1
- package/dist/{chunk-TICWLB2K-zkTP7ya7.js → chunk-TICWLB2K-DaH-gkX5.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-DxJAZI0N.js → classDiagram-ZZMXUADV-C0CyiWQ7.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-TmHo2BpS.js → classDiagram-v2-VYDZK3BY-xfIc9e2Y.js} +2 -2
- package/dist/{code-visibility-BDs_r7jH.js → code-visibility-CduMVVFS.js} +32 -32
- package/dist/{common-CMTsL35V.js → common-CMcEcucH.js} +919 -919
- package/dist/{config-BG2qKzDg.js → config-BVYA1P0C.js} +103 -76
- package/dist/{cynefinDiagram-5FMLGOSQ-Eb40hmhD.js → cynefinDiagram-5FMLGOSQ-DwGYhKu0.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-_paaVwit.js → dagre-GXQ25YYZ-DfMaWJOV.js} +1 -1
- package/dist/{data-grid-overlay-editor-es6V6qf-.js → data-grid-overlay-editor-BYrIVut3.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-BtKJm1_4.js → diagram-S7CK7UJ4-Bw_L87GZ.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-DQbxhEMd.js → diagram-UQ7AKVKN-nsrs3Fbz.js} +1 -1
- package/dist/{diagram-VX7I27RA-DITDIfGC.js → diagram-VX7I27RA-7ST9lEqP.js} +1 -1
- package/dist/{diagram-Z3DM3KII-Ct9_zo6F.js → diagram-Z3DM3KII-BnGte-HX.js} +1 -1
- package/dist/{ebnfDiagram-PWID7BFC-6cOntwfv.js → ebnfDiagram-PWID7BFC-zaKyJ1YL.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-CJiOER41.js → erDiagram-RLTQ6QDP-Cx7g95FZ.js} +1 -1
- package/dist/{error-banner-DGOrmBk5.js → error-banner-DkQNU4bn.js} +128 -128
- package/dist/{error-entries-BWmleiL0.js → error-entries-istW7Xbs.js} +589 -544
- package/dist/{feedback-button-D4eVjeNs.js → feedback-button-Zvm26aOQ.js} +107 -106
- package/dist/{flowDiagram-HODETNUW-1lPBEUuW.js → flowDiagram-HODETNUW-C7nIqaHP.js} +2 -2
- package/dist/{formats-qhBmYb0l.js → formats-CMa7L3E8.js} +1 -1
- package/dist/{glide-data-editor-ahfaPdFW.js → glide-data-editor-BE-GgVp4.js} +3 -3
- package/dist/{globals-m8oswz--.js → globals-Dbru-WLP.js} +1 -1
- package/dist/{html-to-image-B8hE6HIH.js → html-to-image-pPbR2cDx.js} +4512 -4464
- package/dist/{infoDiagram-27XIBGKW-C6K4tri5.js → infoDiagram-27XIBGKW-BTM_NXsn.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-DwcwgRNH.js → ishikawaDiagram-5VMMS53U-K0FZrlvv.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-E489OMdc.js → kanban-definition-UXKFOSKX-ftznOyrz.js} +1 -1
- package/dist/main.js +6595 -6186
- package/dist/{mermaid-DMPMkVqY.js → mermaid-CNgH43ED.js} +33 -33
- package/dist/{mindmap-definition-YA3MSWOX-DWHjasOp.js → mindmap-definition-YA3MSWOX-CmzbxKfM.js} +1 -1
- package/dist/{number-overlay-editor-C6klKzEr.js → number-overlay-editor-qvlPZ-l-.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-COjcPOZT.js → pegDiagram-XKGWAZYB-DfTAWfGE.js} +2 -2
- package/dist/{pieDiagram-E7YTZNPT-BHAVZ38h.js → pieDiagram-E7YTZNPT-_kGQstZj.js} +1 -1
- package/dist/{process-output-DZDL_j1a.js → process-output-BySO1nIs.js} +3 -3
- package/dist/{railroadDiagram-O6MQD6OU-94ThFyKX.js → railroadDiagram-O6MQD6OU-D41WmIff.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-CpF-Fxbb.js → requirementDiagram-BXWQKSXE-Bh53ZI3I.js} +1 -1
- package/dist/{reveal-component-DwnxPyVz.js → reveal-component-DQaegdcW.js} +4 -4
- package/dist/{sequenceDiagram-WJ2MYXX4-CvANK2x7.js → sequenceDiagram-WJ2MYXX4-DBX27dNm.js} +1 -1
- package/dist/{stateDiagram-D77RDMKH-WHuJ4mJL.js → stateDiagram-D77RDMKH-CSYz2IZi.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DbO7lwYq.js → stateDiagram-v2-MP3YSRHH-DVLvtOqn.js} +2 -2
- package/dist/{swimlanes-42K2YHIH-CS2s29Vo.js → swimlanes-42K2YHIH-D59N0ktA.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-CXaA1vQg.js → swimlanesDiagram-VR7AAH4N-CRgpmVSW.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-B-SQMg5h.js → timeline-definition-24CTP7MA-C_xIIZDM.js} +1 -1
- package/dist/toDate-5qPtZ6HL.js +94 -0
- package/dist/{vega-component-DwqGfN3_.js → vega-component-Bly2lDhz.js} +10 -10
- package/dist/{vennDiagram-4TSXK5OY-etEFgvaG.js → vennDiagram-4TSXK5OY-DlOf0Mjs.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-BEQN7g62.js → wardleyDiagram-VM6X3IG4-zD_2guVe.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-D8-e5Z0R.js → xychartDiagram-S5SC5T6Z-CA0Dy1ZM.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +35 -13
- package/src/__mocks__/requests.ts +0 -1
- package/src/components/editor/cell/__tests__/useRunCells.test.tsx +86 -101
- package/src/components/editor/cell/useRunCells.ts +38 -65
- package/src/components/editor/notebook-cell.tsx +32 -20
- package/src/components/editor/output/ansi-reduce.ts +7 -0
- package/src/core/ai/__tests__/staged-cells.test.ts +1 -1
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +2 -0
- package/src/core/cells/__tests__/cells.test.ts +0 -14
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +15 -0
- package/src/core/cells/__tests__/utils.test.ts +1 -1
- package/src/core/cells/add-missing-import.ts +2 -5
- package/src/core/cells/cell.ts +1 -0
- package/src/core/cells/cells.ts +1 -2
- package/src/core/executions/__tests__/atoms.test.ts +227 -43
- package/src/core/executions/__tests__/hooks.test.tsx +1 -2
- package/src/core/executions/__tests__/input.test.ts +86 -0
- package/src/core/executions/__tests__/run.test.ts +390 -0
- package/src/core/executions/__tests__/select.test.ts +105 -30
- package/src/core/executions/atoms.ts +186 -71
- package/src/core/executions/index.ts +7 -6
- package/src/core/executions/input.ts +55 -0
- package/src/core/executions/run.ts +120 -0
- package/src/core/executions/select.ts +59 -24
- package/src/core/islands/__tests__/bridge.test.ts +35 -54
- package/src/core/islands/bootstrap.ts +5 -1
- package/src/core/islands/bridge.ts +16 -28
- package/src/core/islands/components/IslandControls.tsx +15 -7
- package/src/core/islands/components/__tests__/IslandControls.test.tsx +36 -53
- package/src/core/islands/worker/worker.tsx +45 -19
- package/src/core/network/__tests__/requests-lazy.test.ts +14 -24
- package/src/core/network/__tests__/requests-toasting.test.tsx +7 -7
- package/src/core/network/requests-lazy.ts +2 -3
- package/src/core/network/requests-network.ts +0 -9
- package/src/core/network/requests-static.ts +0 -1
- package/src/core/network/requests-toasting.tsx +0 -1
- package/src/core/network/types.ts +0 -2
- package/src/core/notebook/replica/__tests__/fixtures.ts +17 -1
- package/src/core/notebook/replica/backend.ts +3 -1
- package/src/core/runtime/__tests__/runtime.test.ts +36 -0
- package/src/core/runtime/config.ts +36 -1
- package/src/core/runtime/runtime.ts +21 -1
- package/src/core/transports/static.ts +4 -3
- package/src/core/wasm/bridge.ts +0 -17
- package/dist/assets/__vite-browser-external-DzTYIHH_.js +0 -1
- package/dist/assets/worker-BH08I2Il.js +0 -171
- package/dist/static-state-Dtocd9UO.js +0 -68
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-BekOCQ3v.js";
|
|
|
7
7
|
import { t as l } from "./check-DCQEEsUn.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-efcK_v3t.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-6ZiU38At.js";
|
|
10
|
-
import { At as p, Ct as m,
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
10
|
+
import { At as p, Ct as m, Et as h, Ft as g, Mt as _, Rt as v, St as y, d as b, dn as x, jt as ee, ln as S, mn as te, pn as ne, un as re, vt as ie, yt as C } from "./use-restore-focus-DyrKLdSB.js";
|
|
11
|
+
import { n as ae } from "./toast-xEFvuGpt.js";
|
|
12
|
+
import { t as oe } from "./objects-DCmMvZtn.js";
|
|
13
13
|
import { t as w } from "./invariant-DLmrl-hA.js";
|
|
14
|
-
import {
|
|
15
|
-
import { t as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
14
|
+
import { a as se, f as ce, g as le, t as ue, v as de } from "./toDate-5qPtZ6HL.js";
|
|
15
|
+
import { t as fe } from "./purify.es-DmnrIjg4.js";
|
|
16
|
+
import { t as pe } from "./createReducer-DHfURLCk.js";
|
|
17
|
+
import { M as me, N as he, V as ge, g as _e } from "./dist-B_xgcU0N.js";
|
|
18
|
+
import { t as ve } from "./capabilities-BiN90k7v.js";
|
|
19
|
+
var ye = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,19 +29,19 @@ var xe = c("external-link", [
|
|
|
29
29
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
30
30
|
key: "a6xqqp"
|
|
31
31
|
}]
|
|
32
|
-
]),
|
|
32
|
+
]), be = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]), T = /* @__PURE__ */ e(i(), 1), E = f(),
|
|
35
|
+
}]]), T = /* @__PURE__ */ e(i(), 1), E = f(), xe = Object.defineProperty, D = (e, t) => xe(e, "name", {
|
|
36
36
|
value: t,
|
|
37
37
|
configurable: !0
|
|
38
|
-
}),
|
|
39
|
-
function
|
|
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] =
|
|
38
|
+
}), Se = "Checkbox", [Ce, we] = ne(Se), [Te, Ee] = Ce(Se);
|
|
39
|
+
function De(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] = re({
|
|
41
41
|
prop: n,
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
|
-
caller:
|
|
44
|
+
caller: Se
|
|
45
45
|
}), [m, h] = T.useState(null), [g, _] = T.useState(null), [v, y] = T.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
@@ -59,36 +59,36 @@ function ke(e) {
|
|
|
59
59
|
bubbleInput: g,
|
|
60
60
|
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0, E.jsx)(
|
|
62
|
+
return /* @__PURE__ */ (0, E.jsx)(Te, {
|
|
63
63
|
scope: t,
|
|
64
64
|
...x,
|
|
65
|
-
children:
|
|
65
|
+
children: Fe(d) ? d(x) : r
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
D(
|
|
69
|
-
var
|
|
70
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = Oe
|
|
68
|
+
D(De, "CheckboxProvider");
|
|
69
|
+
var Oe = "CheckboxTrigger", ke = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(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 } = Ee(Oe, e), g = r(a, d), _ = T.useRef(l);
|
|
71
71
|
return T.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
74
|
let t = /* @__PURE__ */ D(() => f(_.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0, E.jsx)(
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, E.jsx)(te.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
80
|
"aria-checked": O(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
|
-
"data-state":
|
|
82
|
+
"data-state": Ie(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
84
84
|
disabled: c,
|
|
85
85
|
value: s,
|
|
86
86
|
...i,
|
|
87
87
|
ref: g,
|
|
88
|
-
onKeyDown:
|
|
88
|
+
onKeyDown: x(t, (e) => {
|
|
89
89
|
e.key === "Enter" && e.preventDefault();
|
|
90
90
|
}),
|
|
91
|
-
onClick:
|
|
91
|
+
onClick: x(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
94
|
requestedChecked: O(l) ? !0 : !l,
|
|
@@ -96,9 +96,9 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
96
96
|
}), f((e) => O(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), Ae = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
|
|
100
100
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
101
|
-
return /* @__PURE__ */ (0, E.jsx)(
|
|
101
|
+
return /* @__PURE__ */ (0, E.jsx)(De, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,18 +108,18 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
108
108
|
name: r,
|
|
109
109
|
form: u,
|
|
110
110
|
value: c,
|
|
111
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(
|
|
111
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(ke, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0, E.jsx)(
|
|
115
|
+
}), e && /* @__PURE__ */ (0, E.jsx)(Pe, { __scopeCheckbox: n })] })
|
|
116
116
|
});
|
|
117
|
-
}, "Checkbox")),
|
|
118
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
119
|
-
return /* @__PURE__ */ (0, E.jsx)(
|
|
117
|
+
}, "Checkbox")), je = "CheckboxIndicator", Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = Ee(je, n);
|
|
119
|
+
return /* @__PURE__ */ (0, E.jsx)(S, {
|
|
120
120
|
present: r || O(a.checked) || a.checked === !0,
|
|
121
|
-
children: /* @__PURE__ */ (0, E.jsx)(
|
|
122
|
-
"data-state":
|
|
121
|
+
children: /* @__PURE__ */ (0, E.jsx)(te.span, {
|
|
122
|
+
"data-state": Ie(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
125
125
|
ref: t,
|
|
@@ -129,8 +129,8 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
|
-
}, "CheckboxIndicator")),
|
|
133
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } =
|
|
132
|
+
}, "CheckboxIndicator")), Ne = "CheckboxBubbleInput", Pe = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(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 } = Ee(Ne, e), _ = r(i, g), v = s(a), y = T.useRef(!1), b = T.useRef(c), ee = T.useRef(o), S = T.useRef(null);
|
|
134
134
|
T.useEffect(() => {
|
|
135
135
|
let e = h;
|
|
136
136
|
if (!e) return;
|
|
@@ -138,8 +138,8 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
138
138
|
if (!n) return;
|
|
139
139
|
let r = b.current !== c;
|
|
140
140
|
b.current = c;
|
|
141
|
-
let i = o !== null && o !==
|
|
142
|
-
if (
|
|
141
|
+
let i = o !== null && o !== ee.current;
|
|
142
|
+
if (ee.current = o, i) S.current = r ? null : o, r && (e.indeterminate = O(c), n.call(e, !O(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
144
|
let t = S.current;
|
|
145
145
|
S.current = null;
|
|
@@ -151,11 +151,11 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
151
151
|
c,
|
|
152
152
|
o
|
|
153
153
|
]);
|
|
154
|
-
let
|
|
155
|
-
return /* @__PURE__ */ (0, E.jsx)(
|
|
154
|
+
let ne = T.useRef(!O(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, E.jsx)(te.input, {
|
|
156
156
|
type: "checkbox",
|
|
157
157
|
"aria-hidden": !0,
|
|
158
|
-
defaultChecked: l ??
|
|
158
|
+
defaultChecked: l ?? ne.current,
|
|
159
159
|
required: u,
|
|
160
160
|
disabled: d,
|
|
161
161
|
name: f,
|
|
@@ -164,7 +164,7 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
166
|
ref: _,
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: x(t, (e) => {
|
|
168
168
|
y.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
@@ -178,25 +178,25 @@ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}, "CheckboxBubbleInput"));
|
|
181
|
-
function
|
|
181
|
+
function Fe(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
D(
|
|
184
|
+
D(Fe, "isFunction");
|
|
185
185
|
function O(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
188
|
D(O, "isIndeterminate");
|
|
189
|
-
function
|
|
189
|
+
function Ie(e) {
|
|
190
190
|
return O(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
191
|
}
|
|
192
|
-
D(
|
|
192
|
+
D(Ie, "getState");
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/core/executions/freshness.ts
|
|
195
|
-
var
|
|
195
|
+
var Le = {
|
|
196
196
|
sourceChanged: !1,
|
|
197
197
|
inputsChanged: !1
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Re(e) {
|
|
200
200
|
let t = /* @__PURE__ */ new Map();
|
|
201
201
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
202
202
|
let n = t.get(e.name);
|
|
@@ -204,8 +204,8 @@ function Be(e) {
|
|
|
204
204
|
}
|
|
205
205
|
return t;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
207
|
+
function ze(e) {
|
|
208
|
+
let t = Re(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
209
209
|
function i(e, n) {
|
|
210
210
|
let i = new Set(n).add(e.id);
|
|
211
211
|
for (let [n, a] of Object.entries(e.depends_on)) {
|
|
@@ -242,7 +242,7 @@ function Ve(e) {
|
|
|
242
242
|
}
|
|
243
243
|
return (t) => {
|
|
244
244
|
let n = e.results.get(t);
|
|
245
|
-
return n == null ?
|
|
245
|
+
return n == null ? Le : o(n, /* @__PURE__ */ new Set());
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
//#endregion
|
|
@@ -276,43 +276,53 @@ var k = class e {
|
|
|
276
276
|
};
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/core/executions/select.ts
|
|
279
|
-
function
|
|
279
|
+
function Be(e) {
|
|
280
280
|
let t = e.outcome;
|
|
281
281
|
return t === null ? null : t.kind;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Ve(e) {
|
|
284
284
|
return e === null ? null : k.parse(e).toMilliseconds();
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function He(e, t) {
|
|
287
287
|
let n = e.latest.get(t);
|
|
288
288
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
|
|
290
|
+
function Ue(e, t) {
|
|
291
|
+
let n = e.cells.get(t);
|
|
292
|
+
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
293
|
+
}
|
|
294
|
+
function We(e, t) {
|
|
295
|
+
if (!Ue(e, t)) return !1;
|
|
296
|
+
if (e.requested.has(t)) return !0;
|
|
297
|
+
let n = He(e.executions, t)?.record.run_id ?? e.results.get(t)?.run_id;
|
|
298
|
+
for (let r of e.executions.runs.values()) if (r.status !== "completed" && r.id !== n && r.cells.includes(t)) return !0;
|
|
299
|
+
return !1;
|
|
292
300
|
}
|
|
293
|
-
function
|
|
294
|
-
let n =
|
|
295
|
-
n !== null && n.record.status !== "completed" ? (
|
|
296
|
-
let
|
|
301
|
+
function Ge(e, t) {
|
|
302
|
+
let n = He(e.executions, t), r = e.results.get(t) ?? null, i = "idle", a = r === null ? null : Ve(r.started_at), o = !1;
|
|
303
|
+
n !== null && n.record.status !== "completed" ? (i = n.record.status, a = Ve(n.record.started_at) ?? a, o = n.record.outcome !== null) : We(e, t) && (i = "queued");
|
|
304
|
+
let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? k.parse(r.completed_at).since(k.parse(r.started_at)) : null;
|
|
297
305
|
return {
|
|
298
|
-
status:
|
|
306
|
+
status: i,
|
|
299
307
|
blocked: e.blocked.has(t),
|
|
300
|
-
outcome:
|
|
301
|
-
startedAt:
|
|
302
|
-
duration:
|
|
303
|
-
rendered:
|
|
308
|
+
outcome: s && r !== null ? Be(r) : null,
|
|
309
|
+
startedAt: a,
|
|
310
|
+
duration: c,
|
|
311
|
+
rendered: o
|
|
304
312
|
};
|
|
305
313
|
}
|
|
306
|
-
function
|
|
314
|
+
function Ke(e) {
|
|
307
315
|
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
308
316
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
317
|
+
function qe(e) {
|
|
318
|
+
return Ke(e).some((e) => e.record.status === "running");
|
|
311
319
|
}
|
|
312
|
-
function
|
|
313
|
-
let t =
|
|
314
|
-
for (let
|
|
315
|
-
|
|
320
|
+
function Je(e) {
|
|
321
|
+
let t = Ke(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
322
|
+
for (let t of e.executions.runs.values()) if (t.status !== "completed") for (let e of t.cells) r.add(e);
|
|
323
|
+
let i = 0;
|
|
324
|
+
for (let t of r) !n.has(t) && We(e, t) && (i += 1);
|
|
325
|
+
return t.length + i;
|
|
316
326
|
}
|
|
317
327
|
//#endregion
|
|
318
328
|
//#region src/core/executions/atoms.ts
|
|
@@ -320,32 +330,46 @@ var A = {
|
|
|
320
330
|
runs: /* @__PURE__ */ new Map(),
|
|
321
331
|
executions: /* @__PURE__ */ new Map(),
|
|
322
332
|
latest: /* @__PURE__ */ new Map()
|
|
323
|
-
}, j = /* @__PURE__ */ new Map(),
|
|
324
|
-
function
|
|
333
|
+
}, j = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Map(), Xe = /* @__PURE__ */ new Set(), Ze = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Map(), M = v(null), et = v(null);
|
|
334
|
+
function tt(e, t, n, r) {
|
|
325
335
|
return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
|
|
326
336
|
}
|
|
337
|
+
function nt(e) {
|
|
338
|
+
let t = e.get(m), n = t === null ? null : e.get(t.notebookAtom);
|
|
339
|
+
return t === null || n === null ? null : {
|
|
340
|
+
replica: t,
|
|
341
|
+
id: n.id
|
|
342
|
+
};
|
|
343
|
+
}
|
|
327
344
|
function rt(e, t) {
|
|
328
|
-
let n =
|
|
329
|
-
return n === null
|
|
330
|
-
notebook:
|
|
331
|
-
replica: n,
|
|
332
|
-
id: r.id
|
|
333
|
-
},
|
|
345
|
+
let n = nt(e);
|
|
346
|
+
return n === null ? null : {
|
|
347
|
+
notebook: n,
|
|
334
348
|
value: t
|
|
335
349
|
};
|
|
336
350
|
}
|
|
337
|
-
|
|
338
|
-
let
|
|
351
|
+
function it(e, t) {
|
|
352
|
+
let n = e.get(m);
|
|
353
|
+
if (n !== t.notebook.replica) return !1;
|
|
354
|
+
let r = e.get(n.notebookAtom);
|
|
355
|
+
return r === null || r.id === t.notebook.id;
|
|
356
|
+
}
|
|
357
|
+
var at = v((e) => {
|
|
358
|
+
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = tt(e(M), t, n, Xe);
|
|
359
|
+
return r.size === 0 ? Ze : new Set([...r].flatMap((e) => e.cells));
|
|
360
|
+
}), N = v((e) => {
|
|
361
|
+
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = t === null ? null : e(t.documentAtom);
|
|
339
362
|
return {
|
|
340
363
|
executions: t === null ? A : e(t.executionsAtom),
|
|
341
364
|
results: t === null ? j : e(t.resultsAtom),
|
|
342
|
-
|
|
343
|
-
|
|
365
|
+
cells: r?.cells ?? Ye,
|
|
366
|
+
requested: e(at),
|
|
367
|
+
blocked: tt(e(et), t, n, Qe)
|
|
344
368
|
};
|
|
345
|
-
}),
|
|
369
|
+
}), ot = v((e) => {
|
|
346
370
|
let t = e(m), n = t === null ? null : e(t.documentAtom);
|
|
347
371
|
return t === null || n === null ? {
|
|
348
|
-
cells:
|
|
372
|
+
cells: Ye,
|
|
349
373
|
executions: A,
|
|
350
374
|
results: j
|
|
351
375
|
} : {
|
|
@@ -353,50 +377,92 @@ var M = y((e) => {
|
|
|
353
377
|
executions: e(t.executionsAtom),
|
|
354
378
|
results: e(t.resultsAtom)
|
|
355
379
|
};
|
|
356
|
-
}),
|
|
357
|
-
|
|
380
|
+
}), st = v((e) => ze(e(ot))), ct = v(null);
|
|
381
|
+
v((e) => {
|
|
358
382
|
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
359
383
|
return {
|
|
360
384
|
executions: t === null ? A : e(t.executionsAtom),
|
|
361
385
|
results: t === null ? j : e(t.resultsAtom),
|
|
362
|
-
cleared:
|
|
386
|
+
cleared: tt(e(ct), t, n, $e)
|
|
363
387
|
};
|
|
364
388
|
});
|
|
365
|
-
var
|
|
389
|
+
var lt = v((e) => {
|
|
366
390
|
let t = e(m);
|
|
367
391
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
368
392
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
e
|
|
393
|
+
v((e) => qe(e(N).executions)), v((e) => Je(e(N)));
|
|
394
|
+
var ut = v((e) => {
|
|
395
|
+
let t = e(m);
|
|
396
|
+
if (t === null) return { refused: "No notebook is connected" };
|
|
397
|
+
if (e(t.connectionAtom).state === de.CLOSED) return { refused: "The notebook is disconnected" };
|
|
398
|
+
if (e(t.notebookAtom) === null) return "waiting";
|
|
399
|
+
let n = e(t.runtimeAtom);
|
|
400
|
+
if (n === null) return { refused: "The notebook has no runtime" };
|
|
401
|
+
switch (n.status) {
|
|
402
|
+
case "running": return "running";
|
|
403
|
+
case "failed": return { refused: n.message ?? "The runtime failed" };
|
|
404
|
+
default: return "waiting";
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
function dt(e) {
|
|
408
|
+
return new Promise((t, n) => {
|
|
409
|
+
let r = e.sub(ut, i);
|
|
410
|
+
function i() {
|
|
411
|
+
let i = e.get(ut);
|
|
412
|
+
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
413
|
+
}
|
|
414
|
+
i();
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
function ft(e, t) {
|
|
418
|
+
let n = nt(e);
|
|
419
|
+
if (n === null) return null;
|
|
420
|
+
let r = {
|
|
421
|
+
notebook: n,
|
|
422
|
+
cells: [...t]
|
|
423
|
+
}, i = e.get(M), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : Xe;
|
|
424
|
+
return e.set(M, {
|
|
425
|
+
notebook: n,
|
|
426
|
+
value: new Set(a).add(r)
|
|
427
|
+
}), r;
|
|
428
|
+
}
|
|
429
|
+
function pt(e, t) {
|
|
430
|
+
let n = e.get(M);
|
|
431
|
+
if (n === null || !n.value.has(t)) return;
|
|
432
|
+
let r = new Set(n.value);
|
|
433
|
+
r.delete(t), e.set(M, {
|
|
434
|
+
notebook: n.notebook,
|
|
435
|
+
value: r
|
|
436
|
+
});
|
|
372
437
|
}
|
|
373
|
-
function
|
|
374
|
-
let
|
|
375
|
-
|
|
376
|
-
|
|
438
|
+
function mt(e, t, n) {
|
|
439
|
+
let { replica: r } = t.notebook, i = e.sub(r.executionsAtom, a);
|
|
440
|
+
function a() {
|
|
441
|
+
(!it(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), pt(e, t));
|
|
442
|
+
}
|
|
443
|
+
a();
|
|
377
444
|
}
|
|
378
|
-
function
|
|
379
|
-
let r = e.get(
|
|
445
|
+
function ht(e, t, n) {
|
|
446
|
+
let r = e.get(N).blocked;
|
|
380
447
|
if (r.has(t) === n) return;
|
|
381
448
|
let i = new Set(r);
|
|
382
|
-
n ? i.add(t) : i.delete(t), e.set(
|
|
449
|
+
n ? i.add(t) : i.delete(t), e.set(et, rt(e, i));
|
|
383
450
|
}
|
|
384
|
-
function
|
|
385
|
-
|
|
386
|
-
t.status != null && ut(e, n, r), (r || t.output?.mimetype === "application/vnd.marimo+error") && lt(e, [n]);
|
|
451
|
+
function gt(e, t) {
|
|
452
|
+
t.status != null && ht(e, t.cell_id, t.status === "disabled-transitively");
|
|
387
453
|
}
|
|
388
454
|
//#endregion
|
|
389
455
|
//#region src/plugins/core/sanitize-html.ts
|
|
390
|
-
var
|
|
456
|
+
var _t = a(), vt = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
391
457
|
if (typeof document < "u") {
|
|
392
458
|
let e = "data-temp-href-target";
|
|
393
|
-
|
|
459
|
+
fe.addHook("beforeSanitizeAttributes", (t) => {
|
|
394
460
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
395
|
-
}),
|
|
461
|
+
}), fe.addHook("afterSanitizeAttributes", (t) => {
|
|
396
462
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
397
463
|
});
|
|
398
464
|
}
|
|
399
|
-
function
|
|
465
|
+
function yt(e) {
|
|
400
466
|
let t = {
|
|
401
467
|
USE_PROFILES: {
|
|
402
468
|
html: !0,
|
|
@@ -405,7 +471,7 @@ function mt(e) {
|
|
|
405
471
|
},
|
|
406
472
|
ADD_TAGS: ["use"],
|
|
407
473
|
ADD_ATTR: ["href", "xlink:href"],
|
|
408
|
-
ALLOWED_URI_REGEXP:
|
|
474
|
+
ALLOWED_URI_REGEXP: vt,
|
|
409
475
|
FORCE_BODY: !0,
|
|
410
476
|
CUSTOM_ELEMENT_HANDLING: {
|
|
411
477
|
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
@@ -413,59 +479,59 @@ function mt(e) {
|
|
|
413
479
|
},
|
|
414
480
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
415
481
|
};
|
|
416
|
-
return
|
|
482
|
+
return fe.sanitize(e, t);
|
|
417
483
|
}
|
|
418
484
|
//#endregion
|
|
419
485
|
//#region src/core/dom/outline.ts
|
|
420
|
-
var
|
|
486
|
+
var bt = [
|
|
421
487
|
"marimo-carousel",
|
|
422
488
|
"marimo-tabs",
|
|
423
489
|
"marimo-accordion",
|
|
424
490
|
"marimo-sidebar"
|
|
425
|
-
],
|
|
426
|
-
function
|
|
491
|
+
], xt = "h1, h2, h3, h4, h5, h6";
|
|
492
|
+
function St(e) {
|
|
427
493
|
if (typeof DOMParser > "u") return null;
|
|
428
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
494
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(xt);
|
|
429
495
|
for (let e of Array.from(n)) {
|
|
430
496
|
let n = e.textContent;
|
|
431
|
-
if (
|
|
497
|
+
if (bt.some((t) => e.closest(t)) || !n) continue;
|
|
432
498
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
433
499
|
name: n,
|
|
434
500
|
level: r,
|
|
435
|
-
by:
|
|
501
|
+
by: wt(e)
|
|
436
502
|
};
|
|
437
|
-
i !== n && (a.html =
|
|
503
|
+
i !== n && (a.html = yt(i)), t.push(a);
|
|
438
504
|
}
|
|
439
505
|
return { items: t };
|
|
440
506
|
}
|
|
441
|
-
function
|
|
507
|
+
function Ct(e) {
|
|
442
508
|
if (!e.includes("\"")) return `"${e}"`;
|
|
443
509
|
if (!e.includes("'")) return `'${e}'`;
|
|
444
510
|
let t = e.split("\""), n = [];
|
|
445
511
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
446
512
|
return `concat(${n.join(", ")})`;
|
|
447
513
|
}
|
|
448
|
-
function
|
|
514
|
+
function wt(e) {
|
|
449
515
|
let t = e.id;
|
|
450
516
|
if (t) return { id: t };
|
|
451
517
|
let n = e.textContent ?? "";
|
|
452
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
518
|
+
return { path: `//${e.tagName}[contains(., ${Ct(n)})]` };
|
|
453
519
|
}
|
|
454
|
-
function
|
|
520
|
+
function Tt(e) {
|
|
455
521
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
456
522
|
}
|
|
457
|
-
function
|
|
523
|
+
function Et(e) {
|
|
458
524
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
459
525
|
try {
|
|
460
|
-
return w(typeof e.data == "string", "expected string"),
|
|
526
|
+
return w(typeof e.data == "string", "expected string"), St(e.data);
|
|
461
527
|
} catch {
|
|
462
528
|
return t.error("Failed to parse outline"), null;
|
|
463
529
|
}
|
|
464
530
|
}
|
|
465
|
-
function
|
|
531
|
+
function Dt(e) {
|
|
466
532
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
467
533
|
}
|
|
468
|
-
function
|
|
534
|
+
function Ot(e, n) {
|
|
469
535
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
470
536
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
471
537
|
let a = r(i), o = e + 1;
|
|
@@ -478,17 +544,17 @@ function Ct(e, n) {
|
|
|
478
544
|
}
|
|
479
545
|
//#endregion
|
|
480
546
|
//#region src/core/codemirror/editing/commands.ts
|
|
481
|
-
function
|
|
547
|
+
function kt(e) {
|
|
482
548
|
return (t) => {
|
|
483
549
|
let n = !1;
|
|
484
550
|
for (let r of t) r && (n = e(r) || n);
|
|
485
551
|
return n;
|
|
486
552
|
};
|
|
487
553
|
}
|
|
488
|
-
var
|
|
554
|
+
var At = kt(_e), jt = kt(he);
|
|
489
555
|
//#endregion
|
|
490
556
|
//#region src/utils/schedule-task.ts
|
|
491
|
-
function
|
|
557
|
+
function Mt() {
|
|
492
558
|
let e = globalThis.scheduler;
|
|
493
559
|
if (typeof e?.postTask == "function") return (t) => {
|
|
494
560
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -509,10 +575,10 @@ function Dt() {
|
|
|
509
575
|
setTimeout(e, 0);
|
|
510
576
|
};
|
|
511
577
|
}
|
|
512
|
-
var
|
|
578
|
+
var Nt = Mt();
|
|
513
579
|
//#endregion
|
|
514
580
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
515
|
-
function
|
|
581
|
+
function Pt(e = Nt) {
|
|
516
582
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
517
583
|
function i() {
|
|
518
584
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -555,21 +621,21 @@ function kt(e = Ot) {
|
|
|
555
621
|
}
|
|
556
622
|
};
|
|
557
623
|
}
|
|
558
|
-
var
|
|
624
|
+
var Ft = Pt();
|
|
559
625
|
//#endregion
|
|
560
626
|
//#region src/core/mime.ts
|
|
561
|
-
function
|
|
627
|
+
function It(e) {
|
|
562
628
|
return e === "application/vnd.marimo+error";
|
|
563
629
|
}
|
|
564
|
-
function
|
|
630
|
+
function Lt(e) {
|
|
565
631
|
return e === "application/vnd.marimo+traceback";
|
|
566
632
|
}
|
|
567
|
-
function
|
|
568
|
-
return
|
|
633
|
+
function P(e) {
|
|
634
|
+
return It(e) || Lt(e);
|
|
569
635
|
}
|
|
570
636
|
//#endregion
|
|
571
637
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
572
|
-
var
|
|
638
|
+
var Rt = class e {
|
|
573
639
|
lines = [""];
|
|
574
640
|
cursor = {
|
|
575
641
|
row: 0,
|
|
@@ -658,7 +724,7 @@ var Nt = class e {
|
|
|
658
724
|
render() {
|
|
659
725
|
return this.lines.join("\n");
|
|
660
726
|
}
|
|
661
|
-
},
|
|
727
|
+
}, zt = class {
|
|
662
728
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
663
729
|
parse(e) {
|
|
664
730
|
let t = [], n = 0;
|
|
@@ -677,9 +743,9 @@ var Nt = class e {
|
|
|
677
743
|
value: e.slice(n)
|
|
678
744
|
}), t;
|
|
679
745
|
}
|
|
680
|
-
},
|
|
681
|
-
parser = new
|
|
682
|
-
buffer = new
|
|
746
|
+
}, Bt = class {
|
|
747
|
+
parser = new zt();
|
|
748
|
+
buffer = new Rt();
|
|
683
749
|
reduce(e) {
|
|
684
750
|
return this.reset(), this.append(e), this.render();
|
|
685
751
|
}
|
|
@@ -695,7 +761,7 @@ var Nt = class e {
|
|
|
695
761
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
696
762
|
}
|
|
697
763
|
reset() {
|
|
698
|
-
this.buffer = new
|
|
764
|
+
this.buffer = new Rt();
|
|
699
765
|
}
|
|
700
766
|
render() {
|
|
701
767
|
return this.buffer.render();
|
|
@@ -738,30 +804,32 @@ var Nt = class e {
|
|
|
738
804
|
for (let t of e) t >= " " && (n += t);
|
|
739
805
|
return n;
|
|
740
806
|
}
|
|
741
|
-
},
|
|
807
|
+
}, F = class e {
|
|
742
808
|
mimetype;
|
|
743
809
|
channel;
|
|
744
810
|
timestamp;
|
|
745
811
|
code;
|
|
746
812
|
id;
|
|
747
|
-
|
|
813
|
+
input_id;
|
|
814
|
+
ansiReducer = new Bt();
|
|
748
815
|
_data;
|
|
749
816
|
get data() {
|
|
750
817
|
return this._data;
|
|
751
818
|
}
|
|
752
819
|
static create(t) {
|
|
753
|
-
let n = new
|
|
820
|
+
let n = new Bt();
|
|
754
821
|
return n.append(t.data), new e({
|
|
755
822
|
mimetype: t.mimetype,
|
|
756
823
|
channel: t.channel,
|
|
757
824
|
timestamp: t.timestamp,
|
|
758
825
|
ansiReducer: n,
|
|
759
826
|
code: t.code,
|
|
760
|
-
id: t.id
|
|
827
|
+
id: t.id,
|
|
828
|
+
input_id: t.input_id
|
|
761
829
|
});
|
|
762
830
|
}
|
|
763
|
-
constructor({ mimetype: e, channel: t, timestamp: n, ansiReducer: r, code: i, id: a }) {
|
|
764
|
-
this.mimetype = e, this.channel = t, this.timestamp = n, this.code = i, this.id = a, this.ansiReducer = r, this._data = this.ansiReducer.render();
|
|
831
|
+
constructor({ mimetype: e, channel: t, timestamp: n, ansiReducer: r, code: i, id: a, input_id: o }) {
|
|
832
|
+
this.mimetype = e, this.channel = t, this.timestamp = n, this.code = i, this.id = a, this.input_id = o, this.ansiReducer = r, this._data = this.ansiReducer.render();
|
|
765
833
|
}
|
|
766
834
|
appendData(t) {
|
|
767
835
|
return this.ansiReducer.append(t), new e({
|
|
@@ -770,7 +838,8 @@ var Nt = class e {
|
|
|
770
838
|
timestamp: this.timestamp,
|
|
771
839
|
ansiReducer: this.ansiReducer,
|
|
772
840
|
code: this.code,
|
|
773
|
-
id: this.id
|
|
841
|
+
id: this.id,
|
|
842
|
+
input_id: this.input_id
|
|
774
843
|
});
|
|
775
844
|
}
|
|
776
845
|
toJSON() {
|
|
@@ -785,28 +854,28 @@ var Nt = class e {
|
|
|
785
854
|
};
|
|
786
855
|
//#endregion
|
|
787
856
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
788
|
-
function
|
|
857
|
+
function Vt(e, t = 5e3) {
|
|
789
858
|
let n = [...e];
|
|
790
|
-
if (n.length < 2) return
|
|
859
|
+
if (n.length < 2) return Kt(n.map(Ut), t);
|
|
791
860
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
792
|
-
return
|
|
861
|
+
return Ht(r, i) && (Gt(r), Gt(i), n[n.length - 2] = Wt(i, r), n.pop()), Kt(n, t);
|
|
793
862
|
}
|
|
794
|
-
function
|
|
863
|
+
function Ht(e, t) {
|
|
795
864
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
796
865
|
if (!n) return !1;
|
|
797
866
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
798
867
|
return n && r && i;
|
|
799
868
|
}
|
|
800
|
-
function
|
|
801
|
-
return e instanceof
|
|
869
|
+
function Ut(e) {
|
|
870
|
+
return e instanceof F ? e : typeof e.data == "string" ? F.create(e) : e;
|
|
802
871
|
}
|
|
803
|
-
function
|
|
804
|
-
return e instanceof
|
|
872
|
+
function Wt(e, t) {
|
|
873
|
+
return e instanceof F ? e.appendData(t.data) : F.create(e).appendData(t.data);
|
|
805
874
|
}
|
|
806
|
-
function
|
|
875
|
+
function Gt(e) {
|
|
807
876
|
w(typeof e.data == "string", "expected string output");
|
|
808
877
|
}
|
|
809
|
-
function
|
|
878
|
+
function Kt(e, t) {
|
|
810
879
|
let n = 0, r;
|
|
811
880
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
812
881
|
let t = e[r];
|
|
@@ -836,45 +905,46 @@ function Vt(e, t) {
|
|
|
836
905
|
}
|
|
837
906
|
//#endregion
|
|
838
907
|
//#region src/core/cells/cell.ts
|
|
839
|
-
function
|
|
908
|
+
function qt(e) {
|
|
840
909
|
return (e.at(-1)?.id ?? 0) + 1;
|
|
841
910
|
}
|
|
842
|
-
function
|
|
911
|
+
function Jt(e) {
|
|
843
912
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
844
913
|
}
|
|
845
|
-
function
|
|
914
|
+
function Yt(e, t) {
|
|
846
915
|
let n = { ...e };
|
|
847
|
-
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" &&
|
|
848
|
-
let r =
|
|
916
|
+
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Jt(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
917
|
+
let r = Jt(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
849
918
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
850
919
|
channel: e.channel,
|
|
851
920
|
mimetype: e.mimetype,
|
|
852
921
|
data: e.data,
|
|
853
922
|
timestamp: e.timestamp,
|
|
854
923
|
id: e.id,
|
|
924
|
+
input_id: e.input_id,
|
|
855
925
|
response: e.response ?? ""
|
|
856
926
|
} : e));
|
|
857
927
|
let a = t.console;
|
|
858
|
-
a != null && (i =
|
|
928
|
+
a != null && (i = Vt(Array.isArray(a) ? a.map((e, t) => ({
|
|
859
929
|
...e,
|
|
860
930
|
id: t + 1
|
|
861
931
|
})) : [...i, {
|
|
862
932
|
...a,
|
|
863
|
-
id:
|
|
864
|
-
}])), n.consoleOutputs = i, n.outline =
|
|
933
|
+
id: qt(i)
|
|
934
|
+
}])), n.consoleOutputs = i, n.outline = Et(n.output);
|
|
865
935
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
866
936
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
867
937
|
}
|
|
868
|
-
function
|
|
938
|
+
function Xt(e) {
|
|
869
939
|
return e === "running" || e === "queued";
|
|
870
940
|
}
|
|
871
|
-
function
|
|
941
|
+
function Zt(e, t, n) {
|
|
872
942
|
let { status: r, outcome: i, rendered: a } = e;
|
|
873
|
-
return
|
|
943
|
+
return Xt(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
874
944
|
}
|
|
875
945
|
//#endregion
|
|
876
946
|
//#region src/core/cells/columns.ts
|
|
877
|
-
function
|
|
947
|
+
function Qt(e) {
|
|
878
948
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
879
949
|
for (let r of e.order) {
|
|
880
950
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -882,9 +952,9 @@ function qt(e) {
|
|
|
882
952
|
}
|
|
883
953
|
return t;
|
|
884
954
|
}
|
|
885
|
-
function
|
|
955
|
+
function $t(e) {
|
|
886
956
|
let t = [[]];
|
|
887
|
-
for (let [n, r] of
|
|
957
|
+
for (let [n, r] of Qt(e)) {
|
|
888
958
|
for (; t.length <= r;) t.push([]);
|
|
889
959
|
t[r].push(n);
|
|
890
960
|
}
|
|
@@ -892,16 +962,16 @@ function Jt(e) {
|
|
|
892
962
|
}
|
|
893
963
|
//#endregion
|
|
894
964
|
//#region src/core/dom/ui-element-constants.ts
|
|
895
|
-
var
|
|
965
|
+
var en = "object-id", tn = "random-id", nn = "abcdefghijklmnopqrstuvwxyz", rn = nn + nn.toUpperCase(), an = /* @__PURE__ */ new Set(), I = "__scratch__", on = "setup", sn = { create() {
|
|
896
966
|
let e = 0, t;
|
|
897
967
|
do {
|
|
898
968
|
let n = "";
|
|
899
|
-
for (let e = 0; e < 4; e++) n +=
|
|
969
|
+
for (let e = 0; e < 4; e++) n += rn[Math.floor(Math.random() * 52)];
|
|
900
970
|
t = n, e++;
|
|
901
|
-
} while (
|
|
971
|
+
} while (an.has(t) && e < 100);
|
|
902
972
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
903
|
-
return
|
|
904
|
-
} },
|
|
973
|
+
return an.add(t), t;
|
|
974
|
+
} }, L = {
|
|
905
975
|
create(e) {
|
|
906
976
|
return w(e != null, "cellId is required"), `cell-${e}`;
|
|
907
977
|
},
|
|
@@ -914,7 +984,7 @@ var Yt = "object-id", Xt = "random-id", Zt = "abcdefghijklmnopqrstuvwxyz", Qt =
|
|
|
914
984
|
findElementThroughShadowDOMs(e) {
|
|
915
985
|
let t = e;
|
|
916
986
|
for (; t;) {
|
|
917
|
-
let e =
|
|
987
|
+
let e = L.findElement(t);
|
|
918
988
|
if (e) return e;
|
|
919
989
|
let n = t.getRootNode();
|
|
920
990
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -922,33 +992,33 @@ var Yt = "object-id", Xt = "random-id", Zt = "abcdefghijklmnopqrstuvwxyz", Qt =
|
|
|
922
992
|
return null;
|
|
923
993
|
}
|
|
924
994
|
};
|
|
925
|
-
function
|
|
926
|
-
let t = null, n =
|
|
927
|
-
return n && (t =
|
|
995
|
+
function cn(e) {
|
|
996
|
+
let t = null, n = L.findElementThroughShadowDOMs(e);
|
|
997
|
+
return n && (t = L.parse(n.id)), t;
|
|
928
998
|
}
|
|
929
|
-
var
|
|
999
|
+
var ln = {
|
|
930
1000
|
parse(e) {
|
|
931
|
-
return e.getAttribute(
|
|
1001
|
+
return e.getAttribute(en);
|
|
932
1002
|
},
|
|
933
1003
|
parseOrThrow(e) {
|
|
934
|
-
let t =
|
|
1004
|
+
let t = ln.parse(e);
|
|
935
1005
|
return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
936
1006
|
}
|
|
937
|
-
},
|
|
1007
|
+
}, un = { create(e) {
|
|
938
1008
|
return `output-${e}`;
|
|
939
|
-
} },
|
|
940
|
-
function
|
|
941
|
-
return `column-${
|
|
1009
|
+
} }, dn = v(/* @__PURE__ */ new Set()), R = v([]), z = v([]);
|
|
1010
|
+
function fn() {
|
|
1011
|
+
return `column-${sn.create()}`;
|
|
942
1012
|
}
|
|
943
|
-
var
|
|
944
|
-
let r =
|
|
1013
|
+
var pn = v(null, (e, t, n) => {
|
|
1014
|
+
let r = $t(n).length, i = e(R);
|
|
945
1015
|
if (i.length === r) return;
|
|
946
|
-
let a = e(
|
|
947
|
-
for (; o.length < r;) o.push(
|
|
948
|
-
t(
|
|
1016
|
+
let a = e(z), o = [...i, ...a].slice(0, r);
|
|
1017
|
+
for (; o.length < r;) o.push(fn());
|
|
1018
|
+
t(R, o), t(z, a.slice(Math.max(0, r - i.length)));
|
|
949
1019
|
});
|
|
950
|
-
function
|
|
951
|
-
return [...(e === null ? [[]] :
|
|
1020
|
+
function mn(e, t, n) {
|
|
1021
|
+
return [...(e === null ? [[]] : $t(e)).map((e, n) => ({
|
|
952
1022
|
id: t[n] ?? `column-${n}`,
|
|
953
1023
|
ids: e
|
|
954
1024
|
})), ...n.map((e) => ({
|
|
@@ -956,18 +1026,18 @@ function ln(e, t, n) {
|
|
|
956
1026
|
ids: []
|
|
957
1027
|
}))];
|
|
958
1028
|
}
|
|
959
|
-
function
|
|
1029
|
+
function hn(e, t, n) {
|
|
960
1030
|
let r = /* @__PURE__ */ new Map();
|
|
961
1031
|
return e.forEach((i, a) => {
|
|
962
1032
|
let o = t[a];
|
|
963
1033
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
964
|
-
let s =
|
|
1034
|
+
let s = Ot(a, t);
|
|
965
1035
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
966
1036
|
}), r;
|
|
967
1037
|
}
|
|
968
|
-
function
|
|
1038
|
+
function gn(e, t, n) {
|
|
969
1039
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
970
|
-
let i =
|
|
1040
|
+
let i = hn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
971
1041
|
return {
|
|
972
1042
|
id: e,
|
|
973
1043
|
ids: r,
|
|
@@ -976,52 +1046,52 @@ function dn(e, t, n) {
|
|
|
976
1046
|
};
|
|
977
1047
|
}) };
|
|
978
1048
|
}
|
|
979
|
-
var
|
|
980
|
-
let t = e(
|
|
981
|
-
return
|
|
982
|
-
}),
|
|
983
|
-
function
|
|
1049
|
+
var B = v((e) => {
|
|
1050
|
+
let t = e(y), n = t === null ? null : e(t.documentAtom), r = e(fi);
|
|
1051
|
+
return gn(mn(n, e(R), e(z)), (e) => r[e] ?? null, e(dn));
|
|
1052
|
+
}), _n = () => g(B), vn = v((e) => e(B).columns.length);
|
|
1053
|
+
function yn(e, t) {
|
|
984
1054
|
return e.columns.find((e) => e.id === t);
|
|
985
1055
|
}
|
|
986
|
-
function
|
|
1056
|
+
function bn(e, t) {
|
|
987
1057
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
988
1058
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
989
1059
|
return n;
|
|
990
1060
|
}
|
|
991
|
-
function
|
|
1061
|
+
function xn(e, t) {
|
|
992
1062
|
for (let n of e.columns) {
|
|
993
1063
|
let e = n.folds.get(t);
|
|
994
1064
|
if (e !== void 0) return e;
|
|
995
1065
|
}
|
|
996
1066
|
}
|
|
997
|
-
function
|
|
1067
|
+
function Sn(e, t) {
|
|
998
1068
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
999
1069
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
1000
1070
|
}
|
|
1001
|
-
function
|
|
1002
|
-
let n =
|
|
1003
|
-
return
|
|
1071
|
+
function Cn(e, t) {
|
|
1072
|
+
let n = Sn(e, t);
|
|
1073
|
+
return xn(e, t) === void 0 ? n : [...n, t];
|
|
1004
1074
|
}
|
|
1005
|
-
var
|
|
1006
|
-
function
|
|
1075
|
+
var wn = /* @__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("."));
|
|
1076
|
+
function Tn(e, t = !0) {
|
|
1007
1077
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
1008
1078
|
}
|
|
1009
|
-
function
|
|
1010
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1079
|
+
function En(e, t) {
|
|
1080
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !wn.has(e);
|
|
1011
1081
|
if (i(e)) return e;
|
|
1012
1082
|
let a = 1;
|
|
1013
1083
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1014
1084
|
return r;
|
|
1015
1085
|
}
|
|
1016
|
-
function
|
|
1017
|
-
return
|
|
1086
|
+
function Dn(e, t) {
|
|
1087
|
+
return On(e) ? `cell-${t}` : e;
|
|
1018
1088
|
}
|
|
1019
|
-
function
|
|
1089
|
+
function On(e) {
|
|
1020
1090
|
return !e || e === "_" || e === "__";
|
|
1021
1091
|
}
|
|
1022
1092
|
//#endregion
|
|
1023
1093
|
//#region src/core/cells/types.ts
|
|
1024
|
-
function
|
|
1094
|
+
function kn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1025
1095
|
return {
|
|
1026
1096
|
id: e,
|
|
1027
1097
|
config: r || {
|
|
@@ -1034,7 +1104,7 @@ function Tn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1034
1104
|
code: n
|
|
1035
1105
|
};
|
|
1036
1106
|
}
|
|
1037
|
-
function
|
|
1107
|
+
function An(e) {
|
|
1038
1108
|
return {
|
|
1039
1109
|
hide_code: !1,
|
|
1040
1110
|
disabled: !1,
|
|
@@ -1043,7 +1113,7 @@ function En(e) {
|
|
|
1043
1113
|
...e
|
|
1044
1114
|
};
|
|
1045
1115
|
}
|
|
1046
|
-
function
|
|
1116
|
+
function V(e) {
|
|
1047
1117
|
return {
|
|
1048
1118
|
outline: null,
|
|
1049
1119
|
output: null,
|
|
@@ -1054,8 +1124,8 @@ function z(e) {
|
|
|
1054
1124
|
}
|
|
1055
1125
|
//#endregion
|
|
1056
1126
|
//#region src/core/cells/document.ts
|
|
1057
|
-
function
|
|
1058
|
-
let n = t.code ?? e.code, r =
|
|
1127
|
+
function jn(e, t) {
|
|
1128
|
+
let n = t.code ?? e.code, r = _(e.config, t.config) ? e.config : An(t.config);
|
|
1059
1129
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
1060
1130
|
...e,
|
|
1061
1131
|
name: t.name,
|
|
@@ -1067,30 +1137,30 @@ function Dn(e, t) {
|
|
|
1067
1137
|
config: r
|
|
1068
1138
|
};
|
|
1069
1139
|
}
|
|
1070
|
-
function
|
|
1071
|
-
let n =
|
|
1140
|
+
function Mn(e, t) {
|
|
1141
|
+
let n = _(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1072
1142
|
for (let o of n) {
|
|
1073
1143
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
1074
1144
|
if (n === void 0) continue;
|
|
1075
1145
|
if (s === void 0) {
|
|
1076
1146
|
r = {
|
|
1077
1147
|
...r,
|
|
1078
|
-
[o]:
|
|
1148
|
+
[o]: kn({
|
|
1079
1149
|
id: o,
|
|
1080
1150
|
code: n.code ?? "",
|
|
1081
1151
|
name: n.name,
|
|
1082
|
-
config:
|
|
1152
|
+
config: An(n.config)
|
|
1083
1153
|
})
|
|
1084
1154
|
}, i = {
|
|
1085
1155
|
...i,
|
|
1086
|
-
[o]: i[o] ??
|
|
1156
|
+
[o]: i[o] ?? V()
|
|
1087
1157
|
}, a = {
|
|
1088
1158
|
...a,
|
|
1089
1159
|
[o]: (0, T.createRef)()
|
|
1090
1160
|
};
|
|
1091
1161
|
continue;
|
|
1092
1162
|
}
|
|
1093
|
-
let c =
|
|
1163
|
+
let c = jn(s, n);
|
|
1094
1164
|
c !== s && (r = {
|
|
1095
1165
|
...r,
|
|
1096
1166
|
[o]: c
|
|
@@ -1109,50 +1179,50 @@ function On(e, t) {
|
|
|
1109
1179
|
cellHandles: a
|
|
1110
1180
|
};
|
|
1111
1181
|
}
|
|
1112
|
-
function
|
|
1182
|
+
function Nn({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1113
1183
|
let i = () => {
|
|
1114
1184
|
let r = e.get(t.documentAtom);
|
|
1115
|
-
r !== null && (n(r), e.set(
|
|
1185
|
+
r !== null && (n(r), e.set(pn, r));
|
|
1116
1186
|
}, a = e.sub(t.documentAtom, i);
|
|
1117
1187
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1118
1188
|
}
|
|
1119
|
-
async function
|
|
1120
|
-
let e = C.get(
|
|
1189
|
+
async function Pn() {
|
|
1190
|
+
let e = C.get(y);
|
|
1121
1191
|
e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1122
1192
|
}
|
|
1123
1193
|
//#endregion
|
|
1124
1194
|
//#region src/core/cells/editor.ts
|
|
1125
|
-
var
|
|
1126
|
-
function
|
|
1195
|
+
var H = v(/* @__PURE__ */ new Set());
|
|
1196
|
+
function Fn(e, t, n) {
|
|
1127
1197
|
return !!e && !t.has(n);
|
|
1128
1198
|
}
|
|
1129
|
-
|
|
1130
|
-
t(
|
|
1131
|
-
}),
|
|
1199
|
+
v(null, (e, t, { cellId: n }) => {
|
|
1200
|
+
t(H, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
1201
|
+
}), v(null, (e, t, { cellId: n }) => e(H).has(n) ? (t(H, (e) => {
|
|
1132
1202
|
let t = new Set(e);
|
|
1133
1203
|
return t.delete(n), t;
|
|
1134
1204
|
}), !0) : !1);
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1137
|
-
t(
|
|
1205
|
+
var In = v(/* @__PURE__ */ new Map());
|
|
1206
|
+
v(null, (e, t, { cellId: n }) => {
|
|
1207
|
+
t(In, (e) => {
|
|
1138
1208
|
let t = new Map(e);
|
|
1139
1209
|
return t.delete(n), t;
|
|
1140
1210
|
});
|
|
1141
1211
|
});
|
|
1142
1212
|
//#endregion
|
|
1143
1213
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1144
|
-
function
|
|
1145
|
-
return
|
|
1214
|
+
function Ln(e, t) {
|
|
1215
|
+
return ue(e * 1e3, t?.in);
|
|
1146
1216
|
}
|
|
1147
1217
|
//#endregion
|
|
1148
1218
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1149
|
-
var
|
|
1219
|
+
var U = function(e, t) {
|
|
1150
1220
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1151
|
-
},
|
|
1221
|
+
}, W;
|
|
1152
1222
|
(function(e) {
|
|
1153
1223
|
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";
|
|
1154
|
-
})(
|
|
1155
|
-
var
|
|
1224
|
+
})(W ||= {});
|
|
1225
|
+
var Rn = class {
|
|
1156
1226
|
constructor() {
|
|
1157
1227
|
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 = {
|
|
1158
1228
|
http: 1,
|
|
@@ -1384,57 +1454,57 @@ var Pn = class {
|
|
|
1384
1454
|
}
|
|
1385
1455
|
get_next_packet() {
|
|
1386
1456
|
var e = {
|
|
1387
|
-
kind:
|
|
1457
|
+
kind: W.EOS,
|
|
1388
1458
|
text: "",
|
|
1389
1459
|
url: ""
|
|
1390
1460
|
}, t = this._buffer.length;
|
|
1391
1461
|
if (t == 0) return e;
|
|
1392
1462
|
var n = this._buffer.indexOf("\x1B");
|
|
1393
|
-
if (n == -1) return e.kind =
|
|
1394
|
-
if (n > 0) return e.kind =
|
|
1463
|
+
if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1464
|
+
if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1395
1465
|
if (n == 0) {
|
|
1396
|
-
if (t < 3) return e.kind =
|
|
1466
|
+
if (t < 3) return e.kind = W.Incomplete, e;
|
|
1397
1467
|
var r = this._buffer.charAt(1);
|
|
1398
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1468
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1399
1469
|
if (r == "[") {
|
|
1400
|
-
this._csi_regex ||=
|
|
1470
|
+
this._csi_regex ||= zn(Vn ||= U(["\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 "]));
|
|
1401
1471
|
let t = this._buffer.match(this._csi_regex);
|
|
1402
|
-
if (t === null) return e.kind =
|
|
1403
|
-
if (t[4]) return e.kind =
|
|
1404
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1472
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1473
|
+
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1474
|
+
e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
|
|
1405
1475
|
var i = t[0].length;
|
|
1406
1476
|
return this._buffer = this._buffer.slice(i), e;
|
|
1407
1477
|
}
|
|
1408
1478
|
if (r == "]") {
|
|
1409
|
-
if (t < 4) return e.kind =
|
|
1410
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1411
|
-
this._osc_st ||=
|
|
1479
|
+
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1480
|
+
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1481
|
+
this._osc_st ||= Bn(Hn ||= U(["\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;
|
|
1412
1482
|
{
|
|
1413
1483
|
let t = this._osc_st.exec(this._buffer);
|
|
1414
|
-
if (t === null) return e.kind =
|
|
1415
|
-
if (t[3]) return e.kind =
|
|
1484
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1485
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1416
1486
|
}
|
|
1417
1487
|
{
|
|
1418
1488
|
let t = this._osc_st.exec(this._buffer);
|
|
1419
|
-
if (t === null) return e.kind =
|
|
1420
|
-
if (t[3]) return e.kind =
|
|
1489
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1490
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1421
1491
|
}
|
|
1422
|
-
this._osc_regex ||=
|
|
1492
|
+
this._osc_regex ||= zn(Un ||= U(["\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 "]));
|
|
1423
1493
|
let n = this._buffer.match(this._osc_regex);
|
|
1424
|
-
if (n === null) return e.kind =
|
|
1425
|
-
e.kind =
|
|
1494
|
+
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1495
|
+
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
1426
1496
|
var i = n[0].length;
|
|
1427
1497
|
return this._buffer = this._buffer.slice(i), e;
|
|
1428
1498
|
}
|
|
1429
|
-
if (r == "(") return e.kind =
|
|
1499
|
+
if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1430
1500
|
}
|
|
1431
1501
|
}
|
|
1432
1502
|
ansi_to_html(e) {
|
|
1433
1503
|
this.append_buffer(e);
|
|
1434
1504
|
for (var t = [];;) {
|
|
1435
1505
|
var n = this.get_next_packet();
|
|
1436
|
-
if (n.kind ==
|
|
1437
|
-
n.kind !=
|
|
1506
|
+
if (n.kind == W.EOS || n.kind == W.Incomplete) break;
|
|
1507
|
+
n.kind != W.ESC && n.kind != W.Unknown && (n.kind == W.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == W.SGR ? this.process_ansi(n) : n.kind == W.OSCURL && t.push(this.process_hyperlink(n)));
|
|
1438
1508
|
}
|
|
1439
1509
|
return t.join("");
|
|
1440
1510
|
}
|
|
@@ -1504,16 +1574,16 @@ var Pn = class {
|
|
|
1504
1574
|
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>`;
|
|
1505
1575
|
}
|
|
1506
1576
|
};
|
|
1507
|
-
function
|
|
1577
|
+
function zn(e, ...t) {
|
|
1508
1578
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1509
1579
|
return new RegExp(n);
|
|
1510
1580
|
}
|
|
1511
|
-
function
|
|
1581
|
+
function Bn(e, ...t) {
|
|
1512
1582
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1513
1583
|
return new RegExp(n, "g");
|
|
1514
1584
|
}
|
|
1515
|
-
var
|
|
1516
|
-
function
|
|
1585
|
+
var Vn, Hn, Un, Wn = new Rn();
|
|
1586
|
+
function G(e) {
|
|
1517
1587
|
try {
|
|
1518
1588
|
let t = document.createElement("div");
|
|
1519
1589
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -1521,24 +1591,24 @@ function U(e) {
|
|
|
1521
1591
|
return t.error("Error parsing HTML content:", n), e;
|
|
1522
1592
|
}
|
|
1523
1593
|
}
|
|
1524
|
-
function
|
|
1594
|
+
function Gn(e) {
|
|
1525
1595
|
if (!e) return "";
|
|
1526
1596
|
try {
|
|
1527
|
-
return
|
|
1597
|
+
return G(Wn.ansi_to_html(e));
|
|
1528
1598
|
} catch (n) {
|
|
1529
1599
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1530
1600
|
}
|
|
1531
1601
|
}
|
|
1532
1602
|
//#endregion
|
|
1533
1603
|
//#region src/core/errors/traceback-atom.ts
|
|
1534
|
-
var
|
|
1604
|
+
var Kn = v(null);
|
|
1535
1605
|
//#endregion
|
|
1536
1606
|
//#region src/core/cells/logs.ts
|
|
1537
|
-
function
|
|
1607
|
+
function qn(e) {
|
|
1538
1608
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1539
1609
|
}
|
|
1540
|
-
var
|
|
1541
|
-
function
|
|
1610
|
+
var Jn = !1;
|
|
1611
|
+
function Yn(e) {
|
|
1542
1612
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1543
1613
|
for (let r of n) {
|
|
1544
1614
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1548,7 +1618,7 @@ function Gn(e) {
|
|
|
1548
1618
|
case "stdout":
|
|
1549
1619
|
case "stderr":
|
|
1550
1620
|
case "marimo-error": {
|
|
1551
|
-
let a = d.asString(r.data), o = i ?
|
|
1621
|
+
let a = d.asString(r.data), o = i ? G(a) : a;
|
|
1552
1622
|
t.push({
|
|
1553
1623
|
timestamp: r.timestamp || Date.now(),
|
|
1554
1624
|
level: n ? "stderr" : "stdout",
|
|
@@ -1563,9 +1633,9 @@ function Gn(e) {
|
|
|
1563
1633
|
}
|
|
1564
1634
|
}
|
|
1565
1635
|
}
|
|
1566
|
-
if (t.forEach(
|
|
1636
|
+
if (t.forEach(Xn.log), n.length === 0 && P(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1567
1637
|
e.output.data.forEach((t) => {
|
|
1568
|
-
|
|
1638
|
+
Xn.log({
|
|
1569
1639
|
level: "stderr",
|
|
1570
1640
|
source: {
|
|
1571
1641
|
type: "cell",
|
|
@@ -1575,18 +1645,18 @@ function Gn(e) {
|
|
|
1575
1645
|
message: JSON.stringify(t)
|
|
1576
1646
|
});
|
|
1577
1647
|
});
|
|
1578
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(
|
|
1579
|
-
if (t.length > 0 && !
|
|
1580
|
-
|
|
1648
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(ce) === "read";
|
|
1649
|
+
if (t.length > 0 && !Jn && n) {
|
|
1650
|
+
Jn = !0;
|
|
1581
1651
|
let e = t.find((e) => e.traceback);
|
|
1582
1652
|
o(e ? {
|
|
1583
1653
|
title: "An internal error occurred",
|
|
1584
1654
|
description: e.msg || "Click 'View' to see traceback",
|
|
1585
1655
|
variant: "danger",
|
|
1586
|
-
action: T.createElement(
|
|
1656
|
+
action: T.createElement(ae, {
|
|
1587
1657
|
altText: "View traceback",
|
|
1588
1658
|
onClick: () => {
|
|
1589
|
-
C.set(
|
|
1659
|
+
C.set(Kn, {
|
|
1590
1660
|
traceback: e.traceback,
|
|
1591
1661
|
errorMessage: e.msg || "An internal error occurred"
|
|
1592
1662
|
});
|
|
@@ -1601,13 +1671,13 @@ function Gn(e) {
|
|
|
1601
1671
|
}
|
|
1602
1672
|
return t;
|
|
1603
1673
|
}
|
|
1604
|
-
var
|
|
1674
|
+
var Xn = { log: (e) => {
|
|
1605
1675
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1606
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1676
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Zn(e.timestamp)}]`, `(${qn(e.source)}) ${e.message}`);
|
|
1607
1677
|
} };
|
|
1608
|
-
function
|
|
1678
|
+
function Zn(e) {
|
|
1609
1679
|
try {
|
|
1610
|
-
return
|
|
1680
|
+
return Ln(e).toLocaleTimeString(void 0, {
|
|
1611
1681
|
hour12: !0,
|
|
1612
1682
|
hour: "numeric",
|
|
1613
1683
|
minute: "numeric",
|
|
@@ -1619,14 +1689,14 @@ function qn(e) {
|
|
|
1619
1689
|
}
|
|
1620
1690
|
//#endregion
|
|
1621
1691
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1622
|
-
function
|
|
1623
|
-
let r = document.getElementById(
|
|
1624
|
-
r ?
|
|
1692
|
+
function Qn(e, n) {
|
|
1693
|
+
let r = document.getElementById(L.create(e));
|
|
1694
|
+
r ? er(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1625
1695
|
}
|
|
1626
|
-
function
|
|
1696
|
+
function $n() {
|
|
1627
1697
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1628
1698
|
}
|
|
1629
|
-
function
|
|
1699
|
+
function er(e, n) {
|
|
1630
1700
|
try {
|
|
1631
1701
|
e.focus(n);
|
|
1632
1702
|
} catch {
|
|
@@ -1635,7 +1705,7 @@ function Xn(e, n) {
|
|
|
1635
1705
|
}
|
|
1636
1706
|
//#endregion
|
|
1637
1707
|
//#region src/utils/timeout.ts
|
|
1638
|
-
function
|
|
1708
|
+
function tr(e, n) {
|
|
1639
1709
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1640
1710
|
if (o < r) {
|
|
1641
1711
|
try {
|
|
@@ -1650,76 +1720,76 @@ function Zn(e, n) {
|
|
|
1650
1720
|
}
|
|
1651
1721
|
//#endregion
|
|
1652
1722
|
//#region src/core/cells/utils.ts
|
|
1653
|
-
function
|
|
1654
|
-
return
|
|
1723
|
+
function nr(e, t, n) {
|
|
1724
|
+
return cr(e, t, n).length > 0;
|
|
1655
1725
|
}
|
|
1656
|
-
function
|
|
1726
|
+
function rr(e) {
|
|
1657
1727
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1658
1728
|
}
|
|
1659
|
-
function
|
|
1729
|
+
function ir(e) {
|
|
1660
1730
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1661
1731
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1662
1732
|
return r;
|
|
1663
1733
|
}
|
|
1664
|
-
function
|
|
1734
|
+
function ar(e) {
|
|
1665
1735
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1666
1736
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1667
1737
|
return r;
|
|
1668
1738
|
}
|
|
1669
|
-
function
|
|
1739
|
+
function or(e) {
|
|
1670
1740
|
return e.history.length > 0;
|
|
1671
1741
|
}
|
|
1672
|
-
function
|
|
1742
|
+
function sr(e) {
|
|
1673
1743
|
let t = e.history[e.history.length - 1];
|
|
1674
1744
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1675
1745
|
}
|
|
1676
|
-
function
|
|
1746
|
+
function cr(e, t, n) {
|
|
1677
1747
|
let { cellIds: r, cellData: i } = e;
|
|
1678
1748
|
return r.filter((e) => {
|
|
1679
|
-
let r =
|
|
1680
|
-
return r.status === "idle" ?
|
|
1749
|
+
let r = Ge(t, e);
|
|
1750
|
+
return r.status === "idle" ? ur(r) || dr({
|
|
1681
1751
|
freshness: n(e),
|
|
1682
1752
|
interrupted: r.outcome === "interrupted",
|
|
1683
1753
|
disabled: i[e].config.disabled,
|
|
1684
1754
|
blocked: r.blocked
|
|
1685
|
-
}) :
|
|
1755
|
+
}) : lr(t.executions, e) && n(e).sourceChanged;
|
|
1686
1756
|
});
|
|
1687
1757
|
}
|
|
1688
|
-
function
|
|
1758
|
+
function lr(e, t) {
|
|
1689
1759
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1690
1760
|
return r !== void 0 && r.status !== "completed";
|
|
1691
1761
|
}
|
|
1692
|
-
function
|
|
1762
|
+
function ur({ status: e, outcome: t }) {
|
|
1693
1763
|
return t === null && e !== "queued" && e !== "running";
|
|
1694
1764
|
}
|
|
1695
|
-
function
|
|
1765
|
+
function dr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
|
|
1696
1766
|
return e.sourceChanged || t || e.inputsChanged && !(n || r);
|
|
1697
1767
|
}
|
|
1698
|
-
function
|
|
1768
|
+
function fr({ errored: e, stopped: t }) {
|
|
1699
1769
|
return {
|
|
1700
1770
|
published: !0,
|
|
1701
1771
|
"has-error": e,
|
|
1702
1772
|
stopped: t
|
|
1703
1773
|
};
|
|
1704
1774
|
}
|
|
1705
|
-
function
|
|
1706
|
-
let a =
|
|
1775
|
+
function pr({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1776
|
+
let a = P(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1707
1777
|
return (e || t || n || a) && !o;
|
|
1708
1778
|
}
|
|
1709
1779
|
//#endregion
|
|
1710
1780
|
//#region src/core/network/requests.ts
|
|
1711
|
-
var
|
|
1712
|
-
function
|
|
1713
|
-
let e =
|
|
1781
|
+
var mr = v(null);
|
|
1782
|
+
function hr() {
|
|
1783
|
+
let e = g(mr);
|
|
1714
1784
|
return w(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1715
1785
|
}
|
|
1716
|
-
function
|
|
1717
|
-
let e = C.get(
|
|
1786
|
+
function gr() {
|
|
1787
|
+
let e = C.get(mr);
|
|
1718
1788
|
return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1719
1789
|
}
|
|
1720
1790
|
//#endregion
|
|
1721
1791
|
//#region src/utils/storage/storage.ts
|
|
1722
|
-
var
|
|
1792
|
+
var _r = class {
|
|
1723
1793
|
store = /* @__PURE__ */ new Map();
|
|
1724
1794
|
get length() {
|
|
1725
1795
|
return this.store.size;
|
|
@@ -1740,16 +1810,16 @@ var pr = class {
|
|
|
1740
1810
|
this.store.set(e, t);
|
|
1741
1811
|
}
|
|
1742
1812
|
};
|
|
1743
|
-
function
|
|
1744
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
1745
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1813
|
+
function vr() {
|
|
1814
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = ve();
|
|
1815
|
+
return e ? window.localStorage : t ? window.sessionStorage : new _r();
|
|
1746
1816
|
}
|
|
1747
|
-
var
|
|
1748
|
-
function
|
|
1749
|
-
return
|
|
1817
|
+
var yr = vr(), br = /(https?:\/\/[^\s"<>`{}|\\^]+)/, xr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Sr = /^data:image\//i, Cr = ["avatars.githubusercontent.com"];
|
|
1818
|
+
function wr(e) {
|
|
1819
|
+
return Sr.test(e) ? [{
|
|
1750
1820
|
type: "image",
|
|
1751
1821
|
url: e
|
|
1752
|
-
}] : e.split(
|
|
1822
|
+
}] : e.split(br).filter((e) => e !== "").map((e) => br.test(e) ? xr.test(e) || Sr.test(e) || Cr.some((t) => e.includes(t)) ? {
|
|
1753
1823
|
type: "image",
|
|
1754
1824
|
url: e
|
|
1755
1825
|
} : {
|
|
@@ -1762,48 +1832,48 @@ function br(e) {
|
|
|
1762
1832
|
}
|
|
1763
1833
|
//#endregion
|
|
1764
1834
|
//#region src/utils/json/json-parser.ts
|
|
1765
|
-
var
|
|
1835
|
+
var Tr = new RegExp(br.source, "g");
|
|
1766
1836
|
BigInt.prototype.toJSON = function() {
|
|
1767
1837
|
return JSON.rawJSON(this.toString());
|
|
1768
1838
|
};
|
|
1769
|
-
function
|
|
1839
|
+
function Er(e) {
|
|
1770
1840
|
try {
|
|
1771
|
-
return JSON.parse(e, (e, t) =>
|
|
1841
|
+
return JSON.parse(e, (e, t) => Ar(t));
|
|
1772
1842
|
} catch {}
|
|
1773
1843
|
if (e == null || e === "") return {};
|
|
1774
1844
|
try {
|
|
1775
|
-
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 :
|
|
1845
|
+
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 : Ar(t) : Ar(t));
|
|
1776
1846
|
} catch {
|
|
1777
1847
|
return {};
|
|
1778
1848
|
}
|
|
1779
1849
|
}
|
|
1780
|
-
function
|
|
1850
|
+
function Dr(e) {
|
|
1781
1851
|
if (e.length === 0) return "";
|
|
1782
1852
|
let t = Object.keys(e[0]);
|
|
1783
1853
|
return [
|
|
1784
1854
|
`| ${t.join(" | ")} |`,
|
|
1785
1855
|
`|${t.map(() => "---").join("|")}|`,
|
|
1786
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
1856
|
+
...e.map((e) => `| ${t.map((t) => Or(e[t])).join(" | ")} |`)
|
|
1787
1857
|
].join("\n");
|
|
1788
1858
|
}
|
|
1789
|
-
function
|
|
1859
|
+
function Or(e) {
|
|
1790
1860
|
if (e == null) return "";
|
|
1791
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
1861
|
+
if (Array.isArray(e) || typeof e == "object") return kr(JSON.stringify(e));
|
|
1792
1862
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1793
1863
|
t = t.replaceAll(n, (e) => {
|
|
1794
1864
|
let t = `__MDLINK_${i++}__`;
|
|
1795
1865
|
return r.set(t, e), t;
|
|
1796
|
-
}), t = t.replaceAll(
|
|
1866
|
+
}), t = t.replaceAll(Tr, "[$1]($1)");
|
|
1797
1867
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
1798
|
-
return
|
|
1868
|
+
return kr(t);
|
|
1799
1869
|
}
|
|
1800
|
-
function
|
|
1870
|
+
function kr(e) {
|
|
1801
1871
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1802
1872
|
}
|
|
1803
|
-
function
|
|
1873
|
+
function Ar(e) {
|
|
1804
1874
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1805
1875
|
}
|
|
1806
|
-
var
|
|
1876
|
+
var jr = new class {
|
|
1807
1877
|
getFilename() {
|
|
1808
1878
|
return this.getSearchParam("filename");
|
|
1809
1879
|
}
|
|
@@ -1830,39 +1900,39 @@ var Dr = new class {
|
|
|
1830
1900
|
}();
|
|
1831
1901
|
//#endregion
|
|
1832
1902
|
//#region src/core/dom/htmlUtils.ts
|
|
1833
|
-
function
|
|
1834
|
-
return
|
|
1903
|
+
function K(e) {
|
|
1904
|
+
return Er(e ?? "");
|
|
1835
1905
|
}
|
|
1836
|
-
function
|
|
1837
|
-
return
|
|
1906
|
+
function Mr(e) {
|
|
1907
|
+
return oe.mapValues(e.dataset, (e) => typeof e == "string" ? K(e) : e);
|
|
1838
1908
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let n = e.parentElement ?
|
|
1841
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
1909
|
+
function Nr(e, t) {
|
|
1910
|
+
let n = e.parentElement ? ln.parse(e.parentElement) : void 0;
|
|
1911
|
+
return n && t.has(n) ? t.lookupValue(n) : K(e.dataset.initialValue);
|
|
1842
1912
|
}
|
|
1843
|
-
function
|
|
1844
|
-
if (
|
|
1845
|
-
if (
|
|
1846
|
-
let e =
|
|
1913
|
+
function Pr() {
|
|
1914
|
+
if (b()) return document.title || null;
|
|
1915
|
+
if (se()) {
|
|
1916
|
+
let e = jr.getFilename();
|
|
1847
1917
|
if (e) return e;
|
|
1848
1918
|
}
|
|
1849
1919
|
let e = document.querySelector("marimo-filename");
|
|
1850
|
-
|
|
1920
|
+
le(e, "marimo-filename tag not found");
|
|
1851
1921
|
let t = e.innerHTML;
|
|
1852
1922
|
return t.length === 0 ? null : t;
|
|
1853
1923
|
}
|
|
1854
1924
|
//#endregion
|
|
1855
1925
|
//#region src/core/saving/file-state.ts
|
|
1856
|
-
var
|
|
1857
|
-
|
|
1858
|
-
var
|
|
1859
|
-
|
|
1926
|
+
var q = v(Pr());
|
|
1927
|
+
v(null);
|
|
1928
|
+
var Fr = v(null);
|
|
1929
|
+
v(void 0);
|
|
1860
1930
|
//#endregion
|
|
1861
1931
|
//#region src/utils/storage/typed.ts
|
|
1862
|
-
var
|
|
1932
|
+
var Ir = class {
|
|
1863
1933
|
defaultValue;
|
|
1864
1934
|
storage;
|
|
1865
|
-
constructor(e, t =
|
|
1935
|
+
constructor(e, t = yr) {
|
|
1866
1936
|
this.defaultValue = e, this.storage = t;
|
|
1867
1937
|
}
|
|
1868
1938
|
get(e) {
|
|
@@ -1879,11 +1949,11 @@ var Mr = class {
|
|
|
1879
1949
|
remove(e) {
|
|
1880
1950
|
this.storage.removeItem(e);
|
|
1881
1951
|
}
|
|
1882
|
-
},
|
|
1952
|
+
}, Lr = class {
|
|
1883
1953
|
schema;
|
|
1884
1954
|
getDefaultValue;
|
|
1885
1955
|
storage;
|
|
1886
|
-
constructor(e, t, n =
|
|
1956
|
+
constructor(e, t, n = yr) {
|
|
1887
1957
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1888
1958
|
}
|
|
1889
1959
|
get(e) {
|
|
@@ -1902,15 +1972,15 @@ var Mr = class {
|
|
|
1902
1972
|
remove(e) {
|
|
1903
1973
|
this.storage.removeItem(e);
|
|
1904
1974
|
}
|
|
1905
|
-
},
|
|
1975
|
+
}, Rr = class extends Lr {
|
|
1906
1976
|
filename;
|
|
1907
1977
|
unsubscribeFromFilename;
|
|
1908
1978
|
constructor(e, t, n) {
|
|
1909
|
-
let r = C.get(
|
|
1979
|
+
let r = C.get(q);
|
|
1910
1980
|
super(t, n), this.filename = r;
|
|
1911
1981
|
try {
|
|
1912
|
-
this.unsubscribeFromFilename = C.sub(
|
|
1913
|
-
let t = C.get(
|
|
1982
|
+
this.unsubscribeFromFilename = C.sub(q, () => {
|
|
1983
|
+
let t = C.get(q);
|
|
1914
1984
|
this.handleFilenameChange(e, t);
|
|
1915
1985
|
});
|
|
1916
1986
|
} catch {
|
|
@@ -1938,7 +2008,7 @@ var Mr = class {
|
|
|
1938
2008
|
dispose() {
|
|
1939
2009
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
1940
2010
|
}
|
|
1941
|
-
},
|
|
2011
|
+
}, J = {
|
|
1942
2012
|
VariableName: "VariableName",
|
|
1943
2013
|
FunctionDefinition: "FunctionDefinition",
|
|
1944
2014
|
ClassDefinition: "ClassDefinition",
|
|
@@ -1963,30 +2033,30 @@ var Mr = class {
|
|
|
1963
2033
|
Comment: "Comment",
|
|
1964
2034
|
String: "String",
|
|
1965
2035
|
FormatString: "FormatString"
|
|
1966
|
-
},
|
|
2036
|
+
}, Y = {
|
|
1967
2037
|
For: "for",
|
|
1968
2038
|
In: "in",
|
|
1969
2039
|
As: "as",
|
|
1970
2040
|
Import: "import"
|
|
1971
|
-
},
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
2041
|
+
}, zr = /* @__PURE__ */ new Set([
|
|
2042
|
+
J.FunctionDefinition,
|
|
2043
|
+
J.LambdaExpression,
|
|
2044
|
+
J.ArrayComprehensionExpression,
|
|
2045
|
+
J.SetComprehensionExpression,
|
|
2046
|
+
J.DictionaryComprehensionExpression,
|
|
2047
|
+
J.ComprehensionExpression,
|
|
2048
|
+
J.ClassDefinition
|
|
1979
2049
|
]);
|
|
1980
|
-
|
|
2050
|
+
J.Comment, J.String, J.FormatString;
|
|
1981
2051
|
//#endregion
|
|
1982
2052
|
//#region src/core/codemirror/utils.ts
|
|
1983
|
-
function
|
|
2053
|
+
function Br(e) {
|
|
1984
2054
|
e && e.dispatch({ selection: {
|
|
1985
2055
|
anchor: e.state.doc.length,
|
|
1986
2056
|
head: e.state.doc.length
|
|
1987
2057
|
} });
|
|
1988
2058
|
}
|
|
1989
|
-
function
|
|
2059
|
+
function Vr(e) {
|
|
1990
2060
|
let t = e.dom.closest(".marimo-cell");
|
|
1991
2061
|
t && requestAnimationFrame(() => {
|
|
1992
2062
|
t.scrollIntoView({
|
|
@@ -1998,29 +2068,29 @@ function Lr(e) {
|
|
|
1998
2068
|
}
|
|
1999
2069
|
//#endregion
|
|
2000
2070
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2001
|
-
var
|
|
2002
|
-
function
|
|
2071
|
+
var Hr = /* @__PURE__ */ new Set([J.ClassDefinition]);
|
|
2072
|
+
function Ur(e, t) {
|
|
2003
2073
|
requestAnimationFrame(() => {
|
|
2004
2074
|
e.focus(), e.dispatch({
|
|
2005
2075
|
selection: {
|
|
2006
2076
|
anchor: t,
|
|
2007
2077
|
head: t
|
|
2008
2078
|
},
|
|
2009
|
-
effects:
|
|
2079
|
+
effects: ge.scrollIntoView(t, { y: "center" })
|
|
2010
2080
|
});
|
|
2011
|
-
}),
|
|
2081
|
+
}), Vr(e);
|
|
2012
2082
|
}
|
|
2013
|
-
function
|
|
2014
|
-
let n =
|
|
2083
|
+
function Wr(e, t) {
|
|
2084
|
+
let n = me(e), r = null;
|
|
2015
2085
|
return n.iterate({ enter: (n) => {
|
|
2016
2086
|
if (r !== null) return !1;
|
|
2017
|
-
if (n.name ===
|
|
2018
|
-
if (n.name ===
|
|
2087
|
+
if (n.name === J.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2088
|
+
if (n.name === J.Comment || n.name === J.String) return !1;
|
|
2019
2089
|
} }), r;
|
|
2020
2090
|
}
|
|
2021
|
-
function
|
|
2091
|
+
function Gr(e, t) {
|
|
2022
2092
|
let n = [], r = e.resolveInner(t, 0);
|
|
2023
|
-
for (; r;)
|
|
2093
|
+
for (; r;) zr.has(r.name) && (n.some((e) => e.type === J.FunctionDefinition || e.type === J.LambdaExpression) && r.name === J.ClassDefinition || n.push({
|
|
2024
2094
|
id: r.from,
|
|
2025
2095
|
type: r.name
|
|
2026
2096
|
})), r = r.parent;
|
|
@@ -2029,70 +2099,70 @@ function Vr(e, t) {
|
|
|
2029
2099
|
type: "global"
|
|
2030
2100
|
}), n;
|
|
2031
2101
|
}
|
|
2032
|
-
function
|
|
2102
|
+
function X(e, t, n) {
|
|
2033
2103
|
e.push({
|
|
2034
2104
|
scopeId: t,
|
|
2035
2105
|
from: n
|
|
2036
2106
|
});
|
|
2037
2107
|
}
|
|
2038
|
-
function
|
|
2108
|
+
function Kr(e, t) {
|
|
2039
2109
|
if (e.firstChild()) do
|
|
2040
2110
|
t(e.node);
|
|
2041
2111
|
while (e.nextSibling());
|
|
2042
2112
|
}
|
|
2043
|
-
function
|
|
2113
|
+
function qr(e, t) {
|
|
2044
2114
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2045
2115
|
switch (e.name) {
|
|
2046
|
-
case
|
|
2047
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2116
|
+
case J.VariableName:
|
|
2117
|
+
n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
|
|
2048
2118
|
break;
|
|
2049
|
-
case
|
|
2050
|
-
case
|
|
2119
|
+
case J.TupleExpression:
|
|
2120
|
+
case J.ArrayExpression: {
|
|
2051
2121
|
let n = e.node.cursor();
|
|
2052
2122
|
n.firstChild();
|
|
2053
2123
|
do
|
|
2054
|
-
|
|
2124
|
+
qr(n, t);
|
|
2055
2125
|
while (n.nextSibling());
|
|
2056
2126
|
break;
|
|
2057
2127
|
}
|
|
2058
2128
|
}
|
|
2059
2129
|
}
|
|
2060
|
-
function
|
|
2130
|
+
function Jr(e, t) {
|
|
2061
2131
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2062
2132
|
o.firstChild();
|
|
2063
2133
|
do {
|
|
2064
|
-
if (o.name !==
|
|
2134
|
+
if (o.name !== J.ParamList) continue;
|
|
2065
2135
|
let e = o.node.cursor();
|
|
2066
2136
|
e.firstChild();
|
|
2067
2137
|
do
|
|
2068
|
-
e.name ===
|
|
2138
|
+
e.name === J.VariableName && n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
|
|
2069
2139
|
while (e.nextSibling());
|
|
2070
2140
|
} while (o.nextSibling());
|
|
2071
2141
|
}
|
|
2072
|
-
function
|
|
2142
|
+
function Yr(e, t) {
|
|
2073
2143
|
let n = e.cursor();
|
|
2074
2144
|
n.firstChild();
|
|
2075
2145
|
let r = !1;
|
|
2076
2146
|
do
|
|
2077
|
-
if (n.name ===
|
|
2078
|
-
else if (r && n.name ===
|
|
2079
|
-
else r &&
|
|
2147
|
+
if (n.name === Y.For) r = !0;
|
|
2148
|
+
else if (r && n.name === Y.In) break;
|
|
2149
|
+
else r && qr(n, t);
|
|
2080
2150
|
while (n.nextSibling());
|
|
2081
2151
|
}
|
|
2082
|
-
function
|
|
2083
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2152
|
+
function Xr(e, t) {
|
|
2153
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = zr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2084
2154
|
switch (s) {
|
|
2085
|
-
case
|
|
2086
|
-
case
|
|
2155
|
+
case J.FunctionDefinition:
|
|
2156
|
+
case J.ClassDefinition: {
|
|
2087
2157
|
let t = e.cursor();
|
|
2088
2158
|
t.firstChild();
|
|
2089
2159
|
do
|
|
2090
|
-
if (t.name ===
|
|
2091
|
-
|
|
2160
|
+
if (t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2161
|
+
X(a, i[i.length - 1] ?? -1, t.from);
|
|
2092
2162
|
break;
|
|
2093
2163
|
}
|
|
2094
2164
|
while (t.nextSibling());
|
|
2095
|
-
s ===
|
|
2165
|
+
s === J.FunctionDefinition && Jr(e, {
|
|
2096
2166
|
state: n,
|
|
2097
2167
|
variableName: r,
|
|
2098
2168
|
scopeId: c,
|
|
@@ -2100,38 +2170,38 @@ function Kr(e, t) {
|
|
|
2100
2170
|
});
|
|
2101
2171
|
break;
|
|
2102
2172
|
}
|
|
2103
|
-
case
|
|
2104
|
-
|
|
2173
|
+
case J.LambdaExpression:
|
|
2174
|
+
Jr(e, {
|
|
2105
2175
|
state: n,
|
|
2106
2176
|
variableName: r,
|
|
2107
2177
|
scopeId: c,
|
|
2108
2178
|
declarations: a
|
|
2109
2179
|
});
|
|
2110
2180
|
break;
|
|
2111
|
-
case
|
|
2112
|
-
case
|
|
2113
|
-
case
|
|
2114
|
-
case
|
|
2115
|
-
case
|
|
2116
|
-
|
|
2181
|
+
case J.ArrayComprehensionExpression:
|
|
2182
|
+
case J.DictionaryComprehensionExpression:
|
|
2183
|
+
case J.SetComprehensionExpression:
|
|
2184
|
+
case J.ComprehensionExpression:
|
|
2185
|
+
case J.ForStatement:
|
|
2186
|
+
Yr(e, {
|
|
2117
2187
|
state: n,
|
|
2118
2188
|
variableName: r,
|
|
2119
2189
|
scopeId: u,
|
|
2120
2190
|
declarations: a
|
|
2121
2191
|
});
|
|
2122
2192
|
break;
|
|
2123
|
-
case
|
|
2193
|
+
case J.AssignStatement: {
|
|
2124
2194
|
let t = [], i = e.cursor();
|
|
2125
2195
|
i.firstChild();
|
|
2126
2196
|
do
|
|
2127
|
-
i.name ===
|
|
2197
|
+
i.name === J.AssignOp && t.push(i.from);
|
|
2128
2198
|
while (i.nextSibling());
|
|
2129
2199
|
let o = t[t.length - 1];
|
|
2130
2200
|
if (o === void 0) break;
|
|
2131
2201
|
let s = e.cursor();
|
|
2132
2202
|
s.firstChild();
|
|
2133
2203
|
do
|
|
2134
|
-
s.from < o &&
|
|
2204
|
+
s.from < o && qr(s, {
|
|
2135
2205
|
state: n,
|
|
2136
2206
|
variableName: r,
|
|
2137
2207
|
scopeId: u,
|
|
@@ -2140,14 +2210,14 @@ function Kr(e, t) {
|
|
|
2140
2210
|
while (s.nextSibling());
|
|
2141
2211
|
break;
|
|
2142
2212
|
}
|
|
2143
|
-
case
|
|
2213
|
+
case J.ImportStatement: {
|
|
2144
2214
|
let t = e.cursor();
|
|
2145
2215
|
t.firstChild();
|
|
2146
2216
|
let i = !1, o = null, s = () => {
|
|
2147
|
-
o?.matches &&
|
|
2217
|
+
o?.matches && X(a, u, o.from), o = null;
|
|
2148
2218
|
};
|
|
2149
2219
|
do
|
|
2150
|
-
t.name ===
|
|
2220
|
+
t.name === Y.Import ? i = !0 : i && (t.name === Y.As ? o = null : t.name === J.VariableName ? (s(), o = {
|
|
2151
2221
|
from: t.from,
|
|
2152
2222
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2153
2223
|
}) : t.name === "," && s());
|
|
@@ -2155,19 +2225,19 @@ function Kr(e, t) {
|
|
|
2155
2225
|
s();
|
|
2156
2226
|
break;
|
|
2157
2227
|
}
|
|
2158
|
-
case
|
|
2159
|
-
case
|
|
2228
|
+
case J.TryStatement:
|
|
2229
|
+
case J.WithStatement: {
|
|
2160
2230
|
let t = e.cursor();
|
|
2161
2231
|
t.firstChild();
|
|
2162
2232
|
let i = !1;
|
|
2163
2233
|
do
|
|
2164
|
-
t.name ===
|
|
2234
|
+
t.name === Y.As ? i = !0 : i && t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r && (X(a, u, t.from), i = !1);
|
|
2165
2235
|
while (t.nextSibling());
|
|
2166
2236
|
break;
|
|
2167
2237
|
}
|
|
2168
2238
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2239
|
+
Kr(o, (e) => {
|
|
2240
|
+
Xr(e, {
|
|
2171
2241
|
state: n,
|
|
2172
2242
|
variableName: r,
|
|
2173
2243
|
scopeStack: l,
|
|
@@ -2175,95 +2245,69 @@ function Kr(e, t) {
|
|
|
2175
2245
|
});
|
|
2176
2246
|
});
|
|
2177
2247
|
}
|
|
2178
|
-
function
|
|
2179
|
-
let r =
|
|
2180
|
-
|
|
2248
|
+
function Zr(e, t, n) {
|
|
2249
|
+
let r = me(e), i = [];
|
|
2250
|
+
Xr(r, {
|
|
2181
2251
|
state: e,
|
|
2182
2252
|
variableName: t,
|
|
2183
2253
|
scopeStack: [],
|
|
2184
2254
|
declarations: i
|
|
2185
2255
|
});
|
|
2186
2256
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2187
|
-
for (let e of
|
|
2188
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2257
|
+
for (let e of Gr(r, a)) {
|
|
2258
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Hr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2189
2259
|
if (t) return t.from;
|
|
2190
2260
|
}
|
|
2191
2261
|
return null;
|
|
2192
2262
|
}
|
|
2193
|
-
function
|
|
2194
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2195
|
-
return i !== null && (
|
|
2196
|
-
}
|
|
2197
|
-
function Yr(e, t) {
|
|
2198
|
-
return zr(e, e.state.doc.line(t).from), !0;
|
|
2199
|
-
}
|
|
2200
|
-
//#endregion
|
|
2201
|
-
//#region src/core/notebook/replica/connection.ts
|
|
2202
|
-
var Y = {
|
|
2203
|
-
NOT_STARTED: "NOT_STARTED",
|
|
2204
|
-
CONNECTING: "CONNECTING",
|
|
2205
|
-
OPEN: "OPEN",
|
|
2206
|
-
CLOSING: "CLOSING",
|
|
2207
|
-
CLOSED: "CLOSED"
|
|
2208
|
-
}, Xr = {
|
|
2209
|
-
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
2210
|
-
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
2211
|
-
}, X = y({ state: Y.NOT_STARTED });
|
|
2212
|
-
h(null, (e, t) => t === null ? null : {
|
|
2213
|
-
phase: t.phase,
|
|
2214
|
-
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2215
|
-
});
|
|
2216
|
-
function Zr() {
|
|
2217
|
-
return oe(X, (e) => e.state === Y.OPEN);
|
|
2263
|
+
function Qr(e, t, n) {
|
|
2264
|
+
let { state: r } = e, i = n === void 0 ? Wr(r, t) : Zr(r, t, n);
|
|
2265
|
+
return i !== null && (Ur(e, i), !0);
|
|
2218
2266
|
}
|
|
2219
|
-
function
|
|
2220
|
-
return
|
|
2267
|
+
function $r(e, t) {
|
|
2268
|
+
return Ur(e, e.state.doc.line(t).from), !0;
|
|
2221
2269
|
}
|
|
2222
|
-
y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) => {
|
|
2223
|
-
let t = e(X);
|
|
2224
|
-
return t.state === Y.OPEN || t.state === Y.NOT_STARTED;
|
|
2225
|
-
}), y((e) => e(X).state === Y.CLOSED), y((e) => e(X).state === Y.NOT_STARTED);
|
|
2226
2270
|
//#endregion
|
|
2227
2271
|
//#region src/components/ui/checkbox.tsx
|
|
2228
|
-
var
|
|
2229
|
-
let r = (0,
|
|
2272
|
+
var ei = T.forwardRef((e, t) => {
|
|
2273
|
+
let r = (0, _t.c)(13), i, a;
|
|
2230
2274
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2231
2275
|
let o;
|
|
2232
2276
|
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);
|
|
2233
2277
|
let s;
|
|
2234
2278
|
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];
|
|
2235
2279
|
let c;
|
|
2236
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, E.jsx)(
|
|
2280
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, E.jsx)(Me, {
|
|
2237
2281
|
className: s,
|
|
2238
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, E.jsx)(
|
|
2282
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, E.jsx)(be, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, E.jsx)(l, { className: "h-4 w-4" })
|
|
2239
2283
|
}), r[6] = a.checked, r[7] = c);
|
|
2240
2284
|
let u;
|
|
2241
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, E.jsx)(
|
|
2285
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, E.jsx)(Ae, {
|
|
2242
2286
|
ref: t,
|
|
2243
2287
|
className: o,
|
|
2244
2288
|
...a,
|
|
2245
2289
|
children: c
|
|
2246
2290
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2247
2291
|
});
|
|
2248
|
-
|
|
2292
|
+
ei.displayName = Ae.displayName;
|
|
2249
2293
|
//#endregion
|
|
2250
2294
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2251
|
-
function
|
|
2295
|
+
function ti({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2252
2296
|
if (!n) return;
|
|
2253
|
-
let o = document.getElementById(
|
|
2297
|
+
let o = document.getElementById(L.create(e));
|
|
2254
2298
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2255
|
-
else if (
|
|
2299
|
+
else if ($n()) er(o);
|
|
2256
2300
|
else {
|
|
2257
|
-
if (r)
|
|
2301
|
+
if (r) er(o);
|
|
2258
2302
|
else {
|
|
2259
|
-
|
|
2303
|
+
Ft.promote(e);
|
|
2260
2304
|
let r = n.current?.editorView;
|
|
2261
2305
|
if (!r) {
|
|
2262
2306
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2263
2307
|
return;
|
|
2264
2308
|
}
|
|
2265
2309
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2266
|
-
if (
|
|
2310
|
+
if (tr(() => (r.focus(), r.hasFocus), {
|
|
2267
2311
|
retries: 5,
|
|
2268
2312
|
delay: 20
|
|
2269
2313
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2276,7 +2320,7 @@ function ei({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2276
2320
|
anchor: e.from,
|
|
2277
2321
|
head: e.from
|
|
2278
2322
|
} });
|
|
2279
|
-
} else a &&
|
|
2323
|
+
} else a && Qr(r, a);
|
|
2280
2324
|
}
|
|
2281
2325
|
o.scrollIntoView({
|
|
2282
2326
|
behavior: "smooth",
|
|
@@ -2284,21 +2328,21 @@ function ei({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2284
2328
|
});
|
|
2285
2329
|
}
|
|
2286
2330
|
}
|
|
2287
|
-
function
|
|
2331
|
+
function ni() {
|
|
2288
2332
|
let e = document.getElementById("App");
|
|
2289
2333
|
e?.scrollTo({
|
|
2290
2334
|
top: e.scrollHeight,
|
|
2291
2335
|
behavior: "smooth"
|
|
2292
2336
|
});
|
|
2293
2337
|
}
|
|
2294
|
-
function
|
|
2338
|
+
function ri() {
|
|
2295
2339
|
document.getElementById("App")?.scrollTo({
|
|
2296
2340
|
top: 0,
|
|
2297
2341
|
behavior: "smooth"
|
|
2298
2342
|
});
|
|
2299
2343
|
}
|
|
2300
|
-
function
|
|
2301
|
-
let t = document.getElementById(
|
|
2344
|
+
function ii(e) {
|
|
2345
|
+
let t = document.getElementById(L.create(e));
|
|
2302
2346
|
return t?.scrollIntoView({
|
|
2303
2347
|
behavior: "smooth",
|
|
2304
2348
|
block: "center"
|
|
@@ -2306,7 +2350,7 @@ function ri(e) {
|
|
|
2306
2350
|
}
|
|
2307
2351
|
//#endregion
|
|
2308
2352
|
//#region src/core/cells/cells.ts
|
|
2309
|
-
function
|
|
2353
|
+
function ai(e) {
|
|
2310
2354
|
let t = {
|
|
2311
2355
|
column: 0,
|
|
2312
2356
|
hide_code: !1,
|
|
@@ -2316,24 +2360,24 @@ function ii(e) {
|
|
|
2316
2360
|
return {
|
|
2317
2361
|
...e,
|
|
2318
2362
|
cellData: {
|
|
2319
|
-
[
|
|
2320
|
-
id:
|
|
2363
|
+
[I]: kn({
|
|
2364
|
+
id: I,
|
|
2321
2365
|
config: t
|
|
2322
2366
|
}),
|
|
2323
2367
|
...e.cellData
|
|
2324
2368
|
},
|
|
2325
2369
|
cellRuntime: {
|
|
2326
|
-
[
|
|
2370
|
+
[I]: V(),
|
|
2327
2371
|
...e.cellRuntime
|
|
2328
2372
|
},
|
|
2329
2373
|
cellHandles: {
|
|
2330
|
-
[
|
|
2374
|
+
[I]: (0, T.createRef)(),
|
|
2331
2375
|
...e.cellHandles
|
|
2332
2376
|
}
|
|
2333
2377
|
};
|
|
2334
2378
|
}
|
|
2335
|
-
function
|
|
2336
|
-
return
|
|
2379
|
+
function oi() {
|
|
2380
|
+
return ai({
|
|
2337
2381
|
cellIds: [],
|
|
2338
2382
|
cellData: {},
|
|
2339
2383
|
cellRuntime: {},
|
|
@@ -2343,7 +2387,7 @@ function ai() {
|
|
|
2343
2387
|
cellLogs: []
|
|
2344
2388
|
});
|
|
2345
2389
|
}
|
|
2346
|
-
var { reducer:
|
|
2390
|
+
var { reducer: si, createActions: ci, useActions: li, valueAtom: Z } = pe(oi, {
|
|
2347
2391
|
prepareForRun: (e, t) => Q({
|
|
2348
2392
|
state: e,
|
|
2349
2393
|
cellId: t.cellId,
|
|
@@ -2356,11 +2400,11 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2356
2400
|
let n = t.cell_id, r = Q({
|
|
2357
2401
|
state: e,
|
|
2358
2402
|
cellId: n,
|
|
2359
|
-
cellReducer: (e) =>
|
|
2403
|
+
cellReducer: (e) => Yt(e, t)
|
|
2360
2404
|
});
|
|
2361
2405
|
return {
|
|
2362
2406
|
...r,
|
|
2363
|
-
cellLogs: [...r.cellLogs, ...
|
|
2407
|
+
cellLogs: [...r.cellLogs, ...Yn(t)]
|
|
2364
2408
|
};
|
|
2365
2409
|
},
|
|
2366
2410
|
addLogs: (e, t) => ({
|
|
@@ -2368,8 +2412,8 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2368
2412
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2369
2413
|
}),
|
|
2370
2414
|
reconcileDocument: (e, t) => {
|
|
2371
|
-
let n =
|
|
2372
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2415
|
+
let n = Mn(e, t);
|
|
2416
|
+
for (let t of e.cellIds) t in n.cellData || wi(t);
|
|
2373
2417
|
return n;
|
|
2374
2418
|
},
|
|
2375
2419
|
setStdinResponse: (e, n) => {
|
|
@@ -2385,6 +2429,7 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2385
2429
|
data: r.data,
|
|
2386
2430
|
timestamp: r.timestamp,
|
|
2387
2431
|
id: r.id,
|
|
2432
|
+
input_id: r.input_id,
|
|
2388
2433
|
response: r.mimetype === "text/password" ? "" : i
|
|
2389
2434
|
}, {
|
|
2390
2435
|
...e,
|
|
@@ -2394,10 +2439,10 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2394
2439
|
});
|
|
2395
2440
|
},
|
|
2396
2441
|
resetCellRuntimes: (e) => {
|
|
2397
|
-
let t =
|
|
2398
|
-
for (let r of [...e.cellIds,
|
|
2442
|
+
let t = se(), n = { ...e.cellRuntime };
|
|
2443
|
+
for (let r of [...e.cellIds, I]) {
|
|
2399
2444
|
let i = e.cellRuntime[r];
|
|
2400
|
-
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i :
|
|
2445
|
+
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
|
|
2401
2446
|
}
|
|
2402
2447
|
return {
|
|
2403
2448
|
...e,
|
|
@@ -2408,10 +2453,10 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2408
2453
|
let t = e.scrollKey;
|
|
2409
2454
|
if (t === null) return e;
|
|
2410
2455
|
let n = t;
|
|
2411
|
-
return
|
|
2456
|
+
return ti({
|
|
2412
2457
|
cellId: n,
|
|
2413
2458
|
cell: e.cellHandles[n],
|
|
2414
|
-
isCodeHidden:
|
|
2459
|
+
isCodeHidden: Fn(e.cellData[n]?.config.hide_code, C.get(H), n),
|
|
2415
2460
|
codeFocus: void 0,
|
|
2416
2461
|
variableName: void 0
|
|
2417
2462
|
}), {
|
|
@@ -2419,8 +2464,8 @@ var { reducer: oi, createActions: si, useActions: ci, valueAtom: Z } = ue(ai, {
|
|
|
2419
2464
|
scrollKey: null
|
|
2420
2465
|
};
|
|
2421
2466
|
},
|
|
2422
|
-
foldAll: (e) => (
|
|
2423
|
-
unfoldAll: (e) => (
|
|
2467
|
+
foldAll: (e) => (At(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2468
|
+
unfoldAll: (e) => (jt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2424
2469
|
clearLogs: (e) => ({
|
|
2425
2470
|
...e,
|
|
2426
2471
|
cellLogs: []
|
|
@@ -2470,15 +2515,15 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2470
2515
|
}
|
|
2471
2516
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2472
2517
|
}
|
|
2473
|
-
var
|
|
2474
|
-
C.set(Z, (t) =>
|
|
2475
|
-
}).addLogs, $ =
|
|
2476
|
-
|
|
2477
|
-
var
|
|
2518
|
+
var ui = ci((e) => {
|
|
2519
|
+
C.set(Z, (t) => si(t, e));
|
|
2520
|
+
}).addLogs, $ = v((e) => e(Z).cellIds);
|
|
2521
|
+
v((e) => e($).length === 1), v((e) => ir(e(Z)).length > 0), v((e) => ar(e(Z)).length > 0), v((e) => or(e(Z))), v((e) => sr(e(Z))), v((e) => nr(e(Z), e(N), e(st)));
|
|
2522
|
+
var di = v((e) => {
|
|
2478
2523
|
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2479
2524
|
return t.map((e) => {
|
|
2480
2525
|
let t = n[e], { name: i } = r[e];
|
|
2481
|
-
if (
|
|
2526
|
+
if (P(t.output?.mimetype)) {
|
|
2482
2527
|
w(Array.isArray(t.output.data), "Expected array data");
|
|
2483
2528
|
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2484
2529
|
if (n.length > 0) return {
|
|
@@ -2492,90 +2537,90 @@ var ui = y((e) => {
|
|
|
2492
2537
|
}
|
|
2493
2538
|
return null;
|
|
2494
2539
|
}).filter(Boolean);
|
|
2495
|
-
}),
|
|
2540
|
+
}), fi = ie(v((e) => {
|
|
2496
2541
|
let t = {};
|
|
2497
|
-
for (let [n, r] of
|
|
2542
|
+
for (let [n, r] of oe.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2498
2543
|
return t;
|
|
2499
|
-
})),
|
|
2500
|
-
let t = e($), n = e(
|
|
2501
|
-
return
|
|
2544
|
+
})), pi = v((e) => {
|
|
2545
|
+
let t = e($), n = e(bi);
|
|
2546
|
+
return Tt(t.map((e) => n[e].outline));
|
|
2502
2547
|
});
|
|
2503
|
-
|
|
2504
|
-
var
|
|
2548
|
+
v((e) => e(di).length);
|
|
2549
|
+
var mi = ie(v((e) => {
|
|
2505
2550
|
let { cellIds: t, cellData: n } = e(Z);
|
|
2506
|
-
return
|
|
2551
|
+
return oe.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2507
2552
|
}));
|
|
2508
|
-
|
|
2509
|
-
var
|
|
2553
|
+
v((e) => e(Z).scrollKey);
|
|
2554
|
+
var hi = () => g($), gi = () => g(mi), _i = () => C.get(Z), vi = () => C.get(Z).cellIds, yi = () => {
|
|
2510
2555
|
let { cellIds: e, cellData: t } = C.get(Z);
|
|
2511
2556
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2512
2557
|
};
|
|
2513
|
-
|
|
2514
|
-
var
|
|
2515
|
-
|
|
2516
|
-
var
|
|
2517
|
-
function
|
|
2518
|
-
|
|
2519
|
-
}
|
|
2520
|
-
var
|
|
2558
|
+
ee(p(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2559
|
+
var bi = v((e) => e(Z).cellRuntime);
|
|
2560
|
+
v((e) => e(Z).cellIds.length > 0);
|
|
2561
|
+
var xi = h((e) => v((t) => t(Z).cellData[e])), Si = h((e) => v((t) => t(Z).cellRuntime[e])), Ci = h((e) => v((t) => t(Z).cellHandles[e]));
|
|
2562
|
+
function wi(e) {
|
|
2563
|
+
xi.remove(e), Si.remove(e), Ci.remove(e);
|
|
2564
|
+
}
|
|
2565
|
+
var Ti = (e) => {
|
|
2521
2566
|
let { cellHandles: t } = C.get(Z);
|
|
2522
2567
|
return t[e].current?.editorView;
|
|
2523
|
-
},
|
|
2524
|
-
function
|
|
2525
|
-
return
|
|
2568
|
+
}, Ei = (e) => (Ft.promote(e), Ti(e));
|
|
2569
|
+
function Di() {
|
|
2570
|
+
return li();
|
|
2526
2571
|
}
|
|
2527
2572
|
//#endregion
|
|
2528
2573
|
//#region src/core/errors/error-entries.ts
|
|
2529
|
-
function
|
|
2530
|
-
if (
|
|
2574
|
+
function Oi(e) {
|
|
2575
|
+
if (It(e.mimetype)) {
|
|
2531
2576
|
if (!Array.isArray(e.data)) return null;
|
|
2532
2577
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2533
2578
|
return t.length === 0 ? null : { errorData: t };
|
|
2534
2579
|
}
|
|
2535
|
-
return
|
|
2580
|
+
return Lt(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2536
2581
|
errorData: [],
|
|
2537
2582
|
tracebackHtml: e.data
|
|
2538
2583
|
} : null;
|
|
2539
2584
|
}
|
|
2540
|
-
function
|
|
2585
|
+
function ki(e) {
|
|
2541
2586
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2542
2587
|
}
|
|
2543
|
-
function
|
|
2544
|
-
let t = e?.find((e) =>
|
|
2588
|
+
function Ai(e) {
|
|
2589
|
+
let t = e?.find((e) => Lt(e.mimetype));
|
|
2545
2590
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
2546
2591
|
}
|
|
2547
|
-
function
|
|
2592
|
+
function ji(e, t) {
|
|
2548
2593
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2549
|
-
if (!
|
|
2594
|
+
if (!ki(e.errorData)) return Ai(t);
|
|
2550
2595
|
}
|
|
2551
|
-
function
|
|
2596
|
+
function Mi(e) {
|
|
2552
2597
|
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2553
2598
|
for (let [e, a] of t.entries()) {
|
|
2554
2599
|
let t = n[a], o = t.output;
|
|
2555
|
-
if (!o || !
|
|
2556
|
-
let s =
|
|
2600
|
+
if (!o || !P(o.mimetype)) continue;
|
|
2601
|
+
let s = Oi(o);
|
|
2557
2602
|
if (!s) continue;
|
|
2558
|
-
let c =
|
|
2603
|
+
let c = Dn(r[a].name, e), l = o.code ?? r[a].code;
|
|
2559
2604
|
i.push({
|
|
2560
2605
|
cellId: a,
|
|
2561
2606
|
cellName: c,
|
|
2562
2607
|
cellCode: l,
|
|
2563
2608
|
errorData: s.errorData,
|
|
2564
|
-
tracebackHtml:
|
|
2609
|
+
tracebackHtml: ji(s, t.consoleOutputs)
|
|
2565
2610
|
});
|
|
2566
2611
|
}
|
|
2567
2612
|
return i;
|
|
2568
2613
|
}
|
|
2569
|
-
function Mi(e) {
|
|
2570
|
-
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");
|
|
2571
|
-
}
|
|
2572
2614
|
function Ni(e) {
|
|
2573
|
-
|
|
2574
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${U(e.traceback)}`), t;
|
|
2615
|
+
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");
|
|
2575
2616
|
}
|
|
2576
2617
|
function Pi(e) {
|
|
2618
|
+
let t = Ni(e);
|
|
2619
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
2620
|
+
}
|
|
2621
|
+
function Fi(e) {
|
|
2577
2622
|
let t = [e.cellName];
|
|
2578
|
-
return e.tracebackHtml && t.push(
|
|
2623
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Pi).join("\n\n")), t.join("\n\n");
|
|
2579
2624
|
}
|
|
2580
2625
|
//#endregion
|
|
2581
|
-
export {
|
|
2626
|
+
export { In as $, Ir as A, Zt as At, yr as B, lt as Bt, ni as C, on as Ct, $r as D, tn as Dt, ei as E, en as Et, Mr as F, N as Ft, rr as G, ye as Gt, mr as H, pt as Ht, Nr as I, st as It, Qn as J, fr as K, Er as L, it as Lt, q as M, wt as Mt, Fr as N, yt as Nt, Br as O, Qt as Ot, K as P, mt as Pt, Fn as Q, Dr as R, gt as Rt, ti as S, I as St, ri as T, cn as Tt, hr as U, Ge as Ut, gr as V, dt as Vt, ur as W, be as Wt, G as X, Gn as Y, Rn as Z, si as _, vn as _t, ui as a, On as at, gi as b, un as bt, ci as c, R as ct, yi as d, yn as dt, H as et, vi as f, xn as ft, pi as g, fn as gt, Z as h, B as ht, Mi as i, En as it, Lr as j, Dt as jt, Rr as k, Xt as kt, Ei as l, bn as lt, oi as m, Sn as mt, Fi as n, Nn as nt, xi as o, Tn as ot, _i as p, Cn as pt, pr as q, Pi as r, Dn as rt, $ as s, dn as st, Ni as t, Pn as tt, Ti as u, z as ut, wi as v, _n as vt, ii as w, ln as wt, Di as x, L as xt, hi as y, sn as yt, wr as z, ft as zt };
|