@marimo-team/islands 0.25.3-dev526 → 0.25.3-dev528
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-BWKznbDE.js → ErrorBoundary-1_91ed21.js} +1 -1
- package/dist/{chat-ui-CCmVFbcB.js → chat-ui-D5YPIONI.js} +3 -3
- package/dist/{code-visibility-BL-_Aqt5.js → code-visibility-x9LMnkKU.js} +2 -2
- package/dist/{common-YLSZXvrL.js → common-BRyX77pw.js} +3 -3
- package/dist/{data-grid-overlay-editor-DhoaVlcZ.js → data-grid-overlay-editor-CBZB5al6.js} +1 -1
- package/dist/{error-entries-BoO7a296.js → error-entries-BKlEsuk4.js} +555 -552
- package/dist/{feedback-button-DrceOs6K.js → feedback-button-Cp85y8a3.js} +3 -3
- package/dist/{glide-data-editor-Dq0HGXj0.js → glide-data-editor-DtmEif2O.js} +3 -3
- package/dist/{globals-CKy6TO_c.js → globals-DWczCk3b.js} +1 -1
- package/dist/{html-to-image-rvMfQD46.js → html-to-image-CNM0ZSFD.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/{number-overlay-editor-DOQnFTnc.js → number-overlay-editor-mAfD2UVC.js} +1 -1
- package/dist/{process-output-BXff1USQ.js → process-output-DthYR2Te.js} +2 -2
- package/dist/{reveal-component-lmXC9Dvs.js → reveal-component-ONkucQ9R.js} +2 -2
- package/package.json +1 -1
- package/src/components/editor/renderers/cell-array.tsx +9 -3
- package/src/core/cells/__tests__/layout.test.ts +13 -0
- package/src/core/cells/layout.ts +18 -10
- package/src/core/notebook/document/hooks.tsx +5 -0
- package/src/core/notebook/document/index.ts +1 -0
- package/src/core/saving/__tests__/document.test.tsx +2 -12
- package/src/core/saving/document.ts +2 -2
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-UzJukb3F.js";
|
|
|
7
7
|
import { t as l } from "./check-jchHMCfs.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-DywGMo-S.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-D8btoEHk.js";
|
|
10
|
-
import { At as p, Ct as m, Dt as h, Et as g, Ft as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { H as
|
|
17
|
-
import { a as
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Ht as v, It as y, Ot as ee, Pt as b, St as x, Tt as te, _n as ne, f as re, hn as ie, jt as ae, mn as oe, pn as se, vn as ce, zt as le } from "./use-restore-focus-DaTVz6S6.js";
|
|
11
|
+
import { n as ue } from "./toast-U3NpO2x3.js";
|
|
12
|
+
import { t as de } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as S } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as fe } from "./purify.es-DmnrIjg4.js";
|
|
15
|
+
import { t as pe } from "./createReducer-DdSLRfBT.js";
|
|
16
|
+
import { H as me, N as he, P as ge, _ as _e } from "./dist-D92tYjLc.js";
|
|
17
|
+
import { a as ve, i as ye, l as be, m as xe, u as Se } from "./static-state-C4bAlKTU.js";
|
|
18
|
+
import { t as Ce } from "./capabilities-DKqMqBzm.js";
|
|
19
|
+
var we = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,20 +29,20 @@ var Ce = c("external-link", [
|
|
|
29
29
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
30
30
|
key: "a6xqqp"
|
|
31
31
|
}]
|
|
32
|
-
]),
|
|
32
|
+
]), Te = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
35
|
+
}]]), C = /* @__PURE__ */ e(i(), 1), w = f(), Ee = Object.defineProperty, T = (e, t) => Ee(e, "name", {
|
|
36
36
|
value: t,
|
|
37
37
|
configurable: !0
|
|
38
|
-
}),
|
|
39
|
-
function
|
|
38
|
+
}), De = "Checkbox", [Oe, ke] = ne(De), [Ae, je] = Oe(De);
|
|
39
|
+
function Me(e) {
|
|
40
40
|
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = oe({
|
|
41
41
|
prop: n,
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
|
-
caller:
|
|
45
|
-
}), [m, h] =
|
|
44
|
+
caller: De
|
|
45
|
+
}), [m, h] = C.useState(null), [g, _] = C.useState(null), [v, y] = C.useState(null), ee = !m || !!o || !!m.closest("form"), b = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -51,35 +51,35 @@ function je(e) {
|
|
|
51
51
|
name: s,
|
|
52
52
|
form: o,
|
|
53
53
|
value: u,
|
|
54
|
-
userClick:
|
|
55
|
-
onUserClick:
|
|
54
|
+
userClick: v,
|
|
55
|
+
onUserClick: y,
|
|
56
56
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
58
|
-
isFormControl:
|
|
57
|
+
defaultChecked: !E(i) && i,
|
|
58
|
+
isFormControl: ee,
|
|
59
59
|
bubbleInput: g,
|
|
60
|
-
setBubbleInput:
|
|
60
|
+
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, w.jsx)(Ae, {
|
|
63
63
|
scope: t,
|
|
64
64
|
...b,
|
|
65
|
-
children:
|
|
65
|
+
children: Be(d) ? d(b) : r
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } =
|
|
71
|
-
return
|
|
68
|
+
T(Me, "CheckboxProvider");
|
|
69
|
+
var Ne = "CheckboxTrigger", Pe = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = je(Ne, e), g = r(a, d), _ = C.useRef(l);
|
|
71
|
+
return C.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ T(() => f(_.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, w.jsx)(ce.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": E(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
|
-
"data-state":
|
|
82
|
+
"data-state": Ve(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
84
84
|
disabled: c,
|
|
85
85
|
value: s,
|
|
@@ -91,14 +91,14 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
91
91
|
onClick: ie(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: E(l) ? !0 : !l,
|
|
95
95
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => E(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), Fe = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(function(e, t) {
|
|
100
100
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
101
|
-
return /* @__PURE__ */ (0,
|
|
101
|
+
return /* @__PURE__ */ (0, w.jsx)(Me, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,18 +108,18 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
108
108
|
name: r,
|
|
109
109
|
form: u,
|
|
110
110
|
value: c,
|
|
111
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
111
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, w.jsxs)(w.Fragment, { children: [/* @__PURE__ */ (0, w.jsx)(Pe, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, w.jsx)(ze, { __scopeCheckbox: n })] })
|
|
116
116
|
});
|
|
117
|
-
}, "Checkbox")),
|
|
118
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
120
|
-
present: r ||
|
|
121
|
-
children: /* @__PURE__ */ (0,
|
|
122
|
-
"data-state":
|
|
117
|
+
}, "Checkbox")), Ie = "CheckboxIndicator", Le = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = je(Ie, n);
|
|
119
|
+
return /* @__PURE__ */ (0, w.jsx)(se, {
|
|
120
|
+
present: r || E(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, w.jsx)(ce.span, {
|
|
122
|
+
"data-state": Ve(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
125
125
|
ref: t,
|
|
@@ -129,30 +129,30 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
|
-
}, "CheckboxIndicator")),
|
|
133
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } =
|
|
134
|
-
|
|
132
|
+
}, "CheckboxIndicator")), Re = "CheckboxBubbleInput", ze = /* @__PURE__ */ C.forwardRef(/* @__PURE__ */ T(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = je(Re, e), _ = r(i, g), v = s(a), y = C.useRef(!1), ee = C.useRef(c), b = C.useRef(o), x = C.useRef(null);
|
|
134
|
+
C.useEffect(() => {
|
|
135
135
|
let e = h;
|
|
136
136
|
if (!e) return;
|
|
137
137
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
138
138
|
if (!n) return;
|
|
139
|
-
let r =
|
|
140
|
-
|
|
139
|
+
let r = ee.current !== c;
|
|
140
|
+
ee.current = c;
|
|
141
141
|
let i = o !== null && o !== b.current;
|
|
142
|
-
if (b.current = o, i) x.current = r ? null : o, r && (e.indeterminate =
|
|
142
|
+
if (b.current = o, i) x.current = r ? null : o, r && (e.indeterminate = E(c), n.call(e, !E(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
144
|
let t = x.current;
|
|
145
145
|
x.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
|
|
147
|
+
y.current = !0, e.indeterminate = E(c), n.call(e, !E(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
|
|
148
148
|
}
|
|
149
149
|
}, [
|
|
150
150
|
h,
|
|
151
151
|
c,
|
|
152
152
|
o
|
|
153
153
|
]);
|
|
154
|
-
let te =
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let te = C.useRef(!E(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, w.jsx)(ce.input, {
|
|
156
156
|
type: "checkbox",
|
|
157
157
|
"aria-hidden": !0,
|
|
158
158
|
defaultChecked: l ?? te.current,
|
|
@@ -163,13 +163,13 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
163
163
|
form: m,
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
|
-
ref:
|
|
166
|
+
ref: _,
|
|
167
167
|
onClick: ie(t, (e) => {
|
|
168
|
-
|
|
168
|
+
y.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
171
171
|
...n.style,
|
|
172
|
-
...
|
|
172
|
+
...v,
|
|
173
173
|
position: "absolute",
|
|
174
174
|
pointerEvents: "none",
|
|
175
175
|
opacity: 0,
|
|
@@ -178,30 +178,30 @@ var Me = "CheckboxTrigger", Ne = /* @__PURE__ */ w.forwardRef(/* @__PURE__ */ E(
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}, "CheckboxBubbleInput"));
|
|
181
|
-
function
|
|
181
|
+
function Be(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
184
|
+
T(Be, "isFunction");
|
|
185
|
+
function E(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
|
-
E
|
|
189
|
-
function
|
|
190
|
-
return
|
|
188
|
+
T(E, "isIndeterminate");
|
|
189
|
+
function Ve(e) {
|
|
190
|
+
return E(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
T(Ve, "getState");
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/plugins/core/sanitize-html.ts
|
|
195
|
-
var
|
|
195
|
+
var He = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
|
|
196
196
|
if (typeof document < "u") {
|
|
197
197
|
let e = "data-temp-href-target";
|
|
198
|
-
|
|
198
|
+
fe.addHook("beforeSanitizeAttributes", (t) => {
|
|
199
199
|
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
200
|
-
}),
|
|
200
|
+
}), fe.addHook("afterSanitizeAttributes", (t) => {
|
|
201
201
|
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function Ue(e) {
|
|
205
205
|
let t = {
|
|
206
206
|
USE_PROFILES: {
|
|
207
207
|
html: !0,
|
|
@@ -210,7 +210,7 @@ function He(e) {
|
|
|
210
210
|
},
|
|
211
211
|
ADD_TAGS: ["use"],
|
|
212
212
|
ADD_ATTR: ["href", "xlink:href"],
|
|
213
|
-
ALLOWED_URI_REGEXP:
|
|
213
|
+
ALLOWED_URI_REGEXP: He,
|
|
214
214
|
FORCE_BODY: !0,
|
|
215
215
|
CUSTOM_ELEMENT_HANDLING: {
|
|
216
216
|
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
@@ -218,59 +218,59 @@ function He(e) {
|
|
|
218
218
|
},
|
|
219
219
|
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
220
220
|
};
|
|
221
|
-
return
|
|
221
|
+
return fe.sanitize(e, t);
|
|
222
222
|
}
|
|
223
223
|
//#endregion
|
|
224
224
|
//#region src/core/dom/outline.ts
|
|
225
|
-
var
|
|
225
|
+
var We = [
|
|
226
226
|
"marimo-carousel",
|
|
227
227
|
"marimo-tabs",
|
|
228
228
|
"marimo-accordion",
|
|
229
229
|
"marimo-sidebar"
|
|
230
|
-
],
|
|
231
|
-
function
|
|
230
|
+
], Ge = "h1, h2, h3, h4, h5, h6";
|
|
231
|
+
function Ke(e) {
|
|
232
232
|
if (typeof DOMParser > "u") return null;
|
|
233
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
233
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Ge);
|
|
234
234
|
for (let e of Array.from(n)) {
|
|
235
235
|
let n = e.textContent;
|
|
236
|
-
if (
|
|
236
|
+
if (We.some((t) => e.closest(t)) || !n) continue;
|
|
237
237
|
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
238
238
|
name: n,
|
|
239
239
|
level: r,
|
|
240
|
-
by:
|
|
240
|
+
by: Je(e)
|
|
241
241
|
};
|
|
242
|
-
i !== n && (a.html =
|
|
242
|
+
i !== n && (a.html = Ue(i)), t.push(a);
|
|
243
243
|
}
|
|
244
244
|
return { items: t };
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function qe(e) {
|
|
247
247
|
if (!e.includes("\"")) return `"${e}"`;
|
|
248
248
|
if (!e.includes("'")) return `'${e}'`;
|
|
249
249
|
let t = e.split("\""), n = [];
|
|
250
250
|
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
251
251
|
return `concat(${n.join(", ")})`;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Je(e) {
|
|
254
254
|
let t = e.id;
|
|
255
255
|
if (t) return { id: t };
|
|
256
256
|
let n = e.textContent ?? "";
|
|
257
|
-
return { path: `//${e.tagName}[contains(., ${
|
|
257
|
+
return { path: `//${e.tagName}[contains(., ${qe(n)})]` };
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Ye(e) {
|
|
260
260
|
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Xe(e) {
|
|
263
263
|
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
264
264
|
try {
|
|
265
|
-
return
|
|
265
|
+
return S(typeof e.data == "string", "expected string"), Ke(e.data);
|
|
266
266
|
} catch {
|
|
267
267
|
return t.error("Failed to parse outline"), null;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function Ze(e) {
|
|
271
271
|
return e != null && e.items.some((e) => e.level <= 3);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Qe(e, n) {
|
|
274
274
|
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
275
275
|
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
276
276
|
let a = r(i), o = e + 1;
|
|
@@ -283,18 +283,18 @@ function Ze(e, n) {
|
|
|
283
283
|
}
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/core/notebook/replica/connection.ts
|
|
286
|
-
var
|
|
286
|
+
var D = {
|
|
287
287
|
NOT_STARTED: "NOT_STARTED",
|
|
288
288
|
CONNECTING: "CONNECTING",
|
|
289
289
|
OPEN: "OPEN",
|
|
290
290
|
CLOSED: "CLOSED"
|
|
291
|
-
},
|
|
291
|
+
}, $e = {
|
|
292
292
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
293
293
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
294
294
|
};
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/core/notebook/replica/execution-state.ts
|
|
297
|
-
function
|
|
297
|
+
function O(e) {
|
|
298
298
|
let { state: t } = e.record;
|
|
299
299
|
return t.status === "completed" && t.outcome.kind !== "succeeded" ? t.outcome : e.output === null ? t.status === "completed" ? {
|
|
300
300
|
kind: "output",
|
|
@@ -304,18 +304,18 @@ function k(e) {
|
|
|
304
304
|
media: e.output.media
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function k(e) {
|
|
308
308
|
return e.state.status === "queued" ? null : e.state.started_at;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function A(e) {
|
|
311
311
|
return e.state.status === "completed" ? e.state.completed_at : null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function et(e) {
|
|
314
314
|
return e.state.status === "completed" ? e.state.depends_on : {};
|
|
315
315
|
}
|
|
316
316
|
//#endregion
|
|
317
317
|
//#region src/core/notebook/replica/resources/results.ts
|
|
318
|
-
function
|
|
318
|
+
function tt(e, t) {
|
|
319
319
|
let { record: n, output: r, outputVersion: i } = t, a = n.cell_id;
|
|
320
320
|
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, {
|
|
321
321
|
record: n,
|
|
@@ -323,10 +323,10 @@ function et(e, t) {
|
|
|
323
323
|
outputVersion: i
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function nt(e, t) {
|
|
327
327
|
let { record: n, output: r, outputVersion: i } = t;
|
|
328
|
-
if (n.cell_id !== null ||
|
|
329
|
-
let a = (e) => Date.parse(
|
|
328
|
+
if (n.cell_id !== null || O(t) === null) return e;
|
|
329
|
+
let a = (e) => Date.parse(A(e) ?? k(e) ?? "1970-01-01T00:00:00Z");
|
|
330
330
|
return e !== null && a(e.record) > a(n) ? e : {
|
|
331
331
|
record: n,
|
|
332
332
|
output: r,
|
|
@@ -335,7 +335,7 @@ function tt(e, t) {
|
|
|
335
335
|
}
|
|
336
336
|
//#endregion
|
|
337
337
|
//#region src/core/notebook/replica/resources/executions.ts
|
|
338
|
-
function
|
|
338
|
+
function rt(e) {
|
|
339
339
|
let { state: t } = e;
|
|
340
340
|
return t.status === "completed" && t.outcome.kind === "failed" && t.outcome.message !== null ? {
|
|
341
341
|
runId: e.id,
|
|
@@ -343,49 +343,49 @@ function nt(e) {
|
|
|
343
343
|
completedAt: t.completed_at
|
|
344
344
|
} : void 0;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function it(e) {
|
|
347
347
|
return [...e.items.values()].toSorted((e, t) => e.seq - t.seq);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function j(e, t) {
|
|
350
350
|
if (!e.has(t)) return e;
|
|
351
351
|
let n = new Map(e);
|
|
352
352
|
return n.delete(t), n;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a =
|
|
354
|
+
function at(e, t) {
|
|
355
|
+
let n = e.scratchConsole, { id: r, cell_id: i } = t.record, a = k(t.record);
|
|
356
356
|
if (i !== null || a === null) return n;
|
|
357
357
|
if (!n || n.record.id === r) return t;
|
|
358
358
|
let o = e.executions.get(r);
|
|
359
|
-
return o &&
|
|
359
|
+
return o && k(o.record) !== null ? n : Date.parse(a) >= Date.parse(k(n.record) ?? "") ? t : n;
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function M(e, t) {
|
|
362
362
|
let { id: n, cell_id: r } = t.record;
|
|
363
363
|
return {
|
|
364
364
|
...e,
|
|
365
365
|
executions: new Map(e.executions).set(n, t),
|
|
366
|
-
scratchConsole:
|
|
366
|
+
scratchConsole: at(e, t),
|
|
367
367
|
latest: r === null || e.latest.get(r) === n ? e.latest : new Map(e.latest).set(r, n)
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function ot(e, t) {
|
|
371
371
|
let n = e.executions.get(t);
|
|
372
372
|
if (n === void 0) return e;
|
|
373
373
|
let r = n.record.cell_id;
|
|
374
374
|
return {
|
|
375
375
|
...e,
|
|
376
|
-
executions:
|
|
376
|
+
executions: j(e.executions, t),
|
|
377
377
|
scratchConsole: e.scratchConsole?.record.id === t ? void 0 : e.scratchConsole,
|
|
378
|
-
latest: r !== null && e.latest.get(r) === t ?
|
|
378
|
+
latest: r !== null && e.latest.get(r) === t ? j(e.latest, r) : e.latest
|
|
379
379
|
};
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function st(e, t) {
|
|
382
382
|
let n = e.executions.get(t.execution_id);
|
|
383
383
|
if (n === void 0) return e;
|
|
384
384
|
let r = n.items.get(t.id);
|
|
385
385
|
return r && (t = {
|
|
386
386
|
...t,
|
|
387
387
|
time: r.time
|
|
388
|
-
}),
|
|
388
|
+
}), M(e, {
|
|
389
389
|
...n,
|
|
390
390
|
append: !r && t.seq > (n.lastSeq ?? -1) ? {
|
|
391
391
|
before: new WeakRef(n.items),
|
|
@@ -395,45 +395,45 @@ function ot(e, t) {
|
|
|
395
395
|
items: new Map(n.items).set(t.id, t)
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
-
function
|
|
399
|
-
for (let n of e.executions.values()) if (n.items.has(t)) return
|
|
398
|
+
function ct(e, t) {
|
|
399
|
+
for (let n of e.executions.values()) if (n.items.has(t)) return M(e, {
|
|
400
400
|
...n,
|
|
401
401
|
append: void 0,
|
|
402
|
-
items:
|
|
402
|
+
items: j(n.items, t)
|
|
403
403
|
});
|
|
404
404
|
return e;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function lt(e, t) {
|
|
407
407
|
let n = e.executions.get(t.execution_id);
|
|
408
|
-
return n === void 0 ? e :
|
|
408
|
+
return n === void 0 ? e : M(e, {
|
|
409
409
|
...n,
|
|
410
410
|
variables: new Map(n.variables).set(t.id, t)
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
for (let n of e.executions.values()) if (n.variables.has(t)) return
|
|
413
|
+
function ut(e, t) {
|
|
414
|
+
for (let n of e.executions.values()) if (n.variables.has(t)) return M(e, {
|
|
415
415
|
...n,
|
|
416
|
-
variables:
|
|
416
|
+
variables: j(n.variables, t)
|
|
417
417
|
});
|
|
418
418
|
return e;
|
|
419
419
|
}
|
|
420
|
-
function ut(e, t) {
|
|
421
|
-
return JSON.stringify(k(e)) === JSON.stringify(k(t));
|
|
422
|
-
}
|
|
423
420
|
function dt(e, t) {
|
|
421
|
+
return JSON.stringify(O(e)) === JSON.stringify(O(t));
|
|
422
|
+
}
|
|
423
|
+
function ft(e, t) {
|
|
424
424
|
return {
|
|
425
|
-
...
|
|
426
|
-
results:
|
|
427
|
-
scratch:
|
|
425
|
+
...M(e, t),
|
|
426
|
+
results: tt(e.results, t),
|
|
427
|
+
scratch: nt(e.scratch, t)
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function pt(e, t, n) {
|
|
431
431
|
let r = new Map(e.executions);
|
|
432
432
|
for (let [e, n] of r) {
|
|
433
433
|
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);
|
|
434
434
|
a !== void 0 && r.set(e, {
|
|
435
435
|
...n,
|
|
436
|
-
outputVersion: a.outputVersion + +!
|
|
436
|
+
outputVersion: a.outputVersion + +!dt(a, n)
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
let i = new Map(e.results);
|
|
@@ -451,10 +451,10 @@ function ft(e, t, n) {
|
|
|
451
451
|
executions: r,
|
|
452
452
|
results: i,
|
|
453
453
|
scratchConsole: e.scratchConsole ?? (t.scratchConsole?.record.state.status === "completed" && t.scratchConsole.record.runtime_id === n ? t.scratchConsole : void 0),
|
|
454
|
-
scratch: a == null ? t.scratch :
|
|
454
|
+
scratch: a == null ? t.scratch : nt(t.scratch, a)
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
|
-
var
|
|
457
|
+
var mt = {
|
|
458
458
|
initial: {
|
|
459
459
|
runs: /* @__PURE__ */ new Map(),
|
|
460
460
|
executions: /* @__PURE__ */ new Map(),
|
|
@@ -469,32 +469,32 @@ var pt = {
|
|
|
469
469
|
},
|
|
470
470
|
"cell.removed": (e, { data: t }) => ({
|
|
471
471
|
...e,
|
|
472
|
-
results:
|
|
472
|
+
results: j(e.results, t.id)
|
|
473
473
|
}),
|
|
474
474
|
run: (e, { data: t }) => ({
|
|
475
475
|
...e,
|
|
476
476
|
runs: new Map(e.runs).set(t.run.id, t.run),
|
|
477
|
-
scratchFailure: t.run.origin.kind === "code" ?
|
|
477
|
+
scratchFailure: t.run.origin.kind === "code" ? rt(t.run) : e.scratchFailure
|
|
478
478
|
}),
|
|
479
479
|
"run.removed": (e, { data: t }) => e.runs.has(t.id) ? {
|
|
480
480
|
...e,
|
|
481
|
-
runs:
|
|
481
|
+
runs: j(e.runs, t.id)
|
|
482
482
|
} : e,
|
|
483
483
|
execution: (e, { data: { execution: t } }) => {
|
|
484
484
|
let n = e.executions.get(t.id), r = {
|
|
485
485
|
record: t,
|
|
486
486
|
output: n?.output ?? null
|
|
487
487
|
};
|
|
488
|
-
return
|
|
488
|
+
return ft(e, {
|
|
489
489
|
...r,
|
|
490
|
-
outputVersion: n === void 0 ? 0 : n.outputVersion + +!
|
|
490
|
+
outputVersion: n === void 0 ? 0 : n.outputVersion + +!dt(n, r),
|
|
491
491
|
append: n?.append,
|
|
492
492
|
lastSeq: n?.lastSeq,
|
|
493
493
|
items: n?.items ?? /* @__PURE__ */ new Map(),
|
|
494
494
|
variables: n?.variables ?? /* @__PURE__ */ new Map()
|
|
495
495
|
});
|
|
496
496
|
},
|
|
497
|
-
"execution.removed": (e, { data: t }) =>
|
|
497
|
+
"execution.removed": (e, { data: t }) => ot(e, t.id),
|
|
498
498
|
output: (e, { data: { output: t } }) => {
|
|
499
499
|
let n = e.executions.get(t.execution_id);
|
|
500
500
|
if (n === void 0) return e;
|
|
@@ -502,31 +502,31 @@ var pt = {
|
|
|
502
502
|
...n,
|
|
503
503
|
output: t
|
|
504
504
|
};
|
|
505
|
-
return
|
|
505
|
+
return ft(e, {
|
|
506
506
|
...r,
|
|
507
|
-
outputVersion: n.outputVersion + +!
|
|
507
|
+
outputVersion: n.outputVersion + +!dt(n, r)
|
|
508
508
|
});
|
|
509
509
|
},
|
|
510
510
|
"output.removed": (e) => e,
|
|
511
|
-
console: (e, { data: t }) =>
|
|
511
|
+
console: (e, { data: t }) => st(e, {
|
|
512
512
|
...t.console,
|
|
513
513
|
kind: "console",
|
|
514
514
|
time: t.time
|
|
515
515
|
}),
|
|
516
|
-
"console.removed": (e, { data: t }) =>
|
|
517
|
-
input: (e, { data: t }) =>
|
|
516
|
+
"console.removed": (e, { data: t }) => ct(e, t.id),
|
|
517
|
+
input: (e, { data: t }) => st(e, {
|
|
518
518
|
...t.input,
|
|
519
519
|
kind: "input",
|
|
520
520
|
time: t.time
|
|
521
521
|
}),
|
|
522
|
-
variable: (e, { data: t }) =>
|
|
523
|
-
"variable.removed": (e, { data: t }) =>
|
|
522
|
+
variable: (e, { data: t }) => lt(e, t.variable),
|
|
523
|
+
"variable.removed": (e, { data: t }) => ut(e, t.id)
|
|
524
524
|
}
|
|
525
|
-
},
|
|
525
|
+
}, ht = {
|
|
526
526
|
sourceChanged: !1,
|
|
527
527
|
inputsChanged: !1
|
|
528
528
|
};
|
|
529
|
-
function
|
|
529
|
+
function gt(e) {
|
|
530
530
|
let t = /* @__PURE__ */ new Map();
|
|
531
531
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
532
532
|
let n = t.get(e.name);
|
|
@@ -534,18 +534,18 @@ function ht(e) {
|
|
|
534
534
|
}
|
|
535
535
|
return t;
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
let t =
|
|
537
|
+
function _t(e) {
|
|
538
|
+
let t = gt(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
539
539
|
function i(e, n) {
|
|
540
540
|
let i = new Set(n).add(e.id);
|
|
541
|
-
for (let [n, a] of Object.entries(
|
|
541
|
+
for (let [n, a] of Object.entries(et(e))) {
|
|
542
542
|
let s = t.get(n) ?? [];
|
|
543
543
|
if (a === null) {
|
|
544
544
|
if (s.some((t) => {
|
|
545
545
|
let n = r(t.execution_id);
|
|
546
546
|
if (n === void 0) return !1;
|
|
547
547
|
if (n.runtime_id === e.runtime_id) return !0;
|
|
548
|
-
let i =
|
|
548
|
+
let i = A(n) ?? k(n), a = A(e);
|
|
549
549
|
return i !== null && a !== null && Date.parse(i) > Date.parse(a);
|
|
550
550
|
})) return !0;
|
|
551
551
|
continue;
|
|
@@ -572,54 +572,54 @@ function gt(e) {
|
|
|
572
572
|
}
|
|
573
573
|
return (t) => {
|
|
574
574
|
let n = e.results.get(t)?.record;
|
|
575
|
-
return n == null ?
|
|
575
|
+
return n == null ? ht : o(n, /* @__PURE__ */ new Set());
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
578
|
//#endregion
|
|
579
579
|
//#region src/core/executions/output.ts
|
|
580
|
-
var
|
|
581
|
-
function
|
|
580
|
+
var vt = /* @__PURE__ */ new Map(), yt = "application/vnd.marimo+error";
|
|
581
|
+
function N(e) {
|
|
582
582
|
return e;
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function bt(e) {
|
|
585
585
|
return e.map(({ cell_id: e, message: t }) => ({
|
|
586
|
-
cell_id:
|
|
586
|
+
cell_id: N(e),
|
|
587
587
|
message: t
|
|
588
588
|
}));
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function xt(e) {
|
|
591
591
|
return e === null ? 0 : Date.parse(e) / 1e3;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
return
|
|
593
|
+
function St(e) {
|
|
594
|
+
return xt(A(e) ?? k(e));
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Ct(e, t) {
|
|
597
597
|
return {
|
|
598
598
|
channel: "output",
|
|
599
599
|
mimetype: t.mimetype,
|
|
600
600
|
data: t.data,
|
|
601
|
-
timestamp:
|
|
601
|
+
timestamp: St(e)
|
|
602
602
|
};
|
|
603
603
|
}
|
|
604
|
-
function
|
|
604
|
+
function P(e, t) {
|
|
605
605
|
return {
|
|
606
606
|
channel: "marimo-error",
|
|
607
|
-
mimetype:
|
|
607
|
+
mimetype: yt,
|
|
608
608
|
data: t,
|
|
609
|
-
timestamp:
|
|
609
|
+
timestamp: St(e)
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function wt(e) {
|
|
613
613
|
let t = e.related.at(0);
|
|
614
|
-
return t === void 0 ? null :
|
|
614
|
+
return t === void 0 ? null : N(t.cell_id);
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function Tt(e) {
|
|
617
617
|
switch (e.kind) {
|
|
618
618
|
case "exception": return {
|
|
619
619
|
type: "exception",
|
|
620
620
|
exception_type: e.name ?? "Exception",
|
|
621
621
|
msg: e.message,
|
|
622
|
-
raising_cell:
|
|
622
|
+
raising_cell: wt(e),
|
|
623
623
|
traceback: e.traceback?.data ?? null
|
|
624
624
|
};
|
|
625
625
|
case "invalid-syntax": return {
|
|
@@ -636,78 +636,78 @@ function wt(e) {
|
|
|
636
636
|
type: "diagnostic",
|
|
637
637
|
kind: e.kind,
|
|
638
638
|
msg: e.message,
|
|
639
|
-
related:
|
|
639
|
+
related: bt(e.related)
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function Et(e, t) {
|
|
644
644
|
let n = t.related[0];
|
|
645
|
-
if (n !== void 0 && t.reason === "upstream-stopped") return
|
|
645
|
+
if (n !== void 0 && t.reason === "upstream-stopped") return P(e, [{
|
|
646
646
|
type: "ancestor-stopped",
|
|
647
647
|
msg: t.message,
|
|
648
|
-
raising_cell:
|
|
648
|
+
raising_cell: N(n.cell_id)
|
|
649
649
|
}]);
|
|
650
650
|
if (n !== void 0 && t.reason === "upstream-failed") {
|
|
651
651
|
let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
|
|
652
|
-
return
|
|
652
|
+
return P(e, [{
|
|
653
653
|
type: "ancestor-prevented",
|
|
654
654
|
msg: t.message,
|
|
655
|
-
raising_cell:
|
|
656
|
-
blamed_cell: r === void 0 ? null :
|
|
655
|
+
raising_cell: N(n.cell_id),
|
|
656
|
+
blamed_cell: r === void 0 ? null : N(r.cell_id)
|
|
657
657
|
}]);
|
|
658
658
|
}
|
|
659
|
-
return
|
|
659
|
+
return P(e, [{
|
|
660
660
|
type: "diagnostic",
|
|
661
661
|
kind: t.reason,
|
|
662
662
|
msg: t.message,
|
|
663
|
-
related:
|
|
663
|
+
related: bt(t.related)
|
|
664
664
|
}]);
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function Dt(e, t = vt) {
|
|
667
667
|
let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
|
|
668
668
|
return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
|
|
669
669
|
}
|
|
670
|
-
function
|
|
671
|
-
let n =
|
|
670
|
+
function Ot(e, t = vt) {
|
|
671
|
+
let n = kt(e), r = Dt(e.record, t);
|
|
672
672
|
return n === null || r === void 0 ? n : {
|
|
673
673
|
...n,
|
|
674
674
|
code: r
|
|
675
675
|
};
|
|
676
676
|
}
|
|
677
|
-
function
|
|
678
|
-
let { record: t } = e, n =
|
|
677
|
+
function kt(e) {
|
|
678
|
+
let { record: t } = e, n = O(e);
|
|
679
679
|
if (n === null) return null;
|
|
680
680
|
switch (n.kind) {
|
|
681
|
-
case "output": return n.media === null ? null :
|
|
682
|
-
case "failed": return
|
|
683
|
-
case "cancelled": return
|
|
684
|
-
case "skipped": return
|
|
681
|
+
case "output": return n.media === null ? null : Ct(t, n.media);
|
|
682
|
+
case "failed": return P(t, [Tt(n.error)]);
|
|
683
|
+
case "cancelled": return P(t, [{ type: "interruption" }]);
|
|
684
|
+
case "skipped": return Et(t, n);
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function At(e, t) {
|
|
688
688
|
let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
|
|
689
|
-
if (r !== void 0 &&
|
|
689
|
+
if (r !== void 0 && O(r) !== null && r.record.state.status !== "completed") return r;
|
|
690
690
|
let i = e.results.get(t) ?? null;
|
|
691
|
-
return r?.record.state.status === "running" && i !== null &&
|
|
691
|
+
return r?.record.state.status === "running" && i !== null && O(i)?.kind === "skipped" ? null : i;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function jt(e, t) {
|
|
694
694
|
return e?.execution === t.record.id && e.version === t.outputVersion;
|
|
695
695
|
}
|
|
696
|
-
function
|
|
697
|
-
let n =
|
|
698
|
-
return n === null ||
|
|
696
|
+
function Mt(e, t) {
|
|
697
|
+
let n = At(e, t);
|
|
698
|
+
return n === null || jt(e.cleared.get(t), n) ? null : Ot(n, e.cells);
|
|
699
699
|
}
|
|
700
|
-
function
|
|
700
|
+
function Nt(e) {
|
|
701
701
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
|
|
702
702
|
for (let r of n) {
|
|
703
|
-
let n =
|
|
704
|
-
n !== null && t.set(
|
|
703
|
+
let n = Mt(e, r);
|
|
704
|
+
n !== null && t.set(N(r), n);
|
|
705
705
|
}
|
|
706
706
|
return t;
|
|
707
707
|
}
|
|
708
708
|
//#endregion
|
|
709
709
|
//#region src/utils/time.ts
|
|
710
|
-
var
|
|
710
|
+
var Pt = class e {
|
|
711
711
|
ms;
|
|
712
712
|
static fromMilliseconds(t) {
|
|
713
713
|
return t == null ? null : new e(t);
|
|
@@ -736,17 +736,17 @@ var Nt = class e {
|
|
|
736
736
|
};
|
|
737
737
|
//#endregion
|
|
738
738
|
//#region src/core/executions/select.ts
|
|
739
|
-
function
|
|
739
|
+
function Ft(e) {
|
|
740
740
|
return e.state.status === "completed" ? e.state.outcome.kind : null;
|
|
741
741
|
}
|
|
742
|
-
function
|
|
743
|
-
return e === null ? null :
|
|
742
|
+
function It(e) {
|
|
743
|
+
return e === null ? null : Pt.parse(e).toMilliseconds();
|
|
744
744
|
}
|
|
745
|
-
function
|
|
745
|
+
function Lt(e, t) {
|
|
746
746
|
let n = e.latest.get(t);
|
|
747
747
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
748
748
|
}
|
|
749
|
-
function
|
|
749
|
+
function Rt(e, t) {
|
|
750
750
|
let n = /* @__PURE__ */ new Set(), r = [...t].filter((e) => e.config.disabled);
|
|
751
751
|
if (r.length === 0) return n;
|
|
752
752
|
let i = /* @__PURE__ */ new Map();
|
|
@@ -769,60 +769,60 @@ function Lt(e, t) {
|
|
|
769
769
|
}
|
|
770
770
|
return n;
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function zt(e, t) {
|
|
773
773
|
let n = e.cells.get(t);
|
|
774
774
|
return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
|
|
775
775
|
}
|
|
776
|
-
function
|
|
777
|
-
if (!
|
|
776
|
+
function Bt(e, t) {
|
|
777
|
+
if (!zt(e, t)) return !1;
|
|
778
778
|
if (e.requested.has(t)) return !0;
|
|
779
|
-
let n =
|
|
779
|
+
let n = Lt(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
|
|
780
780
|
for (let r of e.executions.runs.values()) if (r.state.status !== "completed" && r.id !== n && r.origin.kind === "cells" && r.origin.cell_ids.includes(t)) return !0;
|
|
781
781
|
return !1;
|
|
782
782
|
}
|
|
783
|
-
function
|
|
784
|
-
let n =
|
|
785
|
-
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s =
|
|
786
|
-
let c = i === "idle", l = c && a !== null && o !== null ?
|
|
783
|
+
function Vt(e, t) {
|
|
784
|
+
let n = Lt(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : k(r), o = r === null ? null : A(r), s = It(a);
|
|
785
|
+
n !== null && n.record.state.status !== "completed" ? (i = n.record.state.status, s = It(k(n.record)) ?? s) : Bt(e, t) && (i = "queued");
|
|
786
|
+
let c = i === "idle", l = c && a !== null && o !== null ? Pt.parse(o).since(Pt.parse(a)) : null, u = e.blocked.has(t);
|
|
787
787
|
return {
|
|
788
788
|
status: i,
|
|
789
789
|
blocked: u,
|
|
790
790
|
shownBlock: u ? "current" : e.shownBlocked.has(t) ? "stale" : null,
|
|
791
|
-
outcome: c && r !== null ?
|
|
791
|
+
outcome: c && r !== null ? Ft(r) : null,
|
|
792
792
|
live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
|
|
793
793
|
startedAt: s,
|
|
794
794
|
duration: l
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
|
-
function Vt(e) {
|
|
798
|
-
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
799
|
-
}
|
|
800
797
|
function Ht(e) {
|
|
801
|
-
return
|
|
798
|
+
return [...e.executions.values()].filter((e) => e.record.state.status !== "completed");
|
|
802
799
|
}
|
|
803
800
|
function Ut(e) {
|
|
804
|
-
|
|
801
|
+
return Ht(e).some((e) => e.record.state.status === "running");
|
|
802
|
+
}
|
|
803
|
+
function Wt(e) {
|
|
804
|
+
let t = Ht(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
|
|
805
805
|
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);
|
|
806
806
|
let i = 0;
|
|
807
|
-
for (let t of r) !n.has(t) &&
|
|
807
|
+
for (let t of r) !n.has(t) && Bt(e, t) && (i += 1);
|
|
808
808
|
return t.length + i;
|
|
809
809
|
}
|
|
810
810
|
//#endregion
|
|
811
811
|
//#region src/core/executions/atoms.ts
|
|
812
|
-
var
|
|
812
|
+
var Gt = {
|
|
813
813
|
runs: /* @__PURE__ */ new Map(),
|
|
814
814
|
executions: /* @__PURE__ */ new Map(),
|
|
815
815
|
latest: /* @__PURE__ */ new Map(),
|
|
816
816
|
results: /* @__PURE__ */ new Map(),
|
|
817
817
|
scratch: null
|
|
818
|
-
},
|
|
819
|
-
function
|
|
818
|
+
}, Kt = /* @__PURE__ */ new Map(), qt = /* @__PURE__ */ new Map(), Jt = /* @__PURE__ */ new Set(), Yt = /* @__PURE__ */ new Set(), Xt = /* @__PURE__ */ new Set(), Zt = /* @__PURE__ */ new Map(), F = v(null);
|
|
819
|
+
function Qt(e, t) {
|
|
820
820
|
return t !== null && e.replica === t.replica && e.id === t.id && e.generation === t.generation;
|
|
821
821
|
}
|
|
822
|
-
function
|
|
823
|
-
return e !== null &&
|
|
822
|
+
function $t(e, t, n) {
|
|
823
|
+
return e !== null && Qt(e.notebook, t) ? e.value : n;
|
|
824
824
|
}
|
|
825
|
-
var
|
|
825
|
+
var en = v((e) => {
|
|
826
826
|
let t = e(h), n = t === null ? null : e(t.notebookAtom);
|
|
827
827
|
return t === null || n === null ? null : {
|
|
828
828
|
replica: t,
|
|
@@ -830,82 +830,82 @@ var $t = _((e) => {
|
|
|
830
830
|
generation: e(t.generationAtom)
|
|
831
831
|
};
|
|
832
832
|
});
|
|
833
|
-
function
|
|
834
|
-
return
|
|
835
|
-
}
|
|
836
|
-
var
|
|
837
|
-
let t =
|
|
838
|
-
return t.size === 0 ?
|
|
839
|
-
}),
|
|
840
|
-
let t = e(h), n = t && e(t.analysisAtom), r = n ?
|
|
833
|
+
function tn(e, t) {
|
|
834
|
+
return Qt(t.notebook, e.get(en));
|
|
835
|
+
}
|
|
836
|
+
var nn = v((e) => {
|
|
837
|
+
let t = $t(e(F), e(en), Jt);
|
|
838
|
+
return t.size === 0 ? Yt : new Set([...t].flatMap((e) => e.cells));
|
|
839
|
+
}), rn = v((e) => {
|
|
840
|
+
let t = e(h), n = t && e(t.analysisAtom), r = n ? Rt(n.analysis, n.document.cells.values()) : Xt;
|
|
841
841
|
return {
|
|
842
842
|
shownBlocked: r,
|
|
843
|
-
blocked: n?.freshness === "current" ? r :
|
|
843
|
+
blocked: n?.freshness === "current" ? r : Xt
|
|
844
844
|
};
|
|
845
|
-
}),
|
|
845
|
+
}), an = v((e) => {
|
|
846
846
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
847
847
|
return {
|
|
848
|
-
executions: t === null ?
|
|
849
|
-
results: t === null ?
|
|
850
|
-
cells: n?.cells ??
|
|
851
|
-
requested: e(
|
|
852
|
-
...e(
|
|
848
|
+
executions: t === null ? Gt : e(t.executionsAtom),
|
|
849
|
+
results: t === null ? Kt : e(t.resultsAtom),
|
|
850
|
+
cells: n?.cells ?? qt,
|
|
851
|
+
requested: e(nn),
|
|
852
|
+
...e(rn),
|
|
853
853
|
runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
|
|
854
854
|
};
|
|
855
|
-
}),
|
|
855
|
+
}), on = v((e) => {
|
|
856
856
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
857
857
|
return t === null || n === null ? {
|
|
858
|
-
cells:
|
|
859
|
-
executions:
|
|
860
|
-
results:
|
|
858
|
+
cells: qt,
|
|
859
|
+
executions: Gt,
|
|
860
|
+
results: Kt
|
|
861
861
|
} : {
|
|
862
862
|
cells: n.cells,
|
|
863
863
|
executions: e(t.executionsAtom),
|
|
864
864
|
results: e(t.resultsAtom)
|
|
865
865
|
};
|
|
866
|
-
}),
|
|
866
|
+
}), sn = v((e) => _t(e(on))), cn = v(null), ln = v((e) => {
|
|
867
867
|
let t = e(h), n = t === null ? null : e(t.shownDocumentAtom);
|
|
868
868
|
return t === null || n === null ? null : {
|
|
869
869
|
replica: t,
|
|
870
870
|
id: n.revision.notebook_id,
|
|
871
871
|
generation: e(t.generationAtom)
|
|
872
872
|
};
|
|
873
|
-
}),
|
|
873
|
+
}), un = v((e) => {
|
|
874
874
|
let t = e(h);
|
|
875
875
|
return {
|
|
876
|
-
executions: t === null ?
|
|
877
|
-
results: t === null ?
|
|
878
|
-
cleared:
|
|
879
|
-
cells: t === null ?
|
|
876
|
+
executions: t === null ? Gt : e(t.executionsAtom),
|
|
877
|
+
results: t === null ? Kt : e(t.resultsAtom),
|
|
878
|
+
cleared: $t(e(cn), e(ln), Zt),
|
|
879
|
+
cells: t === null ? qt : e(t.documentAtom)?.cells ?? qt
|
|
880
880
|
};
|
|
881
|
-
}),
|
|
881
|
+
}), dn = v((e) => Nt(e(un))), I = p((e) => b(dn, (t) => t.get(e) ?? null, y)), L = p((e) => v((t) => Xe(t(I(e)))));
|
|
882
882
|
function fn(e) {
|
|
883
|
-
|
|
883
|
+
I.remove(e), L.remove(e);
|
|
884
884
|
}
|
|
885
885
|
function pn(e, t) {
|
|
886
|
-
let n = e.get(
|
|
886
|
+
let n = e.get(un), r = new Map(n.cleared);
|
|
887
887
|
for (let e of t) {
|
|
888
|
-
let t =
|
|
889
|
-
t != null &&
|
|
888
|
+
let t = At(n, e);
|
|
889
|
+
t != null && O(t) !== null && r.set(e, {
|
|
890
890
|
execution: t.record.id,
|
|
891
891
|
version: t.outputVersion
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
|
-
let i = e.get(
|
|
895
|
-
e.set(
|
|
894
|
+
let i = e.get(ln);
|
|
895
|
+
e.set(cn, i === null ? null : {
|
|
896
896
|
notebook: i,
|
|
897
897
|
value: r
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
|
-
var mn =
|
|
900
|
+
var mn = v((e) => {
|
|
901
901
|
let t = e(h);
|
|
902
902
|
return t === null ? null : e(t.runtimeAtom)?.state.status ?? null;
|
|
903
903
|
});
|
|
904
|
-
|
|
905
|
-
var hn =
|
|
904
|
+
v((e) => Ut(e(an).executions)), v((e) => Wt(e(an)));
|
|
905
|
+
var hn = v((e) => {
|
|
906
906
|
let t = e(h);
|
|
907
907
|
if (t === null) return { refused: "No notebook is connected" };
|
|
908
|
-
if (e(t.connectionAtom).state ===
|
|
908
|
+
if (e(t.connectionAtom).state === D.CLOSED) return { refused: "The notebook is disconnected" };
|
|
909
909
|
if (e(t.notebookAtom) === null) return "waiting";
|
|
910
910
|
let n = e(t.runtimeAtom);
|
|
911
911
|
if (n === null) return { refused: "The notebook has no runtime" };
|
|
@@ -929,28 +929,28 @@ function gn(e) {
|
|
|
929
929
|
});
|
|
930
930
|
}
|
|
931
931
|
function _n(e, t) {
|
|
932
|
-
let n = e.get(
|
|
932
|
+
let n = e.get(en);
|
|
933
933
|
if (n === null) return null;
|
|
934
934
|
let r = {
|
|
935
935
|
notebook: n,
|
|
936
936
|
cells: [...t]
|
|
937
|
-
}, i =
|
|
938
|
-
return e.set(
|
|
937
|
+
}, i = $t(e.get(F), n, Jt);
|
|
938
|
+
return e.set(F, {
|
|
939
939
|
notebook: n,
|
|
940
940
|
value: new Set(i).add(r)
|
|
941
941
|
}), r;
|
|
942
942
|
}
|
|
943
943
|
function vn(e, t) {
|
|
944
|
-
let n = e.get(
|
|
944
|
+
let n = e.get(F);
|
|
945
945
|
if (n === null || !n.value.has(t)) return;
|
|
946
946
|
let r = new Set(n.value);
|
|
947
|
-
r.delete(t), e.set(
|
|
947
|
+
r.delete(t), e.set(F, {
|
|
948
948
|
notebook: n.notebook,
|
|
949
949
|
value: r
|
|
950
950
|
});
|
|
951
951
|
}
|
|
952
952
|
function yn(e, t, n) {
|
|
953
|
-
let r =
|
|
953
|
+
let r = v((e) => Qt(t.notebook, e(en)) && !e(t.notebook.replica.executionsAtom).runs.has(n.id)), i = e.sub(r, a);
|
|
954
954
|
function a() {
|
|
955
955
|
e.get(r) || (i(), vn(e, t));
|
|
956
956
|
}
|
|
@@ -966,7 +966,7 @@ function xn(e) {
|
|
|
966
966
|
return n;
|
|
967
967
|
};
|
|
968
968
|
}
|
|
969
|
-
var Sn = xn(
|
|
969
|
+
var Sn = xn(_e), Cn = xn(ge);
|
|
970
970
|
//#endregion
|
|
971
971
|
//#region src/utils/schedule-task.ts
|
|
972
972
|
function wn() {
|
|
@@ -1072,7 +1072,7 @@ var jn = "object-id", Mn = "random-id", Nn = "abcdefghijklmnopqrstuvwxyz", Pn =
|
|
|
1072
1072
|
return Fn.add(t), t;
|
|
1073
1073
|
} }, B = {
|
|
1074
1074
|
create(e) {
|
|
1075
|
-
return
|
|
1075
|
+
return S(e != null, "cellId is required"), `cell-${e}`;
|
|
1076
1076
|
},
|
|
1077
1077
|
parse(e) {
|
|
1078
1078
|
return e.slice(5);
|
|
@@ -1101,7 +1101,7 @@ var zn = {
|
|
|
1101
1101
|
},
|
|
1102
1102
|
parseOrThrow(e) {
|
|
1103
1103
|
let t = zn.parse(e);
|
|
1104
|
-
return
|
|
1104
|
+
return S(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
1105
1105
|
}
|
|
1106
1106
|
}, Bn = { create(e) {
|
|
1107
1107
|
return `output-${e}`;
|
|
@@ -1451,13 +1451,13 @@ function er(e, t) {
|
|
|
1451
1451
|
return e instanceof V ? e.appendData(t.data) : V.create(e).appendData(t.data);
|
|
1452
1452
|
}
|
|
1453
1453
|
function tr(e) {
|
|
1454
|
-
|
|
1454
|
+
S(typeof e.data == "string", "expected string output");
|
|
1455
1455
|
}
|
|
1456
1456
|
function nr(e, t) {
|
|
1457
1457
|
let n = 0, r;
|
|
1458
1458
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
1459
1459
|
let t = e[r];
|
|
1460
|
-
t.mimetype === "text/plain" ? (
|
|
1460
|
+
t.mimetype === "text/plain" ? (S(typeof t.data == "string", "expected string"), n += t instanceof V ? t.lineCount : t.data.split("\n").length) : n++;
|
|
1461
1461
|
}
|
|
1462
1462
|
if (n < t) return e;
|
|
1463
1463
|
let i = r + 1, a = [{
|
|
@@ -1468,7 +1468,7 @@ function nr(e, t) {
|
|
|
1468
1468
|
}, ...e.slice(0, i).filter((e) => e.channel === "stdin" && e.response === void 0)], o = e[i];
|
|
1469
1469
|
if (o?.channel === "stdin" && o.response === void 0) return [...a, ...e.slice(i)];
|
|
1470
1470
|
if (o?.mimetype === "text/plain") {
|
|
1471
|
-
|
|
1471
|
+
S(typeof o.data == "string", "expected string");
|
|
1472
1472
|
let r = n - t, s = o instanceof V ? o.dropFirstLines(r) : {
|
|
1473
1473
|
...o,
|
|
1474
1474
|
data: o.data.split("\n").slice(r).join("\n")
|
|
@@ -1484,7 +1484,7 @@ function nr(e, t) {
|
|
|
1484
1484
|
//#endregion
|
|
1485
1485
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1486
1486
|
function rr(e, t) {
|
|
1487
|
-
return
|
|
1487
|
+
return Se(e * 1e3, t?.in);
|
|
1488
1488
|
}
|
|
1489
1489
|
//#endregion
|
|
1490
1490
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
@@ -1873,7 +1873,7 @@ function fr(e) {
|
|
|
1873
1873
|
}
|
|
1874
1874
|
//#endregion
|
|
1875
1875
|
//#region src/core/errors/traceback-atom.ts
|
|
1876
|
-
var pr =
|
|
1876
|
+
var pr = v(null);
|
|
1877
1877
|
//#endregion
|
|
1878
1878
|
//#region src/core/cells/logs.ts
|
|
1879
1879
|
function mr(e) {
|
|
@@ -1917,7 +1917,7 @@ function gr(e) {
|
|
|
1917
1917
|
message: JSON.stringify(t)
|
|
1918
1918
|
});
|
|
1919
1919
|
});
|
|
1920
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = m.get(
|
|
1920
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = m.get(ye) === "read";
|
|
1921
1921
|
if (t.length > 0 && !hr && n) {
|
|
1922
1922
|
hr = !0;
|
|
1923
1923
|
let e = t.find((e) => e.traceback);
|
|
@@ -1925,7 +1925,7 @@ function gr(e) {
|
|
|
1925
1925
|
title: "An internal error occurred",
|
|
1926
1926
|
description: e.msg || "Click 'View' to see traceback",
|
|
1927
1927
|
variant: "danger",
|
|
1928
|
-
action:
|
|
1928
|
+
action: C.createElement(ue, {
|
|
1929
1929
|
altText: "View traceback",
|
|
1930
1930
|
onClick: () => {
|
|
1931
1931
|
m.set(pr, {
|
|
@@ -2048,7 +2048,7 @@ function Or(e, t) {
|
|
|
2048
2048
|
r && (n.state.status === "running" && e.startCellConsole({ cellId: n.cell_id ?? "__scratch__" }), t?.(n));
|
|
2049
2049
|
},
|
|
2050
2050
|
onItem(t, n, r) {
|
|
2051
|
-
let i = t.cell_id ?? "__scratch__", a =
|
|
2051
|
+
let i = t.cell_id ?? "__scratch__", a = k(t), o = Dr(n, a ? Date.parse(a) / 1e3 : 0);
|
|
2052
2052
|
o.channel === "media" && Hn.INSTANCE.track({
|
|
2053
2053
|
cell_id: i,
|
|
2054
2054
|
output: o
|
|
@@ -2070,7 +2070,7 @@ function kr(e, t) {
|
|
|
2070
2070
|
function Ar(e, t) {
|
|
2071
2071
|
let { local: n, execution: r, code: i } = e;
|
|
2072
2072
|
if (t && t.local === n && t.code === i && t.execution?.items === r?.items) return t;
|
|
2073
|
-
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a &&
|
|
2073
|
+
let a = r?.record, o = n.clearedConsole, s = n.clearedConsoleInputs, c = a && k(a), l = c ? Date.parse(c) / 1e3 : 0, u = (e) => {
|
|
2074
2074
|
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;
|
|
2075
2075
|
let t = Dr(e, l, i);
|
|
2076
2076
|
return e.kind === "input" && !e.password && n.answers?.has(e.id) && (t.response = n.answers.get(e.id)), t;
|
|
@@ -2082,7 +2082,7 @@ function Ar(e, t) {
|
|
|
2082
2082
|
rendered: { consoleOutputs: n ? Yn([...r, n]) : r }
|
|
2083
2083
|
};
|
|
2084
2084
|
}
|
|
2085
|
-
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole :
|
|
2085
|
+
let p = !r || a?.runtime_id === "embedded" && !r.items.size ? n.embeddedConsole : it(r).flatMap((e) => u(e) ?? []);
|
|
2086
2086
|
if (d?.length) {
|
|
2087
2087
|
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;
|
|
2088
2088
|
p = [...p, ...d.map((e, t) => ({
|
|
@@ -2115,38 +2115,41 @@ function Mr(e) {
|
|
|
2115
2115
|
}
|
|
2116
2116
|
//#endregion
|
|
2117
2117
|
//#region src/core/cells/layout.ts
|
|
2118
|
-
var Nr =
|
|
2119
|
-
function
|
|
2118
|
+
var Nr = v(/* @__PURE__ */ new Set()), Pr = v([]), Fr = v([]);
|
|
2119
|
+
function Ir() {
|
|
2120
2120
|
return `column-${Ln.create()}`;
|
|
2121
2121
|
}
|
|
2122
|
-
var
|
|
2122
|
+
var Lr = v(null, (e, t, n) => {
|
|
2123
2123
|
let r = Mr(n).length, i = e(Pr);
|
|
2124
2124
|
if (i.length === r) return;
|
|
2125
|
-
let a = e(
|
|
2126
|
-
for (; o.length < r;) o.push(
|
|
2127
|
-
t(Pr, o), t(
|
|
2128
|
-
})
|
|
2129
|
-
|
|
2130
|
-
return
|
|
2131
|
-
|
|
2125
|
+
let a = e(Fr), o = [...i, ...a].slice(0, r);
|
|
2126
|
+
for (; o.length < r;) o.push(Ir());
|
|
2127
|
+
t(Pr, o), t(Fr, a.slice(Math.max(0, r - i.length)));
|
|
2128
|
+
}), Rr = b(v((e) => {
|
|
2129
|
+
let t = e(g);
|
|
2130
|
+
return t === null ? null : e(t.documentAtom);
|
|
2131
|
+
}), (e) => e === null ? [[]] : Mr(e), y), zr = v((e) => {
|
|
2132
|
+
let t = e(Rr), n = e(Pr), r = e(Fr);
|
|
2133
|
+
return [...t.map((e, t) => ({
|
|
2134
|
+
id: n[t] ?? `column-${t}`,
|
|
2132
2135
|
ids: e
|
|
2133
|
-
})), ...
|
|
2136
|
+
})), ...r.map((e) => ({
|
|
2134
2137
|
id: e,
|
|
2135
2138
|
ids: []
|
|
2136
2139
|
}))];
|
|
2137
|
-
}
|
|
2138
|
-
function
|
|
2140
|
+
});
|
|
2141
|
+
function Br(e, t, n) {
|
|
2139
2142
|
let r = /* @__PURE__ */ new Map();
|
|
2140
2143
|
return e.forEach((i, a) => {
|
|
2141
2144
|
let o = t[a];
|
|
2142
2145
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
2143
|
-
let s =
|
|
2146
|
+
let s = Qe(a, t);
|
|
2144
2147
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
2145
2148
|
}), r;
|
|
2146
2149
|
}
|
|
2147
|
-
function
|
|
2150
|
+
function Vr(e, t, n) {
|
|
2148
2151
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
2149
|
-
let i =
|
|
2152
|
+
let i = Br(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
2150
2153
|
return {
|
|
2151
2154
|
id: e,
|
|
2152
2155
|
ids: r,
|
|
@@ -2155,36 +2158,36 @@ function zr(e, t, n) {
|
|
|
2155
2158
|
};
|
|
2156
2159
|
}) };
|
|
2157
2160
|
}
|
|
2158
|
-
var
|
|
2159
|
-
let t = e(
|
|
2160
|
-
return
|
|
2161
|
-
}),
|
|
2162
|
-
function
|
|
2161
|
+
var Hr = v((e) => {
|
|
2162
|
+
let t = e(ba);
|
|
2163
|
+
return Vr(e(zr), (e) => t[e] ?? null, e(Nr));
|
|
2164
|
+
}), Ur = () => le(Hr), Wr = v((e) => e(Hr).columns.length);
|
|
2165
|
+
function Gr(e, t) {
|
|
2163
2166
|
return e.columns.find((e) => e.id === t);
|
|
2164
2167
|
}
|
|
2165
|
-
function
|
|
2168
|
+
function Kr(e, t) {
|
|
2166
2169
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2167
2170
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
2168
2171
|
return n;
|
|
2169
2172
|
}
|
|
2170
|
-
function
|
|
2173
|
+
function qr(e, t) {
|
|
2171
2174
|
for (let n of e.columns) {
|
|
2172
2175
|
let e = n.folds.get(t);
|
|
2173
2176
|
if (e !== void 0) return e;
|
|
2174
2177
|
}
|
|
2175
2178
|
}
|
|
2176
|
-
function
|
|
2179
|
+
function Jr(e, t) {
|
|
2177
2180
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
2178
2181
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
2179
2182
|
}
|
|
2180
|
-
function
|
|
2181
|
-
let n =
|
|
2182
|
-
return
|
|
2183
|
+
function Yr(e, t) {
|
|
2184
|
+
let n = Jr(e, t);
|
|
2185
|
+
return qr(e, t) === void 0 ? n : [...n, t];
|
|
2183
2186
|
}
|
|
2184
2187
|
//#endregion
|
|
2185
2188
|
//#region src/core/cells/document.ts
|
|
2186
|
-
function
|
|
2187
|
-
let n = t.code ?? e.code, r =
|
|
2189
|
+
function Xr(e, t) {
|
|
2190
|
+
let n = t.code ?? e.code, r = y(e.config, t.config) ? e.config : Tr(t.config);
|
|
2188
2191
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
2189
2192
|
...e,
|
|
2190
2193
|
name: t.name,
|
|
@@ -2196,8 +2199,8 @@ function Jr(e, t) {
|
|
|
2196
2199
|
config: r
|
|
2197
2200
|
};
|
|
2198
2201
|
}
|
|
2199
|
-
function
|
|
2200
|
-
let n =
|
|
2202
|
+
function Zr(e, t) {
|
|
2203
|
+
let n = y(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
2201
2204
|
for (let o of n) {
|
|
2202
2205
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
2203
2206
|
if (n === void 0) continue;
|
|
@@ -2215,11 +2218,11 @@ function Yr(e, t) {
|
|
|
2215
2218
|
[o]: i[o] ?? Er()
|
|
2216
2219
|
}, a = {
|
|
2217
2220
|
...a,
|
|
2218
|
-
[o]: (0,
|
|
2221
|
+
[o]: (0, C.createRef)()
|
|
2219
2222
|
};
|
|
2220
2223
|
continue;
|
|
2221
2224
|
}
|
|
2222
|
-
let c =
|
|
2225
|
+
let c = Xr(s, n);
|
|
2223
2226
|
c !== s && (r = {
|
|
2224
2227
|
...r,
|
|
2225
2228
|
[o]: c
|
|
@@ -2238,46 +2241,46 @@ function Yr(e, t) {
|
|
|
2238
2241
|
cellHandles: a
|
|
2239
2242
|
};
|
|
2240
2243
|
}
|
|
2241
|
-
function
|
|
2244
|
+
function Qr({ store: e, model: t, reconcile: n, signal: r }) {
|
|
2242
2245
|
let i = () => {
|
|
2243
2246
|
let r = e.get(t.documentAtom);
|
|
2244
|
-
r !== null && (n(r), e.set(
|
|
2247
|
+
r !== null && (n(r), e.set(Lr, r));
|
|
2245
2248
|
}, a = e.sub(t.documentAtom, i);
|
|
2246
2249
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
2247
2250
|
}
|
|
2248
|
-
async function
|
|
2251
|
+
async function $r() {
|
|
2249
2252
|
let e = m.get(g);
|
|
2250
2253
|
e !== null && m.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
2251
2254
|
}
|
|
2252
2255
|
//#endregion
|
|
2253
2256
|
//#region src/core/cells/editor.ts
|
|
2254
|
-
var
|
|
2255
|
-
function
|
|
2257
|
+
var W = v(/* @__PURE__ */ new Set());
|
|
2258
|
+
function ei(e, t, n) {
|
|
2256
2259
|
return !!e && !t.has(n);
|
|
2257
2260
|
}
|
|
2258
|
-
|
|
2259
|
-
t(
|
|
2260
|
-
}),
|
|
2261
|
+
v(null, (e, t, { cellId: n }) => {
|
|
2262
|
+
t(W, (e) => /* @__PURE__ */ new Set([...e, n]));
|
|
2263
|
+
}), v(null, (e, t, { cellId: n }) => e(W).has(n) ? (t(W, (e) => {
|
|
2261
2264
|
let t = new Set(e);
|
|
2262
2265
|
return t.delete(n), t;
|
|
2263
2266
|
}), !0) : !1);
|
|
2264
|
-
var
|
|
2265
|
-
|
|
2266
|
-
t(
|
|
2267
|
+
var ti = v(/* @__PURE__ */ new Map());
|
|
2268
|
+
v(null, (e, t, { cellId: n }) => {
|
|
2269
|
+
t(ti, (e) => {
|
|
2267
2270
|
let t = new Map(e);
|
|
2268
2271
|
return t.delete(n), t;
|
|
2269
2272
|
});
|
|
2270
2273
|
});
|
|
2271
2274
|
//#endregion
|
|
2272
2275
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
2273
|
-
function
|
|
2276
|
+
function ni(e, n) {
|
|
2274
2277
|
let r = document.getElementById(B.create(e));
|
|
2275
|
-
r ?
|
|
2278
|
+
r ? ii(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
2276
2279
|
}
|
|
2277
|
-
function
|
|
2280
|
+
function ri() {
|
|
2278
2281
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
2279
2282
|
}
|
|
2280
|
-
function
|
|
2283
|
+
function ii(e, n) {
|
|
2281
2284
|
try {
|
|
2282
2285
|
e.focus(n);
|
|
2283
2286
|
} catch {
|
|
@@ -2286,7 +2289,7 @@ function ni(e, n) {
|
|
|
2286
2289
|
}
|
|
2287
2290
|
//#endregion
|
|
2288
2291
|
//#region src/utils/timeout.ts
|
|
2289
|
-
function
|
|
2292
|
+
function ai(e, n) {
|
|
2290
2293
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
2291
2294
|
if (o < r) {
|
|
2292
2295
|
try {
|
|
@@ -2301,75 +2304,75 @@ function ri(e, n) {
|
|
|
2301
2304
|
}
|
|
2302
2305
|
//#endregion
|
|
2303
2306
|
//#region src/core/cells/utils.ts
|
|
2304
|
-
function
|
|
2307
|
+
function oi(e) {
|
|
2305
2308
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
2306
2309
|
}
|
|
2307
|
-
function
|
|
2310
|
+
function si(e) {
|
|
2308
2311
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2309
2312
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
2310
2313
|
return r;
|
|
2311
2314
|
}
|
|
2312
|
-
function
|
|
2315
|
+
function ci(e) {
|
|
2313
2316
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
2314
2317
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
2315
2318
|
return r;
|
|
2316
2319
|
}
|
|
2317
|
-
function
|
|
2320
|
+
function li(e) {
|
|
2318
2321
|
return e.history.length > 0;
|
|
2319
2322
|
}
|
|
2320
|
-
function
|
|
2323
|
+
function ui(e) {
|
|
2321
2324
|
let t = e.history[e.history.length - 1];
|
|
2322
2325
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
2323
2326
|
}
|
|
2324
|
-
function
|
|
2325
|
-
return e.status === "idle" ?
|
|
2327
|
+
function di(e, t, n) {
|
|
2328
|
+
return e.status === "idle" ? hi(e) && n.code.trim() ? "not-run" : t.sourceChanged ? "source" : e.outcome === "cancelled" ? "interrupted" : t.inputsChanged && !n.config.disabled && !e.blocked ? "inputs" : null : null;
|
|
2326
2329
|
}
|
|
2327
|
-
function*
|
|
2330
|
+
function* fi(e, t, n) {
|
|
2328
2331
|
for (let r of e.cellIds) {
|
|
2329
|
-
let i =
|
|
2330
|
-
o === null ? a.sourceChanged &&
|
|
2332
|
+
let i = Vt(t, r), a = n(r), o = di(i, a, e.cellData[r]);
|
|
2333
|
+
o === null ? a.sourceChanged && mi(t.executions, r) && (yield [r, "source"]) : yield [r, o];
|
|
2331
2334
|
}
|
|
2332
2335
|
}
|
|
2333
|
-
function
|
|
2336
|
+
function pi(e, t, n) {
|
|
2334
2337
|
let r = null;
|
|
2335
|
-
for (let [, i] of
|
|
2338
|
+
for (let [, i] of fi(e, t, n)) {
|
|
2336
2339
|
if (i !== "inputs") return i;
|
|
2337
2340
|
r = i;
|
|
2338
2341
|
}
|
|
2339
2342
|
return r;
|
|
2340
2343
|
}
|
|
2341
|
-
function
|
|
2344
|
+
function mi(e, t) {
|
|
2342
2345
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
2343
2346
|
return r !== void 0 && r.state.status !== "completed";
|
|
2344
2347
|
}
|
|
2345
|
-
function
|
|
2348
|
+
function hi({ status: e, outcome: t, live: n }) {
|
|
2346
2349
|
return (t === null || !n) && e !== "queued" && e !== "running";
|
|
2347
2350
|
}
|
|
2348
|
-
function
|
|
2351
|
+
function gi({ errored: e, stopped: t }) {
|
|
2349
2352
|
return {
|
|
2350
2353
|
published: !0,
|
|
2351
2354
|
"has-error": e,
|
|
2352
2355
|
stopped: t
|
|
2353
2356
|
};
|
|
2354
2357
|
}
|
|
2355
|
-
function
|
|
2358
|
+
function _i({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
2356
2359
|
let a = R(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
2357
2360
|
return (e || t || n || a) && !o;
|
|
2358
2361
|
}
|
|
2359
2362
|
//#endregion
|
|
2360
2363
|
//#region src/core/network/requests.ts
|
|
2361
|
-
var
|
|
2362
|
-
function
|
|
2363
|
-
let e =
|
|
2364
|
-
return
|
|
2364
|
+
var vi = v(null);
|
|
2365
|
+
function yi() {
|
|
2366
|
+
let e = le(vi);
|
|
2367
|
+
return S(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
2365
2368
|
}
|
|
2366
|
-
function
|
|
2367
|
-
let e = m.get(
|
|
2368
|
-
return
|
|
2369
|
+
function bi() {
|
|
2370
|
+
let e = m.get(vi);
|
|
2371
|
+
return S(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
2369
2372
|
}
|
|
2370
2373
|
//#endregion
|
|
2371
2374
|
//#region src/utils/storage/storage.ts
|
|
2372
|
-
var
|
|
2375
|
+
var xi = class {
|
|
2373
2376
|
store = /* @__PURE__ */ new Map();
|
|
2374
2377
|
get length() {
|
|
2375
2378
|
return this.store.size;
|
|
@@ -2390,16 +2393,16 @@ var yi = class {
|
|
|
2390
2393
|
this.store.set(e, t);
|
|
2391
2394
|
}
|
|
2392
2395
|
};
|
|
2393
|
-
function
|
|
2394
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
2395
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
2396
|
+
function Si() {
|
|
2397
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = Ce();
|
|
2398
|
+
return e ? window.localStorage : t ? window.sessionStorage : new xi();
|
|
2396
2399
|
}
|
|
2397
|
-
var
|
|
2398
|
-
function
|
|
2399
|
-
return
|
|
2400
|
+
var Ci = Si(), wi = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Ti = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Ei = /^data:image\//i, Di = ["avatars.githubusercontent.com"];
|
|
2401
|
+
function Oi(e) {
|
|
2402
|
+
return Ei.test(e) ? [{
|
|
2400
2403
|
type: "image",
|
|
2401
2404
|
url: e
|
|
2402
|
-
}] : e.split(
|
|
2405
|
+
}] : e.split(wi).filter((e) => e !== "").map((e) => wi.test(e) ? Ti.test(e) || Ei.test(e) || Di.some((t) => e.includes(t)) ? {
|
|
2403
2406
|
type: "image",
|
|
2404
2407
|
url: e
|
|
2405
2408
|
} : {
|
|
@@ -2412,48 +2415,48 @@ function Ei(e) {
|
|
|
2412
2415
|
}
|
|
2413
2416
|
//#endregion
|
|
2414
2417
|
//#region src/utils/json/json-parser.ts
|
|
2415
|
-
var
|
|
2418
|
+
var ki = new RegExp(wi.source, "g");
|
|
2416
2419
|
BigInt.prototype.toJSON = function() {
|
|
2417
2420
|
return JSON.rawJSON(this.toString());
|
|
2418
2421
|
};
|
|
2419
|
-
function
|
|
2422
|
+
function Ai(e) {
|
|
2420
2423
|
try {
|
|
2421
|
-
return JSON.parse(e, (e, t) =>
|
|
2424
|
+
return JSON.parse(e, (e, t) => Pi(t));
|
|
2422
2425
|
} catch {}
|
|
2423
2426
|
if (e == null || e === "") return {};
|
|
2424
2427
|
try {
|
|
2425
|
-
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 :
|
|
2428
|
+
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 : Pi(t) : Pi(t));
|
|
2426
2429
|
} catch {
|
|
2427
2430
|
return {};
|
|
2428
2431
|
}
|
|
2429
2432
|
}
|
|
2430
|
-
function
|
|
2433
|
+
function ji(e) {
|
|
2431
2434
|
if (e.length === 0) return "";
|
|
2432
2435
|
let t = Object.keys(e[0]);
|
|
2433
2436
|
return [
|
|
2434
2437
|
`| ${t.join(" | ")} |`,
|
|
2435
2438
|
`|${t.map(() => "---").join("|")}|`,
|
|
2436
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
2439
|
+
...e.map((e) => `| ${t.map((t) => Mi(e[t])).join(" | ")} |`)
|
|
2437
2440
|
].join("\n");
|
|
2438
2441
|
}
|
|
2439
|
-
function
|
|
2442
|
+
function Mi(e) {
|
|
2440
2443
|
if (e == null) return "";
|
|
2441
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
2444
|
+
if (Array.isArray(e) || typeof e == "object") return Ni(JSON.stringify(e));
|
|
2442
2445
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
2443
2446
|
t = t.replaceAll(n, (e) => {
|
|
2444
2447
|
let t = `__MDLINK_${i++}__`;
|
|
2445
2448
|
return r.set(t, e), t;
|
|
2446
|
-
}), t = t.replaceAll(
|
|
2449
|
+
}), t = t.replaceAll(ki, "[$1]($1)");
|
|
2447
2450
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
2448
|
-
return
|
|
2451
|
+
return Ni(t);
|
|
2449
2452
|
}
|
|
2450
|
-
function
|
|
2453
|
+
function Ni(e) {
|
|
2451
2454
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
2452
2455
|
}
|
|
2453
|
-
function
|
|
2456
|
+
function Pi(e) {
|
|
2454
2457
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
2455
2458
|
}
|
|
2456
|
-
var
|
|
2459
|
+
var Fi = new class {
|
|
2457
2460
|
getFilename() {
|
|
2458
2461
|
return this.getSearchParam("filename");
|
|
2459
2462
|
}
|
|
@@ -2480,39 +2483,39 @@ var Ni = new class {
|
|
|
2480
2483
|
}();
|
|
2481
2484
|
//#endregion
|
|
2482
2485
|
//#region src/core/dom/htmlUtils.ts
|
|
2483
|
-
function
|
|
2484
|
-
return
|
|
2486
|
+
function Ii(e) {
|
|
2487
|
+
return Ai(e ?? "");
|
|
2485
2488
|
}
|
|
2486
|
-
function
|
|
2487
|
-
return
|
|
2489
|
+
function Li(e) {
|
|
2490
|
+
return de.mapValues(e.dataset, (e) => typeof e == "string" ? Ii(e) : e);
|
|
2488
2491
|
}
|
|
2489
|
-
function
|
|
2492
|
+
function Ri(e, t) {
|
|
2490
2493
|
let n = e.parentElement ? zn.parse(e.parentElement) : void 0;
|
|
2491
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
2494
|
+
return n && t.has(n) ? t.lookupValue(n) : Ii(e.dataset.initialValue);
|
|
2492
2495
|
}
|
|
2493
|
-
function
|
|
2496
|
+
function zi() {
|
|
2494
2497
|
if (re()) return document.title || null;
|
|
2495
|
-
if (
|
|
2496
|
-
let e =
|
|
2498
|
+
if (xe()) {
|
|
2499
|
+
let e = Fi.getFilename();
|
|
2497
2500
|
if (e) return e;
|
|
2498
2501
|
}
|
|
2499
2502
|
let e = document.querySelector("marimo-filename");
|
|
2500
|
-
|
|
2503
|
+
be(e, "marimo-filename tag not found");
|
|
2501
2504
|
let t = e.innerHTML;
|
|
2502
2505
|
return t.length === 0 ? null : t;
|
|
2503
2506
|
}
|
|
2504
2507
|
//#endregion
|
|
2505
2508
|
//#region src/core/saving/file-state.ts
|
|
2506
|
-
var
|
|
2507
|
-
|
|
2508
|
-
var
|
|
2509
|
-
|
|
2509
|
+
var G = v(zi());
|
|
2510
|
+
v(null);
|
|
2511
|
+
var Bi = v(null);
|
|
2512
|
+
v(void 0);
|
|
2510
2513
|
//#endregion
|
|
2511
2514
|
//#region src/utils/storage/typed.ts
|
|
2512
|
-
var
|
|
2515
|
+
var Vi = class {
|
|
2513
2516
|
defaultValue;
|
|
2514
2517
|
storage;
|
|
2515
|
-
constructor(e, t =
|
|
2518
|
+
constructor(e, t = Ci) {
|
|
2516
2519
|
this.defaultValue = e, this.storage = t;
|
|
2517
2520
|
}
|
|
2518
2521
|
get(e) {
|
|
@@ -2529,11 +2532,11 @@ var zi = class {
|
|
|
2529
2532
|
remove(e) {
|
|
2530
2533
|
this.storage.removeItem(e);
|
|
2531
2534
|
}
|
|
2532
|
-
},
|
|
2535
|
+
}, Hi = class {
|
|
2533
2536
|
schema;
|
|
2534
2537
|
getDefaultValue;
|
|
2535
2538
|
storage;
|
|
2536
|
-
constructor(e, t, n =
|
|
2539
|
+
constructor(e, t, n = Ci) {
|
|
2537
2540
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
2538
2541
|
}
|
|
2539
2542
|
get(e) {
|
|
@@ -2552,15 +2555,15 @@ var zi = class {
|
|
|
2552
2555
|
remove(e) {
|
|
2553
2556
|
this.storage.removeItem(e);
|
|
2554
2557
|
}
|
|
2555
|
-
},
|
|
2558
|
+
}, Ui = class extends Hi {
|
|
2556
2559
|
filename;
|
|
2557
2560
|
unsubscribeFromFilename;
|
|
2558
2561
|
constructor(e, t, n) {
|
|
2559
|
-
let r = m.get(
|
|
2562
|
+
let r = m.get(G);
|
|
2560
2563
|
super(t, n), this.filename = r;
|
|
2561
2564
|
try {
|
|
2562
|
-
this.unsubscribeFromFilename = m.sub(
|
|
2563
|
-
let t = m.get(
|
|
2565
|
+
this.unsubscribeFromFilename = m.sub(G, () => {
|
|
2566
|
+
let t = m.get(G);
|
|
2564
2567
|
this.handleFilenameChange(e, t);
|
|
2565
2568
|
});
|
|
2566
2569
|
} catch {
|
|
@@ -2588,7 +2591,7 @@ var zi = class {
|
|
|
2588
2591
|
dispose() {
|
|
2589
2592
|
this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
|
|
2590
2593
|
}
|
|
2591
|
-
},
|
|
2594
|
+
}, K = {
|
|
2592
2595
|
VariableName: "VariableName",
|
|
2593
2596
|
FunctionDefinition: "FunctionDefinition",
|
|
2594
2597
|
ClassDefinition: "ClassDefinition",
|
|
@@ -2613,30 +2616,30 @@ var zi = class {
|
|
|
2613
2616
|
Comment: "Comment",
|
|
2614
2617
|
String: "String",
|
|
2615
2618
|
FormatString: "FormatString"
|
|
2616
|
-
},
|
|
2619
|
+
}, q = {
|
|
2617
2620
|
For: "for",
|
|
2618
2621
|
In: "in",
|
|
2619
2622
|
As: "as",
|
|
2620
2623
|
Import: "import"
|
|
2621
|
-
},
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2624
|
+
}, Wi = /* @__PURE__ */ new Set([
|
|
2625
|
+
K.FunctionDefinition,
|
|
2626
|
+
K.LambdaExpression,
|
|
2627
|
+
K.ArrayComprehensionExpression,
|
|
2628
|
+
K.SetComprehensionExpression,
|
|
2629
|
+
K.DictionaryComprehensionExpression,
|
|
2630
|
+
K.ComprehensionExpression,
|
|
2631
|
+
K.ClassDefinition
|
|
2629
2632
|
]);
|
|
2630
|
-
|
|
2633
|
+
K.Comment, K.String, K.FormatString;
|
|
2631
2634
|
//#endregion
|
|
2632
2635
|
//#region src/core/codemirror/utils.ts
|
|
2633
|
-
function
|
|
2636
|
+
function Gi(e) {
|
|
2634
2637
|
e && e.dispatch({ selection: {
|
|
2635
2638
|
anchor: e.state.doc.length,
|
|
2636
2639
|
head: e.state.doc.length
|
|
2637
2640
|
} });
|
|
2638
2641
|
}
|
|
2639
|
-
function
|
|
2642
|
+
function Ki(e) {
|
|
2640
2643
|
let t = e.dom.closest(".marimo-cell");
|
|
2641
2644
|
t && requestAnimationFrame(() => {
|
|
2642
2645
|
t.scrollIntoView({
|
|
@@ -2648,29 +2651,29 @@ function Wi(e) {
|
|
|
2648
2651
|
}
|
|
2649
2652
|
//#endregion
|
|
2650
2653
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
2651
|
-
var
|
|
2652
|
-
function
|
|
2654
|
+
var qi = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
2655
|
+
function Ji(e, t) {
|
|
2653
2656
|
requestAnimationFrame(() => {
|
|
2654
2657
|
e.focus(), e.dispatch({
|
|
2655
2658
|
selection: {
|
|
2656
2659
|
anchor: t,
|
|
2657
2660
|
head: t
|
|
2658
2661
|
},
|
|
2659
|
-
effects:
|
|
2662
|
+
effects: me.scrollIntoView(t, { y: "center" })
|
|
2660
2663
|
});
|
|
2661
|
-
}),
|
|
2664
|
+
}), Ki(e);
|
|
2662
2665
|
}
|
|
2663
|
-
function
|
|
2664
|
-
let n =
|
|
2666
|
+
function Yi(e, t) {
|
|
2667
|
+
let n = he(e), r = null;
|
|
2665
2668
|
return n.iterate({ enter: (n) => {
|
|
2666
2669
|
if (r !== null) return !1;
|
|
2667
|
-
if (n.name ===
|
|
2668
|
-
if (n.name ===
|
|
2670
|
+
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2671
|
+
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
2669
2672
|
} }), r;
|
|
2670
2673
|
}
|
|
2671
|
-
function
|
|
2674
|
+
function Xi(e, t) {
|
|
2672
2675
|
let n = [], r = e.resolveInner(t, 0);
|
|
2673
|
-
for (; r;)
|
|
2676
|
+
for (; r;) Wi.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
2674
2677
|
id: r.from,
|
|
2675
2678
|
type: r.name
|
|
2676
2679
|
})), r = r.parent;
|
|
@@ -2679,70 +2682,70 @@ function Ji(e, t) {
|
|
|
2679
2682
|
type: "global"
|
|
2680
2683
|
}), n;
|
|
2681
2684
|
}
|
|
2682
|
-
function
|
|
2685
|
+
function J(e, t, n) {
|
|
2683
2686
|
e.push({
|
|
2684
2687
|
scopeId: t,
|
|
2685
2688
|
from: n
|
|
2686
2689
|
});
|
|
2687
2690
|
}
|
|
2688
|
-
function
|
|
2691
|
+
function Zi(e, t) {
|
|
2689
2692
|
if (e.firstChild()) do
|
|
2690
2693
|
t(e.node);
|
|
2691
2694
|
while (e.nextSibling());
|
|
2692
2695
|
}
|
|
2693
|
-
function
|
|
2696
|
+
function Qi(e, t) {
|
|
2694
2697
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2695
2698
|
switch (e.name) {
|
|
2696
|
-
case
|
|
2697
|
-
n.doc.sliceString(e.from, e.to) === r &&
|
|
2699
|
+
case K.VariableName:
|
|
2700
|
+
n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
2698
2701
|
break;
|
|
2699
|
-
case
|
|
2700
|
-
case
|
|
2702
|
+
case K.TupleExpression:
|
|
2703
|
+
case K.ArrayExpression: {
|
|
2701
2704
|
let n = e.node.cursor();
|
|
2702
2705
|
n.firstChild();
|
|
2703
2706
|
do
|
|
2704
|
-
|
|
2707
|
+
Qi(n, t);
|
|
2705
2708
|
while (n.nextSibling());
|
|
2706
2709
|
break;
|
|
2707
2710
|
}
|
|
2708
2711
|
}
|
|
2709
2712
|
}
|
|
2710
|
-
function
|
|
2713
|
+
function $i(e, t) {
|
|
2711
2714
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2712
2715
|
o.firstChild();
|
|
2713
2716
|
do {
|
|
2714
|
-
if (o.name !==
|
|
2717
|
+
if (o.name !== K.ParamList) continue;
|
|
2715
2718
|
let e = o.node.cursor();
|
|
2716
2719
|
e.firstChild();
|
|
2717
2720
|
do
|
|
2718
|
-
e.name ===
|
|
2721
|
+
e.name === K.VariableName && n.doc.sliceString(e.from, e.to) === r && J(a, i, e.from);
|
|
2719
2722
|
while (e.nextSibling());
|
|
2720
2723
|
} while (o.nextSibling());
|
|
2721
2724
|
}
|
|
2722
|
-
function
|
|
2725
|
+
function ea(e, t) {
|
|
2723
2726
|
let n = e.cursor();
|
|
2724
2727
|
n.firstChild();
|
|
2725
2728
|
let r = !1;
|
|
2726
2729
|
do
|
|
2727
|
-
if (n.name ===
|
|
2728
|
-
else if (r && n.name ===
|
|
2729
|
-
else r &&
|
|
2730
|
+
if (n.name === q.For) r = !0;
|
|
2731
|
+
else if (r && n.name === q.In) break;
|
|
2732
|
+
else r && Qi(n, t);
|
|
2730
2733
|
while (n.nextSibling());
|
|
2731
2734
|
}
|
|
2732
|
-
function
|
|
2733
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2735
|
+
function ta(e, t) {
|
|
2736
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Wi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2734
2737
|
switch (s) {
|
|
2735
|
-
case
|
|
2736
|
-
case
|
|
2738
|
+
case K.FunctionDefinition:
|
|
2739
|
+
case K.ClassDefinition: {
|
|
2737
2740
|
let t = e.cursor();
|
|
2738
2741
|
t.firstChild();
|
|
2739
2742
|
do
|
|
2740
|
-
if (t.name ===
|
|
2741
|
-
|
|
2743
|
+
if (t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r) {
|
|
2744
|
+
J(a, i[i.length - 1] ?? -1, t.from);
|
|
2742
2745
|
break;
|
|
2743
2746
|
}
|
|
2744
2747
|
while (t.nextSibling());
|
|
2745
|
-
s ===
|
|
2748
|
+
s === K.FunctionDefinition && $i(e, {
|
|
2746
2749
|
state: n,
|
|
2747
2750
|
variableName: r,
|
|
2748
2751
|
scopeId: c,
|
|
@@ -2750,38 +2753,38 @@ function $i(e, t) {
|
|
|
2750
2753
|
});
|
|
2751
2754
|
break;
|
|
2752
2755
|
}
|
|
2753
|
-
case
|
|
2754
|
-
|
|
2756
|
+
case K.LambdaExpression:
|
|
2757
|
+
$i(e, {
|
|
2755
2758
|
state: n,
|
|
2756
2759
|
variableName: r,
|
|
2757
2760
|
scopeId: c,
|
|
2758
2761
|
declarations: a
|
|
2759
2762
|
});
|
|
2760
2763
|
break;
|
|
2761
|
-
case
|
|
2762
|
-
case
|
|
2763
|
-
case
|
|
2764
|
-
case
|
|
2765
|
-
case
|
|
2766
|
-
|
|
2764
|
+
case K.ArrayComprehensionExpression:
|
|
2765
|
+
case K.DictionaryComprehensionExpression:
|
|
2766
|
+
case K.SetComprehensionExpression:
|
|
2767
|
+
case K.ComprehensionExpression:
|
|
2768
|
+
case K.ForStatement:
|
|
2769
|
+
ea(e, {
|
|
2767
2770
|
state: n,
|
|
2768
2771
|
variableName: r,
|
|
2769
2772
|
scopeId: u,
|
|
2770
2773
|
declarations: a
|
|
2771
2774
|
});
|
|
2772
2775
|
break;
|
|
2773
|
-
case
|
|
2776
|
+
case K.AssignStatement: {
|
|
2774
2777
|
let t = [], i = e.cursor();
|
|
2775
2778
|
i.firstChild();
|
|
2776
2779
|
do
|
|
2777
|
-
i.name ===
|
|
2780
|
+
i.name === K.AssignOp && t.push(i.from);
|
|
2778
2781
|
while (i.nextSibling());
|
|
2779
2782
|
let o = t[t.length - 1];
|
|
2780
2783
|
if (o === void 0) break;
|
|
2781
2784
|
let s = e.cursor();
|
|
2782
2785
|
s.firstChild();
|
|
2783
2786
|
do
|
|
2784
|
-
s.from < o &&
|
|
2787
|
+
s.from < o && Qi(s, {
|
|
2785
2788
|
state: n,
|
|
2786
2789
|
variableName: r,
|
|
2787
2790
|
scopeId: u,
|
|
@@ -2790,14 +2793,14 @@ function $i(e, t) {
|
|
|
2790
2793
|
while (s.nextSibling());
|
|
2791
2794
|
break;
|
|
2792
2795
|
}
|
|
2793
|
-
case
|
|
2796
|
+
case K.ImportStatement: {
|
|
2794
2797
|
let t = e.cursor();
|
|
2795
2798
|
t.firstChild();
|
|
2796
2799
|
let i = !1, o = null, s = () => {
|
|
2797
|
-
o?.matches &&
|
|
2800
|
+
o?.matches && J(a, u, o.from), o = null;
|
|
2798
2801
|
};
|
|
2799
2802
|
do
|
|
2800
|
-
t.name ===
|
|
2803
|
+
t.name === q.Import ? i = !0 : i && (t.name === q.As ? o = null : t.name === K.VariableName ? (s(), o = {
|
|
2801
2804
|
from: t.from,
|
|
2802
2805
|
matches: n.doc.sliceString(t.from, t.to) === r
|
|
2803
2806
|
}) : t.name === "," && s());
|
|
@@ -2805,19 +2808,19 @@ function $i(e, t) {
|
|
|
2805
2808
|
s();
|
|
2806
2809
|
break;
|
|
2807
2810
|
}
|
|
2808
|
-
case
|
|
2809
|
-
case
|
|
2811
|
+
case K.TryStatement:
|
|
2812
|
+
case K.WithStatement: {
|
|
2810
2813
|
let t = e.cursor();
|
|
2811
2814
|
t.firstChild();
|
|
2812
2815
|
let i = !1;
|
|
2813
2816
|
do
|
|
2814
|
-
t.name ===
|
|
2817
|
+
t.name === q.As ? i = !0 : i && t.name === K.VariableName && n.doc.sliceString(t.from, t.to) === r && (J(a, u, t.from), i = !1);
|
|
2815
2818
|
while (t.nextSibling());
|
|
2816
2819
|
break;
|
|
2817
2820
|
}
|
|
2818
2821
|
}
|
|
2819
|
-
|
|
2820
|
-
|
|
2822
|
+
Zi(o, (e) => {
|
|
2823
|
+
ta(e, {
|
|
2821
2824
|
state: n,
|
|
2822
2825
|
variableName: r,
|
|
2823
2826
|
scopeStack: l,
|
|
@@ -2825,48 +2828,48 @@ function $i(e, t) {
|
|
|
2825
2828
|
});
|
|
2826
2829
|
});
|
|
2827
2830
|
}
|
|
2828
|
-
function
|
|
2829
|
-
let r =
|
|
2830
|
-
|
|
2831
|
+
function na(e, t, n) {
|
|
2832
|
+
let r = he(e), i = [];
|
|
2833
|
+
ta(r, {
|
|
2831
2834
|
state: e,
|
|
2832
2835
|
variableName: t,
|
|
2833
2836
|
scopeStack: [],
|
|
2834
2837
|
declarations: i
|
|
2835
2838
|
});
|
|
2836
2839
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2837
|
-
for (let e of
|
|
2838
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2840
|
+
for (let e of Xi(r, a)) {
|
|
2841
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !qi.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2839
2842
|
if (t) return t.from;
|
|
2840
2843
|
}
|
|
2841
2844
|
return null;
|
|
2842
2845
|
}
|
|
2843
|
-
function
|
|
2844
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2845
|
-
return i !== null && (
|
|
2846
|
+
function ra(e, t, n) {
|
|
2847
|
+
let { state: r } = e, i = n === void 0 ? Yi(r, t) : na(r, t, n);
|
|
2848
|
+
return i !== null && (Ji(e, i), !0);
|
|
2846
2849
|
}
|
|
2847
|
-
function
|
|
2848
|
-
return
|
|
2850
|
+
function ia(e, t) {
|
|
2851
|
+
return Ji(e, e.state.doc.line(t).from), !0;
|
|
2849
2852
|
}
|
|
2850
2853
|
//#endregion
|
|
2851
2854
|
//#region src/core/network/connection.ts
|
|
2852
|
-
var
|
|
2855
|
+
var Y = v({ state: D.NOT_STARTED });
|
|
2853
2856
|
ae(null, (e, t) => t === null ? null : {
|
|
2854
2857
|
phase: t.phase,
|
|
2855
2858
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2856
2859
|
});
|
|
2857
|
-
function
|
|
2858
|
-
return te(
|
|
2860
|
+
function aa() {
|
|
2861
|
+
return te(Y, (e) => e.state === D.OPEN);
|
|
2859
2862
|
}
|
|
2860
|
-
function
|
|
2861
|
-
return
|
|
2863
|
+
function oa() {
|
|
2864
|
+
return ve() ? aa() : Promise.resolve();
|
|
2862
2865
|
}
|
|
2863
|
-
|
|
2864
|
-
let t = e(
|
|
2865
|
-
return t.state ===
|
|
2866
|
-
}),
|
|
2866
|
+
v((e) => e(Y).state === D.CONNECTING), v((e) => e(Y).state === D.OPEN), v((e) => {
|
|
2867
|
+
let t = e(Y);
|
|
2868
|
+
return t.state === D.OPEN || t.state === D.NOT_STARTED;
|
|
2869
|
+
}), v((e) => e(Y).state === D.CLOSED);
|
|
2867
2870
|
//#endregion
|
|
2868
2871
|
//#region src/components/ui/checkbox.tsx
|
|
2869
|
-
var
|
|
2872
|
+
var sa = C.forwardRef((e, t) => {
|
|
2870
2873
|
let r = (0, bn.c)(13), i, a;
|
|
2871
2874
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2872
2875
|
let o;
|
|
@@ -2874,28 +2877,28 @@ var aa = w.forwardRef((e, t) => {
|
|
|
2874
2877
|
let s;
|
|
2875
2878
|
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];
|
|
2876
2879
|
let c;
|
|
2877
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2880
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, w.jsx)(Le, {
|
|
2878
2881
|
className: s,
|
|
2879
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2882
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, w.jsx)(Te, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, w.jsx)(l, { className: "h-4 w-4" })
|
|
2880
2883
|
}), r[6] = a.checked, r[7] = c);
|
|
2881
2884
|
let u;
|
|
2882
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2885
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, w.jsx)(Fe, {
|
|
2883
2886
|
ref: t,
|
|
2884
2887
|
className: o,
|
|
2885
2888
|
...a,
|
|
2886
2889
|
children: c
|
|
2887
2890
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2888
2891
|
});
|
|
2889
|
-
|
|
2892
|
+
sa.displayName = Fe.displayName;
|
|
2890
2893
|
//#endregion
|
|
2891
2894
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2892
|
-
function
|
|
2895
|
+
function ca({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2893
2896
|
if (!n) return;
|
|
2894
2897
|
let o = document.getElementById(B.create(e));
|
|
2895
2898
|
if (!o) t.warn("scrollCellIntoView: element not found");
|
|
2896
|
-
else if (
|
|
2899
|
+
else if (ri()) ii(o);
|
|
2897
2900
|
else {
|
|
2898
|
-
if (r)
|
|
2901
|
+
if (r) ii(o);
|
|
2899
2902
|
else {
|
|
2900
2903
|
Dn.promote(e);
|
|
2901
2904
|
let r = n.current?.editorView;
|
|
@@ -2904,7 +2907,7 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2904
2907
|
return;
|
|
2905
2908
|
}
|
|
2906
2909
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2907
|
-
if (
|
|
2910
|
+
if (ai(() => (r.focus(), r.hasFocus), {
|
|
2908
2911
|
retries: 5,
|
|
2909
2912
|
delay: 20
|
|
2910
2913
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2917,7 +2920,7 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2917
2920
|
anchor: e.from,
|
|
2918
2921
|
head: e.from
|
|
2919
2922
|
} });
|
|
2920
|
-
} else a &&
|
|
2923
|
+
} else a && ra(r, a);
|
|
2921
2924
|
}
|
|
2922
2925
|
o.scrollIntoView({
|
|
2923
2926
|
behavior: "smooth",
|
|
@@ -2925,20 +2928,20 @@ function oa({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2925
2928
|
});
|
|
2926
2929
|
}
|
|
2927
2930
|
}
|
|
2928
|
-
function
|
|
2931
|
+
function la() {
|
|
2929
2932
|
let e = document.getElementById("App");
|
|
2930
2933
|
e?.scrollTo({
|
|
2931
2934
|
top: e.scrollHeight,
|
|
2932
2935
|
behavior: "smooth"
|
|
2933
2936
|
});
|
|
2934
2937
|
}
|
|
2935
|
-
function
|
|
2938
|
+
function ua() {
|
|
2936
2939
|
document.getElementById("App")?.scrollTo({
|
|
2937
2940
|
top: 0,
|
|
2938
2941
|
behavior: "smooth"
|
|
2939
2942
|
});
|
|
2940
2943
|
}
|
|
2941
|
-
function
|
|
2944
|
+
function da(e) {
|
|
2942
2945
|
let t = document.getElementById(B.create(e));
|
|
2943
2946
|
return t?.scrollIntoView({
|
|
2944
2947
|
behavior: "smooth",
|
|
@@ -2947,7 +2950,7 @@ function la(e) {
|
|
|
2947
2950
|
}
|
|
2948
2951
|
//#endregion
|
|
2949
2952
|
//#region src/core/cells/cells.ts
|
|
2950
|
-
function
|
|
2953
|
+
function fa(e) {
|
|
2951
2954
|
let t = {
|
|
2952
2955
|
column: 0,
|
|
2953
2956
|
hide_code: !1,
|
|
@@ -2968,13 +2971,13 @@ function ua(e) {
|
|
|
2968
2971
|
...e.cellRuntime
|
|
2969
2972
|
},
|
|
2970
2973
|
cellHandles: {
|
|
2971
|
-
[z]: (0,
|
|
2974
|
+
[z]: (0, C.createRef)(),
|
|
2972
2975
|
...e.cellHandles
|
|
2973
2976
|
}
|
|
2974
2977
|
};
|
|
2975
2978
|
}
|
|
2976
|
-
function
|
|
2977
|
-
return
|
|
2979
|
+
function pa() {
|
|
2980
|
+
return fa({
|
|
2978
2981
|
cellIds: [],
|
|
2979
2982
|
cellData: {},
|
|
2980
2983
|
cellRuntime: {},
|
|
@@ -2984,8 +2987,8 @@ function da() {
|
|
|
2984
2987
|
cellLogs: []
|
|
2985
2988
|
});
|
|
2986
2989
|
}
|
|
2987
|
-
var { reducer:
|
|
2988
|
-
startCellConsole: (e, { cellId: t }) =>
|
|
2990
|
+
var { reducer: ma, createActions: ha, useActions: ga, valueAtom: X } = pe(pa, {
|
|
2991
|
+
startCellConsole: (e, { cellId: t }) => Z({
|
|
2989
2992
|
state: e,
|
|
2990
2993
|
cellId: t,
|
|
2991
2994
|
cellReducer: (e) => ({
|
|
@@ -2997,7 +3000,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
2997
3000
|
})
|
|
2998
3001
|
}),
|
|
2999
3002
|
showCommandOutput: (e, t) => {
|
|
3000
|
-
let { cell_id: n, entries: r, replace: i } = t, a =
|
|
3003
|
+
let { cell_id: n, entries: r, replace: i } = t, a = Z({
|
|
3001
3004
|
state: e,
|
|
3002
3005
|
cellId: n,
|
|
3003
3006
|
cellReducer: (e) => ({
|
|
@@ -3015,7 +3018,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3015
3018
|
},
|
|
3016
3019
|
hideConsoleInputs: (e, { cellId: t, executionId: n, inputIds: r }) => {
|
|
3017
3020
|
let i = new Set(r);
|
|
3018
|
-
return
|
|
3021
|
+
return Z({
|
|
3019
3022
|
state: e,
|
|
3020
3023
|
cellId: t,
|
|
3021
3024
|
cellReducer: (e) => ({
|
|
@@ -3051,13 +3054,13 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3051
3054
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
3052
3055
|
}),
|
|
3053
3056
|
reconcileDocument: (e, t) => {
|
|
3054
|
-
let n =
|
|
3055
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
3057
|
+
let n = Zr(e, t);
|
|
3058
|
+
for (let t of e.cellIds) t in n.cellData || ja(t);
|
|
3056
3059
|
return n;
|
|
3057
3060
|
},
|
|
3058
3061
|
setStdinResponse: (e, t) => {
|
|
3059
3062
|
let { cellId: n, response: r, inputId: i } = t;
|
|
3060
|
-
return
|
|
3063
|
+
return Z({
|
|
3061
3064
|
state: e,
|
|
3062
3065
|
cellId: n,
|
|
3063
3066
|
cellReducer: (e) => ({
|
|
@@ -3067,7 +3070,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3067
3070
|
});
|
|
3068
3071
|
},
|
|
3069
3072
|
resetCellRuntimes: (e, t) => {
|
|
3070
|
-
let n =
|
|
3073
|
+
let n = xe(), r = { ...e.cellRuntime };
|
|
3071
3074
|
for (let i of [...e.cellIds, z]) {
|
|
3072
3075
|
let a = e.cellRuntime[i];
|
|
3073
3076
|
r[i] = n && a !== void 0 && a.embeddedConsole.length > 0 ? a : Er({
|
|
@@ -3084,10 +3087,10 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3084
3087
|
let t = e.scrollKey;
|
|
3085
3088
|
if (t === null) return e;
|
|
3086
3089
|
let n = t;
|
|
3087
|
-
return
|
|
3090
|
+
return ca({
|
|
3088
3091
|
cellId: n,
|
|
3089
3092
|
cell: e.cellHandles[n],
|
|
3090
|
-
isCodeHidden:
|
|
3093
|
+
isCodeHidden: ei(e.cellData[n]?.config.hide_code, m.get(W), n),
|
|
3091
3094
|
codeFocus: void 0,
|
|
3092
3095
|
variableName: void 0
|
|
3093
3096
|
}), {
|
|
@@ -3101,7 +3104,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3101
3104
|
...e,
|
|
3102
3105
|
cellLogs: []
|
|
3103
3106
|
}),
|
|
3104
|
-
clearCellConsole: (e, t) =>
|
|
3107
|
+
clearCellConsole: (e, t) => Z({
|
|
3105
3108
|
state: e,
|
|
3106
3109
|
cellId: t.cellId,
|
|
3107
3110
|
cellReducer: (e) => {
|
|
@@ -3117,7 +3120,7 @@ var { reducer: fa, createActions: pa, useActions: ma, valueAtom: Z } = fe(da, {
|
|
|
3117
3120
|
}
|
|
3118
3121
|
})
|
|
3119
3122
|
});
|
|
3120
|
-
function
|
|
3123
|
+
function Z({ state: e, cellId: n, cellReducer: r }) {
|
|
3121
3124
|
return n in e.cellRuntime ? {
|
|
3122
3125
|
...e,
|
|
3123
3126
|
cellRuntime: {
|
|
@@ -3126,18 +3129,18 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
3126
3129
|
}
|
|
3127
3130
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
3128
3131
|
}
|
|
3129
|
-
var
|
|
3130
|
-
m.set(
|
|
3131
|
-
}).addLogs,
|
|
3132
|
-
|
|
3133
|
-
var
|
|
3134
|
-
|
|
3135
|
-
var
|
|
3136
|
-
let { cellIds: t, cellData: n } = e(
|
|
3132
|
+
var _a = ha((e) => {
|
|
3133
|
+
m.set(X, (t) => ma(t, e));
|
|
3134
|
+
}).addLogs, Q = v((e) => e(X).cellIds);
|
|
3135
|
+
v((e) => e(Q).length === 1), v((e) => si(e(X)).length > 0), v((e) => ci(e(X)).length > 0), v((e) => li(e(X))), v((e) => ui(e(X)));
|
|
3136
|
+
var va = v((e) => pi(e(X), e(an), e(sn)));
|
|
3137
|
+
v((e) => e(va) !== null);
|
|
3138
|
+
var ya = v((e) => {
|
|
3139
|
+
let { cellIds: t, cellData: n } = e(X);
|
|
3137
3140
|
return t.map((t) => {
|
|
3138
|
-
let r = e(
|
|
3141
|
+
let r = e(I(t)), { name: i } = n[t];
|
|
3139
3142
|
if (r !== null && R(r.mimetype)) {
|
|
3140
|
-
|
|
3143
|
+
S(Array.isArray(r.data), "Expected array data");
|
|
3141
3144
|
let e = r.data.filter((e) => !e.type.includes("ancestor"));
|
|
3142
3145
|
if (e.length > 0) return {
|
|
3143
3146
|
output: {
|
|
@@ -3150,54 +3153,54 @@ var _a = _((e) => {
|
|
|
3150
3153
|
}
|
|
3151
3154
|
return null;
|
|
3152
3155
|
}).filter(Boolean);
|
|
3153
|
-
}),
|
|
3156
|
+
}), ba = x(v((e) => {
|
|
3154
3157
|
let t = {};
|
|
3155
|
-
for (let n of e(
|
|
3156
|
-
let r = e(
|
|
3158
|
+
for (let n of e(Q)) {
|
|
3159
|
+
let r = e(L(n));
|
|
3157
3160
|
r !== null && r.items.length > 0 && (t[n] = r);
|
|
3158
3161
|
}
|
|
3159
3162
|
return t;
|
|
3160
|
-
})),
|
|
3161
|
-
|
|
3162
|
-
var
|
|
3163
|
-
let { cellIds: t, cellData: n } = e(
|
|
3164
|
-
return
|
|
3163
|
+
})), xa = v((e) => Ye(e(Q).map((t) => e(L(t)))));
|
|
3164
|
+
v((e) => e(ya).length);
|
|
3165
|
+
var Sa = x(v((e) => {
|
|
3166
|
+
let { cellIds: t, cellData: n } = e(X);
|
|
3167
|
+
return de.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
3165
3168
|
}));
|
|
3166
|
-
|
|
3167
|
-
var
|
|
3168
|
-
let { cellIds: e, cellData: t } = m.get(
|
|
3169
|
+
v((e) => e(X).scrollKey);
|
|
3170
|
+
var Ca = () => le(Q), wa = () => le(Sa), Ta = () => m.get(X), Ea = () => m.get(X).cellIds, Da = () => {
|
|
3171
|
+
let { cellIds: e, cellData: t } = m.get(X);
|
|
3169
3172
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
3170
3173
|
};
|
|
3171
|
-
|
|
3172
|
-
var
|
|
3173
|
-
let t =
|
|
3174
|
-
let n = kr(t, e), r = t(
|
|
3174
|
+
_(b(X, (e) => e.cellIds.map((t) => e.cellData[t]))), v((e) => e(X).cellIds.length > 0);
|
|
3175
|
+
var Oa = p((e) => v((t) => t(X).cellData[e])), ka = Er(), $ = p((e) => {
|
|
3176
|
+
let t = v((t) => {
|
|
3177
|
+
let n = kr(t, e), r = t(ee)?.cells;
|
|
3175
3178
|
return {
|
|
3176
|
-
local: t(
|
|
3179
|
+
local: t(X).cellRuntime[e] ?? ka,
|
|
3177
3180
|
execution: n,
|
|
3178
|
-
code: n &&
|
|
3181
|
+
code: n && Dt(n.record, r)
|
|
3179
3182
|
};
|
|
3180
3183
|
}), n = b(t, Ar);
|
|
3181
|
-
return
|
|
3182
|
-
}),
|
|
3183
|
-
function
|
|
3184
|
-
|
|
3184
|
+
return v((e) => e(n).rendered);
|
|
3185
|
+
}), Aa = p((e) => v((t) => t(X).cellHandles[e]));
|
|
3186
|
+
function ja(e) {
|
|
3187
|
+
Oa.remove(e), $.remove(e), Aa.remove(e), fn(e);
|
|
3185
3188
|
}
|
|
3186
|
-
var
|
|
3187
|
-
let { cellHandles: t } = m.get(
|
|
3189
|
+
var Ma = (e) => {
|
|
3190
|
+
let { cellHandles: t } = m.get(X);
|
|
3188
3191
|
return t[e].current?.editorView;
|
|
3189
|
-
},
|
|
3190
|
-
|
|
3191
|
-
...e(Ea(t)),
|
|
3192
|
+
}, Na = (e) => (Dn.promote(e), Ma(e));
|
|
3193
|
+
v((e) => e(Q).map((t) => ({
|
|
3192
3194
|
...e(Oa(t)),
|
|
3193
|
-
|
|
3195
|
+
...e($(t)),
|
|
3196
|
+
output: e(I(t))
|
|
3194
3197
|
})));
|
|
3195
|
-
function
|
|
3196
|
-
return
|
|
3198
|
+
function Pa() {
|
|
3199
|
+
return ga();
|
|
3197
3200
|
}
|
|
3198
3201
|
//#endregion
|
|
3199
3202
|
//#region src/core/errors/error-entries.ts
|
|
3200
|
-
function
|
|
3203
|
+
function Fa(e) {
|
|
3201
3204
|
if (On(e.mimetype)) {
|
|
3202
3205
|
if (!Array.isArray(e.data)) return null;
|
|
3203
3206
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
@@ -3208,23 +3211,23 @@ function Pa(e) {
|
|
|
3208
3211
|
tracebackHtml: e.data
|
|
3209
3212
|
} : null;
|
|
3210
3213
|
}
|
|
3211
|
-
function
|
|
3214
|
+
function Ia(e) {
|
|
3212
3215
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
3213
3216
|
}
|
|
3214
|
-
function
|
|
3217
|
+
function La(e) {
|
|
3215
3218
|
let t = e?.find((e) => kn(e.mimetype));
|
|
3216
3219
|
if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
|
|
3217
3220
|
}
|
|
3218
|
-
function
|
|
3221
|
+
function Ra(e, t) {
|
|
3219
3222
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
3220
|
-
if (!
|
|
3223
|
+
if (!Ia(e.errorData)) return La(t);
|
|
3221
3224
|
}
|
|
3222
|
-
function
|
|
3223
|
-
let { cellIds: t, cellData: n } = e.get(
|
|
3225
|
+
function za(e) {
|
|
3226
|
+
let { cellIds: t, cellData: n } = e.get(X), r = [];
|
|
3224
3227
|
for (let [i, a] of t.entries()) {
|
|
3225
|
-
let t = e.get(
|
|
3228
|
+
let t = e.get(I(a));
|
|
3226
3229
|
if (t === null || !R(t.mimetype)) continue;
|
|
3227
|
-
let o =
|
|
3230
|
+
let o = Fa(t);
|
|
3228
3231
|
if (!o) continue;
|
|
3229
3232
|
let s = Sr(n[a].name, i), c = t.code ?? n[a].code;
|
|
3230
3233
|
r.push({
|
|
@@ -3232,21 +3235,21 @@ function Ra(e) {
|
|
|
3232
3235
|
cellName: s,
|
|
3233
3236
|
cellCode: c,
|
|
3234
3237
|
errorData: o.errorData,
|
|
3235
|
-
tracebackHtml:
|
|
3238
|
+
tracebackHtml: Ra(o, e.get($(a)).consoleOutputs)
|
|
3236
3239
|
});
|
|
3237
3240
|
}
|
|
3238
3241
|
return r;
|
|
3239
3242
|
}
|
|
3240
|
-
function
|
|
3243
|
+
function Ba(e) {
|
|
3241
3244
|
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");
|
|
3242
3245
|
}
|
|
3243
|
-
function
|
|
3244
|
-
let t =
|
|
3246
|
+
function Va(e) {
|
|
3247
|
+
let t = Ba(e);
|
|
3245
3248
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${U(e.traceback)}`), t;
|
|
3246
3249
|
}
|
|
3247
|
-
function
|
|
3250
|
+
function Ha(e) {
|
|
3248
3251
|
let t = [e.cellName];
|
|
3249
|
-
return e.tracebackHtml && t.push(U(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
3252
|
+
return e.tracebackHtml && t.push(U(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Va).join("\n\n")), t.join("\n\n");
|
|
3250
3253
|
}
|
|
3251
3254
|
//#endregion
|
|
3252
|
-
export {
|
|
3255
|
+
export { ei as $, D as $t, oa as A, B as At, Ri as B, L as Bt, ca as C, gr as Ct, sa as D, Hn as Dt, ua as E, ar as Et, Hi as F, jn as Ft, bi as G, _n as Gt, ji as H, un as Ht, G as I, Mn as It, hi as J, vn as Jt, vi as K, mn as Kt, Bi as L, yn as Lt, Gi as M, In as Mt, Ui as N, zn as Nt, Y as O, Ln as Ot, Vi as P, Rn as Pt, ni as Q, $e as Qt, Ii as R, an as Rt, Pa as S, br as St, da as T, U as Tt, Oi as U, pn as Ut, Ai as V, I as Vt, Ci as W, tn as Wt, gi as X, mt as Xt, oi as Y, Vt as Yt, _i as Z, pt as Zt, xa as _, kr as _t, _a as a, Pr as at, Ca as b, xr as bt, $ as c, Gr as ct, Ma as d, Jr as dt, Ze as en, ti as et, Da as f, Hr as ft, X as g, jr as gt, pa as h, Ur as ht, za as i, we as in, Nr as it, ia as j, z as jt, aa as k, Bn as kt, ha as l, qr as lt, Ta as m, Wr as mt, Ha as n, Ue as nn, $r as nt, Oa as o, Kr as ot, Ea as p, Ir as pt, yi as q, gn as qt, Va as r, Te as rn, Qr as rt, Q as s, Fr as st, Ba as t, Je as tn, W as tt, Na as u, Yr as ut, ma as v, Or as vt, la as w, fr as wt, wa as x, Cr as xt, ja as y, Sr as yt, Li as z, sn as zt };
|