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