@marimo-team/islands 0.25.3-dev290 → 0.25.3-dev291
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-DwcFY0Nf.js → ErrorBoundary-Df7sOY5r.js} +1 -1
- package/dist/{chat-ui-ByGe2rP1.js → chat-ui-CoAmcc-W.js} +3 -3
- package/dist/{code-visibility-DSS4dPIe.js → code-visibility-DO6O_8h-.js} +2 -2
- package/dist/{common-CHNDbyF2.js → common-Coz-wkOd.js} +2312 -2285
- package/dist/{data-grid-overlay-editor-8fOxyvQO.js → data-grid-overlay-editor-LbsctrY7.js} +1 -1
- package/dist/{error-entries-9U4BFHjf.js → error-entries-CQl9aZz1.js} +539 -530
- package/dist/{feedback-button-C7Wzdmjf.js → feedback-button-DQXS8piQ.js} +3 -3
- package/dist/{glide-data-editor-BA2VyhpI.js → glide-data-editor-CiTOpufo.js} +3 -3
- package/dist/{globals-DLzuY2gk.js → globals-Bmz_qpY8.js} +1 -1
- package/dist/{html-to-image-BYh_MorV.js → html-to-image-DbxMq9QA.js} +1 -1
- package/dist/main.js +10 -10
- package/dist/{number-overlay-editor-BpuvB3ho.js → number-overlay-editor-CXO_e1Yo.js} +1 -1
- package/dist/{process-output-bS3MGJ3f.js → process-output-BHsfwmw9.js} +2 -2
- package/dist/{reveal-component-BKBSU4IA.js → reveal-component-CLRZbwl1.js} +3 -3
- package/package.json +1 -1
- package/src/components/editor/output/MarimoErrorOutput.tsx +39 -3
- package/src/core/dom/outline.ts +4 -1
- package/src/core/executions/__tests__/hooks.test.tsx +46 -1
- package/src/core/executions/__tests__/output.test.ts +266 -0
- package/src/core/executions/atoms.ts +35 -0
- package/src/core/executions/hooks.ts +44 -5
- package/src/core/executions/index.ts +16 -1
- package/src/core/executions/output.ts +242 -0
|
@@ -7,16 +7,16 @@ import { f as s, h as c } from "./tooltip-DMMiOn2f.js";
|
|
|
7
7
|
import { t as l } from "./check-XFzZeH-y.js";
|
|
8
8
|
import { n as u, r as d } from "./assertNever-B-YzWzbL.js";
|
|
9
9
|
import { t as f } from "./jsx-runtime-3BD1kT0s.js";
|
|
10
|
-
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { a as
|
|
18
|
-
import { t as
|
|
19
|
-
var
|
|
10
|
+
import { At as p, Ct as m, Dt as h, Et as g, Ft as _, Mt as v, Rt as y, St as b, d as x, dn as ee, jt as S, ln as te, mn as C, pn as ne, un as re, vt as ie, xt as ae, yt as w } from "./use-restore-focus-CosX7-gx.js";
|
|
11
|
+
import { n as oe } from "./toast-BhjIy3Tq.js";
|
|
12
|
+
import { t as se } from "./objects-DCmMvZtn.js";
|
|
13
|
+
import { t as T } from "./invariant-DLmrl-hA.js";
|
|
14
|
+
import { t as ce } from "./purify.es-DMv5zIkJ.js";
|
|
15
|
+
import { t as le } from "./createReducer-DRqwmaTc.js";
|
|
16
|
+
import { M as ue, N as de, V as fe, g as pe } from "./dist-CYeqK4Xw.js";
|
|
17
|
+
import { a as me, i as he, l as ge, m as _e, u as ve } from "./static-state-D-Q-Ajaa.js";
|
|
18
|
+
import { t as ye } from "./capabilities-D9FskwsK.js";
|
|
19
|
+
var be = c("external-link", [
|
|
20
20
|
["path", {
|
|
21
21
|
d: "M15 3h6v6",
|
|
22
22
|
key: "1q9fwt"
|
|
@@ -29,20 +29,20 @@ var ve = c("external-link", [
|
|
|
29
29
|
d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
|
|
30
30
|
key: "a6xqqp"
|
|
31
31
|
}]
|
|
32
|
-
]),
|
|
32
|
+
]), xe = c("minus", [["path", {
|
|
33
33
|
d: "M5 12h14",
|
|
34
34
|
key: "1ays0h"
|
|
35
|
-
}]]),
|
|
35
|
+
}]]), E = /* @__PURE__ */ e(i(), 1), D = f(), Se = Object.defineProperty, O = (e, t) => Se(e, "name", {
|
|
36
36
|
value: t,
|
|
37
37
|
configurable: !0
|
|
38
|
-
}),
|
|
39
|
-
function
|
|
40
|
-
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] =
|
|
38
|
+
}), Ce = "Checkbox", [we, Te] = ne(Ce), [Ee, De] = we(Ce);
|
|
39
|
+
function Oe(e) {
|
|
40
|
+
let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = re({
|
|
41
41
|
prop: n,
|
|
42
42
|
defaultProp: i ?? !1,
|
|
43
43
|
onChange: c,
|
|
44
|
-
caller:
|
|
45
|
-
}), [m, h] =
|
|
44
|
+
caller: Ce
|
|
45
|
+
}), [m, h] = E.useState(null), [g, _] = E.useState(null), [v, y] = E.useState(null), b = !m || !!o || !!m.closest("form"), x = {
|
|
46
46
|
checked: f,
|
|
47
47
|
disabled: a,
|
|
48
48
|
setChecked: p,
|
|
@@ -54,51 +54,51 @@ function we(e) {
|
|
|
54
54
|
userClick: v,
|
|
55
55
|
onUserClick: y,
|
|
56
56
|
required: l,
|
|
57
|
-
defaultChecked: !
|
|
57
|
+
defaultChecked: !k(i) && i,
|
|
58
58
|
isFormControl: b,
|
|
59
59
|
bubbleInput: g,
|
|
60
60
|
setBubbleInput: _
|
|
61
61
|
};
|
|
62
|
-
return /* @__PURE__ */ (0,
|
|
62
|
+
return /* @__PURE__ */ (0, D.jsx)(Ee, {
|
|
63
63
|
scope: t,
|
|
64
64
|
...x,
|
|
65
|
-
children:
|
|
65
|
+
children: Ie(d) ? d(x) : r
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
var
|
|
70
|
-
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } =
|
|
71
|
-
return
|
|
68
|
+
O(Oe, "CheckboxProvider");
|
|
69
|
+
var ke = "CheckboxTrigger", Ae = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
|
|
70
|
+
let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = De(ke, e), g = r(a, d), _ = E.useRef(l);
|
|
71
|
+
return E.useEffect(() => {
|
|
72
72
|
let e = o?.form;
|
|
73
73
|
if (e) {
|
|
74
|
-
let t = /* @__PURE__ */
|
|
74
|
+
let t = /* @__PURE__ */ O(() => f(_.current), "reset");
|
|
75
75
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
76
76
|
}
|
|
77
|
-
}, [o, f]), /* @__PURE__ */ (0,
|
|
77
|
+
}, [o, f]), /* @__PURE__ */ (0, D.jsx)(C.button, {
|
|
78
78
|
type: "button",
|
|
79
79
|
role: "checkbox",
|
|
80
|
-
"aria-checked":
|
|
80
|
+
"aria-checked": k(l) ? "mixed" : l,
|
|
81
81
|
"aria-required": u,
|
|
82
|
-
"data-state":
|
|
82
|
+
"data-state": A(l),
|
|
83
83
|
"data-disabled": c ? "" : void 0,
|
|
84
84
|
disabled: c,
|
|
85
85
|
value: s,
|
|
86
86
|
...i,
|
|
87
87
|
ref: g,
|
|
88
|
-
onKeyDown:
|
|
88
|
+
onKeyDown: ee(t, (e) => {
|
|
89
89
|
e.key === "Enter" && e.preventDefault();
|
|
90
90
|
}),
|
|
91
|
-
onClick:
|
|
91
|
+
onClick: ee(n, (e) => {
|
|
92
92
|
let t = e.isPropagationStopped();
|
|
93
93
|
p({
|
|
94
|
-
requestedChecked:
|
|
94
|
+
requestedChecked: k(l) ? !0 : !l,
|
|
95
95
|
hasConsumerStoppedPropagation: t
|
|
96
|
-
}), f((e) =>
|
|
96
|
+
}), f((e) => k(e) ? !0 : !e), h && m && (t || e.stopPropagation());
|
|
97
97
|
})
|
|
98
98
|
});
|
|
99
|
-
}, "CheckboxTrigger")),
|
|
99
|
+
}, "CheckboxTrigger")), je = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
100
100
|
let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
|
|
101
|
-
return /* @__PURE__ */ (0,
|
|
101
|
+
return /* @__PURE__ */ (0, D.jsx)(Oe, {
|
|
102
102
|
__scopeCheckbox: n,
|
|
103
103
|
checked: i,
|
|
104
104
|
defaultChecked: a,
|
|
@@ -108,18 +108,18 @@ var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(
|
|
|
108
108
|
name: r,
|
|
109
109
|
form: u,
|
|
110
110
|
value: c,
|
|
111
|
-
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0,
|
|
111
|
+
internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, D.jsxs)(D.Fragment, { children: [/* @__PURE__ */ (0, D.jsx)(Ae, {
|
|
112
112
|
...d,
|
|
113
113
|
ref: t,
|
|
114
114
|
__scopeCheckbox: n
|
|
115
|
-
}), e && /* @__PURE__ */ (0,
|
|
115
|
+
}), e && /* @__PURE__ */ (0, D.jsx)(Fe, { __scopeCheckbox: n })] })
|
|
116
116
|
});
|
|
117
|
-
}, "Checkbox")),
|
|
118
|
-
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a =
|
|
119
|
-
return /* @__PURE__ */ (0,
|
|
120
|
-
present: r ||
|
|
121
|
-
children: /* @__PURE__ */ (0,
|
|
122
|
-
"data-state":
|
|
117
|
+
}, "Checkbox")), Me = "CheckboxIndicator", Ne = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function(e, t) {
|
|
118
|
+
let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = De(Me, n);
|
|
119
|
+
return /* @__PURE__ */ (0, D.jsx)(te, {
|
|
120
|
+
present: r || k(a.checked) || a.checked === !0,
|
|
121
|
+
children: /* @__PURE__ */ (0, D.jsx)(C.span, {
|
|
122
|
+
"data-state": A(a.checked),
|
|
123
123
|
"data-disabled": a.disabled ? "" : void 0,
|
|
124
124
|
...i,
|
|
125
125
|
ref: t,
|
|
@@ -129,9 +129,9 @@ var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(
|
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
|
-
}, "CheckboxIndicator")),
|
|
133
|
-
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } =
|
|
134
|
-
|
|
132
|
+
}, "CheckboxIndicator")), Pe = "CheckboxBubbleInput", Fe = /* @__PURE__ */ E.forwardRef(/* @__PURE__ */ O(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
|
|
133
|
+
let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = De(Pe, e), _ = r(i, g), v = s(a), y = E.useRef(!1), b = E.useRef(c), x = E.useRef(o), S = E.useRef(null);
|
|
134
|
+
E.useEffect(() => {
|
|
135
135
|
let e = h;
|
|
136
136
|
if (!e) return;
|
|
137
137
|
let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
|
|
@@ -139,23 +139,23 @@ var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(
|
|
|
139
139
|
let r = b.current !== c;
|
|
140
140
|
b.current = c;
|
|
141
141
|
let i = o !== null && o !== x.current;
|
|
142
|
-
if (x.current = o, i)
|
|
142
|
+
if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = k(c), n.call(e, !k(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
|
|
143
143
|
else if (r) {
|
|
144
|
-
let t =
|
|
145
|
-
|
|
144
|
+
let t = S.current;
|
|
145
|
+
S.current = null;
|
|
146
146
|
let r = t?.requestedChecked === c;
|
|
147
|
-
y.current = !0, e.indeterminate =
|
|
147
|
+
y.current = !0, e.indeterminate = k(c), n.call(e, !k(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
|
|
148
148
|
}
|
|
149
149
|
}, [
|
|
150
150
|
h,
|
|
151
151
|
c,
|
|
152
152
|
o
|
|
153
153
|
]);
|
|
154
|
-
let
|
|
155
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
let te = E.useRef(!k(c) && c);
|
|
155
|
+
return /* @__PURE__ */ (0, D.jsx)(C.input, {
|
|
156
156
|
type: "checkbox",
|
|
157
157
|
"aria-hidden": !0,
|
|
158
|
-
defaultChecked: l ??
|
|
158
|
+
defaultChecked: l ?? te.current,
|
|
159
159
|
required: u,
|
|
160
160
|
disabled: d,
|
|
161
161
|
name: f,
|
|
@@ -164,7 +164,7 @@ var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(
|
|
|
164
164
|
...n,
|
|
165
165
|
tabIndex: -1,
|
|
166
166
|
ref: _,
|
|
167
|
-
onClick:
|
|
167
|
+
onClick: ee(t, (e) => {
|
|
168
168
|
y.current && e.stopPropagation();
|
|
169
169
|
}),
|
|
170
170
|
style: {
|
|
@@ -178,25 +178,25 @@ var Te = "CheckboxTrigger", Ee = /* @__PURE__ */ O.forwardRef(/* @__PURE__ */ A(
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}, "CheckboxBubbleInput"));
|
|
181
|
-
function
|
|
181
|
+
function Ie(e) {
|
|
182
182
|
return typeof e == "function";
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
function
|
|
184
|
+
O(Ie, "isFunction");
|
|
185
|
+
function k(e) {
|
|
186
186
|
return e === "indeterminate";
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
function
|
|
190
|
-
return
|
|
188
|
+
O(k, "isIndeterminate");
|
|
189
|
+
function A(e) {
|
|
190
|
+
return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
191
191
|
}
|
|
192
|
-
A
|
|
192
|
+
O(A, "getState");
|
|
193
193
|
//#endregion
|
|
194
194
|
//#region src/core/executions/freshness.ts
|
|
195
|
-
var
|
|
195
|
+
var Le = {
|
|
196
196
|
sourceChanged: !1,
|
|
197
197
|
inputsChanged: !1
|
|
198
198
|
};
|
|
199
|
-
function
|
|
199
|
+
function Re(e) {
|
|
200
200
|
let t = /* @__PURE__ */ new Map();
|
|
201
201
|
for (let n of e.executions.values()) for (let e of n.variables.values()) {
|
|
202
202
|
let n = t.get(e.name);
|
|
@@ -204,8 +204,8 @@ function Pe(e) {
|
|
|
204
204
|
}
|
|
205
205
|
return t;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
let t =
|
|
207
|
+
function ze(e) {
|
|
208
|
+
let t = Re(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
|
|
209
209
|
function i(e, n) {
|
|
210
210
|
let i = new Set(n).add(e.id);
|
|
211
211
|
for (let [n, a] of Object.entries(e.depends_on)) {
|
|
@@ -242,12 +242,12 @@ function Fe(e) {
|
|
|
242
242
|
}
|
|
243
243
|
return (t) => {
|
|
244
244
|
let n = e.results.get(t);
|
|
245
|
-
return n == null ?
|
|
245
|
+
return n == null ? Le : o(n, /* @__PURE__ */ new Set());
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
//#endregion
|
|
249
249
|
//#region src/utils/time.ts
|
|
250
|
-
var
|
|
250
|
+
var j = class e {
|
|
251
251
|
ms;
|
|
252
252
|
static fromMilliseconds(t) {
|
|
253
253
|
return t == null ? null : new e(t);
|
|
@@ -276,55 +276,55 @@ var Ie = class e {
|
|
|
276
276
|
};
|
|
277
277
|
//#endregion
|
|
278
278
|
//#region src/core/executions/select.ts
|
|
279
|
-
function
|
|
279
|
+
function Be(e) {
|
|
280
280
|
let t = e.outcome;
|
|
281
281
|
return t === null ? null : t.kind;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
return e === null ? null :
|
|
283
|
+
function Ve(e) {
|
|
284
|
+
return e === null ? null : j.parse(e).toMilliseconds();
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function He(e, t) {
|
|
287
287
|
let n = e.latest.get(t);
|
|
288
288
|
return n === void 0 ? null : e.executions.get(n) ?? null;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Ue(e, t) {
|
|
291
291
|
return e.executions.latest.get(t) ?? e.results.get(t)?.id ?? null;
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
let n =
|
|
295
|
-
n !== null && n.record.status !== "completed" ? (a = n.record.status, o =
|
|
296
|
-
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ?
|
|
293
|
+
function We(e, t) {
|
|
294
|
+
let n = He(e.executions, t), r = e.results.get(t) ?? null, i = e.submissions.has(t) && e.submissions.get(t) === Ue(e, t), a = "idle", o = r === null ? null : Ve(r.started_at), s = !1;
|
|
295
|
+
n !== null && n.record.status !== "completed" ? (a = n.record.status, o = Ve(n.record.started_at) ?? o, s = n.record.outcome !== null) : i && (a = "queued");
|
|
296
|
+
let c = a === "idle", l = c && r !== null && r.started_at !== null && r.completed_at !== null ? j.parse(r.completed_at).since(j.parse(r.started_at)) : null;
|
|
297
297
|
return {
|
|
298
298
|
status: a,
|
|
299
299
|
blocked: e.blocked.has(t),
|
|
300
|
-
outcome: c && r !== null ?
|
|
300
|
+
outcome: c && r !== null ? Be(r) : null,
|
|
301
301
|
startedAt: o,
|
|
302
302
|
duration: l,
|
|
303
303
|
rendered: s
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function Ge(e) {
|
|
307
307
|
return [...e.executions.values()].filter((e) => e.record.status !== "completed");
|
|
308
308
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
309
|
+
function Ke(e) {
|
|
310
|
+
return Ge(e).some((e) => e.record.status === "running");
|
|
311
311
|
}
|
|
312
|
-
function
|
|
313
|
-
let t =
|
|
314
|
-
for (let [t, i] of e.submissions) !n.has(t) && i ===
|
|
312
|
+
function qe(e) {
|
|
313
|
+
let t = Ge(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = 0;
|
|
314
|
+
for (let [t, i] of e.submissions) !n.has(t) && i === Ue(e, t) && (r += 1);
|
|
315
315
|
return t.length + r;
|
|
316
316
|
}
|
|
317
317
|
//#endregion
|
|
318
318
|
//#region src/core/executions/atoms.ts
|
|
319
|
-
var
|
|
319
|
+
var Je = {
|
|
320
320
|
runs: /* @__PURE__ */ new Map(),
|
|
321
321
|
executions: /* @__PURE__ */ new Map(),
|
|
322
322
|
latest: /* @__PURE__ */ new Map()
|
|
323
|
-
},
|
|
324
|
-
function
|
|
323
|
+
}, Ye = /* @__PURE__ */ new Map(), Xe = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ new Map(), Qe = /* @__PURE__ */ new Set(), $e = /* @__PURE__ */ new Map(), et = y(null), tt = y(null);
|
|
324
|
+
function nt(e, t, n, r) {
|
|
325
325
|
return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function rt(e, t) {
|
|
328
328
|
let n = e.get(m), r = n === null ? null : e.get(n.notebookAtom);
|
|
329
329
|
return n === null || r === null ? null : {
|
|
330
330
|
notebook: {
|
|
@@ -334,62 +334,160 @@ function $e(e, t) {
|
|
|
334
334
|
value: t
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
var
|
|
337
|
+
var M = y((e) => {
|
|
338
338
|
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
339
339
|
return {
|
|
340
|
-
executions: t === null ?
|
|
341
|
-
results: t === null ?
|
|
342
|
-
submissions:
|
|
343
|
-
blocked:
|
|
340
|
+
executions: t === null ? Je : e(t.executionsAtom),
|
|
341
|
+
results: t === null ? Ye : e(t.resultsAtom),
|
|
342
|
+
submissions: nt(e(et), t, n, Ze),
|
|
343
|
+
blocked: nt(e(tt), t, n, Qe)
|
|
344
344
|
};
|
|
345
|
-
}),
|
|
345
|
+
}), it = y((e) => {
|
|
346
346
|
let t = e(m), n = t === null ? null : e(t.documentAtom);
|
|
347
347
|
return t === null || n === null ? {
|
|
348
|
-
cells:
|
|
349
|
-
executions:
|
|
350
|
-
results:
|
|
348
|
+
cells: Xe,
|
|
349
|
+
executions: Je,
|
|
350
|
+
results: Ye
|
|
351
351
|
} : {
|
|
352
352
|
cells: n.cells,
|
|
353
353
|
executions: e(t.executionsAtom),
|
|
354
354
|
results: e(t.resultsAtom)
|
|
355
355
|
};
|
|
356
|
-
}),
|
|
356
|
+
}), at = y((e) => ze(e(it))), ot = y(null);
|
|
357
|
+
y((e) => {
|
|
358
|
+
let t = e(m), n = t === null ? null : e(t.notebookAtom)?.id ?? null;
|
|
359
|
+
return {
|
|
360
|
+
executions: t === null ? Je : e(t.executionsAtom),
|
|
361
|
+
results: t === null ? Ye : e(t.resultsAtom),
|
|
362
|
+
cleared: nt(e(ot), t, n, $e)
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
|
+
var st = y((e) => {
|
|
357
366
|
let t = e(m);
|
|
358
367
|
return t === null ? null : e(t.runtimeAtom)?.status ?? null;
|
|
359
368
|
});
|
|
360
|
-
y((e) =>
|
|
361
|
-
function
|
|
362
|
-
e.set(
|
|
369
|
+
y((e) => Ke(e(M).executions)), y((e) => qe(e(M)));
|
|
370
|
+
function ct(e, t) {
|
|
371
|
+
e.set(et, rt(e, t));
|
|
363
372
|
}
|
|
364
|
-
function
|
|
365
|
-
let n = new Map(e.get(
|
|
373
|
+
function lt(e, t) {
|
|
374
|
+
let n = new Map(e.get(M).submissions);
|
|
366
375
|
for (let e of t) n.delete(e);
|
|
367
|
-
|
|
376
|
+
ct(e, n);
|
|
368
377
|
}
|
|
369
|
-
function
|
|
370
|
-
let r = e.get(
|
|
378
|
+
function ut(e, t, n) {
|
|
379
|
+
let r = e.get(M).blocked;
|
|
371
380
|
if (r.has(t) === n) return;
|
|
372
381
|
let i = new Set(r);
|
|
373
|
-
n ? i.add(t) : i.delete(t), e.set(
|
|
382
|
+
n ? i.add(t) : i.delete(t), e.set(tt, rt(e, i));
|
|
374
383
|
}
|
|
375
|
-
function
|
|
384
|
+
function dt(e, t) {
|
|
376
385
|
let n = t.cell_id, r = t.status === "disabled-transitively";
|
|
377
|
-
t.status != null &&
|
|
386
|
+
t.status != null && ut(e, n, r), (r || t.output?.mimetype === "application/vnd.marimo+error") && lt(e, [n]);
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/plugins/core/sanitize-html.ts
|
|
390
|
+
var ft = a();
|
|
391
|
+
if (typeof document < "u") {
|
|
392
|
+
let e = "data-temp-href-target";
|
|
393
|
+
ce.addHook("beforeSanitizeAttributes", (t) => {
|
|
394
|
+
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
395
|
+
}), ce.addHook("afterSanitizeAttributes", (t) => {
|
|
396
|
+
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
function pt(e) {
|
|
400
|
+
let t = {
|
|
401
|
+
USE_PROFILES: {
|
|
402
|
+
html: !0,
|
|
403
|
+
svg: !0,
|
|
404
|
+
mathMl: !0
|
|
405
|
+
},
|
|
406
|
+
ADD_TAGS: ["use"],
|
|
407
|
+
ADD_ATTR: ["href", "xlink:href"],
|
|
408
|
+
FORCE_BODY: !0,
|
|
409
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
410
|
+
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
411
|
+
attributeNameCheck: /^[A-Za-z][\w-]*$/
|
|
412
|
+
},
|
|
413
|
+
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
414
|
+
};
|
|
415
|
+
return ce.sanitize(e, t);
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/core/dom/outline.ts
|
|
419
|
+
var mt = [
|
|
420
|
+
"marimo-carousel",
|
|
421
|
+
"marimo-tabs",
|
|
422
|
+
"marimo-accordion",
|
|
423
|
+
"marimo-sidebar"
|
|
424
|
+
], ht = "h1, h2, h3, h4, h5, h6";
|
|
425
|
+
function gt(e) {
|
|
426
|
+
if (typeof DOMParser > "u") return null;
|
|
427
|
+
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(ht);
|
|
428
|
+
for (let e of Array.from(n)) {
|
|
429
|
+
let n = e.textContent;
|
|
430
|
+
if (mt.some((t) => e.closest(t)) || !n) continue;
|
|
431
|
+
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
432
|
+
name: n,
|
|
433
|
+
level: r,
|
|
434
|
+
by: vt(e)
|
|
435
|
+
};
|
|
436
|
+
i !== n && (a.html = pt(i)), t.push(a);
|
|
437
|
+
}
|
|
438
|
+
return { items: t };
|
|
439
|
+
}
|
|
440
|
+
function _t(e) {
|
|
441
|
+
if (!e.includes("\"")) return `"${e}"`;
|
|
442
|
+
if (!e.includes("'")) return `'${e}'`;
|
|
443
|
+
let t = e.split("\""), n = [];
|
|
444
|
+
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
445
|
+
return `concat(${n.join(", ")})`;
|
|
446
|
+
}
|
|
447
|
+
function vt(e) {
|
|
448
|
+
let t = e.id;
|
|
449
|
+
if (t) return { id: t };
|
|
450
|
+
let n = e.textContent ?? "";
|
|
451
|
+
return { path: `//${e.tagName}[contains(., ${_t(n)})]` };
|
|
452
|
+
}
|
|
453
|
+
function yt(e) {
|
|
454
|
+
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
455
|
+
}
|
|
456
|
+
function bt(e) {
|
|
457
|
+
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
458
|
+
try {
|
|
459
|
+
return T(typeof e.data == "string", "expected string"), gt(e.data);
|
|
460
|
+
} catch {
|
|
461
|
+
return t.error("Failed to parse outline"), null;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function xt(e) {
|
|
465
|
+
return e != null && e.items.some((e) => e.level <= 3);
|
|
466
|
+
}
|
|
467
|
+
function St(e, n) {
|
|
468
|
+
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
469
|
+
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
470
|
+
let a = r(i), o = e + 1;
|
|
471
|
+
for (; o < n.length;) {
|
|
472
|
+
let t = n[o];
|
|
473
|
+
if (t && r(t) <= a) return [e, o - 1];
|
|
474
|
+
o++;
|
|
475
|
+
}
|
|
476
|
+
return [e, n.length - 1];
|
|
378
477
|
}
|
|
379
478
|
//#endregion
|
|
380
479
|
//#region src/core/codemirror/editing/commands.ts
|
|
381
|
-
|
|
382
|
-
function ct(e) {
|
|
480
|
+
function Ct(e) {
|
|
383
481
|
return (t) => {
|
|
384
482
|
let n = !1;
|
|
385
483
|
for (let r of t) r && (n = e(r) || n);
|
|
386
484
|
return n;
|
|
387
485
|
};
|
|
388
486
|
}
|
|
389
|
-
var
|
|
487
|
+
var wt = Ct(pe), Tt = Ct(de);
|
|
390
488
|
//#endregion
|
|
391
489
|
//#region src/utils/schedule-task.ts
|
|
392
|
-
function
|
|
490
|
+
function Et() {
|
|
393
491
|
let e = globalThis.scheduler;
|
|
394
492
|
if (typeof e?.postTask == "function") return (t) => {
|
|
395
493
|
e.postTask(t, { priority: "user-visible" }).catch((e) => {
|
|
@@ -410,10 +508,10 @@ function dt() {
|
|
|
410
508
|
setTimeout(e, 0);
|
|
411
509
|
};
|
|
412
510
|
}
|
|
413
|
-
var
|
|
511
|
+
var Dt = Et();
|
|
414
512
|
//#endregion
|
|
415
513
|
//#region src/core/codemirror/editor-mount-scheduler.ts
|
|
416
|
-
function
|
|
514
|
+
function Ot(e = Dt) {
|
|
417
515
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
|
|
418
516
|
function i() {
|
|
419
517
|
r || t.size === 0 || (r = !0, e(o));
|
|
@@ -456,110 +554,21 @@ function pt(e = ft) {
|
|
|
456
554
|
}
|
|
457
555
|
};
|
|
458
556
|
}
|
|
459
|
-
var
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/plugins/core/sanitize-html.ts
|
|
462
|
-
if (typeof document < "u") {
|
|
463
|
-
let e = "data-temp-href-target";
|
|
464
|
-
D.addHook("beforeSanitizeAttributes", (t) => {
|
|
465
|
-
t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
|
|
466
|
-
}), D.addHook("afterSanitizeAttributes", (t) => {
|
|
467
|
-
t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
function ht(e) {
|
|
471
|
-
let t = {
|
|
472
|
-
USE_PROFILES: {
|
|
473
|
-
html: !0,
|
|
474
|
-
svg: !0,
|
|
475
|
-
mathMl: !0
|
|
476
|
-
},
|
|
477
|
-
ADD_TAGS: ["use"],
|
|
478
|
-
ADD_ATTR: ["href", "xlink:href"],
|
|
479
|
-
FORCE_BODY: !0,
|
|
480
|
-
CUSTOM_ELEMENT_HANDLING: {
|
|
481
|
-
tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
|
|
482
|
-
attributeNameCheck: /^[A-Za-z][\w-]*$/
|
|
483
|
-
},
|
|
484
|
-
SAFE_FOR_XML: !e.includes("marimo-mermaid")
|
|
485
|
-
};
|
|
486
|
-
return D.sanitize(e, t);
|
|
487
|
-
}
|
|
488
|
-
//#endregion
|
|
489
|
-
//#region src/core/dom/outline.ts
|
|
490
|
-
var gt = [
|
|
491
|
-
"marimo-carousel",
|
|
492
|
-
"marimo-tabs",
|
|
493
|
-
"marimo-accordion",
|
|
494
|
-
"marimo-sidebar"
|
|
495
|
-
], _t = "h1, h2, h3, h4, h5, h6";
|
|
496
|
-
function vt(e) {
|
|
497
|
-
if (typeof DOMParser > "u") return null;
|
|
498
|
-
let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(_t);
|
|
499
|
-
for (let e of Array.from(n)) {
|
|
500
|
-
let n = e.textContent;
|
|
501
|
-
if (gt.some((t) => e.closest(t)) || !n) continue;
|
|
502
|
-
let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
|
|
503
|
-
name: n,
|
|
504
|
-
level: r,
|
|
505
|
-
by: bt(e)
|
|
506
|
-
};
|
|
507
|
-
i !== n && (a.html = ht(i)), t.push(a);
|
|
508
|
-
}
|
|
509
|
-
return { items: t };
|
|
510
|
-
}
|
|
511
|
-
function yt(e) {
|
|
512
|
-
if (!e.includes("\"")) return `"${e}"`;
|
|
513
|
-
if (!e.includes("'")) return `'${e}'`;
|
|
514
|
-
let t = e.split("\""), n = [];
|
|
515
|
-
for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
|
|
516
|
-
return `concat(${n.join(", ")})`;
|
|
517
|
-
}
|
|
518
|
-
function bt(e) {
|
|
519
|
-
let t = e.id;
|
|
520
|
-
if (t) return { id: t };
|
|
521
|
-
let n = e.textContent ?? "";
|
|
522
|
-
return { path: `//${e.tagName}[contains(., ${yt(n)})]` };
|
|
523
|
-
}
|
|
524
|
-
function xt(e) {
|
|
525
|
-
return { items: e.filter(Boolean).flatMap((e) => e.items) };
|
|
526
|
-
}
|
|
527
|
-
function St(e) {
|
|
528
|
-
if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
|
|
529
|
-
try {
|
|
530
|
-
return E(typeof e.data == "string", "expected string"), vt(e.data);
|
|
531
|
-
} catch {
|
|
532
|
-
return t.error("Failed to parse outline"), null;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function Ct(e) {
|
|
536
|
-
return e != null && e.items.some((e) => e.level <= 3);
|
|
537
|
-
}
|
|
538
|
-
function wt(e, n) {
|
|
539
|
-
let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
|
|
540
|
-
if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
|
|
541
|
-
let a = r(i), o = e + 1;
|
|
542
|
-
for (; o < n.length;) {
|
|
543
|
-
let t = n[o];
|
|
544
|
-
if (t && r(t) <= a) return [e, o - 1];
|
|
545
|
-
o++;
|
|
546
|
-
}
|
|
547
|
-
return [e, n.length - 1];
|
|
548
|
-
}
|
|
557
|
+
var kt = Ot();
|
|
549
558
|
//#endregion
|
|
550
559
|
//#region src/core/mime.ts
|
|
551
|
-
function
|
|
560
|
+
function At(e) {
|
|
552
561
|
return e === "application/vnd.marimo+error";
|
|
553
562
|
}
|
|
554
|
-
function
|
|
563
|
+
function jt(e) {
|
|
555
564
|
return e === "application/vnd.marimo+traceback";
|
|
556
565
|
}
|
|
557
|
-
function
|
|
558
|
-
return
|
|
566
|
+
function N(e) {
|
|
567
|
+
return At(e) || jt(e);
|
|
559
568
|
}
|
|
560
569
|
//#endregion
|
|
561
570
|
//#region src/components/editor/output/ansi-reduce.ts
|
|
562
|
-
var
|
|
571
|
+
var Mt = class e {
|
|
563
572
|
lines = [""];
|
|
564
573
|
cursor = {
|
|
565
574
|
row: 0,
|
|
@@ -648,7 +657,7 @@ var Dt = class e {
|
|
|
648
657
|
render() {
|
|
649
658
|
return this.lines.join("\n");
|
|
650
659
|
}
|
|
651
|
-
},
|
|
660
|
+
}, Nt = class {
|
|
652
661
|
ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
|
|
653
662
|
parse(e) {
|
|
654
663
|
let t = [], n = 0;
|
|
@@ -667,9 +676,9 @@ var Dt = class e {
|
|
|
667
676
|
value: e.slice(n)
|
|
668
677
|
}), t;
|
|
669
678
|
}
|
|
670
|
-
},
|
|
671
|
-
parser = new
|
|
672
|
-
buffer = new
|
|
679
|
+
}, Pt = class {
|
|
680
|
+
parser = new Nt();
|
|
681
|
+
buffer = new Mt();
|
|
673
682
|
reduce(e) {
|
|
674
683
|
return this.reset(), this.append(e), this.render();
|
|
675
684
|
}
|
|
@@ -685,7 +694,7 @@ var Dt = class e {
|
|
|
685
694
|
for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
|
|
686
695
|
}
|
|
687
696
|
reset() {
|
|
688
|
-
this.buffer = new
|
|
697
|
+
this.buffer = new Mt();
|
|
689
698
|
}
|
|
690
699
|
render() {
|
|
691
700
|
return this.buffer.render();
|
|
@@ -728,19 +737,19 @@ var Dt = class e {
|
|
|
728
737
|
for (let t of e) t >= " " && (n += t);
|
|
729
738
|
return n;
|
|
730
739
|
}
|
|
731
|
-
},
|
|
740
|
+
}, P = class e {
|
|
732
741
|
mimetype;
|
|
733
742
|
channel;
|
|
734
743
|
timestamp;
|
|
735
744
|
code;
|
|
736
745
|
id;
|
|
737
|
-
ansiReducer = new
|
|
746
|
+
ansiReducer = new Pt();
|
|
738
747
|
_data;
|
|
739
748
|
get data() {
|
|
740
749
|
return this._data;
|
|
741
750
|
}
|
|
742
751
|
static create(t) {
|
|
743
|
-
let n = new
|
|
752
|
+
let n = new Pt();
|
|
744
753
|
return n.append(t.data), new e({
|
|
745
754
|
mimetype: t.mimetype,
|
|
746
755
|
channel: t.channel,
|
|
@@ -775,32 +784,32 @@ var Dt = class e {
|
|
|
775
784
|
};
|
|
776
785
|
//#endregion
|
|
777
786
|
//#region src/core/cells/collapseConsoleOutputs.tsx
|
|
778
|
-
function
|
|
787
|
+
function Ft(e, t = 5e3) {
|
|
779
788
|
let n = [...e];
|
|
780
|
-
if (n.length < 2) return
|
|
789
|
+
if (n.length < 2) return Bt(n.map(Lt), t);
|
|
781
790
|
let r = n[n.length - 1], i = n[n.length - 2];
|
|
782
|
-
return
|
|
791
|
+
return It(r, i) && (zt(r), zt(i), n[n.length - 2] = Rt(i, r), n.pop()), Bt(n, t);
|
|
783
792
|
}
|
|
784
|
-
function
|
|
793
|
+
function It(e, t) {
|
|
785
794
|
let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
|
|
786
795
|
if (!n) return !1;
|
|
787
796
|
let r = e.channel === t.channel, i = e.channel !== "stdin";
|
|
788
797
|
return n && r && i;
|
|
789
798
|
}
|
|
790
|
-
function
|
|
791
|
-
return e instanceof
|
|
799
|
+
function Lt(e) {
|
|
800
|
+
return e instanceof P ? e : typeof e.data == "string" ? P.create(e) : e;
|
|
792
801
|
}
|
|
793
|
-
function
|
|
794
|
-
return e instanceof
|
|
802
|
+
function Rt(e, t) {
|
|
803
|
+
return e instanceof P ? e.appendData(t.data) : P.create(e).appendData(t.data);
|
|
795
804
|
}
|
|
796
|
-
function
|
|
797
|
-
|
|
805
|
+
function zt(e) {
|
|
806
|
+
T(typeof e.data == "string", "expected string output");
|
|
798
807
|
}
|
|
799
|
-
function
|
|
808
|
+
function Bt(e, t) {
|
|
800
809
|
let n = 0, r;
|
|
801
810
|
for (r = e.length - 1; r >= 0 && n < t; r--) {
|
|
802
811
|
let t = e[r];
|
|
803
|
-
t.mimetype === "text/plain" ? (
|
|
812
|
+
t.mimetype === "text/plain" ? (T(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
|
|
804
813
|
}
|
|
805
814
|
if (n < t) return e;
|
|
806
815
|
let i = r + 1, a = {
|
|
@@ -811,7 +820,7 @@ function Ft(e, t) {
|
|
|
811
820
|
}, o = e[i];
|
|
812
821
|
if (o == null) return [a, ...e.slice(i + 1)];
|
|
813
822
|
if (o.mimetype === "text/plain") {
|
|
814
|
-
|
|
823
|
+
T(typeof o.data == "string", "expected string");
|
|
815
824
|
let r = o.data.split("\n"), s = t - (n - r.length);
|
|
816
825
|
return [
|
|
817
826
|
a,
|
|
@@ -826,16 +835,16 @@ function Ft(e, t) {
|
|
|
826
835
|
}
|
|
827
836
|
//#endregion
|
|
828
837
|
//#region src/core/cells/cell.ts
|
|
829
|
-
function
|
|
838
|
+
function Vt(e) {
|
|
830
839
|
return (e.at(-1)?.id ?? 0) + 1;
|
|
831
840
|
}
|
|
832
|
-
function
|
|
841
|
+
function Ht(e) {
|
|
833
842
|
return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
|
|
834
843
|
}
|
|
835
|
-
function
|
|
844
|
+
function Ut(e, t) {
|
|
836
845
|
let n = { ...e };
|
|
837
|
-
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" &&
|
|
838
|
-
let r =
|
|
846
|
+
t.status === "queued" && (n.debuggerActive = !1), t.status === "running" && Ht(e.output).some((e) => e.includes("ancestor")) && (n.output = null), n.output = t.output ?? n.output, t.serialization !== void 0 && (n.serialization = t.serialization);
|
|
847
|
+
let r = Ht(t.output).includes("interruption"), i = e.consoleOutputs;
|
|
839
848
|
(r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
|
|
840
849
|
channel: e.channel,
|
|
841
850
|
mimetype: e.mimetype,
|
|
@@ -845,26 +854,26 @@ function Rt(e, t) {
|
|
|
845
854
|
response: e.response ?? ""
|
|
846
855
|
} : e));
|
|
847
856
|
let a = t.console;
|
|
848
|
-
a != null && (i =
|
|
857
|
+
a != null && (i = Ft(Array.isArray(a) ? a.map((e, t) => ({
|
|
849
858
|
...e,
|
|
850
859
|
id: t + 1
|
|
851
860
|
})) : [...i, {
|
|
852
861
|
...a,
|
|
853
|
-
id:
|
|
854
|
-
}])), n.consoleOutputs = i, n.outline =
|
|
862
|
+
id: Vt(i)
|
|
863
|
+
}])), n.consoleOutputs = i, n.outline = bt(n.output);
|
|
855
864
|
let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
|
|
856
865
|
return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
|
|
857
866
|
}
|
|
858
|
-
function
|
|
867
|
+
function Wt(e) {
|
|
859
868
|
return e === "running" || e === "queued";
|
|
860
869
|
}
|
|
861
|
-
function
|
|
870
|
+
function Gt(e, t, n) {
|
|
862
871
|
let { status: r, outcome: i, rendered: a } = e;
|
|
863
|
-
return
|
|
872
|
+
return Wt(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
|
|
864
873
|
}
|
|
865
874
|
//#endregion
|
|
866
875
|
//#region src/core/cells/columns.ts
|
|
867
|
-
function
|
|
876
|
+
function Kt(e) {
|
|
868
877
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
869
878
|
for (let r of e.order) {
|
|
870
879
|
let i = e.cells.get(r)?.config.column;
|
|
@@ -872,9 +881,9 @@ function Vt(e) {
|
|
|
872
881
|
}
|
|
873
882
|
return t;
|
|
874
883
|
}
|
|
875
|
-
function
|
|
884
|
+
function qt(e) {
|
|
876
885
|
let t = [[]];
|
|
877
|
-
for (let [n, r] of
|
|
886
|
+
for (let [n, r] of Kt(e)) {
|
|
878
887
|
for (; t.length <= r;) t.push([]);
|
|
879
888
|
t[r].push(n);
|
|
880
889
|
}
|
|
@@ -882,18 +891,18 @@ function Ht(e) {
|
|
|
882
891
|
}
|
|
883
892
|
//#endregion
|
|
884
893
|
//#region src/core/dom/ui-element-constants.ts
|
|
885
|
-
var
|
|
894
|
+
var Jt = "object-id", Yt = "random-id", Xt = "abcdefghijklmnopqrstuvwxyz", Zt = Xt + Xt.toUpperCase(), Qt = /* @__PURE__ */ new Set(), F = "__scratch__", $t = "setup", en = { create() {
|
|
886
895
|
let e = 0, t;
|
|
887
896
|
do {
|
|
888
897
|
let n = "";
|
|
889
|
-
for (let e = 0; e < 4; e++) n +=
|
|
898
|
+
for (let e = 0; e < 4; e++) n += Zt[Math.floor(Math.random() * 52)];
|
|
890
899
|
t = n, e++;
|
|
891
|
-
} while (
|
|
900
|
+
} while (Qt.has(t) && e < 100);
|
|
892
901
|
if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
|
|
893
|
-
return
|
|
894
|
-
} },
|
|
902
|
+
return Qt.add(t), t;
|
|
903
|
+
} }, I = {
|
|
895
904
|
create(e) {
|
|
896
|
-
return
|
|
905
|
+
return T(e != null, "cellId is required"), `cell-${e}`;
|
|
897
906
|
},
|
|
898
907
|
parse(e) {
|
|
899
908
|
return e.slice(5);
|
|
@@ -904,7 +913,7 @@ var Ut = "object-id", Wt = "random-id", Gt = "abcdefghijklmnopqrstuvwxyz", Kt =
|
|
|
904
913
|
findElementThroughShadowDOMs(e) {
|
|
905
914
|
let t = e;
|
|
906
915
|
for (; t;) {
|
|
907
|
-
let e =
|
|
916
|
+
let e = I.findElement(t);
|
|
908
917
|
if (e) return e;
|
|
909
918
|
let n = t.getRootNode();
|
|
910
919
|
if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
|
|
@@ -912,33 +921,33 @@ var Ut = "object-id", Wt = "random-id", Gt = "abcdefghijklmnopqrstuvwxyz", Kt =
|
|
|
912
921
|
return null;
|
|
913
922
|
}
|
|
914
923
|
};
|
|
915
|
-
function
|
|
916
|
-
let t = null, n =
|
|
917
|
-
return n && (t =
|
|
924
|
+
function tn(e) {
|
|
925
|
+
let t = null, n = I.findElementThroughShadowDOMs(e);
|
|
926
|
+
return n && (t = I.parse(n.id)), t;
|
|
918
927
|
}
|
|
919
|
-
var
|
|
928
|
+
var L = {
|
|
920
929
|
parse(e) {
|
|
921
|
-
return e.getAttribute(
|
|
930
|
+
return e.getAttribute(Jt);
|
|
922
931
|
},
|
|
923
932
|
parseOrThrow(e) {
|
|
924
|
-
let t =
|
|
925
|
-
return
|
|
933
|
+
let t = L.parse(e);
|
|
934
|
+
return T(t, "<marimo-ui-element/> missing object-id attribute"), t;
|
|
926
935
|
}
|
|
927
|
-
},
|
|
936
|
+
}, nn = { create(e) {
|
|
928
937
|
return `output-${e}`;
|
|
929
|
-
} },
|
|
930
|
-
function
|
|
931
|
-
return `column-${
|
|
938
|
+
} }, rn = y(/* @__PURE__ */ new Set()), R = y([]), z = y([]);
|
|
939
|
+
function an() {
|
|
940
|
+
return `column-${en.create()}`;
|
|
932
941
|
}
|
|
933
|
-
var
|
|
934
|
-
let r =
|
|
942
|
+
var on = y(null, (e, t, n) => {
|
|
943
|
+
let r = qt(n).length, i = e(R);
|
|
935
944
|
if (i.length === r) return;
|
|
936
|
-
let a = e(
|
|
937
|
-
for (; o.length < r;) o.push(
|
|
938
|
-
t(
|
|
945
|
+
let a = e(z), o = [...i, ...a].slice(0, r);
|
|
946
|
+
for (; o.length < r;) o.push(an());
|
|
947
|
+
t(R, o), t(z, a.slice(Math.max(0, r - i.length)));
|
|
939
948
|
});
|
|
940
|
-
function
|
|
941
|
-
return [...(e === null ? [[]] :
|
|
949
|
+
function sn(e, t, n) {
|
|
950
|
+
return [...(e === null ? [[]] : qt(e)).map((e, n) => ({
|
|
942
951
|
id: t[n] ?? `column-${n}`,
|
|
943
952
|
ids: e
|
|
944
953
|
})), ...n.map((e) => ({
|
|
@@ -946,18 +955,18 @@ function nn(e, t, n) {
|
|
|
946
955
|
ids: []
|
|
947
956
|
}))];
|
|
948
957
|
}
|
|
949
|
-
function
|
|
958
|
+
function cn(e, t, n) {
|
|
950
959
|
let r = /* @__PURE__ */ new Map();
|
|
951
960
|
return e.forEach((i, a) => {
|
|
952
961
|
let o = t[a];
|
|
953
962
|
if (!n.has(i) || !o || o.items.length === 0) return;
|
|
954
|
-
let s =
|
|
963
|
+
let s = St(a, t);
|
|
955
964
|
s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
|
|
956
965
|
}), r;
|
|
957
966
|
}
|
|
958
|
-
function
|
|
967
|
+
function ln(e, t, n) {
|
|
959
968
|
return { columns: e.map(({ id: e, ids: r }) => {
|
|
960
|
-
let i =
|
|
969
|
+
let i = cn(r, r.map(t), n), a = new Set([...i.values()].flat());
|
|
961
970
|
return {
|
|
962
971
|
id: e,
|
|
963
972
|
ids: r,
|
|
@@ -966,52 +975,52 @@ function an(e, t, n) {
|
|
|
966
975
|
};
|
|
967
976
|
}) };
|
|
968
977
|
}
|
|
969
|
-
var
|
|
970
|
-
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(
|
|
971
|
-
return
|
|
972
|
-
}),
|
|
973
|
-
function
|
|
978
|
+
var B = y((e) => {
|
|
979
|
+
let t = e(b), n = t === null ? null : e(t.documentAtom), r = e(ui);
|
|
980
|
+
return ln(sn(n, e(R), e(z)), (e) => r[e] ?? null, e(rn));
|
|
981
|
+
}), un = () => _(B), dn = y((e) => e(B).columns.length);
|
|
982
|
+
function fn(e, t) {
|
|
974
983
|
return e.columns.find((e) => e.id === t);
|
|
975
984
|
}
|
|
976
|
-
function
|
|
985
|
+
function pn(e, t) {
|
|
977
986
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
978
987
|
if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
|
|
979
988
|
return n;
|
|
980
989
|
}
|
|
981
|
-
function
|
|
990
|
+
function mn(e, t) {
|
|
982
991
|
for (let n of e.columns) {
|
|
983
992
|
let e = n.folds.get(t);
|
|
984
993
|
if (e !== void 0) return e;
|
|
985
994
|
}
|
|
986
995
|
}
|
|
987
|
-
function
|
|
996
|
+
function hn(e, t) {
|
|
988
997
|
let n = e.columns.find((e) => e.ids.includes(t));
|
|
989
998
|
return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
|
|
990
999
|
}
|
|
991
|
-
function
|
|
992
|
-
let n =
|
|
993
|
-
return
|
|
1000
|
+
function gn(e, t) {
|
|
1001
|
+
let n = hn(e, t);
|
|
1002
|
+
return mn(e, t) === void 0 ? n : [...n, t];
|
|
994
1003
|
}
|
|
995
|
-
var
|
|
996
|
-
function
|
|
1004
|
+
var _n = /* @__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("."));
|
|
1005
|
+
function vn(e, t = !0) {
|
|
997
1006
|
return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
|
|
998
1007
|
}
|
|
999
|
-
function
|
|
1000
|
-
let n = new Set(t), r = e, i = (e) => !n.has(e) && !
|
|
1008
|
+
function yn(e, t) {
|
|
1009
|
+
let n = new Set(t), r = e, i = (e) => !n.has(e) && !_n.has(e);
|
|
1001
1010
|
if (i(e)) return e;
|
|
1002
1011
|
let a = 1;
|
|
1003
1012
|
for (; !i(r);) r = `${e}_${a}`, a++;
|
|
1004
1013
|
return r;
|
|
1005
1014
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return
|
|
1015
|
+
function bn(e, t) {
|
|
1016
|
+
return xn(e) ? `cell-${t}` : e;
|
|
1008
1017
|
}
|
|
1009
|
-
function
|
|
1018
|
+
function xn(e) {
|
|
1010
1019
|
return !e || e === "_" || e === "__";
|
|
1011
1020
|
}
|
|
1012
1021
|
//#endregion
|
|
1013
1022
|
//#region src/core/cells/types.ts
|
|
1014
|
-
function
|
|
1023
|
+
function Sn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
1015
1024
|
return {
|
|
1016
1025
|
id: e,
|
|
1017
1026
|
config: r || {
|
|
@@ -1024,7 +1033,7 @@ function yn({ id: e, name: t = "_", code: n = "", config: r }) {
|
|
|
1024
1033
|
code: n
|
|
1025
1034
|
};
|
|
1026
1035
|
}
|
|
1027
|
-
function
|
|
1036
|
+
function Cn(e) {
|
|
1028
1037
|
return {
|
|
1029
1038
|
hide_code: !1,
|
|
1030
1039
|
disabled: !1,
|
|
@@ -1033,7 +1042,7 @@ function bn(e) {
|
|
|
1033
1042
|
...e
|
|
1034
1043
|
};
|
|
1035
1044
|
}
|
|
1036
|
-
function
|
|
1045
|
+
function V(e) {
|
|
1037
1046
|
return {
|
|
1038
1047
|
outline: null,
|
|
1039
1048
|
output: null,
|
|
@@ -1044,8 +1053,8 @@ function xn(e) {
|
|
|
1044
1053
|
}
|
|
1045
1054
|
//#endregion
|
|
1046
1055
|
//#region src/core/cells/document.ts
|
|
1047
|
-
function
|
|
1048
|
-
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config :
|
|
1056
|
+
function wn(e, t) {
|
|
1057
|
+
let n = t.code ?? e.code, r = v(e.config, t.config) ? e.config : Cn(t.config);
|
|
1049
1058
|
return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
|
|
1050
1059
|
...e,
|
|
1051
1060
|
name: t.name,
|
|
@@ -1057,7 +1066,7 @@ function Sn(e, t) {
|
|
|
1057
1066
|
config: r
|
|
1058
1067
|
};
|
|
1059
1068
|
}
|
|
1060
|
-
function
|
|
1069
|
+
function Tn(e, t) {
|
|
1061
1070
|
let n = v(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
|
|
1062
1071
|
for (let o of n) {
|
|
1063
1072
|
let n = t.cells.get(o), s = e.cellData[o];
|
|
@@ -1065,22 +1074,22 @@ function Cn(e, t) {
|
|
|
1065
1074
|
if (s === void 0) {
|
|
1066
1075
|
r = {
|
|
1067
1076
|
...r,
|
|
1068
|
-
[o]:
|
|
1077
|
+
[o]: Sn({
|
|
1069
1078
|
id: o,
|
|
1070
1079
|
code: n.code ?? "",
|
|
1071
1080
|
name: n.name,
|
|
1072
|
-
config:
|
|
1081
|
+
config: Cn(n.config)
|
|
1073
1082
|
})
|
|
1074
1083
|
}, i = {
|
|
1075
1084
|
...i,
|
|
1076
|
-
[o]: i[o] ??
|
|
1085
|
+
[o]: i[o] ?? V()
|
|
1077
1086
|
}, a = {
|
|
1078
1087
|
...a,
|
|
1079
|
-
[o]: (0,
|
|
1088
|
+
[o]: (0, E.createRef)()
|
|
1080
1089
|
};
|
|
1081
1090
|
continue;
|
|
1082
1091
|
}
|
|
1083
|
-
let c =
|
|
1092
|
+
let c = wn(s, n);
|
|
1084
1093
|
c !== s && (r = {
|
|
1085
1094
|
...r,
|
|
1086
1095
|
[o]: c
|
|
@@ -1099,21 +1108,21 @@ function Cn(e, t) {
|
|
|
1099
1108
|
cellHandles: a
|
|
1100
1109
|
};
|
|
1101
1110
|
}
|
|
1102
|
-
function
|
|
1111
|
+
function En({ store: e, model: t, reconcile: n, signal: r }) {
|
|
1103
1112
|
let i = () => {
|
|
1104
1113
|
let r = e.get(t.documentAtom);
|
|
1105
|
-
r !== null && (n(r), e.set(
|
|
1114
|
+
r !== null && (n(r), e.set(on, r));
|
|
1106
1115
|
}, a = e.sub(t.documentAtom, i);
|
|
1107
1116
|
r.addEventListener("abort", a, { once: !0 }), i();
|
|
1108
1117
|
}
|
|
1109
|
-
async function
|
|
1110
|
-
let e =
|
|
1111
|
-
e !== null &&
|
|
1118
|
+
async function Dn() {
|
|
1119
|
+
let e = w.get(b);
|
|
1120
|
+
e !== null && w.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
|
|
1112
1121
|
}
|
|
1113
1122
|
//#endregion
|
|
1114
1123
|
//#region src/core/cells/editor.ts
|
|
1115
1124
|
var H = y(/* @__PURE__ */ new Set());
|
|
1116
|
-
function
|
|
1125
|
+
function On(e, t, n) {
|
|
1117
1126
|
return !!e && !t.has(n);
|
|
1118
1127
|
}
|
|
1119
1128
|
y(null, (e, t, { cellId: n }) => {
|
|
@@ -1122,27 +1131,27 @@ y(null, (e, t, { cellId: n }) => {
|
|
|
1122
1131
|
let t = new Set(e);
|
|
1123
1132
|
return t.delete(n), t;
|
|
1124
1133
|
}), !0) : !1);
|
|
1125
|
-
var
|
|
1134
|
+
var kn = y(/* @__PURE__ */ new Map());
|
|
1126
1135
|
y(null, (e, t, { cellId: n }) => {
|
|
1127
|
-
t(
|
|
1136
|
+
t(kn, (e) => {
|
|
1128
1137
|
let t = new Map(e);
|
|
1129
1138
|
return t.delete(n), t;
|
|
1130
1139
|
});
|
|
1131
1140
|
});
|
|
1132
1141
|
//#endregion
|
|
1133
1142
|
//#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
|
|
1134
|
-
function
|
|
1135
|
-
return
|
|
1143
|
+
function An(e, t) {
|
|
1144
|
+
return ve(e * 1e3, t?.in);
|
|
1136
1145
|
}
|
|
1137
1146
|
//#endregion
|
|
1138
1147
|
//#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
|
|
1139
|
-
var
|
|
1148
|
+
var jn = function(e, t) {
|
|
1140
1149
|
return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
|
|
1141
1150
|
}, U;
|
|
1142
1151
|
(function(e) {
|
|
1143
1152
|
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";
|
|
1144
1153
|
})(U ||= {});
|
|
1145
|
-
var
|
|
1154
|
+
var Mn = class {
|
|
1146
1155
|
constructor() {
|
|
1147
1156
|
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 = {
|
|
1148
1157
|
http: 1,
|
|
@@ -1387,7 +1396,7 @@ var An = class {
|
|
|
1387
1396
|
var r = this._buffer.charAt(1);
|
|
1388
1397
|
if (r != "[" && r != "]" && r != "(") return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1389
1398
|
if (r == "[") {
|
|
1390
|
-
this._csi_regex ||=
|
|
1399
|
+
this._csi_regex ||= Nn(Fn ||= jn(["\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 "]));
|
|
1391
1400
|
let t = this._buffer.match(this._csi_regex);
|
|
1392
1401
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1393
1402
|
if (t[4]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
@@ -1398,7 +1407,7 @@ var An = class {
|
|
|
1398
1407
|
if (r == "]") {
|
|
1399
1408
|
if (t < 4) return e.kind = U.Incomplete, e;
|
|
1400
1409
|
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;
|
|
1401
|
-
this._osc_st ||=
|
|
1410
|
+
this._osc_st ||= Pn(In ||= jn(["\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;
|
|
1402
1411
|
{
|
|
1403
1412
|
let t = this._osc_st.exec(this._buffer);
|
|
1404
1413
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
@@ -1409,7 +1418,7 @@ var An = class {
|
|
|
1409
1418
|
if (t === null) return e.kind = U.Incomplete, e;
|
|
1410
1419
|
if (t[3]) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1411
1420
|
}
|
|
1412
|
-
this._osc_regex ||=
|
|
1421
|
+
this._osc_regex ||= Nn(Ln ||= jn(["\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 "]));
|
|
1413
1422
|
let n = this._buffer.match(this._osc_regex);
|
|
1414
1423
|
if (n === null) return e.kind = U.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
|
|
1415
1424
|
e.kind = U.OSCURL, e.url = n[1], e.text = n[2];
|
|
@@ -1494,15 +1503,15 @@ var An = class {
|
|
|
1494
1503
|
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>`;
|
|
1495
1504
|
}
|
|
1496
1505
|
};
|
|
1497
|
-
function
|
|
1506
|
+
function Nn(e, ...t) {
|
|
1498
1507
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1499
1508
|
return new RegExp(n);
|
|
1500
1509
|
}
|
|
1501
|
-
function
|
|
1510
|
+
function Pn(e, ...t) {
|
|
1502
1511
|
let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
|
|
1503
1512
|
return new RegExp(n, "g");
|
|
1504
1513
|
}
|
|
1505
|
-
var
|
|
1514
|
+
var Fn, In, Ln, Rn = new Mn();
|
|
1506
1515
|
function W(e) {
|
|
1507
1516
|
try {
|
|
1508
1517
|
let t = document.createElement("div");
|
|
@@ -1511,24 +1520,24 @@ function W(e) {
|
|
|
1511
1520
|
return t.error("Error parsing HTML content:", n), e;
|
|
1512
1521
|
}
|
|
1513
1522
|
}
|
|
1514
|
-
function
|
|
1523
|
+
function zn(e) {
|
|
1515
1524
|
if (!e) return "";
|
|
1516
1525
|
try {
|
|
1517
|
-
return W(
|
|
1526
|
+
return W(Rn.ansi_to_html(e));
|
|
1518
1527
|
} catch (n) {
|
|
1519
1528
|
return t.error("Error converting ANSI to plain text:", n), e;
|
|
1520
1529
|
}
|
|
1521
1530
|
}
|
|
1522
1531
|
//#endregion
|
|
1523
1532
|
//#region src/core/errors/traceback-atom.ts
|
|
1524
|
-
var
|
|
1533
|
+
var Bn = y(null);
|
|
1525
1534
|
//#endregion
|
|
1526
1535
|
//#region src/core/cells/logs.ts
|
|
1527
|
-
function
|
|
1536
|
+
function Vn(e) {
|
|
1528
1537
|
return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
|
|
1529
1538
|
}
|
|
1530
|
-
var
|
|
1531
|
-
function
|
|
1539
|
+
var Hn = !1;
|
|
1540
|
+
function Un(e) {
|
|
1532
1541
|
let t = [], n = [e.console].filter(Boolean).flat();
|
|
1533
1542
|
for (let r of n) {
|
|
1534
1543
|
let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
|
|
@@ -1553,9 +1562,9 @@ function Vn(e) {
|
|
|
1553
1562
|
}
|
|
1554
1563
|
}
|
|
1555
1564
|
}
|
|
1556
|
-
if (t.forEach(
|
|
1565
|
+
if (t.forEach(Wn.log), n.length === 0 && N(e.output?.mimetype) && Array.isArray(e.output.data)) {
|
|
1557
1566
|
e.output.data.forEach((t) => {
|
|
1558
|
-
|
|
1567
|
+
Wn.log({
|
|
1559
1568
|
level: "stderr",
|
|
1560
1569
|
source: {
|
|
1561
1570
|
type: "cell",
|
|
@@ -1565,18 +1574,18 @@ function Vn(e) {
|
|
|
1565
1574
|
message: JSON.stringify(t)
|
|
1566
1575
|
});
|
|
1567
1576
|
});
|
|
1568
|
-
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n =
|
|
1569
|
-
if (t.length > 0 && !
|
|
1570
|
-
|
|
1577
|
+
let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = w.get(he) === "read";
|
|
1578
|
+
if (t.length > 0 && !Hn && n) {
|
|
1579
|
+
Hn = !0;
|
|
1571
1580
|
let e = t.find((e) => e.traceback);
|
|
1572
1581
|
o(e ? {
|
|
1573
1582
|
title: "An internal error occurred",
|
|
1574
1583
|
description: e.msg || "Click 'View' to see traceback",
|
|
1575
1584
|
variant: "danger",
|
|
1576
|
-
action:
|
|
1585
|
+
action: E.createElement(oe, {
|
|
1577
1586
|
altText: "View traceback",
|
|
1578
1587
|
onClick: () => {
|
|
1579
|
-
|
|
1588
|
+
w.set(Bn, {
|
|
1580
1589
|
traceback: e.traceback,
|
|
1581
1590
|
errorMessage: e.msg || "An internal error occurred"
|
|
1582
1591
|
});
|
|
@@ -1591,13 +1600,13 @@ function Vn(e) {
|
|
|
1591
1600
|
}
|
|
1592
1601
|
return t;
|
|
1593
1602
|
}
|
|
1594
|
-
var
|
|
1603
|
+
var Wn = { log: (e) => {
|
|
1595
1604
|
let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
|
|
1596
|
-
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${
|
|
1605
|
+
console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Gn(e.timestamp)}]`, `(${Vn(e.source)}) ${e.message}`);
|
|
1597
1606
|
} };
|
|
1598
|
-
function
|
|
1607
|
+
function Gn(e) {
|
|
1599
1608
|
try {
|
|
1600
|
-
return
|
|
1609
|
+
return An(e).toLocaleTimeString(void 0, {
|
|
1601
1610
|
hour12: !0,
|
|
1602
1611
|
hour: "numeric",
|
|
1603
1612
|
minute: "numeric",
|
|
@@ -1609,14 +1618,14 @@ function Un(e) {
|
|
|
1609
1618
|
}
|
|
1610
1619
|
//#endregion
|
|
1611
1620
|
//#region src/components/editor/navigation/focus-utils.ts
|
|
1612
|
-
function
|
|
1613
|
-
let r = document.getElementById(
|
|
1614
|
-
r ?
|
|
1621
|
+
function Kn(e, n) {
|
|
1622
|
+
let r = document.getElementById(I.create(e));
|
|
1623
|
+
r ? Jn(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
|
|
1615
1624
|
}
|
|
1616
|
-
function
|
|
1625
|
+
function qn() {
|
|
1617
1626
|
return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
|
|
1618
1627
|
}
|
|
1619
|
-
function
|
|
1628
|
+
function Jn(e, n) {
|
|
1620
1629
|
try {
|
|
1621
1630
|
e.focus(n);
|
|
1622
1631
|
} catch {
|
|
@@ -1625,7 +1634,7 @@ function Kn(e, n) {
|
|
|
1625
1634
|
}
|
|
1626
1635
|
//#endregion
|
|
1627
1636
|
//#region src/utils/timeout.ts
|
|
1628
|
-
function
|
|
1637
|
+
function Yn(e, n) {
|
|
1629
1638
|
let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
|
|
1630
1639
|
if (o < r) {
|
|
1631
1640
|
try {
|
|
@@ -1640,76 +1649,76 @@ function qn(e, n) {
|
|
|
1640
1649
|
}
|
|
1641
1650
|
//#endregion
|
|
1642
1651
|
//#region src/core/cells/utils.ts
|
|
1643
|
-
function
|
|
1644
|
-
return
|
|
1652
|
+
function Xn(e, t, n) {
|
|
1653
|
+
return nr(e, t, n).length > 0;
|
|
1645
1654
|
}
|
|
1646
|
-
function
|
|
1655
|
+
function Zn(e) {
|
|
1647
1656
|
return e.cellIds.map((t) => e.cellData[t]);
|
|
1648
1657
|
}
|
|
1649
|
-
function
|
|
1658
|
+
function Qn(e) {
|
|
1650
1659
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1651
1660
|
for (let e of t) n[e].config.disabled && r.push(e);
|
|
1652
1661
|
return r;
|
|
1653
1662
|
}
|
|
1654
|
-
function
|
|
1663
|
+
function $n(e) {
|
|
1655
1664
|
let { cellIds: t, cellData: n } = e, r = [];
|
|
1656
1665
|
for (let e of t) n[e].config.disabled || r.push(e);
|
|
1657
1666
|
return r;
|
|
1658
1667
|
}
|
|
1659
|
-
function
|
|
1668
|
+
function er(e) {
|
|
1660
1669
|
return e.history.length > 0;
|
|
1661
1670
|
}
|
|
1662
|
-
function
|
|
1671
|
+
function tr(e) {
|
|
1663
1672
|
let t = e.history[e.history.length - 1];
|
|
1664
1673
|
return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
|
|
1665
1674
|
}
|
|
1666
|
-
function
|
|
1675
|
+
function nr(e, t, n) {
|
|
1667
1676
|
let { cellIds: r, cellData: i } = e;
|
|
1668
1677
|
return r.filter((e) => {
|
|
1669
|
-
let r =
|
|
1670
|
-
return r.status === "idle" ?
|
|
1678
|
+
let r = We(t, e);
|
|
1679
|
+
return r.status === "idle" ? ir(r) || ar({
|
|
1671
1680
|
freshness: n(e),
|
|
1672
1681
|
interrupted: r.outcome === "interrupted",
|
|
1673
1682
|
disabled: i[e].config.disabled,
|
|
1674
1683
|
blocked: r.blocked
|
|
1675
|
-
}) :
|
|
1684
|
+
}) : rr(t.executions, e) && n(e).sourceChanged;
|
|
1676
1685
|
});
|
|
1677
1686
|
}
|
|
1678
|
-
function
|
|
1687
|
+
function rr(e, t) {
|
|
1679
1688
|
let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
|
|
1680
1689
|
return r !== void 0 && r.status !== "completed";
|
|
1681
1690
|
}
|
|
1682
|
-
function
|
|
1691
|
+
function ir({ status: e, outcome: t }) {
|
|
1683
1692
|
return t === null && e !== "queued" && e !== "running";
|
|
1684
1693
|
}
|
|
1685
|
-
function
|
|
1694
|
+
function ar({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
|
|
1686
1695
|
return e.sourceChanged || t || e.inputsChanged && !(n || r);
|
|
1687
1696
|
}
|
|
1688
|
-
function
|
|
1697
|
+
function or({ errored: e, stopped: t }) {
|
|
1689
1698
|
return {
|
|
1690
1699
|
published: !0,
|
|
1691
1700
|
"has-error": e,
|
|
1692
1701
|
stopped: t
|
|
1693
1702
|
};
|
|
1694
1703
|
}
|
|
1695
|
-
function
|
|
1696
|
-
let a =
|
|
1704
|
+
function sr({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
|
|
1705
|
+
let a = N(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
|
|
1697
1706
|
return (e || t || n || a) && !o;
|
|
1698
1707
|
}
|
|
1699
1708
|
//#endregion
|
|
1700
1709
|
//#region src/core/network/requests.ts
|
|
1701
|
-
var
|
|
1702
|
-
function
|
|
1703
|
-
let e = _(
|
|
1704
|
-
return
|
|
1710
|
+
var cr = y(null);
|
|
1711
|
+
function lr() {
|
|
1712
|
+
let e = _(cr);
|
|
1713
|
+
return T(e, "useRequestClient() requires setting requestClientAtom."), e;
|
|
1705
1714
|
}
|
|
1706
|
-
function
|
|
1707
|
-
let e =
|
|
1708
|
-
return
|
|
1715
|
+
function ur() {
|
|
1716
|
+
let e = w.get(cr);
|
|
1717
|
+
return T(e, "getRequestClient() requires requestClientAtom to be set."), e;
|
|
1709
1718
|
}
|
|
1710
1719
|
//#endregion
|
|
1711
1720
|
//#region src/utils/storage/storage.ts
|
|
1712
|
-
var
|
|
1721
|
+
var dr = class {
|
|
1713
1722
|
store = /* @__PURE__ */ new Map();
|
|
1714
1723
|
get length() {
|
|
1715
1724
|
return this.store.size;
|
|
@@ -1730,16 +1739,16 @@ var lr = class {
|
|
|
1730
1739
|
this.store.set(e, t);
|
|
1731
1740
|
}
|
|
1732
1741
|
};
|
|
1733
|
-
function
|
|
1734
|
-
let { hasLocalStorage: e, hasSessionStorage: t } =
|
|
1735
|
-
return e ? window.localStorage : t ? window.sessionStorage : new
|
|
1742
|
+
function fr() {
|
|
1743
|
+
let { hasLocalStorage: e, hasSessionStorage: t } = ye();
|
|
1744
|
+
return e ? window.localStorage : t ? window.sessionStorage : new dr();
|
|
1736
1745
|
}
|
|
1737
|
-
var
|
|
1738
|
-
function
|
|
1739
|
-
return
|
|
1746
|
+
var pr = fr(), mr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, hr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, gr = /^data:image\//i, _r = ["avatars.githubusercontent.com"];
|
|
1747
|
+
function vr(e) {
|
|
1748
|
+
return gr.test(e) ? [{
|
|
1740
1749
|
type: "image",
|
|
1741
1750
|
url: e
|
|
1742
|
-
}] : e.split(
|
|
1751
|
+
}] : e.split(mr).filter((e) => e !== "").map((e) => mr.test(e) ? hr.test(e) || gr.test(e) || _r.some((t) => e.includes(t)) ? {
|
|
1743
1752
|
type: "image",
|
|
1744
1753
|
url: e
|
|
1745
1754
|
} : {
|
|
@@ -1752,48 +1761,48 @@ function gr(e) {
|
|
|
1752
1761
|
}
|
|
1753
1762
|
//#endregion
|
|
1754
1763
|
//#region src/utils/json/json-parser.ts
|
|
1755
|
-
var
|
|
1764
|
+
var yr = new RegExp(mr.source, "g");
|
|
1756
1765
|
BigInt.prototype.toJSON = function() {
|
|
1757
1766
|
return JSON.rawJSON(this.toString());
|
|
1758
1767
|
};
|
|
1759
|
-
function
|
|
1768
|
+
function br(e) {
|
|
1760
1769
|
try {
|
|
1761
|
-
return JSON.parse(e, (e, t) =>
|
|
1770
|
+
return JSON.parse(e, (e, t) => wr(t));
|
|
1762
1771
|
} catch {}
|
|
1763
1772
|
if (e == null || e === "") return {};
|
|
1764
1773
|
try {
|
|
1765
|
-
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 :
|
|
1774
|
+
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 : wr(t) : wr(t));
|
|
1766
1775
|
} catch {
|
|
1767
1776
|
return {};
|
|
1768
1777
|
}
|
|
1769
1778
|
}
|
|
1770
|
-
function
|
|
1779
|
+
function xr(e) {
|
|
1771
1780
|
if (e.length === 0) return "";
|
|
1772
1781
|
let t = Object.keys(e[0]);
|
|
1773
1782
|
return [
|
|
1774
1783
|
`| ${t.join(" | ")} |`,
|
|
1775
1784
|
`|${t.map(() => "---").join("|")}|`,
|
|
1776
|
-
...e.map((e) => `| ${t.map((t) =>
|
|
1785
|
+
...e.map((e) => `| ${t.map((t) => Sr(e[t])).join(" | ")} |`)
|
|
1777
1786
|
].join("\n");
|
|
1778
1787
|
}
|
|
1779
|
-
function
|
|
1788
|
+
function Sr(e) {
|
|
1780
1789
|
if (e == null) return "";
|
|
1781
|
-
if (Array.isArray(e) || typeof e == "object") return
|
|
1790
|
+
if (Array.isArray(e) || typeof e == "object") return Cr(JSON.stringify(e));
|
|
1782
1791
|
let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
|
|
1783
1792
|
t = t.replaceAll(n, (e) => {
|
|
1784
1793
|
let t = `__MDLINK_${i++}__`;
|
|
1785
1794
|
return r.set(t, e), t;
|
|
1786
|
-
}), t = t.replaceAll(
|
|
1795
|
+
}), t = t.replaceAll(yr, "[$1]($1)");
|
|
1787
1796
|
for (let [e, n] of r) t = t.replace(e, n);
|
|
1788
|
-
return
|
|
1797
|
+
return Cr(t);
|
|
1789
1798
|
}
|
|
1790
|
-
function
|
|
1799
|
+
function Cr(e) {
|
|
1791
1800
|
return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
|
|
1792
1801
|
}
|
|
1793
|
-
function
|
|
1802
|
+
function wr(e) {
|
|
1794
1803
|
return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
|
|
1795
1804
|
}
|
|
1796
|
-
var
|
|
1805
|
+
var Tr = new class {
|
|
1797
1806
|
getFilename() {
|
|
1798
1807
|
return this.getSearchParam("filename");
|
|
1799
1808
|
}
|
|
@@ -1820,39 +1829,39 @@ var Cr = new class {
|
|
|
1820
1829
|
}();
|
|
1821
1830
|
//#endregion
|
|
1822
1831
|
//#region src/core/dom/htmlUtils.ts
|
|
1823
|
-
function
|
|
1824
|
-
return
|
|
1832
|
+
function Er(e) {
|
|
1833
|
+
return br(e ?? "");
|
|
1825
1834
|
}
|
|
1826
|
-
function
|
|
1827
|
-
return
|
|
1835
|
+
function Dr(e) {
|
|
1836
|
+
return se.mapValues(e.dataset, (e) => typeof e == "string" ? Er(e) : e);
|
|
1828
1837
|
}
|
|
1829
|
-
function
|
|
1830
|
-
let n = e.parentElement ?
|
|
1831
|
-
return n && t.has(n) ? t.lookupValue(n) :
|
|
1838
|
+
function Or(e, t) {
|
|
1839
|
+
let n = e.parentElement ? L.parse(e.parentElement) : void 0;
|
|
1840
|
+
return n && t.has(n) ? t.lookupValue(n) : Er(e.dataset.initialValue);
|
|
1832
1841
|
}
|
|
1833
|
-
function
|
|
1842
|
+
function kr() {
|
|
1834
1843
|
if (x()) return document.title || null;
|
|
1835
|
-
if (
|
|
1836
|
-
let e =
|
|
1844
|
+
if (_e()) {
|
|
1845
|
+
let e = Tr.getFilename();
|
|
1837
1846
|
if (e) return e;
|
|
1838
1847
|
}
|
|
1839
1848
|
let e = document.querySelector("marimo-filename");
|
|
1840
|
-
|
|
1849
|
+
ge(e, "marimo-filename tag not found");
|
|
1841
1850
|
let t = e.innerHTML;
|
|
1842
1851
|
return t.length === 0 ? null : t;
|
|
1843
1852
|
}
|
|
1844
1853
|
//#endregion
|
|
1845
1854
|
//#region src/core/saving/file-state.ts
|
|
1846
|
-
var G = y(
|
|
1855
|
+
var G = y(kr());
|
|
1847
1856
|
y(null);
|
|
1848
|
-
var
|
|
1857
|
+
var Ar = y(null);
|
|
1849
1858
|
y(void 0);
|
|
1850
1859
|
//#endregion
|
|
1851
1860
|
//#region src/utils/storage/typed.ts
|
|
1852
|
-
var
|
|
1861
|
+
var jr = class {
|
|
1853
1862
|
defaultValue;
|
|
1854
1863
|
storage;
|
|
1855
|
-
constructor(e, t =
|
|
1864
|
+
constructor(e, t = pr) {
|
|
1856
1865
|
this.defaultValue = e, this.storage = t;
|
|
1857
1866
|
}
|
|
1858
1867
|
get(e) {
|
|
@@ -1869,11 +1878,11 @@ var kr = class {
|
|
|
1869
1878
|
remove(e) {
|
|
1870
1879
|
this.storage.removeItem(e);
|
|
1871
1880
|
}
|
|
1872
|
-
},
|
|
1881
|
+
}, Mr = class {
|
|
1873
1882
|
schema;
|
|
1874
1883
|
getDefaultValue;
|
|
1875
1884
|
storage;
|
|
1876
|
-
constructor(e, t, n =
|
|
1885
|
+
constructor(e, t, n = pr) {
|
|
1877
1886
|
this.schema = e, this.getDefaultValue = t, this.storage = n;
|
|
1878
1887
|
}
|
|
1879
1888
|
get(e) {
|
|
@@ -1892,15 +1901,15 @@ var kr = class {
|
|
|
1892
1901
|
remove(e) {
|
|
1893
1902
|
this.storage.removeItem(e);
|
|
1894
1903
|
}
|
|
1895
|
-
},
|
|
1904
|
+
}, Nr = class extends Mr {
|
|
1896
1905
|
filename;
|
|
1897
1906
|
unsubscribeFromFilename;
|
|
1898
1907
|
constructor(e, t, n) {
|
|
1899
|
-
let r =
|
|
1908
|
+
let r = w.get(G);
|
|
1900
1909
|
super(t, n), this.filename = r;
|
|
1901
1910
|
try {
|
|
1902
|
-
this.unsubscribeFromFilename =
|
|
1903
|
-
let t =
|
|
1911
|
+
this.unsubscribeFromFilename = w.sub(G, () => {
|
|
1912
|
+
let t = w.get(G);
|
|
1904
1913
|
this.handleFilenameChange(e, t);
|
|
1905
1914
|
});
|
|
1906
1915
|
} catch {
|
|
@@ -1958,7 +1967,7 @@ var kr = class {
|
|
|
1958
1967
|
In: "in",
|
|
1959
1968
|
As: "as",
|
|
1960
1969
|
Import: "import"
|
|
1961
|
-
},
|
|
1970
|
+
}, Pr = /* @__PURE__ */ new Set([
|
|
1962
1971
|
K.FunctionDefinition,
|
|
1963
1972
|
K.LambdaExpression,
|
|
1964
1973
|
K.ArrayComprehensionExpression,
|
|
@@ -1970,13 +1979,13 @@ var kr = class {
|
|
|
1970
1979
|
K.Comment, K.String, K.FormatString;
|
|
1971
1980
|
//#endregion
|
|
1972
1981
|
//#region src/core/codemirror/utils.ts
|
|
1973
|
-
function
|
|
1982
|
+
function Fr(e) {
|
|
1974
1983
|
e && e.dispatch({ selection: {
|
|
1975
1984
|
anchor: e.state.doc.length,
|
|
1976
1985
|
head: e.state.doc.length
|
|
1977
1986
|
} });
|
|
1978
1987
|
}
|
|
1979
|
-
function
|
|
1988
|
+
function Ir(e) {
|
|
1980
1989
|
let t = e.dom.closest(".marimo-cell");
|
|
1981
1990
|
t && requestAnimationFrame(() => {
|
|
1982
1991
|
t.scrollIntoView({
|
|
@@ -1988,29 +1997,29 @@ function Pr(e) {
|
|
|
1988
1997
|
}
|
|
1989
1998
|
//#endregion
|
|
1990
1999
|
//#region src/core/codemirror/go-to-definition/commands.ts
|
|
1991
|
-
var
|
|
1992
|
-
function
|
|
2000
|
+
var Lr = /* @__PURE__ */ new Set([K.ClassDefinition]);
|
|
2001
|
+
function Rr(e, t) {
|
|
1993
2002
|
requestAnimationFrame(() => {
|
|
1994
2003
|
e.focus(), e.dispatch({
|
|
1995
2004
|
selection: {
|
|
1996
2005
|
anchor: t,
|
|
1997
2006
|
head: t
|
|
1998
2007
|
},
|
|
1999
|
-
effects:
|
|
2008
|
+
effects: fe.scrollIntoView(t, { y: "center" })
|
|
2000
2009
|
});
|
|
2001
|
-
}),
|
|
2010
|
+
}), Ir(e);
|
|
2002
2011
|
}
|
|
2003
|
-
function
|
|
2004
|
-
let n =
|
|
2012
|
+
function zr(e, t) {
|
|
2013
|
+
let n = ue(e), r = null;
|
|
2005
2014
|
return n.iterate({ enter: (n) => {
|
|
2006
2015
|
if (r !== null) return !1;
|
|
2007
2016
|
if (n.name === K.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
|
|
2008
2017
|
if (n.name === K.Comment || n.name === K.String) return !1;
|
|
2009
2018
|
} }), r;
|
|
2010
2019
|
}
|
|
2011
|
-
function
|
|
2020
|
+
function Br(e, t) {
|
|
2012
2021
|
let n = [], r = e.resolveInner(t, 0);
|
|
2013
|
-
for (; r;)
|
|
2022
|
+
for (; r;) Pr.has(r.name) && (n.some((e) => e.type === K.FunctionDefinition || e.type === K.LambdaExpression) && r.name === K.ClassDefinition || n.push({
|
|
2014
2023
|
id: r.from,
|
|
2015
2024
|
type: r.name
|
|
2016
2025
|
})), r = r.parent;
|
|
@@ -2025,12 +2034,12 @@ function J(e, t, n) {
|
|
|
2025
2034
|
from: n
|
|
2026
2035
|
});
|
|
2027
2036
|
}
|
|
2028
|
-
function
|
|
2037
|
+
function Vr(e, t) {
|
|
2029
2038
|
if (e.firstChild()) do
|
|
2030
2039
|
t(e.node);
|
|
2031
2040
|
while (e.nextSibling());
|
|
2032
2041
|
}
|
|
2033
|
-
function
|
|
2042
|
+
function Hr(e, t) {
|
|
2034
2043
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t;
|
|
2035
2044
|
switch (e.name) {
|
|
2036
2045
|
case K.VariableName:
|
|
@@ -2041,13 +2050,13 @@ function Br(e, t) {
|
|
|
2041
2050
|
let n = e.node.cursor();
|
|
2042
2051
|
n.firstChild();
|
|
2043
2052
|
do
|
|
2044
|
-
|
|
2053
|
+
Hr(n, t);
|
|
2045
2054
|
while (n.nextSibling());
|
|
2046
2055
|
break;
|
|
2047
2056
|
}
|
|
2048
2057
|
}
|
|
2049
2058
|
}
|
|
2050
|
-
function
|
|
2059
|
+
function Ur(e, t) {
|
|
2051
2060
|
let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
|
|
2052
2061
|
o.firstChild();
|
|
2053
2062
|
do {
|
|
@@ -2059,18 +2068,18 @@ function Vr(e, t) {
|
|
|
2059
2068
|
while (e.nextSibling());
|
|
2060
2069
|
} while (o.nextSibling());
|
|
2061
2070
|
}
|
|
2062
|
-
function
|
|
2071
|
+
function Wr(e, t) {
|
|
2063
2072
|
let n = e.cursor();
|
|
2064
2073
|
n.firstChild();
|
|
2065
2074
|
let r = !1;
|
|
2066
2075
|
do
|
|
2067
2076
|
if (n.name === q.For) r = !0;
|
|
2068
2077
|
else if (r && n.name === q.In) break;
|
|
2069
|
-
else r &&
|
|
2078
|
+
else r && Hr(n, t);
|
|
2070
2079
|
while (n.nextSibling());
|
|
2071
2080
|
}
|
|
2072
|
-
function
|
|
2073
|
-
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l =
|
|
2081
|
+
function Gr(e, t) {
|
|
2082
|
+
let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = Pr.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
|
|
2074
2083
|
switch (s) {
|
|
2075
2084
|
case K.FunctionDefinition:
|
|
2076
2085
|
case K.ClassDefinition: {
|
|
@@ -2082,7 +2091,7 @@ function Ur(e, t) {
|
|
|
2082
2091
|
break;
|
|
2083
2092
|
}
|
|
2084
2093
|
while (t.nextSibling());
|
|
2085
|
-
s === K.FunctionDefinition &&
|
|
2094
|
+
s === K.FunctionDefinition && Ur(e, {
|
|
2086
2095
|
state: n,
|
|
2087
2096
|
variableName: r,
|
|
2088
2097
|
scopeId: c,
|
|
@@ -2091,7 +2100,7 @@ function Ur(e, t) {
|
|
|
2091
2100
|
break;
|
|
2092
2101
|
}
|
|
2093
2102
|
case K.LambdaExpression:
|
|
2094
|
-
|
|
2103
|
+
Ur(e, {
|
|
2095
2104
|
state: n,
|
|
2096
2105
|
variableName: r,
|
|
2097
2106
|
scopeId: c,
|
|
@@ -2103,7 +2112,7 @@ function Ur(e, t) {
|
|
|
2103
2112
|
case K.SetComprehensionExpression:
|
|
2104
2113
|
case K.ComprehensionExpression:
|
|
2105
2114
|
case K.ForStatement:
|
|
2106
|
-
|
|
2115
|
+
Wr(e, {
|
|
2107
2116
|
state: n,
|
|
2108
2117
|
variableName: r,
|
|
2109
2118
|
scopeId: u,
|
|
@@ -2121,7 +2130,7 @@ function Ur(e, t) {
|
|
|
2121
2130
|
let s = e.cursor();
|
|
2122
2131
|
s.firstChild();
|
|
2123
2132
|
do
|
|
2124
|
-
s.from < o &&
|
|
2133
|
+
s.from < o && Hr(s, {
|
|
2125
2134
|
state: n,
|
|
2126
2135
|
variableName: r,
|
|
2127
2136
|
scopeId: u,
|
|
@@ -2166,8 +2175,8 @@ function Ur(e, t) {
|
|
|
2166
2175
|
break;
|
|
2167
2176
|
}
|
|
2168
2177
|
}
|
|
2169
|
-
|
|
2170
|
-
|
|
2178
|
+
Vr(o, (e) => {
|
|
2179
|
+
Gr(e, {
|
|
2171
2180
|
state: n,
|
|
2172
2181
|
variableName: r,
|
|
2173
2182
|
scopeStack: l,
|
|
@@ -2175,27 +2184,27 @@ function Ur(e, t) {
|
|
|
2175
2184
|
});
|
|
2176
2185
|
});
|
|
2177
2186
|
}
|
|
2178
|
-
function
|
|
2179
|
-
let r =
|
|
2180
|
-
|
|
2187
|
+
function Kr(e, t, n) {
|
|
2188
|
+
let r = ue(e), i = [];
|
|
2189
|
+
Gr(r, {
|
|
2181
2190
|
state: e,
|
|
2182
2191
|
variableName: t,
|
|
2183
2192
|
scopeStack: [],
|
|
2184
2193
|
declarations: i
|
|
2185
2194
|
});
|
|
2186
2195
|
let a = Math.max(0, Math.min(n, e.doc.length));
|
|
2187
|
-
for (let e of
|
|
2188
|
-
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !
|
|
2196
|
+
for (let e of Br(r, a)) {
|
|
2197
|
+
let t = i.filter((t) => t.scopeId === e.id).filter((t) => !Lr.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
|
|
2189
2198
|
if (t) return t.from;
|
|
2190
2199
|
}
|
|
2191
2200
|
return null;
|
|
2192
2201
|
}
|
|
2193
|
-
function
|
|
2194
|
-
let { state: r } = e, i = n === void 0 ?
|
|
2195
|
-
return i !== null && (
|
|
2202
|
+
function qr(e, t, n) {
|
|
2203
|
+
let { state: r } = e, i = n === void 0 ? zr(r, t) : Kr(r, t, n);
|
|
2204
|
+
return i !== null && (Rr(e, i), !0);
|
|
2196
2205
|
}
|
|
2197
|
-
function
|
|
2198
|
-
return
|
|
2206
|
+
function Jr(e, t) {
|
|
2207
|
+
return Rr(e, e.state.doc.line(t).from), !0;
|
|
2199
2208
|
}
|
|
2200
2209
|
//#endregion
|
|
2201
2210
|
//#region src/core/notebook/replica/connection.ts
|
|
@@ -2205,7 +2214,7 @@ var Y = {
|
|
|
2205
2214
|
OPEN: "OPEN",
|
|
2206
2215
|
CLOSING: "CLOSING",
|
|
2207
2216
|
CLOSED: "CLOSED"
|
|
2208
|
-
},
|
|
2217
|
+
}, Yr = {
|
|
2209
2218
|
KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
|
|
2210
2219
|
KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
|
|
2211
2220
|
}, X = y({ state: Y.NOT_STARTED });
|
|
@@ -2213,11 +2222,11 @@ h(null, (e, t) => t === null ? null : {
|
|
|
2213
2222
|
phase: t.phase,
|
|
2214
2223
|
logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
|
|
2215
2224
|
});
|
|
2216
|
-
function
|
|
2217
|
-
return
|
|
2225
|
+
function Xr() {
|
|
2226
|
+
return ae(X, (e) => e.state === Y.OPEN);
|
|
2218
2227
|
}
|
|
2219
|
-
function
|
|
2220
|
-
return
|
|
2228
|
+
function Zr() {
|
|
2229
|
+
return me() ? Xr() : Promise.resolve();
|
|
2221
2230
|
}
|
|
2222
2231
|
y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) => {
|
|
2223
2232
|
let t = e(X);
|
|
@@ -2225,50 +2234,50 @@ y((e) => e(X).state === Y.CONNECTING), y((e) => e(X).state === Y.OPEN), y((e) =>
|
|
|
2225
2234
|
}), y((e) => e(X).state === Y.CLOSED), y((e) => e(X).state === Y.NOT_STARTED);
|
|
2226
2235
|
//#endregion
|
|
2227
2236
|
//#region src/components/ui/checkbox.tsx
|
|
2228
|
-
var
|
|
2229
|
-
let r = (0,
|
|
2237
|
+
var Qr = E.forwardRef((e, t) => {
|
|
2238
|
+
let r = (0, ft.c)(13), i, a;
|
|
2230
2239
|
r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
|
|
2231
2240
|
let o;
|
|
2232
2241
|
r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
|
|
2233
2242
|
let s;
|
|
2234
2243
|
r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
|
|
2235
2244
|
let c;
|
|
2236
|
-
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0,
|
|
2245
|
+
r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, D.jsx)(Ne, {
|
|
2237
2246
|
className: s,
|
|
2238
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0,
|
|
2247
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, D.jsx)(xe, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, D.jsx)(l, { className: "h-4 w-4" })
|
|
2239
2248
|
}), r[6] = a.checked, r[7] = c);
|
|
2240
2249
|
let u;
|
|
2241
|
-
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0,
|
|
2250
|
+
return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, D.jsx)(je, {
|
|
2242
2251
|
ref: t,
|
|
2243
2252
|
className: o,
|
|
2244
2253
|
...a,
|
|
2245
2254
|
children: c
|
|
2246
2255
|
}), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
|
|
2247
2256
|
});
|
|
2248
|
-
|
|
2257
|
+
Qr.displayName = je.displayName;
|
|
2249
2258
|
//#endregion
|
|
2250
2259
|
//#region src/core/cells/scrollCellIntoView.ts
|
|
2251
|
-
function
|
|
2260
|
+
function $r({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
|
|
2252
2261
|
if (!n) return;
|
|
2253
|
-
let o = document.getElementById(
|
|
2262
|
+
let o = document.getElementById(I.create(e));
|
|
2254
2263
|
if (!o) {
|
|
2255
2264
|
t.warn("scrollCellIntoView: element not found");
|
|
2256
2265
|
return;
|
|
2257
2266
|
}
|
|
2258
|
-
if (
|
|
2259
|
-
|
|
2267
|
+
if (qn()) {
|
|
2268
|
+
Jn(o);
|
|
2260
2269
|
return;
|
|
2261
2270
|
}
|
|
2262
|
-
if (r)
|
|
2271
|
+
if (r) Jn(o);
|
|
2263
2272
|
else {
|
|
2264
|
-
|
|
2273
|
+
kt.promote(e);
|
|
2265
2274
|
let r = n.current?.editorView;
|
|
2266
2275
|
if (!r) {
|
|
2267
2276
|
t.warn("scrollCellIntoView: editor not found", e);
|
|
2268
2277
|
return;
|
|
2269
2278
|
}
|
|
2270
2279
|
if (r.hasFocus || !document.hasFocus()) return;
|
|
2271
|
-
if (
|
|
2280
|
+
if (Yn(() => (r.focus(), r.hasFocus), {
|
|
2272
2281
|
retries: 5,
|
|
2273
2282
|
delay: 20
|
|
2274
2283
|
}), i === "top") r.dispatch({ selection: {
|
|
@@ -2281,28 +2290,28 @@ function Zr({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a
|
|
|
2281
2290
|
anchor: e.from,
|
|
2282
2291
|
head: e.from
|
|
2283
2292
|
} });
|
|
2284
|
-
} else a &&
|
|
2293
|
+
} else a && qr(r, a);
|
|
2285
2294
|
}
|
|
2286
2295
|
o.scrollIntoView({
|
|
2287
2296
|
behavior: "smooth",
|
|
2288
2297
|
block: "nearest"
|
|
2289
2298
|
});
|
|
2290
2299
|
}
|
|
2291
|
-
function
|
|
2300
|
+
function ei() {
|
|
2292
2301
|
let e = document.getElementById("App");
|
|
2293
2302
|
e?.scrollTo({
|
|
2294
2303
|
top: e.scrollHeight,
|
|
2295
2304
|
behavior: "smooth"
|
|
2296
2305
|
});
|
|
2297
2306
|
}
|
|
2298
|
-
function
|
|
2307
|
+
function ti() {
|
|
2299
2308
|
document.getElementById("App")?.scrollTo({
|
|
2300
2309
|
top: 0,
|
|
2301
2310
|
behavior: "smooth"
|
|
2302
2311
|
});
|
|
2303
2312
|
}
|
|
2304
|
-
function
|
|
2305
|
-
let t = document.getElementById(
|
|
2313
|
+
function ni(e) {
|
|
2314
|
+
let t = document.getElementById(I.create(e));
|
|
2306
2315
|
return t?.scrollIntoView({
|
|
2307
2316
|
behavior: "smooth",
|
|
2308
2317
|
block: "center"
|
|
@@ -2310,7 +2319,7 @@ function ei(e) {
|
|
|
2310
2319
|
}
|
|
2311
2320
|
//#endregion
|
|
2312
2321
|
//#region src/core/cells/cells.ts
|
|
2313
|
-
function
|
|
2322
|
+
function ri(e) {
|
|
2314
2323
|
let t = {
|
|
2315
2324
|
column: 0,
|
|
2316
2325
|
hide_code: !1,
|
|
@@ -2320,24 +2329,24 @@ function ti(e) {
|
|
|
2320
2329
|
return {
|
|
2321
2330
|
...e,
|
|
2322
2331
|
cellData: {
|
|
2323
|
-
[
|
|
2324
|
-
id:
|
|
2332
|
+
[F]: Sn({
|
|
2333
|
+
id: F,
|
|
2325
2334
|
config: t
|
|
2326
2335
|
}),
|
|
2327
2336
|
...e.cellData
|
|
2328
2337
|
},
|
|
2329
2338
|
cellRuntime: {
|
|
2330
|
-
[
|
|
2339
|
+
[F]: V(),
|
|
2331
2340
|
...e.cellRuntime
|
|
2332
2341
|
},
|
|
2333
2342
|
cellHandles: {
|
|
2334
|
-
[
|
|
2343
|
+
[F]: (0, E.createRef)(),
|
|
2335
2344
|
...e.cellHandles
|
|
2336
2345
|
}
|
|
2337
2346
|
};
|
|
2338
2347
|
}
|
|
2339
|
-
function
|
|
2340
|
-
return
|
|
2348
|
+
function ii() {
|
|
2349
|
+
return ri({
|
|
2341
2350
|
cellIds: [],
|
|
2342
2351
|
cellData: {},
|
|
2343
2352
|
cellRuntime: {},
|
|
@@ -2347,7 +2356,7 @@ function ni() {
|
|
|
2347
2356
|
cellLogs: []
|
|
2348
2357
|
});
|
|
2349
2358
|
}
|
|
2350
|
-
var { reducer:
|
|
2359
|
+
var { reducer: ai, createActions: oi, useActions: si, valueAtom: Z } = le(ii, {
|
|
2351
2360
|
prepareForRun: (e, t) => Q({
|
|
2352
2361
|
state: e,
|
|
2353
2362
|
cellId: t.cellId,
|
|
@@ -2360,11 +2369,11 @@ var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
|
2360
2369
|
let n = t.cell_id, r = Q({
|
|
2361
2370
|
state: e,
|
|
2362
2371
|
cellId: n,
|
|
2363
|
-
cellReducer: (e) =>
|
|
2372
|
+
cellReducer: (e) => Ut(e, t)
|
|
2364
2373
|
});
|
|
2365
2374
|
return {
|
|
2366
2375
|
...r,
|
|
2367
|
-
cellLogs: [...r.cellLogs, ...
|
|
2376
|
+
cellLogs: [...r.cellLogs, ...Un(t)]
|
|
2368
2377
|
};
|
|
2369
2378
|
},
|
|
2370
2379
|
addLogs: (e, t) => ({
|
|
@@ -2372,8 +2381,8 @@ var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
|
2372
2381
|
cellLogs: [...e.cellLogs, ...t.logs]
|
|
2373
2382
|
}),
|
|
2374
2383
|
reconcileDocument: (e, t) => {
|
|
2375
|
-
let n =
|
|
2376
|
-
for (let t of e.cellIds) t in n.cellData ||
|
|
2384
|
+
let n = Tn(e, t);
|
|
2385
|
+
for (let t of e.cellIds) t in n.cellData || Si(t);
|
|
2377
2386
|
return n;
|
|
2378
2387
|
},
|
|
2379
2388
|
setStdinResponse: (e, n) => {
|
|
@@ -2399,10 +2408,10 @@ var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
|
2399
2408
|
});
|
|
2400
2409
|
},
|
|
2401
2410
|
resetCellRuntimes: (e) => {
|
|
2402
|
-
let t =
|
|
2403
|
-
for (let r of [...e.cellIds,
|
|
2411
|
+
let t = _e(), n = { ...e.cellRuntime };
|
|
2412
|
+
for (let r of [...e.cellIds, F]) {
|
|
2404
2413
|
let i = e.cellRuntime[r];
|
|
2405
|
-
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i :
|
|
2414
|
+
n[r] = t && i !== void 0 && (i.output != null || i.consoleOutputs.length > 0) ? i : V();
|
|
2406
2415
|
}
|
|
2407
2416
|
return {
|
|
2408
2417
|
...e,
|
|
@@ -2413,10 +2422,10 @@ var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
|
2413
2422
|
let t = e.scrollKey;
|
|
2414
2423
|
if (t === null) return e;
|
|
2415
2424
|
let n = t;
|
|
2416
|
-
return
|
|
2425
|
+
return $r({
|
|
2417
2426
|
cellId: n,
|
|
2418
2427
|
cell: e.cellHandles[n],
|
|
2419
|
-
isCodeHidden:
|
|
2428
|
+
isCodeHidden: On(e.cellData[n]?.config.hide_code, w.get(H), n),
|
|
2420
2429
|
codeFocus: void 0,
|
|
2421
2430
|
variableName: void 0
|
|
2422
2431
|
}), {
|
|
@@ -2424,8 +2433,8 @@ var { reducer: ri, createActions: ii, useActions: ai, valueAtom: Z } = se(ni, {
|
|
|
2424
2433
|
scrollKey: null
|
|
2425
2434
|
};
|
|
2426
2435
|
},
|
|
2427
|
-
foldAll: (e) => (
|
|
2428
|
-
unfoldAll: (e) => (
|
|
2436
|
+
foldAll: (e) => (wt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2437
|
+
unfoldAll: (e) => (Tt(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
|
|
2429
2438
|
clearLogs: (e) => ({
|
|
2430
2439
|
...e,
|
|
2431
2440
|
cellLogs: []
|
|
@@ -2475,16 +2484,16 @@ function Q({ state: e, cellId: n, cellReducer: r }) {
|
|
|
2475
2484
|
}
|
|
2476
2485
|
} : (t.warn(`Cell ${n} not found in state`), e);
|
|
2477
2486
|
}
|
|
2478
|
-
var
|
|
2479
|
-
|
|
2487
|
+
var ci = oi((e) => {
|
|
2488
|
+
w.set(Z, (t) => ai(t, e));
|
|
2480
2489
|
}).addLogs, $ = y((e) => e(Z).cellIds);
|
|
2481
|
-
y((e) => e($).length === 1), y((e) =>
|
|
2482
|
-
var
|
|
2490
|
+
y((e) => e($).length === 1), y((e) => Qn(e(Z)).length > 0), y((e) => $n(e(Z)).length > 0), y((e) => er(e(Z))), y((e) => tr(e(Z))), y((e) => Xn(e(Z), e(M), e(at)));
|
|
2491
|
+
var li = y((e) => {
|
|
2483
2492
|
let { cellIds: t, cellRuntime: n, cellData: r } = e(Z);
|
|
2484
2493
|
return t.map((e) => {
|
|
2485
2494
|
let t = n[e], { name: i } = r[e];
|
|
2486
|
-
if (
|
|
2487
|
-
|
|
2495
|
+
if (N(t.output?.mimetype)) {
|
|
2496
|
+
T(Array.isArray(t.output.data), "Expected array data");
|
|
2488
2497
|
let n = t.output.data.filter((e) => !e.type.includes("ancestor"));
|
|
2489
2498
|
if (n.length > 0) return {
|
|
2490
2499
|
output: {
|
|
@@ -2497,90 +2506,90 @@ var si = y((e) => {
|
|
|
2497
2506
|
}
|
|
2498
2507
|
return null;
|
|
2499
2508
|
}).filter(Boolean);
|
|
2500
|
-
}),
|
|
2509
|
+
}), ui = ie(y((e) => {
|
|
2501
2510
|
let t = {};
|
|
2502
|
-
for (let [n, r] of
|
|
2511
|
+
for (let [n, r] of se.entries(e(Z).cellRuntime)) r.outline !== null && r.outline.items.length > 0 && (t[n] = r.outline);
|
|
2503
2512
|
return t;
|
|
2504
|
-
})),
|
|
2505
|
-
let t = e($), n = e(
|
|
2506
|
-
return
|
|
2513
|
+
})), di = y((e) => {
|
|
2514
|
+
let t = e($), n = e(vi);
|
|
2515
|
+
return yt(t.map((e) => n[e].outline));
|
|
2507
2516
|
});
|
|
2508
|
-
y((e) => e(
|
|
2509
|
-
var
|
|
2517
|
+
y((e) => e(li).length);
|
|
2518
|
+
var fi = ie(y((e) => {
|
|
2510
2519
|
let { cellIds: t, cellData: n } = e(Z);
|
|
2511
|
-
return
|
|
2520
|
+
return se.fromEntries(t.map((e) => [e, n[e]?.name]));
|
|
2512
2521
|
}));
|
|
2513
2522
|
y((e) => e(Z).scrollKey);
|
|
2514
|
-
var
|
|
2515
|
-
let { cellIds: e, cellData: t } =
|
|
2523
|
+
var pi = () => _($), mi = () => _(fi), hi = () => w.get(Z), gi = () => w.get(Z).cellIds, _i = () => {
|
|
2524
|
+
let { cellIds: e, cellData: t } = w.get(Z);
|
|
2516
2525
|
return e.map((e) => t[e]?.name).filter(Boolean);
|
|
2517
2526
|
};
|
|
2518
|
-
|
|
2519
|
-
var
|
|
2527
|
+
S(p(Z, (e) => e.cellIds.map((t) => e.cellData[t])));
|
|
2528
|
+
var vi = y((e) => e(Z).cellRuntime);
|
|
2520
2529
|
y((e) => e(Z).cellIds.length > 0);
|
|
2521
|
-
var
|
|
2522
|
-
function
|
|
2523
|
-
|
|
2530
|
+
var yi = g((e) => y((t) => t(Z).cellData[e])), bi = g((e) => y((t) => t(Z).cellRuntime[e])), xi = g((e) => y((t) => t(Z).cellHandles[e]));
|
|
2531
|
+
function Si(e) {
|
|
2532
|
+
yi.remove(e), bi.remove(e), xi.remove(e), lt(w, [e]);
|
|
2524
2533
|
}
|
|
2525
|
-
var
|
|
2526
|
-
let { cellHandles: t } =
|
|
2534
|
+
var Ci = (e) => {
|
|
2535
|
+
let { cellHandles: t } = w.get(Z);
|
|
2527
2536
|
return t[e].current?.editorView;
|
|
2528
|
-
},
|
|
2529
|
-
function
|
|
2530
|
-
return
|
|
2537
|
+
}, wi = (e) => (kt.promote(e), Ci(e));
|
|
2538
|
+
function Ti() {
|
|
2539
|
+
return si();
|
|
2531
2540
|
}
|
|
2532
2541
|
//#endregion
|
|
2533
2542
|
//#region src/core/errors/error-entries.ts
|
|
2534
|
-
function
|
|
2535
|
-
if (
|
|
2543
|
+
function Ei(e) {
|
|
2544
|
+
if (At(e.mimetype)) {
|
|
2536
2545
|
if (!Array.isArray(e.data)) return null;
|
|
2537
2546
|
let t = e.data.filter((e) => !e.type.includes("ancestor"));
|
|
2538
2547
|
return t.length === 0 ? null : { errorData: t };
|
|
2539
2548
|
}
|
|
2540
|
-
return
|
|
2549
|
+
return jt(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
|
|
2541
2550
|
errorData: [],
|
|
2542
2551
|
tracebackHtml: e.data
|
|
2543
2552
|
} : null;
|
|
2544
2553
|
}
|
|
2545
|
-
function
|
|
2554
|
+
function Di(e) {
|
|
2546
2555
|
return e.some((e) => "traceback" in e && e.traceback);
|
|
2547
2556
|
}
|
|
2548
|
-
function
|
|
2549
|
-
let t = e?.find((e) =>
|
|
2557
|
+
function Oi(e) {
|
|
2558
|
+
let t = e?.find((e) => jt(e.mimetype));
|
|
2550
2559
|
if (!(!t || typeof t.data != "string" || t.data.length === 0)) return t.data;
|
|
2551
2560
|
}
|
|
2552
|
-
function
|
|
2561
|
+
function ki(e, t) {
|
|
2553
2562
|
if (e.tracebackHtml) return e.tracebackHtml;
|
|
2554
|
-
if (!
|
|
2563
|
+
if (!Di(e.errorData)) return Oi(t);
|
|
2555
2564
|
}
|
|
2556
|
-
function
|
|
2565
|
+
function Ai(e) {
|
|
2557
2566
|
let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Z), i = [];
|
|
2558
2567
|
for (let [e, a] of t.entries()) {
|
|
2559
2568
|
let t = n[a], o = t.output;
|
|
2560
|
-
if (!o || !
|
|
2561
|
-
let s =
|
|
2569
|
+
if (!o || !N(o.mimetype)) continue;
|
|
2570
|
+
let s = Ei(o);
|
|
2562
2571
|
if (!s) continue;
|
|
2563
|
-
let c =
|
|
2572
|
+
let c = bn(r[a].name, e), l = o.code ?? r[a].code;
|
|
2564
2573
|
i.push({
|
|
2565
2574
|
cellId: a,
|
|
2566
2575
|
cellName: c,
|
|
2567
2576
|
cellCode: l,
|
|
2568
2577
|
errorData: s.errorData,
|
|
2569
|
-
tracebackHtml:
|
|
2578
|
+
tracebackHtml: ki(s, t.consoleOutputs)
|
|
2570
2579
|
});
|
|
2571
2580
|
}
|
|
2572
2581
|
return i;
|
|
2573
2582
|
}
|
|
2574
|
-
function
|
|
2583
|
+
function ji(e) {
|
|
2575
2584
|
return e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
|
|
2576
2585
|
}
|
|
2577
|
-
function
|
|
2578
|
-
let t =
|
|
2586
|
+
function Mi(e) {
|
|
2587
|
+
let t = ji(e);
|
|
2579
2588
|
return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${W(e.traceback)}`), t;
|
|
2580
2589
|
}
|
|
2581
|
-
function
|
|
2590
|
+
function Ni(e) {
|
|
2582
2591
|
let t = [e.cellName];
|
|
2583
|
-
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(
|
|
2592
|
+
return e.tracebackHtml && t.push(W(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(Mi).join("\n\n")), t.join("\n\n");
|
|
2584
2593
|
}
|
|
2585
2594
|
//#endregion
|
|
2586
|
-
export {
|
|
2595
|
+
export { Kn as $, Yr as A, tn as At, Dr as B, at as Bt, ei as C, un as Ct, X as D, F as Dt, Qr as E, I as Et, jr as F, Gt as Ft, pr as G, be as Gt, br as H, st as Ht, Mr as I, xt as It, lr as J, ur as K, G as L, vt as Lt, Jr as M, Yt as Mt, Fr as N, Kt as Nt, Xr as O, $t as Ot, Nr as P, Wt as Pt, sr as Q, Ar as R, pt as Rt, $r as S, dn as St, ti as T, nn as Tt, xr as U, We as Ut, Or as V, dt as Vt, vr as W, xe as Wt, Zn as X, ir as Y, or as Z, ai as _, mn as _t, ci as a, H as at, mi as b, B as bt, oi as c, bn as ct, _i as d, vn as dt, zn as et, gi as f, rn as ft, di as g, fn as gt, Z as h, z as ht, Ai as i, kn as it, Y as j, Jt as jt, Zr as k, L as kt, wi as l, yn as lt, ii as m, pn as mt, Ni as n, Mn as nt, yi as o, Dn as ot, hi as p, R as pt, cr as q, Mi as r, On as rt, $ as s, En as st, ji as t, W as tt, Ci as u, xn as ut, Si as v, gn as vt, ni as w, en as wt, Ti as x, an as xt, pi as y, hn as yt, Er as z, M as zt };
|