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