@marimo-team/islands 0.26.1-dev108 → 0.26.1-dev118
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/{ErrorBoundary-BW4TciqU.js → ErrorBoundary-Gr2Kt5kj.js} +1 -1
- package/dist/{chat-ui-Be9X-W22.js → chat-ui-CMKYvKUz.js} +3 -3
- package/dist/{code-visibility-BKmktPMd.js → code-visibility-BFFe0rT7.js} +2 -2
- package/dist/{common-CSJAjJGa.js → common-7eNIhSN-.js} +4766 -4747
- package/dist/{data-grid-overlay-editor-DTibdR4H.js → data-grid-overlay-editor-B37-1-8n.js} +1 -1
- package/dist/{error-entries-23Z_1oDM.js → error-entries-B4LgfizR.js} +772 -751
- package/dist/{feedback-button-CPu5SV3b.js → feedback-button-CpQcgVuz.js} +3 -3
- package/dist/{formats-Y52bg800.js → formats-CeuXJ_1f.js} +32 -25
- package/dist/{glide-data-editor-CC9_NDNi.js → glide-data-editor-BxTlDHV5.js} +3 -3
- package/dist/{globals-BFlYTNoR.js → globals-ljOLdTJr.js} +1 -1
- package/dist/{html-to-image-Cw7o1IbE.js → html-to-image-CIkwg7mv.js} +1 -1
- package/dist/main.js +69 -66
- package/dist/{number-overlay-editor-qDcRKPE0.js → number-overlay-editor-DGKTstav.js} +1 -1
- package/dist/{process-output-DdBM0lmd.js → process-output-PS9YSLNu.js} +2 -2
- package/dist/{reveal-component-BE1xhtNc.js → reveal-component-BLJMkx2N.js} +2 -2
- package/dist/{useDeepCompareMemoize-Dn-ZJVTd.js → semaphore-8KhQouXt.js} +5 -15
- package/dist/style.css +1 -1
- package/dist/{vega-component-BIq0qzhQ.js → vega-component-CoJiBCaS.js} +11 -11
- package/package.json +1 -1
- package/src/__mocks__/executions.ts +1 -1
- package/src/__mocks__/intersection-observer.ts +5 -5
- package/src/components/editor/Output.tsx +3 -21
- package/src/components/editor/__tests__/cell-renders.test.tsx +327 -1
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +27 -0
- package/src/components/editor/actions/pair-with-agent-modal.tsx +8 -1
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +12 -20
- package/src/components/editor/ai/ai-completion-editor.tsx +391 -289
- package/src/components/editor/ai/completion-utils.ts +9 -7
- package/src/components/editor/cell/CellDeleteShoulder.tsx +82 -0
- package/src/components/editor/cell/DeleteButton.tsx +11 -2
- package/src/components/editor/cell/__tests__/CellDeleteShoulder.test.tsx +181 -0
- package/src/components/editor/cell/code/cell-editor.tsx +15 -25
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +26 -2
- package/src/components/editor/chrome/panels/logs-panel.tsx +27 -11
- package/src/components/editor/notebook-cell.tsx +20 -40
- package/src/components/editor/output/VegaOutput.tsx +35 -0
- package/src/components/find-replace/find-replace.tsx +1 -7
- package/src/core/ai/state.ts +6 -0
- package/src/core/cells/__tests__/cell-errors.test.tsx +179 -0
- package/src/core/cells/__tests__/cells.test.ts +34 -20
- package/src/core/cells/cell-log-chunks.ts +31 -0
- package/src/core/cells/cells.ts +34 -33
- package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +18 -15
- package/src/core/codemirror/find-replace/__tests__/search-highlight.test.ts +90 -2
- package/src/core/codemirror/find-replace/__tests__/unmounted-cells.test.ts +44 -10
- package/src/core/codemirror/find-replace/navigate.ts +4 -1
- package/src/core/codemirror/find-replace/search-highlight.ts +54 -58
- package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +1 -1
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +1 -1
- package/src/core/executions/__tests__/atoms.test.ts +0 -2
- package/src/core/executions/__tests__/output-lifecycle.test.ts +16 -0
- package/src/core/executions/atoms.ts +33 -36
- package/src/core/export/__tests__/output-snapshot.test.tsx +240 -0
- package/src/core/export/__tests__/output-subscription.test.tsx +79 -0
- package/src/core/export/hooks.ts +29 -13
- package/src/core/islands/__tests__/bridge.test.ts +2 -5
- package/src/core/notebook/replica/frame.ts +8 -2
- package/src/core/notebook/replica/index.ts +5 -1
- package/src/core/notebook/replica/once-per-frame.ts +4 -3
- package/src/core/notebook/replica/resources/executions.ts +16 -1
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +10 -1
- package/src/css/common.css +11 -0
- package/src/hooks/useFinePointer.ts +30 -0
- package/src/stories/log-viewer.stories.tsx +48 -44
- package/src/utils/shared-intersection-observer.ts +2 -1
|
@@ -7,18 +7,18 @@ import { f as c, h as l } from "./tooltip-D-9pDheN.js";
|
|
|
7
7
|
import { t as u } from "./check-BqF09bSG.js";
|
|
8
8
|
import { n as d, r as f } from "./assertNever-B9_7z-dW.js";
|
|
9
9
|
import { t as p } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
-
import { At as m, Bt as h, Cn as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { r as
|
|
16
|
-
import { t as
|
|
17
|
-
import { H as
|
|
18
|
-
import { a as
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
var
|
|
10
|
+
import { At as m, Bt as h, Cn as g, Ct as ee, Dt as _, Et as te, Ft as v, It as y, Sn as ne, Vt as b, Wt as x, bn as re, jt as S, p as ie, qt as C, vn as ae, wt as w, yn as oe, zt as T } from "./use-restore-focus-CCfk-ey2.js";
|
|
11
|
+
import { n as se } from "./toast-b3k4YxaT.js";
|
|
12
|
+
import { t as ce } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as E } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as le } from "./purify.es-DmnrIjg4.js";
|
|
15
|
+
import { r as ue } from "./arrays-DoQ-AILx.js";
|
|
16
|
+
import { t as de } from "./createReducer-CArOwUaJ.js";
|
|
17
|
+
import { H as fe, N as pe, P as me, _ as he } from "./dist-BIaGGUbU.js";
|
|
18
|
+
import { a as ge, i as _e, l as ve, u as ye } from "./static-state-D-aT9dOr.js";
|
|
19
|
+
import { t as be } from "./toDate-BZg-byuO.js";
|
|
20
|
+
import { t as xe } from "./capabilities-ba3Dyv8n.js";
|
|
21
|
+
var Se = l("external-link", [
|
|
22
22
|
["path", {
|
|
23
23
|
d: "M15 3h6v6",
|
|
24
24
|
key: "1q9fwt"
|
|
@@ -31,20 +31,20 @@ var Ce = l("external-link", [
|
|
|
31
31
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
32
32
|
key: "a6xqqp"
|
|
33
33
|
}]
|
|
34
|
-
]),
|
|
34
|
+
]), Ce = l("minus", [["path", {
|
|
35
35
|
d: "M5 12h14",
|
|
36
36
|
key: "1ays0h"
|
|
37
|
-
}]]),
|
|
37
|
+
}]]), D = /* @__PURE__ */ e(a(), 1), O = p(), we = Object.defineProperty, k = (e, t) => we(e, "name", {
|
|
38
38
|
value: t,
|
|
39
39
|
configurable: !0
|
|
40
|
-
}),
|
|
41
|
-
function
|
|
42
|
-
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] =
|
|
40
|
+
}), Te = "Checkbox", [Ee, De] = ne(Te), [Oe, ke] = Ee(Te);
|
|
41
|
+
function Ae(e) {
|
|
42
|
+
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] = oe({
|
|
43
43
|
prop: n,
|
|
44
44
|
defaultProp: i ?? !1,
|
|
45
45
|
onChange: c,
|
|
46
|
-
caller:
|
|
47
|
-
}), [m, h] =
|
|
46
|
+
caller: Te
|
|
47
|
+
}), [m, h] = D.useState(null), [g, ee] = D.useState(null), [_, te] = D.useState(null), v = !m || !!o || !!m.closest("form"), y = {
|
|
48
48
|
checked: f,
|
|
49
49
|
disabled: a,
|
|
50
50
|
setChecked: p,
|
|
@@ -53,54 +53,54 @@ function je(e) {
|
|
|
53
53
|
name: s,
|
|
54
54
|
form: o,
|
|
55
55
|
value: u,
|
|
56
|
-
userClick:
|
|
57
|
-
onUserClick:
|
|
56
|
+
userClick: _,
|
|
57
|
+
onUserClick: te,
|
|
58
58
|
required: l,
|
|
59
|
-
defaultChecked: !
|
|
60
|
-
isFormControl:
|
|
61
|
-
bubbleInput:
|
|
62
|
-
setBubbleInput:
|
|
59
|
+
defaultChecked: !A(i) && i,
|
|
60
|
+
isFormControl: v,
|
|
61
|
+
bubbleInput: g,
|
|
62
|
+
setBubbleInput: ee
|
|
63
63
|
};
|
|
64
|
-
return /* @__PURE__ */ (0,
|
|
64
|
+
return /* @__PURE__ */ (0, O.jsx)(Oe, {
|
|
65
65
|
scope: t,
|
|
66
|
-
...
|
|
67
|
-
children:
|
|
66
|
+
...y,
|
|
67
|
+
children: Re(d) ? d(y) : r
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } =
|
|
73
|
-
return
|
|
70
|
+
k(Ae, "CheckboxProvider");
|
|
71
|
+
var je = "CheckboxTrigger", Me = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...r }, a) {
|
|
72
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = ke(je, e), ee = i(a, d), _ = D.useRef(l);
|
|
73
|
+
return D.useEffect(() => {
|
|
74
74
|
let e = o?.form;
|
|
75
75
|
if (e) {
|
|
76
|
-
let t = /* @__PURE__ */
|
|
76
|
+
let t = /* @__PURE__ */ k(() => f(_.current), "reset");
|
|
77
77
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
78
78
|
}
|
|
79
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
79
|
+
}, [o, f]), /* @__PURE__ */ (0, O.jsx)(g.button, {
|
|
80
80
|
type: "button",
|
|
81
81
|
role: "checkbox",
|
|
82
|
-
"aria-checked":
|
|
82
|
+
"aria-checked": A(l) ? "mixed" : l,
|
|
83
83
|
"aria-required": u,
|
|
84
|
-
"data-state":
|
|
84
|
+
"data-state": ze(l),
|
|
85
85
|
"data-disabled": c ? "" : void 0,
|
|
86
86
|
disabled: c,
|
|
87
87
|
value: s,
|
|
88
88
|
...r,
|
|
89
|
-
ref:
|
|
90
|
-
onKeyDown:
|
|
89
|
+
ref: ee,
|
|
90
|
+
onKeyDown: re(t, (e) => {
|
|
91
91
|
e.key === "Enter" && e.preventDefault();
|
|
92
92
|
}),
|
|
93
|
-
onClick:
|
|
93
|
+
onClick: re(n, (e) => {
|
|
94
94
|
let t = e.isPropagationStopped();
|
|
95
95
|
p({
|
|
96
|
-
requestedChecked:
|
|
96
|
+
requestedChecked: A(l) ? !0 : !l,
|
|
97
97
|
hasConsumerStoppedPropagation: t
|
|
98
|
-
}), f((e) =>
|
|
98
|
+
}), f((e) => A(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
99
99
|
})
|
|
100
100
|
});
|
|
101
|
-
}, "CheckboxTrigger")),
|
|
101
|
+
}, "CheckboxTrigger")), Ne = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(function(e, t) {
|
|
102
102
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
103
|
-
return /* @__PURE__ */ (0,
|
|
103
|
+
return /* @__PURE__ */ (0, O.jsx)(Ae, {
|
|
104
104
|
__scopeCheckbox: n,
|
|
105
105
|
checked: i,
|
|
106
106
|
defaultChecked: a,
|
|
@@ -110,18 +110,18 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
|
|
|
110
110
|
name: r,
|
|
111
111
|
form: u,
|
|
112
112
|
value: c,
|
|
113
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
113
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, O.jsxs)(O.Fragment, { children: [/* @__PURE__ */ (0, O.jsx)(Me, {
|
|
114
114
|
...d,
|
|
115
115
|
ref: t,
|
|
116
116
|
__scopeCheckbox: n
|
|
117
|
-
}), e && /* @__PURE__ */ (0,
|
|
117
|
+
}), e && /* @__PURE__ */ (0, O.jsx)(Le, { __scopeCheckbox: n })] })
|
|
118
118
|
});
|
|
119
|
-
}, "Checkbox")),
|
|
120
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
121
|
-
return /* @__PURE__ */ (0,
|
|
122
|
-
present: r ||
|
|
123
|
-
children: /* @__PURE__ */ (0,
|
|
124
|
-
"data-state":
|
|
119
|
+
}, "Checkbox")), Pe = "CheckboxIndicator", Fe = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(function(e, t) {
|
|
120
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = ke(Pe, n);
|
|
121
|
+
return /* @__PURE__ */ (0, O.jsx)(ae, {
|
|
122
|
+
present: r || A(a.checked) || a.checked === !0,
|
|
123
|
+
children: /* @__PURE__ */ (0, O.jsx)(g.span, {
|
|
124
|
+
"data-state": ze(a.checked),
|
|
125
125
|
"data-disabled": a.disabled ? "" : void 0,
|
|
126
126
|
...i,
|
|
127
127
|
ref: t,
|
|
@@ -131,33 +131,33 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
|
|
|
131
131
|
}
|
|
132
132
|
})
|
|
133
133
|
});
|
|
134
|
-
}, "CheckboxIndicator")),
|
|
135
|
-
let { control: a, userClick: o, checked: s, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput:
|
|
136
|
-
|
|
134
|
+
}, "CheckboxIndicator")), Ie = "CheckboxBubbleInput", Le = /* @__PURE__ */ D.forwardRef(/* @__PURE__ */ k(function({ __scopeCheckbox: e, onClick: t, ...n }, r) {
|
|
135
|
+
let { control: a, userClick: o, checked: s, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: ee } = ke(Ie, e), _ = i(r, ee), te = c(a), v = D.useRef(!1), y = D.useRef(s), ne = D.useRef(o), b = D.useRef(null);
|
|
136
|
+
D.useEffect(() => {
|
|
137
137
|
let e = h;
|
|
138
138
|
if (!e) return;
|
|
139
139
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
140
140
|
if (!n) return;
|
|
141
|
-
let r =
|
|
142
|
-
|
|
143
|
-
let i = o !== null && o !==
|
|
144
|
-
if (
|
|
141
|
+
let r = y.current !== s;
|
|
142
|
+
y.current = s;
|
|
143
|
+
let i = o !== null && o !== ne.current;
|
|
144
|
+
if (ne.current = o, i) b.current = r ? null : o, r && (e.indeterminate = A(s), n.call(e, !A(s) && s)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
145
145
|
else if (r) {
|
|
146
|
-
let t =
|
|
147
|
-
|
|
146
|
+
let t = b.current;
|
|
147
|
+
b.current = null;
|
|
148
148
|
let r = t?.requestedChecked === s;
|
|
149
|
-
|
|
149
|
+
v.current = !0, e.indeterminate = A(s), n.call(e, !A(s) && s), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), v.current = !1;
|
|
150
150
|
}
|
|
151
151
|
}, [
|
|
152
152
|
h,
|
|
153
153
|
s,
|
|
154
154
|
o
|
|
155
155
|
]);
|
|
156
|
-
let
|
|
157
|
-
return /* @__PURE__ */ (0,
|
|
156
|
+
let x = D.useRef(!A(s) && s);
|
|
157
|
+
return /* @__PURE__ */ (0, O.jsx)(g.input, {
|
|
158
158
|
type: "checkbox",
|
|
159
159
|
"aria-hidden": !0,
|
|
160
|
-
defaultChecked: l ??
|
|
160
|
+
defaultChecked: l ?? x.current,
|
|
161
161
|
required: u,
|
|
162
162
|
disabled: d,
|
|
163
163
|
name: f,
|
|
@@ -165,13 +165,13 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
|
|
|
165
165
|
form: m,
|
|
166
166
|
...n,
|
|
167
167
|
tabIndex: -1,
|
|
168
|
-
ref:
|
|
169
|
-
onClick:
|
|
170
|
-
|
|
168
|
+
ref: _,
|
|
169
|
+
onClick: re(t, (e) => {
|
|
170
|
+
v.current && e.stopPropagation();
|
|
171
171
|
}),
|
|
172
172
|
style: {
|
|
173
173
|
...n.style,
|
|
174
|
-
...
|
|
174
|
+
...te,
|
|
175
175
|
position: "absolute",
|
|
176
176
|
pointerEvents: "none",
|
|
177
177
|
opacity: 0,
|
|
@@ -180,30 +180,30 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(
|
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
}, "CheckboxBubbleInput"));
|
|
183
|
-
function
|
|
183
|
+
function Re(e) {
|
|
184
184
|
return typeof e == "function";
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
function
|
|
186
|
+
k(Re, "isFunction");
|
|
187
|
+
function A(e) {
|
|
188
188
|
return e === "indeterminate";
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
function
|
|
192
|
-
return
|
|
190
|
+
k(A, "isIndeterminate");
|
|
191
|
+
function ze(e) {
|
|
192
|
+
return A(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
k(ze, "getState");
|
|
195
195
|
//#endregion
|
|
196
196
|
//#region src/plugins/core/sanitize-html.ts
|
|
197
|
-
var
|
|
197
|
+
var Be = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
198
198
|
if (typeof document < "u") {
|
|
199
199
|
let e = "data-temp-href-target";
|
|
200
|
-
|
|
200
|
+
le.addHook("beforeSanitizeAttributes", (t) => {
|
|
201
201
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
202
|
-
}),
|
|
202
|
+
}), le.addHook("afterSanitizeAttributes", (t) => {
|
|
203
203
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Ve(e) {
|
|
207
207
|
let t = {
|
|
208
208
|
USE_PROFILES: {
|
|
209
209
|
html: !0,
|
|
@@ -212,7 +212,7 @@ function He(e) {
|
|
|
212
212
|
},
|
|
213
213
|
ADD_TAGS: ["use"],
|
|
214
214
|
ADD_ATTR: ["href", "xlink:href"],
|
|
215
|
-
ALLOWED_URI_REGEXP:
|
|
215
|
+
ALLOWED_URI_REGEXP: Be,
|
|
216
216
|
FORCE_BODY: !0,
|
|
217
217
|
CUSTOM_ELEMENT_HANDLING: {
|
|
218
218
|
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
@@ -220,21 +220,21 @@ function He(e) {
|
|
|
220
220
|
},
|
|
221
221
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
222
222
|
};
|
|
223
|
-
return
|
|
223
|
+
return le.sanitize(e, t);
|
|
224
224
|
}
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/core/dom/outline.ts
|
|
227
|
-
var
|
|
227
|
+
var He = /* @__PURE__ */ new Set([
|
|
228
228
|
"h1",
|
|
229
229
|
"h2",
|
|
230
230
|
"h3",
|
|
231
231
|
"h4",
|
|
232
232
|
"h5",
|
|
233
233
|
"h6"
|
|
234
|
-
]),
|
|
235
|
-
function
|
|
234
|
+
]), Ue = [...He].join(", "), We = ":not(:is(marimo-carousel, marimo-tabs, marimo-accordion, marimo-sidebar) *)", Ge = `:is(${Ue})${We}`, Ke = `:is(${Ue}, [id])${We}`;
|
|
235
|
+
function qe(e) {
|
|
236
236
|
if (typeof DOMParser > "u") return null;
|
|
237
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
237
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Ge);
|
|
238
238
|
for (let e of n) {
|
|
239
239
|
let n = e.textContent;
|
|
240
240
|
if (!n) continue;
|
|
@@ -242,22 +242,22 @@ function Je(e) {
|
|
|
242
242
|
name: n,
|
|
243
243
|
level: r
|
|
244
244
|
};
|
|
245
|
-
e.id && (a.id = e.id), i !== n && (a.html =
|
|
245
|
+
e.id && (a.id = e.id), i !== n && (a.html = Ve(i)), t.push(a);
|
|
246
246
|
}
|
|
247
247
|
return { items: t };
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Je(e) {
|
|
250
250
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
251
251
|
try {
|
|
252
|
-
return
|
|
252
|
+
return E(typeof e.data == "string", "expected string"), qe(e.data);
|
|
253
253
|
} catch {
|
|
254
254
|
return n.error("Failed to parse outline"), null;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Ye(e) {
|
|
258
258
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function Xe(e, t) {
|
|
261
261
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = t[e];
|
|
262
262
|
if (i == null || i.items.length === 0) return n.warn("Failed to find a starting outline"), null;
|
|
263
263
|
let a = r(i), o = e + 1;
|
|
@@ -270,18 +270,18 @@ function Ze(e, t) {
|
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/core/notebook/replica/connection.ts
|
|
273
|
-
var
|
|
273
|
+
var j = {
|
|
274
274
|
NOT_STARTED: "NOT_STARTED",
|
|
275
275
|
CONNECTING: "CONNECTING",
|
|
276
276
|
OPEN: "OPEN",
|
|
277
277
|
CLOSED: "CLOSED"
|
|
278
|
-
},
|
|
278
|
+
}, Ze = {
|
|
279
279
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
280
280
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
281
281
|
};
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/core/notebook/replica/execution-state.ts
|
|
284
|
-
function
|
|
284
|
+
function M(e) {
|
|
285
285
|
let { state: t } = e.record;
|
|
286
286
|
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
287
287
|
kind: "output",
|
|
@@ -291,18 +291,18 @@ function j(e) {
|
|
|
291
291
|
media: e.output.media
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function N(e) {
|
|
295
295
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function P(e) {
|
|
298
298
|
return e.state.status === "completed" ? e.state.completed_at : null;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function Qe(e) {
|
|
301
301
|
return e.state.status === "completed" ? e.state.depends_on : {};
|
|
302
302
|
}
|
|
303
303
|
//#endregion
|
|
304
304
|
//#region src/core/notebook/replica/resources/results.ts
|
|
305
|
-
function
|
|
305
|
+
function $e(e, t) {
|
|
306
306
|
let { record: n, output: r, outputVersion: i } = t, a = n.cell_id;
|
|
307
307
|
return a === null || n.state.status !== "completed" || !e.has(a) || n.state.outcome.kind === "skipped" && n.state.outcome.reason === "superseded" ? e : new Map(e).set(a, {
|
|
308
308
|
record: n,
|
|
@@ -310,10 +310,10 @@ function et(e, t) {
|
|
|
310
310
|
outputVersion: i
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function et(e, t) {
|
|
314
314
|
let { record: n, output: r, outputVersion: i } = t;
|
|
315
|
-
if (n.cell_id !== null ||
|
|
316
|
-
let a = (e) => Date.parse(
|
|
315
|
+
if (n.cell_id !== null || M(t) === null) return e;
|
|
316
|
+
let a = (e) => Date.parse(P(e) ?? N(e) ?? "1970-01-01T00:00:00Z");
|
|
317
317
|
return e !== null && a(e.record) > a(n) ? e : {
|
|
318
318
|
record: n,
|
|
319
319
|
output: r,
|
|
@@ -322,7 +322,7 @@ function tt(e, t) {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/core/notebook/replica/resources/executions.ts
|
|
325
|
-
function
|
|
325
|
+
function tt(e) {
|
|
326
326
|
let { state: t } = e;
|
|
327
327
|
return t.status === "completed" && t.outcome.kind === "failed" && t.outcome.message !== null ? {
|
|
328
328
|
runId: e.id,
|
|
@@ -330,49 +330,49 @@ function nt(e) {
|
|
|
330
330
|
completedAt: t.completed_at
|
|
331
331
|
} : void 0;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function nt(e) {
|
|
334
334
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function F(e, t) {
|
|
337
337
|
if (!e.has(t)) return e;
|
|
338
338
|
let n = new Map(e);
|
|
339
339
|
return n.delete(t), n;
|
|
340
340
|
}
|
|
341
|
-
function
|
|
342
|
-
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a =
|
|
341
|
+
function rt(e, t) {
|
|
342
|
+
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = N(t.record);
|
|
343
343
|
if (i !== null || a === null) return n;
|
|
344
344
|
if (!n || n.record.id === r) return t;
|
|
345
345
|
let o = e.executions.get(r);
|
|
346
|
-
return o &&
|
|
346
|
+
return o && N(o.record) !== null ? n : Date.parse(a) >= Date.parse(N(n.record) ?? "") ? t : n;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function it(e, t) {
|
|
349
349
|
let { id: n } = t.record;
|
|
350
350
|
return {
|
|
351
351
|
...e,
|
|
352
352
|
executions: new Map(e.executions).set(n, t),
|
|
353
|
-
scratchConsole:
|
|
353
|
+
scratchConsole: rt(e, t)
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function at(e, t) {
|
|
357
357
|
let n = e.executions.get(t);
|
|
358
358
|
if (n === void 0) return e.pendingItems?.has(t) ? {
|
|
359
359
|
...e,
|
|
360
|
-
pendingItems:
|
|
360
|
+
pendingItems: F(e.pendingItems, t)
|
|
361
361
|
} : e;
|
|
362
|
-
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t, a =
|
|
362
|
+
let r = n.record.cell_id, i = r !== null && e.latest.get(r) === t, a = F(e.executions, t), o = e.latest;
|
|
363
363
|
if (i) {
|
|
364
364
|
let t = e.results.get(r);
|
|
365
|
-
o = t && a.has(t.record.id) ? new Map(o).set(r, t.record.id) :
|
|
365
|
+
o = t && a.has(t.record.id) ? new Map(o).set(r, t.record.id) : F(o, r);
|
|
366
366
|
}
|
|
367
367
|
return {
|
|
368
368
|
...e,
|
|
369
369
|
executions: a,
|
|
370
370
|
latest: o,
|
|
371
|
-
variables: i ?
|
|
371
|
+
variables: i ? F(e.variables, r) : e.variables,
|
|
372
372
|
scratchConsole: e.scratchConsole?.record.id === t ? void 0 : e.scratchConsole
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function ot(e, t) {
|
|
376
376
|
let n = new Map(e.items), r = e.lastSeq ?? -1, i;
|
|
377
377
|
for (let a of t) {
|
|
378
378
|
let o = n.get(a.id);
|
|
@@ -391,15 +391,15 @@ function st(e, t) {
|
|
|
391
391
|
items: n
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
for (let n of e.executions.values()) if (n.items.has(t)) return
|
|
394
|
+
function st(e, t) {
|
|
395
|
+
for (let n of e.executions.values()) if (n.items.has(t)) return it(e, {
|
|
396
396
|
...n,
|
|
397
397
|
append: void 0,
|
|
398
|
-
items:
|
|
398
|
+
items: F(n.items, t)
|
|
399
399
|
});
|
|
400
|
-
return
|
|
400
|
+
return ut(e, t);
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function ct(e, t, n) {
|
|
403
403
|
let r = t.record.cell_id;
|
|
404
404
|
if (r === null) return e;
|
|
405
405
|
let i = new Map(e.variables.get(r)).set(n.id, n);
|
|
@@ -408,17 +408,17 @@ function lt(e, t, n) {
|
|
|
408
408
|
variables: new Map(e.variables).set(r, i)
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function lt(e, t) {
|
|
412
412
|
for (let [n, r] of e.variables) if (r.has(t)) {
|
|
413
413
|
let i = new Map(e.variables);
|
|
414
|
-
return r.size === 1 ? i.delete(n) : i.set(n,
|
|
414
|
+
return r.size === 1 ? i.delete(n) : i.set(n, F(r, t)), {
|
|
415
415
|
...e,
|
|
416
416
|
variables: i
|
|
417
417
|
};
|
|
418
418
|
}
|
|
419
|
-
return
|
|
419
|
+
return ut(e, t);
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function ut(e, t) {
|
|
422
422
|
for (let [n, r] of e.pendingItems ?? []) if (r.some((e) => e.id === t)) {
|
|
423
423
|
let i = r.filter((e) => e.id !== t), a = new Map(e.pendingItems);
|
|
424
424
|
return i.length === 0 ? a.delete(n) : a.set(n, i), {
|
|
@@ -428,17 +428,18 @@ function dt(e, t) {
|
|
|
428
428
|
}
|
|
429
429
|
return e;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
432
|
-
|
|
431
|
+
function dt(e, t) {
|
|
432
|
+
let n = M(e), r = M(t);
|
|
433
|
+
return n === r ? !0 : n === null || r === null || n.kind !== r.kind ? !1 : n.kind === "output" && r.kind === "output" ? n.media === r.media || n.media?.mimetype === r.media?.mimetype && n.media?.data === r.media?.data : JSON.stringify(n) === JSON.stringify(r);
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
+
function ft(e, t) {
|
|
435
436
|
return {
|
|
436
|
-
...
|
|
437
|
-
results:
|
|
438
|
-
scratch:
|
|
437
|
+
...it(e, t),
|
|
438
|
+
results: $e(e.results, t),
|
|
439
|
+
scratch: et(e.scratch, t)
|
|
439
440
|
};
|
|
440
441
|
}
|
|
441
|
-
function
|
|
442
|
+
function I(e, t, n) {
|
|
442
443
|
let r = t.execution_id, i = e.executions.get(r);
|
|
443
444
|
if (i === void 0) {
|
|
444
445
|
if (n === "live") return e;
|
|
@@ -448,24 +449,24 @@ function F(e, t, n) {
|
|
|
448
449
|
pendingItems: new Map(e.pendingItems).set(r, [...i, t])
|
|
449
450
|
};
|
|
450
451
|
}
|
|
451
|
-
if ("kind" in t) return
|
|
452
|
-
if ("revision" in t) return
|
|
452
|
+
if ("kind" in t) return it(e, ot(i, [t]));
|
|
453
|
+
if ("revision" in t) return ct(e, i, t);
|
|
453
454
|
let a = {
|
|
454
455
|
...i,
|
|
455
456
|
output: t
|
|
456
457
|
};
|
|
457
|
-
return
|
|
458
|
+
return ft(e, {
|
|
458
459
|
...a,
|
|
459
|
-
outputVersion: i.outputVersion + +!
|
|
460
|
+
outputVersion: i.outputVersion + +!dt(i, a)
|
|
460
461
|
});
|
|
461
462
|
}
|
|
462
|
-
function
|
|
463
|
+
function pt(e, t, n) {
|
|
463
464
|
let r = new Map(e.executions);
|
|
464
465
|
for (let [e, n] of r) {
|
|
465
466
|
let i = n.record.cell_id === null ? t.scratch : t.results.get(n.record.cell_id), a = t.executions.get(e) ?? (i?.record.id === e ? i : void 0);
|
|
466
467
|
a !== void 0 && r.set(e, {
|
|
467
468
|
...n,
|
|
468
|
-
outputVersion: a.outputVersion + +!
|
|
469
|
+
outputVersion: a.outputVersion + +!dt(a, n)
|
|
469
470
|
});
|
|
470
471
|
}
|
|
471
472
|
let i = new Map(e.results);
|
|
@@ -483,10 +484,10 @@ function mt(e, t, n) {
|
|
|
483
484
|
executions: r,
|
|
484
485
|
results: i,
|
|
485
486
|
scratchConsole: e.scratchConsole ?? (t.scratchConsole?.record.state.status === "completed" && t.scratchConsole.record.runtime_id === n ? t.scratchConsole : void 0),
|
|
486
|
-
scratch: a == null ? t.scratch :
|
|
487
|
+
scratch: a == null ? t.scratch : et(t.scratch, a)
|
|
487
488
|
};
|
|
488
489
|
}
|
|
489
|
-
var
|
|
490
|
+
var mt = {
|
|
490
491
|
initial: {
|
|
491
492
|
runs: /* @__PURE__ */ new Map(),
|
|
492
493
|
executions: /* @__PURE__ */ new Map(),
|
|
@@ -499,7 +500,7 @@ var ht = {
|
|
|
499
500
|
cell: (e, { data: { cell: t } }, { phase: n }) => {
|
|
500
501
|
if (e.results.has(t.id)) return e;
|
|
501
502
|
let r = new Map(e.results).set(t.id, null);
|
|
502
|
-
if (n !== "live" && e.latest.has(t.id)) for (let n of e.executions.values()) n.record.cell_id === t.id && (r =
|
|
503
|
+
if (n !== "live" && e.latest.has(t.id)) for (let n of e.executions.values()) n.record.cell_id === t.id && (r = $e(r, n));
|
|
503
504
|
return {
|
|
504
505
|
...e,
|
|
505
506
|
results: r
|
|
@@ -507,16 +508,16 @@ var ht = {
|
|
|
507
508
|
},
|
|
508
509
|
"cell.removed": (e, { data: t }) => ({
|
|
509
510
|
...e,
|
|
510
|
-
results:
|
|
511
|
+
results: F(e.results, t.id)
|
|
511
512
|
}),
|
|
512
513
|
run: (e, { data: t }) => ({
|
|
513
514
|
...e,
|
|
514
515
|
runs: new Map(e.runs).set(t.run.id, t.run),
|
|
515
|
-
scratchFailure: t.run.origin.kind === "code" ?
|
|
516
|
+
scratchFailure: t.run.origin.kind === "code" ? tt(t.run) : e.scratchFailure
|
|
516
517
|
}),
|
|
517
518
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
518
519
|
...e,
|
|
519
|
-
runs:
|
|
520
|
+
runs: F(e.runs, t.id)
|
|
520
521
|
} : e,
|
|
521
522
|
execution: (e, { data: { execution: t } }, { phase: n }) => {
|
|
522
523
|
let r = e.executions.get(t.id), i = {
|
|
@@ -524,17 +525,17 @@ var ht = {
|
|
|
524
525
|
output: r?.output ?? null
|
|
525
526
|
}, a = {
|
|
526
527
|
...i,
|
|
527
|
-
outputVersion: r === void 0 ? 0 : r.outputVersion + +!
|
|
528
|
+
outputVersion: r === void 0 ? 0 : r.outputVersion + +!dt(r, i),
|
|
528
529
|
append: r?.append,
|
|
529
530
|
lastSeq: r?.lastSeq,
|
|
530
531
|
items: r?.items ?? /* @__PURE__ */ new Map()
|
|
531
|
-
}, o = e.pendingItems?.get(t.id), s = o?.filter((e) => "kind" in e), c =
|
|
532
|
+
}, o = e.pendingItems?.get(t.id), s = o?.filter((e) => "kind" in e), c = ft(e, s?.length ? ot(a, s) : a);
|
|
532
533
|
if (o && e.pendingItems) {
|
|
533
534
|
c = {
|
|
534
535
|
...c,
|
|
535
|
-
pendingItems:
|
|
536
|
+
pendingItems: F(e.pendingItems, t.id)
|
|
536
537
|
};
|
|
537
|
-
for (let e of o) "kind" in e || (c =
|
|
538
|
+
for (let e of o) "kind" in e || (c = I(c, e, n));
|
|
538
539
|
}
|
|
539
540
|
let l = t.cell_id;
|
|
540
541
|
if (l === null || r !== void 0) return c;
|
|
@@ -544,21 +545,21 @@ var ht = {
|
|
|
544
545
|
latest: new Map(e.latest).set(l, t.id)
|
|
545
546
|
};
|
|
546
547
|
},
|
|
547
|
-
"execution.removed": (e, { data: t }) =>
|
|
548
|
-
output: (e, { data: t }, { phase: n }) =>
|
|
549
|
-
console: (e, { data: t }, { phase: n }) =>
|
|
548
|
+
"execution.removed": (e, { data: t }) => at(e, t.id),
|
|
549
|
+
output: (e, { data: t }, { phase: n }) => I(e, t.output, n),
|
|
550
|
+
console: (e, { data: t }, { phase: n }) => I(e, {
|
|
550
551
|
...t.console,
|
|
551
552
|
kind: "console",
|
|
552
553
|
time: t.time
|
|
553
554
|
}, n),
|
|
554
|
-
"console.removed": (e, { data: t }) =>
|
|
555
|
-
input: (e, { data: t }, { phase: n }) =>
|
|
555
|
+
"console.removed": (e, { data: t }) => st(e, t.id),
|
|
556
|
+
input: (e, { data: t }, { phase: n }) => I(e, {
|
|
556
557
|
...t.input,
|
|
557
558
|
kind: "input",
|
|
558
559
|
time: t.time
|
|
559
560
|
}, n),
|
|
560
|
-
variable: (e, { data: t }, { phase: n }) =>
|
|
561
|
-
"variable.removed": (e, { data: t }) =>
|
|
561
|
+
variable: (e, { data: t }, { phase: n }) => I(e, t.variable, n),
|
|
562
|
+
"variable.removed": (e, { data: t }) => lt(e, t.id),
|
|
562
563
|
ready: (e) => e.pendingItems ? {
|
|
563
564
|
...e,
|
|
564
565
|
pendingItems: void 0
|
|
@@ -567,17 +568,17 @@ var ht = {
|
|
|
567
568
|
};
|
|
568
569
|
//#endregion
|
|
569
570
|
//#region src/core/state/atom-with-selected-inputs.ts
|
|
570
|
-
function
|
|
571
|
-
let r =
|
|
572
|
-
return
|
|
571
|
+
function ht(e, t, n) {
|
|
572
|
+
let r = T(e, t, ue);
|
|
573
|
+
return C((e) => n(e(r)));
|
|
573
574
|
}
|
|
574
575
|
//#endregion
|
|
575
576
|
//#region src/core/executions/freshness.ts
|
|
576
|
-
var
|
|
577
|
+
var gt = {
|
|
577
578
|
sourceChanged: !1,
|
|
578
579
|
inputsChanged: !1
|
|
579
580
|
};
|
|
580
|
-
function
|
|
581
|
+
function _t(e) {
|
|
581
582
|
let t = /* @__PURE__ */ new Map();
|
|
582
583
|
for (let n of e.variables.values()) for (let e of n.values()) {
|
|
583
584
|
let n = t.get(e.name);
|
|
@@ -585,18 +586,18 @@ function vt(e) {
|
|
|
585
586
|
}
|
|
586
587
|
return t;
|
|
587
588
|
}
|
|
588
|
-
function
|
|
589
|
-
let t =
|
|
589
|
+
function vt(e) {
|
|
590
|
+
let t = _t(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
590
591
|
function i(e, n) {
|
|
591
592
|
let i = new Set(n).add(e.id);
|
|
592
|
-
for (let [n, a] of Object.entries(
|
|
593
|
+
for (let [n, a] of Object.entries(Qe(e))) {
|
|
593
594
|
let s = t.get(n) ?? [];
|
|
594
595
|
if (a === null) {
|
|
595
596
|
if (s.some((t) => {
|
|
596
597
|
let n = r(t.execution_id);
|
|
597
598
|
if (n === void 0) return !1;
|
|
598
599
|
if (n.runtime_id === e.runtime_id) return !0;
|
|
599
|
-
let i =
|
|
600
|
+
let i = P(n) ?? N(n), a = P(e);
|
|
600
601
|
return i !== null && a !== null && Date.parse(i) > Date.parse(a);
|
|
601
602
|
})) return !0;
|
|
602
603
|
continue;
|
|
@@ -623,50 +624,50 @@ function yt(e) {
|
|
|
623
624
|
}
|
|
624
625
|
return (t) => {
|
|
625
626
|
let n = e.results.get(t)?.record;
|
|
626
|
-
return n == null ?
|
|
627
|
+
return n == null ? gt : o(n, /* @__PURE__ */ new Set());
|
|
627
628
|
};
|
|
628
629
|
}
|
|
629
630
|
//#endregion
|
|
630
631
|
//#region src/core/executions/output.ts
|
|
631
|
-
var
|
|
632
|
-
function
|
|
632
|
+
var yt = /* @__PURE__ */ new Map(), bt = "application/vnd.marimo+error";
|
|
633
|
+
function xt(e) {
|
|
633
634
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
634
635
|
cell_id: e,
|
|
635
636
|
message: t
|
|
636
637
|
}));
|
|
637
638
|
}
|
|
638
|
-
function
|
|
639
|
+
function St(e) {
|
|
639
640
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
640
641
|
}
|
|
641
|
-
function
|
|
642
|
-
return
|
|
642
|
+
function Ct(e) {
|
|
643
|
+
return St(P(e) ?? N(e));
|
|
643
644
|
}
|
|
644
|
-
function
|
|
645
|
+
function wt(e, t) {
|
|
645
646
|
return {
|
|
646
647
|
channel: "output",
|
|
647
648
|
mimetype: t.mimetype,
|
|
648
649
|
data: t.data,
|
|
649
|
-
timestamp:
|
|
650
|
+
timestamp: Ct(e)
|
|
650
651
|
};
|
|
651
652
|
}
|
|
652
|
-
function
|
|
653
|
+
function L(e, t) {
|
|
653
654
|
return {
|
|
654
655
|
channel: "marimo-error",
|
|
655
|
-
mimetype:
|
|
656
|
+
mimetype: bt,
|
|
656
657
|
data: t,
|
|
657
|
-
timestamp:
|
|
658
|
+
timestamp: Ct(e)
|
|
658
659
|
};
|
|
659
660
|
}
|
|
660
|
-
function
|
|
661
|
+
function Tt(e) {
|
|
661
662
|
return e.related.at(0)?.cell_id ?? null;
|
|
662
663
|
}
|
|
663
|
-
function
|
|
664
|
+
function Et(e) {
|
|
664
665
|
switch (e.kind) {
|
|
665
666
|
case "exception": return {
|
|
666
667
|
type: "exception",
|
|
667
668
|
exception_type: e.name ?? "Exception",
|
|
668
669
|
msg: e.message,
|
|
669
|
-
raising_cell:
|
|
670
|
+
raising_cell: Tt(e),
|
|
670
671
|
traceback: e.traceback?.data ?? null
|
|
671
672
|
};
|
|
672
673
|
case "invalid-syntax": return {
|
|
@@ -683,83 +684,94 @@ function Dt(e) {
|
|
|
683
684
|
type: "diagnostic",
|
|
684
685
|
kind: e.kind,
|
|
685
686
|
msg: e.message,
|
|
686
|
-
related:
|
|
687
|
+
related: xt(e.related)
|
|
687
688
|
};
|
|
688
689
|
}
|
|
689
690
|
}
|
|
690
|
-
function
|
|
691
|
+
function Dt(e, t) {
|
|
691
692
|
let n = t.related[0];
|
|
692
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
693
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return L(e, [{
|
|
693
694
|
type: "ancestor-stopped",
|
|
694
695
|
msg: t.message,
|
|
695
696
|
raising_cell: n.cell_id
|
|
696
697
|
}]);
|
|
697
698
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
698
699
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
699
|
-
return
|
|
700
|
+
return L(e, [{
|
|
700
701
|
type: "ancestor-prevented",
|
|
701
702
|
msg: t.message,
|
|
702
703
|
raising_cell: n.cell_id,
|
|
703
704
|
blamed_cell: r === void 0 ? null : r.cell_id
|
|
704
705
|
}]);
|
|
705
706
|
}
|
|
706
|
-
return
|
|
707
|
+
return L(e, [{
|
|
707
708
|
type: "diagnostic",
|
|
708
709
|
kind: t.reason,
|
|
709
710
|
msg: t.message,
|
|
710
|
-
related:
|
|
711
|
+
related: xt(t.related)
|
|
711
712
|
}]);
|
|
712
713
|
}
|
|
713
|
-
function
|
|
714
|
-
return
|
|
714
|
+
function Ot(e, t = yt) {
|
|
715
|
+
return kt(e, e.cell_id === null ? void 0 : t.get(e.cell_id));
|
|
715
716
|
}
|
|
716
|
-
function
|
|
717
|
+
function kt(e, t) {
|
|
717
718
|
return t !== void 0 && t.code !== null && t.code_fingerprint === e.code_fingerprint ? t.code : void 0;
|
|
718
719
|
}
|
|
719
|
-
function
|
|
720
|
-
if (e === null ||
|
|
721
|
-
let r =
|
|
720
|
+
function At(e, t, n) {
|
|
721
|
+
if (e === null || Pt(n, e)) return null;
|
|
722
|
+
let r = jt(e), i = kt(e.record, t);
|
|
722
723
|
return r === null || i === void 0 ? r : {
|
|
723
724
|
...r,
|
|
724
725
|
code: i
|
|
725
726
|
};
|
|
726
727
|
}
|
|
727
|
-
function
|
|
728
|
-
let { record: t } = e, n =
|
|
728
|
+
function jt(e) {
|
|
729
|
+
let { record: t } = e, n = M(e);
|
|
729
730
|
if (n === null) return null;
|
|
730
731
|
switch (n.kind) {
|
|
731
|
-
case "output": return n.media === null ? null :
|
|
732
|
-
case "failed": return
|
|
733
|
-
case "cancelled": return
|
|
734
|
-
case "skipped": return
|
|
732
|
+
case "output": return n.media === null ? null : wt(t, n.media);
|
|
733
|
+
case "failed": return L(t, [Et(n.error)]);
|
|
734
|
+
case "cancelled": return L(t, [{ type: "interruption" }]);
|
|
735
|
+
case "skipped": return Dt(t, n);
|
|
735
736
|
}
|
|
736
737
|
}
|
|
737
|
-
function
|
|
738
|
+
function Mt(e, t) {
|
|
738
739
|
let n = e.executions.latest.get(t);
|
|
739
|
-
return
|
|
740
|
+
return Nt(n === void 0 ? void 0 : e.executions.executions.get(n), e.results.get(t) ?? null);
|
|
741
|
+
}
|
|
742
|
+
function Nt(e, t) {
|
|
743
|
+
return e !== void 0 && M(e) !== null && e.record.state.status !== "completed" ? e : e?.record.state.status === "running" && t !== null && M(t)?.kind === "skipped" ? null : t;
|
|
740
744
|
}
|
|
741
745
|
function Pt(e, t) {
|
|
742
|
-
return e
|
|
746
|
+
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
743
747
|
}
|
|
744
748
|
function Ft(e, t) {
|
|
745
|
-
return e
|
|
749
|
+
return At(Mt(e, t), e.cells.get(t), e.cleared.get(t));
|
|
746
750
|
}
|
|
747
751
|
function It(e) {
|
|
752
|
+
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
753
|
+
for (let r of n) {
|
|
754
|
+
let n = Ft(e, r);
|
|
755
|
+
n !== null && t.set(r, n);
|
|
756
|
+
}
|
|
757
|
+
return t;
|
|
758
|
+
}
|
|
759
|
+
function Lt(e) {
|
|
748
760
|
let t = e.scratchFailure;
|
|
749
761
|
return t !== void 0 && e.scratch?.record.run_id !== t.runId ? {
|
|
750
762
|
channel: "marimo-error",
|
|
751
|
-
mimetype:
|
|
763
|
+
mimetype: bt,
|
|
752
764
|
data: [{
|
|
753
765
|
type: "unknown",
|
|
754
766
|
msg: t.message,
|
|
755
767
|
error_type: null
|
|
756
768
|
}],
|
|
757
|
-
timestamp:
|
|
758
|
-
} :
|
|
769
|
+
timestamp: St(t.completedAt)
|
|
770
|
+
} : At(e.scratch);
|
|
759
771
|
}
|
|
760
772
|
//#endregion
|
|
761
773
|
//#region src/utils/time.ts
|
|
762
|
-
var
|
|
774
|
+
var Rt = class e {
|
|
763
775
|
ms;
|
|
764
776
|
static fromMilliseconds(t) {
|
|
765
777
|
return t == null ? null : new e(t);
|
|
@@ -788,24 +800,24 @@ var Lt = class e {
|
|
|
788
800
|
};
|
|
789
801
|
//#endregion
|
|
790
802
|
//#region src/core/executions/select.ts
|
|
791
|
-
function
|
|
803
|
+
function zt(e) {
|
|
792
804
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
793
805
|
}
|
|
794
|
-
var
|
|
795
|
-
function
|
|
796
|
-
let t =
|
|
806
|
+
var Bt = /* @__PURE__ */ new WeakMap();
|
|
807
|
+
function Vt(e) {
|
|
808
|
+
let t = Bt.get(e);
|
|
797
809
|
if (t) return t;
|
|
798
|
-
let n =
|
|
810
|
+
let n = N(e), r = P(e), i = n === null ? null : Rt.parse(n), a = {
|
|
799
811
|
startedAt: i,
|
|
800
|
-
duration: i === null || r === null ? null :
|
|
812
|
+
duration: i === null || r === null ? null : Rt.parse(r).since(i)
|
|
801
813
|
};
|
|
802
|
-
return
|
|
814
|
+
return Bt.set(e, a), a;
|
|
803
815
|
}
|
|
804
|
-
function
|
|
816
|
+
function Ht(e, t) {
|
|
805
817
|
let n = e.latest.get(t);
|
|
806
818
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
807
819
|
}
|
|
808
|
-
function
|
|
820
|
+
function Ut(e, t) {
|
|
809
821
|
let n = /* @__PURE__ */ new Set(), r = [...t], i = r.filter((e) => e.config.disabled);
|
|
810
822
|
if (i.length === 0) return n;
|
|
811
823
|
let a = new Map(r.map(({ id: e }) => [e, []]));
|
|
@@ -830,79 +842,79 @@ function Ht(e, t) {
|
|
|
830
842
|
}
|
|
831
843
|
return n;
|
|
832
844
|
}
|
|
833
|
-
function
|
|
845
|
+
function Wt(e, t) {
|
|
834
846
|
let n = e.cells.get(t);
|
|
835
847
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
836
848
|
}
|
|
837
|
-
function
|
|
838
|
-
return
|
|
849
|
+
function Gt(e, t) {
|
|
850
|
+
return Wt(e, t) ? e.requested.has(t) ? !0 : Jt(e.executions.runs, t, Ht(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id) : !1;
|
|
839
851
|
}
|
|
840
|
-
var
|
|
841
|
-
function
|
|
842
|
-
let t =
|
|
843
|
-
return t === void 0 && (t = new Set(e),
|
|
852
|
+
var Kt = /* @__PURE__ */ new WeakMap();
|
|
853
|
+
function qt(e) {
|
|
854
|
+
let t = Kt.get(e);
|
|
855
|
+
return t === void 0 && (t = new Set(e), Kt.set(e, t)), t;
|
|
844
856
|
}
|
|
845
|
-
function
|
|
846
|
-
for (let r of e.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" &&
|
|
857
|
+
function Jt(e, t, n) {
|
|
858
|
+
for (let r of e.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && qt(r.origin.cell_ids).has(t)) return !0;
|
|
847
859
|
return !1;
|
|
848
860
|
}
|
|
849
|
-
function
|
|
850
|
-
let n =
|
|
851
|
-
return
|
|
861
|
+
function Yt(e, t) {
|
|
862
|
+
let n = Ht(e.executions, t), r = e.results.get(t)?.record ?? null;
|
|
863
|
+
return Xt({
|
|
852
864
|
latest: n?.record ?? null,
|
|
853
865
|
result: r,
|
|
854
|
-
queued:
|
|
866
|
+
queued: Gt(e, t),
|
|
855
867
|
blocked: e.blocked.has(t),
|
|
856
868
|
shownBlocked: e.shownBlocked.has(t),
|
|
857
869
|
runtimeId: e.runtimeId
|
|
858
870
|
});
|
|
859
871
|
}
|
|
860
|
-
function
|
|
861
|
-
let o = "idle", s = t === null ? null :
|
|
862
|
-
e !== null && e.state.status !== "completed" ? (o = e.state.status, c =
|
|
872
|
+
function Xt({ latest: e, result: t, queued: n, blocked: r, shownBlocked: i, runtimeId: a }) {
|
|
873
|
+
let o = "idle", s = t === null ? null : Vt(t), c = s?.startedAt?.toMilliseconds() ?? null;
|
|
874
|
+
e !== null && e.state.status !== "completed" ? (o = e.state.status, c = Vt(e).startedAt?.toMilliseconds() ?? c) : n && (o = "queued");
|
|
863
875
|
let l = o === "idle", u = l ? s?.duration ?? null : null;
|
|
864
876
|
return {
|
|
865
877
|
status: o,
|
|
866
878
|
blocked: r,
|
|
867
879
|
shownBlock: r ? "current" : i ? "stale" : null,
|
|
868
|
-
outcome: l && t !== null ?
|
|
880
|
+
outcome: l && t !== null ? zt(t) : null,
|
|
869
881
|
live: t === null || a === null || t.runtime_id === a,
|
|
870
882
|
startedAt: c,
|
|
871
883
|
duration: u
|
|
872
884
|
};
|
|
873
885
|
}
|
|
874
|
-
function Xt(e) {
|
|
875
|
-
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
876
|
-
}
|
|
877
886
|
function Zt(e) {
|
|
878
|
-
return
|
|
887
|
+
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
879
888
|
}
|
|
880
889
|
function Qt(e) {
|
|
881
|
-
|
|
890
|
+
return Zt(e).some((e) => e.record.state.status === "running");
|
|
891
|
+
}
|
|
892
|
+
function $t(e) {
|
|
893
|
+
let t = Zt(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
882
894
|
for (let t of e.executions.runs.values()) if (t.state.status !== "completed" && t.origin.kind === "cells") for (let e of t.origin.cell_ids) r.add(e);
|
|
883
895
|
let i = 0;
|
|
884
|
-
for (let t of r) !n.has(t) &&
|
|
896
|
+
for (let t of r) !n.has(t) && Gt(e, t) && (i += 1);
|
|
885
897
|
return t.length + i;
|
|
886
898
|
}
|
|
887
899
|
//#endregion
|
|
888
900
|
//#region src/core/executions/atoms.ts
|
|
889
|
-
var
|
|
901
|
+
var en = {
|
|
890
902
|
variables: /* @__PURE__ */ new Map(),
|
|
891
903
|
runs: /* @__PURE__ */ new Map(),
|
|
892
904
|
executions: /* @__PURE__ */ new Map(),
|
|
893
905
|
latest: /* @__PURE__ */ new Map(),
|
|
894
906
|
results: /* @__PURE__ */ new Map(),
|
|
895
907
|
scratch: null
|
|
896
|
-
},
|
|
897
|
-
function
|
|
908
|
+
}, tn = /* @__PURE__ */ new Map(), nn = /* @__PURE__ */ new Map(), rn = /* @__PURE__ */ new Set(), an = /* @__PURE__ */ new Set(), on = /* @__PURE__ */ new Set(), sn = /* @__PURE__ */ new Map(), R = C(null);
|
|
909
|
+
function cn(e, t) {
|
|
898
910
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
899
911
|
}
|
|
900
|
-
function
|
|
901
|
-
return e !== null &&
|
|
912
|
+
function ln(e, t, n) {
|
|
913
|
+
return e !== null && cn(e.notebook, t) ? e.value : n;
|
|
902
914
|
}
|
|
903
|
-
function
|
|
904
|
-
return
|
|
905
|
-
let n = t(
|
|
915
|
+
function un(e) {
|
|
916
|
+
return C((t) => {
|
|
917
|
+
let n = t(S), r = t(e);
|
|
906
918
|
if (n === null || r === null) return null;
|
|
907
919
|
let i = t(r.notebookAtom);
|
|
908
920
|
return i === null ? null : {
|
|
@@ -912,87 +924,84 @@ function ln(e) {
|
|
|
912
924
|
};
|
|
913
925
|
});
|
|
914
926
|
}
|
|
915
|
-
var
|
|
916
|
-
function
|
|
917
|
-
return
|
|
927
|
+
var dn = un(S);
|
|
928
|
+
function fn(e, t) {
|
|
929
|
+
return cn(t.notebook, e.get(dn));
|
|
918
930
|
}
|
|
919
|
-
function
|
|
920
|
-
let t =
|
|
921
|
-
let n =
|
|
922
|
-
return n.size === 0 ?
|
|
923
|
-
}), r =
|
|
924
|
-
let n = t(e), r = n && t(n.analysisAtom), i = r ?
|
|
931
|
+
function pn(e) {
|
|
932
|
+
let t = un(e), n = C((e) => {
|
|
933
|
+
let n = ln(e(R), e(t), rn);
|
|
934
|
+
return n.size === 0 ? an : new Set([...n].flatMap((e) => e.cells));
|
|
935
|
+
}), r = C((t) => {
|
|
936
|
+
let n = t(e), r = n && t(n.analysisAtom), i = r ? Ut(r.analysis, r.document.cells.values()) : on;
|
|
925
937
|
return {
|
|
926
938
|
shownBlocked: i,
|
|
927
|
-
blocked: r?.freshness === "current" ? i :
|
|
939
|
+
blocked: r?.freshness === "current" ? i : on
|
|
928
940
|
};
|
|
929
941
|
});
|
|
930
|
-
return
|
|
942
|
+
return C((t) => {
|
|
931
943
|
let i = t(e), a = i === null ? null : t(i.shownDocumentAtom);
|
|
932
944
|
return {
|
|
933
|
-
executions: i === null ?
|
|
934
|
-
results: i === null ?
|
|
935
|
-
cells: a?.cells ??
|
|
945
|
+
executions: i === null ? en : t(i.executionsAtom),
|
|
946
|
+
results: i === null ? tn : t(i.resultsAtom),
|
|
947
|
+
cells: a?.cells ?? nn,
|
|
936
948
|
requested: t(n),
|
|
937
949
|
...t(r),
|
|
938
950
|
runtimeId: i === null ? null : t(i.runtimeAtom)?.id ?? null
|
|
939
951
|
};
|
|
940
952
|
});
|
|
941
953
|
}
|
|
942
|
-
var
|
|
943
|
-
function
|
|
944
|
-
let t =
|
|
954
|
+
var mn = pn(S), hn = pn(m);
|
|
955
|
+
function gn(e) {
|
|
956
|
+
let t = T(C((t) => {
|
|
945
957
|
let n = t(e), r = n === null ? null : t(n.shownDocumentAtom);
|
|
946
958
|
return n === null || r === null ? {
|
|
947
|
-
cells:
|
|
948
|
-
executions:
|
|
949
|
-
results:
|
|
959
|
+
cells: nn,
|
|
960
|
+
executions: en,
|
|
961
|
+
results: tn
|
|
950
962
|
} : {
|
|
951
963
|
cells: r.cells,
|
|
952
964
|
executions: t(n.executionsAtom),
|
|
953
965
|
results: t(n.resultsAtom)
|
|
954
966
|
};
|
|
955
|
-
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest &&
|
|
956
|
-
return
|
|
967
|
+
}), (e) => e, (e, t) => e.cells === t.cells && e.executions.variables === t.executions.variables && e.executions.latest === t.executions.latest && _n(e.executions.executions, t.executions.executions) && _n(e.results, t.results));
|
|
968
|
+
return C((e) => vt(e(t)));
|
|
957
969
|
}
|
|
958
|
-
function
|
|
970
|
+
function _n(e, t) {
|
|
959
971
|
if (e === t) return !0;
|
|
960
972
|
if (e.size !== t.size) return !1;
|
|
961
973
|
for (let [n, r] of e) if (!t.has(n) || r?.record !== t.get(n)?.record) return !1;
|
|
962
974
|
return !0;
|
|
963
975
|
}
|
|
964
|
-
|
|
965
|
-
var
|
|
966
|
-
let t = e(
|
|
976
|
+
gn(S);
|
|
977
|
+
var vn = gn(m), yn = C(null), bn = C((e) => {
|
|
978
|
+
let t = e(S), n = e(m), r = n === null ? null : e(n.shownDocumentAtom);
|
|
967
979
|
return t === null || n === null || r === null ? null : {
|
|
968
980
|
replica: t,
|
|
969
981
|
id: r.revision.notebook_id,
|
|
970
982
|
generation: e(n.generationAtom)
|
|
971
983
|
};
|
|
972
|
-
}), R = S((e) => {
|
|
973
|
-
let t = e(m);
|
|
974
|
-
return {
|
|
975
|
-
executions: t === null ? $t : e(t.executionsAtom),
|
|
976
|
-
results: t === null ? en : e(t.resultsAtom),
|
|
977
|
-
cleared: cn(e(vn), e(yn), on),
|
|
978
|
-
cells: t === null ? tn : e(t.documentAtom)?.cells ?? tn
|
|
979
|
-
};
|
|
980
|
-
}), bn = w(R, (e) => [.../* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()])], de);
|
|
981
|
-
S((e) => {
|
|
982
|
-
let t = /* @__PURE__ */ new Map();
|
|
983
|
-
for (let n of e(bn)) {
|
|
984
|
-
let r = e(z(n));
|
|
985
|
-
r !== null && t.set(n, r);
|
|
986
|
-
}
|
|
987
|
-
return t;
|
|
988
984
|
});
|
|
989
985
|
function xn(e, t) {
|
|
986
|
+
return C((n) => {
|
|
987
|
+
let r = n(e);
|
|
988
|
+
return {
|
|
989
|
+
executions: r === null ? en : n(r.executionsAtom),
|
|
990
|
+
results: r === null ? tn : n(r.resultsAtom),
|
|
991
|
+
cleared: ln(n(yn), n(t), sn),
|
|
992
|
+
cells: r === null ? nn : n(r.documentAtom)?.cells ?? nn
|
|
993
|
+
};
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
var z = xn(m, bn), Sn = xn(S, dn);
|
|
997
|
+
C((e) => It(e(Sn)));
|
|
998
|
+
function Cn(e, t) {
|
|
990
999
|
let n = e.latest.get(t);
|
|
991
1000
|
return n === void 0 ? void 0 : e.executions.get(n);
|
|
992
1001
|
}
|
|
993
|
-
var
|
|
994
|
-
let t =
|
|
995
|
-
|
|
1002
|
+
var wn = v((e) => {
|
|
1003
|
+
let t = ht(hn, (t) => [
|
|
1004
|
+
Cn(t.executions, e)?.record,
|
|
996
1005
|
t.results.get(e)?.record,
|
|
997
1006
|
t.cells.get(e),
|
|
998
1007
|
t.requested.has(e),
|
|
@@ -1000,18 +1009,18 @@ var Sn = _((e) => {
|
|
|
1000
1009
|
t.shownBlocked.has(e),
|
|
1001
1010
|
t.runtimeId,
|
|
1002
1011
|
t.executions.runs
|
|
1003
|
-
], ([t, n, r, i, a, o, s, c]) =>
|
|
1012
|
+
], ([t, n, r, i, a, o, s, c]) => Xt({
|
|
1004
1013
|
latest: t ?? null,
|
|
1005
1014
|
result: n ?? null,
|
|
1006
1015
|
blocked: a,
|
|
1007
1016
|
shownBlocked: o,
|
|
1008
1017
|
runtimeId: s,
|
|
1009
|
-
queued: r !== void 0 && !r.config.disabled && !a && (i ||
|
|
1018
|
+
queued: r !== void 0 && !r.config.disabled && !a && (i || Jt(c, e, t?.run_id ?? n?.run_id))
|
|
1010
1019
|
}));
|
|
1011
|
-
return
|
|
1012
|
-
}),
|
|
1013
|
-
let t =
|
|
1014
|
-
let n =
|
|
1020
|
+
return T(t, (e) => e, b);
|
|
1021
|
+
}), B = v((e) => {
|
|
1022
|
+
let t = ht(z, (t) => {
|
|
1023
|
+
let n = Cn(t.executions, e);
|
|
1015
1024
|
return [
|
|
1016
1025
|
n?.record,
|
|
1017
1026
|
n?.output,
|
|
@@ -1020,51 +1029,51 @@ var Sn = _((e) => {
|
|
|
1020
1029
|
t.cleared.get(e),
|
|
1021
1030
|
t.cells.get(e)
|
|
1022
1031
|
];
|
|
1023
|
-
}, ([e, t, n, r, i, a]) =>
|
|
1032
|
+
}, ([e, t, n, r, i, a]) => At(Nt(e ? {
|
|
1024
1033
|
record: e,
|
|
1025
1034
|
output: t ?? null,
|
|
1026
1035
|
outputVersion: n ?? 0
|
|
1027
1036
|
} : void 0, r ?? null), a, i));
|
|
1028
|
-
return
|
|
1037
|
+
return T(t, (e) => e, b);
|
|
1029
1038
|
});
|
|
1030
|
-
|
|
1039
|
+
T(ht(z, ({ executions: e }) => [e.scratch, e.scratchFailure], ([e, t]) => Lt({
|
|
1031
1040
|
scratch: e,
|
|
1032
1041
|
scratchFailure: t
|
|
1033
|
-
})), (e) => e,
|
|
1034
|
-
var
|
|
1035
|
-
let n =
|
|
1042
|
+
})), (e) => e, b);
|
|
1043
|
+
var Tn = v((e) => T(vn, (t) => t(e), (e, t) => e.sourceChanged === t.sourceChanged && e.inputsChanged === t.inputsChanged)), En = v((e) => {
|
|
1044
|
+
let n = ht(B(e), (e) => [e?.mimetype, e?.data], ([e, t]) => e == null || t == null ? null : Je({
|
|
1036
1045
|
mimetype: e,
|
|
1037
1046
|
data: t
|
|
1038
1047
|
}));
|
|
1039
|
-
return
|
|
1048
|
+
return T(n, t.identity, b);
|
|
1040
1049
|
});
|
|
1041
|
-
function
|
|
1042
|
-
|
|
1050
|
+
function Dn(e) {
|
|
1051
|
+
B.remove(e), wn.remove(e), Tn.remove(e), En.remove(e);
|
|
1043
1052
|
}
|
|
1044
|
-
function
|
|
1045
|
-
let n = e.get(
|
|
1053
|
+
function On(e, t) {
|
|
1054
|
+
let n = e.get(z), r = new Map(n.cleared);
|
|
1046
1055
|
for (let e of t) {
|
|
1047
|
-
let t =
|
|
1048
|
-
t != null &&
|
|
1056
|
+
let t = Mt(n, e);
|
|
1057
|
+
t != null && M(t) !== null && r.set(e, {
|
|
1049
1058
|
execution: t.record.id,
|
|
1050
1059
|
version: t.outputVersion
|
|
1051
1060
|
});
|
|
1052
1061
|
}
|
|
1053
|
-
let i = e.get(
|
|
1054
|
-
e.set(
|
|
1062
|
+
let i = e.get(bn);
|
|
1063
|
+
e.set(yn, i === null ? null : {
|
|
1055
1064
|
notebook: i,
|
|
1056
1065
|
value: r
|
|
1057
1066
|
});
|
|
1058
1067
|
}
|
|
1059
|
-
var
|
|
1060
|
-
let t = e(
|
|
1068
|
+
var kn = C((e) => {
|
|
1069
|
+
let t = e(S);
|
|
1061
1070
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
1062
1071
|
});
|
|
1063
|
-
|
|
1064
|
-
var
|
|
1065
|
-
let t = e(
|
|
1072
|
+
C((e) => Qt(e(mn).executions)), C((e) => $t(e(mn)));
|
|
1073
|
+
var An = C((e) => {
|
|
1074
|
+
let t = e(S);
|
|
1066
1075
|
if (t === null) return { refused: "No notebook is connected" };
|
|
1067
|
-
if (e(t.connectionAtom).state ===
|
|
1076
|
+
if (e(t.connectionAtom).state === j.CLOSED) return { refused: "The notebook is disconnected" };
|
|
1068
1077
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
1069
1078
|
let n = e(t.runtimeAtom);
|
|
1070
1079
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -1077,66 +1086,66 @@ var On = S((e) => {
|
|
|
1077
1086
|
default: return "waiting";
|
|
1078
1087
|
}
|
|
1079
1088
|
});
|
|
1080
|
-
function
|
|
1089
|
+
function jn(e) {
|
|
1081
1090
|
return new Promise((t, n) => {
|
|
1082
|
-
let r = e.sub(
|
|
1091
|
+
let r = e.sub(An, i);
|
|
1083
1092
|
function i() {
|
|
1084
|
-
let i = e.get(
|
|
1093
|
+
let i = e.get(An);
|
|
1085
1094
|
i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
|
|
1086
1095
|
}
|
|
1087
1096
|
i();
|
|
1088
1097
|
});
|
|
1089
1098
|
}
|
|
1090
|
-
function
|
|
1091
|
-
let n = e.get(
|
|
1099
|
+
function Mn(e, t) {
|
|
1100
|
+
let n = e.get(dn);
|
|
1092
1101
|
if (n === null) return null;
|
|
1093
1102
|
let r = {
|
|
1094
1103
|
notebook: n,
|
|
1095
1104
|
cells: [...t]
|
|
1096
|
-
}, i =
|
|
1097
|
-
return e.set(
|
|
1105
|
+
}, i = ln(e.get(R), n, rn);
|
|
1106
|
+
return e.set(R, {
|
|
1098
1107
|
notebook: n,
|
|
1099
1108
|
value: new Set(i).add(r)
|
|
1100
1109
|
}), r;
|
|
1101
1110
|
}
|
|
1102
|
-
function
|
|
1103
|
-
let n = e.get(
|
|
1111
|
+
function Nn(e, t) {
|
|
1112
|
+
let n = e.get(R);
|
|
1104
1113
|
if (n === null || !n.value.has(t)) return;
|
|
1105
1114
|
let r = new Set(n.value);
|
|
1106
|
-
r.delete(t), e.set(
|
|
1115
|
+
r.delete(t), e.set(R, {
|
|
1107
1116
|
notebook: n.notebook,
|
|
1108
1117
|
value: r
|
|
1109
1118
|
});
|
|
1110
1119
|
}
|
|
1111
|
-
function
|
|
1112
|
-
let r =
|
|
1120
|
+
function Pn(e, t, n) {
|
|
1121
|
+
let r = C((e) => cn(t.notebook, e(dn)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
1113
1122
|
function a() {
|
|
1114
|
-
e.get(r) || (i(),
|
|
1123
|
+
e.get(r) || (i(), Nn(e, t));
|
|
1115
1124
|
}
|
|
1116
1125
|
a();
|
|
1117
1126
|
}
|
|
1118
1127
|
//#endregion
|
|
1119
1128
|
//#region src/core/state/create-keyed-atom-hook.ts
|
|
1120
|
-
var
|
|
1121
|
-
function
|
|
1129
|
+
var Fn = o();
|
|
1130
|
+
function In(e) {
|
|
1122
1131
|
return function(t) {
|
|
1123
|
-
let n = (0,
|
|
1124
|
-
return
|
|
1132
|
+
let n = (0, D.useMemo)(() => e(t), [t]);
|
|
1133
|
+
return x(n);
|
|
1125
1134
|
};
|
|
1126
1135
|
}
|
|
1127
1136
|
//#endregion
|
|
1128
1137
|
//#region src/core/codemirror/editing/commands.ts
|
|
1129
|
-
function
|
|
1138
|
+
function Ln(e) {
|
|
1130
1139
|
return (t) => {
|
|
1131
1140
|
let n = !1;
|
|
1132
1141
|
for (let r of t) r && (n = e(r) || n);
|
|
1133
1142
|
return n;
|
|
1134
1143
|
};
|
|
1135
1144
|
}
|
|
1136
|
-
var
|
|
1145
|
+
var Rn = Ln(he), zn = Ln(me);
|
|
1137
1146
|
//#endregion
|
|
1138
1147
|
//#region src/utils/schedule-task.ts
|
|
1139
|
-
function
|
|
1148
|
+
function Bn() {
|
|
1140
1149
|
let e = globalThis.scheduler;
|
|
1141
1150
|
if (typeof e?.postTask == "function") return (t) => {
|
|
1142
1151
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -1157,10 +1166,10 @@ function Rn() {
|
|
|
1157
1166
|
setTimeout(e, 0);
|
|
1158
1167
|
};
|
|
1159
1168
|
}
|
|
1160
|
-
var
|
|
1169
|
+
var Vn = Bn();
|
|
1161
1170
|
//#endregion
|
|
1162
1171
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
1163
|
-
function
|
|
1172
|
+
function Hn(e = Vn) {
|
|
1164
1173
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
1165
1174
|
function i() {
|
|
1166
1175
|
r || n.size === 0 || (r = !0, e(s));
|
|
@@ -1197,21 +1206,21 @@ function Bn(e = zn) {
|
|
|
1197
1206
|
}
|
|
1198
1207
|
};
|
|
1199
1208
|
}
|
|
1200
|
-
var
|
|
1209
|
+
var Un = Hn();
|
|
1201
1210
|
//#endregion
|
|
1202
1211
|
//#region src/core/mime.ts
|
|
1203
|
-
function
|
|
1212
|
+
function Wn(e) {
|
|
1204
1213
|
return e === "application/vnd.marimo+error";
|
|
1205
1214
|
}
|
|
1206
|
-
function
|
|
1215
|
+
function Gn(e) {
|
|
1207
1216
|
return e === "application/vnd.marimo+traceback";
|
|
1208
1217
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return
|
|
1218
|
+
function Kn(e) {
|
|
1219
|
+
return Wn(e) || Gn(e);
|
|
1211
1220
|
}
|
|
1212
1221
|
//#endregion
|
|
1213
1222
|
//#region src/core/cells/command-console.ts
|
|
1214
|
-
function
|
|
1223
|
+
function qn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
1215
1224
|
if (t === "callback-output" && !r && n.length === 0) return { entries: [] };
|
|
1216
1225
|
let o = r || n.length === 0, s = e?.entries ?? [], c = r && a !== void 0 ? n.findIndex((e) => e.command_id === a) : -1, l = n.slice(c + 1).map((e, n) => ({
|
|
1217
1226
|
...e,
|
|
@@ -1222,18 +1231,18 @@ function Gn(e, { op: t, entries: n, replace: r, after_seq: i }, a) {
|
|
|
1222
1231
|
}
|
|
1223
1232
|
//#endregion
|
|
1224
1233
|
//#region src/core/dom/ui-element-constants.ts
|
|
1225
|
-
var
|
|
1234
|
+
var Jn = "object-id", Yn = "random-id", Xn = "abcdefghijklmnopqrstuvwxyz", Zn = Xn + Xn.toUpperCase(), Qn = /* @__PURE__ */ new Set(), V = "__scratch__", $n = "setup", er = { create() {
|
|
1226
1235
|
let e = 0, t;
|
|
1227
1236
|
do {
|
|
1228
1237
|
let n = "";
|
|
1229
|
-
for (let e = 0; e < 4; e++) n +=
|
|
1238
|
+
for (let e = 0; e < 4; e++) n += Zn[Math.floor(Math.random() * 52)];
|
|
1230
1239
|
t = n, e++;
|
|
1231
|
-
} while (
|
|
1240
|
+
} while (Qn.has(t) && e < 100);
|
|
1232
1241
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
1233
|
-
return
|
|
1234
|
-
} },
|
|
1242
|
+
return Qn.add(t), t;
|
|
1243
|
+
} }, H = {
|
|
1235
1244
|
create(e) {
|
|
1236
|
-
return
|
|
1245
|
+
return E(e != null, "cellId is required"), `cell-${e}`;
|
|
1237
1246
|
},
|
|
1238
1247
|
parse(e) {
|
|
1239
1248
|
return e.slice(5);
|
|
@@ -1244,7 +1253,7 @@ var Kn = "object-id", qn = "random-id", Jn = "abcdefghijklmnopqrstuvwxyz", Yn =
|
|
|
1244
1253
|
findElementThroughShadowDOMs(e) {
|
|
1245
1254
|
let t = e;
|
|
1246
1255
|
for (; t;) {
|
|
1247
|
-
let e =
|
|
1256
|
+
let e = H.findElement(t);
|
|
1248
1257
|
if (e) return e;
|
|
1249
1258
|
let n = t.getRootNode();
|
|
1250
1259
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -1252,21 +1261,21 @@ var Kn = "object-id", qn = "random-id", Jn = "abcdefghijklmnopqrstuvwxyz", Yn =
|
|
|
1252
1261
|
return null;
|
|
1253
1262
|
}
|
|
1254
1263
|
};
|
|
1255
|
-
function
|
|
1256
|
-
let t = null, n =
|
|
1257
|
-
return n && (t =
|
|
1264
|
+
function tr(e) {
|
|
1265
|
+
let t = null, n = H.findElementThroughShadowDOMs(e);
|
|
1266
|
+
return n && (t = H.parse(n.id)), t;
|
|
1258
1267
|
}
|
|
1259
|
-
var
|
|
1268
|
+
var nr = {
|
|
1260
1269
|
parse(e) {
|
|
1261
|
-
return e.getAttribute(
|
|
1270
|
+
return e.getAttribute(Jn);
|
|
1262
1271
|
},
|
|
1263
1272
|
parseOrThrow(e) {
|
|
1264
|
-
let t =
|
|
1265
|
-
return
|
|
1273
|
+
let t = nr.parse(e);
|
|
1274
|
+
return E(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1266
1275
|
}
|
|
1267
|
-
},
|
|
1276
|
+
}, rr = { create(e) {
|
|
1268
1277
|
return `output-${e}`;
|
|
1269
|
-
} },
|
|
1278
|
+
} }, ir = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, ar = class e {
|
|
1270
1279
|
static get INSTANCE() {
|
|
1271
1280
|
let t = "_marimo_private_VirtualFileTracker";
|
|
1272
1281
|
return window[t] || (window[t] = new e()), window[t];
|
|
@@ -1288,7 +1297,7 @@ var er = {
|
|
|
1288
1297
|
switch (t.mimetype) {
|
|
1289
1298
|
case "application/json":
|
|
1290
1299
|
case "text/html": {
|
|
1291
|
-
let r = n.get(e), i =
|
|
1300
|
+
let r = n.get(e), i = or(t.data);
|
|
1292
1301
|
r?.forEach((e) => i.add(e)), n.set(e, i);
|
|
1293
1302
|
return;
|
|
1294
1303
|
}
|
|
@@ -1304,15 +1313,15 @@ var er = {
|
|
|
1304
1313
|
this.virtualFiles.delete(e), this.callbackFiles.delete(e);
|
|
1305
1314
|
}
|
|
1306
1315
|
};
|
|
1307
|
-
function
|
|
1316
|
+
function or(e) {
|
|
1308
1317
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1309
|
-
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(
|
|
1318
|
+
let t = /* @__PURE__ */ new Set(), n = (typeof e == "string" ? e : JSON.stringify(e)).match(ir);
|
|
1310
1319
|
if (n) for (let e of n) t.add(e);
|
|
1311
1320
|
return t;
|
|
1312
1321
|
}
|
|
1313
1322
|
//#endregion
|
|
1314
1323
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
1315
|
-
var
|
|
1324
|
+
var sr = class e {
|
|
1316
1325
|
lines = [""];
|
|
1317
1326
|
cursor = {
|
|
1318
1327
|
row: 0,
|
|
@@ -1414,7 +1423,7 @@ var ar = class e {
|
|
|
1414
1423
|
render() {
|
|
1415
1424
|
return this.lines.join("\n");
|
|
1416
1425
|
}
|
|
1417
|
-
},
|
|
1426
|
+
}, cr = class {
|
|
1418
1427
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
1419
1428
|
parse(e) {
|
|
1420
1429
|
let t = [], n = 0;
|
|
@@ -1433,13 +1442,13 @@ var ar = class e {
|
|
|
1433
1442
|
value: e.slice(n)
|
|
1434
1443
|
}), t;
|
|
1435
1444
|
}
|
|
1436
|
-
},
|
|
1437
|
-
parser = new
|
|
1445
|
+
}, lr = class e {
|
|
1446
|
+
parser = new cr();
|
|
1438
1447
|
buffer;
|
|
1439
1448
|
incompleteEscape = "";
|
|
1440
1449
|
static INCOMPLETE_ESCAPE = new RegExp(String.raw`\u001B(?:\[[0-9;]*|\()?$`, "u");
|
|
1441
1450
|
constructor(e = 0) {
|
|
1442
|
-
this.buffer = new
|
|
1451
|
+
this.buffer = new sr(e);
|
|
1443
1452
|
}
|
|
1444
1453
|
copy(t = 0) {
|
|
1445
1454
|
let n = new e();
|
|
@@ -1463,7 +1472,7 @@ var ar = class e {
|
|
|
1463
1472
|
for (let e of r) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
1464
1473
|
}
|
|
1465
1474
|
reset() {
|
|
1466
|
-
this.buffer = new
|
|
1475
|
+
this.buffer = new sr(), this.incompleteEscape = "";
|
|
1467
1476
|
}
|
|
1468
1477
|
render() {
|
|
1469
1478
|
return this.buffer.render();
|
|
@@ -1507,7 +1516,7 @@ var ar = class e {
|
|
|
1507
1516
|
return n;
|
|
1508
1517
|
}
|
|
1509
1518
|
};
|
|
1510
|
-
function
|
|
1519
|
+
function ur(e) {
|
|
1511
1520
|
let t = 1;
|
|
1512
1521
|
for (let n = 0; n < e.length; n++) {
|
|
1513
1522
|
let r = e.charCodeAt(n);
|
|
@@ -1516,7 +1525,7 @@ function cr(e) {
|
|
|
1516
1525
|
}
|
|
1517
1526
|
return t;
|
|
1518
1527
|
}
|
|
1519
|
-
var
|
|
1528
|
+
var U = class e {
|
|
1520
1529
|
mimetype;
|
|
1521
1530
|
channel;
|
|
1522
1531
|
timestamp;
|
|
@@ -1538,14 +1547,14 @@ var H = class e {
|
|
|
1538
1547
|
}
|
|
1539
1548
|
appendData(t) {
|
|
1540
1549
|
if (!this.terminal) {
|
|
1541
|
-
let n =
|
|
1550
|
+
let n = ur(t);
|
|
1542
1551
|
if (n !== void 0) return new e(this, {
|
|
1543
1552
|
data: this.data + t,
|
|
1544
1553
|
lineCount: this.lineCount + n - 1,
|
|
1545
1554
|
firstPlainRow: this.firstPlainRow
|
|
1546
1555
|
});
|
|
1547
1556
|
}
|
|
1548
|
-
let n = this.terminal?.copy() ?? new
|
|
1557
|
+
let n = this.terminal?.copy() ?? new lr(this.firstPlainRow);
|
|
1549
1558
|
this.terminal || n.append(this.data), n.append(t);
|
|
1550
1559
|
let r = n.render();
|
|
1551
1560
|
return new e(this, {
|
|
@@ -1573,52 +1582,52 @@ var H = class e {
|
|
|
1573
1582
|
...this.code === void 0 ? {} : { code: this.code }
|
|
1574
1583
|
};
|
|
1575
1584
|
}
|
|
1576
|
-
},
|
|
1577
|
-
function
|
|
1585
|
+
}, dr = 5e3;
|
|
1586
|
+
function fr(e, t = dr) {
|
|
1578
1587
|
let n = e.slice(0, -1), r = e.at(-1);
|
|
1579
|
-
return r &&
|
|
1588
|
+
return r && mr(n, r), yr(n, t);
|
|
1580
1589
|
}
|
|
1581
|
-
function
|
|
1590
|
+
function pr(e) {
|
|
1582
1591
|
let t = [];
|
|
1583
1592
|
for (let n = 0; n < e.length;) {
|
|
1584
1593
|
let r = e[n], i = n + 1;
|
|
1585
|
-
for (; i < e.length &&
|
|
1586
|
-
if (i === n + 1)
|
|
1594
|
+
for (; i < e.length && hr(r, e[i]);) i++;
|
|
1595
|
+
if (i === n + 1) mr(t, r);
|
|
1587
1596
|
else {
|
|
1588
|
-
let a = e.slice(n, i).map((e) => (
|
|
1589
|
-
t.push(
|
|
1597
|
+
let a = e.slice(n, i).map((e) => (vr(e), e.data));
|
|
1598
|
+
t.push(U.create({
|
|
1590
1599
|
...r,
|
|
1591
1600
|
data: a.join("")
|
|
1592
1601
|
}));
|
|
1593
1602
|
}
|
|
1594
1603
|
n = i;
|
|
1595
1604
|
}
|
|
1596
|
-
return
|
|
1605
|
+
return yr(t, dr);
|
|
1597
1606
|
}
|
|
1598
|
-
function
|
|
1607
|
+
function mr(e, t) {
|
|
1599
1608
|
let n = e.at(-1);
|
|
1600
|
-
n &&
|
|
1609
|
+
n && hr(n, t) ? (vr(n), vr(t), e[e.length - 1] = _r(n, t)) : e.push(gr(t));
|
|
1601
1610
|
}
|
|
1602
|
-
function
|
|
1611
|
+
function hr(e, t) {
|
|
1603
1612
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
1604
1613
|
if (!n) return !1;
|
|
1605
1614
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
1606
1615
|
return n && r && i;
|
|
1607
1616
|
}
|
|
1608
|
-
function mr(e) {
|
|
1609
|
-
return e instanceof H ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? H.create(e) : e;
|
|
1610
|
-
}
|
|
1611
|
-
function hr(e, t) {
|
|
1612
|
-
return e instanceof H ? e.appendData(t.data) : H.create(e).appendData(t.data);
|
|
1613
|
-
}
|
|
1614
1617
|
function gr(e) {
|
|
1615
|
-
|
|
1618
|
+
return e instanceof U ? e : e.mimetype === "text/plain" && e.channel !== "stdin" && typeof e.data == "string" ? U.create(e) : e;
|
|
1616
1619
|
}
|
|
1617
1620
|
function _r(e, t) {
|
|
1621
|
+
return e instanceof U ? e.appendData(t.data) : U.create(e).appendData(t.data);
|
|
1622
|
+
}
|
|
1623
|
+
function vr(e) {
|
|
1624
|
+
E(typeof e.data == "string", "expected string output");
|
|
1625
|
+
}
|
|
1626
|
+
function yr(e, t) {
|
|
1618
1627
|
let n = 0, r;
|
|
1619
1628
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1620
1629
|
let t = e[r];
|
|
1621
|
-
t.mimetype === "text/plain" ? (
|
|
1630
|
+
t.mimetype === "text/plain" ? (E(typeof t.data == "string", "expected string"), n += t instanceof U ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1622
1631
|
}
|
|
1623
1632
|
if (n < t) return e;
|
|
1624
1633
|
let i = r + 1, a = [{
|
|
@@ -1629,8 +1638,8 @@ function _r(e, t) {
|
|
|
1629
1638
|
}, ...e.slice(0, i).filter((e) => e.channel === "stdin" && e.response === void 0)], o = e[i];
|
|
1630
1639
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1631
1640
|
if (o?.mimetype === "text/plain") {
|
|
1632
|
-
|
|
1633
|
-
let r = n - t, s = o instanceof
|
|
1641
|
+
E(typeof o.data == "string", "expected string");
|
|
1642
|
+
let r = n - t, s = o instanceof U ? o.dropFirstLines(r) : {
|
|
1634
1643
|
...o,
|
|
1635
1644
|
data: o.data.split("\n").slice(r).join("\n")
|
|
1636
1645
|
};
|
|
@@ -1644,18 +1653,18 @@ function _r(e, t) {
|
|
|
1644
1653
|
}
|
|
1645
1654
|
//#endregion
|
|
1646
1655
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1647
|
-
function
|
|
1648
|
-
return
|
|
1656
|
+
function br(e, t) {
|
|
1657
|
+
return be(e * 1e3, t?.in);
|
|
1649
1658
|
}
|
|
1650
1659
|
//#endregion
|
|
1651
1660
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1652
|
-
var
|
|
1661
|
+
var xr = function(e, t) {
|
|
1653
1662
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1654
|
-
},
|
|
1663
|
+
}, W;
|
|
1655
1664
|
(function(e) {
|
|
1656
1665
|
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";
|
|
1657
|
-
})(
|
|
1658
|
-
var
|
|
1666
|
+
})(W ||= {});
|
|
1667
|
+
var Sr = class {
|
|
1659
1668
|
constructor() {
|
|
1660
1669
|
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 = {
|
|
1661
1670
|
http: 1,
|
|
@@ -1887,57 +1896,57 @@ var br = class {
|
|
|
1887
1896
|
}
|
|
1888
1897
|
get_next_packet() {
|
|
1889
1898
|
var e = {
|
|
1890
|
-
kind:
|
|
1899
|
+
kind: W.EOS,
|
|
1891
1900
|
text: "",
|
|
1892
1901
|
url: ""
|
|
1893
1902
|
}, t = this._buffer.length;
|
|
1894
1903
|
if (t == 0) return e;
|
|
1895
1904
|
var n = this._buffer.indexOf("\x1B");
|
|
1896
|
-
if (n == -1) return e.kind =
|
|
1897
|
-
if (n > 0) return e.kind =
|
|
1905
|
+
if (n == -1) return e.kind = W.Text, e.text = this._buffer, this._buffer = "", e;
|
|
1906
|
+
if (n > 0) return e.kind = W.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
|
|
1898
1907
|
if (n == 0) {
|
|
1899
|
-
if (t < 3) return e.kind =
|
|
1908
|
+
if (t < 3) return e.kind = W.Incomplete, e;
|
|
1900
1909
|
var r = this._buffer.charAt(1);
|
|
1901
|
-
if (r != "[" && r != "]" && r != "(") return e.kind =
|
|
1910
|
+
if (r != "[" && r != "]" && r != "(") return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1902
1911
|
if (r == "[") {
|
|
1903
|
-
this._csi_regex ||=
|
|
1912
|
+
this._csi_regex ||= Cr(Tr ||= xr(["\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 "]));
|
|
1904
1913
|
let t = this._buffer.match(this._csi_regex);
|
|
1905
|
-
if (t === null) return e.kind =
|
|
1906
|
-
if (t[4]) return e.kind =
|
|
1907
|
-
e.kind = t[1] != "" || t[3] != "m" ?
|
|
1914
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1915
|
+
if (t[4]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1916
|
+
e.kind = t[1] != "" || t[3] != "m" ? W.Unknown : W.SGR, e.text = t[2];
|
|
1908
1917
|
var i = t[0].length;
|
|
1909
1918
|
return this._buffer = this._buffer.slice(i), e;
|
|
1910
1919
|
}
|
|
1911
1920
|
if (r == "]") {
|
|
1912
|
-
if (t < 4) return e.kind =
|
|
1913
|
-
if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind =
|
|
1914
|
-
this._osc_st ||=
|
|
1921
|
+
if (t < 4) return e.kind = W.Incomplete, e;
|
|
1922
|
+
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;
|
|
1923
|
+
this._osc_st ||= wr(Er ||= xr(["\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;
|
|
1915
1924
|
{
|
|
1916
1925
|
let t = this._osc_st.exec(this._buffer);
|
|
1917
|
-
if (t === null) return e.kind =
|
|
1918
|
-
if (t[3]) return e.kind =
|
|
1926
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1927
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1919
1928
|
}
|
|
1920
1929
|
{
|
|
1921
1930
|
let t = this._osc_st.exec(this._buffer);
|
|
1922
|
-
if (t === null) return e.kind =
|
|
1923
|
-
if (t[3]) return e.kind =
|
|
1931
|
+
if (t === null) return e.kind = W.Incomplete, e;
|
|
1932
|
+
if (t[3]) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1924
1933
|
}
|
|
1925
|
-
this._osc_regex ||=
|
|
1934
|
+
this._osc_regex ||= Cr(Dr ||= xr(["\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 "]));
|
|
1926
1935
|
let n = this._buffer.match(this._osc_regex);
|
|
1927
|
-
if (n === null) return e.kind =
|
|
1928
|
-
e.kind =
|
|
1936
|
+
if (n === null) return e.kind = W.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1937
|
+
e.kind = W.OSCURL, e.url = n[1], e.text = n[2];
|
|
1929
1938
|
var i = n[0].length;
|
|
1930
1939
|
return this._buffer = this._buffer.slice(i), e;
|
|
1931
1940
|
}
|
|
1932
|
-
if (r == "(") return e.kind =
|
|
1941
|
+
if (r == "(") return e.kind = W.Unknown, this._buffer = this._buffer.slice(3), e;
|
|
1933
1942
|
}
|
|
1934
1943
|
}
|
|
1935
1944
|
ansi_to_html(e) {
|
|
1936
1945
|
this.append_buffer(e);
|
|
1937
1946
|
for (var t = [];;) {
|
|
1938
1947
|
var n = this.get_next_packet();
|
|
1939
|
-
if (n.kind ==
|
|
1940
|
-
n.kind !=
|
|
1948
|
+
if (n.kind == W.EOS || n.kind == W.Incomplete) break;
|
|
1949
|
+
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)));
|
|
1941
1950
|
}
|
|
1942
1951
|
return t.join("");
|
|
1943
1952
|
}
|
|
@@ -2007,16 +2016,16 @@ var br = class {
|
|
|
2007
2016
|
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>`;
|
|
2008
2017
|
}
|
|
2009
2018
|
};
|
|
2010
|
-
function
|
|
2019
|
+
function Cr(e, ...t) {
|
|
2011
2020
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2012
2021
|
return new RegExp(n);
|
|
2013
2022
|
}
|
|
2014
|
-
function
|
|
2023
|
+
function wr(e, ...t) {
|
|
2015
2024
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
2016
2025
|
return new RegExp(n, "g");
|
|
2017
2026
|
}
|
|
2018
|
-
var
|
|
2019
|
-
function
|
|
2027
|
+
var Tr, Er, Dr, Or = new Sr();
|
|
2028
|
+
function G(e) {
|
|
2020
2029
|
try {
|
|
2021
2030
|
let t = document.createElement("div");
|
|
2022
2031
|
return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
|
|
@@ -2024,24 +2033,24 @@ function W(e) {
|
|
|
2024
2033
|
return n.error("Error parsing HTML content:", t), e;
|
|
2025
2034
|
}
|
|
2026
2035
|
}
|
|
2027
|
-
function
|
|
2036
|
+
function kr(e) {
|
|
2028
2037
|
if (!e) return "";
|
|
2029
2038
|
try {
|
|
2030
|
-
return
|
|
2039
|
+
return G(Or.ansi_to_html(e));
|
|
2031
2040
|
} catch (t) {
|
|
2032
2041
|
return n.error("Error converting ANSI to plain text:", t), e;
|
|
2033
2042
|
}
|
|
2034
2043
|
}
|
|
2035
2044
|
//#endregion
|
|
2036
2045
|
//#region src/core/errors/traceback-atom.ts
|
|
2037
|
-
var
|
|
2046
|
+
var Ar = C(null);
|
|
2038
2047
|
//#endregion
|
|
2039
2048
|
//#region src/core/cells/logs.ts
|
|
2040
|
-
function
|
|
2049
|
+
function jr(e) {
|
|
2041
2050
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
2042
2051
|
}
|
|
2043
|
-
var
|
|
2044
|
-
function
|
|
2052
|
+
var Mr = !1;
|
|
2053
|
+
function Nr(e) {
|
|
2045
2054
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
2046
2055
|
for (let r of n) {
|
|
2047
2056
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -2051,7 +2060,7 @@ function jr(e) {
|
|
|
2051
2060
|
case "stdout":
|
|
2052
2061
|
case "stderr":
|
|
2053
2062
|
case "marimo-error": {
|
|
2054
|
-
let a = f.asString(r.data), o = i ?
|
|
2063
|
+
let a = f.asString(r.data), o = i ? G(a) : a;
|
|
2055
2064
|
t.push({
|
|
2056
2065
|
timestamp: r.timestamp || Date.now(),
|
|
2057
2066
|
level: n ? "stderr" : "stdout",
|
|
@@ -2066,9 +2075,9 @@ function jr(e) {
|
|
|
2066
2075
|
}
|
|
2067
2076
|
}
|
|
2068
2077
|
}
|
|
2069
|
-
if (t.forEach(
|
|
2078
|
+
if (t.forEach(Pr.log), n.length === 0 && Kn(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
2070
2079
|
e.output.data.forEach((t) => {
|
|
2071
|
-
|
|
2080
|
+
Pr.log({
|
|
2072
2081
|
level: "stderr",
|
|
2073
2082
|
source: {
|
|
2074
2083
|
type: "cell",
|
|
@@ -2078,18 +2087,18 @@ function jr(e) {
|
|
|
2078
2087
|
message: JSON.stringify(t)
|
|
2079
2088
|
});
|
|
2080
2089
|
});
|
|
2081
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
2082
|
-
if (t.length > 0 && !
|
|
2083
|
-
|
|
2090
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = w.get(_e) === "read";
|
|
2091
|
+
if (t.length > 0 && !Mr && n) {
|
|
2092
|
+
Mr = !0;
|
|
2084
2093
|
let e = t.find((e) => e.traceback);
|
|
2085
2094
|
s(e ? {
|
|
2086
2095
|
title: "An internal error occurred",
|
|
2087
2096
|
description: e.msg || "Click 'View' to see traceback",
|
|
2088
2097
|
variant: "danger",
|
|
2089
|
-
action:
|
|
2098
|
+
action: D.createElement(se, {
|
|
2090
2099
|
altText: "View traceback",
|
|
2091
2100
|
onClick: () => {
|
|
2092
|
-
|
|
2101
|
+
w.set(Ar, {
|
|
2093
2102
|
traceback: e.traceback,
|
|
2094
2103
|
errorMessage: e.msg || "An internal error occurred"
|
|
2095
2104
|
});
|
|
@@ -2104,13 +2113,13 @@ function jr(e) {
|
|
|
2104
2113
|
}
|
|
2105
2114
|
return t;
|
|
2106
2115
|
}
|
|
2107
|
-
var
|
|
2116
|
+
var Pr = { log: (e) => {
|
|
2108
2117
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
2109
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
2118
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Fr(e.timestamp)}]`, `(${jr(e.source)}) ${e.message}`);
|
|
2110
2119
|
} };
|
|
2111
|
-
function
|
|
2120
|
+
function Fr(e) {
|
|
2112
2121
|
try {
|
|
2113
|
-
return
|
|
2122
|
+
return br(e).toLocaleTimeString(void 0, {
|
|
2114
2123
|
hour12: !0,
|
|
2115
2124
|
hour: "numeric",
|
|
2116
2125
|
minute: "numeric",
|
|
@@ -2120,26 +2129,26 @@ function Nr(e) {
|
|
|
2120
2129
|
return "";
|
|
2121
2130
|
}
|
|
2122
2131
|
}
|
|
2123
|
-
var
|
|
2124
|
-
function
|
|
2132
|
+
var Ir = /* @__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("."));
|
|
2133
|
+
function Lr(e, t = !0) {
|
|
2125
2134
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
2126
2135
|
}
|
|
2127
|
-
function
|
|
2128
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
2136
|
+
function Rr(e, t) {
|
|
2137
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !Ir.has(e);
|
|
2129
2138
|
if (i(e)) return e;
|
|
2130
2139
|
let a = 1;
|
|
2131
2140
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
2132
2141
|
return r;
|
|
2133
2142
|
}
|
|
2134
|
-
function
|
|
2135
|
-
return
|
|
2143
|
+
function zr(e, t) {
|
|
2144
|
+
return Br(e) ? `cell-${t}` : e;
|
|
2136
2145
|
}
|
|
2137
|
-
function
|
|
2146
|
+
function Br(e) {
|
|
2138
2147
|
return !e || e === "_" || e === "__";
|
|
2139
2148
|
}
|
|
2140
2149
|
//#endregion
|
|
2141
2150
|
//#region src/core/cells/types.ts
|
|
2142
|
-
function
|
|
2151
|
+
function Vr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
2143
2152
|
return {
|
|
2144
2153
|
id: e,
|
|
2145
2154
|
config: r || {
|
|
@@ -2152,7 +2161,7 @@ function zr({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
2152
2161
|
code: n
|
|
2153
2162
|
};
|
|
2154
2163
|
}
|
|
2155
|
-
function
|
|
2164
|
+
function Hr(e) {
|
|
2156
2165
|
return {
|
|
2157
2166
|
hide_code: !1,
|
|
2158
2167
|
disabled: !1,
|
|
@@ -2161,7 +2170,7 @@ function Br(e) {
|
|
|
2161
2170
|
...e
|
|
2162
2171
|
};
|
|
2163
2172
|
}
|
|
2164
|
-
function
|
|
2173
|
+
function Ur(e) {
|
|
2165
2174
|
return {
|
|
2166
2175
|
embeddedConsole: [],
|
|
2167
2176
|
...e
|
|
@@ -2169,7 +2178,7 @@ function Vr(e) {
|
|
|
2169
2178
|
}
|
|
2170
2179
|
//#endregion
|
|
2171
2180
|
//#region src/core/cells/execution-console.ts
|
|
2172
|
-
function
|
|
2181
|
+
function Wr(e, t, n) {
|
|
2173
2182
|
let r = e.time === void 0 ? t : Date.parse(e.time) / 1e3, i = e.seq + 1;
|
|
2174
2183
|
switch (e.kind) {
|
|
2175
2184
|
case "console":
|
|
@@ -2200,49 +2209,49 @@ function Hr(e, t, n) {
|
|
|
2200
2209
|
};
|
|
2201
2210
|
}
|
|
2202
2211
|
}
|
|
2203
|
-
function
|
|
2212
|
+
function Gr(e, t) {
|
|
2204
2213
|
return {
|
|
2205
2214
|
onOutput(e, t) {
|
|
2206
|
-
|
|
2215
|
+
ar.INSTANCE.trackOutput(e, t);
|
|
2207
2216
|
},
|
|
2208
2217
|
onExecution(n, r) {
|
|
2209
2218
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2210
2219
|
},
|
|
2211
2220
|
onItem(t, n, r) {
|
|
2212
|
-
let i = t.cell_id ?? "__scratch__", a =
|
|
2213
|
-
o.channel === "media" &&
|
|
2221
|
+
let i = t.cell_id ?? "__scratch__", a = N(t), o = Wr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2222
|
+
o.channel === "media" && ar.INSTANCE.track({
|
|
2214
2223
|
cell_id: i,
|
|
2215
2224
|
output: o
|
|
2216
|
-
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs:
|
|
2225
|
+
}), r && (o.channel === "stdout" || o.channel === "stderr") && e.addLogs({ logs: Nr({
|
|
2217
2226
|
cell_id: i,
|
|
2218
2227
|
console: o
|
|
2219
2228
|
}) });
|
|
2220
2229
|
}
|
|
2221
2230
|
};
|
|
2222
2231
|
}
|
|
2223
|
-
function
|
|
2232
|
+
function Kr(e, t, n = e(S)) {
|
|
2224
2233
|
if (!n) return;
|
|
2225
2234
|
let r = e(n.executionsAtom);
|
|
2226
2235
|
if (t === "__scratch__") return r.scratchConsole;
|
|
2227
2236
|
let i = r.latest.get(t);
|
|
2228
2237
|
return i === void 0 ? void 0 : r.executions.get(i);
|
|
2229
2238
|
}
|
|
2230
|
-
function
|
|
2239
|
+
function qr(e, t) {
|
|
2231
2240
|
let { local: n, execution: r, code: i } = e;
|
|
2232
2241
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2233
|
-
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a &&
|
|
2242
|
+
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && N(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2234
2243
|
if (o && o.executionId === a?.id && e.seq <= o.seq && !(e.kind === "input" && o.prompts.has(e.id)) || e.kind === "input" && s?.executionId === e.execution_id && s.ids.has(e.id)) return;
|
|
2235
|
-
let t =
|
|
2244
|
+
let t = Wr(e, l, i);
|
|
2236
2245
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
2237
2246
|
}, d = n.commandConsole?.entries, f = r?.append;
|
|
2238
2247
|
if (t && t.local === n && t.code === i && t.execution && f && f.before.deref() === t.execution.items && (!d?.length || d.every((e) => e.afterSeq !== void 0 && e.afterSeq < f.item.seq))) {
|
|
2239
2248
|
let n = u(f.item), r = t.rendered.consoleOutputs;
|
|
2240
2249
|
return {
|
|
2241
2250
|
...e,
|
|
2242
|
-
rendered: { consoleOutputs: n ?
|
|
2251
|
+
rendered: { consoleOutputs: n ? fr([...r, n]) : r }
|
|
2243
2252
|
};
|
|
2244
2253
|
}
|
|
2245
|
-
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole :
|
|
2254
|
+
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : nt(r).flatMap((e) => u(e) ?? []);
|
|
2246
2255
|
if (d?.length) {
|
|
2247
2256
|
let e = d.every((e) => e.afterSeq !== void 0) && p.every((e) => e.id !== void 0), t = (e) => e.afterSeq === void 0 ? e.id ?? 0 : e.afterSeq + 1.5;
|
|
2248
2257
|
p = [...p, ...d.map((e, t) => ({
|
|
@@ -2252,12 +2261,12 @@ function Gr(e, t) {
|
|
|
2252
2261
|
}
|
|
2253
2262
|
return {
|
|
2254
2263
|
...e,
|
|
2255
|
-
rendered: { consoleOutputs:
|
|
2264
|
+
rendered: { consoleOutputs: pr(p) }
|
|
2256
2265
|
};
|
|
2257
2266
|
}
|
|
2258
2267
|
//#endregion
|
|
2259
2268
|
//#region src/core/cells/columns.ts
|
|
2260
|
-
function
|
|
2269
|
+
function Jr(e) {
|
|
2261
2270
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
2262
2271
|
for (let r of e.order) {
|
|
2263
2272
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -2265,9 +2274,9 @@ function Kr(e) {
|
|
|
2265
2274
|
}
|
|
2266
2275
|
return t;
|
|
2267
2276
|
}
|
|
2268
|
-
function
|
|
2277
|
+
function Yr(e) {
|
|
2269
2278
|
let t = [[]];
|
|
2270
|
-
for (let [n, r] of
|
|
2279
|
+
for (let [n, r] of Jr(e)) {
|
|
2271
2280
|
for (; t.length <= r;) t.push([]);
|
|
2272
2281
|
t[r].push(n);
|
|
2273
2282
|
}
|
|
@@ -2275,21 +2284,21 @@ function qr(e) {
|
|
|
2275
2284
|
}
|
|
2276
2285
|
//#endregion
|
|
2277
2286
|
//#region src/core/cells/layout.ts
|
|
2278
|
-
var
|
|
2279
|
-
function
|
|
2280
|
-
return `column-${
|
|
2287
|
+
var Xr = C(/* @__PURE__ */ new Set()), Zr = C([]), Qr = C([]);
|
|
2288
|
+
function $r() {
|
|
2289
|
+
return `column-${er.create()}`;
|
|
2281
2290
|
}
|
|
2282
|
-
var
|
|
2283
|
-
let r =
|
|
2291
|
+
var ei = C(null, (e, t, n) => {
|
|
2292
|
+
let r = Yr(n).length, i = e(Zr);
|
|
2284
2293
|
if (i.length === r) return;
|
|
2285
|
-
let a = e(
|
|
2286
|
-
for (; o.length < r;) o.push(
|
|
2287
|
-
t(
|
|
2288
|
-
}),
|
|
2289
|
-
let t = e(
|
|
2294
|
+
let a = e(Qr), o = [...i, ...a].slice(0, r);
|
|
2295
|
+
for (; o.length < r;) o.push($r());
|
|
2296
|
+
t(Zr, o), t(Qr, a.slice(Math.max(0, r - i.length)));
|
|
2297
|
+
}), ti = T(C((e) => {
|
|
2298
|
+
let t = e(_);
|
|
2290
2299
|
return t === null ? null : e(t.documentAtom);
|
|
2291
|
-
}), (e) => e === null ? [[]] :
|
|
2292
|
-
let t = e(
|
|
2300
|
+
}), (e) => e === null ? [[]] : Yr(e), b), ni = C((e) => {
|
|
2301
|
+
let t = e(ti), n = e(Zr), r = e(Qr);
|
|
2293
2302
|
return [...t.map((e, t) => ({
|
|
2294
2303
|
id: n[t] ?? `column-${t}`,
|
|
2295
2304
|
ids: e
|
|
@@ -2298,18 +2307,18 @@ var Qr = S(null, (e, t, n) => {
|
|
|
2298
2307
|
ids: []
|
|
2299
2308
|
}))];
|
|
2300
2309
|
});
|
|
2301
|
-
function
|
|
2310
|
+
function ri(e, t, n) {
|
|
2302
2311
|
let r = /* @__PURE__ */ new Map();
|
|
2303
2312
|
return e.forEach((i, a) => {
|
|
2304
2313
|
let o = t[a];
|
|
2305
2314
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
2306
|
-
let s =
|
|
2315
|
+
let s = Xe(a, t);
|
|
2307
2316
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2308
2317
|
}), r;
|
|
2309
2318
|
}
|
|
2310
|
-
function
|
|
2319
|
+
function ii(e, t, n) {
|
|
2311
2320
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2312
|
-
let i =
|
|
2321
|
+
let i = ri(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2313
2322
|
return {
|
|
2314
2323
|
id: e,
|
|
2315
2324
|
ids: r,
|
|
@@ -2318,36 +2327,36 @@ function ni(e, t, n) {
|
|
|
2318
2327
|
};
|
|
2319
2328
|
}) };
|
|
2320
2329
|
}
|
|
2321
|
-
var
|
|
2322
|
-
let t = e(
|
|
2323
|
-
return
|
|
2324
|
-
}),
|
|
2325
|
-
function
|
|
2330
|
+
var ai = C((e) => {
|
|
2331
|
+
let t = e(Ua);
|
|
2332
|
+
return ii(e(ni), (e) => t[e] ?? null, e(Xr));
|
|
2333
|
+
}), oi = () => x(ai), si = C((e) => e(ai).columns.length);
|
|
2334
|
+
function ci(e, t) {
|
|
2326
2335
|
return e.columns.find((e) => e.id === t);
|
|
2327
2336
|
}
|
|
2328
|
-
function
|
|
2337
|
+
function li(e, t) {
|
|
2329
2338
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2330
2339
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2331
2340
|
return n;
|
|
2332
2341
|
}
|
|
2333
|
-
function
|
|
2342
|
+
function ui(e, t) {
|
|
2334
2343
|
for (let n of e.columns) {
|
|
2335
2344
|
let e = n.folds.get(t);
|
|
2336
2345
|
if (e !== void 0) return e;
|
|
2337
2346
|
}
|
|
2338
2347
|
}
|
|
2339
|
-
function
|
|
2348
|
+
function di(e, t) {
|
|
2340
2349
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2341
2350
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2342
2351
|
}
|
|
2343
|
-
function
|
|
2344
|
-
let n =
|
|
2345
|
-
return
|
|
2352
|
+
function fi(e, t) {
|
|
2353
|
+
let n = di(e, t);
|
|
2354
|
+
return ui(e, t) === void 0 ? n : [...n, t];
|
|
2346
2355
|
}
|
|
2347
2356
|
//#endregion
|
|
2348
2357
|
//#region src/core/cells/document.ts
|
|
2349
|
-
function
|
|
2350
|
-
let n = t.code ?? e.code, r =
|
|
2358
|
+
function pi(e, t) {
|
|
2359
|
+
let n = t.code ?? e.code, r = b(e.config, t.config) ? e.config : Hr(t.config);
|
|
2351
2360
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2352
2361
|
...e,
|
|
2353
2362
|
name: t.name,
|
|
@@ -2359,30 +2368,30 @@ function di(e, t) {
|
|
|
2359
2368
|
config: r
|
|
2360
2369
|
};
|
|
2361
2370
|
}
|
|
2362
|
-
function
|
|
2363
|
-
let n =
|
|
2371
|
+
function mi(e, t) {
|
|
2372
|
+
let n = b(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2364
2373
|
for (let o of n) {
|
|
2365
2374
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
2366
2375
|
if (n === void 0) continue;
|
|
2367
2376
|
if (s === void 0) {
|
|
2368
2377
|
r = {
|
|
2369
2378
|
...r,
|
|
2370
|
-
[o]:
|
|
2379
|
+
[o]: Vr({
|
|
2371
2380
|
id: o,
|
|
2372
2381
|
code: n.code ?? "",
|
|
2373
2382
|
name: n.name,
|
|
2374
|
-
config:
|
|
2383
|
+
config: Hr(n.config)
|
|
2375
2384
|
})
|
|
2376
2385
|
}, i = {
|
|
2377
2386
|
...i,
|
|
2378
|
-
[o]: i[o] ??
|
|
2387
|
+
[o]: i[o] ?? Ur()
|
|
2379
2388
|
}, a = {
|
|
2380
2389
|
...a,
|
|
2381
|
-
[o]: (0,
|
|
2390
|
+
[o]: (0, D.createRef)()
|
|
2382
2391
|
};
|
|
2383
2392
|
continue;
|
|
2384
2393
|
}
|
|
2385
|
-
let c =
|
|
2394
|
+
let c = pi(s, n);
|
|
2386
2395
|
c !== s && (r = {
|
|
2387
2396
|
...r,
|
|
2388
2397
|
[o]: c
|
|
@@ -2401,39 +2410,50 @@ function fi(e, t) {
|
|
|
2401
2410
|
cellHandles: a
|
|
2402
2411
|
};
|
|
2403
2412
|
}
|
|
2404
|
-
function
|
|
2413
|
+
function hi({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2405
2414
|
let i = () => {
|
|
2406
2415
|
let r = e.get(t.documentAtom);
|
|
2407
|
-
r !== null && (n(r), e.set(
|
|
2416
|
+
r !== null && (n(r), e.set(ei, r));
|
|
2408
2417
|
}, a = e.sub(t.documentAtom, i);
|
|
2409
2418
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2410
2419
|
}
|
|
2411
|
-
async function
|
|
2412
|
-
let e =
|
|
2413
|
-
e !== null &&
|
|
2420
|
+
async function gi() {
|
|
2421
|
+
let e = w.get(_);
|
|
2422
|
+
e !== null && w.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2414
2423
|
}
|
|
2415
2424
|
//#endregion
|
|
2416
2425
|
//#region src/core/cells/editor.ts
|
|
2417
|
-
var
|
|
2418
|
-
function
|
|
2426
|
+
var K = C(/* @__PURE__ */ new Set());
|
|
2427
|
+
function _i(e, t, n) {
|
|
2419
2428
|
return !!e && !t.has(n);
|
|
2420
2429
|
}
|
|
2421
|
-
|
|
2422
|
-
t(
|
|
2423
|
-
}),
|
|
2430
|
+
C(null, (e, t, { cellId: n }) => {
|
|
2431
|
+
t(K, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2432
|
+
}), C(null, (e, t, { cellId: n }) => e(K).has(n) ? (t(K, (e) => {
|
|
2424
2433
|
let t = new Set(e);
|
|
2425
2434
|
return t.delete(n), t;
|
|
2426
2435
|
}), !0) : !1);
|
|
2427
|
-
var
|
|
2428
|
-
|
|
2429
|
-
t(
|
|
2436
|
+
var vi = C(/* @__PURE__ */ new Map());
|
|
2437
|
+
C(null, (e, t, { cellId: n }) => {
|
|
2438
|
+
t(vi, (e) => {
|
|
2430
2439
|
let t = new Map(e);
|
|
2431
2440
|
return t.delete(n), t;
|
|
2432
2441
|
});
|
|
2433
2442
|
});
|
|
2443
|
+
function yi(e, t) {
|
|
2444
|
+
if (t.length === 0) return e;
|
|
2445
|
+
let n = [...e], r = n.at(-1), i = 0;
|
|
2446
|
+
if (r && r.length < 128) {
|
|
2447
|
+
let e = [...r];
|
|
2448
|
+
for (; i < t.length && e.length < 128;) e.push(t[i]), i++;
|
|
2449
|
+
n[n.length - 1] = e;
|
|
2450
|
+
}
|
|
2451
|
+
for (; i < t.length; i += 128) n.push(t.slice(i, i + 128));
|
|
2452
|
+
return n;
|
|
2453
|
+
}
|
|
2434
2454
|
//#endregion
|
|
2435
2455
|
//#region src/utils/timeout.ts
|
|
2436
|
-
function
|
|
2456
|
+
function bi(e, t) {
|
|
2437
2457
|
let { retries: r, delay: i, initialDelay: a = 0 } = t, o = 0, s = () => {
|
|
2438
2458
|
if (o < r) {
|
|
2439
2459
|
try {
|
|
@@ -2448,20 +2468,20 @@ function _i(e, t) {
|
|
|
2448
2468
|
}
|
|
2449
2469
|
//#endregion
|
|
2450
2470
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2451
|
-
function
|
|
2452
|
-
|
|
2471
|
+
function xi(e) {
|
|
2472
|
+
bi(() => (e.focus(), e.hasFocus), {
|
|
2453
2473
|
retries: 5,
|
|
2454
2474
|
delay: 20
|
|
2455
2475
|
});
|
|
2456
2476
|
}
|
|
2457
|
-
function
|
|
2458
|
-
let r = document.getElementById(
|
|
2459
|
-
r ?
|
|
2477
|
+
function Si(e, t) {
|
|
2478
|
+
let r = document.getElementById(H.create(e));
|
|
2479
|
+
r ? wi(r, t) : n.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2460
2480
|
}
|
|
2461
|
-
function
|
|
2481
|
+
function Ci() {
|
|
2462
2482
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2463
2483
|
}
|
|
2464
|
-
function
|
|
2484
|
+
function wi(e, t) {
|
|
2465
2485
|
try {
|
|
2466
2486
|
e.focus(t);
|
|
2467
2487
|
} catch {
|
|
@@ -2470,18 +2490,18 @@ function xi(e, t) {
|
|
|
2470
2490
|
}
|
|
2471
2491
|
//#endregion
|
|
2472
2492
|
//#region src/core/network/requests.ts
|
|
2473
|
-
var
|
|
2474
|
-
function
|
|
2475
|
-
let e =
|
|
2476
|
-
return
|
|
2493
|
+
var Ti = C(null);
|
|
2494
|
+
function Ei() {
|
|
2495
|
+
let e = x(Ti);
|
|
2496
|
+
return E(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2477
2497
|
}
|
|
2478
|
-
function
|
|
2479
|
-
let e =
|
|
2480
|
-
return
|
|
2498
|
+
function Di() {
|
|
2499
|
+
let e = w.get(Ti);
|
|
2500
|
+
return E(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2481
2501
|
}
|
|
2482
2502
|
//#endregion
|
|
2483
2503
|
//#region src/utils/storage/storage.ts
|
|
2484
|
-
var
|
|
2504
|
+
var Oi = class {
|
|
2485
2505
|
store = /* @__PURE__ */ new Map();
|
|
2486
2506
|
get length() {
|
|
2487
2507
|
return this.store.size;
|
|
@@ -2502,16 +2522,16 @@ var Ti = class {
|
|
|
2502
2522
|
this.store.set(e, t);
|
|
2503
2523
|
}
|
|
2504
2524
|
};
|
|
2505
|
-
function
|
|
2506
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
2507
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2525
|
+
function ki() {
|
|
2526
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = xe();
|
|
2527
|
+
return e ? window.localStorage : t ? window.sessionStorage : new Oi();
|
|
2508
2528
|
}
|
|
2509
|
-
var
|
|
2510
|
-
function
|
|
2511
|
-
return
|
|
2529
|
+
var Ai = ki(), ji = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Mi = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ni = /^data:image\//i, Pi = ["avatars.githubusercontent.com"];
|
|
2530
|
+
function Fi(e) {
|
|
2531
|
+
return Ni.test(e) ? [{
|
|
2512
2532
|
type: "image",
|
|
2513
2533
|
url: e
|
|
2514
|
-
}] : e.split(
|
|
2534
|
+
}] : e.split(ji).filter((e) => e !== "").map((e) => ji.test(e) ? Mi.test(e) || Ni.test(e) || Pi.some((t) => e.includes(t)) ? {
|
|
2515
2535
|
type: "image",
|
|
2516
2536
|
url: e
|
|
2517
2537
|
} : {
|
|
@@ -2524,48 +2544,48 @@ function Mi(e) {
|
|
|
2524
2544
|
}
|
|
2525
2545
|
//#endregion
|
|
2526
2546
|
//#region src/utils/json/json-parser.ts
|
|
2527
|
-
var
|
|
2547
|
+
var Ii = new RegExp(ji.source, "g");
|
|
2528
2548
|
BigInt.prototype.toJSON = function() {
|
|
2529
2549
|
return JSON.rawJSON(this.toString());
|
|
2530
2550
|
};
|
|
2531
|
-
function
|
|
2551
|
+
function Li(e) {
|
|
2532
2552
|
try {
|
|
2533
|
-
return JSON.parse(e, (e, t) =>
|
|
2553
|
+
return JSON.parse(e, (e, t) => Vi(t));
|
|
2534
2554
|
} catch {}
|
|
2535
2555
|
if (e == null || e === "") return {};
|
|
2536
2556
|
try {
|
|
2537
|
-
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 :
|
|
2557
|
+
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 : Vi(t) : Vi(t));
|
|
2538
2558
|
} catch {
|
|
2539
2559
|
return {};
|
|
2540
2560
|
}
|
|
2541
2561
|
}
|
|
2542
|
-
function
|
|
2562
|
+
function Ri(e) {
|
|
2543
2563
|
if (e.length === 0) return "";
|
|
2544
2564
|
let t = Object.keys(e[0]);
|
|
2545
2565
|
return [
|
|
2546
2566
|
`| ${t.join(" | ")} |`,
|
|
2547
2567
|
`|${t.map(() => "---").join("|")}|`,
|
|
2548
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2568
|
+
...e.map((e) => `| ${t.map((t) => zi(e[t])).join(" | ")} |`)
|
|
2549
2569
|
].join("\n");
|
|
2550
2570
|
}
|
|
2551
|
-
function
|
|
2571
|
+
function zi(e) {
|
|
2552
2572
|
if (e == null) return "";
|
|
2553
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2573
|
+
if (Array.isArray(e) || typeof e == "object") return Bi(JSON.stringify(e));
|
|
2554
2574
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2555
2575
|
t = t.replaceAll(n, (e) => {
|
|
2556
2576
|
let t = `__MDLINK_${i++}__`;
|
|
2557
2577
|
return r.set(t, e), t;
|
|
2558
|
-
}), t = t.replaceAll(
|
|
2578
|
+
}), t = t.replaceAll(Ii, "[$1]($1)");
|
|
2559
2579
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2560
|
-
return
|
|
2580
|
+
return Bi(t);
|
|
2561
2581
|
}
|
|
2562
|
-
function
|
|
2582
|
+
function Bi(e) {
|
|
2563
2583
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2564
2584
|
}
|
|
2565
|
-
function
|
|
2585
|
+
function Vi(e) {
|
|
2566
2586
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2567
2587
|
}
|
|
2568
|
-
var
|
|
2588
|
+
var Hi = new class {
|
|
2569
2589
|
getFilename() {
|
|
2570
2590
|
return this.getSearchParam("filename");
|
|
2571
2591
|
}
|
|
@@ -2592,39 +2612,39 @@ var zi = new class {
|
|
|
2592
2612
|
}();
|
|
2593
2613
|
//#endregion
|
|
2594
2614
|
//#region src/core/dom/htmlUtils.ts
|
|
2595
|
-
function
|
|
2596
|
-
return
|
|
2615
|
+
function Ui(e) {
|
|
2616
|
+
return Li(e ?? "");
|
|
2597
2617
|
}
|
|
2598
|
-
function
|
|
2599
|
-
return
|
|
2618
|
+
function Wi(e) {
|
|
2619
|
+
return ce.mapValues(e.dataset, (e) => typeof e == "string" ? Ui(e) : e);
|
|
2600
2620
|
}
|
|
2601
|
-
function
|
|
2602
|
-
let n = e.parentElement ?
|
|
2603
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2621
|
+
function Gi(e, t) {
|
|
2622
|
+
let n = e.parentElement ? nr.parse(e.parentElement) : void 0;
|
|
2623
|
+
return n && t.has(n) ? t.lookupValue(n) : Ui(e.dataset.initialValue);
|
|
2604
2624
|
}
|
|
2605
|
-
function
|
|
2606
|
-
if (
|
|
2607
|
-
if (
|
|
2608
|
-
let e =
|
|
2625
|
+
function Ki() {
|
|
2626
|
+
if (ie()) return document.title || null;
|
|
2627
|
+
if (ye()) {
|
|
2628
|
+
let e = Hi.getFilename();
|
|
2609
2629
|
if (e) return e;
|
|
2610
2630
|
}
|
|
2611
2631
|
let e = document.querySelector("marimo-filename");
|
|
2612
|
-
|
|
2632
|
+
ve(e, "marimo-filename tag not found");
|
|
2613
2633
|
let t = e.innerHTML;
|
|
2614
2634
|
return t.length === 0 ? null : t;
|
|
2615
2635
|
}
|
|
2616
2636
|
//#endregion
|
|
2617
2637
|
//#region src/core/saving/file-state.ts
|
|
2618
|
-
var
|
|
2619
|
-
|
|
2620
|
-
var
|
|
2621
|
-
|
|
2638
|
+
var qi = C(Ki());
|
|
2639
|
+
C(null);
|
|
2640
|
+
var Ji = C(null);
|
|
2641
|
+
C(void 0);
|
|
2622
2642
|
//#endregion
|
|
2623
2643
|
//#region src/utils/storage/typed.ts
|
|
2624
|
-
var
|
|
2644
|
+
var Yi = class {
|
|
2625
2645
|
defaultValue;
|
|
2626
2646
|
storage;
|
|
2627
|
-
constructor(e, t =
|
|
2647
|
+
constructor(e, t = Ai) {
|
|
2628
2648
|
this.defaultValue = e, this.storage = t;
|
|
2629
2649
|
}
|
|
2630
2650
|
get(e) {
|
|
@@ -2641,11 +2661,11 @@ var Gi = class {
|
|
|
2641
2661
|
remove(e) {
|
|
2642
2662
|
this.storage.removeItem(e);
|
|
2643
2663
|
}
|
|
2644
|
-
},
|
|
2664
|
+
}, Xi = class {
|
|
2645
2665
|
schema;
|
|
2646
2666
|
getDefaultValue;
|
|
2647
2667
|
storage;
|
|
2648
|
-
constructor(e, t, n =
|
|
2668
|
+
constructor(e, t, n = Ai) {
|
|
2649
2669
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2650
2670
|
}
|
|
2651
2671
|
get(e) {
|
|
@@ -2664,15 +2684,15 @@ var Gi = class {
|
|
|
2664
2684
|
remove(e) {
|
|
2665
2685
|
this.storage.removeItem(e);
|
|
2666
2686
|
}
|
|
2667
|
-
},
|
|
2687
|
+
}, Zi = class extends Xi {
|
|
2668
2688
|
filename;
|
|
2669
2689
|
unsubscribeFromFilename;
|
|
2670
2690
|
constructor(e, t, n) {
|
|
2671
|
-
let r =
|
|
2691
|
+
let r = w.get(qi);
|
|
2672
2692
|
super(t, n), this.filename = r;
|
|
2673
2693
|
try {
|
|
2674
|
-
this.unsubscribeFromFilename =
|
|
2675
|
-
let t =
|
|
2694
|
+
this.unsubscribeFromFilename = w.sub(qi, () => {
|
|
2695
|
+
let t = w.get(qi);
|
|
2676
2696
|
this.handleFilenameChange(e, t);
|
|
2677
2697
|
});
|
|
2678
2698
|
} catch {
|
|
@@ -2730,7 +2750,7 @@ var Gi = class {
|
|
|
2730
2750
|
In: "in",
|
|
2731
2751
|
As: "as",
|
|
2732
2752
|
Import: "import"
|
|
2733
|
-
},
|
|
2753
|
+
}, Qi = /* @__PURE__ */ new Set([
|
|
2734
2754
|
q.FunctionDefinition,
|
|
2735
2755
|
q.LambdaExpression,
|
|
2736
2756
|
q.ArrayComprehensionExpression,
|
|
@@ -2742,13 +2762,13 @@ var Gi = class {
|
|
|
2742
2762
|
q.Comment, q.String, q.FormatString;
|
|
2743
2763
|
//#endregion
|
|
2744
2764
|
//#region src/core/codemirror/utils.ts
|
|
2745
|
-
function
|
|
2765
|
+
function $i(e) {
|
|
2746
2766
|
e && e.dispatch({ selection: {
|
|
2747
2767
|
anchor: e.state.doc.length,
|
|
2748
2768
|
head: e.state.doc.length
|
|
2749
2769
|
} });
|
|
2750
2770
|
}
|
|
2751
|
-
function
|
|
2771
|
+
function ea(e) {
|
|
2752
2772
|
requestAnimationFrame(() => {
|
|
2753
2773
|
e.dom.closest(".marimo-cell")?.scrollIntoView({
|
|
2754
2774
|
behavior: "instant",
|
|
@@ -2759,29 +2779,29 @@ function Xi(e) {
|
|
|
2759
2779
|
}
|
|
2760
2780
|
//#endregion
|
|
2761
2781
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2762
|
-
var
|
|
2763
|
-
function
|
|
2782
|
+
var ta = /* @__PURE__ */ new Set([q.ClassDefinition]);
|
|
2783
|
+
function na(e, t) {
|
|
2764
2784
|
requestAnimationFrame(() => {
|
|
2765
2785
|
e.focus(), e.dispatch({
|
|
2766
2786
|
selection: {
|
|
2767
2787
|
anchor: t,
|
|
2768
2788
|
head: t
|
|
2769
2789
|
},
|
|
2770
|
-
effects:
|
|
2790
|
+
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2771
2791
|
});
|
|
2772
|
-
}),
|
|
2792
|
+
}), ea(e);
|
|
2773
2793
|
}
|
|
2774
|
-
function
|
|
2775
|
-
let n =
|
|
2794
|
+
function ra(e, t) {
|
|
2795
|
+
let n = pe(e), r = null;
|
|
2776
2796
|
return n.iterate({ enter: (n) => {
|
|
2777
2797
|
if (r !== null) return !1;
|
|
2778
2798
|
if (n.name === q.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2779
2799
|
if (n.name === q.Comment || n.name === q.String) return !1;
|
|
2780
2800
|
} }), r;
|
|
2781
2801
|
}
|
|
2782
|
-
function
|
|
2802
|
+
function ia(e, t) {
|
|
2783
2803
|
let n = [], r = e.resolveInner(t, 0);
|
|
2784
|
-
for (; r;)
|
|
2804
|
+
for (; r;) Qi.has(r.name) && (n.some((e) => e.type === q.FunctionDefinition || e.type === q.LambdaExpression) && r.name === q.ClassDefinition || n.push({
|
|
2785
2805
|
id: r.from,
|
|
2786
2806
|
type: r.name
|
|
2787
2807
|
})), r = r.parent;
|
|
@@ -2796,12 +2816,12 @@ function Y(e, t, n) {
|
|
|
2796
2816
|
from: n
|
|
2797
2817
|
});
|
|
2798
2818
|
}
|
|
2799
|
-
function
|
|
2819
|
+
function aa(e, t) {
|
|
2800
2820
|
if (e.firstChild()) do
|
|
2801
2821
|
t(e.node);
|
|
2802
2822
|
while (e.nextSibling());
|
|
2803
2823
|
}
|
|
2804
|
-
function
|
|
2824
|
+
function oa(e, t) {
|
|
2805
2825
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2806
2826
|
switch (e.name) {
|
|
2807
2827
|
case q.VariableName:
|
|
@@ -2812,13 +2832,13 @@ function na(e, t) {
|
|
|
2812
2832
|
let n = e.node.cursor();
|
|
2813
2833
|
n.firstChild();
|
|
2814
2834
|
do
|
|
2815
|
-
|
|
2835
|
+
oa(n, t);
|
|
2816
2836
|
while (n.nextSibling());
|
|
2817
2837
|
break;
|
|
2818
2838
|
}
|
|
2819
2839
|
}
|
|
2820
2840
|
}
|
|
2821
|
-
function
|
|
2841
|
+
function sa(e, t) {
|
|
2822
2842
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2823
2843
|
o.firstChild();
|
|
2824
2844
|
do {
|
|
@@ -2830,18 +2850,18 @@ function ra(e, t) {
|
|
|
2830
2850
|
while (e.nextSibling());
|
|
2831
2851
|
} while (o.nextSibling());
|
|
2832
2852
|
}
|
|
2833
|
-
function
|
|
2853
|
+
function ca(e, t) {
|
|
2834
2854
|
let n = e.cursor();
|
|
2835
2855
|
n.firstChild();
|
|
2836
2856
|
let r = !1;
|
|
2837
2857
|
do
|
|
2838
2858
|
if (n.name === J.For) r = !0;
|
|
2839
2859
|
else if (r && n.name === J.In) break;
|
|
2840
|
-
else r &&
|
|
2860
|
+
else r && oa(n, t);
|
|
2841
2861
|
while (n.nextSibling());
|
|
2842
2862
|
}
|
|
2843
|
-
function
|
|
2844
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2863
|
+
function la(e, t) {
|
|
2864
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Qi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2845
2865
|
switch (s) {
|
|
2846
2866
|
case q.FunctionDefinition:
|
|
2847
2867
|
case q.ClassDefinition: {
|
|
@@ -2853,7 +2873,7 @@ function aa(e, t) {
|
|
|
2853
2873
|
break;
|
|
2854
2874
|
}
|
|
2855
2875
|
while (t.nextSibling());
|
|
2856
|
-
s === q.FunctionDefinition &&
|
|
2876
|
+
s === q.FunctionDefinition && sa(e, {
|
|
2857
2877
|
state: n,
|
|
2858
2878
|
variableName: r,
|
|
2859
2879
|
scopeId: c,
|
|
@@ -2862,7 +2882,7 @@ function aa(e, t) {
|
|
|
2862
2882
|
break;
|
|
2863
2883
|
}
|
|
2864
2884
|
case q.LambdaExpression:
|
|
2865
|
-
|
|
2885
|
+
sa(e, {
|
|
2866
2886
|
state: n,
|
|
2867
2887
|
variableName: r,
|
|
2868
2888
|
scopeId: c,
|
|
@@ -2874,7 +2894,7 @@ function aa(e, t) {
|
|
|
2874
2894
|
case q.SetComprehensionExpression:
|
|
2875
2895
|
case q.ComprehensionExpression:
|
|
2876
2896
|
case q.ForStatement:
|
|
2877
|
-
|
|
2897
|
+
ca(e, {
|
|
2878
2898
|
state: n,
|
|
2879
2899
|
variableName: r,
|
|
2880
2900
|
scopeId: u,
|
|
@@ -2892,7 +2912,7 @@ function aa(e, t) {
|
|
|
2892
2912
|
let s = e.cursor();
|
|
2893
2913
|
s.firstChild();
|
|
2894
2914
|
do
|
|
2895
|
-
s.from < o &&
|
|
2915
|
+
s.from < o && oa(s, {
|
|
2896
2916
|
state: n,
|
|
2897
2917
|
variableName: r,
|
|
2898
2918
|
scopeId: u,
|
|
@@ -2927,8 +2947,8 @@ function aa(e, t) {
|
|
|
2927
2947
|
break;
|
|
2928
2948
|
}
|
|
2929
2949
|
}
|
|
2930
|
-
|
|
2931
|
-
|
|
2950
|
+
aa(o, (e) => {
|
|
2951
|
+
la(e, {
|
|
2932
2952
|
state: n,
|
|
2933
2953
|
variableName: r,
|
|
2934
2954
|
scopeStack: l,
|
|
@@ -2936,86 +2956,86 @@ function aa(e, t) {
|
|
|
2936
2956
|
});
|
|
2937
2957
|
});
|
|
2938
2958
|
}
|
|
2939
|
-
function
|
|
2940
|
-
let r =
|
|
2941
|
-
|
|
2959
|
+
function ua(e, t, n) {
|
|
2960
|
+
let r = pe(e), i = [];
|
|
2961
|
+
la(r, {
|
|
2942
2962
|
state: e,
|
|
2943
2963
|
variableName: t,
|
|
2944
2964
|
scopeStack: [],
|
|
2945
2965
|
declarations: i
|
|
2946
2966
|
});
|
|
2947
2967
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2948
|
-
for (let e of
|
|
2949
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2968
|
+
for (let e of ia(r, a)) {
|
|
2969
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !ta.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2950
2970
|
if (t) return t.from;
|
|
2951
2971
|
}
|
|
2952
2972
|
return null;
|
|
2953
2973
|
}
|
|
2954
|
-
function
|
|
2955
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2956
|
-
return i !== null && (
|
|
2974
|
+
function da(e, t, n) {
|
|
2975
|
+
let { state: r } = e, i = n === void 0 ? ra(r, t) : ua(r, t, n);
|
|
2976
|
+
return i !== null && (na(e, i), !0);
|
|
2957
2977
|
}
|
|
2958
|
-
function
|
|
2959
|
-
return
|
|
2978
|
+
function fa(e, t) {
|
|
2979
|
+
return na(e, e.state.doc.line(t).from), !0;
|
|
2960
2980
|
}
|
|
2961
2981
|
//#endregion
|
|
2962
2982
|
//#region src/core/network/connection.ts
|
|
2963
|
-
var X =
|
|
2964
|
-
|
|
2983
|
+
var X = C({ state: j.NOT_STARTED });
|
|
2984
|
+
y(null, (e, t) => t === null ? null : {
|
|
2965
2985
|
phase: t.phase,
|
|
2966
2986
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2967
2987
|
});
|
|
2968
|
-
function
|
|
2969
|
-
return
|
|
2988
|
+
function pa() {
|
|
2989
|
+
return te(X, (e) => e.state === j.OPEN);
|
|
2970
2990
|
}
|
|
2971
|
-
function
|
|
2972
|
-
return
|
|
2991
|
+
function ma() {
|
|
2992
|
+
return ge() ? pa() : Promise.resolve();
|
|
2973
2993
|
}
|
|
2974
|
-
|
|
2994
|
+
C((e) => e(X).state === j.CONNECTING), C((e) => e(X).state === j.OPEN), C((e) => {
|
|
2975
2995
|
let t = e(X);
|
|
2976
|
-
return t.state ===
|
|
2977
|
-
}),
|
|
2996
|
+
return t.state === j.OPEN || t.state === j.NOT_STARTED;
|
|
2997
|
+
}), C((e) => e(X).state === j.CLOSED);
|
|
2978
2998
|
//#endregion
|
|
2979
2999
|
//#region src/components/ui/checkbox.tsx
|
|
2980
|
-
var
|
|
2981
|
-
let n = (0,
|
|
3000
|
+
var ha = D.forwardRef((e, t) => {
|
|
3001
|
+
let n = (0, Fn.c)(13), i, a;
|
|
2982
3002
|
n[0] === e ? (i = n[1], a = n[2]) : ({className: i, ...a} = e, n[0] = e, n[1] = i, n[2] = a);
|
|
2983
3003
|
let o;
|
|
2984
3004
|
n[3] === i ? o = n[4] : (o = r("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), n[3] = i, n[4] = o);
|
|
2985
3005
|
let s;
|
|
2986
3006
|
n[5] === Symbol.for("react.memo_cache_sentinel") ? (s = r("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), n[5] = s) : s = n[5];
|
|
2987
3007
|
let c;
|
|
2988
|
-
n[6] === a.checked ? c = n[7] : (c = /* @__PURE__ */ (0,
|
|
3008
|
+
n[6] === a.checked ? c = n[7] : (c = /* @__PURE__ */ (0, O.jsx)(Fe, {
|
|
2989
3009
|
className: s,
|
|
2990
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
3010
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, O.jsx)(Ce, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, O.jsx)(u, { className: "h-4 w-4" })
|
|
2991
3011
|
}), n[6] = a.checked, n[7] = c);
|
|
2992
3012
|
let l;
|
|
2993
|
-
return n[8] !== a || n[9] !== t || n[10] !== o || n[11] !== c ? (l = /* @__PURE__ */ (0,
|
|
3013
|
+
return n[8] !== a || n[9] !== t || n[10] !== o || n[11] !== c ? (l = /* @__PURE__ */ (0, O.jsx)(Ne, {
|
|
2994
3014
|
ref: t,
|
|
2995
3015
|
className: o,
|
|
2996
3016
|
...a,
|
|
2997
3017
|
children: c
|
|
2998
3018
|
}), n[8] = a, n[9] = t, n[10] = o, n[11] = c, n[12] = l) : l = n[12], l;
|
|
2999
3019
|
});
|
|
3000
|
-
|
|
3020
|
+
ha.displayName = Ne.displayName;
|
|
3001
3021
|
//#endregion
|
|
3002
3022
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
3003
|
-
function
|
|
3023
|
+
function ga({ cellId: e, cell: t, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
3004
3024
|
if (!t) return;
|
|
3005
|
-
let o = document.getElementById(
|
|
3025
|
+
let o = document.getElementById(H.create(e));
|
|
3006
3026
|
if (!o) n.warn("scrollCellIntoView: element not found");
|
|
3007
|
-
else if (
|
|
3027
|
+
else if (Ci()) wi(o);
|
|
3008
3028
|
else {
|
|
3009
|
-
if (r)
|
|
3029
|
+
if (r) wi(o);
|
|
3010
3030
|
else {
|
|
3011
|
-
|
|
3031
|
+
Un.promote(e);
|
|
3012
3032
|
let r = t.current?.editorView;
|
|
3013
3033
|
if (!r) {
|
|
3014
3034
|
n.warn("scrollCellIntoView: editor not found", e);
|
|
3015
3035
|
return;
|
|
3016
3036
|
}
|
|
3017
3037
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
3018
|
-
if (
|
|
3038
|
+
if (xi(r), i === "top") r.dispatch({ selection: {
|
|
3019
3039
|
anchor: 0,
|
|
3020
3040
|
head: 0
|
|
3021
3041
|
} });
|
|
@@ -3025,7 +3045,7 @@ function fa({ cellId: e, cell: t, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3025
3045
|
anchor: e.from,
|
|
3026
3046
|
head: e.from
|
|
3027
3047
|
} });
|
|
3028
|
-
} else a &&
|
|
3048
|
+
} else a && da(r, a);
|
|
3029
3049
|
}
|
|
3030
3050
|
o.scrollIntoView({
|
|
3031
3051
|
behavior: "smooth",
|
|
@@ -3033,21 +3053,21 @@ function fa({ cellId: e, cell: t, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
3033
3053
|
});
|
|
3034
3054
|
}
|
|
3035
3055
|
}
|
|
3036
|
-
function
|
|
3056
|
+
function _a() {
|
|
3037
3057
|
let e = document.getElementById("App");
|
|
3038
3058
|
e?.scrollTo({
|
|
3039
3059
|
top: e.scrollHeight,
|
|
3040
3060
|
behavior: "smooth"
|
|
3041
3061
|
});
|
|
3042
3062
|
}
|
|
3043
|
-
function
|
|
3063
|
+
function va() {
|
|
3044
3064
|
document.getElementById("App")?.scrollTo({
|
|
3045
3065
|
top: 0,
|
|
3046
3066
|
behavior: "smooth"
|
|
3047
3067
|
});
|
|
3048
3068
|
}
|
|
3049
|
-
function
|
|
3050
|
-
let t = document.getElementById(
|
|
3069
|
+
function ya(e) {
|
|
3070
|
+
let t = document.getElementById(H.create(e));
|
|
3051
3071
|
return t?.scrollIntoView({
|
|
3052
3072
|
behavior: "smooth",
|
|
3053
3073
|
block: "center"
|
|
@@ -3055,64 +3075,64 @@ function ha(e) {
|
|
|
3055
3075
|
}
|
|
3056
3076
|
//#endregion
|
|
3057
3077
|
//#region src/core/cells/utils.ts
|
|
3058
|
-
function
|
|
3078
|
+
function ba(e) {
|
|
3059
3079
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
3060
3080
|
}
|
|
3061
|
-
function
|
|
3081
|
+
function xa(e) {
|
|
3062
3082
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3063
3083
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
3064
3084
|
return r;
|
|
3065
3085
|
}
|
|
3066
|
-
function
|
|
3086
|
+
function Sa(e) {
|
|
3067
3087
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
3068
3088
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
3069
3089
|
return r;
|
|
3070
3090
|
}
|
|
3071
|
-
function
|
|
3091
|
+
function Ca(e) {
|
|
3072
3092
|
return e.history.length > 0;
|
|
3073
3093
|
}
|
|
3074
|
-
function
|
|
3094
|
+
function wa(e) {
|
|
3075
3095
|
let t = e.history[e.history.length - 1];
|
|
3076
3096
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
3077
3097
|
}
|
|
3078
|
-
function
|
|
3079
|
-
return e.status === "idle" ?
|
|
3098
|
+
function Ta(e, t, n) {
|
|
3099
|
+
return e.status === "idle" ? ka(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
3080
3100
|
}
|
|
3081
|
-
function*
|
|
3101
|
+
function* Ea(e, t, n) {
|
|
3082
3102
|
for (let r of e.cellIds) {
|
|
3083
|
-
let i =
|
|
3084
|
-
o === null ? a.sourceChanged &&
|
|
3103
|
+
let i = Yt(t, r), a = n(r), o = Ta(i, a, e.cellData[r]);
|
|
3104
|
+
o === null ? a.sourceChanged && Oa(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
3085
3105
|
}
|
|
3086
3106
|
}
|
|
3087
|
-
function
|
|
3107
|
+
function Da(e, t, n) {
|
|
3088
3108
|
let r = null;
|
|
3089
|
-
for (let [, i] of
|
|
3109
|
+
for (let [, i] of Ea(e, t, n)) {
|
|
3090
3110
|
if (i !== "inputs") return i;
|
|
3091
3111
|
r = i;
|
|
3092
3112
|
}
|
|
3093
3113
|
return r;
|
|
3094
3114
|
}
|
|
3095
|
-
function
|
|
3115
|
+
function Oa(e, t) {
|
|
3096
3116
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
3097
3117
|
return r !== void 0 && r.state.status !== "completed";
|
|
3098
3118
|
}
|
|
3099
|
-
function
|
|
3119
|
+
function ka({ status: e, outcome: t, live: n }) {
|
|
3100
3120
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
3101
3121
|
}
|
|
3102
|
-
function
|
|
3122
|
+
function Aa({ errored: e, stopped: t }) {
|
|
3103
3123
|
return {
|
|
3104
3124
|
published: !0,
|
|
3105
3125
|
"has-error": e,
|
|
3106
3126
|
stopped: t
|
|
3107
3127
|
};
|
|
3108
3128
|
}
|
|
3109
|
-
function
|
|
3110
|
-
let a =
|
|
3129
|
+
function ja({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
3130
|
+
let a = Kn(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
3111
3131
|
return (e || t || n || a) && !o;
|
|
3112
3132
|
}
|
|
3113
3133
|
//#endregion
|
|
3114
3134
|
//#region src/core/cells/cells.ts
|
|
3115
|
-
function
|
|
3135
|
+
function Ma(e) {
|
|
3116
3136
|
let t = {
|
|
3117
3137
|
column: 0,
|
|
3118
3138
|
hide_code: !1,
|
|
@@ -3122,24 +3142,24 @@ function Oa(e) {
|
|
|
3122
3142
|
return {
|
|
3123
3143
|
...e,
|
|
3124
3144
|
cellData: {
|
|
3125
|
-
[
|
|
3126
|
-
id:
|
|
3145
|
+
[V]: Vr({
|
|
3146
|
+
id: V,
|
|
3127
3147
|
config: t
|
|
3128
3148
|
}),
|
|
3129
3149
|
...e.cellData
|
|
3130
3150
|
},
|
|
3131
3151
|
cellRuntime: {
|
|
3132
|
-
[
|
|
3152
|
+
[V]: Ur(),
|
|
3133
3153
|
...e.cellRuntime
|
|
3134
3154
|
},
|
|
3135
3155
|
cellHandles: {
|
|
3136
|
-
[
|
|
3156
|
+
[V]: (0, D.createRef)(),
|
|
3137
3157
|
...e.cellHandles
|
|
3138
3158
|
}
|
|
3139
3159
|
};
|
|
3140
3160
|
}
|
|
3141
|
-
function
|
|
3142
|
-
return
|
|
3161
|
+
function Na() {
|
|
3162
|
+
return Ma({
|
|
3143
3163
|
cellIds: [],
|
|
3144
3164
|
cellData: {},
|
|
3145
3165
|
cellRuntime: {},
|
|
@@ -3149,7 +3169,7 @@ function ka() {
|
|
|
3149
3169
|
cellLogs: []
|
|
3150
3170
|
});
|
|
3151
3171
|
}
|
|
3152
|
-
var { reducer:
|
|
3172
|
+
var { reducer: Pa, createActions: Fa, getActionsForStore: Ia, useActions: La, valueAtom: Z } = de(Na, {
|
|
3153
3173
|
startCellConsole: (e, { cellId: t }) => Q({
|
|
3154
3174
|
state: e,
|
|
3155
3175
|
cellId: t,
|
|
@@ -3167,15 +3187,15 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3167
3187
|
cellId: n,
|
|
3168
3188
|
cellReducer: (e) => ({
|
|
3169
3189
|
...e,
|
|
3170
|
-
commandConsole:
|
|
3190
|
+
commandConsole: qn(e.commandConsole, t, e.clearedCommandIds?.[t.op])
|
|
3171
3191
|
})
|
|
3172
3192
|
});
|
|
3173
3193
|
return i || t.op === "pdb-output" ? a : {
|
|
3174
3194
|
...a,
|
|
3175
|
-
cellLogs:
|
|
3195
|
+
cellLogs: yi(a.cellLogs, Nr({
|
|
3176
3196
|
cell_id: n,
|
|
3177
3197
|
console: r
|
|
3178
|
-
})
|
|
3198
|
+
}))
|
|
3179
3199
|
};
|
|
3180
3200
|
},
|
|
3181
3201
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
@@ -3198,7 +3218,7 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3198
3218
|
let n = t[e];
|
|
3199
3219
|
n.commandConsole?.entries.some((e) => e.source === "pdb-output") && (t[e] = {
|
|
3200
3220
|
...n,
|
|
3201
|
-
commandConsole:
|
|
3221
|
+
commandConsole: qn(n.commandConsole, {
|
|
3202
3222
|
op: "pdb-output",
|
|
3203
3223
|
cell_id: e,
|
|
3204
3224
|
entries: [],
|
|
@@ -3211,13 +3231,13 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3211
3231
|
cellRuntime: t
|
|
3212
3232
|
};
|
|
3213
3233
|
},
|
|
3214
|
-
addLogs: (e, t) =>
|
|
3234
|
+
addLogs: (e, t) => t.logs.length === 0 ? e : {
|
|
3215
3235
|
...e,
|
|
3216
|
-
cellLogs:
|
|
3217
|
-
}
|
|
3236
|
+
cellLogs: yi(e.cellLogs, t.logs)
|
|
3237
|
+
},
|
|
3218
3238
|
reconcileDocument: (e, t) => {
|
|
3219
|
-
let n =
|
|
3220
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3239
|
+
let n = mi(e, t);
|
|
3240
|
+
for (let t of e.cellIds) t in n.cellData || to(t);
|
|
3221
3241
|
return n;
|
|
3222
3242
|
},
|
|
3223
3243
|
setStdinResponse: (e, t) => {
|
|
@@ -3232,10 +3252,10 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3232
3252
|
});
|
|
3233
3253
|
},
|
|
3234
3254
|
resetCellRuntimes: (e, t) => {
|
|
3235
|
-
let n =
|
|
3236
|
-
for (let i of [...e.cellIds,
|
|
3255
|
+
let n = ye(), r = { ...e.cellRuntime };
|
|
3256
|
+
for (let i of [...e.cellIds, V]) {
|
|
3237
3257
|
let a = e.cellRuntime[i];
|
|
3238
|
-
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a :
|
|
3258
|
+
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Ur({
|
|
3239
3259
|
clearedConsole: t ? a?.clearedConsole : void 0,
|
|
3240
3260
|
clearedCommandIds: t ? a?.clearedCommandIds : void 0
|
|
3241
3261
|
});
|
|
@@ -3249,10 +3269,10 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3249
3269
|
let t = e.scrollKey;
|
|
3250
3270
|
if (t === null) return e;
|
|
3251
3271
|
let n = t;
|
|
3252
|
-
return
|
|
3272
|
+
return ga({
|
|
3253
3273
|
cellId: n,
|
|
3254
3274
|
cell: e.cellHandles[n],
|
|
3255
|
-
isCodeHidden:
|
|
3275
|
+
isCodeHidden: _i(e.cellData[n]?.config.hide_code, w.get(K), n),
|
|
3256
3276
|
codeFocus: void 0,
|
|
3257
3277
|
variableName: void 0
|
|
3258
3278
|
}), {
|
|
@@ -3260,8 +3280,8 @@ var { reducer: Aa, createActions: ja, getActionsForStore: Ma, useActions: Na, va
|
|
|
3260
3280
|
scrollKey: null
|
|
3261
3281
|
};
|
|
3262
3282
|
},
|
|
3263
|
-
foldAll: (e) => (
|
|
3264
|
-
unfoldAll: (e) => (
|
|
3283
|
+
foldAll: (e) => (Rn(Object.keys(e.cellHandles).map((e) => ro(e))), e),
|
|
3284
|
+
unfoldAll: (e) => (zn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
3265
3285
|
clearLogs: (e) => ({
|
|
3266
3286
|
...e,
|
|
3267
3287
|
cellLogs: []
|
|
@@ -3291,127 +3311,128 @@ function Q({ state: e, cellId: t, cellReducer: r }) {
|
|
|
3291
3311
|
}
|
|
3292
3312
|
} : (n.warn(`Cell ${t} not found in state`), e);
|
|
3293
3313
|
}
|
|
3294
|
-
var
|
|
3295
|
-
|
|
3296
|
-
}).addLogs, $ =
|
|
3297
|
-
|
|
3298
|
-
var
|
|
3299
|
-
|
|
3300
|
-
var
|
|
3301
|
-
let
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
})
|
|
3314
|
+
var Ra = Fa((e) => {
|
|
3315
|
+
w.set(Z, (t) => Pa(t, e));
|
|
3316
|
+
}).addLogs, $ = C((e) => e(Z).cellIds);
|
|
3317
|
+
C((e) => e($).length === 1), C((e) => xa(e(Z)).length > 0), C((e) => Sa(e(Z)).length > 0), C((e) => Ca(e(Z))), C((e) => wa(e(Z)));
|
|
3318
|
+
var za = C((e) => Da(e(Z), e(hn), e(vn)));
|
|
3319
|
+
C((e) => e(za) !== null);
|
|
3320
|
+
var Ba = v((e) => {
|
|
3321
|
+
let t = C((t) => {
|
|
3322
|
+
let n = t(B(e));
|
|
3323
|
+
if (n === null || !Kn(n.mimetype)) return null;
|
|
3324
|
+
E(Array.isArray(n.data), "Expected array data");
|
|
3325
|
+
let r = n.data.filter((e) => !e.type.includes("ancestor"));
|
|
3326
|
+
return r.length > 0 ? {
|
|
3327
|
+
...n,
|
|
3328
|
+
data: r
|
|
3329
|
+
} : null;
|
|
3330
|
+
}), n = C((t) => t(Za(e))?.name);
|
|
3331
|
+
return C((r) => {
|
|
3332
|
+
let i = r(t);
|
|
3333
|
+
return i && {
|
|
3334
|
+
output: i,
|
|
3335
|
+
cellId: e,
|
|
3336
|
+
cellName: r(n)
|
|
3337
|
+
};
|
|
3338
|
+
});
|
|
3339
|
+
}), Va = T(C((e) => e($).map((t) => e(Ba(t)))), (e) => e.filter(Boolean), ue), Ha = T(C((e) => {
|
|
3319
3340
|
let t = [];
|
|
3320
3341
|
for (let n of e($)) {
|
|
3321
|
-
let r = e(
|
|
3342
|
+
let r = e(En(n));
|
|
3322
3343
|
r && r.items.length > 0 && t.push([n, r]);
|
|
3323
3344
|
}
|
|
3324
3345
|
return t;
|
|
3325
|
-
}), t.identity,
|
|
3346
|
+
}), t.identity, b), Ua = T(Ha, (e) => Object.fromEntries(e), b), Wa = T(Ha, (e) => ({ items: e.flatMap(([e, t]) => t.items.map((t) => ({
|
|
3326
3347
|
...t,
|
|
3327
3348
|
cellId: e
|
|
3328
3349
|
}))) }));
|
|
3329
|
-
|
|
3330
|
-
var
|
|
3350
|
+
C((e) => e(Va).length);
|
|
3351
|
+
var Ga = ee(C((e) => {
|
|
3331
3352
|
let { cellIds: t, cellData: n } = e(Z);
|
|
3332
|
-
return
|
|
3353
|
+
return ce.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3333
3354
|
}));
|
|
3334
|
-
|
|
3335
|
-
var
|
|
3336
|
-
let { cellIds: e, cellData: t } =
|
|
3355
|
+
C((e) => e(Z).scrollKey);
|
|
3356
|
+
var Ka = () => x($), qa = () => x(Ga), Ja = () => w.get(Z), Ya = () => w.get(Z).cellIds, Xa = () => {
|
|
3357
|
+
let { cellIds: e, cellData: t } = w.get(Z);
|
|
3337
3358
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3338
3359
|
};
|
|
3339
|
-
h(
|
|
3340
|
-
var
|
|
3341
|
-
let t =
|
|
3360
|
+
h(T(Z, (e) => e.cellIds.map((t) => e.cellData[t]))), C((e) => e(Z).cellIds.length > 0);
|
|
3361
|
+
var Za = v((e) => C((t) => t(Z).cellData[e])), Qa = Ur(), $a = v((e) => {
|
|
3362
|
+
let t = C((t) => Kr(t, e, t(m))), n = C((t) => t(Z).cellRuntime[e] ?? Qa), r = C((e) => {
|
|
3342
3363
|
let r = e(t), i = e(m), a = i && e(i.shownDocumentAtom)?.cells;
|
|
3343
3364
|
return {
|
|
3344
3365
|
local: e(n),
|
|
3345
3366
|
execution: r,
|
|
3346
|
-
code: r &&
|
|
3367
|
+
code: r && Ot(r.record, a ?? void 0)
|
|
3347
3368
|
};
|
|
3348
|
-
}), i =
|
|
3349
|
-
return
|
|
3350
|
-
}),
|
|
3351
|
-
function
|
|
3352
|
-
|
|
3353
|
-
}
|
|
3354
|
-
var
|
|
3355
|
-
let { cellHandles: t } =
|
|
3369
|
+
}), i = T(r, qr);
|
|
3370
|
+
return C((e) => e(i).rendered);
|
|
3371
|
+
}), eo = v((e) => C((t) => t(Z).cellHandles[e]));
|
|
3372
|
+
function to(e) {
|
|
3373
|
+
Ba.remove(e), Za.remove(e), $a.remove(e), eo.remove(e), Dn(e);
|
|
3374
|
+
}
|
|
3375
|
+
var no = (e) => {
|
|
3376
|
+
let { cellHandles: t } = w.get(Z);
|
|
3356
3377
|
return t[e]?.current?.editorView ?? void 0;
|
|
3357
|
-
},
|
|
3358
|
-
|
|
3359
|
-
...e(
|
|
3360
|
-
...e(
|
|
3361
|
-
output: e(
|
|
3378
|
+
}, ro = (e) => (Un.promote(e), no(e));
|
|
3379
|
+
C((e) => e($).map((t) => ({
|
|
3380
|
+
...e(Za(t)),
|
|
3381
|
+
...e($a(t)),
|
|
3382
|
+
output: e(B(t))
|
|
3362
3383
|
})));
|
|
3363
3384
|
//#endregion
|
|
3364
3385
|
//#region src/core/errors/error-entries.ts
|
|
3365
|
-
function
|
|
3366
|
-
if (
|
|
3386
|
+
function io(e) {
|
|
3387
|
+
if (Wn(e.mimetype)) {
|
|
3367
3388
|
if (!Array.isArray(e.data)) return null;
|
|
3368
3389
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
3369
3390
|
return t.length === 0 ? null : { errorData: t };
|
|
3370
3391
|
}
|
|
3371
|
-
return
|
|
3392
|
+
return Gn(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
3372
3393
|
errorData: [],
|
|
3373
3394
|
tracebackHtml: e.data
|
|
3374
3395
|
} : null;
|
|
3375
3396
|
}
|
|
3376
|
-
function
|
|
3397
|
+
function ao(e) {
|
|
3377
3398
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3378
3399
|
}
|
|
3379
|
-
function
|
|
3380
|
-
let t = e?.find((e) =>
|
|
3400
|
+
function oo(e) {
|
|
3401
|
+
let t = e?.find((e) => Gn(e.mimetype));
|
|
3381
3402
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3382
3403
|
}
|
|
3383
|
-
function
|
|
3404
|
+
function so(e, t) {
|
|
3384
3405
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3385
|
-
if (!
|
|
3406
|
+
if (!ao(e.errorData)) return oo(t);
|
|
3386
3407
|
}
|
|
3387
|
-
function
|
|
3408
|
+
function co(e) {
|
|
3388
3409
|
let { cellIds: t, cellData: n } = e.get(Z), r = [];
|
|
3389
3410
|
for (let [i, a] of t.entries()) {
|
|
3390
|
-
let t = e.get(
|
|
3391
|
-
if (t === null || !
|
|
3392
|
-
let o =
|
|
3411
|
+
let t = e.get(B(a));
|
|
3412
|
+
if (t === null || !Kn(t.mimetype)) continue;
|
|
3413
|
+
let o = io(t);
|
|
3393
3414
|
if (!o) continue;
|
|
3394
|
-
let s =
|
|
3415
|
+
let s = zr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3395
3416
|
r.push({
|
|
3396
3417
|
cellId: a,
|
|
3397
3418
|
cellName: s,
|
|
3398
3419
|
cellCode: c,
|
|
3399
3420
|
errorData: o.errorData,
|
|
3400
|
-
tracebackHtml:
|
|
3421
|
+
tracebackHtml: so(o, e.get($a(a)).consoleOutputs)
|
|
3401
3422
|
});
|
|
3402
3423
|
}
|
|
3403
3424
|
return r;
|
|
3404
3425
|
}
|
|
3405
|
-
function
|
|
3426
|
+
function lo(e) {
|
|
3406
3427
|
return e.type === "diagnostic" ? e.msg : 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" : (d(e), "Unknown error");
|
|
3407
3428
|
}
|
|
3408
|
-
function
|
|
3409
|
-
let t =
|
|
3410
|
-
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${
|
|
3429
|
+
function uo(e) {
|
|
3430
|
+
let t = lo(e);
|
|
3431
|
+
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${G(e.traceback)}`), t;
|
|
3411
3432
|
}
|
|
3412
|
-
function
|
|
3433
|
+
function fo(e) {
|
|
3413
3434
|
let t = [e.cellName];
|
|
3414
|
-
return e.tracebackHtml && t.push(
|
|
3435
|
+
return e.tracebackHtml && t.push(G(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(uo).join("\n\n")), t.join("\n\n");
|
|
3415
3436
|
}
|
|
3416
3437
|
//#endregion
|
|
3417
|
-
export {
|
|
3438
|
+
export { _i as $, pt as $t, ha as A, H as At, Ji as B, mn as Bt, ba as C, Nr as Ct, _a as D, ar as Dt, ga as E, Sr as Et, $i as F, Jn as Ft, Ri as G, On as Gt, Wi as H, En as Ht, Zi as I, Yn as It, Di as J, kn as Jt, Fi as K, fn as Kt, Yi as L, In as Lt, pa as M, $n as Mt, ma as N, nr as Nt, ya as O, er as Ot, fa as P, tr as Pt, xi as Q, mt as Qt, Xi as R, Pn as Rt, ka as S, Lr as St, ja as T, G as Tt, Gi as U, B as Ut, Ui as V, Tn as Vt, Li as W, z as Wt, Ei as X, Nn as Xt, Ti as Y, jn as Yt, Si as Z, Yt as Zt, Wa as _, Kr as _t, Ra as a, Ve as an, Zr as at, Ka as b, Rr as bt, $a as c, ci as ct, Ia as d, di as dt, Ze as en, vi as et, Xa as f, ai as ft, Z as g, Jr as gt, Na as h, oi as ht, co as i, Ye as in, Xr as it, X as j, V as jt, va as k, rr as kt, Fa as l, ui as lt, Ja as m, si as mt, fo as n, He as nn, gi as nt, Za as o, Ce as on, li as ot, Ya as p, $r as pt, Ai as q, Mn as qt, uo as r, Ke as rn, hi as rt, $ as s, Se as sn, Qr as st, lo as t, j as tn, K as tt, ro as u, fi as ut, Pa as v, Gr as vt, Aa as w, kr as wt, qa as x, Br as xt, to as y, zr as yt, qi as z, wn as zt };
|